public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Namhyung Kim <namhyung.kim@lge.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/7] perf tools: Introduce perf_target__strerror()
Date: Mon, 07 May 2012 11:43:09 -0600	[thread overview]
Message-ID: <4FA809AD.7060209@gmail.com> (raw)
In-Reply-To: <20120507172946.GC2485@infradead.org>

On 5/7/12 11:29 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 07, 2012 at 02:09:02PM +0900, Namhyung Kim escreveu:
>> The perf_target__strerror() sets @buf to a string that
>> describes the (perf_target-specific) error condition
>> that is passed via @errnum.
>>
>> This is similar to strerror_r() and does same thing if
>> @errnum has a standard errno value.
>
> This has a problem: why should I be warned when I do, as root:
>
> # perf top -u acme
>
> It warns me that "UID switch overriding SYSTEM", yeah, right that is
> what I asked, no need to tell me that :-)
>
> So what is missing in this case is that top starts with system_wide set,
> not from the command line.
>
> I.e. if I had asked for:
>
> # perf top --system_wide --user acme
>
> Ok, the warning would make sense.
>
> So just special case this in the top case, I think, like the patch
> below, ack?
>
> I'll fold this into this patch and add a [ committer note: ... ]
>
> Ack?
>
> - Arnaldo
>
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index a2518fc..780791f 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -1257,7 +1257,16 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
>   	setup_browser(false);
>
>   	status = perf_target__validate(&top.target);
> -	if (status != PERF_ERRNO_TARGET__SUCCESS) {
> +	if (status != PERF_ERRNO_TARGET__SUCCESS&&
> +	    status != PERF_ERRNO_TARGET__PID_OVERRIDE_SYSTEM&&
> +	    status != PERF_ERRNO_TARGET__UID_OVERRIDE_SYSTEM) {
> +		/*
> + 		 * Top doesn't provide an explicit way to ask for system wide
> + 		 * profiling, it is the default.
> + 		 *
> + 		 * So we shouldn't warn the user when he/she asks for --pid or
> + 		 * --uid.
> + 		 */
>   		perf_target__strerror(&top.target, status, errbuf, BUFSIZ);
>   		ui__warning("%s", errbuf);
>   	}

Seems like we should avoid the propagation of the errnos beyond the 
depths of the library part. For perf-top why not default to nothing set 
and if the user does not request one, set system wide. i.e, following 
Patch 6 in this set do:

if (perf_target__none(&top.target)
     top.target.system_wide = true;

David

  reply	other threads:[~2012-05-07 17:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07  5:08 [PATCH 0/7] perf tools: Fix cpu/thread map handling v3 Namhyung Kim
2012-05-07  5:08 ` [PATCH 1/7] perf top: Defaults to system_wide target Namhyung Kim
2012-05-07  5:08 ` [PATCH 2/7] perf evlist: Fix creation of cpu map Namhyung Kim
2012-05-11  6:39   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 3/7] perf target: Introduce perf_target_errno Namhyung Kim
2012-05-11  6:40   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 4/7] perf target: Introduce perf_target__parse_uid() Namhyung Kim
2012-05-11  6:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 5/7] perf tools: Introduce perf_target__strerror() Namhyung Kim
2012-05-07 17:29   ` Arnaldo Carvalho de Melo
2012-05-07 17:43     ` David Ahern [this message]
2012-05-08  1:57       ` Namhyung Kim
2012-05-08 13:17         ` Arnaldo Carvalho de Melo
2012-05-11  6:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 6/7] perf target: Consolidate target task/cpu checking Namhyung Kim
2012-05-11  6:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-05-07  5:09 ` [PATCH 7/7] perf stat: Use perf_evlist__create_maps Namhyung Kim
2012-05-11  6:43   ` [tip:perf/core] " tip-bot for Namhyung Kim

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=4FA809AD.7060209@gmail.com \
    --to=dsahern@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox