summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/systemtap
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-05-18 12:58:05 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-20 22:52:22 +0100
commit7a3fd4344b70d41a8e97af67878a991daff1fe13 (patch)
tree8199205f3c8847548be6f8420f9f51606d03202b /meta/recipes-kernel/systemtap
parentc8a4ed16d4bd761865d88be0951f7e8b0096f6c4 (diff)
downloadpoky-7a3fd4344b70d41a8e97af67878a991daff1fe13.tar.gz
systemtap: update 4.6 -> 4.7
Drop backports. (From OE-Core rev: 589f030dec438ee8ea54991b9e471482285ef4b7) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/systemtap')
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch45
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch84
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch49
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.bb6
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.inc6
5 files changed, 5 insertions, 185 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch b/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch
deleted file mode 100644
index 0801cb57ec..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From b0422e9e5a539164af75cddcaeb01bceca56bf12 Mon Sep 17 00:00:00 2001
5From: "Frank Ch. Eigler" <fche@redhat.com>
6Date: Thu, 13 Jan 2022 18:33:15 -0500
7Subject: [PATCH] PR28778: gcc warning tweak for sprintf precision parameter
8
9A precision=-1 sentinel value got interpreted as UINT_MAX in a
10context, leading to diagnostics like:
11
12/usr/share/systemtap/runtime/vsprintf.c:341:23: error: 'strnlen' specified bound 4294967295 may exceed maximum object size 2147483647 [-Werror=stringop-overread]
13
14Adding a clamp_t() around the parameter field to keep it limited to
15STP_BUFFER_SIZE (8K by default), which is apprx. the limit for a
16single printf.
17---
18 runtime/vsprintf.c | 4 ++--
19 1 file changed, 2 insertions(+), 2 deletions(-)
20
21diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c
22index cd31a938b..606f685e8 100644
23--- a/runtime/vsprintf.c
24+++ b/runtime/vsprintf.c
25@@ -338,7 +338,7 @@ _stp_vsprint_memory(char * str, char * end, const char * ptr,
26 if (format == 's') {
27 if ((unsigned long)ptr < PAGE_SIZE)
28 ptr = "<NULL>";
29- len = strnlen(ptr, precision);
30+ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE));
31 }
32 else if (precision > 0)
33 len = precision;
34@@ -410,7 +410,7 @@ _stp_vsprint_memory_size(const char * ptr, int width, int precision,
35 if (format == 's') {
36 if ((unsigned long)ptr < PAGE_SIZE)
37 ptr = "<NULL>";
38- len = strnlen(ptr, precision);
39+ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE));
40 }
41 else if (precision > 0)
42 len = precision;
43--
442.25.1
45
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch b/meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch
deleted file mode 100644
index 931310db53..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4PR28804: tune default stap -s ## buffer size on small RAM machines
5
6Insert a forgotten division by num_online_cpu() to adjust downward the
7calculated bufsize. Tweak normal defaults back to 128 * 2 * 64K
8(16MB) per CPU, as the stap man page indicates. This may need further
9tweaking when balancing against staprun consumption performance, but
10at least we have the docs lined up with the code at the moment.
11
12PR28804: tune default stap -s ## buffer size on small RAM machines
13
14Use si_meminfo to limit default buffer size. Note in the man page
15that the "-s ##" parameter is per-CPU.
16
17diff --git a/man/stap.1.in b/man/stap.1.in
18index 55dbc2c93..285a27b34 100644
19--- a/man/stap.1.in
20+++ b/man/stap.1.in
21@@ -239,8 +239,8 @@ and average amount of time spent in each probe-point. Also shows
22 the derivation for each probe-point.
23 .TP
24 .BI \-s " NUM"
25-Use NUM megabyte buffers for kernel-to-user data transfer. On a
26-multiprocessor in bulk mode, this is a per-processor amount.
27+Use NUM megabyte buffers for kernel-to-user data transfer per processor.
28+The default is 16MB, or less on smaller memory machines.
29 .TP
30 .BI \-I " DIR"
31 Add the given directory to the tapset search directory. See the
32diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
33index 18ecccea2..44afff814 100644
34--- a/runtime/transport/transport.c
35+++ b/runtime/transport/transport.c
36@@ -72,8 +72,11 @@ static inline void _stp_unlock_inode(struct inode *inode);
37 #include "procfs.c"
38 #include "control.c"
39
40-static unsigned _stp_nsubbufs = 256;
41-static unsigned _stp_subbuf_size = 8 * STP_BUFFER_SIZE; /* 64K */
42+/* set default buffer parameters. User may override these via stap -s #, and
43+ the runtime may auto-shrink it on low memory machines too. */
44+/* NB: Note default in man/stap.1.in */
45+static unsigned _stp_nsubbufs = 128;
46+static unsigned _stp_subbuf_size = 2 * STP_BUFFER_SIZE; /* 2 * 64K */
47
48 /* module parameters */
49 static int _stp_bufsize;
50@@ -602,17 +605,30 @@ static int _stp_transport_init(void)
51 _stp_need_kallsyms_stext = 0;
52 #endif
53
54- if (_stp_bufsize) {
55- unsigned size = _stp_bufsize * 1024 * 1024;
56+ if (_stp_bufsize == 0) { // option not specified?
57+ struct sysinfo si;
58+ long _stp_bufsize_avail;
59+ si_meminfo(&si);
60+ _stp_bufsize_avail = (long)((si.freeram + si.bufferram) / 4 / num_online_cpus())
61+ << PAGE_SHIFT; // limit to quarter of free ram total
62+ if ((_stp_nsubbufs * _stp_subbuf_size * num_online_cpus()) > _stp_bufsize_avail) {
63+ _stp_bufsize = max_t (int, 1, _stp_bufsize_avail / 1024 / 1024);
64+ dbug_trans(1, "Shrinking default _stp_bufsize to %d MB/cpu due to low free memory\n", _stp_bufsize);
65+ }
66+ }
67+
68+ if (_stp_bufsize) { // overridden by user or by si_meminfo heuristic?
69+ long size = _stp_bufsize * 1024 * 1024;
70 _stp_subbuf_size = 65536;
71+ // bump up subbuf size from 64K to 1M to keep _stp_nsubbufs not too large
72 while (size / _stp_subbuf_size > 64 &&
73 _stp_subbuf_size < 1024 * 1024) {
74 _stp_subbuf_size <<= 1;
75 }
76 _stp_nsubbufs = size / _stp_subbuf_size;
77- dbug_trans(1, "Using %d subbufs of size %d\n", _stp_nsubbufs, _stp_subbuf_size);
78 }
79-
80+ dbug_trans(1, "Using %d subbufs of size %d\n", _stp_nsubbufs, _stp_subbuf_size);
81+
82 ret = _stp_transport_fs_init(THIS_MODULE->name);
83 if (ret)
84 goto err0;
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch b/meta/recipes-kernel/systemtap/systemtap/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch
deleted file mode 100644
index f885c44460..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From f199d1982ef8a6c6d5c06c082d057b8793bcc6aa Mon Sep 17 00:00:00 2001
2From: Serhei Makarov <serhei@serhei.io>
3Date: Fri, 21 Jan 2022 18:21:46 -0500
4Subject: [PATCH] gcc12 c++ compatibility re-tweak for rhel6: use function
5 pointer instead of lambdas instead of ptr_fun<>
6
7Saving 2 lines in ltrim/rtrim is probably not a good reason to drop
8compatibility with the RHEL6 system compiler. Actually declaring a
9named function and passing the function pointer is compatible with
10everything.
11
12Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=f199d1982ef8a6c6d5c06c082d057b8793bcc6aa]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 util.cxx | 13 ++++++++-----
16 1 file changed, 8 insertions(+), 5 deletions(-)
17
18--- a/util.cxx
19+++ b/util.cxx
20@@ -1757,21 +1757,24 @@ flush_to_stream (const string &fname, os
21 return 1; // Failure
22 }
23
24+int
25+not_isspace(unsigned char c)
26+{
27+ return !std::isspace(c);
28+}
29+
30 // trim from start (in place)
31 void
32 ltrim(std::string &s)
33 {
34- s.erase(s.begin(),
35- std::find_if(s.begin(), s.end(),
36- std::not1(std::ptr_fun<int, int>(std::isspace))));
37+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_isspace));
38 }
39
40 // trim from end (in place)
41 void
42 rtrim(std::string &s)
43 {
44- s.erase(std::find_if(s.rbegin(), s.rend(),
45- std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
46+ s.erase(std::find_if(s.rbegin(), s.rend(), not_isspace).base(), s.end());
47 }
48
49 // trim from both ends (in place)
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb
index ce86d5274d..072fcb310a 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.bb
+++ b/meta/recipes-kernel/systemtap/systemtap_git.bb
@@ -6,9 +6,9 @@ HOMEPAGE = "https://sourceware.org/systemtap/"
6 6
7require systemtap_git.inc 7require systemtap_git.inc
8 8
9SRC_URI += "file://0001-improve-reproducibility-for-c-compiling.patch \ 9SRC_URI += " \
10 file://0001-staprun-address-ncurses-6.3-failures.patch \ 10 file://0001-improve-reproducibility-for-c-compiling.patch \
11 file://0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch \ 11 file://0001-staprun-address-ncurses-6.3-failures.patch \
12 " 12 "
13 13
14DEPENDS = "elfutils" 14DEPENDS = "elfutils"
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc
index 5b5521b174..2b79aa8fca 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.inc
+++ b/meta/recipes-kernel/systemtap/systemtap_git.inc
@@ -1,14 +1,12 @@
1LICENSE = "GPL-2.0-only" 1LICENSE = "GPL-2.0-only"
2LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" 2LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
3SRCREV = "2e9f2f6967e44ce2bf8f34932b5bdd738ece2161" 3SRCREV = "0c335a75a789ff44b514e567d458881e15cc283d"
4PV = "4.6" 4PV = "4.7"
5 5
6SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master \ 6SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master \
7 file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ 7 file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \
8 file://0001-Install-python-modules-to-correct-library-dir.patch \ 8 file://0001-Install-python-modules-to-correct-library-dir.patch \
9 file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \ 9 file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \
10 file://0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch \
11 file://0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch \
12 " 10 "
13 11
14COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux' 12COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux'