linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error
@ 2015-02-24 10:46 Adrian Hunter
  2015-02-24 13:32 ` Josh Boyer
  2015-03-01 16:50 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  0 siblings, 2 replies; 9+ messages in thread
From: Adrian Hunter @ 2015-02-24 10:46 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Jiri Olsa

Feature detection for pthread_attr_setaffinity_np was failing,
producing this error:

In file included from bench/futex-hash.c:17:0:
bench/futex.h:73:19: error: conflicting types for ‘pthread_attr_setaffinity_np’
 static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
                   ^
In file included from bench/futex.h:72:0,
                 from bench/futex-hash.c:17:
/usr/include/pthread.h:407:12: note: previous declaration of ‘pthread_attr_setaffinity_np’ was here
 extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
            ^
make[3]: *** [bench/futex-hash.o] Error 1
make[2]: *** [bench] Error 2
make[2]: *** Waiting for unfinished jobs....

This was because compiling test-pthread-attr-setaffinity-np.c
failed due to the function arguments:

test-pthread-attr-setaffinity-np.c: In function ‘main’:
test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
  ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
  ^
So fix the arguments.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 0a0d3ec..2b81b72 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,11 @@ int main(void)
 {
 	int ret = 0;
 	pthread_attr_t thread_attr;
+	cpu_set_t cs;
 
 	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);
+	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
 
 	return ret;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error
  2015-02-24 10:46 [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error Adrian Hunter
@ 2015-02-24 13:32 ` Josh Boyer
  2015-02-24 13:52   ` Adrian Hunter
  2015-03-01 16:50 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  1 sibling, 1 reply; 9+ messages in thread
From: Josh Boyer @ 2015-02-24 13:32 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Arnaldo Carvalho de Melo, Linux-Kernel@Vger. Kernel. Org, Jiri Olsa

On Tue, Feb 24, 2015 at 5:46 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> Feature detection for pthread_attr_setaffinity_np was failing,
> producing this error:
>
> In file included from bench/futex-hash.c:17:0:
> bench/futex.h:73:19: error: conflicting types for 'pthread_attr_setaffinity_np'
>  static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
>                    ^
> In file included from bench/futex.h:72:0,
>                  from bench/futex-hash.c:17:
> /usr/include/pthread.h:407:12: note: previous declaration of 'pthread_attr_setaffinity_np' was here
>  extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>             ^
> make[3]: *** [bench/futex-hash.o] Error 1
> make[2]: *** [bench] Error 2
> make[2]: *** Waiting for unfinished jobs....
>
> This was because compiling test-pthread-attr-setaffinity-np.c
> failed due to the function arguments:
>
> test-pthread-attr-setaffinity-np.c: In function 'main':
> test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
>   ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
>   ^
> So fix the arguments.

Erm, I sent a different fix for this a while ago.  It's queued in some
-tip tree.  The feature test wasn't defining _GNU_SOURCE, which is
required for pthread_attr_setaffinity_np.  Once that was set (passed
via -D in the Makefile), the feature test worked fine.

Did you have to use your patch on top of the fix already queued?

josh

>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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 0a0d3ec..2b81b72 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,11 @@ int main(void)
>  {
>         int ret = 0;
>         pthread_attr_t thread_attr;
> +       cpu_set_t cs;
>
>         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);
> +       ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
>
>         return ret;
>  }
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error
  2015-02-24 13:32 ` Josh Boyer
@ 2015-02-24 13:52   ` Adrian Hunter
  2015-02-24 14:31     ` Josh Boyer
  0 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2015-02-24 13:52 UTC (permalink / raw)
  To: Josh Boyer
  Cc: Arnaldo Carvalho de Melo, Linux-Kernel@Vger. Kernel. Org, Jiri Olsa

