Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1187713pxf; Fri, 12 Mar 2021 04:11:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyOmO+GBNe17F6XSby1AM7beLl8+RJwRO4lltP1PkgsytXAT/rJHj23dNUdllNrmO3Eyo6 X-Received: by 2002:a17:907:c16:: with SMTP id ga22mr8228911ejc.120.1615551078267; Fri, 12 Mar 2021 04:11:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615551078; cv=none; d=google.com; s=arc-20160816; b=toQMofQeY23x3RtGBzc6f26G4+nFa7ECfu8TmDCe2pz06jv+bD+6HAQ8HFgbSJKzjG L51ckFAbkKl8A84eGSQsRCjop5Vxm7h9BV6HFJnhog/Uci5y4l/1AE3LFDqa/s1drspB zh+8eppQWSOK+JPn5E/EsMQh16pvUUpfF/YFR/BzcjSk6wukoRKB9LDjptPaIslpfZZp uZhvinLRWxrrXPRSHQZXOmFXNTdqLhLqXTxEyNwUTwkR3KJjRci/50lTGexMO1vndb8i iJiTsuqJTPz4dsTzJYmgASEW0rWGkbv/nKaTwDyozx8nVcAsXnCBVUVDraXwaBs7qhLK CfoA== 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=7CDKLNvPOs6luVR4r1nFvdWWOhad35qKWOWXJYwAjrs=; b=kgco/qWZhGGOiXqNWVgYgYI3Lq6aQsS1FcHX1LIyolAXyKGnkxUm9awHCet257ie/4 sYk2fyoQmqKIxMNb+2sGSND87QIv7OlZqQGGNG1AEAvY9r0LZ0ryUnrQkmQP//bnVmTK KO84reDWg2TbO39LgcXpkThsDs406mUiwDzTwkEakd3McxctevTHA1nxh5uZrx87TlqB X3DFEvExBm6sso1zj24apZ5Sv2hp8jLTIGDNf9IUtSWDb4sgrefv6OHn5FkY+oEpI0hp /lMGlfnVCkFhoYYVDP+YthC7s++vvmoPhAsJGF5+hewPOOJE5JfgeUtcoGzQwkbNbN/9 iNfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=G7c7cV5Q; 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 l13si3825272edn.284.2021.03.12.04.10.54; Fri, 12 Mar 2021 04:11:18 -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=desiato.20200630 header.b=G7c7cV5Q; 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 S229913AbhCLMJ6 (ORCPT + 99 others); Fri, 12 Mar 2021 07:09:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbhCLMJ0 (ORCPT ); Fri, 12 Mar 2021 07:09:26 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE37AC061574; Fri, 12 Mar 2021 04:09:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=7CDKLNvPOs6luVR4r1nFvdWWOhad35qKWOWXJYwAjrs=; b=G7c7cV5QhrCIxV+Psz7/BVBh1R wwsWytq7TVvI4jUBoYLY8snOPRvTCP2kRbdE0/ALasWXxegCkqaMpDBYk7yvCHszVrm1+97HA4uU8 jlwyU3HEa6kXhFDHk0zDdaXhgOzlsOiUQWRsrpU7+0hQIvJL4jmJ/23JmTNWoIgaJKLTFnwez4o2p DUieQSErD+llVgNrezI/mELZS2ftO9QSBlo+5pFBbt+4NdUJItV8APvafPzQF/obCfC1GY1j2Kveu Q8mE24wwCQxEAQ5DhMRz1T3FazQ0N716YHpx1nutxUqcr8rgvSW/ibpL7QsGToNhVd3HYFFje0xm9 W6U7JoAQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lKgbT-00BN8s-NY; Fri, 12 Mar 2021 12:09:18 +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 60861300238; Fri, 12 Mar 2021 13:09:15 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4E8992DA8633B; Fri, 12 Mar 2021 13:09:15 +0100 (CET) Date: Fri, 12 Mar 2021 13:09:15 +0100 From: Peter Zijlstra To: x86@kernel.org, rostedt@goodmis.org, hpa@zytor.com, torvalds@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org, jpoimboe@redhat.com, alexei.starovoitov@gmail.com, mhiramat@kernel.org Subject: Re: [PATCH 1/2] x86: Remove dynamic NOP selection Message-ID: References: <20210312113253.305040674@infradead.org> <20210312115749.065275711@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210312115749.065275711@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 12, 2021 at 12:32:54PM +0100, Peter Zijlstra wrote: > +#ifndef CONFIG_64BIT > + > +/* > + * Generic 32bit nops from GAS: > + * > + * 1: nop > + * 2: movl %esi,%esi > + * 3: leal 0x0(%esi),%esi > + * 4: leal 0x0(%esi,%eiz,1),%esi > + * 5: leal %ds:0x0(%esi,%eiz,1),%esi > + * 6: leal 0x0(%esi),%esi > + * 7: leal 0x0(%esi,%eiz,1),%esi > + * 8: leal %ds:0x0(%esi,%eiz,1),%esi > * > + * Except 5 and 8, which are DS prefixed 4 and 7 resp, where GAS would emit 2 > + * nop instructions. > */ > +#define BYTES_NOP1 0x90 > +#define BYTES_NOP2 0x89,0xf6 > +#define BYTES_NOP3 0x8d,0x76,0x00 > +#define BYTES_NOP4 0x8d,0x74,0x26,0x00 > +#define BYTES_NOP5 0x3e,BYTES_NOP4 > +#define BYTES_NOP6 0x8d,0xb6,0x00,0x00,0x00,0x00 > +#define BYTES_NOP7 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00 > +#define BYTES_NOP8 0x3e,BYTES_NOP7 > + > +#else > > +/* > + * Generic 64bit nops from GAS: > + * > + * 1: nop > + * 2: osp nop > + * 3: nopl (%eax) > + * 4: nopl 0x00(%eax) > + * 5: nopl 0x00(%eax,%eax,1) > + * 6: osp nopl 0x00(%eax,%eax,1) > + * 7: nopl 0x00000000(%eax) > + * 8: nopl 0x00000000(%eax,%eax,1) > + */ > +#define BYTES_NOP1 0x90 > +#define BYTES_NOP2 0x66,BYTES_NOP1 > +#define BYTES_NOP3 0x0f,0x1f,0x00 > +#define BYTES_NOP4 0x0f,0x1f,0x40,0x00 > +#define BYTES_NOP5 0x0f,0x1f,0x44,0x00,0x00 > +#define BYTES_NOP6 0x66,BYTES_NOP5 > +#define BYTES_NOP7 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00 > +#define BYTES_NOP8 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00 > > +#endif /* CONFIG_64BIT */ Note that this also made all NOPs single instructions and removed the special atomic nop.