From: Peter Xu <peterx@redhat.com>
To: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Cc: qemu-devel@nongnu.org,
"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH 4/5] rcu: Wake the RCU thread when draining
Date: Mon, 17 Nov 2025 11:42:23 -0500 [thread overview]
Message-ID: <aRtQbzMifFW3BejM@x1.local> (raw)
In-Reply-To: <3c3ad5f1-37ac-4c4b-93c4-ca67b5a1edef@rsg.ci.i.u-tokyo.ac.jp>
On Sat, Nov 15, 2025 at 11:59:01AM +0900, Akihiko Odaki wrote:
> This is wrong. The following can still happen:
>
> call_rcu_thread() |
> qatomic_sub(&rcu_call_count, n) |
> (sets rcu_call_count to 0) |
> | call_rcu1()
> | qatomic_fetch_inc(&rcu_call_count)
> qatomic_read(&rcu_call_count) |
> qemu_event_reset(&sync_event) |
> | qemu_event_set(&sync_event)
> enter_qs(false) |
> wait_for_readers(false) |
> qemu_sem_timedwait( |
> &sync_event, 10) |
>
> I'll fix it with the next version.
Please take this as an example of why I think these orderings are very hard
to make 100% accurate. Consider when someone else who is less familiar
with the rcu code and may mess up with some of the orderings without being
noticed.
That's also why I personally liked a sem because the important thing here
is not missing an event, which sem always guarantees as it doesn't have
resetting at all. Then we can be open to false positives on events as long
as keeping it as minimum as possible.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2025-11-17 16:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 6:12 [PATCH 0/5] virtio-gpu: Force RCU when unmapping blob Akihiko Odaki
2025-10-29 6:12 ` [PATCH 1/5] futex: Add qemu_futex_timedwait() Akihiko Odaki
2025-10-30 16:13 ` Alex Bennée
2025-10-29 6:12 ` [PATCH 2/5] qemu-thread: Add qemu_event_timedwait() Akihiko Odaki
2025-10-29 6:12 ` [PATCH 3/5] rcu: Use call_rcu() in synchronize_rcu() Akihiko Odaki
2025-10-29 6:12 ` [PATCH 4/5] rcu: Wake the RCU thread when draining Akihiko Odaki
2025-10-29 18:22 ` Peter Xu
2025-11-03 9:45 ` Akihiko Odaki
2025-11-05 20:43 ` Peter Xu
2025-11-06 1:40 ` Akihiko Odaki
2025-11-06 21:52 ` Peter Xu
2025-11-07 1:47 ` Akihiko Odaki
2025-11-07 14:00 ` Peter Xu
2025-11-08 1:47 ` Akihiko Odaki
2025-11-13 17:03 ` Peter Xu
2025-11-14 1:24 ` Akihiko Odaki
2025-11-14 15:30 ` Peter Xu
2025-11-15 1:58 ` Akihiko Odaki
2025-11-15 2:59 ` Akihiko Odaki
2025-11-17 16:42 ` Peter Xu [this message]
2025-11-17 22:53 ` Akihiko Odaki
2025-11-17 16:39 ` Peter Xu
[not found] ` <1b318ad8-48b3-4968-86ca-c62aef3b3bd4@rsg.ci.i.u-tokyo.ac.jp>
[not found] ` <7c49d808-ccb8-4262-ae6c-2ac746b43b80@rsg.ci.i.u-tokyo.ac.jp>
2025-11-13 17:30 ` Peter Xu
2025-11-14 1:12 ` Akihiko Odaki
2025-10-29 6:12 ` [PATCH 5/5] virtio-gpu: Force RCU when unmapping blob Akihiko Odaki
2025-10-30 11:18 ` Dmitry Osipenko
2025-10-30 11:17 ` [PATCH 0/5] " Dmitry Osipenko
2025-10-30 17:59 ` Alex Bennée
2025-10-31 21:32 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aRtQbzMifFW3BejM@x1.local \
--to=peterx@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=dmitry.osipenko@collabora.com \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.