From: Stafford Horne <shorne@gmail.com>
To: Ben Hutchings <ben.hutchings@mind.be>
Cc: bpf@vger.kernel.org, Dinh Nguyen <dinguyen@kernel.org>,
linux-openrisc@vger.kernel.org, Chris Zankel <chris@zankel.net>,
Max Filippov <jcmvbkbc@gmail.com>
Subject: Re: [PATCH] nios2, openrisc, xtensa: Fix definitions of bpf_user_pt_regs_t
Date: Sat, 23 Aug 2025 06:45:26 +0100 [thread overview]
Message-ID: <aKlVdonjv3URRmtG@antec> (raw)
In-Reply-To: <20250822135848.1922288-1-ben.hutchings@mind.be>
On Fri, Aug 22, 2025 at 03:58:48PM +0200, Ben Hutchings wrote:
> The UAPI <asm/bpf_perf_event.h> header is required to define the type
> alias bpf_user_pt_regs_t. The generic version includes
> <linux/ptrace.h> and defines it as an alias for struct pt_regs.
>
> For these 3 architectures, struct pt_regs is not defined in the UAPI.
> They need to override the generic version with an architecture-
> specific definition of bpf_user_pt_regs_t.
>
> References: https://autobuild.buildroot.org/results/bf2/bf21079facd21d684e8656e7ac44b4218a8fcb9d/build-end.log
> Fixes: c895f6f703ad ("bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type")
> Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
> ---
> I understand that perf_events is not yet supported on nios2 and
> openrisc, so this isn't obviously useful. However, libbpf has generic
> handling for BPF_PROG_TYPE_PERF_EVENT that includes
> <linux/bpf_perf_event.h> and it now fails to build on openrisc.
Understood.
> I verified that:
> - This fixes building libbpf with Buildroot for openrisc
> - This makes "#include <linux/bpf_perf_event.h>" work on xtensa
>
> I wasn't able to test nios2 at all.
>
> Ben.
>
> arch/nios2/include/uapi/asm/bpf_perf_event.h | 9 +++++++++
> arch/openrisc/include/uapi/asm/bpf_perf_event.h | 9 +++++++++
> arch/xtensa/include/uapi/asm/bpf_perf_event.h | 9 +++++++++
> 3 files changed, 27 insertions(+)
> create mode 100644 arch/nios2/include/uapi/asm/bpf_perf_event.h
> create mode 100644 arch/openrisc/include/uapi/asm/bpf_perf_event.h
> create mode 100644 arch/xtensa/include/uapi/asm/bpf_perf_event.h
>
> diff --git a/arch/nios2/include/uapi/asm/bpf_perf_event.h b/arch/nios2/include/uapi/asm/bpf_perf_event.h
> new file mode 100644
> index 000000000000..5e1e648aeec4
> --- /dev/null
> +++ b/arch/nios2/include/uapi/asm/bpf_perf_event.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
> +#define _UAPI__ASM_BPF_PERF_EVENT_H__
> +
> +#include <asm/ptrace.h>
> +
> +typedef struct user_pt_regs bpf_user_pt_regs_t;
> +
> +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
> diff --git a/arch/openrisc/include/uapi/asm/bpf_perf_event.h b/arch/openrisc/include/uapi/asm/bpf_perf_event.h
> new file mode 100644
> index 000000000000..6cb1c2823288
> --- /dev/null
> +++ b/arch/openrisc/include/uapi/asm/bpf_perf_event.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
> +#define _UAPI__ASM_BPF_PERF_EVENT_H__
> +
> +#include <asm/ptrace.h>
> +
> +typedef struct user_regs_struct bpf_user_pt_regs_t;
> +
> +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
This bit,
Acked-by: Stafford Horne <shorne@gmail.com>
Who do you plan on having take this patch for upstream? Will you?
-Stafford
> diff --git a/arch/xtensa/include/uapi/asm/bpf_perf_event.h b/arch/xtensa/include/uapi/asm/bpf_perf_event.h
> new file mode 100644
> index 000000000000..5e1e648aeec4
> --- /dev/null
> +++ b/arch/xtensa/include/uapi/asm/bpf_perf_event.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
> +#define _UAPI__ASM_BPF_PERF_EVENT_H__
> +
> +#include <asm/ptrace.h>
> +
> +typedef struct user_pt_regs bpf_user_pt_regs_t;
> +
> +#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
> --
> 2.39.5
>
>
next prev parent reply other threads:[~2025-08-23 5:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 13:58 [PATCH] nios2, openrisc, xtensa: Fix definitions of bpf_user_pt_regs_t Ben Hutchings
2025-08-23 5:45 ` Stafford Horne [this message]
2025-08-23 23:16 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aKlVdonjv3URRmtG@antec \
--to=shorne@gmail.com \
--cc=ben.hutchings@mind.be \
--cc=bpf@vger.kernel.org \
--cc=chris@zankel.net \
--cc=dinguyen@kernel.org \
--cc=jcmvbkbc@gmail.com \
--cc=linux-openrisc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).