Skip to content

Commit 7931cb3

Browse files
Sebastian Andrzej Siewioraosemp
authored andcommitted
6.19: debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING
The pool of free objects is refilled on several occasions such as object initialisation. On PREEMPT_RT refilling is limited to preemptible sections due to sleeping locks used by the memory allocator. The system boots with disabled interrupts so the pool can not be refilled. If too many objects are initialized and the pool gets empty then debugobjects disables itself. Refiling can also happen early in the boot with disabled interrupts as long as the scheduler is not operational. If the scheduler can not preempt a task then a sleeping lock can not be contended. Allow to additionally refill the pool if the scheduler is not operational. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/20251127153652.291697-2-bigeasy@linutronix.de debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP fill_pool_map is used to suppress nesting violations caused by acquiring a spinlock_t (from within the memory allocator) while holding a raw_spinlock_t. The used annotation is wrong. LD_WAIT_SLEEP is for always sleeping lock types such as mutex_t. LD_WAIT_CONFIG is for lock type which are sleeping while spinning on PREEMPT_RT such as spinlock_t. Use LD_WAIT_CONFIG as override. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/20251127153652.291697-3-bigeasy@linutronix.de
1 parent ddd07e8 commit 7931cb3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/debugobjects.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,13 +714,13 @@ static void debug_objects_fill_pool(void)
714714
* raw_spinlock_t are basically the same type and this lock-type
715715
* inversion works just fine.
716716
*/
717-
if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) {
717+
if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible() || system_state < SYSTEM_SCHEDULING) {
718718
/*
719719
* Annotate away the spinlock_t inside raw_spinlock_t warning
720-
* by temporarily raising the wait-type to WAIT_SLEEP, matching
720+
* by temporarily raising the wait-type to LD_WAIT_CONFIG, matching
721721
* the preemptible() condition above.
722722
*/
723-
static DEFINE_WAIT_OVERRIDE_MAP(fill_pool_map, LD_WAIT_SLEEP);
723+
static DEFINE_WAIT_OVERRIDE_MAP(fill_pool_map, LD_WAIT_CONFIG);
724724
lock_map_acquire_try(&fill_pool_map);
725725
fill_pool();
726726
lock_map_release(&fill_pool_map);

0 commit comments

Comments
 (0)