From: David Vrabel <dvrabel@cantab.net>
To: Ian Campbell <Ian.Campbell@citrix.com>,
xen-devel <xen-devel@lists.xen.org>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Julien Grall <julien.grall@citrix.com>,
Stefano.Stabellini@citrix.com,
David Vrabel <david.vrabel@citrix.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH RFC] xen: arm: use uncached foreign mappings when building guests
Date: Wed, 18 Dec 2013 18:41:07 +0000 [thread overview]
Message-ID: <52B1EC43.7030408@cantab.net> (raw)
In-Reply-To: <1387387710.28680.88.camel@kazak.uk.xensource.com>
On 18/12/2013 17:28, Ian Campbell wrote:
> When building an ARM guest we need to take care of cache maintenance
> because the guest starts with MMU and cache disabled, which means we
> need to make sure that the initial images (kernel, initrd, dtb) which we
> write to guest memory are not in the cache.
>
> We thought we had solved this with "tools: libxc: flush data cache after
> loading images into guest memory" (a0035ecc0d82) however it turns out
> that there are a couple of issues with this approach:
>
> Firstly we need to do a cache flush from userspace, on arm64 this is
> possible by directly using the instructions from userspace, but on arm32
> this is not possible and so we need to use a system call. Unfortunately
> the system call provided by Linux for this purpose does not flush far
> enough down the cache hierarchy. Extending the system call would not be
> an insurmountable barrier, were it not for the second issue:
>
> Secondly, and more importantly, Catalin Marinas points out (via Marc
> Zyngier) that there is a race between the cache flush and the point
> where we tear down the mappings, where the processor might speculatively
> pull some data into the cache (cache flushes are by Virtual Address, so
> this race is unavoidable).
>
> If this happens then guest kernels which modify some code/data before
> enabling MMUs + caches may see stale data in the cache.
Would this same problem with occur with save/restore of a guest that has
caching disabled? If so, this would require using uncached foreign
mappings for save/restore which I would think would make performance suck.
Does the same problem occur if the guest has MMU and caching enabled but
has uncached mappings?
Is there not some sort of cache flush you can do /after/ tearing down
the foreign mappings? Flush all by ASID or similar?
Would this also require that granted pages must only have cachable
mappings in the granting domain? If so, this should be documented as
part of the ABI.
David
next prev parent reply other threads:[~2013-12-18 18:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 17:28 [PATCH RFC] xen: arm: use uncached foreign mappings when building guests Ian Campbell
2013-12-18 17:30 ` [PATCH LINUX RFC] xen: privcmd: implement IOCTL_PRIVCMD_MMAPBATCH_V2_UNCACHED Ian Campbell
2013-12-18 19:24 ` Stefano Stabellini
2013-12-18 21:16 ` Konrad Rzeszutek Wilk
2013-12-20 9:19 ` Ian Campbell
2013-12-20 14:13 ` Konrad Rzeszutek Wilk
2013-12-20 14:18 ` Ian Campbell
2013-12-20 14:38 ` Konrad Rzeszutek Wilk
2013-12-20 14:44 ` Ian Campbell
2013-12-18 17:30 ` [PATCH XEN RFC] libxc: use an uncached mapping of guest ram in domain builder Ian Campbell
2013-12-18 21:14 ` Konrad Rzeszutek Wilk
2013-12-20 9:19 ` Ian Campbell
2013-12-18 18:41 ` David Vrabel [this message]
2013-12-19 10:10 ` [PATCH RFC] xen: arm: use uncached foreign mappings when building guests Ian Campbell
2013-12-19 11:23 ` Stefano Stabellini
2013-12-19 11:29 ` Ian Campbell
2014-01-02 15:10 ` David Vrabel
2014-01-06 10:05 ` Ian Campbell
2013-12-19 4:16 ` Julien Grall
2013-12-19 4:26 ` Julien Grall
2013-12-19 14:30 ` Ian Campbell
2014-01-06 12:10 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B1EC43.7030408@cantab.net \
--to=dvrabel@cantab.net \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=Stefano.Stabellini@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=julien.grall@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.