Re: [PART1 RFC v2 06/10] svm: Add interrupt injection via AVIC

From: Suravee Suthikulpanit
Date: Mon Mar 14 2016 - 05:50:43 EST


Hi,

On 03/09/2016 06:10 PM, Paolo Bonzini wrote:
+
>>>+ if (vcpu->mode == IN_GUEST_MODE) {
>>>+ wrmsrl(SVM_AVIC_DOORBELL,
>>>+ __default_cpu_present_to_apicid(vcpu->cpu));
>>>+ } else {
>>>+ kvm_vcpu_kick(vcpu);
>>>+ }
>> >
>And what about
> [...]
> else if (!vcpu->...->is_running)
> kvm_vcpu_kick(vcpu);
>
>?
>The kick isn't needed unless the VCPU is scheduled out.
>Or maybe just
> if (vcpu->...->is_running)
> wrmsrl()
> else
> kvm_vcpu_kick();
>?
>Which doesn't use the information we have on top AVIC, making our logic
>a bit simpler.
Yes, both of this should work. I like the latter.

Ok, I'll modify this to check the is_running bit of the AVIC Physical APIC ID table entry to determine if we should kick vcpu.

Thanks,
Suravee