diff options
| author | Yonghong Song <[email protected]> | 2023-08-27 15:27:49 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2023-09-08 15:42:17 +0000 |
| commit | 01cc55af93884f1ff5a883426e1924378dfcc62a (patch) | |
| tree | 44ea4543318d9bb06d96549b913c29658f594f03 /tools/testing/selftests/bpf/progs/percpu_alloc_array.c | |
| parent | bpf: Add alloc/xchg/direct_access support for local percpu kptr (diff) | |
| download | kernel-01cc55af93884f1ff5a883426e1924378dfcc62a.tar.gz kernel-01cc55af93884f1ff5a883426e1924378dfcc62a.zip | |
bpf: Add bpf_this_cpu_ptr/bpf_per_cpu_ptr support for allocated percpu obj
The bpf helpers bpf_this_cpu_ptr() and bpf_per_cpu_ptr() are re-purposed
for allocated percpu objects. For an allocated percpu obj,
the reg type is 'PTR_TO_BTF_ID | MEM_PERCPU | MEM_RCU'.
The return type for these two re-purposed helpera is
'PTR_TO_MEM | MEM_RCU | MEM_ALLOC'.
The MEM_ALLOC allows that the per-cpu data can be read and written.
Since the memory allocator bpf_mem_alloc() returns
a ptr to a percpu ptr for percpu data, the first argument
of bpf_this_cpu_ptr() and bpf_per_cpu_ptr() is patched
with a dereference before passing to the helper func.
Signed-off-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/percpu_alloc_array.c')
0 files changed, 0 insertions, 0 deletions
