From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <aahringo@redhat.com>
Cc: Stefan Schmidt <stefan@datenfreihafen.org>,
Alexander Aring <alex.aring@gmail.com>,
linux-wpan - ML <linux-wpan@vger.kernel.org>,
David Girault <david.girault@qorvo.com>,
Romuald Despres <romuald.despres@qorvo.com>,
Frederic Blain <frederic.blain@qorvo.com>,
Nicolas Schodet <nico@ni.fr.eu.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH wpan-next v4 00/11] ieee802154: Synchronous Tx support
Date: Fri, 17 Jun 2022 16:20:35 +0200 [thread overview]
Message-ID: <20220617162035.5024d8a8@xps-13> (raw)
In-Reply-To: <CAK-6q+if-dNbpbneTfUtj6MrZXiYPq9npZfMkatXKo8cfU1m9w@mail.gmail.com>
Hi Alex,
aahringo@redhat.com wrote on Fri, 3 Jun 2022 21:50:15 -0400:
> Hi,
>
> On Fri, Jun 3, 2022 at 1:55 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Stefan, Alex,
> >
> > stefan@datenfreihafen.org wrote on Wed, 1 Jun 2022 23:01:51 +0200:
> >
> > > Hello.
> > >
> > > On 01.06.22 05:30, Alexander Aring wrote:
> > > > Hi,
> > > >
> > > > On Thu, May 19, 2022 at 11:06 AM Miquel Raynal
> > > > <miquel.raynal@bootlin.com> wrote:
> > > >>
> > > >> Hello,
> > > >>
> > > >> This series brings support for that famous synchronous Tx API for MLME
> > > >> commands.
> > > >>
> > > >> MLME commands will be used during scan operations. In this situation,
> > > >> we need to be sure that all transfers finished and that no transfer
> > > >> will be queued for a short moment.
> > > >>
> > > >
> > > > Acked-by: Alexander Aring <aahringo@redhat.com>
> > >
> > > These patches have been applied to the wpan-next tree. Thanks!
> > >
> > > > There will be now functions upstream which will never be used, Stefan
> > > > should wait until they are getting used before sending it to net-next.
> > >
> > > Indeed this can wait until we have a consumer of the functions before pushing this forward to net-next. Pretty sure Miquel is happy to finally move on to other pieces of his puzzle and use them. :-)
> >
> > Next part is coming!
> >
> > In the mean time I've experienced a new lockdep warning:
> >
> > All the netlink commands are executed with the rtnl taken.
> > In my current implementation, when I configure/edit a scan request or a
> > beacon request I take a scan_lock or a beacons_lock, so they may only
> > be taken after the rtnl in this case, which leads to this sequence of
> > events:
> > - the rtnl is taken (by the net core)
> > - the beacon's lock is taken
> >
> > But now in a beacon's work or an active scan work, what happens is:
> > - work gets woken up
> > - the beacon/scan lock is taken
> > - a beacon/beacon-request frame is transmitted
> > - the rtnl lock is taken during this transmission
> >
> > Lockdep then detects a possible circular dependency:
> > [ 490.153387] CPU0 CPU1
> > [ 490.153391] ---- ----
> > [ 490.153394] lock(&local->beacons_lock);
> > [ 490.153400] lock(rtnl_mutex);
> > [ 490.153406] lock(&local->beacons_lock);
> > [ 490.153412] lock(rtnl_mutex);
So after a lot of thinking and different tries, I've opted for a
slightly different approach regarding the rtnl being taken in the mlme
tx path. What we want there is actually to be sure that the device
won't be turned off during the transmission. Either this is done
before, and the transmission will just return an error (and this is
fine) or there is no ndo_close() call and we are actually safe. So I've
actually introduced a mutex for serializing accesses to the "stop the
device" section which actually what we care about. It works well, avoid
keeping the rtnl in all the scan/beacons works (which would have been
a crazy thing to do IMHO) and allows to keep a beacons/scan mutex for
the configuration of these specific parts. I'll propose this change in
the upcoming series.
Thanks,
Miquèl
prev parent reply other threads:[~2022-06-17 14:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 15:05 [PATCH wpan-next v4 00/11] ieee802154: Synchronous Tx support Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 01/11] net: mac802154: Rename the synchronous xmit worker Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 02/11] net: mac802154: Rename the main tx_work struct Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 03/11] net: mac802154: Enhance the error path in the main tx helper Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 04/11] net: mac802154: Follow the count of ongoing transmissions Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 05/11] net: mac802154: Bring the ability to hold the transmit queue Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 06/11] net: mac802154: Create a hot tx path Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 07/11] net: mac802154: Introduce a helper to disable the queue Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 08/11] net: mac802154: Introduce a tx queue flushing mechanism Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 09/11] net: mac802154: Introduce a synchronous API for MLME commands Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 10/11] net: mac802154: Add a warning in the hot path Miquel Raynal
2022-05-19 15:05 ` [PATCH wpan-next v4 11/11] net: mac802154: Add a warning in the slow path Miquel Raynal
2022-06-01 3:30 ` [PATCH wpan-next v4 00/11] ieee802154: Synchronous Tx support Alexander Aring
2022-06-01 6:12 ` Miquel Raynal
2022-06-01 21:01 ` Stefan Schmidt
2022-06-03 17:55 ` Miquel Raynal
2022-06-04 1:50 ` Alexander Aring
2022-06-06 17:03 ` Miquel Raynal
2022-06-17 14:20 ` Miquel Raynal [this message]
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=20220617162035.5024d8a8@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=aahringo@redhat.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=david.girault@qorvo.com \
--cc=frederic.blain@qorvo.com \
--cc=kuba@kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nico@ni.fr.eu.org \
--cc=pabeni@redhat.com \
--cc=romuald.despres@qorvo.com \
--cc=stefan@datenfreihafen.org \
--cc=thomas.petazzoni@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox