]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Mar 2021 11:03:10 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Mar 2021 11:03:10 +0000 (12:03 +0100)
added patches:
perf-tools-use-define-api.pure-full-instead-of-pure-parser.patch
tools-build-check-if-gettid-is-available-before-providing-helper.patch
tools-build-feature-check-if-eventfd-is-available.patch
tools-build-feature-check-if-get_current_dir_name-is-available.patch

queue-4.19/perf-tools-use-define-api.pure-full-instead-of-pure-parser.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/tools-build-check-if-gettid-is-available-before-providing-helper.patch [new file with mode: 0644]
queue-4.19/tools-build-feature-check-if-eventfd-is-available.patch [new file with mode: 0644]
queue-4.19/tools-build-feature-check-if-get_current_dir_name-is-available.patch [new file with mode: 0644]

diff --git a/queue-4.19/perf-tools-use-define-api.pure-full-instead-of-pure-parser.patch b/queue-4.19/perf-tools-use-define-api.pure-full-instead-of-pure-parser.patch
new file mode 100644 (file)
index 0000000..40a9ec0
--- /dev/null
@@ -0,0 +1,51 @@
+From fc8c0a99223367b071c83711259d754b6bb7a379 Mon Sep 17 00:00:00 2001
+From: Jiri Olsa <jolsa@redhat.com>
+Date: Sun, 12 Jan 2020 20:22:59 +0100
+Subject: perf tools: Use %define api.pure full instead of %pure-parser
+
+From: Jiri Olsa <jolsa@redhat.com>
+
+commit fc8c0a99223367b071c83711259d754b6bb7a379 upstream.
+
+bison deprecated the "%pure-parser" directive in favor of "%define
+api.pure full".
+
+The api.pure got introduced in bison 2.3 (Oct 2007), so it seems safe to
+use it without any version check.
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Clark Williams <williams@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lore.kernel.org/lkml/20200112192259.GA35080@krava
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/util/expr.y         |    3 ++-
+ tools/perf/util/parse-events.y |    2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+--- a/tools/perf/util/expr.y
++++ b/tools/perf/util/expr.y
+@@ -10,7 +10,8 @@
+ #define MAXIDLEN 256
+ %}
+-%pure-parser
++%define api.pure full
++
+ %parse-param { double *final_val }
+ %parse-param { struct parse_ctx *ctx }
+ %parse-param { const char **pp }
+--- a/tools/perf/util/parse-events.y
++++ b/tools/perf/util/parse-events.y
+@@ -1,4 +1,4 @@
+-%pure-parser
++%define api.pure full
+ %parse-param {void *_parse_state}
+ %parse-param {void *scanner}
+ %lex-param {void* scanner}
index 214b6d839fdf558169f8acfb11e31c56cf9e3864..57be00dfde15aa38db145495355648a2bdda8214 100644 (file)
@@ -4,3 +4,7 @@ alsa-hda-generic-fix-the-micmute-led-init-state.patch
 revert-pm-runtime-update-device-status-before-letting-suppliers-suspend.patch
 vmlinux.lds.h-create-section-for-protection-against-instrumentation.patch
 lkdtm-don-t-move-ctors-to-.rodata.patch
