Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp268607rdb; Thu, 31 Aug 2023 08:54:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBE83ykOp2XvMcfrXl9h2zCWN7UjtGpJLfRhk87TjngDhm1/cnG80ZE7r99wn+IvSHLz8F X-Received: by 2002:a05:6a21:4987:b0:148:6a9e:143f with SMTP id ax7-20020a056a21498700b001486a9e143fmr78500pzc.21.1693497299337; Thu, 31 Aug 2023 08:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693497299; cv=none; d=google.com; s=arc-20160816; b=gJNQqDRVyz1/g/azyEiDw8rz+7pRZywRHrBrb9q3T83zwHOPt1lCs0ydKgGnvyFJ8C qnCJtYsCIPkNtWN1XFW0Akgh2GY3fgbjOXSXK6iduQbb6au9cuhXLY4NEDl63IJE7cxH Hsm35/FVkSbmbpTVGmuWXzCwE3lV2+I9CuuuhZRB3zTrryTGIX+nVBd6k9qn6BPKWI2w rerUJy7k9NFNbmL48TZs6eyGgH/MQNU0BNwvGfemGkpylyRZRd4QlBErA3cvTWzsPqU/ 2pR7CCCxMllKk70YOXVH4beBv5E0biC1hNKGqcoxWD0M82mZgHciXlT/cKU91RMM5n7+ bpJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=z71CNOrqYQHKLFdNvsDAclAiE84tnPKv7OS/VebVrv4=; fh=pT+rdnkkhBMnd/FqWWlNhGNRHRnBd7yQQCUS8fkz5tk=; b=Q9jFb9QFeHIzK1XiVs7ZCQLGjYXF9DGgLHq8mfxCJT0hCML5fV77FzyVwZog6neBhK mzhuPa6mhC9qnCn3wqsVI9FGxYN15ZBLj+/rgwo39bKbQtFCrLL6m4wIpihECc08Yv1g I106A0yPH/vF+s6nZ6Y6s/gO80qZ4IyzaTINxZ/IC1bW8gWARHEWYOlEsZ6om0Yico/X 3tCml7wm1O55sKAJSBm70CVhNO0Gf9CYjREFOpHoZ9fttai/F0IkIU9OzF9+7bYZ+fs0 +Y1Vbs6VH6GcFkm4y/d0Un1SvFAuuZ7UCzt/rBOe6XMtsbtVTjGE+EKSFg6A03fFGTQg XtQg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a633306000000b00569161a1884si1444981pgz.194.2023.08.31.08.54.38; Thu, 31 Aug 2023 08:54:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244512AbjHaMAQ (ORCPT + 99 others); Thu, 31 Aug 2023 08:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243632AbjHaMAQ (ORCPT ); Thu, 31 Aug 2023 08:00:16 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B6DCE43; Thu, 31 Aug 2023 05:00:08 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id AE01F60014; Thu, 31 Aug 2023 12:00:02 +0000 (UTC) From: Remi Pommarel To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Remi Pommarel , stable@vger.kernel.org Subject: [PATCH net] net: stmmac: remove unneeded stmmac_poll_controller Date: Thu, 31 Aug 2023 14:00:04 +0200 Message-Id: <20230831120004.6919-1-repk@triplefau.lt> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: repk@triplefau.lt X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS autolearn=ham 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 Using netconsole netpoll_poll_dev could be called from interrupt context, thus using disable_irq() would cause the following kernel warning with CONFIG_DEBUG_ATOMIC_SLEEP enabled: BUG: sleeping function called from invalid context at kernel/irq/manage.c:137 in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 10, name: ksoftirqd/0 CPU: 0 PID: 10 Comm: ksoftirqd/0 Tainted: G W 5.15.42-00075-g816b502b2298-dirty #117 Hardware name: aml (r1) (DT) Call trace: dump_backtrace+0x0/0x270 show_stack+0x14/0x20 dump_stack_lvl+0x8c/0xac dump_stack+0x18/0x30 ___might_sleep+0x150/0x194 __might_sleep+0x64/0xbc synchronize_irq+0x8c/0x150 disable_irq+0x2c/0x40 stmmac_poll_controller+0x140/0x1a0 netpoll_poll_dev+0x6c/0x220 netpoll_send_skb+0x308/0x390 netpoll_send_udp+0x418/0x760 write_msg+0x118/0x140 [netconsole] console_unlock+0x404/0x500 vprintk_emit+0x118/0x250 dev_vprintk_emit+0x19c/0x1cc dev_printk_emit+0x90/0xa8 __dev_printk+0x78/0x9c _dev_warn+0xa4/0xbc ath10k_warn+0xe8/0xf0 [ath10k_core] ath10k_htt_txrx_compl_task+0x790/0x7fc [ath10k_core] ath10k_pci_napi_poll+0x98/0x1f4 [ath10k_pci] __napi_poll+0x58/0x1f4 net_rx_action+0x504/0x590 _stext+0x1b8/0x418 run_ksoftirqd+0x74/0xa4 smpboot_thread_fn+0x210/0x3c0 kthread+0x1fc/0x210 ret_from_fork+0x10/0x20 Since [0] .ndo_poll_controller is only needed if driver doesn't or partially use NAPI. Because stmmac does so, stmmac_poll_controller can be removed fixing the above warning. [0] commit ac3d9dd034e5 ("netpoll: make ndo_poll_controller() optional") Cc: # 5.15.x Signed-off-by: Remi Pommarel --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4727f7be4f86..9b5c0ebf0519 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5938,33 +5938,6 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) return IRQ_HANDLED; } -#ifdef CONFIG_NET_POLL_CONTROLLER -/* Polling receive - used by NETCONSOLE and other diagnostic tools - * to allow network I/O with interrupts disabled. - */ -static void stmmac_poll_controller(struct net_device *dev) -{ - struct stmmac_priv *priv = netdev_priv(dev); - int i; - - /* If adapter is down, do nothing */ - if (test_bit(STMMAC_DOWN, &priv->state)) - return; - - if (priv->plat->multi_msi_en) { - for (i = 0; i < priv->plat->rx_queues_to_use; i++) - stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]); - - for (i = 0; i < priv->plat->tx_queues_to_use; i++) - stmmac_msi_intr_tx(0, &priv->dma_conf.tx_queue[i]); - } else { - disable_irq(dev->irq); - stmmac_interrupt(dev->irq, dev); - enable_irq(dev->irq); - } -} -#endif - /** * stmmac_ioctl - Entry point for the Ioctl * @dev: Device pointer. @@ -6800,9 +6773,6 @@ static const struct net_device_ops stmmac_netdev_ops = { .ndo_eth_ioctl = stmmac_ioctl, .ndo_setup_tc = stmmac_setup_tc, .ndo_select_queue = stmmac_select_queue, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = stmmac_poll_controller, -#endif .ndo_set_mac_address = stmmac_set_mac_address, .ndo_vlan_rx_add_vid = stmmac_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = stmmac_vlan_rx_kill_vid, -- 2.40.0