Re: [PATCH] perf tools: Fix pthread_attr_setaffinity_np() feature detection on Ubuntu systems

From: Jiri Olsa
Date: Sat Feb 28 2015 - 17:59:51 EST


On Sat, Feb 28, 2015 at 08:49:27AM +0100, Ingo Molnar wrote:

SNIP

>
> 0695e57b9a6a perf tools: Factor features display code
>
> Firstly, 'factor' isn't a verb we use for code, 'factor out' is. But
> it's not really factoring out - it separates the code. Did this title
> want to say:
>
> perf tools: Separate feature display code into three parts
>
> ? The title was absolutely unreadable.
>
> Then it introduces two new makefile variables: LIB_FEATURE_TESTS and
> VF_FEATURE_TESTS. LIB_FEATURE_TESTS is reasonably self-explanatory,
> but wth is VF_FEATURE_TESTS?
>
> More importantly, why isn't there a _single_ comment explaining their
> use in the Makefile - _especially_ since CORE_FEATURE_TESTS is
> explained so well, it's not like a bad example had to be followed.
>
> Using cryptic abbreviations like 'VF' adds insult to injury. It took
> me some time to figure out that it probably means 'Verbose Features'.
>
> New feature detection adds to all these variables so people will just
> guess to which to add and why.
>
> Guys, this particular change was rushed and not explained well enough,
> and it made debugging from that point on harder. Please slow down a
> bit.

agreed, sry about that.. I'll try to clean it up while moving
features detection into tools/ as you suggested before

>
> </rant>
>

SNIP

> diff --git a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
> index 0a0d3ecb4e8a..85ab83e6a42f 100644
> --- a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
> +++ b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c
> @@ -5,10 +5,12 @@ int main(void)
> {
> int ret = 0;
> pthread_attr_t thread_attr;
> + cpu_set_t cpu_mask;
>
> pthread_attr_init(&thread_attr);
> - /* don't care abt exact args, just the API itself in libpthread */
> - ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
> + CPU_ZERO(&cpu_mask);
> +
> + ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cpu_mask), &cpu_mask);

I think Arnaldo got this one covered in perf/urgent already,
but I might have missed something..

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/