]> git.proxmox.com Git - mirror_qemu.git/commit
xen/mapcache: store dma information in revmapcache entries for debugging
authorStefano Stabellini <sstabellini@kernel.org>
Wed, 3 May 2017 21:00:35 +0000 (14:00 -0700)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Fri, 1 Sep 2017 23:15:24 +0000 (18:15 -0500)
commit2f64063f4e96eac79087c1eefb0b8b32097108e2
treee0440b4bc54ee92c2954a570851da7dd23d63572
parent15d8f91446fe922ccabb20b7e4ab4b32d8f7b5a7
xen/mapcache: store dma information in revmapcache entries for debugging

The Xen mapcache is able to create long term mappings, they are called
"locked" mappings. The third parameter of the xen_map_cache call
specifies if a mapping is a "locked" mapping.

>From the QEMU point of view there are two kinds of long term mappings:

[a] device memory mappings, such as option roms and video memory
[b] dma mappings, created by dma_memory_map & friends

After certain operations, ballooning a VM in particular, Xen asks QEMU
kindly to destroy all mappings. However, certainly [a] mappings are
present and cannot be removed. That's not a problem as they are not
affected by balloonning. The *real* problem is that if there are any
mappings of type [b], any outstanding dma operations could fail. This is
a known shortcoming. In other words, when Xen asks QEMU to destroy all
mappings, it is an error if any [b] mappings exist.

However today we have no way of distinguishing [a] from [b]. Because of
that, we cannot even print a decent warning.

This patch introduces a new "dma" bool field to MapCacheRev entires, to
remember if a given mapping is for dma or is a long term device memory
mapping. When xen_invalidate_map_cache is called, we print a warning if
any [b] mappings exist. We ignore [a] mappings.

Mappings created by qemu_map_ram_ptr are assumed to be [a], while
mappings created by address_space_map->qemu_ram_ptr_length are assumed
to be [b].

The goal of the patch is to make debugging and system understanding
easier.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
(cherry picked from commit 1ff7c5986a515d2d936eba026ff19947bbc7cb92)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
exec.c
include/sysemu/xen-mapcache.h
xen-mapcache.c