Skip to contentSkip to conversation

Emulating CPUs with larger atomic accesses

DISCUSSION Florian Weimer 2 participants 5 messages May 13, 2022 – May 24, 2022

lore
Share & tools
lore
#0 lore raw

What's QEMU's approach to emulating CPU instructions that atomatically operate on values larger than what is supported by the host CPU?

I assume that for full system emulation, this is not a problem, but qemu-user will not achieve atomic behavior on shared memory mappings. How much of a problem is this in practice?

Thanks,
Florian

#1 lore raw
Quoted 6 lines · Florian Weimer

What's QEMU's approach to emulating CPU instructions that atomatically operate on values larger than what is supported by the host CPU?

I assume that for full system emulation, this is not a problem, but qemu-user will not achieve atomic behavior on shared memory mappings. How much of a problem is this in practice?

Well, it doesn't work, no. In practice, x86_64 supports 128-bit atomic operations, and guest requires more than that. No one really cares anymore about 32-bit hosts with smaller atomic operations.

r~

#2 lore raw

* Richard Henderson:

Quoted 10 lines · Florian Weimer
Quoted 5 lines

What's QEMU's approach to emulating CPU instructions that atomatically operate on values larger than what is supported by the host CPU? I assume that for full system emulation, this is not a problem, but qemu-user will not achieve atomic behavior on shared memory mappings. How much of a problem is this in practice?

Well, it doesn't work, no. In practice, x86_64 supports 128-bit atomic operations, and guest requires more than that. No one really cares anymore about 32-bit hosts with smaller atomic operations.

Which part doesn't work? Full-system emulation?

Do guests really require wider-than-128 atomics? That's quite surprising?

Thanks,
Florian

#3 lore raw
Quoted 9 lines · Florian Weimer

* Richard Henderson:

Quoted 7 lines · Florian Weimer
Quoted 5 lines

What's QEMU's approach to emulating CPU instructions that atomatically operate on values larger than what is supported by the host CPU? I assume that for full system emulation, this is not a problem, but qemu-user will not achieve atomic behavior on shared memory mappings. How much of a problem is this in practice?

Quoted 5 lines
Quoted 3 lines

Well, it doesn't work, no. In practice, x86_64 supports 128-bit atomic operations, and guest requires more than that. No one really cares anymore about 32-bit hosts with smaller atomic operations.

Which part doesn't work? Full-system emulation?

No, user-only.

Quoted 2 lines

Do guests really require wider-than-128 atomics? That's quite surprising?

Typo there -- "and no guest requires...".

r~

#4 lore raw

* Richard Henderson:

Quoted 13 lines · Florian Weimer
Quoted 12 lines

* Richard Henderson:

Quoted 10 lines · Florian Weimer
Quoted 5 lines

What's QEMU's approach to emulating CPU instructions that atomatically operate on values larger than what is supported by the host CPU? I assume that for full system emulation, this is not a problem, but qemu-user will not achieve atomic behavior on shared memory mappings. How much of a problem is this in practice?

Well, it doesn't work, no. In practice, x86_64 supports 128-bit atomic operations, and guest requires more than that. No one really cares anymore about 32-bit hosts with smaller atomic operations.

Quoted 8 lines
Quoted 1 line

Which part doesn't work? Full-system emulation?

No, user-only.

Quoted 2 lines

Do guests really require wider-than-128 atomics? That's quite surprising?

Typo there -- "and no guest requires...".

Okay, thanks. So the overall situation is okay even if we end up with x86 guests that require CPU support for 128-bit loads.

Florian