Hacker News new | ask | show | jobs
by Sohcahtoa82 16 days ago
> Or, do running machines often have their CPU changed from under them without much notice?

I dunno about other cloud providers, but I know AWS can move your EC2 VM from one system to another transparently. There is a server ID you can get from the metadata, but unless you're checking it frequently, you can be moved without ever being aware.

2 comments

Question is if they expose it to the guest. Many (most?) cloud platforms will make the guest see the lowest common denominator, specifically to avoid angry customers when their working setup suddenly breaks.

In the case of transparent migration, I think it's basically a must. No JIT (or even libc probably) is going to support CPU features changing at runtime.

You’ll need to restart the guest.
Not true.

AWS migrates live instances to new CPUs without needing to stop or reboot the guest.

When a migration is needed, the hypervisor begins copying blocks of memory to the new system, keeping track of what blocks are written inside the guest during the migration. Once enough has been copied, it hibernates the guest, copies the remaining memory, then wakes it in the new system. On a system that isn't writing to large swaths of memory, it can take only a few milliseconds. To the guest, it might appear that the CPU froze for a tiny bit of time, which could easily just look like a neighbor got noisy.

Yes, but that's irrelevant here because the CPUID report won't change across live migrations.

Consider what would happen if you were live migrated from a machine with AVX512 to one without. Your app would suddenly start crashing with SIGILL for no apparent reason. So, live migrations always preserve the apparent CPU feature set. If you started on a machine without AVX512 then until the VM is rebooted you will remain on such a (virtual) machine.

But why would you live migrate between instances with a different instruction set? You'd need to emulate the missing instruction sets then...
The opposite. You hide CPU features the hardware actually has.

It's just a tradeoff. Most users don't care about the latest CPU features and having a bigger pool of machines to migrate VMs to simplifies operations.

Ah, I understood a different thing.

Then, in that case you wouldn't be worried about this big, as you wouldn't be using the AVX512 extensions.

Not for a routine migration, but they typically keep it inside the same processor family for this reason.