From patchwork Mon May 12 08:12:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 29957 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 18054203F3 for ; Mon, 12 May 2014 08:13:00 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id ey11sf29053641pad.8 for ; Mon, 12 May 2014 01:13:00 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=p82pLGZ4CRbTdb8CatalWb5+z89tRdgF8Ner/bK2LsU=; b=iOj62KQFr8hD7VxwMRq02QiOtaJx0JTqb7Ng2LVuxBaKc6WneE8iAhaKT+3caXFijb 9LI0bwogMrNzSOibniRWHt+0ZFTBWtPJpt/EXiyv6oeCEqEuZvxmH2jH2znU7r7LiTlK E8cyGdSuFy/WhJDajDgj6RwAoVcQTtrNG6LUjjb+ZYF3byAOxQgxGNyj0gTTSAW/jpit Y9YEDNPT6gi54RIMBIQhVrTDiU0bfOGiw83lvWTEMjJLEyHxanwIgP9naryUWi2EjJNd HYyDj1Uyul58qJeBWbzFXbV08UiXSdnaqBrMqDYgMpv8hOiZjX/CBRX8XcFJwP+jSX7o aIAw== X-Gm-Message-State: ALoCoQn4Iac+s/Xp8TTvVAFGvSZEuXxAQ2OCAP2SQaBZhlmcgIoOL4SgjrJBAg9W9onSa53d0UDB X-Received: by 10.66.254.101 with SMTP id ah5mr12824504pad.8.1399882380332; Mon, 12 May 2014 01:13:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.46 with SMTP id k43ls605551qgk.58.gmail; Mon, 12 May 2014 01:13:00 -0700 (PDT) X-Received: by 10.52.13.41 with SMTP id e9mr18791039vdc.21.1399882380207; Mon, 12 May 2014 01:13:00 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id kp14si1951340vcb.110.2014.05.12.01.13.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 May 2014 01:13:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lc6so8230464vcb.2 for ; Mon, 12 May 2014 01:13:00 -0700 (PDT) X-Received: by 10.58.18.198 with SMTP id y6mr447849ved.31.1399882380103; Mon, 12 May 2014 01:13:00 -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.220.221.72 with SMTP id ib8csp49763vcb; Mon, 12 May 2014 01:12:59 -0700 (PDT) X-Received: by 10.66.190.167 with SMTP id gr7mr47496662pac.75.1399882378987; Mon, 12 May 2014 01:12:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kg4si9223223pad.239.2014.05.12.01.12.58; Mon, 12 May 2014 01:12:58 -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 S1753649AbaELIMt (ORCPT + 27 others); Mon, 12 May 2014 04:12:49 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:40489 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751827AbaELIMq (ORCPT ); Mon, 12 May 2014 04:12:46 -0400 Received: by mail-wg0-f51.google.com with SMTP id x13so6518065wgg.22 for ; Mon, 12 May 2014 01:12:45 -0700 (PDT) X-Received: by 10.180.8.40 with SMTP id o8mr14380249wia.25.1399882365611; Mon, 12 May 2014 01:12:45 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id u9sm14678349wib.21.2014.05.12.01.12.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 May 2014 01:12:44 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linaro-networking@linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, arvind.chauhan@arm.com, Viresh Kumar Subject: [PATCH Resend] hrtimer: call switch_hrtimer_base() after setting new expiry time Date: Mon, 12 May 2014 13:42:29 +0530 Message-Id: <81999e148745fc51bbcd0615823fbab9b2e87e23.1399882253.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.0.rc2 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.220.171 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: , In switch_hrtimer_base() we are calling hrtimer_check_target() which guarantees this: /* * With HIGHRES=y we do not migrate the timer when it is expiring * before the next event on the target cpu because we cannot reprogram * the target cpu hardware and we would cause it to fire late. * * Called with cpu_base->lock of target cpu held. */ But switch_hrtimer_base() is only called from one place, i.e. __hrtimer_start_range_ns() and at that point (where we call switch_hrtimer_base()) expiration time is not yet known as we call this routine later: hrtimer_set_expires_range_ns(). To fix this, we need to find the updated expiry time before calling switch_hrtimer_base(). Signed-off-by: Viresh Kumar --- Rebased over: v3.15-rc5 kernel/hrtimer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 6b715c0..e0501fe 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -990,11 +990,8 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, /* Remove an active timer from the queue: */ ret = remove_hrtimer(timer, base); - /* Switch the timer base, if necessary: */ - new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); - if (mode & HRTIMER_MODE_REL) { - tim = ktime_add_safe(tim, new_base->get_time()); + tim = ktime_add_safe(tim, base->get_time()); /* * CONFIG_TIME_LOW_RES is a temporary way for architectures * to signal that they simply return xtime in @@ -1009,6 +1006,9 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, hrtimer_set_expires_range_ns(timer, tim, delta_ns); + /* Switch the timer base, if necessary: */ + new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); + timer_stats_hrtimer_set_start_info(timer); leftmost = enqueue_hrtimer(timer, new_base);