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  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:   Thu, 14 May 2020 08:23:11 +0000
From:   "Singh, Balbir" <sblbir@...zon.com>
To:     "tglx@...utronix.de" <tglx@...utronix.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     "keescook@...omium.org" <keescook@...omium.org>,
        "thomas.lendacky@....com" <thomas.lendacky@....com>,
        "tony.luck@...el.com" <tony.luck@...el.com>,
        "benh@...nel.crashing.org" <benh@...nel.crashing.org>,
        "jpoimboe@...hat.com" <jpoimboe@...hat.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "dave.hansen@...el.com" <dave.hansen@...el.com>
Subject: Re:  [PATCH v6 5/6] Optionally flush L1D on context switch

On Wed, 2020-05-13 at 17:04 +0200, Thomas Gleixner wrote:
> 
> 
> Balbir Singh <sblbir@...zon.com> writes:
> > 
> > +     if (prev_mm & LAST_USER_MM_L1D_FLUSH)
> > +             arch_l1d_flush(0); /* Just flush, don't populate the
> > TLB */
> 
> Bah. I fundamentally hate tail comments. They are just disturbing the
> reading flow. Aside of that, this states the WHAT but not the WHY. And
> if you add that explanation then you need more than 20 characters and
> end up with
> 
>         if (prev_mm & LAST_USER_MM_L1D_FLUSH) {
>                 /*
>                  * Proper comment explaining why this is flushing
>                  * without prepopulating the TLB.
>                  */
>                 arch_l1d_flush(0);
>         }
> 

I added a comment due to the use of 0, 0 is usually seen as true or
false and I wanted to add some comments in there to indicate we don't
populate the TLB, the reason we don't do it is, I don't think we need
to. I am happy to revisit the placement of the comment.

> anyway. And even for a short comment which fits after the function
> call
> it's way better to have:
> 
>         if (prev_mm & LAST_USER_MM_L1D_FLUSH) {
>                 /* Short explanation */
>                 arch_l1d_flush(0);
>         }
> 
> Hmm?
> 
> > +     /*
> > +      * Leave last_user_mm_spec at LAST_USER_MM_IBPB, we don't
> > +      * want to set LAST_USER_MM_L1D_FLUSH and force a flush before
> > +      * we've allocated the flush pages.
> 
> Ah here is the comment. I still like the explicit define for the (re)
> init.
> 

I saw your tree and it sounds like you fixed it up in there in patch 3.

Balbir Singh.

Powered by blists - more mailing lists