Messages in this thread | | | From | Andy Lutomirski <> | Date | Mon, 14 Mar 2016 11:24:00 -0700 | Subject | Re: [PATCH v4 2/5] x86/msr: Carry on after a non-"safe" MSR access fails without !panic_on_oops |
| |
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
| |