Re: [PATCH] genirq: reduce irqdebug bouncing cachelines
From: Thomas Gleixner
Date: Mon Apr 12 2021 - 08:43:53 EST
Cédric,
On Mon, Apr 12 2021 at 11:06, Cédric Le Goater wrote:
> On 4/10/21 1:58 PM, Thomas Gleixner wrote:
>> --- a/kernel/irq/spurious.c
>> +++ b/kernel/irq/spurious.c
>> @@ -274,7 +274,7 @@ void note_interrupt(struct irq_desc *des
>> unsigned int irq;
>>
>> if (desc->istate & IRQS_POLL_INPROGRESS ||
>> - irq_settings_is_polled(desc))
>> + irq_settings_is_polled(desc) | irq_settings_no_debug(desc))
>
> Shouldn't it be '||' instead ?
It could. But that's intentionally '|'. Why?
Because that lets the compiler merge the bit checks into one and
therefore spares one conditional branch.
>> return;
>>
>> if (bad_action_ret(action_ret)) {
>>
>
> We could test irq_settings_no_debug() directly under handle_nested_irq()
> and handle_irq_event_percpu() to avoid calling note_interrupt(), just
> like we do for noirqdebug.
We can do that, but then we should not just make it:
if (!irqnodebug && !irq_settings_no_debug(desc))
note_interrupt(...);
Instead have only one condition:
if (!irq_settings_no_debug(desc))
note_interrupt(...);
See the uncompiled delta patch below.
Thanks,
tglx
---
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1690,6 +1690,9 @@ static int
irq_settings_set_no_debug(desc);
}
+ if (noirqdebug)
+ irq_settings_set_no_debug(desc);
+
if (new->flags & IRQF_ONESHOT)
desc->istate |= IRQS_ONESHOT;
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -274,7 +274,7 @@ void note_interrupt(struct irq_desc *des
unsigned int irq;
if (desc->istate & IRQS_POLL_INPROGRESS ||
- irq_settings_is_polled(desc) | irq_settings_no_debug(desc))
+ irq_settings_is_polled(desc))
return;
if (bad_action_ret(action_ret)) {
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -481,7 +481,7 @@ void handle_nested_irq(unsigned int irq)
for_each_action_of_desc(desc, action)
action_ret |= action->thread_fn(action->irq, action->dev_id);
- if (!noirqdebug)
+ if (!irq_settings_no_debug(desc))
note_interrupt(desc, action_ret);
raw_spin_lock_irq(&desc->lock);
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -197,7 +197,7 @@ irqreturn_t handle_irq_event_percpu(stru
add_interrupt_randomness(desc->irq_data.irq, flags);
- if (!noirqdebug)
+ if (!irq_settings_no_debug(desc))
note_interrupt(desc, retval);
return retval;
}