From: Peter Zijlstra <peterz@infradead.org>
To: Nadav Amit <namit@vmware.com>
Cc: Ingo Molnar <mingo@redhat.com>, Andy Lutomirski <luto@kernel.org>,
Borislav Petkov <bp@alien8.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [RFC PATCH 4/6] x86/mm/tlb: Refactor common code into flush_tlb_on_cpus()
Date: Mon, 27 May 2019 21:14:54 +0200 [thread overview]
Message-ID: <20190527191454.GI2623@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <9BE478F9-C700-46C5-80BC-B905FD0AAB17@vmware.com>
On Mon, May 27, 2019 at 06:59:01PM +0000, Nadav Amit wrote:
> > On May 27, 2019, at 2:24 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Sat, May 25, 2019 at 01:22:01AM -0700, Nadav Amit wrote:
> >
> >> There is one functional change, which should not affect correctness:
> >> flush_tlb_mm_range compared loaded_mm and the mm to figure out if local
> >> flush is needed. Instead, the common code would look at the mm_cpumask()
> >> which should give the same result.
> >
> >> @@ -786,18 +804,9 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
> >> info = get_flush_tlb_info(mm, start, end, stride_shift, freed_tables,
> >> new_tlb_gen);
> >>
> >> - if (mm == this_cpu_read(cpu_tlbstate.loaded_mm)) {
> >> - lockdep_assert_irqs_enabled();
> >> - local_irq_disable();
> >> - flush_tlb_func_local(info, TLB_LOCAL_MM_SHOOTDOWN);
> >> - local_irq_enable();
> >> - }
> >> -
> >> - if (cpumask_any_but(mm_cpumask(mm), cpu) < nr_cpu_ids)
> >> - flush_tlb_others(mm_cpumask(mm), info);
> >
> > So if we want to double check that; we'd add:
> >
> > WARN_ON_ONCE(cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)) ==
> > (mm == this_cpu_read(cpu_tlbstate.loaded_mm)));
> >
> > right?
>
> Yes, except the condition should be inverted (“!=“ instead of “==“), and I
> would prefer to use VM_WARN_ON_ONCE().
>
> Unfortunately, this condition does fire when copy_init_mm() calls dup_mm().
> I don’t think there is a correctness issue, and I am tempted just check,
> before warning, that (mm != init_mm) .
>
> What do you say?
Works for me.
next prev parent reply other threads:[~2019-05-27 19:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-25 8:21 [RFC PATCH 0/6] x86/mm: Flush remote and local TLBs concurrently Nadav Amit
2019-05-25 8:21 ` [RFC PATCH 1/6] smp: Remove smp_call_function() and on_each_cpu() return values Nadav Amit
2019-05-25 8:21 ` [RFC PATCH 2/6] cpumask: Purify cpumask_next() Nadav Amit
2019-05-25 8:32 ` Ingo Molnar
2019-05-27 8:30 ` Peter Zijlstra
2019-05-27 17:34 ` Nadav Amit
2019-05-25 8:22 ` [RFC PATCH 3/6] smp: Run functions concurrently in smp_call_function_many() Nadav Amit
2019-05-27 9:15 ` Peter Zijlstra
2019-05-27 17:39 ` Nadav Amit
2019-05-25 8:22 ` [RFC PATCH 4/6] x86/mm/tlb: Refactor common code into flush_tlb_on_cpus() Nadav Amit
2019-05-27 9:24 ` Peter Zijlstra
2019-05-27 18:59 ` Nadav Amit
2019-05-27 19:14 ` Peter Zijlstra [this message]
2019-05-25 8:22 ` [RFC PATCH 5/6] x86/mm/tlb: Flush remote and local TLBs concurrently Nadav Amit
2019-05-25 8:38 ` Nadav Amit
2019-05-25 8:54 ` Juergen Gross
2019-05-27 9:47 ` Peter Zijlstra
2019-05-27 10:21 ` Paolo Bonzini
2019-05-27 12:32 ` Peter Zijlstra
2019-05-27 12:45 ` Paolo Bonzini
2019-05-27 17:49 ` Nadav Amit
2019-05-25 8:22 ` [RFC PATCH 6/6] x86/mm/tlb: Optimize local TLB flushes Nadav Amit
2019-05-27 8:28 ` [RFC PATCH 0/6] x86/mm: Flush remote and local TLBs concurrently Peter Zijlstra
2019-05-27 9:59 ` Peter Zijlstra
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=20190527191454.GI2623@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=namit@vmware.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®