All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Fong <gregory.0xf0@gmail.com>
To: Doug Berger <opendmb@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	linux-gpio@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/7] gpio: brcmstb: release the bgpio lock during irq handlers
Date: Tue, 3 Oct 2017 20:07:32 -0700	[thread overview]
Message-ID: <CADtm3G6yUco7Av2b3qFRD9rseFH6R8mBnduBBsr8nm2JXGp7OQ@mail.gmail.com> (raw)
In-Reply-To: <2cdf149b-f034-d98a-e77a-e2779a0d1e47@gmail.com>

On Tue, Oct 3, 2017 at 7:09 PM, Doug Berger <opendmb@gmail.com> wrote:
> On 10/03/2017 06:55 PM, Gregory Fong wrote:
>> Hi Doug,
>>
>> On Fri, Sep 29, 2017 at 8:40 PM, Doug Berger <opendmb@gmail.com> wrote:
>>> The basic memory-mapped GPIO controller lock must be released
>>> before calling the registered GPIO interrupt handlers to allow
>>> the interrupt handlers to access the hardware.  Otherwise, the
>>> hardware accesses will deadlock when they attempt to grab the
>>> lock.
>>
>> I was having some trouble understanding exactly what the problem was
>> here, but I think I see it now.  Since this locks the entire bank,
>> where some GPIOs might be set as inputs and some as inputs (and
>> interrupt sources), then an interrupt on a GPIO that is supposed to
>> set another GPIO in the bank would result in deadlock.  Is that
>> correct?  If so, please update the commit message to make that clear,
>> and nice fix.  If not that, it would be nice to know what scenario can
>> cause a problem.
>
> That is an example, but there are really many possibilities.
>
> Basically, if a registered interrupt handler wants to access its GPIO
> you are likely to run into trouble.  Another example might be an
> interrupt that is configured to trigger on either edge transition and
> the handler wants to know whether the input is currently high or low.
>
> I can submit a V2 with a change in the description if you would like,
> but I'm not sure what the clearest example would be.

If you could just mention both of these possible cases, that would be
great! With that change,

Acked-by: Gregory Fong <gregory.0xf0@gmail.com>

WARNING: multiple messages have this Message-ID (diff)
From: gregory.0xf0@gmail.com (Gregory Fong)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/7] gpio: brcmstb: release the bgpio lock during irq handlers
Date: Tue, 3 Oct 2017 20:07:32 -0700	[thread overview]
Message-ID: <CADtm3G6yUco7Av2b3qFRD9rseFH6R8mBnduBBsr8nm2JXGp7OQ@mail.gmail.com> (raw)
In-Reply-To: <2cdf149b-f034-d98a-e77a-e2779a0d1e47@gmail.com>

On Tue, Oct 3, 2017 at 7:09 PM, Doug Berger <opendmb@gmail.com> wrote:
> On 10/03/2017 06:55 PM, Gregory Fong wrote:
>> Hi Doug,
>>
>> On Fri, Sep 29, 2017 at 8:40 PM, Doug Berger <opendmb@gmail.com> wrote:
>>> The basic memory-mapped GPIO controller lock must be released
>>> before calling the registered GPIO interrupt handlers to allow
>>> the interrupt handlers to access the hardware.  Otherwise, the
>>> hardware accesses will deadlock when they attempt to grab the
>>> lock.
>>
>> I was having some trouble understanding exactly what the problem was
>> here, but I think I see it now.  Since this locks the entire bank,
>> where some GPIOs might be set as inputs and some as inputs (and
>> interrupt sources), then an interrupt on a GPIO that is supposed to
>> set another GPIO in the bank would result in deadlock.  Is that
>> correct?  If so, please update the commit message to make that clear,
>> and nice fix.  If not that, it would be nice to know what scenario can
>> cause a problem.
>
> That is an example, but there are really many possibilities.
>
> Basically, if a registered interrupt handler wants to access its GPIO
> you are likely to run into trouble.  Another example might be an
> interrupt that is configured to trigger on either edge transition and
> the handler wants to know whether the input is currently high or low.
>
> I can submit a V2 with a change in the description if you would like,
> but I'm not sure what the clearest example would be.

If you could just mention both of these possible cases, that would be
great! With that change,

