Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1370047
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86: Add a turbo mode sysctl |
| Date | 2016-04-02 22:30 +0200 |
| Message-ID | <rjAlc-Oq-7@gated-at.bofh.it> (permalink) |
| References | <rj9Eo-6vF-25@gated-at.bofh.it> <rj9XH-6W0-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Apr 1, 2016 at 9:10 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 1 Apr 2016, Andy Lutomirski wrote:
>> +static void update_local_turbo_mode(void *dummy)
>> +{
>> + unsigned long cr0 = read_cr0();
>> +
>> + /*
>> + * KVM doesn't properly handle CD.
>> + *
>> + * XXX: this may interact poorly with CPU hotplug.
>
> Please cc these crazy folks who cleanup the hotplug mess so they can put it on
> their todo list.
>
>> + */
>> +
>> + if (turbo_mode)
>> + write_cr0(cr0 & ~X86_CR0_CD);
>> + else
>> + write_cr0(cr0 | X86_CR0_CD);
>
> I think proper turbo mode disable requires ~(X86_CR0_CD | X86_CR0_NW)
I thought that made no difference on family 6 and P4 and was actively
dangerous (disabled coherency) before. At least, that's what the
table of caching modes and the footnote seems to say.
>
>> +static void update_turbo_mode(void)
>> +{
>> + on_each_cpu(update_local_turbo_mode, NULL, 1);
>> +
>> + if (!turbo_mode)
>> + wbinvd();
>
> You really want to do wbinvd() on each cpu to make sure that each cpu gets out
> of that turbo thing.
Nah, this is an explicit optimization to de-turboize as quickly as possible:
"The instruction then issues a special-function bus cycle that directs
external caches to also write
back modified data and another bus cycle to indicate that the external
caches should be invalidated."
I think we should merge this patch and add a special-case so that
calling unlink on turbo_mode sets it to zero. Then people who rm -rf
/ will brick their systems more slowly :)
--Andy
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86: Add a turbo mode sysctl Andy Lutomirski <luto@kernel.org> - 2016-04-01 18:00 +0200
Re: [PATCH] x86: Add a turbo mode sysctl Borislav Petkov <bp@alien8.de> - 2016-04-01 18:10 +0200
Re: [PATCH] x86: Add a turbo mode sysctl kbuild test robot <lkp@intel.com> - 2016-04-01 18:10 +0200
Re: [PATCH] x86: Add a turbo mode sysctl Thomas Gleixner <tglx@linutronix.de> - 2016-04-01 18:20 +0200
Re: [PATCH] x86: Add a turbo mode sysctl Andy Lutomirski <luto@amacapital.net> - 2016-04-02 22:30 +0200
Re: [PATCH] x86: Add a turbo mode sysctl Thomas Gleixner <tglx@linutronix.de> - 2016-04-03 12:00 +0200
Re: [PATCH] x86: Add a turbo mode sysctl Borislav Petkov <bp@alien8.de> - 2016-04-03 12:20 +0200
Re: [PATCH] x86: Add a turbo mode sysctl Nikolay Borisov <kernel@kyup.com> - 2016-04-04 08:50 +0200
csiph-web