]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
authorJoe Jin <joe.jin@oracle.com>
Thu, 17 May 2018 19:33:28 +0000 (12:33 -0700)
committerBrian Maly <brian.maly@oracle.com>
Mon, 11 Jun 2018 20:32:24 +0000 (16:32 -0400)
commitddcf804ba7f4856849323145e348d75180d40406
tree49f9158321faf089c5c5d3aefcbe8de849e74b3f
parentd6c8d3ed5ccc454ef8ccbb53fc75f35973ea0da8
xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent

When run raidconfig from Dom0 we found that the Xen DMA heap is reduced,
but Dom Heap is increased by the same size. Tracing raidconfig we found
that the related ioctl() in megaraid_sas will call dma_alloc_coherent()
to apply memory. If the memory allocated by Dom0 is not in the DMA area,
it will exchange memory with Xen to meet the requiment. Later drivers
call dma_free_coherent() to free the memory, on xen_swiotlb_free_coherent()
the check condition (dev_addr + size - 1 <= dma_mask) is always false,
it prevents calling xen_destroy_contiguous_region() to return the memory
to the Xen DMA heap.

This issue introduced by commit 6810df88dcfc2 "xen-swiotlb: When doing
coherent alloc/dealloc check before swizzling the MFNs.".

(cherry picked from commit 4855c92dbb7b3b85c23e88ab7ca04f99b9677b41)
Orabug: 22910685

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tested-by: John Sobecki <john.sobecki@oracle.com>
Reviewed-by: Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/xen/swiotlb-xen.c