There is no need to have the 'T *v' variable static
since new value always be assigned before use it.
Signed-off-by: Mao Wenan <[email protected]>
---
kernel/locking/rtmutex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 2823d41..ba70db8 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -472,7 +472,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
* We limit the lock chain length for each invocation.
*/
if (++depth > max_lock_depth) {
- static int prev_max;
+ int prev_max;
/*
* Print this only once. If the admin changes the limit,
On Tue, 7 Aug 2018, Mao Wenan wrote:
> There is no need to have the 'T *v' variable static
> since new value always be assigned before use it.
The code is:
static int prev_max;
/*
* Print this only once. If the admin changes the limit,
* print a new message when reaching the limit again.
*/
if (prev_max != max_lock_depth) {
So it is referenced before it is initialized.
julia
>
> Signed-off-by: Mao Wenan <[email protected]>
> ---
> kernel/locking/rtmutex.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
> index 2823d41..ba70db8 100644
> --- a/kernel/locking/rtmutex.c
> +++ b/kernel/locking/rtmutex.c
> @@ -472,7 +472,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
> * We limit the lock chain length for each invocation.
> */
> if (++depth > max_lock_depth) {
> - static int prev_max;
> + int prev_max;
>
> /*
> * Print this only once. If the admin changes the limit,
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
This is obviously wrong and you need to at least compile your patches...
regards,
dan carpenter
Hi Mao,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/locking/core]
[also build test WARNING on v4.18-rc8 next-20180807]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mao-Wenan/rtmutex-Drop-pointless-static-qualifier-in-rt_mutex_adjust_prio_chain/20180808-013010
config: x86_64-randconfig-x010-201831 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
kernel/locking/rtmutex.c: In function 'rt_mutex_adjust_prio_chain':
>> kernel/locking/rtmutex.c:481:6: warning: 'prev_max' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (prev_max != max_lock_depth) {
^
vim +/prev_max +481 kernel/locking/rtmutex.c
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 384
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 385 /*
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 386 * Adjust the priority chain. Also used for deadlock detection.
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 387 * Decreases task's usage by one - may thus free the task.
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 388 *
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 389 * @task: the task owning the mutex (owner) for which a chain walk is
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 390 * probably needed
e6beaa363 kernel/locking/rtmutex.c Tom(JeHyeon Yeon 2015-03-18 391) * @chwalk: do we have to carry out deadlock detection?
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 392 * @orig_lock: the mutex (can be NULL if we are walking the chain to recheck
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 393 * things for a task that has just got its priority adjusted, and
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 394 * is waiting on a mutex)
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 395 * @next_lock: the mutex on which the owner of @orig_lock was blocked before
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 396 * we dropped its pi_lock. Is never dereferenced, only used for
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 397 * comparison to detect lock chain changes.
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 398 * @orig_waiter: rt_mutex_waiter struct for the task that has just donated
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 399 * its priority to the mutex owner (can be NULL in the case
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 400 * depicted above or if the top waiter is gone away and we are
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 401 * actually deboosting the owner)
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 402 * @top_task: the current top waiter
0c1061733 kernel/rtmutex.c Juri Lelli 2013-05-15 403 *
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 404 * Returns 0 or -EDEADLK.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 405 *
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 406 * Chain walk basics and protection scope
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 407 *
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 408 * [R] refcount on task
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 409 * [P] task->pi_lock held
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 410 * [L] rtmutex->wait_lock held
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 411 *
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 412 * Step Description Protected by
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 413 * function arguments:
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 414 * @task [R]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 415 * @orig_lock if != NULL @top_task is blocked on it
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 416 * @next_lock Unprotected. Cannot be
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 417 * dereferenced. Only used for
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 418 * comparison.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 419 * @orig_waiter if != NULL @top_task is blocked on it
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 420 * @top_task current, or in case of proxy
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 421 * locking protected by calling
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 422 * code
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 423 * again:
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 424 * loop_sanity_check();
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 425 * retry:
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 426 * [1] lock(task->pi_lock); [R] acquire [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 427 * [2] waiter = task->pi_blocked_on; [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 428 * [3] check_exit_conditions_1(); [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 429 * [4] lock = waiter->lock; [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 430 * [5] if (!try_lock(lock->wait_lock)) { [P] try to acquire [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 431 * unlock(task->pi_lock); release [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 432 * goto retry;
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 433 * }
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 434 * [6] check_exit_conditions_2(); [P] + [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 435 * [7] requeue_lock_waiter(lock, waiter); [P] + [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 436 * [8] unlock(task->pi_lock); release [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 437 * put_task_struct(task); release [R]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 438 * [9] check_exit_conditions_3(); [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 439 * [10] task = owner(lock); [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 440 * get_task_struct(task); [L] acquire [R]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 441 * lock(task->pi_lock); [L] acquire [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 442 * [11] requeue_pi_waiter(tsk, waiters(lock));[P] + [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 443 * [12] check_exit_conditions_4(); [P] + [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 444 * [13] unlock(task->pi_lock); release [P]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 445 * unlock(lock->wait_lock); release [L]
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 446 * goto again;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 447 */
bd197234b kernel/rtmutex.c Thomas Gleixner 2007-06-17 448 static int rt_mutex_adjust_prio_chain(struct task_struct *task,
8930ed80f kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 449 enum rtmutex_chainwalk chwalk,
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 450 struct rt_mutex *orig_lock,
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 451 struct rt_mutex *next_lock,
95e02ca9b kernel/rtmutex.c Thomas Gleixner 2006-06-27 452 struct rt_mutex_waiter *orig_waiter,
9a11b49a8 kernel/rtmutex.c Ingo Molnar 2006-07-03 453 struct task_struct *top_task)
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 454 {
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 455 struct rt_mutex_waiter *waiter, *top_waiter = orig_waiter;
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 456 struct rt_mutex_waiter *prerequeue_top_waiter;
8930ed80f kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 457 int ret = 0, depth = 0;
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 458 struct rt_mutex *lock;
8930ed80f kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 459 bool detect_deadlock;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 460 bool requeue = true;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 461
8930ed80f kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 462 detect_deadlock = rt_mutex_cond_detect_deadlock(orig_waiter, chwalk);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 463
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 464 /*
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 465 * The (de)boosting is a step by step approach with a lot of
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 466 * pitfalls. We want this to be preemptible and we want hold a
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 467 * maximum of two locks per step. So we have to check
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 468 * carefully whether things change under us.
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 469 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 470 again:
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 471 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 472 * We limit the lock chain length for each invocation.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 473 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 474 if (++depth > max_lock_depth) {
3ac304ec5 kernel/locking/rtmutex.c Mao Wenan 2018-08-07 475 int prev_max;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 476
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 477 /*
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 478 * Print this only once. If the admin changes the limit,
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 479 * print a new message when reaching the limit again.
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 480 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 @481 if (prev_max != max_lock_depth) {
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 482 prev_max = max_lock_depth;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 483 printk(KERN_WARNING "Maximum lock depth %d reached "
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 484 "task: %s (%d)\n", max_lock_depth,
ba25f9dcc kernel/rtmutex.c Pavel Emelyanov 2007-10-18 485 top_task->comm, task_pid_nr(top_task));
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 486 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 487 put_task_struct(task);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 488
3d5c9340d kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 489 return -EDEADLK;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 490 }
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 491
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 492 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 493 * We are fully preemptible here and only hold the refcount on
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 494 * @task. So everything can have changed under us since the
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 495 * caller or our own code below (goto retry/again) dropped all
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 496 * locks.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 497 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 498 retry:
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 499 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 500 * [1] Task cannot go away as we did a get_task() before !
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 501 */
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 502 raw_spin_lock_irq(&task->pi_lock);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 503
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 504 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 505 * [2] Get the waiter on which @task is blocked on.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 506 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 507 waiter = task->pi_blocked_on;
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 508
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 509 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 510 * [3] check_exit_conditions_1() protected by task->pi_lock.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 511 */
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 512
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 513 /*
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 514 * Check whether the end of the boosting chain has been
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 515 * reached or the state of the chain has changed while we
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 516 * dropped the locks.
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 517 */
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 518 if (!waiter)
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 519 goto out_unlock_pi;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 520
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 521 /*
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 522 * Check the orig_waiter state. After we dropped the locks,
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 523 * the previous owner of the lock might have released the lock.
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 524 */
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 525 if (orig_waiter && !rt_mutex_owner(orig_lock))
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 526 goto out_unlock_pi;
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 527
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 528 /*
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 529 * We dropped all locks after taking a refcount on @task, so
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 530 * the task might have moved on in the lock chain or even left
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 531 * the chain completely and blocks now on an unrelated lock or
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 532 * on @orig_lock.
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 533 *
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 534 * We stored the lock on which @task was blocked in @next_lock,
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 535 * so we can detect the chain change.
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 536 */
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 537 if (next_lock != waiter->lock)
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 538 goto out_unlock_pi;
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 539
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 540 /*
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 541 * Drop out, when the task has no waiters. Note,
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 542 * top_waiter can be NULL, when we are in the deboosting
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 543 * mode!
1a539a872 kernel/rtmutex.c Thomas Gleixner 2007-06-08 544 */
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 545 if (top_waiter) {
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 546 if (!task_has_pi_waiters(task))
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 547 goto out_unlock_pi;
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 548 /*
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 549 * If deadlock detection is off, we stop here if we
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 550 * are not the top pi waiter of the task. If deadlock
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 551 * detection is enabled we continue, but stop the
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 552 * requeueing in the chain walk.
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 553 */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 554 if (top_waiter != task_top_pi_waiter(task)) {
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 555 if (!detect_deadlock)
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 556 goto out_unlock_pi;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 557 else
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 558 requeue = false;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 559 }
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 560 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 561
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 562 /*
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 563 * If the waiter priority is the same as the task priority
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 564 * then there is no further priority adjustment necessary. If
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 565 * deadlock detection is off, we stop the chain walk. If its
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 566 * enabled we continue, but stop the requeueing in the chain
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 567 * walk.
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 568 */
19830e552 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 569 if (rt_mutex_waiter_equal(waiter, task_to_waiter(task))) {
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 570 if (!detect_deadlock)
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 571 goto out_unlock_pi;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 572 else
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 573 requeue = false;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 574 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 575
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 576 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 577 * [4] Get the next lock
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 578 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 579 lock = waiter->lock;
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 580 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 581 * [5] We need to trylock here as we are holding task->pi_lock,
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 582 * which is the reverse lock order versus the other rtmutex
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 583 * operations.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 584 */
d209d74d5 kernel/rtmutex.c Thomas Gleixner 2009-11-17 585 if (!raw_spin_trylock(&lock->wait_lock)) {
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 586 raw_spin_unlock_irq(&task->pi_lock);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 587 cpu_relax();
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 588 goto retry;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 589 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 590
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 591 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 592 * [6] check_exit_conditions_2() protected by task->pi_lock and
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 593 * lock->wait_lock.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 594 *
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 595 * Deadlock detection. If the lock is the same as the original
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 596 * lock which caused us to walk the lock chain or if the
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 597 * current lock is owned by the task which initiated the chain
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 598 * walk, we detected a deadlock.
397335f00 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 599 */
95e02ca9b kernel/rtmutex.c Thomas Gleixner 2006-06-27 600 if (lock == orig_lock || rt_mutex_owner(lock) == top_task) {
8930ed80f kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 601 debug_rt_mutex_deadlock(chwalk, orig_waiter, lock);
d209d74d5 kernel/rtmutex.c Thomas Gleixner 2009-11-17 602 raw_spin_unlock(&lock->wait_lock);
3d5c9340d kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 603 ret = -EDEADLK;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 604 goto out_unlock_pi;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 605 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 606
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 607 /*
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 608 * If we just follow the lock chain for deadlock detection, no
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 609 * need to do all the requeue operations. To avoid a truckload
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 610 * of conditionals around the various places below, just do the
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 611 * minimum chain walk checks.
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 612 */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 613 if (!requeue) {
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 614 /*
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 615 * No requeue[7] here. Just release @task [8]
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 616 */
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 617 raw_spin_unlock(&task->pi_lock);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 618 put_task_struct(task);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 619
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 620 /*
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 621 * [9] check_exit_conditions_3 protected by lock->wait_lock.
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 622 * If there is no owner of the lock, end of chain.
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 623 */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 624 if (!rt_mutex_owner(lock)) {
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 625 raw_spin_unlock_irq(&lock->wait_lock);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 626 return 0;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 627 }
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 628
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 629 /* [10] Grab the next task, i.e. owner of @lock */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 630 task = rt_mutex_owner(lock);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 631 get_task_struct(task);
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 632 raw_spin_lock(&task->pi_lock);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 633
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 634 /*
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 635 * No requeue [11] here. We just do deadlock detection.
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 636 *
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 637 * [12] Store whether owner is blocked
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 638 * itself. Decision is made after dropping the locks
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 639 */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 640 next_lock = task_blocked_on_lock(task);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 641 /*
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 642 * Get the top waiter for the next iteration
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 643 */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 644 top_waiter = rt_mutex_top_waiter(lock);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 645
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 646 /* [13] Drop locks */
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 647 raw_spin_unlock(&task->pi_lock);
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 648 raw_spin_unlock_irq(&lock->wait_lock);
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 649
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 650 /* If owner is not blocked, end of chain. */
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 651 if (!next_lock)
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 652 goto out_put_task;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 653 goto again;
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 654 }
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 655
67792e2ca kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 656 /*
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 657 * Store the current top waiter before doing the requeue
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 658 * operation on @lock. We need it for the boost/deboost
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 659 * decision below.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 660 */
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 661 prerequeue_top_waiter = rt_mutex_top_waiter(lock);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 662
9f40a51a3 kernel/locking/rtmutex.c Davidlohr Bueso 2015-05-19 663 /* [7] Requeue the waiter in the lock waiter tree. */
fb00aca47 kernel/locking/rtmutex.c Peter Zijlstra 2013-11-07 664 rt_mutex_dequeue(lock, waiter);
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 665
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 666 /*
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 667 * Update the waiter prio fields now that we're dequeued.
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 668 *
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 669 * These values can have changed through either:
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 670 *
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 671 * sys_sched_set_scheduler() / sys_sched_setattr()
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 672 *
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 673 * or
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 674 *
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 675 * DL CBS enforcement advancing the effective deadline.
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 676 *
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 677 * Even though pi_waiters also uses these fields, and that tree is only
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 678 * updated in [11], we can do this here, since we hold [L], which
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 679 * serializes all pi_waiters access and rb_erase() does not care about
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 680 * the values of the node being removed.
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 681 */
2d3d891d3 kernel/locking/rtmutex.c Dario Faggioli 2013-11-07 682 waiter->prio = task->prio;
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 683 waiter->deadline = task->dl.deadline;
e0aad5b44 kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 684
fb00aca47 kernel/locking/rtmutex.c Peter Zijlstra 2013-11-07 685 rt_mutex_enqueue(lock, waiter);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 686
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 687 /* [8] Release the task */
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 688 raw_spin_unlock(&task->pi_lock);
2ffa5a5cd kernel/locking/rtmutex.c Thomas Gleixner 2014-06-07 689 put_task_struct(task);
2ffa5a5cd kernel/locking/rtmutex.c Thomas Gleixner 2014-06-07 690
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 691 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 692 * [9] check_exit_conditions_3 protected by lock->wait_lock.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 693 *
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 694 * We must abort the chain walk if there is no lock owner even
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 695 * in the dead lock detection case, as we have nothing to
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 696 * follow here. This is the end of the chain we are walking.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 697 */
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 698 if (!rt_mutex_owner(lock)) {
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 699 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 700 * If the requeue [7] above changed the top waiter,
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 701 * then we need to wake the new top waiter up to try
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 702 * to get the lock.
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 703 */
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 704 if (prerequeue_top_waiter != rt_mutex_top_waiter(lock))
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 705 wake_up_process(rt_mutex_top_waiter(lock)->task);
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 706 raw_spin_unlock_irq(&lock->wait_lock);
2ffa5a5cd kernel/locking/rtmutex.c Thomas Gleixner 2014-06-07 707 return 0;
8161239a8 kernel/rtmutex.c Lai Jiangshan 2011-01-14 708 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 709
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 710 /* [10] Grab the next task, i.e. the owner of @lock */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 711 task = rt_mutex_owner(lock);
db630637b kernel/rtmutex.c Steven Rostedt 2006-09-29 712 get_task_struct(task);
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 713 raw_spin_lock(&task->pi_lock);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 714
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 715 /* [11] requeue the pi waiters if necessary */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 716 if (waiter == rt_mutex_top_waiter(lock)) {
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 717 /*
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 718 * The waiter became the new top (highest priority)
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 719 * waiter on the lock. Replace the previous top waiter
9f40a51a3 kernel/locking/rtmutex.c Davidlohr Bueso 2015-05-19 720 * in the owner tasks pi waiters tree with this waiter
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 721 * and adjust the priority of the owner.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 722 */
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 723 rt_mutex_dequeue_pi(task, prerequeue_top_waiter);
fb00aca47 kernel/locking/rtmutex.c Peter Zijlstra 2013-11-07 724 rt_mutex_enqueue_pi(task, waiter);
acd58620e kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 725 rt_mutex_adjust_prio(task);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 726
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 727 } else if (prerequeue_top_waiter == waiter) {
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 728 /*
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 729 * The waiter was the top waiter on the lock, but is
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 730 * no longer the top prority waiter. Replace waiter in
9f40a51a3 kernel/locking/rtmutex.c Davidlohr Bueso 2015-05-19 731 * the owner tasks pi waiters tree with the new top
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 732 * (highest priority) waiter and adjust the priority
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 733 * of the owner.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 734 * The new top waiter is stored in @waiter so that
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 735 * @waiter == @top_waiter evaluates to true below and
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 736 * we continue to deboost the rest of the chain.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 737 */
fb00aca47 kernel/locking/rtmutex.c Peter Zijlstra 2013-11-07 738 rt_mutex_dequeue_pi(task, waiter);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 739 waiter = rt_mutex_top_waiter(lock);
fb00aca47 kernel/locking/rtmutex.c Peter Zijlstra 2013-11-07 740 rt_mutex_enqueue_pi(task, waiter);
acd58620e kernel/locking/rtmutex.c Peter Zijlstra 2017-03-23 741 rt_mutex_adjust_prio(task);
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 742 } else {
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 743 /*
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 744 * Nothing changed. No need to do any priority
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 745 * adjustment.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 746 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 747 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 748
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 749 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 750 * [12] check_exit_conditions_4() protected by task->pi_lock
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 751 * and lock->wait_lock. The actual decisions are made after we
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 752 * dropped the locks.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 753 *
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 754 * Check whether the task which owns the current lock is pi
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 755 * blocked itself. If yes we store a pointer to the lock for
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 756 * the lock chain change detection above. After we dropped
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 757 * task->pi_lock next_lock cannot be dereferenced anymore.
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 758 */
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 759 next_lock = task_blocked_on_lock(task);
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 760 /*
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 761 * Store the top waiter of @lock for the end of chain walk
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 762 * decision below.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 763 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 764 top_waiter = rt_mutex_top_waiter(lock);
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 765
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 766 /* [13] Drop the locks */
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 767 raw_spin_unlock(&task->pi_lock);
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 768 raw_spin_unlock_irq(&lock->wait_lock);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 769
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 770 /*
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 771 * Make the actual exit decisions [12], based on the stored
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 772 * values.
3eb65aead kernel/locking/rtmutex.c Thomas Gleixner 2014-06-09 773 *
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 774 * We reached the end of the lock chain. Stop right here. No
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 775 * point to go back just to figure that out.
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 776 */
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 777 if (!next_lock)
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 778 goto out_put_task;
820849843 kernel/locking/rtmutex.c Thomas Gleixner 2014-06-05 779
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 780 /*
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 781 * If the current waiter is not the top waiter on the lock,
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 782 * then we can stop the chain walk here if we are not in full
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 783 * deadlock detection mode.
a57594a13 kernel/locking/rtmutex.c Thomas Gleixner 2014-05-22 784 */
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 785 if (!detect_deadlock && waiter != top_waiter)
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 786 goto out_put_task;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 787
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 788 goto again;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 789
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 790 out_unlock_pi:
b4abf9104 kernel/locking/rtmutex.c Thomas Gleixner 2016-01-13 791 raw_spin_unlock_irq(&task->pi_lock);
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 792 out_put_task:
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 793 put_task_struct(task);
36c8b5868 kernel/rtmutex.c Ingo Molnar 2006-07-03 794
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 795 return ret;
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 796 }
23f78d4a0 kernel/rtmutex.c Ingo Molnar 2006-06-27 797
:::::: The code at line 481 was first introduced by commit
:::::: 23f78d4a03c53cbd75d87a795378ea540aa08c86 [PATCH] pi-futex: rt mutex core
:::::: TO: Ingo Molnar <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation