From: Avi Kivity <avi@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: Ed Swierk <eswierk@aristanetworks.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Userspace MSR handling
Date: Tue, 26 May 2009 14:31:34 +0300 [thread overview]
Message-ID: <4A1BD316.80901@redhat.com> (raw)
In-Reply-To: <239A70B8-9633-4AFB-9D3B-63C078F5CFF0@suse.de>
Alexander Graf wrote:
>>>> Does it make sense to implement a generic mechanism for handling MSRs
>>>> in userspace? I imagine a mechanism analogous to PIO, adding a
>>>> KVM_EXIT_MSR code and a msr type in the kvm_run struct.
>>>>
>>>> I'm happy to take a stab at implementing this if no one else is
>>>> already working on it.
>>>
>>> I think it's a great idea.
>>> I was thinking of doing something similar for ppc's HIDs/SPRs too,
>>> so a userspace app can complement the kernel's vcpu support.
>>>
>>> Also by falling back to userspace all those MSR read/write patches I
>>> send wouldn't have to go in-kernel anymore :)
>>
>> I'm wary of this. It spreads the burden of implementing the cpu
>> emulation across the kernel/user boundary. We don't really notice
>> with qemu as userspace, because we have a cpu emulator on both sides,
>> but consider an alternative userspace that only emulates devices and
>> has no cpu emulation support. We want to support that scenario well.
>>
>> Moreover, your patches only stub out those MSRs. As soon as you
>> implement the more interesting bits, you'll find yourself back in the
>> kernel.
>>
>
> Agreed. The one thing that always makes my life hard is the default
> policy on what to do for unknown MSRs. So if I could (by having a
> userspace fallback) either #GP or do nothing, I'd be able to mimic
> qemu's behavior more closely depending on what I need.
I'm not interested in mimicing qemu, I'm interested in mimicing a real
cpu. kvm is not part of qemu.
Many (most?) msrs cannot be emulated in userspace.
> I definitely wouldn't see those approaches conflicting, but rather
> complementing each other. If your kvm using userspace app needs to act
> on a user-defined msr, you wouldn't want him to contact reshat to
> implement an ioctl for rhel5 just for this msr, do you?
An msr is a cpu resource. I don't see how you can define a new cpu
resource without changing the cpu implementation, which is in the
kernel. If they want to communicate with userspace, let them use mmio
or pio.
Look at the Xen interface. You write to one cpu's MSR, and the cpu
writes a page in guest memory. It doesn't fit; a much better interface
would have been mmio.
I don't want to break layering just for Xen, so I'm trying to find an
alternative.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2009-05-26 11:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-22 20:11 Userspace MSR handling Ed Swierk
2009-05-23 8:57 ` Alexander Graf
2009-05-24 12:07 ` Avi Kivity
2009-05-24 16:15 ` Alexander Graf
2009-05-26 11:31 ` Avi Kivity [this message]
2009-05-25 11:03 ` Gerd Hoffmann
2009-05-25 11:20 ` Avi Kivity
2009-05-25 11:29 ` Gerd Hoffmann
2009-05-25 11:31 ` Avi Kivity
2009-05-27 16:12 ` Ed Swierk
2009-05-27 16:28 ` Avi Kivity
2009-05-27 17:09 ` Ed Swierk
2009-05-27 19:16 ` Gerd Hoffmann
2009-05-27 23:00 ` Ed Swierk
2009-05-28 8:53 ` Avi Kivity
2009-05-29 9:47 ` Gerd Hoffmann
2009-05-31 8:21 ` Avi Kivity
2009-05-25 11:16 ` Gerd Hoffmann
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=4A1BD316.80901@redhat.com \
--to=avi@redhat.com \
--cc=agraf@suse.de \
--cc=eswierk@aristanetworks.com \
--cc=kvm@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.