On 3/8/22 15:09, Warner Losh wrote:

    Yes, qatomic_foo is expected to work.  It's what we use across
    threads, and it is expected to work "in kernel mode", i.e. within 
cpu_loop().

Even when the writers are done in the context of system calls to the kernel?

Yes.

That said, for the similar syscall in Linux we just forward it to the kernel (and the kernel obviously can only do an atomic---no start_exclusive/end_exclusive involved).

And if the system call does this w/o using
the start_exclusive/end_exclusive stuff, is that a problem?

If it does it without start_exclusive/end_exclusive they must use qatomic_foo(). If it does it with start_exclusive/end_exclusive, they can even write a compare-and-exchange as

    old = *(uint64_t *)g2h(cs, addr);
    if (old == oldval)
        *(uint64_t *)g2h(cs, addr) = new;

Paolo

Reply via email to