From patchwork Mon Feb 19 13:37:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Kannoju X-Patchwork-Id: 203083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1287887dyc; Mon, 19 Feb 2024 05:39:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbqUshka8XwKm9ZgjAHyGwzc5vfXjlrKFhXCtM3c+tjgbDDSp2VUj0nu5PPaBeAtm1gP7AuR7otl612j9SzPiUeoFZmA== X-Google-Smtp-Source: AGHT+IFi+H94/DJapRrW1H+mbxyuI/53lC81pI7HSt7F9iaGqDoy0kLlUsBJfdkzk+fufHFs1O71 X-Received: by 2002:a17:906:1388:b0:a3e:79f7:d218 with SMTP id f8-20020a170906138800b00a3e79f7d218mr3006572ejc.43.1708349944128; Mon, 19 Feb 2024 05:39:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708349944; cv=pass; d=google.com; s=arc-20160816; b=aKzEUuEx87DPncbtTIH8wP7fuxTKJTOCYLfVMgSp9ae/P4+V6DypAgBk6VNwkP1R9N UGgnvhuIV7sVL+1vpZwz3voR1BwENRHbzq1Y/EljHWN5OnGU9b84s+4dabwkh3D+EGiU tye0rGe9ErakH86tT2DdWA58NbK2WuPeJGZ4pQeS0Y4duJX9VwwTJwulO8J/hL+qxl06 2v0wdgkseOIKG04T4jaBXfeOwIpH/uZEhf5UcHn3XKdiF/JH4O/KCWn8mjHRDJjPsMCH vAp0zHXlHxMmjAsLFitAG4lQnNdR7dXpcig+oMeXFj51scQE9UNj68znoLZmPcglZvXk uUbA== 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=v5j29fJ7l64OqdiJXkSFRWQ/MC7+s+gIo0U3PRJ4NMc=; fh=+BDgpcpQY8Nx86o8ef6c2kqnUioYDKzAWbMAC4LKHPI=; b=lIyEtu2MN9tRocqFtLkkHQbq7dkCGY9YjwkOFJF59qpaKdVTBwe8M5IBlki3noZ3Zb KDXt5vqWsN16ik1qZlRveSGM2TXTdga93BA2XlMTOUtGGLhEYrJG5t3lw1B8VcIHCVhh qxyHSUsG49v7RgszCoL2qU/Y+Sqix88nI6it0tQKLqmNFHJ4wXozBN2OiobT8Ld5CMTz w/OIzflW4Ejufyt2DQ4j2e/fQ4plVzUT+kFhz7c4UayzNi33+EkB1kBsGZHBp3IT9sa0 n2PEap5cLPe+5UUn+aMu41OaCQHDYqrrsymYRKKLT0Xi57sCxYekF2Cc1mWw4U8MVFHS pSqQ==; 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=GrfkitrD; 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-71420-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71420-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n11-20020a170906378b00b00a3e9414aa7dsi872463ejc.280.2024.02.19.05.39.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 05:39:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71420-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=GrfkitrD; 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-71420-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71420-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 92A171F21A02 for ; Mon, 19 Feb 2024 13:39:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9848E374E9; Mon, 19 Feb 2024 13:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="GrfkitrD" 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 00F62364A1; Mon, 19 Feb 2024 13:37:44 +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=1708349866; cv=none; b=hxYzBm4wzBVY3rU90qGBSqn7+BEwtTXdrcyePoR6M8dIaixLtMGx4JamtqCzrS7rXeZCbXXW/LrvXRM62qKJsxnhENeI0n0DQ1aTsIaNVlz+mt6gq3WAi4wXJ7HoBmfwgEo+GvTXsvHU6TU7ozZiDD7mrEc2BBGUmD2czpgVoGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708349866; c=relaxed/simple; bh=GX1gehkvQcZqiJUoO8NQAFdj6CmJo/860fgT0JsK+xc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=I4N6VEVGWoZJgj9Cb2R9suk+McdeZRAoQ0UEuj6yxLNARe0mQhzeW28nObIlTXdx+VemtLLOXc2SKt869x8Q4LqZ5pGw/DGOXimuYz7/9nF4UPc27jAE/8ACQH9Mtrz+6pYV41KsayUmcLxseUVGNYdqZt0mKqPCOGxneFhU2X0= 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=GrfkitrD; 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 41J8O74V029244; Mon, 19 Feb 2024 13:37:37 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=v5j29fJ7l64OqdiJXkSFRWQ/MC7+s+gIo0U3PRJ4NMc=; b=GrfkitrDIneElEPutV3vloudxTdwvvaUHYwtcZCQUIMZPnZxfag1LNfK18ILuaxFt+9t TVa8TKtqHV3hDsQXGXA+sF57YDJwEbNmF094KdkXQ+R0tzNDH/WZ1DQvOttH1xUxBft0 f6aQ+db2vScSpZ+JLHNXKpZqLjofqHLgjCW0mLc0NJANTvnRgUmyuAcOhhUv9q5+dSwU eIQwmbIhORiDbIbeNicJzUiIPlSzTf4tyGfWvOxTh1V9vPhhoCqbHhcjFmHTtpx/DzGd PN9+r0M0vrnq8CTCzzWnD/tICtHzREnlBt/lfPA92zwQslS1xAdWQ+58zVkeFMAvtqyD Bw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wakd246v0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Feb 2024 13:37:37 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41JCP7Cx039727; Mon, 19 Feb 2024 13:37:36 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak85xfrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Feb 2024 13:37:36 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41JDWmtk016570; Mon, 19 Feb 2024 13:37:35 GMT Received: from pkannoju-vm.us.oracle.com (dhcp-10-166-182-179.vpn.oracle.com [10.166.182.179]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak85xfmt-1; Mon, 19 Feb 2024 13:37:35 +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] bonding: rate-limit bonding driver inspect messages Date: Mon, 19 Feb 2024 19:07:21 +0530 Message-Id: <20240219133721.4567-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-19_09,2024-02-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402190101 X-Proofpoint-GUID: E8SaMYBR-BetkhYxqamTVOZAfjPKF_Op X-Proofpoint-ORIG-GUID: E8SaMYBR-BetkhYxqamTVOZAfjPKF_Op X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791326805207961351 X-GMAIL-MSGID: 1791334751028111180 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. v2: Use exising net_ratelimit() instead of introducing new rate-limit parameter. v3: Commit message is modified to provide summary of the issue, because of which rate-limiting the bonding driver messages is needed. Signed-off-by: Praveen Kumar Kannoju 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; }