From: Brian Starkey <brian.starkey-5wv7dgnIgG8@public.gmane.org>
To: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Frank Rowand
<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] genirq: fix trigger flags check for shared irqs
Date: Mon, 8 Feb 2016 11:02:40 +0000 [thread overview]
Message-ID: <20160208110239.GA9747@e106950-lin.cambridge.arm.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1601281355200.3886@nanos>
Hi Thomas,
Any further thoughts on this? (some comments below)
On Thu, Jan 28, 2016 at 02:37:24PM +0100, Thomas Gleixner wrote:
>In principle I agree. The issue is that it really depends on the
>particular
>hardware situation.
>
>If there is an explicit requirement for one driver - expressed by a trigger
>flag - and the other driver relies on the default configuration, then this
>might cause malfunction.
>
>The hassle is, that IRQF_TRIGGER_NONE has unclear semantics. It can mean "I
>don't care" or "I rely on the hw configuration". The latter is what worries
>me.
>
>first driver:
>
> creates the mapping and sets the trigger type according to the DT
> setting.
>
> driver calls request_irq() with IRQF_TRIGGER_NONE. It relies on the DT
> setting to be correct.
>
>second driver:
>
> Finds an existing mapping. Now we have two cases:
>
> 1) flat irqdomains:
>
> The DT setting is applied to the trigger type unconditionally.
>
> So if that setting is contrary to first drivers DT setting then we
> are already in trouble.
>
> If the driver uses IRQF_TRIGGER_NONE, bad luck as nothing will notice
> the issue.
>
> 2) hierarchical irqdomains
>
> That code path ignores the type setting of the second driver and
> leaves the irq line in the existing state.
>
> If the driver uses IRQF_TRIGGER_NONE, bad luck as nothing will notice
> the issue.
>
>So we have two problems here.
>
>1) We should detect the mismatch already in the mapping function.
>
> But, that's hard for legacy reasons. Interrupts can be mapped at early boot
> with hardware default settings and we currently have no way to distinguish
> that. It shouldn't be hard to fix that.
>
Would you agree that this is a separate issue that should be fixed
separately? Even with this fixed, my problem would still exist.
>2) How to deal with the mismatch in request_irq()
>
> Relaxing the check is not really a good decision. So what we could do is:
>
> if ((new_action->flags & IRQF_TRIGGER_MASK) == IRQF_TRIGGER_NONE)
> new_action->flags |= irqd_get_trigger_type(irqdata);
>
> Now that has an issue as well. If the driver requests with
> IRQF_TRIGGER_NONE and does an explicit type setting afterwards, the
> action->flags still do not reflect it.
>
Yes, an explicit type-setting afterwards would make action->flags get
out-of-sync, but isn't that already the case, regardless of the relaxed
check?
My patch fixes a bogus error for a real use-case, and as far as I can
see doesn't make any of the existing problems worse - so I feel like
that's a net win.
>The whole trigger handling versus shared interrupts needs some deep thoughts
>and I really want to understand what that of commit 4a43d686fe336 before
>making any decisions.
>
If you'd rather see a patch something like your 2) above, I can do that,
let me know what you think.
Many thanks,
Brian
>Thanks,
>
> tglx
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-02-08 11:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <96c068ece0f5d01fc85bdbd9e0798f68180eebb8.1453204950.git.brian.starkey@arm.com>
[not found] ` <alpine.DEB.2.11.1601262142450.3886@nanos>
[not found] ` <20160128095955.GA12884@e106950-lin.cambridge.arm.com>
[not found] ` <alpine.DEB.2.11.1601281116310.3886@nanos>
[not found] ` <20160128111041.GB12884@e106950-lin.cambridge.arm.com>
2016-01-28 11:49 ` [PATCH] genirq: fix trigger flags check for shared irqs Thomas Gleixner
2016-01-28 12:22 ` Brian Starkey
[not found] ` <20160128122212.GC12884-XkuvqYGHIzfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2016-01-28 13:37 ` Thomas Gleixner
2016-02-08 11:02 ` Brian Starkey [this message]
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=20160208110239.GA9747@e106950-lin.cambridge.arm.com \
--to=brian.starkey-5wv7dgnigg8@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).