[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a11edec-c29a-95df-393e-363e1af46257@redhat.com>
Date: Fri, 7 Jan 2022 16:32:44 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Maxim Levitsky <mlevitsk@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Cc: kvm@...r.kernel.org, Jim Mattson <jmattson@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Joerg Roedel <joro@...tes.org>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Borislav Petkov <bp@...en8.de>, linux-kernel@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Wanpeng Li <wanpengli@...cent.com>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2 3/5] KVM: SVM: fix race between interrupt delivery and
AVIC inhibition
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
Powered by blists - more mailing lists