From 2a2e8202c7a16a85a881ad2b6e32ccbebdc01dda Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Thu, 4 Nov 2021 09:26:28 +0100 Subject: parisc: move CPU field back into thread_info In commit 2214c0e77259 ("parisc: Move thread_info into task struct") PA-RISC gained support for THREAD_INFO_IN_TASK while changes were already underway to keep the CPU field in thread_info rather than move it into task_struct when THREAD_INFO_IN_TASK is enabled. The result is a broken build for all PA-RISC configs that enable SMP. So let's partially revert that commit, and get rid of the ugly hack to get at the offset of task_struct::cpu without having to include linux/sched.h, and put the CPU field back where it was before. Reported-by: Guenter Roeck Fixes: bcf9033e5449 ("sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y") Signed-off-by: Ard Biesheuvel Signed-off-by: Helge Deller --- arch/parisc/include/asm/smp.h | 19 ++----------------- arch/parisc/include/asm/thread_info.h | 3 +++ 2 files changed, 5 insertions(+), 17 deletions(-) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/smp.h b/arch/parisc/include/asm/smp.h index 16d41127500e..2279ebe5e2da 100644 --- a/arch/parisc/include/asm/smp.h +++ b/arch/parisc/include/asm/smp.h @@ -32,25 +32,10 @@ extern void smp_send_all_nop(void); extern void arch_send_call_function_single_ipi(int cpu); extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); +#define raw_smp_processor_id() (current_thread_info()->cpu) + #endif /* !ASSEMBLY */ -/* - * This is particularly ugly: it appears we can't actually get the definition - * of task_struct here, but we need access to the CPU this task is running on. - * Instead of using task_struct we're using TASK_CPU which is extracted from - * asm-offsets.h by kbuild to get the current processor ID. - * - * This also needs to be safeguarded when building asm-offsets.s because at - * that time TASK_CPU is not defined yet. It could have been guarded by - * TASK_CPU itself, but we want the build to fail if TASK_CPU is missing - * when building something else than asm-offsets.s - */ -#ifdef GENERATING_ASM_OFFSETS -#define raw_smp_processor_id() (0) -#else -#include -#define raw_smp_processor_id() (*(unsigned int *)((void *)current + TASK_CPU)) -#endif #else /* CONFIG_SMP */ static inline void smp_send_all_nop(void) { return; } diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 75657c2c54e1..1a58795f785c 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h @@ -9,6 +9,9 @@ struct thread_info { unsigned long flags; /* thread_info flags (see TIF_*) */ int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ +#ifdef CONFIG_SMP + unsigned int cpu; +#endif }; #define INIT_THREAD_INFO(tsk) \ -- cgit v1.2.3