From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932160AbcHJSCD (ORCPT ); Wed, 10 Aug 2016 14:02:03 -0400 Received: from terminus.zytor.com ([198.137.202.10]:55882 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752237AbcHJSCA (ORCPT ); Wed, 10 Aug 2016 14:02:00 -0400 Date: Wed, 10 Aug 2016 11:01:21 -0700 From: tip-bot for Wanpeng Li Message-ID: Cc: torvalds@linux-foundation.org, peterz@infradead.org, wanpeng.li@hotmail.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, juri.lelli@arm.com, mingo@kernel.org, hpa@zytor.com, luca.abeni@unitn.it Reply-To: juri.lelli@arm.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, wanpeng.li@hotmail.com, peterz@infradead.org, torvalds@linux-foundation.org, luca.abeni@unitn.it, hpa@zytor.com, mingo@kernel.org In-Reply-To: <1470274940-17976-1-git-send-email-wanpeng.li@hotmail.com> References: <1470274940-17976-1-git-send-email-wanpeng.li@hotmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/deadline: Fix lock pinning warning during CPU hotplug Git-Commit-ID: c0c8c9fa210c9a042060435f17e40ba4a76d6d6f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c0c8c9fa210c9a042060435f17e40ba4a76d6d6f Gitweb: http://git.kernel.org/tip/c0c8c9fa210c9a042060435f17e40ba4a76d6d6f Author: Wanpeng Li AuthorDate: Thu, 4 Aug 2016 09:42:20 +0800 Committer: Ingo Molnar CommitDate: Wed, 10 Aug 2016 14:02:55 +0200 sched/deadline: Fix lock pinning warning during CPU hotplug The following warning can be triggered by hot-unplugging the CPU on which an active SCHED_DEADLINE task is running on: WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:3531 lock_release+0x690/0x6a0 releasing a pinned lock Call Trace: dump_stack+0x99/0xd0 __warn+0xd1/0xf0 ? dl_task_timer+0x1a1/0x2b0 warn_slowpath_fmt+0x4f/0x60 ? sched_clock+0x13/0x20 lock_release+0x690/0x6a0 ? enqueue_pushable_dl_task+0x9b/0xa0 ? enqueue_task_dl+0x1ca/0x480 _raw_spin_unlock+0x1f/0x40 dl_task_timer+0x1a1/0x2b0 ? push_dl_task.part.31+0x190/0x190 WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:3649 lock_unpin_lock+0x181/0x1a0 unpinning an unpinned lock Call Trace: dump_stack+0x99/0xd0 __warn+0xd1/0xf0 warn_slowpath_fmt+0x4f/0x60 lock_unpin_lock+0x181/0x1a0 dl_task_timer+0x127/0x2b0 ? push_dl_task.part.31+0x190/0x190 As per the comment before this code, its safe to drop the RQ lock here, and since we (potentially) change rq, unpin and repin to avoid the splat. Signed-off-by: Wanpeng Li [ Rewrote changelog. ] Signed-off-by: Peter Zijlstra (Intel) Cc: Juri Lelli Cc: Linus Torvalds Cc: Luca Abeni Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1470274940-17976-1-git-send-email-wanpeng.li@hotmail.com Signed-off-by: Ingo Molnar --- kernel/sched/deadline.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index fcb7f02..1ce8867 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -658,8 +658,11 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) * * XXX figure out if select_task_rq_dl() deals with offline cpus. */ - if (unlikely(!rq->online)) + if (unlikely(!rq->online)) { + lockdep_unpin_lock(&rq->lock, rf.cookie); rq = dl_task_offline_migration(rq, p); + rf.cookie = lockdep_pin_lock(&rq->lock); + } /* * Queueing this task back might have overloaded rq, check if we need