Re: [patch V2 06/45] genirq/proc: Switch to lock guards

From: Thomas Gleixner
Date: Mon Jun 09 2025 - 06:00:44 EST


On Mon, Jun 09 2025 at 15:15, Zenghui Yu wrote:
> On 2025/6/8 20:45, Zenghui Yu wrote:
>> On 2025/4/29 14:54, Thomas Gleixner wrote:
> Plus,
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index b0e0a7332993..57facdc30d55 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -964,7 +964,7 @@ __irq_do_set_handler(struct irq_desc *desc,
> irq_flow_handler_t handle,
> void __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int
> is_chained,
> const char *name)
> {
> - scoped_irqdesc_get_and_lock(irq, 0)
> + scoped_irqdesc_get_and_buslock(irq, 0)

What for? Which problem are you trying to solve here?

> __irq_do_set_handler(scoped_irqdesc, handle, is_chained, name);
> }
> EXPORT_SYMBOL_GPL(__irq_set_handler);
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index c94837382037..400856abf672 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -659,7 +659,7 @@ void __disable_irq(struct irq_desc *desc)
>
> static int __disable_irq_nosync(unsigned int irq)
> {
> - scoped_irqdesc_get_and_lock(irq, IRQ_GET_DESC_CHECK_GLOBAL) {
> + scoped_irqdesc_get_and_buslock(irq, IRQ_GET_DESC_CHECK_GLOBAL) {

That's broken as __disable_irq_nosync() can be invoked from
non-preemtible contexts.

> __disable_irq(scoped_irqdesc);
> return 0;
> }
> @@ -789,7 +789,7 @@ void __enable_irq(struct irq_desc *desc)
> */
> void enable_irq(unsigned int irq)
> {
> - scoped_irqdesc_get_and_lock(irq, IRQ_GET_DESC_CHECK_GLOBAL) {
> + scoped_irqdesc_get_and_buslock(irq, IRQ_GET_DESC_CHECK_GLOBAL) {

Ditto.

Can you stop making random changes and instead provide the actual
information to decode the OOPS?

> string+0x110/0x3b8 (P)
> vsnprintf+0x2f0/0xac8
> seq_printf+0x180/0x220
> show_interrupts+0x4e0/0x7e0

This means the print in show_interrupts() accesses an invalid
pointer. So the obvious thing to do is:

scripts/faddr2line vmlinux show_interrupts+0x4e0/0x7e0

and provide the information, which of the gazillions of seq_printf()'s
in that function causes the problem.

I'm pretty sure that is has absolutely nothing to do with the guard()
conversions.

Thanks,

tglx