Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932175AbeAHJ5L (ORCPT + 1 other); Mon, 8 Jan 2018 04:57:11 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:51928 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932142AbeAHJ5J (ORCPT ); Mon, 8 Jan 2018 04:57:09 -0500 Date: Mon, 8 Jan 2018 10:57:02 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Alan Cox , Linus Torvalds , Dan Williams , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Andi Kleen , Arnd Bergmann , Greg Kroah-Hartman , netdev@vger.kernel.org, Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner Subject: Re: [PATCH 06/18] x86, barrier: stop speculation for failed access_ok Message-ID: <20180108095702.GE3040@hirez.programming.kicks-ass.net> References: <20180106183859.1ad9ae37@alans-desktop> <20180106185134.dzn2en4vw2hj3p6h@ast-mbp> <20180106195551.3207f75d@alans-desktop> <20180106200912.zhzdt4qmfrojeeqe@ast-mbp> <20180106202213.23e553fb@alans-desktop> <20180106211729.cp5oet3at3hyce4o@ast-mbp> <20180106230507.3547c9a0@alans-desktop> <20180107033812.awq3vz4gdkps7tix@ast-mbp> <20180107135935.6ecfabd5@alans-desktop> <20180108025732.2mnqgqivnh5u5mfb@ast-mbp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180108025732.2mnqgqivnh5u5mfb@ast-mbp> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sun, Jan 07, 2018 at 06:57:35PM -0800, Alexei Starovoitov wrote: > On Sun, Jan 07, 2018 at 01:59:35PM +0000, Alan Cox wrote: > > lfence timing is also heavily dependent upon what work has to be done to > > retire previous live instructions. > > BPF does not normally do a lot of writing so you'd expect the cost to be low. > > right. to retire previous loads. Not sure what 'not a lot of writing' > has to do with lfence. LFENCE will wait for completion on _ALL_ prior instructions, not just loads. Stores are by far the most expensive instructions to wait for, as they only complete once their value is globally visible (on x86).