Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Rename the sysctl, remove _NOFETCH flag, update the sysctl description.
Add some note about la57 + la48 flags in elfctl(1).
This seems ok. I still think the approach is inferior to using the mmap() hint or a new flag. A process, especially a language runtime, could legitimately load some library which wants to use the full LA57 address space even when other components in the process do not support LA57. General-purpose applications do not get much benefit from the extra address bits, and with this approach, the extra bits are inaccessible to libraries unless the binary is specially marked. It is probably fine for appliance vendors at least.
sys/amd64/amd64/pmap.c | ||
---|---|---|
434 | I would add some comment here that the default value is needed in order to preserve compatibility with some userspace programs. | |
usr.bin/elfctl/elfctl.1 | ||
99 | ||
106 | ||
107 | ||
111 | ||
usr.bin/elfctl/elfctl.c | ||
70–72 | ||
72 |
I personally think that such library (which is fine with LA57) but the main process is not is too unlikely to exist. It needs to be too hermetic in the aspect of never leaking the memory addresses outside the internals of the library. The overall practice is to assume that there is only one allocator in the process, and whatever memory you have, it can be free()-ed. This is engraved even into C++ and Rust. Of course GC-ed runtime are not such, but C libraries loaded into them with FFI are.
I did not follow too closely (was off), but wouldn't it be more prudent to have la48 have priority over la57 when both flags are present? Two of the inline comments I added are changes needed if you choose so.
sys/amd64/amd64/elf_machdep.c | ||
---|---|---|
173–175 | If giving priority to the LA48 flag, this if needs to be moved after the next one. Then, the fctl0 != NULL && part in the guard can be elided. | |
usr.bin/elfctl/elfctl.1 | ||
105 | If changing priority, "la57" => "la48". | |
111 | I don't think "neither" is correct. I'd suggest "either" (as Mark) or "any". | |
usr.bin/elfctl/elfctl.c | ||
73 |
If both flags are present, it is more a user error than a useful configuration. I documented it only for completeness.
What about a library which maps an NVDIMM and provides some block-addressed I/O interface to it? Such a module does not need to expose the mapping to any other components.
usr.bin/elfctl/elfctl.c | ||
---|---|---|
71 |
But also such module does not need LA57. NVDIMMs are quite modest in sizes, comparable with NVMe/SATA SSDs. LA57 is still about VA, and not physical memory.
The possible beneficiaries of LA57 are things like GC runtimes. I can list e.g. recent chrome changes that allocate 2Tb UVA for V8 objects, or directly JVM for huge processing. In all that cases I do not see the scenario with isolated module realistic.
In fact, the use of the canonical bits for tags should be considered bug, and so far I am aware of only two bugs: in jemalloc, and in go. Both do not fit into the module model.