Commit 33fe41da authored by Ingo Molnar's avatar Ingo Molnar Committed by Thomas Gleixner

softirq: per cpu assumptions fixes

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent c2a1643b
......@@ -477,9 +477,9 @@ static inline int hrtimer_is_hres_enabled(void)
/*
* Is the high resolution mode active ?
*/
static inline int hrtimer_hres_active(void)
static inline int hrtimer_hres_active(struct hrtimer_cpu_base *cpu_base)
{
return __get_cpu_var(hrtimer_bases).hres_active;
return cpu_base->hres_active;
}
/*
......@@ -574,11 +574,11 @@ static int hrtimer_reprogram(struct hrtimer *timer,
*/
static void retrigger_next_event(void *arg)
{
struct hrtimer_cpu_base *base;
struct hrtimer_cpu_base *base = &__get_cpu_var(hrtimer_bases);
struct timespec realtime_offset;
unsigned long seq;
if (!hrtimer_hres_active())
if (!hrtimer_hres_active(base))
return;
do {
......@@ -588,8 +588,6 @@ static void retrigger_next_event(void *arg)
-wall_to_monotonic.tv_nsec);
} while (read_atomic_seqretry(&xtime_lock, seq));
base = &__get_cpu_var(hrtimer_bases);
/* Adjust CLOCK_REALTIME offset */
atomic_spin_lock(&base->lock);
base->clock_base[CLOCK_REALTIME].offset =
......@@ -672,10 +670,8 @@ static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
/*
* Switch to high resolution mode
*/
static int hrtimer_switch_to_hres(void)
static int hrtimer_switch_to_hres(struct hrtimer_cpu_base *base)
{
int cpu = smp_processor_id();
struct hrtimer_cpu_base *base = &per_cpu(hrtimer_bases, cpu);
unsigned long flags;
if (base->hres_active)
......@@ -686,7 +682,7 @@ static int hrtimer_switch_to_hres(void)
if (tick_init_highres()) {
local_irq_restore(flags);
printk(KERN_WARNING "Could not switch to high resolution "
"mode on CPU %d\n", cpu);
"mode on CPU %d\n", raw_smp_processor_id());
return 0;
}
base->hres_active = 1;
......@@ -705,9 +701,15 @@ static int hrtimer_switch_to_hres(void)
#else
static inline int hrtimer_hres_active(void) { return 0; }
static inline int hrtimer_hres_active(struct hrtimer_cpu_base *base)
{
return 0;
}
static inline int hrtimer_is_hres_enabled(void) { return 0; }
static inline int hrtimer_switch_to_hres(void) { return 0; }
static inline int hrtimer_switch_to_hres(struct hrtimer_cpu_base *base)
{
return 0;
}
static inline void hrtimer_force_reprogram(struct hrtimer_cpu_base *base) { }
static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
struct hrtimer_clock_base *base,
......@@ -885,7 +887,7 @@ static void __remove_hrtimer(struct hrtimer *timer,
if (base->first == &timer->node) {
base->first = rb_next(&timer->node);
/* Reprogram the clock event device. if enabled */
if (reprogram && hrtimer_hres_active())
if (reprogram && hrtimer_hres_active(base->cpu_base))
hrtimer_force_reprogram(base->cpu_base);
}
rb_erase(&timer->node, &base->active);
......@@ -1091,7 +1093,7 @@ ktime_t hrtimer_get_next_event(void)
atomic_spin_lock_irqsave(&cpu_base->lock, flags);
if (!hrtimer_hres_active()) {
if (!hrtimer_hres_active(cpu_base)) {
for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++, base++) {
struct hrtimer *timer;
......@@ -1326,9 +1328,11 @@ void hrtimer_interrupt(struct clock_event_device *dev)
*/
static void __hrtimer_peek_ahead_timers(void)
{
struct hrtimer_cpu_base *cpu_base;
struct tick_device *td;
if (!hrtimer_hres_active())
cpu_base = &__get_cpu_var(hrtimer_bases);
if (!hrtimer_hres_active(cpu_base))
return;
td = &__get_cpu_var(tick_cpu_device);
......@@ -1374,7 +1378,9 @@ static inline void __hrtimer_peek_ahead_timers(void) { }
*/
void hrtimer_run_pending(void)
{
if (hrtimer_hres_active())
struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
if (hrtimer_hres_active(cpu_base))
return;
/*
......@@ -1386,7 +1392,7 @@ void hrtimer_run_pending(void)
* deadlock vs. xtime_lock.
*/
if (tick_check_oneshot_change(!hrtimer_is_hres_enabled()))
hrtimer_switch_to_hres();
hrtimer_switch_to_hres(cpu_base);
}
/*
......@@ -1395,11 +1401,12 @@ void hrtimer_run_pending(void)
void hrtimer_run_queues(void)
{
struct rb_node *node;
struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
struct hrtimer_cpu_base *cpu_base;
struct hrtimer_clock_base *base;
int index, gettime = 1;
if (hrtimer_hres_active())
cpu_base = &per_cpu(hrtimer_bases, raw_smp_processor_id());
if (hrtimer_hres_active(cpu_base))
return;
for (index = 0; index < HRTIMER_MAX_CLOCK_BASES; index++) {
......
......@@ -4875,7 +4875,7 @@ out:
*/
static void run_rebalance_domains(struct softirq_action *h)
{
int this_cpu = smp_processor_id();
int this_cpu = raw_smp_processor_id();
struct rq *this_rq = cpu_rq(this_cpu);
enum cpu_idle_type idle = this_rq->idle_at_tick ?
CPU_IDLE : CPU_NOT_IDLE;
......
......@@ -1233,7 +1233,7 @@ void update_process_times(int user_tick)
*/
static void run_timer_softirq(struct softirq_action *h)
{
struct tvec_base *base = __get_cpu_var(tvec_bases);
struct tvec_base *base = per_cpu(tvec_bases, raw_smp_processor_id());
perf_counter_do_pending();
......
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