Page MenuHomeFreeBSD

Add sysctl(8) formatting for hw.pagesizes.
ClosedPublic

Authored by markj on Aug 30 2020, 5:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 22 2024, 8:40 AM
Unknown Object (File)
Oct 10 2024, 5:55 PM
Unknown Object (File)
Sep 8 2024, 12:44 PM
Unknown Object (File)
Sep 8 2024, 5:51 AM
Unknown Object (File)
Sep 7 2024, 9:20 PM
Unknown Object (File)
Jul 2 2024, 9:19 AM
Unknown Object (File)
Jun 29 2024, 11:26 AM
Unknown Object (File)
Jun 13 2024, 1:05 AM
Subscribers

Details

Summary


- Change the type of hw.pagesizes to OPAQUE, since it returns an array.
- Modify the handler to only truncate the returned length if the caller
supplied an output buffer. This allows use of the trick of passing a
NULL output buffer to fetch the output size, while preserving
compatibility if MAXPAGESIZES is increased.
- Add a "S,pagesize" formatter to sysctl(8).

Test Plan

Example output:

hw.pagesizes: { 4096, 2097152, 1073741824 }

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Aug 30 2020, 5:44 PM
markj created this revision.
kib added inline comments.
sys/kern/kern_mib.c
246 ↗(On Diff #76374)

I think we should truncate len by removing all indexes for which pagesizes32[i] are zero (not a problem right now).

This revision is now accepted and ready to land.Aug 30 2020, 6:41 PM
sys/kern/kern_mib.c
246 ↗(On Diff #76374)

You mean, zero due to integer truncation? Does LA57 permit 512G superpages?

sys/kern/kern_mib.c
246 ↗(On Diff #76374)

I mean the comment above, about (uint32_t)pagesizes[i] calculation.

Right now LA57 only defines PG_PS at PD and PDP level still, i.e. no 512G superpages still. But would it allowed (and I do not think it is too far in the future), we get into this situation for i386 on amd64.

markj added inline comments.
sys/kern/kern_mib.c
246 ↗(On Diff #76374)

Shouldn't we do that for the native case as well? For instance, with 1G pages some amd64 systems will still have only 4K and 2M in the page sizes array.

sys/kern/kern_mib.c
246 ↗(On Diff #76374)

It could be reasonable but not critical. amd64 native binaries should be prepared for 3 page sizes. While i386 expect only two.

This revision was automatically updated to reflect the committed changes.
markj marked an inline comment as done.