From: Arnaldo Carvalho de Melo <acme@kernel.org> To: James Clark <james.clark@arm.com> 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 <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>, John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>, 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 Date: Mon, 2 Aug 2021 11:44:36 -0300 [thread overview] Message-ID: <YQgE1CBje091cL3t@kernel.org> (raw) In-Reply-To: <20210729155805.2830-2-james.clark@arm.com> 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 <james.clark@arm.com> > --- > 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
WARNING: multiple messages have this Message-ID (diff)
From: Arnaldo Carvalho de Melo <acme@kernel.org> To: James Clark <james.clark@arm.com> 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 <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>, John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>, 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 Date: Mon, 2 Aug 2021 11:44:36 -0300 [thread overview] Message-ID: <YQgE1CBje091cL3t@kernel.org> (raw) In-Reply-To: <20210729155805.2830-2-james.clark@arm.com> 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 <james.clark@arm.com> > --- > 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
next prev parent reply other threads:[~2021-08-02 14:44 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-29 15:57 [RFC PATCH 0/6] perf tools: Warning fixes James Clark 2021-07-29 15:57 ` James Clark 2021-07-29 15:58 ` [RFC PATCH 1/6] perf tools: Add WARN_ONCE equivalent for UI warnings James Clark 2021-07-29 15:58 ` James Clark 2021-08-02 14:44 ` Arnaldo Carvalho de Melo [this message] 2021-08-02 14:44 ` Arnaldo Carvalho de Melo 2021-07-29 15:58 ` [RFC PATCH 2/6] perf tools: Re-add annotate_warned functionality James Clark 2021-07-29 15:58 ` James Clark 2021-07-29 15:58 ` [RFC PATCH 3/6] perf tools: Add disassembly warnings for annotate --stdio James Clark 2021-07-29 15:58 ` James Clark 2021-07-29 15:58 ` [RFC PATCH 4/6] perf tools: Add flag for tracking warnings of missing DSOs James Clark 2021-07-29 15:58 ` James Clark 2021-07-29 15:58 ` [RFC PATCH 5/6] perf cs-etm: Improve Coresight zero timestamp warning James Clark 2021-07-29 15:58 ` James Clark 2021-08-02 15:17 ` Leo Yan 2021-08-02 15:17 ` Leo Yan 2021-08-03 13:25 ` Arnaldo Carvalho de Melo 2021-08-03 13:25 ` Arnaldo Carvalho de Melo 2021-07-29 15:58 ` [RFC PATCH 6/6] perf cs-etm: Add warnings for missing DSOs James Clark 2021-07-29 15:58 ` James Clark 2021-08-02 14:51 ` Arnaldo Carvalho de Melo 2021-08-02 14:51 ` Arnaldo Carvalho de Melo 2021-08-02 17:03 ` Mathieu Poirier 2021-08-02 17:03 ` Mathieu Poirier 2021-08-03 8:06 ` Mike Leach 2021-08-03 8:06 ` Mike Leach 2021-08-02 15:41 ` Leo Yan 2021-08-02 15:41 ` Leo Yan 2021-08-03 13:24 ` Arnaldo Carvalho de Melo 2021-08-03 13:24 ` Arnaldo Carvalho de Melo 2021-08-03 14:01 ` Leo Yan 2021-08-03 14:01 ` Leo Yan 2021-08-05 12:59 ` James Clark 2021-08-05 12:59 ` James Clark 2021-08-06 18:36 ` Arnaldo Carvalho de Melo 2021-08-06 18:36 ` Arnaldo Carvalho de Melo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YQgE1CBje091cL3t@kernel.org \ --to=acme@kernel.org \ --cc=alexander.shishkin@linux.intel.com \ --cc=coresight@lists.linaro.org \ --cc=james.clark@arm.com \ --cc=john.garry@huawei.com \ --cc=jolsa@redhat.com \ --cc=leo.yan@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-perf-users@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mathieu.poirier@linaro.org \ --cc=mike.leach@linaro.org \ --cc=namhyung@kernel.org \ --cc=suzuki.poulose@arm.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.