diff options
| -rw-r--r-- | drivers/scsi/Makefile | 1 | ||||
| -rw-r--r-- | drivers/scsi/scsi.c | 6 | ||||
| -rw-r--r-- | drivers/scsi/scsi_error.c | 4 | ||||
| -rw-r--r-- | drivers/scsi/scsi_trace.c | 185 | ||||
| -rw-r--r-- | include/trace/events/scsi.h | 328 | ||||
| -rw-r--r-- | kernel/trace/trace_output.c | 1 |
6 files changed, 525 insertions, 0 deletions
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 92a8c500b23..1c7ac49be64 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
| @@ -162,6 +162,7 @@ scsi_mod-y += scsi_scan.o scsi_sysfs.o scsi_devinfo.o | |||
| 162 | scsi_mod-$(CONFIG_SCSI_NETLINK) += scsi_netlink.o | 162 | scsi_mod-$(CONFIG_SCSI_NETLINK) += scsi_netlink.o |
| 163 | scsi_mod-$(CONFIG_SYSCTL) += scsi_sysctl.o | 163 | scsi_mod-$(CONFIG_SYSCTL) += scsi_sysctl.o |
| 164 | scsi_mod-$(CONFIG_SCSI_PROC_FS) += scsi_proc.o | 164 | scsi_mod-$(CONFIG_SCSI_PROC_FS) += scsi_proc.o |
| 165 | scsi_mod-y += scsi_trace.o | ||
| 165 | 166 | ||
| 166 | scsi_tgt-y += scsi_tgt_lib.o scsi_tgt_if.o | 167 | scsi_tgt-y += scsi_tgt_lib.o scsi_tgt_if.o |
| 167 | 168 | ||
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1c08f616465..ad0ed212db4 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
| @@ -67,6 +67,9 @@ | |||
| 67 | #include "scsi_priv.h" | 67 | #include "scsi_priv.h" |
| 68 | #include "scsi_logging.h" | 68 | #include "scsi_logging.h" |
| 69 | 69 | ||
| 70 | #define CREATE_TRACE_POINTS | ||
| 71 | #include <trace/events/scsi.h> | ||
| 72 | |||
| 70 | static void scsi_done(struct scsi_cmnd *cmd); | 73 | static void scsi_done(struct scsi_cmnd *cmd); |
| 71 | 74 | ||
| 72 | /* | 75 | /* |
| @@ -747,10 +750,12 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | |||
| 747 | cmd->result = (DID_NO_CONNECT << 16); | 750 | cmd->result = (DID_NO_CONNECT << 16); |
| 748 | scsi_done(cmd); | 751 | scsi_done(cmd); |
| 749 | } else { | 752 | } else { |
| 753 | trace_scsi_dispatch_cmd_start(cmd); | ||
| 750 | rtn = host->hostt->queuecommand(cmd, scsi_done); | 754 | rtn = host->hostt->queuecommand(cmd, scsi_done); |
| 751 | } | 755 | } |
| 752 | spin_unlock_irqrestore(host->host_lock, flags); | 756 | spin_unlock_irqrestore(host->host_lock, flags); |
| 753 | if (rtn) { | 757 | if (rtn) { |
| 758 | trace_scsi_dispatch_cmd_error(cmd, rtn); | ||
| 754 | if (rtn != SCSI_MLQUEUE_DEVICE_BUSY && | 759 | if (rtn != SCSI_MLQUEUE_DEVICE_BUSY && |
| 755 | rtn != SCSI_MLQUEUE_TARGET_BUSY) | 760 | rtn != SCSI_MLQUEUE_TARGET_BUSY) |
| 756 | rtn = SCSI_MLQUEUE_HOST_BUSY; | 761 | rtn = SCSI_MLQUEUE_HOST_BUSY; |
| @@ -781,6 +786,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | |||
| 781 | */ | 786 | */ |
| 782 | static void scsi_done(struct scsi_cmnd *cmd) | 787 | static void scsi_done(struct scsi_cmnd *cmd) |
| 783 | { | 788 | { |
| 789 | trace_scsi_dispatch_cmd_done(cmd); | ||
| 784 | blk_complete_request(cmd->request); | 790 | blk_complete_request(cmd->request); |
| 785 | } | 791 | } |
| 786 | 792 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 33175974b55..f31d868f936 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | #include "scsi_logging.h" | 39 | #include "scsi_logging.h" |
| 40 | #include "scsi_transport_api.h" | 40 | #include "scsi_transport_api.h" |
| 41 | 41 | ||
| 42 | #include <trace/events/scsi.h> | ||
| 43 | |||
| 42 | #define SENSE_TIMEOUT (10*HZ) | 44 | #define SENSE_TIMEOUT (10*HZ) |
| 43 | 45 | ||
| 44 | /* | 46 | /* |
| @@ -52,6 +54,7 @@ | |||
| 52 | void scsi_eh_wakeup(struct Scsi_Host *shost) | 54 | void scsi_eh_wakeup(struct Scsi_Host *shost) |
| 53 | { | 55 | { |
| 54 | if (shost->host_busy == shost->host_failed) { | 56 | if (shost->host_busy == shost->host_failed) { |
| 57 | trace_scsi_eh_wakeup(shost); | ||
| 55 | wake_up_process(shost->ehandler); | 58 | wake_up_process(shost->ehandler); |
| 56 | SCSI_LOG_ERROR_RECOVERY(5, | 59 | SCSI_LOG_ERROR_RECOVERY(5, |
| 57 | printk("Waking error handler thread\n")); | 60 | printk("Waking error handler thread\n")); |
| @@ -127,6 +130,7 @@ enum blk_eh_timer_return scsi_times_out(struct request *req) | |||
| 127 | struct scsi_cmnd *scmd = req->special; | 130 | struct scsi_cmnd *scmd = req->special; |
| 128 | enum blk_eh_timer_return rtn = BLK_EH_NOT_HANDLED; | 131 | enum blk_eh_timer_return rtn = BLK_EH_NOT_HANDLED; |
| 129 | 132 | ||
| 133 | trace_scsi_dispatch_cmd_timeout(scmd); | ||
| 130 | scsi_log_completion(scmd, TIMEOUT_ERROR); | 134 | scsi_log_completion(scmd, TIMEOUT_ERROR); |
| 131 | 135 | ||
| 132 | if (scmd->device->host->transportt->eh_timed_out) | 136 | if (scmd->device->host->transportt->eh_timed_out) |
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c new file mode 100644 index 00000000000..9a3342a2fa3 --- /dev/null +++ b/drivers/scsi/scsi_trace.c | |||
| @@ -0,0 +1,185 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 FUJITSU LIMITED | ||
| 3 | * Copyright (C) 2010 Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | #include <linux/kernel.h> | ||
| 19 | #include <linux/trace_seq.h> | ||
| 20 | #include <trace/events/scsi.h> | ||
| 21 | |||
| 22 | #define SERVICE_ACTION(cdb) ((cdb[8] << 8) | cdb[9]) | ||
| 23 | |||
| 24 | static const char * | ||
| 25 | scsi_trace_misc(struct trace_seq *, unsigned char *, int); | ||
| 26 | |||
| 27 | static const char * | ||
| 28 | scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb, int len) | ||
| 29 | { | ||
| 30 | const char *ret = p->buffer + p->len; | ||
| 31 | sector_t lba = 0, txlen = 0; | ||
| 32 | |||
| 33 | lba |= ((cdb[1] & 0x1F) << 16); | ||
| 34 | lba |= (cdb[2] << 8); | ||
| 35 | lba |= cdb[3]; | ||
| 36 | txlen = cdb[4]; | ||
| 37 | |||
| 38 | trace_seq_printf(p, "lba=%llu txlen=%llu", | ||
| 39 | (unsigned long long)lba, (unsigned long long)txlen); | ||
| 40 | trace_seq_putc(p, 0); | ||
| 41 | |||
| 42 | return ret; | ||
| 43 | } | ||
| 44 | |||
| 45 | static const char * | ||
| 46 | scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) | ||
| 47 | { | ||
| 48 | const char *ret = p->buffer + p->len; | ||
| 49 | sector_t lba = 0, txlen = 0; | ||
| 50 | |||
| 51 | lba |= (cdb[2] << 24); | ||
| 52 | lba |= (cdb[3] << 16); | ||
| 53 | lba |= (cdb[4] << 8); | ||
| 54 | lba |= cdb[5]; | ||
| 55 | txlen |= (cdb[7] << 8); | ||
| 56 | txlen |= cdb[8]; | ||
| 57 | |||
| 58 | trace_seq_printf(p, "lba=%llu txlen=%llu", | ||
| 59 | (unsigned long long)lba, (unsigned long long)txlen); | ||
| 60 | trace_seq_putc(p, 0); | ||
| 61 | |||
| 62 | return ret; | ||
| 63 | } | ||
| 64 | |||
| 65 | static const char * | ||
| 66 | scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) | ||
| 67 | { | ||
| 68 | const char *ret = p->buffer + p->len; | ||
| 69 | sector_t lba = 0, txlen = 0; | ||
| 70 | |||
| 71 | lba |= (cdb[2] << 24); | ||
| 72 | lba |= (cdb[3] << 16); | ||
| 73 | lba |= (cdb[4] << 8); | ||
| 74 | lba |= cdb[5]; | ||
| 75 | txlen |= (cdb[6] << 24); | ||
| 76 | txlen |= (cdb[7] << 16); | ||
| 77 | txlen |= (cdb[8] << 8); | ||
| 78 | txlen |= cdb[9]; | ||
| 79 | |||
| 80 | trace_seq_printf(p, "lba=%llu txlen=%llu", | ||
| 81 | (unsigned long long)lba, (unsigned long long)txlen); | ||
| 82 | trace_seq_putc(p, 0); | ||
| 83 | |||
| 84 | return ret; | ||
| 85 | } | ||
| 86 | |||
| 87 | static const char * | ||
| 88 | scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) | ||
| 89 | { | ||
| 90 | const char *ret = p->buffer + p->len; | ||
| 91 | sector_t lba = 0, txlen = 0; | ||
| 92 | |||
| 93 | lba |= ((u64)cdb[2] << 56); | ||
| 94 | lba |= ((u64)cdb[3] << 48); | ||
| 95 | lba |= ((u64)cdb[4] << 40); | ||
| 96 | lba |= ((u64)cdb[5] << 32); | ||
| 97 | lba |= (cdb[6] << 24); | ||
| 98 | lba |= (cdb[7] << 16); | ||
| 99 | lba |= (cdb[8] << 8); | ||
| 100 | lba |= cdb[9]; | ||
| 101 | txlen |= (cdb[10] << 24); | ||
| 102 | txlen |= (cdb[11] << 16); | ||
| 103 | txlen |= (cdb[12] << 8); | ||
| 104 | txlen |= cdb[13]; | ||
| 105 | |||
| 106 | trace_seq_printf(p, "lba=%llu txlen=%llu", | ||
| 107 | (unsigned long long)lba, (unsigned long long)txlen); | ||
| 108 | trace_seq_putc(p, 0); | ||
| 109 | |||
| 110 | return ret; | ||
| 111 | } | ||
| 112 | |||
| 113 | static const char * | ||
| 114 | scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) | ||
| 115 | { | ||
| 116 | const char *ret = p->buffer + p->len; | ||
| 117 | sector_t lba = 0, txlen = 0; | ||
| 118 | |||
| 119 | lba |= ((u64)cdb[12] << 56); | ||
| 120 | lba |= ((u64)cdb[13] << 48); | ||
| 121 | lba |= ((u64)cdb[14] << 40); | ||
| 122 | lba |= ((u64)cdb[15] << 32); | ||
| 123 | lba |= (cdb[16] << 24); | ||
| 124 | lba |= (cdb[17] << 16); | ||
