Skip to content

Commit 20ea0f4

Browse files
mbertroneclaude
andcommitted
fix(gpu): gate the event monitor on enable_ebpf_probes
The event monitor is only used to feed the GPU monitoring eBPF probes with process exec/exit events, but both the system-probe module gate and the consumer creation were keyed on gpu_monitoring.enabled alone. A host running GPU monitoring through NVML only therefore still loaded the event monitor's eBPF programs and built a process consumer that nothing read. Gate both on gpu_monitoring.enable_ebpf_probes as well. The two have to move together to stay consistent with the EnableEBPFProbes && processEventConsumer == nil guard in the GPU module factory. The GPU module itself is still gated on gpu_monitoring.enabled, so NVML-based collection is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent bcf5977 commit 20ea0f4

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

cmd/system-probe/modules/eventmonitor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ func createEventMonitorModule(_ *sysconfigtypes.Config, deps module.FactoryDepen
133133
}
134134

135135
gpucfg := gpuconfig.New()
136-
if gpucfg.Enabled {
136+
// Only the eBPF probes consume these events, so skip the consumer entirely
137+
// when they are disabled. Kept in sync with the module gate in
138+
// pkg/system-probe/config, which does not enable the event monitor for GPU
139+
// monitoring unless the probes are enabled too.
140+
if gpucfg.Enabled && gpucfg.EnableEBPFProbes {
137141
err := createGPUProcessEventConsumer(evm)
138142
if err != nil {
139143
return nil, fmt.Errorf("cannot create event consumer for GPU: %w", err)

pkg/system-probe/config/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ func load() (*types.Config, error) {
126126
eudmEnabled := coreCfg.GetString("infrastructure_mode") == "end_user_device"
127127
csmEnabled := cfg.GetBool(secNS("enabled"))
128128
gpuEnabled := cfg.GetBool(gpuNS("enabled"))
129+
// The GPU module only consumes process events when its eBPF probes are
130+
// loaded, so the event monitor is only needed for that combination.
131+
gpuEBPFProbesEnabled := gpuEnabled && cfg.GetBool(gpuNS("enable_ebpf_probes"))
129132
diEnabled := cfg.GetBool(diNS("enabled"))
130133
swEnabled := coreCfg.GetBool(swNS("enabled"))
131134
discoveryServiceMapEnabled := cfg.GetBool(discoveryNS("service_map", "enabled"))
@@ -144,7 +147,7 @@ func load() (*types.Config, error) {
144147
coreCfg.GetBool("sbom.enrichment.usage.enabled") ||
145148
(usmEnabled && cfg.GetBool(smNS("enable_event_stream"))) ||
146149
(c.ModuleIsEnabled(NetworkTracerModule) && cfg.GetBool(evNS("network_process.enabled"))) ||
147-
gpuEnabled ||
150+
gpuEBPFProbesEnabled ||
148151
diEnabled {
149152
c.EnabledModules[EventMonitorModule] = struct{}{}
150153
}

pkg/system-probe/config/config_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func TestEventMonitor(t *testing.T) {
2323

2424
for i, tc := range []struct {
2525
cws, fim, networkEvents, gpu bool
26+
gpuEBPFProbes bool
2627
usmEvents bool
2728
enabled bool
2829
}{
@@ -34,7 +35,11 @@ func TestEventMonitor(t *testing.T) {
3435
{cws: false, fim: true, networkEvents: true, enabled: true},
3536
{cws: true, fim: false, networkEvents: true, enabled: true},
3637
{cws: true, fim: true, networkEvents: true, enabled: true},
37-
{cws: false, fim: false, networkEvents: false, gpu: true, enabled: true},
38+
// GPU monitoring only needs the event monitor to feed its eBPF probes,
39+
// so both settings have to be enabled for the module to be pulled in.
40+
{cws: false, fim: false, networkEvents: false, gpu: true, gpuEBPFProbes: true, enabled: true},
41+
{cws: false, fim: false, networkEvents: false, gpu: true, gpuEBPFProbes: false, enabled: false},
42+
{cws: false, fim: false, networkEvents: false, gpu: false, gpuEBPFProbes: true, enabled: false},
3843
{usmEvents: true, enabled: true},
3944
} {
4045
t.Run(strconv.Itoa(i), func(t *testing.T) {
@@ -44,6 +49,9 @@ func TestEventMonitor(t *testing.T) {
4449
t.Setenv("DD_SYSTEM_PROBE_EVENT_MONITORING_NETWORK_PROCESS_ENABLED", strconv.FormatBool(tc.networkEvents))
4550
t.Setenv("DD_SYSTEM_PROBE_NETWORK_ENABLED", strconv.FormatBool(tc.networkEvents))
4651
t.Setenv("DD_GPU_MONITORING_ENABLED", strconv.FormatBool(tc.gpu))
52+
// Set explicitly rather than relying on the default, which is
53+
// subject to change as the eBPF probes are deprecated.
54+
t.Setenv("DD_GPU_MONITORING_ENABLE_EBPF_PROBES", strconv.FormatBool(tc.gpuEBPFProbes))
4755
t.Setenv("DD_SYSTEM_PROBE_SERVICE_MONITORING_ENABLED", strconv.FormatBool(tc.usmEvents))
4856
t.Setenv("DD_SERVICE_MONITORING_CONFIG_ENABLE_EVENT_STREAM", strconv.FormatBool(tc.usmEvents))
4957

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
enhancements:
3+
- |
4+
GPU Monitoring no longer starts the system-probe event monitor when
5+
``gpu_monitoring.enable_ebpf_probes`` is disabled, as only the eBPF probes
6+
consume its process events. Hosts running GPU Monitoring through NVML alone
7+
no longer load the event monitor's eBPF programs.

0 commit comments

Comments
 (0)