WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH 0/2] MTRR/PAT virtualization

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>, "Su, Disheng" <disheng.su@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH 0/2] MTRR/PAT virtualization
From: "Dong, Eddie" <eddie.dong@xxxxxxxxx>
Date: Tue, 9 Oct 2007 12:38:46 +0800
Delivery-date: Mon, 08 Oct 2007 21:39:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C32FB165.E882%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C32FA17F.E879%Keir.Fraser@xxxxxxxxxxxx> <C32FB165.E882%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcgJfbiHYf5t3raCT5qrRGbrSVAc4gAAyqLhAAJeet0AJqotAA==
Thread-topic: [Xen-devel] [PATCH 0/2] MTRR/PAT virtualization
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx wrote:
> 
> Given that this is probably only safe for non-RAM pages, and given
> that usually such mappings will be UC anyway, is there any advantage
> to this large patch except accelerated access to passed-through video
> framebuffer access? The current 'collapse all memory types to UC for
> non-RAM mappings'
> is I believe always safe,

Propogating guest memory type for MMIO only is what I posted last year
which is rejected by you since pass-through devices support are not in 
at that time :-(

But later on, with VT-d enabled, we found this is insufficient. We know
some
audio drivers will use non-snoopy + UC map for RAM buffers, and same for
video
batch buffers in addition to vram buffer. We have to propogating guest
RAM 
memory type too to fix the audio/video issues :-(

> Won't WBINVD and CLFLUSH also need to be virtualised?

Basically native OS can use WB + WBINVD
scenario for output buffer, but can't be used as input
buffer. I doutb if a driver will use different memory attribute
for input/output buffer. 

But, yes this is really a good point. So we need to do WBINVD when VP 
migrates (of course for pass-through domain only), while the prefered 
approach is to pin VCPU on pCPUs.

> 
> If there are reservations about how this will interact with mappings
> in qemu-dm, perhaps this new attribute mechanism should only be
> enabled for
> pass-thru domains? We get no benefit for non-pass-thru domains and
> some concern about correctness. 

Yes, we can do in this way.


> about Xen's own full 1:1 WB mapping of all RAM (x86/64 Xen
> only of course).

For a native OS, will OS unconditionally map the whole memory itself?
I think no, otherwise same issue will happen to native OS.

BTW, if we don't remove those fixed 1:1 mapping, even without MTRR
patch, we may meet problem in future when there are complicated drivers
in domain0. E.g. high end graphics driver in domain0 may use UC for its
batch
buffer, same for audio driver and other PCIe drivers in future.
Processor will see 2 different memory attribute in its direct page
table.

So I think Xen need to take same policy like native OS though it may be
painful. 
With Xen moving to client, those issue will become more popular.


> There is a missing piece here, to fully explain why this is bad: A
> page mapped WB permits speculative accesses. Thus data can be
> pulled into a CPU
> cache even though no load/store is ever actually executed on
> that data. This
> is particularly bad if a store operation is speculated -- then

Do u mean AMD processor support speculative write? I don't think
Intel processor support this.

> the data may
> be marked as Modified in the cache (even though it is not
> actually modified,
> just because the speculated operation is a store). Then it
> gets evicted at
> some random point in the future, and written back over
> whatever critical
> command structures happened to be residing there.

I may lose here. The MTRR patch only tighten the memory
access attribute, never loosen it, so we are toward much safer
direction, isn't it?


Anyway, we can split the patch into 2, one for MMIO only and
another one for both with RAM. Probably the patch is almost
same, just one line to eliminate the RAM mmeory type propogatio.


Thanks, eddie

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel