[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C38AE46.2090803@us.ibm.com>
Date: Sat, 10 Jul 2010 10:30:46 -0700
From: Darren Hart <dvhltc@...ibm.com>
To: rostedt@...dmis.org
CC: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
Eric Dumazet <eric.dumazet@...il.com>,
John Kacur <jkacur@...hat.com>, Mike Galbraith <efault@....de>,
linux-rt-users@...r.kernel.org
Subject: Re: [PATCH 2/4 V2] rtmutex: add BUG_ON if a task attempts to block
on two locks
On 07/09/2010 05:30 PM, Steven Rostedt wrote:
> On Fri, 2010-07-09 at 15:32 -0700, Darren Hart wrote:
>> rtmutex proxy locking complicates the logic a bit and opens up
>> the possibility for a task to wake and attempt to take another
>> sleeping lock without knowing it has been enqueued on another
>> lock already. Add a BUG_ON to catch this scenario early.
>>
>> Signed-off-by: Darren Hart<dvhltc@...ibm.com>
>> Cc: Thomas Gleixner<tglx@...utronix.de>
>> Cc: Peter Zijlstra<peterz@...radead.org>
>> Cc: Ingo Molnar<mingo@...e.hu>
>> Cc: Eric Dumazet<eric.dumazet@...il.com>
>> Cc: John Kacur<jkacur@...hat.com>
>> Cc: Steven Rostedt<rostedt@...dmis.org>
>> Cc: Mike Galbraith<efault@....de>
>> ---
>> kernel/rtmutex.c | 3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
>> index baac7d9..22f9d18 100644
>> --- a/kernel/rtmutex.c
>> +++ b/kernel/rtmutex.c
>> @@ -459,6 +459,9 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
>> top_waiter = rt_mutex_top_waiter(lock);
>> plist_add(&waiter->list_entry,&lock->wait_list);
>>
>> + /* Tasks can only block on one lock at a time. */
>> + BUG_ON(task->pi_blocked_on != NULL);
>
> WARN_ON may be better. Since it may not cause a system crash or other
> huge bug if it is not true.
>
No objection.
>From 31c7b6c5657bcc897ddc79d7f9bb1942eb4c854a Mon Sep 17 00:00:00 2001
From: Darren Hart <dvhltc@...ibm.com>
Date: Fri, 9 Jul 2010 17:46:05 -0400
Subject: [PATCH 2/4] rtmutex: add WARN_ON if a task attempts to block on two locks
rtmutex proxy locking complicates the logic a bit and opens up
the possibility for a task to wake and attempt to take another
sleeping lock without knowing it has been enqueued on another
lock already. Add a WARN_ON to catch this scenario early.
V2: use a WARN_ON instead of a BUG_ON per Steven's request.
Signed-off-by: Darren Hart <dvhltc@...ibm.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Eric Dumazet <eric.dumazet@...il.com>
Cc: John Kacur <jkacur@...hat.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Mike Galbraith <efault@....de>
---
kernel/rtmutex.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index baac7d9..5262d0f 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -459,6 +459,9 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
top_waiter = rt_mutex_top_waiter(lock);
plist_add(&waiter->list_entry, &lock->wait_list);
+ /* Tasks can only block on one lock at a time. */
+ WARN_ON(task->pi_blocked_on != NULL);
+
task->pi_blocked_on = waiter;
raw_spin_unlock(&task->pi_lock);
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists