From: Sasha Levin Date: Thu, 8 Apr 2021 16:06:49 +0000 (-0400) Subject: Fixes for 5.11 X-Git-Tag: v4.4.266~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b36c627f4ec9dd2a4102dea2e78564b3197465d;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.11 Signed-off-by: Sasha Levin --- diff --git a/queue-5.11/kbuild-add-resolve_btfids-clean-to-root-clean-target.patch b/queue-5.11/kbuild-add-resolve_btfids-clean-to-root-clean-target.patch new file mode 100644 index 00000000000..9e72f5738b9 --- /dev/null +++ b/queue-5.11/kbuild-add-resolve_btfids-clean-to-root-clean-target.patch @@ -0,0 +1,52 @@ +From a42b2607a6f6546a3d2d2890e46ed0d496f1521a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Feb 2021 13:40:20 +0100 +Subject: kbuild: Add resolve_btfids clean to root clean target + +From: Jiri Olsa + +[ 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 +Signed-off-by: Andrii Nakryiko +Acked-by: Song Liu +Link: https://lore.kernel.org/bpf/20210205124020.683286-5-jolsa@kernel.org +Signed-off-by: Sasha Levin +--- + Makefile | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 1e31504aab61..a135a7b9d265 100644 +--- a/Makefile ++++ b/Makefile +@@ -1082,6 +1082,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) +@@ -1499,7 +1504,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.11/kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch b/queue-5.11/kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch new file mode 100644 index 00000000000..6e71e31606f --- /dev/null +++ b/queue-5.11/kbuild-do-not-clean-resolve_btfids-if-the-output-doe.patch @@ -0,0 +1,53 @@ +From 186ea9b7b20e75944629ba3170346d666e8d962a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +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 + +[ 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 +Signed-off-by: Andrii Nakryiko +Tested-by: Nathan Chancellor +Link: https://lore.kernel.org/bpf/20210211124004.1144344-1-jolsa@kernel.org +Signed-off-by: Sasha Levin +--- + Makefile | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index a135a7b9d265..250b4e58abbc 100644 +--- a/Makefile ++++ b/Makefile +@@ -1084,8 +1084,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 + diff --git a/queue-5.11/series b/queue-5.11/series index e2855cf6d74..a2132ab0319 100644 --- a/queue-5.11/series +++ b/queue-5.11/series @@ -34,3 +34,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.11/tools-resolve_btfids-add-libbpf-to-.gitignore.patch b/queue-5.11/tools-resolve_btfids-add-libbpf-to-.gitignore.patch new file mode 100644 index 00000000000..64d54601bcc --- /dev/null +++ b/queue-5.11/tools-resolve_btfids-add-libbpf-to-.gitignore.patch @@ -0,0 +1,34 @@ +From 60f80084aa68652712c2da5dfbefd44bc13e682c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 Feb 2021 17:00:53 -0800 +Subject: tools/resolve_btfids: Add /libbpf to .gitignore + +From: Stanislav Fomichev + +[ 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 +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20210212010053.668700-1-sdf@google.com +Signed-off-by: Sasha Levin +--- + 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.11/tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch b/queue-5.11/tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch new file mode 100644 index 00000000000..4914ad9b5ad --- /dev/null +++ b/queue-5.11/tools-resolve_btfids-build-libbpf-and-libsubcmd-in-s.patch @@ -0,0 +1,104 @@ +From 8f56992750a8cf85939208f8af99f3ffe3873bb1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Feb 2021 13:40:17 +0100 +Subject: tools/resolve_btfids: Build libbpf and libsubcmd in separate + directories + +From: Jiri Olsa + +[ 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 +Signed-off-by: Andrii Nakryiko +Acked-by: Song Liu +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20210205124020.683286-2-jolsa@kernel.org +Signed-off-by: Sasha Levin +--- + 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.11/tools-resolve_btfids-check-objects-before-removing.patch b/queue-5.11/tools-resolve_btfids-check-objects-before-removing.patch new file mode 100644 index 00000000000..390b88a5c06 --- /dev/null +++ b/queue-5.11/tools-resolve_btfids-check-objects-before-removing.patch @@ -0,0 +1,57 @@ +From efd5aa5d55e684cad03f3fa95524e2bb26ef2089 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Feb 2021 13:40:18 +0100 +Subject: tools/resolve_btfids: Check objects before removing + +From: Jiri Olsa + +[ 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 +Signed-off-by: Andrii Nakryiko +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20210205124020.683286-3-jolsa@kernel.org +Signed-off-by: Sasha Levin +--- + 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.11/tools-resolve_btfids-set-srctree-variable-unconditio.patch b/queue-5.11/tools-resolve_btfids-set-srctree-variable-unconditio.patch new file mode 100644 index 00000000000..0b27be4fdc9 --- /dev/null +++ b/queue-5.11/tools-resolve_btfids-set-srctree-variable-unconditio.patch @@ -0,0 +1,60 @@ +From d860c991faeb5a2d075c0b6a0d1514137c66bed2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Feb 2021 13:40:19 +0100 +Subject: tools/resolve_btfids: Set srctree variable unconditionally + +From: Jiri Olsa + +[ 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 +Signed-off-by: Andrii Nakryiko +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20210205124020.683286-4-jolsa@kernel.org +Signed-off-by: Sasha Levin +--- + 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 +