From: Pkshih <pkshih@realtek.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Yan-Hsuan Chuang <tony0620emma@gmail.com>,
Tzu-En Huang <tehuang@realtek.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Neo Jou <neojou@gmail.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>
Subject: RE: rtw88: rtw_{read,write}_rf locking questions
Date: Wed, 14 Jul 2021 01:48:04 +0000 [thread overview]
Message-ID: <3c61fae611294e5098e6e0044a7a4199@realtek.com> (raw)
In-Reply-To: <CAFBinCDMPPJ7qW7xTkep1Trg+zP0B9Jxei6sgjqmF4NDA1JAhQ@mail.gmail.com>
> -----Original Message-----
> From: Martin Blumenstingl [mailto:martin.blumenstingl@googlemail.com]
> Sent: Wednesday, July 14, 2021 12:51 AM
> To: Yan-Hsuan Chuang; Pkshih; Tzu-En Huang
> Cc: linux-wireless@vger.kernel.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Neo Jou;
> Jernej Skrabec
> Subject: rtw88: rtw_{read,write}_rf locking questions
>
> Hello rtw88 maintainers and 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.
> Work-in-progress code can be found in Jernej's repo (note: this may be
> rebased): [0]
Thanks for your nice work!
>
> We are at a point where we can communicate with the SDIO card and
> successfully upload the firmware to it.
> Right now I have two questions about the locking in
> rtw_{read,write}_rf from hci.h:
> 1) A spinlock is used to protect RF register access. This is
> problematic for SDIO, more information below. Would you accept a patch
> to convert this into a mutex? I don't have any rtw88 PCIe card for
> testing any regressions there myself.
I think it's okay.
> 2) I would like to understand why the RF register access needs to be
> protected by a lock. From what I can tell RF register access doesn't
> seem to be used from IRQ handlers.
The use of lock isn't because we want to access the RF register in IRQ
handlers. The reasons are
1. The ieee80211 iterative vif function we use is atomic type, so we can't
use mutex.
Do you change the type of iterative function?
2. RF register access isn't an atomic. If more than one threads access the
register at the same time, the value will be wrong.
>
> Some background on why SDIO access (for example: sdio_writeb) cannot
> be done with a spinlock held:
> - 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)
>
> I am looking forward to your advice on this rtw_{read,write}_rf locking topic.
>
> [0] https://github.com/jernejsk/linux-1/commits/rtw88-sdio
Ping-Ke
next prev parent reply other threads:[~2021-07-14 1:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 16:51 Martin Blumenstingl
2021-07-14 1:48 ` Pkshih [this message]
2021-07-14 22:47 ` Martin Blumenstingl
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=3c61fae611294e5098e6e0044a7a4199@realtek.com \
--to=pkshih@realtek.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neojou@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tehuang@realtek.com \
--cc=tony0620emma@gmail.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
all inboxes | Powered by JetHome®