From: "Jan Beulich" Subject: Re: [PATCH v4 4/7] xen/x86: introduce more cache maintenance operations Date: Fri, 10 Oct 2014 14:16:35 +0100 Message-ID: <5437F853020000780003DBCD@mail.emea.novell.com> References: <1412941440-5646-4-git-send-email-stefano.stabellini@eu.citrix.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 1Xca3g-0008IZ-KR for xen-devel@lists.xenproject.org; Fri, 10 Oct 2014 13:16:36 +0000 In-Reply-To: <1412941440-5646-4-git-send-email-stefano.stabellini@eu.citrix.com> 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: julien.grall@citrix.com, xen-devel , Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 10.10.14 at 13:43, wrote: > +void clean_and_invalidate_dcache_va_range(const void *p, unsigned long size) > +{ > + int order = get_order_from_bytes(size); unsigned int if the variable is really needed. > + flush_area_local(p, FLUSH_CACHE|FLUSH_ORDER(order)); > +} Overall I wonder whether not making this an inline function is really appropriate. Oh, and then I may have slightly misguided you: The caller you're adding for this wants to be able to clean/invalidate sub-page chunks, which this interface doesn't allow. This isn't a problem unless the operation gets done frequently and always degenerates to wbinvd(). At the very least I'd suggest adding a comment saying that sub-page granularity support would need to be added if necessary here. > --- a/xen/include/asm-x86/page.h > +++ b/xen/include/asm-x86/page.h > @@ -344,8 +344,13 @@ static inline uint32_t cacheattr_to_pte_flags(uint32_t > cacheattr) > return ((cacheattr & 4) << 5) | ((cacheattr & 3) << 3); > } > > -/* No cache maintenance required on x86 architecture. */ > static inline void flush_page_to_ram(unsigned long mfn) {} > +static inline void invalidate_dcache_va_range(const void *p, unsigned long size) {} This should fail, not appear to succeed. We just can't do what is being requested. Jan