From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932477AbcELTt6 (ORCPT ); Thu, 12 May 2016 15:49:58 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:36332 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932098AbcELTt4 (ORCPT ); Thu, 12 May 2016 15:49:56 -0400 From: Matt Fleming To: Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, Byungchul Park , Frederic Weisbecker , Luca Abeni , "Rafael J . Wysocki" , Rik van Riel , Thomas Gleixner , Wanpeng Li , Yuyang Du , Mel Gorman , Mike Galbraith , Matt Fleming Subject: [RFC][PATCH 0/5] sched: Diagnostic checks for missing rq clock updates Date: Thu, 12 May 2016 20:49:48 +0100 Message-Id: <1463082593-27777-1-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.7.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(). 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 patch 1 and commit b52fad2db5d7 ("sched/fair: Update rq clock before updating nohz CPU load") in tip/sched/core. I'm not sure how palatable the s/pin_cookie/rq_flags/ changes will be in patch 2, so I've marked this entire series as RFC. 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. Matt Fleming (5): sched/fair: Update the rq clock before detaching tasks 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 | 94 +++++++++++++++++++++++-------------------- kernel/sched/deadline.c | 10 ++--- kernel/sched/fair.c | 31 +++++++++------ kernel/sched/idle_task.c | 2 +- kernel/sched/rt.c | 6 +-- kernel/sched/sched.h | 101 ++++++++++++++++++++++++++++++++++++++++------- kernel/sched/stop_task.c | 2 +- 7 files changed, 166 insertions(+), 80 deletions(-) -- 2.7.3