Thread (4 messages) 4 messages, 2 authors, 2014-07-28

Re: [PATCH] x86, paravirt: BUG_ON on {rd,wr}msr exceptions

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2014-07-28 20:44:42
Also in: lkml

As much as I hate adding new pvops, it might be the better answer, especially since those are the real native ops.


On July 28, 2014 1:39:55 PM PDT, Eduardo Habkost [off-list ref] wrote:
On Mon, Jul 28, 2014 at 12:18:10PM -0700, H. Peter Anvin wrote:
quoted
On 07/28/2014 12:04 PM, Eduardo Habkost wrote:
quoted
When CONFIG_PARAVIRT is enabled, the kernel is ignoring exceptions
on
quoted
quoted
the {rd,wr}msr instructions. This makes serious issues (either on
the
quoted
quoted
guest kernel, or on the host) be silently ignored, and is different
from
quoted
quoted
the native MSR code (which does not ignore the exceptions).

As paravirt.h already includes linux/bug.h, I don't see what was
the
quoted
quoted
original issue preventing BUG_ON from being used.

Change rdmsr(), wrmsr(), and rdmsrl() to BUG_ON() on errors.
How much does this bloat the kernel?
It seems to add 8 bytes to each {wr,rd}msr() call (4 extra
instructions:
test, jmp, ud2, jmp).

allyesconfig, paravirt enabled, before:

 text    data     bss     dec     hex filename
108368312       23500872        55705600        187574784       b2e2a00
vmlinux

allyesconfig, paravirt enabled, after:

  text    data     bss     dec     hex filename
108384438       23500904        55717888        187603230       b2e991e
vmlinux

allyesconfig vmlinux is 28446 bytes larger.

An alternative is to add read_msr_unsafe() & write_msr_unsafe() fields
to pv_cpu_ops, pointing to native_read_msr() & native_write_msr().
-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help