lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 29 Jun 2018 13:29:18 -0400
From:   Rik van Riel <riel@...riel.com>
To:     Dave Hansen <dave.hansen@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Cc:     x86@...nel.org, luto@...nel.org, mingo@...nel.org,
        kernel-team@...com, tglx@...utronix.de, efault@....de,
        songliubraving@...com, hpa@...or.com
Subject: Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier

On Fri, 2018-06-29 at 10:05 -0700, Dave Hansen wrote:
> On 06/29/2018 07:29 AM, Rik van Riel wrote:
> > +		/*
> > +		 * If the CPU is not in lazy TLB mode, we are just
> > switching
> > +		 * from one thread in a process to another thread
> > in the same
> > +		 * process. No TLB flush required.
> > +		 */
> > +		if (!was_lazy)
> > +			return;
> > +
> > +		/*
> > +		 * Read the tlb_gen to check whether a flush is
> > needed.
> > +		 * If the TLB is up to date, just use it.
> > +		 * The barrier synchronizes with the tlb_gen
> > increment in
> > +		 * the TLB shootdown code.
> > +		 */
> > +		smp_mb();
> > +		next_tlb_gen = atomic64_read(&next-
> > >context.tlb_gen);
> > +		if
> > (this_cpu_read(cpu_tlbstate.ctxs[prev_asid].tlb_gen) ==
> > +				next_tlb_gen)
> > +			return;
> 
> Nit: it might be nice to have this hunk in a helper like
> cpu_tlbstate_needs_flush(next) to keep this nice and readable.

That helper might not end up as pretty as you would
like, because when the TLB is not up to date, we use
the value of next_tlb_gen in the "if (need_flush)"
branch below.

I would be happy to whip up a "tlb_up_to_date(mm, &next_tlb_gen)"
helper as patch 8/7, though :)

-- 
All Rights Reversed.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