From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x226XvJD9dO3cDsMH7MGBfA10wXEQV7ws/rP4ePIitmroDoM5fe46IMhJiTHrA3S0pjZXIv55 ARC-Seal: i=1; a=rsa-sha256; t=1517045855; cv=none; d=google.com; s=arc-20160816; b=ZwsMaPz92qfI2zBI5i0b8Q+15z2J+V9NGrpis36ydHwflP/JKDegmrM8rmPDX3sGoR B3GVdFp+CN4BCMK5THRQHOA67Qb3gLvmCML3hZc/XdYpkv1Mp5bPUJz6/iI7Ncs/E9xs T4f63GoBFnMc0ESAduUqY/eoAyCxhkewYXcfJGrEBWur87r+lrN7Rt4ZmzZLduWSINl9 mqHAUBh9UUYq4Hn6IKxkYgBECEzxwGtjfVMxh0yX0SG4d7LoSroyppulnq5qokDF/W+6 ucdu8x2kavHuXw51+bqMitJO8LVVLvc3ysSzVeR5mpQGxi+MfY0d2eF+6K94iyD6h9nX EXcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=C7vH8QhCXRA7WcVtzitx7+74kPD9sP6wmOG5nQsPuok=; b=obCPRgE9o/uzlZzPRmHHE1xHYqVqgg6w/V2vulz/bEJWhhRpwG2CNTp5Zj+rZjdc2b 5bUURhh0dxvMGqRiujZaLD87PryTHpDoU6+zjYXpiyKiuWj6b+83pWta505jNHWsLHcN qFAqbZiEV35OPwTwnUiz5OaTDFQvBxMdh7Ubg595tPT6/OgkmtxDAaeNLnVEac5f/7by Y6NyPBfZpO3HqO1sAAbdjrrov2/xS4BqtAFgvvbU7deui4+HTh9J6JiSFXdKGLsBCxnt 1qtw377sBRYjjba/bDkqmAhzib+nUNpKgl3w7bNVV0+nrVB7OLivG2PZlvY0vNrLozzf tCYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bp@alien8.de designates 2a01:4f8:190:11c2::b:1457 as permitted sender) smtp.mailfrom=bp@alien8.de Authentication-Results: mx.google.com; spf=pass (google.com: domain of bp@alien8.de designates 2a01:4f8:190:11c2::b:1457 as permitted sender) smtp.mailfrom=bp@alien8.de Date: Sat, 27 Jan 2018 10:37:22 +0100 From: Borislav Petkov To: David Woodhouse Cc: Tom Lendacky , x86-ml , linux-tip-commits@vger.kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org Subject: Re: [PATCH] x86/cpufeatures: Cleanup AMD speculation feature bits Message-ID: <20180127093722.t6dn4sgocihjjq37@pd.tnic> References: <20180126184139.rcfbtk7dvj7kmyfn@pd.tnic> <1516992318.30244.271.camel@infradead.org> <20180126184915.ioqewp56orj2qhrt@pd.tnic> <7094ed9b-40f7-ba2b-55a6-cc5ab0b06bb9@amd.com> <20180126215209.vqdxh5p672tcdst6@pd.tnic> <1517003984.30244.299.camel@infradead.org> <20180126221026.hc2hk23zsqbqhkif@pd.tnic> <2cea933f-7e06-26d5-95cf-41df8308a0f8@amd.com> <1517045268.30244.305.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1517045268.30244.305.camel@infradead.org> User-Agent: NeoMutt/20170609 (1.8.3) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590681520403481900?= X-GMAIL-MSGID: =?utf-8?q?1590737875183616034?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Sat, Jan 27, 2018 at 09:27:48AM +0000, David Woodhouse wrote: > http://david.woodhou.se/cleanup-feature-bits.patch on top of my full > tree? @@ -223,7 +223,7 @@ static inline void indirect_branch_prediction_barrier(void) "movl %[val], %%eax\n\t" "movl $0, %%edx\n\t" "wrmsr", - X86_FEATURE_IBPB) + X86_FEATURE_USE_IBPB) I still don't think that's the right approach: I'd call the software-defined, synthetic features X86_FEATURE_IBPB X86_FEATURE_IBRS X86_FEATURE_STIBP then make *them* visible in /proc/cpuinfo and use them everywhere in the code. Only the vendor-specific detection code will set the synthetic ones when it detects a corresponding vendor-specific one. This way one *only* concentrates on the three above everywhere and only low-level, early, vendor-specific code takes care to set the corresponding synthetic features based on the actual hardware bits it detects. I think that unifies the view both to the user *and* to the rest of the kernel which should not care about the actual name of a hardware feature bit. And then you avoid coders scratching heads, asking, so what should I use, X86_FEATURE_IBPB or X86_FEATURE_USE_IBPB. Instead you call IBPB the synthetic one and the hardware feature name is something different like PRED_CMD or so. This will drop the confusion additionally. I hope that makes sense. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.