From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] mt76: refactor cc_lock locking scheme
Date: Tue, 15 Oct 2019 17:54:44 +0200 [thread overview]
Message-ID: <20191015155444.GA10108@localhost.localdomain> (raw)
In-Reply-To: <20191015154250.GA18262@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]
> On Tue, Oct 15, 2019 at 05:16:43PM +0200, Lorenzo Bianconi wrote:
> > Read busy counters not holding cc_lock spinlock since usb read can't be
> > performed in interrupt context. Move cc_active and cc_rx counters out of
> > cc_lock since they are not modified in interrupt context.
> > Grab cc_lock updating cur_cc_bss_rx in mt76_airtime_report and do not
> > hold rx_lock in mt76_update_survey.
> <snip>
> > Fixes: 168aea24f4bb ("mt76: mt76x02u: enable survey support")
>
> I think problem was introduced currently in mt76 driver version
> that is not yet in mainline tree, so this is not right commit.
> On Linus' tree we still read registers outside of cc_lock section.
Hi Stanislaw,
yes, you are right. We should drop the Fixes tag. Thx
>
> void mt76x02_update_channel(struct mt76_dev *mdev)
> {
> ...
>
> busy = mt76_rr(dev, MT_CH_BUSY);
> active = busy + mt76_rr(dev, MT_CH_IDLE);
>
> spin_lock_bh(&dev->mt76.cc_lock);
> state->cc_busy += busy;
> state->cc_active += active;
> spin_unlock_bh(&dev->mt76.cc_lock);
> }
>
> > if (dev->drv->drv_flags & MT_DRV_SW_RX_AIRTIME) {
> > - spin_lock_bh(&dev->rx_lock);
> > - spin_lock(&dev->cc_lock);
> > + spin_lock_bh(&dev->cc_lock);
> > state->cc_bss_rx += dev->cur_cc_bss_rx;
> > dev->cur_cc_bss_rx = 0;
> > - spin_unlock(&dev->cc_lock);
> > - spin_unlock_bh(&dev->rx_lock);
> > + spin_unlock_bh(&dev->cc_lock);
>
> Why dev->rx_lock was needed before and is not needed now ?
Looking at the code I think rx_lock is not needed here since cur_cc_bss_rx is
updated without holding rx_lock in mt76_airtime_report() (we need cc_lock
there).
Regards,
Lorenzo
>
> Stanislaw
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2019-10-15 15:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 15:16 [PATCH v2] mt76: refactor cc_lock locking scheme Lorenzo Bianconi
2019-10-15 15:42 ` Stanislaw Gruszka
2019-10-15 15:54 ` Lorenzo Bianconi [this message]
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=20191015155444.GA10108@localhost.localdomain \
--to=lorenzo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=sgruszka@redhat.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).