Received: by 10.213.65.68 with SMTP id h4csp2080304imn; Mon, 2 Apr 2018 00:09:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/XVbR1BGaRlbZwR4vltsj0bpNHKExUUWuAbhZyhCeYM9frqmzVe7GJZxL21tvD3ROFfaKk X-Received: by 2002:a17:902:407:: with SMTP id 7-v6mr8705086ple.47.1522652968724; Mon, 02 Apr 2018 00:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522652968; cv=none; d=google.com; s=arc-20160816; b=fL8O0jW4O9aUcOHq42WXap5+aTKOXJ/94MB1kMlsyp3a91QhTB7ovxKJBU50d+i1gZ n7PdRkb4wj7aHOuHuTp9/kKZuH9mxIJ7sxH5nrI2ar+yYqowPCzDnWx53su9UQak1hiZ +GsX7gk76QhoocKJzEhXQOXy8yrV1HhaUDYPpVu4lhWP/CF56P2hdt/TBHFWqGNkWOlT OpPPo6KEWotdfE7pg0m+aX7/hxgGmeSufQjSjQS4XKBEsri+LXHHtprnMIwL9aipoe3H P9maWHMr4lF8zTnWZ01tnX4riADNf9V6mzdrqxaiozjEU+56nVFU3S9reNdVA8Vj52AJ Xbkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=pN16oJO+u0Zj7NJ3e78LAiXeuU7qh2PNsiunUodpRXk=; b=KM906tESv6y3YKp51SBfHS0zlJLtPSjSkuBIBriUrPaLXCXC8j+7ofJmrKMF7Jv7qY Q6rRK70SPlVM1R8nwcldCmDnTuypMDy891j8vY+2CWl9mmzZYLaaQ5JidSvHnaZBvU+s Mgfb270UAfAvzqQWf0WJv/ZF7vEJ142NQ87pSjFaPVX7tBnyd3q0jHBWgHA/45eFkcor wcle+CHjk9Ab6cVBtxUZynFvid7JNFNICOY4NY7szcAyu9QBPad5DqIRe8wNdsnbDAfq LisGItddcnNCIvY8X4imUaCL2hDvWyGzttJwHzmdlwhqkXt+ZZye0wHI3E2cCinYq52S ZmgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nmiisv8L; 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 h80si10566316pfj.129.2018.04.02.00.09.14; Mon, 02 Apr 2018 00:09:28 -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=Nmiisv8L; 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 S1754241AbeDBHIH (ORCPT + 99 others); Mon, 2 Apr 2018 03:08:07 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35720 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754155AbeDBHIG (ORCPT ); Mon, 2 Apr 2018 03:08:06 -0400 Received: by mail-pl0-f68.google.com with SMTP id 61-v6so1641283plb.2 for ; Mon, 02 Apr 2018 00:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pN16oJO+u0Zj7NJ3e78LAiXeuU7qh2PNsiunUodpRXk=; b=Nmiisv8LwOFyjmAh59oxp39tgOr+mXci7m90I1YtDGbimS/ytJWzH9dFARBtQ4apZS WeJt0X+Hoevbb4xe9HYzMZJFCievpc8tRfpOKS9EF5BFnv0UAf996UUmG/bVL5GIjX3/ TlL1tRsh5cINBGmKLU+PNzQm11y3fXCgpAgPE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pN16oJO+u0Zj7NJ3e78LAiXeuU7qh2PNsiunUodpRXk=; b=tRKEaRrJCMn1CoQXRqZWflq8j+06OkwthtS9c7Mt/RWFFaicisCBtYRaxDHCZuztea UjDPCyYhR9m0DFHWnSdXlwiqm0oznjAz7BMo3+F2UyZygsAyXXpXIWjz0tpLUHlQzkSv k1T6f2M80OOn4heGqbVlKdkje5cgFCYnOwefNfxzp2po2mdI8BDu90KwfneMBCn+N7rX gw/YYmkYMxzjfPnrgNd8Z0IE7WUAJ3LluxqedQ4G9t0G+3E48ZoiOd4RKhdMRN5wbYfX q2B6diiZpzbQi9qXfAnK7TYIQ2OyItibmGgdG+WC0PV1OYrFG35VeNinltoO92bj411/ cAQQ== X-Gm-Message-State: AElRT7HQCKNsuhHkjXAseiQ1IVOL/e5/gjIbrERh0aKz5AmNE+afiYAQ CtoXgBLFsfgWXalyb2QQS6B5Kg== X-Received: by 2002:a17:902:76c3:: with SMTP id j3-v6mr3293947plt.257.1522652885753; Mon, 02 Apr 2018 00:08:05 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id i127sm30370326pfc.136.2018.04.02.00.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 00:08:04 -0700 (PDT) Date: Mon, 2 Apr 2018 12:38:02 +0530 From: Viresh Kumar To: Shunyong Yang Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Joey Zheng Subject: Re: [PATCH] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities Message-ID: <20180402070802.GE4714@vireshk-i7> References: <1522229514-14377-1-git-send-email-shunyong.yang@hxt-semitech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522229514-14377-1-git-send-email-shunyong.yang@hxt-semitech.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28-03-18, 17:31, Shunyong Yang wrote: > When multiple cpus are related in one cpufreq policy, the first online > cpu will be chosen by default to handle cpufreq operations. Let's take > cpu0 and cpu1 as an example. > > When cpu0 is offline, policy->cpu will be shifted to cpu1. Cpu1's should > be initialized. Otherwise, perf capabilities are 0s and speed change can > not take effect. > > This patch copies perf capabilities of the first online cpu to other > shared cpus when policy shared type is CPUFREQ_SHARED_TYPE_ANY. > > Cc: Joey Zheng > Signed-off-by: Shunyong Yang > --- > > The original RFC link, > https://patchwork.kernel.org/patch/10299055/. > > This patch solves same issue as RFC above. > > Patch name is changed as code is too much different with RFC above. > > Remove extra init() per Viresh Kumar's comments and only handle > CPPC CPUFREQ_SHARED_TYPE_ANY case. > > --- > drivers/cpufreq/cppc_cpufreq.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c > index 8f7b21a4d537..dc625a93a58e 100644 > --- a/drivers/cpufreq/cppc_cpufreq.c > +++ b/drivers/cpufreq/cppc_cpufreq.c > @@ -164,8 +164,18 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) > policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num); > policy->shared_type = cpu->shared_type; > > - if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) > + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { > + int i; > + > cpumask_copy(policy->cpus, cpu->shared_cpu_map); > + > + for_each_cpu(i, policy->cpus) { > + if (i != policy->cpu) I would rather do: if (unlikely(i == policy->cpu)) continue; > + memcpy(&all_cpu_data[i]->perf_caps, > + &cpu->perf_caps, > + sizeof(cpu->perf_caps)); > + } > + } > else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { It should be: } else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { > /* Support only SW_ANY for now. */ > pr_debug("Unsupported CPU co-ord type\n"); And thanks for making it work this way. -- viresh