From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH] revert part of 3db8b916e merge
Date: Wed, 3 Jun 2009 15:07:56 +0300 [thread overview]
Message-ID: <20090603120756.GC11384@redhat.com> (raw)
kvm_*_mpstate() cannot be called from kvm_arch_*_registers()
since kvm_arch_*_registers() sometimes called from io thread, but
kvm_*_mpstate() can be called only by cpu thread.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/qemu-kvm.c b/qemu-kvm.c
index 68d3b92..7ed1e06 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1431,26 +1431,3 @@ void qemu_kvm_cpu_stop(CPUState *env)
if (kvm_enabled())
env->kvm_cpu_state.stopped = 1;
}
-
-void kvm_arch_get_registers(CPUState *env)
-{
- kvm_save_registers(env);
- kvm_save_mpstate(env);
-}
-
-void kvm_arch_put_registers(CPUState *env)
-{
- kvm_load_registers(env);
- kvm_load_mpstate(env);
-}
-
-
-void cpu_synchronize_state(CPUState *env, int modified)
-{
- if (kvm_enabled()) {
- if (modified)
- kvm_arch_put_registers(env);
- else
- kvm_arch_get_registers(env);
- }
-}
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 725589b..5d47e88 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -216,10 +216,25 @@ int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t len);
static inline int kvm_sync_vcpus(void) { return 0; }
-void kvm_arch_get_registers(CPUState *env);
-void kvm_arch_put_registers(CPUState *env);
+static inline void kvm_arch_get_registers(CPUState *env)
+{
+ kvm_save_registers(env);
+}
-void cpu_synchronize_state(CPUState *env, int modified);
+static inline void kvm_arch_put_registers(CPUState *env)
+{
+ kvm_load_registers(env);
+}
+
+static inline void cpu_synchronize_state(CPUState *env, int modified)
+{
+ if (kvm_enabled()) {
+ if (modified)
+ kvm_arch_put_registers(env);
+ else
+ kvm_arch_get_registers(env);
+ }
+}
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
int reg);
diff --git a/target-i386/machine.c b/target-i386/machine.c
index f280d3d..07df1e1 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -32,7 +32,10 @@ void cpu_save(QEMUFile *f, void *opaque)
int32_t pending_irq;
int i, bit;
- cpu_synchronize_state(env, 0);
+ if (kvm_enabled()) {
+ kvm_save_registers(env);
+ kvm_save_mpstate(env);
+ }
for(i = 0; i < CPU_NB_REGS; i++)
qemu_put_betls(f, &env->regs[i]);
--
Gleb.
next reply other threads:[~2009-06-03 12:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-03 12:07 Gleb Natapov [this message]
2009-06-03 12:16 ` [PATCH] revert part of 3db8b916e merge Avi Kivity
2009-06-03 12:20 ` Gleb Natapov
2009-06-04 13:00 ` Avi Kivity
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=20090603120756.GC11384@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.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 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.