From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Rany Hany <rany_hany@riseup.net>
Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 04/13] wifi: mt76: mt7615: rely on shared sta_poll_list and sta_poll_lock
Date: Mon, 29 May 2023 22:22:21 +0200 [thread overview]
Message-ID: <ZHUJfSxIEOzjZnYt@lore-desk> (raw)
In-Reply-To: <f99f3a85-494a-b796-189a-99cf5976c3be@riseup.net>
[-- Attachment #1: Type: text/plain, Size: 5714 bytes --]
> Hi,
Hi,
>
> On 5/29/23 13:40, Lorenzo Bianconi wrote:
> > Rely on sta_poll_list and sta_poll_lock fields in mt76_dev structure
> > and get rid of private copies.
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> > .../net/wireless/mediatek/mt76/mt7615/init.c | 2 --
> > .../net/wireless/mediatek/mt76/mt7615/mac.c | 19 ++++++++++---------
> > .../net/wireless/mediatek/mt76/mt7615/main.c | 8 ++++----
> > .../wireless/mediatek/mt76/mt7615/mt7615.h | 3 ---
> > 4 files changed, 14 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> > index 621e69f07e3c..155931978ed8 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> > @@ -626,8 +626,6 @@ void mt7615_init_device(struct mt7615_dev *dev)
> > INIT_DELAYED_WORK(&dev->coredump.work, mt7615_coredump_work);
> > skb_queue_head_init(&dev->phy.scan_event_list);
> > skb_queue_head_init(&dev->coredump.msg_list);
> > - INIT_LIST_HEAD(&dev->sta_poll_list);
> > - spin_lock_init(&dev->sta_poll_lock);
> > init_waitqueue_head(&dev->reset_wait);
> > init_waitqueue_head(&dev->phy.roc_wait);
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> > index d90378a30d15..a6d267c56dd4 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> > @@ -387,10 +387,11 @@ static int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)
> > struct mt7615_sta *msta;
> >
> > msta = container_of(status->wcid, struct mt7615_sta, wcid);
> > - spin_lock_bh(&dev->sta_poll_lock);
> > + spin_lock_bh(&dev->mt76.sta_poll_lock);
> > if (list_empty(&msta->poll_list))
> > - list_add_tail(&msta->poll_list, &dev->sta_poll_list);
> > - spin_unlock_bh(&dev->sta_poll_lock);
> > + list_add_tail(&msta->poll_list,
> > + &dev->mt76.sta_poll_list);
> > + spin_unlock_bh(&dev->mt76.sta_poll_lock);
> > }
> >
> > if (mt76_is_mmio(&dev->mt76) && (rxd0 & csum_mask) == csum_mask &&
> > @@ -905,9 +906,9 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev)
> > int i;
> >
> > INIT_LIST_HEAD(&sta_poll_list);
> > - spin_lock_bh(&dev->sta_poll_lock);
> > - list_splice_init(&dev->sta_poll_list, &sta_poll_list);
> > - spin_unlock_bh(&dev->sta_poll_lock);
> > + spin_lock_bh(&dev->mt76.sta_poll_lock);
> > + list_splice_init(&dev->mt76.sta_poll_list, &sta_poll_list);
> > + spin_unlock_bh(&dev->mt76.sta_poll_lock);
> >
> > while (!list_empty(&sta_poll_list)) {
> > bool clear = false;
> > @@ -1539,10 +1540,10 @@ static void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data)
> > msta = container_of(wcid, struct mt7615_sta, wcid);
> > sta = wcid_to_sta(wcid);
> >
> > - spin_lock_bh(&dev->sta_poll_lock);
> > + spin_lock_bh(&dev->mt76.sta_poll_lock);
> > if (list_empty(&msta->poll_list))
> > - list_add_tail(&msta->poll_list, &dev->sta_poll_list);
> > - spin_unlock_bh(&dev->sta_poll_lock);
> > + list_add_tail(&msta->poll_list, &dev->mt76.sta_poll_list);
> > + spin_unlock_bh(&dev->mt76.sta_poll_lock);
> >
> > if (mt7615_mac_add_txs_skb(dev, msta, pid, txs_data))
> > goto out;
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> > index ab4c1b4478aa..2a5462bd54c2 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> > @@ -274,10 +274,10 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
> >
> > mt7615_mutex_release(dev);
> >
> > - spin_lock_bh(&dev->sta_poll_lock);
> > + spin_lock_bh(&dev->mt76.sta_poll_lock);
> > if (!list_empty(&msta->poll_list))
> > list_del_init(&msta->poll_list);
> > - spin_unlock_bh(&dev->sta_poll_lock);
> > + spin_unlock_bh(&dev->mt76.sta_poll_lock);
> >
> > mt76_packet_id_flush(&dev->mt76, &mvif->sta.wcid);
> > }
> > @@ -677,10 +677,10 @@ void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
> > if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
> > mt7615_mcu_add_bss_info(phy, vif, sta, false);
> >
> > - spin_lock_bh(&dev->sta_poll_lock);
> > + spin_lock_bh(&mdev->sta_poll_lock);
> > if (!list_empty(&msta->poll_list))
> > list_del_init(&msta->poll_list);
> > - spin_unlock_bh(&dev->sta_poll_lock);
> > + spin_unlock_bh(&mdev->sta_poll_lock);
> >
> > mt76_connac_power_save_sched(phy->mt76, &dev->pm);
> > }
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
> > index 0381c53bc96a..7386495f8299 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
> > @@ -262,9 +262,6 @@ struct mt7615_dev {
> > wait_queue_head_t reset_wait;
> > u32 reset_state;
> >
> > - struct list_head sta_poll_list;
> > - spinlock_t sta_poll_lock;
> > -
> > struct {
> > u8 n_pulses;
> > u32 period;
>
> From code review on GitHub, you did not update to use the shared sta_poll_lock in line 919 and 921.
The fix below is not part of wireless-next yet:
commit 30bc32c7c1f975cc3c14e1c7dc437266311282cf
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Wed May 24 16:39:32 2023 +0200
wifi: mt76: mt7615: fix possible race in mt7615_mac_sta_poll
I will repost when it is merged in wireless-next/Felix's tree.
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-05-29 20:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-29 10:40 [PATCH 00/13] move some common mac fields in shared code Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 01/13] wifi: mt76: mt7921: make mt7921_mac_sta_poll static Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 02/13] wifi: mt76: mt7915: move sta_poll_list and sta_poll_lock in mt76_dev Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 03/13] wifi: mt76: mt7603: rely on shared sta_poll_list and sta_poll_lock Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 04/13] wifi: mt76: mt7615: " Lorenzo Bianconi
2023-05-29 18:06 ` Rany Hany
2023-05-29 20:22 ` Lorenzo Bianconi [this message]
2023-05-29 10:40 ` [PATCH 05/13] wifi: mt76: mt7996: " Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 06/13] wifi: mt76: mt7921: " Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 07/13] wifi: mt76: mt7915: move poll_list in mt76_wcid Lorenzo Bianconi
2023-05-29 10:40 ` [PATCH 08/13] wifi: mt76: mt7603: rely on shared poll_list field Lorenzo Bianconi
2023-05-29 10:41 ` [PATCH 09/13] wifi: mt76: mt7615: " Lorenzo Bianconi
2023-05-29 10:41 ` [PATCH 10/13] wifi: mt76: mt7996: " Lorenzo Bianconi
2023-05-29 10:41 ` [PATCH 11/13] wifi: mt76: mt7921: " Lorenzo Bianconi
2023-05-29 10:41 ` [PATCH 12/13] wifi: mt76: move ampdu_state in mt76_wcid Lorenzo Bianconi
2023-05-29 10:41 ` [PATCH 13/13] mt76: connac: move more mt7921/mt7915 mac shared code in connac lib Lorenzo Bianconi
2023-05-29 13:11 ` kernel test robot
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=ZHUJfSxIEOzjZnYt@lore-desk \
--to=lorenzo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=rany_hany@riseup.net \
/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