Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-22 Thread Nadav Amit
> On Jul 22, 2019, at 12:47 PM, Rasmus Villemoes > wrote: > > On 19/07/2019 02.58, Nadav Amit wrote: > >> /* >> @@ -865,7 +893,7 @@ void arch_tlbbatch_flush(struct >> arch_tlbflush_unmap_batch *batch) >> if (cpumask_test_cpu(cpu, &batch->cpumask)) { >> lockdep_assert_irqs_ena

Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-22 Thread Rasmus Villemoes
On 19/07/2019 02.58, Nadav Amit wrote: > /* > @@ -865,7 +893,7 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch > *batch) > if (cpumask_test_cpu(cpu, &batch->cpumask)) { > lockdep_assert_irqs_enabled(); > local_irq_disable(); > - flush_tl

Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-22 Thread Peter Zijlstra
On Thu, Jul 18, 2019 at 05:58:31PM -0700, Nadav Amit wrote: > +static DEFINE_PER_CPU(cpumask_t, flush_tlb_mask); I'm thinking it should be possible to allocate this before we switch to SMP, no? cpumask_t really should not be used wherever possible.

Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-19 Thread Nadav Amit
> On Jul 19, 2019, at 3:44 PM, Joe Perches wrote: > > On Fri, 2019-07-19 at 18:41 +, Nadav Amit wrote: >>> On Jul 19, 2019, at 11:36 AM, Dave Hansen wrote: >>> >>> On 7/18/19 5:58 PM, Nadav Amit wrote: @@ -865,7 +893,7 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch

Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-19 Thread Joe Perches
On Fri, 2019-07-19 at 18:41 +, Nadav Amit wrote: > > On Jul 19, 2019, at 11:36 AM, Dave Hansen wrote: > > > > On 7/18/19 5:58 PM, Nadav Amit wrote: > > > @@ -865,7 +893,7 @@ void arch_tlbbatch_flush(struct > > > arch_tlbflush_unmap_batch *batch) > > > if (cpumask_test_cpu(cpu, &batch->cpum

Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-19 Thread Nadav Amit
> On Jul 19, 2019, at 11:36 AM, Dave Hansen wrote: > > On 7/18/19 5:58 PM, Nadav Amit wrote: >> @@ -865,7 +893,7 @@ void arch_tlbbatch_flush(struct >> arch_tlbflush_unmap_batch *batch) >> if (cpumask_test_cpu(cpu, &batch->cpumask)) { >> lockdep_assert_irqs_enabled(); >>

Re: [PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-19 Thread Dave Hansen
On 7/18/19 5:58 PM, Nadav Amit wrote: > @@ -865,7 +893,7 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch > *batch) > if (cpumask_test_cpu(cpu, &batch->cpumask)) { > lockdep_assert_irqs_enabled(); > local_irq_disable(); > - flush_tlb_func_l

[PATCH v3 3/9] x86/mm/tlb: Open-code on_each_cpu_cond_mask() for tlb_is_not_lazy()

2019-07-18 Thread Nadav Amit
Open-code on_each_cpu_cond_mask() in native_flush_tlb_others() to optimize the code. Open-coding eliminates the need for the indirect branch that is used to call is_lazy(), and in CPUs that are vulnerable to Spectre v2, it eliminates the retpoline. In addition, it allows to use a preallocated cpuma