From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [PATCH 27/37] Refactor debug and vmstop request interface Date: Mon, 14 Feb 2011 13:22:56 -0200 Message-ID: <8cf71710f068f9c50ce420b1dd4ef71c2f9b2a8d.1297696986.git.mtosatti@redhat.com> References: Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti To: Anthony Liguori Return-path: Received: from mx1.redhat.com ([209.132.183.28]:4935 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755739Ab1BNPZA (ORCPT ); Mon, 14 Feb 2011 10:25:00 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: From: Jan Kiszka Instead of fiddling with debug_requested and vmstop_requested directly, introduce qemu_system_debug_request and turn qemu_system_vmstop_request into a public interface. This aligns those services with exiting ones in vl.c. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- cpus.c | 9 +-------- cpus.h | 2 -- sysemu.h | 2 ++ vl.c | 20 ++++++++++++++++---- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cpus.c b/cpus.c index ca1f01d..97a6d4f 100644 --- a/cpus.c +++ b/cpus.c @@ -168,8 +168,7 @@ static bool all_cpu_threads_idle(void) static void cpu_debug_handler(CPUState *env) { gdb_set_stop_cpu(env); - debug_requested = VMSTOP_DEBUG; - vm_stop(VMSTOP_DEBUG); + qemu_system_debug_request(); } #ifdef CONFIG_LINUX @@ -990,12 +989,6 @@ void qemu_notify_event(void) qemu_event_increment(); } -static void qemu_system_vmstop_request(int reason) -{ - vmstop_requested = reason; - qemu_notify_event(); -} - void cpu_stop_current(void) { if (cpu_single_env) { diff --git a/cpus.h b/cpus.h index 4cadb64..e021126 100644 --- a/cpus.h +++ b/cpus.h @@ -11,8 +11,6 @@ void cpu_stop_current(void); /* vl.c */ extern int smp_cores; extern int smp_threads; -extern int debug_requested; -extern int vmstop_requested; void vm_state_notify(int running, int reason); bool cpu_exec_all(void); void set_numa_modes(void); diff --git a/sysemu.h b/sysemu.h index 0628d3d..0a83ab9 100644 --- a/sysemu.h +++ b/sysemu.h @@ -61,6 +61,8 @@ 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_debug_request(void); +void qemu_system_vmstop_request(int reason); int qemu_shutdown_requested(void); int qemu_reset_requested(void); int qemu_powerdown_requested(void); diff --git a/vl.c b/vl.c index 6d2d1d3..eebe684 100644 --- a/vl.c +++ b/vl.c @@ -1217,8 +1217,8 @@ static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = static int reset_requested; static int shutdown_requested; static int powerdown_requested; -int debug_requested; -int vmstop_requested; +static int debug_requested; +static int vmstop_requested; int qemu_shutdown_requested(void) { @@ -1312,6 +1312,18 @@ void qemu_system_powerdown_request(void) qemu_notify_event(); } +void qemu_system_debug_request(void) +{ + debug_requested = 1; + vm_stop(VMSTOP_DEBUG); +} + +void qemu_system_vmstop_request(int reason) +{ + vmstop_requested = reason; + qemu_notify_event(); +} + void main_loop_wait(int nonblocking) { IOHandlerRecord *ioh; @@ -1427,8 +1439,8 @@ static void main_loop(void) dev_time += profile_getclock() - ti; #endif - if ((r = qemu_debug_requested())) { - vm_stop(r); + if (qemu_debug_requested()) { + vm_stop(VMSTOP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL); -- 1.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57884 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pp0IP-0000D7-E0 for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:25:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pp0IM-00041Y-0O for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:25:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pp0IL-00040I-A9 for qemu-devel@nongnu.org; Mon, 14 Feb 2011 10:24:57 -0500 From: Marcelo Tosatti Date: Mon, 14 Feb 2011 13:22:56 -0200 Message-Id: <8cf71710f068f9c50ce420b1dd4ef71c2f9b2a8d.1297696986.git.mtosatti@redhat.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH 27/37] Refactor debug and vmstop request interface List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org From: Jan Kiszka Instead of fiddling with debug_requested and vmstop_requested directly, introduce qemu_system_debug_request and turn qemu_system_vmstop_request into a public interface. This aligns those services with exiting ones in vl.c. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- cpus.c | 9 +-------- cpus.h | 2 -- sysemu.h | 2 ++ vl.c | 20 ++++++++++++++++---- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cpus.c b/cpus.c index ca1f01d..97a6d4f 100644 --- a/cpus.c +++ b/cpus.c @@ -168,8 +168,7 @@ static bool all_cpu_threads_idle(void) static void cpu_debug_handler(CPUState *env) { gdb_set_stop_cpu(env); - debug_requested = VMSTOP_DEBUG; - vm_stop(VMSTOP_DEBUG); + qemu_system_debug_request(); } #ifdef CONFIG_LINUX @@ -990,12 +989,6 @@ void qemu_notify_event(void) qemu_event_increment(); } -static void qemu_system_vmstop_request(int reason) -{ - vmstop_requested = reason; - qemu_notify_event(); -} - void cpu_stop_current(void) { if (cpu_single_env) { diff --git a/cpus.h b/cpus.h index 4cadb64..e021126 100644 --- a/cpus.h +++ b/cpus.h @@ -11,8 +11,6 @@ void cpu_stop_current(void); /* vl.c */ extern int smp_cores; extern int smp_threads; -extern int debug_requested; -extern int vmstop_requested; void vm_state_notify(int running, int reason); bool cpu_exec_all(void); void set_numa_modes(void); diff --git a/sysemu.h b/sysemu.h index 0628d3d..0a83ab9 100644 --- a/sysemu.h +++ b/sysemu.h @@ -61,6 +61,8 @@ 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_debug_request(void); +void qemu_system_vmstop_request(int reason); int qemu_shutdown_requested(void); int qemu_reset_requested(void); int qemu_powerdown_requested(void); diff --git a/vl.c b/vl.c index 6d2d1d3..eebe684 100644 --- a/vl.c +++ b/vl.c @@ -1217,8 +1217,8 @@ static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = static int reset_requested; static int shutdown_requested; static int powerdown_requested; -int debug_requested; -int vmstop_requested; +static int debug_requested; +static int vmstop_requested; int qemu_shutdown_requested(void) { @@ -1312,6 +1312,18 @@ void qemu_system_powerdown_request(void) qemu_notify_event(); } +void qemu_system_debug_request(void) +{ + debug_requested = 1; + vm_stop(VMSTOP_DEBUG); +} + +void qemu_system_vmstop_request(int reason) +{ + vmstop_requested = reason; + qemu_notify_event(); +} + void main_loop_wait(int nonblocking) { IOHandlerRecord *ioh; @@ -1427,8 +1439,8 @@ static void main_loop(void) dev_time += profile_getclock() - ti; #endif - if ((r = qemu_debug_requested())) { - vm_stop(r); + if (qemu_debug_requested()) { + vm_stop(VMSTOP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL); -- 1.7.4