Thread (8 messages) 8 messages, 6 authors, 2016-04-04

Re: [PATCH] x86: Add a turbo mode sysctl

flat view

From: Thomas Gleixner <hidden>
Date: 2016-04-01 16:11:41
Also in: lkml

On Fri, 1 Apr 2016, Andy Lutomirski wrote:
quoted hunk ↗ jump to hunk
+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.
quoted hunk ↗ jump to hunk
+	 */
+
+	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)
quoted hunk ↗ jump to hunk
+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.

Thanks,

	tglx
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help