Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2260463rwl; Sun, 26 Mar 2023 19:33:37 -0700 (PDT) X-Google-Smtp-Source: AKy350YQGyPKIJivj62dwuaX6InzN8aFoLaQ4R5BuyzzWD7GzWhV/IOkMCjNxW94c7c4ru51HboY X-Received: by 2002:a17:906:8288:b0:933:44ef:851e with SMTP id h8-20020a170906828800b0093344ef851emr11329819ejx.55.1679884416772; Sun, 26 Mar 2023 19:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679884416; cv=none; d=google.com; s=arc-20160816; b=ug+xURt5JHML90zz1SIKBhdzmy/7S3Fbeznc46pT9xdewdnnPWQoWYOBSNqR/RQH/H lwKskRDLFxVVmdCp3AtgOm6pv3t1qkdwAFVZFLeyOeCWtTEMkNM16xG56ly3Sg8MwfS6 lk/LU0cgUu8hwC4YsdeGLqtvaHPKeYQu60OcouDaxHF17OHNzZhwowZ3uFEEjI9WUcDr F1PKK7FJjirHF8XTKsZmIsR04as3j5p7U9Vg5FrfWiJ/ruBaGtnpVVguiGVEWhVDfEQ4 JuMkm7y3FMuyGvFe52cqAouCfQjVBdxWs44Wzlblfvh7j3xf+oARdAcI/PFTOgnwle5h Q4jg== 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=KEKMQ//sgZgh2Mb71h08sVFHOl6IgD+xXmIsoUisjIE=; b=ZbyO8u2SWtQEwMeX32i/k74ztDNXl7a8vVG/ZJCXTBqGYLXA7C2+8CPKqJqBFsbWPu DyCOCaf3gi0ifQVkCnDCK6tuUOBUEjjbViiy31QdjKTJEeLST7eNYNc3pWQ1oc99hqjV qVwvUIvwXF7OnVFEWpjAYrnsxtPfBxAFhBeX6BrabERoxsJ6L9Pztavbq/0nr6FNFXNH /aV2uFTg3YxDoawS5eGYaDQU6/UoaeloqRp2x7rPLrY6fQaNsdtursXoSbxCZ5ZISSzB d2pFsgwzcQRaGvYFj0XIqXqJUqLA6wrGKuZP1VV7HRpmXxsUsGXLP3LsYXkbR55jPYlh KWxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=U50NhQlr; 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 ud26-20020a170907c61a00b00932a33a374csi17362587ejc.170.2023.03.26.19.33.10; Sun, 26 Mar 2023 19:33:36 -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=U50NhQlr; 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 S230386AbjC0C0N (ORCPT + 99 others); Sun, 26 Mar 2023 22:26:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjC0C0K (ORCPT ); Sun, 26 Mar 2023 22:26:10 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B44D49CB; Sun, 26 Mar 2023 19:26:09 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id eg48so29710633edb.13; Sun, 26 Mar 2023 19:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679883968; 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=KEKMQ//sgZgh2Mb71h08sVFHOl6IgD+xXmIsoUisjIE=; b=U50NhQlrcsiBrL+ES0XyqT67HLtli94VrhiODol4xuPdZB6LHOV/GbbPKTsFEE+LRd EOroH+0Jh03k2DGByBnhiFvUCImUz7ZqIuFCizBOmFREae5AM6fvyod+Cq0cxReveEsu TguP202q2dVbPlaiy1MYlt59WNcVtCbbV5E7dzxlIlkcy79qF8puFfqAcQ+eM2xBZDoR n2fIhZa9VLaqziKejQxR+WiD3fYmALN8vzm+qad4pexEm0Y51rTP1ZDYbdfC16ZBXWpZ FoDOLCo+cr8hjBGLVeFePsiXmahPVYdhhdKDdz6Y7529Xf3nn5RuKl2cnccnHjP4K0c/ 7PIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679883968; 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=KEKMQ//sgZgh2Mb71h08sVFHOl6IgD+xXmIsoUisjIE=; b=7HpgledsbxkEYZtusXcY0bu5KE/Uz1LGGabqCh4BxSpBsAwnhvxnVBYDH4cSqwB0t6 il29/8gb6kly1YFE6tv3aIMm3SlA3yT2S+83jKRf/hjxjoAIP0qtgkAiN6JIhipAalHS +VjM84D8FlsuIpmMhp1UVL+wJ9Jj316cYMUzskf2SQVSd+Sy5JZGVIwPJ29PvZZ5oU3H 0Eq+aM+osWFr9AItPjuM4v0mGWeLOm409eO1znQwcle3Du45fgev9GTtWSnZi3+Y2M0A j610gRQNFDUQc+z4c+uBQu1ueR6ZLXoF/pmh5AfmDhdyevx/sBgNoacNzxmILx0hrFaT +Q6g== X-Gm-Message-State: AAQBX9c6JIGF4BlJ5TvNK4WgLj1A9EQdKkJ0WBMLzfTKzU5rT8x5xRWS E/85kJK6GLRWAeMnVyKUbpRiYP3HrXOs0C1oEiA= X-Received: by 2002:a17:906:891:b0:8b1:7569:b526 with SMTP id n17-20020a170906089100b008b17569b526mr4314015eje.11.1679883967999; Sun, 26 Mar 2023 19:26:07 -0700 (PDT) MIME-Version: 1.0 References: <20230325152417.5403-1-kerneljasonxing@gmail.com> In-Reply-To: From: Jason Xing Date: Mon, 27 Mar 2023 10:25:31 +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 Mon, Mar 27, 2023 at 1:35=E2=80=AFAM Eric Dumazet = wrote: > > > > > Forgive me. Really I need some coffee. I made a mistake. This line > > above should be: > > > > + if (!test_bit(NAPI_STATE_SCHED, &mysd->backlog.state)) > > > > But the whole thing doesn't feel right. I need a few days to dig into > > this part until Eric can help me with more of it. > > > > I am still traveling, and this is weekend time :/ Thanks for your time, Eric, really appreciate it. > > It should not be too hard to read net/core/dev.c and remember that not > _all_ drivers (or some core networking functions) use the NAPI model. > > eg look at netif_rx() and ask yourself why your patch is buggy. Yes, it is. In my last email I sent yesterday I encountered one issue which exactly happened when I started hundreds of iperf processes transmitting data to loopback. It got stuck :( So I realized it is the non-napi case that triggers such a problem. > > Just look at callers of enqueue_to_backlog() and ask yourself if all > of them are called from net_rx_action() > > [The answer is no, just in case you wonder] > > In order to add your optimization, more work is needed, like adding > new parameters so that we do not miss critical > __raise_softirq_irqoff(NET_RX_SOFTIRQ) when _needed_. Thanks, I need to do more work/study on it. > > We keep going circles around softirq deficiencies, I feel you are > trying to fix a second-order 'issue'. Right, going circles gives me a headache. > > Real cause is elsewhere, look at recent patches from Jakub. After you pointed out, I searched and found there is indeed one patchset in= 2022 The tile like this: [PATCH 0/3] softirq: uncontroversial change Thanks, Jason > > Thanks.