qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] util/interval-tree: Avoid race conditions without optimization
@ 2023-07-22 21:44 Richard Henderson
  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
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Richard Henderson @ 2023-07-22 21:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-24 11:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-22 21:44 [PATCH v2 0/4] util/interval-tree: Avoid race conditions without optimization Richard Henderson
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

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).