+perf-tools-use-define-api.pure-full-instead-of-pure-parser.patch
+tools-build-feature-check-if-get_current_dir_name-is-available.patch
+tools-build-feature-check-if-eventfd-is-available.patch
+tools-build-check-if-gettid-is-available-before-providing-helper.patch
diff --git a/queue-4.19/tools-build-check-if-gettid-is-available-before-providing-helper.patch b/queue-4.19/tools-build-check-if-gettid-is-available-before-providing-helper.patch
new file mode 100644 (file)
index 0000000..4209456
--- /dev/null
@@ -0,0 +1,158 @@
+From 4541a8bb13a86e504416a13360c8dc64d2fd612a Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Thu, 13 Jun 2019 12:04:19 -0300
+Subject: tools build: Check if gettid() is available before providing helper
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit 4541a8bb13a86e504416a13360c8dc64d2fd612a upstream.
+
+Laura reported that the perf build failed in fedora when we got a glibc
+that provides gettid(), which I reproduced using fedora rawhide with the
+glibc-devel-2.29.9000-26.fc31.x86_64 package.
+
+Add a feature check to avoid providing a gettid() helper in such
+systems.
+
+On a fedora rawhide system with this patch applied we now get:
+
+  [root@7a5f55352234 perf]# grep gettid /tmp/build/perf/FEATURE-DUMP
+  feature-gettid=1
+  [root@7a5f55352234 perf]# cat /tmp/build/perf/feature/test-gettid.make.output
+  [root@7a5f55352234 perf]# ldd /tmp/build/perf/feature/test-gettid.bin
+          linux-vdso.so.1 (0x00007ffc6b1f6000)
+          libc.so.6 => /lib64/libc.so.6 (0x00007f04e0a74000)
+          /lib64/ld-linux-x86-64.so.2 (0x00007f04e0c47000)
+  [root@7a5f55352234 perf]# nm /tmp/build/perf/feature/test-gettid.bin | grep -w gettid
+                   U gettid@@GLIBC_2.30
+  [root@7a5f55352234 perf]#
+
+While on a fedora:29 system:
+
+  [acme@quaco perf]$ grep gettid /tmp/build/perf/FEATURE-DUMP
+  feature-gettid=0
+  [acme@quaco perf]$ cat /tmp/build/perf/feature/test-gettid.make.output
+  test-gettid.c: In function ‘main’:
+  test-gettid.c:8:9: error: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Werror=implicit-function-declaration]
+    return gettid();
+           ^~~~~~
+           getgid
+  cc1: all warnings being treated as errors
+  [acme@quaco perf]$
+
+Reported-by: Laura Abbott <labbott@redhat.com>
+Tested-by: Laura Abbott <labbott@redhat.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Florian Weimer <fweimer@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Stephane Eranian <eranian@google.com>
+Link: https://lkml.kernel.org/n/tip-yfy3ch53agmklwu9o7rlgf9c@git.kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/build/Makefile.feature      |    1 +
+ tools/build/feature/Makefile      |    4 ++++
+ tools/build/feature/test-all.c    |    5 +++++
+ tools/build/feature/test-gettid.c |   11 +++++++++++
+ tools/perf/Makefile.config        |    4 ++++
+ tools/perf/jvmti/jvmti_agent.c    |    2 ++
+ 6 files changed, 27 insertions(+)
+ create mode 100644 tools/build/feature/test-gettid.c
+
+--- a/tools/build/Makefile.feature
++++ b/tools/build/Makefile.feature
+@@ -35,6 +35,7 @@ FEATURE_TESTS_BASIC :=
+         fortify-source                  \
+         sync-compare-and-swap           \
+         get_current_dir_name            \
++        gettid                                \
+         glibc                           \
+         gtk2                            \
+         gtk2-infobar                    \
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -54,6 +54,7 @@ FILES=
+          test-get_cpuid.bin                     \
+          test-sdt.bin                           \
+          test-cxx.bin                           \
++         test-gettid.bin                      \
+          test-jvmti.bin                               \
+          test-sched_getcpu.bin                        \
+          test-setns.bin                               \
+@@ -262,6 +263,9 @@ $(OUTPUT)test-sdt.bin:
+ $(OUTPUT)test-cxx.bin:
+       $(BUILDXX) -std=gnu++11
++$(OUTPUT)test-gettid.bin:
++      $(BUILD)
++
+ $(OUTPUT)test-jvmti.bin:
+       $(BUILD)
+--- a/tools/build/feature/test-all.c
++++ b/tools/build/feature/test-all.c
+@@ -38,6 +38,10 @@
+ # include "test-get_current_dir_name.c"
+ #undef main
++#define main main_test_gettid
++# include "test-gettid.c"
++#undef main
++
+ #define main main_test_glibc
+ # include "test-glibc.c"
+ #undef main
+@@ -183,6 +187,7 @@ int main(int argc, char *argv[])
+       main_test_libelf();
+       main_test_libelf_mmap();
+       main_test_get_current_dir_name();
++      main_test_gettid();
+       main_test_glibc();
+       main_test_dwarf();
+       main_test_dwarf_getlocations();
+--- /dev/null
++++ b/tools/build/feature/test-gettid.c
+@@ -0,0 +1,11 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
++#define _GNU_SOURCE
++#include <unistd.h>
++
++int main(void)
++{
++      return gettid();
++}
++
++#undef _GNU_SOURCE
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -318,6 +318,10 @@ ifeq ($(feature-get_current_dir_name), 1
+   CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
+ endif
++ifeq ($(feature-gettid), 1)
++  CFLAGS += -DHAVE_GETTID
++endif
++
+ ifdef NO_LIBELF
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+--- a/tools/perf/jvmti/jvmti_agent.c
++++ b/tools/perf/jvmti/jvmti_agent.c
+@@ -45,10 +45,12 @@
+ static char jit_path[PATH_MAX];
+ static void *marker_addr;
++#ifndef HAVE_GETTID
+ static inline pid_t gettid(void)
+ {
+       return (pid_t)syscall(__NR_gettid);
+ }
++#endif
+ static int get_e_machine(struct jitheader *hdr)
+ {
diff --git a/queue-4.19/tools-build-feature-check-if-eventfd-is-available.patch b/queue-4.19/tools-build-feature-check-if-eventfd-is-available.patch
new file mode 100644 (file)
index 0000000..d085cb0
--- /dev/null
@@ -0,0 +1,139 @@
+From 11c6cbe706f218a8dc7e1f962f12b3a52ddd33a9 Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Wed, 21 Nov 2018 17:42:00 -0300
+Subject: tools build feature: Check if eventfd() is available
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit 11c6cbe706f218a8dc7e1f962f12b3a52ddd33a9 upstream.
+
+A new 'perf bench epoll' will use this, and to disable it for older
+systems, add a feature test for this API.
+
+This is just a simple program that if successfully compiled, means that
+the feature is present, at least at the library level, in a build that
+sets the output directory to /tmp/build/perf (using O=/tmp/build/perf),
+we end up with:
+
+  $ ls -la /tmp/build/perf/feature/test-eventfd*
+  -rwxrwxr-x. 1 acme acme 8176 Nov 21 15:58 /tmp/build/perf/feature/test-eventfd.bin
+  -rw-rw-r--. 1 acme acme  588 Nov 21 15:58 /tmp/build/perf/feature/test-eventfd.d
+  -rw-rw-r--. 1 acme acme    0 Nov 21 15:58 /tmp/build/perf/feature/test-eventfd.make.output
+  $ ldd /tmp/build/perf/feature/test-eventfd.bin
+         linux-vdso.so.1 (0x00007fff3bf3f000)
+         libc.so.6 => /lib64/libc.so.6 (0x00007fa984061000)
+         /lib64/ld-linux-x86-64.so.2 (0x00007fa984417000)
+  $ grep eventfd -A 2 -B 2 /tmp/build/perf/FEATURE-DUMP
+  feature-dwarf=1
+  feature-dwarf_getlocations=1
+  feature-eventfd=1
+  feature-fortify-source=1
+  feature-sync-compare-and-swap=1
+  $
+
+The main thing here is that in the end we'll have -DHAVE_EVENTFD in
+CFLAGS, and then the 'perf bench' entry needing that API can be
+selectively pruned.
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Davidlohr Bueso <dbueso@suse.de>
+Cc: Jason Baron <jbaron@akamai.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Wang Nan <wangnan0@huawei.com>
+Link: https://lkml.kernel.org/n/tip-wkeldwob7dpx6jvtuzl8164k@git.kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/build/Makefile.feature       |    1 +
+ tools/build/feature/Makefile       |    4 ++++
+ tools/build/feature/test-all.c     |    5 +++++
+ tools/build/feature/test-eventfd.c |    9 +++++++++
+ tools/perf/Makefile.config         |    5 ++++-
+ 5 files changed, 23 insertions(+), 1 deletion(-)
+ create mode 100644 tools/build/feature/test-eventfd.c
+
+--- a/tools/build/Makefile.feature
++++ b/tools/build/Makefile.feature
+@@ -31,6 +31,7 @@ FEATURE_TESTS_BASIC :=
+         backtrace                       \
+         dwarf                           \
+         dwarf_getlocations              \
++        eventfd                         \
+         fortify-source                  \
+         sync-compare-and-swap           \
+         get_current_dir_name            \
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -5,6 +5,7 @@ FILES=
+          test-bionic.bin                        \
+          test-dwarf.bin                         \
+          test-dwarf_getlocations.bin            \
++         test-eventfd.bin                       \
+          test-fortify-source.bin                \
+          test-sync-compare-and-swap.bin         \
+          test-get_current_dir_name.bin          \
+@@ -100,6 +101,9 @@ $(OUTPUT)test-bionic.bin:
+ $(OUTPUT)test-libelf.bin:
+       $(BUILD) -lelf
++$(OUTPUT)test-eventfd.bin:
++      $(BUILD)
++
+ $(OUTPUT)test-get_current_dir_name.bin:
+       $(BUILD)
+--- a/tools/build/feature/test-all.c
++++ b/tools/build/feature/test-all.c
+@@ -50,6 +50,10 @@
+ # include "test-dwarf_getlocations.c"
+ #undef main
++#define main main_test_eventfd
++# include "test-eventfd.c"
++#undef main
++
+ #define main main_test_libelf_getphdrnum
+ # include "test-libelf-getphdrnum.c"
+ #undef main
+@@ -182,6 +186,7 @@ int main(int argc, char *argv[])
+       main_test_glibc();
+       main_test_dwarf();
+       main_test_dwarf_getlocations();
++      main_test_eventfd();
+       main_test_libelf_getphdrnum();
+       main_test_libelf_gelf_getnote();
+       main_test_libelf_getshdrstrndx();
+--- /dev/null
++++ b/tools/build/feature/test-eventfd.c
+@@ -0,0 +1,9 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
++
++#include <sys/eventfd.h>
++
++int main(void)
++{
++      return eventfd(0, EFD_NONBLOCK);
++}
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -310,11 +310,14 @@ ifndef NO_BIONIC
+   endif
+ endif
++ifeq ($(feature-eventfd), 1)
++  CFLAGS += -DHAVE_EVENTFD
++endif
++
+ ifeq ($(feature-get_current_dir_name), 1)
+   CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
+ endif
+-
+ ifdef NO_LIBELF
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
diff --git a/queue-4.19/tools-build-feature-check-if-get_current_dir_name-is-available.patch b/queue-4.19/tools-build-feature-check-if-get_current_dir_name-is-available.patch
new file mode 100644 (file)
index 0000000..d783340
--- /dev/null
@@ -0,0 +1,157 @@
+From 8feb8efef97a134933620071e0b6384cb3238b4e Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Mon, 19 Nov 2018 16:56:22 -0300
+Subject: tools build feature: Check if get_current_dir_name() is available
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit 8feb8efef97a134933620071e0b6384cb3238b4e upstream.
+
+As the namespace support code will use this, which is not available in
+some non _GNU_SOURCE libraries such as Android's bionic used in my
+container build tests (r12b and r15c at the moment).
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Wang Nan <wangnan0@huawei.com>
+Link: https://lkml.kernel.org/n/tip-x56ypm940pwclwu45d7jfj47@git.kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/build/Makefile.feature                    |    1 +
+ tools/build/feature/Makefile                    |    4 ++++
+ tools/build/feature/test-all.c                  |    5 +++++
+ tools/build/feature/test-get_current_dir_name.c |   10 ++++++++++
+ tools/perf/Makefile.config                      |    5 +++++
+ tools/perf/util/Build                           |    1 +
+ tools/perf/util/get_current_dir_name.c          |   18 ++++++++++++++++++
+ tools/perf/util/util.h                          |    4 ++++
+ 8 files changed, 48 insertions(+)
+ create mode 100644 tools/build/feature/test-get_current_dir_name.c
+ create mode 100644 tools/perf/util/get_current_dir_name.c
+
+--- a/tools/build/Makefile.feature
++++ b/tools/build/Makefile.feature
+@@ -33,6 +33,7 @@ FEATURE_TESTS_BASIC :=
+         dwarf_getlocations              \
+         fortify-source                  \
+         sync-compare-and-swap           \
++        get_current_dir_name            \
+         glibc                           \
+         gtk2                            \
+         gtk2-infobar                    \
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -7,6 +7,7 @@ FILES=
+          test-dwarf_getlocations.bin            \
+          test-fortify-source.bin                \
+          test-sync-compare-and-swap.bin         \
++         test-get_current_dir_name.bin          \
+          test-glibc.bin                         \
+          test-gtk2.bin                          \
+          test-gtk2-infobar.bin                  \
+@@ -99,6 +100,9 @@ $(OUTPUT)test-bionic.bin:
+ $(OUTPUT)test-libelf.bin:
+       $(BUILD) -lelf
++$(OUTPUT)test-get_current_dir_name.bin:
++      $(BUILD)
++
+ $(OUTPUT)test-glibc.bin:
+       $(BUILD)
+--- a/tools/build/feature/test-all.c
++++ b/tools/build/feature/test-all.c
+@@ -34,6 +34,10 @@
+ # include "test-libelf-mmap.c"
+ #undef main
++#define main main_test_get_current_dir_name
++# include "test-get_current_dir_name.c"
++#undef main
++
+ #define main main_test_glibc
+ # include "test-glibc.c"
+ #undef main
+@@ -174,6 +178,7 @@ int main(int argc, char *argv[])
+       main_test_hello();
+       main_test_libelf();
+       main_test_libelf_mmap();
++      main_test_get_current_dir_name();
+       main_test_glibc();
+       main_test_dwarf();
+       main_test_dwarf_getlocations();
+--- /dev/null
++++ b/tools/build/feature/test-get_current_dir_name.c
+@@ -0,0 +1,10 @@
++// SPDX-License-Identifier: GPL-2.0
++#define _GNU_SOURCE
++#include <unistd.h>
++#include <stdlib.h>
++
++int main(void)
++{
++      free(get_current_dir_name());
++      return 0;
++}
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -310,6 +310,11 @@ ifndef NO_BIONIC
+   endif
+ endif
++ifeq ($(feature-get_current_dir_name), 1)
++  CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
++endif
++
++
+ ifdef NO_LIBELF
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+--- a/tools/perf/util/Build
++++ b/tools/perf/util/Build
+@@ -10,6 +10,7 @@ libperf-y += evlist.o
+ libperf-y += evsel.o
+ libperf-y += evsel_fprintf.o
+ libperf-y += find_bit.o
++libperf-y += get_current_dir_name.o
+ libperf-y += kallsyms.o
+ libperf-y += levenshtein.o
+ libperf-y += llvm-utils.o
+--- /dev/null
++++ b/tools/perf/util/get_current_dir_name.c
+@@ -0,0 +1,18 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
++//
++#ifndef HAVE_GET_CURRENT_DIR_NAME
++#include "util.h"
++#include <unistd.h>
++#include <stdlib.h>
++#include <stdlib.h>
++
++/* Android's 'bionic' library, for one, doesn't have this */
++
++char *get_current_dir_name(void)
++{
++      char pwd[PATH_MAX];
++
++      return getcwd(pwd, sizeof(pwd)) == NULL ? NULL : strdup(pwd);
++}
++#endif // HAVE_GET_CURRENT_DIR_NAME
+--- a/tools/perf/util/util.h
++++ b/tools/perf/util/util.h
+@@ -57,6 +57,10 @@ int fetch_kernel_version(unsigned int *p
+ const char *perf_tip(const char *dirpath);
++#ifndef HAVE_GET_CURRENT_DIR_NAME
++char *get_current_dir_name(void);
++#endif
++
+ #ifndef HAVE_SCHED_GETCPU_SUPPORT
+ int sched_getcpu(void);
+ #endif