* [PATCH] Fix block mode during halt emulation
@ 2008-06-30 22:30 Dor Laor
2008-07-01 7:29 ` Dor Laor
2008-07-01 15:05 ` Marcelo Tosatti
0 siblings, 2 replies; 3+ messages in thread
From: Dor Laor @ 2008-06-30 22:30 UTC (permalink / raw)
To: kvm-devel, Avi Kivity; +Cc: Yaniv Kamay
[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]
>From d85feaae019bc0abc98a2524369e04d521a78aa8 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor.laor@qumranet.com>
Date: Mon, 30 Jun 2008 18:22:44 -0400
Subject: [PATCH] Fix block mode hduring halt emulation
There is no need to check for pending pit/apic timer, nor
pending virq, since all of the check KVM_MP_STATE_RUNNABLE
and wakeup the waitqueue.
It fixes 100% cpu when windows guest is shutdown (non acpi HAL)
Signed-off-by: Dor Laor <dor.laor@qumranet.com>
---
virt/kvm/kvm_main.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b90da0b..faa0778 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -816,10 +816,6 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
for (;;) {
prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
- if (kvm_cpu_has_interrupt(vcpu))
- break;
- if (kvm_cpu_has_pending_timer(vcpu))
- break;
if (kvm_arch_vcpu_runnable(vcpu))
break;
if (signal_pending(current))
--
1.5.4
[-- Attachment #2: 0001-Fix-block-mode-during-halt-emulation.patch --]
[-- Type: application/mbox, Size: 1012 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix block mode during halt emulation
2008-06-30 22:30 [PATCH] Fix block mode during halt emulation Dor Laor
@ 2008-07-01 7:29 ` Dor Laor
2008-07-01 15:05 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Dor Laor @ 2008-07-01 7:29 UTC (permalink / raw)
To: kvm-devel; +Cc: Avi Kivity, Yaniv Kamay
Well, it's obiosly creates a race, it was too late@night.
The problem is that kvm_cpu_has_interrupt() calls apic that checks if
the kvm_apic_accept_pic_intr and its true since probably the apic is
masked on guest shutdown.
There is no test whether the pic is masked.
Testing.
On Tue, 2008-07-01 at 01:30 +0300, Dor Laor wrote:
> >From d85feaae019bc0abc98a2524369e04d521a78aa8 Mon Sep 17 00:00:00 2001
> From: Dor Laor <dor.laor@qumranet.com>
> Date: Mon, 30 Jun 2008 18:22:44 -0400
> Subject: [PATCH] Fix block mode hduring halt emulation
>
> There is no need to check for pending pit/apic timer, nor
> pending virq, since all of the check KVM_MP_STATE_RUNNABLE
> and wakeup the waitqueue.
>
> It fixes 100% cpu when windows guest is shutdown (non acpi HAL)
>
> Signed-off-by: Dor Laor <dor.laor@qumranet.com>
> ---
> virt/kvm/kvm_main.c | 4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index b90da0b..faa0778 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -816,10 +816,6 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> for (;;) {
> prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
>
> - if (kvm_cpu_has_interrupt(vcpu))
> - break;
> - if (kvm_cpu_has_pending_timer(vcpu))
> - break;
> if (kvm_arch_vcpu_runnable(vcpu))
> break;
> if (signal_pending(current))
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Fix block mode during halt emulation
2008-06-30 22:30 [PATCH] Fix block mode during halt emulation Dor Laor
2008-07-01 7:29 ` Dor Laor
@ 2008-07-01 15:05 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2008-07-01 15:05 UTC (permalink / raw)
To: Dor Laor; +Cc: kvm-devel, Avi Kivity, Yaniv Kamay
Hi Dor,
On Tue, Jul 01, 2008 at 01:30:08AM +0300, Dor Laor wrote:
> >From d85feaae019bc0abc98a2524369e04d521a78aa8 Mon Sep 17 00:00:00 2001
> From: Dor Laor <dor.laor@qumranet.com>
> Date: Mon, 30 Jun 2008 18:22:44 -0400
> Subject: [PATCH] Fix block mode hduring halt emulation
>
> There is no need to check for pending pit/apic timer, nor
> pending virq, since all of the check KVM_MP_STATE_RUNNABLE
> and wakeup the waitqueue.
>
> It fixes 100% cpu when windows guest is shutdown (non acpi HAL)
You need to test for pending interrupts and timers. IRQ injection and
timers can trigger before kvm_vcpu_block() adds the running thread to
the waitqueue, in which case waitqueue_active() test fails.
> Signed-off-by: Dor Laor <dor.laor@qumranet.com>
> ---
> virt/kvm/kvm_main.c | 4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index b90da0b..faa0778 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -816,10 +816,6 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
> for (;;) {
> prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
>
> - if (kvm_cpu_has_interrupt(vcpu))
> - break;
> - if (kvm_cpu_has_pending_timer(vcpu))
> - break;
> if (kvm_arch_vcpu_runnable(vcpu))
> break;
> if (signal_pending(current))
> --
> 1.5.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-01 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-30 22:30 [PATCH] Fix block mode during halt emulation Dor Laor
2008-07-01 7:29 ` Dor Laor
2008-07-01 15:05 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox