From: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Mathieu Desnoyers
<mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
Cc: Avi Kivity <avi-VrcmuVmyx1hWk0Htik3J/w@public.gmane.org>,
Linus Torvalds
<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Andy Lutomirski <luto-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-kernel
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-api <linux-api-u79uwXL29TY76Z2rM5mHXA@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>,
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>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@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>
Subject: Re: [RFC PATCH 0/2] x86: Fix missing core serialization on migration
Date: Tue, 14 Nov 2017 17:08:42 +0100 [thread overview]
Message-ID: <20171114160842.GH3857@worktop> (raw)
In-Reply-To: <20171114160541.GC3165-IIpfhp3q70x9+YH6RuovlLjjLBE8jN/0@public.gmane.org>
On Tue, Nov 14, 2017 at 05:05:41PM +0100, Peter Zijlstra wrote:
> On Tue, Nov 14, 2017 at 03:17:12PM +0000, Mathieu Desnoyers wrote:
> > I've tried to create a small single-threaded self-modifying loop in
> > user-space to trigger a trace cache or speculative execution quirk,
> > but I have not succeeded yet. I suspect that I would need to know
> > more about the internals of the processor architecture to create the
> > right stalls that would allow speculative execution to move further
> > ahead, and trigger an incoherent execution flow. Ideas on how to
> > trigger this would be welcome.
>
> I thought the whole problem was per definition multi-threaded.
>
> Single-threaded stuff can't get out of sync with itself; you'll always
> observe your own stores.
And even if you could, you can always execute a local serializing
instruction like CPUID to force things.
> And ISTR the JIT scenario being something like the JIT overwriting
> previously executed but supposedly no longer used code. And in this
> scenario you'd want to guarantee all CPUs observe the new code before
> jumping into it.
>
> The current approach is using mprotect(), except that on a number of
> platforms the TLB invalidate from that is not guaranteed to be strong
> enough to sync for code changes.
>
> On x86 the mprotect() should work just fine, since we broadcast IPIs for
> the TLB invalidate and the IRET from those will get the things synced up
> again (if nothing else; very likely we'll have done a MOV-CR3 which will
> of course also have sufficient syncness on it).
>
> But PowerPC, s390, ARM et al that do TLB invalidates without interrupts
> and don't guarantee their TLB invalidate sync against execution units
> are left broken by this scheme.
>
next prev parent reply other threads:[~2017-11-14 16:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-10 21:12 [RFC PATCH 0/2] x86: Fix missing core serialization on migration Mathieu Desnoyers
[not found] ` <20171110211249.10742-1-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2017-11-10 21:12 ` [RFC PATCH 1/2] x86: Introduce sync_core_before_usermode Mathieu Desnoyers
2017-11-10 21:12 ` [RFC PATCH 2/2] Fix: x86: Add missing core serializing instruction on migration Mathieu Desnoyers
2017-11-10 21:36 ` [RFC PATCH 0/2] x86: Fix missing core serialization " Linus Torvalds
[not found] ` <CA+55aFzbroWqi+FTdYhRVSwUZ-M0wDVxjXqDbh40JEnXc2LdgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-10 21:57 ` Mathieu Desnoyers
[not found] ` <885227610.13045.1510351034488.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2017-11-10 22:12 ` Linus Torvalds
2017-11-13 16:56 ` Mathieu Desnoyers
[not found] ` <617343212.13932.1510592207202.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2017-11-13 17:14 ` Linus Torvalds
2017-11-14 14:53 ` Avi Kivity
[not found] ` <4d47fbb8-8f99-19d3-a9cf-66841aeffac3-VrcmuVmyx1hWk0Htik3J/w@public.gmane.org>
2017-11-14 15:17 ` Mathieu Desnoyers
[not found] ` <4431530.14831.1510672632887.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2017-11-14 15:42 ` Avi Kivity
2017-11-14 16:05 ` Peter Zijlstra
[not found] ` <20171114160541.GC3165-IIpfhp3q70x9+YH6RuovlLjjLBE8jN/0@public.gmane.org>
2017-11-14 16:08 ` Peter Zijlstra [this message]
2017-11-14 16:49 ` Mathieu Desnoyers
2017-11-14 17:03 ` Avi Kivity
[not found] ` <98b50de6-4cb1-9c43-4353-9ee7135dc63f-VrcmuVmyx1hWk0Htik3J/w@public.gmane.org>
2017-11-14 17:10 ` Mathieu Desnoyers
[not found] ` <1216732828.15017.1510679404571.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2017-11-14 17:31 ` Linus Torvalds
2017-11-14 16:10 ` Andy Lutomirski
[not found] ` <CALCETrVpBocmrd+R5-R-d+QBvp6h8iZkjo7Xjy6V6x1rPfh25w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 16:13 ` Thomas Gleixner
2017-11-14 16:16 ` Andy Lutomirski
[not found] ` <CALCETrXpR7ai047pHtdQe5J+FpuFO5ekeeEqLUt1wVLopyNt_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 16:31 ` Peter Zijlstra
[not found] ` <20171114163159.GD3165-IIpfhp3q70x9+YH6RuovlLjjLBE8jN/0@public.gmane.org>
2017-11-14 17:17 ` Daniel Bristot de Oliveira
[not found] ` <6f9f57fa-8057-cdbe-231b-20920b3b3670-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-14 17:40 ` Peter Zijlstra
[not found] ` <20171114174049.GF3165-IIpfhp3q70x9+YH6RuovlLjjLBE8jN/0@public.gmane.org>
2017-11-14 18:01 ` Daniel Bristot de Oliveira
[not found] ` <ada6faaf-9e94-439f-57f2-3b9179cb4bea-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-14 18:17 ` Peter Zijlstra
[not found] ` <20171114181732.bwahj6woik27trou-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2017-11-14 18:24 ` Daniel Bristot de Oliveira
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=20171114160842.GH3857@worktop \
--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=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@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 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).