linux-rt-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] debugobjects: RT related change and noch annotation
@ 2025-11-27 15:36 Sebastian Andrzej Siewior
  2025-11-27 15:36 ` [PATCH 1/2] debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING Sebastian Andrzej Siewior
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-11-27 15:36 UTC (permalink / raw)
  To: linux-kernel, linux-rt-devel; +Cc: Thomas Gleixner, Sebastian Andrzej Siewior

The first is a repost of
	https://lore.kernel.org/all/20251106120628.AxWa_Viy@linutronix.de/

the second is a fix of the override annotation.

Sebastian Andrzej Siewior (2):
  debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING
  debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP

 lib/debugobjects.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.51.0


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

* [PATCH 1/2] debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING
  2025-11-27 15:36 [PATCH 0/2] debugobjects: RT related change and noch annotation Sebastian Andrzej Siewior
@ 2025-11-27 15:36 ` Sebastian Andrzej Siewior
  2025-11-27 15:36 ` [PATCH 2/2] debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP Sebastian Andrzej Siewior
  2025-11-28 13:21 ` [PATCH 0/2] debugobjects: RT related change and noch annotation Luis Claudio R. Goncalves
  2 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-11-27 15:36 UTC (permalink / raw)
  To: linux-kernel, linux-rt-devel; +Cc: Thomas Gleixner, Sebastian Andrzej Siewior

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>
---
 lib/debugobjects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 7f50c4480a4e3..7017e5c8f32dd 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -714,7 +714,7 @@ static void debug_objects_fill_pool(void)
 	 * raw_spinlock_t are basically the same type and this lock-type
 	 * inversion works just fine.
 	 */
-	if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) {
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible() || system_state < SYSTEM_SCHEDULING) {
 		/*
 		 * Annotate away the spinlock_t inside raw_spinlock_t warning
 		 * by temporarily raising the wait-type to WAIT_SLEEP, matching
-- 
2.51.0


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

* [PATCH 2/2] debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP
  2025-11-27 15:36 [PATCH 0/2] debugobjects: RT related change and noch annotation Sebastian Andrzej Siewior
  2025-11-27 15:36 ` [PATCH 1/2] debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING Sebastian Andrzej Siewior
@ 2025-11-27 15:36 ` Sebastian Andrzej Siewior
  2025-11-28 13:21 ` [PATCH 0/2] debugobjects: RT related change and noch annotation Luis Claudio R. Goncalves
  2 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-11-27 15:36 UTC (permalink / raw)
  To: linux-kernel, linux-rt-devel; +Cc: Thomas Gleixner, Sebastian Andrzej Siewior

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>
---
 lib/debugobjects.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 7017e5c8f32dd..ecf8e7f978e30 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -717,10 +717,10 @@ static void debug_objects_fill_pool(void)
 	if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible() || system_state < SYSTEM_SCHEDULING) {
 		/*
 		 * Annotate away the spinlock_t inside raw_spinlock_t warning
-		 * by temporarily raising the wait-type to WAIT_SLEEP, matching
+		 * by temporarily raising the wait-type to LD_WAIT_CONFIG, matching
 		 * the preemptible() condition above.
 		 */
-		static DEFINE_WAIT_OVERRIDE_MAP(fill_pool_map, LD_WAIT_SLEEP);
+		static DEFINE_WAIT_OVERRIDE_MAP(fill_pool_map, LD_WAIT_CONFIG);
 		lock_map_acquire_try(&fill_pool_map);
 		fill_pool();
 		lock_map_release(&fill_pool_map);
-- 
2.51.0


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

* Re: [PATCH 0/2] debugobjects: RT related change and noch annotation
  2025-11-27 15:36 [PATCH 0/2] debugobjects: RT related change and noch annotation Sebastian Andrzej Siewior
  2025-11-27 15:36 ` [PATCH 1/2] debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING Sebastian Andrzej Siewior
  2025-11-27 15:36 ` [PATCH 2/2] debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP Sebastian Andrzej Siewior
@ 2025-11-28 13:21 ` Luis Claudio R. Goncalves
  2 siblings, 0 replies; 4+ messages in thread
From: Luis Claudio R. Goncalves @ 2025-11-28 13:21 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-kernel, linux-rt-devel, Thomas Gleixner

On Thu, Nov 27, 2025 at 04:36:50PM +0100, Sebastian Andrzej Siewior wrote:
> The first is a repost of
> 	https://lore.kernel.org/all/20251106120628.AxWa_Viy@linutronix.de/
> 
> the second is a fix of the override annotation.
> 
> Sebastian Andrzej Siewior (2):
>   debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING
>   debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP

To the series:

Reviewed-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>

Luis
 
>  lib/debugobjects.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> -- 
> 2.51.0
> 
> 
---end quoted text---


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

end of thread, other threads:[~2025-11-28 13:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27 15:36 [PATCH 0/2] debugobjects: RT related change and noch annotation Sebastian Andrzej Siewior
2025-11-27 15:36 ` [PATCH 1/2] debugobjects: Allow to refill the pool before SYSTEM_SCHEDULING Sebastian Andrzej Siewior
2025-11-27 15:36 ` [PATCH 2/2] debugobjects: Use LD_WAIT_CONFIG instead of LD_WAIT_SLEEP Sebastian Andrzej Siewior
2025-11-28 13:21 ` [PATCH 0/2] debugobjects: RT related change and noch annotation Luis Claudio R. Goncalves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).