All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
       [not found] <4fb35a7e.2458b40a.3ed6.649cSMTPIN_ADDED@mx.google.com>
@ 2012-05-16  8:16 ` dunrong huang
  2012-05-16 10:16   ` Pavel Dovgaluk
  0 siblings, 1 reply; 8+ messages in thread
From: dunrong huang @ 2012-05-16  8:16 UTC (permalink / raw)
  To: Pavel Dovgaluk; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

What's the difference of these two method to call bdrv_close_all?

If you close qemu window, the main_loop will return immediately, and call
bdrv_close_all.

2012/5/16 Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>

> Prevent disk data loss when closing qemu window.
>
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
> ---
>  vl.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 23ab3a3..b6cfd29 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3650,10 +3650,10 @@ int main(int argc, char **argv, char **envp)
>     }
>
>     os_setup_post();
> +    atexit(bdrv_close_all);
>
>     resume_all_vcpus();
>     main_loop();
> -    bdrv_close_all();
>     pause_all_vcpus();
>     net_cleanup();
>     res_free();
>
>
>
>
>


-- 
linuxer and emacser and pythoner living in beijing
blog: http://mathslinux.org
twitter: https://twitter.com/mathslinux
google+: https://plus.google.com/118129852578326338750

[-- Attachment #2: Type: text/html, Size: 1585 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
  2012-05-16  8:16 ` [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu dunrong huang
@ 2012-05-16 10:16   ` Pavel Dovgaluk
  2012-05-22  8:51     ` Kevin Wolf
  0 siblings, 1 reply; 8+ messages in thread
From: Pavel Dovgaluk @ 2012-05-16 10:16 UTC (permalink / raw)
  To: 'dunrong huang'; +Cc: 'qemu-devel'

I use qemu under Windows and it has two windows when executes - console and SDL ones.
When I close SDL window main loop function terminates correctly, and when I close 
console window to terminate qemu then the code after main loop is not executed.

Pavel Dovgaluk

From: dunrong huang [mailto:riegamaths@gmail.com] 
Sent: Wednesday, May 16, 2012 12:17 PM
To: Pavel Dovgaluk
Cc: qemu-devel
Subject: Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu

What's the difference of these two method to call bdrv_close_all?

If you close qemu window, the main_loop will return immediately, and call bdrv_close_all.
2012/5/16 Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
Prevent disk data loss when closing qemu window.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vl.c b/vl.c
index 23ab3a3..b6cfd29 100644
--- a/vl.c
+++ b/vl.c
@@ -3650,10 +3650,10 @@ int main(int argc, char **argv, char **envp)
    }

    os_setup_post();
+    atexit(bdrv_close_all);

    resume_all_vcpus();
    main_loop();
-    bdrv_close_all();
    pause_all_vcpus();
    net_cleanup();
    res_free();






-- 
linuxer and emacser and pythoner living in beijing
blog: http://mathslinux.org
twitter: https://twitter.com/mathslinux
google+: https://plus.google.com/118129852578326338750

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
  2012-05-16 10:16   ` Pavel Dovgaluk
@ 2012-05-22  8:51     ` Kevin Wolf
  2012-05-22  9:25       ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Wolf @ 2012-05-22  8:51 UTC (permalink / raw)
  To: Pavel Dovgaluk
  Cc: Anthony Liguori, 'qemu-devel', 'dunrong huang'

Am 16.05.2012 12:16, schrieb Pavel Dovgaluk:
> I use qemu under Windows and it has two windows when executes - console and SDL ones.
> When I close SDL window main loop function terminates correctly, and when I close 
> console window to terminate qemu then the code after main loop is not executed.

Is there no way to catch this case and use the regular shutdown
mechanism there as well?

I'm not against your patch and it's probably 1.1 material, but there may
be more shutdown logic that we're missing if you close the console window.

Kevin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
  2012-05-22  8:51     ` Kevin Wolf
@ 2012-05-22  9:25       ` Paolo Bonzini
  2012-05-23  6:48         ` Pavel Dovgaluk
       [not found]         ` <3123.31610261953$1337755763@news.gmane.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Paolo Bonzini @ 2012-05-22  9:25 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: 'dunrong huang',
	Anthony Liguori, Pavel Dovgaluk, 'qemu-devel'

Il 22/05/2012 10:51, Kevin Wolf ha scritto:
> Am 16.05.2012 12:16, schrieb Pavel Dovgaluk:
>> I use qemu under Windows and it has two windows when executes - console and SDL ones.
>> When I close SDL window main loop function terminates correctly, and when I close 
>> console window to terminate qemu then the code after main loop is not executed.
> 
> Is there no way to catch this case and use the regular shutdown
> mechanism there as well?
> 
> I'm not against your patch and it's probably 1.1 material, but there may
> be more shutdown logic that we're missing if you close the console window.

Looks like qemu_ctrl_handler (in os-win32.c) needs to do something like
termsig_handler (in os-posix.c) instead of a plain exit.

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
  2012-05-22  9:25       ` Paolo Bonzini
@ 2012-05-23  6:48         ` Pavel Dovgaluk
       [not found]         ` <3123.31610261953$1337755763@news.gmane.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Pavel Dovgaluk @ 2012-05-23  6:48 UTC (permalink / raw)
  To: 'Paolo Bonzini', 'Kevin Wolf'
  Cc: 'dunrong huang', 'qemu-devel', 'Anthony Liguori'

> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
> Il 22/05/2012 10:51, Kevin Wolf ha scritto:
> > Am 16.05.2012 12:16, schrieb Pavel Dovgaluk:
> >> I use qemu under Windows and it has two windows when executes - console and SDL ones.
> >> When I close SDL window main loop function terminates correctly, and when I close
> >> console window to terminate qemu then the code after main loop is not executed.
> >
> > Is there no way to catch this case and use the regular shutdown
> > mechanism there as well?
> >
> > I'm not against your patch and it's probably 1.1 material, but there may
> > be more shutdown logic that we're missing if you close the console window.
> 
> Looks like qemu_ctrl_handler (in os-win32.c) needs to do something like
> termsig_handler (in os-posix.c) instead of a plain exit.

  I tried to call qemu_system_shutdown_request() instead of exit() there, but Windows kills qemu
before it finishes cleanup work.

Pavel Dovgaluk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
       [not found]         ` <3123.31610261953$1337755763@news.gmane.org>
@ 2012-05-23  7:03           ` Paolo Bonzini
  2012-05-24  7:41             ` Pavel Dovgaluk
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2012-05-23  7:03 UTC (permalink / raw)
  To: Pavel Dovgaluk
  Cc: 'Kevin Wolf', 'Anthony Liguori',
	'qemu-devel', 'dunrong huang'

Il 23/05/2012 08:48, Pavel Dovgaluk ha scritto:
>>> > > I'm not against your patch and it's probably 1.1 material, but there may
>>> > > be more shutdown logic that we're missing if you close the console window.
>> > 
>> > Looks like qemu_ctrl_handler (in os-win32.c) needs to do something like
>> > termsig_handler (in os-posix.c) instead of a plain exit.
>   I tried to call qemu_system_shutdown_request() instead of exit() there, but Windows kills qemu
> before it finishes cleanup work.

Uff...
http://stackoverflow.com/questions/3640633/c-setconsolectrlhandler-routine-issue
says more or less what you have to do.

Paolo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
  2012-05-23  7:03           ` Paolo Bonzini
@ 2012-05-24  7:41             ` Pavel Dovgaluk
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Dovgaluk @ 2012-05-24  7:41 UTC (permalink / raw)
  To: 'Paolo Bonzini'
  Cc: 'Kevin Wolf', 'Anthony Liguori',
	'qemu-devel', 'dunrong huang'

> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
> Il 23/05/2012 08:48, Pavel Dovgaluk ha scritto:
> >>> > > I'm not against your patch and it's probably 1.1 material, but there may
> >>> > > be more shutdown logic that we're missing if you close the console window.
> >> >
> >> > Looks like qemu_ctrl_handler (in os-win32.c) needs to do something like
> >> > termsig_handler (in os-posix.c) instead of a plain exit.
> >   I tried to call qemu_system_shutdown_request() instead of exit() there, but Windows kills
> qemu
> > before it finishes cleanup work.
> 
> Uff...
> http://stackoverflow.com/questions/3640633/c-setconsolectrlhandler-routine-issue
> says more or less what you have to do.

  Thank you!
  I have prepared another patch based on this information.

Pavel Dovgaluk

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu
@ 2012-05-16  7:42 Pavel Dovgaluk
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Dovgaluk @ 2012-05-16  7:42 UTC (permalink / raw)
  To: 'qemu-devel'

Prevent disk data loss when closing qemu window.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vl.c b/vl.c
index 23ab3a3..b6cfd29 100644
--- a/vl.c
+++ b/vl.c
@@ -3650,10 +3650,10 @@ int main(int argc, char **argv, char **envp)
     }
 
     os_setup_post();
+    atexit(bdrv_close_all);
 
     resume_all_vcpus();
     main_loop();
-    bdrv_close_all();
     pause_all_vcpus();
     net_cleanup();
     res_free();

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-05-24  7:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4fb35a7e.2458b40a.3ed6.649cSMTPIN_ADDED@mx.google.com>
2012-05-16  8:16 ` [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu dunrong huang
2012-05-16 10:16   ` Pavel Dovgaluk
2012-05-22  8:51     ` Kevin Wolf
2012-05-22  9:25       ` Paolo Bonzini
2012-05-23  6:48         ` Pavel Dovgaluk
     [not found]         ` <3123.31610261953$1337755763@news.gmane.org>
2012-05-23  7:03           ` Paolo Bonzini
2012-05-24  7:41             ` Pavel Dovgaluk
2012-05-16  7:42 Pavel Dovgaluk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.