From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755538AbcIUNiT (ORCPT ); Wed, 21 Sep 2016 09:38:19 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37381 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751743AbcIUNiQ (ORCPT ); Wed, 21 Sep 2016 09:38:16 -0400 From: Matt Fleming To: Peter Zijlstra , Ingo Molnar Cc: Byungchul Park , Frederic Weisbecker , Luca Abeni , Rik van Riel , Thomas Gleixner , Wanpeng Li , Yuyang Du , Petr Mladek , Jan Kara , Sergey Senozhatsky , linux-kernel@vger.kernel.org, Mel Gorman , Mike Galbraith , Matt Fleming Subject: [PATCH v2 0/7] sched: Diagnostic checks for missing rq clock updates Date: Wed, 21 Sep 2016 14:38:06 +0100 Message-Id: <20160921133813.31976-1-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are currently no runtime diagnostic checks for detecting when we have inadvertently missed a call to update_rq_clock() before accessing rq_clock() or rq_clock_task(). The idea in these patches, which came from Peter, is to piggyback on the rq->lock pin/unpin context to detect when we expected (and failed) to see an update to the rq clock. They've already caught a couple of bugs: see commit b52fad2db5d7 ("sched/fair: Update rq clock before updating nohz CPU load"). All the diagnostic code is guarded by CONFIG_SCHED_DEBUG, but there are minimal changes to __schedule() in patch 5 for the !SCHED_DEBUG case. Jan and Sergey, Petr asked that you be Cc'd on this series because of the recent issues with using WARN_ON() in the async printk work. Changes in v2: - Add a check for missing update_rq_clock() before rq_clock_task(). - Address review comments from Yuyang where I messed up the __schedule() ::clock_update_flags manipulation Matt Fleming (7): sched/fair: Update the rq clock before detaching tasks sched/fair: Update rq clock before waking up new task sched/fair: Update rq clock in task_hot() sched: Add wrappers for lockdep_(un)pin_lock() sched/core: Reset RQCF_ACT_SKIP before unpinning rq->lock sched/fair: Push rq lock pin/unpin into idle_balance() sched/core: Add debug code to catch missing update_rq_clock() kernel/sched/core.c | 92 +++++++++++++++++++++------------------- kernel/sched/deadline.c | 10 ++--- kernel/sched/fair.c | 40 +++++++++++------- kernel/sched/idle_task.c | 2 +- kernel/sched/rt.c | 6 +-- kernel/sched/sched.h | 107 ++++++++++++++++++++++++++++++++++++++++------- kernel/sched/stop_task.c | 2 +- 7 files changed, 177 insertions(+), 82 deletions(-) -- 2.9.3