linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] samples/bpf: Add a .gitignore for binaries
@ 2017-02-12 21:23 Mickaël Salaün
  2017-02-13  1:43 ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: Mickaël Salaün @ 2017-02-12 21:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mickaël Salaün, Alexei Starovoitov,
	Arnaldo Carvalho de Melo, Daniel Borkmann, Wang Nan, netdev

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
---
 samples/bpf/.gitignore | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 samples/bpf/.gitignore

diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
new file mode 100644
index 000000000000..a7562a5ef4c2
--- /dev/null
+++ b/samples/bpf/.gitignore
@@ -0,0 +1,32 @@
+fds_example
+lathist
+lwt_len_hist
+map_perf_test
+offwaketime
+sampleip
+sockex1
+sockex2
+sockex3
+sock_example
+spintest
+tc_l2_redirect
+test_cgrp2_array_pin
+test_cgrp2_attach
+test_cgrp2_attach2
+test_cgrp2_sock
+test_cgrp2_sock2
+test_current_task_under_cgroup
+test_lru_dist
+test_overhead
+test_probe_write_user
+trace_event
+trace_output
+tracex1
+tracex2
+tracex3
+tracex4
+tracex5
+tracex6
+xdp1
+xdp2
+xdp_tx_iptunnel
-- 
2.11.0

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

* Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries
  2017-02-12 21:23 [PATCH v1] samples/bpf: Add a .gitignore for binaries Mickaël Salaün
@ 2017-02-13  1:43 ` David Ahern
  2017-05-13 10:30   ` Mickaël Salaün
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2017-02-13  1:43 UTC (permalink / raw)
  To: Mickaël Salaün, linux-kernel
  Cc: Alexei Starovoitov, Arnaldo Carvalho de Melo, Daniel Borkmann,
	Wang Nan, netdev

On 2/12/17 2:23 PM, Mickaël Salaün wrote:
> diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
> new file mode 100644
> index 000000000000..a7562a5ef4c2
> --- /dev/null
> +++ b/samples/bpf/.gitignore
> @@ -0,0 +1,32 @@
> +fds_example
> +lathist

...

Listing each target is going to be a PITA to maintain. It would be
better to put targets into a build directory (bin?) and ignore the
directory.

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

* Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries
  2017-02-13  1:43 ` David Ahern
@ 2017-05-13 10:30   ` Mickaël Salaün
  2017-05-16 23:27     ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: Mickaël Salaün @ 2017-05-13 10:30 UTC (permalink / raw)
  To: David Ahern, Alexei Starovoitov, Daniel Borkmann
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Wang Nan, netdev


