diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-11-06 01:50:37 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-11-06 01:50:37 -0500 |
| commit | c90423d1de12fbeaf0c898e1db0e962de347302b (patch) | |
| tree | 8c7a32b37e74155324ae2b556fcc42718ccf29a3 /arch/x86/kernel | |
| parent | ecf1f014325ba60f4df35edae1a357c67c5d4eb1 (diff) | |
| parent | b8a216269ec0ce2e961d32e6d640d7010b8a818e (diff) | |
Merge branch 'sched/core' into core/locking, to prepare the kernel/locking/ file move
Conflicts:
kernel/Makefile
There are conflicts in kernel/Makefile due to file moving in the
scheduler tree - resolve them.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
| -rw-r--r-- | arch/x86/kernel/Makefile | 2 | ||||
| -rw-r--r-- | arch/x86/kernel/asm-offsets.c | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/common.c | 5 | ||||
| -rw-r--r-- | arch/x86/kernel/entry_32.S | 7 | ||||
| -rw-r--r-- | arch/x86/kernel/entry_64.S | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/i386_ksyms_32.c | 7 | ||||
| -rw-r--r-- | arch/x86/kernel/irq_32.c | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/preempt.S | 25 | ||||
| -rw-r--r-- | arch/x86/kernel/process.c | 6 | ||||
| -rw-r--r-- | arch/x86/kernel/process_32.c | 8 | ||||
| -rw-r--r-- | arch/x86/kernel/process_64.c | 8 | ||||
| -rw-r--r-- | arch/x86/kernel/traps.c | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/x8664_ksyms_64.c | 7 |
13 files changed, 70 insertions, 18 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index a5408b965c9d..9b0a34e2cd79 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
| @@ -36,6 +36,8 @@ obj-y += tsc.o io_delay.o rtc.o | |||
| 36 | obj-y += pci-iommu_table.o | 36 | obj-y += pci-iommu_table.o |
| 37 | obj-y += resource.o | 37 | obj-y += resource.o |
| 38 | 38 | ||
| 39 | obj-$(CONFIG_PREEMPT) += preempt.o | ||
| 40 | |||
| 39 | obj-y += process.o | 41 | obj-y += process.o |
| 40 | obj-y += i387.o xsave.o | 42 | obj-y += i387.o xsave.o |
| 41 | obj-y += ptrace.o | 43 | obj-y += ptrace.o |
diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c index 28610822fb3c..9f6b9341950f 100644 --- a/arch/x86/kernel/asm-offsets.c +++ b/arch/x86/kernel/asm-offsets.c | |||
| @@ -32,7 +32,6 @@ void common(void) { | |||
| 32 | OFFSET(TI_flags, thread_info, flags); | 32 | OFFSET(TI_flags, thread_info, flags); |
| 33 | OFFSET(TI_status, thread_info, status); | 33 | OFFSET(TI_status, thread_info, status); |
| 34 | OFFSET(TI_addr_limit, thread_info, addr_limit); | 34 | OFFSET(TI_addr_limit, thread_info, addr_limit); |
| 35 | OFFSET(TI_preempt_count, thread_info, preempt_count); | ||
| 36 | 35 | ||
| 37 | BLANK(); | 36 | BLANK(); |
| 38 | OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); | 37 | OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 2793d1f095a2..5223fe6dec7b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
| @@ -1095,6 +1095,9 @@ DEFINE_PER_CPU(char *, irq_stack_ptr) = | |||
| 1095 | 1095 | ||
| 1096 | DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1; | 1096 | DEFINE_PER_CPU(unsigned int, irq_count) __visible = -1; |
| 1097 | 1097 | ||
| 1098 | DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT; | ||
| 1099 | EXPORT_PER_CPU_SYMBOL(__preempt_count); | ||
| 1100 | |||
| 1098 | DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); | 1101 | DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); |
| 1099 | 1102 | ||
| 1100 | /* | 1103 | /* |
| @@ -1169,6 +1172,8 @@ void debug_stack_reset(void) | |||
| 1169 | 1172 | ||
| 1170 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; | 1173 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; |
| 1171 | EXPORT_PER_CPU_SYMBOL(current_task); | 1174 | EXPORT_PER_CPU_SYMBOL(current_task); |
| 1175 | DEFINE_PER_CPU(int, __preempt_count) = INIT_PREEMPT_COUNT; | ||
| 1176 | EXPORT_PER_CPU_SYMBOL(__preempt_count); | ||
| 1172 | DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); | 1177 | DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); |
| 1173 | 1178 | ||
| 1174 | #ifdef CONFIG_CC_STACKPROTECTOR | 1179 | #ifdef CONFIG_CC_STACKPROTECTOR |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index f0dcb0ceb6a2..fd1bc1b15e6d 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
| @@ -362,12 +362,9 @@ END(ret_from_exception) | |||
| 362 | #ifdef CONFIG_PREEMPT | 362 | #ifdef CONFIG_PREEMPT |
| 363 | ENTRY(resume_kernel) | 363 | ENTRY(resume_kernel) |
| 364 | DISABLE_INTERRUPTS(CLBR_ANY) | 364 | DISABLE_INTERRUPTS(CLBR_ANY) |
| 365 | cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ? | ||
| 366 | jnz restore_all | ||
| 367 | need_resched: | 365 | need_resched: |
| 368 | movl TI_flags(%ebp), %ecx # need_resched set ? | 366 | cmpl $0,PER_CPU_VAR(__preempt_count) |
| 369 | testb $_TIF_NEED_RESCHED, %cl | 367 | jnz restore_all |
| 370 | jz restore_all | ||
| 371 | testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ? | 368 | testl $X86_EFLAGS_IF,PT_EFLAGS(%esp) # interrupts off (exception path) ? |
| 372 | jz restore_all | 369 | jz restore_all |
| 373 | call preempt_schedule_irq | 370 | call preempt_schedule_irq |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index b077f4cc225a..1a2cc64abcd7 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
| @@ -1103,10 +1103,8 @@ retint_signal: | |||
| 1103 | /* Returning to kernel space. Check if we need preemption */ | 1103 | /* Returning to kernel space. Check if we need preemption */ |
| 1104 | /* rcx: threadinfo. interrupts off. */ | 1104 | /* rcx: threadinfo. interrupts off. */ |
| 1105 | ENTRY(retint_kernel) | 1105 | ENTRY(retint_kernel) |
| 1106 | cmpl $0,TI_preempt_count(%rcx) | 1106 | cmpl $0,PER_CPU_VAR(__preempt_count) |
| 1107 | jnz retint_restore_args | 1107 | jnz retint_restore_args |
| 1108 | bt $TIF_NEED_RESCHED,TI_flags(%rcx) | ||
| 1109 | jnc retint_restore_args | ||
| 1110 | bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */ | 1108 | bt $9,EFLAGS-ARGOFFSET(%rsp) /* interrupts off? */ |
| 1111 | jnc retint_restore_args | 1109 | jnc retint_restore_args |
| 1112 | call preempt_schedule_irq | 1110 | call preempt_schedule_irq |
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c index 0fa69127209a..05fd74f537d6 100644 --- a/arch/x86/kernel/i386_ksyms_32.c +++ b/arch/x86/kernel/i386_ksyms_32.c | |||
| @@ -37,3 +37,10 @@ EXPORT_SYMBOL(strstr); | |||
| 37 | 37 | ||
| 38 | EXPORT_SYMBOL(csum_partial); | 38 | EXPORT_SYMBOL(csum_partial); |
| 39 | EXPORT_SYMBOL(empty_zero_page); | 39 | EXPORT_SYMBOL(empty_zero_page); |
| 40 | |||
| 41 | #ifdef CONFIG_PREEMPT | ||
| 42 | EXPORT_SYMBOL(___preempt_schedule); | ||
| 43 | #ifdef CONFIG_CONTEXT_TRACKING | ||
| 44 | EXPORT_SYMBOL(___preempt_schedule_context); | ||
| 45 | #endif | ||
| 46 | #endif | ||
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index 4186755f1d7c..3fe066359ac0 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
| @@ -100,9 +100,6 @@ execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) | |||
| 100 | irqctx->tinfo.task = curctx->tinfo.task; | 100 | irqctx->tinfo.task = curctx->tinfo.task; |
| 101 | irqctx->tinfo.previous_esp = current_stack_pointer; | 101 | irqctx->tinfo.previous_esp = current_stack_pointer; |
| 102 | 102 | ||
| 103 | /* Copy the preempt_count so that the [soft]irq checks work. */ | ||
| 104 | irqctx->tinfo.preempt_count = curctx->tinfo.preempt_count; | ||
| 105 | |||
| 106 | if (unlikely(overflow)) | 103 | if (unlikely(overflow)) |
| 107 | call_on_stack(print_stack_overflow, isp); | 104 | call_on_stack(print_stack_overflow, isp); |
| 108 | 105 | ||
| @@ -131,7 +128,6 @@ void irq_ctx_init(int cpu) | |||
| 131 | THREAD_SIZE_ORDER)); | 128 | THREAD_SIZE_ORDER)); |
| 132 | memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); | 129 | memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); |
| 133 | irqctx->tinfo.cpu = cpu; | 130 | irqctx->tinfo.cpu = cpu; |
| 134 | irqctx->tinfo.preempt_count = HARDIRQ_OFFSET; | ||
| 135 | irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); | 131 | irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); |
| 136 | 132 | ||
| 137 | per_cpu(hardirq_ctx, cpu) = irqctx; | 133 | per_cpu(hardirq_ctx, cpu) = irqctx; |
diff --git a/arch/x86/kernel/preempt.S b/arch/x86/kernel/preempt.S new file mode 100644 index 000000000000..ca7f0d58a87d --- /dev/null +++ b/arch/x86/kernel/preempt.S | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | |||
| 2 | #include <linux/linkage.h> | ||
| 3 | #include <asm/dwarf2.h> | ||
| 4 | #include <asm/asm.h> | ||
| 5 | #include <asm/calling.h> | ||
| 6 | |||
| 7 | ENTRY(___preempt_schedule) | ||
| 8 | CFI_STARTPROC | ||
| 9 | SAVE_ALL | ||
| 10 | call preempt_schedule | ||
| 11 | RESTORE_ALL | ||
| 12 | ret | ||
| 13 | CFI_ENDPROC | ||
| 14 | |||
| 15 | #ifdef CONFIG_CONTEXT_TRACKING | ||
| 16 | |||
| 17 | ENTRY(___preempt_schedule_context) | ||
| 18 | CFI_STARTPROC | ||
| 19 | SAVE_ALL | ||
| 20 | call preempt_schedule_context | ||
| 21 | RESTORE_ALL | ||
| 22 | ret | ||
| 23 | CFI_ENDPROC | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index c83516be1052..3fb8d95ab8b5 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
| @@ -391,9 +391,9 @@ static void amd_e400_idle(void) | |||
| 391 | * The switch back from broadcast mode needs to be | 391 | * The switch back from broadcast mode needs to be |
| 392 | * called with interrupts disabled. | 392 | * called with interrupts disabled. |
| 393 | */ | 393 | */ |
| 394 | local_irq_disable(); | 394 | local_irq_disable(); |
| 395 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); | 395 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); |
| 396 | local_irq_enable(); | 396 | local_irq_enable(); |
| 397 | } else | 397 | } else |
| 398 | default_idle(); | 398 | default_idle(); |
| 399 | } | 399 | } |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 884f98f69354..c2ec1aa6d454 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
| @@ -292,6 +292,14 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
| 292 | set_iopl_mask(next->iopl); | 292 | set_iopl_mask(next->iopl); |
| 293 | 293 | ||
| 294 | /* | 294 | /* |
| 295 | * If it were not for PREEMPT_ACTIVE we could guarantee that the | ||
| 296 | * preempt_count of all tasks was equal here and this would not be | ||
| 297 | * needed. | ||
| 298 | */ | ||
| 299 | task_thread_info(prev_p)->saved_preempt_count = this_cpu_read(__preempt_count); | ||
| 300 | this_cpu_write(__preempt_count, task_thread_info(next_p)->saved_preempt_count); | ||
| 301 | |||
| 302 | /* | ||
| 295 | * Now maybe handle debug registers and/or IO bitmaps | 303 | * Now maybe handle debug registers and/or IO bitmaps |
| 296 | */ | 304 | */ |
| 297 | if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV || | 305 | if (unlikely(task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV || |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index bb1dc51bab05..45ab4d6fc8a7 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
| @@ -363,6 +363,14 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
| 363 | this_cpu_write(old_rsp, next->usersp); | 363 | this_cpu_write(old_rsp, next->usersp); |
| 364 | this_cpu_write(current_task, next_p); | 364 | this_cpu_write(current_task, next_p); |
| 365 | 365 | ||
| 366 | /* | ||
| 367 | * If it were not for PREEMPT_ACTIVE we could guarantee that the | ||
| 368 | * preempt_count of all tasks was equal here and this would not be | ||
| 369 | * needed. | ||
| 370 | */ | ||
| 371 | task_thread_info(prev_p)->saved_preempt_count = this_cpu_read(__preempt_count); | ||
| 372 | this_cpu_write(__preempt_count, task_thread_info(next_p)->saved_preempt_count); | ||
| 373 | |||
| 366 | this_cpu_write(kernel_stack, | 374 | this_cpu_write(kernel_stack, |
| 367 | (unsigned long)task_stack_page(next_p) + | 375 | (unsigned long)task_stack_page(next_p) + |
| 368 | THREAD_SIZE - KERNEL_STACK_OFFSET); | 376 | THREAD_SIZE - KERNEL_STACK_OFFSET); |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 8c8093b146ca..729aa779ff75 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
| @@ -88,7 +88,7 @@ static inline void conditional_sti(struct pt_regs *regs) | |||
| 88 | 88 | ||
| 89 | static inline void preempt_conditional_sti(struct pt_regs *regs) | 89 | static inline void preempt_conditional_sti(struct pt_regs *regs) |
| 90 | { | 90 | { |
| 91 | inc_preempt_count(); | 91 | preempt_count_inc(); |
| 92 | if (regs->flags & X86_EFLAGS_IF) | 92 | if (regs->flags & X86_EFLAGS_IF) |
| 93 | local_irq_enable(); | 93 | local_irq_enable(); |
| 94 | } | 94 | } |
| @@ -103,7 +103,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs) | |||
| 103 | { | 103 | { |
| 104 | if (regs->flags & X86_EFLAGS_IF) | 104 | if (regs->flags & X86_EFLAGS_IF) |
| 105 | local_irq_disable(); | 105 | local_irq_disable(); |
| 106 | dec_preempt_count(); | 106 | preempt_count_dec(); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | static int __kprobes | 109 | static int __kprobes |
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c index b014d9414d08..040681928e9d 100644 --- a/arch/x86/kernel/x8664_ksyms_64.c +++ b/arch/x86/kernel/x8664_ksyms_64.c | |||
| @@ -66,3 +66,10 @@ EXPORT_SYMBOL(empty_zero_page); | |||
| 66 | #ifndef CONFIG_PARAVIRT | 66 | #ifndef CONFIG_PARAVIRT |
| 67 | EXPORT_SYMBOL(native_load_gs_index); | 67 | EXPORT_SYMBOL(native_load_gs_index); |
| 68 | #endif | 68 | #endif |
| 69 | |||
| 70 | #ifdef CONFIG_PREEMPT | ||
| 71 | EXPORT_SYMBOL(___preempt_schedule); | ||
| 72 | #ifdef CONFIG_CONTEXT_TRACKING | ||
| 73 | EXPORT_SYMBOL(___preempt_schedule_context); | ||
| 74 | #endif | ||
| 75 | #endif | ||
