Fix block mode during halt emulation
PATCH 1/1 Fix block mode during halt emulation
Quoted 1 line
From
d85feaae019bc0abc98a2524369e04d521a78aa8Mon Sep 17 00:00:00 2001
From: Dor Laor <[email protected]>
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)
--- virt/kvm/kvm_main.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
virt/kvm/kvm_main.c +0 -4
@@ -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))
Signature · 1 line
1.5.4
Quoted 1 line
From
d85feaae019bc0abc98a2524369e04d521a78aa8Mon Sep 17 00:00:00 2001
From: Dor Laor <[email protected]>
Date: Mon, 30 Jun 2008 18:22:44 -0400
Subject: [PATCH] Fix block mode during 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)
--- virt/kvm/kvm_main.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
virt/kvm/kvm_main.c +0 -4
@@ -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))
Signature · 1 line
1.5.4
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.
Quoted 31 lines · Dor Laor
Quoted 1 line
From
d85feaae019bc0abc98a2524369e04d521a78aa8Mon Sep 17 00:00:00 2001From: Dor Laor <[email protected]>
Date: Mon, 30 Jun 2008 18:22:44 -0400
Subject: [PATCH] Fix block mode hduring halt emulationThere is no need to check for pending pit/apic timer, nor pending virq, since all of the check
KVM_MP_STATE_RUNNABLEand wakeup the waitqueue.It fixes 100% cpu when windows guest is shutdown (non acpi HAL)
Signed-off-by Dor Laor <[email protected]>--- virt/kvm/kvm_main.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)virt/kvm/kvm_main.c +0
-4@@ -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))
Hi Dor,
Quoted 10 lines · Dor Laor
Quoted 1 line
From
d85feaae019bc0abc98a2524369e04d521a78aa8Mon Sep 17 00:00:00 2001From: Dor Laor <[email protected]>
Date: Mon, 30 Jun 2008 18:22:44 -0400
Subject: [PATCH] Fix block mode hduring halt emulationThere is no need to check for pending pit/apic timer, nor pending virq, since all of the check
KVM_MP_STATE_RUNNABLEand 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.
Quoted 22 lines
Signed-off-by Dor Laor <[email protected]>--- virt/kvm/kvm_main.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)virt/kvm/kvm_main.c +0
-4@@ -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))Signature · 1 line
1.5.4