Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3688744pxf; Mon, 15 Mar 2021 16:13:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD4/+0ZKTc5JCtJu6wgnveBpNnxKQU3N/5MhWMYpMxqfLOgsVP4vWJ3+nAOttO/kUkfYov X-Received: by 2002:a05:6402:3493:: with SMTP id v19mr27537819edc.355.1615850015066; Mon, 15 Mar 2021 16:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615850015; cv=none; d=google.com; s=arc-20160816; b=mrabtIHh9p56ZxZ0+Tw182pp28Wj5QYyLTZ/N+bDdjl21V3BInjPH2Np+ocbD+ELv1 MYQX5S0a9yWPUXE/n3bw6OmW7imi7gU91AB4tD+4SXeUCHkd6vLVquZtMVtChiHKS0+M E6c38mVHdDA6YmQlxMhMpCq5JN5DDC7L8rJfjUOKgwp+RLtcu8u/R5kVyt86HbaVaXtU gducmypX8SIx11p+x0NYr2s5Rb02dCA89W5iDMokADfyz93n5HsHCVrnlyUrCuu8m+U5 qUoyLYoz6mC3p0o9CzJv3LL1IXMWepzJfkQg6jTtPOoN7QokHOCH+3nyAR85RyHhoirr EkVg== 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=2u7R/nEmMLjpbIw1cf7EstUt//SFRpdL2WMEtrso3hQ=; b=QzGMJGpSxWPJrOquHY8crlDPvCBRh6UnvWEeaBMcXqErFti/pLrPbclEKHrHDCtrsx SRlJIgdMIIWAM5oI9t6WGTtYXUl9V87riKMVRSjWRzDTl12+/q4g7ScBXvTqCi1ZHP36 zIiCBEY0q+2EgJGHvdFmqhQHYk/XjJSNmh+2p6EGj5kpL1meWBL5zWY7QhQZ2ilTGU0y 1J9vGnlYO2FmXtqwSt5mRe/zOxMswbTLg9JApbK2npA3iYSoyA/vFw2bQe5jWd5E+Puz HBl1TyWQU0Et5FVstxliF8Fz0XDj8n9ZU5KXe2HO7YeM9mI1bAXIKJPQpK34AnUaPrVG VKvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=AfinbzWr; 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 l33si13888043ede.161.2021.03.15.16.13.12; Mon, 15 Mar 2021 16:13:35 -0700 (PDT) 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=AfinbzWr; 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 S231201AbhCOSK3 (ORCPT + 99 others); Mon, 15 Mar 2021 14:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbhCOSKS (ORCPT ); Mon, 15 Mar 2021 14:10:18 -0400 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 C48F7C06174A; Mon, 15 Mar 2021 11:10:17 -0700 (PDT) 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=2u7R/nEmMLjpbIw1cf7EstUt//SFRpdL2WMEtrso3hQ=; b=AfinbzWr9Gp7wDjUuemJcOVQkZ pmr42l1b5SwV4cZXn6dBxVxH1cqhunwgnGOv74lXIcW8xKJN7GQP9tmWIPwktR7PPN9CfjH7JDIOr LwJWpNCjS9GeoVgfUYfh8bMqgeh+VokvAyjcFRKuthQu39ZozkTiBH2m7boq6sWJXwVmRXw8YoDIF lOv0K/neQrREfoa498UA877YYM86NVeN2QCo8p/Hh3juN1Br0naDTpsmOw0r8BE9gisLcUQiDYJU1 69HU8BNICzjnWkByI9+XcqiN6Fbn9HGzpfOYfAloLAFRfz0G1h3cUuTrcrcSizI3NHV2+pK1pbLNH AzHQ9oag==; 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 1lLrfK-00GeJZ-NU; Mon, 15 Mar 2021 18:10:07 +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 DACDB301324; Mon, 15 Mar 2021 19:10:05 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CDBFE2BF450C1; Mon, 15 Mar 2021 19:10:05 +0100 (CET) Date: Mon, 15 Mar 2021 19:10:05 +0100 From: Peter Zijlstra To: Sedat Dilek Cc: Borislav Petkov , x86@kernel.org, rostedt@goodmis.org, hpa@zytor.com, torvalds@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org, jpoimboe@redhat.com, alexei.starovoitov@gmail.com, mhiramat@kernel.org Subject: Re: [PATCH 0/2] x86: Remove ideal_nops[] Message-ID: References: <20210313084923.GA16144@zn.tnic> <20210313121541.GC16144@zn.tnic> <20210313124919.GD16144@zn.tnic> <20210313132927.GF16144@zn.tnic> 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 Mon, Mar 15, 2021 at 06:04:41PM +0100, Sedat Dilek wrote: > make V=1 -j4 LLVM=1 LLVM_IAS=1 So for giggles I checked, neither GCC nor LLVM seem to emit prefix NOPs when building with -march=sandybridge, they always use MOPL. Furthermore, the kernel explicitly sets: -falign-jumps=1 -falign-loops=1, which, when not specified, default to 16 or so. This means that your userspace is *littered* with NOPL, even when you build your entire distro from source with -march=sandybridge. (arch/gentoo FTW I suppose). (The only good new is that recent LLVM has a pass to use alternative instruction encoding in order to grow a basic block in size in order to minimize the amount of NOP it needs to emit at the end in order to satisfy the jump/loop alignment.) So if you *really* deeply care about NOP performance on your SNB, start by teaching LLVM about prefix NOPs and rebuild your complete userspace. At that point, you can do some trivial patches to the kernel to make it use -march=sandybridge and prefix NOPs too. Until that time, the vast majority of NOPs your CPU will execute will be NOPL.