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 X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A46C432BE for ; Mon, 2 Aug 2021 14:44:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 66B2160F5A for ; Mon, 2 Aug 2021 14:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234257AbhHBOot (ORCPT ); Mon, 2 Aug 2021 10:44:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:47820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233925AbhHBOos (ORCPT ); Mon, 2 Aug 2021 10:44:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6EA1760E97; Mon, 2 Aug 2021 14:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627915478; bh=sJWwqysH7JYnXzYI5IZmt2yWUBjHmLLt/xg7tbEgjqE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X6uQQVAvHrpTIo5AXQD5rIZEeujsT5rHIHVcNYc6K2eFrVtdIn5Uyv6nqM4/vxOgI 82v/ZLG7ts4TdmvB0dukNgIaZbJbZ4KP+6/maoz9RA9rGRhVxY0GdnAgK0Lfkd/NA8 CjuIZsoumxVB/XToSGAuoUXKIvWFdPukJvBW6Uwh5JRIC9Xao56pvQF+s9gdkIAKJU SUOEjJLdbG5EdnS6fdevAJ9DNkZk5Uu8Ar0HtDySmkt9pCtQMfzt4L5vFAUXvcdidk tY2bnk7SmITJbYgCfmwOIiB0kdkZd/K0s1sbsM6NevDn50pokFKT67rdSzA9jrBI9a K6U7Vtubi3mjg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5A967403F2; Mon, 2 Aug 2021 11:44:36 -0300 (-03) Date: Mon, 2 Aug 2021 11:44:36 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: mathieu.poirier@linaro.org, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 1/6] perf tools: Add WARN_ONCE equivalent for UI warnings Message-ID: References: <20210729155805.2830-1-james.clark@arm.com> <20210729155805.2830-2-james.clark@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210729155805.2830-2-james.clark@arm.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jul 29, 2021 at 04:58:00PM +0100, James Clark escreveu: > Currently WARN_ONCE prints to stderr and corrupts the TUI. Add > equivalent methods for UI warnings. This one and the the next 3 seem clean and useful, applying and then waiting for people to comment on the coresight specific ones. - Arnaldo > Signed-off-by: James Clark > --- > tools/perf/util/debug.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h > index 48f631966067..f99468a7f681 100644 > --- a/tools/perf/util/debug.h > +++ b/tools/perf/util/debug.h > @@ -22,6 +22,13 @@ extern int debug_data_convert; > eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) > #define pr_warning(fmt, ...) \ > eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) > +#define pr_warning_once(fmt, ...) ({ \ > + static int __warned; \ > + if (unlikely(!__warned)) { \ > + pr_warning(fmt, ##__VA_ARGS__); \ > + __warned = 1; \ > + } \ > +}) > #define pr_info(fmt, ...) \ > eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) > #define pr_debug(fmt, ...) \ > @@ -55,6 +62,13 @@ void trace_event(union perf_event *event); > > int ui__error(const char *format, ...) __printf(1, 2); > int ui__warning(const char *format, ...) __printf(1, 2); > +#define ui__warning_once(format, ...) ({ \ > + static int __warned; \ > + if (unlikely(!__warned)) { \ > + ui__warning(format, ##__VA_ARGS__); \ > + __warned = 1; \ > + } \ > +}) > > void pr_stat(const char *fmt, ...); > > -- > 2.28.0 > -- - Arnaldo 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 X-Spam-Level: X-Spam-Status: No, score=-14.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C00C432BE for ; Mon, 2 Aug 2021 14:48:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CC63C60F6E for ; Mon, 2 Aug 2021 14:48:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CC63C60F6E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R/QptbDkaVZf2GZDtenvmzBs0rAxmcoraW5E5o82vVo=; b=uBX74RbYodwnwG OdmDrZWYK7fm6bPTAeR6zCQi6QfdfVtG6jzm7PZDWGUym1+N74fkGUF/FnKeOgw82VQTf4n7j7lGI TwkxC3mcs3wTfW17+9OVhj8Obrk5zCKyPMkGXdg0rWYabm+MnRItchVb7LE1+TXRgsdkI4ebjqIDa QubQy5Ucf+mNUVy3xofAhMNsfGWm1Tf6CVqncmijMfg1DCmkdqGRyHu3/vxv/PAxaSnhv98eTRPI5 e9ocR5sJP6RVXq1IbQ1MpDo8P/heDH0zIHOtPK3HYMpYFBiKms7G3qHMBkcKYrL4p9iz/ceEEzEto D09ild0P1bvK2kPCE2cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAZCI-00GiLs-AY; Mon, 02 Aug 2021 14:45:42 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAZCE-00GiKp-VP for linux-arm-kernel@bombadil.infradead.org; Mon, 02 Aug 2021 14:45:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RNTHqvNY0L/YyqAFakHbac6ntLhSsVZN4RTLI+jfkOQ=; b=uauNBBbUhZByyhoQ/TZI9hGHUb EK9FTbSd60cUq1k9smMa3T1kAV2rrBbQnG5/k0vw7QAsacqaeItH6q/RjGrtXdDjA2cWSsx6Agl3N e3dEbRPn2m2YRQsiyZDc01zjnq/jAG6IsVluxinmU/Lk44tnTfjpBs4Q4eWbxwNiDYCF8/at2oExC wMKK9cbLfU2/guq8MjRLSman5XG/08/b/D5hH9UsFfuo5rS3nxaRahoBZshOywKfcgbp3ji6YXUCR NnpfIiywL1ChZxtsiSeqhDa3v7Bk/+92LJK2637tE6jv6dvwT2ThEF/V0ChoRYteBGpmegVto4Xpb ZKObdIpQ==; Received: from [177.35.17.230] (helo=quaco.ghostprotocols.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAZBN-003Zig-E1 for linux-arm-kernel@lists.infradead.org; Mon, 02 Aug 2021 14:45:05 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5A967403F2; Mon, 2 Aug 2021 11:44:36 -0300 (-03) Date: Mon, 2 Aug 2021 11:44:36 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: mathieu.poirier@linaro.org, coresight@lists.linaro.org, linux-perf-users@vger.kernel.org, leo.yan@linaro.org, suzuki.poulose@arm.com, mike.leach@linaro.org, Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 1/6] perf tools: Add WARN_ONCE equivalent for UI warnings Message-ID: References: <20210729155805.2830-1-james.clark@arm.com> <20210729155805.2830-2-james.clark@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210729155805.2830-2-james.clark@arm.com> X-Url: http://acmel.wordpress.com 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 Em Thu, Jul 29, 2021 at 04:58:00PM +0100, James Clark escreveu: > Currently WARN_ONCE prints to stderr and corrupts the TUI. Add > equivalent methods for UI warnings. This one and the the next 3 seem clean and useful, applying and then waiting for people to comment on the coresight specific ones. - Arnaldo > Signed-off-by: James Clark > --- > tools/perf/util/debug.h | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h > index 48f631966067..f99468a7f681 100644 > --- a/tools/perf/util/debug.h > +++ b/tools/perf/util/debug.h > @@ -22,6 +22,13 @@ extern int debug_data_convert; > eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) > #define pr_warning(fmt, ...) \ > eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) > +#define pr_warning_once(fmt, ...) ({ \ > + static int __warned; \ > + if (unlikely(!__warned)) { \ > + pr_warning(fmt, ##__VA_ARGS__); \ > + __warned = 1; \ > + } \ > +}) > #define pr_info(fmt, ...) \ > eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) > #define pr_debug(fmt, ...) \ > @@ -55,6 +62,13 @@ void trace_event(union perf_event *event); > > int ui__error(const char *format, ...) __printf(1, 2); > int ui__warning(const char *format, ...) __printf(1, 2); > +#define ui__warning_once(format, ...) ({ \ > + static int __warned; \ > + if (unlikely(!__warned)) { \ > + ui__warning(format, ##__VA_ARGS__); \ > + __warned = 1; \ > + } \ > +}) > > void pr_stat(const char *fmt, ...); > > -- > 2.28.0 > -- - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel