All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition
@ 2019-07-18 17:30 Andrii Nakryiko
  2019-07-18 17:31 ` Andrii Nakryiko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2019-07-18 17:30 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel, acme
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

hashmap.h depends on __WORDSIZE being defined. It is defined by
glibc/musl in different headers. It's an explicit goal for musl to be
"non-detectable" at compilation time, so instead include glibc header if
glibc is explicitly detected and fall back to musl header otherwise.

Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/hashmap.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
index 03748a742146..bae8879cdf58 100644
--- a/tools/lib/bpf/hashmap.h
+++ b/tools/lib/bpf/hashmap.h
@@ -10,6 +10,11 @@
 
 #include <stdbool.h>
 #include <stddef.h>
+#ifdef __GLIBC__
+#include <bits/wordsize.h>
+#else
+#include <bits/reg.h>
+#endif
 #include "libbpf_internal.h"
 
 static inline size_t hash_bits(size_t h, int bits)
-- 
2.17.1


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

* Re: [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition
  2019-07-18 17:30 [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition Andrii Nakryiko
@ 2019-07-18 17:31 ` Andrii Nakryiko
  2019-07-26 20:49 ` Arnaldo Carvalho de Melo
  2019-07-29 21:36 ` [tip:perf/urgent] " tip-bot for Andrii Nakryiko
  2 siblings, 0 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2019-07-18 17:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: bpf, Networking, Alexei Starovoitov, Daniel Borkmann,
	Arnaldo Carvalho de Melo, Kernel Team, Andrii Nakryiko

On Thu, Jul 18, 2019 at 10:30 AM Andrii Nakryiko <andriin@fb.com> wrote:
>
> hashmap.h depends on __WORDSIZE being defined. It is defined by
> glibc/musl in different headers. It's an explicit goal for musl to be
> "non-detectable" at compilation time, so instead include glibc header if
> glibc is explicitly detected and fall back to musl header otherwise.
>
> Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Arnaldo,

As it compiled fine for me even before and I don't have a musl set up,
could you please verify this fixes the issue for perf for all your
test environments?

Thanks!

> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
>  tools/lib/bpf/hashmap.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
> index 03748a742146..bae8879cdf58 100644
> --- a/tools/lib/bpf/hashmap.h
> +++ b/tools/lib/bpf/hashmap.h
> @@ -10,6 +10,11 @@
>
>  #include <stdbool.h>
>  #include <stddef.h>
> +#ifdef __GLIBC__
> +#include <bits/wordsize.h>
> +#else
> +#include <bits/reg.h>
> +#endif
>  #include "libbpf_internal.h"
>
>  static inline size_t hash_bits(size_t h, int bits)
> --
> 2.17.1
>

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

