From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 08D4FC5B555 for ; Tue, 3 Jun 2025 15:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o1dxeNCnmjTauoiI6ZTbM5n8PM0YLSl4n6WB+BxZiv8=; b=zLsi7yS/5n0/xKTmSDhuSkgAiM +70sA6s8KdQZCWm37BtKISyq7uwN2mE06hOugR7MblkqnpLTeFre6cMM+X2Ftb5Sfb4cJkHPvwTa9 u44klSK1T/ZbFmCh54D94z1j6lCqS+nrS7dWyKQND+p3M/8V5AetY6hLIjmsFN9Dn1aRfj7R+/B6Q K2LB8heWTQweYT6zRVdJywaBFW9ErKgaDEhrmSyrq8ffNK0BHkK0i/AHuwJoLbTBPJqLJ79ouMwA2 x7QxJjVKYO08OBAyZvYm8n/5PRxqvtXje8rfo5u03xYCcbwz8F3T0t35CeNeZcopd690BWG/4D6J+ wl5r1hPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMTZ2-0000000BHV6-2FSW; Tue, 03 Jun 2025 15:28:32 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uMSK3-0000000B8Vz-0Q8T for linux-arm-kernel@lists.infradead.org; Tue, 03 Jun 2025 14:09:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id CE58944875; Tue, 3 Jun 2025 14:08:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7E17C4CEED; Tue, 3 Jun 2025 14:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748959738; bh=OlwtmLY1WNbhrrXFyRfa7IAa9h6HaHr459rqJj8wtLk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=e9mXz4WfQJHliuVYxmJFfPPB/T39ya3TyRloaF7hBQ26SCILVz4H6Z9XY6hegwwcp V4ymDCr9RBza6v8mbG7uUFBfOpSR/xVnUdxVHbqE7kyUEFWk70OW+KyDXiq58FnK55 LzvEE/EpF2/0ZO39svzhL8HwoEsZV3b/qM5Ock6DNhX5p3Zh84qADYS9vNxsYO/Vub euwo+WEtFMjtt4REvSUX6Duuy5a534vNBBYfPF2OMozlCmxgYvIBDEto2+MRhTum7n w7aYC1Jy47sC/V9gnBJ83+XGdYskPT0hnItTeZp9OtP01YJPrHBNfg9ztHUQSJ0VLG BSLbR6Yplp3jw== Received: from [149.88.19.236] (helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1uMSK0-002rHL-6y; Tue, 03 Jun 2025 15:08:56 +0100 Date: Tue, 03 Jun 2025 15:08:54 +0100 Message-ID: <87frggex3d.wl-maz@kernel.org> From: Marc Zyngier To: Lorenzo Pieralisi Cc: Zenghui Yu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Sascha Bischoff , Timothy Hayes Subject: Re: [PATCH v2 3/5] genirq/msi: Move prepare() call to per-device allocation In-Reply-To: <87h60wexch.wl-maz@kernel.org> References: <20250513163144.2215824-1-maz@kernel.org> <20250513163144.2215824-4-maz@kernel.org> <0b1d7aec-1eac-a9cd-502a-339e216e08a1@huawei.com> <87ldq9dm54.wl-maz@kernel.org> <87h60wexch.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 149.88.19.236 X-SA-Exim-Rcpt-To: lpieralisi@kernel.org, yuzenghui@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tglx@linutronix.de, sascha.bischoff@arm.com, timothy.hayes@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250603_070859_187333_87BB8D5D X-CRM114-Status: GOOD ( 23.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 03 Jun 2025 15:03:26 +0100, Marc Zyngier wrote: > > On Tue, 03 Jun 2025 14:29:58 +0100, > Lorenzo Pieralisi wrote: > > > > > + if (!pci_setup_msi_device_domain(dev, nvec)) > > > > If pci_msi_vec_count(dev) > maxvec we would cap nvec and size the > > domain with the capped value. > > > > In __pci_enable_msix_range() we are sizing the device according to > > pci_msix_vec_count(dev) regardless of maxvec, if I read the code correctly. > > > > While fixing it it would be good to make them consistent unless there is > > a reason why they should not. > > This is indeed odd, but that'd be a separate fix. Something like: > > diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c > index 2090eef64b14..6ede55a7c5e6 100644 > --- a/drivers/pci/msi/msi.c > +++ b/drivers/pci/msi/msi.c > @@ -439,9 +439,6 @@ int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, > if (nvec < minvec) > return -ENOSPC; > > - if (nvec > maxvec) > - nvec = maxvec; > - > rc = pci_setup_msi_context(dev); > if (rc) > return rc; > @@ -449,6 +446,9 @@ int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, > if (!pci_setup_msi_device_domain(dev, nvec)) > return -ENODEV; > > + if (nvec > maxvec) > + nvec = maxvec; > + > for (;;) { > if (affd) { > nvec = irq_calc_affinity_vectors(minvec, nvec, affd); > Actually, let's lump the two together. There is no reason to wait. M. -- Jazz isn't dead. It just smells funny.