Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2605504rwd; Wed, 17 May 2023 11:52:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VfHoQkapGkTcoFJMDry5xa5CTiqf9xunwOTb0d0rVxhLy07xOhJGG5+yTDoAMSrXSJ/i3 X-Received: by 2002:a05:6a00:17aa:b0:64a:5cde:3a8c with SMTP id s42-20020a056a0017aa00b0064a5cde3a8cmr827779pfg.28.1684349548092; Wed, 17 May 2023 11:52:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684349548; cv=pass; d=google.com; s=arc-20160816; b=ZtfEWvDmpe/ACx1Ih+zMDip2BriBMXnyGDG/DUHU99M4+11JsYq1cMy24JeQgTlvWp CwQ+Bs3NonBvYBZ9IG/HacWcMZ5XYNFscW5Zulx0WR1p59cwr6Sz18uOlSfA9Btc3bNf F4xRm2aHWkb62k0T2a3NY3DMew9OE/VKFfbMj90/KKsdGsM/lCHLATaQUIOCTsH3c0b5 aSfFM8Rk2E0zp+74k0WvrT6jurPxkxzD1fXS+W1QIliIQekrvc7PusBtsEPPPGC/yYDC SoKAJoDBsYCiKwTBGqEekyS2IQhpOOkmlOBM/HwaVrhIZS40qX5gn+Onej5ZEahjgJRD xltA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=8jwk5sdu2r1XQw/Thhonmb0ignVWwQGaF8KnTBdNgus=; b=cSjrYmVzXDN+38RAyklUJKEJSJDdKmOKv++R1OGGN9Wd1IX2eltoCyl+WVion9ZAQd ibwO5Q2AWURzjjhadVo9K5cJ/1P6sNILCKWJzzschwTRYT8txxcLpIaIWG1jjKYGuHRs XyExmlUDF7EFaToWuxcPxFBQ80innV+ASAgMFaVihzX6vIOIVQFYyU3NWgMx3XPFklEL urpPkC4XJF2dqv+VlrYN5BnmjeGdGkHBcHN1ERg7VU1NFKt8x/x+V+/E5/J0oE728aVO Vb7uw8mIL08ZhJKRrahxjBvKwbrKtCOrwCsTCjInkILWf5K/9ojHIKbz0rEmkGonn9Ie z8uA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=A5Vo8NjY; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020aa79561000000b0063b8ab7f91csi22431174pfq.365.2023.05.17.11.52.14; Wed, 17 May 2023 11:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=A5Vo8NjY; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjEQSrE (ORCPT + 99 others); Wed, 17 May 2023 14:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjEQSrC (ORCPT ); Wed, 17 May 2023 14:47:02 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2109.outbound.protection.outlook.com [40.107.100.109]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC386171A; Wed, 17 May 2023 11:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J8FURW91Ou9lD9vZyBsCR+OyIHPUiF/jPVKN1ZUpVeCUBuIxJGc/4ypcnpbjkgPT2Fz6etOZJsiG6VU3AdZt+Esp5f5L/Lz+1tV4CLEiJYFdIdvI4zcO8Dr4nTS6s5vLHHODsEuz5gyPyedYfxPxd6Vr2JqOL4aAuOIeM3pET7r4e5OQqlMZY2Mzd3Fafx1t2tRz9JkbVa/u/Ceh3AS+WxD5tnW5RcrMyFKUSmwQZnYyc9aKHoh9r7gpQvvD+JUmzA0ZIrGtg09Eze8JnO6HQ8SPorAg2n5vHeTyu0vrsHCSBSt5WLece+v5RHKRIrgcC4nctb8DgjeMMyAZhpWYXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8jwk5sdu2r1XQw/Thhonmb0ignVWwQGaF8KnTBdNgus=; b=ZYvY1Yslj1bwJbLg78t+6/lqj3Hj6CnZzYBcDkEETNv3Uu56wVOQTdVvl4+HVOU+8+gs8mV025WHrRI3eTB/hh1bI/LZ4jEQMMsvMyiB6KQBYy8T2nTg255b7nIMxvuXbBw2Y0HbU1BaqdKGmltY4VukAZI36hyV1LMYJdCGNMyX1RGue3S/ZkVozYDB2Zwp/oJND7O4p4LrAn1Uzmpn7VcJ1M6ZIwK2lYzPSnOkesGh9nPw1uh5Ht9IJeJs1gcZgYXgFwrt55G4Sz7FVagk0V9d6zyGKA1M1T1l3V+4A65DSGsmBKtCdL0FrXtSIZxbiPdD3P1t6E074lnYJMmksw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8jwk5sdu2r1XQw/Thhonmb0ignVWwQGaF8KnTBdNgus=; b=A5Vo8NjYjhajzTab8lsUIJAZ3OJTjlDWuJPtOyx9s0M4kgpYB+J1adQecygyEMeFC57tphIlry5sePYKpjVxcm6muaMUpe273XstSOGMzzjZoULc9A5A0FaI+VTd8fqewuripYixYNiP44ZiEUGPSpNi2Ijp2ls0SC5DGADMTRM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from BL3PR01MB7027.prod.exchangelabs.com (2603:10b6:208:35a::9) by SA0PR01MB6187.prod.exchangelabs.com (2603:10b6:806:ed::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Wed, 17 May 2023 18:46:57 +0000 Received: from BL3PR01MB7027.prod.exchangelabs.com ([fe80::6df9:7381:4788:cc3a]) by BL3PR01MB7027.prod.exchangelabs.com ([fe80::6df9:7381:4788:cc3a%6]) with mapi id 15.20.6387.033; Wed, 17 May 2023 18:46:57 +0000 Message-ID: <7caa9878-c910-06f2-6eee-64cc55d8a207@os.amperecomputing.com> Date: Wed, 17 May 2023 11:46:51 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 1/2] cpufreq: CPPC: keep target core awake when reading its cpufreq rate Content-Language: en-US To: Sumit Gupta , Pierre Gondois , Zeng Heng , Ionela Voinescu Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, wangxiongfeng2@huawei.com, xiexiuqi@huawei.com, liwei391@huawei.com, linux-acpi@vger.kernel.org, weiyongjun1@huawei.com, lenb@kernel.org, viresh.kumar@linaro.org, rafael@kernel.org References: <20230516133248.712242-1-zengheng4@huawei.com> From: Yang Shi In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH2PR08CA0026.namprd08.prod.outlook.com (2603:10b6:610:5a::36) To BL3PR01MB7027.prod.exchangelabs.com (2603:10b6:208:35a::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL3PR01MB7027:EE_|SA0PR01MB6187:EE_ X-MS-Office365-Filtering-Correlation-Id: 2532e3a9-3655-437d-5a4a-08db570716e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4gsWZUt547keQW8pbBW622cBC+djUOE4QaiPldRXJy53wUCvI3w5ltQ+M2AQI1JFTHh/85wDrVJlbTgXAEVXzz6YaSfH6aAhiGHTyTs+7mhpg8gfqOe/hJo9AUcr01/5SmAAk6Iuhlli2tHn2yZnCgPUh3kEIXjrMIvddm3yfwv0Vy/tEfPvuTQRl7IOVhzCD6Qq2F17Sh3OOVeEViF1wJRauJyWm+FTFy2ZBRkeHUThMw+cz5o9Ge5cy7NN5i8NtRxkMLMt3M3OHWWq6n7LzHa7dx84bPjpd9BlxS32nA5Fd0nN1jmG05ldrdE+5PlyeICSYZHHK7meKSls1vRDvnGppaQhwScyY2mDA8iBfLYfgpiP/XevVFyecA39F8l7EdgCAsSfPJRR7iu8RKgoOL5RYHz9InxssuccJOBOMjX9XmAuUjf4fxz+dwVYAck1nApTHUnT+horHNVoprj9IBVPPTZwWzo9DlhO/1D8n+G0Jj/AuEiMh6y4BASBLVUdJc54tHpcH8J1bucL9Sj9PYfwyNFvI/NThCNXZk8JyUA1nfBfjNmjVOJR7YEoH8migEsVOzG7azUnBhUOSnjAJpm8EM1ge6I3O1c0FcIH+oF99Ti0tmADOHmnAzACJ2BgoI3PpP7FAKqiYbbDb/ZspA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL3PR01MB7027.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39850400004)(136003)(346002)(376002)(366004)(396003)(451199021)(31686004)(8676002)(53546011)(2616005)(26005)(6506007)(8936002)(6512007)(83380400001)(7416002)(41300700001)(478600001)(186003)(966005)(6486002)(66476007)(66946007)(6666004)(38350700002)(316002)(5660300002)(110136005)(4326008)(86362001)(52116002)(2906002)(31696002)(38100700002)(66556008)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bldOUkQ3U0s3dG9aYXpSUG9kS1pmOXZwamFHTE1XV09ZRjZrYUtWN3ZpWU5m?= =?utf-8?B?dlhMY1g1UnBCQkhGR3lWaFMvckFHdWZPZVBYWXIzN1I4aFgzQkZPWE5oWjBC?= =?utf-8?B?ZFQ4Q0VveG05WTQxbkI5VUgxZk8ydS93SytQbFZEeGRra28rM3RZT0Y5YlR6?= =?utf-8?B?SEJtOUgrQ2ZwajNyWVhFWXdkQkVORUx4bnpRRVAvNjJiUFFEY0o4MVg2Snpm?= =?utf-8?B?QkQwWlBWOU0vWWc4VVlGUXpKcU9OWFBhcUxyN0h1OTROdzVmVlVSdmZVQlpX?= =?utf-8?B?S0doMlYxd0RrNDkrRlc1T0gyWTVaTWJ5SktJMmxLL05uZVpUR0I4cXJtbDdh?= =?utf-8?B?OVl2RnVJcDdjZkhwTTVoM2VuR09ZYzNpWGJha0RGWHMyTnd6N3dPVEppandz?= =?utf-8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rg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2532e3a9-3655-437d-5a4a-08db570716e6 X-MS-Exchange-CrossTenant-AuthSource: BL3PR01MB7027.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2023 18:46:56.7905 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F9qMvKPfa+JgrMi642oGSIpCYu3qbAD7R6Gw4HISGJxwIAs3DCF66Kgnrmvlw66loKbNsY7/W3aC1E5r54L8UxYuzjP4RcCo/bchR+jo0g0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR01MB6187 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/17/23 8:03 AM, Sumit Gupta wrote: > > > On 17/05/23 13:47, Pierre Gondois wrote: >> External email: Use caution opening links or attachments >> >> >> +Ionela, Sumit, Yang, >> >> Hello Zeng, >> >> I think solutions around related issues were suggested at: >> >> [1] >> https://lore.kernel.org/all/20230418113459.12860-7-sumitg@nvidia.com/ >> [2] >> https://lore.kernel.org/all/20230328193846.8757-1-yang@os.amperecomputing.com/ >> [3] https://lore.kernel.org/all/ZEl1Fms%2FJmdEZsVn@arm.com/ >> >> About this patch, it seems to mean that CPPC counters of CPUx are always >> accessed from CPUx, even when they are not AMUs. For instance CPPC >> counters could be memory mapped and accessible from any CPU. >> cpu_has_amu_feat() should allow to probe if a CPU uses AMUs or not, >> and [2] had an implementation using it. >> >> Another comment about PATCH 2/2 is that if the counters are accessed >> through FFH, arm64 version of cpc_read_ffh() is calling >> counters_read_on_cpu(), and a comment in counters_read_on_cpu() seems >> to specify the function must be called with interrupt enabled. >> >> I think the best solution so far was the one at [3], suggested by >> Ionela, >> but it doesn't seem to solve your issue. Indeed, it is not checked >> whether >> the counters are AMU counters and that they must be remotely read (to >> have the CPU awake), >> >> Regards, >> Pierre >> > > I think the solution in [1] is simple and solves all the three cases. > Also, it provides better accuracy between the set and get frequency as > compared to [3]. I don't think [1] patches work for our case. We use mmio instead of AMU. Increasing delay could help to mitigate it somehow, buyt 25us is not good enough for our case. IIRC the fix proposed by Ionela works for both yours and mine. > > This can be merged and can later still be improved in Upstream. > > If OK, I can send new version by changing the patch to apply for all > ARM SoC's with AMU and not specific to Tegra. > > Thank you, > Sumit Gupta > >> >> On 5/16/23 15:32, Zeng Heng wrote: >>> As ARM AMU's document says, all counters are subject to any changes >>> in clock frequency, including clock stopping caused by the WFI and WFE >>> instructions. >>> >>> Therefore, using smp_call_on_cpu() to trigger target CPU to >>> read self's AMU counters, which ensures the counters are working >>> properly during calculation. >>> >>> Signed-off-by: Zeng Heng >>> --- >>>   drivers/cpufreq/cppc_cpufreq.c | 30 +++++++++++++++++++----------- >>>   1 file changed, 19 insertions(+), 11 deletions(-) >>> >>> diff --git a/drivers/cpufreq/cppc_cpufreq.c >>> b/drivers/cpufreq/cppc_cpufreq.c >>> index 022e3555407c..910167f58bb3 100644 >>> --- a/drivers/cpufreq/cppc_cpufreq.c >>> +++ b/drivers/cpufreq/cppc_cpufreq.c >>> @@ -837,9 +837,24 @@ static int cppc_perf_from_fbctrs(struct >>> cppc_cpudata *cpu_data, >>>       return (reference_perf * delta_delivered) / delta_reference; >>>   } >>> >>> +static int cppc_get_perf_ctrs_smp(void *val) >>> +{ >>> +     int cpu = smp_processor_id(); >>> +     struct cppc_perf_fb_ctrs *fb_ctrs = val; >>> +     int ret; >>> + >>> +     ret = cppc_get_perf_ctrs(cpu, fb_ctrs); >>> +     if (ret) >>> +             return ret; >>> + >>> +     udelay(2); /* 2usec delay between sampling */ >>> + >>> +     return cppc_get_perf_ctrs(cpu, fb_ctrs + 1); >>> +} >>> + >>>   static unsigned int cppc_cpufreq_get_rate(unsigned int cpu) >>>   { >>> -     struct cppc_perf_fb_ctrs fb_ctrs_t0 = {0}, fb_ctrs_t1 = {0}; >>> +     struct cppc_perf_fb_ctrs fb_ctrs[2] = {0}; >>>       struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); >>>       struct cppc_cpudata *cpu_data = policy->driver_data; >>>       u64 delivered_perf; >>> @@ -847,19 +862,12 @@ static unsigned int >>> cppc_cpufreq_get_rate(unsigned int cpu) >>> >>>       cpufreq_cpu_put(policy); >>> >>> -     ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0); >>> -     if (ret) >>> -             return ret; >>> - >>> -     udelay(2); /* 2usec delay between sampling */ >>> - >>> -     ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1); >>> +     ret = smp_call_on_cpu(cpu, cppc_get_perf_ctrs_smp, fb_ctrs, 1); >>>       if (ret) >>>               return ret; >>> >>> -     delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0, >>> -                                            &fb_ctrs_t1); >>> - >>> +     delivered_perf = cppc_perf_from_fbctrs(cpu_data, fb_ctrs, >>> +                                            fb_ctrs + 1); >>>       return cppc_cpufreq_perf_to_khz(cpu_data, delivered_perf); >>>   } >>>