qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] bsd-user: Specify host page alignment if none specified
@ 2023-07-28 16:29 Warner Losh
  2023-07-28 16:46 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Warner Losh @ 2023-07-28 16:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson, kevans, Warner Losh

We're hitting an assert when we pass in alignment == 0 since that's not
a power of two. so pass in the ideal page size.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/mmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 74ed00b9fe3..b62a69bd075 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -260,7 +260,8 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size,
 
     if (reserved_va) {
         return mmap_find_vma_reserved(start, size,
-            (alignment != 0 ? 1 << alignment : 0));
+            (alignment != 0 ? 1 << alignment :
+             MAX(qemu_host_page_size, TARGET_PAGE_SIZE)));
     }
 
     addr = start;
-- 
2.40.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] bsd-user: Specify host page alignment if none specified
  2023-07-28 16:29 [PATCH v2] bsd-user: Specify host page alignment if none specified Warner Losh
@ 2023-07-28 16:46 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2023-07-28 16:46 UTC (permalink / raw)
  To: Warner Losh, qemu-devel; +Cc: kevans

On 7/28/23 09:29, Warner Losh wrote:
> We're hitting an assert when we pass in alignment == 0 since that's not
> a power of two. so pass in the ideal page size.
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>   bsd-user/mmap.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

and queued.


r~
> 
> diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
> index 74ed00b9fe3..b62a69bd075 100644
> --- a/bsd-user/mmap.c
> +++ b/bsd-user/mmap.c
> @@ -260,7 +260,8 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size,
>   
>       if (reserved_va) {
>           return mmap_find_vma_reserved(start, size,
> -            (alignment != 0 ? 1 << alignment : 0));
> +            (alignment != 0 ? 1 << alignment :
> +             MAX(qemu_host_page_size, TARGET_PAGE_SIZE)));
>       }
>   
>       addr = start;



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-28 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28 16:29 [PATCH v2] bsd-user: Specify host page alignment if none specified Warner Losh
2023-07-28 16:46 ` Richard Henderson

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