Received: by 10.223.176.5 with SMTP id f5csp377349wra; Sat, 27 Jan 2018 01:39:28 -0800 (PST) X-Google-Smtp-Source: AH8x225gCBai5JY3Q/omHza/Mg1//5/OMLGoLLKnQlMoeUHDYXsj5JTP3/TM3jcwHy+48qkxdu7+ X-Received: by 2002:a17:902:5309:: with SMTP id b9-v6mr7301962pli.152.1517045967935; Sat, 27 Jan 2018 01:39:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517045967; cv=none; d=google.com; s=arc-20160816; b=nqtgKGZIoZ2uBnl3j4E8wvs05M3/njJ9FlfQeDL8kmh0yEtZKJDhEtGgngYVjSAHwv 0NPf8MqFULqNdy1Q87kSazJDh/wWtbefsh7ETP92ReLQiHOznuVkn/guyHPJVK04fhmQ fIsBEEo60VQLeDuodU2wAxWwfYUBtylgMVFHQW3Z7Ru3NP7UZQ/lW4RKPEpwVNkIVi9K kC7ixPLctbDqgQ6S2MCbGxAQ2buid6CFwrjCV3p/9d39y/b2v9UdJW1TtQpP5hxguyZn ATFp+uJMtW2z84koXLJvAOnHwPCsA0WA7df51Ywc1DXiXOUjfQ9dhDcmIYqfTDa0onzJ dfsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=u0Di+/3934c42XQa/Naz00kyP1gxPzxbrWxqNDgR5vmBrEYLe/fRnC1NaDgltoS/vc piMNqN7KFLipYHkvE5bv7f2EefcP4dFQISIV8seUvcKvGIsYj0CmyiEUASJHPRuHCRq0 HJf26dYWa26M16iauwsLG2lj9DCeTdcVQhWc0XjuSChDfeU0fF4w5RE4lW2wd6hZZlnf NgCluD53idYGRJSYCaYttoUV75agr3SrvrcQM9ifMPOzjNTXWupRrV2OX5p9yJm48T+/ 9mCQC6upUdS6Ht+Snr6jl7ed57BvKSivHtSMODnKiVnuSn9ItX9xFJIQIjGtTfuVwzha 6cow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si593092plq.120.2018.01.27.01.39.13; Sat, 27 Jan 2018 01:39:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbeA0Jhk (ORCPT + 99 others); Sat, 27 Jan 2018 04:37:40 -0500 Received: from mail.skyhub.de ([5.9.137.197]:41092 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752449AbeA0Jhg (ORCPT ); Sat, 27 Jan 2018 04:37:36 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qN-mUv78kjom; Sat, 27 Jan 2018 10:37:34 +0100 (CET) Received: from pd.tnic (p200300EC2BE03F0018898899508E3FC1.dip0.t-ipconnect.de [IPv6:2003:ec:2be0:3f00:1889:8899:508e:3fc1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 9586A1EC03B9; Sat, 27 Jan 2018 10:37:34 +0100 (CET) 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.