* [PATCH v2 for-4.5] tools/libxc: Avoid cacheflush toolstack hypercalls on x86
@ 2014-09-24 16:28 Andrew Cooper
0 siblings, 0 replies; only message in thread
From: Andrew Cooper @ 2014-09-24 16:28 UTC (permalink / raw)
To: Xen-devel
Cc: Keir Fraser, Ian Campbell, Andrew Cooper, Ian Jackson, Tim Deegan,
Jan Beulich, Wei Liu
XEN_DOMCTL_cacheflush hypercalls are (and will always be) -ENOSYS on x86, but
xc_domain_cacheflush() is called often during domain build and migrate for
correct behaviour on ARM.
Stub xc_domain_cacheflush() out on x86 to remove its pressure on the global
domctl lock, and the hypercall overhead (which applies further pressure to the
already heavily-contended TLB flush lock).
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
v2:
* Reduce wording in the patch, as it not really needed in the code, and is
covered in the commit message
---
tools/libxc/xc_domain.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 1a6f90a..6e0e355 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -51,12 +51,22 @@ int xc_domain_create(xc_interface *xch,
int xc_domain_cacheflush(xc_interface *xch, uint32_t domid,
xen_pfn_t start_pfn, xen_pfn_t nr_pfns)
{
+#if defined (__i386__) || defined (__x86_64__)
+ /*
+ * The x86 architecture provides cache coherency guarantees which prevent
+ * the need for this hypercall. Avoid the overhead of making a hypercall
+ * just for Xen to return -ENOSYS.
+ */
+ errno = ENOSYS;
+ return -1;
+#else
DECLARE_DOMCTL;
domctl.cmd = XEN_DOMCTL_cacheflush;
domctl.domain = (domid_t)domid;
domctl.u.cacheflush.start_pfn = start_pfn;
domctl.u.cacheflush.nr_pfns = nr_pfns;
return do_domctl(xch, &domctl);
+#endif
}
int xc_domain_pause(xc_interface *xch,
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-24 16:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 16:28 [PATCH v2 for-4.5] tools/libxc: Avoid cacheflush toolstack hypercalls on x86 Andrew Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).