Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034110AbcJ0Wmp (ORCPT ); Thu, 27 Oct 2016 18:42:45 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:45233 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942773AbcJ0Wmm (ORCPT ); Thu, 27 Oct 2016 18:42:42 -0400 Date: Fri, 28 Oct 2016 00:38:54 +0200 (CEST) From: Thomas Gleixner To: Andy Lutomirski cc: Kyle Huey , "Robert O'Callahan" , Ingo Molnar , "H. Peter Anvin" , X86 ML , Jeff Dike , Richard Weinberger , Andy Lutomirski , Borislav Petkov , Dmitry Safonov , Peter Zijlstra , Dave Hansen , Boris Ostrovsky , Alexander Viro , Shuah Khan , "Rafael J. Wysocki" , Len Brown , "linux-kernel@vger.kernel.org" , "user-mode-linux-devel@lists.sourceforge.net" , "open list:USER-MODE LINUX (UML)" , "open list:KERNEL SELFTEST FRAMEWORK" , Linux API Subject: Re: [PATCH v7 6/6] x86/arch_prctl: Add ARCH_[GET|SET]_CPUID In-Reply-To: Message-ID: References: <20161019020333.3766-1-khuey@kylehuey.com> <20161019020333.3766-7-khuey@kylehuey.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 631 Lines: 20 On Thu, 27 Oct 2016, Andy Lutomirski wrote: > On Thu, Oct 27, 2016 at 4:15 AM, Thomas Gleixner wrote: > Let's just do this right from day one: > > static void set_cpuid_faulting(bool on) > { > u64 msrval; > > DEBUG_LOCKS_WARN_ON(!irqs_disabled()); > > msrval = this_cpu_read(msr_misc_features_enables_shadow); > msrval &= CPUID_FAULT_ENABLE; > msrval |= (on << CPUID_FAULT_ENABLE_BIT); > this_cpu_write(msr_misc_features_enables_shadow, msrval); > wrmsrl(MSR_MISC_FEATURES_ENABLES, msrval); > } > > RDMSR may be considerably faster than WRMSR, but that doesn't mean it's *fast*. Good point!