diff mbox series

[v3] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again

Message ID 1616676601-14478-1-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
State Accepted
Commit 66633abd0642f1e89d26e15f36fb13d3a1c535ff
Headers show
Series [v3] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again | expand

Commit Message

Tiezhu Yang March 25, 2021, 12:50 p.m. UTC
After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to
archs where they work"), bpf_probe_read{, str}() functions were no longer
available on MIPS, so there exist some errors when running bpf program:

root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
bpf: Failed to load program: Invalid argument
[...]
11: (85) call bpf_probe_read#4
unknown func bpf_probe_read#4
[...]
Exception: Failed to load BPF program count_sched: Invalid argument

ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE should be restricted to archs
with non-overlapping address ranges, but they can overlap in EVA mode
on MIPS, so select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA in
arch/mips/Kconfig, otherwise the bpf old helper bpf_probe_read() will
not be available.

This is similar with the commit d195b1d1d119 ("powerpc/bpf: Enable
bpf_probe_read{, str}() on powerpc again").

Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---

v3: Select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
    on MIPS.

v2: update the commit message to fix typos found by
    Sergei Shtylyov, thank you!

    not longer --> no longer
    there exists --> there exist

 arch/mips/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Bogendoerfer March 29, 2021, 9:24 a.m. UTC | #1
On Thu, Mar 25, 2021 at 08:50:01PM +0800, Tiezhu Yang wrote:
> After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to
> archs where they work"), bpf_probe_read{, str}() functions were no longer
> available on MIPS, so there exist some errors when running bpf program:
> 
> root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
> bpf: Failed to load program: Invalid argument
> [...]
> 11: (85) call bpf_probe_read#4
> unknown func bpf_probe_read#4
> [...]
> Exception: Failed to load BPF program count_sched: Invalid argument
> 
> ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE should be restricted to archs
> with non-overlapping address ranges, but they can overlap in EVA mode
> on MIPS, so select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA in
> arch/mips/Kconfig, otherwise the bpf old helper bpf_probe_read() will
> not be available.
> 
> This is similar with the commit d195b1d1d119 ("powerpc/bpf: Enable
> bpf_probe_read{, str}() on powerpc again").
> 
> Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> 
> v3: Select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
>     on MIPS.
> 
> v2: update the commit message to fix typos found by
>     Sergei Shtylyov, thank you!
> 
>     not longer --> no longer
>     there exists --> there exist
> 
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)

applied to mips-next.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 160b3a8..32158c2 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -6,6 +6,7 @@  config MIPS
 	select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_KCOV
+	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
 	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UBSAN_SANITIZE_ALL