hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8TP4Z
--------------------------------
We reserve some fields beforehand for cgroup_bpf_attach_type bpf_cgroup_storage_type prone and struct cgroup_bpf to change, therefore, we can hot add/change features of bpf cgroup with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
Signed-off-by: Lu Jialin lujialin4@huawei.com --- include/linux/bpf-cgroup-defs.h | 20 ++++++++++++++++++++ include/linux/bpf.h | 11 +++++++++++ 2 files changed, 31 insertions(+)
diff --git a/include/linux/bpf-cgroup-defs.h b/include/linux/bpf-cgroup-defs.h index 7b121bd780eb..ed04fe751dd0 100644 --- a/include/linux/bpf-cgroup-defs.h +++ b/include/linux/bpf-cgroup-defs.h @@ -7,6 +7,7 @@ #include <linux/list.h> #include <linux/percpu-refcount.h> #include <linux/workqueue.h> +#include <linux/kabi.h>
struct bpf_prog_array;
@@ -44,6 +45,16 @@ enum cgroup_bpf_attach_type { CGROUP_INET_SOCK_RELEASE, CGROUP_LSM_START, CGROUP_LSM_END = CGROUP_LSM_START + CGROUP_LSM_NUM - 1, +#ifdef CONFIG_KABI_RESERVE + CGROUP_ATTACH_TYPE_KABI_RESERVE_1, + CGROUP_ATTACH_TYPE_KABI_RESERVE_2, + CGROUP_ATTACH_TYPE_KABI_RESERVE_3, + CGROUP_ATTACH_TYPE_KABI_RESERVE_4, + CGROUP_ATTACH_TYPE_KABI_RESERVE_5, + CGROUP_ATTACH_TYPE_KABI_RESERVE_6, + CGROUP_ATTACH_TYPE_KABI_RESERVE_7, + CGROUP_ATTACH_TYPE_KABI_RESERVE_8, +#endif MAX_CGROUP_BPF_ATTACH_TYPE };
@@ -70,6 +81,15 @@ struct cgroup_bpf {
/* cgroup_bpf is released using a work queue */ struct work_struct release_work; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
#else /* CONFIG_CGROUP_BPF */ diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 392f581af2ce..5ac22a961534 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -29,6 +29,7 @@ #include <linux/rcupdate_trace.h> #include <linux/static_call.h> #include <linux/memcontrol.h> +#include <linux/kabi.h>
struct bpf_verifier_env; struct bpf_verifier_log; @@ -974,6 +975,16 @@ struct bpf_prog_offload { enum bpf_cgroup_storage_type { BPF_CGROUP_STORAGE_SHARED, BPF_CGROUP_STORAGE_PERCPU, +#ifdef CONFIG_KABI_RESERVE + BPF_CGROUP_STORAGE_KABI_RESERVE_1, + BPF_CGROUP_STORAGE_KABI_RESERVE_2, + BPF_CGROUP_STORAGE_KABI_RESERVE_3, + BPF_CGROUP_STORAGE_KABI_RESERVE_4, + BPF_CGROUP_STORAGE_KABI_RESERVE_5, + BPF_CGROUP_STORAGE_KABI_RESERVE_6, + BPF_CGROUP_STORAGE_KABI_RESERVE_7, + BPF_CGROUP_STORAGE_KABI_RESERVE_8, +#endif __BPF_CGROUP_STORAGE_MAX };