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 8C907C433EF for ; Sat, 18 Jun 2022 09:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oXf14KaHxaU5BHW+lbGo6uRrBxFyvCAjGBoGymhwW1Q=; b=dM29p3F6fZHyX6 4Z0kSval1ga9nep3zWcngLGyufv4GTO53RcFJuHHZpwh20cWcH13lWRvRet9J9mV/BxSxzaxpuZ8/ Di+/0l4QcbdepXWtc+ShDhpXA4tlWk4C/sOnMtkDYZA4SZAzVm4Fa9egfbvHsXIthTYTNvxAuMD8N hiU1M5EqYEUsOH7ryU1/C+SSQZOcP3eBZ0MLlTQqtevfWiPJBepwmI1nKGORpZr9P47/qcEcgmaXk qCQxF6pu0GPWmdMokkzvjh6I4ef7CP0MViofttzfkF23cdEwuw7py2zHHTYEqGRkyEP/VmgcHh/3I Q/Kc5ZKLYMZFQv8dIdCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2UMH-00AqQ5-4I; Sat, 18 Jun 2022 09:03:09 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2UMC-00AqOa-3X; Sat, 18 Jun 2022 09:03:05 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EB6260DCC; Sat, 18 Jun 2022 09:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A834CC3411A; Sat, 18 Jun 2022 09:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655542981; bh=G2NVbw5GE1KUhRgKcRWq5GgSU83SgY43XdstIbqHLgw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hsZdCg4KciT1MCynTN15yLnPrAMI9/GR5LX/K1fDWZ+2jyhgqSbOm6WmbHsiK0wxO VUmi60QwaPkk8nhlcTGsmwJnUsfpGeQ4IjJG4eVZwBtH2sg3Fe+O2EtP0XpbnzKjcD O6JRKI6BS1qI9ex+8CXOIP92rCqIyOI05VEOPDPCfdsEbnOzZDMuOLsn2SoOg462V5 Hf1uuKJ5LKd4Jm2F7gBMihn1aVgiAAYGDClGLK8WnG7dSS2VRLIrNCFZnWJchegUDq /WGUI0MUa4u2ViBuvVuVm2FbJtk2Eo8wNVmSND5aKlggLSpKDSrb1sZSaQFgYTMl7y ctyVQWmXxEXyg== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.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 1o2ULA-001RtF-1J; Sat, 18 Jun 2022 10:02:59 +0100 Date: Sat, 18 Jun 2022 10:01:55 +0100 Message-ID: <87h74ipcos.wl-maz@kernel.org> From: Marc Zyngier To: Samuel Holland Cc: Thomas Gleixner , Palmer Dabbelt , Paul Walmsley , Albert Ou , Bartosz Golaszewski , Guo Ren , Mark Rutland , Russell King , Wei Xu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v2 4/6] genirq: Provide an IRQ affinity mask in non-SMP configs In-Reply-To: <20220616064028.57933-5-samuel@sholland.org> References: <20220616064028.57933-1-samuel@sholland.org> <20220616064028.57933-5-samuel@sholland.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/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: samuel@sholland.org, tglx@linutronix.de, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, brgl@bgdev.pl, guoren@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, xuwei5@hisilicon.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org 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-20220618_020304_283485_14B1940D X-CRM114-Status: GOOD ( 25.68 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Samuel, On Thu, 16 Jun 2022 07:40:26 +0100, Samuel Holland wrote: > > IRQ affinity masks are not allocated in uniprocessor configurations. > This requires special case non-SMP code in drivers for irqchips which > have per-CPU enable or mask registers. > > Since IRQ affinity is always the same in a uniprocessor configuration, > we can still provide the correct affinity mask without allocating one > per IRQ. We can reuse the system-wide cpu_possible_mask. > > By returning a real cpumask from irq_data_get_affinity_mask even when > SMP is disabled, irqchip drivers which iterate over that mask will > automatically do the right thing. > > Signed-off-by: Samuel Holland > --- > > (no changes since v1) > > include/linux/irq.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/linux/irq.h b/include/linux/irq.h > index 69ee4e2f36ce..d5e958b026aa 100644 > --- a/include/linux/irq.h > +++ b/include/linux/irq.h > @@ -151,7 +151,9 @@ struct irq_common_data { > #endif > void *handler_data; > struct msi_desc *msi_desc; > +#ifdef CONFIG_SMP > cpumask_var_t affinity; > +#endif > #ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK > cpumask_var_t effective_affinity; > #endif > @@ -881,7 +883,11 @@ static inline int irq_data_get_node(struct irq_data *d) > > static inline struct cpumask *irq_data_get_affinity_mask(struct irq_data *d) > { > +#ifdef CONFIG_SMP > return d->common->affinity; > +#else > + return &__cpu_possible_mask; > +#endif I have a bad feeling about this one. Being in a !SMP configuration doesn't necessarily mean that __cpu_possible_mask only contains a single CPU, specially with things like CONFIG_INIT_ALL_POSSIBLE. I can also imagine an architecture populating this bitmap from firmware tables irrespective of the SMP status of the kernel. Can't you use something like: return cpumask_of(0); which is guaranteed to be the right thing on !SMP configuration? Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel