Linux userland API discussions
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Andy Lutomirski <luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] x86: Add a turbo mode sysctl
Date: Fri, 1 Apr 2016 18:10:03 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1604011803390.3978@nanos> (raw)
In-Reply-To: <cd6157244ae75145e2529a1d73f6174cd829ac9c.1459525715.git.luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

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)

> +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

  parent reply	other threads:[~2016-04-01 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 15:49 [PATCH] x86: Add a turbo mode sysctl Andy Lutomirski
     [not found] ` <cd6157244ae75145e2529a1d73f6174cd829ac9c.1459525715.git.luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-04-01 16:05   ` Borislav Petkov
2016-04-01 16:07   ` kbuild test robot
2016-04-01 16:10   ` Thomas Gleixner [this message]
2016-04-02 20:21     ` Andy Lutomirski
     [not found]       ` <CALCETrUfy-yZ6FD7J3AwhP7KB5eZ+YRMrKS_CyNDLvJwmiC49g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-03  9:55         ` Thomas Gleixner
2016-04-03 10:12           ` Borislav Petkov
2016-04-04  6:48   ` Nikolay Borisov

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=alpine.DEB.2.11.1604011803390.3978@nanos \
    --to=tglx-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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