From nobody Fri Jul 24 22:54:52 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CF69345729 for ; Wed, 22 Jul 2026 14:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728849; cv=none; b=XDnvERCF3KJwtBtvTZXhiR+DoSb1qIKyWm5+XUtORGGDMhUC2vY15vcPZdiU6ZjIGggoBXNp4OwbYcDdm47fHgV5gxFFpPmQNgWsaNiKphiBtiIL59ZMynErwwVaAZxjqMSb6wd5PUpCSDnnXigCH3nEV1eb2lwu/hVwT/8tzzA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728849; c=relaxed/simple; bh=F495hDoANVE0TNTS+OBWz3nMY99148N2vW8xj3+FBPM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ola444QvcAibDQse1k2qk3GeeLzYT0JOKPn+ZmIXguFUrLAcjKQLslXtTX9PaPGkB8BgnUTTiom3yfrskxCe+Pgg72PySwqVikpAxER/lgfg+ZLawUbyqrEHa914MzHGG9V6TRsJw5vh8oZ1eHNtIIOUkENwanhjYcIwA44JtdI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XUt/uaIn; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XUt/uaIn" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-8485b358552so76466b3a.2 for ; Wed, 22 Jul 2026 07:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784728847; x=1785333647; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AfYPTs27MYWGdTxiCTfoJlFIBIXHokfTJQCS/9/yrrY=; b=XUt/uaInwy1xCGEyrH2smh6K6myqBvCiZ4aoBmeUDtG0sCyUREX3XoDeW9Hfpn0M6z 2VNGSA/0N+58siWgKv+/pZe9ygPnw5dWHAOBaHO5KIefeM1p0xzALwsDBl0F4C8LwKtK vGnPCpqEb8SqwFDaVqLeUIS7rWKfDMUC8pJSDmsOsykPm0qvYtYFBDNffYCJFrBb4iiT CPABsHgZ+elSoBAk+eg6n8EtX4SZSZEm5+CB0f6zGg7wYIYdnTV05HmPwa9EB+eXT8wp qapH08qaW24lfqqdP+S5hkG5RC8PLnoV39xZdZVG5NY+73tgrkdq4McdZ1xnVHM2h7GT U6LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784728847; x=1785333647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AfYPTs27MYWGdTxiCTfoJlFIBIXHokfTJQCS/9/yrrY=; b=OFOF2OZj9gdnMmcTAnWgXHoajSR+0coyVnsBD5tYv77suS3B3Qy4npIVRELPXqZ/EX qN5t8U8KpaDyBw6yOa855Jr4IoEtJLu/xRnmp36pxt/QFmnY6qEaosE3pktBFwBcCpDc AjY3tHUQ1EJL9dsT2/FakGGJ8uyitvzLcrFtpgXl4xfcayKniYNKfT29Ume52p8pf1Ee HuL9aMHvW+/JgtYujz3rY6DyxogTE1MDwDoKxWlV+3px5/0wEf5sRQPm+j72owbCT/b1 QLVOMVSYKrQa9s/5gF+S0Vdg9PDbR5Qj6BXUEaRBqpNwdZMiywN+90/GEFDUjDYprwmg iXpw== X-Forwarded-Encrypted: i=1; AHgh+RrQ9SGO4PkOs+AC/8GFOkR8UfCMghu5NrBgMKMIbhI0d81tB5lFgksnHMZ5nLtyhSTh5uyw0bhHNSXOSQQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxXpL+jXdyhqNuzYatrZIg3ZUvks0yeZfzKv+VzfuR/nHwJyhIJ L2DFTcqmDhEUlzTGkzTxFadi/HoO+reBuh+Wpaf3ZNst9ETXDf/rBf6K X-Gm-Gg: AR+sD13HtxIcRAwEmbmP7YnCw11t0MITY2xDMLvNACVAqLkeP7zXwTIqeOENFEIM7xC /c603AoL7ylu/oribaUHNQEf/chLPtgXqPAot7jSw+Je7xghnoLWar5OOfjXnvxW9bjRWCZhLG6 AuGQphjMpd7mvYsaHco2/n66cAnHBbtDf5nVMbdJ07n2STwhyu1qdVtE91LFxt9X3o8n5ZoXBod tku57Xsa8MohgYFWHCngcLkOomF8x2R558wiP0bZzX/jVKIYWlLMOihTJWfB/Gx9CDCVcDaH2AS yhTQs6quzlUqdNK62HbTrKdhFrHEYhC4rHRj6OKAo7rtbuNOpwkgKkWz37K+VzVG5nZMj6COI9M 3sjCE6OI7GoS9wmYHU2TSZo2ndpZbgT9fiU0y9PDfh3oUQKG5A+B5ahHLMiHT8G1a6PoTs4hsP0 GTiQSKOfd0P3MJ7rUJuFMHbGAM70nLNNjayctRMJ5m5uCaXlU= X-Received: by 2002:a05:6a00:3a21:b0:847:8d2d:712f with SMTP id d2e1a72fcca58-84c29239a02mr24030412b3a.10.1784728846034; Wed, 22 Jul 2026 07:00:46 -0700 (PDT) Received: from computer.goose-salary.ts.net ([2a09:bac5:40b2:277d::3ef:c9]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbb8f1a8a1fsm1242281a12.26.2026.07.22.07.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 07:00:45 -0700 (PDT) From: Varun R Mallya To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, bjorn@kernel.org, pulehui@huawei.com Cc: alex@ghiti.fr, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, puranjay@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, varunrmallya@gmail.com Subject: [PATCH bpf-next v3 1/6] riscv: Use arch_stack_walk() for the kernel callchain Date: Wed, 22 Jul 2026 19:30:08 +0530 Message-ID: <20260722140015.1982158-2-varunrmallya@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722140015.1982158-1-varunrmallya@gmail.com> References: <20260722140015.1982158-1-varunrmallya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace walk_stackframe() with generic arch_stack_walk() which already wraps walk_stackframe() and is the generic mechanism used in archs like arm64 to build the kernel callchain. Also decouples perf from the internal walk_stackframe unwinder which is modified in later commits to accept a different function signature, which warranted this change. Signed-off-by: Varun R Mallya --- arch/riscv/kernel/perf_callchain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/perf_callchain.c b/arch/riscv/kernel/perf_ca= llchain.c index b465bc9eb870..93a12d53aa26 100644 --- a/arch/riscv/kernel/perf_callchain.c +++ b/arch/riscv/kernel/perf_callchain.c @@ -2,6 +2,7 @@ /* Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. */ =20 #include +#include #include =20 #include @@ -44,5 +45,5 @@ void perf_callchain_kernel(struct perf_callchain_entry_ct= x *entry, return; } =20 - walk_stackframe(NULL, regs, fill_callchain, entry); + arch_stack_walk(fill_callchain, entry, current, regs); } --=20 2.55.0 From nobody Fri Jul 24 22:54:52 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 585D325F984 for ; Wed, 22 Jul 2026 14:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728865; cv=none; b=Up2drBIjPR7Njr6er+xCzEWfRzyyLkHLjyHnroaopGHGCGnGU3Ah5KNaaddpDPXA24wA7waLNfqebimFLpZnztP5/v0o3p8Ci8PA7dPmDGduOw5S+6LzVhhsMkm+3ra27jBRqbem3nJKZKZRUGBBiMXhTySdrX0aZYsVEF97TtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728865; c=relaxed/simple; bh=jYtcECzVlp/tojihwJioNEtjJqVbrNTq7HCP/tKg8Dk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ksep6t+zJXq3+kfX6NWER/rmNNd0l+23iS8Qkx0y30HEbwi/xBwc4KgFXdfncpmevsdgT9qXiGetMvd9ui6KtijlOFkdZHzP6bsxqN2cKLVHXYkgzxr6HSUquo3UJ2vqHpIiTX9xoPs4g2zfNUhxSDpnNLZCUApTNIyasT4R4Lo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UwB1rFm2; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UwB1rFm2" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-84536ecfc5bso9393702b3a.2 for ; Wed, 22 Jul 2026 07:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784728864; x=1785333664; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kmw/vOOFxAmrHxAo+1GzxM/5GGe32N4p7+qg3hLMUYs=; b=UwB1rFm2qlD7eYioGfknMRvH3MN+ZbOLwLiqQHZM9IrVi268w9orvOuTXUZ3rmgh8a Yz9+jhI2HvYJri5HySw+8o+zcoUmra6hkXWq04uaepC7sry4EL+a4tK18xKYbxgXhxju hQI8mK5XAsRaxJko1yu4zOOWP6XrEza7iKgQWSQkZtXj1UFTlLn5UxYyENZ/+rgBF/CW Mc1TVYufqdYGGypfqIYr/K873ulMiO45NURaXe1WnsGFOn8BkRPu5RFhHBIVN2745+n7 ppnyqWJ9EtnRWsmU0u8TyyOrigaV51VVs6y3TIPzMmlKYpOmzPOUNZdpBecIYeIAgz3Z sCBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784728864; x=1785333664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=kmw/vOOFxAmrHxAo+1GzxM/5GGe32N4p7+qg3hLMUYs=; b=U9SKD/fU1pkdMaG+ogAF/mpPNwyU4dXADnk9iIRZ8LViL2gHyVf5XF+4udywqFCCDy r6DFgtcgSxwEQS8CdRXhPPsR9KzthoHwCvPd/yUTXhqg6utHaHl3zZi5xsV1EUJLepeX KkL4zNxntZfBrHHhMNQKNgU7HnLNb4sDRkPP+OlDjcnVu7CL3tqrwaHYyCxXyEom5ShL FB7bNHPmetJBr7ViSBzb0lwzgRvRthq1xLG2RT1FH/5O7ejmH4BJ2sH0rPpJHoH5g3Jc 8C3AcrP9/yA7TfgyjIWXs6IUSMesNAr091Fz6DEH/IfVR+tUmhp4KmOFH1vi8viuaApO UWZw== X-Forwarded-Encrypted: i=1; AHgh+Ro9HIPsegpjJLKYHQZlQEIozQptHis51tebDTr2lXMwxdxSAVUXF3eXH20oQQNXl8wRaGrDJdCBAe04ESM=@vger.kernel.org X-Gm-Message-State: AOJu0YxzJnSDffu6sIltMpQyxJVGtQ3sJJHzjTjKKkX28cpFNZEfV3RN 3K61kMhnoZDpoUA/C0+uO53qRBX05x5Ep/NpuCMe1j2FgYUx4oQDJbiu X-Gm-Gg: AR+sD13yNzGehJlfQcW0Kz1uB4asX6ZZ1vmuskKpUrfrTBuX6UbD1OV0ejviHUqE82q 7DgF59Il1H6uCcGZbgp5Tto+8m9BbINNI3MY47mR2WDfWEueOSGnex2idHQdrMweUSKkcynQ0L5 nfipexWUOS82DgEFP7KmgVcGvTF0RDjsPed1f6bV2AMogPN9Sz30wEWUJpe99gBAua3KVaSVJ02 NYT5asaR5swvTvsAVwGfNv5XdN/W+TmirrrHOqa/ZNWqZ6mo9vfXnzsU45gQ1RNZErjNYJLEgEg WIpvSO2p+yYIgCV69xKmapliS3O/hREFcr7AcmSZvSb/zI4hWXMQuCJ+VWOOCvxBF0Rj/2oWBNv TbIy1aaWfO8KwDotwwH+qAJshBP/wx8R1k1rFn+UiQN62Hd98qPV5XepcjdnyexIGTyxuEby6yD W9KIc4sH6fG1YiGGt4+uCK0uUEOlDnuCSOl83LlEMLHkaAUeU= X-Received: by 2002:a05:6a00:1f09:b0:845:c662:2be with SMTP id d2e1a72fcca58-84c2946f795mr22779930b3a.42.1784728856923; Wed, 22 Jul 2026 07:00:56 -0700 (PDT) Received: from computer.goose-salary.ts.net ([2a09:bac5:40b2:277d::3ef:c9]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbb8f1a8a1fsm1242281a12.26.2026.07.22.07.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 07:00:56 -0700 (PDT) From: Varun R Mallya To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, bjorn@kernel.org, pulehui@huawei.com Cc: alex@ghiti.fr, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, puranjay@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, varunrmallya@gmail.com Subject: [PATCH bpf-next v3 2/6] riscv, stacktrace: Pass sp and fp to the walk_stackframe() callback Date: Wed, 22 Jul 2026 19:30:09 +0530 Message-ID: <20260722140015.1982158-3-varunrmallya@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722140015.1982158-1-varunrmallya@gmail.com> References: <20260722140015.1982158-1-varunrmallya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend the walk_stackframe() consume callback so it receives the stack pointer and frame pointer of each frame, in addition to the pc. The extra state is needed by the BPF exceptions machinery. bpf_throw() unwinds the kernel stack looking for the BPF program that acts as the exception boundary and needs (pc, stack and frame pointers) of that frame to invoke the exception callback in its stack context. This mirrors what arm64 does, where kunwind_stack_walk() hands the full unwind state to its consume functions and arch_stack_walk() adapts the generic stack_trace_consume_fn via a small wrapper (kunwind_consume_entry_data), so that a single unwinder serves the generic stacktrace API and BPF alike. The pc-only callbacks print_trace_address() and save_wchan() simply gain ignored arguments, and arch_stack_walk() now adapts the generic stack_trace_consume_fn with a wrapper struct. In the !CONFIG_FRAME_POINTER variant there is no frame pointer to report, so pass the scan position as sp and 0 as fp. Signed-off-by: Varun R Mallya --- arch/riscv/include/asm/stacktrace.h | 5 +++- arch/riscv/kernel/stacktrace.c | 39 +++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/arch/riscv/include/asm/stacktrace.h b/arch/riscv/include/asm/s= tacktrace.h index b1495a7e06ce..fd1ff04a040e 100644 --- a/arch/riscv/include/asm/stacktrace.h +++ b/arch/riscv/include/asm/stacktrace.h @@ -11,8 +11,11 @@ struct stackframe { unsigned long ra; }; =20 +typedef bool (*walk_stackframe_fn)(void *arg, unsigned long pc, + unsigned long sp, unsigned long fp); + extern void notrace walk_stackframe(struct task_struct *task, struct pt_re= gs *regs, - bool (*fn)(void *, unsigned long), void *arg); + walk_stackframe_fn fn, void *arg); extern void dump_backtrace(struct pt_regs *regs, struct task_struct *task, const char *loglvl); =20 diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index c7555447149b..30b369dd2815 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -46,7 +46,7 @@ static inline int fp_is_valid(unsigned long fp, unsigned = long sp) } =20 void notrace walk_stackframe(struct task_struct *task, struct pt_regs *reg= s, - bool (*fn)(void *, unsigned long), void *arg) + walk_stackframe_fn fn, void *arg) { unsigned long fp, sp, pc; int graph_idx =3D 0; @@ -71,7 +71,9 @@ void notrace walk_stackframe(struct task_struct *task, st= ruct pt_regs *regs, for (;;) { struct stackframe *frame; =20 - if (unlikely(!__kernel_text_address(pc) || (level++ >=3D 0 && !fn(arg, p= c)))) + /* pc belongs to the function whose frame pointer is fp */ + if (unlikely(!__kernel_text_address(pc) || + (level++ >=3D 0 && !fn(arg, pc, sp, fp)))) break; =20 if (unlikely(!fp_is_valid(fp, sp))) @@ -91,7 +93,7 @@ void notrace walk_stackframe(struct task_struct *task, st= ruct pt_regs *regs, &frame->ra); if (pc >=3D (unsigned long)handle_exception && pc < (unsigned long)&ret_from_exception_end) { - if (unlikely(!fn(arg, pc))) + if (unlikely(!fn(arg, pc, sp, fp))) break; =20 pc =3D ((struct pt_regs *)sp)->epc; @@ -105,7 +107,7 @@ void notrace walk_stackframe(struct task_struct *task, = struct pt_regs *regs, #else /* !CONFIG_FRAME_POINTER */ =20 void notrace walk_stackframe(struct task_struct *task, - struct pt_regs *regs, bool (*fn)(void *, unsigned long), void *arg) + struct pt_regs *regs, walk_stackframe_fn fn, void *arg) { unsigned long sp, pc; unsigned long *ksp; @@ -127,7 +129,8 @@ void notrace walk_stackframe(struct task_struct *task, =20 ksp =3D (unsigned long *)sp; while (!kstack_end(ksp)) { - if (__kernel_text_address(pc) && unlikely(!fn(arg, pc))) + if (__kernel_text_address(pc) && + unlikely(!fn(arg, pc, (unsigned long)ksp, 0))) break; pc =3D READ_ONCE_NOCHECK(*ksp++); } @@ -135,7 +138,8 @@ void notrace walk_stackframe(struct task_struct *task, =20 #endif /* CONFIG_FRAME_POINTER */ =20 -static bool print_trace_address(void *arg, unsigned long pc) +static bool print_trace_address(void *arg, unsigned long pc, + unsigned long sp, unsigned long fp) { const char *loglvl =3D arg; =20 @@ -155,7 +159,8 @@ void show_stack(struct task_struct *task, unsigned long= *sp, const char *loglvl) dump_backtrace(NULL, task, loglvl); } =20 -static bool save_wchan(void *arg, unsigned long pc) +static bool save_wchan(void *arg, unsigned long pc, + unsigned long sp, unsigned long fp) { if (!in_sched_functions(pc)) { unsigned long *p =3D arg; @@ -176,10 +181,28 @@ unsigned long __get_wchan(struct task_struct *task) return pc; } =20 +struct walk_stackframe_consume_entry_data { + stack_trace_consume_fn consume_entry; + void *cookie; +}; + +static bool walk_stackframe_consume_entry(void *arg, unsigned long pc, + unsigned long sp, unsigned long fp) +{ + struct walk_stackframe_consume_entry_data *data =3D arg; + + return data->consume_entry(data->cookie, pc); +} + noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry= , void *cookie, struct task_struct *task, struct pt_regs *regs) { - walk_stackframe(task, regs, consume_entry, cookie); + struct walk_stackframe_consume_entry_data data =3D { + .consume_entry =3D consume_entry, + .cookie =3D cookie, + }; + + walk_stackframe(task, regs, walk_stackframe_consume_entry, &data); } =20 /* --=20 2.55.0 From nobody Fri Jul 24 22:54:52 2026 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4F4F32B103 for ; Wed, 22 Jul 2026 14:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728876; cv=none; b=dB76p6xVqAyjRK/q5ytEIEhqQ4UK/6KZtdtQ7nR3dNUn+3h4rW4l/oKFpztmqxKU0UT5KbJF97X8GLejL2R+FBPZbpjKF9+URbDrOwVERDfkVloekAexaNPRE4X7dOtOaDENETJ2l6ge25UTMy15vRbNptFH+j9RQgD0z1OXIxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728876; c=relaxed/simple; bh=XvVl5mjflIv3UtJ8KZ2CpGKOS7tfRL7wakHrEfbOmYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z2tXl00DINvOlBmTtfU0KfGsAwdq3m5Lfevah6wGgEoNyDT/YRqq+9EoVd8Wu7M0X7d80DRIbcYCKOVkXiGj/oVMXmatT3RJiI1ZoyMQT40jOJtpue2vDN0BtGDZxpXhTRCPHayabbh72G8q5mQ9e2SHlV9S/eBtF5bDPmRi98I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NEarH/fk; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NEarH/fk" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-cbb662575d3so1234341a12.0 for ; Wed, 22 Jul 2026 07:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784728874; x=1785333674; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZEjjn0vc5h6Klfz50Xi3OPenrjoSwnSYbs/Qn95SwQM=; b=NEarH/fk0a/bhzHN/l+ixz/cCRwCV6iqTMYLltQPeoDh8C0E20EN0EUdeTzxmGP+uy /WvZ+9HZsAjVV61hkwMVqntKqEKVzqMkSMMWfqoP7lCUMmskEVwBvDzrDIqkF8+Yrb8Z AdrqAEKmqZO5z1L3ln3CmO+WdgFfYeusGYe55pqnuushnn2zcZIY8/O/auD/9ZF2VQoL 1euhfHYmPW+xcw2Kx+hvs2/Izy7/LKMOO3gfTCSkuMPveQyXsWmbRT/LpbMsHpBV+iIz zyCxEt//W66H4KedZqEZPTnmtjfz1PyR6WUILY+Lih1pIeXlSYvr6yFQcUvFB0J2EYON RvGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784728874; x=1785333674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ZEjjn0vc5h6Klfz50Xi3OPenrjoSwnSYbs/Qn95SwQM=; b=rt7dYzokvGIZur1zD5fL1SbGaHsxoQ8i036LEhcLqQfXzjJeDwcVT59HWkH3OEp7yL HqY45rEvnZk09yF1/tFsiD7JIQ2SpQ4v6k4WAthyz1ZiUZWByRElO2UK2nIQzhO32S70 ni531q2x7wkLzQ9Zpy7gZ9n4/wFooyF5W6LpunxR5fm6ppNmm593XuRBgjtt9aKtFNVB hZtb0cZHyyZ+NFGTb0GjBQ1TGg301ZkVHIyb/MpLtsILjEHIajzL/xeKDTaINQNN3AI+ BHQmQKZGB7B5Jd/3FKs4eMyaf57pZS57gUZS7Cupmvxq0dCnzn7MjojRfVkum3M58PJJ dDgQ== X-Forwarded-Encrypted: i=1; AHgh+RqVUYkjabTjFEq2kvTlWXt0r2UMm+zBfRUo6q/nrHYubO0Dz14DEfmDTZRoicp8tHpHCxmqQ+w1czCypXM=@vger.kernel.org X-Gm-Message-State: AOJu0YzyHartCef7PcPf5VIJvIcLfNAWGtcrRxOlqoq4HH7VlZi56Hn0 tSH+2AfRUVsl4ucxp81RtM8s/4yeGA6WZGPmk/i1Ogd9GzVLs+Dic2p+ X-Gm-Gg: AR+sD10FzWY1yMAeKPMsyVXOEjRZRl0u54zpZiQQaKwOIMfO2vx6fgjSrBJ74eKh77G L3DuTQgh7qGeydg3+znsZjQF5Zlgr+ln8c6wbzQRr8ugCjmrBHJgPNSgZqkhRcLBjGLl56QKrX3 XEZduMdvR9E7jrj0m2A++IJOhdwYYOUpTVhxXlaVg8e0TsvdR1BccoG2e0flwg3nathb0209voE gM07E7pB2U37gskwzAS01nbN2r9pfktDPhmYe9ch5GN6gjDAWN4tMGCQ2OlR2cXCNA0g/r0E3Bl cCm3NslWsm++cEKs43rexKJrtIRQKihb//+WTllTb0aM4gER1MCDQylvnYZYV58AK4ZhbzE2PeM 0T27aWjqC9yHZVqBWUE6BeJzDcTBnpLdjdtSQIxv6sg9pTLOViwMaplCaxTQh9CPsYLaNAnSgnQ 0teNlYVfXlrDre4ePDjU8bjOUywgmj23jsvLsKgAxE2pARits= X-Received: by 2002:a05:6a20:3ca3:b0:3c3:7ecd:72df with SMTP id adf61e73a8af0-3c3ad86ab89mr26184446637.30.1784728873939; Wed, 22 Jul 2026 07:01:13 -0700 (PDT) Received: from computer.goose-salary.ts.net ([2a09:bac5:40b2:277d::3ef:c9]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbb8f1a8a1fsm1242281a12.26.2026.07.22.07.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 07:01:13 -0700 (PDT) From: Varun R Mallya To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, bjorn@kernel.org, pulehui@huawei.com Cc: alex@ghiti.fr, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, puranjay@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, varunrmallya@gmail.com Subject: [PATCH bpf-next v3 3/6] riscv, stacktrace: Implement arch_bpf_stack_walk() for BPF Date: Wed, 22 Jul 2026 19:30:10 +0530 Message-ID: <20260722140015.1982158-4-varunrmallya@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722140015.1982158-1-varunrmallya@gmail.com> References: <20260722140015.1982158-1-varunrmallya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This will be used by bpf_throw() to unwind till the program marked as exception boundary and run the exception callback with the stack of the main program. This is a wrapper around walk_stackframe(), which now passes (pc, sp and fp) to it's consume callback. Signed-off-by: Varun R Mallya --- arch/riscv/kernel/stacktrace.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index 30b369dd2815..c0f2393e5163 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -5,6 +5,7 @@ */ =20 #include +#include #include #include #include @@ -104,6 +105,30 @@ void notrace walk_stackframe(struct task_struct *task,= struct pt_regs *regs, } } =20 +struct bpf_unwind_consume_entry_data { + bool (*consume_entry)(void *cookie, u64 ip, u64 sp, u64 fp); + void *cookie; +}; + +static bool bpf_unwind_consume_entry(void *arg, unsigned long pc, + unsigned long sp, unsigned long fp) +{ + struct bpf_unwind_consume_entry_data *data =3D arg; + + return data->consume_entry(data->cookie, pc, sp, fp); +} + +void notrace arch_bpf_stack_walk(bool (*consume_fn)(void *cookie, u64 ip, = u64 sp, u64 bp), + void *cookie) +{ + struct bpf_unwind_consume_entry_data data =3D { + .consume_entry =3D consume_fn, + .cookie =3D cookie, + }; + + walk_stackframe(current, NULL, bpf_unwind_consume_entry, &data); +} + #else /* !CONFIG_FRAME_POINTER */ =20 void notrace walk_stackframe(struct task_struct *task, --=20 2.55.0 From nobody Fri Jul 24 22:54:52 2026 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E76F35AC31 for ; Wed, 22 Jul 2026 14:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728890; cv=none; b=PfAuG5MVqp2hls3bjFShK1kYmRm7+sZsjicMg2oy54XNsOYO+ZBG2i8kapyRwMO2WFzU4n3THekw1yVZjuKF6+BHtlyc7YH2uQa1t/JtFBxaZp2MB1b0T4ST1a7YrBh6e8houWSNoWGfQXoSnHboGrrh/ewJIEB25Obc8bxtvZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728890; c=relaxed/simple; bh=fOHTCBcrgzq+oHWGg2uUXZmqlixrBOKYf9/zyymmA0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PI2pSHzoruJltM9cEczCP0oZ1z7mBvz+FQsfc2f1AIPm5MmHelp5NX/6yOMLLesOE+bS2dTmSfygo/GRQ9MCEMDkY2ssNIK1qUPGxNQtGniYhjapE4C9BJnuSBQj7McIgMC0qA1/C7Oe/KPRTj1jw2Rwdlq7Uvm1qMg19hXuAKA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BfNDmBJO; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BfNDmBJO" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-c96c92c0980so6079178a12.3 for ; Wed, 22 Jul 2026 07:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784728888; x=1785333688; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FH52Aw5C7E2f+s1RWscjl9uFLtr6OIWxpcyJYXQFaUM=; b=BfNDmBJOcX99rQTu/IE7X2eQTgw5EG//8IrQFhBxNEIItf3BX6/c3eKtal9anYIzQl 7m/65+4koQ8147ZNdHWeXPkxMRasueDVPqVZ1UfjmnUCgPfRIk0yIAHH7pnO9t4EL1GV qxOGHSleMlwZuSxW+KM2+eAZGQI0f0AWWuq5HVmp0M8GUaodlOkgX48n+MGAsvgvAO2z XzYXGVX2XZJMKQ0pvZ2yjhdX1L2GVbFn1LBz8ALPMkcCiKZEX8nX4qpRhRM+rQAhghyO yPuv635LuCODDxp8Z1UuasvIEvHj52aN2yI0TeZAghhdiUzQ8iDNWxAEsN/9UAidotEJ uG6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784728888; x=1785333688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=FH52Aw5C7E2f+s1RWscjl9uFLtr6OIWxpcyJYXQFaUM=; b=sr+LVVber9tFnP+CqMU0O7LIrFaKhY/l26EUlc5071E7gBv2DKVDYNtc34RyI95TvS OD/B/63cETk7Ox46BDtraXlfZ+i9JovOlTwGBxf0ye0duB9YwubkiYjmO3qIx/cJt/mW u18oHtNSYBSAicyjilCSHIsC4SHr7Ty6vQ7SFCbaMHKid+A9tBIo8w6xe1nNN+UEzcvN ykMWaxDEBidgxmeqQjZoL5zYB6YyKmS+L3Zf605V031NIWtGiqstKT/q8hEwOnAnHwM5 QjPxzx/jLcX0ni5nlY5fHeJiman8IljzuL8Ne/j9s0Eu5bYbs+2UOXv+i8hI3luzQjG1 yZVA== X-Forwarded-Encrypted: i=1; AHgh+RqknFC4qSS9fMA+EUJNzrL3gxUI/mXA6OOg3AoSzutLGIE5LzN8G9Uco6446DaUpOBn/g+YcNJIPYlyAyo=@vger.kernel.org X-Gm-Message-State: AOJu0YyE8DH7I87w1JeeEbRBDGM62yq/I5ts9lT9Hy3Wo7Qozr/8ZQO4 blR2k0NYlaNDOGT2Xnxe8xkT3X64P5DDhOf8GZI7XSR30aHSZEWVZhIw X-Gm-Gg: AR+sD10OqUCLdpsybdvrQuslLdYFr82Sa7DKN3XQ6d+n9xUMEp/HvAWQ0ziaQYhyfm7 uCCTGDPpQJ83p49ERPXLOJ58YRwcgE0GpqrBFIrQ+v3oiOggg6gRww/IDqCqFVoFRlm9+1+5O+/ k7I5zpfbqw/QT4OpiWBQHIb6Ihl+E2XBRrPM5s6Fk68tzYjYxWQZjZRwrVlvWRb+ZKrDVMdNjFU eSr81eOj7zoXe6OfOo5jEGrZJQB0ixhZs38IMC48Iv+vzCVxKLna5Dg/5X4XOaZQEoSvg2jX9sB /QV/YUcYU7lF3OcmKVcG8KEngpOefFpemuUJhTW9xREfBYn5p97MQqK+Kng3PsSVOYeoR+i1pfJ uB1DwE9ydsyfwFhOig4i0KTZNhmgMQiFGCNW/WNPQq3DbfOjZKzZrKCqo0iO9sDSU1sFSnrLbAt UPAIIA4cTDsjvajSwdIACm/7NYVMzWmpczipO899SMfHaBVKo= X-Received: by 2002:a05:6a20:9397:b0:3bd:4698:e7c4 with SMTP id adf61e73a8af0-3c3ada17f25mr23594749637.42.1784728884846; Wed, 22 Jul 2026 07:01:24 -0700 (PDT) Received: from computer.goose-salary.ts.net ([2a09:bac5:40b2:277d::3ef:c9]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbb8f1a8a1fsm1242281a12.26.2026.07.22.07.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 07:01:23 -0700 (PDT) From: Varun R Mallya To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, bjorn@kernel.org, pulehui@huawei.com Cc: alex@ghiti.fr, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, puranjay@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, varunrmallya@gmail.com Subject: [PATCH bpf-next v3 4/6] riscv, bpf: Split prologue and epilogue into helper functions Date: Wed, 22 Jul 2026 19:30:11 +0530 Message-ID: <20260722140015.1982158-5-varunrmallya@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722140015.1982158-1-varunrmallya@gmail.com> References: <20260722140015.1982158-1-varunrmallya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Split bpf_jit_build_prologue() and __build_epilogue() into helpers. normal_stack_adjust() computes the frame size for the callee-saved registers a program actually clobbers, emit_normal_prologue() allocates the frame and spills those registers, and emit_normal_restore() reloads them. The kcfi preamble, fentry nops and tail-call-counter setup are hoisted before the frame-size computation and they do not depend on it and the emitted instruction sequence is unchanged. No functional change. Signed-off-by: Varun R Mallya --- arch/riscv/net/bpf_jit_comp64.c | 152 ++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 65 deletions(-) diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp6= 4.c index ad089a9a4ea9..b804382075c4 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -198,9 +198,84 @@ static void emit_imm(u8 rd, s64 val, struct rv_jit_con= text *ctx) emit_addi(rd, rd, lower, ctx); } =20 -static void __build_epilogue(bool is_tail_call, struct rv_jit_context *ctx) +/* Stack space for the callee-saved registers a normal program spills, + * excluding the BPF stack itself. + */ +static int normal_stack_adjust(struct rv_jit_context *ctx) { - int stack_adjust =3D ctx->stack_size, store_offset =3D stack_adjust - 8; + int stack_adjust =3D 0; + + if (seen_reg(RV_REG_RA, ctx)) + stack_adjust +=3D 8; + stack_adjust +=3D 8; /* RV_REG_FP */ + if (seen_reg(RV_REG_S1, ctx)) + stack_adjust +=3D 8; + if (seen_reg(RV_REG_S2, ctx)) + stack_adjust +=3D 8; + if (seen_reg(RV_REG_S3, ctx)) + stack_adjust +=3D 8; + if (seen_reg(RV_REG_S4, ctx)) + stack_adjust +=3D 8; + if (seen_reg(RV_REG_S5, ctx)) + stack_adjust +=3D 8; + if (ctx->arena_vm_start) + stack_adjust +=3D 8; + stack_adjust +=3D 8; /* RV_REG_TCC */ + + return round_up(stack_adjust, STACK_ALIGN); +} + +/* Allocate the frame and save the callee-saved registers the program + * actually clobbers, then point FP at the frame top. + */ +static void emit_normal_prologue(struct rv_jit_context *ctx, int stack_adj= ust) +{ + int store_offset =3D stack_adjust - 8; + /* tailcall starts here, emit insn before it must be fixed */ + + emit_addi(RV_REG_SP, RV_REG_SP, -stack_adjust, ctx); + + if (seen_reg(RV_REG_RA, ctx)) { + emit_sd(RV_REG_SP, store_offset, RV_REG_RA, ctx); + store_offset -=3D 8; + } + emit_sd(RV_REG_SP, store_offset, RV_REG_FP, ctx); + store_offset -=3D 8; + if (seen_reg(RV_REG_S1, ctx)) { + emit_sd(RV_REG_SP, store_offset, RV_REG_S1, ctx); + store_offset -=3D 8; + } + if (seen_reg(RV_REG_S2, ctx)) { + emit_sd(RV_REG_SP, store_offset, RV_REG_S2, ctx); + store_offset -=3D 8; + } + if (seen_reg(RV_REG_S3, ctx)) { + emit_sd(RV_REG_SP, store_offset, RV_REG_S3, ctx); + store_offset -=3D 8; + } + if (seen_reg(RV_REG_S4, ctx)) { + emit_sd(RV_REG_SP, store_offset, RV_REG_S4, ctx); + store_offset -=3D 8; + } + if (seen_reg(RV_REG_S5, ctx)) { + emit_sd(RV_REG_SP, store_offset, RV_REG_S5, ctx); + store_offset -=3D 8; + } + if (ctx->arena_vm_start) { + emit_sd(RV_REG_SP, store_offset, RV_REG_ARENA, ctx); + store_offset -=3D 8; + } + + /* store TCC from RV_REG_TCC to stack */ + emit_sd(RV_REG_SP, store_offset, RV_REG_TCC, ctx); + ctx->tcc_offset =3D store_offset; + + emit_addi(RV_REG_FP, RV_REG_SP, stack_adjust, ctx); +} + +static void emit_normal_restore(struct rv_jit_context *ctx, int stack_adju= st) +{ + int store_offset =3D stack_adjust - 8; =20 if (seen_reg(RV_REG_RA, ctx)) { emit_ld(RV_REG_RA, store_offset, RV_REG_SP, ctx); @@ -235,6 +310,13 @@ static void __build_epilogue(bool is_tail_call, struct= rv_jit_context *ctx) =20 /* restore TCC from stack to RV_REG_TCC */ emit_ld(RV_REG_TCC, ctx->tcc_offset, RV_REG_SP, ctx); +} + +static void __build_epilogue(bool is_tail_call, struct rv_jit_context *ctx) +{ + int stack_adjust =3D ctx->stack_size; + + emit_normal_restore(ctx, stack_adjust); =20 emit_addi(RV_REG_SP, RV_REG_SP, stack_adjust, ctx); /* Set return value. */ @@ -2006,34 +2088,12 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, = struct rv_jit_context *ctx, =20 void bpf_jit_build_prologue(struct rv_jit_context *ctx, bool is_subprog) { - int i, stack_adjust =3D 0, store_offset, bpf_stack_adjust; + int i, stack_adjust, bpf_stack_adjust; =20 bpf_stack_adjust =3D round_up(ctx->prog->aux->stack_depth, STACK_ALIGN); if (bpf_stack_adjust) mark_fp(ctx); =20 - if (seen_reg(RV_REG_RA, ctx)) - stack_adjust +=3D 8; - stack_adjust +=3D 8; /* RV_REG_FP */ - if (seen_reg(RV_REG_S1, ctx)) - stack_adjust +=3D 8; - if (seen_reg(RV_REG_S2, ctx)) - stack_adjust +=3D 8; - if (seen_reg(RV_REG_S3, ctx)) - stack_adjust +=3D 8; - if (seen_reg(RV_REG_S4, ctx)) - stack_adjust +=3D 8; - if (seen_reg(RV_REG_S5, ctx)) - stack_adjust +=3D 8; - if (ctx->arena_vm_start) - stack_adjust +=3D 8; - stack_adjust +=3D 8; /* RV_REG_TCC */ - - stack_adjust =3D round_up(stack_adjust, STACK_ALIGN); - stack_adjust +=3D bpf_stack_adjust; - - store_offset =3D stack_adjust - 8; - /* emit kcfi type preamble immediately before the first insn */ emit_kcfi(is_subprog ? cfi_bpf_subprog_hash : cfi_bpf_hash, ctx); =20 @@ -2046,46 +2106,8 @@ void bpf_jit_build_prologue(struct rv_jit_context *c= tx, bool is_subprog) if (!is_subprog) emit(rv_addi(RV_REG_TCC, RV_REG_ZERO, MAX_TAIL_CALL_CNT), ctx); =20 - /* tailcall starts here, emit insn before it must be fixed */ - - emit_addi(RV_REG_SP, RV_REG_SP, -stack_adjust, ctx); - - if (seen_reg(RV_REG_RA, ctx)) { - emit_sd(RV_REG_SP, store_offset, RV_REG_RA, ctx); - store_offset -=3D 8; - } - emit_sd(RV_REG_SP, store_offset, RV_REG_FP, ctx); - store_offset -=3D 8; - if (seen_reg(RV_REG_S1, ctx)) { - emit_sd(RV_REG_SP, store_offset, RV_REG_S1, ctx); - store_offset -=3D 8; - } - if (seen_reg(RV_REG_S2, ctx)) { - emit_sd(RV_REG_SP, store_offset, RV_REG_S2, ctx); - store_offset -=3D 8; - } - if (seen_reg(RV_REG_S3, ctx)) { - emit_sd(RV_REG_SP, store_offset, RV_REG_S3, ctx); - store_offset -=3D 8; - } - if (seen_reg(RV_REG_S4, ctx)) { - emit_sd(RV_REG_SP, store_offset, RV_REG_S4, ctx); - store_offset -=3D 8; - } - if (seen_reg(RV_REG_S5, ctx)) { - emit_sd(RV_REG_SP, store_offset, RV_REG_S5, ctx); - store_offset -=3D 8; - } - if (ctx->arena_vm_start) { - emit_sd(RV_REG_SP, store_offset, RV_REG_ARENA, ctx); - store_offset -=3D 8; - } - - /* store TCC from RV_REG_TCC to stack */ - emit_sd(RV_REG_SP, store_offset, RV_REG_TCC, ctx); - ctx->tcc_offset =3D store_offset; - - emit_addi(RV_REG_FP, RV_REG_SP, stack_adjust, ctx); + stack_adjust =3D normal_stack_adjust(ctx) + bpf_stack_adjust; + emit_normal_prologue(ctx, stack_adjust); =20 if (bpf_stack_adjust) emit_addi(RV_REG_S5, RV_REG_SP, bpf_stack_adjust, ctx); --=20 2.55.0 From nobody Fri Jul 24 22:54:52 2026 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C20D33546D0 for ; Wed, 22 Jul 2026 14:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728902; cv=none; b=RmWvt0LxV0wZAfKp3o5JXgyb9PJ/XjiNRyn6YDGmTwfFnlu8imJTrQZY4pfP0z2G0wWVgTLW9wlKMNGrTxr8w+euipGr+MUt74GY/SRBmTMd9Nr92X2M9WkJu1vKR1ebTjH8WGfrMhGyiFUMrL1diPzgLzHeUJUFU9srbRO+H3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728902; c=relaxed/simple; bh=UpvQpevrWIIS/T5wDeBixMvu/ILTPMDbvy8wHUGgX1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MrjZ4RSYqYNRptbifkptd1sgZk3oQHaSkHExoszO42ws9LIVnxF20zh19lqJQHeVIYD+CYJCTVSOl2MQRq7A04rEb2i9a8rtSknJgqFsM8oVvlNVrdm83n5BuUnyGGKr22DAfz0xXH7grhK4F5UFpRXQzq5I/lK+/fPuQKnTnH8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WT6B3ctR; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WT6B3ctR" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-caf707e3a70so3902058a12.1 for ; Wed, 22 Jul 2026 07:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784728900; x=1785333700; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hJghvyp9lx2AAiAnzR9hFK8qyEideu4pePevOLlB6CQ=; b=WT6B3ctROp8sQdHrkFkW5+YDN7Zl0Ya+hBmSvpKqspxHIdesiAtwEdP9D+cehNibF8 wKmH3eyiR47RoGD3Ztkat6IUN+v2yriOYH4/72snkFjCrY90l2sJP2VswvbKyo4GtWpt fRgeq15gcAs8ElIhCHL03SzPTB9qrB49DlaIRGwi9cPqJoTWGD42duy8KxiqGEA132eb 29l6YzegiDNAnXyD8Zo2XwwKqfad4CGKQcJGwGw2/ewXSG9HNo7fZ9bRtqP/zAuRwVqZ n7cFOGxGsvVS0N8mzKkROT6DGPCk2Ey3fXUQPcVEhexpo8vlngCM8+XjYf8I9t7Zuu8D KvMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784728900; x=1785333700; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hJghvyp9lx2AAiAnzR9hFK8qyEideu4pePevOLlB6CQ=; b=Bhr6a/MuoeXO4h+01C5viY2PBOFu2Qo/+5P/Umxx07LliH0gUaItyibJIHWAsMqQyN 3IMf8P5QsLX95UGK8KjXN90AvkdNQDOFg5s7GQjjm9mV/NSd760i8bnOrP4rLtMHULAw uKBRRqgHBCofp/Py3BlHAsMBmcincFZAhlFaP0pkYmeqq6v/OlCaD4uyF/gHEUmtYJeZ Lybt3DLG9B8FjvHlmvvx5SIyWStDXqQq9XwNI0YorhyTBhueq3bJEO3uICrsDK2wsNJc sJC6Xj2JIJkAMwFBNkPRwehm3z2Lqqw/iO4TuHM4FwpKFpVxjaSKMu5zwhQGkgmI+gFm M5/Q== X-Forwarded-Encrypted: i=1; AHgh+Roycl1w0cw1QV2JarsztqBthRDsqEIvy4SPSQPyq4IJdSp8sVD9SCwBYry0OtXzfDKNuCb1VifgRhuKkUM=@vger.kernel.org X-Gm-Message-State: AOJu0YzCAxqo2R5Ix/5nbxNmYE2dHOQrIqGNVNtUdtO0j46NcOJYEpnP v8egRAD0iegGclu3jLCvAVhYi9aWAtHctQ2uoAaBvKK1Ve+gSe+cIfhp X-Gm-Gg: AR+sD11UPqvx1trGP4CCg2vnx3JC+tVunaZo0VemxlbgG9pkqkm+dWS21T6u2ni3JTN CuKE1wVBR4b4Evf9SBL+G+flPuw9WqLgHY1rnPeRPkXmNR3xUtAbgAWh9CJBMudUErD6gwytqkm dqtfug/5gR5hU8mc9KSO2798AA0UBv01eL/WC04HBi/JzaiUaIpPOWxhsafpYv51nJ0TUdX8G2V vaAIw77+b9XrGNK3VOq0q4aWenGvV62C6VjCWxEh6DG4pZc+w79t+ZBMgrNdgpb0VXz2HW1PxuP 6+7Lhl0S98E8C1BmwyrVj0kVpPuVhJV5wjVqoowuJw2HWwBdTkJNHj1XSkb0Efrm8EjP3qo2VyV 01FSEmc4CMM42rZwjEionlbyuSWoKRdluQJbw475cQ6Gt87/wswtgOggUObcFNiZt7TV3AGcx0z PTVOcBVo0dheI1jVP+jR3791OAKglZ1xDcBQUOEM8brZZI5VQ= X-Received: by 2002:a05:6a21:6004:b0:3bf:9bd9:cf60 with SMTP id adf61e73a8af0-3c42921e111mr4368025637.6.1784728898850; Wed, 22 Jul 2026 07:01:38 -0700 (PDT) Received: from computer.goose-salary.ts.net ([2a09:bac5:40b2:277d::3ef:c9]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbb8f1a8a1fsm1242281a12.26.2026.07.22.07.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 07:01:37 -0700 (PDT) From: Varun R Mallya To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, bjorn@kernel.org, pulehui@huawei.com Cc: alex@ghiti.fr, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, puranjay@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, varunrmallya@gmail.com Subject: [PATCH bpf-next v3 5/6] riscv, bpf: Add support for BPF exceptions Date: Wed, 22 Jul 2026 19:30:12 +0530 Message-ID: <20260722140015.1982158-6-varunrmallya@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722140015.1982158-1-varunrmallya@gmail.com> References: <20260722140015.1982158-1-varunrmallya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the JIT support required for BPF exceptions on riscv64. Two kinds of programs need special prologue/epilogue handling: - A program acting as an exception boundary must save the full set of riscv callee-saved GP registers (ra, s0-s11), not just the ones it clobbers, so that the exception callback can restore the state that was live at the boundary. ra and fp are stored first so the saved ra/fp pair forms a valid stackframe record for the unwinder. - exception_cb does not allocate its own frame. It reuses the boundary program's frame, whose frame pointer is passed in a2, by setting SP =3D FP - stack_adjust. This lines the epilogue's loads up with the registers the boundary saved, so both paths restore the same order. Both cases are implemented as prologue/epilogue helpers next to the normal-path ones, selected with a plain if/else in bpf_jit_build_prologue() and __build_epilogue(). Signed-off-by: Varun R Mallya --- arch/riscv/net/bpf_jit_comp64.c | 112 +++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp6= 4.c index b804382075c4..e0c2f73bc646 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -56,6 +56,29 @@ static const int pt_regmap[] =3D { [RV_REG_T0] =3D offsetof(struct pt_regs, t0), }; =20 +/* Full set of RISC-V callee-saved GP registers (ra, s0-s11) saved by a pr= ogram + * acting as an exception boundary, in the order they are stored on the st= ack. + * RA and FP come first so the saved ra/fp pair forms a valid stackframe r= ecord + * at [FP-8]/[FP-16] for the unwinder. The exception callback reuses the + * boundary program's frame and restores this same set in its epilogue, so= both + * paths must agree on the contents and ordering of this list. + */ +static const int rv_exception_csave_regs[] =3D { + RV_REG_RA, + RV_REG_FP, + RV_REG_S1, + RV_REG_S2, + RV_REG_S3, + RV_REG_S4, + RV_REG_S5, + RV_REG_S6, + RV_REG_S7, + RV_REG_S8, + RV_REG_S9, + RV_REG_S10, + RV_REG_S11, +}; + enum { RV_CTX_F_SEEN_CALL =3D RV_REG_RA, RV_CTX_F_SEEN_S1 =3D RV_REG_S1, @@ -312,11 +335,67 @@ static void emit_normal_restore(struct rv_jit_context= *ctx, int stack_adjust) emit_ld(RV_REG_TCC, ctx->tcc_offset, RV_REG_SP, ctx); } =20 +static bool is_exception_prog(const struct bpf_prog *prog) +{ + return prog->aux->exception_boundary || prog->aux->exception_cb; +} + +static void emit_exception_boundary_prologue(struct rv_jit_context *ctx, + int stack_adjust) +{ + int store_offset =3D stack_adjust - 8; + int i; + + emit_addi(RV_REG_SP, RV_REG_SP, -stack_adjust, ctx); + for (i =3D 0; i < ARRAY_SIZE(rv_exception_csave_regs); i++) { + emit_sd(RV_REG_SP, store_offset, rv_exception_csave_regs[i], ctx); + store_offset -=3D 8; + } + + /* store TCC from RV_REG_TCC to stack */ + emit_sd(RV_REG_SP, store_offset, RV_REG_TCC, ctx); + ctx->tcc_offset =3D store_offset; + + emit_addi(RV_REG_FP, RV_REG_SP, stack_adjust, ctx); +} + +/* reuses the boundary program's frame, whose frame pointer + * is passed in a2 (since it's the third argument from bpf_throw()). + * Setting SP =3D FP - stack_adjust lines the epilogue's loads up with + * the registers the boundary saved. + */ +static void emit_exception_cb_prologue(struct rv_jit_context *ctx, + int stack_adjust) +{ + emit_mv(RV_REG_FP, RV_REG_A2, ctx); + emit_addi(RV_REG_SP, RV_REG_FP, -stack_adjust, ctx); + ctx->tcc_offset =3D stack_adjust - 8 - ARRAY_SIZE(rv_exception_csave_regs= ) * 8; +} + +/* Used by both the boundary program and the exception callback alike, sin= ce the + * callback runs on the boundary's frame. + */ +static void emit_exception_restore(struct rv_jit_context *ctx, int stack_a= djust) +{ + int store_offset =3D stack_adjust - 8; + int i; + + for (i =3D 0; i < ARRAY_SIZE(rv_exception_csave_regs); i++) { + emit_ld(rv_exception_csave_regs[i], store_offset, RV_REG_SP, ctx); + store_offset -=3D 8; + } + /* restore TCC from stack to RV_REG_TCC */ + emit_ld(RV_REG_TCC, ctx->tcc_offset, RV_REG_SP, ctx); +} + static void __build_epilogue(bool is_tail_call, struct rv_jit_context *ctx) { int stack_adjust =3D ctx->stack_size; =20 - emit_normal_restore(ctx, stack_adjust); + if (is_exception_prog(ctx->prog)) + emit_exception_restore(ctx, stack_adjust); + else + emit_normal_restore(ctx, stack_adjust); =20 emit_addi(RV_REG_SP, RV_REG_SP, stack_adjust, ctx); /* Set return value. */ @@ -2086,6 +2165,15 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, s= truct rv_jit_context *ctx, return 0; } =20 +static int exception_stack_adjust(void) +{ + int stack_adjust =3D 0; + + stack_adjust +=3D 8; /* RV_REG_TCC */ + stack_adjust +=3D ARRAY_SIZE(rv_exception_csave_regs) * 8; + return round_up(stack_adjust, STACK_ALIGN); +} + void bpf_jit_build_prologue(struct rv_jit_context *ctx, bool is_subprog) { int i, stack_adjust, bpf_stack_adjust; @@ -2106,8 +2194,17 @@ void bpf_jit_build_prologue(struct rv_jit_context *c= tx, bool is_subprog) if (!is_subprog) emit(rv_addi(RV_REG_TCC, RV_REG_ZERO, MAX_TAIL_CALL_CNT), ctx); =20 - stack_adjust =3D normal_stack_adjust(ctx) + bpf_stack_adjust; - emit_normal_prologue(ctx, stack_adjust); + if (is_exception_prog(ctx->prog)) { + stack_adjust =3D exception_stack_adjust() + bpf_stack_adjust; + + if (ctx->prog->aux->exception_cb) + emit_exception_cb_prologue(ctx, stack_adjust); + else + emit_exception_boundary_prologue(ctx, stack_adjust); + } else { + stack_adjust =3D normal_stack_adjust(ctx) + bpf_stack_adjust; + emit_normal_prologue(ctx, stack_adjust); + } =20 if (bpf_stack_adjust) emit_addi(RV_REG_S5, RV_REG_SP, bpf_stack_adjust, ctx); @@ -2183,3 +2280,12 @@ bool bpf_jit_supports_subprog_tailcalls(void) { return true; } + +bool bpf_jit_supports_exceptions(void) +{ + /* bpf_throw() unwinds by walking the frame-pointer chain from inside + * the kernel back into the BPF frames (see arch_bpf_stack_walk()), so + * exceptions require the frame-pointer unwinder to be enabled. + */ + return IS_ENABLED(CONFIG_FRAME_POINTER); +} --=20 2.55.0 From nobody Fri Jul 24 22:54:52 2026 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54D653546D0 for ; Wed, 22 Jul 2026 14:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728912; cv=none; b=qaZk+Z+iMzOYJp1G4IOP3Y4W0KoUYojQyXyv/s2hNotfls4JepYyz+eorsTHISB2V0eEWPYNFeAl+1FWsmRWJ4TXB8Bz9ktAGvIyzihswx2BIpbqvmb8QLIU/0J2s3zMu6mpohbgDkeSYf4gHzCbAZOlsa9xa79zTuf1WDCXBMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784728912; c=relaxed/simple; bh=IRZyJ0fopRXhrBse54glb0AttLyv2hlC/a2Ga8rTfYU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KYEQ4dztpguhwmw3gy4LPFpmH4PCpmyqm6KUClvOFLzrsl7qty4Y+hkHFkQFxhmNx/RkxCW6QjUHLHtJFRFvOJtYkoGb/1W0ggxjMDXZu1GItyu6ffpzsVif8RxOI/R9t8y9uKcWN2pKcZ7OP1csAZ/L4TU43253BNTs+RWWoOU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=j3sftEMj; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j3sftEMj" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-8485b358552so77983b3a.2 for ; Wed, 22 Jul 2026 07:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784728910; x=1785333710; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=lhfzR90Z74WPj2CRcWlLERVPxsI4JJvonp11/p/J06I=; b=j3sftEMjDErU7K1hmqXQ/B46+/mjgK1pkoWsJzKs9C172+hE12VEYlEnuYrCWzdu0t lOEHoFs4cdetOUHAAiYuKPbK2DciZ3szo7BzBoWeA/f+MLf2ohT9KHYcupXalw7eJ2/k zAUyKQOwIaNotYLp9oBNjfTYr+SAEYHyXDavWXq9qvOL5d5c3vD4iyi+9VGVe1Wkxr3U 31Oi+Oal15u1/8bXZjAEDzIVX3CEW0QWDoJXMT3k2d22MBeovtpJlhVpJVlWfKPpMqWf hsaIIO+nZrQ2SZ931mY2bl70o5P1IyaVZBUY4uf0V2lQpBPZtCZxfOo7CvoDnV4sXM60 op2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784728910; x=1785333710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=lhfzR90Z74WPj2CRcWlLERVPxsI4JJvonp11/p/J06I=; b=ejQP6ri+zouLVzo4MwEbmr26BN9m/XsrgInnF009l+ceW/c/zr0+/0r/3+G38AtSGE dtZGjHUs0NGVwDq0qcjWlRcN2+cLNEmX4t4yX+8g56FzLzTtK25IJXJWKNqiXST0+D/h WDlDMAYBbNcCwb9YHIaDiVRPBkIuqQ8PzDd14Ie2pCOdSRzXlpgiJQOckWc0tIK3DhBx yu2gF8wUWAT+2rbUGBApdmIO3UPtGZidC7M6LC+EkWkHfr4J89hBKvCMIMad9NIqrPkd i/hn3FpKyhblKeo7WAO/jtlZF35r8nj3AHortkASOqPHRlWCJAu2EN69rXeRMzg5eSLX P3rg== X-Forwarded-Encrypted: i=1; AHgh+Rrhg7gKf4HIY8Z752NugqkQpUQT36G/YNfJ1UiMTLTsHgi3U+/CrHbLE6bZBx1CutimmHaZ3q057pEWK2E=@vger.kernel.org X-Gm-Message-State: AOJu0YwbtW/8FlHDdenJyJqFi4mV55mFYlOn10KY8cHSpABYOZ8VB6xT rbbDIUWMkF6Vh5KqWUNQJTk58q4nLSnD6VClEjYGrxCWmhMOwH+2IMYf X-Gm-Gg: AR+sD11D3B7yPol77mLdn8bBNYm3fQSaOizm+Q3tU6zxjv2DVJZCq8Z/nyYuIneda9q GWuddrdbzU64GFHrgXsUwxOl46P7jufQFwET0e4bVW3dU+lEQQwCv9CSWfQSjnKJAqb2JzddDJ+ SgEWYVq9DOen46/04tLrJ/5ymAlTSMofSpTs+a/5xDufCOhHso90WNvzRY/JCiiYvFCN5DWEEKB SaJDU/O4RiaD4xTJe3ne+lbp7K2lSWD9WmHvGdW3+pBeD0VX3SrS5qGsPExQpQPxBL1IoTuxJNb XpRhkwUvibWxI4fMkt3wSv3ATUMKkWJwFKK8X6p158HC9HaqUVVPBWOysxxM2UOBQmUJrEmVPMM RtKAgg2QoubGB8rdmpxCAgVfZa5B+X8W53Nh3lS/mtCP9oqbpH+nFBpoezCm1B2pn+dmcU1jAcE pmj9x1Tf+cKG1SFjKi2Wla7UdshdYyMxJ1LRk+olsxbZvyCaU= X-Received: by 2002:a05:6a21:62c4:b0:3c0:b3f7:e5e5 with SMTP id adf61e73a8af0-3c3ad65cc12mr24097620637.25.1784728910120; Wed, 22 Jul 2026 07:01:50 -0700 (PDT) Received: from computer.goose-salary.ts.net ([2a09:bac5:40b2:277d::3ef:c9]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cbb8f1a8a1fsm1242281a12.26.2026.07.22.07.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 07:01:49 -0700 (PDT) From: Varun R Mallya To: pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, bjorn@kernel.org, pulehui@huawei.com Cc: alex@ghiti.fr, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, puranjay@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, varunrmallya@gmail.com Subject: [PATCH bpf-next v3 6/6] riscv, bpf: Remove BPF exceptions from denylist Date: Wed, 22 Jul 2026 19:30:13 +0530 Message-ID: <20260722140015.1982158-7-varunrmallya@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260722140015.1982158-1-varunrmallya@gmail.com> References: <20260722140015.1982158-1-varunrmallya@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This patch removes BPF exceptions from riscv64 denylist on BPF selftests since support for exceptions has been added now. Also, since the file is empty, delete the file. Signed-off-by: Varun R Mallya --- tools/testing/selftests/bpf/DENYLIST.riscv64 | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tools/testing/selftests/bpf/DENYLIST.riscv64 diff --git a/tools/testing/selftests/bpf/DENYLIST.riscv64 b/tools/testing/s= elftests/bpf/DENYLIST.riscv64 deleted file mode 100644 index ca1beae7fe8f..000000000000 --- a/tools/testing/selftests/bpf/DENYLIST.riscv64 +++ /dev/null @@ -1,2 +0,0 @@ -# riscv64 deny list for BPF CI and local vmtest -exceptions # JIT does not support exceptions --=20 2.55.0