From patchwork Thu Apr 4 11:42:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13617609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8147ACD1284 for ; Thu, 4 Apr 2024 11:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=ddYPOCkHgImJ1CCHmFB/aH7U8ZG9dRYiOYSSbt2e1vk=; b=iPNruq01bf5wuV Qbai0WTqk0daBJVG116lsp8gdF9Nob8iFofmmlSnYpwq0fWEs+b24/HVTe/8OrUh/Soy1Pyv2NV4i OPVlDA0wcXMI2FV//GYJwtjNGWtXUBus6Q2VLLNwC7nq77c4d8UQC/p8FP7UOdrwu/VV1Jyqai+iw 4g7XVTNSIe03WM5bK7NNmW5xE01KvPx/Q+zboR1qQkXwJoXN0xXH/eqgSJEhXRw0OUTpMQuvwz9wF MvYjAbH7FANvqEQuesh+UnAhXzMdMqM1XYPbYg38GJOo++ozUvA9XAzYRFcuJAXKb0iND1ST7CSTc uDNLSchiSKRPSr6sPCKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsLUP-00000002PAh-3O7R; Thu, 04 Apr 2024 11:42:41 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsLUL-00000002P7h-3yF1 for linux-riscv@lists.infradead.org; Thu, 04 Apr 2024 11:42:40 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4162b74f2a1so2351805e9.3 for ; Thu, 04 Apr 2024 04:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712230954; x=1712835754; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=V/9UaWH58JbSSliu9hWrazNjsMfAiTpooxWMtLVHRkQ=; b=WTzRCIVWeNCQgmdSuxTVTc+qvh0P0HQhxMHwJN0KvwkkH7K1Rc3SQg5/fxj82eBQZY 0gVxajWz0r5oKG5BlyI6uhksJGcAZ+75y+2gPIhWLDz8mtZ0dHLhzAILIC5hbF9GV8S/ jV5RcGoUIv3uQ0UwWF+O7wnfJviqmTYKdmD9owCbf/Xv5cF8HwG3+nQr2S9ziN/XkUvx XvnkZa8hHtQ9aUTSVyslXym93oiIyXwYU8p3eb5zPmjPqZoHxhtvMNyBeFFMzNBl0ZMV TiH9SZ2SP4OR9Ehi0JoGMX0aR1dBokUqFEwOxjSRcCzJ8e7WXPRBjxzysdNxUE8apEnM eNWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712230954; x=1712835754; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V/9UaWH58JbSSliu9hWrazNjsMfAiTpooxWMtLVHRkQ=; b=Icc8C29inrhloceMWTlJwGN5EvQxGMqXli3EFtCZLqRRdhwhEmG8S96rZpnKUTJ5Nd /Q6egqz0QuuZeu3ESUuA9xbYH+S7gmBlE64XRZpmPTRoN2YI7MUsBM0k++VKfR25U2kR xz9RhXX+oaaf+Hk181SJoQOAPRM2UaImVKfUSdOZKI93VxSYX5bIAm3UxGo6Ed21psUB oSYqQGwsIlp1UB/hsIwQsp0haeYmcbbTZ5SuzdSkwaPQ8ma49HEs+Yl+aFdE2ZiiK2zH is/kYpR+2A62ZeePJHUeFbPCrJ+iTyrGvkD9J2qgRYzRm4c1IVyU6Bsaw1PFUw1heUHY FmCA== X-Forwarded-Encrypted: i=1; AJvYcCUZLMrZmwRIe2HVAsv5NDrHYFqZ+nYfbEL7nZZ/O0YigeNz9FI98gN4e4JCJl78byuoldhLb56JqKSy5mF1h7XjXGRU3d8gsN+fu2yYcvVx X-Gm-Message-State: AOJu0YxGkx72sJjME/jAONFwdsZTXMkRTheJ16RzqHvQuC9D81424Mxw a2F61s/QPp9SHtRSBokfPZodAk4oEo2V6zEVN9XfFvGEPqYj0sZ8 X-Google-Smtp-Source: AGHT+IH4vjW4HOFwL0nxbzJW32/tQIfeK4E02sLbTVajHqefX6+EkRKk3hQ3JvJK5+Y61Zy5YxGxEg== X-Received: by 2002:a05:600c:310b:b0:416:2485:e6ce with SMTP id g11-20020a05600c310b00b004162485e6cemr1984611wmo.22.1712230953991; Thu, 04 Apr 2024 04:42:33 -0700 (PDT) Received: from localhost (54-240-197-231.amazon.com. [54.240.197.231]) by smtp.gmail.com with ESMTPSA id v9-20020a05600c470900b0041568e91c41sm2411599wmo.41.2024.04.04.04.42.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2024 04:42:33 -0700 (PDT) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , bpf@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Pu Lehui Cc: puranjay12@gmail.com Subject: [PATCH bpf-next v4 0/2] bpf,riscv: Add support for BPF Arena Date: Thu, 4 Apr 2024 11:42:01 +0000 Message-Id: <20240404114203.105970-1-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_044238_248779_4E3AB3C7 X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Changes in V4: V3: https://lore.kernel.org/all/20240326224943.86912-1-puranjay12@gmail.com/ - Fix some style issues. - Add Tested-by: and Reviewed-by: tags by Pu Lehui and Björn Changes in V3 V2: https://lore.kernel.org/bpf/20240325155434.65589-1-puranjay12@gmail.com/ - Use REG_DONT_CLEAR_MARKER in place of DONT_CLEAR as the name. - Use RV_REG_ZERO for the above as it is guaranteed to be never used in as dst/src register in BPF LDX/STX/ST instructions. - Use #define RV_REG_ARENA for RV_REG_S7 Changes in V2 V1: https://lore.kernel.org/bpf/20240323154652.54572-1-puranjay12@gmail.com/ - Used S7 in place of S11 for storing the kernel_vm_start - Used 17 in place of 16 for DONT_CLEAR marker - Remove an unused variable - Removed some misleading information from the commit message. This series adds the support for PROBE_MEM32 and bpf_addr_space_cast instructions to the RISCV BPF JIT. These two instructions allow the enablement of BPF Arena. All arena related selftests are passing: root@rv-tester:~/bpf# uname -p riscv64 root@rv-tester:~/bpf# ./test_progs -a "*arena*" #3/1 arena_htab/arena_htab_llvm:OK #3/2 arena_htab/arena_htab_asm:OK #3 arena_htab:OK #4/1 arena_list/arena_list_1:OK #4/2 arena_list/arena_list_1000:OK #4 arena_list:OK #434/1 verifier_arena/basic_alloc1:OK #434/2 verifier_arena/basic_alloc2:OK #434/3 verifier_arena/basic_alloc3:OK #434/4 verifier_arena/iter_maps1:OK #434/5 verifier_arena/iter_maps2:OK #434/6 verifier_arena/iter_maps3:OK #434 verifier_arena:OK Summary: 3/10 PASSED, 0 SKIPPED, 0 FAILED Puranjay Mohan (2): bpf,riscv: Implement PROBE_MEM32 pseudo instructions bpf,riscv: Implement bpf_addr_space_cast instruction arch/riscv/net/bpf_jit.h | 2 + arch/riscv/net/bpf_jit_comp64.c | 203 +++++++++++++++++++++++++++++++- arch/riscv/net/bpf_jit_core.c | 2 + 3 files changed, 205 insertions(+), 2 deletions(-)