Commit 7c19c2e5 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

powerpc: 'current_set' is now a table of task_struct pointers



The table of pointers 'current_set' has been used for retrieving
the stack and current. They used to be thread_info pointers as
they were pointing to the stack and current was taken from the
'task' field of the thread_info.

Now, the pointers of 'current_set' table are now both pointers
to task_struct and pointers to thread_info.

As they are used to get current, and the stack pointer is
retrieved from current's stack field, this patch changes
their type to task_struct, and renames secondary_ti to
secondary_current.

Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent a7916a1d
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -23,8 +23,8 @@
#include <uapi/asm/ucontext.h>
#include <uapi/asm/ucontext.h>


/* SMP */
/* SMP */
extern struct thread_info *current_set[NR_CPUS];
extern struct task_struct *current_set[NR_CPUS];
extern struct thread_info *secondary_ti;
extern struct task_struct *secondary_current;
void start_secondary(void *unused);
void start_secondary(void *unused);


/* kexec */
/* kexec */
+3 −3
Original line number Original line Diff line number Diff line
@@ -832,9 +832,9 @@ __secondary_start:
#endif /* CONFIG_PPC_BOOK3S_32 */
#endif /* CONFIG_PPC_BOOK3S_32 */


	/* get current's stack and current */
	/* get current's stack and current */
	lis	r1,secondary_ti@ha
	lis	r2,secondary_current@ha
	tophys(r1,r1)
	tophys(r2,r2)
	lwz	r2,secondary_ti@l(r1)
	lwz	r2,secondary_current@l(r2)
	tophys(r1,r2)
	tophys(r1,r2)
	lwz	r1,TASK_STACK(r1)
	lwz	r1,TASK_STACK(r1)


+2 −2
Original line number Original line Diff line number Diff line
@@ -1020,8 +1020,8 @@ _GLOBAL(start_secondary_47x)
	/* Now we can get our task struct and real stack pointer */
	/* Now we can get our task struct and real stack pointer */


	/* Get current's stack and current */
	/* Get current's stack and current */
	lis	r1,secondary_ti@ha
	lis	r2,secondary_current@ha
	lwz	r2,secondary_ti@l(r1)
	lwz	r2,secondary_current@l(r2)
	lwz	r1,TASK_STACK(r2)
	lwz	r1,TASK_STACK(r2)


	/* Current stack pointer */
	/* Current stack pointer */
+2 −2
Original line number Original line Diff line number Diff line
@@ -1091,8 +1091,8 @@ __secondary_start:
	bl	call_setup_cpu
	bl	call_setup_cpu


	/* get current's stack and current */
	/* get current's stack and current */
	lis	r1,secondary_ti@ha
	lis	r2,secondary_current@ha
	lwz	r2,secondary_ti@l(r1)
	lwz	r2,secondary_current@l(r2)
	lwz	r1,TASK_STACK(r2)
	lwz	r1,TASK_STACK(r2)


	/* stack */
	/* stack */
+4 −6
Original line number Original line Diff line number Diff line
@@ -76,7 +76,7 @@
static DEFINE_PER_CPU(int, cpu_state) = { 0 };
static DEFINE_PER_CPU(int, cpu_state) = { 0 };
#endif
#endif


struct thread_info *secondary_ti;
struct task_struct *secondary_current;
bool has_big_cores;
bool has_big_cores;


DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
@@ -631,7 +631,7 @@ void smp_send_stop(void)
}
}
#endif /* CONFIG_NMI_IPI */
#endif /* CONFIG_NMI_IPI */


struct thread_info *current_set[NR_CPUS];
struct task_struct *current_set[NR_CPUS];


static void smp_store_cpu_info(int id)
static void smp_store_cpu_info(int id)
{
{
@@ -896,7 +896,7 @@ void smp_prepare_boot_cpu(void)
	paca_ptrs[boot_cpuid]->__current = current;
	paca_ptrs[boot_cpuid]->__current = current;
#endif
#endif
	set_numa_node(numa_cpu_lookup_table[boot_cpuid]);
	set_numa_node(numa_cpu_lookup_table[boot_cpuid]);
	current_set[boot_cpuid] = task_thread_info(current);
	current_set[boot_cpuid] = current;
}
}


#ifdef CONFIG_HOTPLUG_CPU
#ifdef CONFIG_HOTPLUG_CPU
@@ -981,15 +981,13 @@ static bool secondaries_inhibited(void)


static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
{
{
	struct thread_info *ti = task_thread_info(idle);

#ifdef CONFIG_PPC64
#ifdef CONFIG_PPC64
	paca_ptrs[cpu]->__current = idle;
	paca_ptrs[cpu]->__current = idle;
	paca_ptrs[cpu]->kstack = (unsigned long)task_stack_page(idle) +
	paca_ptrs[cpu]->kstack = (unsigned long)task_stack_page(idle) +
				 THREAD_SIZE - STACK_FRAME_OVERHEAD;
				 THREAD_SIZE - STACK_FRAME_OVERHEAD;
#endif
#endif
	idle->cpu = cpu;
	idle->cpu = cpu;
	secondary_ti = current_set[cpu] = ti;
	secondary_current = current_set[cpu] = idle;
}
}


int __cpu_up(unsigned int cpu, struct task_struct *tidle)
int __cpu_up(unsigned int cpu, struct task_struct *tidle)