From patchwork Thu Apr 2 10:51:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 46720 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 40154216D1 for ; Thu, 2 Apr 2015 10:52:21 +0000 (UTC) Received: by widjs5 with SMTP id js5sf3504588wid.3 for ; Thu, 02 Apr 2015 03:52:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=iTxqmP7ih5D+o3CHHNf/btk/Q3/whqa0jMxpdAsQjAw=; b=Fdl27rPD5iZShrUx4qh1vCXNnDCVGCHSC8xORPzzMw2S6SPdPSy9Eun0N03tHnSQE+ 44SId48da7bRUPyOD1+8iweX2xfXahjQWPkOUrvYsZ8wzq3zkjeP4xviu7jW33+T5fDY uQpIxDcQcMMRwbpEa4BH4wwuTlUckZtv7KI6pxCNGdjRENd6B/CJC6XnH8eRFScyF4L4 7rbnBhdIOqhVUJwZu9PJaN2pQbdjxesNZdgGNI7dl/kCy8UV9ztgWBlCJFpoEKkvsrPG 6qOyDD7oNn26ARvgmw6VxU1SsL5QvB+GcWBfo4/lW+JdoGcFDUPvtsn6oWs/W6bfCDyx WVUQ== X-Gm-Message-State: ALoCoQmUZL7wq+2XVCapRjDN6oJDso10jDfAO73REIEuDW8LMK3J5vlv0QMOTy5pv0V4HQarRgZq X-Received: by 10.112.125.67 with SMTP id mo3mr10490448lbb.6.1427971940457; Thu, 02 Apr 2015 03:52:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.38 with SMTP id jt6ls33673lab.101.gmail; Thu, 02 Apr 2015 03:52:20 -0700 (PDT) X-Received: by 10.112.136.232 with SMTP id qd8mr21461912lbb.1.1427971940209; Thu, 02 Apr 2015 03:52:20 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id ax6si3945398lbc.65.2015.04.02.03.52.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Apr 2015 03:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lagg8 with SMTP id g8so57235745lag.1 for ; Thu, 02 Apr 2015 03:52:20 -0700 (PDT) X-Received: by 10.152.29.68 with SMTP id i4mr40330439lah.19.1427971940063; Thu, 02 Apr 2015 03:52:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1250993lbq; Thu, 2 Apr 2015 03:52:18 -0700 (PDT) X-Received: by 10.66.161.161 with SMTP id xt1mr86123298pab.35.1427971936388; Thu, 02 Apr 2015 03:52:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ur3si7023658pac.8.2015.04.02.03.52.14; Thu, 02 Apr 2015 03:52:16 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752968AbbDBKwK (ORCPT + 27 others); Thu, 2 Apr 2015 06:52:10 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:36374 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751215AbbDBKvi (ORCPT ); Thu, 2 Apr 2015 06:51:38 -0400 Received: by pdea3 with SMTP id a3so34640183pde.3 for ; Thu, 02 Apr 2015 03:51:38 -0700 (PDT) X-Received: by 10.70.137.72 with SMTP id qg8mr86498321pdb.8.1427971898412; Thu, 02 Apr 2015 03:51:38 -0700 (PDT) Received: from localhost ([122.167.118.120]) by mx.google.com with ESMTPSA id rd7sm4846599pdb.85.2015.04.02.03.51.36 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 02 Apr 2015 03:51:37 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH 1/2] hrtimer: update '->active_bases' before calling hrtimer_force_reprogram() Date: Thu, 2 Apr 2015 16:21:21 +0530 Message-Id: X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 'active_bases' indicates which clock-base have active timers. While it is updated (almost) correctly, it is hardly used. Next commit will start using it to make code more efficient, but before that we need to fix a problem. While removing hrtimers, in __remove_hrtimer(): - We first remove the hrtimer from the queue. - Then reprogram clockevent device if required (hrtimer_force_reprogram()). - And then finally clear 'active_bases', if no more timers are pending on the current clock base (from which we are removing the hrtimer). hrtimer_force_reprogram() needs to loop over all active clock bases to find the next expiry event, and while doing so it will use 'active_bases' (after next commit). And it will find the current base active, as we haven't cleared it until now, even if current clock base has no more hrtimers queued. To fix this issue, clear active_bases before calling hrtimer_force_reprogram(). Reviewed-by: Preeti U Murthy Signed-off-by: Viresh Kumar --- kernel/time/hrtimer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index bee0c1f78091..3152f327c988 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -879,6 +879,9 @@ static void __remove_hrtimer(struct hrtimer *timer, next_timer = timerqueue_getnext(&base->active); timerqueue_del(&base->active, &timer->node); + if (!timerqueue_getnext(&base->active)) + base->cpu_base->active_bases &= ~(1 << base->index); + if (&timer->node == next_timer) { #ifdef CONFIG_HIGH_RES_TIMERS /* Reprogram the clock event device. if enabled */ @@ -892,8 +895,6 @@ static void __remove_hrtimer(struct hrtimer *timer, } #endif } - if (!timerqueue_getnext(&base->active)) - base->cpu_base->active_bases &= ~(1 << base->index); out: timer->state = newstate; }