Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1259804rwl; Sat, 25 Mar 2023 22:05:04 -0700 (PDT) X-Google-Smtp-Source: AKy350Z0nlo1gVaeMui/JMKEGVizH7Ay6qYpCJA0BP5DTILwNAjT5UNDogxd6V94LyLV8MZHZ4bj X-Received: by 2002:a17:902:e5c8:b0:19e:6eb0:a746 with SMTP id u8-20020a170902e5c800b0019e6eb0a746mr9951958plf.26.1679807104721; Sat, 25 Mar 2023 22:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679807104; cv=none; d=google.com; s=arc-20160816; b=JbHdqPAEbFl9WaApg4jdxyzBBnAGj7DAqEcbea9/liTnPqLOqKqwQ0ys3COyFpfhYq CrsgXVrT9utzfM9neLxkt7+0b5QLOsVkesdCZAWtEZmQxWabux74fmJ1/MWtJ8H76SMZ MwXCggvJVVpksmQDg3b3tD24N3ak57fosHc2jYqOwjievKv0dD+ILbEQoyCUOigfPR1I rV1vTZkeAtF5W+EH/vVCZX/5y5o/xawB+KkV6+0TvVTsjAGRrI8v4n6hXmhvZFYh+YCd CQz2oXQF9P4P8IjYTiUVHY1ixXyKu0SzPTKstBlysoTvcTZoavjfxwDhvk0Q8duNx5sv xklA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vrdZ1ENXUKsXYUhHxuCniJKJgXSUIk7kPQqo1dyQuWs=; b=Hb7dLDHoPzLjzVCNTTnw+IbPgrJiqA+w1zMbYy55fF6x0eOzFUXCXTlErEovQDWjQC jUItuiaw0eiqZ7TlVPDmp171ZRskW2f6GRB9XuIjtr28PxyiibiPOAmJZatH2yIywmC2 YBbZ/7s7oE3j5daVRVS7bg0R62U3YsXzMHPmoWMZo6Zqma/IO8Xuprs7/27C9bE/Nr3Z KBQrx7dHGaEyogw/Cxc/g6NlTE/98571o/gwsuo/2dEYZkv9SStyBBr8PSuQB3EZQ0AN DOH3uaJzeMRb42bPf4w1etaGnVN2eWns3x3JpHLU49qe2LaGVZ62LB7uWyi7fwq4P4fg Qxzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="KNDd7RM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iy9-20020a170903130900b0019ceb9491d2si24033454plb.391.2023.03.25.22.04.52; Sat, 25 Mar 2023 22:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="KNDd7RM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbjCZEEt (ORCPT + 99 others); Sun, 26 Mar 2023 00:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjCZEEr (ORCPT ); Sun, 26 Mar 2023 00:04:47 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7ECB753; Sat, 25 Mar 2023 21:04:45 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id y4so23141953edo.2; Sat, 25 Mar 2023 21:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679803484; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vrdZ1ENXUKsXYUhHxuCniJKJgXSUIk7kPQqo1dyQuWs=; b=KNDd7RM/hDhy33mGV1uyS5zhoCuORpXGzSE/1oCf/10gCPYitIN2q27foOYWquYZKR QtBuTMxU+XAedfYXNS23h/78kxBvH0p9y0296L2XDzzV24aCtNq9hDTiKVuWO6xVIutX V59GGavPWV6engQmsOZBuNlsgsQ93qoqIIxyPoerNq3tXv+s3fo0HSE7IcvBoD3SRjQA ahdyVMZr+zj1j5hp3MjqQxSIIDty+eiPIPl4WhZMpcmeHKSRm5kdWhvxWHAQaVVg8DAx OtFCzjddiJYJbWdeSy7aox9J03FvjzHQXFtEsJUsywNZrsWaP6Bc/1iQ+EnTnYB4P5nM X86A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679803484; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vrdZ1ENXUKsXYUhHxuCniJKJgXSUIk7kPQqo1dyQuWs=; b=k55pctr5dyfsfqUbN3R7n94HpGRVeHGfPYHyALWPBmMV4Hdd1Ix6Or4iccRctnCA71 Fo7P7WH0FND7TaUhq9+XJlUae0bUeDxYfGJ4Yb7rezED4VNB5Zw1veeKgYi4WXq0ZE68 gat8HfMgajwFd3D8ThjmKd4K4HmU7Lxcy7TxwMdTkgWTdIJh6DypisdXtAi9NGZBfXp7 Dp8rJedIGF4xvsh/znZYRMIrWQMAD65/n7kXRsjVPS0N0VDAujuJ1cCpL+j4fCaT7JZD UTK+l3PziarQxH9Uieg8v2PWkhE4gxeYRE26dHhqX348+5CCzyEWI1l6+Rqj+YXmWFlw 6qVQ== X-Gm-Message-State: AAQBX9elKmEHgWRhTaNiArNpByPc908qdD3A3fjEWwVd63hjAtFc8vPl qp3J/edrdPFB4Kle0PyjOYEeWrFtpMl+ge8KrSPpNTrExj1P7g== X-Received: by 2002:a17:906:891:b0:8b1:7569:b526 with SMTP id n17-20020a170906089100b008b17569b526mr3338697eje.11.1679803483782; Sat, 25 Mar 2023 21:04:43 -0700 (PDT) MIME-Version: 1.0 References: <20230325152417.5403-1-kerneljasonxing@gmail.com> In-Reply-To: From: Jason Xing Date: Sun, 26 Mar 2023 12:04:07 +0800 Message-ID: Subject: Re: [PATCH net] net: fix raising a softirq on the current cpu with rps enabled To: Eric Dumazet Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jason Xing Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 25, 2023 at 11:57=E2=80=AFPM Eric Dumazet = wrote: > > On Sat, Mar 25, 2023 at 8:26=E2=80=AFAM Jason Xing wrote: > > > > From: Jason Xing > > > > Since we decide to put the skb into a backlog queue of another > > cpu, we should not raise the softirq for the current cpu. When > > to raise a softirq is based on whether we have more data left to > > process later. As to the current cpu, there is no indication of > > more data enqueued, so we do not need this action. After enqueuing > > to another cpu, net_rx_action() function will call ipi and then > > another cpu will raise the softirq as expected. > > > > Also, raising more softirqs which set the corresponding bit field > > can make the IRQ mechanism think we probably need to start ksoftirqd > > on the current cpu. Actually it shouldn't happen. > > > > Fixes: 0a9627f2649a ("rps: Receive Packet Steering") > > Signed-off-by: Jason Xing > > --- > > net/core/dev.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/net/core/dev.c b/net/core/dev.c > > index 1518a366783b..bfaaa652f50c 100644 > > --- a/net/core/dev.c > > +++ b/net/core/dev.c > > @@ -4594,8 +4594,6 @@ static int napi_schedule_rps(struct softnet_data = *sd) > > if (sd !=3D mysd) { > > sd->rps_ipi_next =3D mysd->rps_ipi_list; > > mysd->rps_ipi_list =3D sd; > > - > > - __raise_softirq_irqoff(NET_RX_SOFTIRQ); > > return 1; > > } > > #endif /* CONFIG_RPS */ > > -- > > 2.37.3 > > > > This is not going to work in some cases. Please take a deeper look. > > I have to run, if you (or others) do not find the reason, I will give > more details when I am done traveling. I'm wondering whether we could use @mysd instead of @sd like this: if (!__test_and_set_bit(NAPI_STATE_SCHED, &mysd->backlog.state)) __raise_softirq_irqoff(NET_RX_SOFTIRQ); I traced back to some historical changes and saw some relations with this commit ("net: solve a NAPI race"): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3D39e6c8208d7b6fb9d2047850fb3327db567b564b Thanks, Jason