Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 28 Jan 2019 03:30:56 -0000 Received: from mga03.intel.com ([134.134.136.65]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gnxdO-0001xh-15 for speck@linutronix.de; Mon, 28 Jan 2019 04:30:55 +0100 Date: Sun, 27 Jan 2019 19:30:50 -0800 From: Andi Kleen Subject: [MODERATED] Re: [PATCH v5 03/27] MDSv5 16 Message-ID: <20190128033050.GJ6118@tassilo.jf.intel.com> References: <6bfd31477bf279d9af286a17ad6b87c7f6656ddf.1547858934.git.ak@linux.intel.com> MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Sun, Jan 27, 2019 at 10:58:38PM +0100, speck for Thomas Gleixner wrote: > On Fri, 18 Jan 2019, speck for Andi Kleen wrote: > > +/* > > + * Clear CPU buffers to avoid side channels. > > + * We use microcode as a side effect of the obsolete VERW instruction > > + */ > > + > > +static inline void clear_cpu(void) > > +{ > > + unsigned kernel_ds = __KERNEL_DS; > > + /* Has to be memory form, don't modify to use an register */ > > + alternative_input("verw %[kernelds]", "", X86_FEATURE_NO_VERW, > > + [kernelds] "m" (kernel_ds)); > > This looks backwards. Why is this FEATURE_NO_VERW instead of > FEATURE_MDS_VERW (or such) ? I had it that way originally in the earlier versions, but Linus proposed to do it this way around for the unconditional VERW (see emails some time back) However I'm also thinking of changing it back to optimize some of the other checks to avoid needing to check multiple flags. -Andi