From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nadav Har'El" Subject: Re: [PATCH 11/24] Implement VMPTRST Date: Wed, 16 Jun 2010 18:33:58 +0300 Message-ID: <20100616153358.GC11896@fermat.math.technion.ac.il> References: <1276431753-nyh@il.ibm.com> <201006131228.o5DCSCAW012994@rice.haifa.ibm.com> <4C15F31E.9000905@redhat.com> <20100616135335.GB523@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mailgw11.technion.ac.il ([132.68.225.11]:63541 "EHLO mailgw11.technion.ac.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759142Ab0FPPeV (ORCPT ); Wed, 16 Jun 2010 11:34:21 -0400 Content-Disposition: inline In-Reply-To: <20100616135335.GB523@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jun 16, 2010, Gleb Natapov wrote about "Re: [PATCH 11/24] Implement VMPTRST": > On Mon, Jun 14, 2010 at 12:15:10PM +0300, Avi Kivity wrote: > > write_guest_virt_system() is used by writes which need to ignore the > > cpl, for example when a cpl 3 instruction loads a segment, the > > processor needs to update the accessed flag even though it is only > > accessible to cpl 0. That's not your case, you need the ordinary > > write_guest_virt(). > > > > Um, I see there is no kvm_write_guest_virt(), you'll have to introduce it. > > > the code uses this function after checking cpl to be zero, so may be it > is ok, not to pretty though. I was actually hoping to get rid of all > kvm_(read|write)_guest_virt* and replace existing uses with > emulator_(read|write)_emulated, but this patch series adds more users > that will be hard to replace :( If I remember the history correctly, this is exactly what happened in this code. We used to use kvm_write_guest_virt(), until a few months ago it disappeared. I thought it to be fine to call write_guest_virt_system() because, like you said, we only already check above that cpl=0, so it is fine to assume we have cpl 0 privileges. So while it might look a bit strange at first, I think it should be fine and there's no need to create more functions. -- Nadav Har'El | Wednesday, Jun 16 2010, 4 Tammuz 5770 nyh@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Amateurs built the ark - professionals http://nadav.harel.org.il |built the Titanic.