Commit 397d3f0d authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior
Browse files

irq_work: Also rcuwait for !IRQ_WORK_HARD_IRQ on PREEMPT_RT



On PREEMPT_RT most items are processed as LAZY via softirq context.
Avoid to spin-wait for them because irq_work_sync() could have higher
priority and not allow the irq-work to be completed.

Wait additionally for !IRQ_WORK_HARD_IRQ irq_work items on PREEMPT_RT.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
parent 1ab991dc
...@@ -49,6 +49,11 @@ static inline bool irq_work_is_busy(struct irq_work *work) ...@@ -49,6 +49,11 @@ static inline bool irq_work_is_busy(struct irq_work *work)
return atomic_read(&work->node.a_flags) & IRQ_WORK_BUSY; return atomic_read(&work->node.a_flags) & IRQ_WORK_BUSY;
} }
static inline bool irq_work_is_hard(struct irq_work *work)
{
return atomic_read(&work->node.a_flags) & IRQ_WORK_HARD_IRQ;
}
bool irq_work_queue(struct irq_work *work); bool irq_work_queue(struct irq_work *work);
bool irq_work_queue_on(struct irq_work *work, int cpu); bool irq_work_queue_on(struct irq_work *work, int cpu);
......
...@@ -182,7 +182,8 @@ void irq_work_single(void *arg) ...@@ -182,7 +182,8 @@ void irq_work_single(void *arg)
*/ */
(void)atomic_cmpxchg(&work->node.a_flags, flags, flags & ~IRQ_WORK_BUSY); (void)atomic_cmpxchg(&work->node.a_flags, flags, flags & ~IRQ_WORK_BUSY);
if (!arch_irq_work_has_interrupt()) if ((IS_ENABLED(CONFIG_PREEMPT_RT) && !irq_work_is_hard(work)) ||
!arch_irq_work_has_interrupt())
rcuwait_wake_up(&work->irqwait); rcuwait_wake_up(&work->irqwait);
} }
...@@ -252,7 +253,8 @@ void irq_work_sync(struct irq_work *work) ...@@ -252,7 +253,8 @@ void irq_work_sync(struct irq_work *work)
lockdep_assert_irqs_enabled(); lockdep_assert_irqs_enabled();
might_sleep(); might_sleep();
if (!arch_irq_work_has_interrupt()) { if ((IS_ENABLED(CONFIG_PREEMPT_RT) && !irq_work_is_hard(work)) ||
!arch_irq_work_has_interrupt()) {
rcuwait_wait_event(&work->irqwait, !irq_work_is_busy(work), rcuwait_wait_event(&work->irqwait, !irq_work_is_busy(work),
TASK_UNINTERRUPTIBLE); TASK_UNINTERRUPTIBLE);
return; return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment