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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00D5EECAAD2 for ; Sat, 27 Aug 2022 15:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233056AbiH0PY0 (ORCPT ); Sat, 27 Aug 2022 11:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbiH0PYY (ORCPT ); Sat, 27 Aug 2022 11:24:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC654620D for ; Sat, 27 Aug 2022 08:24:24 -0700 (PDT) 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 9A73360DE3 for ; Sat, 27 Aug 2022 15:24:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02E7EC433C1; Sat, 27 Aug 2022 15:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661613863; bh=PiWQZ52g42zOcHYXEWFQDTM4nMRUI3ZQPjyEJmmv24A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gnhG9DXDZa4ZfKOfSExf77dp0LTV7h6cjWkX5MFo4QYCshoLoDV+AliicZSIFkJbs /BYLfzcSw4bx/OEDZu7lmlU5KrsaMs3nOYF5DfAUiGtBRRqof+HxJiVU61wRqwanaH Hftp/f6rkEpntvqYpnLoWsm/0DufxQB2FGyyJE28vnS+vGTEcOEam8AyOF7++nu4S4 wMsT8v5SHMGVKbPXi5A+aMpungbvYziTBIiCcNKKLtqye1v7zzOwb5AnU+PZ3VL2pM 5P6SbP3d/zS2EIeAJQGlIW3mQXMh/vf9V7LOfNCSjh/JB1RIQKibckKkeXQEs7mBfd mrL/0jVaWs1eg== Received: from [12.191.126.171] (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 1oRxfY-006BAw-H0; Sat, 27 Aug 2022 16:24:21 +0100 Date: Sat, 27 Aug 2022 16:24:17 +0100 Message-ID: <87tu5xr9pa.wl-maz@kernel.org> From: Marc Zyngier To: Xu Qiang Cc: , , , , , , , , Subject: Re: [PATCH -next 2/3] genirq/affinity: Define tmp_mask as a local variable in irq_do_set_affinity In-Reply-To: <20220827011351.9185-2-xuqiang36@huawei.com> References: <20220827011351.9185-1-xuqiang36@huawei.com> <20220827011351.9185-2-xuqiang36@huawei.com> 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") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 12.191.126.171 X-SA-Exim-Rcpt-To: xuqiang36@huawei.com, tglx@linutronix.de, frederic@kernel.org, peterz@infradead.org, nitesh@redhat.com, bigeasy@linutronix.de, douliyangs@gmail.com, linux-kernel@vger.kernel.org, guohanjun@huawei.com, weiyongjun1@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 27 Aug 2022 02:13:50 +0100, Xu Qiang wrote: >=20 > When irq_do_set_affinity is called, tmp_mask saved last time > does not make any sense. it is reassigned before each use, > so it should be defined as a local variable. >=20 > Fixes: 33de0aa4bae9 (=E2=80=9Cgenirq: Always limit the affinity to online= CPUs=E2=80=9D) > Signed-off-by: Xu Qiang > --- > kernel/irq/manage.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c > index c3423f552e0b..ae1c7eebdfa6 100644 > --- a/kernel/irq/manage.c > +++ b/kernel/irq/manage.c > @@ -218,7 +218,7 @@ int irq_do_set_affinity(struct irq_data *data, const = struct cpumask *mask, > int ret; > =20 > static DEFINE_RAW_SPINLOCK(tmp_mask_lock); > - static struct cpumask tmp_mask; > + struct cpumask tmp_mask; > =20 > if (!chip || !chip->irq_set_affinity) > return -EINVAL; Oh Gawd... Don't you see *WHY* this is a static structure? Hint: what is the effect of this on a machine with 4096 CPUs when the stack space is tight? And what would be the point of having a spinlock to protect a local variable? M. --=20 Without deviation from the norm, progress is not possible.