diff mbox series

LoongArch: eBPF: Restrict bpf_probe_read{, str}() only to archs where they work

Message ID 20230726062902.566312-1-zhaochenguang@kylinos.cn (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series LoongArch: eBPF: Restrict bpf_probe_read{, str}() only to archs where they work | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-6 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-17 success Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-19 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-20 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-22 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-29 success Logs for veristat
bpf/vmtest-bpf-next-VM_Test-11 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-18 success Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-24 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-12 success Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for test_maps on s390x with gcc

Commit Message

Chenguang Zhao July 26, 2023, 6:29 a.m. UTC
When we run nettrace on LoongArch, there is a problem that
ERROR: failed to load kprobe-based eBPF
ERROR: failed to load kprobe-based bpf

Because ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE dose not exist,
so we enable it.

The patch reference upstream id 0ebeea8ca8a4d1d453ad299aef0507dab04f6e8d.

Signed-off-by: zhaochenguang <zhaochenguang@kylinos.cn>
---
 arch/loongarch/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

WANG Xuerui July 26, 2023, 7:33 a.m. UTC | #1
On 2023/7/26 14:29, zhaochenguang wrote:
> When we run nettrace on LoongArch, there is a problem that
> ERROR: failed to load kprobe-based eBPF
> ERROR: failed to load kprobe-based bpf
> 
> Because ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE dose not exist,
> so we enable it.
> 
> The patch reference upstream id 0ebeea8ca8a4d1d453ad299aef0507dab04f6e8d.

The description is a bit hard to follow. Rephrasing a bit:

"Currently nettrace does not work on LoongArch due to missing 
bpf_probe_read{,str}() support, with the error message:

     ERROR: failed to load kprobe-based eBPF
     ERROR: failed to load kprobe-based bpf

According to commit 0ebeea8ca8a4d ("bpf: Restrict bpf_probe_read{, 
str}() only to archs where they work"), we only need to select 
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE to add said support, 
because LoongArch does have non-overlapping address ranges for kernel 
and userspace."

Also, the patch subject does not make sense. Looking at precedents such 
as commit 66633abd0642f ("MIPS/bpf: Enable bpf_probe_read{, str}() on 
MIPS again") and commit d195b1d1d1196 ("powerpc/bpf: Enable 
bpf_probe_read{, str}() on powerpc again"), we can instead re-title the 
commit as "LoongArch/bpf: Enable bpf_probe_read{, str}() on LoongArch". 
(No "again" because commit 0ebeea8ca8a4d actually predated the LoongArch 
port.)

> 
> Signed-off-by: zhaochenguang <zhaochenguang@kylinos.cn>
> ---
>   arch/loongarch/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index 903096bd87f8..4a156875e9cc 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -11,6 +11,7 @@ config LOONGARCH
>   	select ARCH_ENABLE_MEMORY_HOTREMOVE
>   	select ARCH_HAS_ACPI_TABLE_UPGRADE	if ACPI
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE

Please keep the list in alphabetical order by moving this one line above.

>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>   	select ARCH_INLINE_READ_LOCK if !PREEMPTION
>   	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
Huacai Chen July 27, 2023, 1:42 a.m. UTC | #2
Hi,

Usually, your E-mail format should be
Chenguang Zhao <zhaochenguang@kylinos.cn>

Huacai

On Wed, Jul 26, 2023 at 2:29 PM zhaochenguang <zhaochenguang@kylinos.cn> wrote:
>
> When we run nettrace on LoongArch, there is a problem that
> ERROR: failed to load kprobe-based eBPF
> ERROR: failed to load kprobe-based bpf
>
> Because ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE dose not exist,
> so we enable it.
>
> The patch reference upstream id 0ebeea8ca8a4d1d453ad299aef0507dab04f6e8d.
>
> Signed-off-by: zhaochenguang <zhaochenguang@kylinos.cn>
> ---
>  arch/loongarch/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index 903096bd87f8..4a156875e9cc 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -11,6 +11,7 @@ config LOONGARCH
>         select ARCH_ENABLE_MEMORY_HOTREMOVE
>         select ARCH_HAS_ACPI_TABLE_UPGRADE      if ACPI
>         select ARCH_HAS_PTE_SPECIAL
> +       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>         select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>         select ARCH_INLINE_READ_LOCK if !PREEMPTION
>         select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
> --
> 2.25.1
>
>
diff mbox series

Patch

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 903096bd87f8..4a156875e9cc 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -11,6 +11,7 @@  config LOONGARCH
 	select ARCH_ENABLE_MEMORY_HOTREMOVE
 	select ARCH_HAS_ACPI_TABLE_UPGRADE	if ACPI
 	select ARCH_HAS_PTE_SPECIAL
+	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_INLINE_READ_LOCK if !PREEMPTION
 	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION