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: Handle INIT before SIPI.
Date: Thu, 16 Oct 2008 17:20:57 +0200	[thread overview]
Message-ID: <20081016152057.GV11435@redhat.com> (raw)


Handle INIT before SIPI.
    
If SIPI was issued before CPU handled INIT signal the CPU is not reseted.
    
Signed-off-by: Gleb Natapov <gleb@redhat.com>

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 577f2b2..dae05b0 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -349,13 +349,20 @@ static void update_regs_for_sipi(CPUState *env)
 {
     kvm_arch_update_regs_for_sipi(env);
     vcpu_info[env->cpu_index].sipi_needed = 0;
-    vcpu_info[env->cpu_index].init = 0;
 }
 
 static void update_regs_for_init(CPUState *env)
 {
+    SegmentCache cs = env->segs[R_CS];
+
     cpu_reset(env);
+
+    /* restore SIPI vector */
+    if(vcpu_info[env->cpu_index].sipi_needed)
+        env->segs[R_CS] = cs;
+
     kvm_arch_load_regs(env);
+    vcpu_info[env->cpu_index].init = 0;
 }
 
 static void setup_kernel_sigmask(CPUState *env)
@@ -411,10 +418,12 @@ static int kvm_main_loop_cpu(CPUState *env)
 	    kvm_main_loop_wait(env, 1000);
 	if (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI))
 	    env->halted = 0;
-	if (!kvm_irqchip_in_kernel(kvm_context) && info->sipi_needed)
-	    update_regs_for_sipi(env);
-	if (!kvm_irqchip_in_kernel(kvm_context) && info->init)
-	    update_regs_for_init(env);
+    if (!kvm_irqchip_in_kernel(kvm_context)) {
+	    if (info->init)
+	        update_regs_for_init(env);
+	    if (info->sipi_needed)
+	        update_regs_for_sipi(env);
+    }
 	if (!env->halted && !info->init)
 	    kvm_cpu_exec(env);
 	env->interrupt_request &= ~CPU_INTERRUPT_EXIT;
--
			Gleb.

             reply	other threads:[~2008-10-16 15:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 15:20 Gleb Natapov [this message]
2008-10-19  9:42 ` Handle INIT before SIPI Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-10-21  2:34 Xu, Dongxiao
2008-10-21  2:34 ` Xu, Dongxiao
2008-10-22 12:48 ` Gleb Natapov
2008-10-22 12:48   ` Gleb Natapov

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=20081016152057.GV11435@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.