>-----Original Message-----
>From: [EMAIL PROTECTED] 
>[mailto:[EMAIL PROTECTED] On Behalf Of 
>Avi Kivity
>Sent: 2007年9月10日 20:48
>To: He, Qing
>Cc: kvm-devel@lists.sourceforge.net
>Subject: Re: [kvm-devel] [PATCH] passing smp cpu count from CMOS
>
>Avi Kivity wrote:
>>
>> Alternative patch attached, but works only with -no-kvm-irqchip.
>>
>>
>
>After removing smp_processor_id() from kvm_vcpu_kick() it works fairly 
>well, unfortunately that means there's a timing issue with 
>kernel lapic.
>

Double checked the code, yes there is really not a small window where 
the pre-read ipi_pcpu may be already out of date. Just remove the additional
condition check is fine, or we can have following patch since this is
only a performance concern in delivering virtual IRQ. Just let you fell 
comfortable :-)

In either way, we are not precisely on demand signal IPI (i.e. we may 
signal redundant IPIs which is harmless) since it is only a very minor
performance issue so I didn't use lock similar mechanism.

thx,eddie


diff --git a/drivers/kvm/irq.c b/drivers/kvm/irq.c
index 225c541..ab5769f 100644
--- a/drivers/kvm/irq.c
+++ b/drivers/kvm/irq.c
@@ -73,13 +73,11 @@ static void vcpu_kick_intr(void *info)

 void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
 {
-       int ipi_pcpu = vcpu->cpu;
-
        if (waitqueue_active(&vcpu->wq)) {
                wake_up_interruptible(&vcpu->wq);
                ++vcpu->stat.halt_wakeup;
        }
-       if (vcpu->guest_mode && ipi_pcpu != smp_processor_id())
+       if (vcpu->guest_mode && vcpu->cpu != smp_processor_id())
                smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0, 0);
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to