Skip to content

Commit

Permalink
Replace revert with upstream patch regarding dm-crypt bug
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Nov 14, 2023
1 parent fb404f2 commit 8f84454
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 106 deletions.
105 changes: 0 additions & 105 deletions 0001-Revert-dm-crypt-allocate-compound-pages-if-possible.patch

This file was deleted.

43 changes: 43 additions & 0 deletions 0001-swiotlb-xen-provide-the-max_mapping_size-method.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Date: Mon, 6 Nov 2023 18:12:30 +0100 (CET)
From: Keith Busch <[email protected]>
Subject: [PATCH v2] swiotlb-xen: provide the "max_mapping_size" method

There's a bug that when using the XEN hypervisor with bios with large
multi-page bio vectors on NVMe, the kernel deadlocks [1].

The deadlocks are caused by inability to map a large bio vector -
dma_map_sgtable always returns an error, this gets propagated to the block
layer as BLK_STS_RESOURCE and the block layer retries the request
indefinitely.

XEN uses the swiotlb framework to map discontiguous pages into contiguous
runs that are submitted to the PCIe device. The swiotlb framework has a
limitation on the length of a mapping - this needs to be announced with
the max_mapping_size method to make sure that the hardware drivers do not
create larger mappings.

Without max_mapping_size, the NVMe block driver would create large
mappings that overrun the maximum mapping size.

Reported-by: Marek Marczykowski-Górecki <[email protected]>
Link: https://lore.kernel.org/stable/ZTNH0qtmint%2FzLJZ@mail-itl/ [1]
Tested-by: Marek Marczykowski-Górecki <[email protected]>
Suggested-by: Christoph Hellwig <[email protected]>
Cc: [email protected]
Signed-off-by: Keith Busch <[email protected]>
Signed-off-by: Mikulas Patocka <[email protected]>

---
drivers/xen/swiotlb-xen.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-stable/drivers/xen/swiotlb-xen.c
===================================================================
--- linux-stable.orig/drivers/xen/swiotlb-xen.c 2023-11-03 17:57:18.000000000 +0100
+++ linux-stable/drivers/xen/swiotlb-xen.c 2023-11-06 15:30:59.000000000 +0100
@@ -405,4 +405,5 @@ const struct dma_map_ops xen_swiotlb_dma
.get_sgtable = dma_common_get_sgtable,
.alloc_pages = dma_common_alloc_pages,
.free_pages = dma_common_free_pages,
+ .max_mapping_size = swiotlb_max_mapping_size,
};
2 changes: 1 addition & 1 deletion kernel.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Patch26: 0001-sound-Disable-SG-buffer.patch
Patch27: 0001-amdgpu-timeout.patch
Patch28: 0001-iwlwifi-avoid-writing-to-MSI-X-page-when-MSI-X-is-no.patch
Patch29: 0001-xen-pciback-Consider-INTx-disabled-when-MSI-MSI-X-is.patch
Patch30: 0001-Revert-dm-crypt-allocate-compound-pages-if-possible.patch
Patch30: 0001-swiotlb-xen-provide-the-max_mapping_size-method.patch

# S0ix support:
Patch61: xen-events-Add-wakeup-support-to-xen-pirq.patch
Expand Down

0 comments on commit 8f84454

Please sign in to comment.