[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-4.22 2/2] xen/arm: vgic: free eSPIs using the bitmap index


  • To: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Thu, 16 Jul 2026 17:32:14 +0300
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qGDa6+1+DnJbq2R2aFaIL9WLM4kgzQ9gt/HFwnLQRb0=; fh=CbXQhWZTwQlH/OH1p55PYIW1twR7jST5umoJ4C4PE6c=; b=hPPr0WrD2i2NXnjXL2VT00bBDJslqIz7kL0pz1hEpTdXkN/ZsCkx1CNsgvQbnwnD6H v5LaVkn+4mEH9Ol4RlOZaM/qx/+nPmqADZHZkPS8fYPWdYiQFIR442uUo1YfT1vlxGKZ g1IKx/gbJLQjvpaKbCfxB07kcq2hxf72wLx2J58xg5o2rPbwfjJHZmAl707usiacL7ZU 0nEtVv1RC4EcAfvBu0oYonC4cOXRW7pevz7rKvJLqDU45MzPVUtV26UkPw0UUWrZ8lp+ 7VVzD39YOQqOrba0rPcXFiijFOL8DWrHJGJaJdjySaGV2GoYGuKPkfwvt56VSLm9pCcp XAaA==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1784212346; cv=none; d=google.com; s=arc-20260327; b=GCjp4kvx6Hsw03fL5mR6yw+BrAwxl3oivOJji1u5t5gc34rOpGebk0dx3hF37H+y+Z wIZ6Z6Z4b1PFfcrBTVGbPEW5bNbr6dsOgPZfPdslUE73M2xnMjbCb3SKj0itbcZIGS3X ID1bPEXnid/JmYetIVdo4DD7faY0B7Wk8A66ZI2EkcM/6YfMCM1DrNA1wGUMQ855y55r nYcrFxpUAwBk9eXy16zeV5wuk8uqLx7lfNq/YMdBHsl/bn4aeBNrBFub6uAzX16WN1cW oyO+MYBqJ9QI2dusRuoUt5AigAp3dMBwHdWaKqMpueiF+/h+VT/O/ySq+aDo/rsI3ukI 8EiA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: Mykola Kvach <mykola_kvach@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 16 Jul 2026 14:32:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Jul 16, 2026 at 3:03 PM Orzel, Michal <michal.orzel@xxxxxxx> wrote:
>
>
>
> On 10-Jul-26 10:31, Mykola Kvach wrote:
> > Classic vGIC stores eSPIs in allocated_irqs after the regular virtual
> > interrupts. vgic_reserve_virq() therefore translates an eSPI INTID to a
> > compressed bitmap index before test_and_set_bit().
> >
> > vgic_free_virq() still used the raw virtual INTID. Freeing INTID 4096
> > would clear bit 4096 instead of the first eSPI allocation bit, which is
> > outside allocated_irqs for a domain with eSPI support. That can leave
> > the eSPI reserved and may corrupt memory.
> >
> > Add the inverse of idx_to_virq() and use it in both reserve and free, so
> > the allocation bitmap is indexed consistently. Also reject invalid
> > virtual INTIDs before clearing the bitmap.
> I think we can have it in 4.22 given that the release is postponed a bit.
>
> >
> > Fixes: bdde400c6e1b ("xen/arm: vgic: add resource management for extended 
> > SPIs")
> > Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> > ---
> >  xen/arch/arm/vgic.c | 27 ++++++++++++++++-----------
> >  1 file changed, 16 insertions(+), 11 deletions(-)
> >
> > diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> > index e5aca17dcb..b85710c6a7 100644
> > --- a/xen/arch/arm/vgic.c
> > +++ b/xen/arch/arm/vgic.c
> > @@ -33,6 +33,16 @@ static inline unsigned int idx_to_virq(struct domain *d, 
> > unsigned int idx)
> >      return idx;
> >  }
> >
> > +static inline unsigned int virq_to_idx(struct domain *d, unsigned int virq)
> > +{
> > +#ifdef CONFIG_GICV3_ESPI
> Same as for patch 1: is_espi() shouldn't be protected as it protects itself.

Ack.

Best regards,
Mykola



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.