Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759229AbcDAQLl (ORCPT ); Fri, 1 Apr 2016 12:11:41 -0400 Received: from www.linutronix.de ([62.245.132.108]:54950 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbcDAQLk (ORCPT ); Fri, 1 Apr 2016 12:11:40 -0400 Date: Fri, 1 Apr 2016 18:10:03 +0200 (CEST) From: Thomas Gleixner To: Andy Lutomirski cc: x86@kernel.org, Borislav Petkov , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH] x86: Add a turbo mode sysctl In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 780 Lines: 35 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