diff options
author | Jan Beulich | 2021-09-07 14:05:12 +0200 |
---|---|---|
committer | Juergen Gross | 2021-09-15 08:42:04 +0200 |
commit | d9a688add3d412c840e31060847a6a297b552316 (patch) | |
tree | 0445d0c092a50df2c01cc221e505aa1eb9515ca5 /samples/kfifo | |
parent | 4c092c59015f7adf0f07685f869edb96d997a756 (diff) |
swiotlb-xen: maintain slab count properly
Generic swiotlb code makes sure to keep the slab count a multiple of the
number of slabs per segment. Yet even without checking whether any such
assumption is made elsewhere, it is easy to see that xen_swiotlb_fixup()
might alter unrelated memory when calling xen_create_contiguous_region()
for the last segment, when that's not a full one - the function acts on
full order-N regions, not individual pages.
Align the slab count suitably when halving it for a retry. Add a build
time check and a runtime one. Replace the no longer useful local
variable "slabs" by an "order" one calculated just once, outside of the
loop. Re-use "order" for calculating "dma_bits", and change the type of
the latter as well as the one of "i" while touching this anyway.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/dc054cb0-bec4-4db0-fc06-c9fc957b6e66@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'samples/kfifo')
0 files changed, 0 insertions, 0 deletions