Red Hat Bugzilla – Bug 311391
with DEBUG_PI_LIST a constantly prints out to console on futex
Last modified: 2008-02-27 14:57:03 EST
Description of problem:
When DEBUG_PI_LIST is enabled, we get a large amount of warnings with
BUG: at lib/plist.c:60 plist_check_head()
| preempt count: 00000000 ]
| 0-level deep critical section nesting:
Looking at plist.c:60
head is a pointer to the plist head.
The cause of this is that the futex code uses plist for the hash queues.
Each hash queue has its own lock to manipulate it. Instead of using the
plist lock, it locks the hash lock instead. To prevent this from triggering
these outputs, the futex code assigns plist->lock = hash->lock. So the test
to see if the lock is held succeeds.
The problem in PREEMPT_RT is that the hash lock is a spinlock that is converted
to a mutex where as the plist lock stays as a spinlock (raw lock). The reason
for this is that the plist is also used for the internals of the mutex code.
Now when this switch happens, the debugging test of spin_is_locked(head->lock)
fails since its testing a mutex instead of a spinlock.
Note: when this is configured, there is indeed a warning of assigning
incompatible types when plist->lock = hash->lock.
We'll need to determine what the proper fix for this is.
First reaction: Shouldn't we use TYPE_OF tricks on spin_is_locked to apply the
right test for being locked?
First reply: No, because the code is not a macro, but a function. This means
that the TYPE_OF would always return the same.
The reall bug is that we are pointing a raw_spinlock_t pointer at a spin_lock_t
Patch submitted to linux-rt-users:
Created attachment 234971 [details]
DEBUG_PI_LIST RT fix
Created attachment 274001 [details]
updated patch to fix futex DEBUG_PI printk storm on debug -rt kernel
New patch from rostedt