On 24/02/15 15:32, Josh Boyer wrote:
> On Tue, Feb 24, 2015 at 5:46 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> Feature detection for pthread_attr_setaffinity_np was failing,
>> producing this error:
>>
>> In file included from bench/futex-hash.c:17:0:
>> bench/futex.h:73:19: error: conflicting types for 'pthread_attr_setaffinity_np'
>>  static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
>>                    ^
>> In file included from bench/futex.h:72:0,
>>                  from bench/futex-hash.c:17:
>> /usr/include/pthread.h:407:12: note: previous declaration of 'pthread_attr_setaffinity_np' was here
>>  extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>>             ^
>> make[3]: *** [bench/futex-hash.o] Error 1
>> make[2]: *** [bench] Error 2
>> make[2]: *** Waiting for unfinished jobs....
>>
>> This was because compiling test-pthread-attr-setaffinity-np.c
>> failed due to the function arguments:
>>
>> test-pthread-attr-setaffinity-np.c: In function 'main':
>> test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
>>   ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
>>   ^
>> So fix the arguments.
> 
> Erm, I sent a different fix for this a while ago.  It's queued in some
> -tip tree.  The feature test wasn't defining _GNU_SOURCE, which is
> required for pthread_attr_setaffinity_np.  Once that was set (passed
> via -D in the Makefile), the feature test worked fine.
> 
> Did you have to use your patch on top of the fix already queued?

Yes.

The error (warning + Werror) I got definitely seemed to be about the use of
NULL as an argument.

> 
> josh
> 
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>>  tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> 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 0a0d3ec..2b81b72 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,11 @@ int main(void)
>>  {
>>         int ret = 0;
>>         pthread_attr_t thread_attr;
>> +       cpu_set_t cs;
>>
>>         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);
>> +       ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
>>
>>         return ret;
>>  }
>> --
>> 1.9.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error
  2015-02-24 13:52   ` Adrian Hunter
@ 2015-02-24 14:31     ` Josh Boyer
  2015-02-25  6:50       ` Adrian Hunter
  0 siblings, 1 reply; 9+ messages in thread
From: Josh Boyer @ 2015-02-24 14:31 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Arnaldo Carvalho de Melo, Linux-Kernel@Vger. Kernel. Org, Jiri Olsa

On Tue, Feb 24, 2015 at 8:52 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 24/02/15 15:32, Josh Boyer wrote:
>> On Tue, Feb 24, 2015 at 5:46 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>> Feature detection for pthread_attr_setaffinity_np was failing,
>>> producing this error:
>>>
>>> In file included from bench/futex-hash.c:17:0:
>>> bench/futex.h:73:19: error: conflicting types for 'pthread_attr_setaffinity_np'
>>>  static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
>>>                    ^
>>> In file included from bench/futex.h:72:0,
>>>                  from bench/futex-hash.c:17:
>>> /usr/include/pthread.h:407:12: note: previous declaration of 'pthread_attr_setaffinity_np' was here
>>>  extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>>>             ^
>>> make[3]: *** [bench/futex-hash.o] Error 1
>>> make[2]: *** [bench] Error 2
>>> make[2]: *** Waiting for unfinished jobs....
>>>
>>> This was because compiling test-pthread-attr-setaffinity-np.c
>>> failed due to the function arguments:
>>>
>>> test-pthread-attr-setaffinity-np.c: In function 'main':
>>> test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
>>>   ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
>>>   ^
>>> So fix the arguments.
>>
>> Erm, I sent a different fix for this a while ago.  It's queued in some
>> -tip tree.  The feature test wasn't defining _GNU_SOURCE, which is
>> required for pthread_attr_setaffinity_np.  Once that was set (passed
>> via -D in the Makefile), the feature test worked fine.
>>
>> Did you have to use your patch on top of the fix already queued?
>
> Yes.
>
> The error (warning + Werror) I got definitely seemed to be about the use of
> NULL as an argument.

Hm, ok.  Which compiler/glibc are you using?  Curious that I'm not
seeing that issue.

josh

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error
  2015-02-24 14:31     ` Josh Boyer
