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

Re: [PATCH v3 3/4] xen/arm: vgic: free eSPIs using the bitmap index


  • To: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • From: Mykola Kvach <mykola_kvach@xxxxxxxx>
  • Date: Tue, 22 Sep 2026 08:26:12 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QkzG1G/uSLHdxO2Qo/R8DUfiJJyJT4LbFRZ/pEkIQVI=; b=OX3qD8baVHhJTopI65oowxBGKwfCXDV9ZaiQQQWxFQkwoqVvfNlhrXlFtI62N2zh3ra2wn+JXLY5szvISCPbHCAY9or0JK7llOEsyl2Zv8dqY5ieD6Q8yFIcfJY7kHu6tKAYoQTLiDAsZcgj91FSpKBy3S/4ivcTWwrOefbAwrFNkkcHiTXN6ysGvj1wT8mezIUABVnxuDQSgAMSxvIUMuO0fsDkhBMGXzBv26KP4QZeshafG62xCWD2QEEt5mcNMh7k3yMdqNOGl7VrFU6OnPx3YREP73rRCREuKI6nohvdHtiXlzCTpxizn/Hu8yt+Q/aZgkqp2eP7k5Afe3B7cw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k0o4NwVJVHu0UnaSq1bF7eZ+QNe1mIVG1pRU39f241mC4HSWlRN2rsEQnD3jlEw2VYKb+AS5fYeQrbpXRGI7kVQJwjTVjdMutECI6uMYtOk6gYhr8w0CgB+nXNpASduMCPHt44/AzDjWBh61bKKLY5H77V/ViJ7Un0sL0KwocvpAvcQganP9ZPjD/BTIG+qJ+8LE5XhS8MpuPwXv5smQasPhAtBQSCpy17lpBgCBMCy7jKoKw5Curg9mfDUxpo/miFRnW8Wlwk0cSb4jh7b1xwNZiySHeRmxl14OOO8qZ2HLwGQp8fcmpZBQI0UrleXPnLbyrtfuks/KKp+0bvOJ8A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Tue, 22 Sep 2026 05:26:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Mail-followup-to: "Orzel, Michal" <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>

On Mon, Sep 14, 2026 at 05:55:29PM +0200, Orzel, Michal wrote:
> 
> 
> On 25-Aug-26 02:35, Volodymyr Babchuk wrote:
> > Hi,
> > 
> > 
> > I have only one small question to this patch. Please see below.
> > 
> > Mykola Kvach <mykola_kvach@xxxxxxxx> writes:
> > 
> >> The allocated_irqs bitmap in the existing vGIC implementation stores eSPI
> >> allocation bits immediately after the regular vIRQ bits.
> >> vgic_reserve_virq() converts an eSPI INTID to this compressed bitmap index,
> >> but vgic_free_virq() used the raw INTID.
> >>
> >> Freeing INTID 4096 therefore clears bit 4096 instead of the first eSPI bit.
> >> This writes beyond allocated_irqs and leaves the intended eSPI bit set.
> >> Valid eSPIs reach this path during DOMCTL bind failure cleanup and unbind,
> >> and during vPL011 teardown.
> >>
> >> Add virq_to_idx(), the inverse of idx_to_virq(), and use it when reserving
> >> and freeing vIRQs. Validate a vIRQ before clearing its allocation bit.
> >>
> >> Fixes: bdde400c6e1b ("xen/arm: vgic: add resource management for extended 
> >> SPIs")
> >> Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> >> ---
> >> Changes in v3:
> >> - Adapt virq_to_idx() to the configuration-neutral is_espi() helper.
> >>
> >> Changes in v2:
> >> - Call is_espi() without a configuration guard.
> >> ---
> >>  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 e14123a30a..e541348a5c 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)
> Please add a comment at the top of the function about the layout these two
> helpers encode to prevent such problems in the future.

Ack.

Best regards,
Mykola



 


Rackspace

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