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