Message ID | e47fc487980d5330e6059ac6e16416bec88cda0e.1676358308.git.jpoimboe@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2810935wrn; Mon, 13 Feb 2023 23:09:26 -0800 (PST) X-Google-Smtp-Source: AK7set+7lcDFKW0lMfE4LlmraON+Lg7SZlXOzPKivgIotwFXqAxceGmewr1X80k5P6SfVjsW7s5S X-Received: by 2002:a17:906:d8a3:b0:8ab:4c4:d0f6 with SMTP id qc3-20020a170906d8a300b008ab04c4d0f6mr1760689ejb.56.1676358566311; Mon, 13 Feb 2023 23:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676358566; cv=none; d=google.com; s=arc-20160816; b=Rsv6lzSU/yXA2oPsM7XXZxeHGom46sTDQYmgZHj3ZTeIAdR4dqb+LHoJQCI9vlqRek W759zuzTv8d/CDoyCzgzo47uDqcuEQl8co7Kim4EFYc9xn1B68HqULAGuDUZaZQbR7HQ DDejZMlZG1DbTuxKLmiuG42g+S+L73PHxoZORMIJG+r5kHfIwKFcNrDbqUs7PGMhvmeR U93W1gVaEt4tv6tUdpcLLjbrtH8S9fetw07osC6S9PmL02HtltNdCGpwTlvr9NXAuefk YbtKV9W4o47LTh4rc3CuAFMo6KH24YveVzuk6xL3VilaoIle3FYp0zI+unuq2cgAEs0f IuOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UPa0lvoKe+AfdzaTg82aZbagclk2AJU9d2UD1Pk6i7c=; b=OxXjc9v6JsjfKbBUCW/sIpDESx9StDr2vAiygoNOxOUNY1C03yuDT0I7R/M7istwsD xMQAb6p8RT4Wn5xeU/AITAQHKKdZJgq9RkvHg5PFcfx+mDF36KC2eS/B9RpjCuOsztol /PDBY1jNmePNa/xAk9gfjfPqJwFEdOjoIR1NKaByp6ktxtjG1RtEw0WNfDupnfzDuETh wrcoQJk9peibnhhCis74aqGC1KyVmJLgCk6F3m3emKL1TklSenzYjH7VmWF2i9Y3yREs HduELRCRFZnohYK4zvqXU+tDOKSAqD7HJQm7iQY2murxT7uObebS3irU5VZv6UhOKJvU mqiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uWSwmz7m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ez17-20020a1709070bd100b008ab771ffcdbsi13635405ejc.317.2023.02.13.23.09.03; Mon, 13 Feb 2023 23:09:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uWSwmz7m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231918AbjBNHHj (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Tue, 14 Feb 2023 02:07:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjBNHHZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Feb 2023 02:07:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EABA51E9D7; Mon, 13 Feb 2023 23:06:59 -0800 (PST) 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 720FD61467; Tue, 14 Feb 2023 07:06:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31830C433AC; Tue, 14 Feb 2023 07:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676358415; bh=oKr+64PCQbKmVhIylAaRqnfLnM47aB4SsgpB++1picw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uWSwmz7maJITaav1CLWBhY0wq77E2TQEFKj9SKI7oT4oMpxVqb3lnDG9f8hCIs7vx HVTVUNH/CEB+xnKwRtPrWXCjjXX2QoZ6agft9A4TFcEbpCpKEzT26/mEGxqnQiz95o zkfcQQxa8cvlxnYRQYWNZohgh7gKqA1EEVTuJI/igRwz7PuH4itxjP9aX6J5xm6WHv AqE4y1+HEUJO8h2TaNm+RWH5Twq/9S9n93G3vmmCUYhVhMNLRNmz8AdGFdTOEjqc58 eqx4YmZwfXjO7QxwI0rh92vrbJzEUVkWPecbQGWlfLvjGw76DlG8tSDV49G6oiOOzu wAL7TpohQ8anw== From: Josh Poimboeuf <jpoimboe@kernel.org> To: linux-kernel@vger.kernel.org Cc: jgross@suse.com, richard.henderson@linaro.org, ink@jurassic.park.msu.ru, mattst88@gmail.com, linux-alpha@vger.kernel.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, guoren@kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, chenhuacai@kernel.org, kernel@xen0n.name, loongarch@lists.linux.dev, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, tsbogend@alpha.franken.de, linux-mips@vger.kernel.org, jiaxun.yang@flygoat.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, linuxppc-dev@lists.ozlabs.org, ysato@users.sourceforge.jp, dalias@libc.org, linux-sh@vger.kernel.org, davem@davemloft.net, sparclinux@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, chris@zankel.net, jcmvbkbc@gmail.com, linux-xtensa@linux-xtensa.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, paulmck@kernel.org Subject: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn Date: Mon, 13 Feb 2023 23:05:38 -0800 Message-Id: <e47fc487980d5330e6059ac6e16416bec88cda0e.1676358308.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <cover.1676358308.git.jpoimboe@kernel.org> References: <cover.1676358308.git.jpoimboe@kernel.org> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757789359682997448?= X-GMAIL-MSGID: =?utf-8?q?1757789359682997448?= |
Series |
cpu,sched: Mark arch_cpu_idle_dead() __noreturn
|
|
Commit Message
Josh Poimboeuf
Feb. 14, 2023, 7:05 a.m. UTC
cpu_die() doesn't return. Annotate it as such. By extension this also
makes arch_cpu_idle_dead() noreturn.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
arch/arm64/include/asm/smp.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 14/2/23 08:05, Josh Poimboeuf wrote: > cpu_die() doesn't return. Annotate it as such. By extension this also > makes arch_cpu_idle_dead() noreturn. > > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> > --- > arch/arm64/include/asm/smp.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h > index fc55f5a57a06..5733a31bab08 100644 > --- a/arch/arm64/include/asm/smp.h > +++ b/arch/arm64/include/asm/smp.h > @@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) > extern int __cpu_disable(void); > > extern void __cpu_die(unsigned int cpu); > -extern void cpu_die(void); > +extern void __noreturn cpu_die(void); > extern void cpu_die_early(void); Shouldn't cpu_operations::cpu_die() be declared noreturn first?
On Tue, Feb 14, 2023 at 09:13:08AM +0100, Philippe Mathieu-Daudé wrote: > On 14/2/23 08:05, Josh Poimboeuf wrote: > > cpu_die() doesn't return. Annotate it as such. By extension this also > > makes arch_cpu_idle_dead() noreturn. > > > > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> > > --- > > arch/arm64/include/asm/smp.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h > > index fc55f5a57a06..5733a31bab08 100644 > > --- a/arch/arm64/include/asm/smp.h > > +++ b/arch/arm64/include/asm/smp.h > > @@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) > > extern int __cpu_disable(void); > > extern void __cpu_die(unsigned int cpu); > > -extern void cpu_die(void); > > +extern void __noreturn cpu_die(void); > > extern void cpu_die_early(void); > > Shouldn't cpu_operations::cpu_die() be declared noreturn first? The cpu_die() function ends with a BUG(), and so does not return, even if a cpu_operations::cpu_die() function that it calls erroneously returned. We *could* mark cpu_operations::cpu_die() as noreturn, but I'd prefer that we did not so that the compiler doesn't optimize away the BUG() which is there to catch such erroneous returns. That said, could we please add __noreturn to the implementation of cpu_die() in arch/arm64/kernel/smp.c? i.e. the fixup below. With that fixup: Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. ---->8---- diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index ffc5d76cf695..a98a76f7c1c6 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -361,7 +361,7 @@ void __cpu_die(unsigned int cpu) * Called from the idle thread for the CPU which has been shutdown. * */ -void cpu_die(void) +void __noreturn cpu_die(void) { unsigned int cpu = smp_processor_id(); const struct cpu_operations *ops = get_cpu_ops(cpu);
On Wed, Feb 15, 2023 at 01:09:21PM +0000, Mark Rutland wrote: > On Tue, Feb 14, 2023 at 09:13:08AM +0100, Philippe Mathieu-Daudé wrote: > > On 14/2/23 08:05, Josh Poimboeuf wrote: > > > cpu_die() doesn't return. Annotate it as such. By extension this also > > > makes arch_cpu_idle_dead() noreturn. > > > > > > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> > > > --- > > > arch/arm64/include/asm/smp.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h > > > index fc55f5a57a06..5733a31bab08 100644 > > > --- a/arch/arm64/include/asm/smp.h > > > +++ b/arch/arm64/include/asm/smp.h > > > @@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) > > > extern int __cpu_disable(void); > > > extern void __cpu_die(unsigned int cpu); > > > -extern void cpu_die(void); > > > +extern void __noreturn cpu_die(void); > > > extern void cpu_die_early(void); > > > > Shouldn't cpu_operations::cpu_die() be declared noreturn first? > > The cpu_die() function ends with a BUG(), and so does not return, even if a > cpu_operations::cpu_die() function that it calls erroneously returned. > > We *could* mark cpu_operations::cpu_die() as noreturn, but I'd prefer that we > did not so that the compiler doesn't optimize away the BUG() which is there to > catch such erroneous returns. > > That said, could we please add __noreturn to the implementation of cpu_die() in > arch/arm64/kernel/smp.c? i.e. the fixup below. Done. > With that fixup: > > Acked-by: Mark Rutland <mark.rutland@arm.com> Thanks!
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index fc55f5a57a06..5733a31bab08 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -100,7 +100,7 @@ static inline void arch_send_wakeup_ipi_mask(const struct cpumask *mask) extern int __cpu_disable(void); extern void __cpu_die(unsigned int cpu); -extern void cpu_die(void); +extern void __noreturn cpu_die(void); extern void cpu_die_early(void); static inline void cpu_park_loop(void)