Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1516535

Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0
Date 2016-11-07 20:40 +0100
Message-ID <sAXVU-7y3-3@gated-at.bofh.it> (permalink)
References (4 earlier) <sASjw-3Kx-21@gated-at.bofh.it> <sATpf-4qY-21@gated-at.bofh.it> <sATIB-4Mo-21@gated-at.bofh.it> <sAUuZ-52M-7@gated-at.bofh.it> <sAUEG-5ny-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 7 Nov 2016, Thomas Gleixner wrote:
> No. We don't want a dummy set_type to paper over the issue. As Mika
> correctly figured out that the ioapic is already configured, but it does
> not propagate it to the irq descriptor. That wants to be fixed. I'll have a
> look.

Actually that's pointless. The ioapic code sets the type in irqdata. The
type storage in the irq descriptor is a historical left over and want's to
be removed. The last forgotten user of the type data in the irq descriptor
is __setup_irq().... Fix below.

Thanks,

	tglx

8<---------------------------
Subject: genirq: Use irq type from irqdata instead of irqdesc
From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 07 Nov 2016 19:57:00 +0100

The type flags in the irq descriptor are there for historical reasons and
only updated via irq_modify_status() or irq_set_type(). Both functions also
update the type flags in irqdata. __setup_irq() is the only left over user
of the type flags in the irq descriptor.

If __setup_irq() is called with empty irq type flags, then the type flags
are retrieved from irqdata. If an interrupt is shared, then the type flags
are compared with the type flags stored in the irq descriptor. 

On x86 the ioapic does not have a irq_set_type() callback because the type
is defined in the BIOS tables and cannot be changed. The type is stored in
irqdata at setup time without updating the type data in the irq
descriptor. As a result the comparison described above fails.

There is no point in updating the irq descriptor flags because the only
relevant storage is irqdata. Use the type flags from irqdata for both
retrieval and comparison in __setup_irq() instead.

Aside of that the print out in case of non matching type flags has the old
and new type flags arguments flipped. Fix that as well.

For correctness sake the flags stored in the irq descriptor should be
removed, but this is beyond the scope of this bugfix and will be done in a
later patch.

Fixes: 4b357daed698 ("genirq: Look-up trigger type if not specified by caller")
Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/irq/manage.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1341,12 +1341,12 @@ static int
 
 	} else if (new->flags & IRQF_TRIGGER_MASK) {
 		unsigned int nmsk = new->flags & IRQF_TRIGGER_MASK;
-		unsigned int omsk = irq_settings_get_trigger_mask(desc);
+		unsigned int omsk = irqd_get_trigger_type(&desc->irq_data);
 
 		if (nmsk != omsk)
 			/* hope the handler works with current  trigger mode */
 			pr_warn("irq %d uses trigger mode %u; requested %u\n",
-				irq, nmsk, omsk);
+				irq, omsk, nmsk);
 	}
 
 	*old_ptr = new;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

BUG? genirq: irq 14 uses trigger mode 8; requested 0 Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-11-01 14:20 +0100
  Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Jon Hunter <jonathanh@nvidia.com> - 2016-11-01 15:30 +0100
    Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-11-01 15:50 +0100
      Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-11-07 12:50 +0100
        Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Jon Hunter <jonathanh@nvidia.com> - 2016-11-07 14:40 +0100
          Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Marc Zyngier <marc.zyngier@arm.com> - 2016-11-07 15:50 +0100
            Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-11-07 16:10 +0100
              Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Jon Hunter <jonathanh@nvidia.com> - 2016-11-07 17:00 +0100
                Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Thomas Gleixner <tglx@linutronix.de> - 2016-11-07 17:10 +0100
                Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Thomas Gleixner <tglx@linutronix.de> - 2016-11-07 20:40 +0100
                Re: BUG? genirq: irq 14 uses trigger mode 8; requested 0 Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-11-08 10:20 +0100
                [tip:irq/urgent] genirq: Use irq type from irqdata instead of  irqdesc tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-11-08 15:30 +0100

csiph-web