Skip to contentSkip to conversation

Use 0 to check for preemption enabled in opid

PATCH New Gabriele Monaco 1 participant 1 message May 27

Subsystems (2)
lore
Share & tools
lore

Gabriele Monaco

author maintainer
#0 lore raw

PATCH 1/1 Use 0 to check for preemption enabled in opid

Since tracepoint handlers no longer run with preemption disabled by default, the opid monitor should count 1 in the preemption count as preemption disabled.

Change the rule for preempt_off to preempt > 0.

---

Forgot to add this commit to the fixes series. This is required since opid was merged with the commits enabling preemption in tracepoints, similarly to "rv: Prevent task migration while handling per-CPU events"

---
 kernel/trace/rv/monitors/opid/opid.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
kernel/trace/rv/monitors/opid/opid.c +1 -7
index 2922318c6112..3b6a85e815b8 100644
@@ -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;

base-commit: 8bc67e4db64aa72732c474b44ea8622062c903f0

Signature · 1 line
2.54.0