[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <acf2q5da7s2rmh5tugozwhwv5rqafacgah7kjicrfc2qhbuzc6@k6ic4xngr552>
Date: Wed, 5 Feb 2025 16:43:50 +0530
From: Naveen N Rao <naveen@...nel.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Maxim Levitsky <mlevitsk@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>, Vasant Hegde <vasant.hegde@....com>,
Vitaly Kuznetsov <vkuznets@...hat.com>
Subject: Re: [PATCH 2/3] KVM: x86: Remove use of apicv_update_lock when
toggling guest debug state
On Tue, Feb 04, 2025 at 09:51:22AM -0800, Sean Christopherson wrote:
> On Tue, Feb 04, 2025, Naveen N Rao wrote:
> > On Mon, Feb 03, 2025 at 09:00:05PM -0500, Maxim Levitsky wrote:
> > > On Mon, 2025-02-03 at 22:33 +0530, Naveen N Rao (AMD) wrote:
> > > > apicv_update_lock is not required when querying the state of guest
> > > > debug in all the vcpus. Remove usage of the same, and switch to
> > > > kvm_set_or_clear_apicv_inhibit() helper to simplify the code.
> > >
> > > It might be worth to mention that the reason why the lock is not needed,
> > > is because kvm_vcpu_ioctl from which this function is called takes 'vcpu->mutex'
> > > and thus concurrent execution of this function is not really possible.
> >
> > Looking at this again, that looks to be a vcpu-specific lock, so I guess
> > it is possible for multiple vcpus to run this concurrently?
>
> Correct.
>
> > In reality, this looks to be coming in from a vcpu ioctl from userspace,
> > so this is probably not being invoked concurrently today.
> >
> > Regardless, I wonder if moving this to a per-vcpu inhibit might be a
> > better way to address this.
>
> No, this is a slow path.
My comment was more from the point of view of correctness, rather than
performance (with the goal of removing use of apicv_update_lock) --
similar to the issue with IRQWIN needing to maintain per-vcpu state. My
naive understanding of Maxim's mail was that we would introduce per-vcpu
inhibit field to maintain per-vcpu inhibit state, but not actually
inhibit AVIC on a per-vcpu basis :)
Thanks,
Naveen
Powered by blists - more mailing lists