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 2/6] Do not use env->halted to decide where halted state should be handled.
Date: Sun, 14 Jun 2009 13:52:18 +0300	[thread overview]
Message-ID: <1244976742-22926-2-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1244976742-22926-1-git-send-email-gleb@redhat.com>

Use kvm_irqchip_in_kernel() for that. If irq chip is not handled by
userspace kernel should be entered even when CPU is halted.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 hw/apic.c  |    3 +--
 qemu-kvm.c |    6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/apic.c b/hw/apic.c
index c5d97b2..f186202 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -467,8 +467,7 @@ static void apic_init_ipi(APICState *s)
 
     cpu_reset(s->cpu_env);
 
-    if (!(s->apicbase & MSR_IA32_APICBASE_BSP) &&
-        (!kvm_enabled() || !qemu_kvm_irqchip_in_kernel()))
+    if (!(s->apicbase & MSR_IA32_APICBASE_BSP))
         s->cpu_env->halted = 1;
 
     if (kvm_enabled() && !qemu_kvm_irqchip_in_kernel())
diff --git a/qemu-kvm.c b/qemu-kvm.c
index ec911ef..7676e02 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -217,6 +217,8 @@ static int has_work(CPUState *env)
 {
     if (!vm_running || (env && env->kvm_cpu_state.stopped))
 	return 0;
+    if (kvm_irqchip_in_kernel(kvm_context))
+        return 1;
     if (!env->halted)
 	return 1;
     return kvm_arch_has_work(env);
@@ -390,8 +392,6 @@ static int kvm_main_loop_cpu(CPUState *env)
     setup_kernel_sigmask(env);
 
     pthread_mutex_lock(&qemu_mutex);
-    if (kvm_irqchip_in_kernel(kvm_context))
-	env->halted = 0;
 
     kvm_qemu_init_env(env);
 #ifdef TARGET_I386
@@ -412,7 +412,7 @@ static int kvm_main_loop_cpu(CPUState *env)
 	    if (env->kvm_cpu_state.sipi_needed)
 	        update_regs_for_sipi(env);
     }
-	if (!env->halted)
+	if (!env->halted || kvm_irqchip_in_kernel(kvm_context))
 	    kvm_cpu_exec(env);
 	env->exit_request = 0;
         env->exception_index = EXCP_INTERRUPT;
-- 
1.6.2.1


  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 ` Gleb Natapov [this message]
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 ` [PATCH 6/6] Retrieve mp state info in cpu_synchronize_state() Gleb Natapov
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-2-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.