From: Jakub Kicinski <kuba@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: <netdev@vger.kernel.org>, "'Andrew Lunn'" <andrew+netdev@lunn.ch>,
"'David S. Miller'" <davem@davemloft.net>,
"'Eric Dumazet'" <edumazet@google.com>,
"'Paolo Abeni'" <pabeni@redhat.com>,
"'Simon Horman'" <horms@kernel.org>,
"'Jacob Keller'" <jacob.e.keller@intel.com>,
"'Mengyuan Lou'" <mengyuanlou@net-swift.com>
Subject: Re: [PATCH net-next v4 4/4] net: wangxun: support to use adaptive RX/TX coalescing
Date: Wed, 20 Aug 2025 08:45:13 -0700 [thread overview]
Message-ID: <20250820084513.587f560b@kernel.org> (raw)
In-Reply-To: <0bea01dc1175$d1394730$73abd590$@trustnetic.com>
On Wed, 20 Aug 2025 09:57:43 +0800 Jiawen Wu wrote:
> On Sat, Aug 16, 2025 2:19 AM, Jakub Kicinski wrote:
> > On Tue, 12 Aug 2025 09:50:23 +0800 Jiawen Wu wrote:
> > > @@ -878,6 +909,8 @@ static int wx_poll(struct napi_struct *napi, int budget)
> > >
> > > /* all work done, exit the polling mode */
> > > if (likely(napi_complete_done(napi, work_done))) {
> > > + if (wx->adaptive_itr)
> > > + wx_update_dim_sample(q_vector);
> >
> > this is racy, napi is considered released after napi_complete_done()
> > returns. So napi_disable() can succeed right after that point...
> >
> > > @@ -1611,6 +1708,8 @@ void wx_napi_disable_all(struct wx *wx)
> > > for (q_idx = 0; q_idx < wx->num_q_vectors; q_idx++) {
> > > q_vector = wx->q_vector[q_idx];
> > > napi_disable(&q_vector->napi);
> > > + cancel_work_sync(&q_vector->rx.dim.work);
> > > + cancel_work_sync(&q_vector->tx.dim.work);
> >
> > so you may end up with the DIM work scheduled after the device is
> > stopped.
>
> But the DIM work doesn't seem to be concerned about the status of napi.
> And even if the device is stopped, setting itr would not cause any errors.
>
> I can't fully grasp this point...
> Should I move cancel_work_sync() in front of napi_disable()?
My point is that this is possible today:
CPU 0 CPU 1
napi_complete_done()
napi_disable()
cancel_work()
wx_update_dim_sample()
schedule_work()
You can probably use disable_work_sync() and enable_work..
to fix it.
next prev parent reply other threads:[~2025-08-20 15:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 1:50 [PATCH net-next v4 0/4] net: wangxun: complete ethtool coalesce options Jiawen Wu
2025-08-12 1:50 ` [PATCH net-next v4 1/4] net: ngbe: change the default ITR setting Jiawen Wu
2025-08-12 11:11 ` Michal Swiatkowski
2025-08-12 1:50 ` [PATCH net-next v4 2/4] net: wangxun: limit tx_max_coalesced_frames_irq Jiawen Wu
2025-08-12 1:50 ` [PATCH net-next v4 3/4] net: wangxun: cleanup the code in wx_set_coalesce() Jiawen Wu
2025-08-12 11:12 ` Michal Swiatkowski
2025-08-12 1:50 ` [PATCH net-next v4 4/4] net: wangxun: support to use adaptive RX/TX coalescing Jiawen Wu
2025-08-15 18:18 ` Jakub Kicinski
2025-08-20 1:57 ` Jiawen Wu
2025-08-20 15:45 ` Jakub Kicinski [this message]
2025-08-21 1:45 ` Jiawen Wu
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=20250820084513.587f560b@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jiawenwu@trustnetic.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.