Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp357724rdh; Thu, 26 Oct 2023 04:26:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQUgH4Zu0XxiuWJcw9sRwDwEK147SMP2Sxro4p//+eD356mFJiUjj/XBpKPkt8tLqIKbKF X-Received: by 2002:a25:81c1:0:b0:da0:aac9:aa11 with SMTP id n1-20020a2581c1000000b00da0aac9aa11mr2645063ybm.12.1698319614062; Thu, 26 Oct 2023 04:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698319614; cv=none; d=google.com; s=arc-20160816; b=CPLxQnpSPFzwt7/ypvJisHX154tlnilf7mLlJXzIC3xDvgLI9/5p5s0tSXNXCmG9vR 4N02VwE4EPVlmdfLXkfxcHXxE4qoHHcjGUNMk092TnGplG6SxHaKk6lmSITcDeWc9LHR 6tMoD1yadYjQ2yNMQUukndCKxdltzrJuAxXFpSSuyLAWaBBmmxUHFNjgte5ivgWBe004 /N6K2CC8IzRIu7+q2Akx3QzazlCtC64Svpuot7l4wDPzRMdCiySWQEJQePvmPKeocPq0 haJ1cKQcw8RQcjWlU5gaOSJe4hZCUE1GI0CDvz3iwkaCrZ9GDCwBHfiLQ3BRobuorF4h Ypmg== 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=3dRYUZsnTUWA0JF/95OS2JF2yY/j5G6bKuKB5/8rdoI=; fh=RhXqtdGm40bKf7FRoFgxIsrGORYltF07tFYRacCwg98=; b=Etoc/nwKyyBochKkiPPN5PEwrZ+8Jz1rRQHU5KZFQYG/7Frk0wzOfGEdfz0Vbmelp3 pEZbcFIkqQe00CC4D6G7v24LtwsXddXFxZnoz+j52IBiVZGwFhNU8F9DYk0F8RZVjOjl ackyFRepWrCuyhc5MDfcnXFDwRzaXlmPhZR+EHkVkWKrDOEkXKOHqv/HBmWZl289P1Yd BDvGjFGokmRs1Ww9mUCvCcOxcm1MmV/xu0kCU8zGn3GPxhO/Sh44jntv34jkyjbtpKuZ Nlfi2NK/lgDP7t+aLS9piEox43HNj6WfFCfF8DKRfwSV0lb10993mng8O4A+L1dtZqju jpzA== 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:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id e68-20020a255047000000b00d9ccc92adf8si14000579ybb.96.2023.10.26.04.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 04:26:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id EC09381BB19D; Thu, 26 Oct 2023 04:26:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344699AbjJZL0k (ORCPT + 99 others); Thu, 26 Oct 2023 07:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjJZL0i (ORCPT ); Thu, 26 Oct 2023 07:26:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9DA811A6; Thu, 26 Oct 2023 04:26:35 -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 E84CA2F4; Thu, 26 Oct 2023 04:27:16 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.70.231]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB90E3F738; Thu, 26 Oct 2023 04:26:32 -0700 (PDT) Date: Thu, 26 Oct 2023 12:26:20 +0100 From: Mark Rutland To: Zeng Heng Cc: broonie@kernel.org, joey.gouly@arm.com, will@kernel.org, amit.kachhap@arm.com, rafael@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, maz@kernel.org, viresh.kumar@linaro.org, sumitg@nvidia.com, yang@os.amperecomputing.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, wangxiongfeng2@huawei.com, xiexiuqi@huawei.com, Ionela Voinescu Subject: Re: [PATCH 3/3] cpufreq: CPPC: Eliminate the impact of cpc_read() latency error Message-ID: References: <20231025093847.3740104-1-zengheng4@huawei.com> <20231025093847.3740104-4-zengheng4@huawei.com> 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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 26 Oct 2023 04:26:50 -0700 (PDT) On Thu, Oct 26, 2023 at 09:55:39AM +0800, Zeng Heng wrote: > > 在 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. Ah, sorry -- I had confused this with the smp_call_function*() family, which do this in IRQ context. > And this function will be called in task context, and IRQs is certainly enabled. Understood; given that, please ignore my comments below. Mark. > > > 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 > > >