From: Tim Deegan Subject: Re: [PATCH v3] xen/arm: flush D-cache and I-cache when appropriate Date: Mon, 19 Nov 2012 14:43:17 +0000 Message-ID: <20121119144317.GC31411@ocelot.phlegethon.org> References: <1353080578-1487-1-git-send-email-stefano.stabellini@eu.citrix.com> <1353329757.18229.81.camel@zakaz.uk.xensource.com> <20121119130826.GB31411@ocelot.phlegethon.org> <1353333381.18229.90.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1353333381.18229.90.camel@zakaz.uk.xensource.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: Ian Campbell Cc: "xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org At 13:56 +0000 on 19 Nov (1353333381), Ian Campbell wrote: > On Mon, 2012-11-19 at 13:08 +0000, Tim Deegan wrote: > > Sorry for the late review - I meant to get to these on Thursday but > > hadn't time. > > > > At 12:55 +0000 on 19 Nov (1353329757), Ian Campbell wrote: > > > > +/* Macro for flushing a single small item. The predicate is always > > > > + * compile-time constant so this will compile down to 3 instructions in > > > > + * the common case. > > > > This is no longer true! The predicate now depends on the alignment of > > the pointer, so this will compile to quite a bit of code, including the > > memory barrier I was trying to avoid. > > If p is static then isn't p + sizeof(*p) etc static and therefore the > compiler can figure it out? No. Cacheline_bytes isn't known until run time, and even if p is static, its value isn't known until link time. :( > Stefano, what does it actually compile down to in practice? > > > If we can sensibly restrict this to naturally-aligned objects smaller > > than a cacheline, we should go back to the previous version of this > > macro. If not, I think we might as well just use > > flush_xen_dcache_va_range(_p, sizeof *_p) and be done with it. > > I've already committed it, so please send a followup patch of whichever > sort is needed. Will do. Again, probably Thursday before I can get to it. Tim.