From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D778C282C0 for ; Fri, 25 Jan 2019 10:23:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13E4F2184B for ; Fri, 25 Jan 2019 10:23:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="D2FrTI5T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbfAYKXi (ORCPT ); Fri, 25 Jan 2019 05:23:38 -0500 Received: from merlin.infradead.org ([205.233.59.134]:40266 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726562AbfAYKXi (ORCPT ); Fri, 25 Jan 2019 05:23:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Od7fkvsDyYaRy40Z3KppYPRQmxwUe4+0Qp+HW3Y8Zz8=; b=D2FrTI5TvX0wz/9u5++whZ4fh CFcQLL+drUpkOwu4GLrw3i59YUb8P4zaUfgJLSQ4j47QxrX4L252BoQPXN914IQqU2/NtDCe3EtA7 YVytscGkmxHIK7dEVzJ1CC8ebGFYbsf2yIEIkM4kYsgn4S3oMuqVupE30IkLPkRqKSHXqhyd9gO4W MXZST41Rxz24JYLaGnYfEfnsVu4/2GRhmum9DGfSyHQcI7LPo5l0BDufsVkWIQHRpxaRL7hOevv5t ggFTUeBNObEat3MLcVRVWLVuQro/mUaT6wHjL1hEIBf9V+PDd+y3G0yZstYo0+t5hjtZgbdXYkTGW szMOybdMA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmydm-0003pa-LU; Fri, 25 Jan 2019 10:23:14 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 70CAB201EC170; Fri, 25 Jan 2019 11:23:12 +0100 (CET) Date: Fri, 25 Jan 2019 11:23:12 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Alexei Starovoitov , davem@davemloft.net, daniel@iogearbox.net, jakub.kicinski@netronome.com, netdev@vger.kernel.org, kernel-team@fb.com, mingo@redhat.com, will.deacon@arm.com, Paul McKenney , jannh@google.com Subject: Re: [PATCH v4 bpf-next 1/9] bpf: introduce bpf_spin_lock Message-ID: <20190125102312.GC4500@hirez.programming.kicks-ass.net> References: <20190124041403.2100609-1-ast@kernel.org> <20190124041403.2100609-2-ast@kernel.org> <20190124180109.GA27771@hirez.programming.kicks-ass.net> <20190124235857.xyb5xx2ufr6x5mbt@ast-mbp.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124235857.xyb5xx2ufr6x5mbt@ast-mbp.dhcp.thefacebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Jan 24, 2019 at 03:58:59PM -0800, Alexei Starovoitov wrote: > On Thu, Jan 24, 2019 at 07:01:09PM +0100, Peter Zijlstra wrote: > > And this would again be the moment where I go pester you about the BPF > > memory model :-) > > hehe :) > How do you propose to define it in a way that it applies to all archs > and yet doesn't penalize x86 ? > "Assume minimum execution ordering model" the way kernel does > unfortunately is not usable, since bpf doesn't have a luxury > of using nice #defines that convert into nops on x86. Why not? Surely the JIT can fix it up? That is, suppose you were to have smp_rmb() as a eBPF instruction then the JIT (which knows what architecture it is targeting) can simply avoid emitting instructions for it. Similarly; could something like this not also help with the spinlock thing? Use that generic test-and-set thing for the interpreter, but provide a better implementation in the JIT?