News for hackers. Stuff that matters.
Re:A Tour of Safe Tracing GC Designs in Rust by zozbot234 on Saturday June 19, 2021 @10:34AM (#27560737)
> Whereas if I steal ten bits at the top of the pointer, when Intel ships Ice Lake CPUs my compiler now crashes. Good luck debugging that!

That's not how it works. The x86-64 ISA requires these "top" bits to be properly sign extended when actually accessing addresses, so any binary code that's using this "trick" is forward compatible wrt. future CPU's that might enable a bigger virtual address space. The only concern wrt. compatibility is purely ABI related but that can be managed at the OS and system-software layer.

Re:A Tour of Safe Tracing GC Designs in Rust by tialaramex on Saturday June 19, 2021 @01:23PM (#27562372)
> That's not how it works. The x86-64 ISA requires these "top" bits to be properly sign extended when actually accessing addresses.

On Coffee Lake no more than 48 bits of the virtual address are "real". If I steal ten of the 64 bits from the top, all the actual address information is preserved and I've lost nothing. My compiler works just fine.

On Ice Lake up to 57 bits of the virtual address are "real". Since I'm stealing ten of the 64 bits from the top, I only have 54 bits left, so 3 significant bits were dropped and I don't have them any more. Sign-extending the wrong value won't magically make it into the right value.

Re:A Tour of Safe Tracing GC Designs in Rust by klodolph on Saturday June 19, 2021 @05:12PM (#27564502)
Yes—and my concern is that old binaries will suddenly stop working on newer hardware. This has happened before!

The whole reason the top bits are sign-extended in the first place is to discourage these kinds of shenanigans. I remember the pain of switching 24-bit to 32-bit on M68K Macs.

Re:A Tour of Safe Tracing GC Designs in Rust by celeritascelery on Saturday June 19, 2021 @12:32PM (#27561946)
Until the virtual address space gets so big that there are no bits left at the top that are "free". As soon as you have a 64 bit virtual address space, pointer tagging the top bits no longer works. Your program is now broken on the new CPU.
Re:A Tour of Safe Tracing GC Designs in Rust by devit on Saturday June 19, 2021 @01:23PM (#27562381)
Of course competent programmers using the top K bits of the pointer would make sure that the kernel and memory allocator operate so that they don't allocate memory outside a (64 - K)-bit address space, regardless of what the CPU supports (e.g. Linux mmap as one would expect won't allocate beyond 2^48 unless explicitly requested).

And obviously any intelligent CPU architect, if they make a CPU that masks the upper bits, they would make the number of bits that gets masked configurable per-process and not dependent on the maximum virtual address space supported by the CPU.

Re:A Tour of Safe Tracing GC Designs in Rust by zozbot234 on Saturday June 19, 2021 @04:14PM (#27564022)
> And obviously any intelligent CPU architect, if they make a CPU that masks the upper bits, they would make the number of bits that gets masked configurable per-process

x86-64 does this by requiring all accesses to be correctly sign-extended, which means that valid virtual addresses are unique and there is full forward compatibility even with an extended virtual address space. The "number of bits that get masked" is a pure system/ABI concern, the CPU support only defines a maximum.

Re:A Tour of Safe Tracing GC Designs in Rust by celeritascelery on Saturday June 19, 2021 @01:43PM (#27562563)
> Of course competent programmers ... And obviously any intelligent CPU architect

Interesting to see the future is so "obvious" to you. You are correct however, that this is not a problem at the present because no architecture uses more then 48-bits of address space in practice. And since this is such a common practice now, there will have to allowances made in the future for when the address space is expanded.

Re:A Tour of Safe Tracing GC Designs in Rust by vlovich123 on Saturday June 19, 2021 @04:07PM (#27563962)
As a sibling to you noted, Ice Lake has bumped this from 48 bits to 57 bits to support 5-level paging [1]. So the "in practice" appears to already by out of date. This was known publicly as early as 2017 (albeit this is the first I've heard of it).

That being said, I don't know why the increase from 256TB to 128PB is at all useful but it's enabled in my Arch Linux kernel on a 32GB laptop, so clearly adopted by the broader ecosystem even outside whatever niche use-case it's for.

That being said, the kernel maintains backward compatability by restricting the allocation address space it hands out by default. Userspace needs to explicitly ask for the higher bits [2], so it's probably OK to just continue as-is assuming the 48-bit limit in practice.

[1] https://en.wikipedia.org/wiki/Intel_5-level_paging

[2] https://www.kernel.org/doc/html/latest/x86/x86_64/5level-pag....