From patchwork Thu Mar 14 06:42:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 160311 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15145275jad; Wed, 13 Mar 2019 23:43:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkmf5sZsKhUl7+TvHUGkNyK+zNzhVFsoLCgQ7fRFbr0ibeJRhuqEfoNkI+hCxy6HxudkBY X-Received: by 2002:a17:902:b201:: with SMTP id t1mr13686855plr.55.1552545809090; Wed, 13 Mar 2019 23:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552545809; cv=none; d=google.com; s=arc-20160816; b=AjC8JARCUqsr2cpu1KhX8yGzvgFLYUFVVTaRShdXcn8/xk5pjmeZcLHlaUJtYNvcsM DDSG+h76txqdAspdvDAUP393aMvNvj6+jBQ3/mtLCUhYnWwamhDu+7KmVR0ax3UsL/Tw bEZexhUVIJZmcJVHls1hXOJt2OzI0ZCowBJtJ0QTxTkz9BSwO/MjQPr3GsMSznWFqoU2 g6oMr46BEbQlspUSCAXDoTX9+1CCeQq+etzEaZEKIxkk1LCu1J7UmTN3V6EEET7K5geS ZoHnWID3TAhi/TrVVbECZ7J4ecCiAlt7dxwUkHBB5KASSW6ahAEptYuS+tNd423RSn2v Od1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lorcbNHNRFiGuz7eBUCSVribuTSrEkumL8TszzbxjzE=; b=okxLDKnmASVREwjAGUtiQdTBc9zb0SFiQl7ijm0jP2pRlx8mV8eAXZVta9d9VLsDo5 e/uD/u8ROnsAAbZhK6uEa5RcywwzboPG0rUiiRjEqQwbXoVKsPQhFeVZiGOwOH7xOjA4 3flN6OmYeZ0szzOjFrOIskJJcAWOkvL9IT4VH+ClxoCG5xu/v9t84H4V9vyD254YjRG+ wullHIDLFrzEfbJhv+HG9Z++WY7CX0wsOAb2fdKSAVGipuh/GVLdiQLxfw2Bt29gZMun HwlB37OlFCRBwKVgtfRatgiWkCLFpCaLsmGigmIt5hF89WoKy8Itv7ODllUo+UJ+XCNU W8ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RAUy/ZE/"; 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 a15si11723742pgg.560.2019.03.13.23.43.28; Wed, 13 Mar 2019 23:43:29 -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.s=google header.b="RAUy/ZE/"; 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 S1727214AbfCNGn1 (ORCPT + 31 others); Thu, 14 Mar 2019 02:43:27 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34311 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbfCNGnX (ORCPT ); Thu, 14 Mar 2019 02:43:23 -0400 Received: by mail-pg1-f193.google.com with SMTP id v12so3347240pgq.1 for ; Wed, 13 Mar 2019 23:43:23 -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 :mime-version:content-transfer-encoding; bh=lorcbNHNRFiGuz7eBUCSVribuTSrEkumL8TszzbxjzE=; b=RAUy/ZE/2HUVSglg0pbU6Z/RrAdT63TPxc7bUux3usECJno//O90wuudOKDCcvBCtx xTAJIZqajAEKv1st0pog2fnZG47Mxm3N3NhF7H0TNIF8kvedGrvu//HObZRKeUMkXTHw V+jmHs/DlShzFtQvesKJdHHvm9SiMcg56285396HhWSDi9pFH2bwLcxjaYQCKHevb/r+ NjAQS0v8ZaCje2Q6MUsVztwhgzGaKa2tmiqDpxW/5Q+lANxvrVLOZ/pyi3d4pIQEE/mJ OtCx9am3vcsp11RzES7y6vGGI9XQg7xAogBQiIm8p+SwrBW6POGBp+/pZzYimSv4dKa8 90Pg== 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:mime-version:content-transfer-encoding; bh=lorcbNHNRFiGuz7eBUCSVribuTSrEkumL8TszzbxjzE=; b=fLFXA85wHQR4CXamBJ7eBfma33wxJb3uWQx1iFvC6rNWQSODiDBH8lXQSXQu2USC72 mFt7S4EqiETFt2cSrd+rYUWXaD8XLsC4qf10lhqBLeFYx1dgxkBCeE4gCkmMsNVeYNtx LPiPTsD5UvX8doyg3G+LUXbCabaPRZD7l5V6L6JOXldcH31xJ/WdTCd2/dyznxXFGukH LS+3GWb2f6ogTpG/kqyYBpD2hOnbQX7TRkGwMvZltweLKaf5kkKNXXeMKCrtYCHv3Ld9 OK7671ZGTNqtu2SbOJXvR5NH43BUE49nN8aYUKp3Xs9Dg4TmrfNaDwYXS40+DTg/oQLi d44Q== X-Gm-Message-State: APjAAAVm3ahpBbmd8z0O/WBbTJPogTn7S5iffhqbvXEq0vAgVUtnNDE+ JtdpOmjabt2hoMLSUJ2aO1P0kQ== X-Received: by 2002:a65:41ca:: with SMTP id b10mr43786224pgq.146.1552545802717; Wed, 13 Mar 2019 23:43:22 -0700 (PDT) Received: from localhost ([122.166.134.37]) by smtp.gmail.com with ESMTPSA id k125sm46777131pgc.51.2019.03.13.23.43.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 23:43:22 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Russell King Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] ARM: smp: Update cpufreq transition notifier to handle multiple CPUs Date: Thu, 14 Mar 2019 12:12:48 +0530 Message-Id: <4bcc5e47e3b5959e9b1e21578323a84dc9a3c79a.1552545525.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq core currently calls the cpufreq transition notifier callback once for each affected CPU. This is going to change soon and the cpufreq core will call the callback only once for each cpufreq policy. The callback must look at the newly added field in struct cpufreq_freqs, "cpus", which contains policy->related_cpus (both online/offline CPUs) and perform per-cpu actions for them if any. This patch updates cpufreq_callback() to use the new "cpus" field. Signed-off-by: Viresh Kumar --- arch/arm/kernel/smp.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 1d6f5ea522f4..59ee0f4db449 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -758,15 +758,19 @@ static int cpufreq_callback(struct notifier_block *nb, unsigned long val, void *data) { struct cpufreq_freqs *freq = data; - int cpu = freq->cpu; + int cpu, first = cpumask_first(freq->cpus); + unsigned int lpj; if (freq->flags & CPUFREQ_CONST_LOOPS) return NOTIFY_OK; - if (!per_cpu(l_p_j_ref, cpu)) { - per_cpu(l_p_j_ref, cpu) = - per_cpu(cpu_data, cpu).loops_per_jiffy; - per_cpu(l_p_j_ref_freq, cpu) = freq->old; + if (!per_cpu(l_p_j_ref, first)) { + for_each_cpu(cpu, freq->cpus) { + per_cpu(l_p_j_ref, cpu) = + per_cpu(cpu_data, cpu).loops_per_jiffy; + per_cpu(l_p_j_ref_freq, cpu) = freq->old; + } + if (!global_l_p_j_ref) { global_l_p_j_ref = loops_per_jiffy; global_l_p_j_ref_freq = freq->old; @@ -778,10 +782,11 @@ static int cpufreq_callback(struct notifier_block *nb, loops_per_jiffy = cpufreq_scale(global_l_p_j_ref, global_l_p_j_ref_freq, freq->new); - per_cpu(cpu_data, cpu).loops_per_jiffy = - cpufreq_scale(per_cpu(l_p_j_ref, cpu), - per_cpu(l_p_j_ref_freq, cpu), - freq->new); + + lpj = cpufreq_scale(per_cpu(l_p_j_ref, first), + per_cpu(l_p_j_ref_freq, first), freq->new); + for_each_cpu(cpu, freq->cpus) + per_cpu(cpu_data, cpu).loops_per_jiffy = lpj; } return NOTIFY_OK; }