
v10: - Move all bpf progs to samples/bpf/ v9: - Fix the missing of sourcing kernel/bpf-rvi/Kconfig in an existing Kconfig v8: - Move generic_single_iter.c to kernel/bpf-rvi/ - Refine the decompling with CONFIG_PROC_FS v7: - Add bpf_arch_flags to let cpuinfo_x86 get flags from kernel - Decomple CONFIG_BPF_RVI with CONFIG_PROC_FS - Move {bpf,get}_current_level1_reaper() from kernel/pid_namespace.c to kernel/pid.c, as it doesn't depends on CONFIG_PID_NS - Add 'depends on CONFIG_CPUSETS' to CONFIG_BPF_RVI, as we need task_cs(). v6: Don't remove uncompilable bpf progs in selftests, as demanded v5: Merge only cpuinfo_x86 and cpu_online for stage 1 v4: Fix valid checkpatch warnings v3: Add commit message for all commits v2: Add config control for all code --- Common supports: bpf: Add CONFIG_BPF_RVI bpf: Add generic_single_iter bpf: cpuset: Add bpf_cpuset_from_task() kfunc cpuset: Add task_effective_cpumask() bpf: Add bpf_cpumask_weight() kfunc bpf: pidns: Add {bpf,get}_current_level1_reaper() Cpuinfo_x86: selftests/bpf: Avoid building x86 cpuinfo prog for other arch bpf: Add cpuinfo_x86 iterator target bpf: Add bpf_arch_flags kunc for x86 selftests/bpf: Add iterator program for cpuinfo_x86 Cpu_online: selftests/bpf: Add iterator program for cpu_online --- GONG Ruiqi (11): bpf: Add CONFIG_BPF_RVI bpf: Add generic_single_iter bpf: cpuset: Add bpf_cpuset_from_task() kfunc cpuset: Add task_effective_cpumask() bpf: Add bpf_cpumask_weight() kfunc bpf: pidns: Add {bpf,get}_current_level1_reaper() bpf: Add cpuinfo_x86 iterator target bpf: Add bpf_arch_flags kunc for x86 samples/bpf: Add iterator program for cpuinfo_x86 samples/bpf: Add iterator program for cpu_online config: Turn on CONFIG_BPF_RVI for openeuler_defconfig arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + arch/x86/kernel/cpu/Makefile | 1 + arch/x86/kernel/cpu/bpf-rvi.c | 159 +++++++++++++++++++++++ arch/x86/kernel/cpu/proc.c | 2 +- include/linux/cpuset.h | 11 ++ include/linux/pid_namespace.h | 4 + init/Kconfig | 1 + kernel/Makefile | 2 + kernel/bpf-rvi/Kconfig | 19 +++ kernel/bpf-rvi/Makefile | 4 + kernel/bpf-rvi/generic_single_iter.c | 72 +++++++++++ kernel/bpf/helpers.c | 29 +++++ kernel/cgroup/cpuset.c | 50 ++++++++ kernel/pid.c | 25 ++++ samples/bpf/Makefile | 4 + samples/bpf/bpf_rvi_cpu_online.bpf.c | 55 ++++++++ samples/bpf/bpf_rvi_cpuinfo_x86.bpf.c | 169 +++++++++++++++++++++++++ 18 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 arch/x86/kernel/cpu/bpf-rvi.c create mode 100644 kernel/bpf-rvi/Kconfig create mode 100644 kernel/bpf-rvi/Makefile create mode 100644 kernel/bpf-rvi/generic_single_iter.c create mode 100644 samples/bpf/bpf_rvi_cpu_online.bpf.c create mode 100644 samples/bpf/bpf_rvi_cpuinfo_x86.bpf.c -- 2.25.1