lkml.org 
[lkml]   [2022]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 3/5] KVM: SVM: fix race between interrupt delivery and AVIC inhibition
From
On 1/5/22 12:03, Maxim Levitsky wrote:
>>> - if (!vcpu->arch.apicv_active)
>>> - return -1;
>>> -
>>> + /*
>>> + * Below, we have to handle anyway the case of AVIC being disabled
>>> + * in the middle of this function, and there is hardly any overhead
>>> + * if AVIC is disabled. So, we do not bother returning -1 and handle
>>> + * the kick ourselves for disabled APICv.
>> Hmm, my preference would be to keep the "return -1" even though apicv_active must
>> be rechecked. That would help highlight that returning "failure" after this point
>> is not an option as it would result in kvm_lapic_set_irr() being called twice.
> I don't mind either - this will fix the tracepoint I recently added to report the
> number of interrupts that were delivered by AVIC/APICv - with this patch,
> all of them count as such.

The reasoning here is that, unlike VMX, we have to react anyway to
vcpu->arch.apicv_active becoming false halfway through the function.

Removing the early return means that there's one less case of load
(mis)reordering that the reader has to check. So I really would prefer
to remove it.

Agreed with the other feedback.

Paolo

\
 
 \ /
  Last update: 2022-01-07 16:34    [W:0.369 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site