From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 1/3] xen/vt-d: need barriers to workaround CLFLUSH Date: Mon, 4 May 2015 11:22:51 -0400 Message-ID: <20150504152251.GD14147@l.oracle.com> References: <1430705771-6744-1-git-send-email-tiejun.chen@intel.com> <55474F790200007800076334@mail.emea.novell.com> <55474C7C.4000909@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: <55474C7C.4000909@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: "Chen, Tiejun" , boris.ostrovsky@oracle.com Cc: kevin.tian@intel.com, keir@xen.org, jinsong.liu@alibaba-inc.com, xen-devel@lists.xen.org, Jan Beulich , andrew.cooper3@citrix.com, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org On Mon, May 04, 2015 at 06:39:56PM +0800, Chen, Tiejun wrote: > On 2015/5/4 16:52, Jan Beulich wrote: > >>>>On 04.05.15 at 04:16, wrote: > >>--- a/xen/drivers/passthrough/vtd/x86/vtd.c > >>+++ b/xen/drivers/passthrough/vtd/x86/vtd.c > >>@@ -56,7 +56,9 @@ unsigned int get_cache_line_size(void) > >> > >> void cacheline_flush(char * addr) > >> { > >>+ mb(); > >> clflush(addr); > >>+ mb(); > >> } > > > >I think the purpose of the flush is to force write back, not to evict > >the cache line, and if so wmb() would appear to be sufficient. As > >the SDM says that's not the case, a comment explaining why wmb() > >is not sufficient would seem necessary. Plus in the description I > > Seems wmb() is not sufficient here. > > "CLFLUSH is only ordered by the MFENCE instruction. It is not guaranteed to > be ordered by any other fencing, serializing or other CLFLUSH instruction." That is incorrect. We have observed that CLFLUSH instruction do serialize each other. That is if on a core you send a bunch of CLFLUSH it stalls the pipeline. Cc-ing Boris who discovered this. > > Thanks > Tiejun > > >think "serializing" needs to be changed to "fencing", as serialization > >is not what we really care about here. If you and the maintainers > >agree, I could certainly fix up both aspects while committing. > > > >Jan > > > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel