]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rv: Use 0 to check preemption enabled in opid
authorGabriele Monaco <gmonaco@redhat.com>
Mon, 1 Jun 2026 15:38:37 +0000 (17:38 +0200)
committerGabriele Monaco <gmonaco@redhat.com>
Wed, 3 Jun 2026 10:33:25 +0000 (12:33 +0200)
Tracepoint handlers no longer run with preemption disabled by default
since a46023d5616 ("tracing: Guard __DECLARE_TRACE() use of
__DO_TRACE_CALL() with SRCU-fast"), the opid monitor should now count 1
in the preemption count as preemption disabled.

Change the rule for preempt_off to preempt > 0.

Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260601153840.124372-11-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
kernel/trace/rv/monitors/opid/opid.c

index 2922318c611287a82f5ebd547075b8eace9b425d..3b6a85e815b84cef99b8cc82709b54413a80e06e 100644 (file)
@@ -22,14 +22,8 @@ static u64 ha_get_env(struct ha_monitor *ha_mon, enum envs_opid env, u64 time_ns
        if (env == irq_off_opid)
                return irqs_disabled();
        else if (env == preempt_off_opid) {
-               /*
-                * If CONFIG_PREEMPTION is enabled, then the tracepoint itself disables
-                * preemption (adding one to the preempt_count). Since we are
-                * interested in the preempt_count at the time the tracepoint was
-                * hit, we consider 1 as still enabled.
-                */
                if (IS_ENABLED(CONFIG_PREEMPTION))
-                       return (preempt_count() & PREEMPT_MASK) > 1;
+                       return (preempt_count() & PREEMPT_MASK) > 0;
                return true;
        }
        return ENV_INVALID_VALUE;