Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1108088ybf; Fri, 28 Feb 2020 14:20:49 -0800 (PST) X-Google-Smtp-Source: APXvYqzD+/rlfK7FHHtoWgUAPxKdSi35ueTxSycuU5kaxuLp9sfk38/1q21vAk0vWS6dLBp6rP+O X-Received: by 2002:aca:5a04:: with SMTP id o4mr4674497oib.71.1582928449325; Fri, 28 Feb 2020 14:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582928449; cv=none; d=google.com; s=arc-20160816; b=wZ7L0IATDzVc8F4c0KOt0MoQuUCSNCMopc/hZ8GNZTogyPuhFS3UaR8jaFyvICmv6Y GZ/4jskw0ih5r5df7n80SlcmU8GO7GRT/ArF4kYbqKhRgyeF4fiwV4DcLx7sF22CrwCV DSCqQcXqOTbttuM3SMgs/jdrZLiY2YDmUY0NrBw8HjuHaSo/2aC3BMEwsFehZ1v3Ex80 fJm8w9UQV0HKTRkEMNzdPghi/h6Vt+a/z4kev54KttGizlCrwBg5u25p6puZUJMlAARZ +bFghDutbafcqCTrBTxq5Aaj8B9RzuNBuq14X/m2AVWqvZx3NmF8xvUhuW6L6dZHwaml Qrdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oupcBBMzkVkZ/IoOMguzUGYed0hV634MFJNr2ddg34I=; b=ZVHLN1O/bwSWHbS5jQfZQW0uft3j/LYjIoVcBoDJ3YdfTw44bSM9IePnMffoz51/xY 2OmbK7J7SBqnGkG9q0wfhiU0bSj9T+4EdR2qBkxWEPBZrxDoU5JNZO4BUx2IR+3ohURs SDZ9FCQr+LV5wQxYXKzE0HiCa4ToZEojlNVyY4QojvTtCpI4681sHGRixuzaguqCfIy2 CNe4lSobaQYguagkwwXC2aCBTWxgg3mwYqcON8I1C1Dn+FOnjHkPii8qATBZ3gOwwFTq hn0bSnvWmbRc8OkrCFvJDVnNMbeNR+ZZDS5SUfJmuc3YoZnZeeeh9++QntZBlYbYCNRD l+Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cs.washington.edu header.s=goo201206 header.b=ZepahZwI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cs.washington.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d26si2173247otc.6.2020.02.28.14.20.37; Fri, 28 Feb 2020 14:20:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cs.washington.edu header.s=goo201206 header.b=ZepahZwI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cs.washington.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgB1WUX (ORCPT + 99 others); Fri, 28 Feb 2020 17:20:23 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:42287 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726562AbgB1WUX (ORCPT ); Fri, 28 Feb 2020 17:20:23 -0500 Received: by mail-io1-f67.google.com with SMTP id z1so5186317iom.9 for ; Fri, 28 Feb 2020 14:20:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=oupcBBMzkVkZ/IoOMguzUGYed0hV634MFJNr2ddg34I=; b=ZepahZwIUeF3xf2pSgqJtC+C8FNfJcpunG9ymLMAOgpy/DumhVN1QFSRYjquUNkYPG VWiL/PQPCcKK/I5We1TfbQpN9B4IX1fTqUWAljn7CWQefOiGcSUpRct4y/FkjGsHtGoW B2OkpiVEi4Z69fyjPREGb2YNKfDXZePcAtPy0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=oupcBBMzkVkZ/IoOMguzUGYed0hV634MFJNr2ddg34I=; b=As3+cMk7kTOfmd2dZbk5ET4gx+h5of/RjngIuobBTryfzRnpggQx0a2jMmSCjFZa3i 1cDHmBqDipxvfifIu/TTAHscz2CThRTPUrBeCLMnKOpo0nD/Sv+uE/XiTZS5Cbalf3w8 3t1Gw/QZHmhkBSGUCih3KyKllFk3CYnuvtGlNTq7xQ2+XQL3lyH3MopDA5GBfcRtsIFq D/K+zozcR6uUHg8scZbY4M6Z1ok4dVXhDvnvui7BXBNGoINmOQSiv4xTqd6dWfyCyTtr IEtDspZCGSH+10vkmTSjaX2Y/1SkUWh8pKwNZ184nirZrkVvWa8F+pb1D2tiupj7ESZ/ E6JQ== X-Gm-Message-State: APjAAAWT2MRUfMfXaLV2W43FoFdfgsUk3jy31NT2hU7eYsnknfab5CqF S8Rel/ChLeRWJMzEPX4ek2BLagQI5xiYMcJsNZq9cQ== X-Received: by 2002:a6b:fb02:: with SMTP id h2mr5156666iog.126.1582928422602; Fri, 28 Feb 2020 14:20:22 -0800 (PST) MIME-Version: 1.0 References: <20200220041608.30289-1-lukenels@cs.washington.edu> In-Reply-To: From: Luke Nelson Date: Fri, 28 Feb 2020 14:20:11 -0800 Message-ID: Subject: Re: [PATCH v3 bpf-next] RV32G eBPF JIT To: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Cc: bpf , Jiong Wang , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , linux-riscv@lists.infradead.org, LKML , Netdev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 28, 2020 at 6:25 AM Bj=C3=B6rn T=C3=B6pel wrote: > > Luke/Xi, apologies for the slow reponse. (All my RV work is done on > non-payed time, so that's that. :-)) Very nice that you're still > working on it! No worries, thanks for reviewing! > > > > - ALU64 DIV/MOD: Requires loops to implement on 32-bit hardware. > > Even though it requires loops, JIT support would be nice. OTOH, arm > doesn't support that either... We could probably implement this by calling into a helper function for BPF_ALU64 | BPF_DIV/BPF_MOD, but none of the other JITs (e.g., arm,x86) for 32-bit architectures do this. We could add support to rv32 and other architectures in a future patch. > > - BPF_XADD | BPF_DW: Requires either an 8-byte atomic instruction > > in the target (which doesn't exist in RV32), or acqusition of > > locks in generated code. > > > > Any ideas how this could be addressed for RV32G? I don't believe there is a simple way to correctly implement BPF_XADD | BPF_DW without hardware support for 64-bit atomic operations, like for other 32-bit JITs. > In general I agree with Song; It would be good if the 64/32 bit > variants would share more code. RISC-V 64/32 *are* very similar, and > we should be able to benefit from that codewise. > > Pull out all functions are that common -- most of the emit_*, the > parts of the registers, the branch relaxation, and context > structs. Hopefully, the acutal RV32/64 specfic parts will be pretty > small. Thanks for the suggestion. I'll factor out the common functionality into a header for the next revision. > Finally; There are some checkpatch issues: run 'checkpatch.pl --strict'. > [...] I'll fix the rest of the issues you found in the next revision. > Thanks for the hard work! I'll take it for a spin, with help from the > guide above, this weekend! Thanks again! - Luke