@ 2015-02-25  6:50       ` Adrian Hunter
  0 siblings, 0 replies; 9+ messages in thread
From: Adrian Hunter @ 2015-02-25  6:50 UTC (permalink / raw)
  To: Josh Boyer
  Cc: Arnaldo Carvalho de Melo, Linux-Kernel@Vger. Kernel. Org, Jiri Olsa

On 24/02/2015 4:31 p.m., Josh Boyer wrote:
> On Tue, Feb 24, 2015 at 8:52 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 24/02/15 15:32, Josh Boyer wrote:
>>> On Tue, Feb 24, 2015 at 5:46 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>> Feature detection for pthread_attr_setaffinity_np was failing,
>>>> producing this error:
>>>>
>>>> In file included from bench/futex-hash.c:17:0:
>>>> bench/futex.h:73:19: error: conflicting types for 'pthread_attr_setaffinity_np'
>>>>   static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
>>>>                     ^
>>>> In file included from bench/futex.h:72:0,
>>>>                   from bench/futex-hash.c:17:
>>>> /usr/include/pthread.h:407:12: note: previous declaration of 'pthread_attr_setaffinity_np' was here
>>>>   extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
>>>>              ^
>>>> make[3]: *** [bench/futex-hash.o] Error 1
>>>> make[2]: *** [bench] Error 2
>>>> make[2]: *** Waiting for unfinished jobs....
>>>>
>>>> This was because compiling test-pthread-attr-setaffinity-np.c
>>>> failed due to the function arguments:
>>>>
>>>> test-pthread-attr-setaffinity-np.c: In function 'main':
>>>> test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
>>>>    ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
>>>>    ^
>>>> So fix the arguments.
>>>
>>> Erm, I sent a different fix for this a while ago.  It's queued in some
>>> -tip tree.  The feature test wasn't defining _GNU_SOURCE, which is
>>> required for pthread_attr_setaffinity_np.  Once that was set (passed
>>> via -D in the Makefile), the feature test worked fine.
>>>
>>> Did you have to use your patch on top of the fix already queued?
>>
>> Yes.
>>
>> The error (warning + Werror) I got definitely seemed to be about the use of
>> NULL as an argument.
>
> Hm, ok.  Which compiler/glibc are you using?  Curious that I'm not
> seeing that issue.

4.8.2

You could also see if you have the __nonnull attribute in the header e.g.

extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
                                         size_t __cpusetsize,
                                         const cpu_set_t *__cpuset)
      __THROW __nonnull ((1, 3));


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [tip:perf/urgent] perf tools: Fix pthread_attr_setaffinity_np build error
  2015-02-24 10:46 [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error Adrian Hunter
  2015-02-24 13:32 ` Josh Boyer
@ 2015-03-01 16:50 ` tip-bot for Adrian Hunter
  2015-03-01 16:52   ` Ingo Molnar
  1 sibling, 1 reply; 9+ messages in thread
From: tip-bot for Adrian Hunter @ 2015-03-01 16:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, acme, tglx, jolsa, linux-kernel, eranian, adrian.hunter, hpa

Commit-ID:  95a09cfa3cdf94231ce511f1697754482b918d39
Gitweb:     http://git.kernel.org/tip/95a09cfa3cdf94231ce511f1697754482b918d39
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Tue, 24 Feb 2015 12:46:06 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 25 Feb 2015 12:18:03 -0300

perf tools: Fix pthread_attr_setaffinity_np build error

Feature detection for pthread_attr_setaffinity_np was failing, producing
this error:

  In file included from bench/futex-hash.c:17:0:
  bench/futex.h:73:19: error: conflicting types for ‘pthread_attr_setaffinity_np’
   static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr,
                   ^
  In file included from bench/futex.h:72:0,
                   from bench/futex-hash.c:17:
  /usr/include/pthread.h:407:12: note: previous declaration of ‘pthread_attr_setaffinity_np’ was here
   extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
            ^
  make[3]: *** [bench/futex-hash.o] Error 1
  make[2]: *** [bench] Error 2
  make[2]: *** Waiting for unfinished jobs....

  This was because compiling test-pthread-attr-setaffinity-np.c
  failed due to the function arguments:

  test-pthread-attr-setaffinity-np.c: In function ‘main’:
  test-pthread-attr-setaffinity-np.c:11:2: warning: null argument where non-null required (argument 3) [-Wnonnull]
    ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL);
    ^
  So fix the arguments.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Stephane Eranian <eranian@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1424774766-24194-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 0a0d3ec..2b81b72 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,11 @@ int main(void)
 {
 	int ret = 0;
 	pthread_attr_t thread_attr;
+	cpu_set_t cs;
 
 	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);
