public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
Cc: Jeremy Fitzhardinge <jeremy-TSDbQ3PG+2Y@public.gmane.org>,
	lkml-MRDXTZLjjMs8G+1z+Pypc6QD96bmaF075NbjCUgZEJk@public.gmane.org,
	Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Andi Kleen <ak-h9bWGtP8wOw@public.gmane.org>,
	kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] make KVM conform to sucky rdmsr interface
Date: Thu, 22 Mar 2007 14:30:11 -0700	[thread overview]
Message-ID: <20070322143011.0cf83370.akpm@linux-foundation.org> (raw)
In-Reply-To: <1174549770.2713.121.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On Thu, 22 Mar 2007 18:49:30 +1100
Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org> wrote:

> rdmsr_safe() takes pointers.  rdmsr() modifies its arguments.  What a
> mess.
> 
> Fix rdmsr_safe() with !CONFIG_PARAVIRT.
> 
> Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
> 
> diff -r a7f78e8eacc8 include/asm-i386/msr.h
> --- a/include/asm-i386/msr.h	Thu Mar 22 12:38:35 2007 +1100
> +++ b/include/asm-i386/msr.h	Thu Mar 22 18:40:35 2007 +1100
> @@ -96,12 +96,12 @@ static inline void wrmsrl (unsigned long
>  	(native_write_msr(msr, ((unsigned long long)val2 << 32) | val1))
>  
>  /* rdmsr with exception handling */
> -#define rdmsr_safe(msr,val1,val2)						\
> +#define rdmsr_safe(msr,p1,p2)						\
>  	({								\
>  		int __err;						\
> -		unsigned long long __val = native_read_msr(msr, &__err);	\
> -		val1 = __val;						\
> -		val2 = __val >> 32;					\
> +		unsigned long long __val = native_read_msr(msr, &__err);\
> +		(*p1) = __val;						\
> +		(*p2) = __val >> 32;					\
>  		__err;							\
>  	})


Linus's tree has

/* rdmsr with exception handling */
#define rdmsr_safe(msr,a,b) ({ int ret__;						\
	asm volatile("2: rdmsr ; xorl %0,%0\n"						\
		     "1:\n\t"								\
		     ".section .fixup,\"ax\"\n\t"					\
		     "3:  movl %4,%0 ; jmp 1b\n\t"					\
		     ".previous\n\t"							\
 		     ".section __ex_table,\"a\"\n"					\
		     "   .align 4\n\t"							\
		     "   .long 	2b,3b\n\t"						\
		     ".previous"							\
		     : "=r" (ret__), "=a" (*(a)), "=d" (*(b))				\
		     : "c" (msr), "i" (-EFAULT));\
	ret__; })

(secret decoder ring: resize your xterm to 100 cols to read the above.  Sigh).

Which tree are you patching??

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22  2:51 [PATCH] make KVM conform to sucky rdmsr interface Rusty Russell
     [not found] ` <1174531917.2713.91.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-03-22  7:20   ` Avi Kivity
     [not found]     ` <46022E40.8080300-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-22  7:49       ` Rusty Russell
     [not found]         ` <1174549770.2713.121.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-03-22  7:55           ` Jeremy Fitzhardinge
2007-03-22 21:30           ` Andrew Morton [this message]
     [not found]             ` <20070322143011.0cf83370.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-03-22 22:01               ` Jeremy Fitzhardinge
2007-03-23  1:10               ` Rusty Russell

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=20070322143011.0cf83370.akpm@linux-foundation.org \
    --to=akpm-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
    --cc=ak-h9bWGtP8wOw@public.gmane.org \
    --cc=jeremy-TSDbQ3PG+2Y@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lkml-MRDXTZLjjMs8G+1z+Pypc6QD96bmaF075NbjCUgZEJk@public.gmane.org \
    --cc=rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox