Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1651390
| From | Rik van Riel <riel@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes |
| Date | 2017-05-26 15:30 +0200 |
| Message-ID | <tLntv-6pE-5@gated-at.bofh.it> (permalink) |
| References | <tLbC1-79q-5@gated-at.bofh.it> <tLbC2-79q-19@gated-at.bofh.it> <tLcop-7Hu-3@gated-at.bofh.it> <tLcRr-87p-5@gated-at.bofh.it> |
| Organization | Red Hat, Inc |
On Thu, 2017-05-25 at 19:01 -0700, Andy Lutomirski wrote:
> On Thu, May 25, 2017 at 6:39 PM, Rik van Riel <riel@redhat.com>
> wrote:
> > On Thu, 2017-05-25 at 17:47 -0700, Andy Lutomirski wrote:
> > >
> > > +++ b/arch/x86/mm/tlb.c
> > > @@ -311,7 +311,7 @@ void flush_tlb_mm_range(struct mm_struct *mm,
> > > unsigned long start,
> > > goto out;
> > > }
> > >
> > > - if (!current->mm) {
> > > + if (this_cpu_read(cpu_tlbstate.state) != TLBSTATE_OK) {
> > > leave_mm(smp_processor_id());
> >
> > Unless -mm changed leave_mm (I did not check), this
> > is not quite correct yet.
> >
> > The reason is leave_mm (at least in the latest Linus
> > tree) ignores the cpu argument for one of its checks.
> >
> > You should probably fix that in an earlier patch,
> > assuming you haven't already done so in -mm.
> >
> > void leave_mm(int cpu)
> > {
> > struct mm_struct *active_mm =
> > this_cpu_read(cpu_tlbstate.active_mm);
> > if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
> > BUG();
> > if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) {
> > cpumask_clear_cpu(cpu, mm_cpumask(active_mm));
> > load_cr3(swapper_pg_dir);
>
> I agree it's odd, but what's the bug? Both before and after,
> leave_mm
> needed to be called with cpu == smp_processor_id(), and
> smp_processor_id() warns if it's called in a preemptible context.
Indeed, you are right. Looking at too much code at once...
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/8] x86 TLB flush cleanups, moving toward PCID support Andy Lutomirski <luto@kernel.org> - 2017-05-26 02:50 +0200
[PATCH v3 6/8] x86/mm: Rework lazy TLB to track the actual loaded mm Andy Lutomirski <luto@kernel.org> - 2017-05-26 02:50 +0200
[PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes Andy Lutomirski <luto@kernel.org> - 2017-05-26 02:50 +0200
Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes Rik van Riel <riel@redhat.com> - 2017-05-26 03:40 +0200
Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes Andy Lutomirski <luto@kernel.org> - 2017-05-26 04:10 +0200
Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes Rik van Riel <riel@redhat.com> - 2017-05-26 15:30 +0200
Re: [PATCH v3 2/8] x86/mm: Change the leave_mm() condition for local TLB flushes Nadav Amit <nadav.amit@gmail.com> - 2017-05-26 03:50 +0200
[PATCH v3 5/8] x86/mm: Remove the UP tlbflush code; always use the formerly SMP code Andy Lutomirski <luto@kernel.org> - 2017-05-26 02:50 +0200
[PATCH v3 1/8] x86/mm: Pass flush_tlb_info to flush_tlb_others() etc Andy Lutomirski <luto@kernel.org> - 2017-05-26 02:50 +0200
[PATCH v3 4/8] x86/mm: Use new merged flush logic in arch_tlbbatch_flush() Andy Lutomirski <luto@kernel.org> - 2017-05-26 02:50 +0200
csiph-web