From: Brian Norris <briannorris@chromium.org>
To: Amitkumar Karwar <akarwar@marvell.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
Cathy Luo <cluo@marvell.com>,
Nishant Sarmukadam <nishants@marvell.com>,
"rajatja@google.com" <rajatja@google.com>,
Xinming Hu <huxm@marvell.com>
Subject: Re: [PATCH v2 1/2] mwifiex: reset card->adapter during device unregister
Date: Wed, 5 Oct 2016 09:30:24 -0700 [thread overview]
Message-ID: <20161005163024.GA54237@google.com> (raw)
In-Reply-To: <8ec683dc72a746909157fca4dcbd10e8@SC-EXCH04.marvell.com>
Hi,
On Wed, Oct 05, 2016 at 02:04:53PM +0000, Amitkumar Karwar wrote:
> > From: Brian Norris [mailto:briannorris@chromium.org]
> > Sent: Wednesday, October 05, 2016 3:28 AM
> > To: Amitkumar Karwar
> > Cc: linux-wireless@vger.kernel.org; Cathy Luo; Nishant Sarmukadam;
> > rajatja@google.com; briannorris@google.com; Xinming Hu
> > Subject: Re: [PATCH v2 1/2] mwifiex: reset card->adapter during device
> > unregister
> >
> > Hi,
> >
> > On Tue, Oct 04, 2016 at 10:38:24PM +0530, Amitkumar Karwar wrote:
> > > --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> > > +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> > > @@ -3042,6 +3042,7 @@ static void mwifiex_unregister_dev(struct
> > mwifiex_adapter *adapter)
> > > pci_disable_msi(pdev);
> > > }
> > > }
> > > + card->adapter = NULL;
> >
> > I think you have a similar problem here as in patch 2; there is no
> > locking to protect fields in struct pcie_service_card or struct
> > sdio_mmc_card below. That problem kind of already exists, except that
> > you only write the value of card->adapter once at registration time, so
> > it's not actually unsafe. But now that you're introducing a second
> > write, you have a problem.
> >
> > Brian
> >
>
> We have a global "add_remove_card_sem" semaphore in our code for
> synchronizing initialization and teardown threads. Ideally "init +
> teardown/reboot" should not have a race issue with this logic
>
> Later there was a loophole introduced in this after using async
> firmware download API. During initialization, firmware downloads
> asynchronously in a separate thread where might have released the
> semaphore. I am working on a patch to fix this.
>
> So "card->adapter" doesn't need to have locking. Even if we have two
> write operations, those two threads can't run simultaneously due to
> above mentioned logic.
What about writes racing with reads? You have lots of unsynchronized
cases that read this, although most of them should be halted by now
(e.g., cmd processing). I was looking at suspend() in particular, which
I thought you were looking at in this patch series.
Brian
next prev parent reply other threads:[~2016-10-05 16:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 17:08 [PATCH v2 1/2] mwifiex: reset card->adapter during device unregister Amitkumar Karwar
2016-10-04 17:08 ` [PATCH v2 2/2] mwifiex: check hw_status in suspend and resume handlers Amitkumar Karwar
2016-10-04 21:04 ` Brian Norris
2016-10-05 12:26 ` Amitkumar Karwar
2016-10-05 16:41 ` Brian Norris
2016-10-05 17:19 ` Cathy Luo
2016-10-06 17:28 ` Amitkumar Karwar
2016-10-04 21:58 ` [PATCH v2 1/2] mwifiex: reset card->adapter during device unregister Brian Norris
2016-10-05 14:04 ` Amitkumar Karwar
2016-10-05 16:30 ` Brian Norris [this message]
2016-10-06 13:03 ` Amitkumar Karwar
2016-10-10 20:43 ` Brian Norris
2016-10-10 23:43 ` Dmitry Torokhov
2016-10-10 23:47 ` Brian Norris
2016-10-10 23:53 ` Dmitry Torokhov
2016-10-10 23:54 ` Brian Norris
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=20161005163024.GA54237@google.com \
--to=briannorris@chromium.org \
--cc=akarwar@marvell.com \
--cc=cluo@marvell.com \
--cc=huxm@marvell.com \
--cc=linux-wireless@vger.kernel.org \
--cc=nishants@marvell.com \
--cc=rajatja@google.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.