s390x: fixing I/O memory allocation
PATCH v2 1/1 s390x: fixing I/O memory allocation
The allocator allocate pages it follows the size must be rounded to pages before the allocation.
--- lib/s390x/malloc_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/s390x/malloc_io.c +2 -2
@@ -41,7 +41,7 @@ static void unshare_pages(void *p, int count)void *alloc_io_mem (int size,int flags) { -int order =get_order (size >>PAGE_SHIFT ); +int order =get_order (PAGE_ALIGN (size) >>PAGE_SHIFT );void *p;int n;
@@ -62,7 +62,7 @@ void *alloc_io_mem(int size, int flags)void free_io_mem (void *p,int size) { -int order =get_order (size >>PAGE_SHIFT ); +int order =get_order (PAGE_ALIGN (size) >>PAGE_SHIFT );assert (IS_ALIGNED ((uintptr_t )p,PAGE_SIZE ));
Signature · 1 line
2.25.1
Quoted 5 lines · Pierre Morel
The allocator allocate pages it follows the size must be rounded to pages before the allocation.
Fixes b0fe3988 "s390x: define UV compatible I/O allocation"
What's the symptom of this? A failing test? Or is this just a pro-activ fix?
Signature · 3 lines
Thanks, David / dhildenb
Quoted 8 lines · On Thu, 11 Nov 2021 11:14:53 +0100 David Hildenbrand <[email protected]> wrote:
Quoted 5 lines · Pierre Morel
The allocator allocate pages it follows the size must be rounded to pages before the allocation.
Fixes b0fe3988 "s390x: define UV compatible I/O allocation"What's the symptom of this? A failing test? Or is this just a pro-activ fix?
if size < PAGE_SIZE then we would allocate 0, and in general we are rounding down instead of up, which is obviously wrong.
Quoted 7 lines · Claudio Imbrenda
Quoted 4 lines · On Thu, 11 Nov 2021 11:14:53 +0100 David Hildenbrand <[email protected]> wrote:
Quoted 3 lines · Pierre Morel
The allocator allocate pages it follows the size must be rounded to pages before the allocation.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes b0fe3988 "s390x: define UV compatible I/O allocation"What's the symptom of this? A failing test? Or is this just a pro-activ fix?
if size <
PAGE_SIZEthen we would allocate 0, and in general we are rounding down instead of up, which is obviously wrong.
I know, but is this fixing a failing test or is this just a pro-activ fix?
Signature · 3 lines
Thanks, David / dhildenb
Quoted 11 lines · David Hildenbrand
Quoted 10 lines · Claudio Imbrenda
Quoted 7 lines · On Thu, 11 Nov 2021 11:14:53 +0100 David Hildenbrand <[email protected]> wrote:
Quoted 5 lines · Pierre Morel
The allocator allocate pages it follows the size must be rounded to pages before the allocation.
Fixes b0fe3988 "s390x: define UV compatible I/O allocation"
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
What's the symptom of this? A failing test? Or is this just a pro-activ fix?
if size <
PAGE_SIZEthen we would allocate 0, and in general we are rounding down instead of up, which is obviously wrong.I know, but is this fixing a failing test or is this just a pro-activ fix?
It is not fixing an existing test but it must be fixed before the VIRTIO test that I am currently developing. In the current tests we do not allocate sizes greater than 1 page that are no multiple of pages.
Signature · 2 lines
Pierre Morel IBM Lab Boeblingen
Quoted 7 lines · Pierre Morel
The allocator allocate pages it follows the size must be rounded to pages before the allocation.
Fixes b0fe3988 "s390x: define UV compatible I/O allocation"Signed-off-by Pierre Morel <[email protected]>Reviewed-by Claudio Imbrenda <[email protected]>
Quoted 27 lines
--- lib/s390x/malloc_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/s390x/malloc_io.c +2
-2@@ -41,7 +41,7 @@ static void unshare_pages(void *p, int count)void *alloc_io_mem (int size,int flags) { -int order =get_order (size >>PAGE_SHIFT ); +int order =get_order (PAGE_ALIGN (size) >>PAGE_SHIFT );void *p;int n;@@ -62,7 +62,7 @@ void *alloc_io_mem(int size, int flags)void free_io_mem (void *p,int size) { -int order =get_order (size >>PAGE_SHIFT ); +int order =get_order (PAGE_ALIGN (size) >>PAGE_SHIFT );assert (IS_ALIGNED ((uintptr_t )p,PAGE_SIZE ));