[RFC PATCH v3 2/7] powerpc: Prepare for moving thread_info into task_struct

Nicholas Piggin npiggin at gmail.com
Wed Oct 3 15:57:56 AEST 2018


On Wed, 3 Oct 2018 07:49:44 +0200
Christophe LEROY <christophe.leroy at c-s.fr> wrote:

> Le 03/10/2018 à 07:02, Nicholas Piggin a écrit :
> > On Mon,  1 Oct 2018 12:30:21 +0000 (UTC)
> > Christophe Leroy <christophe.leroy at c-s.fr> wrote:
> >   
> >> This patch cleans the powerpc kernel before activating
> >> CONFIG_THREAD_INFO_IN_TASK:
> >> - The purpose of the pointer given to call_do_softirq() and
> >> call_do_irq() is to point the new stack ==> change it to void*
> >> - Don't use CURRENT_THREAD_INFO() to locate the stack.
> >> - Fixed a few comments.
> >> - TI_CPU is only used when CONFIG_SMP is set.
> >> - Replace current_thread_info()->task by current
> >> - Remove unnecessary casts to thread_info, as they'll become invalid
> >> once thread_info is not in stack anymore.
> >> - Ensure task_struct 'cpu' fields is not used directly out of SMP code
> >> - Rename THREAD_INFO to TASK_STASK: As it is in fact the offset of the
> >> pointer to the stack in task_struct, this pointer will not be impacted
> >> by the move of THREAD_INFO.
> >> - Makes TASK_STACK available to PPC64 which will need it to the get
> >> stack pointer from current once the thread_info have been moved.
> >>
> >> Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
> >> ---
> >>   arch/powerpc/include/asm/irq.h       |  4 ++--
> >>   arch/powerpc/include/asm/livepatch.h |  2 +-
> >>   arch/powerpc/include/asm/processor.h |  4 ++--
> >>   arch/powerpc/include/asm/reg.h       |  2 +-
> >>   arch/powerpc/kernel/asm-offsets.c    |  2 +-
> >>   arch/powerpc/kernel/entry_32.S       |  2 +-
> >>   arch/powerpc/kernel/entry_64.S       |  2 +-
> >>   arch/powerpc/kernel/head_32.S        |  4 ++--
> >>   arch/powerpc/kernel/head_40x.S       |  4 ++--
> >>   arch/powerpc/kernel/head_44x.S       |  2 +-
> >>   arch/powerpc/kernel/head_8xx.S       |  2 +-
> >>   arch/powerpc/kernel/head_booke.h     |  4 ++--
> >>   arch/powerpc/kernel/head_fsl_booke.S |  6 ++++--
> >>   arch/powerpc/kernel/irq.c            |  2 +-
> >>   arch/powerpc/kernel/misc_32.S        |  8 ++++++--
> >>   arch/powerpc/kernel/process.c        |  6 +++---
> >>   arch/powerpc/kernel/setup_32.c       | 15 +++++----------
> >>   arch/powerpc/kernel/smp.c            |  4 +++-
> >>   arch/powerpc/xmon/xmon.c             |  2 +-
> >>   19 files changed, 40 insertions(+), 37 deletions(-)
> >>
> >> diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
> >> index ee39ce56b2a2..8108d1fe33ca 100644
> >> --- a/arch/powerpc/include/asm/irq.h
> >> +++ b/arch/powerpc/include/asm/irq.h
> >> @@ -63,8 +63,8 @@ extern struct thread_info *hardirq_ctx[NR_CPUS];
> >>   extern struct thread_info *softirq_ctx[NR_CPUS];
> >>   
> >>   extern void irq_ctx_init(void);
> >> -extern void call_do_softirq(struct thread_info *tp);
> >> -extern void call_do_irq(struct pt_regs *regs, struct thread_info *tp);
> >> +extern void call_do_softirq(void *tp);
> >> +extern void call_do_irq(struct pt_regs *regs, void *tp);  
> > 
> > void *sp for these ?  
> 
> Yes, why not but it means changing the code. I wanted to minimise the 
> changes and avoid cosmetic.

Fair enough.

