2022-04-08 10:31:18

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 3/4] x86,objtool: Mark cpu_startup_entry() __noreturn

GCC-8 isn't clever enough to figure out that cpu_start_entry() is a
noreturn while objtool is. This results in code after the call in
start_secondary(). Give GCC a hand so that they all agree on things.

vmlinux.o: warning: objtool: start_secondary()+0x10e: unreachable

Reported-by: Rick Edgecombe <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
include/linux/cpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -167,7 +167,7 @@ static inline int suspend_disable_second
static inline void suspend_enable_secondary_cpus(void) { }
#endif /* !CONFIG_PM_SLEEP_SMP */

-void cpu_startup_entry(enum cpuhp_state state);
+void __noreturn cpu_startup_entry(enum cpuhp_state state);

void cpu_idle_poll_ctrl(bool enable);




2022-04-12 21:13:24

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH 3/4] x86,objtool: Mark cpu_startup_entry() __noreturn

On Fri, Apr 08, 2022 at 11:45:55AM +0200, Peter Zijlstra wrote:
> GCC-8 isn't clever enough to figure out that cpu_start_entry() is a
> noreturn while objtool is. This results in code after the call in
> start_secondary(). Give GCC a hand so that they all agree on things.
>
> vmlinux.o: warning: objtool: start_secondary()+0x10e: unreachable
>
> Reported-by: Rick Edgecombe <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> include/linux/cpu.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -167,7 +167,7 @@ static inline int suspend_disable_second
> static inline void suspend_enable_secondary_cpus(void) { }
> #endif /* !CONFIG_PM_SLEEP_SMP */
>
> -void cpu_startup_entry(enum cpuhp_state state);
> +void __noreturn cpu_startup_entry(enum cpuhp_state state);
>
> void cpu_idle_poll_ctrl(bool enable);

Also needs added to the objtool noreturn list.

--
Josh

2022-04-12 23:59:52

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [PATCH 3/4] x86,objtool: Mark cpu_startup_entry() __noreturn

On Fri, Apr 08, 2022 at 11:45:55AM +0200, Peter Zijlstra wrote:
> GCC-8 isn't clever enough to figure out that cpu_start_entry() is a
> noreturn while objtool is. This results in code after the call in
> start_secondary(). Give GCC a hand so that they all agree on things.
>
> vmlinux.o: warning: objtool: start_secondary()+0x10e: unreachable
>
> Reported-by: Rick Edgecombe <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> include/linux/cpu.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -167,7 +167,7 @@ static inline int suspend_disable_second
> static inline void suspend_enable_secondary_cpus(void) { }
> #endif /* !CONFIG_PM_SLEEP_SMP */
>
> -void cpu_startup_entry(enum cpuhp_state state);
> +void __noreturn cpu_startup_entry(enum cpuhp_state state);
>
> void cpu_idle_poll_ctrl(bool enable);

I just ran into this:

init/main.o: warning: objtool: rest_init() falls through to next function kernel_init()

so we need this as well:

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 565fec451d69..fab2235599a0 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -184,6 +184,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
"do_group_exit",
"stop_this_cpu",
"__invalid_creds",
+ "cpu_startup_entry",
};

if (!func)

2022-04-20 17:17:34

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [tip: x86/urgent] x86,objtool: Mark cpu_startup_entry() __noreturn

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: d4e5268a08b211b536fed29beb24271ecd85187e
Gitweb: https://git.kernel.org/tip/d4e5268a08b211b536fed29beb24271ecd85187e
Author: Peter Zijlstra <[email protected]>
AuthorDate: Fri, 08 Apr 2022 11:45:55 +02:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Tue, 19 Apr 2022 21:58:48 +02:00

x86,objtool: Mark cpu_startup_entry() __noreturn

GCC-8 isn't clever enough to figure out that cpu_start_entry() is a
noreturn while objtool is. This results in code after the call in
start_secondary(). Give GCC a hand so that they all agree on things.

vmlinux.o: warning: objtool: start_secondary()+0x10e: unreachable

Reported-by: Rick Edgecombe <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
include/linux/cpu.h | 2 +-
tools/objtool/check.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 9cf51e4..54dc2f9 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -167,7 +167,7 @@ static inline int suspend_disable_secondary_cpus(void) { return 0; }
static inline void suspend_enable_secondary_cpus(void) { }
#endif /* !CONFIG_PM_SLEEP_SMP */

-void cpu_startup_entry(enum cpuhp_state state);
+void __noreturn cpu_startup_entry(enum cpuhp_state state);

void cpu_idle_poll_ctrl(bool enable);

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index bd0c2c8..e3a675d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -184,6 +184,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
"do_group_exit",
"stop_this_cpu",
"__invalid_creds",
+ "cpu_startup_entry",
};

if (!func)