public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Xi Ruoyao <xry111@xry111.site>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization
Date: Sat, 01 Jun 2024 21:03:18 -0700	[thread overview]
Message-ID: <6d5ee74605bd9574baa5ed111cb54e959414437a.camel@linux.intel.com> (raw)
In-Reply-To: <bf3ebf1571a4788e97daf861eb493c12d42639a3.camel@xry111.site>

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]

Hi Xi,

On Sun, 2024-06-02 at 11:21 +0800, Xi Ruoyao wrote:
> On Mon, 2024-03-25 at 18:02 +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > The global.turbo_disabled is updated quite often, especially in the
> > passive mode in which case it is updated every time the scheduler
> > calls
> > into the driver.  However, this is generally not necessary and it
> > adds
> > MSR read overhead to scheduler code paths (and that particular MSR
> > is
> > slow to read).
> > 
> > For this reason, make the driver read
> > MSR_IA32_MISC_ENABLE_TURBO_DISABLE
> > just once at the cpufreq driver registration time and remove all of
> > the
> > in-flight updates of global.turbo_disabled.
> 
> Hi Rafael and Srinivas,
> 
> Thanks for the clean up, but unfortunately on one of my laptops
> (based
> on i5-11300H) MSR_IA32_MISC_ENABLE_TURBO_DISABLE is mysteriously
> changing from 1 to 0 in about one minute after system boot.  I've no
> idea why this is happening (firmware is doing some stupid thing?)
> 
> I've noticed the issue before and "hacked it around"
> (https://bugzilla.kernel.org/show_bug.cgi?id=218702). But after this
> change I can no longer hack it around and the system is much slower.
> 
> Is it possible to hack it around again?
> 
Please try the attached diff and build kernel and try.

git apply update_max_freq.diff

Then build kernel and install.

Thanks,
Srinivas

[-- Attachment #2: update_max_freq.diff --]
[-- Type: text/x-patch, Size: 578 bytes --]

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 4b986c044741..deab96d8d4bf 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1168,6 +1168,12 @@ static void intel_pstate_update_limits(unsigned int cpu)
 	if (!policy)
 		return;
 
+	pr_info("%s cpu:%d\n", __func__, cpu);
+
+	global.turbo_disabled = turbo_is_disabled();
+	global.no_turbo = global.turbo_disabled;
+	arch_set_max_freq_ratio(global.turbo_disabled);
+
 	__intel_pstate_update_max_freq(all_cpu_data[cpu], policy);
 
 	cpufreq_cpu_release(policy);

  reply	other threads:[~2024-06-02  4:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 17:00 [PATCH v1 0/6] intel_pstate: Turbo disabled handling rework Rafael J. Wysocki
2024-03-25 17:01 ` [PATCH v1 1/6] cpufreq: intel_pstate: Fold intel_pstate_max_within_limits() into caller Rafael J. Wysocki
2024-04-01 20:06   ` srinivas pandruvada
2024-03-25 17:02 ` [PATCH v1 2/6] cpufreq: intel_pstate: Do not update global.turbo_disabled after initialization Rafael J. Wysocki
2024-06-02  3:21   ` Xi Ruoyao
2024-06-02  4:03     ` srinivas pandruvada [this message]
2024-06-02  4:25       ` Xi Ruoyao
2024-06-02 13:40         ` srinivas pandruvada
2024-06-02 16:07           ` Xi Ruoyao
2024-06-02 23:11             ` srinivas pandruvada
2024-06-03 13:12               ` Xi Ruoyao
2024-06-03 17:11                 ` srinivas pandruvada
2024-06-03 17:44                   ` Xi Ruoyao
2024-06-03 18:32                     ` Rafael J. Wysocki
2024-06-03 18:47                       ` srinivas pandruvada
2024-06-04  4:10                         ` srinivas pandruvada
2024-06-04  4:31                         ` srinivas pandruvada
2024-06-04  9:30                           ` Xi Ruoyao
2024-06-04 10:29                             ` srinivas pandruvada
2024-06-04 10:32                               ` Xi Ruoyao
2024-06-04 16:41                                 ` srinivas pandruvada
2024-06-04 16:46                                   ` Rafael J. Wysocki
2024-06-04 16:56                                     ` srinivas pandruvada
2024-06-05  5:21                                       ` Xi Ruoyao
2024-06-05 12:05                                         ` srinivas pandruvada
2024-06-07 15:04                                           ` Rafael J. Wysocki
2024-06-07 15:18                                             ` srinivas pandruvada
2024-06-08  9:30                                               ` Xi Ruoyao
2024-03-25 17:03 ` [PATCH v1 3/6] cpufreq: intel_pstate: Rearrange show_no_turbo() and store_no_turbo() Rafael J. Wysocki
2024-03-25 17:04 ` [PATCH v1 4/6] cpufreq: intel_pstate: Read global.no_turbo under READ_ONCE() Rafael J. Wysocki
2024-03-25 17:05 ` [PATCH v1 5/6] cpufreq: intel_pstate: Replace three global.turbo_disabled checks Rafael J. Wysocki
2024-03-25 17:06 ` [PATCH v1 6/6] cpufreq: intel_pstate: Update the maximum CPU frequency consistently Rafael J. Wysocki
2024-03-27 18:08   ` srinivas pandruvada
2024-03-28 11:26     ` Rafael J. Wysocki
2024-03-28 19:02   ` [PATCH v1.1 " Rafael J. Wysocki
2024-04-02  8:46 ` [PATCH v1 0/6] intel_pstate: Turbo disabled handling rework srinivas pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d5ee74605bd9574baa5ed111cb54e959414437a.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox