linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Abeni <luca.abeni@unitn.it>
To: Wanpeng Li <wanpeng.li@hotmail.com>, linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Juri Lelli <juri.lelli@arm.com>
Subject: Re: lockdep-related warning in kernel/sched/deadline.c::find_lock_later_rq()
Date: Thu, 22 Oct 2015 09:06:31 +0200	[thread overview]
Message-ID: <56288AF7.20602@unitn.it> (raw)
In-Reply-To: <BLU436-SMTP61CD3023B63D84AF4BF0E480270@phx.gbl>

Hi,

On 10/22/2015 07:35 AM, Wanpeng Li wrote:
[...]
>> Now, if I understand correctly the issue is that dl_task_timer() does:
>>     rq = task_rq_lock(p, &flags);
>> [...]
>>     if (has_pushable_dl_tasks(rq))
>>         push_dl_task(rq);
>> with task_rq_lock() that pins rq->lock and push_tl_task() that invokes
>> find_lock_later_rq() that unlocks rq->lock() while it is pinned.
>>
>> I am not sure about how to fix this issue: as a first try, I did
>> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
>> index 142df26..5b1ba95 100644
>> --- a/kernel/sched/deadline.c
>> +++ b/kernel/sched/deadline.c
>> @@ -668,8 +668,11 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
>>       * Queueing this task back might have overloaded rq, check if we need
>>       * to kick someone away.
>>       */
>> -    if (has_pushable_dl_tasks(rq))
>> +    if (has_pushable_dl_tasks(rq)) {
>> +        lockdep_unpin_lock(&rq->lock);
>>          push_dl_task(rq);
>> +        lockdep_pin_lock(&rq->lock);
>> +    }
>>  #endif
>>
>>  unlock:
>>
>> This removes the warning, but I am not sure if it is the correct fix (is it
>> valid to unpin rq->lock, here?).
>>
>> If someone can confirm that this is the correct approach, I'll test the patch a
>> little bit more and then I'll send a properly signed-off patch; otherwise, if
>> someone can suggest the correct approach I'll try it.
>
> wake_up_new_task()
>    -> __task_rq_lock()
>    -> task_woken()
>      -> push_dl/rt_tasks()
>        -> push_dl/rt_task()
>
> I think you also should consider the lockdep pin_lock in this path.
Well, I never triggered this warning for the task_woken() path, but now I
see it... Thanks!

If someone can confirm that unpinning before calling push/pull and pinning again
after the call is the correct thing to do, I'll send a proper patch taking into
account all the paths... But for the moment I am still not sure if unpinning
the lock here is ok.



			Thanks,
				Luca

  reply	other threads:[~2015-10-22  7:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 13:20 lockdep-related warning in kernel/sched/deadline.c::find_lock_later_rq() Luca Abeni
2015-10-22  5:35 ` Wanpeng Li
2015-10-22  7:06   ` Luca Abeni [this message]
2015-10-23  9:50     ` Peter Zijlstra
2015-10-23 10:03       ` [tip:sched/urgent] sched/core: Add missing lockdep_unpin() annotations tip-bot for Peter Zijlstra
2015-10-23 20:10       ` lockdep-related warning in kernel/sched/deadline.c::find_lock_later_rq() Luca Abeni

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=56288AF7.20602@unitn.it \
    --to=luca.abeni@unitn.it \
    --cc=juri.lelli@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=wanpeng.li@hotmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).