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

From: Christophe LEROY
Date: Thu Oct 04 2018 - 10:29:34 EST




Le 03/10/2018 Ã 07:49, Christophe LEROY a ÃcritÂ:


Le 03/10/2018 Ã 07:02, Nicholas Piggin a ÃcritÂ:
On Mon, 1 Oct 2018 12:30:21 +0000 (UTC)
Christophe Leroy <christophe.leroy@xxxxxx> 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@xxxxxx>
---
 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. Or maybe should add a cosmetic patch at the end ?

In fact, I'll do it because the only additional impact is on a comment in misc_32.S

Christophe



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.


Reviewed-by: Nicholas Piggin <npiggin@xxxxxxxxx>


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@ha
ÂÂÂÂÂ tophys(r1,r1)
ÂÂÂÂÂ lwzÂÂÂ r1,secondary_ti@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@ha
ÂÂÂÂÂ lwzÂÂÂ r1,secondary_ti@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@h
ÂÂÂÂÂ oriÂÂÂÂ r14, r14, __per_cpu_offset@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@ha
ÂÂÂÂÂ lwzÂÂÂ r1,secondary_ti@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@ha
ÂÂÂÂÂ stwÂÂÂ r4,nap_save_hid1@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