Skip to content

Commit 2a2e820

Browse files
ardbiesheuvelhdeller
authored andcommitted
parisc: move CPU field back into thread_info
In commit 2214c0e ("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 <linux@roeck-us.net> Fixes: bcf9033 ("sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y") Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 7e99271 commit 2a2e820

4 files changed

Lines changed: 5 additions & 24 deletions

File tree

arch/parisc/include/asm/smp.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,10 @@ extern void smp_send_all_nop(void);
3232
extern void arch_send_call_function_single_ipi(int cpu);
3333
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
3434

35+
#define raw_smp_processor_id() (current_thread_info()->cpu)
36+
3537
#endif /* !ASSEMBLY */
3638

37-
/*
38-
* This is particularly ugly: it appears we can't actually get the definition
39-
* of task_struct here, but we need access to the CPU this task is running on.
40-
* Instead of using task_struct we're using TASK_CPU which is extracted from
41-
* asm-offsets.h by kbuild to get the current processor ID.
42-
*
43-
* This also needs to be safeguarded when building asm-offsets.s because at
44-
* that time TASK_CPU is not defined yet. It could have been guarded by
45-
* TASK_CPU itself, but we want the build to fail if TASK_CPU is missing
46-
* when building something else than asm-offsets.s
47-
*/
48-
#ifdef GENERATING_ASM_OFFSETS
49-
#define raw_smp_processor_id() (0)
50-
#else
51-
#include <asm/asm-offsets.h>
52-
#define raw_smp_processor_id() (*(unsigned int *)((void *)current + TASK_CPU))
53-
#endif
5439
#else /* CONFIG_SMP */
5540

5641
static inline void smp_send_all_nop(void) { return; }

arch/parisc/include/asm/thread_info.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
struct thread_info {
1010
unsigned long flags; /* thread_info flags (see TIF_*) */
1111
int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
12+
#ifdef CONFIG_SMP
13+
unsigned int cpu;
14+
#endif
1215
};
1316

1417
#define INIT_THREAD_INFO(tsk) \

arch/parisc/kernel/asm-offsets.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org>
1515
*/
1616

17-
#define GENERATING_ASM_OFFSETS /* asm/smp.h */
18-
1917
#include <linux/types.h>
2018
#include <linux/sched.h>
2119
#include <linux/thread_info.h>
@@ -39,9 +37,6 @@ int main(void)
3937
{
4038
DEFINE(TASK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags));
4139
DEFINE(TASK_STACK, offsetof(struct task_struct, stack));
42-
#ifdef CONFIG_SMP
43-
DEFINE(TASK_CPU, offsetof(struct task_struct, cpu));
44-
#endif
4540
BLANK();
4641
DEFINE(TASK_REGS, offsetof(struct task_struct, thread.regs));
4742
DEFINE(TASK_PT_PSW, offsetof(struct task_struct, thread.regs.gr[ 0]));

arch/parisc/kernel/smp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ int smp_boot_one_cpu(int cpuid, struct task_struct *idle)
339339
const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid);
340340
long timeout;
341341

342-
idle->cpu = cpuid;
343-
344342
/* Let _start know what logical CPU we're booting
345343
** (offset into init_tasks[],cpu_data[])
346344
*/

0 commit comments

Comments
 (0)