All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com,
	cohuck@redhat.com, imbrenda@linux.ibm.com
Subject: [kvm-unit-tests PATCH 2/2] s390x: fixing I/O memory allocation
Date: Wed, 25 Aug 2021 18:20:21 +0200	[thread overview]
Message-ID: <1629908421-8543-3-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1629908421-8543-1-git-send-email-pmorel@linux.ibm.com>

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>
---
 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


  parent reply	other threads:[~2021-08-25 16:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 16:20 [kvm-unit-tests PATCH 0/2] Two fixes for KVM unit tests Pierre Morel
2021-08-25 16:20 ` [kvm-unit-tests PATCH 1/2] Makefile: Fix cscope Pierre Morel
2021-08-26  5:07   ` Thomas Huth
2021-08-27  9:26     ` Pierre Morel
2021-08-27 10:22       ` Andrew Jones
2021-09-20 13:27         ` Paolo Bonzini
2021-09-20 14:10           ` Andrew Jones
2021-09-20 18:04             ` Paolo Bonzini
2021-09-21  6:58               ` Andrew Jones
2021-08-27 10:22       ` Thomas Huth
2021-08-25 16:20 ` Pierre Morel [this message]
2021-08-25 16:31   ` [kvm-unit-tests PATCH 2/2] s390x: fixing I/O memory allocation Claudio Imbrenda
2021-08-27  9:39     ` Pierre Morel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1629908421-8543-3-git-send-email-pmorel@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.