All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Avi Kivity <avi@qumranet.com>
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 19:00:42 +1100	[thread overview]
Message-ID: <1174550442.2713.128.camel@localhost.localdomain> (raw)
In-Reply-To: <46023096.8060809@qumranet.com>

On Thu, 2007-03-22 at 09:30 +0200, Avi Kivity wrote:
> 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.

Hi Avi!

	Not sure what you're saying about the prototype: the old macro was:

-#define rdmsr(msr,val1,val2) \
-	__asm__ __volatile__("rdmsr" \
-			  : "=a" (val1), "=d" (val2) \
-			  : "c" (msr))
-

Which doesn't seem to be a great difference to me.

The behaviour change (don't oops when an invalid rdmsr is used) was
there with CONFIG_PARAVIRT=y, the cleanup just made !CONFIG_PARAVIRT the
same.  Is it important?

Thanks,
Rusty.


  reply	other threads:[~2007-03-22  8:01 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
2007-03-22  8:00   ` Rusty Russell [this message]
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=1174550442.2713.128.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=avi@qumranet.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.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.