Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1724171
| From | Anna-Maria Gleixner <anna-maria@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 16/25] hrtimer: Allow function reuse for softirq based hrtimer |
| Date | 2017-08-31 14:30 +0200 |
| Message-ID | <ukwLE-5Ay-21@gated-at.bofh.it> (permalink) |
| References | <ukwLD-5Ay-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
The softirq based hrtimer can utilize most of the existing hrtimer
functions, but need to operate on a different data set. Add an active_mask
argument to various functions so the hard and soft bases can be
selected. Fixup the existing callers and hand in the ACTIVE_HARD mask.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
kernel/time/hrtimer.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -72,6 +72,14 @@
#define CLOCK_TAI_SOFT (CLOCK_TAI | HRTIMER_BASE_SOFT_MASK)
/*
+ * Masks for selecting the soft and hard context timers from
+ * cpu_base->active
+ */
+#define MASK_SHIFT (HRTIMER_BASE_MONOTONIC_SOFT)
+#define HRTIMER_ACTIVE_HARD ((1U << MASK_SHIFT) - 1)
+#define HRTIMER_ACTIVE_SOFT (HRTIMER_ACTIVE_HARD << MASK_SHIFT)
+
+/*
* The timer bases:
*
* There are more clockids than hrtimer bases. Thus, we index
@@ -527,11 +535,12 @@ static ktime_t __hrtimer_next_event_base
static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
{
- unsigned int active = cpu_base->active_bases;
+ unsigned int active;
ktime_t expires_next = KTIME_MAX;
hrtimer_update_next_timer(cpu_base, NULL);
+ active = cpu_base->active_bases & HRTIMER_ACTIVE_HARD;
expires_next = __hrtimer_next_event_base(cpu_base, active, expires_next);
return expires_next;
@@ -1264,9 +1273,10 @@ static void __run_hrtimer(struct hrtimer
base->running = NULL;
}
-static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
+static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now,
+ unsigned int active_mask)
{
- unsigned int active = cpu_base->active_bases;
+ unsigned int active = cpu_base->active_bases & active_mask;
while (active) {
unsigned int id = __ffs(active);
@@ -1333,7 +1343,7 @@ void hrtimer_interrupt(struct clock_even
*/
cpu_base->expires_next = KTIME_MAX;
- __hrtimer_run_queues(cpu_base, now);
+ __hrtimer_run_queues(cpu_base, now, HRTIMER_ACTIVE_HARD);
/* Reevaluate the clock bases for the next expiry */
expires_next = __hrtimer_get_next_event(cpu_base);
@@ -1438,7 +1448,7 @@ void hrtimer_run_queues(void)
raw_spin_lock(&cpu_base->lock);
now = hrtimer_update_base(cpu_base);
- __hrtimer_run_queues(cpu_base, now);
+ __hrtimer_run_queues(cpu_base, now, HRTIMER_ACTIVE_HARD);
raw_spin_unlock(&cpu_base->lock);
}
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 16/25] hrtimer: Allow function reuse for softirq based hrtimer Anna-Maria Gleixner <anna-maria@linutronix.de> - 2017-08-31 14:30 +0200
csiph-web