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: 160313 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15145384jad; Wed, 13 Mar 2019 23:43:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlqIVVhXD4gdT1hOBN8/QCgPTEd6k2wE0yr/Mx1a++FMVW57YTEdhEoO5hL0ib2nSRnzA+ X-Received: by 2002:a63:1322:: with SMTP id i34mr43089913pgl.208.1552545815574; Wed, 13 Mar 2019 23:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552545815; cv=none; d=google.com; s=arc-20160816; b=tYmYiC7jyxcglB9YMzKnjcL/2882pom+NwZvGKz3uiLHpwP6qyVQTqayW/fUpAunD8 Vrn0maxQToOx907ZW3DqjS064Owm7I+2cXTXTr1DWkZBVxuh8kP9A8nllo534tJ52pBF /cu0rDHOAhj5kOdMD62qnLrXGuBwJbo4CdLw2ecxjQXF3EEk4QpcN70AloghnOOyYG86 GBCoEhvhl9iUqYScRfpjDF5T9+JVE/9y9yatflhS/gcalAmWMK4C3uzmEgMyZ/nAlAgE I74ABvXJYH3zk/tTvgt4Bul0FP2Ywo0kljx0RgvoTmX1n505Y9C+SNLxsapo7ztr8bZ6 eSiw== 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=gau8qlK9lYlCkFsnqnqItN7NoeHxD4E7ZSFErNPXgA4=; b=IU4cdXG6uspN24RpYg6p5kkMZeeopkayn0M3RB0ChLlfzQVGrlEoxovTFnH6UtVqN7 GEILyahU9r+T9ElqBu9fOvZmtbXULQl3+iwFaz4otuCPS7mdGt0+N7sx76Lz4ihxo1j1 bSHNLonNKRTsm/iXSaq5NwCkF14/Hg+g5qMKIfe5kAshdm/EgeFEMJmEots1UZgjZsEL vCvaUbpHXsciodm7IAE9BAlRAT3KMscCORxZN8RtD0MbB8D00b9BasWWUmxTlU2QZ2cr fwmgIucH6hM+xWOv96v3urrKhax+sCkdCzOW/Ikjkr3eqv6K29BZyQ5uYPo+pvNLdThZ Xpcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RLOnMQXk; 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 v3si12780459plo.147.2019.03.13.23.43.35; Wed, 13 Mar 2019 23:43:35 -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=RLOnMQXk; 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 S1727281AbfCNGnc (ORCPT + 31 others); Thu, 14 Mar 2019 02:43:32 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44581 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727242AbfCNGna (ORCPT ); Thu, 14 Mar 2019 02:43:30 -0400 Received: by mail-pg1-f193.google.com with SMTP id h34so3304171pgh.11 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=MUMtlg8YDLuNaD11utaqv1GpKlW3ba3N/A2uulD5s9FG/QbZIiVJJrN9T7gXse0kdH 8LWHQa5g7lr84QZzXxnAau1Eoc88wWAPrKFgM9VHDfd87YqEzri4A9DHjbM+4nFOH2WU 56e6lE+1R9cLi0+z3cMqLAOAa9lokRQMsX7J4G9C2/cQwoxDwPnoiJOPrfn5D5Q9+IYg sD4mQwbMUrF5DMqIeFiCAd0kYHgmAUxpIvLNHhWNDcTIh4oaDctEl/DyBVrsl7ruxazr vhpJhfHD+yQb1Z4rdlCCOyMMn/1pMN08za0CINZcQNZRckAOsGEbJIkPH+4g4vzceAvD gZtA== X-Gm-Message-State: APjAAAW9B48CbrnBlJI/I3a2EJmFQrFUxUVuQmKe0BfXXTKQuTMYUGr/ sMJmVh2jivZ7NwIi/13tpxr9Yg== 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: 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 sparc64_cpufreq_notifier() to use the new "cpus" field and update per-cpu data for all the related CPUs. Signed-off-by: Viresh Kumar --- arch/sparc/kernel/time_64.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b 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;