Skip to contentSkip to conversation

bsd-user: Specify host page alignment if none specified

PATCH Superseded Warner Losh 2 participants 4 messages Jul 28, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsd-user: Specify host page alignment if none specified

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.

---
 bsd-user/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bsd-user/mmap.c +1 -1
index 74ed00b9fe3..e3ce4ab1fc7 100644
@@ -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;
Signature · 1 line
2.40.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · 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.

---
  bsd-user/mmap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

r~

Quoted 14 lines
bsd-user/mmap.c +1 -1
index 74ed00b9fe3..e3ce4ab1fc7 100644
@@ -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 lore raw
Quoted 15 lines · Richard Henderson
Quoted 7 lines · 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.

---
  bsd-user/mmap.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)

r~

Quoted 1 line
Quoted 9 lines

bsd-user/mmap.c static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size, · line 262

Quoted 9 lines
bsd-user/mmap.c +1 -1
index 74ed00b9fe3..e3ce4ab1fc7 100644
@@ -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~

#3 lore raw
Quoted 27 lines · Richard Henderson
Quoted 12 lines · Richard Henderson
Quoted 7 lines · 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.

---
  bsd-user/mmap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

r~

bsd-user/mmap.c static abi_ulong mmap_find_vma_aligned(abi_ulong

Quoted 6 lines
bsd-user/mmap.c +0 -0
index 74ed00b9fe3..e3ce4ab1fc7 100644
@@ -260,7 +260,7 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong

start, abi_ulong size,

Quoted 4 lines

bsd-user/mmap.c static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size, · line 263

Quoted 4 lines
bsd-user/mmap.c +1 -1
      if (reserved_va) {
          return mmap_find_vma_reserved(start, size,
-            (alignment != 0 ? 1 << alignment : 0));
+            (alignment != 0 ? 1 << alignment : qemu_host_page_size));
Quoted 7 lines

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