Received: by 10.213.65.68 with SMTP id h4csp77003imn; Thu, 5 Apr 2018 18:11:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx48IyCv2k6U5GU2t3yIhn+LV4bUp+qlRZEdNbADXF7Kb0Xh13lNsBm48X8L0sCbT1BMoEqZ2 X-Received: by 10.167.128.2 with SMTP id j2mr18890918pfi.179.1522977103001; Thu, 05 Apr 2018 18:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522977102; cv=none; d=google.com; s=arc-20160816; b=CEKfSyDq6EFJ+N/iLESGUgKgJJALTSLV+T1zSupcKl81fXp1Kgoq1rQnKm/iX2Y/uj FdqrmsANBVW535fxQlLSh0xhJGDIZTy5yxIrh8UNeYZJK/cx1i57PuPszmDvWe0Qy+rZ jiYv7svy+VqxT5RnWUPq1AlNDczh4OlKaCz/1H+BCjdLMM3fg42g5QphCkihr99qQ1mW QPCS0yGnISumEBM1URVWi+c6FzUCWnptgBMm0QtKLfTr5YUCFnMn7k5OyyzNd5NAjhka y/Ji0sp46j7ho/6qYWYNrxvX+U1m2T6oyYdRoqNBUfdPMnkZwtLRuxNfyHGRvRDPNzwr bI8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=i7UJY43B/VCK38qqcXPOQXcZlpqHhD7Z9+7h/EalanI=; b=kYvTE2Gns9jIIEGnTFns0PCGQqhomByulXltaQ8J7Mmr34JTFYBU+aOti/r9JmcF1c OeEzqrgqDujrTVT3jkW8NPkszYdZM98YAsZPrYs6c7UeBI0laDek60z5Z4sh4s2XNJau 18gpIWD1S40al32mqrgFN+T6OgF5Bvr0PWVR4by+RwCf08YiwLeEbWC1WG+cp+w1f0rF yEL5TwuB5bTiH7IgoafcEEOe8SSRrg/OouDuXUOg4E/hDOn1Vzngr8yS/G40i2kPjD/H hxNYDdaafiJHsf1Rm7L3oOTFhR3v85nO3sbtikxDah36Zva++9d2AFzoodQ2Q+e/ABt7 MckA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z127si5134203pfb.397.2018.04.05.18.11.29; Thu, 05 Apr 2018 18:11:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751538AbeDFBKM convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Apr 2018 21:10:12 -0400 Received: from mx01.hxt-semitech.com.96.203.223.in-addr.arpa ([223.203.96.7]:54746 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751482AbeDFBKK (ORCPT ); Thu, 5 Apr 2018 21:10:10 -0400 X-ASG-Debug-ID: 1522977005-093b7e10b331920001-xx1T2L Received: from HXTBJIDCEMVIW02.hxtcorp.net (localhost [10.128.0.15]) by barracuda.hxt-semitech.com with ESMTP id cGl8hRRdhQTbmvZx (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 06 Apr 2018 09:10:05 +0800 (CST) X-Barracuda-Envelope-From: shunyong.yang@hxt-semitech.com Received: from HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) by HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) with Microsoft SMTP Server (TLS) id 15.0.847.32; Fri, 6 Apr 2018 09:10:07 +0800 Received: from HXTBJIDCEMVIW01.hxtcorp.net ([fe80::f451:a443:c0b5:87d1]) by HXTBJIDCEMVIW01.hxtcorp.net ([fe80::f451:a443:c0b5:87d1%12]) with mapi id 15.00.0847.030; Fri, 6 Apr 2018 09:10:07 +0800 From: "Yang, Shunyong" To: "viresh.kumar@linaro.org" CC: "linux-kernel@vger.kernel.org" , "Zheng, Joey" , "linux-pm@vger.kernel.org" , "rjw@rjwysocki.net" Subject: Re: [PATCH v2] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities Thread-Topic: [PATCH v2] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities X-ASG-Orig-Subj: Re: [PATCH v2] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities Thread-Index: AQHTy/XJXfOHf7atGkaXAZEUhTEY6KPv42oAgAKGiwA= Date: Fri, 6 Apr 2018 01:10:07 +0000 Message-ID: <1522977004.8366.11.camel@hxt-semitech.com> References: <1522833380-18438-1-git-send-email-shunyong.yang@hxt-semitech.com> <20180404103600.GJ3572@vireshk-i7> In-Reply-To: <20180404103600.GJ3572@vireshk-i7> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.127.0.11] Content-Type: text/plain; charset="iso-8859-15" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Barracuda-Connect: localhost[10.128.0.15] X-Barracuda-Start-Time: 1522977005 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.5020 1.0000 0.7500 X-Barracuda-Spam-Score: 0.75 X-Barracuda-Spam-Status: No, SCORE=0.75 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.49625 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Kumar, On Wed, 2018-04-04 at 16:06 +0530, Viresh Kumar wrote: > On 04-04-18, 17:16, 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 > > Signed-off-by: Shunyong Yang > > --- > > > > 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 | 15 +++++++++++++-- > > ?1 file changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/cpufreq/cppc_cpufreq.c > > b/drivers/cpufreq/cppc_cpufreq.c > > index 8f7b21a4d537..679e43b9c980 100644 > > --- a/drivers/cpufreq/cppc_cpufreq.c > > +++ b/drivers/cpufreq/cppc_cpufreq.c > > @@ -164,9 +164,20 @@ 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); > > - 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)); > I think this can be written in two lines without violating the 80 > columns rule. The memcpy() is split in three lines (the three "+"). And I rechecked it by downloading from https://patchwork.kernel.org/patch/10322305/ and apply to code. The maximum column number is 59.? And I re-run checkpatch.pl and it passed. I am not sure why it is over 80 columns in your tool.? > > > > > + } > > + } 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; > Acked-by: Viresh Kumar Thanks for your ACK. Thanks. Shunyong. >