Skip to contentSkip to conversation

x86/threadinfo changes for v3.15

GIT PULL Ingo Molnar 1 participant 1 message Apr 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-threadinfo-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-threadinfo-for-linus

# HEAD: 6cce16f99d7be23cec7cabdf32a8166eec6e5393 x86, threadinfo: Redo "x86: Use inline assembler to get sp"

The main change here is the consolidation/unification of 32 and 64 bit thread_info handling methods, from Steve Rostedt.

Thanks,

Ingo

------------------>
Mathias Krause (1):
x86, threadinfo: Redo "x86: Use inline assembler to get sp"

Steven Rostedt (4):
x86: Nuke the supervisor_stack field in i386 thread_info
x86: Prepare removal of previous_esp from i386 thread_info structure
x86: Keep thread_info on thread stack in x86_32
x86: Clean up dumpstack_64.c code

Steven Rostedt (Red Hat) (1):
x86: Nuke GET_THREAD_INFO_WITH_ESP() macro for i386

 arch/x86/include/asm/processor.h   |   9 +++
 arch/x86/include/asm/thread_info.h |  53 ++---------------
 arch/x86/kernel/cpu/common.c       |   8 +--
 arch/x86/kernel/dumpstack_32.c     |  44 ++++++++++++--
 arch/x86/kernel/dumpstack_64.c     | 117 ++++++++++++++++++++++++++-----------
 arch/x86/kernel/irq_32.c           |  83 +++++++++++++-------------
 arch/x86/kernel/process_32.c       |   4 ++
 arch/x86/kernel/ptrace.c           |   8 +--
 arch/x86/kernel/smpboot.c          |   2 +-
 9 files changed, 191 insertions(+), 137 deletions(-)
arch/x86/include/asm/processor.h +9 -0
index fdedd38..a4ea023 100644
@@ -449,6 +449,15 @@ struct stack_canary {
 };
 DECLARE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
 #endif
+/*
+ * per-CPU IRQ handling stacks
+ */
+struct irq_stack {
+	u32                     stack[THREAD_SIZE/sizeof(u32)];
+} __aligned(THREAD_SIZE);
+
+DECLARE_PER_CPU(struct irq_stack *, hardirq_stack);
+DECLARE_PER_CPU(struct irq_stack *, softirq_stack);
 #endif	/* X86_64 */
 
 extern unsigned int xstate_size;
arch/x86/include/asm/thread_info.h +5 -48

90 lines not on this page · raw message

arch/x86/kernel/cpu/common.c +4 -4
index 8e28bf2..29c1944 100644
@@ -1078,6 +1078,10 @@ static __init int setup_disablecpuid(char *arg)
 }
 __setup("clearcpuid=", setup_disablecpuid);
 
+DEFINE_PER_CPU(unsigned long, kernel_stack) =
+	(unsigned long)&init_thread_union - KERNEL_STACK_OFFSET + THREAD_SIZE;
+EXPORT_PER_CPU_SYMBOL(kernel_stack);
+
 #ifdef CONFIG_X86_64
 struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
 struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1,
@@ -1094,10 +1098,6 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
 	&init_task;
 EXPORT_PER_CPU_SYMBOL(current_task);
 
-DEFINE_PER_CPU(unsigned long, kernel_stack) =
-	(unsigned long)&init_thread_union - KERNEL_STACK_OFFSET + THREAD_SIZE;
-EXPORT_PER_CPU_SYMBOL(kernel_stack);
-
 DEFINE_PER_CPU(char *, irq_stack_ptr) =
 	init_per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE - 64;
 
arch/x86/kernel/dumpstack_32.c +40 -4

70 lines not on this page · raw message

arch/x86/kernel/dumpstack_64.c +83 -34

150 lines not on this page · raw message

arch/x86/kernel/irq_32.c +41 -42

130 lines not on this page · raw message

arch/x86/kernel/process_32.c +4 -0
index 0de43e9..7bc86bb 100644
@@ -314,6 +314,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 	 */
 	arch_end_context_switch(next_p);
 
+	this_cpu_write(kernel_stack,
+		  (unsigned long)task_stack_page(next_p) +
+		  THREAD_SIZE - KERNEL_STACK_OFFSET);
+
 	/*
 	 * Restore %gs if needed (which is common)
 	 */
arch/x86/kernel/ptrace.c +4 -4
index 7461f50..678c0ad 100644
@@ -184,14 +184,14 @@ unsigned long kernel_stack_pointer(struct pt_regs *regs)
 {
 	unsigned long context = (unsigned long)regs & ~(THREAD_SIZE - 1);
 	unsigned long sp = (unsigned long)&regs->sp;
-	struct thread_info *tinfo;
+	u32 *prev_esp;
 
 	if (context == (sp & ~(THREAD_SIZE - 1)))
 		return sp;
 
-	tinfo = (struct thread_info *)context;
-	if (tinfo->previous_esp)
-		return tinfo->previous_esp;
+	prev_esp = (u32 *)(context);
+	if (prev_esp)
+		return (unsigned long)prev_esp;
 
 	return (unsigned long)regs;
 }
arch/x86/kernel/smpboot.c +1 -1
index a32da80..867d53e 100644
@@ -758,10 +758,10 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
 #else
 	clear_tsk_thread_flag(idle, TIF_FORK);
 	initial_gs = per_cpu_offset(cpu);
+#endif
 	per_cpu(kernel_stack, cpu) =
 		(unsigned long)task_stack_page(idle) -
 		KERNEL_STACK_OFFSET + THREAD_SIZE;
-#endif
 	early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
 	initial_code = (unsigned long)start_secondary;
 	stack_start  = idle->thread.sp;