From patchwork Mon Apr 14 16:23:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28362 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A29C2036A for ; Mon, 14 Apr 2014 16:50:54 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id hw13sf15984621qab.11 for ; Mon, 14 Apr 2014 09:50:53 -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=rhqf1m9I1NcKeMqfFRSTUIaQx7T3B8QMnmkR/vS4LQs=; b=NfqUtPffQ5CVsQm8O8HsW3PZ94s+OTChcrkc1dfyovlQbzZc7OnHXdAHhQ7naw9HOv kadpENDz8IXs/tGRbwQCq4FT84yzTkTCTf26+Z1VGEBkhl8oG0gAqtWUeR4XdkeehhBE Es1DWRc4vqGsk4oQqFQtV/wmC95nI6/GbupRY1iVXUQSjSBSF96pzrKPFDMRYGqUD/wS JolC0OjgTUxpxVRVRgA5Llb8AbtRr8yS1odVWVxYVxHUs5rK/NfjJjuIPy89YfEYXgNM 3mhve2T/qP52JQZEjbwNISKEOIbQCaEE2FT67DX7vyDZsSDBfwkCqmzX/ryPbt/eDwSI sOWQ== X-Gm-Message-State: ALoCoQlKTV+P9n6utYzxbKD04EdtTB7Zti3h+Z+ktH2JnrNPwYyfgYYCneIugNnaq96jW+JskkPh X-Received: by 10.58.41.39 with SMTP id c7mr21381539vel.25.1397494253868; Mon, 14 Apr 2014 09:50:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.231 with SMTP id 94ls2216982qgh.15.gmail; Mon, 14 Apr 2014 09:50:53 -0700 (PDT) X-Received: by 10.58.185.145 with SMTP id fc17mr39594264vec.14.1397494253728; Mon, 14 Apr 2014 09:50:53 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id e9si2847710vct.34.2014.04.14.09.50.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:50:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 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.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so7860343vcb.33 for ; Mon, 14 Apr 2014 09:50:53 -0700 (PDT) X-Received: by 10.58.13.104 with SMTP id g8mr37357288vec.16.1397494253653; Mon, 14 Apr 2014 09:50:53 -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 ib8csp164626vcb; Mon, 14 Apr 2014 09:50:53 -0700 (PDT) X-Received: by 10.68.171.4 with SMTP id aq4mr4003686pbc.150.1397494252783; Mon, 14 Apr 2014 09:50:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zt8si9171854pbc.402.2014.04.14.09.50.52; Mon, 14 Apr 2014 09:50:52 -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 S1755473AbaDNQZt (ORCPT + 26 others); Mon, 14 Apr 2014 12:25:49 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:33204 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754899AbaDNQZj (ORCPT ); Mon, 14 Apr 2014 12:25:39 -0400 Received: by mail-pb0-f52.google.com with SMTP id rr13so8433739pbb.39 for ; Mon, 14 Apr 2014 09:25:38 -0700 (PDT) X-Received: by 10.67.4.138 with SMTP id ce10mr3137359pad.12.1397492737827; Mon, 14 Apr 2014 09:25:37 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id pl10sm34702755pbb.56.2014.04.14.09.25.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:25:37 -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 14/38] tick-common: do additional checks in tick_check_preferred() Date: Mon, 14 Apr 2014 21:53:36 +0530 Message-Id: <212d5ff77b5ffef9d80b1f3d7d0bb5f42cb2ffc6.1397492345.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.174 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 3dc31f5..3bd9f9c 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -236,18 +236,29 @@ static bool tick_check_preferred(struct clock_event_device *curdev, if (!tick_check_percpu(curdev, newdev, smp_processor_id())) return false; - /* 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); }