linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Chun-Tse Shao <ctshao@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v4 2/3] perf lock: Fix the wrong name percpu-rwsem
Date: Mon, 9 Dec 2024 14:44:41 -0800	[thread overview]
Message-ID: <Z1dy2Svj6gddulHf@google.com> (raw)
In-Reply-To: <20241209200104.870531-2-ctshao@google.com>

On Mon, Dec 09, 2024 at 12:01:01PM -0800, Chun-Tse Shao wrote:
> In `perf lock --help`, the name of `percpu-rwsem` should be
> `pcpu-rwsem`. This patch fixes the naming in `lock_type_table`, and also
> replaces the mismatched name `percpu-rwsem` before parsing it for
> backward compatibility.
> 
> Tested `./perf lock con -ab -Y pcpu-sem` and `./perf lock con -ab -Y
> percpu-rwsem`
> 
> Fixes: 4f701063bfa2 ("perf lock contention: Show lock type with address")
> Signed-off-by: Chun-Tse Shao <ctshao@google.com>
> ---
>  tools/perf/builtin-lock.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
> index 7e36bbe3cb80..264acfa648e4 100644
> --- a/tools/perf/builtin-lock.c
> +++ b/tools/perf/builtin-lock.c
> @@ -1587,8 +1587,8 @@ static const struct {
>  	{ LCB_F_RT,			"rt-mutex",	"rt-mutex" },
>  	{ LCB_F_RT | LCB_F_READ,	"rwlock-rt:R",	"rwlock-rt" },
>  	{ LCB_F_RT | LCB_F_WRITE,	"rwlock-rt:W",	"rwlock-rt" },
> -	{ LCB_F_PERCPU | LCB_F_READ,	"pcpu-sem:R",	"percpu-rwsem" },
> -	{ LCB_F_PERCPU | LCB_F_WRITE,	"pcpu-sem:W",	"percpu-rwsem" },
> +	{ LCB_F_PERCPU | LCB_F_READ,	"pcpu-sem:R",	"pcpu-sem" },
> +	{ LCB_F_PERCPU | LCB_F_WRITE,	"pcpu-sem:W",	"pcpu-sem" },

It'll change the output of perf lock con -l.


>  	{ LCB_F_MUTEX,			"mutex",	"mutex" },
>  	{ LCB_F_MUTEX | LCB_F_SPIN,	"mutex",	"mutex" },
>  };
> @@ -2365,7 +2365,11 @@ static int parse_lock_type(const struct option *opt __maybe_unused, const char *
>  		/*
>  		 * Otherwise `tok` is `name` in `lock_type_table`.
>  		 * Single lock name could contain multiple flags.
> +		 * By documentation, `percpu-rwmem` should be `pcpu-sem`.
> +		 * For backward compatibility, we replace `percpu-rwmem` with `pcpu-sem`.
>  		 */
> +		if (!strcmp(tok, "percpu-rwsem"))
> +			tok = (char *)"pcpu-sem";

I think you can do this in the other way around.

Thanks,
Namhyung


>  		for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) {
>  			if (!strcmp(lock_type_table[i].name, tok)) {
>  				if (add_lock_type(lock_type_table[i].flags)) {
> -- 
> 2.47.0.338.g60cca15819-goog
> 

  reply	other threads:[~2024-12-09 22:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 20:01 [PATCH v4 1/3] perf lock: Fix parse_lock_type which only retrieve one lock flag Chun-Tse Shao
2024-12-09 20:01 ` [PATCH v4 2/3] perf lock: Fix the wrong name percpu-rwsem Chun-Tse Shao
2024-12-09 22:44   ` Namhyung Kim [this message]
2024-12-10 20:10     ` Chun-Tse Shao
2024-12-09 20:01 ` [PATCH v4 3/3] perf lock: Rename fields in lock_type_table Chun-Tse Shao
2024-12-09 22:41 ` [PATCH v4 1/3] perf lock: Fix parse_lock_type which only retrieve one lock flag 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=Z1dy2Svj6gddulHf@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ctshao@google.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=mingo@redhat.com \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).