Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1753284rdb; Mon, 9 Oct 2023 01:28:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGBTdqWm6aFB3sIrKjMpZeoKjZg6OK8MGfEWdKTLCsVCmkYLMeRY4y1tJtuPH6Rkj/QJ4x X-Received: by 2002:a17:902:db0c:b0:1c7:54ee:c560 with SMTP id m12-20020a170902db0c00b001c754eec560mr13039440plx.55.1696840082239; Mon, 09 Oct 2023 01:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696840082; cv=none; d=google.com; s=arc-20160816; b=J7vPROZ+bdOqPXVmUJ7Xv8FX6DamBwohF+gz0kuT0/XJPlUiI7g/MHyFxjSP6dv56e j4B3PGgOWOu7xjHbzS492EDBsrP90QesnsQ9TjfKvrtPXaAUTARyA9bnmI80VFicmss8 WZY7jEuzEybLITDDCT/ZcOGiHqyg2FEH+vzsi7tu+JrEUzIazN9sYKvmdeUZdVOQihRW n9LOT+cd2VZrHvbvQotbWOZlWdzbyVRoZo6RFXgItgq0n1XAhEJZz4Gz6i4pileNxuZM q80Fa1jgcfYNrZNgUmowWwT+myj7n9LInESx7z8178684HKlJHfGAVauTiRGiTsyN6p7 GM2Q== 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=U/6BMjrzXld+2G2niRt8GwZnrjwExfOE5RsZF3IWDsg=; fh=BrqZMW8jZrPvQPkx1Q1LARmakMyYMGjLZPpVcJ2dAQs=; b=FR6fVRwQkxqcpD//WBUih1xhOKepZhCXjilqVvwXdw02bqlef17Rak9/UhrDixqcIX TWlSfKYfNd2xh691pAtRZN2k0P/5OkHhIJYKcVl3jRWyZpyzmpSSlLrw22lusmOnbxAU Gx6X+rxGAPPeCPleyhnidwsxbR6Y+f4rrxmv2ePPsLPwURVmMBmdoL9YxaJ3wuvI0LGu aaaAAtDRa/mobuVQ0oPfhNoRnkapxYuMdzTgi7mSA2mBkzSIQUQsylbBRGmeHk2B4RSG 5kh7dQ6H9kzvtDK3RNmXOujISZVgWJOL06OQum7SgmP7ZIIoqkDvEZ7CtjeF56+ax5sz SmHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=1Fvemo0z; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id n21-20020a170903405500b001bdf67d6a8fsi8733613pla.40.2023.10.09.01.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 01:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=1Fvemo0z; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id CDB9580963AD; Mon, 9 Oct 2023 01:27:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234441AbjJII1t (ORCPT + 52 others); Mon, 9 Oct 2023 04:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234407AbjJII1s (ORCPT ); Mon, 9 Oct 2023 04:27:48 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C20AB for ; Mon, 9 Oct 2023 01:27:45 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-51e24210395so12393a12.0 for ; Mon, 09 Oct 2023 01:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696840064; x=1697444864; darn=vger.kernel.org; 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=U/6BMjrzXld+2G2niRt8GwZnrjwExfOE5RsZF3IWDsg=; b=1Fvemo0zUEKWZz2P8ySOREgI6whV3blDLPFWkyKqFgGnIo++FsYUKbIP4/v7ivCHeK HKlpENY6UMOXVLbHCvDYYYK7MoDXsUjMfHaZ2UEdldT75b1O/Er2Yh5btjd8ZUJhWuAd rVQ5SV3f0XtPlgMiXb6nEWyN+j70uil5mEVNJMGPArnD4m9tOasbYa/FL/1FBiiPftff ROaXOl2frpDh74+GBeY+SLMfKPaygCn7bRT6t9RBAjQ9mFprSkkPJTtoSWBen/+EmpvI 4i0JPXoO2v2LotPZrj3m0CSHW6K7VQ44iqg4uuGaSz02JOkwqxGqIucOTdLbhRGbURkW lIbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696840064; x=1697444864; 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=U/6BMjrzXld+2G2niRt8GwZnrjwExfOE5RsZF3IWDsg=; b=Hkm+S8rPi84IKyNHYzoO0YLuJUfkUnAlO2fO7/WT3j4bKetQaSWbH3jeQfrqnbKzYT /rwZl55bDRlNU9VtVS03/5IwvpYLWao+FKLxG73+GyDkrO2pa07rfHkVnds8QXIGX+p5 rZkJ4epBYTcu0kzqDPvCaIgoix92RlxDCR80Z2TBZVUUGt4cThnC4+quB5RwKjSS77S3 o1tdU15I/gcmkIMvAT6g3tGeRyXm28aZFHOlH5a+ot84Morx0P7kc2kIuV+Y0Iqx35bs VCaMj/mnxzosDMYExffsPVqDO+ZCmWMpVnCePLkjAiMguypuifJKahsDdeT97NVq/co8 Negw== X-Gm-Message-State: AOJu0Yzo3E3t7d36uxY3BQQcxPc8EK1UathymcE7nEsAHICqTT9oCbFO TVAzuSvQ0QCl2j1wToVRCoK5d+j3eq3ISyw903kQzw== X-Received: by 2002:a50:9fa4:0:b0:538:5f9e:f0fc with SMTP id c33-20020a509fa4000000b005385f9ef0fcmr350450edf.0.1696840063815; Mon, 09 Oct 2023 01:27:43 -0700 (PDT) MIME-Version: 1.0 References: <20231003145150.2498-1-ansuelsmth@gmail.com> <20231003145150.2498-4-ansuelsmth@gmail.com> <652056c5.5d0a0220.2b60d.c5dc@mx.google.com> <6522f495.df0a0220.326ed.de6c@mx.google.com> In-Reply-To: <6522f495.df0a0220.326ed.de6c@mx.google.com> From: Eric Dumazet Date: Mon, 9 Oct 2023 10:27:32 +0200 Message-ID: Subject: Re: [net-next PATCH v2 4/4] netdev: use napi_schedule bool instead of napi_schedule_prep/__napi_schedule To: Christian Marangi Cc: Jason Gunthorpe , Leon Romanovsky , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Chris Snook , Raju Rangoju , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Douglas Miller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Nick Child , Haren Myneni , Rick Lindsley , Dany Madden , Thomas Falcon , Tariq Toukan , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Krzysztof Halasa , Kalle Valo , Jeff Johnson , Gregory Greenman , Chandrashekar Devegowda , Intel Corporation , Chiranjeevi Rapolu , Liu Haijun , M Chetan Kumar , Ricardo Martinez , Loic Poulain , Sergey Ryazanov , Johannes Berg , Yuanjun Gong , Simon Horman , Rob Herring , Ziwei Xiao , Rushil Gupta , Coco Li , Thomas Gleixner , Junfeng Guo , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Wei Fang , Krzysztof Kozlowski , Yuri Karpov , Zhengchao Shao , Andrew Lunn , Zheng Zengkai , Lee Jones , Maximilian Luz , "Rafael J. Wysocki" , Dawei Li , Anjaneyulu , Benjamin Berg , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 01:27:59 -0700 (PDT) On Sun, Oct 8, 2023 at 8:27=E2=80=AFPM Christian Marangi wrote: > > On Sun, Oct 08, 2023 at 09:08:41AM +0200, Eric Dumazet wrote: > > On Fri, Oct 6, 2023 at 8:49=E2=80=AFPM Christian Marangi wrote: > > > > > > On Thu, Oct 05, 2023 at 06:16:26PM +0200, Eric Dumazet wrote: > > > > On Tue, Oct 3, 2023 at 8:36=E2=80=AFPM Christian Marangi wrote: > > > > > > > > > > Replace if condition of napi_schedule_prep/__napi_schedule and us= e bool > > > > > from napi_schedule directly where possible. > > > > > > > > > > Signed-off-by: Christian Marangi > > > > > --- > > > > > drivers/net/ethernet/atheros/atlx/atl1.c | 4 +--- > > > > > drivers/net/ethernet/toshiba/tc35815.c | 4 +--- > > > > > drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 4 +--- > > > > > 3 files changed, 3 insertions(+), 9 deletions(-) > > > > > > > > > > diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/n= et/ethernet/atheros/atlx/atl1.c > > > > > index 02aa6fd8ebc2..a9014d7932db 100644 > > > > > --- a/drivers/net/ethernet/atheros/atlx/atl1.c > > > > > +++ b/drivers/net/ethernet/atheros/atlx/atl1.c > > > > > @@ -2446,7 +2446,7 @@ static int atl1_rings_clean(struct napi_str= uct *napi, int budget) > > > > > > > > > > static inline int atl1_sched_rings_clean(struct atl1_adapter* ad= apter) > > > > > { > > > > > - if (!napi_schedule_prep(&adapter->napi)) > > > > > + if (!napi_schedule(&adapter->napi)) > > > > > /* It is possible in case even the RX/TX ints are= disabled via IMR > > > > > * register the ISR bits are set anyway (but do n= ot produce IRQ). > > > > > * To handle such situation the napi functions us= ed to check is > > > > > @@ -2454,8 +2454,6 @@ static inline int atl1_sched_rings_clean(st= ruct atl1_adapter* adapter) > > > > > */ > > > > > return 0; > > > > > > > > > > - __napi_schedule(&adapter->napi); > > > > > - > > > > > /* > > > > > * Disable RX/TX ints via IMR register if it is > > > > > * allowed. NAPI handler must reenable them in same > > > > > diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net= /ethernet/toshiba/tc35815.c > > > > > index 14cf6ecf6d0d..a8b8a0e13f9a 100644 > > > > > --- a/drivers/net/ethernet/toshiba/tc35815.c > > > > > +++ b/drivers/net/ethernet/toshiba/tc35815.c > > > > > @@ -1436,9 +1436,7 @@ static irqreturn_t tc35815_interrupt(int ir= q, void *dev_id) > > > > > if (!(dmactl & DMA_IntMask)) { > > > > > /* disable interrupts */ > > > > > tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl); > > > > > - if (napi_schedule_prep(&lp->napi)) > > > > > - __napi_schedule(&lp->napi); > > > > > - else { > > > > > + if (!napi_schedule(&lp->napi)) { > > > > > printk(KERN_ERR "%s: interrupt taken in p= oll\n", > > > > > dev->name); > > > > > BUG(); > > > > > > > > Hmmm... could you also remove this BUG() ? I think this code path c= an be taken > > > > if some applications are using busy polling. > > > > > > > > Or simply rewrite this with the traditional > > > > > > > > if (napi_schedule_prep(&lp->napi)) { > > > > /* disable interrupts */ > > > > tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl); > > > > __napi_schedule(&lp->napi); > > > > } > > > > > > > > > > > > > > Mhhh is it safe to do so? I mean it seems very wrong to print a warni= ng > > > and BUG() instead of disabling the interrupt only if napi can be > > > scheduled... Maybe is very old code? The more I see this the more I s= ee > > > problem... (randomly disabling the interrupt and then make the kernel > > > die) > > > > I am pretty sure this BUG() can be hit these days with busy polling or > > setting gro_flush_timeout. > > > > I wish we could remove these bugs before someone copy-paste them. > > > > Again, this is orthogonal, I might simply stop doing reviews if this > > is not useful. > > They are very useful and thanks a lot for them! I'm asking these as to > understand how to proceed. I have in queue 2 other series that depends > on this and I'm just asking info on how to speedup the progress on this! > > Soo think I have to send v3 with the suggested change and BUG() dropped? > Happy to do everything to fix and improve this series! I think that your patch series is all about doing cleanups, so I suggested adding another cleanup/fix, and this can be done independently. I doubt this matters, this code has probably not been used for quite a long time...