From: Tim Deegan Subject: Re: [PATCH 09/10] log-dirty: Refine common code to support PML Date: Fri, 10 Apr 2015 10:31:30 +0100 Message-ID: <20150410093130.GD12937@deinos.phlegethon.org> References: <1427423754-11841-1-git-send-email-kai.huang@linux.intel.com> <1427423754-11841-10-git-send-email-kai.huang@linux.intel.com> <20150409122751.GI17031@deinos.phlegethon.org> <55277DE1.6080301@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <55277DE1.6080301@linux.intel.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: Kai Huang Cc: yang.z.zhang@intel.com, andrew.cooper3@citrix.com, kevin.tian@intel.com, jbeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 15:38 +0800 on 10 Apr (1428680289), Kai Huang wrote: > > > On 04/09/2015 08:27 PM, Tim Deegan wrote: > > At 10:35 +0800 on 27 Mar (1427452553), Kai Huang wrote: > >> --- a/xen/arch/x86/mm/paging.c > >> +++ b/xen/arch/x86/mm/paging.c > >> @@ -411,7 +411,18 @@ static int paging_log_dirty_op(struct domain *d, > >> int i4, i3, i2; > >> > >> if ( !resuming ) > >> + { > >> domain_pause(d); > >> + > >> + /* > >> + * Only need to flush when not resuming, as domain was paused in > >> + * resuming case therefore it's not possible to have any new dirty > >> + * page. > >> + */ > >> + if ( d->arch.paging.log_dirty.flush_cached_dirty ) > >> + d->arch.paging.log_dirty.flush_cached_dirty(d); > > I think there are too many layers of indirection here. :) How about: > > - don't add a flush_cached_dirty() function to the log_dirty ops. > > - just call p2m_flush_hardware_cached_dirty(d) here. > > > > Would that work OK? > Thanks for pointing out. > > Is it nature to call p2m layer functions in paging.c? If there's no > restriction on it, calling p2m_flush_hardware_cached_dirty is more > clear, and it should work. Yes, calling public p2m functions directly is OK -- it's the internal function pointers like ->get_entry() that aren't supposed to be called from outside p2m code. I guess that's not terribly clear - maybe it needs some better comments. Tim.