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 36332C2BA1B for ; Thu, 13 Mar 2025 11:51: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=QBrkTkDZogH5LPIgZUavCFJm+CaTzU099s3gDFiycho=; b=DWd+7nrZ/DAqYB KUoL3O4ObCXoyZux9vJhOmFzM7VikSDZflLR/r2ZmIhG1h6DLuFGPDyd5fffn7zepbr0xy4+7b5hN okOmIGyZFmdLlhpXDPzEIiPhknx1XkVP6N0xd13d+nV9KzAzRvZb/DdkJdhUaDptbeWXhHNytVlwr ratMMj84I7DTfPdKoQKVcvbMcTfDyJBfjhra+u3vS8/BgCCYa8ixp+i7pfMxD9KpaY4w89Vt5IMxj YoiYrczdWeN8i1LLCH4vFdj7GJhQx0PwyUViah7956hv1zQ5RR4pJ0AgiOi0XLFFHpv/ExGJ9C2Xg Z0MaUFuhhOXSbZUN7ujg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tsh5e-0000000B7fI-40Zu; Thu, 13 Mar 2025 11:51:06 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tsh0l-0000000B5nU-0c3o for linux-riscv@lists.infradead.org; Thu, 13 Mar 2025 11:46:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741866361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UxCl1osfLw2v3G3W+1kfNU8xiBvtJTPCZorcBEjeG40=; b=VBzuhPk3Zq1Q+zhWOge7tnyE6q7mqA7np06T4FzfCrSSqY7CuX1Ga6xqOPdoMfU0wOO1Ii l5ZSKPghqkSaF34zAoBpWBwnPqFUlfC+dooSyKW4qINVQeuyETu7Cdfy7NbVUECdDLGPdC 8+YK+tk5idbahHDkpv1AkLE5wa50Oto= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-578-tbv1FOZqOzy5bf4NkjUbCw-1; Thu, 13 Mar 2025 07:44:34 -0400 X-MC-Unique: tbv1FOZqOzy5bf4NkjUbCw-1 X-Mimecast-MFC-AGG-ID: tbv1FOZqOzy5bf4NkjUbCw_1741866273 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43cf44b66f7so4302185e9.1 for ; Thu, 13 Mar 2025 04:44:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741866273; x=1742471073; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UxCl1osfLw2v3G3W+1kfNU8xiBvtJTPCZorcBEjeG40=; b=DnmP1IYnxGv1Tx5NtzcrnM7ggUsUsF9N2OecdZq0q3lfz8OcnzeQszEuDmLKcZPozg Jncn3MRptA5JuaUo/9D9JbScFFITNdIcpPX+//FQA02sjlfGAvqJe4njDmxUq4vzz9SO xd/ncbApE9oLmZ05Gx2+TpwY8SRcRrYZtfhimpGhp4O6D/BTyzSE83ArFVMW3vhStl6e x0TYfCStaM4BzeOtyy7EqTBLEmwWWUCx4zc/cm9hZeIE+xMXluUi+cR/lJV8fSfnglII FqAojjiEzrWo3rRQe8hrdVW99fmqrfhqHZJDQRYDh4zB5pz9o9NpvXfUYqTb2a61a5Q5 JNkQ== X-Forwarded-Encrypted: i=1; AJvYcCXDEAtjCqSK/JIv2fCTAkuwWcG3C3r25QvFYZ5l64gSB3NkySPv3mcDAbTF+ASSo8LQob2dCzk1GTooKA==@lists.infradead.org X-Gm-Message-State: AOJu0YzgSL1VO0ry3TLJc10dAyFwx6WmkAiDwAzHS+Ya4ExKyMqFgJ5L 4f/04oxInyC9FR5rkcEMstj7ec9sENJFCTlTvX2CJWkRAFUjl4jZhv8JZ3Ny/ZWMZPZIOyx45wE k8+QPz3+0vh+O5OgV1ZxBGTX5O7UUewZ7mAiMKJFtXbzyLrPehFKRNiuwJFhj85s54g== X-Gm-Gg: ASbGncsYjjyX4azKgTAZPVf8RFKdzo7l3yCVIFtwQ5pLp5njKBMO3pxlm9V7mBxcShG iH+4qmg8wotD4lZu5lkcQO9ZazNId7TQMYsLDLiOqw3NhACleuUQlvN6Un/8VkBUi6Bnt1xduSF zuCClGhwVGhEPlcdfsXywaGs2+r3e+mp9kuVUtGGLyGJ8E/0xCqZ7cm95s5GIcScarvE95REGLt ADKrEQClMd0qnoV7tPdGnxi/XUsGfLLhB7AExNYAEhfgv+P34bqVoYT5VM2IuG4Fk5NdB3cZ6D9 /1PF0ulnDwMaj76z/omm X-Received: by 2002:a05:600c:190c:b0:43c:ea40:ae4a with SMTP id 5b1f17b1804b1-43cea40af7amr174500865e9.31.1741866273502; Thu, 13 Mar 2025 04:44:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGs6EAEForVjkecQAM8kbehVzhKfM/0tK/SxXfrbXe4b06Gjm7InnzRnhjTKgVzk9sVgzkBAA== X-Received: by 2002:a05:600c:190c:b0:43c:ea40:ae4a with SMTP id 5b1f17b1804b1-43cea40af7amr174500265e9.31.1741866273039; Thu, 13 Mar 2025 04:44:33 -0700 (PDT) Received: from lab.hqhome163.com ([81.57.75.210]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-43d188b754asm17844115e9.14.2025.03.13.04.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 04:44:32 -0700 (PDT) From: Alessandro Carminati 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 , Guenter Roeck , Alessandro Carminati , Jani Nikula , 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, x86@kernel.org, Linux Kernel Functional Testing , Alessandro Carminati Subject: [PATCH v4 02/14] kunit: bug: Count suppressed warning backtraces Date: Thu, 13 Mar 2025 11:43:17 +0000 Message-Id: <20250313114329.284104-3-acarmina@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250313114329.284104-1-acarmina@redhat.com> References: <20250313114329.284104-1-acarmina@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4pQfcBVHR6TGgG9qyEwt1VeIniG_FEYqVPtHg_6xbog_1741866273 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250313_044603_252905_D319F303 X-CRM114-Status: GOOD ( 13.00 ) 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 From: Guenter Roeck 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 Reviewed-by: David Gow Signed-off-by: Alessandro Carminati --- 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 0a8e62c1fcaf..44efa7d5c902 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 __kunit_start_suppress_warning(struct __suppressed_warning *warning); @@ -28,7 +29,7 @@ bool __kunit_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 KUNIT_START_SUPPRESSED_WARNING(func) \ __kunit_start_suppress_warning(&__kunit_suppress_##func) @@ -39,12 +40,16 @@ bool __kunit_is_suppressed_warning(const char *function); #define KUNIT_IS_SUPPRESSED_WARNING(func) \ __kunit_is_suppressed_warning(func) +#define SUPPRESSED_WARNING_COUNT(func) \ + (__kunit_suppress_##func.counter) + #else /* CONFIG_KUNIT_SUPPRESS_BACKTRACE */ #define DEFINE_SUPPRESSED_WARNING(func) #define KUNIT_START_SUPPRESSED_WARNING(func) #define KUNIT_END_SUPPRESSED_WARNING(func) #define KUNIT_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 351f9a595a71..84c05b1a9e8b 100644 --- a/lib/kunit/bug.c +++ b/lib/kunit/bug.c @@ -32,8 +32,10 @@ bool __kunit_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.34.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv