From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: Anup Patel <apatel@apm.com>,
Andre Przywara <andre.przywara@calxeda.com>,
tim@xen.org, Pranavkumar Sawargaonkar <psawargaonkar@apm.com>,
stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH] tools: libxc: flush data cache after loading images into guest memory
Date: Thu, 12 Dec 2013 14:11:49 +0000 [thread overview]
Message-ID: <52A9C425.7030109@linaro.org> (raw)
In-Reply-To: <1386850863-16373-1-git-send-email-ian.campbell@citrix.com>
On 12/12/2013 12:21 PM, Ian Campbell wrote:
> On ARM guest OSes are started with MMU and Caches disables (as they are on
> native) however caching is enabled in the domain running the builder and
> therefore we must flush the cache as we load the blobs, otherwise when the
> guest starts running it may not see them. The dom0 build in the hypervisor has
> the same requirements and already does the right thing.
>
> The mechanism for performing a cache flush from userspace is OS specific, so
> implement this as a new osdep hook:
>
> - On 32-bit ARM Linux provides a system call to flush the cache.
> - On 64-bit ARM Linux the processor is configured to allow cache flushes
> directly from userspace.
> - Non-Linux platforms will need to provide their own implementation. If
> similar mechanisms are not available then a new privcmd ioctl should be a
> suitable alternative.
>
> No cache maintenance is required on x86, so provide a stub for all non-Linux
> platforms which returns success on x86 only and log an error otherwise.
>
> This fixes guest building on Xgene which has a very large L3 cache and so is
> particularly susceptible to this problem. It has also been observed
> sporadically on midway.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Andre Przywara <andre.przywara@calxeda.com>
> Cc: Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
> Cc: Anup Patel <apatel@apm.com>
> ---
> Freeze: Bugfix.
> ---
> tools/libxc/xc_dom_armzimageloader.c | 1 +
> tools/libxc/xc_dom_binloader.c | 1 +
> tools/libxc/xc_dom_core.c | 2 ++
> tools/libxc/xc_linux_osdep.c | 39 ++++++++++++++++++++++++++++++++++
> tools/libxc/xc_minios.c | 11 ++++++++++
> tools/libxc/xc_netbsd.c | 12 +++++++++++
> tools/libxc/xc_private.c | 5 +++++
> tools/libxc/xc_private.h | 3 +++
> tools/libxc/xc_solaris.c | 12 +++++++++++
> tools/libxc/xenctrl_osdep_ENOSYS.c | 6 ++++++
> tools/libxc/xenctrlosdep.h | 1 +
> 11 files changed, 93 insertions(+)
>
[..]
> diff --git a/tools/libxc/xenctrl_osdep_ENOSYS.c b/tools/libxc/xenctrl_osdep_ENOSYS.c
> index 4821342..c6fceff 100644
> --- a/tools/libxc/xenctrl_osdep_ENOSYS.c
> +++ b/tools/libxc/xenctrl_osdep_ENOSYS.c
> @@ -63,6 +63,10 @@ static void *ENOSYS_privcmd_map_foreign_ranges(xc_interface *xch, xc_osdep_handl
> return MAP_FAILED;
> }
>
> +static void ENOSYS_privcmd_cache_flush(xc_interface *xch, const void *p, size_t n)
> +{
> +}
> +
Missing IPRINTF for this function.
> static struct xc_osdep_ops ENOSYS_privcmd_ops =
> {
> .open = &ENOSYS_privcmd_open,
> @@ -74,6 +78,8 @@ static struct xc_osdep_ops ENOSYS_privcmd_ops =
> .map_foreign_bulk = &ENOSYS_privcmd_map_foreign_bulk,
> .map_foreign_range = &ENOSYS_privcmd_map_foreign_range,
> .map_foreign_ranges = &ENOSYS_privcmd_map_foreign_ranges,
> +
> + .cache_flush = &ENOSYS_privcmd_cache_flush,
> }
> };
>
> diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h
> index e610a24..6c9a005 100644
> --- a/tools/libxc/xenctrlosdep.h
> +++ b/tools/libxc/xenctrlosdep.h
> @@ -89,6 +89,7 @@ struct xc_osdep_ops
> void *(*map_foreign_ranges)(xc_interface *xch, xc_osdep_handle h, uint32_t dom, size_t size, int prot,
> size_t chunksize, privcmd_mmap_entry_t entries[],
> int nentries);
> + void (*cache_flush)(xc_interface *xch, const void *p, size_t n);
> } privcmd;
> struct {
> int (*fd)(xc_evtchn *xce, xc_osdep_handle h);
>
--
Julien Grall
next prev parent reply other threads:[~2013-12-12 14:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 12:21 [PATCH] tools: libxc: flush data cache after loading images into guest memory Ian Campbell
2013-12-12 14:11 ` Julien Grall [this message]
2013-12-12 14:23 ` [PATCH v2] " Ian Campbell
2013-12-12 14:30 ` Stefano Stabellini
2013-12-12 14:37 ` Ian Campbell
2013-12-12 14:45 ` Stefano Stabellini
2013-12-12 14:49 ` Ian Campbell
2013-12-12 17:31 ` Ian Campbell
2013-12-12 17:52 ` Ian Jackson
2013-12-12 19:32 ` Ian Campbell
2013-12-12 19:43 ` Ian Jackson
2013-12-12 17:33 ` Ian Campbell
2013-12-13 0:49 ` Julien Grall
2013-12-13 8:26 ` Ian Campbell
2013-12-13 12:01 ` Stefano Stabellini
2013-12-13 12:53 ` Ian Campbell
2013-12-16 0:49 ` Julien Grall
2013-12-16 11:05 ` 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=52A9C425.7030109@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@calxeda.com \
--cc=apatel@apm.com \
--cc=ian.campbell@citrix.com \
--cc=psawargaonkar@apm.com \
--cc=stefano.stabellini@eu.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.