All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Octavian Purdila <tavi@cs.pub.ro>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-usb@vger.kernel.org, tglx@linutronix.de,
	Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH REPOST] mfd: dln2: use irqsave() in USB's complete callback
Date: Mon, 2 Jul 2018 08:24:42 +0200	[thread overview]
Message-ID: <20180702062442.GD9802@localhost> (raw)
In-Reply-To: <CAMoF9u0ZxNqKLV6FEjpHkGGuh8_V7zFQ_VpK-Y-fmbkSwL31Rg@mail.gmail.com>

On Mon, Jul 02, 2018 at 12:07:22AM +0200, Octavian Purdila wrote:
> On Sun, Jul 1, 2018 at 5:41 PM, Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
> > The USB completion callback does not disable interrupts while acquiring
> > the lock. We want to remove the local_irq_disable() invocation from
> > __usb_hcd_giveback_urb() and therefore it is required for the callback
> > handler to disable the interrupts while acquiring the lock.
> > The callback may be invoked either in IRQ or BH context depending on the
> > USB host controller.
> > Use the _irqsave() variant of the locking primitives.
> >
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Cc: Octavian Purdila <octavian.purdila@intel.com>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> >  drivers/mfd/dln2.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> > index 704e189ca162..1ef3c92f32e0 100644
> > --- a/drivers/mfd/dln2.c
> > +++ b/drivers/mfd/dln2.c
> > @@ -194,6 +194,7 @@ static bool dln2_transfer_complete(struct dln2_dev *dln2, struct urb *urb,
> >         struct device *dev = &dln2->interface->dev;
> >         struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
> >         struct dln2_rx_context *rxc;
> > +       unsigned long flags;
> >         bool valid_slot = false;
> >
> >         if (rx_slot >= DLN2_MAX_RX_SLOTS)
> > @@ -206,13 +207,13 @@ static bool dln2_transfer_complete(struct dln2_dev *dln2, struct urb *urb,
> >          * context elsewhere in this driver. This function (or its callers) are
> >          * also not exported to other modules.
> >          */
> > -       spin_lock(&rxs->lock);
> > +       spin_lock_irqsave(&rxs->lock, flags);
> 
> 
> I don't think disabling the IRQ is necessary, please see the comment
> above and also this discussion:
> 
> https://www.spinics.net/lists/linux-usb/msg115214.html

It hasn't been necessary so far, but we want to get rid of the disabling
of interrupts before calling the completion handler so this patch is
correct.

The comment above the lock is not correct as it stands, and definitely
is not after the conversion, so Sebastian, could you please drop it as
part of this change?

With that you can add my:

Reviewed-by: Johan Hovold <johan@kernel.org>

Thanks,
Johan

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Octavian Purdila <tavi@cs.pub.ro>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-usb@vger.kernel.org, tglx@linutronix.de,
	Lee Jones <lee.jones@linaro.org>
Subject: [REPOST] mfd: dln2: use irqsave() in USB's complete callback
Date: Mon, 2 Jul 2018 08:24:42 +0200	[thread overview]
Message-ID: <20180702062442.GD9802@localhost> (raw)

On Mon, Jul 02, 2018 at 12:07:22AM +0200, Octavian Purdila wrote:
> On Sun, Jul 1, 2018 at 5:41 PM, Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
> > The USB completion callback does not disable interrupts while acquiring
> > the lock. We want to remove the local_irq_disable() invocation from
> > __usb_hcd_giveback_urb() and therefore it is required for the callback
> > handler to disable the interrupts while acquiring the lock.
> > The callback may be invoked either in IRQ or BH context depending on the
> > USB host controller.
> > Use the _irqsave() variant of the locking primitives.
> >
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Cc: Octavian Purdila <octavian.purdila@intel.com>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> >  drivers/mfd/dln2.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> > index 704e189ca162..1ef3c92f32e0 100644
> > --- a/drivers/mfd/dln2.c
> > +++ b/drivers/mfd/dln2.c
> > @@ -194,6 +194,7 @@ static bool dln2_transfer_complete(struct dln2_dev *dln2, struct urb *urb,
> >         struct device *dev = &dln2->interface->dev;
> >         struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
> >         struct dln2_rx_context *rxc;
> > +       unsigned long flags;
> >         bool valid_slot = false;
> >
> >         if (rx_slot >= DLN2_MAX_RX_SLOTS)
> > @@ -206,13 +207,13 @@ static bool dln2_transfer_complete(struct dln2_dev *dln2, struct urb *urb,
> >          * context elsewhere in this driver. This function (or its callers) are
> >          * also not exported to other modules.
> >          */
> > -       spin_lock(&rxs->lock);
> > +       spin_lock_irqsave(&rxs->lock, flags);
> 
> 
> I don't think disabling the IRQ is necessary, please see the comment
> above and also this discussion:
> 
> https://www.spinics.net/lists/linux-usb/msg115214.html

It hasn't been necessary so far, but we want to get rid of the disabling
of interrupts before calling the completion handler so this patch is
correct.

The comment above the lock is not correct as it stands, and definitely
is not after the conversion, so Sebastian, could you please drop it as
part of this change?

With that you can add my:

Reviewed-by: Johan Hovold <johan@kernel.org>

Thanks,
Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-07-02  6:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 15:41 [PATCH REPOST] mfd: dln2: use irqsave() in USB's complete callback Sebastian Andrzej Siewior
2018-07-01 15:41 ` [REPOST] " Sebastian Andrzej Siewior
2018-07-01 22:07 ` [PATCH REPOST] " Octavian Purdila
2018-07-01 22:07   ` [REPOST] " Octavian Purdila
2018-07-02  6:24   ` Johan Hovold [this message]
2018-07-02  6:24     ` Johan Hovold
2018-07-02  7:31     ` [PATCH v2] " Sebastian Andrzej Siewior
2018-07-02  7:31       ` [v2] " Sebastian Andrzej Siewior
2018-07-04  7:40       ` [PATCH v2] " Lee Jones
2018-07-04  7:40         ` [v2] " Lee Jones

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=20180702062442.GD9802@localhost \
    --to=johan@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tavi@cs.pub.ro \
    --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 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.