From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Stefan Schmidt <stefan@datenfreihafen.org>
Cc: Alexander Aring <aahringo@redhat.com>,
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, 3 Jun 2022 19:55:09 +0200 [thread overview]
Message-ID: <20220603195509.73cf888f@xps-13> (raw)
In-Reply-To: <d844514c-771f-e720-407b-2679e430243a@datenfreihafen.org>
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 in practice, I always need to have the rtnl lock taken when
acquiring these other locks (beacon/scan_lock) which I think is far
from optimal.
1# One solution is to drop the beacons/scan locks because they are not
useful anymore and simply rely on the rtnl.
2# Another solution would be to change the mlme_tx() implementation to
finally not need the rtnl at all.
Note that just calling ASSERT_RTNL() makes no difference in 2#, it
still means that I always need to acquire the rtnl before acquiring the
beacons/scan locks, which greatly reduces their usefulness and leads to
solution 1# in the end.
IIRC I decided to introduce the rtnl to avoid ->ndo_stop() calls during
an MLME transmission. I don't know if it has another use there. If not,
we may perhaps get rid of the rtnl in mlme_tx() by really handling the
stop calls (but I was too lazy so far to do that).
What direction would you advise?
Thanks,
Miquèl
next prev parent reply other threads:[~2022-06-03 18:00 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 [this message]
2022-06-04 1:50 ` Alexander Aring
2022-06-06 17:03 ` Miquel Raynal
2022-06-17 14:20 ` Miquel Raynal
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=20220603195509.73cf888f@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