From mboxrd@z Thu Jan 1 00:00:00 1970 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 21886C48BF8 for ; Thu, 22 Feb 2024 19:28:38 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2UlVnrJ9ldpwUJ3dHBfqgkbp7WiMXeOja+ffrHOWLC8=; b=HnSW8BRU5iD72t 0bceeJ/q17p5fxGiDHX1A9BNf616FroY5dzllt6ikAEV5L1hBJH7xa5KiS/Q8IXKULMYTHrk+swcb TxhgJ6RxlZIKeYaGS9NtWe9OzLjDMtyk5ftcSlcG6f5gt55cQ8l0z8sWE1pj+sdE1dPwZtXNuqITp f5dmwik9M9ylORjaz+zKtqGblL9jIfQ3Cmmd20Ds7rpx6NTrU+phxcaJtXKbieAjYuPJqc7lpFrAm RId10XcG2CgqIQepL831LgH/dAFCJunA5jdlOmY2+53Ka5HBY+r4HKFQTl1Vx5Oj/EnDMc3OKXihY PbN+dXd6YAL79mj2FGhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdEk4-00000006KUv-1EOd; Thu, 22 Feb 2024 19:28:24 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdEk0-00000006KSr-0FXo for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2024 19:28:21 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 787A661A2F; Thu, 22 Feb 2024 19:28:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B10F9C433F1; Thu, 22 Feb 2024 19:28:15 +0000 (UTC) Date: Thu, 22 Feb 2024 19:28:13 +0000 From: Catalin Marinas To: Puranjay Mohan Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Zi Shen Lim , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kumar Kartikeya Dwivedi Subject: Re: [PATCH bpf-next v3 1/2] arm64: stacktrace: Implement arch_bpf_stack_walk() for the BPF JIT Message-ID: References: <20240201125225.72796-1-puranjay12@gmail.com> <20240201125225.72796-2-puranjay12@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240201125225.72796-2-puranjay12@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_112820_170960_3B6D825C X-CRM114-Status: GOOD ( 18.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 01, 2024 at 12:52:24PM +0000, Puranjay Mohan wrote: > This will be used by bpf_throw() to unwind till the program marked as > exception boundary and run the callback with the stack of the main > program. > > This is required for supporting BPF exceptions on ARM64. > > Signed-off-by: Puranjay Mohan > --- > arch/arm64/kernel/stacktrace.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c > index 7f88028a00c0..66cffc5fc0be 100644 > --- a/arch/arm64/kernel/stacktrace.c > +++ b/arch/arm64/kernel/stacktrace.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -266,6 +267,31 @@ noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry, > kunwind_stack_walk(arch_kunwind_consume_entry, &data, task, regs); > } > > +struct bpf_unwind_consume_entry_data { > + bool (*consume_entry)(void *cookie, u64 ip, u64 sp, u64 fp); > + void *cookie; > +}; > + > +static bool > +arch_bpf_unwind_consume_entry(const struct kunwind_state *state, void *cookie) > +{ > + struct bpf_unwind_consume_entry_data *data = cookie; > + > + return data->consume_entry(data->cookie, state->common.pc, 0, > + state->common.fp); > +} > + > +noinline noinstr void arch_bpf_stack_walk(bool (*consume_entry)(void *cookie, u64 ip, u64 sp, > + u64 fp), void *cookie) > +{ > + struct bpf_unwind_consume_entry_data data = { > + .consume_entry = consume_entry, > + .cookie = cookie, > + }; > + > + kunwind_stack_walk(arch_bpf_unwind_consume_entry, &data, current, NULL); > +} Too many "cookies", I found reading this confusing. If you ever respin, please use some different "cookie" names. I guess you want this to be merged via the bpf tree? Acked-by: Catalin Marinas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel