* [PATCH] bsd-user: Specify host page alignment if none specified
@ 2023-07-28 3:54 Warner Losh
2023-07-28 13:34 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Warner Losh @ 2023-07-28 3:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Kyle Evans, richard.henderson, 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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 74ed00b9fe3..e3ce4ab1fc7 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -260,7 +260,7 @@ 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 : qemu_host_page_size));
}
addr = start;
--
2.40.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bsd-user: Specify host page alignment if none specified
2023-07-28 3:54 [PATCH] bsd-user: Specify host page alignment if none specified Warner Losh
@ 2023-07-28 13:34 ` Richard Henderson
2023-07-28 13:41 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2023-07-28 13:34 UTC (permalink / raw)
To: Warner Losh, qemu-devel; +Cc: Kyle Evans
On 7/27/23 20:54, 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 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
> index 74ed00b9fe3..e3ce4ab1fc7 100644
> --- a/bsd-user/mmap.c
> +++ b/bsd-user/mmap.c
> @@ -260,7 +260,7 @@ 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 : qemu_host_page_size));
> }
>
> addr = start;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bsd-user: Specify host page alignment if none specified
2023-07-28 13:34 ` Richard Henderson
@ 2023-07-28 13:41 ` Richard Henderson
2023-07-28 16:20 ` Warner Losh
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2023-07-28 13:41 UTC (permalink / raw)
To: Warner Losh, qemu-devel; +Cc: Kyle Evans
On 7/28/23 06:34, Richard Henderson wrote:
> On 7/27/23 20:54, 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 | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
>
> r~
>
>>
>> diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
>> index 74ed00b9fe3..e3ce4ab1fc7 100644
>> --- a/bsd-user/mmap.c
>> +++ b/bsd-user/mmap.c
>> @@ -260,7 +260,7 @@ 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 : qemu_host_page_size));
Actually, it probably should be MAX(qemu_host_page_size, TARGET_PAGE_SIZE).
Does freebsd currently support any hosts with a page size that is not 4k? It would have
been true in the past, certainly, but perhaps they've all been deprecated and removed.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bsd-user: Specify host page alignment if none specified
2023-07-28 13:41 ` Richard Henderson
@ 2023-07-28 16:20 ` Warner Losh
0 siblings, 0 replies; 4+ messages in thread
From: Warner Losh @ 2023-07-28 16:20 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, Kyle Evans
[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]
On Fri, Jul 28, 2023 at 7:41 AM Richard Henderson <
richard.henderson@linaro.org> wrote:
> On 7/28/23 06:34, Richard Henderson wrote:
> > On 7/27/23 20:54, 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 | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> >
> >
> > r~
> >
> >>
> >> diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
> >> index 74ed00b9fe3..e3ce4ab1fc7 100644
> >> --- a/bsd-user/mmap.c
> >> +++ b/bsd-user/mmap.c
> >> @@ -260,7 +260,7 @@ 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 : qemu_host_page_size));
>
> Actually, it probably should be MAX(qemu_host_page_size, TARGET_PAGE_SIZE).
>
> Does freebsd currently support any hosts with a page size that is not 4k?
> It would have
> been true in the past, certainly, but perhaps they've all been deprecated
> and removed.
>
arm64 supports 64k pages now too... I'll update the patch...
Warner
[-- Attachment #2: Type: text/html, Size: 2125 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-28 16:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28 3:54 [PATCH] bsd-user: Specify host page alignment if none specified Warner Losh
2023-07-28 13:34 ` Richard Henderson
2023-07-28 13:41 ` Richard Henderson
2023-07-28 16:20 ` Warner Losh
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).