summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
Diffstat (limited to 'tapset')
-rw-r--r--tapset/ChangeLog1
-rw-r--r--tapset/LKET/Changelog7
-rwxr-xr-xtapset/LKET/register_event.stp12
-rwxr-xr-xtapset/LKET/scsi.stp146
-rw-r--r--tapset/scsi.stp6
5 files changed, 57 insertions, 115 deletions
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index a028c79e..49d1ef6f 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,4 +1,5 @@
2006-10-13 Li Guanglei <guanglei@cn.ibm.com>
+ * scsi.stp: add some variables
* scheduler.stp: skip __switch_to on x86_64
2006-10-12 Martin Hunt <hunt@redhat.com>
diff --git a/tapset/LKET/Changelog b/tapset/LKET/Changelog
index 4a85b6cd..ce2b8265 100644
--- a/tapset/LKET/Changelog
+++ b/tapset/LKET/Changelog
@@ -1,3 +1,10 @@
+2006-10-13 Li Guanglei <guanglei@cn.ibm.com>
+ * register_event.stp: be sync with scsi trace hooks
+ * scsi.stp: avoid reference to struct members in
+ embedded c. Use stap variables as more as possible.
+ break scsi_info into four variables.
+ delete cmd_pid from all logging functions
+
2006-10-12 Li Guanglei <guanglei@cn.ibm.com>
* hookid_defs.stp, ioscheduler.stp, register_event.stp:
break the old addevent.ioscheduler.elv_next_request into
diff --git a/tapset/LKET/register_event.stp b/tapset/LKET/register_event.stp
index 4b7b5f05..046af772 100755
--- a/tapset/LKET/register_event.stp
+++ b/tapset/LKET/register_event.stp
@@ -198,18 +198,20 @@ function register_sys_events()
"INT32", "cur_pid")
register_sys_event("addevent.scsi.ioentry", GROUP_SCSI, HOOKID_SCSI_IOENTRY,
- "INT8:INT8:INT8:INT64", "major:minor:sdev_state:request")
+ "INT8:INT8:INT8:INT64", "major:minor:sdev_state:request_addr")
register_sys_event("addevent.scsi.iodispatching", GROUP_SCSI, HOOKID_SCSI_IO_TO_LLD,
- "INT8:INT32:INT8:INT64:INT32:INT64:INT64",
- "sdev_state:scsi_info:data_dir:req_buff:buf_len:cmd_id:request")
+ "INT8:INT8:INT8:INT8:INT8:INT8:INT64:INT32:INT64",
+ "host:channel:lun:dev_id:dev_state:data_dir:reqbuf_addr:reqbuf_len:request_addr")
register_sys_event("addevent.scsi.iodone", GROUP_SCSI, HOOKID_SCSI_IODONE_BY_LLD,
- "INT32:INT8:INT64:INT64", "scsi_info:data_dir:cmd_id:request")
+ "INT8:INT8:INT8:INT8:INT8:INT8:INT64",
+ "host:channel:lun:dev_id:dev_state:data_dir:request_addr")
register_sys_event("addevent.scsi.iocompleted",
GROUP_SCSI, HOOKID_SCSI_IOCOMP_BY_MIDLEVEL,
- "INT32:INT8:INT64:INT32:INT64", "scsi_info:data_dir:cmd_id:bytes:request");
+ "INT8:INT8:INT8:INT8:INT8:INT8:INT64:INT32",
+ "host:channel:lun:dev_id:dev_state:data_dir:request_addr:done_bytes")
register_sys_event("addevent.pagefault", GROUP_PAGEFAULT, HOOKID_PAGEFAULT,
"INT64:INT8", "addr:write")
diff --git a/tapset/LKET/scsi.stp b/tapset/LKET/scsi.stp
index 1c4c5ac8..a1b76102 100755
--- a/tapset/LKET/scsi.stp
+++ b/tapset/LKET/scsi.stp
@@ -40,7 +40,7 @@ probe addevent.scsi.ioentry
probe _addevent.scsi.ioentry
= scsi.ioentry
{
- log_scsi_ioentry(HOOKID_SCSI_IOENTRY, $q, $req)
+ log_scsi_ioentry(disk_major, disk_minor, device_state, req_addr)
}
/* Dispatch a command to the low-level driver. */
@@ -53,7 +53,8 @@ probe addevent.scsi.iodispatching
probe _addevent.scsi.iodispatching
= scsi.iodispatching
{
- log_scsi_dispatch(HOOKID_SCSI_IO_TO_LLD, $cmd)
+ log_scsi_dispatch(host_no, channel, lun, dev_id, device_state,
+ data_direction, request_buffer, request_bufflen, req_addr)
}
/* I/O is done by low-level driver*/
@@ -70,8 +71,9 @@ probe _addevent.scsi.iodone
* when the timer is inactive. But there's a gap between
* the checking and the actual calling of scsi_delete_timer.
*/
- if( scsi_timer_pending($cmd) == 1) {
- log_scsi_iodone_extra(HOOKID_SCSI_IODONE_BY_LLD, $cmd)
+ if( scsi_timer_pending == 1) {
+ log_scsi_iodone_extra(host_no, channel, lun,
+ dev_id, device_state, data_direction, req_addr)
}
}
@@ -85,127 +87,53 @@ probe addevent.scsi.iocompleted
probe _addevent.scsi.iocompleted
= scsi.iocompleted
{
- log_scsi_iocompleted(HOOKID_SCSI_IOCOMP_BY_MIDLEVEL, $cmd, $good_bytes)
+ log_scsi_iocompleted(host_no, channel, lun, dev_id, device_state,
+ data_direction, req_addr, goodbytes)
}
/* log the info about scsi io entry */
-function log_scsi_ioentry(var_id:long, var_q:long, var_rq:long)
+function log_scsi_ioentry(major:long, minor:long, dev_state:long, req_addr:long)
%{
- struct request_queue *q = (struct request_queue *)((long)THIS->var_q);
- struct request *rq = (struct request *)((long)THIS->var_rq);
- struct scsi_device *sdev = (struct scsi_device *)(q->queuedata);
-
/*
- major|minor|scsi_device_state|request
+ major|minor|scsi_device_state|request_addr
*/
- _lket_trace(_GROUP_SCSI, THIS->var_id, "%1b%1b%1b%8b", (_FMT_)rq->rq_disk->major,
- (_FMT_)rq->rq_disk->first_minor, (_FMT_)sdev->sdev_state, (int64_t)((long)rq));
+ _lket_trace(_GROUP_SCSI, _HOOKID_SCSI_IOENTRY, "%1b%1b%1b%8b",
+ THIS->major, THIS->minor, THIS->dev_state, THIS->req_addr);
%}
-/* log the info about scsi_dispatching_cmd
- *
- *
- * Now we can use cmd->serial_number as cmd identifier
- * But according to the comments of struct scsi_cmnd, it's
- * a better to use cmd->pid since cmd->serial_number will be killed one
- * day in the future
- *
- * But when scsi_dispatch_cmd is called, cmd->serial_number is still not
- * initialized.
- *
- * For kernel >= 2.6.12, it will be set later by calling scsi_cmd_get_serial.
- * So I choose to record cmd->device->host->cmd_pid. But there is a gap between
- * the time when cmd->device->host->cmd_pid is retrieved at the beginning of
- * scsi_dispatch_cmd and the actual calling of scsi_cmd_get_serial.
- *
- * For kernel <=2.6.9, it will be set by a global counter.
- *
- * NOTE: The kernel version need further investigation.
- */
-
-/* sdev_state|scsi_info|data_direction|request_buffer|request_bufflen|cmd_identifier| */
-%( kernel_v >= "2.6.12" %?
-function log_scsi_dispatch(var_id:long, var:long)
-%{
- struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
- int scsi_info;
-
- scsi_info = ((cmd->device->host->host_no & 0xFF) << 24) |
- ((cmd->device->channel & 0xFF) << 16) |
- ((cmd->device->lun & 0xFF) << 8) |
- (cmd->device->id & 0xFF);
-
- /* sdev_state|scsi_info|data_direction|cmd_identifier|request_buffer|request_bufflen|request
- *
- * sdev_state could be: SDEV_DEL, SDEV_BLOCK or something else.
- * Instead of skipping SDEV_DEL & SDEV_BLOCK, I choose to log them
- */
-
- _lket_trace(_GROUP_SCSI, THIS->var_id, "%1b%4b%1b%8b%4b%8b%8b",
- (_FMT_)cmd->device->sdev_state, (_FMT_)scsi_info,
- (_FMT_)cmd->sc_data_direction, (int64_t)((long)cmd->request_buffer),
- (_FMT_)cmd->request_bufflen, (int64_t)cmd->device->host->cmd_pid,
- (int64_t)((long)(cmd->request)));
-%}
-%:
+/* log the info about scsi_dispatching_cmd */
-function log_scsi_dispatch(var_id:long, var:long)
+function log_scsi_dispatch(host_no:long, channel:long, lun:long, dev_id:long,
+ device_state:long, data_direction:long, request_buffer:long,
+ request_bufflen:long, req_addr:long)
%{
- struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
- int scsi_info;
-
- scsi_info = ((cmd->device->host->host_no & 0xFF) << 24) |
- ((cmd->device->channel & 0xFF) << 16) |
- ((cmd->device->lun & 0xFF) << 8) |
- (cmd->device->id & 0xFF);
-
- /* sdev_state|scsi_info|data_direction|cmd_identifier|request_buffer|request_bufflen|request
- *
- * sdev_state could be: SDEV_DEL, SDEV_BLOCK or something else.
- * Instead of skipping SDEV_DEL & SDEV_BLOCK, I choose to log them
- */
-
- /* systemTap failed to access global variable. So I temporarily use 0.
- _stp_printf("%d|", scsi_pid);
- */
- _lket_trace(_GROUP_SCSI, THIS->var_id, "%1b%4b%1b%8b%4b%8b%8b",
- (_FMT_)cmd->device->sdev_state, (_FMT_)scsi_info,
- (_FMT_)cmd->sc_data_direction, (int64_t)((long)cmd->request_buffer),
- (_FMT_)cmd->request_bufflen, (int64_t)0, (int64_t)((long)(cmd->request)));
+ _lket_trace(_GROUP_SCSI, _HOOKID_SCSI_IO_TO_LLD, "%1b%1b%1b%1b%1b%1b%8b%4b%8b",
+ THIS->host_no, THIS->channel, THIS->lun, THIS->dev_id,
+ THIS->device_state, THIS->data_direction, THIS->request_buffer,
+ THIS->request_bufflen, THIS->req_addr);
%}
-%)
/* log the info about scsi_done */
-function log_scsi_iodone_extra(var_id:long, var:long)
+function log_scsi_iodone_extra(host_no:long, channel:long, lun:long,
+ dev_id:long, device_state:long, data_direction:long,
+ req_addr:long)
%{
- struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
- int scsi_info;
-
- scsi_info = ((cmd->device->host->host_no & 0xFF) << 24) |
- ((cmd->device->channel & 0xFF) << 16) |
- ((cmd->device->lun & 0xFF) << 8) |
- (cmd->device->id & 0xFF);
-
- /* scsi_info|data_direction|cmd_identifier|request */
- _lket_trace(_GROUP_SCSI, THIS->var_id, "%4b%1b%8b%8b", (_FMT_)scsi_info,
- (_FMT_)cmd->sc_data_direction, (int64_t)cmd->pid,
- (int64_t)((long)(cmd->request)));
+ _lket_trace(_GROUP_SCSI, _HOOKID_SCSI_IODONE_BY_LLD, "%1b%1b%1b%1b%1b%1b%8b",
+ THIS->host_no, THIS->channel, THIS->lun, THIS->dev_id,
+ THIS->device_state, THIS->data_direction, THIS->req_addr);
%}
/* log the info about scsi_dispatching_cmd */
-function log_scsi_iocompleted(var_id:long, var_cmd:long, var_goodbytes:long)
+function log_scsi_iocompleted(host_no:long, channel:long, lun:long, dev_id:long,
+ device_state:long, data_direction:long, req_addr:long, goodbytes:long)
%{
- struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var_cmd);
- int scsi_info;
- unsigned long goodbytes = (unsigned long)(THIS->var_goodbytes);
-
- scsi_info = ((cmd->device->host->host_no & 0xFF) << 24) |
- ((cmd->device->channel & 0xFF) << 16) |
- ((cmd->device->lun & 0xFF) << 8) |
- (cmd->device->id & 0xFF);
-
- /* scsi_info|data_direction|cmd_identifier|goodbytes|request */
- _lket_trace(_GROUP_SCSI, THIS->var_id, "%4b%1b%8b%4b%8b", (_FMT_)scsi_info,
- (_FMT_)cmd->sc_data_direction, (int64_t)cmd->pid, (_FMT_)goodbytes,
- (int64_t)((long)(cmd->request)));
+ _lket_trace(_GROUP_SCSI, _HOOKID_SCSI_IOCOMP_BY_MIDLEVEL,
+ "%1b%1b%1b%1b%1b%1b%8b%4b", THIS->host_no, THIS->channel,
+ THIS->lun, THIS->dev_id, THIS->device_state, THIS->data_direction,
+ THIS->req_addr, THIS->goodbytes);
%}
+
+probe never
+{
+ printf("%d\n", GROUP_SCSI)
+}
diff --git a/tapset/scsi.stp b/tapset/scsi.stp
index 0cd74be2..f1c449fa 100644
--- a/tapset/scsi.stp
+++ b/tapset/scsi.stp
@@ -22,6 +22,7 @@ probe scsi.ioentry
disk_major = $req->rq_disk->major
disk_minor = $req->rq_disk->first_minor
device_state = get_devstate_from_req($q)
+ req_addr = $req
}
/* Dispatch a command to the low-level driver. */
@@ -36,7 +37,8 @@ probe scsi.iodispatching
device_state = $cmd->device->sdev_state
data_direction = $cmd->sc_data_direction
request_buffer = $cmd->request_buffer
- req_bufflen = $cmd->request_bufflen
+ request_bufflen = $cmd->request_bufflen
+ req_addr = $cmd->request
}
/* I/O is done by low-level driver*/
@@ -49,6 +51,7 @@ probe scsi.iodone
dev_id = $cmd->device->id
device_state = $cmd->device->sdev_state
data_direction = $cmd->sc_data_direction
+ req_addr = $cmd->request
scsi_timer_pending = scsi_timer_pending($cmd);
}
@@ -62,6 +65,7 @@ probe scsi.iocompleted
dev_id = $cmd->device->id
device_state = $cmd->device->sdev_state
data_direction = $cmd->sc_data_direction
+ req_addr = $cmd->request
goodbytes = $good_bytes
}