From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 0/4] KVM: Clean up and optimize __kvm_set_memory_region() - part1 Date: Thu, 17 Jan 2013 11:20:43 +0800 Message-ID: <50F76E0B.7040605@linux.vnet.ibm.com> References: <20130111182518.6c5975d9.yoshikawa_takuya_b1@lab.ntt.co.jp> <20130116190757.GA28986@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Takuya Yoshikawa , gleb@redhat.com, kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from e28smtp01.in.ibm.com ([122.248.162.1]:39536 "EHLO e28smtp01.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757207Ab3AQDUv (ORCPT ); Wed, 16 Jan 2013 22:20:51 -0500 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Jan 2013 08:49:11 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id E5A76125804F for ; Thu, 17 Jan 2013 08:51:04 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0H3KhPQ45875262 for ; Thu, 17 Jan 2013 08:50:44 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0H3KidV011028 for ; Thu, 17 Jan 2013 14:20:45 +1100 In-Reply-To: <20130116190757.GA28986@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 01/17/2013 03:07 AM, Marcelo Tosatti wrote: > On Fri, Jan 11, 2013 at 06:25:18PM +0900, Takuya Yoshikawa wrote: >> Patches 1 to 3 are trivial. >> >> Patch 4 is the main cause of the increased lines, but I think the new >> code makes it easier to understand why each condition in >> __kvm_set_memory_region() is there. >> >> If you don't agree with patch 4, please consider taking the rest of the >> series at this time. >> >> Takuya Yoshikawa (4): >> KVM: set_memory_region: Don't jump to out_free unnecessarily >> KVM: set_memory_region: Don't check for overlaps unless we create or move a slot >> KVM: set_memory_region: Remove unnecessary variable memslot >> KVM: set_memory_region: Identify the requested change explicitly >> >> virt/kvm/kvm_main.c | 94 ++++++++++++++++++++++++++++++++------------------- >> 1 files changed, 59 insertions(+), 35 deletions(-) >> >> -- >> 1.7.5.4 > > Reviewed-by: Marcelo Tosatti > > BTW, while at it, its probably worthwhile to restrict flags > modifications: change from flags = 0 to flags = read-only is > incomplete. Xiao, should it be allowed only during creation? Will Readonly memory be used for VM-mem-sharing in the future? I remember you mentioned about mem-sharing things before. ;) Actually, It is safe on KVM MMU because all the gfns in the slot can become readonly after calling __kvm_set_memory_region. It is unsafe on IOMMU, what need to be fixed is unmapping gfns on IOMMU when the flag is changed.