Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3608791pxu; Sun, 20 Dec 2020 08:44:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzuxFMljjfCGg1qRbWt1zVq0QfiS9F9qxPL9BDpXgvb+1nRbjANkGrT6hG6EgxENJvfPvD X-Received: by 2002:aa7:c492:: with SMTP id m18mr12810912edq.236.1608482675803; Sun, 20 Dec 2020 08:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608482675; cv=none; d=google.com; s=arc-20160816; b=hLs9a6Mw0qAroI9DgM2cImsF58J2d+gPnaLDsMiwjXhLxuHzn7azflUq3IiLxDQaHz VGnTxs/R0Qiz6IbB1k2wdRAJsmAWbqTJRCR98D/d13lhkqVbNFYPsfXLDonsaPXm2Wfm KyRgo8iVCeqF5ePEKPNraLsksG6zsEgUdrQ5cvqmcizX9ASDNdpltZCvQxprVzkSNHxQ Z3uZGaN2pX15JApAqMzEsS6FlYkD6yq4L0u0RJD9Eku8FaKV4LYQv93aVTii77yGmxbU K0ODBltEMHY82ijEThYL0To0ga6ePNpi3UyEVoHakuHaW04LQSECzmY6B6eG1I/zNATE 5gag== 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=uMR8UsOOJm/t0/BOhlXp0IthO+C1BPZiiQ0XR2+w7ww=; b=qb3hmDXhCF4r9MtFzXeJDtK646mO9+jPhCeMSdMWt1GeNfw6bVdHsOPJA+TVWfi+ti dxF4wH1cqJi6EBwjM3A31AiWNA8LfWyvwDykQ+24d4uBc1ZmXnn/Cb+53QcJ1BkuznuO vFP5KklSM5FPqNFM0abFSat3jnCnRkuATjWSSTSCITC2hVg9xcc4H7tyuED1iFX0uz1l VZBselKd8VvAihMp+NzpcYDsVsL8m+oH9OrlJO5Qxd6YNasS+E4VD8+ihhhI5qxPCIIf /xgJ84qgCOfkmR6qoCJuFXAiamYPFMnp61I1gPCFfQ53a361blwFyblb4mvI8pmu3N3O P/tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si9375409edf.22.2020.12.20.08.43.59; Sun, 20 Dec 2020 08:44:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727683AbgLTQm1 (ORCPT + 99 others); Sun, 20 Dec 2020 11:42:27 -0500 Received: from mail-ot1-f53.google.com ([209.85.210.53]:37724 "EHLO mail-ot1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgLTQm0 (ORCPT ); Sun, 20 Dec 2020 11:42:26 -0500 Received: by mail-ot1-f53.google.com with SMTP id o11so6772504ote.4; Sun, 20 Dec 2020 08:42:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uMR8UsOOJm/t0/BOhlXp0IthO+C1BPZiiQ0XR2+w7ww=; b=tN4EttWdmxiS6dAbsrwdkDa8g0SkhM+tMitDgKwse15nmbt7NwxspFaQ/YOe3wMXqc TRmRg3OE05AbI1AgMuZsY1vrRjFpYbUOLhxchjPIEud4ooZsU9mtqWsdNKiidBZ2Nfaw NGsRzJ8SVA+r4rWTQDcHqCZ/kIKrpfTmPFO6its6kemJtZZxnBF1LQX0Q1SQBLMq7kQ3 ujGywnmNMkvHFjvZVl/cHKRVGVLe2wp/j1PCnGKMVmXTEjeupg2x3sDfgOucvqTM3SLa h1ZmpVptmpICbodn6fFtP1cZHdK4CMxJJENWSeJH9jKwY7VwI7lysNLaZmamR8xUYSHS SBKw== X-Gm-Message-State: AOAM533++AxVjw6f4PjXTKV0JMpQwvIZFr7C4Tv6ks++BIrGY86W2bPM OqJfJRi6BomaedVDNmyZVLOL0F7E908l9ERSQi8= X-Received: by 2002:a9d:67da:: with SMTP id c26mr9552050otn.321.1608482505856; Sun, 20 Dec 2020 08:41:45 -0800 (PST) MIME-Version: 1.0 References: <4600970.KDbqdY64fy@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Sun, 20 Dec 2020 17:41:30 +0100 Message-ID: Subject: Re: [PATCH] cpufreq: intel_pstate: Use most recent guaranteed performance values To: srinivas pandruvada Cc: "Rafael J. Wysocki" , Linux PM , Viresh Kumar , LKML , Len Brown Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 19, 2020 at 6:21 AM srinivas pandruvada wrote: > > On Thu, 2020-12-17 at 20:17 +0100, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > When turbo has been disabled by the BIOS, but HWP_CAP.GUARANTEED is > > changed later, user space may want to take advantage of this > > increased > > guaranteed performance. > > > > HWP_CAP.GUARANTEED is not a static value. It can be adjusted by an > > out-of-band agent or during an Intel Speed Select performance level > > change. The HWP_CAP.MAX is still the maximum achievable performance > > with turbo disabled by the BIOS, so HWP_CAP.GUARANTEED can still > > change as long as it remains less than or equal to HWP_CAP.MAX. > > > > When HWP_CAP.GUARANTEED is changed, the sysfs base_frequency > > attribute shows the most recent guaranteed frequency value. This > > attribute can be used by user space software to update the scaling > > min/max limits of the CPU. > > > > Currently, the ->setpolicy() callback already uses the latest > > HWP_CAP values when setting HWP_REQ, but the ->verify() callback will > > restrict the user settings to the to old guaranteed performance value > > which prevents user space from making use of the extra CPU capacity > > theoretically available to it after increasing HWP_CAP.GUARANTEED. > > > > To address this, read HWP_CAP in intel_pstate_verify_cpu_policy() > > to obtain the maximum P-state that can be used and use that to > > confine the policy max limit instead of using the cached and > > possibly stale pstate.max_freq value for this purpose. > > > > For consistency, update intel_pstate_update_perf_limits() to use the > > maximum available P-state returned by intel_pstate_get_hwp_max() to > > compute the maximum frequency instead of using the return value of > > intel_pstate_get_max_freq() which, again, may be stale. > > > > This issue is a side-effect of fixing the scaling frequency limits in > > commit eacc9c5a927e ("cpufreq: intel_pstate: Fix > > intel_pstate_get_hwp_max() > > for turbo disabled") which currected > corrected Right, thanks!