Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH RFC v1 0/7] rtw88: prepare locking for SDIO support
@ 2021-07-17 20:40 Martin Blumenstingl
  2021-07-17 20:40 ` [PATCH RFC v1 1/7] mac80211: Add stations iterator where the iterator function may sleep Martin Blumenstingl
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Martin Blumenstingl @ 2021-07-17 20:40 UTC (permalink / raw)
  To: linux-wireless
  Cc: tony0620emma, kvalo, johannes, netdev, linux-kernel, Neo Jou,
	Jernej Skrabec, Martin Blumenstingl

Hello rtw88 and mac80211 maintainers/contributors,

there is an ongoing effort where Jernej and I are working on adding
SDIO support to the rtw88 driver.
The hardware we use at the moment is RTL8822BS and RTL8822CS.
We are at a point where scanning, assoc etc. works (though it's not
fast yet, in my tests I got ~6Mbit/s in either direction).

This series contains some preparation work for adding SDIO support.
While testing our changes we found that there are some "scheduling
while atomic" errors in the kernel log. These are due to the fact
that the SDIO accessors (sdio_readb, sdio_writeb and friends) may
sleep internally.

Some background on why SDIO access (for example: sdio_writeb) cannot
be done with a spinlock held (this is a copy from my previous mail,
see [0]):
- when using for example sdio_writeb the MMC subsystem in Linux
  prepares a so-called MMC request
- this request is submitted to the MMC host controller hardware
- the host controller hardware forwards the MMC request to the card
- the card signals when it's done processing the request
- the MMC subsystem in Linux waits for the card to signal that it's
done processing the request in mmc_wait_for_req_done() -> this uses
wait_for_completion() internally, which might sleep (which is not
allowed while a spinlock is held)

Based on Ping-Ke's suggestion I came up with the code in this series.
The goal is to use non-atomic locking for all register access in the
rtw88 driver. One patch adds a new function to mac80211 which did not
have a "non-atomic" version of it's "atomic" counterpart yet.

As mentioned before I don't have any rtw88 PCIe device so I am unable
to test on that hardware.
I am sending this as an RFC series since I am new to the mac80211
subsystem as well as the rtw88 driver. So any kind of feedback is
very welcome!
The actual changes for adding SDIO support will be sent separately in
the future.


[0] https://lore.kernel.org/linux-wireless/CAFBinCDMPPJ7qW7xTkep1Trg+zP0B9Jxei6sgjqmF4NDA1JAhQ@mail.gmail.com/


Martin Blumenstingl (7):
  mac80211: Add stations iterator where the iterator function may sleep
  rtw88: Use rtw_iterate_vifs where the iterator reads or writes
    registers
  rtw88: Use rtw_iterate_stas where the iterator reads or writes
    registers
  rtw88: Replace usage of rtw_iterate_keys_rcu() with rtw_iterate_keys()
  rtw88: Configure the registers from rtw_bf_assoc() outside the RCU
    lock
  rtw88: hci: Convert rf_lock from a spinlock to a mutex
  rtw88: fw: Convert h2c.lock from a spinlock to a mutex

 drivers/net/wireless/realtek/rtw88/bf.c       |  8 ++++++--
 drivers/net/wireless/realtek/rtw88/fw.c       | 14 +++++++-------
 drivers/net/wireless/realtek/rtw88/hci.h      | 11 ++++-------
 drivers/net/wireless/realtek/rtw88/mac80211.c |  2 +-
 drivers/net/wireless/realtek/rtw88/main.c     | 16 +++++++---------
 drivers/net/wireless/realtek/rtw88/main.h     |  4 ++--
 drivers/net/wireless/realtek/rtw88/phy.c      |  4 ++--
 drivers/net/wireless/realtek/rtw88/ps.c       |  2 +-
 drivers/net/wireless/realtek/rtw88/util.h     |  4 ++--
 drivers/net/wireless/realtek/rtw88/wow.c      |  2 +-
 include/net/mac80211.h                        | 18 ++++++++++++++++++
 net/mac80211/util.c                           | 13 +++++++++++++
 12 files changed, 64 insertions(+), 34 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-08-09 20:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 20:40 [PATCH RFC v1 0/7] rtw88: prepare locking for SDIO support Martin Blumenstingl
2021-07-17 20:40 ` [PATCH RFC v1 1/7] mac80211: Add stations iterator where the iterator function may sleep Martin Blumenstingl
2021-07-19  5:46   ` Pkshih
2021-07-19  6:30   ` Johannes Berg
2021-07-17 20:40 ` [PATCH RFC v1 2/7] rtw88: Use rtw_iterate_vifs where the iterator reads or writes registers Martin Blumenstingl
2021-07-19  5:47   ` Pkshih
2021-07-25 21:31     ` Martin Blumenstingl
2021-07-26  7:22       ` Pkshih
2021-07-17 20:40 ` [PATCH RFC v1 3/7] rtw88: Use rtw_iterate_stas " Martin Blumenstingl
2021-07-19  6:36   ` Johannes Berg
2021-07-25 21:51     ` Martin Blumenstingl
2021-07-26  7:22       ` Pkshih
2021-08-09 20:00         ` Johannes Berg
2021-07-17 20:40 ` [PATCH RFC v1 4/7] rtw88: Replace usage of rtw_iterate_keys_rcu() with rtw_iterate_keys() Martin Blumenstingl
2021-07-17 20:40 ` [PATCH RFC v1 5/7] rtw88: Configure the registers from rtw_bf_assoc() outside the RCU lock Martin Blumenstingl
2021-07-19  5:47   ` Pkshih
2021-07-25 21:36     ` Martin Blumenstingl
2021-07-26  7:22       ` Pkshih
2021-07-17 20:40 ` [PATCH RFC v1 6/7] rtw88: hci: Convert rf_lock from a spinlock to a mutex Martin Blumenstingl
2021-07-17 20:40 ` [PATCH RFC v1 7/7] rtw88: fw: Convert h2c.lock " Martin Blumenstingl
2021-07-19  5:52 ` [PATCH RFC v1 0/7] rtw88: prepare locking for SDIO support Pkshih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).