Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Mark Rutland <mark.rutland@xxxxxxx>
- Subject: Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn
- From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
- Date: Wed, 15 Feb 2023 11:45:38 -0800
- Cc: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>, juri.lelli@xxxxxxxxxx, dalias@xxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, peterz@xxxxxxxxxxxxx, catalin.marinas@xxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, jiaxun.yang@xxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, bsegall@xxxxxxxxxx, jcmvbkbc@xxxxxxxxx, guoren@xxxxxxxxxx, hpa@xxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, kernel@xxxxxxxxxx, will@xxxxxxxxxx, vschneid@xxxxxxxxxx, f.fainelli@xxxxxxxxx, vincent.guittot@xxxxxxxxxx, ysato@xxxxxxxxxxxxx, chenhuacai@xxxxxxxxxx, linux@xxxxxxxxxxxxxxx, linux-csky@xxxxxxxxxxxxxxx, dietmar.eggemann@xxxxxxx, mingo@xxxxxxxxxx, bcm-kernel-feedback-list@xxxxxxxxxxxx, mgorman@xxxxxxx, mattst88@xxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, paulmck@xxxxxxxxxx, richard.henderson@xxxxxxxxxx, npiggin@xxxxxxxxx, ink@xxxxxxxxxxxxxxxxxxxx, rostedt@xxxxxxxxxxx, loongarch@xxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, jgross@xxxxxxxx, chris@xxxxxxxxxx, tsbogend@xxxxxxxxxxxxxxxx, bristot@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, bp@xxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, davem@xxxxxxxxxxxxx
- In-reply-to: <Y+zZgZIP7RPIgyQf@FVFF77S0Q05N>
- References: <cover.1676358308.git.jpoimboe@kernel.org> <e47fc487980d5330e6059ac6e16416bec88cda0e.1676358308.git.jpoimboe@kernel.org> <14274f04-2991-95bd-c29b-07e86e8755c1@linaro.org> <Y+zZgZIP7RPIgyQf@FVFF77S0Q05N>
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@xxxxxxxxxx>
> > > ---
> > > 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@xxxxxxx>
Thanks!
--
Josh
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]