From patchwork Tue May 27 12:59:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shashank Balaji X-Patchwork-Id: 893539 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [211.125.140.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22455271465; Tue, 27 May 2025 13:00:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.125.140.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748350823; cv=none; b=kFxxIBEHFAkprTCoTOrsi5XrkzflhMXKqRf3TdkLzwZEHgBxCJ4nDC0C/y/AHnUg9qQQlA+pjke5CI6liIiKHX7Y9RlJZJiiBTyYUe88U7mXNDPYRvxywMvTdrZh4g1vGGjhmJSbU/nS0SFU0KYpCauNackQVRagE/Ofp4/q9FI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748350823; c=relaxed/simple; bh=wz2YLWMbq4CtCNT5+hXTW4Pe3i/LH9i2UYVGXT38WoM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r2GlNfwM7yYDIIrATAvLjFn3Sy5YaNfQzTXkzdEV14WeIJ7Itg9Kb+zCM+ICf8ta10zYHj3rNwgk7O1W43hN8FmbVJPXwcqBREWL6Ebmy1qtpyRNaXyJwDaUHCZNUfquGJ1GHNHGtA+ie7u7IVmlNgJ1fhCy2eH8UAW3C/bDqqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=yC19Nsox; arc=none smtp.client-ip=211.125.140.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="yC19Nsox" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1748350820; x=1779886820; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=ESLzshhHlbbN/3D+meQ6D0p0oySo64yvRcb3j4KyjO8=; b=yC19NsoxYsR8r0yCjDdPyjg0T0OW4kO8jJ9i0Yw/+1eSr+OxDj/LK7YG Lxhypn2P3P8r3dOCMX+vMb6wHj1gTEJ6uzvrKZvWBG0ZDNscTOh6K3VNT f4+dVDydPbnRDhvm9r4yyGU16PX7MK3k62i/5apv6i8YYspxb6n7ue0oJ OiHd32F4AxUIopMZC4Vk1NDKDSj7YNXuHyQFczB0wG55nMqMsB1B/VT/+ 7dRJFUgqVK+ZnND/FN2Knv2F5e3hZMzhqy7lC5GN4V/GM/w8fYyZMoYX9 If5j9KOO0Lcl4/7URM5V9sTnRsq4Jf4ZbQyUAj6jwO2xTl9GSeDxFweou Q==; Received: from unknown (HELO jpmta-ob1.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::6]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2025 22:00:14 +0900 X-IronPort-AV: E=Sophos;i="6.15,318,1739804400"; d="scan'208";a="564893579" Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob1.noc.sony.co.jp with ESMTP; 27 May 2025 22:00:14 +0900 From: Shashank Balaji Date: Tue, 27 May 2025 21:59:09 +0900 Subject: [PATCH v2 1/2] cpufreq: userspace: set CPUFREQ_GOV_STRICT_TARGET flag Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250527-userspace-governor-doc-v2-1-0e22c69920f2@sony.com> References: <20250527-userspace-governor-doc-v2-0-0e22c69920f2@sony.com> In-Reply-To: <20250527-userspace-governor-doc-v2-0-0e22c69920f2@sony.com> To: "Rafael J. Wysocki" , Viresh Kumar , Jonathan Corbet Cc: linux-pm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Shinya Takumi , 20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com, Shashank Balaji X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1387; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=wz2YLWMbq4CtCNT5+hXTW4Pe3i/LH9i2UYVGXT38WoM=; b=owGbwMvMwCV2mPH4Ij++H1mMp9WSGDJMt8cWKLyNObR6maTwhc3XJk6ey1cuVBh9ZVeRX8JE5 bcnzR6t6ChlYRDjYpAVU2R5J7PuwkEry6avxxm+wcxhZQIZwsDFKQAT4cliZJh17mCj8v6aDeUn VCRVy1Nm68qGLDtQqvLcqCLhqmtK8QRGhrey+4KKO57M6jSawDJlhuYKnnPbt95/zhW8Ic+z912 HCwcA X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=EE1CAED0C13A3982F5C700F6C301C7A24E0EF86A When the userspace governor is used, the user intends to set a fixed CPU frequency for a policy, for whatever reason. The CPUFREQ_GOV_STRICT_TARGET flag is the required behaviour. Without this flag, the intel_pstate driver, with HWP enabled, will set HWP_MIN_PERF to the target frequency and HWP_MAX_PERF to the policy maximum, when configuring the HWP_REQUEST MSR. This lets the hardware choose any frequency between the target frequency and the policy maximum, which is not the intended behaviour. To fix this, `cat scaling_setspeed > scaling_max_freq` had to be done. With this patch, that is no longer necessary. Setting scaling_setspeed is sufficient, as expected. Signed-off-by: Shashank Balaji --- drivers/cpufreq/cpufreq_userspace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 2c42fee76daa808f0cd1c7b1ab85476e695082e9..77d62152cd386d0eea69eba347b39f055ec860ce 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c @@ -134,6 +134,7 @@ static struct cpufreq_governor cpufreq_gov_userspace = { .store_setspeed = cpufreq_set, .show_setspeed = show_speed, .owner = THIS_MODULE, + .flags = CPUFREQ_GOV_STRICT_TARGET, }; MODULE_AUTHOR("Dominik Brodowski , " From patchwork Tue May 27 12:59:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shashank Balaji X-Patchwork-Id: 892890 Received: from jpms-ob01.noc.sony.co.jp (jpms-ob01.noc.sony.co.jp [211.125.140.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BB8B27144E; Tue, 27 May 2025 13:00:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.125.140.164 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748350824; cv=none; b=FfaLS6cPoEKmbIejWTZCpR+IZZwLbk0bxf0p6ZqCo5yw0XWioa9vdJbDOUWp0+30OR/kwYo9ovcbYNTlognySqRfRvpvQ/QT1FsasGteRUOpeCctsW9yOnPlRDqYBf0AQR9np2BRCRUB8VD2Tel3DNifKl5FTXvZxrokPBDjQ8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748350824; c=relaxed/simple; bh=MEqM4vWFkkhwqxSh+gqQSgVUNNIX+HgRMV/7LAhpF48=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p6aqrcWCBJDP3DRcm5bH2LOQGNGNLf8gQVsOVaQigUvL5E5uYR5PbLMpBzU5hyn7RZGG2loaGVGUZV+xCoInu7qxyAPD52zp1nMhdJTuRBKawOWGbt1I8W5ZP58HFnC3l8weNtoiUwRTQ7IxNj/MINcC4LKK4VEyCzRl+if4nnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com; spf=pass smtp.mailfrom=sony.com; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b=IVNUtryi; arc=none smtp.client-ip=211.125.140.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sony.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sony.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sony.com header.i=@sony.com header.b="IVNUtryi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sony.com; s=s1jp; t=1748350822; x=1779886822; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=+Lxgs3He9IdDt6ifvL+tC57fCEzAPriv444VErqusZI=; b=IVNUtryiJWuouNq1l0dQWIl/runxMaBydXiYlrJSEXphR3/1hD1B7sF6 zN6VeF+lC7dPgt2LRM3dd/iD8jxFZXFiQ59ghmfzEcN8i/RCAdId6TXuE dzEaJHe40b2Atwv/saw2RCvF5YdCJppegipAoES58vWdJSb3kNVG6CSN7 zvHYiL64XzsGFkknEGckoaabfdm4CstWBP9tK6Y3HlIcjZsVc3VC6m7Cb 9vgH12h7NgtHA4MoU+uK5/0L0qiMjh+at3iDKwnCuY3lEr6mMUsHbhPiG /pvxP9IKK7qGgtorUsIZ0CgZZFnNI3fsh9bkrNU/oYekU8Li2w0YHAI5H g==; Received: from unknown (HELO jpmta-ob1.noc.sony.co.jp) ([IPv6:2001:cf8:0:6e7::6]) by jpms-ob01.noc.sony.co.jp with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2025 22:00:14 +0900 X-IronPort-AV: E=Sophos;i="6.15,318,1739804400"; d="scan'208";a="564893580" Received: from unknown (HELO [127.0.1.1]) ([IPv6:2001:cf8:1:573:0:dddd:6b3e:119e]) by jpmta-ob1.noc.sony.co.jp with ESMTP; 27 May 2025 22:00:14 +0900 From: Shashank Balaji Date: Tue, 27 May 2025 21:59:10 +0900 Subject: [PATCH v2 2/2] cpufreq, docs: userspace: mention variation in freq due to hw coordination Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250527-userspace-governor-doc-v2-2-0e22c69920f2@sony.com> References: <20250527-userspace-governor-doc-v2-0-0e22c69920f2@sony.com> In-Reply-To: <20250527-userspace-governor-doc-v2-0-0e22c69920f2@sony.com> To: "Rafael J. Wysocki" , Viresh Kumar , Jonathan Corbet Cc: linux-pm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Shinya Takumi , 20250522-userspace-governor-doc-v1-1-c8a038e39084@sony.com, Shashank Balaji X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1009; i=shashank.mahadasyam@sony.com; h=from:subject:message-id; bh=MEqM4vWFkkhwqxSh+gqQSgVUNNIX+HgRMV/7LAhpF48=; b=owGbwMvMwCV2mPH4Ij++H1mMp9WSGDJMt8d+ezrz5p8Zc4++XMZS2b/l46ZnVzqZFF0tTO+7p Ggu3qPZ31HKwiDGxSArpsjyTmbdhYNWlk1fjzN8g5nDygQyhIGLUwAm0u/N8Fcwk+PKRIbawypr JXyvf/0qVhKaJFW0UlZkhxjz9YjF7dGMDOuEvr7/d2yVp/uUvpwjCbdsHwcuu+NSv2j1mwkVM1g /7WcDAA== X-Developer-Key: i=shashank.mahadasyam@sony.com; a=openpgp; fpr=EE1CAED0C13A3982F5C700F6C301C7A24E0EF86A Signed-off-by: Shashank Balaji --- Documentation/admin-guide/pm/cpufreq.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/pm/cpufreq.rst b/Documentation/admin-guide/pm/cpufreq.rst index 3950583f2b1549b27f568632547e22e9ef8bc167..30799f734ca5568002d790c1db0ced7454bbbc8d 100644 --- a/Documentation/admin-guide/pm/cpufreq.rst +++ b/Documentation/admin-guide/pm/cpufreq.rst @@ -398,7 +398,9 @@ policy limits change after that. This governor does not do anything by itself. Instead, it allows user space to set the CPU frequency for the policy it is attached to by writing to the -``scaling_setspeed`` attribute of that policy. +``scaling_setspeed`` attribute of that policy. Though the intention may be to +set an exact frequency for the policy, the actual frequency may vary depending +on hardware coordination, thermal and power limits, and other factors. ``schedutil`` -------------