From patchwork Thu Jul 13 06:44:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 107551 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1830716qge; Wed, 12 Jul 2017 23:45:19 -0700 (PDT) X-Received: by 10.84.225.4 with SMTP id t4mr8615215plj.274.1499928319679; Wed, 12 Jul 2017 23:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499928319; cv=none; d=google.com; s=arc-20160816; b=NlgAveS5NvM7XnpAk6MtJ94V/izpx/s84s56fTwNDMRSiNcvi0cSPaC30Qesv13xvL GBNs5ruwbEG9RoeBNjLHEtbvuVQ4pv3riyN6ifIZFbs2EFWtUfA/nsB2We3b+qadSAWu H+4SDH+6/dKxN2HSu0gVaXYWErAwlic2TcbbAU7outOhCEZLl0T9QvTTBz+sxMRwYzlK eWSb6ju/NiqwjNB0omHNajbiqI6JupCGZnO+Yhe9VgzlXo+AtJez6CSGYvBrZ5pePaVF NWb7cOFcAu2A4pvMqy0Lzg1/ytI2vIGDpkMdPfR++i5FBBYud67ZfaVDp57+za3oD97+ 1kWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=PWa4puSol83UzEvxo2xzSz5KwNctj2hY3pyQoDBR+3Y=; b=I/NAcQvh+pI8IM87Lr/sIDg8p2LCmLOzzoU3+oWTd8g9PwqWwAWg6kZQcDxnTOsb2P OA2v1hkHyeUqjNwuku/UPzt4U31d89HTfncxtbexAkV9DV2iad4QVp0WKFGJDb4FZ+0t sqeyVIsc1iT5zFlveAQQtfiDUdt49in16jqhIKftgdxbcohehkt5HkgSrXcIiw6SP3/o pOTyK7bi7mKwAQPTKTpNG1jREaIkWxOl68gLxNggo5bioVoTogVFsaIXBLqpOBYkr7Qw vTrNOrv+BlSnJ4+Z4d0CD+C6+0eVeuJb3aM65PHXx1p/VuLNl9Rxuqn0Wx/yg0OLKj3a CByQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=jvavbtok; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k124si3705765pgk.434.2017.07.12.23.45.19; Wed, 12 Jul 2017 23:45:19 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=jvavbtok; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751256AbdGMGpM (ORCPT + 25 others); Thu, 13 Jul 2017 02:45:12 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:35693 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbdGMGpL (ORCPT ); Thu, 13 Jul 2017 02:45:11 -0400 Received: by mail-pg0-f41.google.com with SMTP id j186so24809505pge.2 for ; Wed, 12 Jul 2017 23:45:10 -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=PWa4puSol83UzEvxo2xzSz5KwNctj2hY3pyQoDBR+3Y=; b=jvavbtokBsmGtRR5ZQckW2YSvTx98DwVEFBnUQ+CcxjcVgmf/PO9W/jPrQc6zdE1dC ef2k0HBUN8/Rk9/q9ZOumlKR6Ps08IUqC7Nt0JzfDb4cuyo/Fe1tk1SppExZTeGlWetV ewDo38tgAZPV+VvINQcqt/yTQ+LYGm2mNWEfo= 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=PWa4puSol83UzEvxo2xzSz5KwNctj2hY3pyQoDBR+3Y=; b=AvCFUHIFBsuRJS26xoLmX+FggAQ/XxRgUYLKaTGDMcBEuvjAdBcwn6lGAJTdl9NeSE 3psGsGPtDqR3JvM7klIBL5OD2rUnTkGeRku+U2sMiX568ZxnQFgOEqI4mmk0g+hZDYh1 5PJP9EYOhddTggslD5R8NedqaDgQqZ6fQ6yB/xyA4neaI8RfU6+bEjy7sguL7JdQlODE y7BFoslwlZsvcAFl3nd5vQC2dplUpclaq274igMUl8tAvMfxvV3QuyHUa4fgra3TCzcP 0a2V65fMdMmdG3VuUBe2Y2CpjYjMSVhXnasU+K3VL8iqBdKSlDv9DEcQ3BMGESdSOv2s DKXQ== X-Gm-Message-State: AIVw113AoDNI4mFlngOVHLyzxakV7e0H+IcOAIOTQ727JCra4L6G7WtD bFVPfRv/30bFv6zW X-Received: by 10.99.107.3 with SMTP id g3mr7549496pgc.172.1499928310468; Wed, 12 Jul 2017 23:45:10 -0700 (PDT) Received: from localhost ([122.171.81.230]) by smtp.gmail.com with ESMTPSA id o8sm7907436pgn.52.2017.07.12.23.45.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 23:45:09 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , 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, linux-kernel@vger.kernel.org Subject: [PATCH V3 2/3] cpufreq: schedutil: Process remote callback for shared policies Date: Thu, 13 Jul 2017 12:14:38 +0530 Message-Id: <3fbaa9aaba19bfff5ff25d2c4141e88fb83f1ea9.1499927699.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch updates the schedutil governor to process cpufreq utilization update hooks called for remote CPUs. The schedutil governor already has proper locking in place for shared policy update hooks and nothing extra is required to be done. Based on initial work from Steve Muckle. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index ed9c589e5386..2599e7e7a82c 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -154,12 +154,12 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, return cpufreq_driver_resolve_freq(policy, freq); } -static void sugov_get_util(unsigned long *util, unsigned long *max) +static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu) { - struct rq *rq = this_rq(); + struct rq *rq = cpu_rq(cpu); unsigned long cfs_max; - cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id()); + cfs_max = arch_scale_cpu_capacity(NULL, cpu); *util = min(rq->cfs.avg.util_avg, cfs_max); *max = cfs_max; @@ -233,7 +233,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, if (flags & SCHED_CPUFREQ_RT_DL) { next_f = policy->cpuinfo.max_freq; } else { - sugov_get_util(&util, &max); + sugov_get_util(&util, &max, hook->cpu); sugov_iowait_boost(sg_cpu, &util, &max); next_f = get_next_freq(sg_policy, util, max); /* @@ -291,14 +291,15 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, { struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util); struct sugov_policy *sg_policy = sg_cpu->sg_policy; + struct cpufreq_policy *policy = sg_policy->policy; unsigned long util, max; unsigned int next_f; - /* Don't allow remote callbacks */ - if (smp_processor_id() != hook->cpu) + /* Allow remote callbacks only on the CPUs sharing cpufreq policy */ + if (!cpumask_test_cpu(smp_processor_id(), policy->cpus)) return; - sugov_get_util(&util, &max); + sugov_get_util(&util, &max, hook->cpu); raw_spin_lock(&sg_policy->update_lock); From patchwork Thu Jul 13 06:44: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: 107552 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1830721qge; Wed, 12 Jul 2017 23:45:20 -0700 (PDT) X-Received: by 10.99.109.201 with SMTP id i192mr7820203pgc.204.1499928320050; Wed, 12 Jul 2017 23:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499928320; cv=none; d=google.com; s=arc-20160816; b=XND+c8sFADDPzh+ivF8lncr4apg+oBn0YrpIIadciEqUoxPBv8RJscqOqciPJ1ahcy 5OQsVhU2gRwCtB+pByxAeumXR1/EYU44QbHgWJjtL3WBaBfUvzkPZbz9zsr53pHmP1L3 0Z0FLe5muLP3p9R37ge5YnnEOgwe9ctOS3pbFFrphSraKhHf0PSPM/urj8Oc3MRf/M5a 6sC+2R4ibWcjB76t6VHm/mvN9UsfRwcIA3mfjoO7q2eEnaV3SqlBv0qifyTgSP0Q9ClT ornWltqXRsp/vzNBvKzu6dksowbcykOKnOs8snHdQdTUGZ3dWQrGUzNWQ8kUr2QVp46r JJTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=utGWZXaPt88H9hR02yWNRjlbalVN6rT2tBZbiutiWFA=; b=VB+ihWyA1mgp42ZIyVZ0lx1FVVt7f+Tz6aDfjYGsbzfMpvMtm5eBn6T3J6kAoY5dVB PvZVSdEVQKmnt/Ar3xE1flng4aBoMt65yTROrrueQTpCvqYGHoYDMvI0n7UpTyOcqt7v 7NJBMNQ3/CbuzuzOgNMcYPbMBPDoBUaXtzk5NYq3yXqtsaCKrZqlaqPztw4WA8MvvfB1 EwKtyYc8yOSIamoiulBx2kJot1Zz/bmDV6Y0GAbHO3R5PV+FEBzvgzRzCdjzIzFmKRip Hg0DgbX2qM60ov/K2Qxw9NhOS9J+OlVEbRpbgIQ/XpAUnxhzDahwwRi89tKzbKthRkg/ D5yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=ZXzfIe+8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k124si3705765pgk.434.2017.07.12.23.45.19; Wed, 12 Jul 2017 23:45:20 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=ZXzfIe+8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751275AbdGMGpR (ORCPT + 25 others); Thu, 13 Jul 2017 02:45:17 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35488 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751198AbdGMGpO (ORCPT ); Thu, 13 Jul 2017 02:45:14 -0400 Received: by mail-pf0-f181.google.com with SMTP id c73so24726367pfk.2 for ; Wed, 12 Jul 2017 23:45:13 -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=utGWZXaPt88H9hR02yWNRjlbalVN6rT2tBZbiutiWFA=; b=ZXzfIe+8pJkSJktWvLaaPfjyOgR7pGSzbuzWkG840dtL7zzkMYFeHZ876dt+9OMjWs pPeD4I5I+yPLcIRAo63qjA29FcTknUgDKc6qDazRou6qdrTr6e+qobL6HjEHUue6+eOh z5mE9YYFKqMC+ve2uT1ncJ3YKXz4iLEu2HEbs= 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=utGWZXaPt88H9hR02yWNRjlbalVN6rT2tBZbiutiWFA=; b=Q4IFyMgqlAqtMW1EUIjponZcg6HDJHjh6VhNSTO3quUqydXRcR/8Wl3e5amTZBvdqY fXv8dcXUftHjnvkqaifX6yAnSJvHF1N1aR42I9HSen48YJzRgmEgSwN1IHqw44DWG5/p ZJUAoyGdX2fpUf9v+pb57OTkAQwNvArkXZBP5AuV5+q17LmsmakQQSNxQv6uVa7KQ8rq TMnh/5FbtEbULSRGCeWoeosI+q/MKrQ3WcKeGXLToHPwBh6wiUjIqE26D5cE3z5MFWBm e4LApJl964mwDNN5G5911fBC13c6uXsE75ESJo/3Z5IMT7258cNRyLaX2KUGrgXaT4w0 VoQQ== X-Gm-Message-State: AIVw113uA0nq3jfc7d/I4YbOUxQcv0fZkVhe2ILR4aLfJbJi9rd38TpE d6lNMAlDYoUZ/uVS X-Received: by 10.98.133.211 with SMTP id m80mr59782860pfk.164.1499928313418; Wed, 12 Jul 2017 23:45:13 -0700 (PDT) Received: from localhost ([122.171.81.230]) by smtp.gmail.com with ESMTPSA id b13sm9482479pfc.25.2017.07.12.23.45.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 23:45:12 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , 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, linux-kernel@vger.kernel.org Subject: [PATCH V3 3/3] cpufreq: governor: Process remote callback for shared policies Date: Thu, 13 Jul 2017 12:14:39 +0530 Message-Id: <93a9001437dac267e083f4df55f68bd2e2455d47.1499927699.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch updates the legacy governors (ondemand/conservative) to process cpufreq utilization update hooks to be called for remote CPUs. Proper locking is already in place for shared policies and nothing extra is required to be done. Based on initial work from Steve Muckle. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_governor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 606b1a37a1af..0b49fc8bb91d 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -275,8 +275,8 @@ static void dbs_update_util_handler(struct update_util_data *data, u64 time, struct policy_dbs_info *policy_dbs = cdbs->policy_dbs; u64 delta_ns, lst; - /* Don't allow remote callbacks */ - if (smp_processor_id() != data->cpu) + /* Allow remote callbacks only on the CPUs sharing cpufreq policy */ + if (!cpumask_test_cpu(smp_processor_id(), policy_dbs->policy->cpus)) return; /*