Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30f9028b authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner
Browse files

perf/core: Mark hrtimers to expire in hard interrupt context



To guarantee that the multiplexing mechanism and the hrtimer driven events
work on PREEMPT_RT enabled kernels it's required that the related hrtimers
expire in hard interrupt context. Mark them so PREEMPT_RT kernels wont
defer them to soft interrupt context.

No functional change.

[ tglx: Split out of larger combo patch. Added changelog ]

Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190726185753.169509224@linutronix.de

parent d5096aa6
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -1103,7 +1103,7 @@ static void __perf_mux_hrtimer_init(struct perf_cpu_context *cpuctx, int cpu)
	cpuctx->hrtimer_interval = ns_to_ktime(NSEC_PER_MSEC * interval);
	cpuctx->hrtimer_interval = ns_to_ktime(NSEC_PER_MSEC * interval);


	raw_spin_lock_init(&cpuctx->hrtimer_lock);
	raw_spin_lock_init(&cpuctx->hrtimer_lock);
	hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
	hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
	timer->function = perf_mux_hrtimer_handler;
	timer->function = perf_mux_hrtimer_handler;
}
}


@@ -1121,7 +1121,7 @@ static int perf_mux_hrtimer_restart(struct perf_cpu_context *cpuctx)
	if (!cpuctx->hrtimer_active) {
	if (!cpuctx->hrtimer_active) {
		cpuctx->hrtimer_active = 1;
		cpuctx->hrtimer_active = 1;
		hrtimer_forward_now(timer, cpuctx->hrtimer_interval);
		hrtimer_forward_now(timer, cpuctx->hrtimer_interval);
		hrtimer_start_expires(timer, HRTIMER_MODE_ABS_PINNED);
		hrtimer_start_expires(timer, HRTIMER_MODE_ABS_PINNED_HARD);
	}
	}
	raw_spin_unlock_irqrestore(&cpuctx->hrtimer_lock, flags);
	raw_spin_unlock_irqrestore(&cpuctx->hrtimer_lock, flags);


@@ -9491,7 +9491,7 @@ static void perf_swevent_start_hrtimer(struct perf_event *event)
		period = max_t(u64, 10000, hwc->sample_period);
		period = max_t(u64, 10000, hwc->sample_period);
	}
	}
	hrtimer_start(&hwc->hrtimer, ns_to_ktime(period),
	hrtimer_start(&hwc->hrtimer, ns_to_ktime(period),
		      HRTIMER_MODE_REL_PINNED);
		      HRTIMER_MODE_REL_PINNED_HARD);
}
}


static void perf_swevent_cancel_hrtimer(struct perf_event *event)
static void perf_swevent_cancel_hrtimer(struct perf_event *event)
@@ -9513,7 +9513,7 @@ static void perf_swevent_init_hrtimer(struct perf_event *event)
	if (!is_sampling_event(event))
	if (!is_sampling_event(event))
		return;
		return;


	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
	hwc->hrtimer.function = perf_swevent_hrtimer;
	hwc->hrtimer.function = perf_swevent_hrtimer;


	/*
	/*