Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5088747rwl; Wed, 28 Dec 2022 12:51:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYkeQLE7gkywLXxprGuzpPYii6ECMA+SWnm4quo7oCJzm/NAwPcTgk2IyyHMTJlD8/v0KM X-Received: by 2002:a05:6a21:c08d:b0:a3:a90f:5326 with SMTP id bn13-20020a056a21c08d00b000a3a90f5326mr40618712pzc.61.1672260685176; Wed, 28 Dec 2022 12:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672260685; cv=none; d=google.com; s=arc-20160816; b=ubyCPw6sizG+jbolaZrvfJJHMAGiatC9/zx0ZiWXfqL6f9wNv2FGRX8bxwQTUxHra4 dZPRl6+zliAof16YNnTF+V3Iw6LWzomLSyEdJYVAOTsCb3CNmQjTkNlE0CxFJF1Stg3v YD/o/Fzq9Jr8Rw/CXC/4TiaYPVmkXIOIVKfM1aCi0Pd1VUDPvDmrpEGczK3kabW2MmOZ Qm/uHwOb2ic86xbP7SRKPWowX1eK4CRrwv7ZYMNeo92lYntlLNsMRvg12oXYH0T7RhZ3 84Ax+cUYAKssz2yamiJiEzwjKU1edqd5er/yOiQlaRFXbBNO6ETxST6ixslOD+/hwZFj 4dqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=5uBOQQYDQCIH7OuKYOssxy4KhYY8m5RLan038W/LXmQ=; b=WjekvJmT3HNFelVGslhwJ/iuvrM1BMQ5tkJ1o526lZcHqxaIbsAkPRVfJSx4GL1PaF 3dZowCNmtxV95l5oWqIa/Rc/ZdK3TLQK7MeBBJ79cKiNlrs9G95Hb1WyYTLiI7k2+T2X OyoGgHYtqnSF0OLDzPCxkfLzrLVW3NnkUxGpSlUCTwHkARsw6O8hE7O2zsdeO4O5Q/Vz 7zkK8goF81P6Co/aPwTpYvTrKK25TbXWzwnP6nUClKoOMxu64qzeeV5WUPnEACIHm7+F pC95m4W7P5OyKqrMrpIaLsSXj+wp6yik0rZ5kDsET0B46QX8xZ9sAu4bG7UNcPfr39YR wPgA== ARC-Authentication-Results: i=1; mx.google.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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o25-20020a635a19000000b0046b3ba2c806si17278303pgb.145.2022.12.28.12.51.17; Wed, 28 Dec 2022 12:51:25 -0800 (PST) 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; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231635AbiL1Ulm (ORCPT + 63 others); Wed, 28 Dec 2022 15:41:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbiL1Ulk (ORCPT ); Wed, 28 Dec 2022 15:41:40 -0500 Received: from mail-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C6C10ED; Wed, 28 Dec 2022 12:41:38 -0800 (PST) Received: by mail-il1-f178.google.com with SMTP id d10so8736112ilc.12; Wed, 28 Dec 2022 12:41:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5uBOQQYDQCIH7OuKYOssxy4KhYY8m5RLan038W/LXmQ=; b=gUgagun4p8kPK3znssZQqmHmLAY9t7WcXzRdmjlqg1W7LanXj4dPThdLA8Luq38bSW jNR1EOrb2WAlaD4XhVJoJ3/AZku76pEko39JydqScCYoMgsUU/z/WjSSYUSk+Ub6AtG1 5fOaApnd9hOku3mP8+x4HRyYmoMTasdvGk8do4G0VdnvhWWj5HJaMbQ4CZEifEOcEBA0 wBgysXoIArJ4L6ngFvfTaW2XxJBwtbA2r/uSFbMQ04ciNOfZxL9ijDStD+0cmVsHzxBn m7IBE1v+D2oMYm4h1F9VQNAumrLh+R1eNN73Yun9kM9uOw97SXtxCzswnX/u9GkZHXJt egPQ== X-Gm-Message-State: AFqh2kpNRnaZDwxdrnpViGoMCx6nm1mCacm4LnvI3U8+tkolssjYmsLY TBY5jhOT66Kthn5sdg2uiuLXGlbJlnfx2PRNHdQjJwTdfCQ= X-Received: by 2002:a05:6e02:1d8c:b0:303:814:dc0d with SMTP id h12-20020a056e021d8c00b003030814dc0dmr2830249ila.131.1672260097365; Wed, 28 Dec 2022 12:41:37 -0800 (PST) MIME-Version: 1.0 References: <12138067.O9o76ZdvQC@kreacher> <24821308109ba20d845e11caf32bede92fec5d8e.camel@linux.intel.com> In-Reply-To: <24821308109ba20d845e11caf32bede92fec5d8e.camel@linux.intel.com> From: "Rafael J. Wysocki" Date: Wed, 28 Dec 2022 21:41:24 +0100 Message-ID: Subject: Re: [PATCH v1 1/2] ACPI: processor: perflib: Use the "no limit" frequency QoS To: srinivas pandruvada Cc: "Rafael J. Wysocki" , Linux PM , Pratyush Yadav , LKML , Linux ACPI Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Tue, Dec 27, 2022 at 9:55 PM srinivas pandruvada wrote: > > On Tue, 2022-12-27 at 20:51 +0100, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > When _PPC returns 0, it means that the CPU frequency is not limited > > by > > the platform firmware, so make acpi_processor_get_platform_limit() > > update the frequency QoS request used by it to "no limit" in that > > case > > and avoid updating the QoS request when the _PPC return value has not > > changed. > > > > This addresses a problem with limiting CPU frequency artificially on > > some systems after CPU offline/online to the frequency that > > corresponds > > to the first entry in the _PSS return package. > > > > While at it, move the _PPC return value check against the state count > > earlier to avoid setting performance_platform_limit to an invalid > > value. > > > > Reported-by: Pratyush Yadav > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/acpi/processor_perflib.c | 27 +++++++++++++++++++++------ > > 1 file changed, 21 insertions(+), 6 deletions(-) > > > > Index: linux-pm/drivers/acpi/processor_perflib.c > > =================================================================== > > --- linux-pm.orig/drivers/acpi/processor_perflib.c > > +++ linux-pm/drivers/acpi/processor_perflib.c > > @@ -53,6 +53,8 @@ static int acpi_processor_get_platform_l > > { > > acpi_status status = 0; > > unsigned long long ppc = 0; > > + s32 qos_value; > > + int index; > > int ret; > > > > if (!pr) > > @@ -72,17 +74,30 @@ static int acpi_processor_get_platform_l > > } > > } > > > > + index = ppc; > > + > > + if (pr->performance_platform_limit == index || > > + ppc >= pr->performance->state_count) > > + return 0; > > Do we need to re initialize pr->performance_platform_limit to 0 in > acpi_processor_unregister_performance()? > > If PPC was 1 before the offline and after online the above check will > cause it to return as the pr->performance_platform_limit is not > changed. Not sure if the PM QOS state is preserved after offline and > online. This is stored in a per CPU variable, not in dynamically > allocated memory which will be reallocated during online again. Good point in general, but the QoS request is tied to the cpufreq policy, so it is not freed on offline. However, if the policy goes away and is created again for the same CPU (like when the intel_pstate mode is changed via its 'status' attribute in sysfs), there may be a stale value in performance_platform_limit, so it needs to be cleared in acpi_processor_ppc_init() when the QoS request is first set to "no limit". I'll update the patch accordingly. I think I'll also split it in two to avoid making too many changes in one go.