Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1406219lqh; Mon, 6 May 2024 07:00:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgRysRvU+mbtnBBEjZlEkcJGKC4v/lfyVOse1Mjd9EPWtYayVItSE4WTNv5KSbAIs10BlPgLVBY6mTiRNbRgIrBXXl7Ua4UDpmRWHqsQ== X-Google-Smtp-Source: AGHT+IEFmZsIhfO2S8tO3OEOOojjTtuXF/QXBbli4JGKqYzKW3QXR9BVVcmArKQ8U8p+B3FHi4F2 X-Received: by 2002:a17:906:eb16:b0:a59:ca33:683f with SMTP id mb22-20020a170906eb1600b00a59ca33683fmr2071369ejb.28.1715004010794; Mon, 06 May 2024 07:00:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715004010; cv=pass; d=google.com; s=arc-20160816; b=WEs1RwjKzc2e6enZi8+NyyUKT81dAKFo71L3wWq/1NX/D091tJ2UFrLfJeVKC1YAm5 w1e6L13kKuuQfX/5tNq6Fe/kVUaVl5t62msZc7tmej2pjzCLsunAVguuqB/O/T31SriO aLv+mrvQaTDt/JdWKryrCwBj+0KuAet1f87UA4gee1rmn3UqKeqkPaHO24CvaK5qB++j V47KQ95drBTsxKMe2uec60qU6O77cwF4LDq6KSUarpHlUoukWKl04EzWMrvGoWGXYA0l nBivtylLZBEJQUAcz4fYfafHMUPpqafG3a7sEKQngaSLRnNK4YvcsXkyVlqOwvvQf9pm hd+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=l8vsB0YxVyOhCoOR1rq+CzGzcpNzExSdLNP82ssVmCM=; fh=SRf4HiqpRfujZxnScjc6yzb2kCRD/fekZGTqBAuNSY8=; b=oCtqwC1/1bu2b/1T19WsbTDSEZoulb2BJ+KYkF9XBlZ/VL9pZ973DZWP7RJVBIddMb ULtr5PQv5uaLXrJCtWwbA5EwycBfxqRWzYbReuEt5QcKg5D7DFg11yRCjr6TclEscnVX FhZr7f0CWrL1JlTOvsajYH5Ch3pPKloDj2JEwNxXIrVELALxXSU++d7rc3/P3q84DtQi B/68FTWujBxSGht+ZY/bxZ4naSiaGvxvem0ofeycsdgBvHoHzqAGfO39CGsEkI/rCxS7 X6vy9i9cff9y+KZouteMOV9mALIRs61OTeB68OgkXX8IrwTzIFzteY6jNb1ITZNVDz9m EhyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=fChRnzLO; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-169934-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169934-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l10-20020a170906414a00b00a59b09ded1csi2498759ejk.997.2024.05.06.07.00.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 07:00:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169934-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=fChRnzLO; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-169934-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169934-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 566421F245A3 for ; Mon, 6 May 2024 14:00:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D8DC8174C; Mon, 6 May 2024 14:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="fChRnzLO" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E808015A5; Mon, 6 May 2024 14:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715004002; cv=none; b=huMIUbBXuK/27VDlVLatXQyv97mI2Y61ilB+9H5Z4RlH1SEIr49QMfZnBWhRouEi5FSatdLbs4121RfIxdgvV0q3TfEwyt85/PGtT1ZXg56zwGAHIQjzUw8CICXMgJ9KuK5SXagEezFFcabt7BCZa4Xd8AAR6Jd6rW2f1J/R2qk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715004002; c=relaxed/simple; bh=P7hzobG48OrQRhVmRGZvAghTx4JfPFToBDmjqFqNKpI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FjngjOzOW/UegdXZxQvS9bIY6Mrq+kWlnyeAIilH++tXiK5MGLSt9yFQEg6CG/R6csedYUt1yz19woRn72Wis7vYQ1qA5a0NEFULS05Y/EKO2kBhqyQuPcCgXVPmP9ENCc8vGmWoqLeqDuc9N09owkhhVwRiHCprouk4cmOPxLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=fChRnzLO; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 446An4gF027863; Mon, 6 May 2024 13:59:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=l8vsB0YxVyOhCoOR1rq+CzGzcpNzExSdLNP82ssVmCM=; b=fChRnzLOkEjRTcdNnI/XUZmQK/PfdYREMS5/ArjpCknWpCIJeTmNpY+G6XfeITRj1g4h YwinRki+3j8GY0gsdLC7YMKpTuYzFSD8AqMmxPFSRTZH578/pgs/zyKRXGGpWZQUlrZH NXTH4pexaNtzdTVl0Lpy7+vCTlIwYlvICQoiUbke23WKM4IwH6ABEc3uFfSfZ4tW9PZ5 hDD0mC86ajeTDc6e0Ger4Ha9So3FcHBTf4/IO93W6nfOrHgGp34iadfNm48/A0M8A92X Lj761TyNkRDbTAg6F0F2iOzy5Nn60XpAw9UJPSTBo/esAoEtN3xB5WhYJQwkAQ8Nq/Oz lA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xwd2dtnaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 May 2024 13:59:55 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 446ChRM6014136; Mon, 6 May 2024 13:59:54 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xwbf61983-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 May 2024 13:59:54 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 446Dv4n5027456; Mon, 6 May 2024 13:59:53 GMT Received: from pkannoju-vm.us.oracle.com (dhcp-10-191-206-220.vpn.oracle.com [10.191.206.220]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3xwbf6195f-1; Mon, 06 May 2024 13:59:53 +0000 From: Praveen Kumar Kannoju To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rajesh.sivaramasubramaniom@oracle.com, rama.nichanamatlu@oracle.com, manjunath.b.patil@oracle.com, Praveen Kumar Kannoju Subject: [PATCH v2] net/sched: adjust device watchdog timer to detect stopped queue at right time Date: Mon, 6 May 2024 19:29:44 +0530 Message-Id: <20240506135944.7753-1-praveen.kannoju@oracle.com> X-Mailer: git-send-email 2.31.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-06_08,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 adultscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2405060096 X-Proofpoint-GUID: TJufH9kkmrhGtnz6M3se9SSQm5zh2ZI8 X-Proofpoint-ORIG-GUID: TJufH9kkmrhGtnz6M3se9SSQm5zh2ZI8 Applications are sensitive to long network latency, particularly heartbeat monitoring ones. Longer the tx timeout recovery higher the risk with such applications on a production machines. This patch remedies, yet honoring device set tx timeout. Modify watchdog next timeout to be shorter than the device specified. Compute the next timeout be equal to device watchdog timeout less the how long ago queue stop had been done. At next watchdog timeout tx timeout handler is called into if still in stopped state. Either called or not called, restore the watchdog timeout back to device specified. Signed-off-by: Praveen Kumar Kannoju --- v2: - Identify the oldest trans_start from all the queues and use it. v1: https://lore.kernel.org/netdev/20240430140010.5005-1-praveen.kannoju@oracle.com/ --- net/sched/sch_generic.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 4a2c763e2d11..840b995c7233 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -506,19 +506,22 @@ static void dev_watchdog(struct timer_list *t) unsigned int timedout_ms = 0; unsigned int i; unsigned long trans_start; + unsigned long oldest_start = jiffies; for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq; txq = netdev_get_tx_queue(dev, i); trans_start = READ_ONCE(txq->trans_start); - if (netif_xmit_stopped(txq) && - time_after(jiffies, (trans_start + - dev->watchdog_timeo))) { + if (!netif_xmit_stopped(txq)) + continue; + if (time_after(jiffies, (trans_start + dev->watchdog_timeo))) { timedout_ms = jiffies_to_msecs(jiffies - trans_start); atomic_long_inc(&txq->trans_timeout); break; } + if (time_after(oldest_start, trans_start)) + oldest_start = trans_start; } if (unlikely(timedout_ms)) { @@ -531,7 +534,7 @@ static void dev_watchdog(struct timer_list *t) netif_unfreeze_queues(dev); } if (!mod_timer(&dev->watchdog_timer, - round_jiffies(jiffies + + round_jiffies(oldest_start + dev->watchdog_timeo))) release = false; } -- 2.31.1