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: 10852231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FF9713B5 for ; Thu, 14 Mar 2019 06:43:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 382AB2A1BF for ; Thu, 14 Mar 2019 06:43:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C82A2A1C4; Thu, 14 Mar 2019 06:43:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CBF552A1BF for ; Thu, 14 Mar 2019 06:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=21RoNez/W0ybHzKU9DPpWK0C/o1t4iiffvjJ/IJHH2s=; b=n89Xc0exyUQks5 wN62D7bnNO1TY6cia5zcFEM6SepxuYZJ30COIW8SiEqjZd61tXcizJhxHOD5asYdf3L8JZTch09WK nGIppyh5H+9RIEoCZNZLagM+mfdjfK6sE6Vo3+Vvg7QkXHMvjyJKCymhWGSARj7UcYaJbK0Pp63ln tNvppaoXzP8ZK2WfZMbcKzhKfoNLoW/enebN+zZ/zNfoEy38qXx8SptR9MkU3XsJKNGRLyVxpSiEz Z3k3GMG8ilL6pr0HKD+yPIthI6XHI9bZZlOsevW+DgUukgo0MgQ7lAqN36x2d21RBb3sfbwcp33H2 CfIfF94Ju40WMPyNV/Uw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4K5V-0003t3-N3; Thu, 14 Mar 2019 06:43:33 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4K5L-0003bB-8r for linux-arm-kernel@lists.infradead.org; Thu, 14 Mar 2019 06:43:27 +0000 Received: by mail-pg1-x543.google.com with SMTP id 125so3299273pgc.12 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=LsVSyWY/8+kxE2FoajPPtd+G58GTfaj1CCuKvDUkVD3t8N/4xxw94H/GYw8Az9T8L4 lM298R30oqGpyeX7OUS9f8LQs+W9UjpMPp+cVwh4ldy2PXcU4Z2B/0QDKgbQLuVcxT6c OE+THUg0XDjWPmyeG+8irZWKt3FsSoo1ez7dFZ5FadKB69+kEM69LS8zrsXkgf+9FJ2I 9B51IkOJr1qxqFDxlD7sOUsh9ppETCLsJ4T/zo5uJI5ZT3NvPmKEoQxXAo91vyhVZNnQ GMeMNFpJ8TLwdnS5CnUG0MMJFACRRObxpiqDXNgUZqh/Pn3z8e5mPFAM5kGlybcTIwQr EKHw== X-Gm-Message-State: APjAAAVmjKUQMStornssEyDvVTQKf7NZGbJaU5FJYhSq4p9Ghb42IkJ2 RKKlMtaqYatjFshyPKpwT21GqQ== X-Google-Smtp-Source: APXvYqwIIW6dzmk2JsSBenA1IcKwZgqTKG0LG6o6lVpVx4PDXhvngIw7tSCMXe22PloKIQkXeduD+Q== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_234323_759272_14B50AE4 X-CRM114-Status: GOOD ( 13.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Vincent Guittot , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; } From patchwork Thu Mar 14 06:42:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10852235 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 318DE17EF for ; Thu, 14 Mar 2019 06:43:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C9E92A1BF for ; Thu, 14 Mar 2019 06:43:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1117F2A1C4; Thu, 14 Mar 2019 06:43:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 985742A1BF for ; Thu, 14 Mar 2019 06:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y+YB5PhoTqnpEvNRGSguT3sgeUjqgVvefiuPrO9ECKI=; b=YRkicqhgiIUQse D8/NpoI+wPt5gwqUtonq9xwlrrrkwVh0Ob+tJoEOdoh5gqG70tdS127mUrpgIIYgVIDFEQ1xCee/G viO2KQOoBR5Aw7hnrAb7VENb+V5QLIgxTe5qTcPsShsN9mmWOLqoHZRr6UG+OSfr/9cNeZSViyWUk y3NbhwxBed2kTsx39lxJNtPhbSxrAIyaCbXokyq5nUuZi6EIcL5rEUAHWbxEJYM/8iiRW7rPhHtWR 3f0tFqDHeKjgnhmtKpPmqI7bbfmtnZpy+O24kdTtPXE05LkxiTQZB63oEYuOKmo5RmzbIyILbeAvJ pEInaqwfB3Hme/OpCK7w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4K5f-00043b-Da; Thu, 14 Mar 2019 06:43:43 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4K5O-0003hA-H5 for linux-arm-kernel@lists.infradead.org; Thu, 14 Mar 2019 06:43:31 +0000 Received: by mail-pg1-x543.google.com with SMTP id h8so3323031pgp.6 for ; Wed, 13 Mar 2019 23:43:26 -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=qELTA4aujWEU9keNr9yQA2v0lmekRZinbYpRGs9xFkI=; b=u7Cwfo3HTNXiwKrg1Xm7VMazORbN94o2bgbSQzTbrMMH/hv2AKW3bvhAABqWicB/v4 b9asgi0FzheRGcnrFHLPLb4TWJFo6FCTgETwkXrrarLL5+LNgizsrqJnUFDCoutWuuqR 0ys3qt/rgIrjMeEOQMF1tUJbUIKoqzngo0Pw5nfz0P5pZbzD2MgMLpzU7u8vYP1AX2SE UTIQp1N9YYQv44EaDziD2yLPLUdGeRIlzbsiovemP4HQwk9YKbxdCVVb5Oquqs7roSz/ tAL1P3fwgMxIMURRzGJ2geREkGPTznTxUDRymTjz/gYQ1dthykaya/JICIL1lYNV/VBF NhsA== 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=qELTA4aujWEU9keNr9yQA2v0lmekRZinbYpRGs9xFkI=; b=MFSvoJGcrCntXWz6P9jyg/kf6sAq1mYdl2+R/EANKj20GXObyRLTD4YRtQxeaPuZWs BlOSwEU6i6AZfHd21B4jCNmlhty/bImrmoLMN5vVPVtb4prRaOhDuiQoHsP/JWM7sc2C YiZGZPuoJnqXojurRNW2MnmdGpclMnOlyfM32IdM7VdUS2EuFCSzriHi/qFBRBcAY2fa bOU8zAP7aZNmJQrmohOw2qXqVy1owINjHWbFCVE9CWsbLjalmV2DrX99XutvpAcB2OiZ qx4T8nro0Q68hyA+cv7DRCDs32JUJucpCjp/6lhxT4fiTD5M9v0A3ovgs8wgiIUvjIcO mDBQ== X-Gm-Message-State: APjAAAVmi+0LSZE22YBMfg1XxNQg//+CdcV9Jcm9+7it7tnPpxQrOlO4 h1M2mIngwg/IiPTdknIAo2MtsQ== X-Google-Smtp-Source: APXvYqzEbwwxjCug9kdh/7bejtUsTgAC7OJlUejiEL+ajhn8s2NdVFN0pvHFBtOZYPx8uOLJs3Y6tQ== X-Received: by 2002:a65:5c0b:: with SMTP id u11mr34473391pgr.352.1552545805889; Wed, 13 Mar 2019 23:43:25 -0700 (PDT) Received: from localhost ([122.166.134.37]) by smtp.gmail.com with ESMTPSA id l7sm49201244pfj.162.2019.03.13.23.43.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 23:43:25 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Russell King Subject: [PATCH 3/7] ARM: twd: Update cpufreq transition notifier to handle multiple CPUs Date: Thu, 14 Mar 2019 12:12:49 +0530 Message-Id: <3c977305886032ba871bd266d555ede47b4576fc.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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190313_234327_065239_2496D60F X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Viresh Kumar , Vincent Guittot , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 twd_cpufreq_transition() to use the new "cpus" field and run twd_update_frequency() for each online CPU present in the freqs->cpus. Signed-off-by: Viresh Kumar --- arch/arm/kernel/smp_twd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index b30eafeef096..df7db45d931b 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -162,15 +162,18 @@ static int twd_cpufreq_transition(struct notifier_block *nb, unsigned long state, void *data) { struct cpufreq_freqs *freqs = data; + int cpu; /* * The twd clock events must be reprogrammed to account for the new * frequency. The timer is local to a cpu, so cross-call to the * changing cpu. */ - if (state == CPUFREQ_POSTCHANGE) - smp_call_function_single(freqs->cpu, twd_update_frequency, - NULL, 1); + if (state != CPUFREQ_POSTCHANGE) + return NOTIFY_OK; + + for_each_cpu_and(cpu, freqs->cpus, cpu_online_mask) + smp_call_function_single(cpu, twd_update_frequency, NULL, 1); return NOTIFY_OK; }