All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
To: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	yrl.pp-manager.tt@hitachi.com, linux-kernel@vger.kernel.org,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	Doug Gilbert <dgilbert@interlog.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: Re: [RFC PATCH 07/10] scsi/trace: Use scsi_show_result trace point instead of printk
Date: Thu, 28 Aug 2014 10:37:41 +0900	[thread overview]
Message-ID: <53FE87E5.6030604@hitachi.com> (raw)
In-Reply-To: <53FDE743.2040705@suse.de>

(2014/08/27 23:12), Hannes Reinecke wrote:
> On 08/08/2014 01:50 PM, Yoshihiro YUNOMAE wrote:
>> Current SCSI trace has hostbyte table and driverbyte table, so we
>> don't need to
>> have the same table in scsi/constants.c.
>>
>> - Result examples
>>
>> <Before> (printk)
>> sd 2:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
>>
>> <After> (ftrace)
>> scsi_show_result: host_no=2 channel=0 id=0 lun=0 [sda]
>> result=(driver=DRIVER_SENSE host=DID_OK)
>>
>> Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
>> Cc: Hannes Reinecke <hare@suse.de>
>> Cc: Doug Gilbert <dgilbert@interlog.com>
>> Cc: Martin K. Petersen <martin.petersen@oracle.com>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
>> Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
>> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> ---
>>   drivers/scsi/constants.c    |   52
>> -------------------------------------------
>>   drivers/scsi/scsi_trace.c   |   16 +++++++++++++
>>   include/trace/events/scsi.h |   38 +++++++++++++++++++++++++++++++
>>   3 files changed, 53 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
>> index 6fad6b4..f7b7f32 100644
>> --- a/drivers/scsi/constants.c
>> +++ b/drivers/scsi/constants.c
>> @@ -1488,55 +1488,3 @@ void scsi_print_sense(struct scsi_cmnd *cmd)
>>                  SCSI_SENSE_BUFFERSIZE);
>>   }
>>   EXPORT_SYMBOL(scsi_print_sense);
>> -
>> -#ifdef CONFIG_SCSI_CONSTANTS
>> -
>> -static const char * const hostbyte_table[]={
>> -"DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT",
>> "DID_BAD_TARGET",
>> -"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR",
>> -"DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY", "DID_REQUEUE",
>> -"DID_TRANSPORT_DISRUPTED", "DID_TRANSPORT_FAILFAST",
>> "DID_TARGET_FAILURE",
>> -"DID_NEXUS_FAILURE" };
>> -#define NUM_HOSTBYTE_STRS ARRAY_SIZE(hostbyte_table)
>> -
>> -static const char * const driverbyte_table[]={
>> -"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT",  "DRIVER_MEDIA",
>> "DRIVER_ERROR",
>> -"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"};
>> -#define NUM_DRIVERBYTE_STRS ARRAY_SIZE(driverbyte_table)
>> -
>> -void scsi_show_result(struct scsi_device *sdev, const char *name, int
>> result)
>> -{
>> -    int hb = host_byte(result);
>> -    int db = driver_byte(result);
>> -    const char *hb_string;
>> -    const char *db_string;
>> -
>> -    hb_string = (hb < NUM_HOSTBYTE_STRS) ? hostbyte_table[hb] :
>> "invalid";
>> -    db_string = (db < NUM_DRIVERBYTE_STRS) ?
>> -        driverbyte_table[db] : "invalid";
>> -
>> -
>> -    sdev_printk(KERN_INFO, sdev,
>> -            "[%s] Result: hostbyte=%s driverbyte=%s\n",
>> -            name, hb_string, db_string);
>> -}
>> -
>> -#else
>> -
>> -void scsi_show_result(struct scsi_device *sdev, const char *name, int
>> result)
>> -{
>> -    sdev_printk(KERN_INFO, sdev,
>> -            "[%s] Result: hostbyte=0x%02x driverbyte=0x%02x\n",
>> -            name, host_byte(result), driver_byte(result));
>> -}
>> -
>> -#endif
>> -EXPORT_SYMBOL(scsi_show_result);
>> -
>> -void scsi_print_result(struct scsi_cmnd *cmd)
>> -{
>> -    const char *devname = cmd->request->rq_disk ?
>> -        cmd->request->rq_disk->disk_name : "scsi";
>> -    scsi_show_result(cmd->device, devname, cmd->result);
>> -}
>> -EXPORT_SYMBOL(scsi_print_result);
>> diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
>> index 2bea4f0..6ffbc40 100644
>> --- a/drivers/scsi/scsi_trace.c
>> +++ b/drivers/scsi/scsi_trace.c
>> @@ -19,6 +19,8 @@
>>   #include <linux/trace_seq.h>
>>   #include <trace/events/scsi.h>
>>
>> +#include <scsi/scsi_dbg.h>
>> +
>>   #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f)
>>   #define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9])
>>
>> @@ -286,3 +288,17 @@ scsi_trace_parse_cdb(struct trace_seq *p,
>> unsigned char *cdb, int len)
>>           return scsi_trace_misc(p, cdb, len);
>>       }
>>   }
>> +
>> +void scsi_show_result(struct scsi_device *sdev, const char *name, int
>> result)
>> +{
>> +    trace_scsi_show_result(sdev, name, result);
>> +}
>> +EXPORT_SYMBOL(scsi_show_result);
>> +
>> +void scsi_print_result(struct scsi_cmnd *cmd)
>> +{
>> +    const char *devname = cmd->request->rq_disk ?
>> +        cmd->request->rq_disk->disk_name : "scsi";
>> +    scsi_show_result(cmd->device, devname, cmd->result);
>> +}
>> +EXPORT_SYMBOL(scsi_print_result);
>> diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
>> index 8aecdc2..0675195 100644
>> --- a/include/trace/events/scsi.h
>> +++ b/include/trace/events/scsi.h
>> @@ -123,7 +123,11 @@
>>           scsi_hostbyte_name(DID_IMM_RETRY),        \
>>           scsi_hostbyte_name(DID_REQUEUE),        \
>>           scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED),    \
>> -        scsi_hostbyte_name(DID_TRANSPORT_FAILFAST))
>> +        scsi_hostbyte_name(DID_TRANSPORT_FAILFAST),    \
>> +        scsi_hostbyte_name(DID_TARGET_FAILURE),        \
>> +        scsi_hostbyte_name(DID_NEXUS_FAILURE),        \
>> +        scsi_hostbyte_name(DID_ALLOC_FAILURE),        \
>> +        scsi_hostbyte_name(DID_MEDIUM_ERROR))
>>
>>   #define scsi_driverbyte_name(result)    { result, #result }
>>   #define show_driverbyte_name(val)                \
>> @@ -359,6 +363,38 @@ TRACE_EVENT(scsi_eh_wakeup,
>>       TP_printk("host_no=%u", __entry->host_no)
>>   );
>>
>> +TRACE_EVENT(scsi_show_result,
>> +
>> +    TP_PROTO(struct scsi_device *sdev, const char *devname, int result),
>> +
>> +    TP_ARGS(sdev, devname, result),
>> +
>> +    TP_STRUCT__entry(
>> +        __field( unsigned int,    host_no    )
>> +        __field( unsigned int,    channel    )
>> +        __field( unsigned int,    id    )
>> +        __field( unsigned int,    lun    )
>> +        __string(devname,    devname    )
>> +        __field( int,        result    )
>> +    ),
>> +
>> +    TP_fast_assign(
>> +        __entry->host_no    = sdev->host->host_no;
>> +        __entry->channel    = sdev->channel;
>> +        __entry->id        = sdev->id;
>> +        __entry->lun        = sdev->lun;
>> +        __assign_str(devname, devname);
>> +        __entry->result        = result;
>> +    ),
>> +
>> +    TP_printk("host_no=%u channel=%u id=%u lun=%u [%s]
>> result=(driver=%s "\
>> +          "host=%s)",
>> +          __entry->host_no, __entry->channel, __entry->id, __entry->lun,
>> +          __get_str(devname),
>> +          show_driverbyte_name(driver_byte(__entry->result)),
>> +          show_hostbyte_name(host_byte(__entry->result)))
>> +);
>> +
>>   #endif /*  _TRACE_SCSI_H */
>>
>>   /* This part must be outside protection */
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> Hmm.
> I'm not sure this is the correct way.
> Currently we have quite some code duplication in scsi_trace.c and
> constants.c, correct.
> So I definitely would like to see them both merged.
>
> But constants.c is influenced by CONFIG_SCSI_CONSTANTS, whereas
> scsi_trace isn't, and the functions in constants.c are used throughout
> the scsi stack.
> So I'd rather see to have scsi_trace to be updated to use the functions
> from constants.c, and remove the duplicate code in
> scsi_trace.

