From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Maarten Lankhorst <maarten.lankhorst@canonical.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 3/3] locking: rtmutex: set state back to running on error
Date: Fri, 27 Feb 2015 17:57:09 +0100
Message-ID: <1425056229-22326-4-git-send-email-bigeasy@linutronix.de> (raw)
In-Reply-To: <1425056229-22326-1-git-send-email-bigeasy@linutronix.de>
The "usual" path is:
- rt_mutex_slowlock()
- set_current_state()
- task_blocks_on_rt_mutex() (ret 0)
- __rt_mutex_slowlock()
- sleep or not but do return with __set_current_state(TASK_RUNNING)
- back to caller.
In the early error case where task_blocks_on_rt_mutex() return -EDEADLK
we never change the task's state back to RUNNING. I assume this is
intended. Without this change after ww_mutex using rt_mutex the selftest
passes but later I get plenty of
| bad: scheduling from the idle thread!
backtraces.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/locking/rtmutex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 6d7d72ffa619..c4d07f254bb4 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1305,6 +1305,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
}
if (unlikely(ret)) {
+ set_current_state(TASK_RUNNING);
if (rt_mutex_has_waiters(lock))
remove_waiter(lock, &waiter);
/* ww_mutex need the error reported */
--
2.1.4
next prev parent reply index
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 16:57 rt_mutex based ww_mutex implementation Sebastian Andrzej Siewior
2015-02-27 16:57 ` [PATCH 1/3] locking: ww_mutex: add one level of indirection for access of the lock Sebastian Andrzej Siewior
2015-02-27 18:20 ` Maarten Lankhorst
2015-02-27 18:57 ` Sebastian Andrzej Siewior
2015-02-27 16:57 ` [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock Sebastian Andrzej Siewior
2015-03-02 3:20 ` Mike Galbraith
2015-03-02 8:46 ` Maarten Lankhorst
2015-03-02 12:50 ` Mike Galbraith
2015-03-06 12:14 ` Sebastian Andrzej Siewior
2015-03-06 12:16 ` Maarten Lankhorst
2015-03-06 12:36 ` Sebastian Andrzej Siewior
2015-03-06 17:50 ` Mike Galbraith
2015-03-09 10:00 ` Sebastian Andrzej Siewior
2015-03-09 10:51 ` Mike Galbraith
2015-03-09 11:07 ` Sebastian Andrzej Siewior
2015-03-09 11:29 ` Mike Galbraith
2015-03-09 13:21 ` Sebastian Andrzej Siewior
2015-03-09 22:27 ` Paul E. McKenney
2015-03-10 12:30 ` Peter Zijlstra
2015-03-10 12:37 ` Peter Zijlstra
2015-03-10 12:39 ` Peter Zijlstra
2015-03-10 14:10 ` Maarten Lankhorst
2015-03-10 15:28 ` Peter Zijlstra
2015-03-10 18:21 ` Maarten Lankhorst
2015-03-10 12:43 ` Peter Zijlstra
2015-03-10 12:46 ` Peter Zijlstra
2015-02-27 16:57 ` Sebastian Andrzej Siewior [this message]
2015-02-28 10:00 ` [tip:locking/urgent] locking/rtmutex: Set state back to running on error tip-bot for Sebastian Andrzej Siewior
2015-03-01 5:35 ` [PATCH 3/3] locking: rtmutex: set " Mike Galbraith
2015-03-01 8:48 ` [tip:locking/urgent] locking/rtmutex: Set " tip-bot for Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425056229-22326-4-git-send-email-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@canonical.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org
Archives are clonable:
git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
linux-kernel@vger.kernel.org
public-inbox-index lkml
Example config snippet for mirrors
Newsgroup available over NNTP:
nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git