* [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
@ 2021-11-16 12:26 Pierre Morel
2021-11-16 12:27 ` Pierre Morel
0 siblings, 1 reply; 8+ messages in thread
From: Pierre Morel @ 2021-11-16 12:26 UTC (permalink / raw)
To: kvm; +Cc: frankja, david, thuth, cohuck, imbrenda
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 <pmorel@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
lib/s390x/malloc_io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/s390x/malloc_io.c b/lib/s390x/malloc_io.c
index 78582eac..080fc694 100644
--- a/lib/s390x/malloc_io.c
+++ b/lib/s390x/malloc_io.c
@@ -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));
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
2021-11-16 12:26 [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation Pierre Morel
@ 2021-11-16 12:27 ` Pierre Morel
0 siblings, 0 replies; 8+ messages in thread
From: Pierre Morel @ 2021-11-16 12:27 UTC (permalink / raw)
To: kvm; +Cc: frankja, david, thuth, cohuck, imbrenda
Sorry ... manipulation error
On 11/16/21 13:26, Pierre Morel wrote:
> 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 <pmorel@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> lib/s390x/malloc_io.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/s390x/malloc_io.c b/lib/s390x/malloc_io.c
> index 78582eac..080fc694 100644
> --- a/lib/s390x/malloc_io.c
> +++ b/lib/s390x/malloc_io.c
> @@ -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));
>
>
--
Pierre Morel
IBM Lab Boeblingen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
2021-11-11 10:01 Pierre Morel
2021-11-11 10:14 ` David Hildenbrand
@ 2021-11-11 15:10 ` Janosch Frank
1 sibling, 0 replies; 8+ messages in thread
From: Janosch Frank @ 2021-11-11 15:10 UTC (permalink / raw)
To: Pierre Morel, kvm; +Cc: david, thuth, cohuck, imbrenda
On 11/11/21 11:01, Pierre Morel wrote:
> 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 <pmorel@linux.ibm.com>
> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> lib/s390x/malloc_io.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/s390x/malloc_io.c b/lib/s390x/malloc_io.c
> index 78582eac..080fc694 100644
> --- a/lib/s390x/malloc_io.c
> +++ b/lib/s390x/malloc_io.c
> @@ -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));
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
2021-11-11 10:39 ` David Hildenbrand
@ 2021-11-11 11:55 ` Pierre Morel
0 siblings, 0 replies; 8+ messages in thread
From: Pierre Morel @ 2021-11-11 11:55 UTC (permalink / raw)
To: David Hildenbrand, Claudio Imbrenda; +Cc: kvm, frankja, thuth, cohuck
On 11/11/21 11:39, David Hildenbrand wrote:
> On 11.11.21 11:28, Claudio Imbrenda wrote:
>> On Thu, 11 Nov 2021 11:14:53 +0100
>> David Hildenbrand <david@redhat.com> wrote:
>>
>>> On 11.11.21 11:01, Pierre Morel wrote:
>>>> 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.
>>
>
> 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.
--
Pierre Morel
IBM Lab Boeblingen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
2021-11-11 10:28 ` Claudio Imbrenda
@ 2021-11-11 10:39 ` David Hildenbrand
2021-11-11 11:55 ` Pierre Morel
0 siblings, 1 reply; 8+ messages in thread
From: David Hildenbrand @ 2021-11-11 10:39 UTC (permalink / raw)
To: Claudio Imbrenda; +Cc: Pierre Morel, kvm, frankja, thuth, cohuck
On 11.11.21 11:28, Claudio Imbrenda wrote:
> On Thu, 11 Nov 2021 11:14:53 +0100
> David Hildenbrand <david@redhat.com> wrote:
>
>> On 11.11.21 11:01, Pierre Morel wrote:
>>> 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.
>
I know, but is this fixing a failing test or is this just a pro-activ fix?
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
2021-11-11 10:14 ` David Hildenbrand
@ 2021-11-11 10:28 ` Claudio Imbrenda
2021-11-11 10:39 ` David Hildenbrand
0 siblings, 1 reply; 8+ messages in thread
From: Claudio Imbrenda @ 2021-11-11 10:28 UTC (permalink / raw)
To: David Hildenbrand; +Cc: Pierre Morel, kvm, frankja, thuth, cohuck
On Thu, 11 Nov 2021 11:14:53 +0100
David Hildenbrand <david@redhat.com> wrote:
> On 11.11.21 11:01, Pierre Morel wrote:
> > 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
2021-11-11 10:01 Pierre Morel
@ 2021-11-11 10:14 ` David Hildenbrand
2021-11-11 10:28 ` Claudio Imbrenda
2021-11-11 15:10 ` Janosch Frank
1 sibling, 1 reply; 8+ messages in thread
From: David Hildenbrand @ 2021-11-11 10:14 UTC (permalink / raw)
To: Pierre Morel, kvm; +Cc: frankja, thuth, cohuck, imbrenda
On 11.11.21 11:01, Pierre Morel wrote:
> 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?
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 8+ messages in thread
* [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation
@ 2021-11-11 10:01 Pierre Morel
2021-11-11 10:14 ` David Hildenbrand
2021-11-11 15:10 ` Janosch Frank
0 siblings, 2 replies; 8+ messages in thread
From: Pierre Morel @ 2021-11-11 10:01 UTC (permalink / raw)
To: kvm; +Cc: frankja, david, thuth, cohuck, imbrenda
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 <pmorel@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
lib/s390x/malloc_io.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/s390x/malloc_io.c b/lib/s390x/malloc_io.c
index 78582eac..080fc694 100644
--- a/lib/s390x/malloc_io.c
+++ b/lib/s390x/malloc_io.c
@@ -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));
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-16 12:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 12:26 [kvm-unit-tests PATCH v2] s390x: fixing I/O memory allocation Pierre Morel
2021-11-16 12:27 ` Pierre Morel
-- strict thread matches above, loose matches on Subject: below --
2021-11-11 10:01 Pierre Morel
2021-11-11 10:14 ` David Hildenbrand
2021-11-11 10:28 ` Claudio Imbrenda
2021-11-11 10:39 ` David Hildenbrand
2021-11-11 11:55 ` Pierre Morel
2021-11-11 15:10 ` Janosch Frank
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).