netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC v2] net/core: add optional threading for rps backlog processing
Date: Fri, 17 Feb 2023 16:54:11 +0100	[thread overview]
Message-ID: <CANn89i+rCxZgzoM2qJ5yB1NnJoQpovS6_8xdrX5yrxxcC-x9dg@mail.gmail.com> (raw)
In-Reply-To: <b163bfe3-0b91-e2cf-f702-8ab08a30db0d@nbd.name>

On Fri, Feb 17, 2023 at 4:26 PM Felix Fietkau <nbd@nbd.name> wrote:

>
> > Then, process_backlog() has been designed to run only from the cpu
> > tied to the per-cpu data (softnet_data)
> > There are multiple comments about this assumption, and various things
> > that would need to be changed
> > (eg sd_has_rps_ipi_waiting() would be wrong in its current implementation)
> That's why I added the NAPI_STATE_THREADED check in napi_schedule_rps,
> so that sd_has_rps_ipi_waiting would always return false.
> Or are you worried about a race when enabling threading?
>

Please look at all uses of sd->process_queue, without locking. They do
not care about NAPI_STATE_THREADED

flush_backlog() is one instance, but process_backlog() is also using
__skb_dequeue(&sd->process_queue)

I suspect the following patch would work today, and would show
process_queue lock is not used.

diff --git a/net/core/dev.c b/net/core/dev.c
index 5687b528d4c18ef2960edb6bf3161bbad666aece..bed540b417a1b4cd3e384611a4681b8e2a43fd30
100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11396,7 +11396,7 @@ static int __init net_dev_init(void)
                INIT_WORK(flush, flush_backlog);

                skb_queue_head_init(&sd->input_pkt_queue);
-               skb_queue_head_init(&sd->process_queue);
+               __skb_queue_head_init(&sd->process_queue);
 #ifdef CONFIG_XFRM_OFFLOAD
                skb_queue_head_init(&sd->xfrm_backlog);
 #endif

      reply	other threads:[~2023-02-17 15:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 10:06 [RFC v2] net/core: add optional threading for rps backlog processing Felix Fietkau
2023-02-17 12:23 ` Eric Dumazet
2023-02-17 12:35   ` Felix Fietkau
2023-02-17 12:57     ` Eric Dumazet
2023-02-17 13:40       ` Felix Fietkau
2023-02-17 14:38         ` Eric Dumazet
2023-02-17 15:26           ` Felix Fietkau
2023-02-17 15:54             ` Eric Dumazet [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=CANn89i+rCxZgzoM2qJ5yB1NnJoQpovS6_8xdrX5yrxxcC-x9dg@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@nbd.name \
    --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 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).