Commit 2f2fde92 authored by Linus Torvalds's avatar Linus Torvalds

Merge branches 'core-urgent-for-linus', 'perf-urgent-for-linus',...

Merge branches 'core-urgent-for-linus', 'perf-urgent-for-linus', 'sched-urgent-for-linus' and 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  bugs, x86: Fix printk levels for panic, softlockups and stack dumps

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf top: Fix number of samples displayed
  perf tools: Fix strlen() bug in perf_event__synthesize_event_type()
  perf tools: Fix broken build by defining _GNU_SOURCE in Makefile
  x86/dumpstack: Remove unneeded check in dump_trace()
  perf: Fix broken interrupt rate throttling

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/rt: Fix task stack corruption under __ARCH_WANT_INTERRUPTS_ON_CTXSW
  sched: Fix ancient race in do_exit()
  sched/nohz: Fix nohz cpu idle load balancing state with cpu hotplug
  sched/s390: Fix compile error in sched/core.c
  sched: Fix rq->nr_uninterruptible update race

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/reboot: Remove VersaLogic Menlow reboot quirk
  x86/reboot: Skip DMI checks if reboot set by user
  x86: Properly parenthesize cmpxchg() macro arguments
...@@ -145,13 +145,13 @@ extern void __add_wrong_size(void) ...@@ -145,13 +145,13 @@ extern void __add_wrong_size(void)
#ifdef __HAVE_ARCH_CMPXCHG #ifdef __HAVE_ARCH_CMPXCHG
#define cmpxchg(ptr, old, new) \ #define cmpxchg(ptr, old, new) \
__cmpxchg((ptr), (old), (new), sizeof(*ptr)) __cmpxchg(ptr, old, new, sizeof(*(ptr)))
#define sync_cmpxchg(ptr, old, new) \ #define sync_cmpxchg(ptr, old, new) \
__sync_cmpxchg((ptr), (old), (new), sizeof(*ptr)) __sync_cmpxchg(ptr, old, new, sizeof(*(ptr)))
#define cmpxchg_local(ptr, old, new) \ #define cmpxchg_local(ptr, old, new) \
__cmpxchg_local((ptr), (old), (new), sizeof(*ptr)) __cmpxchg_local(ptr, old, new, sizeof(*(ptr)))
#endif #endif
/* /*
......
...@@ -252,7 +252,8 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err) ...@@ -252,7 +252,8 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
unsigned short ss; unsigned short ss;
unsigned long sp; unsigned long sp;
#endif #endif
printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter); printk(KERN_DEFAULT
"%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
printk("PREEMPT "); printk("PREEMPT ");
#endif #endif
......
...@@ -129,7 +129,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, ...@@ -129,7 +129,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
if (!stack) { if (!stack) {
if (regs) if (regs)
stack = (unsigned long *)regs->sp; stack = (unsigned long *)regs->sp;
else if (task && task != current) else if (task != current)
stack = (unsigned long *)task->thread.sp; stack = (unsigned long *)task->thread.sp;
else else
stack = &dummy; stack = &dummy;
...@@ -269,11 +269,11 @@ void show_registers(struct pt_regs *regs) ...@@ -269,11 +269,11 @@ void show_registers(struct pt_regs *regs)
unsigned char c; unsigned char c;
u8 *ip; u8 *ip;
printk(KERN_EMERG "Stack:\n"); printk(KERN_DEFAULT "Stack:\n");
show_stack_log_lvl(NULL, regs, (unsigned long *)sp, show_stack_log_lvl(NULL, regs, (unsigned long *)sp,
0, KERN_EMERG); 0, KERN_DEFAULT);
printk(KERN_EMERG "Code: "); printk(KERN_DEFAULT "Code: ");
ip = (u8 *)regs->ip - code_prologue; ip = (u8 *)regs->ip - code_prologue;
if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) { if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
......
...@@ -39,6 +39,14 @@ static int reboot_mode; ...@@ -39,6 +39,14 @@ static int reboot_mode;
enum reboot_type reboot_type = BOOT_ACPI; enum reboot_type reboot_type = BOOT_ACPI;
int reboot_force; int reboot_force;
/* This variable is used privately to keep track of whether or not
* reboot_type is still set to its default value (i.e., reboot= hasn't
* been set on the command line). This is needed so that we can
* suppress DMI scanning for reboot quirks. Without it, it's
* impossible to override a faulty reboot quirk without recompiling.
*/
static int reboot_default = 1;
#if defined(CONFIG_X86_32) && defined(CONFIG_SMP) #if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
static int reboot_cpu = -1; static int reboot_cpu = -1;
#endif #endif
...@@ -67,6 +75,12 @@ bool port_cf9_safe = false; ...@@ -67,6 +75,12 @@ bool port_cf9_safe = false;
static int __init reboot_setup(char *str) static int __init reboot_setup(char *str)
{ {
for (;;) { for (;;) {
/* Having anything passed on the command line via
* reboot= will cause us to disable DMI checking
* below.
*/
reboot_default = 0;
switch (*str) { switch (*str) {
case 'w': case 'w':
reboot_mode = 0x1234; reboot_mode = 0x1234;
...@@ -295,14 +309,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { ...@@ -295,14 +309,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
DMI_MATCH(DMI_BOARD_NAME, "P4S800"), DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
}, },
}, },
{ /* Handle problems with rebooting on VersaLogic Menlow boards */
.callback = set_bios_reboot,
.ident = "VersaLogic Menlow based board",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "VersaLogic Corporation"),
DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"),
},
},
{ /* Handle reboot issue on Acer Aspire one */ { /* Handle reboot issue on Acer Aspire one */
.callback = set_kbd_reboot, .callback = set_kbd_reboot,
.ident = "Acer Aspire One A110", .ident = "Acer Aspire One A110",
...@@ -316,7 +322,12 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { ...@@ -316,7 +322,12 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
static int __init reboot_init(void) static int __init reboot_init(void)
{ {
/* Only do the DMI check if reboot_type hasn't been overridden
* on the command line
*/
if (reboot_default) {
dmi_check_system(reboot_dmi_table); dmi_check_system(reboot_dmi_table);
}
return 0; return 0;
} }
core_initcall(reboot_init); core_initcall(reboot_init);
...@@ -465,7 +476,12 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { ...@@ -465,7 +476,12 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = {
static int __init pci_reboot_init(void) static int __init pci_reboot_init(void)
{ {
/* Only do the DMI check if reboot_type hasn't been overridden
* on the command line
*/
if (reboot_default) {
dmi_check_system(pci_reboot_dmi_table); dmi_check_system(pci_reboot_dmi_table);
}
return 0; return 0;
} }
core_initcall(pci_reboot_init); core_initcall(pci_reboot_init);
......
...@@ -673,7 +673,7 @@ no_context(struct pt_regs *regs, unsigned long error_code, ...@@ -673,7 +673,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
stackend = end_of_stack(tsk); stackend = end_of_stack(tsk);
if (tsk != &init_task && *stackend != STACK_END_MAGIC) if (tsk != &init_task && *stackend != STACK_END_MAGIC)
printk(KERN_ALERT "Thread overran stack, or stack corrupted\n"); printk(KERN_EMERG "Thread overran stack, or stack corrupted\n");
tsk->thread.cr2 = address; tsk->thread.cr2 = address;
tsk->thread.trap_no = 14; tsk->thread.trap_no = 14;
...@@ -684,7 +684,7 @@ no_context(struct pt_regs *regs, unsigned long error_code, ...@@ -684,7 +684,7 @@ no_context(struct pt_regs *regs, unsigned long error_code,
sig = 0; sig = 0;
/* Executive summary in case the body of the oops scrolled away */ /* Executive summary in case the body of the oops scrolled away */
printk(KERN_EMERG "CR2: %016lx\n", address); printk(KERN_DEFAULT "CR2: %016lx\n", address);
oops_end(flags, regs, sig); oops_end(flags, regs, sig);
} }
......
...@@ -587,6 +587,7 @@ struct hw_perf_event { ...@@ -587,6 +587,7 @@ struct hw_perf_event {
u64 sample_period; u64 sample_period;
u64 last_period; u64 last_period;
local64_t period_left; local64_t period_left;
u64 interrupts_seq;
u64 interrupts; u64 interrupts;
u64 freq_time_stamp; u64 freq_time_stamp;
......
...@@ -2300,6 +2300,9 @@ do { \ ...@@ -2300,6 +2300,9 @@ do { \
return div64_u64(dividend, divisor); return div64_u64(dividend, divisor);
} }
static DEFINE_PER_CPU(int, perf_throttled_count);
static DEFINE_PER_CPU(u64, perf_throttled_seq);
static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
{ {
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
...@@ -2325,16 +2328,29 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) ...@@ -2325,16 +2328,29 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
} }
} }
static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) /*
* combine freq adjustment with unthrottling to avoid two passes over the
* events. At the same time, make sure, having freq events does not change
* the rate of unthrottling as that would introduce bias.
*/
static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx,
int needs_unthr)
{ {
struct perf_event *event; struct perf_event *event;
struct hw_perf_event *hwc; struct hw_perf_event *hwc;
u64 interrupts, now; u64 now, period = TICK_NSEC;
s64 delta; s64 delta;
if (!ctx->nr_freq) /*
* only need to iterate over all events iff:
* - context have events in frequency mode (needs freq adjust)
* - there are events to unthrottle on this cpu
*/
if (!(ctx->nr_freq || needs_unthr))
return; return;
raw_spin_lock(&ctx->lock);
list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
if (event->state != PERF_EVENT_STATE_ACTIVE) if (event->state != PERF_EVENT_STATE_ACTIVE)
continue; continue;
...@@ -2344,13 +2360,8 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) ...@@ -2344,13 +2360,8 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period)
hwc = &event->hw; hwc = &event->hw;
interrupts = hwc->interrupts; if (needs_unthr && hwc->interrupts == MAX_INTERRUPTS) {
hwc->interrupts = 0; hwc->interrupts = 0;
/*
* unthrottle events on the tick
*/
if (interrupts == MAX_INTERRUPTS) {
perf_log_throttle(event, 1); perf_log_throttle(event, 1);
event->pmu->start(event, 0); event->pmu->start(event, 0);
} }
...@@ -2358,14 +2369,26 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period) ...@@ -2358,14 +2369,26 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx, u64 period)
if (!event->attr.freq || !event->attr.sample_freq) if (!event->attr.freq || !event->attr.sample_freq)
continue; continue;
event->pmu->read(event); /*
* stop the event and update event->count
*/
event->pmu->stop(event, PERF_EF_UPDATE);
now = local64_read(&event->count); now = local64_read(&event->count);
delta = now - hwc->freq_count_stamp; delta = now - hwc->freq_count_stamp;
hwc->freq_count_stamp = now; hwc->freq_count_stamp = now;
/*
* restart the event
* reload only if value has changed
*/
if (delta > 0) if (delta > 0)
perf_adjust_period(event, period, delta); perf_adjust_period(event, period, delta);
event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
} }
raw_spin_unlock(&ctx->lock);
} }
/* /*
...@@ -2388,16 +2411,13 @@ static void rotate_ctx(struct perf_event_context *ctx) ...@@ -2388,16 +2411,13 @@ static void rotate_ctx(struct perf_event_context *ctx)
*/ */
static void perf_rotate_context(struct perf_cpu_context *cpuctx) static void perf_rotate_context(struct perf_cpu_context *cpuctx)
{ {
u64 interval = (u64)cpuctx->jiffies_interval * TICK_NSEC;
struct perf_event_context *ctx = NULL; struct perf_event_context *ctx = NULL;
int rotate = 0, remove = 1, freq = 0; int rotate = 0, remove = 1;
if (cpuctx->ctx.nr_events) { if (cpuctx->ctx.nr_events) {
remove = 0; remove = 0;
if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active) if (cpuctx->ctx.nr_events != cpuctx->ctx.nr_active)
rotate = 1; rotate = 1;
if (cpuctx->ctx.nr_freq)
freq = 1;
} }
ctx = cpuctx->task_ctx; ctx = cpuctx->task_ctx;
...@@ -2405,23 +2425,14 @@ static void perf_rotate_context(struct perf_cpu_context *cpuctx) ...@@ -2405,23 +2425,14 @@ static void perf_rotate_context(struct perf_cpu_context *cpuctx)
remove = 0; remove = 0;
if (ctx->nr_events != ctx->nr_active) if (ctx->nr_events != ctx->nr_active)
rotate = 1; rotate = 1;
if (ctx->nr_freq)
freq = 1;
} }
if (!rotate && !freq) if (!rotate)
goto done; goto done;
perf_ctx_lock(cpuctx, cpuctx->task_ctx); perf_ctx_lock(cpuctx, cpuctx->task_ctx);
perf_pmu_disable(cpuctx->ctx.pmu); perf_pmu_disable(cpuctx->ctx.pmu);
if (freq) {
perf_ctx_adjust_freq(&cpuctx->ctx, interval);
if (ctx)
perf_ctx_adjust_freq(ctx, interval);
}
if (rotate) {
cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
if (ctx) if (ctx)
ctx_sched_out(ctx, cpuctx, EVENT_FLEXIBLE); ctx_sched_out(ctx, cpuctx, EVENT_FLEXIBLE);
...@@ -2431,11 +2442,9 @@ static void perf_rotate_context(struct perf_cpu_context *cpuctx) ...@@ -2431,11 +2442,9 @@ static void perf_rotate_context(struct perf_cpu_context *cpuctx)
rotate_ctx(ctx); rotate_ctx(ctx);
perf_event_sched_in(cpuctx, ctx, current); perf_event_sched_in(cpuctx, ctx, current);
}
perf_pmu_enable(cpuctx->ctx.pmu); perf_pmu_enable(cpuctx->ctx.pmu);
perf_ctx_unlock(cpuctx, cpuctx->task_ctx); perf_ctx_unlock(cpuctx, cpuctx->task_ctx);
done: done:
if (remove) if (remove)
list_del_init(&cpuctx->rotation_list); list_del_init(&cpuctx->rotation_list);
...@@ -2445,10 +2454,22 @@ void perf_event_task_tick(void) ...@@ -2445,10 +2454,22 @@ void perf_event_task_tick(void)
{ {
struct list_head *head = &__get_cpu_var(rotation_list); struct list_head *head = &__get_cpu_var(rotation_list);
struct perf_cpu_context *cpuctx, *tmp; struct perf_cpu_context *cpuctx, *tmp;
struct perf_event_context *ctx;
int throttled;
WARN_ON(!irqs_disabled()); WARN_ON(!irqs_disabled());
__this_cpu_inc(perf_throttled_seq);
throttled = __this_cpu_xchg(perf_throttled_count, 0);
list_for_each_entry_safe(cpuctx, tmp, head, rotation_list) { list_for_each_entry_safe(cpuctx, tmp, head, rotation_list) {
ctx = &cpuctx->ctx;
perf_adjust_freq_unthr_context(ctx, throttled);
ctx = cpuctx->task_ctx;
if (ctx)
perf_adjust_freq_unthr_context(ctx, throttled);
if (cpuctx->jiffies_interval == 1 || if (cpuctx->jiffies_interval == 1 ||
!(jiffies % cpuctx->jiffies_interval)) !(jiffies % cpuctx->jiffies_interval))
perf_rotate_context(cpuctx); perf_rotate_context(cpuctx);
...@@ -4509,6 +4530,7 @@ static int __perf_event_overflow(struct perf_event *event, ...@@ -4509,6 +4530,7 @@ static int __perf_event_overflow(struct perf_event *event,
{ {
int events = atomic_read(&event->event_limit); int events = atomic_read(&event->event_limit);
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
u64 seq;
int ret = 0; int ret = 0;
/* /*
...@@ -4518,14 +4540,20 @@ static int __perf_event_overflow(struct perf_event *event, ...@@ -4518,14 +4540,20 @@ static int __perf_event_overflow(struct perf_event *event,
if (unlikely(!is_sampling_event(event))) if (unlikely(!is_sampling_event(event)))
return 0; return 0;
if (unlikely(hwc->interrupts >= max_samples_per_tick)) { seq = __this_cpu_read(perf_throttled_seq);
if (throttle) { if (seq != hwc->interrupts_seq) {
hwc->interrupts_seq = seq;
hwc->interrupts = 1;
} else {
hwc->interrupts++;
if (unlikely(throttle
&& hwc->interrupts >= max_samples_per_tick)) {
__this_cpu_inc(perf_throttled_count);
hwc->interrupts = MAX_INTERRUPTS; hwc->interrupts = MAX_INTERRUPTS;
perf_log_throttle(event, 0); perf_log_throttle(event, 0);
ret = 1; ret = 1;
} }
} else }
hwc->interrupts++;
if (event->attr.freq) { if (event->attr.freq) {
u64 now = perf_clock(); u64 now = perf_clock();
......
...@@ -1038,6 +1038,22 @@ void do_exit(long code) ...@@ -1038,6 +1038,22 @@ void do_exit(long code)
if (tsk->nr_dirtied) if (tsk->nr_dirtied)
__this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied);
exit_rcu(); exit_rcu();
/*
* The setting of TASK_RUNNING by try_to_wake_up() may be delayed
* when the following two conditions become true.
* - There is race condition of mmap_sem (It is acquired by
* exit_mm()), and
* - SMI occurs before setting TASK_RUNINNG.
* (or hypervisor of virtual machine switches to other guest)
* As a result, we may become TASK_RUNNING after becoming TASK_DEAD
*
* To avoid it, we have to wait for releasing tsk->pi_lock which
* is held by try_to_wake_up()
*/
smp_mb();
raw_spin_unlock_wait(&tsk->pi_lock);
/* causes final put_task_struct in finish_task_switch(). */ /* causes final put_task_struct in finish_task_switch(). */
tsk->state = TASK_DEAD; tsk->state = TASK_DEAD;
tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#include <asm/tlb.h> #include <asm/tlb.h>
#include <asm/irq_regs.h> #include <asm/irq_regs.h>
#include <asm/mutex.h>
#ifdef CONFIG_PARAVIRT #ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h> #include <asm/paravirt.h>
#endif #endif
...@@ -723,9 +724,6 @@ static void dequeue_task(struct rq *rq, struct task_struct *p, int flags) ...@@ -723,9 +724,6 @@ static void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
p->sched_class->dequeue_task(rq, p, flags); p->sched_class->dequeue_task(rq, p, flags);
} }
/*
* activate_task - move a task to the runqueue.
*/
void activate_task(struct rq *rq, struct task_struct *p, int flags) void activate_task(struct rq *rq, struct task_struct *p, int flags)
{ {
if (task_contributes_to_load(p)) if (task_contributes_to_load(p))
...@@ -734,9 +732,6 @@ void activate_task(struct rq *rq, struct task_struct *p, int flags) ...@@ -734,9 +732,6 @@ void activate_task(struct rq *rq, struct task_struct *p, int flags)
enqueue_task(rq, p, flags); enqueue_task(rq, p, flags);
} }
/*
* deactivate_task - remove a task from the runqueue.
*/
void deactivate_task(struct rq *rq, struct task_struct *p, int flags) void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
{ {
if (task_contributes_to_load(p)) if (task_contributes_to_load(p))
...@@ -4134,7 +4129,7 @@ static int __sched_setscheduler(struct task_struct *p, int policy, ...@@ -4134,7 +4129,7 @@ static int __sched_setscheduler(struct task_struct *p, int policy,
on_rq = p->on_rq; on_rq = p->on_rq;
running = task_current(rq, p); running = task_current(rq, p);
if (on_rq) if (on_rq)
deactivate_task(rq, p, 0); dequeue_task(rq, p, 0);
if (running) if (running)
p->sched_class->put_prev_task(rq, p); p->sched_class->put_prev_task(rq, p);
...@@ -4147,7 +4142,7 @@ static int __sched_setscheduler(struct task_struct *p, int policy, ...@@ -4147,7 +4142,7 @@ static int __sched_setscheduler(struct task_struct *p, int policy,
if (running) if (running)
p->sched_class->set_curr_task(rq); p->sched_class->set_curr_task(rq);
if (on_rq) if (on_rq)
activate_task(rq, p, 0); enqueue_task(rq, p, 0);
check_class_changed(rq, p, prev_class, oldprio); check_class_changed(rq, p, prev_class, oldprio);
task_rq_unlock(rq, p, &flags); task_rq_unlock(rq, p, &flags);
...@@ -4998,9 +4993,9 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu) ...@@ -4998,9 +4993,9 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
* placed properly. * placed properly.
*/ */
if (p->on_rq) { if (p->on_rq) {
deactivate_task(rq_src, p, 0); dequeue_task(rq_src, p, 0);
set_task_cpu(p, dest_cpu); set_task_cpu(p, dest_cpu);
activate_task(rq_dest, p, 0); enqueue_task(rq_dest, p, 0);
check_preempt_curr(rq_dest, p, 0); check_preempt_curr(rq_dest, p, 0);
} }
done: done:
...@@ -7032,10 +7027,10 @@ static void normalize_task(struct rq *rq, struct task_struct *p) ...@@ -7032,10 +7027,10 @@ static void normalize_task(struct rq *rq, struct task_struct *p)
on_rq = p->on_rq; on_rq = p->on_rq;
if (on_rq) if (on_rq)
deactivate_task(rq, p, 0); dequeue_task(rq, p, 0);
__setscheduler(rq, p, SCHED_NORMAL, 0); __setscheduler(rq, p, SCHED_NORMAL, 0);
if (on_rq) { if (on_rq) {
activate_task(rq, p, 0); enqueue_task(rq, p, 0);
resched_task(rq->curr); resched_task(rq->curr);
} }
......
...@@ -4866,6 +4866,15 @@ static void nohz_balancer_kick(int cpu) ...@@ -4866,6 +4866,15 @@ static void nohz_balancer_kick(int cpu)
return; return;
} }
static inline void clear_nohz_tick_stopped(int cpu)
{
if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
atomic_dec(&nohz.nr_cpus);
clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
}
}
static inline void set_cpu_sd_state_busy(void) static inline void set_cpu_sd_state_busy(void)
{ {
struct sched_domain *sd; struct sched_domain *sd;
...@@ -4904,6 +4913,12 @@ void select_nohz_load_balancer(int stop_tick) ...@@ -4904,6 +4913,12 @@ void select_nohz_load_balancer(int stop_tick)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
/*
* If this cpu is going down, then nothing needs to be done.
*/
if (!cpu_active(cpu))
return;
if (stop_tick) { if (stop_tick) {
if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu))) if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
return; return;
...@@ -4914,6 +4929,18 @@ void select_nohz_load_balancer(int stop_tick) ...@@ -4914,6 +4929,18 @@ void select_nohz_load_balancer(int stop_tick)
} }
return; return;
} }
static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DYING:
clear_nohz_tick_stopped(smp_processor_id());
return NOTIFY_OK;
default:
return NOTIFY_DONE;
}
}
#endif #endif
static DEFINE_SPINLOCK(balancing); static DEFINE_SPINLOCK(balancing);
...@@ -5070,11 +5097,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu) ...@@ -5070,11 +5097,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu)
* busy tick after returning from idle, we will update the busy stats. * busy tick after returning from idle, we will update the busy stats.
*/ */
set_cpu_sd_state_busy(); set_cpu_sd_state_busy();
if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) { clear_nohz_tick_stopped(cpu);
clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
atomic_dec(&nohz.nr_cpus);
}
/* /*
* None are in tickless mode and hence no need for NOHZ idle load * None are in tickless mode and hence no need for NOHZ idle load
...@@ -5590,6 +5613,7 @@ __init void init_sched_fair_class(void) ...@@ -5590,6 +5613,7 @@ __init void init_sched_fair_class(void)
#ifdef CONFIG_NO_HZ #ifdef CONFIG_NO_HZ
zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT); zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT);
cpu_notifier(sched_ilb_notifier, 0);
#endif #endif
#endif /* SMP */ #endif /* SMP */
......
...@@ -1587,6 +1587,11 @@ static int push_rt_task(struct rq *rq) ...@@ -1587,6 +1587,11 @@ static int push_rt_task(struct rq *rq)
if (!next_task) if (!next_task)
return 0; return 0;
#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
if (unlikely(task_running(rq, next_task)))
return 0;
#endif
retry: retry:
if (unlikely(next_task == rq->curr)) { if (unlikely(next_task == rq->curr)) {
WARN_ON(1); WARN_ON(1);
......
...@@ -296,7 +296,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) ...@@ -296,7 +296,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
if (__this_cpu_read(soft_watchdog_warn) == true) if (__this_cpu_read(soft_watchdog_warn) == true)
return HRTIMER_RESTART; return HRTIMER_RESTART;
printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n", printk(KERN_EMERG "BUG: soft lockup - CPU#%d stuck for %us! [%s:%d]\n",
smp_processor_id(), duration, smp_processor_id(), duration,
current->comm, task_pid_nr(current)); current->comm, task_pid_nr(current));
print_modules(); print_modules();
......
...@@ -169,7 +169,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) ...@@ -169,7 +169,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
return BUG_TRAP_TYPE_WARN; return BUG_TRAP_TYPE_WARN;
} }
printk(KERN_EMERG "------------[ cut here ]------------\n"); printk(KERN_DEFAULT "------------[ cut here ]------------\n");
if (file) if (file)
printk(KERN_CRIT "kernel BUG at %s:%u!\n", printk(KERN_CRIT "kernel BUG at %s:%u!\n",
......
...@@ -104,7 +104,7 @@ endif ...@@ -104,7 +104,7 @@ endif
CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
EXTLIBS = -lpthread -lrt -lelf -lm EXTLIBS = -lpthread -lrt -lelf -lm
ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
ALL_LDFLAGS = $(LDFLAGS) ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip STRIP ?= strip
...@@ -168,10 +168,7 @@ endif ...@@ -168,10 +168,7 @@ endif
### --- END CONFIGURATION SECTION --- ### --- END CONFIGURATION SECTION ---
# Those must not be GNU-specific; they are shared with perl/ which may BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
# be built by a different compiler. (Note that this is an artifact now
# but it still might be nice to keep that distinction.)
BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include
BASIC_LDFLAGS = BASIC_LDFLAGS =
# Guard against environment variables # Guard against environment variables
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
*/ */
#define _GNU_SOURCE
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -31,7 +30,6 @@ ...@@ -31,7 +30,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#undef _GNU_SOURCE
#include "perf.h" #include "perf.h"
#include "builtin.h" #include "builtin.h"
#include "util/util.h" #include "util/util.h"
......
...@@ -89,8 +89,6 @@ void get_term_dimensions(struct winsize *ws) ...@@ -89,8 +89,6 @@ void get_term_dimensions(struct winsize *ws)
static void perf_top__update_print_entries(struct perf_top *top) static void perf_top__update_print_entries(struct perf_top *top)
{ {
top->print_entries = top->winsize.ws_row;
if (top->print_entries > 9) if (top->print_entries > 9)
top->print_entries -= 9; top->print_entries -= 9;
} }
...@@ -100,6 +98,13 @@ static void perf_top__sig_winch(int sig __used, siginfo_t *info __used, void *ar ...@@ -100,6 +98,13 @@ static void perf_top__sig_winch(int sig __used, siginfo_t *info __used, void *ar
struct perf_top *top = arg; struct perf_top *top = arg;
get_term_dimensions(&top->winsize); get_term_dimensions(&top->winsize);
if (!top->print_entries
|| (top->print_entries+4) > top->winsize.ws_row) {
top->print_entries = top->winsize.ws_row;
} else {
top->print_entries += 4;
top->winsize.ws_row = top->print_entries;
}
perf_top__update_print_entries(top); perf_top__update_print_entries(top);
} }
...@@ -453,8 +458,10 @@ static void perf_top__handle_keypress(struct perf_top *top, int c) ...@@ -453,8 +458,10 @@ static void perf_top__handle_keypress(struct perf_top *top, int c)
}; };
perf_top__sig_winch(SIGWINCH, NULL, top); perf_top__sig_winch(SIGWINCH, NULL, top);
sigaction(SIGWINCH, &act, NULL); sigaction(SIGWINCH, &act, NULL);
} else } else {
perf_top__sig_winch(SIGWINCH, NULL, top);
signal(SIGWINCH, SIG_DFL); signal(SIGWINCH, SIG_DFL);
}
break; break;
case 'E': case 'E':
if (top->evlist->nr_entries > 1) { if (top->evlist->nr_entries > 1) {
......
...@@ -2105,7 +2105,7 @@ int perf_event__synthesize_event_type(struct perf_tool *tool, ...@@ -2105,7 +2105,7 @@ int perf_event__synthesize_event_type(struct perf_tool *tool,
strncpy(ev.event_type.event_type.name, name, MAX_EVENT_NAME - 1); strncpy(ev.event_type.event_type.name, name, MAX_EVENT_NAME - 1);
ev.event_type.header.type = PERF_RECORD_HEADER_EVENT_TYPE; ev.event_type.header.type = PERF_RECORD_HEADER_EVENT_TYPE;
size = strlen(name); size = strlen(ev.event_type.event_type.name);
size = ALIGN(size, sizeof(u64)); size = ALIGN(size, sizeof(u64));
ev.event_type.header.size = sizeof(ev.event_type) - ev.event_type.header.size = sizeof(ev.event_type) -
(sizeof(ev.event_type.event_type.name) - size); (sizeof(ev.event_type.event_type.name) - size);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
* *
*/ */
#define _GNU_SOURCE
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
#include <limits.h> #include <limits.h>
#include <elf.h> #include <elf.h>
#undef _GNU_SOURCE
#include "util.h" #include "util.h"
#include "event.h" #include "event.h"
#include "string.h" #include "string.h"
......
#define _GNU_SOURCE
#include <ctype.h> #include <ctype.h>
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
......
...@@ -21,14 +21,13 @@ ...@@ -21,14 +21,13 @@
* The parts for function graph printing was taken and modified from the * The parts for function graph printing was taken and modified from the
* Linux Kernel that were written by Frederic Weisbecker. * Linux Kernel that were written by Frederic Weisbecker.
*/ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#undef _GNU_SOURCE
#include "../perf.h" #include "../perf.h"
#include "util.h" #include "util.h"
#include "trace-event.h" #include "trace-event.h"
......
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#undef _GNU_SOURCE
#include "../libslang.h" #include "../libslang.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
......
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) #define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1)
#define _ALL_SOURCE 1 #define _ALL_SOURCE 1
#define _GNU_SOURCE 1
#define _BSD_SOURCE 1 #define _BSD_SOURCE 1
#define HAS_BOOL #define HAS_BOOL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment