Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/cio: Introduce common I/O layer tracepoints

Add tracepoints to interrupt handler and core inline assemblies used by
the s390 common I/O layer. These tracepoints can be used to monitor and
validate hardware and hypervisor requests and responses.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Reviewed-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Peter Oberparleiter and committed by
Martin Schwidefsky
42248979 2ab59de7

+419 -1
+4 -1
drivers/s390/cio/Makefile
··· 2 2 # Makefile for the S/390 common i/o drivers 3 3 # 4 4 5 + # The following is required for define_trace.h to find ./trace.h 6 + CFLAGS_trace.o := -I$(src) 7 + 5 8 obj-y += airq.o blacklist.o chsc.o cio.o css.o chp.o idset.o isc.o \ 6 - fcx.o itcw.o crw.o ccwreq.o 9 + fcx.o itcw.o crw.o ccwreq.o trace.o 7 10 ccw_device-objs += device.o device_fsm.o device_ops.o 8 11 ccw_device-objs += device_id.o device_pgid.o device_status.o 9 12 obj-y += ccw_device.o cmf.o
+1
drivers/s390/cio/airq.c
··· 89 89 90 90 set_cpu_flag(CIF_NOHZ_DELAY); 91 91 tpi_info = (struct tpi_info *) &get_irq_regs()->int_code; 92 + trace_s390_cio_adapter_int(tpi_info); 92 93 head = &airq_lists[tpi_info->isc]; 93 94 rcu_read_lock(); 94 95 hlist_for_each_entry_rcu(airq, head, list)
+2
drivers/s390/cio/cio.c
··· 41 41 #include "blacklist.h" 42 42 #include "cio_debug.h" 43 43 #include "chp.h" 44 + #include "trace.h" 44 45 45 46 debug_info_t *cio_debug_msg_id; 46 47 debug_info_t *cio_debug_trace_id; ··· 540 539 541 540 set_cpu_flag(CIF_NOHZ_DELAY); 542 541 tpi_info = (struct tpi_info *) &get_irq_regs()->int_code; 542 + trace_s390_cio_interrupt(tpi_info); 543 543 irb = this_cpu_ptr(&cio_irb); 544 544 sch = (struct subchannel *)(unsigned long) tpi_info->intparm; 545 545 if (!sch) {
+25
drivers/s390/cio/ioasm.h
··· 6 6 #include <asm/crw.h> 7 7 #include "orb.h" 8 8 #include "cio.h" 9 + #include "trace.h" 9 10 10 11 /* 11 12 * Some S390 specific IO instructions as inline ··· 26 25 : "+d" (ccode), "=m" (*addr) 27 26 : "d" (reg1), "a" (addr) 28 27 : "cc"); 28 + trace_s390_cio_stsch(schid, addr, ccode); 29 + 29 30 return ccode; 30 31 } 31 32 ··· 45 42 : "+d" (ccode) 46 43 : "d" (reg1), "a" (addr), "m" (*addr) 47 44 : "cc"); 45 + trace_s390_cio_msch(schid, addr, ccode); 46 + 48 47 return ccode; 49 48 } 50 49 ··· 62 57 : "=d" (ccode), "=m" (*addr) 63 58 : "d" (reg1), "a" (addr) 64 59 : "cc"); 60 + trace_s390_cio_tsch(schid, addr, ccode); 61 + 65 62 return ccode; 66 63 } 67 64 ··· 81 74 : "+d" (ccode) 82 75 : "d" (reg1), "a" (addr), "m" (*addr) 83 76 : "cc", "memory"); 77 + trace_s390_cio_ssch(schid, addr, ccode); 78 + 84 79 return ccode; 85 80 } 86 81 ··· 98 89 : "=d" (ccode) 99 90 : "d" (reg1) 100 91 : "cc"); 92 + trace_s390_cio_csch(schid, ccode); 93 + 101 94 return ccode; 102 95 } 103 96 ··· 114 103 : "=d" (ccode), "=m" (*addr) 115 104 : "a" (addr) 116 105 : "cc"); 106 + trace_s390_cio_tpi(addr, ccode); 107 + 117 108 return ccode; 118 109 } 119 110 ··· 131 118 : "=d" (cc), "=m" (*(addr_type *) chsc_area) 132 119 : "d" (chsc_area), "m" (*(addr_type *) chsc_area) 133 120 : "cc"); 121 + trace_s390_cio_chsc(chsc_area, cc); 122 + 134 123 return cc; 135 124 } 136 125 ··· 147 132 " ipm %0\n" 148 133 " srl %0,28" 149 134 : "=d" (ccode) : "d" (reg1) : "cc"); 135 + trace_s390_cio_rchp(chpid, ccode); 136 + 150 137 return ccode; 151 138 } 152 139 ··· 164 147 : "=d" (ccode) 165 148 : "d" (reg1) 166 149 : "cc", "memory"); 150 + trace_s390_cio_rsch(schid, ccode); 151 + 167 152 return ccode; 168 153 } 169 154 ··· 181 162 : "=d" (ccode) 182 163 : "d" (reg1) 183 164 : "cc"); 165 + trace_s390_cio_hsch(schid, ccode); 166 + 184 167 return ccode; 185 168 } 186 169 ··· 198 177 : "=d" (ccode) 199 178 : "d" (reg1) 200 179 : "cc"); 180 + trace_s390_cio_xsch(schid, ccode); 181 + 201 182 return ccode; 202 183 } 203 184 ··· 214 191 : "=d" (ccode), "=m" (*crw) 215 192 : "a" (crw) 216 193 : "cc"); 194 + trace_s390_cio_stcrw(crw, ccode); 195 + 217 196 return ccode; 218 197 } 219 198
+24
drivers/s390/cio/trace.c
··· 1 + /* 2 + * Tracepoint definitions for s390_cio 3 + * 4 + * Copyright IBM Corp. 2015 5 + * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com> 6 + */ 7 + 8 + #include <asm/crw.h> 9 + #include "cio.h" 10 + 11 + #define CREATE_TRACE_POINTS 12 + #include "trace.h" 13 + 14 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_stsch); 15 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_msch); 16 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_tsch); 17 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_tpi); 18 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_ssch); 19 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_csch); 20 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_hsch); 21 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_xsch); 22 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_rsch); 23 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_rchp); 24 + EXPORT_TRACEPOINT_SYMBOL(s390_cio_chsc);
+363
drivers/s390/cio/trace.h
··· 1 + /* 2 + * Tracepoint header for the s390 Common I/O layer (CIO) 3 + * 4 + * Copyright IBM Corp. 2015 5 + * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com> 6 + */ 7 + 8 + #include <linux/kernel.h> 9 + #include <asm/crw.h> 10 + #include <uapi/asm/chpid.h> 11 + #include <uapi/asm/schid.h> 12 + #include "cio.h" 13 + #include "orb.h" 14 + 15 + #undef TRACE_SYSTEM 16 + #define TRACE_SYSTEM s390 17 + 18 + #if !defined(_TRACE_S390_CIO_H) || defined(TRACE_HEADER_MULTI_READ) 19 + #define _TRACE_S390_CIO_H 20 + 21 + #include <linux/tracepoint.h> 22 + 23 + DECLARE_EVENT_CLASS(s390_class_schib, 24 + TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc), 25 + TP_ARGS(schid, schib, cc), 26 + TP_STRUCT__entry( 27 + __field(u8, cssid) 28 + __field(u8, ssid) 29 + __field(u16, schno) 30 + __field(u16, devno) 31 + __field_struct(struct schib, schib) 32 + __field(int, cc) 33 + ), 34 + TP_fast_assign( 35 + __entry->cssid = schid.cssid; 36 + __entry->ssid = schid.ssid; 37 + __entry->schno = schid.sch_no; 38 + __entry->devno = schib->pmcw.dev; 39 + __entry->schib = *schib; 40 + __entry->cc = cc; 41 + ), 42 + TP_printk("schid=%x.%x.%04x cc=%d ena=%d st=%d dnv=%d dev=%04x " 43 + "lpm=0x%02x pnom=0x%02x lpum=0x%02x pim=0x%02x pam=0x%02x " 44 + "pom=0x%02x chpids=%016llx", 45 + __entry->cssid, __entry->ssid, __entry->schno, __entry->cc, 46 + __entry->schib.pmcw.ena, __entry->schib.pmcw.st, 47 + __entry->schib.pmcw.dnv, __entry->schib.pmcw.dev, 48 + __entry->schib.pmcw.lpm, __entry->schib.pmcw.pnom, 49 + __entry->schib.pmcw.lpum, __entry->schib.pmcw.pim, 50 + __entry->schib.pmcw.pam, __entry->schib.pmcw.pom, 51 + *((u64 *) __entry->schib.pmcw.chpid) 52 + ) 53 + ); 54 + 55 + /** 56 + * s390_cio_stsch - Store Subchannel instruction (STSCH) was performed 57 + * @schid: Subchannel ID 58 + * @schib: Subchannel-Information block 59 + * @cc: Condition code 60 + */ 61 + DEFINE_EVENT(s390_class_schib, s390_cio_stsch, 62 + TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc), 63 + TP_ARGS(schid, schib, cc) 64 + ); 65 + 66 + /** 67 + * s390_cio_msch - Modify Subchannel instruction (MSCH) was performed 68 + * @schid: Subchannel ID 69 + * @schib: Subchannel-Information block 70 + * @cc: Condition code 71 + */ 72 + DEFINE_EVENT(s390_class_schib, s390_cio_msch, 73 + TP_PROTO(struct subchannel_id schid, struct schib *schib, int cc), 74 + TP_ARGS(schid, schib, cc) 75 + ); 76 + 77 + /** 78 + * s390_cio_tsch - Test Subchannel instruction (TSCH) was performed 79 + * @schid: Subchannel ID 80 + * @irb: Interruption-Response Block 81 + * @cc: Condition code 82 + */ 83 + TRACE_EVENT(s390_cio_tsch, 84 + TP_PROTO(struct subchannel_id schid, struct irb *irb, int cc), 85 + TP_ARGS(schid, irb, cc), 86 + TP_STRUCT__entry( 87 + __field(u8, cssid) 88 + __field(u8, ssid) 89 + __field(u16, schno) 90 + __field_struct(struct irb, irb) 91 + __field(int, cc) 92 + ), 93 + TP_fast_assign( 94 + __entry->cssid = schid.cssid; 95 + __entry->ssid = schid.ssid; 96 + __entry->schno = schid.sch_no; 97 + __entry->irb = *irb; 98 + __entry->cc = cc; 99 + ), 100 + TP_printk("schid=%x.%x.%04x cc=%d dcc=%d pno=%d fctl=0x%x actl=0x%x " 101 + "stctl=0x%x dstat=0x%x cstat=0x%x", 102 + __entry->cssid, __entry->ssid, __entry->schno, __entry->cc, 103 + scsw_cc(&__entry->irb.scsw), scsw_pno(&__entry->irb.scsw), 104 + scsw_fctl(&__entry->irb.scsw), scsw_actl(&__entry->irb.scsw), 105 + scsw_stctl(&__entry->irb.scsw), 106 + scsw_dstat(&__entry->irb.scsw), scsw_cstat(&__entry->irb.scsw) 107 + ) 108 + ); 109 + 110 + /** 111 + * s390_cio_tpi - Test Pending Interruption instruction (TPI) was performed 112 + * @addr: Address of the I/O interruption code or %NULL 113 + * @cc: Condition code 114 + */ 115 + TRACE_EVENT(s390_cio_tpi, 116 + TP_PROTO(struct tpi_info *addr, int cc), 117 + TP_ARGS(addr, cc), 118 + TP_STRUCT__entry( 119 + __field(int, cc) 120 + __field_struct(struct tpi_info, tpi_info) 121 + __field(u8, cssid) 122 + __field(u8, ssid) 123 + __field(u16, schno) 124 + ), 125 + TP_fast_assign( 126 + __entry->cc = cc; 127 + if (cc != 0) 128 + memset(&__entry->tpi_info, 0, sizeof(struct tpi_info)); 129 + else if (addr) 130 + __entry->tpi_info = *addr; 131 + else { 132 + memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id, 133 + sizeof(struct tpi_info)); 134 + } 135 + __entry->cssid = __entry->tpi_info.schid.cssid; 136 + __entry->ssid = __entry->tpi_info.schid.ssid; 137 + __entry->schno = __entry->tpi_info.schid.sch_no; 138 + ), 139 + TP_printk("schid=%x.%x.%04x cc=%d a=%d isc=%d type=%d", 140 + __entry->cssid, __entry->ssid, __entry->schno, __entry->cc, 141 + __entry->tpi_info.adapter_IO, __entry->tpi_info.isc, 142 + __entry->tpi_info.type 143 + ) 144 + ); 145 + 146 + /** 147 + * s390_cio_ssch - Start Subchannel instruction (SSCH) was performed 148 + * @schid: Subchannel ID 149 + * @orb: Operation-Request Block 150 + * @cc: Condition code 151 + */ 152 + TRACE_EVENT(s390_cio_ssch, 153 + TP_PROTO(struct subchannel_id schid, union orb *orb, int cc), 154 + TP_ARGS(schid, orb, cc), 155 + TP_STRUCT__entry( 156 + __field(u8, cssid) 157 + __field(u8, ssid) 158 + __field(u16, schno) 159 + __field_struct(union orb, orb) 160 + __field(int, cc) 161 + ), 162 + TP_fast_assign( 163 + __entry->cssid = schid.cssid; 164 + __entry->ssid = schid.ssid; 165 + __entry->schno = schid.sch_no; 166 + __entry->orb = *orb; 167 + __entry->cc = cc; 168 + ), 169 + TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid, 170 + __entry->schno, __entry->cc 171 + ) 172 + ); 173 + 174 + DECLARE_EVENT_CLASS(s390_class_schid, 175 + TP_PROTO(struct subchannel_id schid, int cc), 176 + TP_ARGS(schid, cc), 177 + TP_STRUCT__entry( 178 + __field(u8, cssid) 179 + __field(u8, ssid) 180 + __field(u16, schno) 181 + __field(int, cc) 182 + ), 183 + TP_fast_assign( 184 + __entry->cssid = schid.cssid; 185 + __entry->ssid = schid.ssid; 186 + __entry->schno = schid.sch_no; 187 + __entry->cc = cc; 188 + ), 189 + TP_printk("schid=%x.%x.%04x cc=%d", __entry->cssid, __entry->ssid, 190 + __entry->schno, __entry->cc 191 + ) 192 + ); 193 + 194 + /** 195 + * s390_cio_csch - Clear Subchannel instruction (CSCH) was performed 196 + * @schid: Subchannel ID 197 + * @cc: Condition code 198 + */ 199 + DEFINE_EVENT(s390_class_schid, s390_cio_csch, 200 + TP_PROTO(struct subchannel_id schid, int cc), 201 + TP_ARGS(schid, cc) 202 + ); 203 + 204 + /** 205 + * s390_cio_hsch - Halt Subchannel instruction (HSCH) was performed 206 + * @schid: Subchannel ID 207 + * @cc: Condition code 208 + */ 209 + DEFINE_EVENT(s390_class_schid, s390_cio_hsch, 210 + TP_PROTO(struct subchannel_id schid, int cc), 211 + TP_ARGS(schid, cc) 212 + ); 213 + 214 + /** 215 + * s390_cio_xsch - Cancel Subchannel instruction (XSCH) was performed 216 + * @schid: Subchannel ID 217 + * @cc: Condition code 218 + */ 219 + DEFINE_EVENT(s390_class_schid, s390_cio_xsch, 220 + TP_PROTO(struct subchannel_id schid, int cc), 221 + TP_ARGS(schid, cc) 222 + ); 223 + 224 + /** 225 + * s390_cio_rsch - Resume Subchannel instruction (RSCH) was performed 226 + * @schid: Subchannel ID 227 + * @cc: Condition code 228 + */ 229 + DEFINE_EVENT(s390_class_schid, s390_cio_rsch, 230 + TP_PROTO(struct subchannel_id schid, int cc), 231 + TP_ARGS(schid, cc) 232 + ); 233 + 234 + /** 235 + * s390_cio_rchp - Reset Channel Path (RCHP) instruction was performed 236 + * @chpid: Channel-Path Identifier 237 + * @cc: Condition code 238 + */ 239 + TRACE_EVENT(s390_cio_rchp, 240 + TP_PROTO(struct chp_id chpid, int cc), 241 + TP_ARGS(chpid, cc), 242 + TP_STRUCT__entry( 243 + __field(u8, cssid) 244 + __field(u8, id) 245 + __field(int, cc) 246 + ), 247 + TP_fast_assign( 248 + __entry->cssid = chpid.cssid; 249 + __entry->id = chpid.id; 250 + __entry->cc = cc; 251 + ), 252 + TP_printk("chpid=%x.%02x cc=%d", __entry->cssid, __entry->id, 253 + __entry->cc 254 + ) 255 + ); 256 + 257 + #define CHSC_MAX_REQUEST_LEN 64 258 + #define CHSC_MAX_RESPONSE_LEN 64 259 + 260 + /** 261 + * s390_cio_chsc - Channel Subsystem Call (CHSC) instruction was performed 262 + * @chsc: CHSC block 263 + * @cc: Condition code 264 + */ 265 + TRACE_EVENT(s390_cio_chsc, 266 + TP_PROTO(struct chsc_header *chsc, int cc), 267 + TP_ARGS(chsc, cc), 268 + TP_STRUCT__entry( 269 + __field(int, cc) 270 + __field(u16, code) 271 + __field(u16, rcode) 272 + __array(u8, request, CHSC_MAX_REQUEST_LEN) 273 + __array(u8, response, CHSC_MAX_RESPONSE_LEN) 274 + ), 275 + TP_fast_assign( 276 + __entry->cc = cc; 277 + __entry->code = chsc->code; 278 + memcpy(&entry->request, chsc, 279 + min_t(u16, chsc->length, CHSC_MAX_REQUEST_LEN)); 280 + chsc = (struct chsc_header *) ((char *) chsc + chsc->length); 281 + __entry->rcode = chsc->code; 282 + memcpy(&entry->response, chsc, 283 + min_t(u16, chsc->length, CHSC_MAX_RESPONSE_LEN)); 284 + ), 285 + TP_printk("code=0x%04x cc=%d rcode=0x%04x", __entry->code, 286 + __entry->cc, __entry->rcode) 287 + ); 288 + 289 + /** 290 + * s390_cio_interrupt - An I/O interrupt occurred 291 + * @tpi_info: Address of the I/O interruption code 292 + */ 293 + TRACE_EVENT(s390_cio_interrupt, 294 + TP_PROTO(struct tpi_info *tpi_info), 295 + TP_ARGS(tpi_info), 296 + TP_STRUCT__entry( 297 + __field_struct(struct tpi_info, tpi_info) 298 + __field(u8, cssid) 299 + __field(u8, ssid) 300 + __field(u16, schno) 301 + ), 302 + TP_fast_assign( 303 + __entry->tpi_info = *tpi_info; 304 + __entry->cssid = __entry->tpi_info.schid.cssid; 305 + __entry->ssid = __entry->tpi_info.schid.ssid; 306 + __entry->schno = __entry->tpi_info.schid.sch_no; 307 + ), 308 + TP_printk("schid=%x.%x.%04x isc=%d type=%d", 309 + __entry->cssid, __entry->ssid, __entry->schno, 310 + __entry->tpi_info.isc, __entry->tpi_info.type 311 + ) 312 + ); 313 + 314 + /** 315 + * s390_cio_adapter_int - An adapter interrupt occurred 316 + * @tpi_info: Address of the I/O interruption code 317 + */ 318 + TRACE_EVENT(s390_cio_adapter_int, 319 + TP_PROTO(struct tpi_info *tpi_info), 320 + TP_ARGS(tpi_info), 321 + TP_STRUCT__entry( 322 + __field_struct(struct tpi_info, tpi_info) 323 + ), 324 + TP_fast_assign( 325 + __entry->tpi_info = *tpi_info; 326 + ), 327 + TP_printk("isc=%d", __entry->tpi_info.isc) 328 + ); 329 + 330 + /** 331 + * s390_cio_stcrw - Store Channel Report Word (STCRW) was performed 332 + * @crw: Channel Report Word 333 + * @cc: Condition code 334 + */ 335 + TRACE_EVENT(s390_cio_stcrw, 336 + TP_PROTO(struct crw *crw, int cc), 337 + TP_ARGS(crw, cc), 338 + TP_STRUCT__entry( 339 + __field_struct(struct crw, crw) 340 + __field(int, cc) 341 + ), 342 + TP_fast_assign( 343 + __entry->crw = *crw; 344 + __entry->cc = cc; 345 + ), 346 + TP_printk("cc=%d slct=%d oflw=%d chn=%d rsc=%d anc=%d erc=0x%x " 347 + "rsid=0x%x", 348 + __entry->cc, __entry->crw.slct, __entry->crw.oflw, 349 + __entry->crw.chn, __entry->crw.rsc, __entry->crw.anc, 350 + __entry->crw.erc, __entry->crw.rsid 351 + ) 352 + ); 353 + 354 + #endif /* _TRACE_S390_CIO_H */ 355 + 356 + /* This part must be outside protection */ 357 + #undef TRACE_INCLUDE_PATH 358 + #define TRACE_INCLUDE_PATH . 359 + 360 + #undef TRACE_INCLUDE_FILE 361 + #define TRACE_INCLUDE_FILE trace 362 + 363 + #include <trace/define_trace.h>