Acked-by: Gregory Fong <gregory.0xf0@gmail.com>

  reply	other threads:[~2017-10-04  3:07 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  3:40 [PATCH 0/7] gpio: brcmstb: improved interrupt and wake support Doug Berger
2017-09-30  3:40 ` Doug Berger
2017-09-30  3:40 ` [PATCH 1/7] gpio: brcmstb: allow all instances to be wakeup sources Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-04  1:40   ` Gregory Fong
2017-10-04  1:40     ` Gregory Fong
2017-10-04  1:40     ` Gregory Fong
2017-10-07 10:52   ` Linus Walleij
2017-10-07 10:52     ` Linus Walleij
2017-10-07 10:52     ` Linus Walleij
2017-09-30  3:40 ` [PATCH 2/7] gpio: brcmstb: release the bgpio lock during irq handlers Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-04  1:55   ` Gregory Fong
2017-10-04  1:55     ` Gregory Fong
2017-10-04  1:55     ` Gregory Fong
2017-10-04  2:09     ` Doug Berger
2017-10-04  2:09       ` Doug Berger
2017-10-04  2:09       ` Doug Berger
2017-10-04  3:07       ` Gregory Fong [this message]
2017-10-04  3:07         ` Gregory Fong
2017-10-04  3:07         ` Gregory Fong
2017-09-30  3:40 ` [PATCH 3/7] gpio: brcmstb: switch to handle_level_irq flow Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-04  1:59   ` Gregory Fong
2017-10-04  1:59     ` Gregory Fong
2017-10-04  1:59     ` Gregory Fong
2017-09-30  3:40 ` [PATCH 4/7] gpio: brcmstb: correct the configuration of level interrupts Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-04  2:03   ` Gregory Fong
2017-10-04  2:03     ` Gregory Fong
2017-10-04  2:03     ` Gregory Fong
2017-09-30  3:40 ` [PATCH 5/7] gpio: brcmstb: enable masking of interrupts when changing type Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-04  2:10   ` Gregory Fong
2017-10-04  2:10     ` Gregory Fong
2017-10-04  2:10     ` Gregory Fong
2017-10-04  2:22     ` Doug Berger
2017-10-04  2:22       ` Doug Berger
2017-10-04  2:22       ` Doug Berger
2017-10-04  3:15       ` Gregory Fong
2017-10-04  3:15         ` Gregory Fong
2017-10-04  3:15         ` Gregory Fong
2017-09-30  3:40 ` [PATCH 6/7] gpio: brcmstb: consolidate interrupt domains Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-04  3:03   ` Gregory Fong
2017-10-04  3:03     ` Gregory Fong
2017-10-04  3:03     ` Gregory Fong
2017-10-04 21:24     ` Doug Berger
2017-10-04 21:24       ` Doug Berger
2017-10-04 21:24       ` Doug Berger
2017-10-16 23:04       ` Doug Berger
2017-10-16 23:04         ` Doug Berger
2017-10-16 23:04         ` Doug Berger
2017-10-19  7:57       ` Gregory Fong
2017-10-19  7:57         ` Gregory Fong
2017-10-19  7:57         ` Gregory Fong
2017-10-19 18:25         ` Doug Berger
2017-10-19 18:25           ` Doug Berger
2017-10-19 18:25           ` Doug Berger
2017-09-30  3:40 ` [PATCH 7/7] gpio: brcmstb: implement suspend/resume/shutdown Doug Berger
2017-09-30  3:40   ` Doug Berger
2017-10-19  9:03   ` Gregory Fong
2017-10-19  9:03     ` Gregory Fong
2017-10-19 18:39     ` Doug Berger
2017-10-19 18:39       ` Doug Berger
2017-10-21  0:54       ` Gregory Fong
2017-10-21  0:54         ` Gregory Fong
2017-10-21  0:54         ` Gregory Fong
2017-10-23 23:06         ` Doug Berger
2017-10-23 23:06           ` Doug Berger
2017-10-23 23:06           ` Doug Berger
2017-09-30  5:34 ` [PATCH 0/7] gpio: brcmstb: improved interrupt and wake support Florian Fainelli
2017-09-30  5:34   ` Florian Fainelli
2017-10-07 10:54 ` Linus Walleij
2017-10-07 10:54   ` Linus Walleij
2017-10-07 10:54   ` Linus Walleij

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=CADtm3G6yUco7Av2b3qFRD9rseFH6R8mBnduBBsr8nm2JXGp7OQ@mail.gmail.com \
    --to=gregory.0xf0@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opendmb@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.