diff mbox series

[v3,04/29] alpha: Add <bits/pagesize.h>

Message ID 4b9385fbcd4b2a93c27f8fb5b5d7e4bca120b190.1727624528.git.fweimer@redhat.com
State New
Headers show
Series Teach glibc about possible page sizes and handle gaps in ld.so | expand

Commit Message

Florian Weimer Sept. 29, 2024, 3:56 p.m. UTC
According to arch/alpha/Kconfig, alpha always has a page size of
8 KiB (only HAVE_PAGE_SIZE_8KB is used).  However, the toolchain
defaults support a maximum page size of 64 KiB, so adjust the
maximum accordingly.

(Note: We could XFAIL the gaps test added later and fix the page size at
8 KiB, despite what binutils does today.)

---
 sysdeps/alpha/bits/pagesize.h | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 sysdeps/alpha/bits/pagesize.h

Comments

Richard Henderson Oct. 5, 2024, 12:53 a.m. UTC | #1
On 9/29/24 08:56, Florian Weimer wrote:
> According to arch/alpha/Kconfig, alpha always has a page size of
> 8 KiB (only HAVE_PAGE_SIZE_8KB is used).  However, the toolchain
> defaults support a maximum page size of 64 KiB, so adjust the
> maximum accordingly.

The ev6 hardware can support 8k, 64k, 512k, and 4G page sizes, but we never got around to 
supporting them within the kernel.  When doing the toolchain support, I always assumed 
we'd get around to at least 64k.  :-/


> (Note: We could XFAIL the gaps test added later and fix the page size at
> 8 KiB, despite what binutils does today.)
> 
> ---
>   sysdeps/alpha/bits/pagesize.h | 2 ++
>   1 file changed, 2 insertions(+)
>   create mode 100644 sysdeps/alpha/bits/pagesize.h
> 
> diff --git a/sysdeps/alpha/bits/pagesize.h b/sysdeps/alpha/bits/pagesize.h
> new file mode 100644
> index 0000000000..81824b5ab6
> --- /dev/null
> +++ b/sysdeps/alpha/bits/pagesize.h
> @@ -0,0 +1,2 @@
> +#define __GLIBC_PAGE_SHIFT_MIN 13
> +#define __GLIBC_PAGE_SHIFT_MAX 16

FWIW, qemu 9.1 supports aligning the guest page size to the host page size, for a subset 
of guests: alpha, aarch64, ppc*.  This fixes a number of edge cases with mmap that cannot 
be properly emulated otherwise (especially wrt SIGBUS within the final guest page beyond 
the end of a file).  I intend to extend this to other guests as and when I have time, but 
have not done the legwork you have done to identify which guests need attention.

We allow Alpha page size to float down to 4k to aid emulation on x86 hosts, despite this 
not being a page size supported by real hardware.  This works in practice because Alpha 
applications do not hard-code a particular page size.  As long as the program respects 
AT_PAGESIZE or getpagesize(2), all is well.

I only bring this up to let you know that the test case may fail when run on qemu-alpha.


r~
diff mbox series

Patch

diff --git a/sysdeps/alpha/bits/pagesize.h b/sysdeps/alpha/bits/pagesize.h
new file mode 100644
index 0000000000..81824b5ab6
--- /dev/null
+++ b/sysdeps/alpha/bits/pagesize.h
@@ -0,0 +1,2 @@ 
+#define __GLIBC_PAGE_SHIFT_MIN 13
+#define __GLIBC_PAGE_SHIFT_MAX 16