From: Juri Lelli <juri.lelli@redhat.com>
To: bigeasy@linutronix.de, tglx@linutronix.de
Cc: linux-rt-users@vger.kernel.org, peterz@infradead.org,
linux-kernel@vger.kernel.org, bristot@redhat.com,
Juri Lelli <juri.lelli@redhat.com>
Subject: [RFC PATCH RT v2 0/2] Add PINNED_HARD mode to hrtimers
Date: Wed, 16 Jun 2021 09:17:03 +0200 [thread overview]
Message-ID: <20210616071705.166658-1-juri.lelli@redhat.com> (raw)
Hi,
I rebased an RFC series I already proposed a while ago [1] and I'd like
people to consider it again for inclusion.
When running cyclictest on isolated CPUs with timer_migration enabled,
the following, where CPU0 is one of the housekeeping CPUs and CPU2 is
isolated, is (of course) happening:
<idle>-0 [000] ... hrtimer_cancel: hrtimer=0xffffb4a74be7fe70
<idle>-0 [000] ... hrtimer_expire_entry: hrtimer=0xffffb4a74be7fe70 now=144805770984 function=hrtimer_wakeup/0x0
<idle>-0 [000] ... sched_wakeup: cyclictest:1171 [4] success=1 CPU:002
<idle>-0 [000] ... hrtimer_expire_exit: hrtimer=0xffffb4a74be7fe70
<idle>-0 [002] ... sched_switch: swapper/2:0 [120] R ==> cyclictest:1171 [4]
cyclictest-1171 [002] ... hrtimer_init: hrtimer=0xffffb4a74be7fe70 clockid=CLOCK_MONOTONIC mode=0x8
cyclictest-1171 [002] ... hrtimer_start: hrtimer=0xffffb4a74be7fe70 function=hrtimer_wakeup/0x0 ...
cyclictest-1171 [002] ... sched_switch: cyclictest:1171 [4] S ==> swapper/2:0 [120]
While cyclitest is arming the hrtimer while running on isolated CPU2
(by means of clock_nanosleep), the hrtimer is then firing on CPU0. This
is due to the fact that switch_hrtimer_base(), called at hrtimer enqueue
time, will prefer to enqueue the timer on an housekeeping !idle CPU, if
the timer is not pinned, as per timer_migration feature.
The problem with this is that we are measuring wake up latencies across
isolated and !isolated domains, which is against the purpose of
configuring the latter, while having timer_migration enabled is required
for certain workloads that are not using timers and don't want to be
ever interrupted.
Since PREEMPT_RT already forces HARD mode for hrtimers armed by tasks
running with RT policies, it seems to make sense to also force PINNED
mode under the same conditions.
This set implements the behavior, achieving something like the
following:
<idle>-0 [002] ... hrtimer_cancel: hrtimer=0xffffafbacc19fe78
<idle>-0 [002] ... hrtimer_expire_entry: hrtimer=0xffffafbacc19fe78 now=104335855898 function=hrtimer_wakeup/0x0
<idle>-0 [002] ... sched_wakeup: cyclictest:1165 [4] success=1 CPU:002
<idle>-0 [002] ... hrtimer_expire_exit: hrtimer=0xffffafbacc19fe78
<idle>-0 [002] ... sched_switch: swapper/2:0 [120] R ==> cyclictest:1165 [4]
cyclictest-1165 [002] ... hrtimer_init: hrtimer=0xffffafbacc19fe78 clockid=CLOCK_MONOTONIC mode=0xa
cyclictest-1165 [002] ... hrtimer_start: hrtimer=0xffffafbacc19fe78 function=hrtimer_wakeup/0x0 ...
cyclictest-1165 [002] ... sched_switch: cyclictest:1165 [4] S ==> swapper/2:0 [120]
Sebastian didn't look against the proposed changes, but I didn't follow
up back then because it looked like we could meet workloads requirements
at that time w/o this set. Now things have changed, looks like the mix
of the two types of workloads - interrupt driven and always running - is
very relevant and we need to accommodate both types on the same system
setup.
Does this still make sense or do you suggest alternative approaches?
Thanks!
- Juri
1 - https://lore.kernel.org/lkml/20190214133716.10187-1-juri.lelli@redhat.com/
Juri Lelli (2):
time/hrtimer: Add PINNED_HARD mode for realtime hrtimers
time/hrtimer: Embed hrtimer mode into hrtimer_sleeper
include/linux/hrtimer.h | 3 +++
kernel/time/hrtimer.c | 13 +++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
--
2.31.1
next reply other threads:[~2021-06-16 7:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 7:17 Juri Lelli [this message]
2021-06-16 7:17 ` [RFC PATCH RT v2 1/2] time/hrtimer: Add PINNED_HARD mode for realtime hrtimers Juri Lelli
2021-06-18 23:35 ` Thomas Gleixner
2021-06-19 7:56 ` Thomas Gleixner
2021-06-21 5:35 ` Juri Lelli
2021-06-16 7:17 ` [RFC PATCH RT v2 2/2] time/hrtimer: Embed hrtimer mode into hrtimer_sleeper Juri Lelli
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=20210616071705.166658-1-juri.lelli@redhat.com \
--to=juri.lelli@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=bristot@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--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
all inboxes | Powered by JetHome®