From patchwork Wed Feb 21 05:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Kannoju X-Patchwork-Id: 203917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp839020dyc; Tue, 20 Feb 2024 21:09:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUJcqmwgTtp6gbz2tlbPz09aE9RLkfsIACeB7WSCilgP5hcOEAk3X0uf2FSxM52Z7hyfrSxl9fgsnFW2eLFldNaisFwqQ== X-Google-Smtp-Source: AGHT+IG2piGruXFbXeh+gkcQWofaAxHg2u2Xsw/zZ8KV4U3wVGKvRqN9gsGt9Zqk/QFIMRYNdX6t X-Received: by 2002:ac8:7d4d:0:b0:42c:c74:e924 with SMTP id h13-20020ac87d4d000000b0042c0c74e924mr23193730qtb.51.1708492141587; Tue, 20 Feb 2024 21:09:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708492141; cv=pass; d=google.com; s=arc-20160816; b=uFg1B0eDLTwBn4aX7Lj1RP5SB1O84nBP6QSBNs0oZxAGHr/HHd4pr3JQyHCRvgrS81 t0Z6Xgv2y15q98fjyft8s1GkFsE61ymZoNSgRQHiXdIwIP3sVoFQAQwFCvLQYHk/1N/3 lJ3c2/FyBxOfVY9L1y8YIuxBzHgSmdMB7bgKUtpzsAhazHQME1FdYuxcFdBpHX/jAjw0 LzPPWeuuZw8xdoxdZ/qpFiGVXg3TUpcYP2NvmWpsupmw5rHgWNSRi0HPKS8j0Db57kIZ 5W1ZAv/ZLHU9pxrXkGO8CodantB8dh4NIjEQv1zIUFXfYmvVi4gwXV+IMafqjIrpbEba eHHA== 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=WulNQ77cw1AzM/OSoQ+njGNXHsFMEjxLNLfnhrUy/f4=; fh=+BDgpcpQY8Nx86o8ef6c2kqnUioYDKzAWbMAC4LKHPI=; b=FEbwKUDtEI++41sUgYV9aTG7xgWNXYylf6m7vUPxMINReQCu+kykVd55rBuwhpjWtV 9XdN93jzaKXjo2gIFVhdxu2Y8lotWmi+sEdxyIj4CbPD6CAi06qA6Yr/LbyFP4zMOCxE b/AdmqIUjvVgEAeha0vx1IRWZ5EdGgltZtLpq6zdmyi/+5m8pWJN7ytYMauhg6aXByp0 SvyabKm4kS12sy0O7ZlGm/2tIzzH4zPkLqaiAj+Z2SanA2JPz1WBE99jt+mBXAsWSlZ+ coULXTaKN+CE9w/onHQ7sJqrx7uWSaXsFUkGlSGdkC/n+Qfaoo+ExeBpy52+eNU12rbq YOAg==; 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=b6Ti8lA5; 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-74057-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74057-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i4-20020ac87644000000b0042e2cd06e25si2209944qtr.378.2024.02.20.21.09.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 21:09:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74057-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=b6Ti8lA5; 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-74057-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74057-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3E7B51C226E9 for ; Wed, 21 Feb 2024 05:09:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8345739FC8; Wed, 21 Feb 2024 05:08:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="b6Ti8lA5" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 7F08829A1; Wed, 21 Feb 2024 05:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708492121; cv=none; b=Wu0DFLKF0C4O1RNqY7I/G2Pm68OoJV8gHFxCSNxt4QlrUfiE3HnDO5kwdrR4uMFMndzqZzsdOaWvq+4aRL8+OXwdObhvZhIKzu3rPYNG/zV5u91LN4kM9jznhauC2BHMmQnEVRhb/qIf8sJXby7bLZ0agSz1B3DWF4csysm8nGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708492121; c=relaxed/simple; bh=VKJ/Y4FNh1iyDSAXLsW/RzP2h2EOe4/G9T3wlsbJZOY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=u5Jb/FFbw8veRRF2T5id/fp/YsszhqpkArLm2PgxE1vGTwfxZWp9xPVWd3512H3vRkEHe6hzDrSF306RNLL2YG4+U4M2Mq914QADjvIiXl166qhkx8OUPQ4aIE+hAe4kJ2G1qM1bcUrM2nLrcntcEBHyhPKhCOdvePYsC0SVDQk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=b6Ti8lA5; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41KKT8AU006004; Wed, 21 Feb 2024 05:08:28 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=WulNQ77cw1AzM/OSoQ+njGNXHsFMEjxLNLfnhrUy/f4=; b=b6Ti8lA5DZ7j1En+/cAuM8jSRtXo0xf51/aPM/KFRM6/pPVLJzTEwH2N4Od0WWisE52q nUjS9vbJeDFqOEkH7Ln32d8Vaqg+yFceazixJF9+1eq2ZefPtBt1zxql3XtJTy4DdixG 82nCD3TUVDIyI3W2JSsKnvEiTltCyHTFopMNHjmO1tAUB7H7tlpOsi9XG5F/Qz+MZnJ9 fpJfRV/ITcFb56arpEPGTpwCr+1pxRmnTM5hZ1p8gd6ltEugWpM5ryeJ2Tl1hpjnhiBy 7aZOC4pyf0NwsNk135upUEDIVOUVPeSMGNbq5YK/T2CRZh8ffE2iy2pGvB8H0i1O62GF Iw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wakd28tkh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Feb 2024 05:08:27 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41L4ZPsb006609; Wed, 21 Feb 2024 05:08:26 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak88mym7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Feb 2024 05:08:26 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41L58Pvf007156; Wed, 21 Feb 2024 05:08:25 GMT Received: from pkannoju-vm.us.oracle.com (dhcp-10-191-205-154.vpn.oracle.com [10.191.205.154]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak88myj9-1; Wed, 21 Feb 2024 05:08:25 +0000 From: Praveen Kumar Kannoju To: j.vosburgh@gmail.com, andy@greyhouse.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, 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 net-next v5] bonding: rate-limit bonding driver inspect messages Date: Wed, 21 Feb 2024 10:38:09 +0530 Message-Id: <20240221050809.4372-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 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-20_06,2024-02-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402210036 X-Proofpoint-GUID: 22x8LQVmlE1oHyN0t1rJYSA8NZNK_t7M X-Proofpoint-ORIG-GUID: 22x8LQVmlE1oHyN0t1rJYSA8NZNK_t7M X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791483856008282430 X-GMAIL-MSGID: 1791483856008282430 Through the routine bond_mii_monitor(), bonding driver inspects and commits the slave state changes. During the times when slave state change and failure in aqcuiring rtnl lock happen at the same time, the routine bond_mii_monitor() reschedules itself to come around after 1 msec to commit the new state. During this, it executes the routine bond_miimon_inspect() to re-inspect the state chane and prints the corresponding slave state on to the console. Hence we do see a message at every 1 msec till the rtnl lock is acquired and state chage is committed. This patch doesn't change how bond functions. It only simply limits this kind of log flood. Signed-off-by: Praveen Kumar Kannoju --- v5: - Redundant indentation addressed. v4: https://lore.kernel.org/all/20240220050437.5623-1-praveen.kannoju@oracle.com/ - Rectification in the patch subject and versioning details. v3: https://lore.kernel.org/lkml/20240219133721.4567-1-praveen.kannoju@oracle.com/ - Commit message is modified to provide summary of the issue, because of which rate-limiting the bonding driver messages is needed. v2: https://lore.kernel.org/lkml/20240215172554.4211-1-praveen.kannoju@oracle.com/ - Use exising net_ratelimit() instead of introducing new rate-limit parameter. v1: https://lore.kernel.org/lkml/20240214044245.33170-1-praveen.kannoju@oracle.com/ --- drivers/net/bonding/bond_main.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 4e0600c..c8482cd 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2609,12 +2609,12 @@ static int bond_miimon_inspect(struct bonding *bond) bond_propose_link_state(slave, BOND_LINK_FAIL); commit++; slave->delay = bond->params.downdelay; - if (slave->delay) { + if (slave->delay && net_ratelimit()) { slave_info(bond->dev, slave->dev, "link status down for %sinterface, disabling it in %d ms\n", (BOND_MODE(bond) == - BOND_MODE_ACTIVEBACKUP) ? - (bond_is_active_slave(slave) ? - "active " : "backup ") : "", + BOND_MODE_ACTIVEBACKUP) ? + (bond_is_active_slave(slave) ? + "active " : "backup ") : "", bond->params.downdelay * bond->params.miimon); } fallthrough; @@ -2623,9 +2623,10 @@ static int bond_miimon_inspect(struct bonding *bond) /* recovered before downdelay expired */ bond_propose_link_state(slave, BOND_LINK_UP); slave->last_link_up = jiffies; - slave_info(bond->dev, slave->dev, "link status up again after %d ms\n", - (bond->params.downdelay - slave->delay) * - bond->params.miimon); + if (net_ratelimit()) + slave_info(bond->dev, slave->dev, "link status up again after %d ms\n", + (bond->params.downdelay - slave->delay) * + bond->params.miimon); commit++; continue; } @@ -2647,7 +2648,7 @@ static int bond_miimon_inspect(struct bonding *bond) commit++; slave->delay = bond->params.updelay; - if (slave->delay) { + if (slave->delay && net_ratelimit()) { slave_info(bond->dev, slave->dev, "link status up, enabling it in %d ms\n", ignore_updelay ? 0 : bond->params.updelay * @@ -2657,9 +2658,10 @@ static int bond_miimon_inspect(struct bonding *bond) case BOND_LINK_BACK: if (!link_state) { bond_propose_link_state(slave, BOND_LINK_DOWN); - slave_info(bond->dev, slave->dev, "link status down again after %d ms\n", - (bond->params.updelay - slave->delay) * - bond->params.miimon); + if (net_ratelimit()) + slave_info(bond->dev, slave->dev, "link status down again after %d ms\n", + (bond->params.updelay - slave->delay) * + bond->params.miimon); commit++; continue; }