* [PATCH] ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type
@ 2022-04-14 8:11 Sergey Matyukevich
2022-04-18 19:11 ` Vineet Gupta
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Matyukevich @ 2022-04-14 8:11 UTC (permalink / raw)
To: bpf; +Cc: Vladimir Isaev, Vineet Gupta, Sergey Matyukevich
From: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Define appropriate uapi for the BPF_PROG_TYPE_PERF_EVENT program type
by exporting the user_regs_struct structure instead of the pt_regs
structure that is in-kernel only.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
---
Originally I sent this patch via linux-snps-arc mailing list: see [1].
However this patch accompanies ARC support for libbpf bpf_tracing.h
accepted to bpf kernel tree: see [2].
So it looks like it makes sense to post this patch here as well.
I will also update linux-snps-arc patch series accordingly.
Regards,
Sergey
[1] https://lore.kernel.org/linux-snps-arc/20220408155804.587197-1-geomatsi@gmail.com/
[2] https://lore.kernel.org/bpf/20220408224442.599566-1-geomatsi@gmail.com/
arch/arc/include/asm/perf_event.h | 4 ++++
arch/arc/include/uapi/asm/bpf_perf_event.h | 9 +++++++++
2 files changed, 13 insertions(+)
create mode 100644 arch/arc/include/uapi/asm/bpf_perf_event.h
diff --git a/arch/arc/include/asm/perf_event.h b/arch/arc/include/asm/perf_event.h
index 4c919c0f4b30..d5719a260864 100644
--- a/arch/arc/include/asm/perf_event.h
+++ b/arch/arc/include/asm/perf_event.h
@@ -63,4 +63,8 @@ struct arc_reg_cc_build {
#define PERF_COUNT_ARC_HW_MAX (PERF_COUNT_HW_MAX + 8)
+#ifdef CONFIG_PERF_EVENTS
+#define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
+#endif
+
#endif /* __ASM_PERF_EVENT_H */
diff --git a/arch/arc/include/uapi/asm/bpf_perf_event.h b/arch/arc/include/uapi/asm/bpf_perf_event.h
new file mode 100644
index 000000000000..6cb1c2823288
--- /dev/null
+++ b/arch/arc/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__ */
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type
2022-04-14 8:11 [PATCH] ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type Sergey Matyukevich
@ 2022-04-18 19:11 ` Vineet Gupta
0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2022-04-18 19:11 UTC (permalink / raw)
To: Sergey Matyukevich, bpf; +Cc: Vladimir Isaev, Vineet Gupta, Sergey Matyukevich
On 4/14/22 01:11, Sergey Matyukevich wrote:
> From: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
>
> Define appropriate uapi for the BPF_PROG_TYPE_PERF_EVENT program type
> by exporting the user_regs_struct structure instead of the pt_regs
> structure that is in-kernel only.
>
> Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
> ---
>
> Originally I sent this patch via linux-snps-arc mailing list: see [1].
> However this patch accompanies ARC support for libbpf bpf_tracing.h
> accepted to bpf kernel tree: see [2].
>
> So it looks like it makes sense to post this patch here as well.
> I will also update linux-snps-arc patch series accordingly.
>
> Regards,
> Sergey
Applied !
Thx,
-Vineet
>
> [1] https://lore.kernel.org/linux-snps-arc/20220408155804.587197-1-geomatsi@gmail.com/
> [2] https://lore.kernel.org/bpf/20220408224442.599566-1-geomatsi@gmail.com/
>
>
> arch/arc/include/asm/perf_event.h | 4 ++++
> arch/arc/include/uapi/asm/bpf_perf_event.h | 9 +++++++++
> 2 files changed, 13 insertions(+)
> create mode 100644 arch/arc/include/uapi/asm/bpf_perf_event.h
>
> diff --git a/arch/arc/include/asm/perf_event.h b/arch/arc/include/asm/perf_event.h
> index 4c919c0f4b30..d5719a260864 100644
> --- a/arch/arc/include/asm/perf_event.h
> +++ b/arch/arc/include/asm/perf_event.h
> @@ -63,4 +63,8 @@ struct arc_reg_cc_build {
>
> #define PERF_COUNT_ARC_HW_MAX (PERF_COUNT_HW_MAX + 8)
>
> +#ifdef CONFIG_PERF_EVENTS
> +#define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
> +#endif
> +
> #endif /* __ASM_PERF_EVENT_H */
> diff --git a/arch/arc/include/uapi/asm/bpf_perf_event.h b/arch/arc/include/uapi/asm/bpf_perf_event.h
> new file mode 100644
> index 000000000000..6cb1c2823288
> --- /dev/null
> +++ b/arch/arc/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__ */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-18 19:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-14 8:11 [PATCH] ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type Sergey Matyukevich
2022-04-18 19:11 ` Vineet Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox