From: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Mathieu Desnoyers
<mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
Cc: Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-api <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Andy Lutomirski <luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"Paul E. McKenney"
<paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Boqun Feng <boqun.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Andrew Hunter <ahh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
maged michael
<maged.michael-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Avi Kivity <avi-VrcmuVmyx1hWk0Htik3J/w@public.gmane.org>,
Benjamin Herrenschmidt
<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>,
Dave Watson <davejwatson-b10kYP2dOMg@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Andrea Parri
<parri.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Russell King,
ARM Linux" <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
Greg Hackmann <ghackmann-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
David
Subject: Re: [PATCH 08/11] membarrier: Provide core serializing command (v2)
Date: Mon, 29 Jan 2018 20:09:23 +0100 [thread overview]
Message-ID: <20180129190923.GP2249@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <485936677.11601.1517250965043.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
On Mon, Jan 29, 2018 at 06:36:05PM +0000, Mathieu Desnoyers wrote:
> ----- On Jan 29, 2018, at 1:15 PM, Peter Zijlstra peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org wrote:
> > Aaah, its the case where we do not pass through switch_mm(), the partial
> > comment got to me. I only realized after reading the next patch.
>
> Indeed, if we read the entire comment, it's made clear that this case is for
> when switch_mm is not invoked, where the current mm is changed without going
> through switch_mm(), when scheduling between uthread->kthread->uthread for
> instance.
>
> /*
> * When transitioning from a kernel thread to a userspace
> * thread, mmdrop()'s implicit full barrier is required by the
> * membarrier system call, because the current active_mm can
> * become the current mm without going through switch_mm().
> * membarrier also requires a core serializing instruction
> * before going back to user-space after storing to rq->curr.
> */
>
> Is there something I should improve in the wording of this added
> sentence to make it clearer ?
Can be improved I think, its got two unqualified "membarrier"s in and
its a bit mixed up. I'm having a major case of the mondays (brain just
won't start today), but maybe something like:
When we switched through a kernel thread, the loop in
membarrier_{private,global}_expedited() can have observed that
kernel thread and not issued an IPI. We will also not pass
through switch_mm(). Membarrier requires a barrier after writing
rq->curr and returning to userspace, so provide them here:
- a full memory barrier for {PRIVATE,GLOBAL}_EXPEDITED
- a sync_core for SYNC_CORE
Also I think changing the changlog to state where we need core-sync
would be good. Currently the x86 patch does that, but not this one,
while this introduces the feature.
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-api <linux-api@vger.kernel.org>,
Andy Lutomirski <luto@kernel.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>, Andrew Hunter <ahh@google.com>,
maged michael <maged.michael@gmail.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>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrea Parri <parri.andrea@gmail.com>,
"Russell King, ARM Linux" <linux@armlinux.org.uk>,
Greg Hackmann <ghackmann@google.com>,
Will Deacon <will.deacon@arm.com>, David Sehr <sehr@google.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
x86 <x86@kernel.org>, linux-arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH 08/11] membarrier: Provide core serializing command (v2)
Date: Mon, 29 Jan 2018 20:09:23 +0100 [thread overview]
Message-ID: <20180129190923.GP2249@hirez.programming.kicks-ass.net> (raw)
Message-ID: <20180129190923.-r1p83fbUb8gWbmO-PDT9uo_5OI31KQ2IAIb_oWT3y4@z> (raw)
In-Reply-To: <485936677.11601.1517250965043.JavaMail.zimbra@efficios.com>
On Mon, Jan 29, 2018 at 06:36:05PM +0000, Mathieu Desnoyers wrote:
> ----- On Jan 29, 2018, at 1:15 PM, Peter Zijlstra peterz@infradead.org wrote:
> > Aaah, its the case where we do not pass through switch_mm(), the partial
> > comment got to me. I only realized after reading the next patch.
>
> Indeed, if we read the entire comment, it's made clear that this case is for
> when switch_mm is not invoked, where the current mm is changed without going
> through switch_mm(), when scheduling between uthread->kthread->uthread for
> instance.
>
> /*
> * When transitioning from a kernel thread to a userspace
> * thread, mmdrop()'s implicit full barrier is required by the
> * membarrier system call, because the current active_mm can
> * become the current mm without going through switch_mm().
> * membarrier also requires a core serializing instruction
> * before going back to user-space after storing to rq->curr.
> */
>
> Is there something I should improve in the wording of this added
> sentence to make it clearer ?
Can be improved I think, its got two unqualified "membarrier"s in and
its a bit mixed up. I'm having a major case of the mondays (brain just
won't start today), but maybe something like:
When we switched through a kernel thread, the loop in
membarrier_{private,global}_expedited() can have observed that
kernel thread and not issued an IPI. We will also not pass
through switch_mm(). Membarrier requires a barrier after writing
rq->curr and returning to userspace, so provide them here:
- a full memory barrier for {PRIVATE,GLOBAL}_EXPEDITED
- a sync_core for SYNC_CORE
Also I think changing the changlog to state where we need core-sync
would be good. Currently the x86 patch does that, but not this one,
while this introduces the feature.
next prev parent reply other threads:[~2018-01-29 19:09 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 15:57 [PATCH for 4.16 00/11] membarrier updates for 4.16 Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 01/11] membarrier: selftest: Test private expedited cmd (v2) Mathieu Desnoyers
2018-01-23 15:57 ` [Linux-kselftest-mirror] " Mathieu Desnoyers
2018-01-23 15:57 ` mathieu.desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 03/11] membarrier: Document scheduler barrier requirements (v5) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
[not found] ` <20180123155733.3404-1-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2018-01-23 15:57 ` [PATCH 02/11] powerpc: membarrier: Skip memory barrier in switch_mm() (v7) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 04/11] membarrier: provide GLOBAL_EXPEDITED command (v3) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 05/11] membarrier: selftest: Test global expedited cmd (v2) Mathieu Desnoyers
2018-01-23 15:57 ` [Linux-kselftest-mirror] " Mathieu Desnoyers
2018-01-23 15:57 ` mathieu.desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 07/11] x86: Implement sync_core_before_usermode (v3) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 09/11] membarrier: x86: Provide core serializing command (v4) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-29 19:13 ` [PATCH for 4.16 00/11] membarrier updates for 4.16 Peter Zijlstra
2018-01-29 19:13 ` Peter Zijlstra
2018-01-23 15:57 ` [PATCH 06/11] Introduce sync_core_before_usermode (v2) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 08/11] membarrier: Provide core serializing command (v2) Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-29 18:04 ` Peter Zijlstra
2018-01-29 18:04 ` Peter Zijlstra
[not found] ` <20180129180414.GO2249-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2018-01-29 18:15 ` Peter Zijlstra
2018-01-29 18:15 ` Peter Zijlstra
[not found] ` <20180129181529.GG2295-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2018-01-29 18:36 ` Mathieu Desnoyers
2018-01-29 18:36 ` Mathieu Desnoyers
[not found] ` <485936677.11601.1517250965043.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2018-01-29 19:09 ` Peter Zijlstra [this message]
2018-01-29 19:09 ` Peter Zijlstra
[not found] ` <20180129190923.GP2249-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2018-01-29 19:20 ` Mathieu Desnoyers
2018-01-29 19:20 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 10/11] membarrier: arm64: Provide core serializing command Mathieu Desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-23 15:57 ` [PATCH 11/11] membarrier: selftest: Test private expedited sync core cmd Mathieu Desnoyers
2018-01-23 15:57 ` [Linux-kselftest-mirror] " Mathieu Desnoyers
2018-01-23 15:57 ` mathieu.desnoyers
2018-01-23 15:57 ` Mathieu Desnoyers
2018-01-29 16:02 ` [PATCH for 4.16 00/11] membarrier updates for 4.16 Mathieu Desnoyers
2018-01-29 16:02 ` Mathieu Desnoyers
2018-01-29 17:40 ` Linus Torvalds
2018-01-29 17:40 ` Linus Torvalds
[not found] ` <CA+55aFxdqXJidPLFb--pa8cmJnepzGpLRD=gNXgktkjNW+jJug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-05 16:33 ` Ingo Molnar
2018-02-05 16:33 ` Ingo Molnar
[not found] ` <20180205163353.llyamby4o7ajsvt7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-05 17:23 ` Linus Torvalds
2018-02-05 17:23 ` Linus Torvalds
[not found] ` <CA+55aFw9r1bLhPZ8bOApD7dBPTtFLBk+A71qLNF+XrEOL8+1oA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-02-05 18:33 ` Ingo Molnar
2018-02-05 18:33 ` Ingo Molnar
2018-02-05 18:53 ` Mathieu Desnoyers
2018-02-05 18:53 ` Mathieu Desnoyers
[not found] ` <1659703322.16254.1517856780591.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2018-02-05 19:49 ` Ingo Molnar
2018-02-05 19:49 ` Ingo Molnar
2018-02-05 19:54 ` Linus Torvalds
2018-02-05 19:54 ` Linus Torvalds
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=20180129190923.GP2249@hirez.programming.kicks-ass.net \
--to=peterz-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
--cc=ahh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=avi-VrcmuVmyx1hWk0Htik3J/w@public.gmane.org \
--cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=boqun.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=davejwatson-b10kYP2dOMg@public.gmane.org \
--cc=ghackmann-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=maged.michael-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org \
--cc=parri.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.