From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Userspace MSR handling Date: Wed, 27 May 2009 19:28:13 +0300 Message-ID: <4A1D6A1D.2040400@redhat.com> References: <9ae48b020905221311h1859d5a1v3653404721d5208b@mail.gmail.com> <790CB8FA-1660-4F6B-BEEC-AAB9724DDD64@suse.de> <4A193878.4030206@redhat.com> <4A1A7B14.5000205@redhat.com> <4A1A7F03.1020106@redhat.com> <9ae48b020905270912ib832446q28c47ebaf0da1720@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Gerd Hoffmann , Alexander Graf , "kvm@vger.kernel.org" To: Ed Swierk Return-path: Received: from mx2.redhat.com ([66.187.237.31]:34412 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756688AbZE0Q2U (ORCPT ); Wed, 27 May 2009 12:28:20 -0400 In-Reply-To: <9ae48b020905270912ib832446q28c47ebaf0da1720@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Ed Swierk wrote: > On Mon, May 25, 2009 at 4:20 AM, Avi Kivity wrote: > >> Device drivers have no business writing to cpu model specific registers. I >> hate to bring that fugliness to kvm but I do want to support Xen guests. >> >> It should have been implemented as mmio. Maybe implement an ioctl that >> converts rdmsr/wrmsr to equivalent mmios? >> > > Converting MSRs to IO sounds fine, but a generic mechanism, with a new > ioctl type and all the bookkeeping for a dynamically-sized list of > MSR-to-MMIO mappings, seems like overkill given the puny scope of the > problem. All the Xen HVM guest needs is a single, arbitrary MSR that > when written generates an MMIO or PIO write handled by userspace. If > this requirement is unique and we don't expect to find other guests > that similarly abuse MSRs, could we get away with a less flexible but > simpler mechanism? > I agree, it's stupid. > What I have in mind is choosing an unused legacy IO port range, say, > 0x28-0x2f, and implementing a KVM-specific MSR, say, MSR_KVM_IO_28, > that maps rdmsr/wrmsr to a pair of inl/outl operations on these ports. > Either MMIO or PIO would work, but I'm assuming it's safer to grab > currently-unused IO ports than particular memory addresses. > It's just as bad. > That odor you smell is the aroma of hardcoded goop, but I'm trying to > find a solution that doesn't burden KVM with a big chunk of code to > solve a one-off problem. > Will it actually solve the problem? - can all hypercalls that can be issued with pv-on-hvm-on-kvm-with-a-side-order-of-fries be satisfied from userspace? - what about connecting the guest driver to xen netback one day? we don't want to go through userspace for that. We can consider catering to Xen and implementing that MSR in the kernel, if it's truly one off. -- error compiling committee.c: too many arguments to function