Sure. We'll use decoder in constants.c.
We need to support raw output format for existing traceevents.

> At a later step we should be working on removing/replacing existing
> logging code in the SCSI stack with trace points, but that should be
> reserved for a separate patchset.

OK, I'll create a patch replacing existing decoder first, then
I'll add new traceevents.

Thanks,
Yoshihiro YUNOMAE

-- 
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae.ez@hitachi.com

  reply	other threads:[~2014-08-28  1:37 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 11:50 [RFC PATCH -logging 00/10] scsi/constants: Output continuous error messages on trace Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 01/10] scsi/constants: Cleanup printk message in __scsi_print_sense() Yoshihiro YUNOMAE
2014-08-12 14:51   ` Elliott, Robert (Server Storage)
2014-08-12 14:51     ` Elliott, Robert (Server Storage)
2014-08-13  3:14     ` Yoshihiro YUNOMAE
2014-08-27 13:56   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 02/10] scsi/constants: Cleanup printk message in scsi_decode_sense_extras() Yoshihiro YUNOMAE
2014-08-27 13:58   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 03/10] scsi/constants: Cleanup printk message in __scsi_print_command() Yoshihiro YUNOMAE
2014-08-15 15:05   ` Ewan Milne
2014-08-18  5:05     ` Yoshihiro YUNOMAE
2014-08-27 13:58   ` Hannes Reinecke
2014-08-27 13:58     ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 04/10] scsi/constants: Cleanup printk message in scsi_dump_sense_buffer() Yoshihiro YUNOMAE
2014-08-15 15:08   ` Ewan Milne
2014-08-18  5:06     ` Yoshihiro YUNOMAE
2014-08-27 13:59   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 05/10] scsi/trace: Use macros for getting driver byte, host byte, msg byte, and status byte Yoshihiro YUNOMAE
2014-08-15 15:10   ` Ewan Milne
2014-08-27 14:01   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 06/10] scsi/sd: Delete extra scsi_show_extd_sense() in sd_print_sense_hdr() Yoshihiro YUNOMAE
2014-08-15 15:14   ` Ewan Milne
2014-08-27 14:07   ` Hannes Reinecke
2014-08-08 11:50 ` [RFC PATCH 07/10] scsi/trace: Use scsi_show_result trace point instead of printk Yoshihiro YUNOMAE
2014-08-27 14:12   ` Hannes Reinecke
2014-08-27 14:12     ` Hannes Reinecke
2014-08-28  1:37     ` Yoshihiro YUNOMAE [this message]
2014-08-29  0:50     ` Christoph Hellwig
2014-09-03  1:17       ` Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 08/10] scsi/trace: Use scsi_print_sense " Yoshihiro YUNOMAE
2014-08-27 14:15   ` Hannes Reinecke
2014-08-28  1:39     ` Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 09/10] scsi/trace: Add additional sense code and additional sense code qualifier to scsi_print_sense trace point Yoshihiro YUNOMAE
2014-08-27 14:16   ` Hannes Reinecke
2014-08-27 14:16     ` Hannes Reinecke
2014-08-28  1:39     ` Yoshihiro YUNOMAE
2014-08-08 11:50 ` [RFC PATCH 10/10] scsi/trace: Use scsi_print_command trace point instead of printk Yoshihiro YUNOMAE
2014-08-27 14:16   ` Hannes Reinecke
2014-08-28  1:40     ` Yoshihiro YUNOMAE
2014-08-28  6:19       ` Yoshihiro YUNOMAE
2014-08-28 12:15         ` Hannes Reinecke
2014-08-28 12:15           ` Hannes Reinecke
2014-09-01  6:38           ` Yoshihiro YUNOMAE
2014-08-08 13:07 ` [RFC PATCH -logging 00/10] scsi/constants: Output continuous error messages on trace Douglas Gilbert
2014-08-13  3:13   ` Yoshihiro YUNOMAE
2014-08-22 19:54     ` Douglas Gilbert
2014-08-26 14:23       ` Hannes Reinecke
2014-08-27 14:23   ` Hannes Reinecke
2014-08-27 14:23     ` Hannes Reinecke
2014-08-27 14:48     ` Douglas Gilbert
2014-08-22  0:39 ` Elliott, Robert (Server Storage)
2014-08-22  0:39   ` Elliott, Robert (Server Storage)
2014-08-24 20:44   ` scsi logging future directions, was " Christoph Hellwig
2014-08-25 11:30     ` Hannes Reinecke
2014-08-26  8:53   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53FE87E5.6030604@hitachi.com \
    --to=yoshihiro.yunomae.ez@hitachi.com \
    --cc=JBottomley@parallels.com \
    --cc=dgilbert@interlog.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=yrl.pp-manager.tt@hitachi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.