From patchwork Thu Feb 15 17:25:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Kannoju X-Patchwork-Id: 201666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:260d:b0:106:f285:ce21 with SMTP id mm13csp539343dyc; Thu, 15 Feb 2024 09:26:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXFahqQT3j4N48JTP3oZR1zDzyYE4BnhOsJREuK6Nip3NZGpMyxirmf6buQZtMjkKkmXCMS9/n1JKB0JlYqMOO5zxkApQ== X-Google-Smtp-Source: AGHT+IGOMreMm1rJCfq58H8bOZcfiuZvCExYM4p29e+7W5Cy+zquPBqcp1w1O2Bl5kWCOXPTxGNS X-Received: by 2002:a05:620a:1484:b0:787:27ee:7937 with SMTP id w4-20020a05620a148400b0078727ee7937mr3354995qkj.3.1708018001462; Thu, 15 Feb 2024 09:26:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708018001; cv=pass; d=google.com; s=arc-20160816; b=KseXQv1QXissjz6De4A/hoFsecJNOJ44++n+fu8SJLRSKRO67xCicq6YCKJUn4CuJZ Tu3+5U/B91OJDbO5E7nqcxTIR0zrwHy9aqKEt4c5+TyuA5Y8XL0R1a1vcD/7gpSkS1Nt pDv3crkatN7x6n64Mm3ps4YQ85YwcWtUevRiQ18sxa6DyZICAfv35d1LtWJVwBHQAlx4 eai49TXM+68hpzfYqSZunqp//sT2VRABbToXmDDCxUcVwgOpiqKJbzNaY/s5AIvxPHQk HWnEJxxjc8c8EihXpSU2aWmMGGj7OVpandYST4d9rskLYw++f5vBwZsgksFntLtvHqDS x6SQ== 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=OtKQRNORPDYn0Y5hER7+bF1OLu9vZNSd/ghGX8H1WpQ=; fh=+BDgpcpQY8Nx86o8ef6c2kqnUioYDKzAWbMAC4LKHPI=; b=d7acaKNMTr36FpqI9AX+cGuZilrBss1QkB/a+ztl1Ln8j5pVwy2nzG0MkTBkHosIw+ tAkhG02MuWPuXeYofvlm6ZSCWeFzuuHCeMXiN70CkpNERH40/ua2/tP/P26wZZizlEOv yDCbBNsMdaJVPoVit/DhIhWUqgow7udr3/mPi40ZMNMq/8+s/qTvA8WKPjQuf4MZV/Y+ J+mK2IqknOG65tB/yGzgwVwN0R9u7AGZXHjf1uUOGmjOd3KNM/PZ8p9oihYW5ZmcAioy R84d5qp4NkwuF0X0e9Ae7bIN3/X7lQILGz8i5Ze2FFXkD5Syimh6FkMxAtqxrCUW29WU ckEg==; 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=d6gTYzrk; 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-67401-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67401-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id qp5-20020a05620a388500b00785d6130b14si1898006qkn.634.2024.02.15.09.26.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:26:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67401-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=d6gTYzrk; 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-67401-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67401-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 3545B1C23EFB for ; Thu, 15 Feb 2024 17:26:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CD36137C32; Thu, 15 Feb 2024 17:26:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="d6gTYzrk" 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 4E6ED1339B2; Thu, 15 Feb 2024 17:26:17 +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=1708017979; cv=none; b=b0+bxxZnTuunq4fvxApQkCYPdhtOMMZSppDqWQ/Zgd6280154Sgf7hPXnb1ITPL7MFAw9of2M+K/xurun+TeD7d9VmTZef+sD38u+xshunq7NDSJlEdhJo0NkhlAlbaeRdNyTeI27NREoTD4UaURuaBameG1CsKBAadj6FQUjBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708017979; c=relaxed/simple; bh=wpvYxSVLWfwRfU8XWrQQv24yac6bhrNor1LrbZespGw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RnCiFFsgJ4+d7Jqk6fR3QsSsjhp9E1idQdbDUYJdrdXQ4vs855vhisz9EUh9S/3371dE0FDBBNa060zyyKjN1WdQ+pvVq4xU34Bof8yLeQQhBRKLk60MxCNbXogWc5cMhcHm6a1dOTgO8CczdIES6ZM80mTwPSTmxDQLhmHvuXA= 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=d6gTYzrk; arc=none smtp.client-ip=205.220.177.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 (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FFT5Rn022525; Thu, 15 Feb 2024 17:26:08 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=OtKQRNORPDYn0Y5hER7+bF1OLu9vZNSd/ghGX8H1WpQ=; b=d6gTYzrkG88iH0Ww62/qmwe6NI+eH6jvqbLPSk8yC+KuC6HAGUML/WuCCeJ0W+sDHLtk kq5XcQZ3vciaebNWOMcEYNbPcUSbGNc5hW/1cp2LrzVr4UYivxxmjj7pH5RlztArUd/f tuxzwhM2b1saIzpG7RpAt1CrFy/GVogpBqmIdlyhNM/giq8/Cv0bKENE/sKShhyHZYjA 1YL/+OKpMXLVsXUR/54cWAuiiAcVf2eXgMk4b2evlvulneyW4Wsuwz+y/Sf71VmqjbsA 4nRexLDZ5pbPbZFI3D8W6QNIBe7NI87ciUgIfpnCahp/42z2NnmrO5qXP8vPmCWLj7fX qw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w92db2tm8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 17:26:08 +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 41FGZqiI013767; Thu, 15 Feb 2024 17:26:07 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w6apdqrw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 17:26:07 +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 41FHQ6j3025624; Thu, 15 Feb 2024 17:26:06 GMT Received: from pkannoju-vm.us.oracle.com (dhcp-10-191-247-28.vpn.oracle.com [10.191.247.28]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3w6apdqrt0-1; Thu, 15 Feb 2024 17:26:06 +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 RFC] bonding: rate-limit bonding driver inspect messages Date: Thu, 15 Feb 2024 22:55:54 +0530 Message-Id: <20240215172554.4211-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-15_16,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150140 X-Proofpoint-GUID: m58sarWKwedKz45Wfy4Y-ZiasB4wqALy X-Proofpoint-ORIG-GUID: m58sarWKwedKz45Wfy4Y-ZiasB4wqALy X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790986684100691173 X-GMAIL-MSGID: 1790986684100691173 Rate limit bond driver log messages, to prevent a log flood in a run-away situation, e.g couldn't get rtnl lock. Message flood leads to instability of system and loss of other crucial messages. v2: Use exising net_ratelimit() instead of introducing new rate-limit parameter. Signed-off-by: Praveen Kumar Kannoju --- drivers/net/bonding/bond_main.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 4e0600c..e92eba1 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2610,12 +2610,13 @@ static int bond_miimon_inspect(struct bonding *bond) commit++; slave->delay = bond->params.downdelay; if (slave->delay) { - 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->params.downdelay * bond->params.miimon); + if (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->params.downdelay * bond->params.miimon); } fallthrough; case BOND_LINK_FAIL: @@ -2623,9 +2624,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; } @@ -2648,18 +2650,20 @@ static int bond_miimon_inspect(struct bonding *bond) slave->delay = bond->params.updelay; if (slave->delay) { - slave_info(bond->dev, slave->dev, "link status up, enabling it in %d ms\n", - ignore_updelay ? 0 : - bond->params.updelay * - bond->params.miimon); + if (net_ratelimit()) + slave_info(bond->dev, slave->dev, "link status up, enabling it in %d ms\n", + ignore_updelay ? 0 : + bond->params.updelay * + bond->params.miimon); } fallthrough; 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; }