* [PATCH] Update SCSI tapset
@ 2009-12-02 22:13 Andre Detsch
2009-12-18 17:19 ` Frank Ch. Eigler
2009-12-22 18:13 ` K.Prasad
0 siblings, 2 replies; 5+ messages in thread
From: Andre Detsch @ 2009-12-02 22:13 UTC (permalink / raw)
To: systemtap
This patch updates the scsi.stp tapset, as long as the correspondent testcase.
Changes are:
* Inclusion of two new probes: scsi.set_state and scsi.ioexecute
* device_state and data_direction values are now available in string
form, reflecting the enum identificator, instead of its integer id
* Minor fix in scsi.iodispatching documentation: "req_bufflen" is actually
called "request_bufflen"
* Testcase now prints not only the values, but also the name of the fields
* Some housekeeping, such as white space and tabulation fixes
Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Index: systemtap-1.0/tapset/scsi.stp
===================================================================
--- systemtap-1.0.orig/tapset/scsi.stp 2009-12-02 15:27:01.000000000 -0200
+++ systemtap-1.0/tapset/scsi.stp 2009-12-02 16:51:53.000000000 -0200
@@ -1,12 +1,12 @@
// scsi tapset
-// Copyright (C) 2005, 2006 IBM Corp.
+// Copyright (C) 2005, 2006, 2009 IBM Corp.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
// <tapsetdescription>
-// This family of probe points is used to probe SCSI activities.
+// This family of probe points is used to probe SCSI activities.
// </tapsetdescription>
%{
#include <linux/types.h>
@@ -17,13 +17,38 @@
#include <linux/blkdev.h>
%}
+function describe_data_direction:string(state:long)
+%{ /* pure */
+ switch ((long)THIS->state) {
+ case DMA_BIDIRECTIONAL: strlcpy(THIS->__retvalue, "BIDIRECTIONAL", MAXSTRINGLEN); break;
+ case DMA_TO_DEVICE: strlcpy(THIS->__retvalue, "TO_DEVICE", MAXSTRINGLEN); break;
+ case DMA_FROM_DEVICE: strlcpy(THIS->__retvalue, "FROM_DEVICE", MAXSTRINGLEN); break;
+ case DMA_NONE: strlcpy(THIS->__retvalue, "NONE", MAXSTRINGLEN); break;
+ default: strlcpy(THIS->__retvalue, "[INVALID]", MAXSTRINGLEN);
+ }
+%}
+
+function describe_device_state:string(state:long)
+%{ /* pure */
+ switch ((long)THIS->state) {
+ case SDEV_CREATED: strlcpy(THIS->__retvalue, "CREATED", MAXSTRINGLEN); break;
+ case SDEV_RUNNING: strlcpy(THIS->__retvalue, "RUNNING", MAXSTRINGLEN); break;
+ case SDEV_CANCEL: strlcpy(THIS->__retvalue, "CANCEL", MAXSTRINGLEN); break;
+ case SDEV_DEL: strlcpy(THIS->__retvalue, "DEL", MAXSTRINGLEN); break;
+ case SDEV_QUIESCE: strlcpy(THIS->__retvalue, "QUIESCE", MAXSTRINGLEN); break;
+ case SDEV_OFFLINE: strlcpy(THIS->__retvalue, "OFFLINE", MAXSTRINGLEN); break;
+ case SDEV_BLOCK: strlcpy(THIS->__retvalue, "BLOCK", MAXSTRINGLEN); break;
+ case SDEV_CREATED_BLOCK: strlcpy(THIS->__retvalue, "CREATED_BLOCK", MAXSTRINGLEN); break;
+ default: strlcpy(THIS->__retvalue, "[INVALID]", MAXSTRINGLEN);
+ }
+%}
/**
* probe scsi.ioentry - Prepares a SCSI mid-layer request
* @disk_major: The major number of the disk (-1 if no information)
* @disk_minor: The minor number of the disk (-1 if no information)
- * @device_state: The current state of the device.
+ * @device_state: The current state of the device
+ * @device_state_str: The current state of the device, as a string
*/
-// FIXME describe the device_state
probe scsi.ioentry
= module("scsi_mod").function("scsi_prep_fn@drivers/scsi/scsi_lib.c")!,
kernel.function("scsi_prep_fn@drivers/scsi/scsi_lib.c")?
@@ -36,6 +61,7 @@ probe scsi.ioentry
disk_minor = $req->rq_disk->first_minor
}
device_state = get_devstate_from_req($q)
+ device_state_str = describe_device_state(device_state)
req_addr = $req
}
@@ -45,24 +71,27 @@ probe scsi.ioentry
* @channel: The channel number
* @lun: The lun number
* @dev_id: The scsi device id
- * @device_state: The current state of the device.
- * @data_direction: The data_direction specifies whether this command is from/to the device.
+ * @device_state: The current state of the device
+ * @device_state_str: The current state of the device, as a string
+ * @data_direction: The data_direction specifies whether this command is from/to the device
* 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE),
* 2 (DMA_FROM_DEVICE), 3 (DMA_NONE)
+ * @data_direction_str: Data direction, as a string
* @request_buffer: The request buffer address
- * @req_bufflen: The request buffer length
+ * @request_bufflen: The request buffer length
*/
probe scsi.iodispatching
= module("scsi_mod").function("scsi_dispatch_cmd@drivers/scsi/scsi.c")!,
kernel.function("scsi_dispatch_cmd@drivers/scsi/scsi.c")?
{
-
host_no = $cmd->device->host->host_no
channel = $cmd->device->channel
lun = $cmd->device->lun
dev_id = $cmd->device->id
device_state = $cmd->device->sdev_state
+ device_state_str = describe_device_state(device_state)
data_direction = $cmd->sc_data_direction
+ data_direction_str = describe_data_direction(data_direction)
%( kernel_v >= "2.6.25" %?
request_buffer = $cmd->sdb->table->sgl
request_bufflen = $cmd->sdb->length
@@ -74,14 +103,16 @@ probe scsi.iodispatching
}
/**
- * probe scsi.iodone - SCSI command completed by low level driver and enqueued into the done queue.
+ * probe scsi.iodone - SCSI command completed by low level driver and enqueued into the done queue.
* @host_no: The host number
* @channel: The channel number
* @lun: The lun number
* @dev_id: The scsi device id
* @device_state: The current state of the device
+ * @device_state_str: The current state of the device, as a string
* @data_direction: The data_direction specifies whether this command is
* from/to the device.
+ * @data_direction_str: Data direction, as a string
*/
probe scsi.iodone
= module("scsi_mod").function("scsi_done@drivers/scsi/scsi.c")!,
@@ -93,7 +124,9 @@ probe scsi.iodone
lun = $cmd->device->lun
dev_id = $cmd->device->id
device_state = $cmd->device->sdev_state
+ device_state_str = describe_device_state(device_state)
data_direction = $cmd->sc_data_direction
+ data_direction_str = describe_data_direction(data_direction)
req_addr = $cmd->request
scsi_timer_pending = scsi_timer_pending($cmd);
}
@@ -105,9 +138,11 @@ probe scsi.iodone
* @lun: The lun number
* @dev_id: The scsi device id
* @device_state: The current state of the device
+ * @device_state_str: The current state of the device, as a string
* @data_direction: The data_direction specifies whether this command is from/to
* the device
- * @goodbytes: The bytes completed.
+ * @data_direction_str: Data direction, as a string
+ * @goodbytes: The bytes completed
*/
// mid-layer processes the completed IO
probe scsi.iocompleted
@@ -119,23 +154,25 @@ probe scsi.iocompleted
lun = $cmd->device->lun
dev_id = $cmd->device->id
device_state = $cmd->device->sdev_state
+ device_state_str = describe_device_state(device_state)
data_direction = $cmd->sc_data_direction
+ data_direction_str = describe_data_direction(data_direction)
req_addr = $cmd->request
goodbytes = $good_bytes
}
function scsi_timer_pending:long(var:long)
%{ /* pure */
- struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
+ struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
- THIS->__retvalue = timer_pending(&cmd->eh_timeout); /* FIXME: deref hazard! */
+ THIS->__retvalue = timer_pending(&cmd->eh_timeout); /* FIXME: deref hazard! */
#else
- struct request *req;
- struct request_queue *rq;
- req = (struct request *)kread(&cmd->request);
- rq = (struct request_queue *)kread(&req->q);
- THIS->__retvalue = timer_pending(&rq->timeout); /* FIXME: deref hazard! */
- CATCH_DEREF_FAULT();
+ struct request *req;
+ struct request_queue *rq;
+ req = (struct request *)kread(&cmd->request);
+ rq = (struct request_queue *)kread(&req->q);
+ THIS->__retvalue = timer_pending(&rq->timeout); /* FIXME: deref hazard! */
+ CATCH_DEREF_FAULT();
#endif
%}
@@ -144,3 +181,63 @@ function get_devstate_from_req:long(var:
sdev = @cast(var, "request_queue", "kernel:scsi_mod")->queuedata
return @cast(sdev, "scsi_device", "kernel:scsi_mod")->sdev_state
}
+
+/**
+ * probe scsi.ioexecute - Create mid-layer SCSI request and wait for the result
+ * @host_no: The host number
+ * @channel: The channel number
+ * @lun: The lun number
+ * @dev_id: The scsi device id
+ * @device_state: The current state of the device
+ * @device_state_str: The current state of the device, as a string
+ * @data_direction: The data_direction specifies whether this command is
+ * from/to the device.
+ * @data_direction_str: Data direction, as a string
+ * @request_buffer: The data buffer address
+ * @request_bufflen: The data buffer buffer length
+ * @timeout: Request timeout in seconds
+ * @retries: Number of times to retry request
+ */
+probe scsi.ioexecute
+ = module("scsi_mod").function("scsi_execute@drivers/scsi/scsi_lib.c")!,
+ kernel.function("scsi_execute@drivers/scsi/scsi_lib.c")?
+{
+ host_no = $sdev->host->host_no
+ channel = $sdev->channel
+ lun = $sdev->lun
+ dev_id = $sdev->id
+ device_state = $sdev->sdev_state
+ device_state_str = describe_device_state(device_state)
+ data_direction = $data_direction
+ data_direction_str = describe_data_direction(data_direction)
+ request_buffer = $buffer
+ request_bufflen = $bufflen
+ timeout = $timeout
+ retries = $retries
+}
+
+/**
+ * probe scsi.set_state - Order SCSI device state change
+ * @host_no: The host number
+ * @channel: The channel number
+ * @lun: The lun number
+ * @dev_id: The scsi device id
+ * @old_state: The current state of the device
+ * @old_state_str: The current state of the device, as a string
+ * @state: The new state of the device
+ * @state_str: The new state of the device, as a string
+ */
+probe scsi.set_state
+ = module("scsi_mod").function("scsi_device_set_state@drivers/scsi/scsi_lib.c")!,
+ kernel.function("scsi_device_set_state@drivers/scsi/scsi_lib.c")?
+{
+ state = $state
+ state_str = describe_device_state(state)
+
+ host_no = $sdev->host->host_no
+ channel = $sdev->channel
+ lun = $sdev->lun
+ dev_id = $sdev->id
+ old_state = $sdev->sdev_state
+ old_state_str = describe_device_state(old_state)
+}
Index: systemtap-1.0/testsuite/buildok/scsi.stp
===================================================================
--- systemtap-1.0.orig/testsuite/buildok/scsi.stp 2009-12-02 15:50:22.000000000 -0200
+++ systemtap-1.0/testsuite/buildok/scsi.stp 2009-12-02 15:54:52.000000000 -0200
@@ -15,29 +15,41 @@ fi
stap -p4 - << EOF
probe scsi.ioentry
{
- printf("ppname: %s, %d, %d, %d\n", probefunc(),
- disk_major, disk_minor, device_state)
+ printf("%20s, disk_major=%d, disk_minor=%d, device_state=%s\n",
+ probefunc(), disk_major, disk_minor, device_state_str)
}
probe scsi.iodispatching
{
- printf("ppname: %s, %d, %d, %d, %d, %d, %d, %p, %d\n", probefunc(),
- host_no, channel, lun, dev_id, device_state, data_direction,
- request_buffer, request_bufflen)
+ printf("%20s, host_no=%d, channel=%d, lun=%d, dev_id=%d, device_state=%s, data_direction=%s, request_buffer=%p, request_bufflen=%d\n",
+ probefunc(), host_no, channel, lun, dev_id, device_state_str,
+ data_direction_str, request_buffer, request_bufflen)
}
-
probe scsi.iodone
{
- printf("ppname: %s, %d, %d, %d, %d, %d, %d, %d\n", probefunc(),
- host_no, channel, lun, dev_id, device_state, data_direction,
- scsi_timer_pending)
+ printf("%20s, host_no=%d, channel=%d, lun=%d, dev_id=%d, device_state=%s, data_direction=%s, scsi_timer_pending=%d\n",
+ probefunc(), host_no, channel, lun, dev_id, device_state_str,
+ data_direction_str, scsi_timer_pending)
}
probe scsi.iocompleted
{
- printf("ppname: %s, %d, %d, %d, %d, %d, %d, %d\n", probefunc(),
- host_no, channel, lun, dev_id, device_state, data_direction,
- goodbytes)
+ printf("%20s, host_no=%d, channel=%d, lun=%d, dev_id=%d, device_state=%s, data_direction=%s, goodbytes=%d\n\n",
+ probefunc(), host_no, channel, lun, dev_id, device_state_str,
+ data_direction_str, goodbytes)
+}
+
+probe scsi.set_state
+{
+ printf("%20s, host_no=%d, channel=%d, lun=%d, dev_id=%d, old_state=%s, state=%s\n",
+ probefunc(), host_no, channel, lun, dev_id, old_state_str, state_str)
+}
+
+probe scsi.ioexecute
+{
+ printf("%20s, host_no=%d, channel=%d, lun=%d, dev_id=%d, device_state=%s, data_direction=%s, request_buffer=%p, request_bufflen=%d retries=%d, timeout=%d\n",
+ probefunc(),host_no, channel, lun, dev_id, device_state_str,
+ data_direction_str, request_buffer, request_bufflen, retries, timeout)
}
EOF
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update SCSI tapset
2009-12-02 22:13 [PATCH] Update SCSI tapset Andre Detsch
@ 2009-12-18 17:19 ` Frank Ch. Eigler
2009-12-23 18:57 ` Andre Detsch
2009-12-22 18:13 ` K.Prasad
1 sibling, 1 reply; 5+ messages in thread
From: Frank Ch. Eigler @ 2009-12-18 17:19 UTC (permalink / raw)
To: Andre Detsch; +Cc: systemtap
Andre Detsch <adetsch@br.ibm.com> writes:
> This patch updates the scsi.stp tapset, as long as the correspondent testcase.
> [...]
> Changes are:
> * Inclusion of two new probes: scsi.set_state and scsi.ioexecute
> * device_state and data_direction values are now available in string
> form, reflecting the enum identificator, instead of its integer id
> * Minor fix in scsi.iodispatching documentation: "req_bufflen" is actually
> called "request_bufflen"
> * Testcase now prints not only the values, but also the name of the fields
> * Some housekeeping, such as white space and tabulation fixes
> [...]
Looks good to me. Is the existing scsi-related example (iostat-scsi)
a sufficient showcase of this tapset?
- FChE
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update SCSI tapset
2009-12-02 22:13 [PATCH] Update SCSI tapset Andre Detsch
2009-12-18 17:19 ` Frank Ch. Eigler
@ 2009-12-22 18:13 ` K.Prasad
1 sibling, 0 replies; 5+ messages in thread
From: K.Prasad @ 2009-12-22 18:13 UTC (permalink / raw)
To: Andre Detsch; +Cc: systemtap
On Wed, Dec 02, 2009 at 08:12:53PM -0200, Andre Detsch wrote:
> This patch updates the scsi.stp tapset, as long as the correspondent testcase.
>
> Changes are:
> * Inclusion of two new probes: scsi.set_state and scsi.ioexecute
> * device_state and data_direction values are now available in string
> form, reflecting the enum identificator, instead of its integer id
> * Minor fix in scsi.iodispatching documentation: "req_bufflen" is actually
> called "request_bufflen"
> * Testcase now prints not only the values, but also the name of the fields
> * Some housekeeping, such as white space and tabulation fixes
>
> Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
>
Hi Andre,
This patch is committed to systemtap git tree through commit
82acd39eeb4e04fc2359cb4ce1a0834f0d7769cc.
Thanks,
K.Prasad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update SCSI tapset
2009-12-18 17:19 ` Frank Ch. Eigler
@ 2009-12-23 18:57 ` Andre Detsch
2009-12-23 20:56 ` Frank Ch. Eigler
0 siblings, 1 reply; 5+ messages in thread
From: Andre Detsch @ 2009-12-23 18:57 UTC (permalink / raw)
To: Frank Ch. Eigler; +Cc: systemtap
Frank Ch. Eigler wrote:
> Andre Detsch <adetsch@br.ibm.com> writes:
>
>> This patch updates the scsi.stp tapset, as long as the
>> correspondent testcase. [...]
> Looks good to me. Is the existing scsi-related example (iostat-scsi)
> a sufficient showcase of this tapset?
iostat-scsi example does not use the scsi.stp tapset. It references the
kernel functions directly, and is focused on scsi disk and tape (sd_*, st_*).
scsi.stp probes, on the other hand, are related to more generic mid-layer SCSI
calls. Currently, the only usage example is "testsuite/buildok/scsi.stp". It
covers all tapsets/scsi.stp probes. If it is good to have something inside
testsuite/systemtap.examples/io/, maybe moving or copying content from
testsuite/buildok/scsi.stp, I can provide a patch.
--
André Detsch
Kernel Software Engineer - Network Device Drivers
Linux Technology Center Brazil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Update SCSI tapset
2009-12-23 18:57 ` Andre Detsch
@ 2009-12-23 20:56 ` Frank Ch. Eigler
0 siblings, 0 replies; 5+ messages in thread
From: Frank Ch. Eigler @ 2009-12-23 20:56 UTC (permalink / raw)
To: Andre Detsch; +Cc: systemtap
Hi -
On Wed, Dec 23, 2009 at 04:57:32PM -0200, Andre Detsch wrote:
> [...] Currently, the only usage example is
> "testsuite/buildok/scsi.stp". It covers all tapsets/scsi.stp
> probes. If it is good to have something inside
> testsuite/systemtap.examples/io/, maybe moving or copying content
> from testsuite/buildok/scsi.stp [...]
We have heard interest in probe scripts that focus in on *errors*,
specifically to display recent history of I/O up to the point of a
low-level error associated with the device. Do you think you could
write something like that?
- FChE
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-12-23 20:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-02 22:13 [PATCH] Update SCSI tapset Andre Detsch
2009-12-18 17:19 ` Frank Ch. Eigler
2009-12-23 18:57 ` Andre Detsch
2009-12-23 20:56 ` Frank Ch. Eigler
2009-12-22 18:13 ` K.Prasad
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).