Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp281775rdh; Thu, 26 Oct 2023 01:54:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeMnOQrM+Ofn8H7q/03RlUzXBdSo1uXErlw1cfqQDMSqdrQwqwzQfSJjtMWxvTk96WjUGG X-Received: by 2002:a25:4192:0:b0:d9a:634e:5ad3 with SMTP id o140-20020a254192000000b00d9a634e5ad3mr17570540yba.13.1698310467674; Thu, 26 Oct 2023 01:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698310467; cv=none; d=google.com; s=arc-20160816; b=nsSMWsMrUVLTD8EMiJDwiKdF6LiW6UmzcEJsBR83uEHQxrHadIvtH0vWcESv+GIjZQ 5bQzs7W2VvXIdh2Q2xgkCecE2KoycxxwG+zpAzVVWckCNnZeC33CfNKc7hTHtkzytZoD EnqIu1R4W3yHxcuR6ZUEjoR27ywTEozTbE/HjTtrYLqVKnTlXptUOHKzw12zCEacZfMc cDrW3NeU/fR4QcYML5CgARFWW4puHRkw2qGHD+ztMcUrUCmIgEWJk/82ddgLdRhZxKdI MDMjXHo+U2HND+v4U2JeFm52D6MfTHyHJAktxG6EBkCznSyhyzmCE0OVqzX1B0DwTPZp GX3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=uOfqZ1A27ImyQkpn6oCZyA2sjLUK9cxzMe9Tg2I0VZ4=; fh=ilAg3ta6CJlJo1mjpCLMVTs+sYbfOYQJQeOPrX0hii0=; b=BwKYRuKNu2kWkiwZHJlNwA8ZMnlWIaJDPQjg5pzbuwEHpBSGfhj8PRLitpTcPSkdkK LVagXKSUOmaH3QCI6iHD/n659zs0DzKtf89hH9hpQrmjmcqIYLUQMNmtdrAm9wyLe99/ 0OJS+TgGBxEiC7SUReZ7rh8o3Xlnk5Ahg5ZwyYcBpvFkCW08J95/ZztkHEJMbGkpod9a PlSxvTlXju147ND19I4pzGA8hSMW77n+d5WxJodoAvUwOJJMKXTfOFF4B+tGvSeTi5z1 VGwS1XQS41UnsyER/bxhUhJTmVjRX3He7v1W8leDBnBpMwXx5jLjhVs6vdLwzK0zAlRD GLIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n3-20020a25d603000000b00d9cee80be0dsi14312465ybg.665.2023.10.26.01.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 01:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 26AF082289B0; Thu, 26 Oct 2023 01:54:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229931AbjJZIxi (ORCPT + 99 others); Thu, 26 Oct 2023 04:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344757AbjJZIxa (ORCPT ); Thu, 26 Oct 2023 04:53:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 21DD410E3; Thu, 26 Oct 2023 01:53:27 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2F3592F4; Thu, 26 Oct 2023 01:54:08 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5154F3F762; Thu, 26 Oct 2023 01:53:24 -0700 (PDT) Date: Thu, 26 Oct 2023 09:53:21 +0100 From: Sudeep Holla To: Zeng Heng Cc: , , , Sudeep Holla , , , , , , , , , , , , , , Subject: Re: [PATCH 2/3] cpufreq: CPPC: Keep the target core awake when reading its cpufreq rate Message-ID: References: <20231025093847.3740104-1-zengheng4@huawei.com> <20231025093847.3740104-3-zengheng4@huawei.com> <20231025111301.ng5eaeaixfs3jjpg@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 01:54:22 -0700 (PDT) On Thu, Oct 26, 2023 at 10:24:54AM +0800, Zeng Heng wrote: > > 在 2023/10/25 19:13, Sudeep Holla 写道: > > On Wed, Oct 25, 2023 at 05:38:46PM +0800, 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 while cstate feature is enabled. > > > > > > Reported-by: Sumit Gupta > > > Link: https://lore.kernel.org/all/20230418113459.12860-7-sumitg@nvidia.com/ > > > Signed-off-by: Zeng Heng > > > --- > > > drivers/cpufreq/cppc_cpufreq.c | 39 ++++++++++++++++++++++++++-------- > > > 1 file changed, 30 insertions(+), 9 deletions(-) > > > > > > diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c > > > index fe08ca419b3d..321a9dc9484d 100644 > > > --- a/drivers/cpufreq/cppc_cpufreq.c > > > +++ b/drivers/cpufreq/cppc_cpufreq.c > > [...] > > > > > @@ -850,18 +871,18 @@ 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 0; > > > - > > > - udelay(2); /* 2usec delay between sampling */ > > > + if (cpu_has_amu_feat(cpu)) > > Have you compiled this on x86 ? Even if you have somehow managed to, > > this is not the right place to check the presence of AMU feature on > > the CPU. > > If AMU registers are used in CPPC, they must be using FFH GAS, in which > > case the interpretation of FFH is architecture dependent code. > > According to drivers/cpufreq/Makefile, cppc_cpufreq.c is only compiled with > ARM architecture. > Well that's true but this change doesn't belong to cppc_cpufreq.c, it must be part of drivers/acpi/cppc_acpi.c IMO and sorry I assumed that without explicitly mentioning that here. > But here, I would change cpu_has_amu_feat() with cpc_ffh_supported(), which > belongs to FFH APIs. > It is not like that. cppc_acpi.c will know the GAS is FFH based so no need to check anything there. I see counters_read_on_cpu() called from cpc_ffh_read() already takes care of reading the AMUs on the right CPU. What exactly is the issue you are seeing ? I don't if this change is needed at all. -- Regards, Sudeep