Xen queue

Fix a bug on FreeBSD when doing a migration.
 -----BEGIN PGP SIGNATURE-----
 
 iQFOBAABCgA4FiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAlyRDYcaHGFudGhvbnku
 cGVyYXJkQGNpdHJpeC5jb20ACgkQDPVXL9f7Va9JcAf+JZAEjaZOMmrtC5/J6Uqn
 d7lI4+heGZmlkC67iJz/x0xL07G+ZJfKs/4m8xTSxLtil0KMluUMwr2PkPnoT+5m
 xrjxlFunhfcjWhj18/VkJVvHzD8s7kqxVX3N2WGc+9MKbqzhjw++NG8tLG60n2Gf
 r1IqlNex8fDiAQkZyIlGn9lQsyWYtvx+JxR1jVjZFY9cZZpTGo3qWA7fqDfkbqKQ
 a+brlcNnMjcmmslfmjD2vJu/MJ+W3P0kXRJDhVKzFRQuMviv8Phnb+WjBVz591IR
 opvTAFW9RMb4sc/V0V5KcaMTzpTpHYuozSkrdXiPwNJRu3gPu7uyfYr0HRuXj1rZ
 pA==
 =nPro
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190319' into staging

Xen queue

Fix a bug on FreeBSD when doing a migration.

# gpg: Signature made Tue 19 Mar 2019 15:40:55 GMT
# gpg:                using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF
# gpg:                issuer "anthony.perard@citrix.com"
# gpg: Good signature from "Anthony PERARD <anthony.perard@gmail.com>" [marginal]
# gpg:                 aka "Anthony PERARD <anthony.perard@citrix.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 5379 2F71 024C 600F 778A  7161 D8D5 7199 DF83 42C8
#      Subkey fingerprint: F80C 0063 08E2 2CFD 8A92  E798 0CF5 572F D7FB 55AF

* remotes/aperard/tags/pull-xen-20190319:
  xen-mapcache: use MAP_FIXED flag so the mmap address hint is always honored

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-03-19 15:47:13 +00:00
commit 9bc59ffd9e

View File

@ -184,9 +184,14 @@ static void xen_remap_bucket(MapCacheEntry *entry,
pfns[i] = (address_index << (MCACHE_BUCKET_SHIFT-XC_PAGE_SHIFT)) + i;
}
/*
* If the caller has requested the mapping at a specific address use
* MAP_FIXED to make sure it's honored.
*/
if (!dummy) {
vaddr_base = xenforeignmemory_map2(xen_fmem, xen_domid, vaddr,
PROT_READ | PROT_WRITE, 0,
PROT_READ | PROT_WRITE,
vaddr ? MAP_FIXED : 0,
nb_pfn, pfns, err);
if (vaddr_base == NULL) {
perror("xenforeignmemory_map2");
@ -198,7 +203,8 @@ static void xen_remap_bucket(MapCacheEntry *entry,
* mapping immediately due to certain circumstances (i.e. on resume now)
*/
vaddr_base = mmap(vaddr, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0);
MAP_ANON | MAP_SHARED | (vaddr ? MAP_FIXED : 0),
-1, 0);
if (vaddr_base == MAP_FAILED) {
perror("mmap");
exit(-1);