From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Boqun Feng <boqun.feng@gmail.com>, Andrew Hunter <ahh@google.com>,
maged michael <maged.michael@gmail.com>,
gromer <gromer@google.com>, Avi Kivity <avi@scylladb.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Dave Watson <davejwatson@fb.com>,
Andy Lutomirski <luto@kernel.org>,
Will Deacon <will.deacon@arm.com>, Hans Boehm <hboehm@google.com>
Subject: Re: [PATCH v2] membarrier: provide register sync core cmd
Date: Wed, 30 Aug 2017 07:46:41 -0700 [thread overview]
Message-ID: <20170830144641.GV11320@linux.vnet.ibm.com> (raw)
In-Reply-To: <CALCETrXTgNNwB4670QgV=ZLoubRrUATZJAiihUgLMuRUVN=baA@mail.gmail.com>
On Tue, Aug 29, 2017 at 10:01:56PM -0700, Andy Lutomirski wrote:
> > On Aug 27, 2017, at 8:05 PM, Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
> >
> > ----- On Aug 27, 2017, at 3:53 PM, Andy Lutomirski luto@amacapital.net wrote:
> >
> >>> On Aug 27, 2017, at 1:50 PM, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> >>> wrote:
> >>>
> >>> Add a new MEMBARRIER_CMD_REGISTER_SYNC_CORE command to the membarrier
> >>> system call. It allows processes to register their intent to have their
> >>> threads issue core serializing barriers in addition to memory barriers
> >>> whenever a membarrier command is performed.
> >>>
> >>
> >> Why is this stateful? That is, why not just have a new membarrier command to
> >> sync every thread's icache?
> >
> > If we'd do it on every CPU icache, it would be as trivial as you say. The
> > concern here is sending IPIs only to CPUs running threads that belong to the
> > same process, so we don't disturb unrelated processes.
> >
> > If we could just grab each CPU's runqueue lock, it would be fairly simple
> > to do. But we want to avoid hitting each runqueue with exclusive atomic
> > access associated with grabbing the lock. (cache-line bouncing)
>
> Hmm. Are there really arches where there is no clean implementation
> without this hacker? It seems rather unfortunate that munmap() can be
> done efficiently but this barrier can't be.
>
> At the very least, could there be a register command *and* a special
> sync command? I dislike the idea that the sync command does something
> different depending on some other state. Even better (IMO) would be a
> design where you ask for an isync and, if the arch can do it
> efficiently (x86), you get an efficient isync and, if the arch can't
> (arm64?) you take all the rq locks?
In some cases I suspect that IPIs might be required. Regardless of
that, we might well need to provide a way for architectures to do
special things.
But I must defer to Mathieu on this.
Thanx, Paul
next prev parent reply other threads:[~2017-08-30 14:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-27 20:50 [PATCH v2] membarrier: provide register sync core cmd Mathieu Desnoyers
2017-08-27 22:53 ` Andy Lutomirski
2017-08-28 3:05 ` Mathieu Desnoyers
2017-08-30 5:01 ` Andy Lutomirski
2017-08-30 14:46 ` Paul E. McKenney [this message]
2017-08-30 17:33 ` Mathieu Desnoyers
2017-08-31 17:00 ` Will Deacon
2017-08-30 4:01 ` Boqun Feng
2017-08-30 17:25 ` Mathieu Desnoyers
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=20170830144641.GV11320@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=ahh@google.com \
--cc=avi@scylladb.com \
--cc=benh@kernel.crashing.org \
--cc=boqun.feng@gmail.com \
--cc=davejwatson@fb.com \
--cc=gromer@google.com \
--cc=hboehm@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=maged.michael@gmail.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.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