[v3,04/29] alpha: Add <bits/pagesize.h>
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
Commit Message
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
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~
* Richard Henderson:
>> (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.
Hmm, I'm surprised that a smaller page size isn't compatible. I suppose
there could be an issue regarding the tail if the file is subsequently
resized. The end of the tail might not be writable with 4K pages, but
is writable with 8K pages.
Do you suggest to lower PAGE_SIZE_MIN to 4096 for QEMU compatibility?
It's not clear to me based on your message.
I should probably update the documentation in the manual that
PAGE_SIZE_MIN is not a suitable boundary for over-reading because it's
incompatible with (future introduction of) pointer tagging. The alpha
memchr in glibc uses cache line boundaries for overreading, so it's fine
with 4K pages at least.
Thanks,
Florian
On 10/5/24 11:22, Florian Weimer wrote:
> * Richard Henderson:
>
>>> (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.
>
> Hmm, I'm surprised that a smaller page size isn't compatible. I suppose
> there could be an issue regarding the tail if the file is subsequently
> resized. The end of the tail might not be writable with 4K pages, but
> is writable with 8K pages.
>
> Do you suggest to lower PAGE_SIZE_MIN to 4096 for QEMU compatibility?
> It's not clear to me based on your message.
I was not suggesting anything, but soliciting comment.
Anyway, given that only min == max is optimizable, I think including 4k with a big comment
should be acceptable. The alternative is accepting the testsuite failure under qemu-user.
r~
new file mode 100644
@@ -0,0 +1,2 @@
+#define __GLIBC_PAGE_SHIFT_MIN 13
+#define __GLIBC_PAGE_SHIFT_MAX 16