[DTrace-devel] [PATCH v2 3/4] bpf: allocate the buffers BPF map to fit highest CPU id
Kris Van Hees
kris.van.hees at oracle.com
Wed Dec 17 05:10:01 UTC 2025
Even when less than the possible number of CPUs are online, the 'buffers'
BPF map should be allocated based on the highest possible CPU id because
probe data is written to the bufer that corresponds to a given CPU id,
which could be part of non-sequential CPU id configurations.
The observed problem was on a system with 128 possible CPUs (0-127), but
only CPUs 0-7,100-107 were online. The 'buffers' BPF map was created with
space to hold 16 trace data buffers (one for each online CPU), and since it
is an array map, this caused the trace buffers for CPUs 100-107 to fail to
allocate buffers, which in turn caused any trace data generated for those
CPUs never to get reported. Since 'buffers' is an array map accessed by
CPU id, enough space must be allocated to accomodate the highest online
CPU id.
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
libdtrace/dt_bpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
index 0a57b7d2..6568a572 100644
--- a/libdtrace/dt_bpf.c
+++ b/libdtrace/dt_bpf.c
@@ -755,7 +755,7 @@ gmap_create_buffers(dtrace_hdl_t *dtp)
{
return create_gmap(dtp, "buffers", BPF_MAP_TYPE_PERF_EVENT_ARRAY,
sizeof(uint32_t), sizeof(uint32_t),
- dtp->dt_conf.num_online_cpus);
+ dtp->dt_conf.max_cpuid);
}
/*
--
2.51.0
More information about the DTrace-devel
mailing list