mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hrtimer: Add cleanup class for on-stack timers
@ 2026-10-16  1:09 Hui Su
  2026-10-16  1:09 ` [PATCH v2 1/2] " Hui Su
  2026-10-16  1:09 ` [PATCH v2 2/2] sched/idle: Use hrtimer cleanup class in play_idle_precise() Hui Su
  0 siblings, 2 replies; 3+ messages in thread
From: Hui Su @ 2026-10-16  1:09 UTC (permalink / raw)
  To: anna-maria, frederic, tglx, mingo, peterz, juri.lelli, vincent.guittot
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
	kprateek.nayak, rafael.j.wysocki, jacob.jun.pan, linux-kernel,
	Hui Su

Add an opt-in cleanup class that pairs hrtimer_setup_on_stack() with
destroy_hrtimer_on_stack(), and convert play_idle_precise() to use it.

The class provides debug-object teardown, not timer cancellation. The
converted caller limits the cleanup object's lifetime to the block covering
timer start and the idle wait, which ends only after the pinned hard hrtimer
callback has completed.

Testing:
- x86_64 QEMU with CONFIG_DEBUG_OBJECTS_TIMERS=y: baseline setup=301,
  play_idle_precise return=301, free=0; the patched kernel recorded
  setup=301, play_idle_precise return=301, free=301 for the same timer
  address, with no ODEBUG warning.
- x86_64 GCC 15.2.0: the series built bzImage/modules, and
  kernel/sched/idle.o also built with CONFIG_DEBUG_OBJECTS_TIMERS=n.

Changes in v2:
- Add an hrtimer_on_stack cleanup class following Peter's suggestion to use
  __cleanup() for the setup/destroy pairing.
- Document the hrtimer_setup_on_stack() lifetime requirements.
- Convert play_idle_precise() using CLASS() in an explicit block and explain
  the callback ordering.

v1: https://lore.kernel.org/lkml/20261015025029.3356060-1-sh_def@163.com/

Hui Su (2):
  hrtimer: Add cleanup class for on-stack timers
  sched/idle: Use hrtimer cleanup class in play_idle_precise()

 include/linux/hrtimer.h | 24 ++++++++++++++++++++++++
 kernel/sched/idle.c     | 16 ++++++++++------
 kernel/time/hrtimer.c   |  8 ++++++--
 3 files changed, 40 insertions(+), 8 deletions(-)


base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-16  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16  1:09 [PATCH v2 0/2] hrtimer: Add cleanup class for on-stack timers Hui Su
2026-10-16  1:09 ` [PATCH v2 1/2] " Hui Su
2026-10-16  1:09 ` [PATCH v2 2/2] sched/idle: Use hrtimer cleanup class in play_idle_precise() Hui Su

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®