Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1681998pxy; Mon, 2 Aug 2021 07:47:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDB7DykMjogL/Fa+7UeAZnAmrmHHnXOMfsx3p4eHcDsH65ThEpav/YJ4zEyu5dPJqhC4mS X-Received: by 2002:a05:6402:10cc:: with SMTP id p12mr19853118edu.328.1627915642125; Mon, 02 Aug 2021 07:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627915642; cv=none; d=google.com; s=arc-20160816; b=nRrjoBkGn+rcU2EhEHiOQEZjBD9HMt3J8ZD5ZreP8l9d4XAiW9Shft7kf4yHx+fvXU tloqohBMcjcWjmCml6h/Wpw/YdX3HU0PyZwh/BXZ4+4A5vAWffVvKuUtL58Wz3orkxol ZAqwSmqzBZuXnja9Gg21Bj8A/CS5kc92Zgjdm3xhIic+WSevP2PZ6CLk03iIDiV4Vllj OkcUeNClLEvlPtNz1f2Cze0Y0CoLxovGrgN359GLgi9FVBxL42wxFxCCQoM59C9A3Qt5 jIY8dt/+3MD1AvqXc/CIW1ZiKw973O0pnrcad+aVX3UiLDgQPL9UI74VVuzJ3F8HJY33 gzfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RNTHqvNY0L/YyqAFakHbac6ntLhSsVZN4RTLI+jfkOQ=; b=IX1+eNjBHuswerY6PnnGW7B3pPwIQzTI6/H5T9Z0npCk3q0qP1x92iNYzUHEJcbVih hZamZJ34wQ1iWHBxVDXjo0uIW8va4VpqW97uN+oYMn+UKZWp+oOGDEe02HpXUv/+GOmu 9V1yRJz5WMvjknfQQtiieUKChfI9fg9r02iz+boRVH4aIOb2lg3xUhD/eWqQLM0DKkXp X/+OpZIsyXgMLJeTSUfXSo3tJIauj/sPkopDgaanoO2aDHLrIE4t6XyrKUgm8NM8HAzE PPJoubw//CaTDzpoNsqVCNfIog+EEAjyiiP4alDlbPoqe2SW0K/fUratIqAJq+Lkh4I1 u3zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6uQQVAv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj24si5543603ejb.143.2021.08.02.07.46.55; Mon, 02 Aug 2021 07:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6uQQVAv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234087AbhHBOos (ORCPT + 99 others); Mon, 2 Aug 2021 10:44:48 -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