tools/libxc: retry hypercall in case of EFAULT
authorJuergen Gross <jgross@suse.com>
Mon, 18 Jun 2018 07:18:56 +0000 (09:18 +0200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 18 Jun 2018 11:31:50 +0000 (12:31 +0100)
commit988d66cb78c35c620c2a0eb01bac842e4e99bf0e
tree4b3c52d8c7406c1ffd251e17dbe89de618350c16
parent171d6ecec1efca5a3e395a08acb299453a957528
tools/libxc: retry hypercall in case of EFAULT

A hypercall issued via the privcmd driver can very rarely return
-EFAULT even if the hypercall buffers are locked in memory. This
happens for hypercall buffers in user memory when the Linux kernel
is doing memory scans e.g. for page migration or compaction.

Retry the getpageframeinfo3 hypercall up to 2 times in case
-EFAULT is returned and the hypervisor might see invalid PTEs for
user hypercall buffers (which should be the case only if the kernel
doesn't offer a /dev/xen/hypercall node).

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_private.c
tools/libxc/xc_private.h