Skip to content

Commit c337c84

Browse files
seehearfeelchenhuacai
authored andcommitted
LoongArch: Put the body of play_dead() into arch_cpu_idle_dead()
The initial aim is to silence the following objtool warning: arch/loongarch/kernel/process.o: warning: objtool: arch_cpu_idle_dead() falls through to next function start_thread() According to tools/objtool/Documentation/objtool.txt, this is because the last instruction of arch_cpu_idle_dead() is a call to a noreturn function play_dead(). In order to silence the warning, one simple way is to add the noreturn function play_dead() to objtool's hard-coded global_noreturns array, that is to say, just put "NORETURN(play_dead)" into tools/objtool/noreturns.h, it works well. But I noticed that play_dead() is only defined once and only called by arch_cpu_idle_dead(), so put the body of play_dead() into the caller arch_cpu_idle_dead(), then remove the noreturn function play_dead() is an alternative way which can reduce the overhead of the function call at the same time. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 8879515 commit c337c84

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

arch/loongarch/include/asm/smp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ static inline void __cpu_die(unsigned int cpu)
9898
{
9999
loongson_cpu_die(cpu);
100100
}
101-
102-
extern void __noreturn play_dead(void);
103101
#endif
104102

105103
#endif /* __ASM_SMP_H */

arch/loongarch/kernel/process.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ EXPORT_SYMBOL(__stack_chk_guard);
6161
unsigned long boot_option_idle_override = IDLE_NO_OVERRIDE;
6262
EXPORT_SYMBOL(boot_option_idle_override);
6363

64-
#ifdef CONFIG_HOTPLUG_CPU
65-
void __noreturn arch_cpu_idle_dead(void)
66-
{
67-
play_dead();
68-
}
69-
#endif
70-
7164
asmlinkage void ret_from_fork(void);
7265
asmlinkage void ret_from_kernel_thread(void);
7366

arch/loongarch/kernel/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void loongson_cpu_die(unsigned int cpu)
317317
mb();
318318
}
319319

320-
void play_dead(void)
320+
void __noreturn arch_cpu_idle_dead(void)
321321
{
322322
register uint64_t addr;
323323
register void (*init_fn)(void);

0 commit comments

Comments
 (0)