From: Jan Kiszka <jan.kiszka@siemens.com> To: Anthony Liguori <anthony@codemonkey.ws> Cc: Marcelo Tosatti <mtosatti@redhat.com>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, "kvm@vger.kernel.org" <kvm@vger.kernel.org> Subject: [PATCH v3 02/23] Stop current VCPU on synchronous reset requests Date: Fri, 04 Feb 2011 19:21:25 +0100 [thread overview] Message-ID: <4D4C43A5.2030207@siemens.com> (raw) In-Reply-To: <4D4C3CC8.9040202@siemens.com> On 2011-02-04 18:52, Jan Kiszka wrote: > On 2011-02-04 18:34, Anthony Liguori wrote: >> On 02/04/2011 09:47 AM, Marcelo Tosatti wrote: >>> The following changes since commit bfddb47a343b4718e5768aa80bce8adead0f7fca: >>> >>> Open up the 0.15 development branch (2011-02-02 08:39:28 +0100) >>> >> >> This series breaks reboot of a Linux guest both with TCG and KVM. >> >> Perhaps it's a conflict with the ioapic changes from Jan? I can post a >> tree but if you just rebase to the latest master there shouldn't be any >> conflicts. >> > > The problem is some patch in the queue itself. I obviously missed that > case. Will have a look. > Yet another IOTHREAD vs. !IOTHREAD case: We don't need to do anything in cpu_stop_current in the single-thread setup as qemu_notify_event already kicks us out. Specifically, we must not set the current cpu on stop as reset happens without stop/start. This replaces patch 2 in the series. Jan --------8<---------- Subject: [PATCH] Stop current VCPU on synchronous reset requests If some I/O operation ends up calling qemu_system_reset_request in VCPU context, we record this and inform the io-thread, but we do not terminate the VCPU loop. This can lead to fairly unexpected behavior if the triggering reset operation is supposed to work synchronously. Fix this for TCG (when run in deterministic I/O mode) by setting the VCPU on stop and issuing a cpu_exit. KVM requires some more work on its VCPU loop. [ ported from qemu-kvm ] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- cpus.c | 17 +++++++++++++---- cpus.h | 1 + vl.c | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index ab6e40e..f8a88e3 100644 --- a/cpus.c +++ b/cpus.c @@ -312,6 +312,10 @@ void qemu_notify_event(void) void qemu_mutex_lock_iothread(void) {} void qemu_mutex_unlock_iothread(void) {} +void cpu_stop_current(void) +{ +} + void vm_stop(int reason) { do_vm_stop(reason); @@ -852,6 +856,14 @@ static void qemu_system_vmstop_request(int reason) qemu_notify_event(); } +void cpu_stop_current(void) +{ + if (cpu_single_env) { + cpu_single_env->stopped = 1; + cpu_exit(cpu_single_env); + } +} + void vm_stop(int reason) { QemuThread me; @@ -863,10 +875,7 @@ void vm_stop(int reason) * FIXME: should not return to device code in case * vm_stop() has been requested. */ - if (cpu_single_env) { - cpu_exit(cpu_single_env); - cpu_single_env->stop = 1; - } + cpu_stop_current(); return; } do_vm_stop(reason); diff --git a/cpus.h b/cpus.h index bf4d9bb..4cadb64 100644 --- a/cpus.h +++ b/cpus.h @@ -6,6 +6,7 @@ int qemu_init_main_loop(void); void qemu_main_loop_start(void); void resume_all_vcpus(void); void pause_all_vcpus(void); +void cpu_stop_current(void); /* vl.c */ extern int smp_cores; diff --git a/vl.c b/vl.c index 655617f..b1dc3ff 100644 --- a/vl.c +++ b/vl.c @@ -1296,6 +1296,7 @@ void qemu_system_reset_request(void) } else { reset_requested = 1; } + cpu_stop_current(); qemu_notify_event(); } -- 1.7.1
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com> To: Anthony Liguori <anthony@codemonkey.ws> Cc: Marcelo Tosatti <mtosatti@redhat.com>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, "kvm@vger.kernel.org" <kvm@vger.kernel.org> Subject: [Qemu-devel] [PATCH v3 02/23] Stop current VCPU on synchronous reset requests Date: Fri, 04 Feb 2011 19:21:25 +0100 [thread overview] Message-ID: <4D4C43A5.2030207@siemens.com> (raw) In-Reply-To: <4D4C3CC8.9040202@siemens.com> On 2011-02-04 18:52, Jan Kiszka wrote: > On 2011-02-04 18:34, Anthony Liguori wrote: >> On 02/04/2011 09:47 AM, Marcelo Tosatti wrote: >>> The following changes since commit bfddb47a343b4718e5768aa80bce8adead0f7fca: >>> >>> Open up the 0.15 development branch (2011-02-02 08:39:28 +0100) >>> >> >> This series breaks reboot of a Linux guest both with TCG and KVM. >> >> Perhaps it's a conflict with the ioapic changes from Jan? I can post a >> tree but if you just rebase to the latest master there shouldn't be any >> conflicts. >> > > The problem is some patch in the queue itself. I obviously missed that > case. Will have a look. > Yet another IOTHREAD vs. !IOTHREAD case: We don't need to do anything in cpu_stop_current in the single-thread setup as qemu_notify_event already kicks us out. Specifically, we must not set the current cpu on stop as reset happens without stop/start. This replaces patch 2 in the series. Jan --------8<---------- Subject: [PATCH] Stop current VCPU on synchronous reset requests If some I/O operation ends up calling qemu_system_reset_request in VCPU context, we record this and inform the io-thread, but we do not terminate the VCPU loop. This can lead to fairly unexpected behavior if the triggering reset operation is supposed to work synchronously. Fix this for TCG (when run in deterministic I/O mode) by setting the VCPU on stop and issuing a cpu_exit. KVM requires some more work on its VCPU loop. [ ported from qemu-kvm ] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- cpus.c | 17 +++++++++++++---- cpus.h | 1 + vl.c | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index ab6e40e..f8a88e3 100644 --- a/cpus.c +++ b/cpus.c @@ -312,6 +312,10 @@ void qemu_notify_event(void) void qemu_mutex_lock_iothread(void) {} void qemu_mutex_unlock_iothread(void) {} +void cpu_stop_current(void) +{ +} + void vm_stop(int reason) { do_vm_stop(reason); @@ -852,6 +856,14 @@ static void qemu_system_vmstop_request(int reason) qemu_notify_event(); } +void cpu_stop_current(void) +{ + if (cpu_single_env) { + cpu_single_env->stopped = 1; + cpu_exit(cpu_single_env); + } +} + void vm_stop(int reason) { QemuThread me; @@ -863,10 +875,7 @@ void vm_stop(int reason) * FIXME: should not return to device code in case * vm_stop() has been requested. */ - if (cpu_single_env) { - cpu_exit(cpu_single_env); - cpu_single_env->stop = 1; - } + cpu_stop_current(); return; } do_vm_stop(reason); diff --git a/cpus.h b/cpus.h index bf4d9bb..4cadb64 100644 --- a/cpus.h +++ b/cpus.h @@ -6,6 +6,7 @@ int qemu_init_main_loop(void); void qemu_main_loop_start(void); void resume_all_vcpus(void); void pause_all_vcpus(void); +void cpu_stop_current(void); /* vl.c */ extern int smp_cores; diff --git a/vl.c b/vl.c index 655617f..b1dc3ff 100644 --- a/vl.c +++ b/vl.c @@ -1296,6 +1296,7 @@ void qemu_system_reset_request(void) } else { reset_requested = 1; } + cpu_stop_current(); qemu_notify_event(); } -- 1.7.1
next prev parent reply other threads:[~2011-02-04 18:21 UTC|newest] Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-02-04 15:47 [PATCH 00/23] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 01/23] Prevent abortion on multiple VCPU kicks Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 02/23] Stop current VCPU on synchronous reset requests Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 03/23] Process vmstop requests in IO thread Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 04/23] Trigger exit from cpu_exec_all on pending IO events Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 05/23] Leave inner main_loop faster on pending requests Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 06/23] Flatten the main loop Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 07/23] kvm: Report proper error on GET_VCPU_MMAP_SIZE failures Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 08/23] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 09/23] kvm: Handle kvm_init_vcpu errors Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 10/23] kvm: Provide sigbus services arch-independently Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 11/23] Refactor signal setup functions in cpus.c Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 12/23] kvm: Set up signal mask also for !CONFIG_IOTHREAD Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 13/23] kvm: Refactor qemu_kvm_eat_signals Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 14/23] kvm: Call qemu_kvm_eat_signals also under !CONFIG_IOTHREAD Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 15/23] Set up signalfd " Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 16/23] kvm: Fix race between timer signals and vcpu entry under !IOTHREAD Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 17/23] kvm: Add MCE signal support for !CONFIG_IOTHREAD Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 18/23] Introduce VCPU self-signaling service Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 19/23] kvm: Unconditionally reenter kernel after IO exits Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 20/23] kvm: Remove static return code of kvm_handle_io Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 21/23] kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 15:47 ` [PATCH 22/23] x86: Fix MCA broadcast parameters for TCG case Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-08 11:39 ` Aurelien Jarno 2011-02-08 11:39 ` Aurelien Jarno 2011-02-08 11:42 ` Jan Kiszka 2011-02-08 11:42 ` Jan Kiszka 2011-02-04 15:47 ` [PATCH 23/23] kvm: make tsc stable over migration and machine start Marcelo Tosatti 2011-02-04 15:47 ` [Qemu-devel] " Marcelo Tosatti 2011-02-04 17:34 ` [Qemu-devel] [PATCH 00/23] [PULL] qemu-kvm.git uq/master queue Anthony Liguori 2011-02-04 17:34 ` Anthony Liguori 2011-02-04 17:52 ` Jan Kiszka 2011-02-04 18:21 ` Jan Kiszka [this message] 2011-02-04 18:21 ` [Qemu-devel] [PATCH v3 02/23] Stop current VCPU on synchronous reset requests Jan Kiszka 2011-02-04 21:22 ` Marcelo Tosatti 2011-02-04 21:22 ` [Qemu-devel] " Marcelo Tosatti
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4D4C43A5.2030207@siemens.com \ --to=jan.kiszka@siemens.com \ --cc=anthony@codemonkey.ws \ --cc=kvm@vger.kernel.org \ --cc=mtosatti@redhat.com \ --cc=qemu-devel@nongnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.