From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, aik@ozlabs.ru, agraf@suse.de,
mdroth@linux.vnet.ibm.com, clg@fr.ibm.com, qemu-ppc@nongnu.org,
pbonzini@redhat.com, David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PULL 3/3] vl: Move cpu_synchronize_all_states() into qemu_system_reset()
Date: Tue, 5 Apr 2016 12:17:23 +1000 [thread overview]
Message-ID: <1459822643-4770-4-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1459822643-4770-1-git-send-email-david@gibson.dropbear.id.au>
There are currently 3 calls to qemu_system_reset() in vl.c. Two of them
are immediately preceded by a cpu_synchronize_all_states9) and the
remaining one should be.
The one which doesn't is the very first reset called directly from main().
Without a cpu_synchronize_all_states(), kvm_vcpu_dirty is false at this
point from the earlier cpu_synchronize_all_post_init(). That's incorrect
because the reset path is quite likely to update the CPU state, and that
updated state should be pushed back to KVM, not overwritten with stale
data pushed to KVM immediately after init.
This patch moves the call to cpu_synchronize_all_states() into
qemu_system_reset() for safety, so it is always called. AFAICT this should
be safe for the handful of callers outside vl.c - these all appear to be in
places where the cpu state is already synchronized so the extra call
will be a no-op.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
---
vl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vl.c b/vl.c
index bd81ea9..3629336 100644
--- a/vl.c
+++ b/vl.c
@@ -1745,6 +1745,8 @@ void qemu_system_reset(bool report)
mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
+ cpu_synchronize_all_states();
+
if (mc && mc->reset) {
mc->reset();
} else {
@@ -1893,7 +1895,6 @@ static bool main_loop_should_exit(void)
}
if (qemu_reset_requested()) {
pause_all_vcpus();
- cpu_synchronize_all_states();
qemu_system_reset(VMRESET_REPORT);
resume_all_vcpus();
if (!runstate_check(RUN_STATE_RUNNING) &&
@@ -1903,7 +1904,6 @@ static bool main_loop_should_exit(void)
}
if (qemu_wakeup_requested()) {
pause_all_vcpus();
- cpu_synchronize_all_states();
qemu_system_reset(VMRESET_SILENT);
notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
wakeup_reason = QEMU_WAKEUP_REASON_NONE;
--
2.5.5
next prev parent reply other threads:[~2016-04-05 2:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 2:17 [Qemu-devel] [PULL 0/3] ppc-for-2.6 queue 20160405 David Gibson
2016-04-05 2:17 ` [Qemu-devel] [PULL 1/3] ppc: Rework POWER7 & POWER8 exception model David Gibson
2016-04-05 2:19 ` Benjamin Herrenschmidt
2016-04-05 3:25 ` David Gibson
2016-04-05 7:03 ` Cédric Le Goater
2016-04-05 20:42 ` Benjamin Herrenschmidt
2016-04-07 9:13 ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2016-04-07 10:27 ` Cédric Le Goater
2016-04-07 10:45 ` Laurent Vivier
2016-04-07 15:01 ` Cédric Le Goater
2016-04-08 1:22 ` David Gibson
2016-04-08 1:20 ` David Gibson
2016-04-05 2:17 ` [Qemu-devel] [PULL 2/3] spapr_drc: enable immediate detach for unsignalled devices David Gibson
2016-04-05 2:17 ` David Gibson [this message]
2016-04-05 10:02 ` [Qemu-devel] [PULL 0/3] ppc-for-2.6 queue 20160405 Peter Maydell
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=1459822643-4770-4-git-send-email-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=clg@fr.ibm.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).