From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADB9DC0032E for ; Thu, 26 Oct 2023 01:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbjJZBzr (ORCPT ); Wed, 25 Oct 2023 21:55:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjJZBzq (ORCPT ); Wed, 25 Oct 2023 21:55:46 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B094E115; Wed, 25 Oct 2023 18:55:43 -0700 (PDT) Received: from kwepemi500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SG80p2JlFzNpB9; Thu, 26 Oct 2023 09:51:38 +0800 (CST) Received: from [10.174.179.163] (10.174.179.163) by kwepemi500024.china.huawei.com (7.221.188.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 26 Oct 2023 09:55:40 +0800 Message-ID: Date: Thu, 26 Oct 2023 09:55:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 3/3] cpufreq: CPPC: Eliminate the impact of cpc_read() latency error Content-Language: en-US To: Mark Rutland CC: , , , , , , , , , , , , , , , , Ionela Voinescu References: <20231025093847.3740104-1-zengheng4@huawei.com> <20231025093847.3740104-4-zengheng4@huawei.com> From: Zeng Heng In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.163] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500024.china.huawei.com (7.221.188.100) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 在 2023/10/25 19:01, Mark Rutland 写道: > On Wed, Oct 25, 2023 at 05:38:47PM +0800, Zeng Heng wrote: > > The previous patch added this function, and calls it with smp_call_on_cpu(), > where it'll run in IRQ context with IRQs disabled... smp_call_on_cpu() puts the work to the bind-cpu worker. And this function will be called in task context, and IRQs is certainly enabled. Zeng Heng >> struct fb_ctr_pair *fb_ctrs = val; >> int cpu = fb_ctrs->cpu; >> int ret; >> + unsigned long timeout; >> >> ret = cppc_get_perf_ctrs(cpu, &fb_ctrs->fb_ctrs_t0); >> if (ret) >> return ret; >> >> - udelay(2); /* 2usec delay between sampling */ >> + if (likely(!irqs_disabled())) { >> + /* >> + * Set 1ms as sampling interval, but never schedule >> + * to the idle task to prevent the AMU counters from >> + * stopping working. >> + */ >> + timeout = jiffies + msecs_to_jiffies(1); >> + while (!time_after(jiffies, timeout)) >> + cond_resched(); >> + >> + } else { > ... so we'll enter this branch of the if-else ... > >> + pr_warn_once("CPU%d: Get rate in atomic context", cpu); > ... and pr_warn_once() for something that's apparently normal and outside of > the user's control? > > That doesn't make much sense to me. > > Mark. > >> + udelay(2); /* 2usec delay between sampling */ >> + } >> >> return cppc_get_perf_ctrs(cpu, &fb_ctrs->fb_ctrs_t1); >> } >> -- >> 2.25.1 >>