Skip to contentSkip to conversation

4.9.263-rt177: Balance local_irq_{disable,enable} in irq_forced_thread_fn

PATCH In review Joe Korty 3 participants 4 messages Apr 27, 2021 – Apr 30, 2021 IRQ

lore
Share & tools
lore

Joe Korty

author
#0 lore raw

PATCH 1/1 4.9.263-rt177: Balance local_irq_{disable,enable} in irq_forced_thread_fn

Balance local_irq_{disable,enable} usage in irq_forced_thread_fn

Re: 0152-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch

In 4.9.263-rt177, irq_forced_thread_fn has potentially unbalanced calls to local_irq_disable ... local_irq_enable. This is probably not intentional.

I am not absolutely sure what the proper fix is. Attached is an example of what that might look like.

[ Issue detected via compiler warning, using a sufficiently advanced gcc ]

kernel/irq/manage.c +3 -2
Index: b/kernel/irq/manage.c
===================================================================
@@ -1035,6 +1035,9 @@ irq_forced_thread_fn(struct irq_desc *de
 		atomic_inc(&desc->threads_handled);
 
 	irq_finalize_oneshot(desc, action);
+
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
+		local_irq_enable();
 	/*
 	 * Interrupts which have real time requirements can be set up
 	 * to avoid softirq processing in the thread handler. This is
@@ -1043,8 +1046,6 @@ irq_forced_thread_fn(struct irq_desc *de
 	if (irq_settings_no_softirq_call(desc))
 		_local_bh_enable();
 	else
-		if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
-			local_irq_enable();
 		local_bh_enable();
 	return ret;
 }
#1 lore raw
Quoted 7 lines · Joe Korty

Balance local_irq_{disable,enable} usage in irq_forced_thread_fn

Re: 0152-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch

In 4.9.263-rt177, irq_forced_thread_fn has potentially unbalanced calls to local_irq_disable ... local_irq_enable. This is probably not intentional.

Quoted 6 lines

I am not absolutely sure what the proper fix is. Attached is an example of what that might look like.

[ Issue detected via compiler warning, using a sufficiently advanced gcc ]

Joe, I fell a bit behind on v4.9-rt and intend to get up to date this weekend. I am now satisfied with my current backport of the futex changes from v4.9.264 and my 96h of pi_stress testing.

Your patch makes sense, taking v4.19-rt as reference, but I will wait for comments from the wise people you listed on the Cc: before taking action.

Best regards,
Luis

Quoted 16 lines

Index: b/kernel/irq/manage.c
===================================================================

kernel/irq/manage.c +3 -0
@@ -1035,6 +1035,9 @@ irq_forced_thread_fn(struct irq_desc *de
 		atomic_inc(&desc->threads_handled);
 
 	irq_finalize_oneshot(desc, action);
+
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
+		local_irq_enable();
 	/*
 	 * Interrupts which have real time requirements can be set up
 	 * to avoid softirq processing in the thread handler. This is

kernel/irq/manage.c irq_forced_thread_fn(struct irq_desc *de · line 1051

Quoted 8 lines
kernel/irq/manage.c +0 -2
@@ -1043,8 +1046,6 @@ irq_forced_thread_fn(struct irq_desc *de
 	if (irq_settings_no_softirq_call(desc))
 		_local_bh_enable();
 	else
-		if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
-			local_irq_enable();
 		local_bh_enable();
 	return ret;
 }

---end quoted text---

#2 lore raw

Hi,

Quoted 15 lines · Luis Claudio R. Goncalves
Quoted 7 lines · Joe Korty

Balance local_irq_{disable,enable} usage in irq_forced_thread_fn

Re: 0152-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch

In 4.9.263-rt177, irq_forced_thread_fn has potentially unbalanced calls to local_irq_disable ... local_irq_enable. This is probably not intentional.

Quoted 6 lines

I am not absolutely sure what the proper fix is. Attached is an example of what that might look like.

[ Issue detected via compiler warning, using a sufficiently advanced gcc ]

Quoted 7 lines

Joe, I fell a bit behind on v4.9-rt and intend to get up to date this weekend. I am now satisfied with my current backport of the futex changes from v4.9.264 and my 96h of pi_stress testing.

Your patch makes sense, taking v4.19-rt as reference, but I will wait for comments from the wise people you listed on the Cc: before taking action.

I had to resolve the same merge conflict in v4.4-rt. The fix from Joe resolve to the same solution I've done in v4.4-rt

Quoted 12 lines

Best regards,
Luis

Quoted 8 lines

Index: b/kernel/irq/manage.c
===================================================================

kernel/irq/manage.c +0 -0
@@ -1035,6 +1035,9 @@ irq_forced_thread_fn(struct irq_desc *de
 		atomic_inc(&desc->threads_handled);
 
Quoted 2 lines

kernel/irq/manage.c irq_forced_thread_fn(struct irq_desc *de · line 1038

Quoted 2 lines
kernel/irq/manage.c +1 -0
 	irq_finalize_oneshot(desc, action);
+

Nit there is no new line here in upstream, dd652c6ab49b ("genirq:
Disable interrupts for force threaded handlers")

Quoted 7 lines
Quoted 7 lines
kernel/irq/manage.c +2 -0
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
+		local_irq_enable();
 	/*
 	 * Interrupts which have real time requirements can be set up
 	 * to avoid softirq processing in the thread handler. This is
@@ -1043,8 +1046,6 @@ irq_forced_thread_fn(struct irq_desc *de
 	if (irq_settings_no_softirq_call(desc))
Quoted 8 lines

kernel/irq/manage.c irq_forced_thread_fn(struct irq_desc *de · line 1051

Quoted 7 lines
kernel/irq/manage.c +0 -2
 		_local_bh_enable();
 	else
-		if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
-			local_irq_enable();
 		local_bh_enable();
 	return ret;
 }

---end quoted text---

Thanks,
Daniel

#3 lore raw
Quoted 22 lines · Daniel Wagner

Hi,

Quoted 19 lines · Luis Claudio R. Goncalves
Quoted 7 lines · Joe Korty

Balance local_irq_{disable,enable} usage in irq_forced_thread_fn

Re: 0152-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch

In 4.9.263-rt177, irq_forced_thread_fn has potentially unbalanced calls to local_irq_disable ... local_irq_enable. This is probably not intentional.

Quoted 6 lines

I am not absolutely sure what the proper fix is. Attached is an example of what that might look like.

[ Issue detected via compiler warning, using a sufficiently advanced gcc ]

Joe, I fell a bit behind on v4.9-rt and intend to get up to date this weekend. I am now satisfied with my current backport of the futex changes from v4.9.264 and my 96h of pi_stress testing.

Quoted 6 lines
Quoted 3 lines

Your patch makes sense, taking v4.19-rt as reference, but I will wait for comments from the wise people you listed on the Cc: before taking action.

I had to resolve the same merge conflict in v4.4-rt. The fix from Joe resolve to the same solution I've done in v4.4-rt

I will add this patch to the next v4.9-rt without the extra empty line.

Thank you both,
Luis

Quoted 34 lines
Quoted 12 lines

Best regards,
Luis

Quoted 8 lines

Index: b/kernel/irq/manage.c
===================================================================

kernel/irq/manage.c +0 -0
@@ -1035,6 +1035,9 @@ irq_forced_thread_fn(struct irq_desc *de
 		atomic_inc(&desc->threads_handled);
 
Quoted 2 lines

kernel/irq/manage.c irq_forced_thread_fn(struct irq_desc *de · line 1038

Quoted 2 lines
kernel/irq/manage.c +1 -0
 	irq_finalize_oneshot(desc, action);
+

Nit there is no new line here in upstream, dd652c6ab49b ("genirq:
Disable interrupts for force threaded handlers")

Quoted 7 lines
Quoted 7 lines
kernel/irq/manage.c +2 -0
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
+		local_irq_enable();
 	/*
 	 * Interrupts which have real time requirements can be set up
 	 * to avoid softirq processing in the thread handler. This is
@@ -1043,8 +1046,6 @@ irq_forced_thread_fn(struct irq_desc *de
 	if (irq_settings_no_softirq_call(desc))
Quoted 8 lines

kernel/irq/manage.c irq_forced_thread_fn(struct irq_desc *de · line 1051

Quoted 7 lines
kernel/irq/manage.c +0 -2
 		_local_bh_enable();
 	else
-		if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
-			local_irq_enable();
 		local_bh_enable();
 	return ret;
 }

---end quoted text---

Quoted 2 lines

Thanks,
Daniel

---end quoted text---