All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@muc.de>
Subject: Re: [PATCH] Cleanup: rationalize paravirt wrappers
Date: Thu, 22 Mar 2007 09:30:30 +0200	[thread overview]
Message-ID: <46023096.8060809@qumranet.com> (raw)
In-Reply-To: <1174531311.2713.86.camel@localhost.localdomain>

Rusty Russell wrote:
> +static inline unsigned long long native_read_msr(unsigned int msr, int *err)
> +{
> +	unsigned long long val;
> +
> +	asm volatile("2: rdmsr ; xorl %0,%0\n"
> +		     "1:\n\t"
> +		     ".section .fixup,\"ax\"\n\t"
> +		     "3:  movl %3,%0 ; jmp 1b\n\t"
> +		     ".previous\n\t"
> + 		     ".section __ex_table,\"a\"\n"
> +		     "   .align 4\n\t"
> +		     "   .long 	2b,3b\n\t"
> +		     ".previous"
> +		     : "=r" (*err), "=A" (val)
> +		     : "c" (msr), "i" (-EFAULT));
> +
> +	return val;
> +}
>   


> +#define rdmsr(msr,val1,val2)						\
> +	do {								\
> +		int __err;						\
> +		unsigned long long __val = native_read_msr(msr, &__err);	\
> +		val1 = __val;						\
> +		val2 = __val >> 32;					\
> +	} while(0)
> +
>   

You're silently changing the behavior (as well as the prototype) here,  
rdmsr() used to fail loudly, now it fails silently, with no way for the 
caller to check.


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2007-03-22  7:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22  2:41 [PATCH] Cleanup: rationalize paravirt wrappers Rusty Russell
2007-03-22  7:30 ` Avi Kivity [this message]
2007-03-22  8:00   ` Rusty Russell
2007-03-22  8:09     ` Jeremy Fitzhardinge
2007-03-22  8:09     ` Avi Kivity
2007-03-22  9:55       ` Rusty Russell
2007-03-23 11:05 ` Rusty Russell
2007-03-23 11:19   ` Avi Kivity

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=46023096.8060809@qumranet.com \
    --to=avi@qumranet.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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.