[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200831224911.GA13114@paulmck-ThinkPad-P72>
Date: Mon, 31 Aug 2020 15:49:11 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: peterz@...radead.org, mingo@...hat.com, will@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: Question on task_blocks_on_rt_mutex()
Hello!
The task_blocks_on_rt_mutex() function uses rt_mutex_owner() to
take a snapshot of the lock owner right up front. At this point,
the ->wait_lock is held, which at first glance prevents the owner
from leaving. Except that if there are not yet any waiters (that is,
the low-order bit of ->owner is zero), rt_mutex_fastunlock() might
locklessly clear the ->owner field. And in that case, it looks like
task_blocks_on_rt_mutex() will blithely continue using the ex-owner's
task_struct structure, without anything that I can see that prevents
the ex-owner from exiting.
What am I missing here?
The reason that I am looking into this is that locktorture scenario LOCK05
hangs, and does so leaving the torture_rtmutex.waiters field equal to 0x1.
This is of course a legal transitional state, but I would not expect it
to persist for more than three minutes. Yet it often does.
This leads me to believe that there is a way for an unlock to fail to wake
up a task concurrently acquiring the lock. This seems to be repaired
by later lock acquisitions, and in fact setting the locktorture.stutter
module parameter to zero avoids the hang. Except that I first found the
above apparently unprotected access to what was recently the owner task.
Thoughts?
Thanx, Paul
Powered by blists - more mailing lists