mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
dbe97cff7d
unmap_grant_pages() currently waits for the pages to no longer be used.
In https://github.com/QubesOS/qubes-issues/issues/7481, this lead to a
deadlock against i915: i915 was waiting for gntdev's MMU notifier to
finish, while gntdev was waiting for i915 to free its pages. I also
believe this is responsible for various deadlocks I have experienced in
the past.
Avoid these problems by making unmap_grant_pages async. This requires
making it return void, as any errors will not be available when the
function returns. Fortunately, the only use of the return value is a
WARN_ON(), which can be replaced by a WARN_ON when the error is
detected. Additionally, a failed call will not prevent further calls
from being made, but this is harmless.
Because unmap_grant_pages is now async, the grant handle will be sent to
INVALID_GRANT_HANDLE too late to prevent multiple unmaps of the same
handle. Instead, a separate bool array is allocated for this purpose.
This wastes memory, but stuffing this information in padding bytes is
too fragile. Furthermore, it is necessary to grab a reference to the
map before making the asynchronous call, and release the reference when
the call returns.
It is also necessary to guard against reentrancy in gntdev_map_put(),
and to handle the case where userspace tries to map a mapping whose
contents have not all been freed yet.
Fixes:
|
||
---|---|---|
.. | ||
events | ||
xen-pciback | ||
xenbus | ||
xenfs | ||
acpi.c | ||
arm-device.c | ||
balloon.c | ||
biomerge.c | ||
cpu_hotplug.c | ||
dbgp.c | ||
efi.c | ||
evtchn.c | ||
features.c | ||
gntalloc.c | ||
gntdev-common.h | ||
gntdev-dmabuf.c | ||
gntdev-dmabuf.h | ||
gntdev.c | ||
grant-dma-iommu.c | ||
grant-dma-ops.c | ||
grant-table.c | ||
Kconfig | ||
Makefile | ||
manage.c | ||
mcelog.c | ||
mem-reservation.c | ||
pci.c | ||
pcpu.c | ||
platform-pci.c | ||
privcmd-buf.c | ||
privcmd.c | ||
privcmd.h | ||
pvcalls-back.c | ||
pvcalls-front.c | ||
pvcalls-front.h | ||
swiotlb-xen.c | ||
sys-hypervisor.c | ||
time.c | ||
unpopulated-alloc.c | ||
xen-acpi-pad.c | ||
xen-acpi-processor.c | ||
xen-balloon.c | ||
xen-front-pgdir-shbuf.c | ||
xen-scsiback.c | ||
xlate_mmu.c |