From: Kalle Valo <kvalo@kernel.org>
To: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Cc: <ath12k@lists.infradead.org>, <linux-wireless@vger.kernel.org>,
Sriram R <quic_srirrama@quicinc.com>
Subject: Re: [PATCH v6 1/3] wifi: ath12k: prepare vif data structure for MLO handling
Date: Fri, 09 Aug 2024 17:29:05 +0300 [thread overview]
Message-ID: <87bk213h3i.fsf@kernel.org> (raw)
In-Reply-To: <2b78c227-ef2e-4d98-baf3-762e4f5bd155@quicinc.com> (Rameshkumar Sundaram's message of "Thu, 8 Aug 2024 22:12:26 +0530")
Rameshkumar Sundaram <quic_ramess@quicinc.com> writes:
> On 8/8/2024 4:27 PM, Kalle Valo wrote:
>> Kalle Valo <kvalo@kernel.org> writes:
>>
>>> Rameshkumar Sundaram <quic_ramess@quicinc.com> writes:
>>>
>>>> Locking:
>>>> Currently modifications to members of arvif and arsta are
>>>> protected by ar->conf_mutex
>>>> and it stays as such.
>>>> Now with these hw level structure (ahvif) being introduced, any modifications
>>>> to its members and link objects (i.e., arvifs[] which are dynamically allocated)
>>>> needs to be protected for writing and ah->conf_mutex is used for the same.
>>>> Also, atomic contexts(say WMI events and certain mac_ops) that
>>>> we currently have in driver
>>>> will not(shouldn't be allowed) do any modifications but can read them and
>>>> rcu_read_lock() is used for the same.
>>>
>>> Please elaborate more about your locking design. Because of past bad
>>> contributions from Qualcomm the bar is really high for adding any new
>>> locks. I'm doing the locking analysis right now but it would help a lot
>>> if you could provide your own analysis.
>
> The new ah->conf_mutex is particularly introduced to protect the
> members and dynamically allocated link objects of ahvif and ahsta
> (ahvif/sta->links[]) in process context (i.e. between call backs from
> mac80211 and ath12k's workers)
> The same is protected by rcu in case of atomic contexts(tasklets of
> WMI and in datapath)
I need more info than that. I can't understand which conf_mutex protects
what data exactly, currently it just looks random to me.
Let's take an example:
static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
...
mutex_lock(&ah->conf_mutex);
arvif = &ahvif->deflink;
ar = ath12k_get_ar_by_vif(hw, vif);
if (!ar) {
cache = ath12k_arvif_get_cache(arvif);
...
mutex_lock(&ar->conf_mutex);
ath12k_mac_bss_info_changed(ar, arvif, info, changed);
So first mac80211 calls ath12k_mac_op_bss_info_changed() with wiphy
mutex held. Then ath12k takes ah->conf_mutex and soon after also
ar->conf_mutex. So we are basically holding three locks and it's not
clear for me the difference between ah and ar mutexes. For example, do
ath12k_get_ar_by_vif() & ath12k_arvif_get_cache() require ah->conf_mutex
to be held? Or why are we taking it here?
I guess ahvif->deflink access does not require any protection because in
ath12k_mac_op_tx() we access ahvif->deflink without any protection:
struct ath12k_link_vif *arvif = &ahvif->deflink;
Anyway, I just could not understand this locking design and besides it
just looks uncessarily complex. I propose dropping the new conf_mutex in
this patchset altogether and handle the locking in a separate patchset
later on.
AFAICS removing ah->conf_mutex from this patchset should be safe as
mac80211 is holding the wiphy mutex already. Of course I might have
missed something but at least that's what it looks like.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2024-08-09 14:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 16:55 [PATCH v6 0/3] wifi: ath12k: prepare vif and sta datastructure Rameshkumar Sundaram
2024-07-11 16:55 ` [PATCH v6 1/3] wifi: ath12k: prepare vif data structure for MLO handling Rameshkumar Sundaram
2024-07-16 20:38 ` Jeff Johnson
2024-08-05 9:56 ` Kalle Valo
2024-08-08 10:57 ` Kalle Valo
2024-08-08 16:42 ` Rameshkumar Sundaram
2024-08-09 14:29 ` Kalle Valo [this message]
2024-08-09 18:00 ` Rameshkumar Sundaram
2024-08-06 12:28 ` Kalle Valo
2024-08-06 16:02 ` Aditya Kumar Singh
2024-08-06 16:32 ` Kalle Valo
2024-07-11 16:55 ` [PATCH v6 2/3] wifi: ath12k: pass ath12k_link_vif instead of vif/ahvif Rameshkumar Sundaram
2024-07-11 16:55 ` [PATCH v6 3/3] wifi: ath12k: prepare sta data structure for MLO handling Rameshkumar Sundaram
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=87bk213h3i.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=ath12k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_ramess@quicinc.com \
--cc=quic_srirrama@quicinc.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).