Message ID | 20240625195407.1922912-1-almasrymina@google.com |
---|---|
Headers | show |
Series | Device Memory TCP | expand |
On 25/06/2024 22:53, Mina Almasry wrote: > Add an interface for the user to notify the kernel that it is done > reading the devmem dmabuf frags returned as cmsg. The kernel will > drop the reference on the frags to make them available for reuse. > > Signed-off-by: Willem de Bruijn <willemb@google.com> > Signed-off-by: Kaiyuan Zhang <kaiyuanz@google.com> > Signed-off-by: Mina Almasry <almasrymina@google.com> > > --- > > v10: > - Fix leak of tokens (Nikolay). > > v7: > - Updated SO_DEVMEM_* uapi to use the next available entry (Arnd). > > v6: > - Squash in locking optimizations from edumazet@google.com. With his > changes we lock the xarray once per sock_devmem_dontneed operation > rather than once per frag. > > Changes in v1: > - devmemtoken -> dmabuf_token (David). > - Use napi_pp_put_page() for refcounting (Yunsheng). > - Fix build error with missing socket options on other asms. > > --- > arch/alpha/include/uapi/asm/socket.h | 1 + > arch/mips/include/uapi/asm/socket.h | 1 + > arch/parisc/include/uapi/asm/socket.h | 1 + > arch/sparc/include/uapi/asm/socket.h | 1 + > include/uapi/asm-generic/socket.h | 1 + > include/uapi/linux/uio.h | 4 ++ > net/core/sock.c | 61 +++++++++++++++++++++++++++ > 7 files changed, 70 insertions(+) > FWIW, Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
On Tue, 25 Jun 2024 19:54:01 +0000 Mina Almasry wrote: > +CFLAGS += -I../../../net/ynl/generated/ > +CFLAGS += -I../../../net/ynl/lib/ > + > +LDLIBS += ../../../net/ynl/lib/ynl.a ../../../net/ynl/generated/protos.a Not as easy as this.. Please add this commit to your series: https://github.com/kuba-moo/linux/commit/c130e8cc7208be544ec4f6f3627f1d36875d8c47 And here's an example of how you then use ynl.mk to code gen and build for desired families (note the ordering of variables vs includes, I remember that part was quite inflexible..): https://github.com/kuba-moo/linux/commit/5d357f97ccd0248ca6136c5e11ca3eadf5091bb3 Feel free to repost as soon as you got it fixed.
On Wed, Jun 26, 2024 at 5:46 PM Jakub Kicinski <kuba@kernel.org> wrote: > > On Wed, 26 Jun 2024 15:08:22 -0700 Jakub Kicinski wrote: > > On Tue, 25 Jun 2024 19:54:01 +0000 Mina Almasry wrote: > > > +CFLAGS += -I../../../net/ynl/generated/ > > > +CFLAGS += -I../../../net/ynl/lib/ > > > + > > > +LDLIBS += ../../../net/ynl/lib/ynl.a ../../../net/ynl/generated/protos.a > > > > Not as easy as this.. Please add this commit to your series: > > https://github.com/kuba-moo/linux/commit/c130e8cc7208be544ec4f6f3627f1d36875d8c47 > > > > And here's an example of how you then use ynl.mk to code gen and build > > for desired families (note the ordering of variables vs includes, > > I remember that part was quite inflexible..): > > https://github.com/kuba-moo/linux/commit/5d357f97ccd0248ca6136c5e11ca3eadf5091bb3 > > Investigating this further my patches will not work for O=xyz builds > either. Please squash this into the relevant changes: > Thanks! I cherry-picked commit 15dbefa97fb98 ("tools: net: package libynl for use in selftests"), and then applied the diff below to the series [1]. Now: `git clean -fdx && make headers_install && make -C ./tools/testing/selftests/net` works `git clean -fdx && make headers_install && make -C ./tools/testing/selftests/net ncdevmem` doesn't work with this error: make: Entering directory '/usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/net' gcc -Wall -Wl,--no-as-needed -O2 -g -I../../../../usr/include/ -isystem /usr/local/google/home/almasrymina/cos-kernel/tools/testing/selftests/../../../usr/include -I../ ncdevmem.c -lmnl -o ncdevmem ncdevmem.c:34:10: fatal error: netdev-user.h: No such file or directory 34 | #include "netdev-user.h" | ^~~~~~~~~~~~~~~ compilation terminated. make: *** [<builtin>: ncdevmem] Error 1 It seems specifying the target doesn't trigger the libynl.a to be built. Isn't this a bug, or is that expected? I took a bit of a look into it but couldn't figure it out immediately. If it is a bug, any pointers would be appreciated (but I'm digging into it anyway). [1] The diff on top of the series-with-cherry-pick that I'm testing with: diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 7ba1505dc2eb4..1d3b99e9c12e8 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -5,10 +5,6 @@ CFLAGS += -Wall -Wl,--no-as-needed -O2 -g CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES) # Additional include paths needed by kselftest.h CFLAGS += -I../ -CFLAGS += -I../../../net/ynl/generated/ -CFLAGS += -I../../../net/ynl/lib/ - -LDLIBS += ../../../net/ynl/lib/ynl.a ../../../net/ynl/generated/protos.a LDLIBS += -lmnl @@ -100,7 +96,11 @@ TEST_PROGS += fdb_flush.sh TEST_PROGS += fq_band_pktlimit.sh TEST_PROGS += vlan_hw_filter.sh TEST_PROGS += bpf_offload.py -TEST_GEN_FILES += ncdevmem + +# YNL files, must be before "include ..lib.mk" +EXTRA_CLEAN += $(OUTPUT)/libynl.a +YNL_GEN_FILES := ncdevmem +TEST_GEN_FILES += $(YNL_GEN_FILES) TEST_FILES := settings TEST_FILES += in_netns.sh lib.sh net_helper.sh setup_loopback.sh setup_veth.sh @@ -111,6 +111,10 @@ TEST_INCLUDES := forwarding/lib.sh include ../lib.mk +# YNL build +YNL_GENS := netdev +include ynl.mk + $(OUTPUT)/epoll_busy_poll: LDLIBS += -lcap $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma $(OUTPUT)/tcp_mmap: LDLIBS += -lpthread -lcrypto diff --git a/tools/testing/selftests/net/ynl.mk b/tools/testing/selftests/net/ynl.mk index 0e01ad12b30ec..59cb26cf3f738 100644 --- a/tools/testing/selftests/net/ynl.mk +++ b/tools/testing/selftests/net/ynl.mk @@ -18,6 +18,4 @@ $(YNL_OUTPUTS): CFLAGS += \ $(OUTPUT)/libynl.a: $(Q)$(MAKE) -C $(top_srcdir)/tools/net/ynl GENS="$(YNL_GENS)" libynl.a - $(Q)cp $(top_srcdir)/tools/net/ynl/libynl.a ./ - -EXTRA_CLEAN += libynl.a + $(Q)cp $(top_srcdir)/tools/net/ynl/libynl.a $(OUTPUT)/libynl.a
On Thu, 27 Jun 2024 12:55:38 -0700 Mina Almasry wrote: > `git clean -fdx && make headers_install && make -C > ./tools/testing/selftests/net` works > > `git clean -fdx && make headers_install && make -C > ./tools/testing/selftests/net ncdevmem` doesn't work with this error: Hm, I haven't tested this exact combination. Makefiles are fun! I think in this case you're just hitting the built-in make rule, you're not exercising our Makefile logic much. This should make it work: diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 429535816dbd..a274ae8cd72b 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -45,7 +45,7 @@ endif # LLVM ifeq (0,$(MAKELEVEL)) ifeq ($(OUTPUT),) - OUTPUT := $(shell pwd) + OUTPUT := . DEFAULT_INSTALL_HDR_PATH := 1 endif endif But it will probably break the makefile for others? All our targets are defined (or magically redefined) as $(OUTPUT)/name if you call make directly OUTPUT is not defined, so our rules would mathc on /name, which obviously doesn't exist. Adding OUTPUT=. on command line would also work (I think): make -C ./tools/testing/selftests/net OUTPUT=. ncdevmem Another option would be for OUTPUT to contain the trailing /, always, to avoid the /name problem, but: $ git grep '$(OUTPUT)/' -- tools/testing/selftests/ | wc -l 414 so good luck changing that :( Long story short what you're trying doesn't really appear to be supported by kselftest makefile infra, so don't worry about it.
On Thu, 27 Jun 2024 13:36:57 -0700 Mina Almasry wrote:
> `make -C ./tools/testing/selftests/net TARGETS=ncdevmem`, which works.
AFAIU the most supported incantation would have to be something rather
insane, like:
make -C tools/testing/selftests TARGETS=net TEST_GEN_PROGS="$(pwd)/tools/testing/selftests/net/tls" TEST_GEN_FILES=""
but yes, don't worry.