These macros generate both the 32- and 64-bit ops, but the mask was hard
coded for 32-bit ops, causing the 64-bit ops always to affect only the
low 32 bits.
Reported by: mmel
Differential D27886
arm64: fix mask in atomic_testand{set,clear}_64 rlibby on Jan 2 2021, 5:09 AM. Authored by Tags None Referenced Files
Details These macros generate both the 32- and 64-bit ops, but the mask was hard Reported by: mmel qemu-system-aarch64 -M virt -m 512m -cpu cortex-a57 -kernel obj/usr/src/freebsd/arm64.aarch64/sys/GENERIC/kernel.bin -nographic After 942951ba46ecd5ebab18de006a24dc52e2d3f745 and before this patch, this panicked very early in boot (just after the "WITNESS option enabled" message), and now it makes it to mountroot.
Diff Detail
Event TimelineComment Actions Good catch. It never occurred to me that we could have a bug in atomics on two architectures at the same time, so I wasn't looking for a problem in my own garden :) I will try to fix arm by myself. Comment Actions Are you saying 32-bit ARM is also broken? Those are a little weirder, I think it uses sys/sys/_atomic_subword.h.
Thanks. Comment Actions Okay, I can see that indeed 32-bit arm's atomic_testand{set,clear} also do not match the atomic(9) API with respect to the bit argument. Comment Actions Yes, it is also broken. ARM uses its own implementation, which does not do modulo for the bit position. Comment Actions Yeah, I have seen this too. I have a patch, but no hardware, and no luck so far with getting qemu-system-arm to work. |