Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hrtimers: Add missing hrtimer_init() trace points

hrtimer_init*_on_stack() is not covered by tracing when
CONFIG_DEBUG_OBJECTS_TIMERS=y.

Rework the functions similar to hrtimer_init() and hrtimer_init_sleeper()
so that the hrtimer_init() tracepoint is unconditionally available.

The rework makes hrtimer_init_sleeper() unused. Delete it.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/74528e8abf2bb96e8bee85ffacbf14e15cf89f0d.1730386209.git.namcao@linutronix.de

authored by

Nam Cao and committed by
Thomas Gleixner
fbf920f2 2634303f

+37 -47
+1 -18
include/linux/hrtimer.h
··· 228 228 /* Initialize timers: */ 229 229 extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock, 230 230 enum hrtimer_mode mode); 231 - extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, clockid_t clock_id, 232 - enum hrtimer_mode mode); 233 - 234 - #ifdef CONFIG_DEBUG_OBJECTS_TIMERS 235 231 extern void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t which_clock, 236 232 enum hrtimer_mode mode); 237 233 extern void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, 238 234 clockid_t clock_id, 239 235 enum hrtimer_mode mode); 240 236 237 + #ifdef CONFIG_DEBUG_OBJECTS_TIMERS 241 238 extern void destroy_hrtimer_on_stack(struct hrtimer *timer); 242 239 #else 243 - static inline void hrtimer_init_on_stack(struct hrtimer *timer, 244 - clockid_t which_clock, 245 - enum hrtimer_mode mode) 246 - { 247 - hrtimer_init(timer, which_clock, mode); 248 - } 249 - 250 - static inline void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, 251 - clockid_t clock_id, 252 - enum hrtimer_mode mode) 253 - { 254 - hrtimer_init_sleeper(sl, clock_id, mode); 255 - } 256 - 257 240 static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } 258 241 #endif 259 242
+36 -29
kernel/time/hrtimer.c
··· 417 417 debug_object_init(timer, &hrtimer_debug_descr); 418 418 } 419 419 420 + static inline void debug_hrtimer_init_on_stack(struct hrtimer *timer) 421 + { 422 + debug_object_init_on_stack(timer, &hrtimer_debug_descr); 423 + } 424 + 420 425 static inline void debug_hrtimer_activate(struct hrtimer *timer, 421 426 enum hrtimer_mode mode) 422 427 { ··· 433 428 debug_object_deactivate(timer, &hrtimer_debug_descr); 434 429 } 435 430 436 - static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, 437 - enum hrtimer_mode mode); 438 - 439 - void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, 440 - enum hrtimer_mode mode) 441 - { 442 - debug_object_init_on_stack(timer, &hrtimer_debug_descr); 443 - __hrtimer_init(timer, clock_id, mode); 444 - } 445 - EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); 446 - 447 - static void __hrtimer_init_sleeper(struct hrtimer_sleeper *sl, 448 - clockid_t clock_id, enum hrtimer_mode mode); 449 - 450 - void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, 451 - clockid_t clock_id, enum hrtimer_mode mode) 452 - { 453 - debug_object_init_on_stack(&sl->timer, &hrtimer_debug_descr); 454 - __hrtimer_init_sleeper(sl, clock_id, mode); 455 - } 456 - EXPORT_SYMBOL_GPL(hrtimer_init_sleeper_on_stack); 457 - 458 431 void destroy_hrtimer_on_stack(struct hrtimer *timer) 459 432 { 460 433 debug_object_free(timer, &hrtimer_debug_descr); ··· 442 459 #else 443 460 444 461 static inline void debug_hrtimer_init(struct hrtimer *timer) { } 462 + static inline void debug_hrtimer_init_on_stack(struct hrtimer *timer) { } 445 463 static inline void debug_hrtimer_activate(struct hrtimer *timer, 446 464 enum hrtimer_mode mode) { } 447 465 static inline void debug_hrtimer_deactivate(struct hrtimer *timer) { } ··· 453 469 enum hrtimer_mode mode) 454 470 { 455 471 debug_hrtimer_init(timer); 472 + trace_hrtimer_init(timer, clockid, mode); 473 + } 474 + 475 + static inline void debug_init_on_stack(struct hrtimer *timer, clockid_t clockid, 476 + enum hrtimer_mode mode) 477 + { 478 + debug_hrtimer_init_on_stack(timer); 456 479 trace_hrtimer_init(timer, clockid, mode); 457 480 } 458 481 ··· 1591 1600 } 1592 1601 EXPORT_SYMBOL_GPL(hrtimer_init); 1593 1602 1603 + /** 1604 + * hrtimer_init_on_stack - initialize a timer in stack memory 1605 + * @timer: The timer to be initialized 1606 + * @clock_id: The clock to be used 1607 + * @mode: The timer mode 1608 + * 1609 + * Similar to hrtimer_init(), except that this one must be used if struct hrtimer is in stack 1610 + * memory. 1611 + */ 1612 + void hrtimer_init_on_stack(struct hrtimer *timer, clockid_t clock_id, 1613 + enum hrtimer_mode mode) 1614 + { 1615 + debug_init_on_stack(timer, clock_id, mode); 1616 + __hrtimer_init(timer, clock_id, mode); 1617 + } 1618 + EXPORT_SYMBOL_GPL(hrtimer_init_on_stack); 1619 + 1594 1620 /* 1595 1621 * A timer is active, when it is enqueued into the rbtree or the 1596 1622 * callback function is running or it's in the state of being migrated ··· 1952 1944 * Make the enqueue delivery mode check work on RT. If the sleeper 1953 1945 * was initialized for hard interrupt delivery, force the mode bit. 1954 1946 * This is a special case for hrtimer_sleepers because 1955 - * hrtimer_init_sleeper() determines the delivery mode on RT so the 1947 + * __hrtimer_init_sleeper() determines the delivery mode on RT so the 1956 1948 * fiddling with this decision is avoided at the call sites. 1957 1949 */ 1958 1950 if (IS_ENABLED(CONFIG_PREEMPT_RT) && sl->timer.is_hard) ··· 1995 1987 } 1996 1988 1997 1989 /** 1998 - * hrtimer_init_sleeper - initialize sleeper to the given clock 1990 + * hrtimer_init_sleeper_on_stack - initialize a sleeper in stack memory 1999 1991 * @sl: sleeper to be initialized 2000 1992 * @clock_id: the clock to be used 2001 1993 * @mode: timer mode abs/rel 2002 1994 */ 2003 - void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, clockid_t clock_id, 2004 - enum hrtimer_mode mode) 1995 + void hrtimer_init_sleeper_on_stack(struct hrtimer_sleeper *sl, 1996 + clockid_t clock_id, enum hrtimer_mode mode) 2005 1997 { 2006 - debug_init(&sl->timer, clock_id, mode); 1998 + debug_init_on_stack(&sl->timer, clock_id, mode); 2007 1999 __hrtimer_init_sleeper(sl, clock_id, mode); 2008 - 2009 2000 } 2010 - EXPORT_SYMBOL_GPL(hrtimer_init_sleeper); 2001 + EXPORT_SYMBOL_GPL(hrtimer_init_sleeper_on_stack); 2011 2002 2012 2003 int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts) 2013 2004 {