linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pkshih <pkshih@realtek.com>
To: "briannorris@chromium.org" <briannorris@chromium.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"tony0620emma@gmail.com" <tony0620emma@gmail.com>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	Bernie Huang <phhuang@realtek.com>
Subject: Re: [PATCH v4 3/8] rtw88: add napi support
Date: Tue, 9 Feb 2021 07:19:03 +0000	[thread overview]
Message-ID: <1612855085.8436.15.camel@realtek.com> (raw)
In-Reply-To: <e8e451faf35e47b494f6d49fe92d1858@realtek.com>

On Mon, 2021-02-01 at 06:38 +0000, Pkshih wrote:
> > -----Original Message-----
> > From: Brian Norris [mailto:briannorris@chromium.org]
> > Sent: Saturday, January 30, 2021 7:39 AM
> > To: Pkshih
> > Cc: Yan-Hsuan Chuang; Kalle Valo; linux-wireless; Bernie Huang
> > Subject: Re: [PATCH v4 3/8] rtw88: add napi support
> > 
> > On Thu, Jan 28, 2021 at 1:45 AM Pkshih <pkshih@realtek.com> wrote:
> > > > -----Original Message-----
> > > > From: Brian Norris [mailto:briannorris@chromium.org]
> > > > On Fri, Jan 15, 2021 at 1:26 AM Ping-Ke Shih <pkshih@realtek.com> wrote:
> > > > > +static u32 rtw_pci_rx_napi(struct rtw_dev *rtwdev, struct rtw_pci
> *rtwpci,
> > > > >                            u8 hw_queue)
> > > > ...
> > > >
> > > > Are you sure you don't want any locking in rtw_pci_rx_napi()?
> > > > Previously, you held irq_lock for the entirety of rtw_pci_rx_isr(),
> > > > but now all the RX work is being deferred to a NAPI context, without
> > > > any additional lock. IIUC, that means you can be both handling RX and
> > > > other ISR operations at the same time. Is that intentional?
> > > >
> > >
> > > irq_lock is used to protect TX ring->queue. The TX skb(s) are queued into
> the
> > > queue, and unlink the skb until TX_OK_ISR is received. So, RX doesn't need
> to
> > > hold this lock.
> > 
> > I could be misunderstanding your locking model, but IIUC, you're left
> > with zero locking between NAPI RX and all other operations (H2C, link
> > up/down -- including DMA free, etc.). irq_lock used to protect you
> > from that.
> > 
> 
> Sorry, I'm wrong. I think irq_lock is used to protect not only TX ring->queue
> but also TX/RX rings. The RX ring rtwpci->rx_rings[RTW_RX_QUEUE_MPDU] is reset
> by rtw_pci_reset_buf_desc() when pci_stop(), and napi_poll() also uses it to
> know how many RX packets are needed to be received. Therefore, we plan to
> use irq_lock to protect napi_poll(), and then see if it affects performance.
> 

I change my mind, because using irq_lock to protect napi_poll causes deadlock.
I think that it's disallowed to hold a spin_lock_bh and call napi APIs that uses
RCU lock.

Then, I have another simple thinking -- enable NAPI only if interrupt is
enabled. Other operations with RX ring are working only if interrupt is
disabled. So, we don't need a lock to protect RX ring at all.

The irq_lock is still used to protect TX ring/queue, and now it also used
to protect switching IMR. Some comments are added to describe about this.

Above is implemented in v5.

---
Ping-Ke



  reply	other threads:[~2021-02-09  7:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  9:23 [PATCH v4 0/8] rtw88: improve TX performance in field Ping-Ke Shih
2021-01-15  9:23 ` [PATCH v4 1/8] rtw88: add dynamic rrsr configuration Ping-Ke Shih
2021-02-08 10:50   ` Kalle Valo
2021-01-15  9:23 ` [PATCH v4 2/8] rtw88: add rts condition Ping-Ke Shih
2021-01-15  9:24 ` [PATCH v4 3/8] rtw88: add napi support Ping-Ke Shih
2021-01-22 22:57   ` Brian Norris
2021-01-28  9:45     ` Pkshih
2021-01-29 23:39       ` Brian Norris
2021-02-01  6:38         ` Pkshih
2021-02-09  7:19           ` Pkshih [this message]
2021-02-11 20:30             ` Brian Norris
2021-01-15  9:24 ` [PATCH v4 4/8] rtw88: replace tx tasklet with work queue Ping-Ke Shih
2021-01-22 22:59   ` Brian Norris
2021-01-15  9:24 ` [PATCH v4 5/8] rtw88: 8822c: update MAC/BB parameter tables to v60 Ping-Ke Shih
2021-01-15  9:24 ` [PATCH v4 6/8] rtw88: 8822c: update RF_A " Ping-Ke Shih
2021-01-15  9:24 ` [PATCH v4 7/8] rtw88: 8822c: update RF_B (1/2) " Ping-Ke Shih
2021-01-15  9:24 ` [PATCH v4 8/8] rtw88: 8822c: update RF_B (2/2) " 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=1612855085.8436.15.camel@realtek.com \
    --to=pkshih@realtek.com \
    --cc=briannorris@chromium.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=phhuang@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;
as well as URLs for NNTP newsgroup(s).