Received: by 10.213.65.68 with SMTP id h4csp227056imn; Thu, 5 Apr 2018 22:09:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+U4rFzsUwSFhIw5QRL7XK4xb1ourQM0xiXAu7yZm2cptN/Or6Q7vnjb1AkaX+Y5Aq/kb/B X-Received: by 10.101.92.129 with SMTP id a1mr12241395pgt.69.1522991383579; Thu, 05 Apr 2018 22:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522991383; cv=none; d=google.com; s=arc-20160816; b=Y/kgz3etihXdqjTrvy1vkQifjLQuYyKBuN7VQ9K85UQbpzWbWj6/e4elD1qDXavek6 +q0H4JhlAWSR6spQ3Mj8SQbf6Br1U+rV/CEXP1512PXUs2io9paVvpEt2PI3m2a88qas DU6tNr4kcyq9HUG4FjMqAb2/5nIKdr1HWX55L6SVWYgu121v5+XAFkYqHvMdNdr/S6+5 eOJtuvtdVvczcW4/JcVLOP+JJ2scmdvoUnZxU2xHBGbwszrx5GmgX/ZKloq/iTsm7mDr 0Qlv5Q14zhO4oJumMSF6CzOapOB0CzYmvCY6+MR91iNcItGYRI6/wAat86bJDb/Wkzbn ri4w== 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=MIYNwel/VDyP0xNLhbUw0Zz363e64biHzrdqjAc2eIc=; b=jOOIQczNXUDdtZafW3sUPo1aoNzUkChxGmB7gj9+ZleEYUAudgl6zQGLUDKleaJKT9 fd2Iu5c4KGw1xUQVeYYzlCijmAPbf2QUYRGD7pldZkASJjBRhkO7DLZQYoxoVFB1K1vI inSufVEtDFnqAooWcFUfVrgdVIjLN8I9aaWUilI8jAGk+tGSm2VSoTbTrEbiiQDzARnS mmBmDEM4lcYE8wMISSVPWC2UxLS4HKuEezwakAz6pxpJ2QHlfG7qJ57cfWl1OOKfBNph P/yZP7CTstbHNWu/weSJGSc4/OrBSwaStcTOq6kPKh8spVMYYkUxX0dY0/jTB4VN6jyL vGCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PqXQs9IW; 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 v23si7424333pfk.116.2018.04.05.22.09.29; Thu, 05 Apr 2018 22:09:43 -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=PqXQs9IW; 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 S1751618AbeDFFHG (ORCPT + 99 others); Fri, 6 Apr 2018 01:07:06 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36689 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbeDFFHE (ORCPT ); Fri, 6 Apr 2018 01:07:04 -0400 Received: by mail-pf0-f194.google.com with SMTP id g14so10137417pfh.3 for ; Thu, 05 Apr 2018 22:07:04 -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=MIYNwel/VDyP0xNLhbUw0Zz363e64biHzrdqjAc2eIc=; b=PqXQs9IWP9vq1HvyqJKUeKKvxkzeZaNIMKDh3kHYWn32El4Sw4URmsUXRN4yrnBMUp q10rmCpiOfbYLaXiqZ1wbuwIDWJRVj+sm1xlLFX5+NXc5bxgL2ymQZ9941A2pqrowkMW rPUPGiF20o8weijyk1qwb3mAf3hO8UeCkfc9E= 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=MIYNwel/VDyP0xNLhbUw0Zz363e64biHzrdqjAc2eIc=; b=Hqrp/5Vnb8Ii4/UgO2pIFmzXsrumb9MuYHYx2eyMSfwaY5fRPKJZgfTobOsCvv9UUS 1BLww+DlCz1HOjZVc+3nX4i9rQ585ANGAlGrX80baQDgS8LyQtMlUOgPIsg1UPd1Mzbm kHEXLctJNoTHXhFJ4GeJosX6/tUaXshQVjM80088itlq7cjKL7N6ryUC4yCkAGNRV5sO P0rpKA6maTHdXMKV/rSq/6L8e6K9Pwx7ePNKZY5OCjNgn2go051VctBD7b5jc8V/Tnxx DhLkph88eXQHbwhrMGqj31/3xpiNSzB2f2DnWBxxgRuyJcz124lXnoc78dFNE5+6kSiC 6H0Q== X-Gm-Message-State: ALQs6tATI76tKi4ekQLYMgzeZdbfSZV5PFkByiZATQkozeRAGgaLJfnU Nfl86Vuzah0/1ITM/Rwj6BT3QQ== X-Received: by 10.101.102.82 with SMTP id z18mr4155641pgv.130.1522991223976; Thu, 05 Apr 2018 22:07:03 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id g127sm9884255pgc.6.2018.04.05.22.07.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 22:07:02 -0700 (PDT) Date: Fri, 6 Apr 2018 10:37:00 +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 v3] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities Message-ID: <20180406050700.GR3572@vireshk-i7> References: <1522982629-7557-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: <1522982629-7557-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 06-04-18, 10:43, 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 perf > capabilities 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 > Acked-by: Viresh Kumar > Signed-off-by: Shunyong Yang > --- > > Changes in v3: > -Remove unnecessary wrap per Kumar's comments. > > Changes in v2: > -Add unlikely in cpu comparison per Kumar's comments. > -Fix coding style per Kumar's comments. > > Changes in v1: > -Drop RFC tag, > 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 | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c > index 8300a9fcb80c..8b432d6e846d 100644 > --- a/drivers/cpufreq/cppc_cpufreq.c > +++ b/drivers/cpufreq/cppc_cpufreq.c > @@ -167,9 +167,19 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) > NSEC_PER_USEC; > 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); > - else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) { > + > + for_each_cpu(i, policy->cpus) { > + 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) { > /* Support only SW_ANY for now. */ > pr_debug("Unsupported CPU co-ord type\n"); > return -EFAULT; LGTM. Thanks. -- viresh