Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752430AbbGBJPl (ORCPT ); Thu, 2 Jul 2015 05:15:41 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:34384 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbbGBJPZ (ORCPT ); Thu, 2 Jul 2015 05:15:25 -0400 Date: Thu, 2 Jul 2015 11:15:20 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: "Brown, Len" , Prarit Bhargava , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , X86 ML , "Chandramouli, Dasaratharaman" , Peter Zijlstra , Borislav Petkov , Andy Lutomirski , Denys Vlasenko , Brian Gerst , Arnaldo Carvalho de Melo Subject: Re: [PATCH] x86, msr: Allow read access to /dev/cpu/X/msr Message-ID: <20150702091520.GA8539@gmail.com> References: <1435341131-3279-1-git-send-email-prarit@redhat.com> <20150627083354.GA12834@gmail.com> <20150627083921.GA13074@gmail.com> <1A7043D5F58CCB44A599DFD55ED4C948468A477B@fmsmsx115.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2100 Lines: 48 * Andy Lutomirski wrote: > On Wed, Jul 1, 2015 at 9:38 AM, Brown, Len wrote: > > > BTW. I've had a discussion w/ LLNL about their needs, both for security and > > performance. For security, as concluded by this thread, a white list is the > > only way to go. I'm thinking a bit-vector of allowed MSR offsets... For > > performance, they absolutely can not afford a system call for every single MSR > > access. > > I'm surprised. On a sane kernel, a syscall is about 120 cycles. Just rdmsr to > an unoptimized MSR is probably fifty cycles, I'd guess. RDMSR to a non-fastpath MSR is more like a hundred cycles: [ 104.151166] x86/bench: --------------------------- [ 104.155350] x86/bench: | Running x86 benchmarks: | [ 104.159530] x86/bench: ------------------------------------------------------------------- [ 104.167604] x86/bench: | RDTSC-cycles: hot (?noise) / cold (?noise) [ 104.175870] x86/bench: ------------------------------------------------------------------- Ancient box (10 years old): x86/bench: rdmsr : 36 / 17 (?29.4%) x86/bench: wrmsr : 198 / 245 AMD box (2 years old): ... [ 173.208130] x86/bench: rdmsr : 121 / 169 (?18.9%) [ 174.633653] x86/bench: wrmsr : 365 / 422 (? 9.2%) Intel box (1 year old): ... [ 130.185195] x86/bench: rdmsr : 100 / 112 [ 131.263560] x86/bench: wrmsr : 492 / 728 (?15.3%) so the RDMSR cost got progressively worse as MSRs got farther and farther away from the core and microcode execution got progressively worse as well. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/