From f2107354d0a07d8f1d3bb3e97920ba557ebe7855 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Nov 2009 10:59:37 -0600 Subject: PR 5150. Fixed nfs tapset by making probes optional. * tapset/nfs_proc.stp: Made 'nfs.proc.read', 'nfs.proc.write', and 'nfs.proc.commit' optional for newer kernels without those functions. * testsuite/systemtap.pass1-4/buildok.exp: Expect nfs-all-probes.stp to pass. --- tapset/nfs_proc.stp | 52 +++++++++++++++++++-------------- testsuite/systemtap.pass1-4/buildok.exp | 1 - 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/tapset/nfs_proc.stp b/tapset/nfs_proc.stp index 502091b4..afd5328b 100644 --- a/tapset/nfs_proc.stp +++ b/tapset/nfs_proc.stp @@ -207,9 +207,9 @@ function __getfh_inode :long(dir:long) %{ /* pure */ THIS->__retvalue =(long) fh; %} probe nfs.proc.entries = nfs.proc.lookup, - nfs.proc.read, - nfs.proc.write, - nfs.proc.commit, + nfs.proc.read ?, + nfs.proc.write ?, + nfs.proc.commit ?, nfs.proc.read_setup, nfs.proc.write_setup, nfs.proc.commit_setup, @@ -226,9 +226,9 @@ probe nfs.proc.entries = nfs.proc.lookup, probe nfs.proc.return = nfs.proc.lookup.return, - nfs.proc.read.return, - nfs.proc.write.return, - nfs.proc.commit.return, + nfs.proc.read.return ?, + nfs.proc.write.return ?, + nfs.proc.commit.return ?, nfs.proc.read_setup.return, nfs.proc.write_setup.return, nfs.proc.commit_setup.return, @@ -355,16 +355,18 @@ probe nfs.proc4.lookup.return = kernel.function("nfs4_proc_lookup").return!, * count : read bytes in this execution * offset : the file offset * +* All the nfs.proc.read kernel functions were removed in kernel commit +* 8e0969, so these probes are optional. */ -probe nfs.proc.read = nfs.proc2.read , - nfs.proc3.read , - nfs.proc4.read +probe nfs.proc.read = nfs.proc2.read ?, + nfs.proc3.read ?, + nfs.proc4.read ? {} -probe nfs.proc.read.return = nfs.proc2.read.return , - nfs.proc3.read.return , - nfs.proc4.read.return +probe nfs.proc.read.return = nfs.proc2.read.return ?, + nfs.proc3.read.return ?, + nfs.proc4.read.return ? { } @@ -464,17 +466,20 @@ probe nfs.proc4.read.return = kernel.function("nfs4_proc_read").return !, * bitmask0: * bitmask1 :V4 bitmask representing the set of attributes * supported on this filesystem (only in probe nfs.proc4.write) +* +* All the nfs.proc.write kernel functions were removed in kernel commit +* 200baa, so these probes are optional. */ -probe nfs.proc.write = nfs.proc2.write , - nfs.proc3.write , - nfs.proc4.write +probe nfs.proc.write = nfs.proc2.write ?, + nfs.proc3.write ?, + nfs.proc4.write ? {} -probe nfs.proc.write.return = nfs.proc2.write.return , - nfs.proc3.write.return , - nfs.proc4.write.return +probe nfs.proc.write.return = nfs.proc2.write.return ?, + nfs.proc3.write.return ?, + nfs.proc4.write.return ? {} probe nfs.proc2.write = kernel.function("nfs_proc_write")!, @@ -598,13 +603,16 @@ probe nfs.proc4.write.return = kernel.function("nfs4_proc_write").return !, * bitmask0: * bitmask1 :V4 bitmask representing the set of attributes * supported on this filesystem (only in probe nfs.proc4.commit) +* +* All the nfs.proc.commit kernel functions were removed in kernel +* commit 200baa, so these probes are optional. */ -probe nfs.proc.commit = nfs.proc3.commit, - nfs.proc4.commit +probe nfs.proc.commit = nfs.proc3.commit ?, + nfs.proc4.commit ? {} -probe nfs.proc.commit.return = nfs.proc3.commit.return, - nfs.proc4.commit.return +probe nfs.proc.commit.return = nfs.proc3.commit.return ?, + nfs.proc4.commit.return ? {} // XXX: on kernels > 2.6.18 (?), module("nfs") -> module("nfsd") and diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp index 8ab8b139..b03ea8fc 100644 --- a/testsuite/systemtap.pass1-4/buildok.exp +++ b/testsuite/systemtap.pass1-4/buildok.exp @@ -9,7 +9,6 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { buildok/sched_test.stp {setup_kfail 1155 *-*-*} buildok/process_test.stp {setup_kfail 1155 *-*-*} buildok/rpc-all-probes.stp {setup_kfail 4413 *-*-*} - buildok/nfs-all-probes.stp {setup_kfail 4413 *-*-*} buildok/per-process-syscall.stp {if {![utrace_p]} { setup_kfail 9999 *-*-*} } } if {$rc == 0} { pass $test } else { fail $test } -- cgit From c3425989053b94d526ab7647eb0ffc260daf4ff2 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Nov 2009 11:16:15 -0600 Subject: Don't kfail buildok/sched_test.stp and buildok/process_test.stp. * testsuite/systemtap.pass1-4/buildok.exp: On rhel5 and rawhide, the buildok/sched_test.stp and buildok/process_test.stp tests pass sucessfully, so there is no reason to kfail them. --- testsuite/systemtap.pass1-4/buildok.exp | 2 -- 1 file changed, 2 deletions(-) diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp index b03ea8fc..a9f16a8b 100644 --- a/testsuite/systemtap.pass1-4/buildok.exp +++ b/testsuite/systemtap.pass1-4/buildok.exp @@ -6,8 +6,6 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { # some tests are known to fail. switch $test { buildok/perfmon01.stp {setup_kfail 909 *-*-*} - buildok/sched_test.stp {setup_kfail 1155 *-*-*} - buildok/process_test.stp {setup_kfail 1155 *-*-*} buildok/rpc-all-probes.stp {setup_kfail 4413 *-*-*} buildok/per-process-syscall.stp {if {![utrace_p]} { setup_kfail 9999 *-*-*} } } -- cgit From 02a2d6ca6f9120cc39cc1eb5ffe089b88dd4d818 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Nov 2009 12:53:50 -0600 Subject: PR 10981. Fixed buildok/netdev.stp for RHEL5. * tapset/networking.stp: Made 'netdev.change_rx_flag' and 'netdev.get_stats' optional, since those functions don't exist on RHEL5. * testsuite/buildok/netdev.stp: Ditto. --- tapset/networking.stp | 4 ++-- testsuite/buildok/netdev.stp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tapset/networking.stp b/tapset/networking.stp index e9ea35dc..e1c5ed1f 100644 --- a/tapset/networking.stp +++ b/tapset/networking.stp @@ -154,7 +154,7 @@ probe netdev.rx * @flags: The new flags */ probe netdev.change_rx_flag - = kernel.function("dev_change_rx_flags") + = kernel.function("dev_change_rx_flags") ? { dev_name = get_netdev_name($dev) flags = $flags @@ -217,7 +217,7 @@ probe netdev.unregister * @dev_name: The device that is going to provide the statistics */ probe netdev.get_stats - = kernel.function("dev_get_stats") + = kernel.function("dev_get_stats") ? { dev_name = get_netdev_name($dev) } diff --git a/testsuite/buildok/netdev.stp b/testsuite/buildok/netdev.stp index 49a1eb5c..7e4be82c 100755 --- a/testsuite/buildok/netdev.stp +++ b/testsuite/buildok/netdev.stp @@ -1,6 +1,6 @@ #! stap -wp4 -probe netdev.get_stats{ +probe netdev.get_stats ? { printf("%s", dev_name) } @@ -21,7 +21,7 @@ probe netdev.set_promiscuity { disable, inc) } -probe netdev.change_rx_flag { +probe netdev.change_rx_flag ? { printf("%s %d", dev_name, flags) } -- cgit From 508968a7d10bbae3b9fbc33bf3d3b1e62a8a018a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 18 Nov 2009 13:32:22 -0800 Subject: PR10983: Give preference to tracepoints in trace/events/ In 2.6.32-rc7, there are two power.h tracepoints headers, and only the one in trace/events/ is valid. In general, we can expect that trace/events/ has newer headers, so we should search those first. * tapsets.cxx (tracepoint_builder::init_dw): Search /events/ first. --- tapsets.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tapsets.cxx b/tapsets.cxx index c972de5f..7bae4615 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -6313,10 +6313,10 @@ tracepoint_builder::init_dw(systemtap_session& s) glob_t trace_glob; string globs[] = { - "/include/trace/*.h", "/include/trace/events/*.h", - "/source/include/trace/*.h", "/source/include/trace/events/*.h", + "/include/trace/*.h", + "/source/include/trace/*.h", }; for (unsigned z = 0; z < sizeof(globs) / sizeof(globs[0]); z++) { -- cgit From 34642a03789b139d9e33253ab42744852199af1f Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 20 Nov 2009 11:55:28 -0500 Subject: build: disable make-silent mode in rpm builds --- systemtap.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemtap.spec b/systemtap.spec index d7cdc61b..1ccf6751 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -241,7 +241,7 @@ cd .. %endif -%configure %{?elfutils_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{grapher_config} %{rpm_config} +%configure %{?elfutils_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{grapher_config} %{rpm_config} --disable-silent-rules make %{?_smp_mflags} %install -- cgit From e9b2a22da6a5a4cc49b410681bd5cf228f1e8fc3 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 20 Nov 2009 13:02:38 -0500 Subject: cleanup: explain -5 magic value used in map-sorting code --- runtime/map.c | 2 +- translate.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/map.c b/runtime/map.c index 74467f30..20d8a48c 100644 --- a/runtime/map.c +++ b/runtime/map.c @@ -412,7 +412,7 @@ static void _stp_pmap_del(PMAP pmap) } /* sort keynum values */ -#define SORT_COUNT -5 +#define SORT_COUNT -5 /* see also translate.cxx:visit_foreach_loop */ #define SORT_SUM -4 #define SORT_MIN -3 #define SORT_MAX -2 diff --git a/translate.cxx b/translate.cxx index ca298113..03f7c86a 100644 --- a/translate.cxx +++ b/translate.cxx @@ -2611,7 +2611,7 @@ c_unparser::visit_foreach_loop (foreach_loop *s) // @count instead for aggregates. '-5' tells the // runtime to sort by count. if (s->sort_column == 0) - sort_column = -5; + sort_column = -5; /* runtime/map.c SORT_COUNT */ else sort_column = s->sort_column; -- cgit From 4eea0069b8b677657dcfea3effa2f342d0e5d27f Mon Sep 17 00:00:00 2001 From: Prerna Saxena Date: Sun, 22 Nov 2009 23:40:39 +0530 Subject: Added tracepoint-based probes to block IO and IO scheduler tapsets. Added testcases for these probes. Also, modified comments in ioblock.stp so that tapset docmentation can be automatically generated for this tapset. --- doc/SystemTap_Tapset_Reference/tapsets.tmpl | 5 +- tapset/ioblock.stp | 221 ++++++++++++++++++++++------ tapset/ioscheduler.stp | 191 +++++++++++++++++++++++- testsuite/buildok/ioblock_test.stp | 7 + testsuite/buildok/ioscheduler.stp | 13 ++ 5 files changed, 385 insertions(+), 52 deletions(-) diff --git a/doc/SystemTap_Tapset_Reference/tapsets.tmpl b/doc/SystemTap_Tapset_Reference/tapsets.tmpl index addcf88d..bb855d29 100644 --- a/doc/SystemTap_Tapset_Reference/tapsets.tmpl +++ b/doc/SystemTap_Tapset_Reference/tapsets.tmpl @@ -167,12 +167,13 @@ - IO Scheduler Tapset + IO Scheduler and block IO Tapset - This family of probe points is used to probe IO scheduler activities. + This family of probe points is used to probe block IO layer and IO scheduler activities. It contains the following probe points: !Itapset/ioscheduler.stp +!Itapset/ioblock.stp diff --git a/tapset/ioblock.stp b/tapset/ioblock.stp index bc64c425..1bc06699 100644 --- a/tapset/ioblock.stp +++ b/tapset/ioblock.stp @@ -78,18 +78,13 @@ function __bio_devname:string(bio:long) global BIO_READ = 0, BIO_WRITE = 1 -/* probe ioblock.request +/** + * probe ioblock.request - Fires whenever making a generic block I/O request. * - * Fires whenever making a generic block I/O request. - * - * Context: - * The process makes block I/O request - * - * Variables: - * devname - block device name - * ino - i-node number of the mapped file - * sector - beginning sector for the entire bio - * flags - see below + * @devname - block device name + * @ino - i-node number of the mapped file + * @sector - beginning sector for the entire bio + * @flags - see below * BIO_UPTODATE 0 ok after I/O completion * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block * BIO_EOF 2 out-out-bounds error @@ -99,20 +94,18 @@ global BIO_READ = 0, BIO_WRITE = 1 * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported * - * rw - binary trace for read/write request - * vcnt - bio vector count which represents number of array element (page, - * offset, length) which make up this I/O request - * idx - offset into the bio vector array - * phys_segments - number of segments in this bio after physical address - * coalescing is performed. - * hw_segments - number of segments after physical and DMA remapping - * hardware coalescing is performed - * size - total size in bytes - * bdev - target block device - * bdev_contains - points to the device object which contains the - * partition (when bio structure represents a partition) - * p_start_sect - points to the start sector of the partition - * structure of the device + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which make up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed + * @hw_segments - number of segments after physical and DMA remapping hardware coalescing is performed + * @size - total size in bytes + * @bdev - target block device + * @bdev_contains - points to the device object which contains the partition (when bio structure represents a partition) + * @p_start_sect - points to the start sector of the partition structure of the device + * + * Context: + * The process makes block I/O request */ probe ioblock.request = kernel.function ("generic_make_request") { @@ -135,19 +128,14 @@ probe ioblock.request = kernel.function ("generic_make_request") p_start_sect = __bio_start_sect($bio) } -/* probe ioblock.end - * - * Fires whenever a block I/O transfer is complete. - * - * Context: - * The process signals the transfer is done. +/** + * probe ioblock.end - Fires whenever a block I/O transfer is complete. * - * Variables: - * devname - block device name - * ino - i-node number of the mapped file - * byte_done - number of bytes transferred - * sector - beginning sector for the entire bio - * flags - see below + * @devname - block device name + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below * BIO_UPTODATE 0 ok after I/O completion * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block * BIO_EOF 2 out-out-bounds error @@ -156,16 +144,16 @@ probe ioblock.request = kernel.function ("generic_make_request") * BIO_BOUNCED 5 bio is a bounce bio * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported - * error - 0 on success - * rw - binary trace for read/write request - * vcnt - bio vector count which represents number of array element (page, - * offset, length) which makes up this I/O request - * idx - offset into the bio vector array - * phys_segments - number of segments in this bio after physical address - * coalescing is performed. - * hw_segments - number of segments after physical and DMA remapping - * hardware coalescing is performed - * size - total size in bytes + * @error - 0 on success + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @hw_segments - number of segments after physical and DMA remapping hardware coalescing is performed + * @size - total size in bytes + * + * Context: + * The process signals the transfer is done. */ probe ioblock.end = kernel.function("bio_endio") { @@ -186,3 +174,142 @@ probe ioblock.end = kernel.function("bio_endio") %) size = $bio->bi_size } + +/** + * probe ioblock_trace.bounce - Fires whenever a buffer bounce is needed for at least one page of a block IO request. + * + * @bio struct bio * + * @q struct request_queue* + * @devname device for which a buffer bounce was needed. + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below + * BIO_UPTODATE 0 ok after I/O completion + * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block + * BIO_EOF 2 out-out-bounds error + * BIO_SEG_VALID 3 nr_hw_seg valid + * BIO_CLONED 4 doesn't own data + * BIO_BOUNCED 5 bio is a bounce bio + * BIO_USER_MAPPED 6 contains user pages + * BIO_EOPNOTSUPP 7 not supported + * @error - 0 on success + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @size - total size in bytes + * + * Context : + * The process creating a block IO request. + */ +probe ioblock_trace.bounce = kernel.trace("block_bio_bounce") +{ + devname = __bio_devname($bio) + ino = __bio_ino($bio) + + bytes_done = $bio->bi_size + sector = $bio->bi_sector + flags = $bio->bi_flags + rw = $bio->bi_rw + vcnt = $bio->bi_vcnt + idx = $bio->bi_idx + phys_segments = $bio->bi_phys_segments + size = $bio->bi_size +} + +/** + * probe ioblock_trace.request - Fires just as a generic block I/O request is created for a bio. + * + * @bio struct bio* for which IO request is to be submitted + * @q struct request_queue* to which the request is to be added + * @devname - block device name + * @ino - i-node number of the mapped file + * @sector - beginning sector for the entire bio + * @flags - see below + * BIO_UPTODATE 0 ok after I/O completion + * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block + * BIO_EOF 2 out-out-bounds error + * BIO_SEG_VALID 3 nr_hw_seg valid + * BIO_CLONED 4 doesn't own data + * BIO_BOUNCED 5 bio is a bounce bio + * BIO_USER_MAPPED 6 contains user pages + * BIO_EOPNOTSUPP 7 not supported + * + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which make up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @size - total size in bytes + * @bdev - target block device + * @bdev_contains - points to the device object which contains the partition (when bio structure represents a partition) + * @p_start_sect - points to the start sector of the partition structure of the device + * + * Context: + * The process makes block I/O request + */ + +probe ioblock_trace.request = kernel.trace("block_bio_queue") +{ + devname = __bio_devname($bio) + ino = __bio_ino($bio) + + bytes_done = $bio->bi_size + error = $error + sector = $bio->bi_sector + flags = $bio->bi_flags + rw = $bio->bi_rw + vcnt = $bio->bi_vcnt + idx = $bio->bi_idx + phys_segments = $bio->bi_phys_segments + size = $bio->bi_size + bdev_contains = $bio->bi_bdev->bd_contains + bdev = $bio->bi_bdev + p_start_sect = __bio_start_sect($bio) +} + +/** + * probe ioblock_trace.end - Fires whenever a block I/O transfer is complete. + * + * @q - request queue on which this bio was queued. + * @devname - block device name + * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred + * @sector - beginning sector for the entire bio + * @flags - see below + * BIO_UPTODATE 0 ok after I/O completion + * BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block + * BIO_EOF 2 out-out-bounds error + * BIO_SEG_VALID 3 nr_hw_seg valid + * BIO_CLONED 4 doesn't own data + * BIO_BOUNCED 5 bio is a bounce bio + * BIO_USER_MAPPED 6 contains user pages + * BIO_EOPNOTSUPP 7 not supported + + * @error - 0 on success + * @rw - binary trace for read/write request + * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request + * @idx - offset into the bio vector array + * @phys_segments - number of segments in this bio after physical address coalescing is performed. + * @size - total size in bytes + * + * Context: + * The process signals the transfer is done. + */ +probe ioblock_trace.end = kernel.trace("block_bio_complete") +{ + q = $q + devname = __bio_devname($bio) + ino = __bio_ino($bio) + + bytes_done = $bio->bi_size + error = $error + + sector = $bio->bi_sector + flags = $bio->bi_flags + rw = $bio->bi_rw + vcnt = $bio->bi_vcnt + idx = $bio->bi_idx + phys_segments = $bio->bi_phys_segments + size = $bio->bi_size +} diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp index 637e2783..ac271f80 100644 --- a/tapset/ioscheduler.stp +++ b/tapset/ioscheduler.stp @@ -68,22 +68,24 @@ probe ioscheduler.elv_next_request.return } /** - * probe ioscheduler.elv_add_request - A request was added to the request queue + * probe ioscheduler.elv_add_request.kp - kprobe based probe to indicate that a request was added to the request queue * @elevator_name: The type of I/O elevator currently enabled + * @q: pointer to request queue * @req: Address of the request * @req_flags: Request flags * @disk_major: Disk major number of the request * @disk_minor: Disk minor number of the request */ // when a request is added to the request queue -probe ioscheduler.elv_add_request - = kernel.function("__elv_add_request") +probe ioscheduler.elv_add_request.kp + = kernel.function("elv_insert") { %( kernel_v >= "2.6.10" %? elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) %: elevator_name = kernel_string($q->elevator->elevator_name) %) + q = $q if($rq == 0) { disk_major = -1 disk_minor = -1 @@ -142,6 +144,189 @@ probe ioscheduler.elv_completed_request %) } +/** + * probe ioscheduler.elv_add_request.tp : tracepoint based probe to indicate a request is added to the request queue. + * @elevator_name : The type of I/O elevator currently enabled. + * @q : Pointer to request queue. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler.elv_add_request.tp + = kernel.trace("block_rq_insert") +{ +q = $q +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +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 +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler.elv_add_request : probe to indicate request is added to the request queue. + * @elevator_name : The type of I/O elevator currently enabled. + * @q : Pointer to request queue. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler.elv_add_request = + ioscheduler.elv_add_request.tp !, ioscheduler.elv_add_request.kp +{} + +/** + * probe ioscheduler_trace.elv_completed_request : Fires when a request is + * completed. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_completed_request + = kernel.trace("block_rq_complete") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +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 +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.elv_issue_request : Fires when a request is + * scheduled. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_issue_request + = kernel.trace("block_rq_issue") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +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 +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.elv_requeue_request : Fires when a request is + * put back on the queue, when the hadware cannot accept more requests. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_requeue_request + = kernel.trace("block_rq_requeue") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +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 +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.elv_abort_request : Fires when a request is aborted. + * @elevator_name : The type of I/O elevator currently enabled. + * @rq : Address of request. + * @rq_flags : Request flags. + * @disk_major : Disk major no of request. + * @disk_minor : Disk minor number of request. + * + */ +probe ioscheduler_trace.elv_abort_request + = kernel.trace("block_rq_abort") +{ +elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +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 +} + +rq_flags = $rq==0? 0:$rq->cmd_flags +} + +/** + * probe ioscheduler_trace.plug - Fires when a request queue is plugged; + * ie, requests in the queue cannot be serviced by block driver. + * @rq_queue : request queue + * + */ +probe ioscheduler_trace.plug = kernel.trace("block_plug") +{ + rq_queue = $q +} + +/** + * probe ioscheduler_trace.unplug_io - Fires when a request queue is unplugged; + * Either, when number of pending requests in the queue exceeds threshold + * or, upon expiration of timer that was activated when queue was plugged. + * @rq_queue : request queue + * + */ +probe ioscheduler_trace.unplug_io = kernel.trace("block_unplug_io") +{ + rq_queue = $q +} + +/** + * probe ioscheduler_trace.unplug_timer - Fires when unplug timer associated + * with a request queue expires. + * @rq_queue : request queue + * + */ +probe ioscheduler_trace.unplug_timer = kernel.trace("block_unplug_timer") +{ + rq_queue = $q +} + function disk_major_from_request:long(var_q:long) %{ /* pure */ struct request_queue *q = (struct request_queue *)((long)THIS->var_q); diff --git a/testsuite/buildok/ioblock_test.stp b/testsuite/buildok/ioblock_test.stp index 4d3dadfa..55237994 100755 --- a/testsuite/buildok/ioblock_test.stp +++ b/testsuite/buildok/ioblock_test.stp @@ -25,3 +25,10 @@ probe ioblock.end { devname, sector, flags, rw, bio_rw_str(rw), vcnt, idx, phys_segments, size, bytes_done, error, ino) %) } + +probe ioblock_trace.* +{ + log(pp()) + printf("%s\t%p\t%d\t%d\t%d\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", + devname, q, sector, flags, rw, bio_rw_str(rw), vcnt, idx, phys_segments, size, bytes_done, error, ino) +} diff --git a/testsuite/buildok/ioscheduler.stp b/testsuite/buildok/ioscheduler.stp index 2d88d2d5..55ef9a0f 100755 --- a/testsuite/buildok/ioscheduler.stp +++ b/testsuite/buildok/ioscheduler.stp @@ -7,3 +7,16 @@ probe ioscheduler.* printf("ppname: %s, elv_name: %s, %d, %d", probefunc(), elevator_name, disk_major, disk_minor) } + +probe ioscheduler_trace.elv* +{ + printf("ppname: %s, request %p, elv_name: %s, %d, %d", probefunc(), + rq, elevator_name, disk_major, disk_minor) +} + +probe ioscheduler_trace.plug, ioscheduler_trace.unplug_io, ioscheduler_trace.unplug_timer +{ + printf("ppname: %s, request %p, elv_name: %s, %d, %d", probefunc(), + rq_queue) +} + -- cgit From b28d67e28087f208ecfd888b4518bb9efb2bf552 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 23 Nov 2009 14:03:33 +0800 Subject: Correct block IO and IO scheduler tapset and test case * tapset/ioblock.stp: Update comment and variables. * testsuite/buildok/ioblock_test.stp: Add parameters. * testsuite/buildok/ioscheduler.stp: Remove redundant parameters. --- tapset/ioblock.stp | 9 +-------- testsuite/buildok/ioblock_test.stp | 4 ++-- testsuite/buildok/ioscheduler.stp | 3 +-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/tapset/ioblock.stp b/tapset/ioblock.stp index 1bc06699..707fad4c 100644 --- a/tapset/ioblock.stp +++ b/tapset/ioblock.stp @@ -178,8 +178,6 @@ probe ioblock.end = kernel.function("bio_endio") /** * probe ioblock_trace.bounce - Fires whenever a buffer bounce is needed for at least one page of a block IO request. * - * @bio struct bio * - * @q struct request_queue* * @devname device for which a buffer bounce was needed. * @ino - i-node number of the mapped file * @bytes_done - number of bytes transferred @@ -193,7 +191,6 @@ probe ioblock.end = kernel.function("bio_endio") * BIO_BOUNCED 5 bio is a bounce bio * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported - * @error - 0 on success * @rw - binary trace for read/write request * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request * @idx - offset into the bio vector array @@ -221,10 +218,9 @@ probe ioblock_trace.bounce = kernel.trace("block_bio_bounce") /** * probe ioblock_trace.request - Fires just as a generic block I/O request is created for a bio. * - * @bio struct bio* for which IO request is to be submitted - * @q struct request_queue* to which the request is to be added * @devname - block device name * @ino - i-node number of the mapped file + * @bytes_done - number of bytes transferred * @sector - beginning sector for the entire bio * @flags - see below * BIO_UPTODATE 0 ok after I/O completion @@ -255,7 +251,6 @@ probe ioblock_trace.request = kernel.trace("block_bio_queue") ino = __bio_ino($bio) bytes_done = $bio->bi_size - error = $error sector = $bio->bi_sector flags = $bio->bi_flags rw = $bio->bi_rw @@ -286,7 +281,6 @@ probe ioblock_trace.request = kernel.trace("block_bio_queue") * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported - * @error - 0 on success * @rw - binary trace for read/write request * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request * @idx - offset into the bio vector array @@ -303,7 +297,6 @@ probe ioblock_trace.end = kernel.trace("block_bio_complete") ino = __bio_ino($bio) bytes_done = $bio->bi_size - error = $error sector = $bio->bi_sector flags = $bio->bi_flags diff --git a/testsuite/buildok/ioblock_test.stp b/testsuite/buildok/ioblock_test.stp index 55237994..21595021 100755 --- a/testsuite/buildok/ioblock_test.stp +++ b/testsuite/buildok/ioblock_test.stp @@ -29,6 +29,6 @@ probe ioblock.end { probe ioblock_trace.* { log(pp()) - printf("%s\t%p\t%d\t%d\t%d\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", - devname, q, sector, flags, rw, bio_rw_str(rw), vcnt, idx, phys_segments, size, bytes_done, error, ino) + printf("%s\t%d\t%d\t%d\t%d\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%p\t%p\t%d\n", + devname, q, sector, flags, rw, bio_rw_str(rw), vcnt, idx, phys_segments, size, bytes_done, ino, p_start_sect, bdev_contains, bdev) } diff --git a/testsuite/buildok/ioscheduler.stp b/testsuite/buildok/ioscheduler.stp index 55ef9a0f..8b377619 100755 --- a/testsuite/buildok/ioscheduler.stp +++ b/testsuite/buildok/ioscheduler.stp @@ -16,7 +16,6 @@ probe ioscheduler_trace.elv* probe ioscheduler_trace.plug, ioscheduler_trace.unplug_io, ioscheduler_trace.unplug_timer { - printf("ppname: %s, request %p, elv_name: %s, %d, %d", probefunc(), - rq_queue) + printf("ppname: %s, request %p", probefunc(), rq_queue) } -- cgit From fad409cab6527b17dcc15a81505113606b8d4ed4 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 23 Nov 2009 16:38:04 +0800 Subject: Tweak cu-decl test * testsuite/systemtap.base/cu-decl.exp: Check utrace. * testsuite/lib/stap_compile.exp: Make catch after wait. --- testsuite/lib/stap_compile.exp | 2 +- testsuite/systemtap.base/cu-decl.exp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/testsuite/lib/stap_compile.exp b/testsuite/lib/stap_compile.exp index c8d44203..8780930e 100644 --- a/testsuite/lib/stap_compile.exp +++ b/testsuite/lib/stap_compile.exp @@ -19,8 +19,8 @@ proc stap_compile { TEST_NAME compile script args } { -re "compilation failed" {incr compile_errors 1; exp_continue} -re "semantic error:" {incr compile_errors 1; exp_continue} } - catch close set res [wait -i $spawn_id] + catch close set res [lindex $res 3] if {($res == 0 && $compile_errors == 0) diff --git a/testsuite/systemtap.base/cu-decl.exp b/testsuite/systemtap.base/cu-decl.exp index 42e683cb..ae06ad85 100644 --- a/testsuite/systemtap.base/cu-decl.exp +++ b/testsuite/systemtap.base/cu-decl.exp @@ -17,7 +17,9 @@ if { $res != "" } { } else { pass "$test target compilation" } - -stap_compile $test 1 "{$script}" - +if {![utrace_p]} { + untested "$test : no kernel utrace support found" +} else { + stap_compile $test 1 "{$script}" +} catch {exec rm $test} -- cgit From d58c711f40a92a0013cd62b6e96c4ae1c54fe045 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 23 Nov 2009 13:30:46 -0500 Subject: Correct tapset/ioscheduler.stp so documentation builds. --- tapset/ioscheduler.stp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp index ac271f80..7f26cf23 100644 --- a/tapset/ioscheduler.stp +++ b/tapset/ioscheduler.stp @@ -145,7 +145,7 @@ probe ioscheduler.elv_completed_request } /** - * probe ioscheduler.elv_add_request.tp : tracepoint based probe to indicate a request is added to the request queue. + * probe ioscheduler.elv_add_request.tp - tracepoint based probe to indicate a request is added to the request queue. * @elevator_name : The type of I/O elevator currently enabled. * @q : Pointer to request queue. * @rq : Address of request. @@ -173,7 +173,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags } /** - * probe ioscheduler.elv_add_request : probe to indicate request is added to the request queue. + * probe ioscheduler.elv_add_request - probe to indicate request is added to the request queue. * @elevator_name : The type of I/O elevator currently enabled. * @q : Pointer to request queue. * @rq : Address of request. @@ -187,7 +187,7 @@ probe ioscheduler.elv_add_request = {} /** - * probe ioscheduler_trace.elv_completed_request : Fires when a request is + * probe ioscheduler_trace.elv_completed_request - Fires when a request is * completed. * @elevator_name : The type of I/O elevator currently enabled. * @rq : Address of request. @@ -214,7 +214,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags } /** - * probe ioscheduler_trace.elv_issue_request : Fires when a request is + * probe ioscheduler_trace.elv_issue_request - Fires when a request is * scheduled. * @elevator_name : The type of I/O elevator currently enabled. * @rq : Address of request. @@ -241,7 +241,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags } /** - * probe ioscheduler_trace.elv_requeue_request : Fires when a request is + * probe ioscheduler_trace.elv_requeue_request - Fires when a request is * put back on the queue, when the hadware cannot accept more requests. * @elevator_name : The type of I/O elevator currently enabled. * @rq : Address of request. @@ -268,7 +268,7 @@ rq_flags = $rq==0? 0:$rq->cmd_flags } /** - * probe ioscheduler_trace.elv_abort_request : Fires when a request is aborted. + * probe ioscheduler_trace.elv_abort_request - Fires when a request is aborted. * @elevator_name : The type of I/O elevator currently enabled. * @rq : Address of request. * @rq_flags : Request flags. -- cgit From 18871ad0ed1c0618dc4c2479eadbcf982b72e6cd Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 23 Nov 2009 14:13:38 -0600 Subject: Fixed tapset reference manual generation. * doc/SystemTap_Tapset_Reference/Makefile.am: Check for file existence before doing compare. * doc/SystemTap_Tapset_Reference/Makefile.in: Regenerated. * tapset/ioblock.stp: Fixed comment so that docs can be built. --- doc/SystemTap_Tapset_Reference/Makefile.am | 2 +- doc/SystemTap_Tapset_Reference/Makefile.in | 2 +- tapset/ioblock.stp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/SystemTap_Tapset_Reference/Makefile.am b/doc/SystemTap_Tapset_Reference/Makefile.am index 454b3331..109aaa9e 100644 --- a/doc/SystemTap_Tapset_Reference/Makefile.am +++ b/doc/SystemTap_Tapset_Reference/Makefile.am @@ -30,7 +30,7 @@ if BUILD_REFDOCS all: $(PDFDOCS) stamp-htmldocs stamp-mandocs tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp') SRCTREE=$(SRCTREE) $(DOCPROC) doc $(abs_srcdir)/tapsets.tmpl > tapsets.xml.new - if cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ + if test -s tapsets.xml && cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ echo tapsets.xml unchanged; \ rm tapsets.xml.new; \ else \ diff --git a/doc/SystemTap_Tapset_Reference/Makefile.in b/doc/SystemTap_Tapset_Reference/Makefile.in index 5059b159..158c9b6b 100644 --- a/doc/SystemTap_Tapset_Reference/Makefile.in +++ b/doc/SystemTap_Tapset_Reference/Makefile.in @@ -470,7 +470,7 @@ uninstall-am: @BUILD_REFDOCS_TRUE@all: $(PDFDOCS) stamp-htmldocs stamp-mandocs @BUILD_REFDOCS_TRUE@tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp') @BUILD_REFDOCS_TRUE@ SRCTREE=$(SRCTREE) $(DOCPROC) doc $(abs_srcdir)/tapsets.tmpl > tapsets.xml.new -@BUILD_REFDOCS_TRUE@ if cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ +@BUILD_REFDOCS_TRUE@ if test -s tapsets.xml && cmp tapsets.xml.new tapsets.xml >/dev/null ; then \ @BUILD_REFDOCS_TRUE@ echo tapsets.xml unchanged; \ @BUILD_REFDOCS_TRUE@ rm tapsets.xml.new; \ @BUILD_REFDOCS_TRUE@ else \ diff --git a/tapset/ioblock.stp b/tapset/ioblock.stp index 707fad4c..761e7df7 100644 --- a/tapset/ioblock.stp +++ b/tapset/ioblock.stp @@ -280,7 +280,7 @@ probe ioblock_trace.request = kernel.trace("block_bio_queue") * BIO_BOUNCED 5 bio is a bounce bio * BIO_USER_MAPPED 6 contains user pages * BIO_EOPNOTSUPP 7 not supported - + * * @rw - binary trace for read/write request * @vcnt - bio vector count which represents number of array element (page, offset, length) which makes up this I/O request * @idx - offset into the bio vector array -- cgit From 90bba7158de040705a101ba1fdf6062866b4b4e9 Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 23 Nov 2009 14:15:20 -0600 Subject: Updated. --- .gitignore | 1 + initscript/.gitignore | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5869f401..e10d5226 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ build-elfutils include-elfutils lib-elfutils stamp-elfutils +dtrace diff --git a/initscript/.gitignore b/initscript/.gitignore index ec0530ab..37416cbb 100644 --- a/initscript/.gitignore +++ b/initscript/.gitignore @@ -1 +1,2 @@ systemtap +stap-server -- cgit