[-- Attachment #1.1: Type: text/plain, Size: 849 bytes --]


On 13/02/2017 02:43, David Ahern wrote:
> On 2/12/17 2:23 PM, Mickaël Salaün wrote:
>> diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
>> new file mode 100644
>> index 000000000000..a7562a5ef4c2
>> --- /dev/null
>> +++ b/samples/bpf/.gitignore
>> @@ -0,0 +1,32 @@
>> +fds_example
>> +lathist
> 
> ...
> 
> Listing each target is going to be a PITA to maintain. It would be
> better to put targets into a build directory (bin?) and ignore the
> directory.
> 

It would require a lot of modifications to the Makefile and more
complexity. It seems much more simple for everyone to stick to a simple
gitignore file easily maintainable:
$ awk '$1 == "hostprogs-y" { print $3 }' < Makefile > .gitignore

Alexei, Daniel, what do you think about this? Do you want me to send a
v2 with the new tests?

 Mickaël


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries
  2017-05-13 10:30   ` Mickaël Salaün
@ 2017-05-16 23:27     ` David Ahern
  2017-05-17  8:18       ` Alexander Alemayhu
  0 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2017-05-16 23:27 UTC (permalink / raw)
  To: Mickaël Salaün, David Ahern, Alexei Starovoitov,
	Daniel Borkmann
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Wang Nan, netdev

On 5/13/17 3:30 AM, Mickaël Salaün wrote:
> 
> On 13/02/2017 02:43, David Ahern wrote:
>> On 2/12/17 2:23 PM, Mickaël Salaün wrote:
>>> diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore
>>> new file mode 100644
>>> index 000000000000..a7562a5ef4c2
>>> --- /dev/null
>>> +++ b/samples/bpf/.gitignore
>>> @@ -0,0 +1,32 @@
>>> +fds_example
>>> +lathist
>>
>> ...
>>
>> Listing each target is going to be a PITA to maintain. It would be
>> better to put targets into a build directory (bin?) and ignore the
>> directory.
>>
> 
> It would require a lot of modifications to the Makefile and more
> complexity. It seems much more simple for everyone to stick to a simple
> gitignore file easily maintainable:
> $ awk '$1 == "hostprogs-y" { print $3 }' < Makefile > .gitignore
> 
> Alexei, Daniel, what do you think about this? Do you want me to send a
> v2 with the new tests?
> 

The problem stems from the fact that bpf samples do not really fall into
the 'hostprogs' category (see "4 Host Program support" in
Documentation/kbuild/makefiles.txt). Fixing samples/bpf to not rely on
it is the better long term solution. Building of tools/ for example does
not rely on it so there is an existing example of leveraging kernel
headers without the overhead.

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

* Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries
  2017-05-16 23:27     ` David Ahern
@ 2017-05-17  8:18       ` Alexander Alemayhu
  2017-05-18 20:03         ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Alemayhu @ 2017-05-17  8:18 UTC (permalink / raw)
  To: David Ahern
  Cc: Mickaël Salaün, David Ahern, Alexei Starovoitov,
	Daniel Borkmann, linux-kernel, Arnaldo Carvalho de Melo,
	Wang Nan, netdev

On Tue, May 16, 2017 at 04:27:36PM -0700, David Ahern wrote:
> 
> The problem stems from the fact that bpf samples do not really fall into
> the 'hostprogs' category (see "4 Host Program support" in
> Documentation/kbuild/makefiles.txt). Fixing samples/bpf to not rely on
> it is the better long term solution. Building of tools/ for example does
> not rely on it so there is an existing example of leveraging kernel
> headers without the overhead.
+1

I have looked into this but found it to be not easy and all attempts to
change the Makefile has resulted in obscure errors :/

Getting clang to output in a different directory was easy[0], but I guess
this is not the right approach either. Have you tried making the change?


[0]:
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 6c7468eb3684..79268d310ba5 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -1,6 +1,13 @@
 # kbuild trick to avoid linker error. Can be omitted if a module is built.
 obj- := dummy.o
 
+ifndef O
+  OUTPUT := $(shell pwd)/samples/bpf/_build/
+else
+  OUTPUT := $O/
+endif
+$(shell mkdir -p $(OUTPUT))
+
 # List of programs to build
 hostprogs-y := test_lru_dist
 hostprogs-y += sock_example
@@ -190,4 +197,4 @@ $(obj)/%.o: $(src)/%.c
 		-Wno-gnu-variable-sized-type-not-at-end \
 		-Wno-address-of-packed-member -Wno-tautological-compare \
 		-Wno-unknown-warning-option \
-		-O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
+		-O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $(OUTPUT)$(shell basename $@)

-- 
Mit freundlichen Grüßen

Alexander Alemayhu

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

* Re: [PATCH v1] samples/bpf: Add a .gitignore for binaries
  2017-05-17  8:18       ` Alexander Alemayhu
@ 2017-05-18 20:03         ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2017-05-18 20:03 UTC (permalink / raw)
  To: Alexander Alemayhu
  Cc: Mickaël Salaün, Alexei Starovoitov, Daniel Borkmann,
	linux-kernel, Arnaldo Carvalho de Melo, Wang Nan, netdev

On 5/17/17 1:18 AM, Alexander Alemayhu wrote:
> I have looked into this but found it to be not easy and all attempts to
> change the Makefile has resulted in obscure errors :/
> 
> Getting clang to output in a different directory was easy[0], but I guess
> this is not the right approach either. Have you tried making the change?

spent an hour so a few weeks back. It is not trivial, but someone needs
to find to fix it now.

perf is the example to use: you can build it from both top level kernel
directory (e.g, make -C tools/perf O=/tmp/perf) and the perf directory
(cd tools/perf; make O=/tmp/perf). Both are wanted for samples/bpf and
it would be nice to keep the O= option as well.

I don't have the time for the next few weeks. Perhaps mid-June I can
take a look.

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

end of thread, other threads:[~2017-05-18 20:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-12 21:23 [PATCH v1] samples/bpf: Add a .gitignore for binaries Mickaël Salaün
2017-02-13  1:43 ` David Ahern
2017-05-13 10:30   ` Mickaël Salaün
2017-05-16 23:27     ` David Ahern
2017-05-17  8:18       ` Alexander Alemayhu
2017-05-18 20:03         ` David Ahern

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