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=-3.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT 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 0B499C282D7 for ; Wed, 30 Jan 2019 19:51:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4DB620989 for ; Wed, 30 Jan 2019 19:51:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sYEvj8Jb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733266AbfA3TvV (ORCPT ); Wed, 30 Jan 2019 14:51:21 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45642 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729372AbfA3TvS (ORCPT ); Wed, 30 Jan 2019 14:51:18 -0500 Received: by mail-pf1-f193.google.com with SMTP id g62so288047pfd.12 for ; Wed, 30 Jan 2019 11:51:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BmZs8KdIevNhKkK5VR6ljTeKMJ+U51JMl3E7Mr6ZyPE=; b=sYEvj8Jb28W14zmjFEQ8eL1BzAVjeeTykqg2EhzLrkwWqY3WStIsxLrxOne7G5upMe G6O6n/QvhWsZzzm1WFhZRois651hmBg7DHFFkBVdTuo/9QyySGijBmpABBQkrl2zsNWr /BQoiNZYFCIZnVbYRMTFcWSnQ2PDbXLXvNgRgImmM6FRIZ0UJAPJFo4puDASxda8tJpT nt9OPsX7BPrun3w8nQDImPbJRxyVo+rp0T38yvdhhkppEtVN6fNm/PQHzg9ruXvQ8B2/ gdqKIZMyH3zlYy632edAMxFMMTVPSZ3Gr3HTCC0ALgRuYWkjpCLWF3iaw1y2V/01XvE7 Gmnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BmZs8KdIevNhKkK5VR6ljTeKMJ+U51JMl3E7Mr6ZyPE=; b=iHCCe1nig2pNBfuGef6rcPLYSxS8kou1fG/w/SoOLCRn30vrFVNprMtG3q0Troh8Nx qYS7DFd46bYjKOBi7plH9U3tDmPfb0OHAGetaP8/QVKbjHz4MD64Ox3d5R9lX1GUpuJE 2sXED6t4oRXtM7NaXIdLNN6l2aSsLijsvDbR8kudLVNheQ2//2zsE1hFNU/NmRHrlcfe t+tW2/J3P41+1uYFdoS5MPkUkI89Ja8KWTb8qLieNpZyRFIUVVpHsxeJwQ+pjgSFxBQb UPu6blICHRWaR9nbuovyif30le+CvBdGSkoq8+2k4ps3hVCHBPpynIK1tj/fUzwwHk/H W0yg== X-Gm-Message-State: AJcUukedsrsa3DhQJyc0HKewUHDNRT+s8iKhIjX48eHsMpsxzTasNd8U NsSiAr2DiVJCvqX0F7VbfO4= X-Google-Smtp-Source: ALg8bN6C3NSpSw36xAjjSoBIM/yScDdcZDfOD7Ka1z91oqj7fH0ib9QbEvHroVp5Lpzzai0kZjI+dQ== X-Received: by 2002:a62:33c1:: with SMTP id z184mr31621542pfz.104.1548877877395; Wed, 30 Jan 2019 11:51:17 -0800 (PST) Received: from ast-mbp.dhcp.thefacebook.com ([2620:10d:c090:180::1:9e50]) by smtp.gmail.com with ESMTPSA id j9sm3058046pfi.86.2019.01.30.11.51.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 11:51:16 -0800 (PST) Date: Wed, 30 Jan 2019 11:51:14 -0800 From: Alexei Starovoitov To: "Paul E. McKenney" Cc: Will Deacon , Peter Zijlstra , Alexei Starovoitov , davem@davemloft.net, daniel@iogearbox.net, jakub.kicinski@netronome.com, netdev@vger.kernel.org, kernel-team@fb.com, mingo@redhat.com, jannh@google.com Subject: Re: bpf memory model. Was: [PATCH v4 bpf-next 1/9] bpf: introduce bpf_spin_lock Message-ID: <20190130195113.xyqre4sxasit6vpu@ast-mbp.dhcp.thefacebook.com> 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> <20190125102312.GC4500@hirez.programming.kicks-ass.net> <20190126001725.roqqfrpysyljqiqx@ast-mbp.dhcp.thefacebook.com> <20190128092408.GD28467@hirez.programming.kicks-ass.net> <20190128215623.6eqskzhklydhympa@ast-mbp> <20190130181100.GA18558@fuggles.cambridge.arm.com> <20190130183618.GX4240@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130183618.GX4240@linux.ibm.com> User-Agent: NeoMutt/20180223 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jan 30, 2019 at 10:36:18AM -0800, Paul E. McKenney wrote: > On Wed, Jan 30, 2019 at 06:11:00PM +0000, Will Deacon wrote: > > Hi Alexei, > > > > On Mon, Jan 28, 2019 at 01:56:24PM -0800, Alexei Starovoitov wrote: > > > On Mon, Jan 28, 2019 at 10:24:08AM +0100, Peter Zijlstra wrote: > > > > On Fri, Jan 25, 2019 at 04:17:26PM -0800, Alexei Starovoitov wrote: > > > > > What I want to avoid is to define the whole execution ordering model upfront. > > > > > We cannot say that BPF ISA is weakly ordered like alpha. > > > > > Most of the bpf progs are written and running on x86. We shouldn't > > > > > twist bpf developer's arm by artificially relaxing memory model. > > > > > BPF memory model is equal to memory model of underlying architecture. > > > > > What we can do is to make it bpf progs a bit more portable with > > > > > smp_rmb instructions, but we must not force weak execution on the developer. > > > > > > > > Well, I agree with only introducing bits you actually need, and my > > > > smp_rmb() example might have been poorly chosen, smp_load_acquire() / > > > > smp_store_release() might have been a far more useful example. > > > > > > > > But I disagree with the last part; we have to pick a model now; > > > > otherwise you'll pain yourself into a corner. > > > > > > > > Also; Alpha isn't very relevant these days; however ARM64 does seem to > > > > be gaining a lot of attention and that is very much a weak architecture. > > > > Adding strongly ordered assumptions to BPF now, will penalize them in > > > > the long run. > > > > > > arm64 is gaining attention just like riscV is gaining it too. > > > BPF jit for arm64 is very solid, while BPF jit for riscV is being worked on. > > > BPF is not picking sides in CPU HW and ISA battles. > > > > It's not about picking a side, it's about providing an abstraction of the > > various CPU architectures out there so that the programmer doesn't need to > > worry about where their program may run. Hell, even if you just said "eBPF > > follows x86 semantics" that would be better than saying nothing (and then we > > could have a discussion about whether x86 semantics are really what you > > want). > > To reinforce this point, the Linux-kernel memory model (tools/memory-model) > is that abstraction for the Linux kernel. Why not just use that for BPF? I already answered this earlier in the thread. tldr: not going to sacrifice performance.