public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>, "Jin, Yao" <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v1] perf tools: Fix pattern matching for same substring used in different pmu type
Date: Tue, 29 Jun 2021 17:47:56 -0400	[thread overview]
Message-ID: <844625a7-5903-519e-9ef4-ca6684661aef@linux.intel.com> (raw)
In-Reply-To: <YNuNW/Afd/X25fNe@krava>



On 6/29/2021 5:15 PM, Jiri Olsa wrote:
> On Mon, Jun 28, 2021 at 09:52:42AM +0800, Jin, Yao wrote:
> 
> SNIP
> 
>>>>>> +    /*
>>>>>> +     * The pmu_name has substring tok. If the format of
>>>>>> +     * pmu_name is <tok> or <tok>_<digit>, return true.
>>>>>> +     */
>>>>>> +    p = pmu_name + strlen(tok);
>>>>>> +    if (*p == 0)
>>>>>> +        return true;
>>>>>> +
>>>>>> +    if (*p != '_')
>>>>>> +        return false;
>>>>>> +
>>>>>> +    ++p;
>>>>>> +    if (*p == 0 || !isdigit(*p))
>>>>>> +        return false;
>>>>>> +
>>>>>> +    return true;
>>>>>> +}
>>>
>>> hum, so we have pattern serch and then another function checking
>>> if that search was ok..
>>
>> Yes, that's what this patch does.
>>
>> I understand that's convenient, because
>>> it's on 2 different places
>>
>> Yes, on pmu_uncore_alias_match() and on parse-events.y.
>>
>> but could we have some generic solution,
>>> line one function/search that returns/search for valid pmu name?
>>>
>>
>> Sorry, I don't understand this idea well. Would you like to further explain?
>>
>> Or can you accept the regex approach?
> 
> I don't really have any suggestion, just would be great to have
> this encapsulated in one function.. 

Yes, I agree. One function is better.

We just changed the design for the uncore PMU on SPR. There will be two 
PMU names for each uncore unit, a real name and an alias. The perf tool 
should handle both names. So we have to compare both names here.
I think one generic function can facilitate the code rebase.

https://lore.kernel.org/lkml/1624990443-168533-7-git-send-email-kan.liang@linux.intel.com/

Thanks,
Kan


  reply	other threads:[~2021-06-29 21:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  4:57 [PATCH v1] perf tools: Fix pattern matching for same substring used in different pmu type Jin Yao
2021-06-11  2:54 ` Jin, Yao
2021-06-23  2:02   ` Jin, Yao
2021-06-25 10:11     ` Jiri Olsa
2021-06-28  1:52       ` Jin, Yao
2021-06-29 21:15         ` Jiri Olsa
2021-06-29 21:47           ` Liang, Kan [this message]
2021-06-30  8:15             ` Jin, Yao

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=844625a7-5903-519e-9ef4-ca6684661aef@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.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