From patchwork Thu Mar 14 06:42:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1056374 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RLOnMQXk"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44KfLm3Z9xz9s3q for ; Thu, 14 Mar 2019 17:44:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbfCNGna (ORCPT ); Thu, 14 Mar 2019 02:43:30 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34325 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727241AbfCNGn3 (ORCPT ); Thu, 14 Mar 2019 02:43:29 -0400 Received: by mail-pg1-f193.google.com with SMTP id v12so3347410pgq.1 for ; Wed, 13 Mar 2019 23:43:29 -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=gau8qlK9lYlCkFsnqnqItN7NoeHxD4E7ZSFErNPXgA4=; b=RLOnMQXkHi2HZm4bmQA0sLNXWNQW0CH3U3TiMA50yPp92jnLFhTjR+yd+dyTIWwMuX +0oeC9HkNf2ixELn3+rAYVsWVA71CR57dJ6RM1vqxcLMTFzJc/tLNTcLE7dgC2z6me8/ EBrpOdgzVVgR8sysX8SVNbf3us+Gc05qvHGJ8midp2dXjnav8aGf3zJlRaJKOZP55FRx KgjqyV7f0vib6WBR6o5z38x8tsSi7g/r0S3OXN9aSXkavdejG+uRJM4N9LLD8AG7we1s J5CtTKAcnTjLOhKxStNjuc5E0dGEu0u80Ws4jtuqScH6JUj7NVGdMfI9GmQlfxhsfyPg UDeA== 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=gau8qlK9lYlCkFsnqnqItN7NoeHxD4E7ZSFErNPXgA4=; b=e19hhA+ejV7dMBMxa+frW3793gT+IQG1F2qb83UWQXFKJjH4m+0xwo7B+jA6ysmAFW HP4irLb8tWh7RmecFkl1sCTzRSEhYuOnBcu/fd45Gw5Ei+BDPN8/GEQmggg3BVMxWCqO dAZQntvnlOJ/hfJinqk5IEtGgDStQUK/+JJaNKhDx7IUjv8Dd+PPxUUNDWna29A4pD3y e0D5kDWWiQkE8shOxvm4GMd46YkpoZtC7awXs1quHvvJu18ngTgOqLOCUpojTi95FgGY G/DGIoFQw/d6GGU8j7zqV306RtXWsP8t+Br03Had9SgmfBIepVr9ZjovmbUGBjDx6noj FJqQ== X-Gm-Message-State: APjAAAWz1sk3GLXZujcyNDVtAHr6MnUTGsXDLe1e5iUQ4Ui8cyaIYsbU MC9XAq/LN5tjnSVh16GzCJVTbg== X-Google-Smtp-Source: APXvYqxbSJZzzKsaof7Eb4IMfSCrTvkAry2FOR9NZQQQWjLabmBf38M5lS34sLRpQAjaPQpsyzIRbA== X-Received: by 2002:a62:b61a:: with SMTP id j26mr47461072pff.151.1552545809013; Wed, 13 Mar 2019 23:43:29 -0700 (PDT) Received: from localhost ([122.166.134.37]) by smtp.gmail.com with ESMTPSA id o5sm13049375pgc.16.2019.03.13.23.43.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 23:43:28 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , "David S. Miller" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] sparc64: Update cpufreq transition notifier to handle multiple CPUs Date: Thu, 14 Mar 2019 12:12:50 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@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 sparc64_cpufreq_notifier() to use the new "cpus" field and update per-cpu data for all the related CPUs. Signed-off-by: Viresh Kumar Acked-by: David S. Miller --- arch/sparc/kernel/time_64.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index 3eb77943ce12..23544646695f 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c @@ -653,19 +653,23 @@ static int sparc64_cpufreq_notifier(struct notifier_block *nb, unsigned long val void *data) { struct cpufreq_freqs *freq = data; - unsigned int cpu = freq->cpu; - struct freq_table *ft = &per_cpu(sparc64_freq_table, cpu); + unsigned int cpu; + struct freq_table *ft; - if (!ft->ref_freq) { - ft->ref_freq = freq->old; - ft->clock_tick_ref = cpu_data(cpu).clock_tick; - } - if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || - (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { - cpu_data(cpu).clock_tick = - cpufreq_scale(ft->clock_tick_ref, - ft->ref_freq, - freq->new); + for_each_cpu(cpu, freq->cpus) { + ft = &per_cpu(sparc64_freq_table, cpu); + + if (!ft->ref_freq) { + ft->ref_freq = freq->old; + ft->clock_tick_ref = cpu_data(cpu).clock_tick; + } + + if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || + (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { + cpu_data(cpu).clock_tick = + cpufreq_scale(ft->clock_tick_ref, ft->ref_freq, + freq->new); + } } return 0;