* Re: [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition
  2019-07-18 17:30 [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition Andrii Nakryiko
  2019-07-18 17:31 ` Andrii Nakryiko
@ 2019-07-26 20:49 ` Arnaldo Carvalho de Melo
  2019-07-26 23:01   ` Andrii Nakryiko
  2019-07-29 21:36 ` [tip:perf/urgent] " tip-bot for Andrii Nakryiko
  2 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-26 20:49 UTC (permalink / raw)
  To: Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, netdev, ast, daniel, acme, andrii.nakryiko, kernel-team

Em Thu, Jul 18, 2019 at 10:30:21AM -0700, Andrii Nakryiko escreveu:
> hashmap.h depends on __WORDSIZE being defined. It is defined by
> glibc/musl in different headers. It's an explicit goal for musl to be
> "non-detectable" at compilation time, so instead include glibc header if
> glibc is explicitly detected and fall back to musl header otherwise.
> 
> Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Couldn't find ths in the bpf tree, please consider applying it:

Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>


- Arnaldo

> ---
>  tools/lib/bpf/hashmap.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
> index 03748a742146..bae8879cdf58 100644
> --- a/tools/lib/bpf/hashmap.h
> +++ b/tools/lib/bpf/hashmap.h
> @@ -10,6 +10,11 @@
>  
>  #include <stdbool.h>
>  #include <stddef.h>
> +#ifdef __GLIBC__
> +#include <bits/wordsize.h>
> +#else
> +#include <bits/reg.h>
> +#endif
>  #include "libbpf_internal.h"
>  
>  static inline size_t hash_bits(size_t h, int bits)
> -- 
> 2.17.1

-- 

- Arnaldo

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

* Re: [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition
  2019-07-26 20:49 ` Arnaldo Carvalho de Melo
@ 2019-07-26 23:01   ` Andrii Nakryiko
  2019-07-27  0:03     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Andrii Nakryiko @ 2019-07-26 23:01 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Daniel Borkmann, Andrii Nakryiko, bpf, Networking,
	Alexei Starovoitov, Arnaldo Carvalho de Melo, Kernel Team

On Fri, Jul 26, 2019 at 1:49 PM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Thu, Jul 18, 2019 at 10:30:21AM -0700, Andrii Nakryiko escreveu:
> > hashmap.h depends on __WORDSIZE being defined. It is defined by
> > glibc/musl in different headers. It's an explicit goal for musl to be
> > "non-detectable" at compilation time, so instead include glibc header if
> > glibc is explicitly detected and fall back to musl header otherwise.
> >
> > Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
> > Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>
> Couldn't find ths in the bpf tree, please consider applying it:
>
> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Arnaldo, I somehow got impression that you were going to pull this
into your perf tree. Can you please confirm that it wasn't pulled into
your tree, so that Alexei can apply it to bpf tree? Thanks!


>
>
> - Arnaldo
>
> > ---
> >  tools/lib/bpf/hashmap.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
> > index 03748a742146..bae8879cdf58 100644
> > --- a/tools/lib/bpf/hashmap.h
> > +++ b/tools/lib/bpf/hashmap.h
> > @@ -10,6 +10,11 @@
> >
> >  #include <stdbool.h>
> >  #include <stddef.h>
> > +#ifdef __GLIBC__
> > +#include <bits/wordsize.h>
> > +#else
> > +#include <bits/reg.h>
> > +#endif
> >  #include "libbpf_internal.h"
> >
> >  static inline size_t hash_bits(size_t h, int bits)
> > --
> > 2.17.1
>
> --
>
> - Arnaldo

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

* Re: [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition
  2019-07-26 23:01   ` Andrii Nakryiko
@ 2019-07-27  0:03     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-27  0:03 UTC (permalink / raw)
  To: Andrii Nakryiko, Arnaldo Carvalho de Melo
  Cc: Daniel Borkmann, Andrii Nakryiko, bpf, Networking,
	Alexei Starovoitov, Arnaldo Carvalho de Melo, Kernel Team

On July 26, 2019 8:01:10 PM GMT-03:00, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
>On Fri, Jul 26, 2019 at 1:49 PM Arnaldo Carvalho de Melo
><arnaldo.melo@gmail.com> wrote:
>>
>> Em Thu, Jul 18, 2019 at 10:30:21AM -0700, Andrii Nakryiko escreveu:
>> > hashmap.h depends on __WORDSIZE being defined. It is defined by
>> > glibc/musl in different headers. It's an explicit goal for musl to
>be
>> > "non-detectable" at compilation time, so instead include glibc
>header if
>> > glibc is explicitly detected and fall back to musl header
>otherwise.
>> >
>> > Fixes: e3b924224028 ("libbpf: add resizable non-thread safe
>internal hashmap")
>> > Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>>
>> Couldn't find ths in the bpf tree, please consider applying it:
>>
>> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
>Arnaldo, I somehow got impression that you were going to pull this
>into your perf tree. Can you please confirm that it wasn't pulled into
>your tree, so that Alexei can apply it to bpf tree? Thanks!
>

I can process it, just was unsure about where it should go by,

I'll have it in my next perf/urgent pull req,

Thanks,

- Arnaldo
>
>>
>>
>> - Arnaldo
>>
>> > ---
>> >  tools/lib/bpf/hashmap.h | 5 +++++
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
>> > index 03748a742146..bae8879cdf58 100644
>> > --- a/tools/lib/bpf/hashmap.h
>> > +++ b/tools/lib/bpf/hashmap.h
>> > @@ -10,6 +10,11 @@
>> >
>> >  #include <stdbool.h>
>> >  #include <stddef.h>
>> > +#ifdef __GLIBC__
>> > +#include <bits/wordsize.h>
>> > +#else
>> > +#include <bits/reg.h>
>> > +#endif
>> >  #include "libbpf_internal.h"
>> >
>> >  static inline size_t hash_bits(size_t h, int bits)
>> > --
>> > 2.17.1
>>
>> --
>>
>> - Arnaldo


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

* [tip:perf/urgent] libbpf: fix missing __WORDSIZE definition
  2019-07-18 17:30 [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition Andrii Nakryiko
  2019-07-18 17:31 ` Andrii Nakryiko
  2019-07-26 20:49 ` Arnaldo Carvalho de Melo
@ 2019-07-29 21:36 ` tip-bot for Andrii Nakryiko
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Andrii Nakryiko @ 2019-07-29 21:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: andriin, andrii.nakryiko, ast, acme, linux-kernel, tglx, daniel,
	hpa, mingo

Commit-ID:  8aa259b10a6a759c50137bbbf225df0c17ca5d27
Gitweb:     https://git.kernel.org/tip/8aa259b10a6a759c50137bbbf225df0c17ca5d27
Author:     Andrii Nakryiko <andriin@fb.com>
AuthorDate: Thu, 18 Jul 2019 10:30:21 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 29 Jul 2019 10:18:08 -0300

libbpf: fix missing __WORDSIZE definition

hashmap.h depends on __WORDSIZE being defined. It is defined by
glibc/musl in different headers. It's an explicit goal for musl to be
"non-detectable" at compilation time, so instead include glibc header if
glibc is explicitly detected and fall back to musl header otherwise.

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Fixes: e3b924224028 ("libbpf: add resizable non-thread safe internal hashmap")
Link: https://lkml.kernel.org/r/20190718173021.2418606-1-andriin@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/bpf/hashmap.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
index 03748a742146..bae8879cdf58 100644
--- a/tools/lib/bpf/hashmap.h
+++ b/tools/lib/bpf/hashmap.h
@@ -10,6 +10,11 @@
 
 #include <stdbool.h>
 #include <stddef.h>
+#ifdef __GLIBC__
+#include <bits/wordsize.h>
+#else
+#include <bits/reg.h>
+#endif
 #include "libbpf_internal.h"
 
 static inline size_t hash_bits(size_t h, int bits)

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

end of thread, other threads:[~2019-07-29 21:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18 17:30 [PATCH v2 bpf] libbpf: fix missing __WORDSIZE definition Andrii Nakryiko
2019-07-18 17:31 ` Andrii Nakryiko
2019-07-26 20:49 ` Arnaldo Carvalho de Melo
2019-07-26 23:01   ` Andrii Nakryiko
2019-07-27  0:03     ` Arnaldo Carvalho de Melo
2019-07-29 21:36 ` [tip:perf/urgent] " tip-bot for Andrii Nakryiko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.