qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [PATCH v2 0/4] util/interval-tree: Avoid race conditions without optimization
Date: Sat, 22 Jul 2023 22:44:18 +0100	[thread overview]
Message-ID: <20230722214422.118743-1-richard.henderson@linaro.org> (raw)

Read the left and right trees once, so that the gating
tests are meaningful.  This was only a problem at -O0,
where the compiler didn't CSE the two reads.

Changes for v2:
  * Use qatomic_read for left/right while searching (pmm)
  * Use qatomic_set_mb when inserting a new node, so that
    we're sure that the new node is consistent.
  * Abundance of caution: Use qatomic_read/set for manipulating parent.


r~


Richard Henderson (4):
  util/interval-tree: Use qatomic_read for left/right while searching
  util/interval-tree: Use qatomic_set_mb in rb_link_node
  util/interval-tree: Introduce pc_parent
  util/interval-tree: Use qatomic_read/set for rb_parent_color

 util/interval-tree.c | 79 +++++++++++++++++++++++++++-----------------
 1 file changed, 48 insertions(+), 31 deletions(-)

-- 
2.34.1



             reply	other threads:[~2023-07-22 21:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 21:44 Richard Henderson [this message]
2023-07-22 21:44 ` [PATCH for-8.1 v2 1/4] util/interval-tree: Use qatomic_read for left/right while searching Richard Henderson
2023-07-24 11:48   ` Peter Maydell
2023-07-22 21:44 ` [PATCH for-8.1 v2 2/4] util/interval-tree: Use qatomic_set_mb in rb_link_node Richard Henderson
2023-07-24 11:49   ` Peter Maydell
2023-07-22 21:44 ` [PATCH for-8.2? v2 3/4] util/interval-tree: Introduce pc_parent Richard Henderson
2023-07-24 11:51   ` Peter Maydell
2023-07-22 21:44 ` [PATCH for-8.2? v2 4/4] util/interval-tree: Use qatomic_read/set for rb_parent_color Richard Henderson
2023-07-24 11:53   ` Peter Maydell

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=20230722214422.118743-1-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).