From: Keir Fraser Subject: Re: Re: xen crash in tmem: checking a xen pfn for domain ownership Date: Tue, 21 Sep 2010 08:44:23 +0100 Message-ID: References: <12d0043a-2042-4939-9489-8ec8a50ea785@default> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <12d0043a-2042-4939-9489-8ec8a50ea785@default> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer , Jan Beulich Cc: Xen-devel List-Id: xen-devel@lists.xenproject.org On 21/09/2010 00:03, "Dan Magenheimer" wrote: > if ( is_hvm_domain(current->domain) ) > { > xmfn = mfn_x(gfn_to_mfn_unshare(current->domain, cmfn, &t, 2)); > if (t != p2m_ram_rw || xmfn == INVALID_MFN) > return NULL; > } > else > { > xmfn = cmfn; > if (!mfn_valid(xmfn)) > return NULL; > } This is needlessly cumbersome. You can do it without the if(is_hvm): xmfn = mfn_x(gfn_to_mfn(current->domain, cmfn, &t); if ((t != p2m_ram_rw) || !mfn_valid(xmfn)) return NULL; (Didn't use hfn_to_mfn_unshare as you have decided against it.) Rest of the code looks fine. -- Keir