From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [V1 PATCH 06/11] PVH dom0: construct_dom0 changes Date: Thu, 14 Nov 2013 18:34:18 -0800 Message-ID: <20131114183418.6f396e00@mantra.us.oracle.com> References: <1383960215-22444-1-git-send-email-mukesh.rathor@oracle.com> <1383960215-22444-7-git-send-email-mukesh.rathor@oracle.com> <528266C902000078001028F8@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vh9Eo-0006W1-LA for xen-devel@lists.xenproject.org; Fri, 15 Nov 2013 02:34:26 +0000 In-Reply-To: <528266C902000078001028F8@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , keir.xen@gmail.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 12 Nov 2013 16:35:05 +0000 "Jan Beulich" wrote: > >>> On 09.11.13 at 02:23, Mukesh Rathor > >>> wrote: ...... > These look more complicated than necessary (largely due to the > casts), but be it that way. > > > + pl4e = l4start + l4_table_offset(v_start); > >... > > + *pl4e = l4e_from_pfn(get_gpfn_from_mfn(l4e_get_pfn(*pl4e)), > > + l4e_get_flags(*pl4e)); > > But this one I told before needs to be in a loop. You must not make > assumptions on guest virtual address space layout, and hence you > must not assume none of the initial mapping crosses an L4 boundary. Ah right, my bad. > And once these are in a loop, getting the earlier two loops simplified > (using l4e_empty() rather than plain memset()) and ordered properly > (the head part before the main loop, the tail part after) will be > almost obvious legibility cleanups. Actually, the loop will go from v_start->L4 to v_end->L4. The memsets are clearing the entries before v_start and after v_end. So, I'm thinking something like: clear entries before v_start using memset clear entries after v_end using memset for ( pl4e = l4start + l4_table_offset(v_start); pl4e <= l4start + l4_table_offset(v_end); pl4e++) { pl3e = map_l3t_from_l4e(*pl4e); for ( i = 0; i < PAGE_SIZE / sizeof(*pl3e); i++, pl3e++ ) { ... } Look ok? thanks, Mukesh