From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] Handle vma regions with no backing page Date: Wed, 04 Jun 2008 11:48:42 -0500 Message-ID: <4846C76A.9070201@us.ibm.com> References: <484664D9.6040407@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ben-Ami Yassour , Han Weidong , "Kay, Allen M" , Muli Ben-Yehuda , Amit Shah , andrea@qumranet.com, kvm@vger.kernel.org, Dave Hansen To: Avi Kivity Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:54600 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751996AbYFDQtB (ORCPT ); Wed, 4 Jun 2008 12:49:01 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m54GmwAN022421 for ; Wed, 4 Jun 2008 12:48:58 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m54Gmrox208194 for ; Wed, 4 Jun 2008 12:48:53 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m54Gmq6Y019823 for ; Wed, 4 Jun 2008 12:48:53 -0400 In-Reply-To: <484664D9.6040407@qumranet.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > > Looks like we need to reintroduce a refcount bit in the pte, and check > the page using the VMA. I don't think mucking with the VMA is going to help. We're already using the VMA to determine that the region is MMIO. What we need to be able to do is figure out, given a PFN, if that PFN is an MMIO page or not. Really what we're looking for is whether we have to release a reference to the page. I think it would be sufficient to change kvm_release_pfn_clean() to something like: void kvm_release_pfn_clean(pfn_t pfn) { struct page *page; if (!pfn_valid(pfn)) return; page = pfn_to_page(pfn); if (paeg_count(page)) put_page(page); } A couple other places need updating (like kvm_set_pfn_dirty()), but I think the general idea would work. Regards, Anthony Liguori