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 92a8c500b23d..1c7ac49be649 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 1c08f6164658..ad0ed212db4a 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 33175974b55a..f31d868f9362 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 000000000000..9a3342a2fa36 --- /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); | ||
125 | lba |= (cdb[18] << 8); | ||
126 | lba |= cdb[19]; | ||
127 | txlen |= (cdb[28] << 24); | ||
128 | txlen |= (cdb[29] << 16); | ||
129 | txlen |= (cdb[30] << 8); | ||
130 | txlen |= cdb[31]; | ||
131 | |||
132 | trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu", | ||
133 | (SERVICE_ACTION(cdb) == READ_32 ? "READ" : "WRITE"), | ||
134 | (unsigned long long)lba, (unsigned long long)txlen); | ||
135 | |||
136 | trace_seq_putc(p, 0); | ||
137 | |||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | static const char * | ||
142 | scsi_trace_varlen(struct trace_seq *p, unsigned char *cdb, int len) | ||
143 | { | ||
144 | switch (SERVICE_ACTION(cdb)) { | ||
145 | case READ_32: | ||
146 | case WRITE_32: | ||
147 | return scsi_trace_rw32(p, cdb, len); | ||
148 | default: | ||
149 | return scsi_trace_misc(p, cdb, len); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static const char * | ||
154 | scsi_trace_misc(struct trace_seq *p, unsigned char *cdb, int len) | ||
155 | { | ||
156 | const char *ret = p->buffer + p->len; | ||
157 | |||
158 | trace_seq_printf(p, "-"); | ||
159 | trace_seq_putc(p, 0); | ||
160 | |||
161 | return ret; | ||
162 | } | ||
163 | |||
164 | const char * | ||
165 | scsi_trace_parse_cdb(struct trace_seq *p, unsigned char *cdb, int len) | ||
166 | { | ||
167 | switch (cdb[0]) { | ||
168 | case READ_6: | ||
169 | case WRITE_6: | ||
170 | return scsi_trace_rw6(p, cdb, len); | ||
171 | case READ_10: | ||
172 | case WRITE_10: | ||
173 | return scsi_trace_rw10(p, cdb, len); | ||
174 | case READ_12: | ||
175 | case WRITE_12: | ||
176 | return scsi_trace_rw12(p, cdb, len); | ||
177 | case READ_16: | ||
178 | case WRITE_16: | ||
179 | return scsi_trace_rw16(p, cdb, len); | ||
180 | case VARIABLE_LENGTH_CMD: | ||
181 | return scsi_trace_varlen(p, cdb, len); | ||
182 | default: | ||
183 | return scsi_trace_misc(p, cdb, len); | ||
184 | } | ||
185 | } | ||
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h new file mode 100644 index 000000000000..76cbf828eb86 --- /dev/null +++ b/include/trace/events/scsi.h | |||
@@ -0,0 +1,328 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM scsi | ||
3 | |||
4 | #if !defined(_TRACE_SCSI_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_SCSI_H | ||
6 | |||
7 | #include <scsi/scsi_cmnd.h> | ||
8 | #include <scsi/scsi_host.h> | ||
9 | #include <linux/tracepoint.h> | ||
10 | #include <linux/trace_seq.h> | ||
11 | |||
12 | #define scsi_opcode_name(opcode) { opcode, #opcode } | ||
13 | #define show_opcode_name(val) \ | ||
14 | __print_symbolic(val, \ | ||
15 | scsi_opcode_name(TEST_UNIT_READY), \ | ||
16 | scsi_opcode_name(REZERO_UNIT), \ | ||
17 | scsi_opcode_name(REQUEST_SENSE), \ | ||
18 | scsi_opcode_name(FORMAT_UNIT), \ | ||
19 | scsi_opcode_name(READ_BLOCK_LIMITS), \ | ||
20 | scsi_opcode_name(REASSIGN_BLOCKS), \ | ||
21 | scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \ | ||
22 | scsi_opcode_name(READ_6), \ | ||
23 | scsi_opcode_name(WRITE_6), \ | ||
24 | scsi_opcode_name(SEEK_6), \ | ||
25 | scsi_opcode_name(READ_REVERSE), \ | ||
26 | scsi_opcode_name(WRITE_FILEMARKS), \ | ||
27 | scsi_opcode_name(SPACE), \ | ||
28 | scsi_opcode_name(INQUIRY), \ | ||
29 | scsi_opcode_name(RECOVER_BUFFERED_DATA), \ | ||
30 | scsi_opcode_name(MODE_SELECT), \ | ||
31 | scsi_opcode_name(RESERVE), \ | ||
32 | scsi_opcode_name(RELEASE), \ | ||
33 | scsi_opcode_name(COPY), \ | ||
34 | scsi_opcode_name(ERASE), \ | ||
35 | scsi_opcode_name(MODE_SENSE), \ | ||
36 | scsi_opcode_name(START_STOP), \ | ||
37 | scsi_opcode_name(RECEIVE_DIAGNOSTIC), \ | ||
38 | scsi_opcode_name(SEND_DIAGNOSTIC), \ | ||
39 | scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \ | ||
40 | scsi_opcode_name(SET_WINDOW), \ | ||
41 | scsi_opcode_name(READ_CAPACITY), \ | ||
42 | scsi_opcode_name(READ_10), \ | ||
43 | scsi_opcode_name(WRITE_10), \ | ||
44 | scsi_opcode_name(SEEK_10), \ | ||
45 | scsi_opcode_name(POSITION_TO_ELEMENT), \ | ||
46 | scsi_opcode_name(WRITE_VERIFY), \ | ||
47 | scsi_opcode_name(VERIFY), \ | ||
48 | scsi_opcode_name(SEARCH_HIGH), \ | ||
49 | scsi_opcode_name(SEARCH_EQUAL), \ | ||
50 | scsi_opcode_name(SEARCH_LOW), \ | ||
51 | scsi_opcode_name(SET_LIMITS), \ | ||
52 | scsi_opcode_name(PRE_FETCH), \ | ||
53 | scsi_opcode_name(READ_POSITION), \ | ||
54 | scsi_opcode_name(SYNCHRONIZE_CACHE), \ | ||
55 | scsi_opcode_name(LOCK_UNLOCK_CACHE), \ | ||
56 | scsi_opcode_name(READ_DEFECT_DATA), \ | ||
57 | scsi_opcode_name(MEDIUM_SCAN), \ | ||
58 | scsi_opcode_name(COMPARE), \ | ||
59 | scsi_opcode_name(COPY_VERIFY), \ | ||
60 | scsi_opcode_name(WRITE_BUFFER), \ | ||
61 | scsi_opcode_name(READ_BUFFER), \ | ||
62 | scsi_opcode_name(UPDATE_BLOCK), \ | ||
63 | scsi_opcode_name(READ_LONG), \ | ||
64 | scsi_opcode_name(WRITE_LONG), \ | ||
65 | scsi_opcode_name(CHANGE_DEFINITION), \ | ||
66 | scsi_opcode_name(WRITE_SAME), \ | ||
67 | scsi_opcode_name(UNMAP), \ | ||
68 | scsi_opcode_name(READ_TOC), \ | ||
69 | scsi_opcode_name(LOG_SELECT), \ | ||
70 | scsi_opcode_name(LOG_SENSE), \ | ||
71 | scsi_opcode_name(XDWRITEREAD_10), \ | ||
72 | scsi_opcode_name(MODE_SELECT_10), \ | ||
73 | scsi_opcode_name(RESERVE_10), \ | ||
74 | scsi_opcode_name(RELEASE_10), \ | ||
75 | scsi_opcode_name(MODE_SENSE_10), \ | ||
76 | scsi_opcode_name(PERSISTENT_RESERVE_IN), \ | ||
77 | scsi_opcode_name(PERSISTENT_RESERVE_OUT), \ | ||
78 | scsi_opcode_name(VARIABLE_LENGTH_CMD), \ | ||
79 | scsi_opcode_name(REPORT_LUNS), \ | ||
80 | scsi_opcode_name(MAINTENANCE_IN), \ | ||
81 | scsi_opcode_name(MAINTENANCE_OUT), \ | ||
82 | scsi_opcode_name(MOVE_MEDIUM), \ | ||
83 | scsi_opcode_name(EXCHANGE_MEDIUM), \ | ||
84 | scsi_opcode_name(READ_12), \ | ||
85 | scsi_opcode_name(WRITE_12), \ | ||
86 | scsi_opcode_name(WRITE_VERIFY_12), \ | ||
87 | scsi_opcode_name(SEARCH_HIGH_12), \ | ||
88 | scsi_opcode_name(SEARCH_EQUAL_12), \ | ||
89 | scsi_opcode_name(SEARCH_LOW_12), \ | ||
90 | scsi_opcode_name(READ_ELEMENT_STATUS), \ | ||
91 | scsi_opcode_name(SEND_VOLUME_TAG), \ | ||
92 | scsi_opcode_name(WRITE_LONG_2), \ | ||
93 | scsi_opcode_name(READ_16), \ | ||
94 | scsi_opcode_name(WRITE_16), \ | ||
95 | scsi_opcode_name(VERIFY_16), \ | ||
96 | scsi_opcode_name(WRITE_SAME_16), \ | ||
97 | scsi_opcode_name(SERVICE_ACTION_IN), \ | ||
98 | scsi_opcode_name(SAI_READ_CAPACITY_16), \ | ||
99 | scsi_opcode_name(SAI_GET_LBA_STATUS), \ | ||
100 | scsi_opcode_name(MI_REPORT_TARGET_PGS), \ | ||
101 | scsi_opcode_name(MO_SET_TARGET_PGS), \ | ||
102 | scsi_opcode_name(READ_32), \ | ||
103 | scsi_opcode_name(WRITE_32), \ | ||
104 | scsi_opcode_name(WRITE_SAME_32), \ | ||
105 | scsi_opcode_name(ATA_16), \ | ||
106 | scsi_opcode_name(ATA_12)) | ||
107 | |||
108 | #define scsi_hostbyte_name(result) { result, #result } | ||
109 | #define show_hostbyte_name(val) \ | ||
110 | __print_symbolic(val, \ | ||
111 | scsi_hostbyte_name(DID_OK), \ | ||
112 | scsi_hostbyte_name(DID_NO_CONNECT), \ | ||
113 | scsi_hostbyte_name(DID_BUS_BUSY), \ | ||
114 | scsi_hostbyte_name(DID_TIME_OUT), \ | ||
115 | scsi_hostbyte_name(DID_BAD_TARGET), \ | ||
116 | scsi_hostbyte_name(DID_ABORT), \ | ||
117 | scsi_hostbyte_name(DID_PARITY), \ | ||
118 | scsi_hostbyte_name(DID_ERROR), \ | ||
119 | scsi_hostbyte_name(DID_RESET), \ | ||
120 | scsi_hostbyte_name(DID_BAD_INTR), \ | ||
121 | scsi_hostbyte_name(DID_PASSTHROUGH), \ | ||
122 | scsi_hostbyte_name(DID_SOFT_ERROR), \ | ||
123 | scsi_hostbyte_name(DID_IMM_RETRY), \ | ||
124 | scsi_hostbyte_name(DID_REQUEUE), \ | ||
125 | scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED), \ | ||
126 | scsi_hostbyte_name(DID_TRANSPORT_FAILFAST)) | ||
127 | |||
128 | #define scsi_driverbyte_name(result) { result, #result } | ||
129 | #define show_driverbyte_name(val) \ | ||
130 | __print_symbolic(val, \ | ||
131 | scsi_driverbyte_name(DRIVER_OK), \ | ||
132 | scsi_driverbyte_name(DRIVER_BUSY), \ | ||
133 | scsi_driverbyte_name(DRIVER_SOFT), \ | ||
134 | scsi_driverbyte_name(DRIVER_MEDIA), \ | ||
135 | scsi_driverbyte_name(DRIVER_ERROR), \ | ||
136 | scsi_driverbyte_name(DRIVER_INVALID), \ | ||
137 | scsi_driverbyte_name(DRIVER_TIMEOUT), \ | ||
138 | scsi_driverbyte_name(DRIVER_HARD), \ | ||
139 | scsi_driverbyte_name(DRIVER_SENSE)) | ||
140 | |||
141 | #define scsi_msgbyte_name(result) { result, #result } | ||
142 | #define show_msgbyte_name(val) \ | ||
143 | __print_symbolic(val, \ | ||
144 | scsi_msgbyte_name(COMMAND_COMPLETE), \ | ||
145 | scsi_msgbyte_name(EXTENDED_MESSAGE), \ | ||
146 | scsi_msgbyte_name(SAVE_POINTERS), \ | ||
147 | scsi_msgbyte_name(RESTORE_POINTERS), \ | ||
148 | scsi_msgbyte_name(DISCONNECT), \ | ||
149 | scsi_msgbyte_name(INITIATOR_ERROR), \ | ||
150 | scsi_msgbyte_name(ABORT_TASK_SET), \ | ||
151 | scsi_msgbyte_name(MESSAGE_REJECT), \ | ||
152 | scsi_msgbyte_name(NOP), \ | ||
153 | scsi_msgbyte_name(MSG_PARITY_ERROR), \ | ||
154 | scsi_msgbyte_name(LINKED_CMD_COMPLETE), \ | ||
155 | scsi_msgbyte_name(LINKED_FLG_CMD_COMPLETE), \ | ||
156 | scsi_msgbyte_name(TARGET_RESET), \ | ||
157 | scsi_msgbyte_name(ABORT_TASK), \ | ||
158 | scsi_msgbyte_name(CLEAR_TASK_SET), \ | ||
159 | scsi_msgbyte_name(INITIATE_RECOVERY), \ | ||
160 | scsi_msgbyte_name(RELEASE_RECOVERY), \ | ||
161 | scsi_msgbyte_name(CLEAR_ACA), \ | ||
162 | scsi_msgbyte_name(LOGICAL_UNIT_RESET), \ | ||
163 | scsi_msgbyte_name(SIMPLE_QUEUE_TAG), \ | ||
164 | scsi_msgbyte_name(HEAD_OF_QUEUE_TAG), \ | ||
165 | scsi_msgbyte_name(ORDERED_QUEUE_TAG), \ | ||
166 | scsi_msgbyte_name(IGNORE_WIDE_RESIDUE), \ | ||
167 | scsi_msgbyte_name(ACA), \ | ||
168 | scsi_msgbyte_name(QAS_REQUEST), \ | ||
169 | scsi_msgbyte_name(BUS_DEVICE_RESET), \ | ||
170 | scsi_msgbyte_name(ABORT)) | ||
171 | |||
172 | #define scsi_statusbyte_name(result) { result, #result } | ||
173 | #define show_statusbyte_name(val) \ | ||
174 | __print_symbolic(val, \ | ||
175 | scsi_statusbyte_name(SAM_STAT_GOOD), \ | ||
176 | scsi_statusbyte_name(SAM_STAT_CHECK_CONDITION), \ | ||
177 | scsi_statusbyte_name(SAM_STAT_CONDITION_MET), \ | ||
178 | scsi_statusbyte_name(SAM_STAT_BUSY), \ | ||
179 | scsi_statusbyte_name(SAM_STAT_INTERMEDIATE), \ | ||
180 | scsi_statusbyte_name(SAM_STAT_INTERMEDIATE_CONDITION_MET), \ | ||
181 | scsi_statusbyte_name(SAM_STAT_RESERVATION_CONFLICT), \ | ||
182 | scsi_statusbyte_name(SAM_STAT_COMMAND_TERMINATED), \ | ||
183 | scsi_statusbyte_name(SAM_STAT_TASK_SET_FULL), \ | ||
184 | scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \ | ||
185 | scsi_statusbyte_name(SAM_STAT_TASK_ABORTED)) | ||
186 | |||
187 | const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int); | ||
188 | #define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len) | ||
189 | |||
190 | TRACE_EVENT(scsi_dispatch_cmd_start, | ||
191 | |||
192 | TP_PROTO(struct scsi_cmnd *cmd), | ||
193 | |||
194 | TP_ARGS(cmd), | ||
195 | |||
196 | TP_STRUCT__entry( | ||
197 | __field( unsigned int, host_no ) | ||
198 | __field( unsigned int, channel ) | ||
199 | __field( unsigned int, id ) | ||
200 | __field( unsigned int, lun ) | ||
201 | __field( unsigned int, opcode ) | ||
202 | __field( unsigned int, cmd_len ) | ||
203 | __dynamic_array(unsigned char, cmnd, cmd->cmd_len) | ||
204 | ), | ||
205 | |||
206 | TP_fast_assign( | ||
207 | __entry->host_no = cmd->device->host->host_no; | ||
208 | __entry->channel = cmd->device->channel; | ||
209 | __entry->id = cmd->device->id; | ||
210 | __entry->lun = cmd->device->lun; | ||
211 | __entry->opcode = cmd->cmnd[0]; | ||
212 | __entry->cmd_len = cmd->cmd_len; | ||
213 | memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); | ||
214 | ), | ||
215 | |||
216 | TP_printk("host_no=%u channel=%u id=%u lun=%u cmnd=(%s %s raw=%s)", | ||
217 | __entry->host_no, __entry->channel, __entry->id, | ||
218 | __entry->lun, show_opcode_name(__entry->opcode), | ||
219 | __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), | ||
220 | __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len)) | ||
221 | ); | ||
222 | |||
223 | TRACE_EVENT(scsi_dispatch_cmd_error, | ||
224 | |||
225 | TP_PROTO(struct scsi_cmnd *cmd, int rtn), | ||
226 | |||
227 | TP_ARGS(cmd, rtn), | ||
228 | |||
229 | TP_STRUCT__entry( | ||
230 | __field( unsigned int, host_no ) | ||
231 | __field( unsigned int, channel ) | ||
232 | __field( unsigned int, id ) | ||
233 | __field( unsigned int, lun ) | ||
234 | __field( int, rtn ) | ||
235 | __field( unsigned int, opcode ) | ||
236 | __field( unsigned int, cmd_len ) | ||
237 | __dynamic_array(unsigned char, cmnd, cmd->cmd_len) | ||
238 | ), | ||
239 | |||
240 | TP_fast_assign( | ||
241 | __entry->host_no = cmd->device->host->host_no; | ||
242 | __entry->channel = cmd->device->channel; | ||
243 | __entry->id = cmd->device->id; | ||
244 | __entry->lun = cmd->device->lun; | ||
245 | __entry->rtn = rtn; | ||
246 | __entry->opcode = cmd->cmnd[0]; | ||
247 | __entry->cmd_len = cmd->cmd_len; | ||
248 | memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); | ||
249 | ), | ||
250 | |||
251 | TP_printk("host_no=%u channel=%u id=%u lun=%u cmnd=(%s %s raw=%s)" | ||
252 | " rtn=%d", | ||
253 | __entry->host_no, __entry->channel, __entry->id, | ||
254 | __entry->lun, show_opcode_name(__entry->opcode), | ||
255 | __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), | ||
256 | __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), | ||
257 | __entry->rtn) | ||
258 | ); | ||
259 | |||
260 | DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template, | ||
261 | |||
262 | TP_PROTO(struct scsi_cmnd *cmd), | ||
263 | |||
264 | TP_ARGS(cmd), | ||
265 | |||
266 | TP_STRUCT__entry( | ||
267 | __field( unsigned int, host_no ) | ||
268 | __field( unsigned int, channel ) | ||
269 | __field( unsigned int, id ) | ||
270 | __field( unsigned int, lun ) | ||
271 | __field( int, result ) | ||
272 | __field( unsigned int, opcode ) | ||
273 | __field( unsigned int, cmd_len ) | ||
274 | __dynamic_array(unsigned char, cmnd, cmd->cmd_len) | ||
275 | ), | ||
276 | |||
277 | TP_fast_assign( | ||
278 | __entry->host_no = cmd->device->host->host_no; | ||
279 | __entry->channel = cmd->device->channel; | ||
280 | __entry->id = cmd->device->id; | ||
281 | __entry->lun = cmd->device->lun; | ||
282 | __entry->result = cmd->result; | ||
283 | __entry->opcode = cmd->cmnd[0]; | ||
284 | __entry->cmd_len = cmd->cmd_len; | ||
285 | memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); | ||
286 | ), | ||
287 | |||
288 | TP_printk("host_no=%u channel=%u id=%u lun=%u cmnd=(%s %s raw=%s) " | ||
289 | "result=(driver=%s host=%s message=%s status=%s)", | ||
290 | __entry->host_no, __entry->channel, __entry->id, | ||
291 | __entry->lun, show_opcode_name(__entry->opcode), | ||
292 | __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), | ||
293 | __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), | ||
294 | show_driverbyte_name(((__entry->result) >> 24) & 0xff), | ||
295 | show_hostbyte_name(((__entry->result) >> 16) & 0xff), | ||
296 | show_msgbyte_name(((__entry->result) >> 8) & 0xff), | ||
297 | show_statusbyte_name(__entry->result & 0xff)) | ||
298 | ); | ||
299 | |||
300 | DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done, | ||
301 | TP_PROTO(struct scsi_cmnd *cmd), | ||
302 | TP_ARGS(cmd)); | ||
303 | |||
304 | DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_timeout, | ||
305 | TP_PROTO(struct scsi_cmnd *cmd), | ||
306 | TP_ARGS(cmd)); | ||
307 | |||
308 | TRACE_EVENT(scsi_eh_wakeup, | ||
309 | |||
310 | TP_PROTO(struct Scsi_Host *shost), | ||
311 | |||
312 | TP_ARGS(shost), | ||
313 | |||
314 | TP_STRUCT__entry( | ||
315 | __field( unsigned int, host_no ) | ||
316 | ), | ||
317 | |||
318 | TP_fast_assign( | ||
319 | __entry->host_no = shost->host_no; | ||
320 | ), | ||
321 | |||
322 | TP_printk("host_no=%u", __entry->host_no) | ||
323 | ); | ||
324 | |||
325 | #endif /* _TRACE_SCSI_H */ | ||
326 | |||
327 | /* This part must be outside protection */ | ||
328 | #include <trace/define_trace.h> | ||
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 7c4a0ca650b5..9cb5df5dc656 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -209,6 +209,7 @@ int trace_seq_putc(struct trace_seq *s, unsigned char c) | |||
209 | 209 | ||
210 | return 1; | 210 | return 1; |
211 | } | 211 | } |
212 | EXPORT_SYMBOL(trace_seq_putc); | ||
212 | 213 | ||
213 | int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) | 214 | int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len) |
214 | { | 215 | { |