linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Pkshih <pkshih@realtek.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>
Subject: Re: [PATCH v4 13/19] rtw89: 8852a: add 8852a specific files
Date: Thu, 29 Apr 2021 18:22:16 -0700	[thread overview]
Message-ID: <YItbyGGlZN4q9iOh@google.com> (raw)
In-Reply-To: <1619739791.1874.18.camel@realtek.com>

On Thu, Apr 29, 2021 at 11:43:12PM +0000, Pkshih wrote:
> On Thu, 2021-04-29 at 21:10 +0000, Brian Norris wrote:
> > rtw89_write_rf() is holding a mutex (rf_mutex). Judging by its trivial
> > usage (it's only protecting register reads/writes), it probably could be
> > a spinlock instead -- although I do note some magic udelay()s in there.
> > 
> 
> The udelay() is needed to ensure the indirect-write correct.

OK. Maybe deserves a comment for the future. Is this a
hardware-specified timing (measured in number of cycles or similar, on
the WiFi chip side), or something you're just guessing at?

> > Alternatively, it looks like you'd be safe moving to the non-atomic
> > ieee80211_iterate_active_interfaces() in rtw89_leave_lps().
> > 
> 
> For most cases of rtw89_leave_lps(), we can use ieee80211_iterate_active_interfaces(),
> which hold iflist_mtx lock, except to 
> 
> 	ieee80211_recalc_ps(local);	// held iflist_mtx lock
> 		...
> 		ieee80211_hw_config
> 			...
> 			rtw89_leave_lps()
> 				...
> 				ieee80211_iterate_active_interfaces()
> 
> That will leads deadlock.

Good point.

> Another variant ieee80211_iterate_active_interfaces_mtx() that doesn't
> hold a lock may be a solution. The the comment says "This version can
> only be used while holding the RTNL.", and the code within the function
> says "lockdep_assert_wiphy(hw->wiphy);". I'm not sure if I can use it
> to prevent locking iflist_mtx twice.

This doesn't quite feel like the right thing. You're in the midst of
many other callback layers, and I don't think this is the right place to
be grabbing those locks. But I haven't researched this very closely yet.

> If I can use it, I can add a argument 'mtx', like rtw89_leave_lps(rtwdev, bool mtx),
> to judge using ieee80211_iterate_active_interfaces() or ieee80211_iterate_active_interfaces_mtx().
> 
> I'm also thinking that we can still use ieee80211_iterate_active_interfaces_atomic()
> to merely collect rtwvif->mac_id list, and use a loop to do leave_lps
> out of the atomic iterate.

That's probably safe, because we're already holding rtwdev->mutex, so
there's no chance of our mac_id going away. If that solution isn't too
complex, it makes sense to me.

Brian

  reply	other threads:[~2021-04-30  1:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29  8:01 [PATCH v4 00/19] rtw89: add Realtek 802.11ax driver Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 01/19] rtw89: add CAM files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 02/19] rtw89: add BT coexistence files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 03/19] rtw89: add core and trx files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 04/19] rtw89: add debug files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 05/19] rtw89: add efuse files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 06/19] rtw89: add files to download and communicate with firmware Ping-Ke Shih
2021-04-30  1:10   ` Brian Norris
2021-05-01  0:39     ` Pkshih
2021-04-29  8:01 ` [PATCH v4 07/19] rtw89: add MAC files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 08/19] rtw89: implement mac80211 ops Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 09/19] rtw89: add pci files Ping-Ke Shih
2021-06-10  2:03   ` Brian Norris
2021-06-16  8:31     ` Pkshih
2021-06-18 19:13       ` Brian Norris
2021-06-25 10:07         ` Pkshih
2021-07-01  0:47         ` Pkshih
2021-07-19 18:50           ` Brian Norris
2021-07-21  3:20             ` Pkshih
2021-04-29  8:01 ` [PATCH v4 10/19] rtw89: add phy files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 11/19] rtw89: define register names Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 12/19] rtw89: add regulatory support Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 13/19] rtw89: 8852a: add 8852a specific files Ping-Ke Shih
2021-04-29 21:10   ` Brian Norris
2021-04-29 23:43     ` Pkshih
2021-04-30  1:22       ` Brian Norris [this message]
2021-05-01  0:54         ` Pkshih
2021-04-29  8:01 ` [PATCH v4 14/19] rtw89: 8852a: add 8852a RFK files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 15/19] rtw89: 8852a: add 8852a RFK tables Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 17/19] rtw89: add ser to recover error reported by firmware Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 18/19] rtw89: add PS files Ping-Ke Shih
2021-04-29  8:01 ` [PATCH v4 19/19] rtw89: add Kconfig and Makefile Ping-Ke Shih

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=YItbyGGlZN4q9iOh@google.com \
    --to=briannorris@chromium.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.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;
as well as URLs for NNTP newsgroup(s).