systemtap/rhbz2081102.patch
2022-05-17 10:50:56 +00:00

259 lines
8.3 KiB
Diff

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,