Thread (29 messages) 29 messages, 6 authors, 2021-04-19

RE: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems

From: David Laight <hidden>
Date: 2021-04-17 10:59:28
Also in: linux-arm-kernel, linux-mips, linux-mm, lkml, netdev

From: Matthew Wilcox
Sent: 16 April 2021 16:28

On Thu, Apr 15, 2021 at 08:08:32PM +0200, Jesper Dangaard Brouer wrote:
quoted
See below patch.  Where I swap32 the dma address to satisfy
page->compound having bit zero cleared. (It is the simplest fix I could
come up with).
I think this is slightly simpler, and as a bonus code that assumes the
old layout won't compile.
Always a good plan.

...
 static inline dma_addr_t page_pool_get_dma_addr(struct page *page)
 {
-	return page->dma_addr;
+	dma_addr_t ret = page->dma_addr[0];
+	if (sizeof(dma_addr_t) > sizeof(unsigned long))
+		ret |= (dma_addr_t)page->dma_addr[1] << 32;
+	return ret;
+}
Won't some compiler/option combinations generate an
error for the '<< 32' when dma_addr_t is 32bit?

You might need to use a (u64) cast.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help