powerpc: smp: remove hack to obtain offset of task_struct::cpu
Instead of relying on awful hacks to obtain the offset of the cpu field in struct task_struct, move it back into struct thread_info, which does not create the same level of circular dependency hell when trying to include the header file that defines it. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
bcf9033e54
commit
336868afba
@ -446,17 +446,6 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CONFIG_SMP
|
||||
ifdef CONFIG_PPC32
|
||||
prepare: task_cpu_prepare
|
||||
|
||||
PHONY += task_cpu_prepare
|
||||
task_cpu_prepare: prepare0
|
||||
$(eval KBUILD_CFLAGS += -D_TASK_CPU=$(shell awk '{if ($$2 == "TASK_CPU") print $$3;}' include/generated/asm-offsets.h))
|
||||
|
||||
endif # CONFIG_PPC32
|
||||
endif # CONFIG_SMP
|
||||
|
||||
PHONY += checkbin
|
||||
# Check toolchain versions:
|
||||
# - gcc-4.6 is the minimum kernel-wide version so nothing required.
|
||||
|
@ -87,22 +87,7 @@ int is_cpu_dead(unsigned int cpu);
|
||||
/* 32-bit */
|
||||
extern int smp_hw_index[];
|
||||
|
||||
/*
|
||||
* 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
|
||||
#define raw_smp_processor_id() (*(unsigned int *)((void *)current + _TASK_CPU))
|
||||
#endif
|
||||
#define raw_smp_processor_id() (current_thread_info()->cpu)
|
||||
#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
|
||||
|
||||
static inline int get_hard_smp_processor_id(int cpu)
|
||||
|
@ -9,8 +9,6 @@
|
||||
* #defines from the assembly-language output.
|
||||
*/
|
||||
|
||||
#define GENERATING_ASM_OFFSETS /* asm/smp.h */
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/sched.h>
|
||||
|
Loading…
Reference in New Issue
Block a user