2023-07-27 04:30:12

by Chenguang Zhao

[permalink] [raw]
Subject: [PATCH v2] LoongArch/bpf: Enable bpf_probe_read{, str}() on LoongArch

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.

Signed-off-by: Chenguang Zhao <[email protected]>
---
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



2023-07-27 06:43:53

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH v2] LoongArch/bpf: Enable bpf_probe_read{, str}() on LoongArch

Queued for loongarch-next, thanks.

Huacai

On Thu, Jul 27, 2023 at 12:21 PM Chenguang Zhao
<[email protected]> wrote:
>
> 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.
>
> Signed-off-by: Chenguang Zhao <[email protected]>
> ---
> 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
>