Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3847005pxb; Tue, 7 Sep 2021 08:47:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4uSadwSBros2+/A7+T6zCNWqrx0mZ8CQvgY9WfVZbbbYMPyooXjJhoz/nG1Zu9k79Tpz1 X-Received: by 2002:a05:6402:2292:: with SMTP id cw18mr93711edb.109.1631029653263; Tue, 07 Sep 2021 08:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631029653; cv=none; d=google.com; s=arc-20160816; b=FG23w/O5TMaQr2YsfgcRxqjh2MjLv0Ysh2MJ8NAc8Bmcg0oRjNXUHpFLlPSWKdLHGg 5zo6Fv9VuZcEUyDDOlLVYjmGFZvpBsO/dwfYIHHUF2654Cw6KQy35klanCWYRg5kSi+g XQt3kUf30tjWibE5mlkEhV03vEacqIB6ggtWXPUga8eOPiwhICR8gZ1ShaPeRt5MHlb0 4uzdub1KkKw52ESCYsrm4Di8ixdXJBnAPSACgV7FpC8uG3MUJmb3dKUifCWWwqOKsCRo mx37N6Nrul3jW3SbQIQdHcqWXm/GBXXMxih5MrPlRyLsN+gjhT6cYB5J35l4Uo645tJu S3Wg== 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:dkim-signature; bh=JbH6kM1r7YQ2tYEJRiq5GI4cM6T8zwbtZb9Ux1TmjKg=; b=QioqLiXw6p0emDcLVlBtei2sWdISr4qViJZ0xlHDQpIyYQpe+k+VieRofpe1eQvEey 3NUreEjnFbC0G8tB//U9Htp0VF+DeZIIqI9nsuplS0l/OJVHw8RK98wzgxtAd6h3bQUw iXCzAGP9TZ2SkHmu+4R0xmqRp5OqKSpp2jBfpMMTwvuNuqMmfZMT2YYRczHkbjJmfaD0 mI+MmLxg4kulTINtQWxru9Iq+64E3TI6J+wWDgLLIeSJFEeB9frgJbrObaJeEHiQmBpk k1ZWCxt37UHS0y5SjJTr9UxZ3O4HKOF8wlSzKRC3PC1tNOhZ6IZo8NrddcBaHWTdvnko 4rLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@telus.net header.s=google header.b=gGxjKDFl; 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=telus.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si11909580eji.707.2021.09.07.08.47.09; Tue, 07 Sep 2021 08:47:33 -0700 (PDT) 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; dkim=pass header.i=@telus.net header.s=google header.b=gGxjKDFl; 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=telus.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345461AbhIGPq5 (ORCPT + 99 others); Tue, 7 Sep 2021 11:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235162AbhIGPq4 (ORCPT ); Tue, 7 Sep 2021 11:46:56 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C32C061757 for ; Tue, 7 Sep 2021 08:45:49 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id h16so20342692lfk.10 for ; Tue, 07 Sep 2021 08:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JbH6kM1r7YQ2tYEJRiq5GI4cM6T8zwbtZb9Ux1TmjKg=; b=gGxjKDFlJf/UeXdmNOL6MkGjbnVoR1m3xqw+MLyNhHd8AhrWsnCj2Axd0tVam+PuOW MpZuKWwwoEzDMK7o2GBvbJVLomg6gaW62HQOJm4pEm1jjsVy5uzwm9lGPARoeNfyfuY/ XH3pOzbfwydT+Bri39zKD77el/sVX7srAZpkyhrCpfqixAJgZ+E013xdHC8ddHeSls1s WBB9E9FLABbQmDPH2e7v39HZDmWeqGc6otzsDj7xvFIiCudu3khWk1DsJ4oEclVsBUXe cJzuz9CVx87V52sS1BhoIkNw22sGLJz80K0kdBDHjHo7Hu8qzqf4TPqshE9Ysreo4OS/ 90rw== 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=JbH6kM1r7YQ2tYEJRiq5GI4cM6T8zwbtZb9Ux1TmjKg=; b=XGu2tArGKTJR3H+qhE7hFhpfXCr6mk+I5G2uzuQugKudh0h3dcmTO3F3vBjdwtzKOd 9Xu0A8sAI81UmxgzJjbQ7CYMziT1QGzJDBpQjxVDGUxsYVIbJLgmdj5uY1GrfIGPWsAD U1AIADJ0R6Gyd6gATk6STvmxg3xGLXxpcxYCgrhYNcu0n8CzkJanoq8kk317A/VkRDYJ xFS9phrMX6S78dqklfxkquja4EaiVdhrRZ0C9plRCoii73RJ7Dx+TDN0B5HOrAmndw9M IDSRYW0OWiOZRvupLjZWCbEalvWnDL66V28kA+B7zguzq9y76wSChkPVM53hkzJgdBhG BSBA== X-Gm-Message-State: AOAM5326oVuOH0PbN1m2gHxeLr3OSZ6eVLwpiGv7qhv5xdDLWZRej+n6 L8N/06427BQc5LqgJQuqRa9ikDM8DVeX6DybeOwRRQ== X-Received: by 2002:a05:6512:1087:: with SMTP id j7mr12996802lfg.515.1631029547946; Tue, 07 Sep 2021 08:45:47 -0700 (PDT) MIME-Version: 1.0 References: <20210513132051.31465-1-ggherdovich@suse.cz> <067ee60e47a0350d01f0c3f216c1032818044b36.camel@suse.cz> In-Reply-To: From: Doug Smythies Date: Tue, 7 Sep 2021 08:45:37 -0700 Message-ID: Subject: Re: [PATCH v2] cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode To: Giovanni Gherdovich , "Rafael J . Wysocki" , Srinivas Pandruvada Cc: Viresh Kumar , Len Brown , Linux PM list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, Recent ASUS BIOS updates have changed the default system response for this old thread, rendering "intel_pstate=no_hwp" useless. It also raises a question: If BIOS has forced HWP, then how do we prevent the acpi-cpufreq driver from being used? Read on. On Fri, May 14, 2021 at 3:12 PM Doug Smythies wrote: > > On Fri, May 14, 2021 at 1:33 PM Giovanni Gherdovich wrote: > > On Fri, 2021-05-14 at 08:31 -0700, Doug Smythies wrote: ... > > > > when COMETLAKE is not in that list, can you confirm that if you go into the > > BIOS config at boot, and disable HWP from there, then intel_pstate does *not* load? > > Yes, already tested before my original reply. > > > Does it say "intel_pstate: CPU model not supported" in the dmesg log? > > That I did not check, but if I boot now with an unmodified kernel > 5.13-rc1 (i.e. without this patch): > > [ 0.369323] intel_pstate: CPU model not supported > > > The control may be somewhere around "power mangement" in the BIOS config, and > > may be called "Enable/disable Intel Speed Shift". > > Yes. > > > I'm asking because I've just checked on two Dell laptops, one Skylake and the > > other Kabylake, and the menu is there in the BIOS config to disable HWP, > > but if I disable it... nothing happens. "lscpu" shows all the hwp flags as usual: > > Motherboard here is ASUS PRIME Z490-A. > CPU: Intel(R) Core(TM) i5-10600K CPU @ 4.10GHz > > > # lscpu | grep Flags | tr ' ' '\n' | grep hwp > > hwp > > hwp_notify > > hwp_act_window > > hwp_epp > > Here, for some reason I have to do it this way (sudo) or your command > doesn't work properly. Results herein confirmed by looking at the > "Flags" output manually without filtering: > > intel_speed_shift = Disabled in BIOS: > > doug@s19:~$ sudo lscpu | tr ' ' '\n' | grep hwp > doug@s19:~$ > > intel_speed_shift = Auto in BIOS > > $ sudo lscpu | tr ' ' '\n' | grep hwp > hwp > hwp_notify > hwp_act_window > hwp_epp > > > and turbostat gives me: > > > > # turbostat -Summary -i 1 : 2>&1 | grep MSR_PM_ENABLE > > cpu0: MSR_PM_ENABLE: 0x00000001 (HWP) > > Here: > > intel_speed_shift = Disabled in BIOS: > > root@s19:/home/doug# > /home/doug/temp-k-git/linux/tools/power/x86/turbostat/turbostat > -Summary -i 1 : 2>&1 | grep MSR_PM_ENABLE > root@s19:/home/doug# > > intel_speed_shift = Auto in BIOS (the default setting) > > root@s19:/home/doug# > /home/doug/temp-k-git/linux/tools/power/x86/turbostat/turbostat > -Summary -i 1 : 2>&1 | grep MSR_PM_ENABLE > cpu0: MSR_PM_ENABLE: 0x00000001 (HWP) > > or with "intel_pstate=no_hwp" > > root@s19:/home/doug# > /home/doug/temp-k-git/linux/tools/power/x86/turbostat/turbostat > -Summary -i 1 : 2>&1 | grep MSR_PM_ENABLE > cpu0: MSR_PM_ENABLE: 0x00000000 (No-HWP) > > > Which is to say, on the Intel client machines I have, the firmware doesn't > > seem to be able to hide HWP from the OS. Buggy BIOS? Maybe, the fact of the > > matter is, I wouldn't need to add, say, KABYLAKE to that list, based on my > > experience. > > My experience (hardware) differs from yours with respect to this. > > > The other side of the issue is that, from my understanding, the > > preferred/supported way to disable HWP is to boot with intel_pstate=no_hwp, Previous correspondence was with BIOS version 1003. There have been 3 BIOS releases since then (at least that I know of), 2103, 2201, 2301, and all of them have changed the behaviour of the "Auto" setting for Intel Speed Shift Technology BIOS setting, forcing it on upon transfer of control to the OS. Where with "intel_pstate=no_hwp" one used to get 0 for MSR_PM_ENABLE (0x770) they now get 1. That was for my ASUS Z490-P Motherboard. For my ASUS Z390-A Motherboard (actually a windows 10 computer now), with an older BIOS, things still work properly for "intel_pstate=no_hwp", and while there is a newer BIOS, I will not install it as it is also not possible to rollback. I have had an escalation in progress with ASUS about this for about a month, and while they have been responsive we have communications/language issues and have yet to even agree that there is an issue. I have been working with this incomplete patch: diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index bb4549959b11..7dcc51ee56ea 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -3347,17 +3347,27 @@ device_initcall(intel_pstate_init); static int __init intel_pstate_setup(char *str) { + /* The following needs to be conditional on CPUID with EAX 6 */ + /* CPUID.06H:EAX[bit 7], which I do not know how to do. */ + /* Avoid doing checking and printing multiple times, */ + /* which I do not know why it does. */ + if(!force_load){ + if(intel_pstate_hwp_is_enabled()){ + pr_info("HWP enabled by BIOS\n"); + force_load = 1; + } + } if (!str) return -EINVAL; - if (!strcmp(str, "disable")) + if (!strcmp(str, "disable") && !force_load) no_load = 1; - else if (!strcmp(str, "active")) + if (!strcmp(str, "active") && !no_load) default_driver = &intel_pstate; else if (!strcmp(str, "passive")) default_driver = &intel_cpufreq; - if (!strcmp(str, "no_hwp")) { + if (!strcmp(str, "no_hwp") && !force_load) { pr_info("HWP disabled\n"); no_hwp = 1; } Which has troubles when HWP has been disabled by BIOS, but otherwise works well. HWP Disabled by BIOS: doug@s19:~$ sudo dmesg | grep intel_pstate [sudo] password for doug: [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-ipstate4 root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=314 intel_pstate=active intel_pstate=no_hwp msr.allow_writes=on cpuidle.governor=teo [ 0.000000] intel_pstate_setup+0x24/0x151 [ 0.000000] intel_pstate_setup+0x24/0x151 [ 0.000000] intel_pstate: HWP disabled [ 0.051278] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-ipstate4 root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=314 intel_pstate=active intel_pstate=no_hwp msr.allow_writes=on cpuidle.governor=teo [ 0.393236] intel_pstate: Intel P-state driver initializing HWP force enabled by BIOS, which is the only other option with the newer BIOS: doug@s19:~$ sudo dmesg | grep intel_pstate [sudo] password for doug: [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-ipstate4 root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=314 intel_pstate=active intel_pstate=no_hwp msr.allow_writes=on cpuidle.governor=teo [ 0.000000] intel_pstate: HWP enabled by BIOS [ 0.049205] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-ipstate4 root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=314 intel_pstate=active intel_pstate=no_hwp msr.allow_writes=on cpuidle.governor=teo [ 0.370662] intel_pstate: Intel P-state driver initializing [ 0.371590] intel_pstate: HWP enabled HWP forced by BIOS, disable intel_pstate: doug@s19:~$ sudo dmesg | grep intel_pstate [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-ipstate4 root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=300 intel_pstate=disable msr.allow_writes=on cpuidle.governor=teo [ 0.000000] intel_pstate: HWP enabled by BIOS [ 0.049133] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-ipstate4 root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=300 intel_pstate=disable msr.allow_writes=on cpuidle.governor=teo [ 0.370519] intel_pstate: Intel P-state driver initializing [ 0.371451] intel_pstate: HWP enabled doug@s19:~$ cat /sys/devices/system/cpu/cpu5/cpufreq/scaling_driver intel_pstate HWP forced by BIOS, disable intel_pstate:, unpatched kernel 5.14: doug@s19:~$ sudo dmesg | grep intel_pstate [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-stock root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=300 intel_pstate=disable msr.allow_writes=on cpuidle.governor=teo [ 0.049108] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-stock root=UUID=0ac356c1-caa9-4c2e-8229-4408bd998dbd ro ipv6.disable=1 consoleblank=300 intel_pstate=disable msr.allow_writes=on cpuidle.governor=teo doug@s19:~$ cat /sys/devices/system/cpu/cpu5/cpufreq/scaling_driver acpi-cpufreq doug@s19:~$ sudo rdmsr 0x770 1 Observe the driver ended up as acpi-cpufreq, but with HWP enabled. ... Doug