From patchwork Mon Mar 25 17:52:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 13602680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19AF2C6FD1F for ; Mon, 25 Mar 2024 17:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Od42lXrJ0i9e4H4k+dbubs6XaUGK6oTwyiuIWZkQujo=; b=dP6B8MW7p8gGMP ERp/p0KCOp1/do76JtkfomI0Tb4X6xcuHJvSr4WiLoCqg5tghObxFLqbx2CJdSowIZRIZ7Fac6wCh T0xo1aSB9S7+jbbPd3xVmFQXmA7zz2d/ElVaU5YrPkrGNgJgD5iDSDPOXo50MJCuNetu0/w7b+/7y ZfVLykugB13J1IFCoXKtuWZFnEF3+uBLKgYUO2FFvfy4W+VoXmVQDid9Jyp+9digPUyl4RMTCJcIC AzJN0ohweGS24SFFdOh4EwWqETb6VeMirvleZBK/ez+Uve9LwiBcRTiRqJkBhrp0lwQvArpQGMTmr mhtm0ln0tX4sR0ROVG1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rooW1-00000001AMm-1DqV; Mon, 25 Mar 2024 17:53:45 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rooVP-000000019mo-0vVr; Mon, 25 Mar 2024 17:53:09 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1dddbe47ac1so35475845ad.1; Mon, 25 Mar 2024 10:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711389185; x=1711993985; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=yZNhbleKNla2Ie/ZEatm6EVk1jlCAGbsmm+zF41MFkk=; b=HkdYmrfApVCT2Vbc5JxPSI2TAOhXHg6cUYLVKxY8qz4fp8d8esCK4xV/0wBxMvZtoB f/nKMsEeNMuKzACw68lOVpI2dP1DyjKpK5lNyzCziKMb6XfAG29HVkBBW9UoxISOAZf5 AYrPqE242NSEumlH6RYby/eqHe8fqpRaA3XycKbay8+FUOPph828PwupQAoXRZOEMzIJ vyB/Ya4OxTkz39UfXtwMuQFqpq/oPXi5tvHd9XYlcv04bbNrPFUwYRuoXGZiuqLvLtZ3 PMPb0d5qAY3jL5KDE84k/ZpUL3SHUcyaCdAUW5as0P8IJt/6XWNoQRom5X0kRebUi2la 5U/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711389185; x=1711993985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yZNhbleKNla2Ie/ZEatm6EVk1jlCAGbsmm+zF41MFkk=; b=YM6qHtjxPHfPCxhdlIc+k76vT06uA2TpYInPvc3iQXwzekcJbTrys4zbDuaKoRaVE6 mSnYc1QLtdm033PnxFyqbEhXI3GO0J0e9qvgFQ3LzdD4okruWkGRLbOgDNHQif84oTUX PyQ9vmyB9cH56lp0YwbTn2VUWRlRvmD1+MNCWjEpEhVTaBkNfc3SF+gJ9EyUmsc07th4 Im6C46WSGdfrEn2gef8ZDzlGfZQKL81EUUh6Stj+nmpG0G5Bn+RHcKz1A/kO0C3Lo2KA ozIQpDAKveYibfQZQZ7N5DERRngmDnk9eDLQptxsKCXzwBsaX/7L0pmvNNtpItAqM+vO wheQ== X-Forwarded-Encrypted: i=1; AJvYcCWDjTRb9f/Phb69sEQFdD1xw65Qs6+/W1E4OkxvtrG+UORuhjmTqWbWeJOi1VHjXCoE0z56Fo4xd+Nf3TkCkG8gA2BMOec16HJX7Jp1r4iMaS4Aoz9YSerGoOyYahhoEHCWRpFsMYBRKHJkHsK6EfBgxUiMx/w= X-Gm-Message-State: AOJu0YxyvUEhWbCTHTH5awoYGOfh+fCcWs2pk7jexVEtQWyXsTKAqgIl epvgtaTfB/Mkh20PrRs4gfndHPsl8qwW+biXeHETyq21YrqP88cu X-Google-Smtp-Source: AGHT+IEKWGuzpihfez0cIj5Jcw9QuULSWV5Y1XxkrBzCrtkepZtfQa7QDls+G+yzQdtdIaLpfh3muA== X-Received: by 2002:a17:902:e810:b0:1e0:960b:f395 with SMTP id u16-20020a170902e81000b001e0960bf395mr11373029plg.25.1711389185110; Mon, 25 Mar 2024 10:53:05 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id j5-20020a170902da8500b001e0c568ae8fsm1586519plx.192.2024.03.25.10.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:53:04 -0700 (PDT) From: Guenter Roeck To: linux-kselftest@vger.kernel.org Cc: David Airlie , Arnd Bergmann , =?utf-8?q?Ma=C3=ADra_Canal?= , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Daniel Vetter , Thomas Zimmermann , dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, Guenter Roeck , Linux Kernel Functional Testing , Jakub Kicinski Subject: [PATCH v2 06/14] net: kunit: Suppress lock warning noise at end of dev_addr_lists tests Date: Mon, 25 Mar 2024 10:52:40 -0700 Message-Id: <20240325175248.1499046-7-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240325175248.1499046-1-linux@roeck-us.net> References: <20240325175248.1499046-1-linux@roeck-us.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_105307_488223_D3ACE31E X-CRM114-Status: GOOD ( 13.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dev_addr_lists_test generates lock warning noise at the end of tests if lock debugging is enabled. There are two sets of warnings. WARNING: CPU: 0 PID: 689 at kernel/locking/mutex.c:923 __mutex_unlock_slowpath.constprop.0+0x13c/0x368 DEBUG_LOCKS_WARN_ON(__owner_task(owner) != __get_current()) WARNING: kunit_try_catch/1336 still has locks held! KUnit test cleanup is not guaranteed to run in the same thread as the test itself. For this test, this means that rtnl_lock() and rtnl_unlock() may be called from different threads. This triggers the warnings. Suppress the warnings because they are irrelevant for the test and just confusing. The first warning can be suppressed by using START_SUPPRESSED_WARNING() and END_SUPPRESSED_WARNING() around the call to rtnl_unlock(). To suppress the second warning, it is necessary to set debug_locks_silent while the rtnl lock is held. Tested-by: Linux Kernel Functional Testing Cc: David Gow Cc: Jakub Kicinski Acked-by: Dan Carpenter Signed-off-by: Guenter Roeck --- - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags net/core/dev_addr_lists_test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/core/dev_addr_lists_test.c b/net/core/dev_addr_lists_test.c index 4dbd0dc6aea2..b427dd1a3c93 100644 --- a/net/core/dev_addr_lists_test.c +++ b/net/core/dev_addr_lists_test.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include #include #include @@ -49,6 +50,7 @@ static int dev_addr_test_init(struct kunit *test) KUNIT_FAIL(test, "Can't register netdev %d", err); } + debug_locks_silent = 1; rtnl_lock(); return 0; } @@ -56,8 +58,12 @@ static int dev_addr_test_init(struct kunit *test) static void dev_addr_test_exit(struct kunit *test) { struct net_device *netdev = test->priv; + DEFINE_SUPPRESSED_WARNING(__mutex_unlock_slowpath); + START_SUPPRESSED_WARNING(__mutex_unlock_slowpath); rtnl_unlock(); + END_SUPPRESSED_WARNING(__mutex_unlock_slowpath); + debug_locks_silent = 0; unregister_netdev(netdev); free_netdev(netdev); }