From patchwork Wed Apr 19 11:56:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 85355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp328506vqo; Wed, 19 Apr 2023 05:01:37 -0700 (PDT) X-Google-Smtp-Source: AKy350adb63LhDGahVzzsRmY30gi4EMwDbV3uVQy/h+ayBOIU5t70wetF7b/7+fXiKdSKPl4PYnb X-Received: by 2002:a17:90a:df16:b0:24b:2e6a:24f8 with SMTP id gp22-20020a17090adf1600b0024b2e6a24f8mr313430pjb.41.1681905697548; Wed, 19 Apr 2023 05:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681905697; cv=none; d=google.com; s=arc-20160816; b=s7npxlFpynfrt7Jn9eEdqkHJXaU8wjz5w5jqcgxacl9V6uK8+4HDxrY/U82W/q5Jp+ 2G9KI/XCnzGwyjKfi8vWr+7KB7hlUbszkTBXXgZp6DS/mqnfsMFX0N1IX9QaLYTkczWe MBEdddaKFvRScUiFHEO32gCU5t0xzUvHrA7KrHn6FR4LIIE5Ve7+15VbMW3CZZbj1vvb gQLbFMPgB7/5REumTtdchdSYAtA3y49kMPNOZ2+I1UR5KR9ht57vrC7epmQs7kNSy4x4 P2ZhVFTndZyeXtmc548Tj602f4AtW7P81D4iu01EJRLWiUe23Zmgb4MysFQ39sxS3IKp 4lvg== 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:dkim-signature; bh=kQMy059N3s1atSzVKA/d/rtaeGTHOWIXN8OS6g3STNA=; b=n/s8pmY4dsBQyIpuc5/qu72b2/uPOt0iBqOUugalh6Bqyu5vq00w3FYHBlp4LXVBuI GVDwVUgDtJqvkRc2IqjIfkMNwpAKoT+k+X/ebd/YwlB65vVWi1dv7A8poVMDftUJslxd 8SRokFVqdga96EsPKRlmRjTouupGixt68OnA3cfi8j3sJsyO766R3gcwalWV9I3kk391 1tQc/ZlU5YMCt+e1in9ZUvY0T+tLtRk557+1rueSuEhFCue9k8ZUTQ9PhZ7mw2zzl1C7 Xeo6LBLFSDlNkv/3OrWuEG+VbjZFSPdyR/kZwWmP8in2VkOPlMX915qWtkKZQC2GGuc/ yNaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UYRfGj+K; 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=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a17090a670700b00249720507d9si1665791pjj.61.2023.04.19.05.01.23; Wed, 19 Apr 2023 05:01:37 -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=@linux.dev header.s=key1 header.b=UYRfGj+K; 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=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232408AbjDSL6Z (ORCPT + 99 others); Wed, 19 Apr 2023 07:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbjDSL6X (ORCPT ); Wed, 19 Apr 2023 07:58:23 -0400 Received: from out-18.mta1.migadu.com (out-18.mta1.migadu.com [95.215.58.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4B9215617 for ; Wed, 19 Apr 2023 04:57:57 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1681905407; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kQMy059N3s1atSzVKA/d/rtaeGTHOWIXN8OS6g3STNA=; b=UYRfGj+Kl9pg6QfmfJnJT4KL/GQlRMQ1iLAOp+nSoqOMtXivQlQQT/C9Q1ML96IqrnUvF0 zbzkEFTD56/czGh+hZA9aSs8CcCfxuPyvxDqrbkLE2plOVjt8QZlogFa/Ea5lnGApN5mED w9ZKeZl/x5VwOCsi4nZsHcAMli34bzY= From: Yajun Deng To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] net: sched: print jiffies when transmit queue time out Date: Wed, 19 Apr 2023 19:56:32 +0800 Message-Id: <20230419115632.738730-1-yajun.deng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763605948454145914?= X-GMAIL-MSGID: =?utf-8?q?1763605948454145914?= Although there is watchdog_timeo to let users know when the transmit queue begin stall, but dev_watchdog() is called with an interval. The jiffies will always be greater than watchdog_timeo. To let users know the exact time the stall started, print jiffies when the transmit queue time out. Signed-off-by: Yajun Deng --- net/sched/sch_generic.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index a9aadc4e6858..67b78e260d28 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -502,7 +502,7 @@ static void dev_watchdog(struct timer_list *t) if (netif_device_present(dev) && netif_running(dev) && netif_carrier_ok(dev)) { - int some_queue_timedout = 0; + unsigned long some_queue_timedout = 0; unsigned int i; unsigned long trans_start; @@ -514,7 +514,7 @@ static void dev_watchdog(struct timer_list *t) if (netif_xmit_stopped(txq) && time_after(jiffies, (trans_start + dev->watchdog_timeo))) { - some_queue_timedout = 1; + some_queue_timedout = jiffies - trans_start; atomic_long_inc(&txq->trans_timeout); break; } @@ -522,8 +522,9 @@ static void dev_watchdog(struct timer_list *t) if (unlikely(some_queue_timedout)) { trace_net_dev_xmit_timeout(dev, i); - WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", - dev->name, netdev_drivername(dev), i); + WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): \ + transmit queue %u timed out %lu jiffies\n", + dev->name, netdev_drivername(dev), i, some_queue_timedout); netif_freeze_queues(dev); dev->netdev_ops->ndo_tx_timeout(dev, i); netif_unfreeze_queues(dev);