From: "Jan Beulich" Subject: Re: [PATCH 8/8] x86/EPT: IOMMU snoop capability should not affect memory type selection Date: Fri, 04 Apr 2014 09:28:20 +0100 Message-ID: <533E8944020000780000586F@nat28.tlf.novell.com> References: <5332FF1902000078000027A2@nat28.tlf.novell.com> <533302520200007800002848@nat28.tlf.novell.com> <20140327151211.GJ91759@deinos.phlegethon.org> <533452B40200007800002FFF@nat28.tlf.novell.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 1WVzU8-00033l-DF for xen-devel@lists.xenproject.org; Fri, 04 Apr 2014 08:28:24 +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: Kevin Tian Cc: Keir Fraser , Tim Deegan , Eddie Dong , Jun Nakajima , Yang Z Zhang , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 04.04.14 at 09:30, wrote: >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Thursday, March 27, 2014 11:33 PM >> >> >>> On 27.03.14 at 16:12, wrote: >> > At 15:37 +0000 on 26 Mar (1395844658), Jan Beulich wrote: >> >> This capability solely makes a statement on cache coherency guarantees >> >> by the IOMMU. It does specifically not imply any further guarantees >> >> implied by certain memory types (cachability, ordering). >> > >> > Can you give some examples of what this is protecting against? >> > >> > Cachability is irrelevant unless there's some other form of direct >> > access that's not covered by the IOMMU, and x86 ordering is pretty >> > strict. >> >> What the IOMMU gets to see already depends on cachability: Especially >> for write buffers (WC) I don't think cache coherence really matters. >> >> And my understanding of "snoop" also means that stuff held in caches >> (WB) may not become visible as needed when some RAM page is >> shared between CPU and some device (namely a GPU): The IOMMU >> can certainly snoop any accesses that hit the bus, but I don't think it >> can enforce write-back to happen for an area that's marked WB but >> was supposed to be UC. But maybe I'm wrong with this... >> > > WC is essentially a UC type, with only difference on caching writes in > a store buffer. The out-of-order implication means that WC is only used > for I/O buffers w/o write order requirements, e.g. frame buffer. GPU > access to frame buffer is not snooped, or more specifically, it may use > a different physical address (through GPU page table), which is different > from the address written by CPU (typically a PCI bar). Using WB on pages > which are supposed to WC doesn't work. Which isn't answering the original question (or at least I'm not able to derive the answer from your statement above): Is this patch (or parts thereof) correct? > However, in virtualization WC may be used on memory pages, e.g. a > virtual frame buffer provided by Qemu. In that scenario WC must be > replaced with WB, otherwise there's cache inconsistency problem when > Qemu accesses virtual frame buffer as WB while guest uses WC. But that's being taken care of already by qemu pinning the memory attribute of the frame buffer to WB. I.e. we need to only be concerned of pass-through cards' frame buffers (and alike). Jan