Resolves: rhbz2125010

This commit is contained in:
Frank Ch. Eigler 2022-11-03 16:27:50 -04:00
parent 7b1dd23b34
commit c094e13c06
5 changed files with 22 additions and 338 deletions

1
.gitignore vendored
View File

@ -61,3 +61,4 @@
/systemtap-4.5.tar.gz
/systemtap-4.6.tar.gz
/systemtap-4.7.tar.gz
/systemtap-4.8.tar.gz

View File

@ -1,258 +0,0 @@
commit 093b972294256b3ad68712daecdfdc5da1418a13
Author: Martin Cermak <mcermak@redhat.com>
Date: Mon May 9 20:00:15 2022 +0200
refix PR28634 for rhel8+ kernels
The rhel kernel backports do not always align to upstream, so that
the KERNEL_VERSION() based gate needs to be updated using a version
that does the expected thing for the rhel{7,8,9} kernels.
diff --git a/tapset/linux/ioscheduler.stp b/tapset/linux/ioscheduler.stp
index 3096a73ea..c7231878d 100644
--- a/tapset/linux/ioscheduler.stp
+++ b/tapset/linux/ioscheduler.stp
@@ -11,7 +11,7 @@
// </tapsetdescription>
%{
#include <linux/blkdev.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0)
#include <linux/elevator.h>
#endif
%}
@@ -41,7 +41,7 @@ probe ioscheduler.elv_next_request = kernel.function("blk_peek_request") !,
*/
probe ioscheduler.elv_next_request.return =
kernel.function("blk_peek_request").return !,
- kernel.function("elv_next_request").return
+ kernel.function("elv_next_request").return ?
{
name = "elv_next_request"
if ($return == 0) {
@@ -80,18 +80,14 @@ probe ioscheduler.elv_completed_request
@choose_defined($q->elevator->elevator_type->elevator_name,
@choose_defined($q->elevator->elevator_name,
0))), "")
- if($rq == 0) {
- disk_major = -1
- disk_minor = -1
- } else {
- if($rq->rq_disk == 0) {
- disk_major = -1
- disk_minor = -1
- } else {
- disk_major = $rq->rq_disk->major
- disk_minor = $rq->rq_disk->first_minor
- }
- }
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
+ disk_major = $rq->rq_disk->major
+ disk_minor = $rq->rq_disk->first_minor
+ }
rq = $rq
rq_flags = ($rq == 0) ? 0
@@ -111,7 +107,7 @@ probe ioscheduler.elv_completed_request
// when a request is added to the request queue
probe ioscheduler.elv_add_request.kp =
kernel.function("elv_insert") !,
- kernel.function("__elv_add_request")
+ kernel.function("__elv_add_request") ?
{
name = "elv_add_request"
elevator_name = kernel_string(
@@ -120,18 +116,15 @@ probe ioscheduler.elv_add_request.kp =
@choose_defined($q->elevator->elevator_name,
0))), "")
q = $q
- if($rq == 0) {
- disk_major = -1
- disk_minor = -1
- } else {
- if($rq->rq_disk == 0) {
- disk_major = -1
- disk_minor = -1
- } else {
- disk_major = $rq->rq_disk->major
- disk_minor = $rq->rq_disk->first_minor
- }
- }
+
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
+ disk_major = $rq->rq_disk->major
+ disk_minor = $rq->rq_disk->first_minor
+ }
rq = $rq
rq_flags = ($rq == 0) ? 0
@@ -160,11 +153,11 @@ probe ioscheduler.elv_add_request.tp = kernel.trace("block_rq_insert") ?
0))), "")
rq = $rq
- if ($rq == 0 || $rq->rq_disk ==0) {
- disk_major = -1
- disk_minor = -1
- }
- else {
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
disk_major = $rq->rq_disk->major
disk_minor = $rq->rq_disk->first_minor
}
@@ -184,7 +177,7 @@ probe ioscheduler.elv_add_request.tp = kernel.trace("block_rq_insert") ?
*
*/
probe ioscheduler.elv_add_request =
- ioscheduler.elv_add_request.tp !, ioscheduler.elv_add_request.kp
+ ioscheduler.elv_add_request.tp !, ioscheduler.elv_add_request.kp ?
{}
/**
@@ -211,14 +204,14 @@ probe ioscheduler_trace.elv_completed_request
rq = $rq
- if ($rq == 0 || $rq->rq_disk ==0) {
- disk_major = -1
- disk_minor = -1
- }
- else {
- disk_major = $rq->rq_disk->major
- disk_minor = $rq->rq_disk->first_minor
- }
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
+ disk_major = $rq->rq_disk->major
+ disk_minor = $rq->rq_disk->first_minor
+ }
rq_flags = ($rq == 0) ? 0
: @choose_defined($rq->cmd_flags, $rq->flags)
@@ -247,14 +240,14 @@ probe ioscheduler_trace.elv_issue_request
0))), "")
rq = $rq
- if ($rq == 0 || $rq->rq_disk ==0) {
- disk_major = -1
- disk_minor = -1
- }
- else {
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
disk_major = $rq->rq_disk->major
disk_minor = $rq->rq_disk->first_minor
- }
+ }
rq_flags = ($rq == 0) ? 0
: @choose_defined($rq->cmd_flags, $rq->flags)
@@ -283,14 +276,14 @@ probe ioscheduler_trace.elv_requeue_request
0))), "")
rq = $rq
- if ($rq == 0 || $rq->rq_disk ==0) {
- disk_major = -1
- disk_minor = -1
- }
- else {
- disk_major = $rq->rq_disk->major
- disk_minor = $rq->rq_disk->first_minor
- }
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
+ disk_major = $rq->rq_disk->major
+ disk_minor = $rq->rq_disk->first_minor
+ }
rq_flags = ($rq == 0) ? 0
: @choose_defined($rq->cmd_flags, $rq->flags)
@@ -318,14 +311,14 @@ probe ioscheduler_trace.elv_abort_request
0))), "")
rq = $rq
- if ($rq == 0 || $rq->rq_disk ==0) {
- disk_major = -1
- disk_minor = -1
- }
- else {
- disk_major = $rq->rq_disk->major
- disk_minor = $rq->rq_disk->first_minor
- }
+ disk_major = -1
+ disk_minor = -1
+ // kernel f3fa33acca9f0058157214800f68b10d8e71ab7a
+ // block: remove the ->rq_disk field in struct request
+ if(@defined($rq->rq_disk) && ($rq->rq_disk != 0)) {
+ disk_major = $rq->rq_disk->major
+ disk_minor = $rq->rq_disk->first_minor
+ }
rq_flags = ($rq == 0) ? 0
: @choose_defined($rq->cmd_flags, $rq->flags)
diff --git a/testsuite/buildok/ioscheduler-all-probes.stp b/testsuite/buildok/ioscheduler-all-probes.stp
index da182c774..a8d8e08c5 100755
--- a/testsuite/buildok/ioscheduler-all-probes.stp
+++ b/testsuite/buildok/ioscheduler-all-probes.stp
@@ -2,6 +2,6 @@
// Tests if all probes in the ioscheduler tapset are resolvable.
-probe ioscheduler.*, ioscheduler.*.return {}
+probe ioscheduler.* ?, ioscheduler.*.return ? {}
probe ioscheduler_trace.* ? {}
diff --git a/testsuite/buildok/ioscheduler-detailed.stp b/testsuite/buildok/ioscheduler-detailed.stp
index 143f20cd6..033e955dc 100755
--- a/testsuite/buildok/ioscheduler-detailed.stp
+++ b/testsuite/buildok/ioscheduler-detailed.stp
@@ -6,24 +6,24 @@
# test the kprobes aliases (*.kp). This could cause them to get out
# of sync with the kprobed functions. So, we test them explicitly.
-probe ioscheduler.elv_next_request
+probe ioscheduler.elv_next_request ?
{
printf("%s: %s\n", name, elevator_name)
}
-probe ioscheduler.elv_next_request.return
+probe ioscheduler.elv_next_request.return ?
{
printf("name: %s, %d, %d, %p, %d", name, disk_major,
disk_minor, rq, rq_flags)
}
-probe ioscheduler.elv_completed_request
+probe ioscheduler.elv_completed_request ?
{
printf("name: %s, elv_name: %s, %d, %d, %p, %d", name, elevator_name,
disk_major, disk_minor, rq, rq_flags)
}
-probe ioscheduler.elv_add_request,
- ioscheduler.elv_add_request.kp,
+probe ioscheduler.elv_add_request ?,
+ ioscheduler.elv_add_request.kp ?,
ioscheduler.elv_add_request.tp ?
{
printf("name: %s, elv_name: %s, %d, %d, %p, %d", name, elevator_name,

View File

@ -1,66 +0,0 @@
commit a0fa7bf0b68058d8f41a5fde608362172a2c3d77
Author: Martin Cermak <mcermak@redhat.com>
Date: Wed May 11 22:22:00 2022 +0200
Update examples/io/iostat-scsi.stp for modern rhel9 kernels.
Update examples/io/iostat-scsi.stp for kernels having following
upstream kernel commit backported:
commit f3fa33acca9f0058157214800f68b10d8e71ab7a
Author: Christoph Hellwig <hch@lst.de>
Date: Fri Nov 26 13:18:00 2021 +0100
block: remove the ->rq_disk field in struct request
Just use the disk attached to the request_queue instead.
[ ... stuff deleted ... ]
diff --git a/testsuite/systemtap.examples/io/iostat-scsi.stp b/testsuite/systemtap.examples/io/iostat-scsi.stp
index 3faf32fe9..aa0238a7b 100755
--- a/testsuite/systemtap.examples/io/iostat-scsi.stp
+++ b/testsuite/systemtap.examples/io/iostat-scsi.stp
@@ -2,12 +2,18 @@
global devices, reads, writes
+/* kernel commit f3fa33acca9f0058157214800f68b10d8e71ab7a */
+@define __disk_name(__request)
+%(
+ ( @choose_defined(@__request->rq_disk->disk_name, @__request->q->disk->disk_name ) )
+%)
+
/* data collection: SCSI disk */
%(kernel_v < "2.6.24" %?
probe module("sd_mod").function("sd_init_command") !,
kernel.function("sd_init_command")
{
- device = kernel_string($SCpnt->request->rq_disk->disk_name)
+ device = kernel_string(@__disk_name($SCpnt->request))
sector_size = $SCpnt->device->sector_size
nr_sectors = $SCpnt->request->nr_sectors
devices[device] = 1
@@ -38,7 +44,7 @@ function get_nr_sectors:long(rq:long)
probe sd_prep_fn = module("sd_mod").function("sd_prep_fn") !,
kernel.function("sd_prep_fn")
{
- device = kernel_string($rq->rq_disk->disk_name)
+ device = kernel_string(@__disk_name($rq))
sector_size = @cast($q->queuedata, "scsi_device", "kernel<scsi/scsi_device.h>")->sector_size
%(kernel_v>="2.6.31" %?
nr_sectors = get_nr_sectors($rq)
@@ -58,11 +64,11 @@ probe sd_init_command = module("sd_mod").function("sd_init_command") !,
sector_size = @choose_defined($cmd, $SCpnt)->device->sector_size
# Kernel commits aa8e25e5006aac52c943c84e9056ab488630ee19 2266a2def97ce11ec979b6c58a1b637a16eca7dd
if (@defined(@choose_defined($cmd, $SCpnt)->request)) {
- device = kernel_string(@choose_defined($cmd, $SCpnt)->request->rq_disk->disk_name)
+ device = kernel_string(@__disk_name(@choose_defined($cmd, $SCpnt)->request))
nr_sectors = get_nr_sectors(@choose_defined($cmd, $SCpnt)->request)
_cmd_flags = @choose_defined($cmd, $SCpnt)->request->cmd_flags
} else {
- device = kernel_string(@cast(scsi_cmd_to_rq(@choose_defined($cmd, $SCpnt)), "request", "kernel")->rq_disk->disk_name)
+ device = kernel_string(@__disk_name(@cast(scsi_cmd_to_rq(@choose_defined($cmd, $SCpnt)), "request", "kernel")))
nr_sectors = get_nr_sectors(scsi_cmd_to_rq(@choose_defined($cmd, $SCpnt)))
_cmd_flags = @cast(scsi_cmd_to_rq(@choose_defined($cmd, $SCpnt)), "request", "kernel")->cmd_flags
}

View File

@ -1 +1 @@
SHA512 (systemtap-4.7.tar.gz) = 7d7c213dc4f7c5430f81763668da21403fbc351d1701b1096eb1ad233e3f0325e35f01dfd0a33e75f277b26fdde88c46d42dd32e32e4d4f27a45d53e2dd0f831
SHA512 (systemtap-4.8.tar.gz) = fdcbc48ba17b2155c1419d99147a4cfbee2e69db945bfd0e6881b71ab11165bd23ea7ce9456856ae36807fb18f9934880a6b7c44456b63833ea260038744d9f2

View File

@ -20,7 +20,11 @@
%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 8}
%{!?with_systemd: %global with_systemd 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%{!?with_emacsvim: %global with_emacsvim 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%ifarch %{ix86}
%{!?with_java: %global with_java 0}
%else
%{!?with_java: %global with_java 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%endif
%{!?with_debuginfod: %global with_debuginfod 0%{?fedora} >= 25 || 0%{?rhel} >= 7}
%{!?with_virthost: %global with_virthost 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%{!?with_virtguest: %global with_virtguest 1}
@ -117,8 +121,8 @@ m stapdev stapdev
Name: systemtap
Version: 4.7
Release: 2%{?release_override}%{?dist}
Version: 4.8
Release: 1%{?release_override}%{?dist}
# for version, see also configure.ac
@ -154,9 +158,6 @@ License: GPLv2+
URL: http://sourceware.org/systemtap/
Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz
Patch1: rhbz2081102.patch
Patch2: rhbz2085647.patch
# Build*
BuildRequires: make
BuildRequires: gcc-c++
@ -235,9 +236,6 @@ BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
%if %{with_specific_python}
BuildRequires: /usr/bin/pathfix.py
%endif
%if %{with_httpd}
BuildRequires: libmicrohttpd-devel
@ -576,8 +574,6 @@ systemtap-runtime-virthost machine to execute systemtap scripts.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
@ -681,6 +677,11 @@ make %{?_smp_mflags} V=1
%install
make DESTDIR=$RPM_BUILD_ROOT install
%if ! (%{with_python3})
rm -v $RPM_BUILD_ROOT%{_bindir}/stap-profile-annotate
%endif
%find_lang %{name}
for dir in $(ls -1d $RPM_BUILD_ROOT%{_mandir}/{??,??_??}) ; do
dir=$(echo $dir | sed -e "s|^$RPM_BUILD_ROOT||")
@ -818,7 +819,7 @@ done
%if %{with_specific_python}
# Some files got ambiguous python shebangs, we fix them after everything else is done
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/*
%py3_shebang_fix %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/*
%endif
%pre runtime
@ -873,7 +874,8 @@ if [ ! -f ~stap-server/.systemtap/rc ]; then
numcpu=`/usr/bin/getconf _NPROCESSORS_ONLN`
if [ -z "$numcpu" -o "$numcpu" -lt 1 ]; then numcpu=1; fi
nproc=`expr $numcpu \* 30`
echo "--rlimit-as=614400000 --rlimit-cpu=60 --rlimit-nproc=$nproc --rlimit-stack=1024000 --rlimit-fsize=51200000" > ~stap-server/.systemtap/rc
# PR29661 -> 4G
echo "--rlimit-as=4294967296 --rlimit-cpu=60 --rlimit-nproc=$nproc --rlimit-stack=1024000 --rlimit-fsize=51200000" > ~stap-server/.systemtap/rc
chown stap-server:stap-server ~stap-server/.systemtap/rc
fi
@ -1083,7 +1085,9 @@ exit 0
%files devel -f systemtap.lang
%{_bindir}/stap
%{_bindir}/stap-prep
%if %{with_python3}
%{_bindir}/stap-profile-annotate
%endif
%{_bindir}/stap-report
%dir %{_datadir}/systemtap
%{_datadir}/systemtap/runtime
@ -1280,7 +1284,10 @@ exit 0
# PRERELEASE
%changelog
* Tue May 17 2022 Martin Cermak <mcermak@redhat.com> - 4.1-2
* Thu Nov 03 2022 Frank Ch. Eigler <fche@redhat.com> - 4.8-1
- Upstream release.
* Tue May 17 2022 Martin Cermak <mcermak@redhat.com> - 4.7-2
- Fix rhbz2081102 and rhbz2085647
* Mon May 02 2022 Frank Ch. Eigler <fche@redhat.com> - 4.7-1