[RFC,v2,1/4] irq: Move spurious_deferred bit from BIT(31) to BIT(0)
Commit Message
Makes sure the threads_handled reserve a bit for that.
This will be useful in the next patch in this series.
Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
include/linux/irqdesc.h | 9 +++++++++
kernel/irq/manage.c | 4 ++--
kernel/irq/spurious.c | 6 ++----
3 files changed, 13 insertions(+), 6 deletions(-)
@@ -251,4 +251,13 @@ irq_set_lockdep_class(unsigned int irq, struct lock_class_key *lock_class,
__irq_set_lockdep_class(irq, lock_class, request_class);
}
+#define SPURIOUS_DEFERRED (0x1)
+#define SPURIOUS_DEFERRED_SHIFT (1)
+
+static inline void irq_add_handled(struct irq_desc *desc, int i)
+{
+ i <<= SPURIOUS_DEFERRED_SHIFT;
+ atomic_add(i, &desc->threads_handled);
+}
+
#endif
@@ -1191,7 +1191,7 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action)
local_irq_disable();
ret = action->thread_fn(action->irq, action->dev_id);
if (ret == IRQ_HANDLED)
- atomic_inc(&desc->threads_handled);
+ irq_add_handled(desc, 1);
irq_finalize_oneshot(desc, action);
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
@@ -1212,7 +1212,7 @@ static irqreturn_t irq_thread_fn(struct irq_desc *desc,
ret = action->thread_fn(action->irq, action->dev_id);
if (ret == IRQ_HANDLED)
- atomic_inc(&desc->threads_handled);
+ irq_add_handled(desc, 1);
irq_finalize_oneshot(desc, action);
return ret;
@@ -267,8 +267,6 @@ try_misrouted_irq(unsigned int irq, struct irq_desc *desc,
return action && (action->flags & IRQF_IRQPOLL);
}
-#define SPURIOUS_DEFERRED 0x80000000
-
void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret)
{
unsigned int irq;
@@ -312,7 +310,7 @@ void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret)
if (action_ret == IRQ_WAKE_THREAD) {
int handled;
/*
- * We use bit 31 of thread_handled_last to
+ * We use bit 0 of thread_handled_last to
* denote the deferred spurious detection
* active. No locking necessary as
* thread_handled_last is only accessed here
@@ -328,7 +326,7 @@ void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret)
* returned IRQ_HANDLED since the last
* interrupt happened.
*
- * For simplicity we just set bit 31, as it is
+ * For simplicity we just set bit 0, as it is
* set in threads_handled_last as well. So we
* avoid extra masking. And we really do not
* care about the high bits of the handled