Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp122051rdh; Wed, 25 Oct 2023 18:56:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDuin8XYAtmEoqQw1nI8oZogtqViFTTOlEcbUOru7PJ6d4UaNhIv26MGYsh+iQ6AMwKoYp X-Received: by 2002:a0d:eb8c:0:b0:5a8:8330:6f20 with SMTP id u134-20020a0deb8c000000b005a883306f20mr17566281ywe.23.1698285366534; Wed, 25 Oct 2023 18:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698285366; cv=none; d=google.com; s=arc-20160816; b=Hek+sY+oFHzDkw6NPVuMQDfQKDKp2tCgPivMeCrFgecV9Gzx5yStin00P2s66Ojsh6 hzCAAg8VpFKaoDmA0ayZsca3E5sNBFrUAiuUkVO/ud8MRqO02frF7I2smBN3YDdxkCW0 WuUAaDmsgNTA3KJCx49Vs1Ed2y+X1v2KXFIK2c170lSSCwFgMNf+EHwn7ZkJTOAWyf8k PBFYiqy9pAgH59LVnFX9uCW7sTb9BKB+vS0xeHPwu8ChlBODm1kBIhlra68EUYX6Poaf OG1B131lMM3Dqhv7H+SmPuq44h4uW5nk80Fo6QX6nS6gZB6/UD3IMJPbYLEjHWGoAztx C7RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=l5k6YPtxnrL6blIFrM1NlulNrSucUzsymSxMPY5DwVU=; fh=wHg0t/mn/RwnR8AkbjfFUU1utLc2vsaghuMnnkeNdik=; b=0SlS5aZNUzgEYtVv7K1hFxgAXofZVZyhKfuDZwF8rsXtEQWyEJjqaU8vOLXrTeAdMn rZP7NAVGkYKL0nzrEeY/cTcCA9SsbnRNgQgHeIRjxTMX4gnPd9f0Iqinwa2ICGBXI9eN O6eVjeF0QeKN/dWRtKxmNUqCs/0TuqpHXAw3Ux8sDBDyFs0jBfVya0L+KzN5J3dAqDrd oEDr/PO3I1C97UKKG7SrC+P2ovIQo0O+3QdwZAF9EgogWU6WPx+hYk42idGW5Gccxr5z GOiM2r+wseBNGCVyEhBtn1YGPAQbTzSvdu1+aEOyCR2SBbezp6wQZB9pM3V5rPwbD0rY 6VVw== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id o128-20020a0dcc86000000b0058cd28531b2si13575190ywd.435.2023.10.25.18.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 18:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D6CD3808D207; Wed, 25 Oct 2023 18:55:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230467AbjJZBzs (ORCPT + 99 others); Wed, 25 Oct 2023 21:55:48 -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 X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 25 Oct 2023 18:55:58 -0700 (PDT) 在 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 >>