RE: [PATCH v4 02/24] powerpc/pseries: Fix alignment of PLPKS structures and buffers

From
David Laight <hidden>
Date
2023-01-27 09:05:45
Also in
linux-integrity, lkml
Reply to
Andrew Donnellan, 2023-01-27
From: Andrew Donnellan
Sent: 27 January 2023 03:21

On Thu, 2023-01-26 at 17:31 +0000, David Laight wrote:
quoted
Changing the size to kzalloc() doesn't help.
The alignment depends on the allocator and is only required to have
a relatively small alignment (ARCH_MINALIGN?) regardless of the size.

IIRC one of the allocators adds a small header to every item.
It won't return 16 byte aligned items at all.
I'm relying on the behaviour described in Documentation/core-
api/memory-allocation.rst:

    The address of a chunk allocated with kmalloc is aligned to at
    least ARCH_KMALLOC_MINALIGN bytes. For sizes which are a power of
    two, the alignment is also guaranteed to be at least the respective
    size.

Is this wrong?
The alignment for power of two doesn't match what I've inferred
from reading comments on other patches.

It is true for dma_malloc_coherent() - that does guarantee that a
16k allocate will be aligned on a 16k physical address boundary.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Thread (52 messages) 52 messages, 8 authors, last reply 2023-02-01
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help