2022-03-25 18:27:50

by chenlifu

[permalink] [raw]
Subject: [PATCH -next] irq: print depth in __enable_irq WARNING

Since case 0 and 1 of desc->depth may print same warning messages as follows,
according to the messages, we do not know in which case the warning is generated.
This patch prints extra desc->depth in the warning messages to distinguish
these cases.
This patch just does warning message changes,no functional changes.

[20220314100142]------------[ cut here ]------------
[20220314100142]WARNING: CPU: 1 PID: 10332 at kernel/irq/manage.c:723 __enable_irq+0x58/0xa4
[20220314100142]Unbalanced enable for IRQ 38
......

Signed-off-by: Chen Lifu <[email protected]>
---
kernel/irq/manage.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index c03f71d5ec10..83bb9d9ee71a 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -769,12 +769,12 @@ void disable_nmi_nosync(unsigned int irq)
void __enable_irq(struct irq_desc *desc)
{
switch (desc->depth) {
case 0:
err_out:
- WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n",
- irq_desc_get_irq(desc));
+ WARN(1, KERN_WARNING "depth %u: Unbalanced enable for IRQ %d\n",
+ desc->depth, irq_desc_get_irq(desc));
break;
case 1: {
if (desc->istate & IRQS_SUSPENDED)
goto err_out;
/* Prevent probing on this irq: */
--
2.35.1


2022-04-12 08:53:31

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH -next] irq: print depth in __enable_irq WARNING

Chen!

On Fri, Mar 25 2022 at 09:33, Chen Lifu wrote:

The subsystem prefix for the interrupt core is 'genirq' as you can easy
check via 'git log kernel/irq/manage.c'

> Since case 0 and 1 of desc->depth may print same warning messages as follows,
> according to the messages, we do not know in which case the warning is generated.
> This patch prints extra desc->depth in the warning messages to distinguish
> these cases.

This patch prints? The patch cannot print anything.

Please read the patch submission notes in Documentation/process/
including the tip tree specific rules in Documentation/process/maintainer-tip.html

> void __enable_irq(struct irq_desc *desc)
> {
> switch (desc->depth) {
> case 0:
> err_out:
> - WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n",
> - irq_desc_get_irq(desc));
> + WARN(1, KERN_WARNING "depth %u: Unbalanced enable for IRQ %d\n",
> + desc->depth, irq_desc_get_irq(desc));

If we change this then we really want separate messages which makes it
clear what this is about. Something like:

if (likely(depth == 1)) {
if (WARN_ONCE(suspended, "Enable of suspended irq %d", irq))
return;
....
return;
}

if (WARN_ONCE(!depth, "Unbalanced enable of irq %d", irq))
return;

desc->depth--;

Hmm?

Thanks,

tglx