Page MenuHomeFreeBSD

Make UVA LA57 opt-int
ClosedPublic

Authored by kib on Sat, Apr 19, 10:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 8, 6:32 PM
Unknown Object (File)
Wed, May 7, 6:52 AM
Unknown Object (File)
Wed, May 7, 6:52 AM
Unknown Object (File)
Wed, May 7, 6:52 AM
Unknown Object (File)
Wed, May 7, 6:52 AM
Unknown Object (File)
Wed, May 7, 6:52 AM
Unknown Object (File)
Mon, Apr 28, 8:49 AM
Unknown Object (File)
Mon, Apr 28, 12:34 AM

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Sat, Apr 19, 10:59 AM
sys/amd64/amd64/pmap.c
434

Maybe default_la48_uva or something like that? The tunable affects only userspace mappings AFAIK.

437
usr.bin/elfctl/elfctl.c
71

Probably the elfctl man page should document the interaction between la48 and la57?

kib marked 3 inline comments as done.

Rename the sysctl, remove _NOFETCH flag, update the sysctl description.
Add some note about la57 + la48 flags in elfctl(1).

More words 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
kib marked 7 inline comments as done.Tue, Apr 22, 12:40 AM

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.

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.

Editing for comments and user strings.

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
kib marked 2 inline comments as done.Tue, Apr 22, 3:03 PM

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.

If both flags are present, it is more a user error than a useful configuration. I documented it only for completeness.

In D49913#1139253, @kib wrote:

If both flags are present, it is more a user error than a useful configuration.

Certainly. But shouldn't we be conservative on a user error?

In D49913#1139047, @kib wrote:

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.

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.

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
kib marked an inline comment as done.Sat, Apr 26, 5:47 PM
In D49913#1139047, @kib wrote:

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.

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.

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.

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.

This revision is now accepted and ready to land.Sun, Apr 27, 1:46 PM