diff mbox series

[kvm-unit-tests,v1,2/2] s390x: uv-host: fix allocation of UV memory

Message ID 20221018140951.127093-3-imbrenda@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x misc fixes | expand

Commit Message

Claudio Imbrenda Oct. 18, 2022, 2:09 p.m. UTC
Allocate the donated storage with 1M alignment from the normal pool, to
force it to be above 2G without wasting a whole 2G block of memory.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/uv-host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Janosch Frank Oct. 19, 2022, 6:34 a.m. UTC | #1
On 10/18/22 16:09, Claudio Imbrenda wrote:
> Allocate the donated storage with 1M alignment from the normal pool, to
> force it to be above 2G without wasting a whole 2G block of memory.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

Thanks for fixing this :)
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> ---
>   s390x/uv-host.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
> index a1a6d120..e1fc0213 100644
> --- a/s390x/uv-host.c
> +++ b/s390x/uv-host.c
> @@ -329,7 +329,7 @@ static void test_init(void)
>   	struct psw psw;
>   
>   	/* Donated storage needs to be over 2GB */
> -	mem = (uint64_t)memalign(1UL << 31, uvcb_qui.uv_base_stor_len);
> +	mem = (uint64_t)memalign_pages_flags(SZ_1M, uvcb_qui.uv_base_stor_len, AREA_NORMAL);
>   
>   	uvcb_init.header.len = sizeof(uvcb_init);
>   	uvcb_init.header.cmd = UVC_CMD_INIT_UV;
Steffen Eiden Oct. 20, 2022, 8:07 a.m. UTC | #2
On 10/18/22 16:09, Claudio Imbrenda wrote:
> Allocate the donated storage with 1M alignment from the normal pool, to
> force it to be above 2G without wasting a whole 2G block of memory.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
LGTM
Reviewed-by; Steffen Eiden <seiden@linux.ibm.com>

> ---
>   s390x/uv-host.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/s390x/uv-host.c b/s390x/uv-host.c
> index a1a6d120..e1fc0213 100644
> --- a/s390x/uv-host.c
> +++ b/s390x/uv-host.c
> @@ -329,7 +329,7 @@ static void test_init(void)
>   	struct psw psw;
>   
>   	/* Donated storage needs to be over 2GB */
> -	mem = (uint64_t)memalign(1UL << 31, uvcb_qui.uv_base_stor_len);
> +	mem = (uint64_t)memalign_pages_flags(SZ_1M, uvcb_qui.uv_base_stor_len, AREA_NORMAL);
>   
>   	uvcb_init.header.len = sizeof(uvcb_init);
>   	uvcb_init.header.cmd = UVC_CMD_INIT_UV;
diff mbox series

Patch

diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index a1a6d120..e1fc0213 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -329,7 +329,7 @@  static void test_init(void)
 	struct psw psw;
 
 	/* Donated storage needs to be over 2GB */
-	mem = (uint64_t)memalign(1UL << 31, uvcb_qui.uv_base_stor_len);
+	mem = (uint64_t)memalign_pages_flags(SZ_1M, uvcb_qui.uv_base_stor_len, AREA_NORMAL);
 
 	uvcb_init.header.len = sizeof(uvcb_init);
 	uvcb_init.header.cmd = UVC_CMD_INIT_UV;