All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "Brown, Len" <len.brown@intel.com>,
	Prarit Bhargava <prarit@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, X86 ML <x86@kernel.org>,
	"Chandramouli,
	Dasaratharaman"  <dasaratharaman.chandramouli@intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Brian Gerst <brgerst@gmail.com>,
	Arnaldo Carvalho de Melo <acme@infradead.org>
Subject: Re: [PATCH] x86, msr: Allow read access to /dev/cpu/X/msr
Date: Thu, 2 Jul 2015 11:15:20 +0200	[thread overview]
Message-ID: <20150702091520.GA8539@gmail.com> (raw)
In-Reply-To: <CALCETrXd54pCdENwN1+ppwFBReLy6Tsq=mm2_X-SCQmUdhwUwQ@mail.gmail.com>


* Andy Lutomirski <luto@amacapital.net> wrote:

> On Wed, Jul 1, 2015 at 9:38 AM, Brown, Len <len.brown@intel.com> 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

  reply	other threads:[~2015-07-02  9:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 17:52 [PATCH] x86, msr: Allow read access to /dev/cpu/X/msr Prarit Bhargava
2015-06-26 18:45 ` H. Peter Anvin
2015-06-26 19:23 ` Brian Gerst
2015-06-26 21:26   ` Prarit Bhargava
2015-06-28 15:13     ` Henrique de Moraes Holschuh
2015-06-27  8:33 ` Ingo Molnar
2015-06-27  8:39   ` Ingo Molnar
2015-06-27 15:52     ` Andy Lutomirski
2015-06-28 14:34       ` Prarit Bhargava
2015-06-28 15:10         ` Henrique de Moraes Holschuh
2015-06-29  6:42           ` Ingo Molnar
2015-06-29 10:58           ` Matt Fleming
2015-06-29 19:51         ` H. Peter Anvin
2015-06-30 12:20           ` Prarit Bhargava
2015-06-30 12:44             ` Peter Zijlstra
2015-06-30 12:57               ` Ingo Molnar
2015-06-30 13:23               ` Prarit Bhargava
2015-07-01 16:38       ` Brown, Len
2015-07-01 17:33         ` Andy Lutomirski
2015-07-02  9:15           ` Ingo Molnar [this message]
2015-07-02 19:22         ` H. Peter Anvin
2015-07-02 19:26           ` Andy Lutomirski
2015-07-03  7:42         ` Ingo Molnar

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=20150702091520.GA8539@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dasaratharaman.chandramouli@intel.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=prarit@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.