From: Avi Kivity <avi@qumranet.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@muc.de>, Andrew Morton <akpm@osdl.org>,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: Re: [PATCH] make KVM conform to sucky rdmsr interface
Date: Thu, 22 Mar 2007 09:20:32 +0200 [thread overview]
Message-ID: <46022E40.8080300@qumranet.com> (raw)
In-Reply-To: <1174531917.2713.91.camel@localhost.localdomain>
Rusty Russell wrote:
> Grrr.... Andi refused to take my "rdmsr64" patch which moved to a
> function-like interface for MSRs, dismissing it as pointless churn.
>
> paravirt_ops cleanups changed a macro to an inline and spotted this
> kvm bug.
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> diff -r 47c6ee74a5c5 drivers/kvm/vmx.c
> --- a/drivers/kvm/vmx.c Thu Mar 22 12:57:44 2007 +1100
> +++ b/drivers/kvm/vmx.c Thu Mar 22 13:38:24 2007 +1100
> @@ -1127,7 +1127,7 @@ static int vmx_vcpu_setup(struct kvm_vcp
> u64 data;
> int j = vcpu->nmsrs;
>
> - if (rdmsr_safe(index, &data_low, &data_high) < 0)
> + if (rdmsr_safe(index, data_low, data_high) < 0)
> continue;
> if (wrmsr_safe(index, data_low, data_high) < 0)
> continue;
>
>
>
My rdmsr_safe (x86_64, i386 is similar/same) is
#define rdmsr_safe(msr,a,b) \
({ int ret__; \
asm volatile ("1: rdmsr\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: movl %4,%0\n" \
" jmp 2b\n" \
".previous\n" \
".section __ex_table,\"a\"\n" \
" .align 8\n" \
" .quad 1b,3b\n" \
".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b))\
:"c"(msr), "i"(-EIO), "0"(0)); \
ret__; })
Which seems quite happy to accept pointers to the values. The one in
asm/i386/paravirt.h has a similar calling convention.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
Cc: Andrew Morton <akpm-3NddpPZAyC0@public.gmane.org>,
Andi Kleen <ak-h9bWGtP8wOw@public.gmane.org>,
lkml - Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@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 09:20:32 +0200 [thread overview]
Message-ID: <46022E40.8080300@qumranet.com> (raw)
In-Reply-To: <1174531917.2713.91.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
Rusty Russell wrote:
> Grrr.... Andi refused to take my "rdmsr64" patch which moved to a
> function-like interface for MSRs, dismissing it as pointless churn.
>
> paravirt_ops cleanups changed a macro to an inline and spotted this
> kvm bug.
>
> Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
>
> diff -r 47c6ee74a5c5 drivers/kvm/vmx.c
> --- a/drivers/kvm/vmx.c Thu Mar 22 12:57:44 2007 +1100
> +++ b/drivers/kvm/vmx.c Thu Mar 22 13:38:24 2007 +1100
> @@ -1127,7 +1127,7 @@ static int vmx_vcpu_setup(struct kvm_vcp
> u64 data;
> int j = vcpu->nmsrs;
>
> - if (rdmsr_safe(index, &data_low, &data_high) < 0)
> + if (rdmsr_safe(index, data_low, data_high) < 0)
> continue;
> if (wrmsr_safe(index, data_low, data_high) < 0)
> continue;
>
>
>
My rdmsr_safe (x86_64, i386 is similar/same) is
#define rdmsr_safe(msr,a,b) \
({ int ret__; \
asm volatile ("1: rdmsr\n" \
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: movl %4,%0\n" \
" jmp 2b\n" \
".previous\n" \
".section __ex_table,\"a\"\n" \
" .align 8\n" \
" .quad 1b,3b\n" \
".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b))\
:"c"(msr), "i"(-EIO), "0"(0)); \
ret__; })
Which seems quite happy to accept pointers to the values. The one in
asm/i386/paravirt.h has a similar calling convention.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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
next prev parent reply other threads:[~2007-03-22 7:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-22 2:51 [PATCH] make KVM conform to sucky rdmsr interface Rusty Russell
2007-03-22 2:51 ` Rusty Russell
2007-03-22 7:20 ` Avi Kivity [this message]
2007-03-22 7:20 ` Avi Kivity
2007-03-22 7:49 ` Rusty Russell
2007-03-22 7:49 ` Rusty Russell
2007-03-22 7:55 ` Jeremy Fitzhardinge
2007-03-22 7:55 ` Jeremy Fitzhardinge
2007-03-22 21:30 ` Andrew Morton
2007-03-22 21:30 ` Andrew Morton
2007-03-22 22:01 ` Jeremy Fitzhardinge
2007-03-22 22:01 ` Jeremy Fitzhardinge
2007-03-23 1:10 ` Rusty Russell
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=46022E40.8080300@qumranet.com \
--to=avi@qumranet.com \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=kvm-devel@lists.sourceforge.net \
--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.