All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH 6/6] Retrieve mp state info in cpu_synchronize_state()
Date: Sun, 14 Jun 2009 13:52:22 +0300	[thread overview]
Message-ID: <1244976742-22926-6-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1244976742-22926-1-git-send-email-gleb@redhat.com>

And set env->halted based on the value to show accurate vcpu state in
QEMU monitor.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 qemu-kvm.c |   27 +++++++++++++++++++++++++++
 qemu-kvm.h |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index af3fd91..41dcdc3 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -187,6 +187,33 @@ void kvm_save_registers(CPUState *env)
         on_vcpu(env, kvm_do_save_registers, env);
 }
 
+static void kvm_do_load_mpstate(void *_env)
+{
+    CPUState *env = _env;
+
+    kvm_arch_load_mpstate(env);
+}
+
+void kvm_load_mpstate(CPUState *env)
+{
+    if (kvm_enabled() && qemu_system_ready)
+        on_vcpu(env, kvm_do_load_mpstate, env);
+}
+
+static void kvm_do_save_mpstate(void *_env)
+{
+    CPUState *env = _env;
+
+    kvm_arch_save_mpstate(env);
+    env->halted = (env->mp_state == KVM_MP_STATE_HALTED);
+}
+
+void kvm_save_mpstate(CPUState *env)
+{
+    if (kvm_enabled())
+        on_vcpu(env, kvm_do_save_mpstate, env);
+}
+
 int kvm_cpu_exec(CPUState *env)
 {
     int r;
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 3b73fe9..22452e9 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -221,11 +221,13 @@ static inline int kvm_sync_vcpus(void) { return 0; }
 static inline void kvm_arch_get_registers(CPUState *env)
 {
     kvm_save_registers(env);
+    kvm_save_mpstate(env);
 }
 
 static inline void kvm_arch_put_registers(CPUState *env)
 {
     kvm_load_registers(env);
+    kvm_load_mpstate(env);
 }
 
 static inline void cpu_synchronize_state(CPUState *env, int modified)
-- 
1.6.2.1


  parent reply	other threads:[~2009-06-14 10:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-14 10:52 [PATCH 1/6] env->kvm_cpu_state.init is always zero here Gleb Natapov
2009-06-14 10:52 ` [PATCH 2/6] Do not use env->halted to decide where halted state should be handled Gleb Natapov
2009-06-14 10:52 ` [PATCH 3/6] Call kvm_arch_load_regs() instead of kvm_load_registers() Gleb Natapov
2009-06-14 10:52 ` [PATCH 4/6] Handle vcpu init/sipi by calling a function on vcpu Gleb Natapov
2009-06-15 10:03   ` Avi Kivity
2009-06-15 10:11     ` Gleb Natapov
2009-06-15 10:14       ` Avi Kivity
2009-06-15 10:16         ` Gleb Natapov
2009-06-15 10:26           ` Avi Kivity
2009-06-14 10:52 ` [PATCH 5/6] Rename kvm_(load|save)_mpstate to kvm_arch_(load|save)_mpstate Gleb Natapov
2009-06-14 10:52 ` Gleb Natapov [this message]
2009-06-15  9:55 ` [PATCH 1/6] env->kvm_cpu_state.init is always zero here Avi Kivity
2009-06-15  9:58   ` Gleb Natapov
2009-06-15 10:05     ` 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=1244976742-22926-6-git-send-email-gleb@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.