mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: bigeasy@linutronix.de, hpa@zytor.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	torvalds@linux-foundation.org, peterz@infradead.org,
	maarten.lankhorst@canonical.com
Subject: [tip:locking/urgent] locking/rtmutex: Set state back to running on error
Date: Sat, 28 Feb 2015 02:00:48 -0800	[thread overview]
Message-ID: <tip-8671e69f00c2733c995d188b9f8d6f9cbb67897c@git.kernel.org> (raw)
In-Reply-To: <1425056229-22326-4-git-send-email-bigeasy@linutronix.de>

Commit-ID:  8671e69f00c2733c995d188b9f8d6f9cbb67897c
Gitweb:     http://git.kernel.org/tip/8671e69f00c2733c995d188b9f8d6f9cbb67897c
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Fri, 27 Feb 2015 17:57:09 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 28 Feb 2015 10:47:37 +0100

locking/rtmutex: Set state back to running on error

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>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1425056229-22326-4-git-send-email-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/locking/rtmutex.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index e16e554..5845068 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1193,6 +1193,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
 		ret = __rt_mutex_slowlock(lock, state, timeout, &waiter);
 
 	if (unlikely(ret)) {
+		set_current_state(TASK_RUNNING);
 		if (rt_mutex_has_waiters(lock))
 			remove_waiter(lock, &waiter);
 		rt_mutex_handle_deadlock(ret, chwalk, &waiter);

  reply	other threads:[~2015-02-28 10:01 UTC|newest]

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 ` [PATCH 3/3] locking: rtmutex: set state back to running on error Sebastian Andrzej Siewior
2015-02-28 10:00   ` tip-bot for Sebastian Andrzej Siewior [this message]
2015-03-01  5:35   ` 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=tip-8671e69f00c2733c995d188b9f8d6f9cbb67897c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bigeasy@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=maarten.lankhorst@canonical.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome