]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.10
authorSasha Levin <sashal@kernel.org>
Thu, 8 Apr 2021 16:06:50 +0000 (12:06 -0400)
committerSasha Levin <sashal@kernel.org>
Thu, 8 Apr 2021 16:06:50 +0000 (12:06 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.10/kbuild-add-resolve_btfids-clean-to-root-clean-target.patch [new file with mode: 0644]
queue-5.10/kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/tools-resolve_btfids-add-libbpf-to-.gitignore.patch [new file with mode: 0644]
queue-5.10/tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch [new file with mode: 0644]
queue-5.10/tools-resolve_btfids-check-objects-before-removing.patch [new file with mode: 0644]
queue-5.10/tools-resolve_btfids-set-srctree-variable-unconditio.patch [new file with mode: 0644]

diff --git a/queue-5.10/kbuild-add-resolve_btfids-clean-to-root-clean-target.patch b/queue-5.10/kbuild-add-resolve_btfids-clean-to-root-clean-target.patch
new file mode 100644 (file)
index 0000000..af7d20f
--- /dev/null
@@ -0,0 +1,52 @@
+From c80e2820d712219067670aeba077eb596fa600c0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Feb 2021 13:40:20 +0100
+Subject: kbuild: Add resolve_btfids clean to root clean target
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+[ Upstream commit 50d3a3f81689586697a38cd60070181ebe626ad9 ]
+
+The resolve_btfids tool is used during the kernel build,
+so we should clean it on kernel's make clean.
+
+Invoking the the resolve_btfids clean as part of root
+'make clean'.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Song Liu <songliubraving@fb.com>
+Link: https://lore.kernel.org/bpf/20210205124020.683286-5-jolsa@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Makefile | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index cb76f64abb6d..3a3937ab7ed0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1083,6 +1083,11 @@ ifdef CONFIG_STACK_VALIDATION
+   endif
+ endif
++PHONY += resolve_btfids_clean
++
++resolve_btfids_clean:
++      $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean
++
+ ifdef CONFIG_BPF
+ ifdef CONFIG_DEBUG_INFO_BTF
+   ifeq ($(has_libelf),1)
+@@ -1500,7 +1505,7 @@ vmlinuxclean:
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
+       $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
+-clean: archclean vmlinuxclean
++clean: archclean vmlinuxclean resolve_btfids_clean
+ # mrproper - Delete all generated files, including .config
+ #
+-- 
+2.30.2
+
diff --git a/queue-5.10/kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch b/queue-5.10/kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch
new file mode 100644 (file)
index 0000000..cfda59f
--- /dev/null
@@ -0,0 +1,53 @@
+From 23dc60f7282a226c42d040b5167a4d50b3ddb277 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Feb 2021 13:40:04 +0100
+Subject: kbuild: Do not clean resolve_btfids if the output does not exist
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+[ Upstream commit 0e1aa629f1ce9e8cb89e0cefb9e3bfb3dfa94821 ]
+
+Nathan reported issue with cleaning empty build directory:
+
+  $ make -s O=build distclean
+  ../../scripts/Makefile.include:4: *** \
+  O=/ho...build/tools/bpf/resolve_btfids does not exist.  Stop.
+
+The problem that tools scripts require existing output
+directory, otherwise it fails.
+
+Adding check around the resolve_btfids clean target to
+ensure the output directory is in place.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Tested-by: Nathan Chancellor <nathan@kernel.org>
+Link: https://lore.kernel.org/bpf/20210211124004.1144344-1-jolsa@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Makefile | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 3a3937ab7ed0..4420131d4709 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1085,8 +1085,14 @@ endif
+ PHONY += resolve_btfids_clean
++resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
++
++# tools/bpf/resolve_btfids directory might not exist
++# in output directory, skip its clean in that case
+ resolve_btfids_clean:
+-      $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean
++ifneq ($(wildcard $(resolve_btfids_O)),)
++      $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
++endif
+ ifdef CONFIG_BPF
+ ifdef CONFIG_DEBUG_INFO_BTF
+-- 
+2.30.2
+
index 719f3ef37cc146735ee219abad4516b3c17ce8c0..af6af3555047b151142c6b91fa13a51539886d66 100644 (file)
@@ -29,3 +29,9 @@ cifs-revalidate-mapping-when-we-open-files-for-smb1-.patch
 cifs-silently-ignore-unknown-oplock-break-handle.patch
 io_uring-fix-timeout-cancel-return-code.patch
 math-export-mul_u64_u64_div_u64.patch
+tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch
+tools-resolve_btfids-check-objects-before-removing.patch
+tools-resolve_btfids-set-srctree-variable-unconditio.patch
+kbuild-add-resolve_btfids-clean-to-root-clean-target.patch
+kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch
+tools-resolve_btfids-add-libbpf-to-.gitignore.patch
diff --git a/queue-5.10/tools-resolve_btfids-add-libbpf-to-.gitignore.patch b/queue-5.10/tools-resolve_btfids-add-libbpf-to-.gitignore.patch
new file mode 100644 (file)
index 0000000..5faf9a1
--- /dev/null
@@ -0,0 +1,34 @@
+From 9b72c9da7fb2689ecd22bebda34e8aa3a519a80c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Feb 2021 17:00:53 -0800
+Subject: tools/resolve_btfids: Add /libbpf to .gitignore
+
+From: Stanislav Fomichev <sdf@google.com>
+
+[ Upstream commit 90a82b1fa40d0cee33d1c9306dc54412442d1e57 ]
+
+This is what I see after compiling the kernel:
+
+ # bpf-next...bpf-next/master
+ ?? tools/bpf/resolve_btfids/libbpf/
+
+Fixes: fc6b48f692f8 ("tools/resolve_btfids: Build libbpf and libsubcmd in separate directories")
+Signed-off-by: Stanislav Fomichev <sdf@google.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Link: https://lore.kernel.org/bpf/20210212010053.668700-1-sdf@google.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/bpf/resolve_btfids/.gitignore | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore
+index 25f308c933cc..16913fffc985 100644
+--- a/tools/bpf/resolve_btfids/.gitignore
++++ b/tools/bpf/resolve_btfids/.gitignore
+@@ -1,2 +1,3 @@
+ /fixdep
+ /resolve_btfids
++/libbpf/
+-- 
+2.30.2
+
diff --git a/queue-5.10/tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch b/queue-5.10/tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch
new file mode 100644 (file)
index 0000000..94c7253
--- /dev/null
@@ -0,0 +1,104 @@
+From 87020fbc0f0cbe9ab0d52b34a0d9a14cbaa6d3e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Feb 2021 13:40:17 +0100
+Subject: tools/resolve_btfids: Build libbpf and libsubcmd in separate
+ directories
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+[ Upstream commit fc6b48f692f89cc48bfb7fd1aa65454dfe9b2d77 ]
+
+Setting up separate build directories for libbpf and libpsubcmd,
+so it's separated from other objects and we don't get them mixed
+in the future.
+
+It also simplifies cleaning, which is now simple rm -rf.
+
+Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h
+files in .gitignore anymore.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Song Liu <songliubraving@fb.com>
+Acked-by: Andrii Nakryiko <andrii@kernel.org>
+Link: https://lore.kernel.org/bpf/20210205124020.683286-2-jolsa@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/bpf/resolve_btfids/.gitignore |  2 --
+ tools/bpf/resolve_btfids/Makefile   | 26 +++++++++++---------------
+ 2 files changed, 11 insertions(+), 17 deletions(-)
+
+diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore
+index a026df7dc280..25f308c933cc 100644
+--- a/tools/bpf/resolve_btfids/.gitignore
++++ b/tools/bpf/resolve_btfids/.gitignore
+@@ -1,4 +1,2 @@
+-/FEATURE-DUMP.libbpf
+-/bpf_helper_defs.h
+ /fixdep
+ /resolve_btfids
+diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
+index bf656432ad73..1d46a247ec95 100644
+--- a/tools/bpf/resolve_btfids/Makefile
++++ b/tools/bpf/resolve_btfids/Makefile
+@@ -28,22 +28,22 @@ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
+ LIBBPF_SRC := $(srctree)/tools/lib/bpf/
+ SUBCMD_SRC := $(srctree)/tools/lib/subcmd/
+-BPFOBJ     := $(OUTPUT)/libbpf.a
+-SUBCMDOBJ  := $(OUTPUT)/libsubcmd.a
++BPFOBJ     := $(OUTPUT)/libbpf/libbpf.a
++SUBCMDOBJ  := $(OUTPUT)/libsubcmd/libsubcmd.a
+ BINARY     := $(OUTPUT)/resolve_btfids
+ BINARY_IN  := $(BINARY)-in.o
+ all: $(BINARY)
+-$(OUTPUT):
++$(OUTPUT) $(OUTPUT)/libbpf $(OUTPUT)/libsubcmd:
+       $(call msg,MKDIR,,$@)
+-      $(Q)mkdir -p $(OUTPUT)
++      $(Q)mkdir -p $(@)
+-$(SUBCMDOBJ): fixdep FORCE
+-      $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT)
++$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd
++      $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
+-$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)
++$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)/libbpf
+       $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)  OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
+ CFLAGS := -g \
+@@ -57,23 +57,19 @@ LIBS = -lelf -lz
+ export srctree OUTPUT CFLAGS Q
+ include $(srctree)/tools/build/Makefile.include
+-$(BINARY_IN): fixdep FORCE
++$(BINARY_IN): fixdep FORCE | $(OUTPUT)
+       $(Q)$(MAKE) $(build)=resolve_btfids
+ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
+       $(call msg,LINK,$@)
+       $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS)
+-libsubcmd-clean:
+-      $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean
+-
+-libbpf-clean:
+-      $(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean
+-
+-clean: libsubcmd-clean libbpf-clean fixdep-clean
++clean: fixdep-clean
+       $(call msg,CLEAN,$(BINARY))
+       $(Q)$(RM) -f $(BINARY); \
+       $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
++      $(RM) -rf $(OUTPUT)/libbpf; \
++      $(RM) -rf $(OUTPUT)/libsubcmd; \
+       find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
+ tags:
+-- 
+2.30.2
+
diff --git a/queue-5.10/tools-resolve_btfids-check-objects-before-removing.patch b/queue-5.10/tools-resolve_btfids-check-objects-before-removing.patch
new file mode 100644 (file)
index 0000000..a285d4d
--- /dev/null
@@ -0,0 +1,57 @@
+From 68bb9a593ca079cd81002ae1c636fb92a8a05cd3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Feb 2021 13:40:18 +0100
+Subject: tools/resolve_btfids: Check objects before removing
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+[ Upstream commit f23130979c2f15ea29a431cd9e1ea7916337bbd4 ]
+
+We want this clean to be called from tree's root clean
+and that one is silent if there's nothing to clean.
+
+Adding check for all object to clean and display CLEAN
+messages only if there are objects to remove.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Andrii Nakryiko <andrii@kernel.org>
+Link: https://lore.kernel.org/bpf/20210205124020.683286-3-jolsa@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/bpf/resolve_btfids/Makefile | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
+index 1d46a247ec95..be09ec4f03ff 100644
+--- a/tools/bpf/resolve_btfids/Makefile
++++ b/tools/bpf/resolve_btfids/Makefile
+@@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
+       $(call msg,LINK,$@)
+       $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS)
++clean_objects := $(wildcard $(OUTPUT)/*.o                \
++                            $(OUTPUT)/.*.o.cmd           \
++                            $(OUTPUT)/.*.o.d             \
++                            $(OUTPUT)/libbpf             \
++                            $(OUTPUT)/libsubcmd          \
++                            $(OUTPUT)/resolve_btfids)
++
++ifneq ($(clean_objects),)
+ clean: fixdep-clean
+       $(call msg,CLEAN,$(BINARY))
+-      $(Q)$(RM) -f $(BINARY); \
+-      $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
+-      $(RM) -rf $(OUTPUT)/libbpf; \
+-      $(RM) -rf $(OUTPUT)/libsubcmd; \
+-      find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
++      $(Q)$(RM) -rf $(clean_objects)
++else
++clean:
++endif
+ tags:
+       $(call msg,GEN,,tags)
+-- 
+2.30.2
+
diff --git a/queue-5.10/tools-resolve_btfids-set-srctree-variable-unconditio.patch b/queue-5.10/tools-resolve_btfids-set-srctree-variable-unconditio.patch
new file mode 100644 (file)
index 0000000..b4242a8
--- /dev/null
@@ -0,0 +1,60 @@
+From 8c592733db90592648c086592d2c3f2e74b1729a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Feb 2021 13:40:19 +0100
+Subject: tools/resolve_btfids: Set srctree variable unconditionally
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+[ Upstream commit 7962cb9b640af98ccb577f46c8b894319e6c5c20 ]
+
+We want this clean to be called from tree's root Makefile,
+which defines same srctree variable and that will screw
+the make setup.
+
+We actually do not use srctree being passed from outside,
+so we can solve this by setting current srctree value
+directly.
+
+Also changing the way how srctree is initialized as suggested
+by Andrri.
+
+Also root Makefile does not define the implicit RM variable,
+so adding RM initialization.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Andrii Nakryiko <andrii@kernel.org>
+Link: https://lore.kernel.org/bpf/20210205124020.683286-4-jolsa@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/bpf/resolve_btfids/Makefile | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
+index be09ec4f03ff..bb9fa8de7e62 100644
+--- a/tools/bpf/resolve_btfids/Makefile
++++ b/tools/bpf/resolve_btfids/Makefile
+@@ -2,11 +2,7 @@
+ include ../../scripts/Makefile.include
+ include ../../scripts/Makefile.arch
+-ifeq ($(srctree),)
+-srctree := $(patsubst %/,%,$(dir $(CURDIR)))
+-srctree := $(patsubst %/,%,$(dir $(srctree)))
+-srctree := $(patsubst %/,%,$(dir $(srctree)))
+-endif
++srctree := $(abspath $(CURDIR)/../../../)
+ ifeq ($(V),1)
+   Q =
+@@ -22,6 +18,7 @@ AR       = $(HOSTAR)
+ CC       = $(HOSTCC)
+ LD       = $(HOSTLD)
+ ARCH     = $(HOSTARCH)
++RM      ?= rm
+ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
+-- 
+2.30.2
+