qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about atomics


From: Warner Losh
Subject: Question about atomics
Date: Mon, 7 Mar 2022 21:18:29 -0700

I have a question related to the user-mode emulation and atomics. I asked on IRC, but thinking about it, I think it may be too complex to discuss in that medium...

In FreeBSD we have a system call that uses host atomic operations to interact memory that userland also interacts with using atomic operations.

In bsd-user we call the kernel with a special flag for dealing with 32-bit processes running on a 64-bit kernel. In this case, we use 32-bit-sized atomics to set variables in the address space of the bsd-user guest. This is used when running armv7 binaries on amd64 hosts.

First question: Is this expected to work? I know I'm a bit vague, so as a followup question: If there's restrictions on this, what might they be? Do some classes of atomic operations work, while others may fail or need additional cooperation? Are there any conformance tests I could compile for FreeBSD/armv7 to test the hypothesis that atomic operations are misbehaving?

I'm asking because I'm seeing a rare, but not rare enough, race that's corrupting state in ways that only appear to be possible when pthread mutexes aren't working (which only break when atomic operations are broken). So far my efforts to narrow this down has been unsuccessful and I'm looking to both understand qemu/tcm better as well as to reduce the problem space to search...

Thanks for any help you might be able to give.

Warner


reply via email to

[Prev in Thread] Current Thread [Next in Thread]