Re: [PATCH 1/2] perf vendor events: Add stepping in CPUID string for x86
From: Jiri Olsa
Date: Thu Nov 15 2018 - 10:33:29 EST
On Thu, Nov 15, 2018 at 10:18:27AM -0500, Liang, Kan wrote:
SNIP
> > > > +int strcmp_cpuid_str(const char *mapcpuid, const char *cpuid)
> > > > +{
> > > > + regex_t re;
> > > > + regmatch_t pmatch[1];
> > > > + int match;
> > > > + bool full_mapcpuid = is_full_cpuid(mapcpuid);
> > > > + bool full_cpuid = is_full_cpuid(cpuid);
> > >
> > > cpuid will be always full from now right? why do we need to check it?
> > >
> >
> > User may set cpuid by environment string "PERF_CPUID", which may not be
> > full format.
> >
> > > also please move this to arch/x86/util/pmu.c
> > > so it matches the weak function object
> >
> > Sure.
> >
>
> It looks like both pmu.c and header.c have cpuid related functions.
> For example,
> get_cpuid_str() has weak function in pmu.c. It's declaration in header.h.
> It's x86 specific function in x86/util/header.c
> get_cpuid() has weak function in header.c. It's declaration in header.h.
> It's x86 specific function in x86/util/header.c
>
> It looks like most of the cpuid related functions are in header.c/h.
> I think it may be better to move all the cpuid related functions to
> header.c/h.
>
> If it's OK for you, I will send a clean up patch later to move the weak
> functions strcmp_cpuid_str() and get_cpuid_str() to header.c
>
> What do you think?
sounds good, thanks
jirka