From: "Jan Beulich" Subject: Re: [PATCH v2 4/4] x86: fix pinned cache attribute handling Date: Fri, 04 Apr 2014 16:01:30 +0100 Message-ID: <533EE56A0200007800005BE9@nat28.tlf.novell.com> References: <533583C5020000780000367B@nat28.tlf.novell.com> <533584D60200007800003697@nat28.tlf.novell.com> <533586CD02000078000036E6@nat28.tlf.novell.com> <1396013811.8670.49.camel@kazak.uk.xensource.com> <5335988F0200007800003782@nat28.tlf.novell.com> <1396018356.8670.75.camel@kazak.uk.xensource.com> <53359E7A02000078000037C8@nat28.tlf.novell.com> <53394AE90200007800003AD0@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WW5ca-0006FO-JV for xen-devel@lists.xenproject.org; Fri, 04 Apr 2014 15:01:32 +0000 In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: anthony.perard@citrix.com, Ian Campbell , IanJackson , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 04.04.14 at 16:30, wrote: > On Mon, 31 Mar 2014, Jan Beulich wrote: >> >>> On 28.03.14 at 19:00, wrote: >> > I miss some context here. >> > What is the issue with xc_domain_pin_memory_cacheattr_range and how does >> > it affect QEMU (that uses the xc_domain_pin_memory_cacheattr variety)? >> >> The issue is that the hypervisor (and hence libxc) interface expect the >> passed range to be inclusive, yet the ending page number all the qemus >> pass is one past the intended range. > > Thanks for the clear explanation. > Is this patch what you are looking for? > > --- > > diff --git a/xen-all.c b/xen-all.c > index ba34739..027e7a8 100644 > --- a/xen-all.c > +++ b/xen-all.c > @@ -323,7 +323,7 @@ go_physmap: > > xc_domain_pin_memory_cacheattr(xen_xc, xen_domid, > start_addr >> TARGET_PAGE_BITS, > - (start_addr + size) >> TARGET_PAGE_BITS, > + (start_addr + size - 1) >> TARGET_PAGE_BITS, > XEN_DOMCTL_MEM_CACHEATTR_WB); > > snprintf(path, sizeof(path), Something along these lines, for all maintained trees. The main thing I'm not sure about is whether size can ever be zero, or not page aligned - in both cases further care would need to be taken. Jan