From patchwork Wed Apr 20 02:39:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Muckle X-Patchwork-Id: 66164 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2202124qge; Tue, 19 Apr 2016 19:39:34 -0700 (PDT) X-Received: by 10.66.140.105 with SMTP id rf9mr8852525pab.117.1461119974270; Tue, 19 Apr 2016 19:39:34 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n76si17340902pfa.84.2016.04.19.19.39.34; Tue, 19 Apr 2016 19:39:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbcDTCjd (ORCPT + 13 others); Tue, 19 Apr 2016 22:39:33 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:33072 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbcDTCjc (ORCPT ); Tue, 19 Apr 2016 22:39:32 -0400 Received: by mail-pf0-f171.google.com with SMTP id 184so13045271pff.0 for ; Tue, 19 Apr 2016 19:39:32 -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; bh=wR3OhU1fSzgfw17o0HqmwNjEu9jBv9NlsFLO4x8HDMM=; b=cn+1ucD3TcZTLzOFXiAh+Dc1WY8ZuVX1R8oH2NS1dF2smiF4wvZRp4E11T4Y3KoNcR mb4HLX46mSuUQSuFjIyRGF2xBcOlZjCI7uPO7a2JLzieHH+gylBK+io8EVrOChBgDmMH PKc5zaz1IdePtZARVo+PyyaxVurKmyGN55v0U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wR3OhU1fSzgfw17o0HqmwNjEu9jBv9NlsFLO4x8HDMM=; b=bGvHUZaHd2rrZnIcI1/Qt3EVJ7SeV+KfvL44tsHsT7y8dB2+6di1r6fHAAc05m1KPK ua/TBQSG6HQ58mAuhoTJL8USd8h5vfipddBBejhSIYgDPMVNyxIYDsGU+QqsepSceWxs t8Pqyp2RsOKUAcZV5BK2xW7IGKtV+30iqdQ6RbJWr55PfouVQ8O5mJx3D/9+H2iUGsUA am4BpayVgyl6lqYEeWGQ6sA3UmUVgT7BRSuWjrjwCUdQvsisEfBECXxJwfY/EiEkT1Vj acrZnAlwDYnJKmv3VgnRzwur/NSMuF7nIU/lq7bhBCbGuGX42auIbVbrYgBzWo4UxWB0 iFeg== X-Gm-Message-State: AOPr4FWU2A1p7tMpEQKCxroWcCd1gqdLKJqYZY3nSxZVYKo8JqZPeYEc3jT/Lrcp5eTr0RKN X-Received: by 10.98.85.196 with SMTP id j187mr9051375pfb.50.1461119971535; Tue, 19 Apr 2016 19:39:31 -0700 (PDT) Received: from graphite.smuckle.net (cpe-76-167-105-107.san.res.rr.com. [76.167.105.107]) by smtp.gmail.com with ESMTPSA id 9sm93833526pfm.10.2016.04.19.19.39.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Apr 2016 19:39:31 -0700 (PDT) From: Steve Muckle X-Google-Original-From: Steve Muckle To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette Subject: [RFC PATCH 1/4] cpufreq: governor: support scheduler cpufreq callbacks on remote CPUs Date: Tue, 19 Apr 2016 19:39:26 -0700 Message-Id: <1461119969-10371-1-git-send-email-smuckle@linaro.org> X-Mailer: git-send-email 2.4.10 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org In preparation for the scheduler cpufreq callback happening on remote CPUs, add support for this in the dbs governors. The dbs governors make assumptions about the callback occurring on the CPU being updated. Signed-off-by: Steve Muckle --- drivers/cpufreq/cpufreq_governor.c | 21 +++++++++++++++++++-- drivers/cpufreq/cpufreq_governor.h | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 20f0a4e114d1..429d3a5b9866 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -248,6 +248,20 @@ static void dbs_irq_work(struct irq_work *irq_work) schedule_work_on(smp_processor_id(), &policy_dbs->work); } +#ifdef CONFIG_SMP +static inline void dbs_irq_work_queue(struct policy_dbs_info *policy_dbs, + int cpu) +{ + irq_work_queue_on(&policy_dbs->irq_work, cpu); +} +#else +static inline void dbs_irq_work_queue(struct policy_dbs_info *policy_dbs, + int cpu) +{ + irq_work_queue(&policy_dbs->irq_work); +} +#endif + static void dbs_update_util_handler(struct update_util_data *data, u64 time, unsigned long util, unsigned long max) { @@ -295,7 +309,7 @@ static void dbs_update_util_handler(struct update_util_data *data, u64 time, policy_dbs->last_sample_time = time; policy_dbs->work_in_progress = true; - irq_work_queue(&policy_dbs->irq_work); + dbs_irq_work_queue(policy_dbs, cdbs->cpu); } static void gov_set_update_util(struct policy_dbs_info *policy_dbs, @@ -384,7 +398,7 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy) struct dbs_data *dbs_data; struct policy_dbs_info *policy_dbs; unsigned int latency; - int ret = 0; + int j, ret = 0; /* State should be equivalent to EXIT */ if (policy->governor_data) @@ -394,6 +408,9 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy) if (!policy_dbs) return -ENOMEM; + for_each_cpu(j, policy->cpus) + per_cpu(cpu_dbs, j).cpu = j; + /* Protect gov->gdbs_data against concurrent updates. */ mutex_lock(&gov_dbs_data_mutex); diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 3e0eb7c54903..1d5f4857ff80 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h @@ -122,6 +122,7 @@ struct cpu_dbs_info { unsigned int prev_load; struct update_util_data update_util; struct policy_dbs_info *policy_dbs; + int cpu; }; /* Common Governor data across policies */