From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/1 v2] KVM: MMU: Use ptep_user for cmpxchg_gpte() Date: Wed, 04 May 2011 17:27:00 +0300 Message-ID: <4DC16234.7010900@redhat.com> References: <20110501143026.9eb3c875.takuya.yoshikawa@gmail.com> <20110501143307.1bcfd375.takuya.yoshikawa@gmail.com> <20110504111611.GA26538@amt.cnet> <4DC13C2F.4090402@redhat.com> <20110504115827.GA28957@amt.cnet> <4DC14277.4090006@redhat.com> <20110504230035.b7f41443.takuya.yoshikawa@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753707Ab1EDO1G (ORCPT ); Wed, 4 May 2011 10:27:06 -0400 In-Reply-To: <20110504230035.b7f41443.takuya.yoshikawa@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/04/2011 05:00 PM, Takuya Yoshikawa wrote: > > > > We do get_user() in read_gpte(). That is equivalent to > > get_user_pages(). So we already broke that layer of abstraction. > > At first, I broke hva_to_pfn() into two functions: > hva_to_page > hva_to_pfn > and used the former to get the page. Ouch, what a complicated function. > But after making that patch, I thought it might be a bit extra to do such > things in the function which is doing low level page manipulations like > kmapping. > > Actually, we are already assuming that the page returned by gfn_to_page is > always a usual page which contains gptes without extra checks. When gfn_to_page() returns an error, it is actually a real page in host memory that can be scribbled on. So no further checks are needed. > Which way do you like the best? I think it should work fine as is. The question is whether we're doing a layering violation here (but in any case, that was introduced by ptep_user, not this patch). -- error compiling committee.c: too many arguments to function