> Or maybe should add a cosmetic patch at the 
> end ?

Yeah that would be nice, I don't mind too much if it goes as part of
the patches or as a cleanup afterward. There's a few other places that
could use similar minor.

> > This all seems okay to me except the 32-bit code which I don't know.
> > Would it be any trouble for you to put the TI_CPU bits into their own
> > patch?  
> 
> No problem, I can put the TI_CPU bits in a separate patch.

Great thanks.

Thanks,
Nick

> 
> > 
> > Reviewed-by: Nicholas Piggin <npiggin at gmail.com>
> >   
> 
> Thanks
> Christophe
> 
> >   
> >>   extern void do_IRQ(struct pt_regs *regs);
> >>   extern void __init init_IRQ(void);
> >>   extern void __do_irq(struct pt_regs *regs);
> >> diff --git a/arch/powerpc/include/asm/livepatch.h b/arch/powerpc/include/asm/livepatch.h
> >> index 47a03b9b528b..818451bf629c 100644
> >> --- a/arch/powerpc/include/asm/livepatch.h
> >> +++ b/arch/powerpc/include/asm/livepatch.h
> >> @@ -49,7 +49,7 @@ static inline void klp_init_thread_info(struct thread_info *ti)
> >>   	ti->livepatch_sp = (unsigned long *)(ti + 1) + 1;
> >>   }
> >>   #else
> >> -static void klp_init_thread_info(struct thread_info *ti) { }
> >> +static inline void klp_init_thread_info(struct thread_info *ti) { }
> >>   #endif /* CONFIG_LIVEPATCH */
> >>   
> >>   #endif /* _ASM_POWERPC_LIVEPATCH_H */
> >> diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
> >> index 353879db3e98..31873614392f 100644
> >> --- a/arch/powerpc/include/asm/processor.h
> >> +++ b/arch/powerpc/include/asm/processor.h
> >> @@ -40,7 +40,7 @@
> >>   
> >>   #ifndef __ASSEMBLY__
> >>   #include <linux/types.h>
> >> -#include <asm/thread_info.h>
> >> +#include <linux/thread_info.h>
> >>   #include <asm/ptrace.h>
> >>   #include <asm/hw_breakpoint.h>
> >>   
> >> @@ -333,7 +333,7 @@ struct thread_struct {
> >>   
> >>   #define INIT_SP		(sizeof(init_stack) + (unsigned long) &init_stack)
> >>   #define INIT_SP_LIMIT \
> >> -	(_ALIGN_UP(sizeof(init_thread_info), 16) + (unsigned long) &init_stack)
> >> +	(_ALIGN_UP(sizeof(struct thread_info), 16) + (unsigned long) &init_stack)
> >>   
> >>   #ifdef CONFIG_SPE
> >>   #define SPEFSCR_INIT \
> >> diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
> >> index e5b314ed054e..f3a9cf19a986 100644
> >> --- a/arch/powerpc/include/asm/reg.h
> >> +++ b/arch/powerpc/include/asm/reg.h
> >> @@ -1053,7 +1053,7 @@
> >>    *	- SPRG9 debug exception scratch
> >>    *
> >>    * All 32-bit:
> >> - *	- SPRG3 current thread_info pointer
> >> + *	- SPRG3 current thread_struct physical addr pointer
> >>    *        (virtual on BookE, physical on others)
> >>    *
> >>    * 32-bit classic:
> >> diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
> >> index ba9d0fc98730..d1f161e48945 100644
> >> --- a/arch/powerpc/kernel/asm-offsets.c
> >> +++ b/arch/powerpc/kernel/asm-offsets.c
> >> @@ -85,10 +85,10 @@ int main(void)
> >>   	DEFINE(NMI_MASK, NMI_MASK);
> >>   	OFFSET(TASKTHREADPPR, task_struct, thread.ppr);
> >>   #else
> >> -	OFFSET(THREAD_INFO, task_struct, stack);
> >>   	DEFINE(THREAD_INFO_GAP, _ALIGN_UP(sizeof(struct thread_info), 16));
> >>   	OFFSET(KSP_LIMIT, thread_struct, ksp_limit);
> >>   #endif /* CONFIG_PPC64 */
> >> +	OFFSET(TASK_STACK, task_struct, stack);
> >>   
> >>   #ifdef CONFIG_LIVEPATCH
> >>   	OFFSET(TI_livepatch_sp, thread_info, livepatch_sp);
> >> diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
> >> index e58c3f467db5..12c0721f65ea 100644
> >> --- a/arch/powerpc/kernel/entry_32.S
> >> +++ b/arch/powerpc/kernel/entry_32.S
> >> @@ -1166,7 +1166,7 @@ ret_from_debug_exc:
> >>   	mfspr	r9,SPRN_SPRG_THREAD
> >>   	lwz	r10,SAVED_KSP_LIMIT(r1)
> >>   	stw	r10,KSP_LIMIT(r9)
> >> -	lwz	r9,THREAD_INFO-THREAD(r9)
> >> +	lwz	r9,TASK_STACK-THREAD(r9)
> >>   	CURRENT_THREAD_INFO(r10, r1)
> >>   	lwz	r10,TI_PREEMPT(r10)
> >>   	stw	r10,TI_PREEMPT(r9)
> >> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> >> index 77a888bfcb53..697406572592 100644
> >> --- a/arch/powerpc/kernel/entry_64.S
> >> +++ b/arch/powerpc/kernel/entry_64.S
> >> @@ -680,7 +680,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
> >>   2:
> >>   #endif /* CONFIG_PPC_BOOK3S_64 */
> >>   
> >> -	CURRENT_THREAD_INFO(r7, r8)  /* base of new stack */
> >> +	clrrdi	r7, r8, THREAD_SHIFT	/* base of new stack */
> >>   	/* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE
> >>   	   because we don't need to leave the 288-byte ABI gap at the
> >>   	   top of the kernel stack. */
> >> diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
> >> index 61ca27929355..dce6f2ff07e5 100644
> >> --- a/arch/powerpc/kernel/head_32.S
> >> +++ b/arch/powerpc/kernel/head_32.S
> >> @@ -261,7 +261,7 @@ __secondary_hold_acknowledge:
> >>   	tophys(r11,r1);			/* use tophys(r1) if kernel */ \
> >>   	beq	1f;		\
> >>   	mfspr	r11,SPRN_SPRG_THREAD;	\
> >> -	lwz	r11,THREAD_INFO-THREAD(r11);	\
> >> +	lwz	r11,TASK_STACK-THREAD(r11);	\
> >>   	addi	r11,r11,THREAD_SIZE;	\
> >>   	tophys(r11,r11);	\
> >>   1:	subi	r11,r11,INT_FRAME_SIZE	/* alloc exc. frame */
> >> @@ -841,7 +841,7 @@ __secondary_start:
> >>   	bl	init_idle_6xx
> >>   #endif /* CONFIG_6xx */
> >>   
> >> -	/* get current_thread_info and current */
> >> +	/* get current's stack and current */
> >>   	lis	r1,secondary_ti at ha
> >>   	tophys(r1,r1)
> >>   	lwz	r1,secondary_ti at l(r1)
> >> diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
> >> index b19d78410511..3088c9f29f5e 100644
> >> --- a/arch/powerpc/kernel/head_40x.S
> >> +++ b/arch/powerpc/kernel/head_40x.S
> >> @@ -115,7 +115,7 @@ _ENTRY(saved_ksp_limit)
> >>   	andi.	r11,r11,MSR_PR;						     \
> >>   	beq	1f;							     \
> >>   	mfspr	r1,SPRN_SPRG_THREAD;	/* if from user, start at top of   */\
> >> -	lwz	r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack   */\
> >> +	lwz	r1,TASK_STACK-THREAD(r1); /* this thread's kernel stack   */\
> >>   	addi	r1,r1,THREAD_SIZE;					     \
> >>   1:	subi	r1,r1,INT_FRAME_SIZE;	/* Allocate an exception frame     */\
> >>   	tophys(r11,r1);							     \
> >> @@ -158,7 +158,7 @@ _ENTRY(saved_ksp_limit)
> >>   	beq	1f;							     \
> >>   	/* COMING FROM USER MODE */					     \
> >>   	mfspr	r11,SPRN_SPRG_THREAD;	/* if from user, start at top of   */\
> >> -	lwz	r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
> >> +	lwz	r11,TASK_STACK-THREAD(r11); /* this thread's kernel stack */\
> >>   1:	addi	r11,r11,THREAD_SIZE-INT_FRAME_SIZE; /* Alloc an excpt frm  */\
> >>   	tophys(r11,r11);						     \
> >>   	stw	r10,_CCR(r11);          /* save various registers	   */\
> >> diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
> >> index 37e4a7cf0065..15d39b2499de 100644
> >> --- a/arch/powerpc/kernel/head_44x.S
> >> +++ b/arch/powerpc/kernel/head_44x.S
> >> @@ -1020,7 +1020,7 @@ _GLOBAL(start_secondary_47x)
> >>   
> >>   	/* Now we can get our task struct and real stack pointer */
> >>   
> >> -	/* Get current_thread_info and current */
> >> +	/* Get current's stack and current */
> >>   	lis	r1,secondary_ti at ha
> >>   	lwz	r1,secondary_ti at l(r1)
> >>   	lwz	r2,TI_TASK(r1)
> >> diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
> >> index 6582f824d620..e56e36aa2b3d 100644
> >> --- a/arch/powerpc/kernel/head_8xx.S
> >> +++ b/arch/powerpc/kernel/head_8xx.S
> >> @@ -124,7 +124,7 @@ turn_on_mmu:
> >>   	tophys(r11,r1);			/* use tophys(r1) if kernel */ \
> >>   	beq	1f;		\
> >>   	mfspr	r11,SPRN_SPRG_THREAD;	\
> >> -	lwz	r11,THREAD_INFO-THREAD(r11);	\
> >> +	lwz	r11,TASK_STACK-THREAD(r11);	\
> >>   	addi	r11,r11,THREAD_SIZE;	\
> >>   	tophys(r11,r11);	\
> >>   1:	subi	r11,r11,INT_FRAME_SIZE	/* alloc exc. frame */
> >> diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
> >> index d0862a100d29..20fe0c93a0bd 100644
> >> --- a/arch/powerpc/kernel/head_booke.h
> >> +++ b/arch/powerpc/kernel/head_booke.h
> >> @@ -44,7 +44,7 @@
> >>   	mr	r11, r1;						     \
> >>   	beq	1f;							     \
> >>   	/* if from user, start at top of this thread's kernel stack */       \
> >> -	lwz	r11, THREAD_INFO-THREAD(r10);				     \
> >> +	lwz	r11, TASK_STACK-THREAD(r10);				     \
> >>   	ALLOC_STACK_FRAME(r11, THREAD_SIZE);				     \
> >>   1 :	subi	r11, r11, INT_FRAME_SIZE; /* Allocate exception frame */     \
> >>   	stw	r13, _CCR(r11);		/* save various registers */	     \
> >> @@ -130,7 +130,7 @@
> >>   	DO_KVM	BOOKE_INTERRUPT_##intno exc_level_srr1;		             \
> >>   	andi.	r11,r11,MSR_PR;						     \
> >>   	mfspr	r11,SPRN_SPRG_THREAD;	/* if from user, start at top of   */\
> >> -	lwz	r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
> >> +	lwz	r11,TASK_STACK-THREAD(r11); /* this thread's kernel stack */\
> >>   	addi	r11,r11,EXC_LVL_FRAME_OVERHEAD;	/* allocate stack frame    */\
> >>   	beq	1f;							     \
> >>   	/* COMING FROM USER MODE */					     \
> >> diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
> >> index e2750b856c8f..239ad8a4754e 100644
> >> --- a/arch/powerpc/kernel/head_fsl_booke.S
> >> +++ b/arch/powerpc/kernel/head_fsl_booke.S
> >> @@ -243,8 +243,10 @@ set_ivor:
> >>   	li	r0,0
> >>   	stwu	r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
> >>   
> >> +#ifdef CONFIG_SMP
> >>   	CURRENT_THREAD_INFO(r22, r1)
> >>   	stw	r24, TI_CPU(r22)
> >> +#endif
> >>   
> >>   	bl	early_init
> >>   
> >> @@ -702,7 +704,7 @@ finish_tlb_load:
> >>   
> >>   	/* Get the next_tlbcam_idx percpu var */
> >>   #ifdef CONFIG_SMP
> >> -	lwz	r12, THREAD_INFO-THREAD(r12)
> >> +	lwz	r12, TASK_STACK-THREAD(r12)
> >>   	lwz	r15, TI_CPU(r12)
> >>   	lis     r14, __per_cpu_offset at h
> >>   	ori     r14, r14, __per_cpu_offset at l
> >> @@ -1074,7 +1076,7 @@ __secondary_start:
> >>   	mr	r4,r24		/* Why? */
> >>   	bl	call_setup_cpu
> >>   
> >> -	/* get current_thread_info and current */
> >> +	/* get current's stack and current */
> >>   	lis	r1,secondary_ti at ha
> >>   	lwz	r1,secondary_ti at l(r1)
> >>   	lwz	r2,TI_TASK(r1)
> >> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> >> index 916ddc4aac44..aa53db3ba6e7 100644
> >> --- a/arch/powerpc/kernel/irq.c
> >> +++ b/arch/powerpc/kernel/irq.c
> >> @@ -663,7 +663,7 @@ void do_IRQ(struct pt_regs *regs)
> >>   	struct thread_info *curtp, *irqtp, *sirqtp;
> >>   
> >>   	/* Switch to the irq stack to handle this */
> >> -	curtp = current_thread_info();
> >> +	curtp = (void*)(current_stack_pointer() & ~(THREAD_SIZE - 1));
> >>   	irqtp = hardirq_ctx[raw_smp_processor_id()];
> >>   	sirqtp = softirq_ctx[raw_smp_processor_id()];
> >>   
> >> diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
> >> index 695b24a2d954..24a7f18ea10c 100644
> >> --- a/arch/powerpc/kernel/misc_32.S
> >> +++ b/arch/powerpc/kernel/misc_32.S
> >> @@ -60,7 +60,7 @@ _GLOBAL(call_do_softirq)
> >>   	blr
> >>   
> >>   /*
> >> - * void call_do_irq(struct pt_regs *regs, struct thread_info *irqtp);
> >> + * void call_do_irq(struct pt_regs *regs, void *irqtp);
> >>    */
> >>   _GLOBAL(call_do_irq)
> >>   	mflr	r0
> >> @@ -183,10 +183,14 @@ _GLOBAL(low_choose_750fx_pll)
> >>   	or	r4,r4,r5
> >>   	mtspr	SPRN_HID1,r4
> >>   
> >> +#ifdef CONFIG_SMP
> >>   	/* Store new HID1 image */
> >>   	CURRENT_THREAD_INFO(r6, r1)
> >>   	lwz	r6,TI_CPU(r6)
> >>   	slwi	r6,r6,2
> >> +#else
> >> +	li	r6, 0
> >> +#endif
> >>   	addis	r6,r6,nap_save_hid1 at ha
> >>   	stw	r4,nap_save_hid1 at l(r6)
> >>   
> >> @@ -599,7 +603,7 @@ EXPORT_SYMBOL(__bswapdi2)
> >>   #ifdef CONFIG_SMP
> >>   _GLOBAL(start_secondary_resume)
> >>   	/* Reset stack */
> >> -	CURRENT_THREAD_INFO(r1, r1)
> >> +	rlwinm	r1, r1, 0, 0, 31 - THREAD_SHIFT
> >>   	addi	r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
> >>   	li	r3,0
> >>   	stw	r3,0(r1)		/* Zero the stack frame pointer	*/
> >> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> >> index 03c2e1f134bc..111abb4df2ec 100644
> >> --- a/arch/powerpc/kernel/process.c
> >> +++ b/arch/powerpc/kernel/process.c
> >> @@ -1240,8 +1240,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
> >>   		batch->active = 1;
> >>   	}
> >>   
> >> -	if (current_thread_info()->task->thread.regs) {
> >> -		restore_math(current_thread_info()->task->thread.regs);
> >> +	if (current->thread.regs) {
> >> +		restore_math(current->thread.regs);
> >>   
> >>   		/*
> >>   		 * The copy-paste buffer can only store into foreign real
> >> @@ -1251,7 +1251,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
> >>   		 * mappings, we must issue a cp_abort to clear any state and
> >>   		 * prevent snooping, corruption or a covert channel.
> >>   		 */
> >> -		if (current_thread_info()->task->thread.used_vas)
> >> +		if (current->thread.used_vas)
> >>   			asm volatile(PPC_CP_ABORT);
> >>   	}
> >>   #endif /* CONFIG_PPC_BOOK3S_64 */
> >> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> >> index 8c507be12c3c..81ebf7d6f526 100644
> >> --- a/arch/powerpc/kernel/setup_32.c
> >> +++ b/arch/powerpc/kernel/setup_32.c
> >> @@ -205,10 +205,8 @@ void __init irqstack_early_init(void)
> >>   	/* interrupt stacks must be in lowmem, we get that for free on ppc32
> >>   	 * as the memblock is limited to lowmem by default */
> >>   	for_each_possible_cpu(i) {
> >> -		softirq_ctx[i] = (struct thread_info *)
> >> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> -		hardirq_ctx[i] = (struct thread_info *)
> >> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> +		softirq_ctx[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> +		hardirq_ctx[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >>   	}
> >>   }
> >>   
> >> @@ -226,13 +224,10 @@ void __init exc_lvl_early_init(void)
> >>   		hw_cpu = 0;
> >>   #endif
> >>   
> >> -		critirq_ctx[hw_cpu] = (struct thread_info *)
> >> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> +		critirq_ctx[hw_cpu] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >>   #ifdef CONFIG_BOOKE
> >> -		dbgirq_ctx[hw_cpu] = (struct thread_info *)
> >> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> -		mcheckirq_ctx[hw_cpu] = (struct thread_info *)
> >> -			__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> +		dbgirq_ctx[hw_cpu] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >> +		mcheckirq_ctx[hw_cpu] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
> >>   #endif
> >>   	}
> >>   }
> >> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> >> index 61c1fadbc644..19dd0ea55714 100644
> >> --- a/arch/powerpc/kernel/smp.c
> >> +++ b/arch/powerpc/kernel/smp.c
> >> @@ -20,6 +20,7 @@
> >>   #include <linux/kernel.h>
> >>   #include <linux/export.h>
> >>   #include <linux/sched/mm.h>
> >> +#include <linux/sched/task_stack.h>
> >>   #include <linux/sched/topology.h>
> >>   #include <linux/smp.h>
> >>   #include <linux/interrupt.h>
> >> @@ -812,7 +813,8 @@ static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
> >>   
> >>   #ifdef CONFIG_PPC64
> >>   	paca_ptrs[cpu]->__current = idle;
> >> -	paca_ptrs[cpu]->kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD;
> >> +	paca_ptrs[cpu]->kstack = (unsigned long)task_stack_page(idle) +
> >> +				  THREAD_SIZE - STACK_FRAME_OVERHEAD;
> >>   #endif
> >>   	ti->cpu = cpu;
> >>   	secondary_ti = current_set[cpu] = ti;
> >> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> >> index 694c1d92e796..0d8d6fee892a 100644
> >> --- a/arch/powerpc/xmon/xmon.c
> >> +++ b/arch/powerpc/xmon/xmon.c
> >> @@ -2988,7 +2988,7 @@ static void show_task(struct task_struct *tsk)
> >>   	printf("%px %016lx %6d %6d %c %2d %s\n", tsk,
> >>   		tsk->thread.ksp,
> >>   		tsk->pid, tsk->parent->pid,
> >> -		state, task_thread_info(tsk)->cpu,
> >> +		state, task_cpu(tsk),
> >>   		tsk->comm);
> >>   }
> >>   
> >> -- 
> >> 2.13.3
> >>  



More information about the Linuxppc-dev mailing list