From: Simon Horman <horms@kernel.org>
To: Brian Vazquez <brianvv@google.com>
Cc: Brian Vazquez <brianvv.kernel@gmail.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
intel-wired-lan@lists.osuosl.org,
David Decotigny <decot@google.com>,
Anjali Singhai <anjali.singhai@intel.com>,
Sridhar Samudrala <sridhar.samudrala@intel.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
emil.s.tantilov@intel.com, Josh Hay <joshua.a.hay@intel.com>,
Luigi Rizzo <lrizzo@google.com>
Subject: Re: [iwl-net PATCH v2] idpf: fix a race in txq wakeup
Date: Fri, 2 May 2025 10:36:10 +0100 [thread overview]
Message-ID: <20250502093610.GE3339421@horms.kernel.org> (raw)
In-Reply-To: <CAMzD94SNJe3QcLgNCPtVqDa69B7qcghcBkSOPWzV43d_XAeYuQ@mail.gmail.com>
On Thu, May 01, 2025 at 12:51:48PM -0400, Brian Vazquez wrote:
> On Thu, May 1, 2025 at 11:16 AM Simon Horman <horms@kernel.org> wrote:
> >
> > On Mon, Apr 28, 2025 at 07:55:32PM +0000, Brian Vazquez wrote:
> > > Add a helper function to correctly handle the lockless
> > > synchronization when the sender needs to block. The paradigm is
> > >
> > > if (no_resources()) {
> > > stop_queue();
> > > barrier();
> > > if (!no_resources())
> > > restart_queue();
> > > }
> > >
> > > netif_subqueue_maybe_stop already handles the paradigm correctly, but
> > > the code split the check for resources in three parts, the first one
> > > (descriptors) followed the protocol, but the other two (completions and
> > > tx_buf) were only doing the first part and so race prone.
> > >
> > > Luckily netif_subqueue_maybe_stop macro already allows you to use a
> > > function to evaluate the start/stop conditions so the fix only requires
> > > the right helper function to evaluate all the conditions at once.
> > >
> > > The patch removes idpf_tx_maybe_stop_common since it's no longer needed
> > > and instead adjusts separately the conditions for singleq and splitq.
> > >
> > > Note that idpf_rx_buf_hw_update doesn't need to check for resources
> > > since that will be covered in idpf_tx_splitq_frame.
> >
> > Should the above read idpf_tx_buf_hw_update() rather than
> > idpf_rx_buf_hw_update()?
>
> Nice catch, that's a typo indeed.
Thanks. I only noticed because on reading the above I was looking
at idpf_rx_buf_hw_update(). Which turned out to not be very useful
in the context of reviewing this patch.
> > If so, I see that this is true when idpf_tx_buf_hw_update() is called from
> > idpf_tx_singleq_frame(). But is a check required in the case where
> > idpf_rx_buf_hw_update() is called by idpf_tx_singleq_map()?
>
> No, the check is not required. The call is at the end of
> idpf_tx_singleq_map at that point you already checked for resources
> and you're about to send the pkt.
Thanks for the clarification.
In that case this patch looks good to me.
(But please do fix the typo.)
Reviewed-by: Simon Horman <horms@kernel.org>
prev parent reply other threads:[~2025-05-02 9:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 19:55 [iwl-net PATCH v2] idpf: fix a race in txq wakeup Brian Vazquez
2025-04-29 1:42 ` Chittim, Madhu
2025-04-30 20:58 ` [Intel-wired-lan] " Jacob Keller
2025-05-01 15:16 ` Simon Horman
2025-05-01 16:51 ` Brian Vazquez
2025-05-02 9:36 ` Simon Horman [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=20250502093610.GE3339421@horms.kernel.org \
--to=horms@kernel.org \
--cc=anjali.singhai@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=brianvv.kernel@gmail.com \
--cc=brianvv@google.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lrizzo@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sridhar.samudrala@intel.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).