From patchwork Mon Jan 10 18:12:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12709022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0712CC433EF for ; Mon, 10 Jan 2022 18:13:22 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.255523.437882 (Exim 4.92) (envelope-from ) id 1n6zA6-0001n3-L7; Mon, 10 Jan 2022 18:12:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 255523.437882; Mon, 10 Jan 2022 18:12:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n6zA6-0001mw-H8; Mon, 10 Jan 2022 18:12:54 +0000 Received: by outflank-mailman (input) for mailman id 255523; Mon, 10 Jan 2022 18:12:53 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n6zA4-0001mq-RY for xen-devel@lists.xenproject.org; Mon, 10 Jan 2022 18:12:53 +0000 Received: from galois.linutronix.de (galois.linutronix.de [193.142.43.55]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ea4d805d-7240-11ec-81c1-a30af7de8005; Mon, 10 Jan 2022 19:12:50 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ea4d805d-7240-11ec-81c1-a30af7de8005 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1641838366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2zo1GoaegfwLq8ByWLgrCdt6kQL15RfNmR27qdFkCXs=; b=wg+0jYPkfyXBANMF9DrbB1VZY/A2H3NxCDNL0PdKZaQjveELygI6vChYjpmK8mezF1B8JM 3Q6Fgd45hThR6NFyrAztLFQW0Du/St5l9y9ZtElwgFl9NDDq0PXVzJtEVKov8EaNRDZ81L eVdqnmysikOkVjpjAg882Gsjz6yZ54Uctmk12wQHCofZiwWVPnCbHkpvv4tDyYO3vZLG9w e64U20W7FggbG9+ID3eENSFzucC7Eorc5fEgfrJ4OKYz0CE6hPEZM+Xgk2ce8kuvb0VAsa X3V2Ri9KCwv0+VUgAxjPNl/CVqXJXoiumYuNcRD9koqxMMscv8p75zWFHCgf8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1641838366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2zo1GoaegfwLq8ByWLgrCdt6kQL15RfNmR27qdFkCXs=; b=1JyyFqm//sjHNxcOA43/6zXwebeoZM76NF5Ms6lFcm7i8cDw3SAOwzaBpYafr8eAGkMdhU XC6nlPN+OSbMq8AQ== To: LKML Cc: 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 Subject: [patch] genirq/msi: Populate sysfs entry only once In-Reply-To: <20211206210749.224917330@linutronix.de> References: <20211206210600.123171746@linutronix.de> <20211206210749.224917330@linutronix.de> Date: Mon, 10 Jan 2022 19:12:45 +0100 Message-ID: <87leznqx2a.ffs@tglx> MIME-Version: 1.0 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 Tested-by: Borislav Petkov Reviewed-by: Greg Kroah-Hartman Reviewed-by: Cédric Le Goater --- 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++; }