From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.skyhub.de (mail.skyhub.de. [5.9.137.197]) by gmr-mx.google.com with ESMTPS id x32si352773lfu.8.2022.01.10.10.15.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jan 2022 10:15:05 -0800 (PST) Date: Mon, 10 Jan 2022 19:15:03 +0100 From: Borislav Petkov Subject: Re: [patch] genirq/msi: Populate sysfs entry only once Message-ID: References: <20211206210600.123171746@linutronix.de> <20211206210749.224917330@linutronix.de> <87leznqx2a.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87leznqx2a.ffs@tglx> To: Thomas Gleixner Cc: LKML , Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , linux-pci@vger.kernel.org, Cedric Le Goater , xen-devel@lists.xenproject.org, Juergen Gross , Greg Kroah-Hartman , Niklas Schnelle , linux-s390@vger.kernel.org, Heiko Carstens , Christian Borntraeger , Logan Gunthorpe , Jon Mason , Dave Jiang , Allen Hubbe , linux-ntb@googlegroups.com List-ID: On Mon, Jan 10, 2022 at 07:12:45PM +0100, Thomas Gleixner wrote: > The MSI entries for multi-MSI are populated en bloc for the MSI descriptor, > but the current code invokes the population inside the per interrupt loop > which triggers a warning in the sysfs code and causes the interrupt > allocation to fail. > > Move it outside of the loop so it works correctly for single and multi-MSI. > > Fixes: bf5e758f02fc ("genirq/msi: Simplify sysfs handling") > Reported-by: Borislav Petkov > Signed-off-by: Thomas Gleixner > --- > kernel/irq/msi.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > --- a/kernel/irq/msi.c > +++ b/kernel/irq/msi.c > @@ -887,12 +887,11 @@ int __msi_domain_alloc_irqs(struct irq_d > ret = msi_init_virq(domain, virq + i, vflags); > if (ret) > return ret; > - > - if (info->flags & MSI_FLAG_DEV_SYSFS) { > - ret = msi_sysfs_populate_desc(dev, desc); > - if (ret) > - return ret; > - } > + } > + if (info->flags & MSI_FLAG_DEV_SYSFS) { > + ret = msi_sysfs_populate_desc(dev, desc); > + if (ret) > + return ret; > } > allocated++; > } Yap, works. Tested-by: Borislav Petkov -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette