Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3738929pxu; Tue, 8 Dec 2020 22:14:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeRJRny1sK7K6YNLwh2RH2JhXFpIE2inoo+Kiymp31ABeO5jL0p1bpHAmQlfmNCScVeGKB X-Received: by 2002:a17:906:279a:: with SMTP id j26mr744239ejc.203.1607494468295; Tue, 08 Dec 2020 22:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607494468; cv=none; d=google.com; s=arc-20160816; b=PjnETT5Qy3XVITvoVEnQhVfy0OU3p2H6MW9W7Bd318BWsw0mbgLuMixxtYqta8Z96d psEMrigZVcPQiB0yBn9xPwb8tXOdvi9bWgK+uhzoSkUBv1ASNsvc8F8ya9O5gNC5U8ec 0KC/Jo2ShdLz7qZysUU91H0LD1vkgMgsHCHLKOd5VwAb/QWkkpxGULDSyKiVLwO8/hJ6 X1XT6ElW820D6ISZhy7ZFGXuWh0qTRF7qoP24WhXarG4Ylq55Ji8wXZZl2pKWbWrZElh 6PCYoE9ZMhmrKQZEbSNLvr9LFgzDv3LlJem94EAehAbrP1eky/7T2IL0j2uwQ2iRZFhH L4jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:subject :references:in-reply-to:message-id:cc:to:from:date:dkim-signature; bh=z6JGKBHPAN6pNta50XqRFUPJ38/LJ/rWm+SV+OmNwnY=; b=IixQ4le05gAKMH9PeZ3QTCyT9YLY8OnA2v6PV0496TJ8Fbzy+YoiBseQK2vK9qBWUK wSQAQ9Ob49KSijJ9olPdNrQ+v26zf3qEn0puwrV8mEzx80u46K8CTTDW8JfuipUWqt/v RPSNaAcYyQ9nmFmF+n8Y32QMbBA4XRhnkYfkDt12UUzwY3TyAaxB9o4aWhnCq344OqO3 bkOaS3ljrNouwvhBp6rdNChQwYRIc4idTGKQ/6+l0DlpZcyF0ia5/UxzEcbHpkzkw5JI U/+nhRSYGV0iYQ0xNLSG8KqktMDubLv6ducScdrpojVhWxbTLEizmve+MrfXN+esupZA Ndjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MneNY57C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si275222eja.49.2020.12.08.22.14.06; Tue, 08 Dec 2020 22:14:28 -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=@gmail.com header.s=20161025 header.b=MneNY57C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbgLIFky (ORCPT + 99 others); Wed, 9 Dec 2020 00:40:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727645AbgLIFkx (ORCPT ); Wed, 9 Dec 2020 00:40:53 -0500 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ECFCC0613CF; Tue, 8 Dec 2020 21:40:13 -0800 (PST) Received: by mail-ot1-x344.google.com with SMTP id a109so276156otc.1; Tue, 08 Dec 2020 21:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=z6JGKBHPAN6pNta50XqRFUPJ38/LJ/rWm+SV+OmNwnY=; b=MneNY57C8ATW72aGVSjho5XUG1L7xqirqc1sTdP4RN33aq8KWb9nkxKhf0FEFIvRJi OpJeMOhRRO2EFN6JgK1S4Oguxg7hJOLTTGm1uM43lVwjbla1/1XDqkQcjvtH18KTe7aM 4eDScKlxkhMVDylgFgyixbFXIIbKDePXe4y2cPnDVkt92EwOAv91dafSLMMcx8gvK1va w3Kz6fP+azVEkGiTZgWbW23ubg0SyuwWN8SnAFGXNAFOKKh7/cgyTTwHzJtJuFux0OJV FtNwBQudiCreJJbu8Gct62938yETQkvqeFzpn4zpuceE2kmCJJnl8yD+nbJmirsZ01zM 3m9w== 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:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=z6JGKBHPAN6pNta50XqRFUPJ38/LJ/rWm+SV+OmNwnY=; b=M1LEveM1PCZ0Yfj//ur3kHeUiTpc8Uq3bccBXf7r/8yGOyXcyjVPf707Pby6pVi2uw 5lPf4FfSAvvebrKcXnlt7uS2P1cZboVg82s+ojTzwBqYtoL9cLnHEQ0nIegv8qHQ3yK5 7ckH0widgOF8yeKp9PSP+audqCANqPTUYB5fnFMCf+BBD8S4BBTQ3OuZ5bspohEVAihU +SQ2aE9UUPfUSoya1MLKD+TBV3aG9JqP/R8vthxuGXdLVNWxWU/0GkPsffZVsd3hJPuq /43LV+uCGHh4WLHmPv8zEJ99/G/A4WzgJj28P856me5MlPKmvTQ0sQd1NfVWkTRlU79f UQmQ== X-Gm-Message-State: AOAM5338wkJbXQLHTgOc8K8ZX3f2iRhI0Gq7pA3S4bYTeTFXqAZ6qTtU TW8obDz5QOM+07sWmHhbh+Y= X-Received: by 2002:a05:6830:22eb:: with SMTP id t11mr487039otc.114.1607492413043; Tue, 08 Dec 2020 21:40:13 -0800 (PST) Received: from localhost ([184.21.204.5]) by smtp.gmail.com with ESMTPSA id z9sm174527otj.67.2020.12.08.21.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 21:40:12 -0800 (PST) Date: Tue, 08 Dec 2020 21:40:03 -0800 From: John Fastabend To: Brendan Jackman , John Fastabend Cc: bpf@vger.kernel.org, Alexei Starovoitov , Yonghong Song , Daniel Borkmann , KP Singh , Florent Revest , linux-kernel@vger.kernel.org, Jann Horn Message-ID: <5fd06333d11ff_50ce2082d@john-XPS-13-9370.notmuch> In-Reply-To: References: <20201207160734.2345502-1-jackmanb@google.com> <20201207160734.2345502-5-jackmanb@google.com> <5fcea525c4971_5a96208bd@john-XPS-13-9370.notmuch> Subject: Re: [PATCH bpf-next v4 04/11] bpf: Rename BPF_XADD and prepare to encode other atomics in .imm Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Brendan Jackman wrote: > Hi John, thanks a lot for the reviews! > > On Mon, Dec 07, 2020 at 01:56:53PM -0800, John Fastabend wrote: > > Brendan Jackman wrote: > > > A subsequent patch will add additional atomic operations. These new > > > operations will use the same opcode field as the existing XADD, with > > > the immediate discriminating different operations. > > > > > > In preparation, rename the instruction mode BPF_ATOMIC and start > > > calling the zero immediate BPF_ADD. > > > > > > This is possible (doesn't break existing valid BPF progs) because the > > > immediate field is currently reserved MBZ and BPF_ADD is zero. > > > > > > All uses are removed from the tree but the BPF_XADD definition is > > > kept around to avoid breaking builds for people including kernel > > > headers. > > > > > > Signed-off-by: Brendan Jackman > > > --- [...] > > > + case BPF_STX | BPF_ATOMIC | BPF_W: > > > + case BPF_STX | BPF_ATOMIC | BPF_DW: > > > + if (insn->imm != BPF_ADD) { > > > + pr_err("bpf-jit: not supported: atomic operation %02x ***\n", > > > + insn->imm); > > > + return -EINVAL; > > > + } > > > > Can we standardize the error across jits and the error return code? It seems > > odd that we use pr_err, pr_info_once, pr_err_ratelimited and then return > > ENOTSUPP, EFAULT or EINVAL. > > That would be a noble cause but I don't think it makes sense in this > patchset: they are already inconsistent, so here I've gone for intra-JIT > consistency over inter-JIT consistency. > > I think it would be more annoying, for example, if the s390 JIT returned > -EOPNOTSUPP for a bad atomic but -1 for other unsupported ops, than it > is already that the s390 JIT returns -1 where the MIPS returns -EINVAL. ok works for me thanks for the explanation.