[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/2] xen/swiotlb: fix allocated size
On 16.09.24 09:59, Jan Beulich wrote: On 16.09.2024 08:47, Juergen Gross wrote:The allocated size in xen_swiotlb_alloc_coherent() and xen_swiotlb_free_coherent() is calculated wrong for the case of XEN_PAGE_SIZE not matching PAGE_SIZE. Fix that. Fixes: 7250f422da04 ("xen-swiotlb: use actually allocated size on check physical continuous") Reported-by: Jan Beulich <jbeulich@xxxxxxxx> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>--- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -147,7 +147,7 @@ xen_swiotlb_alloc_coherent(struct device *dev, size_t size, void *ret;/* Align the allocation to the Xen page size */- size = 1UL << (order + XEN_PAGE_SHIFT); + size = ALIGN(size, XEN_PAGE_SIZE);The way you're doing it has further positive effects, as the size is now also no longer needlessly over-aligned. May want mentioning in the description. Hope of course is that no-one came to rely on the up-to-next-power-of-2 allocation anywhere (which of course would be a bug there, yet might end in a perceived regression). Quite unlikely IMHO, as this is a Xen-only behavior. I'm not aware of any hardware used with Xen only. So for a regression to happen the driver allocating DMA memory would need to have a Xen-specific handling relying on the higher alignment. Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature.asc
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |