All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] posix-timers: Clarify timer_wait_running() comment
Date: Sun, 18 Jun 2023 20:50:07 -0000	[thread overview]
Message-ID: <168712140796.404.15897229283135813033.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20230425183312.985681995@linutronix.de>

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     7d9909026645064cd31b20cee5939a0f72282261
Gitweb:        https://git.kernel.org/tip/7d9909026645064cd31b20cee5939a0f72282261
Author:        Thomas Gleixner <tglx@linutronix.de>
AuthorDate:    Tue, 25 Apr 2023 20:49:00 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sun, 18 Jun 2023 22:41:48 +02:00

posix-timers: Clarify timer_wait_running() comment

Explain it better and add the CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y aspect
for completeness.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20230425183312.985681995@linutronix.de

---
 kernel/time/posix-timers.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 2d6cf93..0c61f29 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -836,10 +836,18 @@ static void common_timer_wait_running(struct k_itimer *timer)
 }
 
 /*
- * On PREEMPT_RT this prevent priority inversion against softirq kthread in
- * case it gets preempted while executing a timer callback. See comments in
- * hrtimer_cancel_wait_running. For PREEMPT_RT=n this just results in a
- * cpu_relax().
+ * On PREEMPT_RT this prevents priority inversion and a potential livelock
+ * against the ksoftirqd thread in case that ksoftirqd gets preempted while
+ * executing a hrtimer callback.
+ *
+ * See the comments in hrtimer_cancel_wait_running(). For PREEMPT_RT=n this
+ * just results in a cpu_relax().
+ *
+ * For POSIX CPU timers with CONFIG_POSIX_CPU_TIMERS_TASK_WORK=n this is
+ * just a cpu_relax(). With CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y this
+ * prevents spinning on an eventually scheduled out task and a livelock
+ * when the task which tries to delete or disarm the timer has preempted
+ * the task which runs the expiry in task work context.
  */
 static struct k_itimer *timer_wait_running(struct k_itimer *timer,
 					   unsigned long *flags)

  parent reply	other threads:[~2023-06-18 20:51 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 18:48 [patch 00/20] posix-timers: Fixes and cleanups Thomas Gleixner
2023-04-25 18:48 ` [patch 01/20] posix-timers: Prevent RT livelock in itimer_delete() Thomas Gleixner
2023-05-04 17:06   ` Frederic Weisbecker
2023-05-04 18:20     ` Thomas Gleixner
2023-05-05  7:57       ` Thomas Gleixner
2023-06-01 19:00         ` [patch v2 " Thomas Gleixner
2023-06-01 20:16           ` [patch v2a " Thomas Gleixner
2023-06-05 10:59             ` Frederic Weisbecker
2023-06-05 15:08             ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50             ` tip-bot2 for Thomas Gleixner
2023-04-25 18:48 ` [patch 02/20] posix-timers: Ensure timer ID search-loop limit is valid Thomas Gleixner
2023-05-05 14:50   ` Frederic Weisbecker
2023-05-05 22:58     ` Thomas Gleixner
2023-05-05 23:36       ` Thomas Gleixner
2023-05-08 21:57         ` Thomas Gleixner
2023-05-09  9:30           ` Thomas Gleixner
2023-05-09 12:50             ` Thomas Gleixner
2023-05-09 21:42               ` [RFD] posix-timers: CRIU woes Thomas Gleixner
2023-05-10  4:36                 ` Pavel Tikhomirov
2023-05-10  8:30                   ` Thomas Gleixner
2023-05-11  4:12                     ` Pavel Tikhomirov
2023-05-11  7:56                       ` Peter Zijlstra
2023-05-11  9:32                       ` Thomas Gleixner
2023-05-11 10:13                   ` David Laight
2023-05-10  8:16                 ` Andrey Vagin
2023-05-11  3:17                   ` Pavel Tikhomirov
2023-05-11  9:36                     ` Thomas Gleixner
2023-05-11  9:52                       ` Pavel Tikhomirov
2023-05-11 13:42                         ` Thomas Gleixner
2023-05-11 14:54                           ` Pavel Tikhomirov
2023-05-11 15:25                           ` Pavel Tikhomirov
2023-05-12  1:21                       ` Andrey Vagin
2023-05-31 17:38                         ` Thomas Gleixner
2023-05-11  7:49                   ` Cyrill Gorcunov
2023-05-10  0:42               ` [patch 02/20] posix-timers: Ensure timer ID search-loop limit is valid Andrey Vagin
2023-05-09  9:42         ` Frederic Weisbecker
2023-05-09 12:04           ` Thomas Gleixner
2023-05-09 12:38           ` Thomas Gleixner
2023-05-09 14:18             ` Frederic Weisbecker
2023-06-01 18:58               ` [patch v2 " Thomas Gleixner
2023-06-05 14:17                 ` Frederic Weisbecker
2023-06-05 15:08                 ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50                 ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 03/20] posix-timers: Clarify timer_wait_running() comment Thomas Gleixner
2023-05-09  9:50   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner [this message]
2023-04-25 18:49 ` [patch 04/20] posix-timers: Cleanup comments about timer ID tracking Thomas Gleixner
2023-05-09  9:58   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 05/20] posix-timers: Add comments about timer lookup Thomas Gleixner
2023-05-09 10:58   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 06/20] posix-timers: Annotate concurrent access to k_itimer::it_signal Thomas Gleixner
2023-05-09 11:04   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] posix-timers: Annotate concurrent access to k_itimer:: It_signal tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 07/20] posix-timers: Set k_itimer::it_signal to NULL on exit() Thomas Gleixner
2023-06-01 10:09   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] posix-timers: Set k_itimer:: It_signal " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 08/20] posix-timers: Remove pointless irqsafe from hash_lock Thomas Gleixner
2023-06-01 10:12   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 09/20] posix-timers: Split release_posix_timers() Thomas Gleixner
2023-06-01 10:25   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 10/20] posix-timers: Document sys_clock_getres() correctly Thomas Gleixner
2023-06-01 10:44   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 11/20] posix-timers: Document common_clock_get() correctly Thomas Gleixner
2023-06-01 11:00   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 12/20] posix-timers: Document sys_clock_getoverrun() Thomas Gleixner
2023-06-01 11:06   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 13/20] posix-timers: Document sys_clock_settime() permissions in place Thomas Gleixner
2023-06-01 11:22   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:50   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 14/20] posix-timers: Document nanosleep() details Thomas Gleixner
2023-06-01 12:30   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:49   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 15/20] posix-timers: Add proper comments in do_timer_create() Thomas Gleixner
2023-06-01 12:43   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:49   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 16/20] posix-timers: Comment SIGEV_THREAD_ID properly Thomas Gleixner
2023-06-01 12:47   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:49   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 17/20] posix-timers: Clarify posix_timer_rearm() comment Thomas Gleixner
2023-06-01 12:52   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-18 20:49   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 18/20] posix-timers: Clarify posix_timer_fn() comments Thomas Gleixner
2023-06-01 13:21   ` Frederic Weisbecker
2023-06-01 18:43     ` Thomas Gleixner
2023-06-01 19:07     ` Thomas Gleixner
2023-06-05 14:26       ` Frederic Weisbecker
2023-06-05 15:08       ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-05 22:17       ` tip-bot2 for Thomas Gleixner
2023-06-18 20:49       ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 19/20] posix-timers: Remove pointless comments Thomas Gleixner
2023-06-01 13:48   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-05 22:17   ` tip-bot2 for Thomas Gleixner
2023-06-18 20:49   ` tip-bot2 for Thomas Gleixner
2023-04-25 18:49 ` [patch 20/20] posix-timers: Polish coding style in a few places Thomas Gleixner
2023-06-01 13:50   ` Frederic Weisbecker
2023-06-05 15:08   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2023-06-05 22:17   ` tip-bot2 for Thomas Gleixner
2023-06-18 20:49   ` tip-bot2 for Thomas Gleixner
2023-06-05 14:32 ` [patch 00/20] posix-timers: Fixes and cleanups Frederic Weisbecker

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=168712140796.404.15897229283135813033.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.