From: Andrew Cooper Date: Wed, 24 Sep 2014 16:28:15 +0000 (+0100) Subject: tools/libxc: Avoid cacheflush toolstack hypercalls on x86 X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4327 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c85c5adb7806e59874e737fa98562c3d123ee3f5;p=xen.git tools/libxc: Avoid cacheflush toolstack hypercalls on x86 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 CC: Keir Fraser CC: Jan Beulich CC: Tim Deegan CC: Ian Campbell CC: Ian Jackson CC: Wei Liu Acked-by: Ian Campbell --- diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 1a6f90abbc..6e0e3552de 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,