mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: "Paul E. McKenney via Libc-alpha" <libc-alpha@sourceware.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] nptl: Add rseq registration
Date: Mon, 6 Dec 2021 13:08:13 -0800	[thread overview]
Message-ID: <20211206210813.GF641268@paulmck-ThinkPad-P17-Gen-1> (raw)
In-Reply-To: <87k0ghlbsk.fsf@oldenburg.str.redhat.com>

On Mon, Dec 06, 2021 at 09:26:51PM +0100, Florian Weimer wrote:
> * Paul E. McKenney via Libc-alpha:
> 
> >> The C memory model is broken and does not prevent out-of-thin-air
> >> values.  As far as I know, this breaks single-copy atomicity.  In
> >> practice, compilers will not exercise the latitude offered by the memory
> >> model.  volatile does not ensure absence of data races.
> >
> > Within the confines of the standard, agreed, use of the volatile keyword
> > does not explicitly prevent data races.
> >
> > However, volatile accesses are (informally) defined to suffice for
> > device-driver memory accesses that communicate with devices, whether via
> > MMIO or DMA-style shared memory.  The device-driver firmware is often
> > written in C or C++.  So doesn't this informal device-driver guarantee
> > need to also do what is needed for userspace code that is communicating
> > with kernel code?  If not, why not?
> 
> The informal guarantee is probably good enough here, too.  However, the
> actual accesses are behind macros, and those macros use either
> non-volatile plain reads or inline assembler (which use
> single-instruction naturally aligned reads).

Agreed, a non-volatile plain read is quite dangerous in this context.

							Thanx, Paul

      reply	other threads:[~2021-12-06 21:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1638798186.git.fweimer@redhat.com>
     [not found] ` <9c58724d604e160ebda5f667331fa41416c0d12b.1638798186.git.fweimer@redhat.com>
     [not found]   ` <1780152866.15126.1638809966443.JavaMail.zimbra@efficios.com>
     [not found]     ` <871r2podt9.fsf@oldenburg.str.redhat.com>
2021-12-06 18:52       ` Mathieu Desnoyers
2021-12-06 19:03         ` Florian Weimer
2021-12-06 20:11           ` Paul E. McKenney
2021-12-06 20:26             ` Florian Weimer
2021-12-06 21:08               ` Paul E. McKenney [this message]

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=20211206210813.GF641268@paulmck-ThinkPad-P17-Gen-1 \
    --to=paulmck@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.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

all inboxes | Powered by JetHome®