tools/testing/selftests/bpf/progs/cpumask_success.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/cpumask_success.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/cpumask_success.c- Extension
.c- Size
- 18457 bytes
- Lines
- 891
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hbpf/bpf_tracing.hbpf/bpf_helpers.hbpf_misc.hcpumask_common.h
Detected Declarations
struct kptr_nestedstruct kptr_nested_pairstruct kptr_nested_midstruct kptr_nested_deepstruct kptr_nested_deep_array_1_2struct kptr_nested_deep_array_1_1struct kptr_nested_deep_array_1struct kptr_nested_deep_array_2_2struct kptr_nested_deep_array_2_1struct kptr_nested_deep_array_2struct kptr_nested_deep_array_3_2struct kptr_nested_deep_array_3_1struct kptr_nested_deep_array_3function is_test_taskfunction create_cpumask_setfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction _global_mask_array_rcufunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction bpf_kptr_xchgfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction BPF_PROGfunction SECfunction bpf_for
Annotated Snippet
struct kptr_nested {
struct bpf_cpumask __kptr * mask;
};
struct kptr_nested_pair {
struct bpf_cpumask __kptr * mask_1;
struct bpf_cpumask __kptr * mask_2;
};
struct kptr_nested_mid {
int dummy;
struct kptr_nested m;
};
struct kptr_nested_deep {
struct kptr_nested_mid ptrs[2];
struct kptr_nested_pair ptr_pairs[3];
};
struct kptr_nested_deep_array_1_2 {
int dummy;
struct bpf_cpumask __kptr * mask[CPUMASK_KPTR_FIELDS_MAX];
};
struct kptr_nested_deep_array_1_1 {
int dummy;
struct kptr_nested_deep_array_1_2 d_2;
};
struct kptr_nested_deep_array_1 {
long dummy;
struct kptr_nested_deep_array_1_1 d_1;
};
struct kptr_nested_deep_array_2_2 {
long dummy[2];
struct bpf_cpumask __kptr * mask;
};
struct kptr_nested_deep_array_2_1 {
int dummy;
struct kptr_nested_deep_array_2_2 d_2[CPUMASK_KPTR_FIELDS_MAX];
};
struct kptr_nested_deep_array_2 {
long dummy;
struct kptr_nested_deep_array_2_1 d_1;
};
struct kptr_nested_deep_array_3_2 {
long dummy[2];
struct bpf_cpumask __kptr * mask;
};
struct kptr_nested_deep_array_3_1 {
int dummy;
struct kptr_nested_deep_array_3_2 d_2;
};
struct kptr_nested_deep_array_3 {
long dummy;
struct kptr_nested_deep_array_3_1 d_1[CPUMASK_KPTR_FIELDS_MAX];
};
private(MASK) static struct bpf_cpumask __kptr * global_mask_array[2];
private(MASK) static struct bpf_cpumask __kptr * global_mask_array_l2[2][1];
private(MASK) static struct bpf_cpumask __kptr * global_mask_array_one[1];
private(MASK) static struct kptr_nested global_mask_nested[2];
private(MASK_DEEP) static struct kptr_nested_deep global_mask_nested_deep;
private(MASK_1) static struct kptr_nested_deep_array_1 global_mask_nested_deep_array_1;
private(MASK_2) static struct kptr_nested_deep_array_2 global_mask_nested_deep_array_2;
private(MASK_3) static struct kptr_nested_deep_array_3 global_mask_nested_deep_array_3;
static bool is_test_task(void)
{
int cur_pid = bpf_get_current_pid_tgid() >> 32;
return pid == cur_pid;
}
static bool create_cpumask_set(struct bpf_cpumask **out1,
struct bpf_cpumask **out2,
struct bpf_cpumask **out3,
struct bpf_cpumask **out4)
{
struct bpf_cpumask *mask1, *mask2, *mask3, *mask4;
mask1 = create_cpumask();
if (!mask1)
return false;
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_tracing.h`, `bpf/bpf_helpers.h`, `bpf_misc.h`, `cpumask_common.h`.
- Detected declarations: `struct kptr_nested`, `struct kptr_nested_pair`, `struct kptr_nested_mid`, `struct kptr_nested_deep`, `struct kptr_nested_deep_array_1_2`, `struct kptr_nested_deep_array_1_1`, `struct kptr_nested_deep_array_1`, `struct kptr_nested_deep_array_2_2`, `struct kptr_nested_deep_array_2_1`, `struct kptr_nested_deep_array_2`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.