From patchwork Tue Apr 15 05:24:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28379 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 246902036A for ; Tue, 15 Apr 2014 05:25:33 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oz11sf33636896veb.5 for ; Mon, 14 Apr 2014 22:25:32 -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=ayBXlqGSOcAVpe0uPizqVC5ODSZPh7kl69NZK6iD8DU=; b=WVFdugBZEeP66N/vT8fBexgK1Rqvwu54i+njGjZL9jvGqFDB8kaK1j+KEvObhcf+us RarNrQNFDdwBTtABSThHwFQQmZbSJEbr34Y744q+zKzoFNLjmYHpRjbWlGacWsjpLj4/ AyDYJdu6wCtTNgEvCYgiWjn0SN7EbZ4FpmrGIXM8nzoon1QUgTOZfDHCy3bOYRR+PW9U YB7AJTPJUQdb6VwvA3FkOllXhplSM5hce1P/nwQ+3AIgaaSY53ndJt3uYNLpEJkx9eHm mpiDhgKOufXfV/GbXTmEzGUWV98mGhvWpDGPyOFQl1xp72HneB1fd6a0PCqj1ivEW3oC M8qA== X-Gm-Message-State: ALoCoQnXbAzZWtG7YT3PqRIaVZ/aCBFfnTLSw9wxnXss95/TPq9IX6rqzeok/YR7fm2qSrT3ncf3 X-Received: by 10.58.22.166 with SMTP id e6mr23413209vef.6.1397539532853; Mon, 14 Apr 2014 22:25:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.115 with SMTP id w106ls3066371qgw.53.gmail; Mon, 14 Apr 2014 22:25:32 -0700 (PDT) X-Received: by 10.58.219.233 with SMTP id pr9mr42541111vec.10.1397539532782; Mon, 14 Apr 2014 22:25:32 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id b7si3204598vev.94.2014.04.14.22.25.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 22:25:32 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so8636641vcb.35 for ; Mon, 14 Apr 2014 22:25:32 -0700 (PDT) X-Received: by 10.220.12.66 with SMTP id w2mr39774773vcw.15.1397539532684; Mon, 14 Apr 2014 22:25:32 -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 ib8csp202950vcb; Mon, 14 Apr 2014 22:25:32 -0700 (PDT) X-Received: by 10.66.149.7 with SMTP id tw7mr25828748pab.72.1397539531706; Mon, 14 Apr 2014 22:25:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ov9si8769761pbc.342.2014.04.14.22.25.31; Mon, 14 Apr 2014 22:25:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbaDOFZO (ORCPT + 26 others); Tue, 15 Apr 2014 01:25:14 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:61044 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbaDOFZJ (ORCPT ); Tue, 15 Apr 2014 01:25:09 -0400 Received: by mail-wg0-f50.google.com with SMTP id x13so9184533wgg.9 for ; Mon, 14 Apr 2014 22:25:08 -0700 (PDT) X-Received: by 10.194.92.7 with SMTP id ci7mr36283620wjb.7.1397539508867; Mon, 14 Apr 2014 22:25:08 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id go20sm260906wjc.18.2014.04.14.22.25.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 22:25:07 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Arvind.Chauhan@arm.com, linaro-networking@linaro.org, Viresh Kumar Subject: [PATCH V1 Resend 3/5] tick-common: do additional checks in tick_check_preferred() Date: Tue, 15 Apr 2014 10:54:39 +0530 Message-Id: <6fee05309c65f68120bfaed6c68a952157b5da5e.1397537987.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e 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=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , We return false from tick_check_preferred() if newdev doesn't have ONESHOT feature but curdev has, but we don't return true when newdev has ONESHOT and curdev doesn't. Instead we go on, check ratings and other things in that case. This patch tries to fix this by rewriting some portion of this code and adds sufficient comments to make logic clear. Signed-off-by: Viresh Kumar --- kernel/time/tick-common.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 69cab28..2f13889 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -252,18 +252,29 @@ static bool tick_check_percpu(struct clock_event_device *curdev, static bool tick_check_preferred(struct clock_event_device *curdev, struct clock_event_device *newdev) { - /* Prefer oneshot capable device */ - if (!(newdev->features & CLOCK_EVT_FEAT_ONESHOT)) { - if (curdev && (curdev->features & CLOCK_EVT_FEAT_ONESHOT)) - return false; - } + if (!curdev) + return true; + + /* + * Prefer oneshot capable device. + * return values based on if ONESHOT is available or not: + * + * curdev newdev operation + * 0 0 check priority + * 0 1 return true + * 1 0 return false + * 1 1 check priority + */ + + if ((newdev->features & CLOCK_EVT_FEAT_ONESHOT) ^ + (curdev->features & CLOCK_EVT_FEAT_ONESHOT)) + return newdev->features & CLOCK_EVT_FEAT_ONESHOT; /* * Use the higher rated one, but prefer a CPU local device with a lower * rating than a non-CPU local device */ - return !curdev || - newdev->rating > curdev->rating || + return newdev->rating > curdev->rating || !cpumask_equal(curdev->cpumask, newdev->cpumask); }