From: Brian Starkey <brian.starkey@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, marc.zyngier@arm.com
Subject: Re: [PATCH] genirq: fix trigger flags check for shared irqs
Date: Thu, 28 Jan 2016 11:10:42 +0000 [thread overview]
Message-ID: <20160128111041.GB12884@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1601281116310.3886@nanos>
On Thu, Jan 28, 2016 at 11:29:21AM +0100, Thomas Gleixner wrote:
>Brian,
>
>On Thu, 28 Jan 2016, Brian Starkey wrote:
>> On Tue, Jan 26, 2016 at 09:45:32PM +0100, Thomas Gleixner wrote:
>> > On Tue, 26 Jan 2016, Brian Starkey wrote:
>> >
>> > > For shared interrupts, if one requester passes in any IRQF_TRIGGER_*
>> > > flags whilst another doesn't, __setup_irq() can erroneously fail.
>> > >
>> > > The no-flags case should be treated as "already configured", so change
>> > > __setup_irq() to only check that the flags match if any have been
>> > > provided.
>> >
>> > What happens if that "already configured", i.e. the default setting, is
>> > conflicting with the newly requested interrupt?
>> >
>> > I rather prefer the failure than the resulting silent wreckage.
>> >
>>
>> Yes, I agree that would be best avoided. It seems to me that this case
>> is actually handled a bit lower down:
>>
>> } else if (new->flags & IRQF_TRIGGER_MASK) {
>> unsigned int nmsk = new->flags & IRQF_TRIGGER_MASK;
>> unsigned int omsk = irq_settings_get_trigger_mask(desc);
>>
>> if (nmsk != omsk)
>> /* hope the handler works with current trigger mode
>> */
>> pr_warning("irq %d uses trigger mode %u; requested
>> %u\n",
>> irq, nmsk, omsk);
>> }
>>
>> Perhaps that should be louder/fatal?
>
>Perhaps. So what's the actual problem case you are trying to solve?
I've got a few devices on the same interrupt line. One driver does
something along these lines:
res = platform_get_resource(dev, IORESOURCE_IRQ, 0);
flags = (res->flags & IRQF_TRIGGER_MASK) | IRQF_SHARED;
request_irq(res->start, handler, flags, "name", dev);
This seems pretty reasonable. The problem is since 4a43d686fe33:
of/irq: Pass trigger type in IRQ resource flags[1]
the trigger type information from device-tree is in res->flags.
So when the other drivers don't pass in any flags, they fail the check
in __setup_irq().
Changing the former driver to remove the flags doesn't seem right, and
adding flags to the latter would imply adding flags to _every_ driver,
which is an awful lot to change - and I'm not sure it would be possible
and/or effective in all cases.
Cheers,
-Brian
[1]http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4a43d686fe336cc0e955c4400ba4d3fcff788786
>
>Thanks,
>
> tglx
>
next prev parent reply other threads:[~2016-01-28 11:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-26 10:31 Brian Starkey
2016-01-26 20:45 ` Thomas Gleixner
2016-01-28 9:59 ` Brian Starkey
2016-01-28 10:29 ` Thomas Gleixner
2016-01-28 11:10 ` Brian Starkey [this message]
2016-01-28 11:49 ` Thomas Gleixner
2016-01-28 12:22 ` Brian Starkey
2016-01-28 13:37 ` Thomas Gleixner
2016-02-08 11:02 ` Brian Starkey
2016-01-28 15:58 ` Rob Herring
2016-01-28 20:06 ` Thomas Gleixner
2016-01-29 4:17 ` Tomasz Figa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160128111041.GB12884@e106950-lin.cambridge.arm.com \
--to=brian.starkey@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®