* [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return
@ 2010-05-12 17:52 Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 1/3] Revert "Monitor: Return before exiting with 'quit'" Luiz Capitulino
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-05-12 17:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Right after when 0e8d2b55 was merged, Paolo suggested using
qemu_system_shutdown_request() instead of adding yet another 'system request'
operation.
This series implements his suggestion, passes my tests :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/3] Revert "Monitor: Return before exiting with 'quit'"
2010-05-12 17:52 [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return Luiz Capitulino
@ 2010-05-12 17:52 ` Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 2/3] sysemu: Export 'no_shutdown' Luiz Capitulino
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-05-12 17:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
This reverts commit 0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d.
Next commits will do the same thing in a better way.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
monitor.c | 3 +--
sysemu.h | 2 --
vl.c | 18 ------------------
3 files changed, 1 insertions(+), 22 deletions(-)
diff --git a/monitor.c b/monitor.c
index 4c95d7b..e984122 100644
--- a/monitor.c
+++ b/monitor.c
@@ -942,8 +942,7 @@ static void do_info_cpu_stats(Monitor *mon)
*/
static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- monitor_suspend(mon);
- qemu_system_exit_request();
+ exit(0);
return 0;
}
diff --git a/sysemu.h b/sysemu.h
index 47975b5..fcfccdf 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -45,11 +45,9 @@ void cpu_disable_ticks(void);
void qemu_system_reset_request(void);
void qemu_system_shutdown_request(void);
void qemu_system_powerdown_request(void);
-void qemu_system_exit_request(void);
int qemu_shutdown_requested(void);
int qemu_reset_requested(void);
int qemu_powerdown_requested(void);
-int qemu_exit_requested(void);
extern qemu_irq qemu_system_powerdown;
void qemu_system_reset(void);
diff --git a/vl.c b/vl.c
index 85bcc84..791564a 100644
--- a/vl.c
+++ b/vl.c
@@ -1708,7 +1708,6 @@ static int shutdown_requested;
static int powerdown_requested;
int debug_requested;
int vmstop_requested;
-static int exit_requested;
int qemu_shutdown_requested(void)
{
@@ -1731,12 +1730,6 @@ int qemu_powerdown_requested(void)
return r;
}
-int qemu_exit_requested(void)
-{
- /* just return it, we'll exit() anyway */
- return exit_requested;
-}
-
static int qemu_debug_requested(void)
{
int r = debug_requested;
@@ -1807,12 +1800,6 @@ void qemu_system_powerdown_request(void)
qemu_notify_event();
}
-void qemu_system_exit_request(void)
-{
- exit_requested = 1;
- qemu_notify_event();
-}
-
#ifdef _WIN32
static void host_main_loop_wait(int *timeout)
{
@@ -1949,8 +1936,6 @@ static int vm_can_run(void)
return 0;
if (debug_requested)
return 0;
- if (exit_requested)
- return 0;
return 1;
}
@@ -2003,9 +1988,6 @@ static void main_loop(void)
if ((r = qemu_vmstop_requested())) {
vm_stop(r);
}
- if (qemu_exit_requested()) {
- exit(0);
- }
}
pause_all_vcpus();
}
--
1.7.1.11.g3bf78
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/3] sysemu: Export 'no_shutdown'
2010-05-12 17:52 [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 1/3] Revert "Monitor: Return before exiting with 'quit'" Luiz Capitulino
@ 2010-05-12 17:52 ` Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 3/3] Monitor: Return before exiting with 'quit' Luiz Capitulino
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-05-12 17:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
It's a global variable already, do_quit() will use it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
sysemu.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/sysemu.h b/sysemu.h
index fcfccdf..58c9733 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -128,6 +128,7 @@ extern int max_cpus;
extern int cursor_hide;
extern int graphic_rotate;
extern int no_quit;
+extern int no_shutdown;
extern int semihosting_enabled;
extern int old_param;
extern int boot_menu;
--
1.7.1.11.g3bf78
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/3] Monitor: Return before exiting with 'quit'
2010-05-12 17:52 [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 1/3] Revert "Monitor: Return before exiting with 'quit'" Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 2/3] sysemu: Export 'no_shutdown' Luiz Capitulino
@ 2010-05-12 17:52 ` Luiz Capitulino
2010-05-13 7:18 ` [Qemu-devel] Re: [PATCH 0/3]: Monitor: Better fix for 'quit' return Paolo Bonzini
2010-05-13 13:30 ` [Qemu-devel] " Luiz Capitulino
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-05-12 17:52 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
This is a new version of the (now reverted) following commit:
0e8d2b5575938b8876a3c4bb66ee13c5d306fb6d
The 'quit' Monitor command (implemented by do_quit()) calls
exit() directly, this is problematic under QMP because QEMU
exits before having a chance to send the ok response.
Clients don't know if QEMU exited because of a problem or
because the 'quit' command has been executed.
This commit fixes that by making do_quit() use
qemu_system_shutdown_request(), so that we exit gracefully.
Thanks to Paolo Bonzini <pbonzini@redhat.com> for suggesting
this solution.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
monitor.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/monitor.c b/monitor.c
index e984122..15b53b9 100644
--- a/monitor.c
+++ b/monitor.c
@@ -942,7 +942,10 @@ static void do_info_cpu_stats(Monitor *mon)
*/
static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
- exit(0);
+ monitor_suspend(mon);
+ no_shutdown = 0;
+ qemu_system_shutdown_request();
+
return 0;
}
--
1.7.1.11.g3bf78
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: [PATCH 0/3]: Monitor: Better fix for 'quit' return
2010-05-12 17:52 [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return Luiz Capitulino
` (2 preceding siblings ...)
2010-05-12 17:52 ` [Qemu-devel] [PATCH 3/3] Monitor: Return before exiting with 'quit' Luiz Capitulino
@ 2010-05-13 7:18 ` Paolo Bonzini
2010-05-13 13:30 ` [Qemu-devel] " Luiz Capitulino
4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2010-05-13 7:18 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel
On 05/12/2010 07:52 PM, Luiz Capitulino wrote:
> Right after when 0e8d2b55 was merged, Paolo suggested using
> qemu_system_shutdown_request() instead of adding yet another 'system request'
> operation.
>
> This series implements his suggestion, passes my tests :)
Thanks,
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return
2010-05-12 17:52 [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return Luiz Capitulino
` (3 preceding siblings ...)
2010-05-13 7:18 ` [Qemu-devel] Re: [PATCH 0/3]: Monitor: Better fix for 'quit' return Paolo Bonzini
@ 2010-05-13 13:30 ` Luiz Capitulino
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-05-13 13:30 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Sorry for the duplicated emails, git-send-email is misbehaving.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-13 13:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 17:52 [Qemu-devel] [PATCH 0/3]: Monitor: Better fix for 'quit' return Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 1/3] Revert "Monitor: Return before exiting with 'quit'" Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 2/3] sysemu: Export 'no_shutdown' Luiz Capitulino
2010-05-12 17:52 ` [Qemu-devel] [PATCH 3/3] Monitor: Return before exiting with 'quit' Luiz Capitulino
2010-05-13 7:18 ` [Qemu-devel] Re: [PATCH 0/3]: Monitor: Better fix for 'quit' return Paolo Bonzini
2010-05-13 13:30 ` [Qemu-devel] " Luiz Capitulino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).