linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* debugobjects: Make them PREEMPT_RT aware
@ 2021-08-12 15:43 Thomas Gleixner
  2021-08-12 15:45 ` Sebastian Andrzej Siewior
  2021-08-13  8:12 ` [tip: core/debugobjects] " tip-bot2 for Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Gleixner @ 2021-08-12 15:43 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Sebastian Andrzej Siewior, Ingo Molnar

On PREEMPT_RT enabled kernels it is not possible to refill the object pool
from atomic context (preemption or interrupts disabled) as the allocator
might acquire 'sleeping' spinlocks.

Guard the invocation of fill_pool() accordingly.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 lib/debugobjects.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -557,7 +557,12 @@ static void
 	struct debug_obj *obj;
 	unsigned long flags;
 
-	fill_pool();
+	/*
+	 * On RT enabled kernels the pool refill must happen in preemptible
+	 * context:
+	 */
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
+		fill_pool();
 
 	db = get_bucket((unsigned long) addr);
 

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

* Re: debugobjects: Make them PREEMPT_RT aware
  2021-08-12 15:43 debugobjects: Make them PREEMPT_RT aware Thomas Gleixner
@ 2021-08-12 15:45 ` Sebastian Andrzej Siewior
  2021-08-13  8:12 ` [tip: core/debugobjects] " tip-bot2 for Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-12 15:45 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Peter Zijlstra, Ingo Molnar

On 2021-08-12 17:43:26 [+0200], Thomas Gleixner wrote:
> On PREEMPT_RT enabled kernels it is not possible to refill the object pool
> from atomic context (preemption or interrupts disabled) as the allocator
> might acquire 'sleeping' spinlocks.
> 
> Guard the invocation of fill_pool() accordingly.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Sebastian

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

* [tip: core/debugobjects] debugobjects: Make them PREEMPT_RT aware
  2021-08-12 15:43 debugobjects: Make them PREEMPT_RT aware Thomas Gleixner
  2021-08-12 15:45 ` Sebastian Andrzej Siewior
@ 2021-08-13  8:12 ` tip-bot2 for Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Thomas Gleixner @ 2021-08-13  8:12 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Thomas Gleixner, Sebastian Andrzej Siewior, x86, linux-kernel

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

Commit-ID:     4bedcc28469a24fe481a8a31b3584e6070457ddb
Gitweb:        https://git.kernel.org/tip/4bedcc28469a24fe481a8a31b3584e6070457ddb
Author:        Thomas Gleixner <tglx@linutronix.de>
AuthorDate:    Thu, 12 Aug 2021 17:43:26 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 13 Aug 2021 10:07:44 +02:00

debugobjects: Make them PREEMPT_RT aware

On PREEMPT_RT enabled kernels it is not possible to refill the object pool
from atomic context (preemption or interrupts disabled) as the allocator
might acquire 'sleeping' spinlocks.

Guard the invocation of fill_pool() accordingly.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/87sfzehdnl.ffs@tglx

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

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index 9e14ae0..6946f8e 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -557,7 +557,12 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack
 	struct debug_obj *obj;
 	unsigned long flags;
 
-	fill_pool();
+	/*
+	 * On RT enabled kernels the pool refill must happen in preemptible
+	 * context:
+	 */
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
+		fill_pool();
 
 	db = get_bucket((unsigned long) addr);
 

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

end of thread, other threads:[~2021-08-13  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 15:43 debugobjects: Make them PREEMPT_RT aware Thomas Gleixner
2021-08-12 15:45 ` Sebastian Andrzej Siewior
2021-08-13  8:12 ` [tip: core/debugobjects] " tip-bot2 for Thomas Gleixner

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).