public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Thomas Rodgers <rodgert@appliantology.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org,
	trodgers@redhat.com, Thomas Rodgers <rodgert@twrodgers.com>
Subject: Re: [PATCH] libstdc++: Fix wrong thread waking on notify [PR100334]
Date: Mon, 10 May 2021 19:21:10 +0100	[thread overview]
Message-ID: <20210510182110.GR3008@redhat.com> (raw)
In-Reply-To: <20210503164352.23944-1-rodgert@appliantology.com>

On 03/05/21 09:43 -0700, Thomas Rodgers wrote:
>From: Thomas Rodgers <rodgert@twrodgers.com>
>
>This should also be backported to gcc-11

The additional _M_laundered data member changes the object layout.
That isn't safe for the branch. Would it be possible to smuggle that
flag in the least significant bit of the _M_addr member, which is
always aligned to more than one byte? Just on the gcc-11 branch, not
for trunk.


>libstdc++/ChangeLog:
>	* include/bits/atomic_wait.h (__waiter::_M_do_wait_v): loop
>	until observe value change.
>	(__waiter_base::_M_laundered): New member.
>	(__watier_base::_M_notify): Check _M_laundered to determine
>	whether to wake one or all.
>	(__detail::__atomic_compare): Do not implicitly convert
>	result of __buildtin_memcpmp to bool,

Typos, and the description doesn't seem accurate (it wasn't implicitly
converting it to bool, there was always an explicit comparison, but
now it's == rather than !=).

>	(__waiter_base::_S_do_spin_v): Adjust predicate.
>	* testsuite/29_atomics/atomic/wait_notify/100334.cc: New
>	test.


OK for trunk with a fixed changelog, but we need a different patch for
the branch.



  reply	other threads:[~2021-05-10 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 16:43 Thomas Rodgers
2021-05-10 18:21 ` Jonathan Wakely [this message]
2021-05-13 23:35   ` Thomas Rodgers
2021-05-14  1:54     ` Thomas Rodgers
2021-05-14 17:09       ` Jonathan Wakely
2021-05-17 16:43         ` Jonathan Wakely
2021-05-17 19:08           ` Thomas Rodgers

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=20210510182110.GR3008@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=rodgert@appliantology.com \
    --cc=rodgert@twrodgers.com \
    --cc=trodgers@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).