From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 90112147C6C; Wed, 3 Apr 2024 13:19:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712150388; cv=none; b=RD1rfPgrcOwRWgNgD/FRhHaYDeMnSnlwOTTrK4eWIXaE09XXwUbSMFb4dX7mRhafWR0ZqpSLIwgLZRRoAW69iXQ1v3+KiYlkfWCWM7E4QFcT3hqsonYYfYGN+RZ+xvIH/tvkwvUfI9J/ynYzjnmO025is5xF1isi99aTpg87hj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712150388; c=relaxed/simple; bh=qIpKll238/HMKyMj8OXA3kK3I9zyQbT0+DzHrIXJApg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H3UE/+DL5x6yERGzYXJ9gvUWbXTdj/1BmKA98BsvPyyBey4u8I1huCUpefzBpdQs0ZYpQeT5mr0TILO9iw/ID9ecrpiT7XzODzhDg+21FgTEW6W7WTYJMKHPt2o2ippYfhq4m3nRbqUPJ2aKl587LTgGhi6GXV4G75hryzszg4Y= 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=InvFh4N7; arc=none smtp.client-ip=209.85.214.171 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="InvFh4N7" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e296c7aa7cso4303095ad.1; Wed, 03 Apr 2024 06:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=InvFh4N7Hb1IP9fVLAn2M2FO6/oG4l7vTjWn1rnmBl71Ep6ntedclhWog6OgqsYZA6 CROmiegIbIREQAxXQb3xhh4/hkvq3OrptAbkn8SFxnjxQmp2gDRaj7dWjCxfJQUCUvPU RlOocwLjXHCqBpQLaW0/BJLuvTOLO5pE0teSzwK4OpqS6b8R8I448GvGvncyJnkFUQ+Y gHePaXzdp/WFJGV6WVZZhKqnAeqqaIQTgYctdSYvqsi+rnJxG7louyzJcxJZXnRfPIrn AHzwHkX1tiGo7BUDjbhepv+jiCOU8o7ALusoVBRKfRy7FpbUV8BKYmUXl9afA6+ol48m 6D2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=ZydZy6urPjyueBDjpIhV7V6bkvAPSh8jeA7Ubp3TbVdCWC1lD4P+Am+ejvyQiY49O5 0OYny4O//KjUM3pZK1kDbKXI+wBwnaZJc+zbspSIHFgA0ADnVUbay5VIA6A6iFzvjDdb aN1bRxZvvjtybYDDcinAv7rNG/QAynEJP8aruCpX810HM9S8erbo8k0l9xcPKeAq+rUV xl6w5fhS7Z3CFSGHCWZbplIu/k5XgM+xjkH3QbUpp3PbNF+rVtS3gwPxNFtZYeH2Emr7 DUIWnO/A3MOayp1htQa0EcZBJes2DQLRg8hERTKYMeHcAym9/CgQ5ieXe4tVVuiGONY1 G7ow== X-Forwarded-Encrypted: i=1; AJvYcCWlwjS9mvJ5yhRr4ph9ZOyIj4mcmrqOtsGzCQQ55pj8jGAOzgYU6y77a1tikxyA3uaNQn3ezYyE1HQM1qxFmaTN9nwj6BffUNAiUXI7mQu0lmwE6IbFb1wrWZy6rm80Ed9sc337c9ll4xhNadID4oZXNraeGHakjlNVdvh4sI26QOdHpJMtAH/v+EpsYZqcq3ae9CPCzulY0SAYJYftV9btuWLRD3Jiw9pag7s0rlguoSTX24xRZinCxRpr7HWdBAymJ4MiyveJ2NmzyNQf+vaLNxZQEwvHVtFMwyeJu9Bwx9VqMobSOlw5Ckjdzf6h/Q== X-Gm-Message-State: AOJu0Yw0sIzM5kbnjN9CB63lqA8l/UsoSnYrHTKkC2H0zgx+GiICF59+ uocPzyUSnV+BWMLfdRCFl/74u9XT2FlkHY1USi4Kz0LRNtLO/060R7lDEieE X-Google-Smtp-Source: AGHT+IEBdntNuCJK1g1Qd+nUbBCHvT+g3ANfVkijVSktnMtYlUtgHLeuVpmPgg+o1C+TJMJB0A4+8w== X-Received: by 2002:a17:902:9004:b0:1e2:5e2f:682 with SMTP id a4-20020a170902900400b001e25e2f0682mr6996194plp.2.1712150385380; Wed, 03 Apr 2024 06:19:45 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u2-20020a170902e5c200b001d8f81ecea1sm13305095plf.172.2024.04.03.06.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:19:44 -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, x86@kernel.org, Guenter Roeck , Linux Kernel Functional Testing Subject: [PATCH v3 02/15] kunit: bug: Count suppressed warning backtraces Date: Wed, 3 Apr 2024 06:19:23 -0700 Message-Id: <20240403131936.787234-3-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403131936.787234-1-linux@roeck-us.net> References: <20240403131936.787234-1-linux@roeck-us.net> Precedence: bulk X-Mailing-List: linux-arch@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 --- v2: - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option v3: - Rebased to v6.9-rc2 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 B292BCD1288 for ; Wed, 3 Apr 2024 14:34:24 +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=K7ElIdN8Tm75nauDLK0wU3sFvaaT8mBf1Qm+G0NdbIc=; b=iMo35j7kmn2M6m jMoc91bRn1xmAZhwG64RkVn/j3dlW9thLn4KSbEiqU0WW+pKIwL+Dq7tW5A0tZj9KDWdz5pKhjOl/ Pg76v2+pyWWjqu3g4DhgJe3s0Wa7tZ0ug/qgbLj0ZHfZsR23qG7UHQDEt2tbDcPH+0Nr22/JSVKW7 KJetgTvYB9r6VjrjjxFhtvbE1kti1/5ImBxxJBQakXFenTARxI5ab7aGzmt3vlBdmGCEI8hnXYeX3 J7LROFJgntnpJcJEas74BkHHPZCbrFVRjeSfiRbcr1od8cR1lG/X3p7CC8deENB+HRnbh/n/aosKN jzuTwVCU12BAd8LN92NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs1gw-0000000GUg2-1cqn; Wed, 03 Apr 2024 14:34:18 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0Wr-0000000G8S3-1WhO; Wed, 03 Apr 2024 13:19:53 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1e27e174ccbso10904895ad.2; Wed, 03 Apr 2024 06:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=Hdis1yKYxs7UzPBOWDK/7whrRx3Ma3wLxyJ46fWep9HEnnphkb7aqX1uRqaFBY3ZfS 6GhceUUZexFSQh9vzC1wHbEQhiMowqoJkHwgFQc09ibnDKXsK7/OHHJ5ogut/K/T54Wu Apek/yef/Wf1v9N3hjWWV4gR5QN8bWrEFAIDoFZ40rwzhXLiEMPYqqHZz5QZqcWE3P3c hd32tBCXxp6zV1EbIMHJlgbJSPU5lxMWUslPTXYiF1Hey+dVMuFLGPbMufG8/W6EMNd2 qNSWqruZNqgFfmU2HL44LMPBuoAtxMSlCJnLE6DVS1iATuhQC1N+cOIeC6L/gOBlbemb bDXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=vaePumFxZrOPYH5q0wWg6ifZlxWNnIRpxzjzRed89Ubxhn/hKJJ9r6mEiPUtKweFRq 0cFixv5F3mnxSUM3wALHRdt+ZwRRuIHPrOanK7PwLooIhMyr2H93Qmf+Ec3LLWYiYr3f bl8a4/oTMyg0tGreoGFpduN1tKtLK4fxWntzecbrn7QKpWTWP1/ShBZSpu39zk/FWKD2 XnNT+seeKg+GC0VpxYwlzDYwWbqbXrSriTphiXsV9CjpTfzoTRbWcCzz0KCcmCe+KxnI 3D58UXfp+ObcGSAbANeXf9D/8Z/zuffk08HgFn9jaCnrmV0IaaiXZpv7ehpCkKAX2Vw/ g25A== X-Forwarded-Encrypted: i=1; AJvYcCXbKJuBzRS8hC9OF1GPo2Q3IyCMSSM+Bme8rq8/xgAtGBUfmIgE7LLDwBFI5VVFGR40pG6Wcr/UPb7lHNyMlYi52FMcpbDF5mTvuv3gaGq3NQpoOirComxJS0kIuzbIlaT2wbePfHSsmqlOyj8CJckU812eHw4= X-Gm-Message-State: AOJu0YyvyvrU6dijouWaYWWeAIRY71wDQDneOPTMv8B745FeXYBt43Dd UM8RAyTpVtgJmfMHQrgGR/dPlOABNbjjXfYbOXMgJC4+0BgrlaD2 X-Google-Smtp-Source: AGHT+IEBdntNuCJK1g1Qd+nUbBCHvT+g3ANfVkijVSktnMtYlUtgHLeuVpmPgg+o1C+TJMJB0A4+8w== X-Received: by 2002:a17:902:9004:b0:1e2:5e2f:682 with SMTP id a4-20020a170902900400b001e25e2f0682mr6996194plp.2.1712150385380; Wed, 03 Apr 2024 06:19:45 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u2-20020a170902e5c200b001d8f81ecea1sm13305095plf.172.2024.04.03.06.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:19:44 -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, x86@kernel.org, Guenter Roeck , Linux Kernel Functional Testing Subject: [PATCH v3 02/15] kunit: bug: Count suppressed warning backtraces Date: Wed, 3 Apr 2024 06:19:23 -0700 Message-Id: <20240403131936.787234-3-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403131936.787234-1-linux@roeck-us.net> References: <20240403131936.787234-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-20240403_061949_619981_ADB72F43 X-CRM114-Status: GOOD ( 13.98 ) 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 --- v2: - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option v3: - Rebased to v6.9-rc2 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 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 BB11DCD1288 for ; Wed, 3 Apr 2024 13:21:52 +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=QKllijHT; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4V8llM2yCbz3w38 for ; Thu, 4 Apr 2024 00:21:51 +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=QKllijHT; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::631; helo=mail-pl1-x631.google.com; envelope-from=groeck7@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) (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 4V8lhz48jmz3vsp for ; Thu, 4 Apr 2024 00:19:47 +1100 (AEDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1e293335cdeso5394435ad.3 for ; Wed, 03 Apr 2024 06:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=QKllijHTQYA3HB4FgINix7o837YId7d0Z2o2DElCtRV5ki/xMD29hoNC49209Nzska x1Ng7TgUwc+/CIyN/rEatotjj/jXmysOZ2TlASb3mNC7EbIOMbM+BlSVRNuA3L+k3XhN uxjsJ6wNwhCJBKFJEWpulBKH2uAFfqYmsiFAS9o98cp2EJ9o0eozrFaDAX8qE8uYSgd7 E4v5W3e6dQdKqSmGkt+OQejWeTBOGyabEiyi45yf0mQbTrlh2PD4qwcQgenO9IVMcvlm rgpIkrYB64ug/uHdrhGgJJY28nIUY/AOWR4TmMhrvKrKx84VNGEoyo41VVcqrL+G0SM4 kGhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=Tac019D5faONF4Bnv28GksLkHlE3iQgEuIBX/DfivaLEzMd8/0NqFemMBae/BL1v3a ATbKPs/Wzw4NikYm8bcckdN7bKIRTLmwPAnSDysNOEv3Mc/hm7ch8nm6C6x7X9Ab3rVc mxOVi5h7gomVk4KwH9xDZpPcvgRy00skfdBRgf9dZif0rURmuVZoEUANnET8uH/zC2nb FrACVE8z5FkK0gvNAzUhwXHGB1EUiHF9So4cLGSQtN4k/fNmMb0ar18FZ76l6uVBOvb7 fF+obf8NJlDpo3Z9n0WSz9vw7bavdZHwiOD9Jpc8fCDyuitxlubqkbbSYEmUBIJjcTxi hOmA== X-Forwarded-Encrypted: i=1; AJvYcCUqacSVkqtM0DqPQ8zYtS0Tw6OLhgI5SLRshYdFs9U741LX/455XaLGF2QrGoFOuoaNGTanl0IHkZ8KcKMWJhLWIpjZVndG4uh9us7z/g== X-Gm-Message-State: AOJu0YweOGKAbkdRqPTC3UMxDWZXH7ET5wjBiWa7f5lkqTFElFa8knE+ 2v7jkrEiWOa9LQc2ZjJyOSthMIBNOcG45FDei+oy0Heg54eXd9z1 X-Google-Smtp-Source: AGHT+IEBdntNuCJK1g1Qd+nUbBCHvT+g3ANfVkijVSktnMtYlUtgHLeuVpmPgg+o1C+TJMJB0A4+8w== X-Received: by 2002:a17:902:9004:b0:1e2:5e2f:682 with SMTP id a4-20020a170902900400b001e25e2f0682mr6996194plp.2.1712150385380; Wed, 03 Apr 2024 06:19:45 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u2-20020a170902e5c200b001d8f81ecea1sm13305095plf.172.2024.04.03.06.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:19:44 -0700 (PDT) From: Guenter Roeck To: linux-kselftest@vger.kernel.org Subject: [PATCH v3 02/15] kunit: bug: Count suppressed warning backtraces Date: Wed, 3 Apr 2024 06:19:23 -0700 Message-Id: <20240403131936.787234-3-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403131936.787234-1-linux@roeck-us.net> References: <20240403131936.787234-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: x86@kernel.org, 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, net dev@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 --- v2: - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option v3: - Rebased to v6.9-rc2 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 704BACD128A for ; Wed, 3 Apr 2024 14:34:26 +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=JWIIMiBoGOaVMSBkbzjiB0IaVkPdunGAHA//7DrKxF0=; b=eRZKHl/BCAr4Kl /loYeRZkLmj+AzxMvZYOl4izD51bqmIqGoQ+41dpw/s3rcM/sM0rjFYI51f0ZHtIh6DE0iVqpw/l5 dQcFcv8DqqObhP6JEcVKltnGoE87Y4tDQCvvrDhPFP0cbQTHAU40JXrOPJI8AQ5hLJdEtUxAJP/Oq UFi4kG3e9L/3uZdgot/sj7yoXhIzWs2LF8SJ4U9/BLQ2kSUrgz/Al0BS6hbYv8JqpZOI4cImqKi7L kysbhea8oYjyRgIbzVULaS/K908q6vAua8tPtwMDliKCGVkjr3l8zimE4nPc9nwDIihWRB3LFyZAh H37oKl8Sg6pFDy9wznkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs1gv-0000000GUfX-3Exj; Wed, 03 Apr 2024 14:34:17 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs0Wr-0000000G8S3-1WhO; Wed, 03 Apr 2024 13:19:53 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1e27e174ccbso10904895ad.2; Wed, 03 Apr 2024 06:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=Hdis1yKYxs7UzPBOWDK/7whrRx3Ma3wLxyJ46fWep9HEnnphkb7aqX1uRqaFBY3ZfS 6GhceUUZexFSQh9vzC1wHbEQhiMowqoJkHwgFQc09ibnDKXsK7/OHHJ5ogut/K/T54Wu Apek/yef/Wf1v9N3hjWWV4gR5QN8bWrEFAIDoFZ40rwzhXLiEMPYqqHZz5QZqcWE3P3c hd32tBCXxp6zV1EbIMHJlgbJSPU5lxMWUslPTXYiF1Hey+dVMuFLGPbMufG8/W6EMNd2 qNSWqruZNqgFfmU2HL44LMPBuoAtxMSlCJnLE6DVS1iATuhQC1N+cOIeC6L/gOBlbemb bDXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712150385; x=1712755185; 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=vPi3jXYhV/VW7gVgCzBi2KBL1/Xcj6OVJJpN8P4Laxs=; b=vaePumFxZrOPYH5q0wWg6ifZlxWNnIRpxzjzRed89Ubxhn/hKJJ9r6mEiPUtKweFRq 0cFixv5F3mnxSUM3wALHRdt+ZwRRuIHPrOanK7PwLooIhMyr2H93Qmf+Ec3LLWYiYr3f bl8a4/oTMyg0tGreoGFpduN1tKtLK4fxWntzecbrn7QKpWTWP1/ShBZSpu39zk/FWKD2 XnNT+seeKg+GC0VpxYwlzDYwWbqbXrSriTphiXsV9CjpTfzoTRbWcCzz0KCcmCe+KxnI 3D58UXfp+ObcGSAbANeXf9D/8Z/zuffk08HgFn9jaCnrmV0IaaiXZpv7ehpCkKAX2Vw/ g25A== X-Forwarded-Encrypted: i=1; AJvYcCXbKJuBzRS8hC9OF1GPo2Q3IyCMSSM+Bme8rq8/xgAtGBUfmIgE7LLDwBFI5VVFGR40pG6Wcr/UPb7lHNyMlYi52FMcpbDF5mTvuv3gaGq3NQpoOirComxJS0kIuzbIlaT2wbePfHSsmqlOyj8CJckU812eHw4= X-Gm-Message-State: AOJu0YyvyvrU6dijouWaYWWeAIRY71wDQDneOPTMv8B745FeXYBt43Dd UM8RAyTpVtgJmfMHQrgGR/dPlOABNbjjXfYbOXMgJC4+0BgrlaD2 X-Google-Smtp-Source: AGHT+IEBdntNuCJK1g1Qd+nUbBCHvT+g3ANfVkijVSktnMtYlUtgHLeuVpmPgg+o1C+TJMJB0A4+8w== X-Received: by 2002:a17:902:9004:b0:1e2:5e2f:682 with SMTP id a4-20020a170902900400b001e25e2f0682mr6996194plp.2.1712150385380; Wed, 03 Apr 2024 06:19:45 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id u2-20020a170902e5c200b001d8f81ecea1sm13305095plf.172.2024.04.03.06.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 06:19:44 -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, x86@kernel.org, Guenter Roeck , Linux Kernel Functional Testing Subject: [PATCH v3 02/15] kunit: bug: Count suppressed warning backtraces Date: Wed, 3 Apr 2024 06:19:23 -0700 Message-Id: <20240403131936.787234-3-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403131936.787234-1-linux@roeck-us.net> References: <20240403131936.787234-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-20240403_061949_619981_ADB72F43 X-CRM114-Status: GOOD ( 13.98 ) 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 --- v2: - Rebased to v6.9-rc1 - Added Tested-by:, Acked-by:, and Reviewed-by: tags - Introduced KUNIT_SUPPRESS_BACKTRACE configuration option v3: - Rebased to v6.9-rc2 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