[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z-WqIxO1XfFAmchX@google.com>
Date: Thu, 27 Mar 2025 12:42:27 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: Nikunj A Dadhania <nikunj@....com>, Paolo Bonzini <pbonzini@...hat.com>,
Jim Mattson <jmattson@...gle.com>, Maxim Levitsky <mlevitsk@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>, Rik van Riel <riel@...riel.com>,
Tom Lendacky <thomas.lendacky@....com>, x86@...nel.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Manali Shukla <manali.shukla@....com>,
santosh.shukla@....com
Subject: Re: [RFC PATCH 01/24] KVM: VMX: Generalize VPID allocation to be vendor-neutral
On Thu, Mar 27, 2025, Yosry Ahmed wrote:
> On Thu, Mar 27, 2025 at 10:58:31AM +0000, Nikunj A Dadhania wrote:
> > > +unsigned int kvm_tlb_tags_alloc(struct kvm_tlb_tags *tlb_tags)
> > > +{
> > > + unsigned int tag;
> > > +
> > > + spin_lock(&tlb_tags->lock);
> > > + tag = find_next_zero_bit(tlb_tags->bitmap, tlb_tags->max + 1,
> > > + tlb_tags->min);
> > > + if (tag <= tlb_tags->max)
> > > + __set_bit(tag, tlb_tags->bitmap);
> > > + else
> > > + tag = 0;
> >
> > In the event that the KVM runs out of tags, adding WARN_ON_ONCE() here will
> > help debugging.
>
> Yeah I wanted to do that, but we do not currently WARN in VMX if we run
> out of VPIDs. I am fine with doing adding it if others are. My main
> concern was if there's some existing use case that routinely runs out of
> VPIDs (although I cannot imagine one).
No WARNs, it would be userspace triggerable (hello, syzkaller). If we really
want to harden things against performance issues due to unexpected VPID/ASID
allocation, I would rather do something like add a knob to fail VM or vCPU
creation if allocation fails (nested would just have to suffer).
Powered by blists - more mailing lists