Skip to contentSkip to conversation

debugobjects: Make them PREEMPT_RT aware

PATCH Applied Thomas Gleixner 3 participants 3 messages Aug 12, 2021 – Aug 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

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

---

lib/debugobjects.c +6 -1
@@ -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);
 
#2 lore raw
In reply to Thomas Gleixner
The following commit has been merged into the core/debugobjects branch of tip:

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 <[email protected]>
AuthorDate:    Thu, 12 Aug 2021 17:43:26 +02:00
Committer:     Thomas Gleixner <[email protected]>
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.

---
 lib/debugobjects.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
lib/debugobjects.c +6 -1
index 9e14ae0..6946f8e 100644
@@ -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);