Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp135776pxf; Wed, 10 Mar 2021 02:26:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxr7XuKK0LiSKaoBmfLKG9IdTmT5s3kHUzZYZlWaMGAHoB8J6Pmfc9UXIDI7V5P/D5O8opE X-Received: by 2002:a17:906:c099:: with SMTP id f25mr2934117ejz.141.1615372009029; Wed, 10 Mar 2021 02:26:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615372009; cv=none; d=google.com; s=arc-20160816; b=KpR9z8uQ3EG4USM+8VCnCUxq1u+nzD26hn1rG8+xeqGZMNFMKLIrwdcd5VclNGhw/4 GcihIPlI9GiAd3kAK3oJ4VUMpUwm1DZWulvQ3lHSMnROB+awdIWIWU0pDiZ7qB5n0QOP HNEFcmtQ+wuow3WTrnKGC6A9UEY7lp7ZgHudltJhYFoxXRNdvSVhwM+wpJaIT+YrzmqO DqonKLd8TXYnD+nnbOQCwXJwZl4LiiQqd9p4x2B98tv2xkcDE/gXEkTCDurhLRUO0XE4 3qknzJqWjsnDnSyEJN7Da6Ls+8HTYA83kAfCITNXU81IeO/uCdTkULCQ25iQv6Vpiz+f eCZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=c1dSdngbby5wMSRQlaNZcuWULVXSILfowsqxzDo6joU=; b=y5xmVfLSQ51sObEHP1/9gT6W3KHxDDywKLDQRcYWV/IlKEkNvLImRPrFQdDljfn1Om pFn1vPl4CMbklvKPqGW/E2wEOhOB7p3VkUVEBjWVQyVr/1Nb9gHdqXi2wPvKxuXBK06r sMhH9IaVSxZH5pxV3awzHO9rSZjiPP6wmpFLvTxtl43g5TAGRGV8BIa+KCLJJryFfBDU pMrlNNl0UEAqV3LSB54+rFqKnrn1VTNdKvm+iMOnVft51h9C0z35UY+ubl7KZkdIkzmd JThZ4WQ0hhVuQvHyowiiwbPHha7DGKuJbNxxjoTLQdlTUkFxkfybSBVzitD2VM3bw/sT YpWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TNVFzqOQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de4si10668966ejc.539.2021.03.10.02.26.27; Wed, 10 Mar 2021 02:26:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TNVFzqOQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbhCJKXU (ORCPT + 99 others); Wed, 10 Mar 2021 05:23:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbhCJKW6 (ORCPT ); Wed, 10 Mar 2021 05:22:58 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE277C06174A for ; Wed, 10 Mar 2021 02:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=c1dSdngbby5wMSRQlaNZcuWULVXSILfowsqxzDo6joU=; b=TNVFzqOQlsR2qBo7UCt3+wWpmm vTX278P9elr9j8335LznMpmwRdrwT8CjFl/ynuwTUTevpQWpRtD9zSKdEcovXMWbFa5lsQG76B/c2 kh4i11L92CBXpacl5tKDcLg0vMW2B9eI3OR0r6slEo328ttmzhW6wWKY+dLfGbU5+TeaJsrh9he5Q oqxVveOMZR08I8Z1LOdSMpgxzyNkHTrKXP7pbjOXhN6v8aymh47y9mGelXpYWYhjijzL4suQJ9nzY Z6dGmDLS5Lk3/uFYq4K3B6BSN74nslYG4ATBCepY3rK6TiW+DSrniQlyn1kQlm8yPWWKhO0Ce78ZT r2f/ITnQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lJvzN-003A8s-Gd; Wed, 10 Mar 2021 10:22:51 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DC037300455; Wed, 10 Mar 2021 11:22:48 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9A28F234E3604; Wed, 10 Mar 2021 11:22:48 +0100 (CET) Date: Wed, 10 Mar 2021 11:22:48 +0100 From: Peter Zijlstra To: hpa@zytor.com Cc: Steven Rostedt , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: The killing of ideal_nops[] Message-ID: References: <20210309120519.7c6bbb97@gandalf.local.home> <362BD2A4-016D-4F6B-8974-92C84DC0DDB4@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 11:03:10AM +0100, Peter Zijlstra wrote: > -void __init arch_init_ideal_nops(void) > -{ > - switch (boot_cpu_data.x86_vendor) { > - case X86_VENDOR_INTEL: > - /* > - * Due to a decoder implementation quirk, some > - * specific Intel CPUs actually perform better with > - * the "k8_nops" than with the SDM-recommended NOPs. > - */ > - if (boot_cpu_data.x86 == 6 && > - boot_cpu_data.x86_model >= 0x0f && > - boot_cpu_data.x86_model != 0x1c && > - boot_cpu_data.x86_model != 0x26 && > - boot_cpu_data.x86_model != 0x27 && > - boot_cpu_data.x86_model < 0x30) { > - ideal_nops = k8_nops; > - } else if (boot_cpu_has(X86_FEATURE_NOPL)) { > - ideal_nops = p6_nops; > - } else { > -#ifdef CONFIG_X86_64 > - ideal_nops = k8_nops; > -#else > - ideal_nops = intel_nops; > -#endif > - } > - break; > - > - case X86_VENDOR_HYGON: > - ideal_nops = p6_nops; > - return; > - > - case X86_VENDOR_AMD: > - if (boot_cpu_data.x86 > 0xf) { > - ideal_nops = p6_nops; > - return; > - } > - > - fallthrough; > - > - default: > -#ifdef CONFIG_X86_64 > - ideal_nops = k8_nops; > -#else > - if (boot_cpu_has(X86_FEATURE_K8)) > - ideal_nops = k8_nops; > - else if (boot_cpu_has(X86_FEATURE_K7)) > - ideal_nops = k7_nops; > - else > - ideal_nops = intel_nops; > -#endif > - } > -} After this FEATURE_NOPL is unused except for required-features for x86_64. FEATURE_K8 is only used for PTI and FEATURE_K7 is unused. AFAICT this negatively affects lots of 32bit (DONTCARE) and 32bit on 64bit CPUs (CARELESS) and early AMD (K8) which is from 2003 and almost 2 decades old by now (SHRUG). Everything x86_64 since AMD K10 (2007) was using p6_nops. And per FEATURE_NOPL being required for x86_64, all those CPUs can use p6_nops. So stop caring about NOPs, simplify things and get on with life :-)