diff --git a/backport-sync-the-newly-added-helper-functions-from-kernel.patch b/backport-sync-the-newly-added-helper-functions-from-kernel.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0d35025b5ca74db9e5b3c7860623e1af82723ca --- /dev/null +++ b/backport-sync-the-newly-added-helper-functions-from-kernel.patch @@ -0,0 +1,190 @@ +From a0803c536aff35a26b18fed66125a4b84e69ee69 Mon Sep 17 00:00:00 2001 +From: Liu Jian +Date: Tue, 13 Jun 2023 23:50:31 +0800 +Subject: [PATCH] sync the newly added helper functions from kernel + +Signed-off-by: Liu Jian +--- + src/bpf_helper_defs.h | 169 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 169 insertions(+) + +diff --git a/src/bpf_helper_defs.h b/src/bpf_helper_defs.h +index c8b3b33..a95379b 100644 +--- a/src/bpf_helper_defs.h ++++ b/src/bpf_helper_defs.h +@@ -3679,3 +3679,172 @@ static __u64 (*bpf_get_sockops_uid_gid)(void *sockops) = (void *) 156; + */ + static int (*bpf_sk_original_addr)(void *bpf_socket, int optname, char *optval, int optlen) = (void *) 157; + ++/* ++ * bpf_sched_tg_tag_of ++ * ++ * Return task group tag of *tg* if CONFIG_CGROUP_SCHED enabled. ++ * The bpf prog obtains the tags to detect different workloads. ++ * ++ * Returns ++ * Task group tag, if CONFIG_CGROUP_SCHED enabled, 0 as default tag, or ++ * a negative error in case of failure. ++ */ ++static long (*bpf_sched_tg_tag_of)(struct task_group *tg) = (void *) 158; ++ ++/* ++ * bpf_sched_task_tag_of ++ * ++ * Return task tag of *tsk*.The bpf prog obtains the tags to detect ++ * different workloads. ++ * ++ * Returns ++ * Task tag, if used, 0 as default tag, or a negative error in case of failure. ++ */ ++static long (*bpf_sched_task_tag_of)(struct task_struct *tsk) = (void *) 159; ++ ++/* ++ * bpf_sched_set_tg_tag ++ * ++ * Set tag to *tg* and its descendants. ++ * ++ * Returns ++ * 0 on success, or a negative error in case of failure. ++ */ ++static int (*bpf_sched_set_tg_tag)(struct task_group *tg, __s64 tag) = (void *) 160; ++ ++/* ++ * bpf_sched_set_task_tag ++ * ++ * Set tag to *tsk*. ++ * ++ * Returns ++ * 0 on success, or a negative error in case of failure. ++ */ ++static int (*bpf_sched_set_task_tag)(struct task_struct *tsk, __s64 tag) = (void *) 161; ++ ++/* ++ * bpf_sched_cpu_stats_of ++ * ++ * Get multiple types of *cpu* statistics and store in *ctx*. ++ * ++ * Returns ++ * 0 on success, or a negative error in case of failure. ++ */ ++static int (*bpf_sched_cpu_stats_of)(int cpu, struct bpf_sched_cpu_stats *ctx, int len) = (void *) 162; ++ ++/* ++ * bpf_init_cpu_topology ++ * ++ * Initializing the cpu topology which used for bpf prog. ++ * ++ * Returns ++ * 0 on success, or a negative error in case of failure. ++ */ ++static long (*bpf_init_cpu_topology)(void *map) = (void *) 163; ++ ++/* ++ * bpf_get_cpumask_info ++ * ++ * Get system cpus returned in *cpus*. ++ * ++ * Returns ++ * 0 on success, or a negative error in case of failure. ++ */ ++static int (*bpf_get_cpumask_info)(void *map, struct bpf_cpumask_info *cpus) = (void *) 164; ++ ++/* ++ * bpf_sched_entity_is_task ++ * ++ * Checks whether the sched entity is a task. ++ * ++ * Returns ++ * 1 if true, 0 otherwise. ++ */ ++static long (*bpf_sched_entity_is_task)(struct sched_entity *se) = (void *) 165; ++ ++/* ++ * bpf_sched_entity_to_task ++ * ++ * Return task struct of *se* if se is a task. ++ * ++ * Returns ++ * Task struct if se is a task, NULL otherwise. ++ */ ++static struct task_struct *(*bpf_sched_entity_to_task)(struct sched_entity *se) = (void *) 166; ++ ++/* ++ * bpf_sched_entity_to_tg ++ * ++ * Return task group of *se* if se is a task group. ++ * ++ * Returns ++ * Task struct if se is a task group, NULL otherwise. ++ */ ++static struct task_group *(*bpf_sched_entity_to_tg)(struct sched_entity *se) = (void *) 167; ++ ++/* ++ * bpf_cpumask_op ++ * ++ * A series of cpumask-related operations. Perform different ++ * operations base on *op*->type. User also need fill other ++ * *op* field base on *op*->type. *op*->type is one of them ++ * ++ * **CPUMASK_EMPTY** ++ * *(op->arg1) == 0 returned. ++ * **CPUMASK_AND** ++ * *(op->arg1) = *(op->arg2) & *(op->arg3) ++ * **CPUMASK_ANDNOT** ++ * *(op->arg1) = *(op->arg2) & ~*(op->arg3) ++ * **CPUMASK_SUBSET** ++ * *(op->arg1) & ~*(op->arg2) == 0 returned ++ * **CPUMASK_EQUAL** ++ * *(op->arg1) == *(op->arg2) returned ++ * **CPUMASK_TEST_CPU** ++ * test for a cpu *(int)(op->arg1) in *(op->arg2) ++ * returns 1 if *op*->arg1 is set in *op*->arg2, else returns 0 ++ * **CPUMASK_COPY** ++ * *(op->arg1) = *(op->arg2), return 0 always ++ * **CPUMASK_WEIGHT** ++ * count of bits in *(op->arg1) ++ * **CPUMASK_NEXT** ++ * get the next cpu in *(struct cpumask *)(op->arg2) ++ * *(int *)(op->arg1): the cpu prior to the place to search ++ * **CPUMASK_NEXT_WRAP** ++ * helper to implement for_each_cpu_wrap ++ * @op->arg1: the cpu prior to the place to search ++ * @op->arg2: the cpumask pointer ++ * @op->arg3: the start point of the iteration ++ * @op->arg4: assume @op->arg1 crossing @op->arg3 terminates the iteration ++ * returns >= nr_cpu_ids on completion ++ * **CPUMASK_NEXT_AND** ++ * get the next cpu in *(op->arg1) & *(op->arg2) ++ * **CPUMASK_CPULIST_PARSE** ++ * extract a cpumask from a user string of ranges. ++ * (char *)op->arg1 -> (struct cpumask *)(op->arg2) ++ * 0 on success, or a negative error in case of failure. ++ * ++ * Returns ++ * View above. ++ */ ++static int (*bpf_cpumask_op)(struct cpumask_op_args *op, int len) = (void *) 168; ++ ++/* ++ * bpf_cpus_share_cache ++ * ++ * check src_cpu whether share cache with dst_cpu. ++ * ++ * Returns ++ * true yes, false no. ++ */ ++static int (*bpf_cpus_share_cache)(int src_cpu, int dst_cpu) = (void *) 169; ++ ++/* ++ * bpf_is_local_ipaddr ++ * ++ * Check the ipaddr is local address or not. ++ * ++ * Returns ++ * 1 is local address, 0 is not. ++ */ ++static long (*bpf_is_local_ipaddr)(__u32 ipaddr) = (void *) 170; ++ +-- +2.34.1 + diff --git a/libbpf.spec b/libbpf.spec index 61fa29e7239783b9b4bb25636ed69ed74cfc82e4..37b2780333ebb75c30f9e073f14049258de2d6e0 100644 --- a/libbpf.spec +++ b/libbpf.spec @@ -4,7 +4,7 @@ Name: %{githubname} Version: %{githubver} -Release: 9 +Release: 10 Summary: Libbpf library License: LGPLv2 or BSD @@ -32,6 +32,7 @@ Patch0015: backport-libbpf-disassociate-section-handler-on-explicit-bpf_.pa Patch0016: backport-libbpf-Use-correct-return-pointer-in-attach_raw_tp.patch Patch0017: backport-libbpf-Use-elf_getshdrnum-instead-of-e_shnum.patch Patch0018: 0001-remove-nonexistent-helper-functions-and-add-new-help.patch +Patch0019: backport-sync-the-newly-added-helper-functions-from-kernel.patch # This package supersedes libbpf from kernel-tools, # which has default Epoch: 0. By having Epoch: 1 @@ -84,6 +85,10 @@ developing applications that use %{name} %{_libdir}/libbpf.a %changelog +* Wed Jun 14 2023 Qingqing Li -2:0.8.1-10 +- backport patch from openEuler kernel repo: + backport-sync-the-newly-added-helper-functions-from-kernel.patch + * Mon May 29 2023 JofDiamonds -2:0.8.1-9 - remove nonexistent helper functions and add new helper functions