2024-05-16 19:31:01

by Mukesh Ojha

[permalink] [raw]
Subject: [PATCH] genirq/chip: Fix the warn for non-SMP system

__irq_startup_managed() for !SMP system returns IRQ_STARTUP_NORMAL
which may result in a WARNING during enablement of an irq i.e.,
starting a irq while it is not activated.

Fix this by appropriately returning IRQ_STARTUP_MANAGED.

[ 11.129246] ------------[ cut here ]------------
[ 11.133891] WARNING: CPU: 0 PID: 39 at kernel/irq/chip.c:243 irq_startup+0x87/0x88
[ 11.146370] CPU: 0 PID: 39 Comm: kworker/0:5 Tainted: G OE 5.15.123-perf-gc692140b4d58-dirty #1
[ 11.156289] Hardware name: Generic DT based system
[ 11.161081] Workqueue: pm pm_runtime_work
[ 11.165112] (unwind_backtrace) from [<c0108c37>] (show_stack+0xb/0xc)
[ 11.172695] (show_stack) from [<c01154d5>] (__warn+0x8d/0x8e)
[ 11.179581] (__warn) from [<c0115525>] (warn_slowpath_fmt+0x4f/0x68)
[ 11.187063] (warn_slowpath_fmt) from [<c0146d89>] (irq_startup+0x87/0x88)
[ 11.194992] (irq_startup) from [<c0144969>] (enable_irq+0x31/0x70)
[ 11.202313] (enable_irq) from [<c05726bb>]

Signed-off-by: Mukesh Ojha <[email protected]>
---
kernel/irq/chip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index dc94e0bf2c94..a243f5ce786c 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -228,7 +228,7 @@ static __always_inline int
__irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff,
bool force)
{
- return IRQ_STARTUP_NORMAL;
+ return IRQ_STARTUP_MANAGED;
}
#endif

--
2.7.4



2024-05-17 08:48:42

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] genirq/chip: Fix the warn for non-SMP system

Hi Mukesh,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on linus/master v6.9 next-20240517]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/genirq-chip-Fix-the-warn-for-non-SMP-system/20240517-033251
base: tip/irq/core
patch link: https://lore.kernel.org/r/1715887825-1031-1-git-send-email-quic_mojha%40quicinc.com
patch subject: [PATCH] genirq/chip: Fix the warn for non-SMP system
config: alpha-allnoconfig (https://download.01.org/0day-ci/archive/20240517/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240517/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

alpha-linux-ld: kernel/irq/chip.o: in function `irq_startup':
>> (.text+0x17f8): undefined reference to `irq_do_set_affinity'
>> alpha-linux-ld: (.text+0x1808): undefined reference to `irq_do_set_affinity'

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-05-17 08:59:36

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] genirq/chip: Fix the warn for non-SMP system

Hi Mukesh,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on linus/master v6.9 next-20240517]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/genirq-chip-Fix-the-warn-for-non-SMP-system/20240517-033251
base: tip/irq/core
patch link: https://lore.kernel.org/r/1715887825-1031-1-git-send-email-quic_mojha%40quicinc.com
patch subject: [PATCH] genirq/chip: Fix the warn for non-SMP system
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240517/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240517/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

or1k-linux-ld: kernel/irq/chip.o: in function `irq_startup':
>> chip.c:(.text+0x14d8): undefined reference to `irq_do_set_affinity'
>> chip.c:(.text+0x14d8): relocation truncated to fit: R_OR1K_INSN_REL_26 against undefined symbol `irq_do_set_affinity'

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-05-23 20:19:04

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH] genirq/chip: Fix the warn for non-SMP system

On Fri, May 17 2024 at 01:00, Mukesh Ojha wrote:

We don't fix warnings. We fix the underlying problem.

> __irq_startup_managed() for !SMP system returns IRQ_STARTUP_NORMAL
> which may result in a WARNING during enablement of an irq i.e.,
> starting a irq while it is not activated.
>
> Fix this by appropriately returning IRQ_STARTUP_MANAGED.

What does that fix?

Absolutely nothing because both cases at the call site invoke
__irq_startup() which warns if the interrupt has not been activated yet.

It's not magically activated when __irq_startup_managed() returns
IRQ_STARTUP_MANAGED.

Also if you look at the SMP variant of that function then you might
notice that IRQ_STARTUP_MANAGED is not returned unconditionally. That
function can return IRQ_STARTUP_NORMAL too.

Just for the record. There are no managed interrupts on SMP=n. The code
which can initialize them is not even compiled in.

So I have no idea why you think that this has anything to do with
managed interrupts.

What's worse is that this does not even build on UP because
irq_do_set_affinity() does not exists for SMP=n. It builds today because
the IRQ_STARTUP_MANAGED case is optimized out by the compiler.

Sigh,

tglx