On Tue, 27 Aug 2013 18:03:25 -0400 Jörn Engel <joern@xxxxxxxxx> wrote: > Here is a fun patch in an early state. Essentially I want to trace > scsi commands, which has already been done long ago. The problem I > have is that I care about all the scsi commands for one particular > device - without knowing in advance which device it will be. Once I > know the device in question, I want to dump the last X commands. Is the device passed to the trace point? If so, you can add a filter on that device. You can even create a separate buffer to just trace that device. cd /sys/kernel/debug/tracing mkdir instances/myscsi echo 'channel==0 && id==0 && lun==0' > \ instances/myscsi/events/scsi/scsi_dispatch_cmd_done/filter echo 1 > instance/myscsi/events/scsi/scsi_dispatch_cmd_done/enable cat instances/myscsi/trace # tracer: nop # # entries-in-buffer/entries-written: 10/10 #P:4 # # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | <idle>-0 [000] d.h3 8173.344559: scsi_dispatch_cmd_done: host_no=0 channel=0 id=0 lun=0 data_sgl=1 prot_sgl=0 prot_op=SCSI_PROT_NORMAL cmnd=(READ_10 lba=68117912 txlen=8 protect=0 raw=28 00 04 0f 65 98 00 00 08 00) result=(driver=DRIVER_OK host=DID_OK message=COMMAND_COMPLETE status=SAM_STAT_GOOD) <idle>-0 [001] d.h3 8173.347743: scsi_dispatch_cmd_done: host_no=0 channel=0 id=0 lun=0 data_sgl=1 prot_sgl=0 prot_op=SCSI_PROT_NORMAL cmnd=(READ_10 lba=68351144 txlen=8 protect=0 raw=28 00 04 12 f4 a8 00 00 08 00) result=(driver=DRIVER_OK host=DID_OK message=COMMAND_COMPLETE status=SAM_STAT_GOOD) <idle>-0 [000] d.h3 8174.810108: scsi_dispatch_cmd_done: host_no=0 channel=0 id=0 lun=0 data_sgl=1 prot_sgl=0 prot_op=SCSI_PROT_NORMAL cmnd=(READ_10 lba=61301272 txlen=8 protect=0 raw=28 00 03 a7 62 18 00 00 08 00) result=(driver=DRIVER_OK host=DID_OK message=COMMAND_COMPLETE status=SAM_STAT_GOOD) <idle>-0 [001] d.h3 8174.822038: scsi_dispatch_cmd_done: host_no=0 channel=0 id=0 lun=0 data_sgl=1 prot_sgl=0 prot_op=SCSI_PROT_NORMAL cmnd=(READ_10 lba=48718352 txlen=8 protect=0 raw=28 00 02 e7 62 10 00 00 08 00) result=(driver=DRIVER_OK host=DID_OK message=COMMAND_COMPLETE status=SAM_STAT_GOOD) <idle>-0 [002] d.h3 8174.827439: scsi_dispatch_cmd_done: host_no=0 channel=0 id=0 lun=0 data_sgl=1 prot_sgl=0 prot_op=SCSI_PROT_NORMAL cmnd=(READ_10 lba=56582672 txlen=8 protect=0 raw=28 00 03 5f 62 10 00 00 08 00) result=(driver=DRIVER_OK host=DID_OK message=COMMAND_COMPLETE status=SAM_STAT_GOOD) <idle>-0 [003] d.h3 8174.835280: scsi_dispatch_cmd_done: host_no=0 channel=0 id=0 lun=0 data_sgl=1 prot_sgl=0 prot_op=SCSI_PROT_NORMAL cmnd=(READ_10 lba=82010640 txl Is that something you are talking about? -- Steve > > The existing tracing is covering all commands to all devices. So > either I have to oversize my trace buffer and dump way too much, or I > will miss the stuff I am interested in most of the time. Hence my > per-device trace buffer (called fdr to avoid namespace collisions). > > Steven, is there some magic 2-line patch that would also give me what > I want without having to reinvent all your infrastructure and doing > such a bad job? > > Jörn > -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html