Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730111

Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf
Date 2017-09-11 03:50 +0200
Message-ID <uom1k-41R-3@gated-at.bofh.it> (permalink)
References (8 earlier) <unSPE-Nx-5@gated-at.bofh.it> <unSZj-R2-7@gated-at.bofh.it> <unTsm-1hK-31@gated-at.bofh.it> <unTC1-1le-3@gated-at.bofh.it> <uolyi-3QJ-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Sep 10, 2017 at 6:12 PM, Rik van Riel <riel@redhat.com> wrote:
> On Sat, 2017-09-09 at 12:28 -0700, Andy Lutomirski wrote:
>> -
>> I propose the following fix.  If PCID is on, then, in
>> enter_lazy_tlb(), we switch to init_mm with the no-flush flag set.
>> (And we give init_mm its own dedicated ASID to keep it simple and
>> fast
>> -- no need to use the LRU ASID mapping to assign one
>> dynamically.)  We
>> clear the bit in mm_cpumask.  That is, we more or less just skip the
>> whole lazy TLB optimization and rely on PCID CPUs having reasonably
>> fast CR3 writes.  No extra IPIs.
>
> Avoiding the IPIs is probably what matters the most, especially
> on systems with deep C states, and virtual machines where the
> host may be running something else, causing the IPI service time
> to go through the roof for idle VCPUs.
>
>> Also, sorry Rik, this means your old increased laziness optimization
>> is dead in the water.  It will have exactly the same speculative load
>> problem.
>
> Doesn't a memory barrier solve that speculative load
> problem?
>
> The memory barrier could be added only to the path
> that potentially skips reloading the TLB, under the
> assumption that a memory barrier is cheaper than a
> TLB reload (even with ASID).

No, nothing stops the problematic speculative load.  Here's the issue.
One CPU removes a reference to a page table from a higher-level page
table, flushes, and then frees the page table.  Then it re-allocates
it and writes something unrelated there.  Another CPU that has CR3
pointing to the page hierarchy in question could have a reference to
the freed table in its paging structure cache.  Even if it's
guaranteed to not try to access the addresses in question (because
they're user addresses and the other CPU is in kernel mode, etc), but
there is never a guarantee that the CPU doesn't randomly try to fill
its TLB for the affected addresses.  This results in invalid PTEs in
the TLB, possible accesses using bogus memory types, and maybe even
reads from IO space.

It looks like we actually need to propagate flushes everywhere that
could have references to the flushed range, even if the software won't
access that range.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-05 09:40 +0200
  Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Peter Zijlstra <peterz@infradead.org> - 2017-09-05 11:00 +0200
    Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-05 12:00 +0200
      Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Thomas Gleixner <tglx@linutronix.de> - 2017-09-06 15:00 +0200
        Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-06 15:20 +0200
          Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-07 08:30 +0200
            Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Thomas Gleixner <tglx@linutronix.de> - 2017-09-08 08:30 +0200
              Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-08 10:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-08 11:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-08 11:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Ingo Molnar <mingo@kernel.org> - 2017-09-08 12:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-08 12:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-08 13:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-08 18:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-08 19:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-08 23:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 00:00 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-09 01:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-09 01:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-09 02:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-09 03:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@amacapital.net> - 2017-09-09 03:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-09 20:00 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-09 20:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 08:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 12:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 13:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 15:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 15:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 15:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 16:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 16:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 16:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 16:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 18:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 19:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 19:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 19:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 20:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 20:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 20:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 21:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 21:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-09 20:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 20:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-09 20:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 21:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-09 21:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-09 21:40 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-10 06:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@amacapital.net> - 2017-09-10 22:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Peter Zijlstra <peterz@infradead.org> - 2017-09-10 22:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Ingo Molnar <mingo@kernel.org> - 2017-09-17 19:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building  e.g. perf Rik van Riel <riel@redhat.com> - 2017-09-11 03:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Andy Lutomirski <luto@kernel.org> - 2017-09-11 03:50 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building  e.g. perf Rik van Riel <riel@redhat.com> - 2017-09-11 17:10 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g. perf Linus Torvalds <torvalds@linux-foundation.org> - 2017-09-09 21:30 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-12 09:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Markus Trippelsdorf <markus@trippelsdorf.de> - 2017-09-09 10:20 +0200
                Re: Current mainline git (24e700e291d52bd2) hangs when building e.g.  perf Borislav Petkov <bp@alien8.de> - 2017-09-08 17:00 +0200

csiph-web