From patchwork Fri Jul 28 06:46:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 9867897 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D22460382 for ; Fri, 28 Jul 2017 06:48:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 316D42889F for ; Fri, 28 Jul 2017 06:48:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26661288A2; Fri, 28 Jul 2017 06:48:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B352889F for ; Fri, 28 Jul 2017 06:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751071AbdG1GsV (ORCPT ); Fri, 28 Jul 2017 02:48:21 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:37830 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751788AbdG1Grw (ORCPT ); Fri, 28 Jul 2017 02:47:52 -0400 Received: by mail-pg0-f45.google.com with SMTP id y129so107416193pgy.4 for ; Thu, 27 Jul 2017 23:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=pXPIZ8LBfCHSI9VidJD+t0/ReHxsMA1X/FM5BhkTpxA=; b=MxppJz84Fczac+cr87LTQzU0hvy9QpTPdU6njeXX/sIheo9ZOsafJNru+BTQqk3mHx 3YNNlKaoBBjzxxvdr9cS9ExyGASx/HBpD0c5Bed+jkMpLUtNHKI7JS47dmrmjry6l/jD MpF8h6KFbTaRA5rbQJw+vR24VOxzXSQkMRa0k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=pXPIZ8LBfCHSI9VidJD+t0/ReHxsMA1X/FM5BhkTpxA=; b=oHvLXqUk+BBSGhS5InJd7Ex0i4063F2X99erIzssXMyh7/LNZSE3xF8eQ8NusnIF7K WCDamdwNceYZTENtEH2rIN9L5TpII7YHw0Jecru9gCuuK84Yk1xDAYPDdIa4Sc7Ma7wu ULelLwsSzJaJ6+GnfBl8Dnc9qAIi/U0MIxO01ij47NzzlNnP+Xkb0UDjCxIwS62W5KkO o8cYpbtivDEYlnvb14T7fIAw6lxS7/6sL0fCfwIeGrmm4KagKDIT7pCYZGhtZDh2qkOr 0a9Nwhn6pyBVYQEjvdq0wsMgNd41iVHcGI08Vlc1ahcIxbo8G8jE01Du70XI9VW+luFP F48g== X-Gm-Message-State: AIVw1122qz1t0tBQdgUZ/h7vz07Xd99CSfCKJOMn2qPUuutDCtdPkB8k eTaIJYI+3ooqNagQ X-Received: by 10.98.155.133 with SMTP id e5mr6520573pfk.186.1501224471669; Thu, 27 Jul 2017 23:47:51 -0700 (PDT) Received: from localhost ([122.171.79.89]) by smtp.gmail.com with ESMTPSA id l17sm39411221pfk.146.2017.07.27.23.47.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jul 2017 23:47:51 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Peter Zijlstra , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, skannan@codeaurora.org, joelaf@google.com, linux-kernel@vger.kernel.org Subject: [PATCH V5 2/2] cpufreq: Process remote callbacks from any CPU if the platform permits Date: Fri, 28 Jul 2017 12:16:39 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On many platforms, CPUs can do DVFS across cpufreq policies. i.e CPU from policy-A can change frequency of CPUs belonging to policy-B. This is quite common in case of ARM platforms where we don't configure any per-cpu register. Add a flag to identify such platforms and update cpufreq_can_do_remote_dvfs() to allow remote callbacks if this flag is set. Also enable the flag for cpufreq-dt driver which is used only on ARM platforms currently. Signed-off-by: Viresh Kumar Acked-by: Saravana Kannan --- drivers/cpufreq/cpufreq-dt.c | 1 + include/linux/cpufreq.h | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index fef3c2160691..d83ab94d041a 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -274,6 +274,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) transition_latency = CPUFREQ_ETERNAL; policy->cpuinfo.transition_latency = transition_latency; + policy->dvfs_possible_from_any_cpu = true; return 0; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index b3b6e8203e82..227cd0f13300 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -127,6 +127,15 @@ struct cpufreq_policy { */ unsigned int transition_delay_us; + /* + * Remote DVFS flag (Not added to the driver structure as we don't want + * to access another structure from scheduler hotpath). + * + * Should be set if CPUs can do DVFS on behalf of other CPUs from + * different cpufreq policies. + */ + bool dvfs_possible_from_any_cpu; + /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ unsigned int cached_target_freq; int cached_resolved_idx; @@ -564,8 +573,13 @@ struct governor_attr { static inline bool cpufreq_can_do_remote_dvfs(struct cpufreq_policy *policy) { - /* Allow remote callbacks only on the CPUs sharing cpufreq policy */ - if (cpumask_test_cpu(smp_processor_id(), policy->cpus)) + /* + * Allow remote callbacks if: + * - dvfs_possible_from_any_cpu flag is set + * - the local and remote CPUs share cpufreq policy + */ + if (policy->dvfs_possible_from_any_cpu || + cpumask_test_cpu(smp_processor_id(), policy->cpus)) return true; return false;