Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-17 Thread Akihiko Odaki
On 2025/05/17 19:24, Paolo Bonzini wrote: Il sab 17 mag 2025, 01:41 Akihiko Odaki > ha scritto: I think we only need a store-release, which is ensured even by the C11 read-modify-write operation; we only need to ensure that ev->value is set to EV_S

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-17 Thread Paolo Bonzini
Il sab 17 mag 2025, 01:41 Akihiko Odaki ha scritto: > I think we only need a store-release, which is ensured even by the C11 > read-modify-write operation; we only need to ensure that ev->value is > set to EV_SET after all stores specified earlier appear. > You really need a barrier to order the

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-16 Thread Akihiko Odaki
On 2025/05/16 23:25, 'Paolo Bonzini' via devel wrote: Il ven 16 mag 2025, 08:58 Akihiko Odaki > ha scritto: I also found smp_mb__after_rmw() before qemu_futex_wake_all() is no longer necessary. Summing up, I think the code should look like as follo

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-16 Thread Paolo Bonzini
Il ven 16 mag 2025, 08:58 Akihiko Odaki ha scritto: > I also found smp_mb__after_rmw() before qemu_futex_wake_all() is no > longer necessary. Summing up, I think the code should look like as follows: > > #ifdef HAVE_FUTEX > You would still need smp_mb__before_rmw() here. if (qatomic_xchg(&

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-16 Thread Akihiko Odaki
On 2025/05/16 20:09, 'Paolo Bonzini' via devel wrote: Il mer 14 mag 2025, 08:57 Akihiko Odaki > ha scritto: Honestly, I do not understand why smp_mb() is placed here even in the futex case. The comment says:  > qemu_event_set has release semantics

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-16 Thread Paolo Bonzini
Il mer 14 mag 2025, 08:57 Akihiko Odaki ha scritto: > Honestly, I do not understand why smp_mb() is placed here even in the > futex case. The comment says: > > qemu_event_set has release semantics, but because it *loads* > > ev->value we need a full memory barrier here. > > The barrier is indee

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-14 Thread Akihiko Odaki
On 2025/05/14 9:51, 'Paolo Bonzini' via devel wrote: On 5/11/25 08:08, Akihiko Odaki wrote: @@ -387,12 +365,17 @@ void qemu_event_set(QemuEvent *ev)   assert(ev->initialized);   /* - * Pairs with both qemu_event_reset() and qemu_event_wait(). + * Pairs with qemu_event_wait() (on

Re: [PATCH v3 04/10] qemu-thread: Avoid futex abstraction for non-Linux

2025-05-13 Thread Paolo Bonzini
On 5/11/25 08:08, Akihiko Odaki wrote: @@ -387,12 +365,17 @@ void qemu_event_set(QemuEvent *ev) assert(ev->initialized); /* - * Pairs with both qemu_event_reset() and qemu_event_wait(). + * Pairs with qemu_event_wait() (on Linux) and qemu_event_reset(). * * q