qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 4/8] edu: add smp_mb__after_rmw()


From: Paolo Bonzini
Subject: Re: [PATCH 4/8] edu: add smp_mb__after_rmw()
Date: Mon, 6 Mar 2023 15:10:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 3/6/23 14:38, Peter Maydell wrote:
On Fri, 3 Mar 2023 at 17:21, Paolo Bonzini <pbonzini@redhat.com> wrote:

Ensure ordering between clearing the COMPUTING flag and checking
IRQFACT, and between setting the IRQFACT flag and checking
COMPUTING.  This ensures that no wakeups are lost.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Why is this device even messing around with multiple
threads and atomics anyway ??

Because it is an example of deferring device work to another thread, just like on real hardware it may be deferred to an on-device microcontroller or CPU.

In particular, in this case I think it is useful to show a pitfall that is present in emulated hardware (where all loads and stores ultimately go through a store buffer and CPU cache) and not in real hardware (where I/O registers are always uncached).

I'm quite tempted to suggest we should deprecate-and-drop
this; it's not real hardware, it doesn't do anything
useful, and it's not a good model to follow if you're
implementing some other device.

I'm okay with deprecating it but I think it has educational value.

Paolo




reply via email to

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