From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D86A882876; Mon, 25 Mar 2024 17:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711389182; cv=none; b=NN37nIhVc6z/e2DQxVAYfGVymr8ltxkC5zNheNd1bt1rPjUxwAha+bhhEIsVYMdRQBH4UIWP02+Ir/TE2SB+S3EVHU8tpPazVc9qL1+yaUe0fS1mz6+yuVk/6qlely5vw6Lgsuc3uLbPs3RrF93gMcSkm3R6FL2WuANKXyfbn9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711389182; c=relaxed/simple; bh=15e2EytmBJtDwmxM7xihax47wGX3x8ja++Giz6T9SSQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UtgN+4QNWhXHW5joxbs3HxHWf/jBbIV6gm2X0zrac3jmINYuTmjQ7NIuCAciDqK2qZ3Lxf006IiVPsgYtQ6zPoOYPVfYsuuQaU2goDwFN6c00uSHLQTuaGF7DWGwqxjEyPWx16sX/L6pvKjiyQ4W6aNfXJxCN9jvJPuF6yCtXTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JVPhXjD+; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JVPhXjD+" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e6ce174d45so3240128b3a.3; Mon, 25 Mar 2024 10:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711389178; x=1711993978; darn=vger.kernel.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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=JVPhXjD+WjmIEZDY7tblSZ9k35aE7xFyI6Y41Bv82/4Zsiq0FndjMlOdE79HtCvWn9 vdG5ZQYNoupztbObvX3fO86oIy/Mpucg2FeGrxcrkQNgzBlY1SaFMBTxOzaxvmmCY2s3 icUry+bcw+QVvM6lnMdObQgUfGTPY9CIsa499yzByb9SDNN7PmzsyyNG/oAbJV04MU92 DSuSfrypDITWDQWY04lyNaet0F8c0feDAFLez+X+Ce0DpAy89dhpZ5ppgCypLJzLuGT5 SOsFe39D1iGA2sU2zVPKALyanpiBIkG94xJ7E+okr1ko3uj2dRUzshClOM+pGcvS5UTV YogQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711389178; x=1711993978; 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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=kO7D4u++LTg76cPqd0/TxBrIHIwhdJjolYg6EBBv8TciBUIEYE0M2mXXdCHWSDRNTk Ji/KnsKPMSWOl807lzwFScnMPYgYE3rkh9o2qJFCZpeMlPX8nARRb94HGIbiycR9ivPy Hx/sNqnirELvGcyL9QPimQKCF0eVdTPKPakhXp7M/tnNs+T1JvUwGdb+TWiuLaviVuRX A1shZlW0b/5gM85dIZ+RYQHdjCtY0Z2zJ1tEwOnl8DtHGNyvH/ghiM6TDdDnllHApQ/Z 5bc2LEJPhqvq5wNkkwD/7Tk9oBCyJkGphLdAFQlHD8NKiJLFI1nHoZyHyeUzi1WW9Szf 6yJg== X-Forwarded-Encrypted: i=1; AJvYcCXMkoc2XI61xunovtLB8Luc23B+Ir1i/mEUEWYRUMTsL1HuN1J0z10oFd8ehCxwHSBXmqQXTqcLHQkwuptkhIwjGZZRhtO4ApmI5/of+Tsmyjz3jPaXX7XPASNmzRwJb4j0FPNkLU/u9E6waYyxsHS3igzUHrG1kVesk71YUayOHYZ4YCL/8U3BdqTzqz89hBeCQ1v5gNs1JdXuB7YbC3ckStlSnYP9NTKerhLP9CHEVUN10HpW3b9ld0pjIaR3EQZ3xDb4egSeauPNS8jC1ZkvpKBD/PaErt5ewuhGRrCqpmbMufb6sigdLV15N/Dbhg== X-Gm-Message-State: AOJu0Yye6SjchqZslJnxHCStMOofgChKOM0jq+keoS7Sr+PB6crQrQZS k1Ydu/omTWeGHihe9b3rsw3Hm8phetvtV1Pw0bBjgd66ex6WezrHhY6QGdzC X-Google-Smtp-Source: AGHT+IHUF5/gztmPtcgdfhPMYdq4be7TA0gGRpEdurcbuiSF4hiBELhPQZ43z3ayY8PxmvtmmRl6tQ== X-Received: by 2002:a05:6a00:990:b0:6e7:b3c4:43a4 with SMTP id u16-20020a056a00099000b006e7b3c443a4mr8121119pfg.25.1711389178489; Mon, 25 Mar 2024 10:52:58 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id r6-20020aa78b86000000b006ea92de360esm4522577pfd.93.2024.03.25.10.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:52:58 -0700 (PDT) Sender: Guenter Roeck From: Guenter Roeck To: linux-kselftest@vger.kernel.org Cc: David Airlie , Arnd Bergmann , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , 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 Subject: [PATCH v2 02/14] kunit: bug: Count suppressed warning backtraces Date: Mon, 25 Mar 2024 10:52:36 -0700 Message-Id: <20240325175248.1499046-3-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Count suppressed warning backtraces to enable code which suppresses warning backtraces to check if the expected backtrace(s) have been observed. Using atomics for the backtrace count resulted in build errors on some architectures due to include file recursion, so use a plain integer for now. Acked-by: Dan Carpenter Reviewed-by: Kees Cook Tested-by: Linux Kernel Functional Testing Signed-off-by: Guenter Roeck --- - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option include/kunit/bug.h | 7 ++++++- lib/kunit/bug.c | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/kunit/bug.h b/include/kunit/bug.h index bd0fe047572b..72e9fb23bbd5 100644 --- a/include/kunit/bug.h +++ b/include/kunit/bug.h @@ -20,6 +20,7 @@ struct __suppressed_warning { struct list_head node; const char *function; + int counter; }; void __start_suppress_warning(struct __suppressed_warning *warning); @@ -28,7 +29,7 @@ bool __is_suppressed_warning(const char *function); #define DEFINE_SUPPRESSED_WARNING(func) \ struct __suppressed_warning __kunit_suppress_##func = \ - { .function = __stringify(func) } + { .function = __stringify(func), .counter = 0 } #define START_SUPPRESSED_WARNING(func) \ __start_suppress_warning(&__kunit_suppress_##func) @@ -39,12 +40,16 @@ bool __is_suppressed_warning(const char *function); #define IS_SUPPRESSED_WARNING(func) \ __is_suppressed_warning(func) +#define SUPPRESSED_WARNING_COUNT(func) \ + (__kunit_suppress_##func.counter) + #else /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #define DEFINE_SUPPRESSED_WARNING(func) #define START_SUPPRESSED_WARNING(func) #define END_SUPPRESSED_WARNING(func) #define IS_SUPPRESSED_WARNING(func) (false) +#define SUPPRESSED_WARNING_COUNT(func) (0) #endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #endif /* __ASSEMBLY__ */ diff --git a/lib/kunit/bug.c b/lib/kunit/bug.c index f93544d7a9d1..13b3d896c114 100644 --- a/lib/kunit/bug.c +++ b/lib/kunit/bug.c @@ -32,8 +32,10 @@ bool __is_suppressed_warning(const char *function) return false; list_for_each_entry(warning, &suppressed_warnings, node) { - if (!strcmp(function, warning->function)) + if (!strcmp(function, warning->function)) { + warning->counter++; return true; + } } return false; } -- 2.39.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 99730C54E64 for ; Mon, 25 Mar 2024 17:54:12 +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=iiRTgwaHLD3lsLmmGauwQIKPNv5PSGGJ3G+U+icQO2M=; b=fqprnJc869Iqai AyF3hO0WGz5aNbgpmEimNqR9P5w/awNx3vUUhBF6wdEe8K6CSPYKJ5Ba8GV9+AhI6R9bMwxCBOIxx +JxR3gQEhgJ2vc8jDJJjXQ6mQbduhlLvPgFKJp9NtGr/D19d6G2xRe95ZM0uGwGGFAmINaMdQQrv4 +Rv4NlL7tOSzpKw9JZAQzszfZ/6g+wyDtWHNmK7gA24CK4rMz/CBBp6rnu9r1eX77G/Jt0Ufq/ZSV h7jWE76SmJqy6u0Gbq2WxyKPSQVu08GhJAouzlYTGPwUhPobTVJmDax/q2n0UBDlSzzjyJ8lt41WO /7WVV+csZ7b6JyGaNZGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rooWM-00000001AcT-1uiU; Mon, 25 Mar 2024 17:54:06 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rooVP-000000019kl-4BsK; Mon, 25 Mar 2024 17:53:10 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e709e0c123so3506114b3a.1; Mon, 25 Mar 2024 10:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711389178; x=1711993978; 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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=jZFSpPHVyt0n8DoSE9/wJEdT0++PFZUX1fZpNfUA2atcGG6m0LePR1d0B6E/mD25pc 0d0TvH5gT1x0EI/ACQH0L59Ewc+MDGUVBU5B3HMyz381OlXfpmUDvTmwB01HzcAGAcYl Io+lyQQRw1eH31Jwg/mkS7/4EQNt82QMkCDBvyR18GUz5Gecs6s6pfw0qrMuR8KYxFKo jWa/WlVeWRMgjtteGiyo70Yo6M7Ti+jXq/4fXp64L7dGIaXQOL+byJTGLgZwUX56SWkA 3eNbjH1ZJCyfhZnt7lzVZbBj+Mlm9N3TZJUKxBOrvGhVB6aX9ttzIyt9a9Ym48eOk+Pi 9zlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711389178; x=1711993978; 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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=LaI9yywmKf3qJgsXStAxiyyc+ZgxJSdPUsOKvnYQ1gpZVX7ivfhAOhjdZj0jYvKyqI Ztcs1ADio9HHB3sr2txkFQsc6Os3/rUthvXr3MuLLH5mjYJjg0PFHHpHTj/eoEmxHtJR JJS2mnqy5w942YAWmHMs1AqMr3VhsfbkeVzVa1TKHB+uiIpFE6ayGzKhU0d7jftyQZw4 NmSdwPyYX30610W02YpADympB+Z1GLgsLuGdcqmqR8gjbqnTwXxz0Epqhc5s6UikRPVA QuYC6JbhA8t6igYTDpTc8mQEJGMOz5DRl6z1ZAdow8CDrRpZFi7/Dn0uxCCqmoeKXztY kioQ== X-Forwarded-Encrypted: i=1; AJvYcCW+TULCrp0zBeNycyRAO+8w7GYHpnpNIdaqrRNJNiAct7WoW7qYZybwgXPLolBWyeXeJ+gOmiWKx3SpsBYWWydcpFIQXb5fNcUXSSjGWQ6GhPRCjh66OBhXRYggNbYYmPRw8bzDRfrffsZIeAQygYedJ9V9arQ= X-Gm-Message-State: AOJu0YwsQfNuC2sIFV7sToXK7ft+O67k9QklSl0K6rWR4oYgxTsruVra j4d4IIM47PK6oUQOITwgf/KlKINQ5PwiiH+psBh+i4DnhZVjRLnC X-Google-Smtp-Source: AGHT+IHUF5/gztmPtcgdfhPMYdq4be7TA0gGRpEdurcbuiSF4hiBELhPQZ43z3ayY8PxmvtmmRl6tQ== X-Received: by 2002:a05:6a00:990:b0:6e7:b3c4:43a4 with SMTP id u16-20020a056a00099000b006e7b3c443a4mr8121119pfg.25.1711389178489; Mon, 25 Mar 2024 10:52:58 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id r6-20020aa78b86000000b006ea92de360esm4522577pfd.93.2024.03.25.10.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:52:58 -0700 (PDT) From: Guenter Roeck To: linux-kselftest@vger.kernel.org Cc: David Airlie , Arnd Bergmann , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , 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 Subject: [PATCH v2 02/14] kunit: bug: Count suppressed warning backtraces Date: Mon, 25 Mar 2024 10:52:36 -0700 Message-Id: <20240325175248.1499046-3-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_105308_211008_36B1BC52 X-CRM114-Status: GOOD ( 14.13 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Count suppressed warning backtraces to enable code which suppresses warning backtraces to check if the expected backtrace(s) have been observed. Using atomics for the backtrace count resulted in build errors on some architectures due to include file recursion, so use a plain integer for now. Acked-by: Dan Carpenter Reviewed-by: Kees Cook Tested-by: Linux Kernel Functional Testing Signed-off-by: Guenter Roeck --- - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option include/kunit/bug.h | 7 ++++++- lib/kunit/bug.c | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/kunit/bug.h b/include/kunit/bug.h index bd0fe047572b..72e9fb23bbd5 100644 --- a/include/kunit/bug.h +++ b/include/kunit/bug.h @@ -20,6 +20,7 @@ struct __suppressed_warning { struct list_head node; const char *function; + int counter; }; void __start_suppress_warning(struct __suppressed_warning *warning); @@ -28,7 +29,7 @@ bool __is_suppressed_warning(const char *function); #define DEFINE_SUPPRESSED_WARNING(func) \ struct __suppressed_warning __kunit_suppress_##func = \ - { .function = __stringify(func) } + { .function = __stringify(func), .counter = 0 } #define START_SUPPRESSED_WARNING(func) \ __start_suppress_warning(&__kunit_suppress_##func) @@ -39,12 +40,16 @@ bool __is_suppressed_warning(const char *function); #define IS_SUPPRESSED_WARNING(func) \ __is_suppressed_warning(func) +#define SUPPRESSED_WARNING_COUNT(func) \ + (__kunit_suppress_##func.counter) + #else /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #define DEFINE_SUPPRESSED_WARNING(func) #define START_SUPPRESSED_WARNING(func) #define END_SUPPRESSED_WARNING(func) #define IS_SUPPRESSED_WARNING(func) (false) +#define SUPPRESSED_WARNING_COUNT(func) (0) #endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #endif /* __ASSEMBLY__ */ diff --git a/lib/kunit/bug.c b/lib/kunit/bug.c index f93544d7a9d1..13b3d896c114 100644 --- a/lib/kunit/bug.c +++ b/lib/kunit/bug.c @@ -32,8 +32,10 @@ bool __is_suppressed_warning(const char *function) return false; list_for_each_entry(warning, &suppressed_warnings, node) { - if (!strcmp(function, warning->function)) + if (!strcmp(function, warning->function)) { + warning->counter++; return true; + } } return false; } -- 2.39.2 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 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 A4024C54E58 for ; Mon, 25 Mar 2024 17:54:01 +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=6r1KoXhURIT9YbWoUXyH88fGHgcF3A5NEnSogQmPbxY=; b=MSJy4d8cbKnfQQ Zy29HJH0v95owKJH+uDYQnFN8FSf8ZQv2tF6z2H4tJumecIzY6pwN+FdBb7P7ZcpGD7Dlee9fjH+6 xr0VIj4yKzHEDaGF06yNqOuqS8yqTzQ2bGshgjOnXSr6BFxW8UPaPLIYBRoyyWk4VqaGfr5IkBBm9 PmUSnoGnUnI53IIJcru7UcipBgQiJNtbi3C8VWiryueK3cgMYqV9KNdhSy3X3s/oxqE3uPVzycj9u JqYSiisfOIhhmzZHMCD9XFWrEqDSmQygoPXtDgxRkCSIYJhwpaNMXyWZJM0v4ckKTk2H2BdzFkmwi iW331kz5NiWD9DVIfTig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rooW2-00000001ANs-3Koj; Mon, 25 Mar 2024 17:53:46 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rooVP-000000019kl-4BsK; Mon, 25 Mar 2024 17:53:10 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e709e0c123so3506114b3a.1; Mon, 25 Mar 2024 10:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711389178; x=1711993978; 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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=jZFSpPHVyt0n8DoSE9/wJEdT0++PFZUX1fZpNfUA2atcGG6m0LePR1d0B6E/mD25pc 0d0TvH5gT1x0EI/ACQH0L59Ewc+MDGUVBU5B3HMyz381OlXfpmUDvTmwB01HzcAGAcYl Io+lyQQRw1eH31Jwg/mkS7/4EQNt82QMkCDBvyR18GUz5Gecs6s6pfw0qrMuR8KYxFKo jWa/WlVeWRMgjtteGiyo70Yo6M7Ti+jXq/4fXp64L7dGIaXQOL+byJTGLgZwUX56SWkA 3eNbjH1ZJCyfhZnt7lzVZbBj+Mlm9N3TZJUKxBOrvGhVB6aX9ttzIyt9a9Ym48eOk+Pi 9zlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711389178; x=1711993978; 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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=LaI9yywmKf3qJgsXStAxiyyc+ZgxJSdPUsOKvnYQ1gpZVX7ivfhAOhjdZj0jYvKyqI Ztcs1ADio9HHB3sr2txkFQsc6Os3/rUthvXr3MuLLH5mjYJjg0PFHHpHTj/eoEmxHtJR JJS2mnqy5w942YAWmHMs1AqMr3VhsfbkeVzVa1TKHB+uiIpFE6ayGzKhU0d7jftyQZw4 NmSdwPyYX30610W02YpADympB+Z1GLgsLuGdcqmqR8gjbqnTwXxz0Epqhc5s6UikRPVA QuYC6JbhA8t6igYTDpTc8mQEJGMOz5DRl6z1ZAdow8CDrRpZFi7/Dn0uxCCqmoeKXztY kioQ== X-Forwarded-Encrypted: i=1; AJvYcCW+TULCrp0zBeNycyRAO+8w7GYHpnpNIdaqrRNJNiAct7WoW7qYZybwgXPLolBWyeXeJ+gOmiWKx3SpsBYWWydcpFIQXb5fNcUXSSjGWQ6GhPRCjh66OBhXRYggNbYYmPRw8bzDRfrffsZIeAQygYedJ9V9arQ= X-Gm-Message-State: AOJu0YwsQfNuC2sIFV7sToXK7ft+O67k9QklSl0K6rWR4oYgxTsruVra j4d4IIM47PK6oUQOITwgf/KlKINQ5PwiiH+psBh+i4DnhZVjRLnC X-Google-Smtp-Source: AGHT+IHUF5/gztmPtcgdfhPMYdq4be7TA0gGRpEdurcbuiSF4hiBELhPQZ43z3ayY8PxmvtmmRl6tQ== X-Received: by 2002:a05:6a00:990:b0:6e7:b3c4:43a4 with SMTP id u16-20020a056a00099000b006e7b3c443a4mr8121119pfg.25.1711389178489; Mon, 25 Mar 2024 10:52:58 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id r6-20020aa78b86000000b006ea92de360esm4522577pfd.93.2024.03.25.10.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:52:58 -0700 (PDT) From: Guenter Roeck To: linux-kselftest@vger.kernel.org Cc: David Airlie , Arnd Bergmann , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Kees Cook , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , 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 Subject: [PATCH v2 02/14] kunit: bug: Count suppressed warning backtraces Date: Mon, 25 Mar 2024 10:52:36 -0700 Message-Id: <20240325175248.1499046-3-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_105308_211008_36B1BC52 X-CRM114-Status: GOOD ( 14.13 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Count suppressed warning backtraces to enable code which suppresses warning backtraces to check if the expected backtrace(s) have been observed. Using atomics for the backtrace count resulted in build errors on some architectures due to include file recursion, so use a plain integer for now. Acked-by: Dan Carpenter Reviewed-by: Kees Cook Tested-by: Linux Kernel Functional Testing Signed-off-by: Guenter Roeck --- - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option include/kunit/bug.h | 7 ++++++- lib/kunit/bug.c | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/kunit/bug.h b/include/kunit/bug.h index bd0fe047572b..72e9fb23bbd5 100644 --- a/include/kunit/bug.h +++ b/include/kunit/bug.h @@ -20,6 +20,7 @@ struct __suppressed_warning { struct list_head node; const char *function; + int counter; }; void __start_suppress_warning(struct __suppressed_warning *warning); @@ -28,7 +29,7 @@ bool __is_suppressed_warning(const char *function); #define DEFINE_SUPPRESSED_WARNING(func) \ struct __suppressed_warning __kunit_suppress_##func = \ - { .function = __stringify(func) } + { .function = __stringify(func), .counter = 0 } #define START_SUPPRESSED_WARNING(func) \ __start_suppress_warning(&__kunit_suppress_##func) @@ -39,12 +40,16 @@ bool __is_suppressed_warning(const char *function); #define IS_SUPPRESSED_WARNING(func) \ __is_suppressed_warning(func) +#define SUPPRESSED_WARNING_COUNT(func) \ + (__kunit_suppress_##func.counter) + #else /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #define DEFINE_SUPPRESSED_WARNING(func) #define START_SUPPRESSED_WARNING(func) #define END_SUPPRESSED_WARNING(func) #define IS_SUPPRESSED_WARNING(func) (false) +#define SUPPRESSED_WARNING_COUNT(func) (0) #endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #endif /* __ASSEMBLY__ */ diff --git a/lib/kunit/bug.c b/lib/kunit/bug.c index f93544d7a9d1..13b3d896c114 100644 --- a/lib/kunit/bug.c +++ b/lib/kunit/bug.c @@ -32,8 +32,10 @@ bool __is_suppressed_warning(const char *function) return false; list_for_each_entry(warning, &suppressed_warnings, node) { - if (!strcmp(function, warning->function)) + if (!strcmp(function, warning->function)) { + warning->counter++; return true; + } } return false; } -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 AFEC8C6FD1F for ; Mon, 25 Mar 2024 17:55:05 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VHa2xONq; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4V3LDm2rBhz3vn6 for ; Tue, 26 Mar 2024 04:55:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VHa2xONq; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::42c; helo=mail-pf1-x42c.google.com; envelope-from=groeck7@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4V3LBP1fpqz3bxZ for ; Tue, 26 Mar 2024 04:53:00 +1100 (AEDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6e709e0c123so3506112b3a.1 for ; Mon, 25 Mar 2024 10:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711389178; x=1711993978; darn=lists.ozlabs.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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=VHa2xONqWZQhgw9PUcJztQ/MbvcN680+6bfnWE4MtsxWBAPVDSeLlQcA7dFRWlYymP pZ/WvKh9ZKQD4djqk+qujqm0p3BJsBN2WiawMO/2lgrbk6E19ibNTITjuMZ2R5ocGlD/ eKv8dxTi3PGaalQqOY7VpT9pyeyZEKwNsx4D9dt6Wjc/Tc+rq67P8Xp8q0vShR4+4x+B cwyR5TLZWP8ytjFZCpoHSVqH6Q+NkYZB8KEghk3MyclnQcKwmkSdg3k1Dr70erqR59aD 0/nVws9kTpWaPYH2/ACm8wXePlRDlcyUrxI73Df/7Ft3MeQ3qGij0bGxZimYtyf3w1LL /BFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711389178; x=1711993978; 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=FTOeGU6FQqXFkFqXhTXI5f43XSJm9vhCGcg9SgmVgjc=; b=kqo8RjtrVAcsbIMWqg2MWCIQmHq3Fvl97RCL9s+qF+zJnTrXac5m83XMoAJnSDy08Q OtiVX0dAMnsSUhbRknyMDiPiv6ofcpCxYI+M8IzNxAdNoswrxXrvtRq6UUX229vN33r+ CdWrpenrYzKmhxZ5tNpCkioVSGoMnRTs5oYh3EAUbR6ZGzWupSHHvUDsNGDGUOFCCOW5 BAqzUZWp0aKCw98zp4+Vzd4K0w+OV4LyGsV3SaxFsoLBBARZuZtYVxZQMqTy0IE584// tm9pd3FLA28I5Fu20AGUOFwexpC2FEJmcrn9MqZO4ZtlsrSQJAV3ja3hVitSBFoC/IbV FkkA== X-Forwarded-Encrypted: i=1; AJvYcCWOqxTFxIX2t4dGIvYPFOGEObd+W0LiwLQeqf2XpjEE29I/PPAgNncSZ6vUvvhKvxEhMtkgDTIA3MBIVZfU0FDGFMByu0sxasirjgir5w== X-Gm-Message-State: AOJu0Yy3JXIGL7JVdV2Ol8QBgcrmtCQYwjCBESVeOluzkXLfJrrZ6Y/k qX3asP+JLVOBVHniNH+qk3bdFes0FOGuGDKbwVuPDU1II8KjeqXT X-Google-Smtp-Source: AGHT+IHUF5/gztmPtcgdfhPMYdq4be7TA0gGRpEdurcbuiSF4hiBELhPQZ43z3ayY8PxmvtmmRl6tQ== X-Received: by 2002:a05:6a00:990:b0:6e7:b3c4:43a4 with SMTP id u16-20020a056a00099000b006e7b3c443a4mr8121119pfg.25.1711389178489; Mon, 25 Mar 2024 10:52:58 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id r6-20020aa78b86000000b006ea92de360esm4522577pfd.93.2024.03.25.10.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:52:58 -0700 (PDT) From: Guenter Roeck To: linux-kselftest@vger.kernel.org Subject: [PATCH v2 02/14] kunit: bug: Count suppressed warning backtraces Date: Mon, 25 Mar 2024 10:52:36 -0700 Message-Id: <20240325175248.1499046-3-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 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: loongarch@lists.linux.dev, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, Brendan Higgins , linux-riscv@lists.infradead.org, David Airlie , Arthur Grillo , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Daniel Diaz , linux-sh@vger.kernel.org, Naresh Kamboju , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Dan Carpenter , Linux Kernel Functional Testing , Guenter Roeck , Kees Cook , Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , David Gow , Daniel Vetter , linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, linux-parisc@vger.kernel.org, netdev@vger.kernel. org, linux-kernel@vger.kernel.org, Thomas Zimmermann , Andrew Morton , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Count suppressed warning backtraces to enable code which suppresses warning backtraces to check if the expected backtrace(s) have been observed. Using atomics for the backtrace count resulted in build errors on some architectures due to include file recursion, so use a plain integer for now. Acked-by: Dan Carpenter Reviewed-by: Kees Cook Tested-by: Linux Kernel Functional Testing Signed-off-by: Guenter Roeck --- - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option include/kunit/bug.h | 7 ++++++- lib/kunit/bug.c | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/kunit/bug.h b/include/kunit/bug.h index bd0fe047572b..72e9fb23bbd5 100644 --- a/include/kunit/bug.h +++ b/include/kunit/bug.h @@ -20,6 +20,7 @@ struct __suppressed_warning { struct list_head node; const char *function; + int counter; }; void __start_suppress_warning(struct __suppressed_warning *warning); @@ -28,7 +29,7 @@ bool __is_suppressed_warning(const char *function); #define DEFINE_SUPPRESSED_WARNING(func) \ struct __suppressed_warning __kunit_suppress_##func = \ - { .function = __stringify(func) } + { .function = __stringify(func), .counter = 0 } #define START_SUPPRESSED_WARNING(func) \ __start_suppress_warning(&__kunit_suppress_##func) @@ -39,12 +40,16 @@ bool __is_suppressed_warning(const char *function); #define IS_SUPPRESSED_WARNING(func) \ __is_suppressed_warning(func) +#define SUPPRESSED_WARNING_COUNT(func) \ + (__kunit_suppress_##func.counter) + #else /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #define DEFINE_SUPPRESSED_WARNING(func) #define START_SUPPRESSED_WARNING(func) #define END_SUPPRESSED_WARNING(func) #define IS_SUPPRESSED_WARNING(func) (false) +#define SUPPRESSED_WARNING_COUNT(func) (0) #endif /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #endif /* __ASSEMBLY__ */ diff --git a/lib/kunit/bug.c b/lib/kunit/bug.c index f93544d7a9d1..13b3d896c114 100644 --- a/lib/kunit/bug.c +++ b/lib/kunit/bug.c @@ -32,8 +32,10 @@ bool __is_suppressed_warning(const char *function) return false; list_for_each_entry(warning, &suppressed_warnings, node) { - if (!strcmp(function, warning->function)) + if (!strcmp(function, warning->function)) { + warning->counter++; return true; + } } return false; } -- 2.39.2