From patchwork Sun Feb 3 11:51:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= X-Patchwork-Id: 10794625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F1951390 for ; Sun, 3 Feb 2019 11:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61D3F2ABD7 for ; Sun, 3 Feb 2019 11:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50C642BF85; Sun, 3 Feb 2019 11:52:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA6232ABD7 for ; Sun, 3 Feb 2019 11:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=a4mCDyDCIapR43fM1SaJD01fm9FEqRk0Z+fce0oZ+HU=; b=H/WSW1P6HFL5rN KDgzlEA/dhql678to+38FsVdpfZ4DI1ruH0BKoToMjSQmQyspqylM6R1z5ZazyqtgiWZt6A7XZ3+B hhKAHZDfQQaiIJPnogM/hD78C/kBNITyQP5hImFrrwswc/fgvYkUGHCvi9mCmUkdeRD4KeJTIvh23 0Jo+M3QB47GlLuaoYglY37XPGxObA4+yCPYGIQU93l6oNaGO62nfPAzhRzWpQZvg51oEhbxvRngAl z+hRHVDBMKI4cdLS/ZkAvNpezWaH4c+TXH9t5Gfl3FqYyg/VtOGG+v9wv8uKxZnnZ34PcEX6YRC9r O9JLEd4bP/ZiSOtILGxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gqGKJ-0007li-VY; Sun, 03 Feb 2019 11:52:43 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gqGKF-0007kz-Or for linux-riscv@lists.infradead.org; Sun, 03 Feb 2019 11:52:41 +0000 Received: by mail-ed1-x543.google.com with SMTP id g22so8991937edr.7 for ; Sun, 03 Feb 2019 03:52:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mYxMbHIquM6UE8/rcw8KlfN7w2I5ecQu1rL8ri42f8Y=; b=k0doAk9bvEXjTy0LU7qd91j6uKmhSastdKyokfRZ3tv6Iht8GG5EgQuMYKNh14Ov/a g+kYyQdR4nkQ5ALgGUxW4UmCsu97iujVUtJhUQWH8yXAO9HAG7QOph/BTTcjkiPMVkBd fTUl3hUG1HuU+nft2QKKfQyahYqVy9e1lTRHnnmDGBUqwHoT2pyBP2FpOaN5TNTVT7r4 hr4NY37tejLUuCLZ68gMAAIIrc/kUqGYN+P2PhghVu/E3dRyuQqPAhjTiT0InyjKWrW7 B7U4y6jj9RlbkdUwTih6iKWorkVkQkmstJWei5cWdgpyRjqawj+8B+4WPsYzOiqRpafz 5O0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mYxMbHIquM6UE8/rcw8KlfN7w2I5ecQu1rL8ri42f8Y=; b=KyPaz9S3iJ2CiXmh19h51DMlaKal17Teg1+syuO4vRoMcTuC18wGdKDU88cGkV6Snq J0j23bPrR7SgRkZWt+MGZb6jdebRpN7Fi/PcFddQv54eQ8lyrEjz7HVMkYBS6Y9Xwb4A OQ4SWAqdB84m9+Qx/+/PpGV4gAbUAeD7ejf5qTJFXThHa1GHnkCOWZ1Rp3T84oyXADZ9 b6AHZEUFSfFJ58eGztGOrBWFtKG/yfLqXBDXdxeDpGLCcldn73lv2b24AAUIFUc/pPld oYRGp7lppN9ay359lioZKz9tQ3Fm7ZfJfRY3hTE+0IEjdkU7qj6WDHRk39QTmFNqYtIk MZaw== X-Gm-Message-State: AJcUukdZV9CqHTOYHi7jSjsE77+x99BT/SCAZqoA2WazFx39GzV3MfAE SDxYj22bSK5LI5zvVt84HHX/whWjCf4x+g== X-Google-Smtp-Source: ALg8bN66oNGItKp9jW0Oe61h/frEANmzCUMoNBlSgDXX4pQ8XtEPHIyx8jEdu0KojCYrLnpTqlNFCA== X-Received: by 2002:a50:a642:: with SMTP id d60mr47296716edc.290.1549194755396; Sun, 03 Feb 2019 03:52:35 -0800 (PST) Received: from btopel-mobl.ger.intel.com ([2001:67c:1810:f055:c82b:bcf5:1add:2ef0]) by smtp.gmail.com with ESMTPSA id l10sm2120719ejq.55.2019.02.03.03.52.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Feb 2019 03:52:34 -0800 (PST) From: bjorn.topel@gmail.com To: linux-riscv@lists.infradead.org, daniel@iogearbox.net, ast@kernel.org, netdev@vger.kernel.org Subject: [PATCH bpf-next 0/3] Add RISC-V (RV64G) BPF JIT Date: Sun, 3 Feb 2019 12:51:28 +0100 Message-Id: <20190203115132.8766-1-bjorn.topel@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190203_035239_903784_6D4B569F X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hch@infradead.org, =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , palmer@sifive.com Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Björn Töpel Hi! This series adds an RV64G BPF JIT to the kernel. I've sent out a RFC for a couple of weeks ago, and think this code is feature-complete/stable enough (famous last words) for a proper patch. Unfortunately, kprobes isn't supported by RISC-V yet (Patrick Stählin sent out an RFC last year), which means that all tests involving BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_KPROBE and BPF_PROG_TYPE_RAW_TRACEPOINT will fail. Further, the implementation does not support "far branching" (>4KiB). The implementation passes all the test_bpf.ko tests: test_bpf: Summary: 378 PASSED, 0 FAILED, [366/366 JIT'ed] All the tail_call tests in the selftest/bpf/test_verifier program passes. All tests where done on QEMU emulator version 3.1.50 (v3.1.0-688-g8ae951fbc106). I'll test it on real hardware, when I get access to it. I'm routing this patch via bpf-next/netdev mailing list (after a conversation with Palmer at FOSDEM), mainly because the other JITs went that path. Thanks for all the comments! Cheers, Björn RFCv1 -> v1: * Cleaned up the Kconfig and net/Makefile. (Christoph) * Removed the entry-stub and squashed the build/config changes to be part of the JIT implementation. (Christoph) * Simplified the register tracking code. (Daniel) * Removed unused macros. (Daniel) * Added myself as maintainer and updated documentation. (Daniel) * Removed HAVE_EFFICIENT_UNALIGNED_ACCESS. (Christoph, Palmer) * Added tail-calls and cleaned up the code. Björn Töpel (3): bpf, riscv: add BPF JIT for RV64G MAINTAINERS: add RISC-V BPF JIT maintainer bpf, doc: add RISC-V to filter.txt Documentation/networking/filter.txt | 16 +- MAINTAINERS | 6 + arch/riscv/Kconfig | 1 + arch/riscv/Makefile | 2 +- arch/riscv/net/Makefile | 1 + arch/riscv/net/bpf_jit_comp.c | 1502 +++++++++++++++++++++++++++ 6 files changed, 1520 insertions(+), 8 deletions(-) create mode 100644 arch/riscv/net/Makefile create mode 100644 arch/riscv/net/bpf_jit_comp.c