+	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
 
 	return ret;
 }

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [tip:perf/urgent] perf tools: Fix pthread_attr_setaffinity_np build error
  2015-03-01 16:50 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
@ 2015-03-01 16:52   ` Ingo Molnar
  2015-03-02  7:59     ` [PATCH] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test Adrian Hunter
  0 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2015-03-01 16:52 UTC (permalink / raw)
  To: hpa, adrian.hunter, eranian, linux-kernel, tglx, jolsa, acme
  Cc: linux-tip-commits


* tip-bot for Adrian Hunter <tipbot@zytor.com> wrote:

> --- 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,11 @@ int main(void)
>  {
>  	int ret = 0;
>  	pthread_attr_t thread_attr;
> +	cpu_set_t cs;
>  
>  	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);
> +	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);

So I'm splitting hairs, as we never run these testcases, but I think a 
CPU_ZERO(&cs) is needed, as 'cs' might be uninitialized.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test
  2015-03-01 16:52   ` Ingo Molnar
@ 2015-03-02  7:59     ` Adrian Hunter
  2015-03-03  6:26       ` [tip:perf/core] " tip-bot for Adrian Hunter
  0 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2015-03-02  7:59 UTC (permalink / raw)
  To: acme
  Cc: Ingo Molnar, hpa, eranian, linux-kernel, tglx, jolsa, linux-tip-commits

Feature tests are compiled but not executed, however
it might avoid a future uninitialized variable warning,
so initialize the cpu set.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 2b81b72..fdada5e 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
@@ -1,5 +1,6 @@
 #include <stdint.h>
 #include <pthread.h>
+#include <sched.h>
 
 int main(void)
 {
@@ -8,7 +9,8 @@ int main(void)
 	cpu_set_t cs;
 
 	pthread_attr_init(&thread_attr);
-	/* don't care abt exact args, just the API itself in libpthread */
+	CPU_ZERO(&cs);
+
 	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
 
 	return ret;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:perf/core] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test
  2015-03-02  7:59     ` [PATCH] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test Adrian Hunter
@ 2015-03-03  6:26       ` tip-bot for Adrian Hunter
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Adrian Hunter @ 2015-03-03  6:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: adrian.hunter, mingo, tglx, acme, linux-kernel, eranian, hpa

Commit-ID:  543d976fa2ebf5543bd07b5d487bf3a6144c0886
Gitweb:     http://git.kernel.org/tip/543d976fa2ebf5543bd07b5d487bf3a6144c0886
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Mon, 2 Mar 2015 09:59:05 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 2 Mar 2015 12:48:16 -0300

perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test

Feature tests are compiled but not executed, however it might avoid a
future uninitialized variable warning, so initialize the cpu set.

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-tip-commits@vger.kernel.org
Link: http://lkml.kernel.org/r/54F41849.1010906@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 2b81b72..fdada5e 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
@@ -1,5 +1,6 @@
 #include <stdint.h>
 #include <pthread.h>
+#include <sched.h>
 
 int main(void)
 {
@@ -8,7 +9,8 @@ int main(void)
 	cpu_set_t cs;
 
 	pthread_attr_init(&thread_attr);
-	/* don't care abt exact args, just the API itself in libpthread */
+	CPU_ZERO(&cs);
+
 	ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
 
 	return ret;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-03  6:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-24 10:46 [PATCH] perf tools: Fix pthread_attr_setaffinity_np build error Adrian Hunter
2015-02-24 13:32 ` Josh Boyer
2015-02-24 13:52   ` Adrian Hunter
2015-02-24 14:31     ` Josh Boyer
2015-02-25  6:50       ` Adrian Hunter
2015-03-01 16:50 ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2015-03-01 16:52   ` Ingo Molnar
2015-03-02  7:59     ` [PATCH] perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test Adrian Hunter
2015-03-03  6:26       ` [tip:perf/core] " tip-bot for Adrian Hunter

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).