Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1357543

Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access fails without !panic_on_oops

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access fails without !panic_on_oops
Date 2016-03-14 19:30 +0100
Message-ID <rcFpF-7uk-29@gated-at.bofh.it> (permalink)
References (4 earlier) <rcEjT-6Ns-3@gated-at.bofh.it> <rcEjT-6Ns-1@gated-at.bofh.it> <rcF6l-7mS-77@gated-at.bofh.it> <rcFfZ-7qA-57@gated-at.bofh.it> <rcFfZ-7qA-55@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Mar 14, 2016 at 11:15 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Mon, Mar 14, 2016 at 11:10 AM, Andy Lutomirski <luto@amacapital.net> wrote:
>>
>> A couple of the wrmsr users actually care about performance.  These
>> are the ones involved in context switching and, to a lesser extent, in
>> switching in and out of guest mode.
>
> .. ok, see the crossed emails.
>
> I'd *much* rather special case the special cases. Not make the generic
> case something complex.

The code in my queue is, literally:

bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup,
                 struct pt_regs *regs, int trapnr)
{
    WARN_ONCE(1, "unchecked MSR access error: RDMSR from 0x%x",
          (unsigned int)regs->cx);

    /* Pretend that the read succeeded and returned 0. */
    regs->ip = ex_fixup_addr(fixup);
    regs->ax = 0;
    regs->dx = 0;
    return true;
}
EXPORT_SYMBOL(ex_handler_rdmsr_unsafe);

The only regard in which this is any more complex than the _safe
variant is because there's a warning (one line of code) and because
the _safe variant forgot to zero the result (two lines of code).  My
series fixes the latter, so we're talking about almost no source code
size difference.  There *is* a difference in binary size, though --
the _safe variant emits a copy of its fixup every time it appears,
whereas the new fixup appears once.

So I think we should apply my patches (with the early handling fixed
and the panic_on_oops removed), and then consider reimplementing the
_safe variant using fancy handlers to reduce number of lines of asm
and code size, and then consider changing the overall API on top if we
think there's a better API to be had.

Is that okay?

>
> And *particularly* not make the generic case be something where people
> think it's sane to oops and kill the machine. Christ.

I've already removed the panic_on_oops thing from my tree.

--Andy

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access fails without !panic_on_oops Andy Lutomirski <luto@kernel.org> - 2016-03-12 19:10 +0100
  Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Borislav Petkov <bp@alien8.de> - 2016-03-14 13:10 +0100
    Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2016-03-14 18:10 +0100
      Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2016-03-14 18:20 +0100
        Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-14 19:10 +0100
          Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-14 19:20 +0100
          Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-14 19:20 +0100
            Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2016-03-14 19:30 +0100
              Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2016-03-14 19:50 +0100
                Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Ingo Molnar <mingo@kernel.org> - 2016-03-15 11:30 +0100
                Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Ingo Molnar <mingo@kernel.org> - 2016-03-15 11:30 +0100
              Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Linus Torvalds <torvalds@linux-foundation.org> - 2016-03-14 19:50 +0100
          Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Andy Lutomirski <luto@amacapital.net> - 2016-03-14 19:20 +0100
            Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Peter Zijlstra <peterz@infradead.org> - 2016-03-14 21:20 +0100
          Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access  fails without !panic_on_oops Ingo Molnar <mingo@kernel.org> - 2016-03-15 11:30 +0100

csiph-web