Linux-perf-users Archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Nick Forrington <nick.forrington@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	 Mark Rutland <mark.rutland@arm.com>,
	 Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,  Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	 "Liang, Kan" <kan.liang@linux.intel.com>
Subject: Re: [PATCH 1/1] perf lock info: Display both map and thread by default
Date: Sun, 12 May 2024 18:41:36 -0700	[thread overview]
Message-ID: <CAM9d7cgPRK1uayZd3fRB0gWzdugGKLycCWSsNRCPNx4fhEt6Sw@mail.gmail.com> (raw)
In-Reply-To: <45d28735-043f-43fd-bd2f-9dd8cb5259e8@arm.com>

On Thu, May 9, 2024 at 3:01 AM Nick Forrington <nick.forrington@arm.com> wrote:
>
> Hello,
>
> On 08/05/2024 22:18, Namhyung Kim wrote:
> > Hello,
> >
> > On Wed, May 8, 2024 at 6:46 AM Nick Forrington <nick.forrington@arm.com> wrote:
> >> Change "perf lock info" argument handling to:
> >>
> >> Display both map and thread info (rather than an error) when neither are
> >> specified.
> >>
> >> Display both map and thread info (rather than just thread info) when
> >> both are requested.
> >>
> >> Signed-off-by: Nick Forrington <nick.forrington@arm.com>
> >> ---
> >>   tools/perf/Documentation/perf-lock.txt |  4 ++--
> >>   tools/perf/builtin-lock.c              | 22 +++++++++++++++++-----
> >>   2 files changed, 19 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/tools/perf/Documentation/perf-lock.txt b/tools/perf/Documentation/perf-lock.txt
> >> index f5938d616d75..57a940399de0 100644
> >> --- a/tools/perf/Documentation/perf-lock.txt
> >> +++ b/tools/perf/Documentation/perf-lock.txt
> >> @@ -111,11 +111,11 @@ INFO OPTIONS
> >>
> >>   -t::
> >>   --threads::
> >> -       dump thread list in perf.data
> >> +       dump only the thread list in perf.data
> >>
> >>   -m::
> >>   --map::
> >> -       dump map of lock instances (address:name table)
> >> +       dump only the map of lock instances (address:name table)
> >>
> >>
> >>   CONTENTION OPTIONS
> >> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> >> index 230461280e45..d0b8645487ad 100644
> >> --- a/tools/perf/builtin-lock.c
> >> +++ b/tools/perf/builtin-lock.c
> >> @@ -1483,11 +1483,16 @@ static int dump_info(void)
> >>
> >>          if (info_threads)
> >>                  dump_threads();
> >> -       else if (info_map)
> >> +
> >> +       if (info_map) {
> >> +               if (info_threads)
> >> +                       fputc('\n', lock_output);
> > it seems you need pr_info("\n").  Where does lock_output come from?
>
>
> It's a static FILE* that defaults to stderr.

Oh, right.  I somehow confused this with perf sched. ;-p

>
>
> It's used by dump_threads and dump_map (via fprintf), so I think it
> makes sense to use it for the output spacing between them?
>
> >
> >
> >>                  dump_map();
> >> -       else {
> >> +       }
> >> +
> >> +       if (!info_threads && !info_map) {
> >>                  rc = -1;
> >> -               pr_err("Unknown type of information\n");
> >> +               pr_err("No lock info specified\n");
> >>          }
> > I think we can remove this block now.
>
>
> The original error looked like a function input sanity check (rather
> than for handling user input), so I kept it (even if it should no longer
> be possible for a user to trigger it).
>
>
> Although I can remove it (or move it to the start of the function) if
> you prefer.

Yep, I think we can just remove it.

Thanks,
Namhyung

  reply	other threads:[~2024-05-13  1:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 13:42 [PATCH v3 0/1] Perf lock improvements Nick Forrington
2024-05-08 13:42 ` [PATCH 1/1] perf lock info: Display both map and thread by default Nick Forrington
2024-05-08 21:18   ` Namhyung Kim
2024-05-09 10:01     ` Nick Forrington
2024-05-13  1:41       ` Namhyung Kim [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-13  9:14 [PATCH v4 0/1] Perf lock improvements Nick Forrington
2024-05-13  9:14 ` [PATCH 1/1] perf lock info: Display both map and thread by default Nick Forrington

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=CAM9d7cgPRK1uayZd3fRB0gWzdugGKLycCWSsNRCPNx4fhEt6Sw@mail.gmail.com \
    --to=namhyung@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nick.forrington@arm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).