From: Anna-Maria Gleixner <anna-maria@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Christoph Hellwig <hch@lst.org>,
keescook@chromium.org, John Stultz <john.stultz@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 16/25] hrtimer: Allow function reuse for softirq based hrtimer
Date: Thu, 31 Aug 2017 12:23:41 -0000 [thread overview]
Message-ID: <20170831105826.849175752@linutronix.de> (raw)
In-Reply-To: <20170831105725.809317030@linutronix.de>
[-- Attachment #1: hrtimer_Allow_function_reuse_for_softirq_based_hrtimer.patch --]
[-- Type: text/plain, Size: 2498 bytes --]
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);
}
next prev parent reply other threads:[~2017-08-31 12:27 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-31 12:23 [PATCH 00/25] hrtimer: Provide softirq context hrtimers Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 01/25] hrtimer: Use predefined function for updating next_timer Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 02/25] hrtimer: Correct blantanly wrong comment Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 03/25] hrtimer: Fix kerneldoc for struct hrtimer_cpu_base Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 05/25] hrtimer: Switch for loop to _ffs() evaluation Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 04/25] hrtimer: Cleanup clock argument in schedule_hrtimeout_range_clock() Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 06/25] hrtimer: Store running timer in hrtimer_clock_base Anna-Maria Gleixner
2017-09-25 14:44 ` Peter Zijlstra
2017-09-28 12:45 ` Thomas Gleixner
2017-08-31 12:23 ` [PATCH 07/25] hrtimer: Reduce conditional code (hres_active) Anna-Maria Gleixner
2017-09-25 13:55 ` Peter Zijlstra
2017-09-25 14:28 ` Thomas Gleixner
2017-08-31 12:23 ` [PATCH 08/25] hrtimer: Reduce conditional code (expires_next, next_timer) Anna-Maria Gleixner
2017-09-26 12:10 ` Peter Zijlstra
2017-09-28 8:07 ` Thomas Gleixner
2017-08-31 12:23 ` [PATCH 09/25] hrtimer: Reduce conditional code (hrtimer_reprogram()) Anna-Maria Gleixner
2017-09-26 12:07 ` Peter Zijlstra
2017-08-31 12:23 ` [PATCH 11/25] hrtimer: Allow remote hrtimer enqueue with "expires_next" as expiry time Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 10/25] hrtimer: Make handling of hrtimer reprogramming and enqueuing not conditional Anna-Maria Gleixner
2017-09-26 12:14 ` Peter Zijlstra
2017-09-28 8:09 ` Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 13/25] hrtimer: Split out code from hrtimer_start_range_ns() for reuse Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 12/25] hrtimer: Simplify hrtimer_reprogram() call Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 14/25] hrtimer: Split out code from __hrtimer_get_next_event() for reuse Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 15/25] hrtimer: Add clock bases for soft irq context Anna-Maria Gleixner
2017-08-31 12:23 ` Anna-Maria Gleixner [this message]
2017-08-31 12:23 ` [PATCH 18/25] hrtimer: Enable soft and hard hrtimer Anna-Maria Gleixner
2017-09-26 12:52 ` Peter Zijlstra
2017-09-27 14:18 ` Anna-Maria Gleixner
2017-09-27 15:54 ` Thomas Gleixner
2017-09-27 16:47 ` Peter Zijlstra
2017-08-31 12:23 ` [PATCH 17/25] hrtimer: Implementation of softirq hrtimer handling Anna-Maria Gleixner
2017-09-26 12:40 ` Peter Zijlstra
2017-09-26 15:03 ` Peter Zijlstra
2017-09-27 14:22 ` Anna-Maria Gleixner
2017-09-27 16:46 ` Peter Zijlstra
2017-09-27 16:40 ` Peter Zijlstra
2017-09-28 7:59 ` Thomas Gleixner
2017-09-28 8:15 ` Peter Zijlstra
2017-12-19 8:58 ` Sebastian Andrzej Siewior
2017-12-19 13:21 ` Peter Zijlstra
2017-12-20 8:44 ` Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 19/25] can/bcm: Replace hrtimer_tasklet with softirq based hrtimer Anna-Maria Gleixner
2017-09-01 15:49 ` Oliver Hartkopp
2017-09-01 15:56 ` Thomas Gleixner
2017-09-01 17:02 ` Oliver Hartkopp
2017-09-02 17:56 ` Oliver Hartkopp
2017-08-31 12:23 ` [PATCH 20/25] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer Anna-Maria Gleixner
2017-09-05 7:03 ` Johannes Berg
2017-09-05 8:49 ` Thomas Gleixner
2017-09-05 8:51 ` Johannes Berg
2017-08-31 12:23 ` [PATCH 21/25] xfrm: " Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 22/25] softirq: Remove tasklet_hrtimer Anna-Maria Gleixner
2017-08-31 12:23 ` [PATCH 23/25] ALSA/dummy: Replace tasklet with softirq hrtimer Anna-Maria Gleixner
2017-08-31 14:21 ` Takashi Sakamoto
2017-08-31 14:26 ` Takashi Iwai
2017-08-31 15:36 ` Takashi Iwai
2017-09-01 10:25 ` Takashi Sakamoto
2017-09-01 11:58 ` Takashi Iwai
2017-09-02 1:19 ` Takashi Sakamoto
2017-09-04 12:45 ` Takashi Sakamoto
2017-09-05 15:53 ` [PATCH 23/25 v2] " Sebastian Andrzej Siewior
2017-09-05 16:02 ` Takashi Iwai
2017-09-05 16:05 ` Takashi Sakamoto
2017-09-05 16:18 ` [PATCH 23/25 v3] " Sebastian Andrzej Siewior
2017-09-06 4:30 ` Takashi Sakamoto
2017-09-08 8:28 ` [alsa-devel] " Takashi Iwai
2017-08-31 12:23 ` [PATCH 25/25] usb/gadget/NCM: " Anna-Maria Gleixner
2017-10-24 9:45 ` Felipe Balbi
2017-08-31 12:23 ` [PATCH 24/25] net/cdc_ncm: " Anna-Maria Gleixner
2017-08-31 13:33 ` Greg Kroah-Hartman
2017-08-31 13:57 ` Bjørn Mork
2017-09-05 15:42 ` [PATCH 24/25 v2] " Sebastian Andrzej Siewior
2017-08-31 12:36 ` [PATCH 00/25] hrtimer: Provide softirq context hrtimers Anna-Maria Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170831105826.849175752@linutronix.de \
--to=anna-maria@linutronix.de \
--cc=hch@lst.org \
--cc=john.stultz@linaro.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome