Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request
Hello, I am responding to this, but noticed your next, fixed version. > On 17.10.2014, at 23.20, Laurence Oberman wrote: > > Hello Kai > > You have seen this patch before. The first time around, given that we don't > enable DEBUG by default, I let it go. > However we have been looking into defining DEBUG 1 by default here at Redhat > and then setting the default to disabled. > > Are you open to considering changing the driver based on this patch. > i.e. default DEFINE 1 and adding this code with default set to off. > Yes. I certainly think defining DEBUG 1 and changing the default to zero should be done if it is useful for supporting users. The runtime overhead is negligible and the extra code does not matter nowadays (it did matter, at least theoretically, for years ago). I am not so sure about the module option. When the debugging code is compiled in, debugging can be enabled and disabled for each device by the MTIOCTOP ioctl (e.g., mtst -f tape_device stsetoptions debug). The module option enables debugging for all tape devices. However, if you think this additional module option is useful, I am not against it. It does not remove the possibility for controlling debugging for each device for those who want to do it that way. Anyway, you should modify the documentation (Documentation/scsi/st.txt) according to the changes. > Note that with DEBUG 0, as you know you need to change that and recompile. > That is exactly what I am trying to avoid with Enterprise customers. > I have also noticed this when someone has asked me about some tape problems. > This patch adds a debug_flag parameter that can be set on module load, and > allows the DEBUG facility without a module recompile. > Note that now DEBUG 1 is the default with this patch. > > Usage: modprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman > > diff -Nur a/st.c b/st.c > --- a/st.c2014-10-17 16:15:54.103810627 -0400 > +++ b/st.c2014-10-17 16:22:12.303810392 -0400 > @@ -56,7 +56,7 @@ > > /* The driver prints some debugging information on the console if DEBUG >is defined and non-zero. */ > -#define DEBUG 0 > +#define DEBUG 1 > > #define ST_DEB_MSG KERN_NOTICE > #if DEBUG > @@ -80,6 +80,7 @@ > static int try_direct_io = TRY_DIRECT_IO; > static int try_rdio = 1; > static int try_wdio = 1; > +static int debug_flag = 0; > > static struct class st_sysfs_class; > static const struct attribute_group *st_dev_groups[]; > @@ -100,6 +101,9 @@ > MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to > use (256)"); > module_param_named(try_direct_io, try_direct_io, int, 0); > MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape > drive (1)"); > +module_param_named(debug_flag, debug_flag, int, 0); > +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); > + > > /* Extra parameters for testing */ > module_param_named(try_rdio, try_rdio, int, 0); > @@ -124,6 +128,9 @@ > }, > { > "try_direct_io", &try_direct_io > +}, > +{ > +"debug_flag", &debug_flag > } > }; > #endif > @@ -4306,6 +4313,11 @@ > > validate_options(); > > +debugging = (debug_flag > 0) ? debug_flag : DEBUG; > + if (debugging) > +printk(KERN_INFO "st: Debugging enabled debug_flag = > %d\n",debugging); > + > + I think you have an extra newline here? I also think that the kernel log would look nicer if the print below would be before setting the option. The driver would introduce itself first and print the debug flag status after that. > printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", > verstr, st_fixed_buffer_size, st_max_sg_segs); Thanks, Kai -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Sparc ESP problem with blk-mq
> > Christoph, I don't see how the new tagging code with blk-mq can > > be providing compatible behavior for existing SCSI drivers. > > It doesn't, and that's my fault. > > Please try the patch below: Seems to have worked - the machine booted up with scsi blk mq enabled, I just can not log in since I forgot to apply the fault code ptach and mys ssh is killed. -- Meelis Roos (mr...@linux.ee) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Bug 85151] pm80xx + 7805H + HP SAS port expander = mpi_smp_completion 2604:smp IO status 0x2 and sas: expander ... discovery failed(0xffffffa6)
https://bugzilla.kernel.org/show_bug.cgi?id=85151 --- Comment #15 from linux-...@crashplan.pro --- After the patch there are less issues. However only 1 HP SAS expander is usable on the Adaptec/Pmcs 2280800-R 7805H. # uname -a Linux ubuntu14 3.17.0-031700rc7-generic #201409281835 SMP Sun Sep 28 22:36:30 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux case #1: Attaching 1 expander to HBA port #1 (closest to bracket) = all 32 drives # lsscsi -g [0:0:0:0]diskATA OCZ-VERTEX 1.3 /dev/sda /dev/sg0 [4:0:0:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdb /dev/sg1 [4:0:1:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdc /dev/sg2 [4:0:2:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdd /dev/sg3 [4:0:3:0]diskATA Hitachi HDS5C302 AAB0 /dev/sde /dev/sg4 [4:0:4:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdf /dev/sg5 [4:0:5:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdg /dev/sg6 [4:0:6:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdh /dev/sg7 [4:0:7:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdi /dev/sg8 [4:0:8:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdj /dev/sg9 [4:0:9:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdk /dev/sg10 [4:0:10:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdl /dev/sg11 [4:0:11:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdm /dev/sg12 [4:0:12:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdn /dev/sg13 [4:0:13:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdo /dev/sg14 [4:0:14:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdp /dev/sg15 [4:0:15:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdq /dev/sg16 [4:0:16:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdr /dev/sg17 [4:0:17:0] diskATA Hitachi HDS5C302 AAB0 /dev/sds /dev/sg18 [4:0:18:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdt /dev/sg19 [4:0:19:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdu /dev/sg20 [4:0:20:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdv /dev/sg21 [4:0:21:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdw /dev/sg22 [4:0:22:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdx /dev/sg23 [4:0:23:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdy /dev/sg24 [4:0:24:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdz /dev/sg25 [4:0:25:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdaa /dev/sg26 [4:0:26:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdab /dev/sg27 [4:0:27:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdac /dev/sg28 [4:0:28:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdad /dev/sg29 [4:0:29:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdae /dev/sg30 [4:0:30:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdaf /dev/sg31 [4:0:31:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdag /dev/sg32 [4:0:32:0] enclosu HP HP SAS EXP Card 2.10 - /dev/sg33 case #2: Attaching 1 expander to HBA port #2 = all 32 drives # lsscsi -g [0:0:0:0]diskATA OCZ-VERTEX 1.3 /dev/sda /dev/sg0 [4:0:0:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdb /dev/sg1 [4:0:1:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdc /dev/sg2 [4:0:2:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdd /dev/sg3 [4:0:3:0]diskATA Hitachi HDS5C302 AAB0 /dev/sde /dev/sg4 [4:0:4:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdf /dev/sg5 [4:0:5:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdg /dev/sg6 [4:0:6:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdh /dev/sg7 [4:0:7:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdi /dev/sg8 [4:0:8:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdj /dev/sg9 [4:0:9:0]diskATA Hitachi HDS5C302 AAB0 /dev/sdk /dev/sg10 [4:0:10:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdl /dev/sg11 [4:0:11:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdm /dev/sg12 [4:0:12:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdn /dev/sg13 [4:0:13:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdo /dev/sg14 [4:0:14:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdp /dev/sg15 [4:0:15:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdq /dev/sg16 [4:0:16:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdr /dev/sg17 [4:0:17:0] diskATA Hitachi HDS5C302 AAB0 /dev/sds /dev/sg18 [4:0:18:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdt /dev/sg19 [4:0:19:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdu /dev/sg20 [4:0:20:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdv /dev/sg21 [4:0:21:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdw /dev/sg22 [4:0:22:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdx /dev/sg23 [4:0:23:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdy /dev/sg24 [4:0:24:0] diskATA Hitachi HDS5C302 AAB0 /dev/sdz /dev/sg25 [4:0:25:0] diskATA Hitachi HDS5C302 AAB0 /dev/sd
[Bug 85151] pm80xx + 7805H + HP SAS port expander = mpi_smp_completion 2604:smp IO status 0x2 and sas: expander ... discovery failed(0xffffffa6)
https://bugzilla.kernel.org/show_bug.cgi?id=85151 --- Comment #16 from linux-...@crashplan.pro --- Created attachment 154171 --> https://bugzilla.kernel.org/attachment.cgi?id=154171&action=edit dmesg after first pm80xx patch, having 2 expanders attached in parallel -- You are receiving this mail because: You are watching the assignee of the bug. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request
Hello Kai Thanks. Here is v3 This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. Note that now DEBUG 1 is the default with this patch. Usage: modprobe st debug_flag=1 Signed-off-by: Laurence Oberman diff -Nur a/Documentation/scsi/st.txt b/Documentation/scsi/st.txt --- a/Documentation/scsi/st.txt 2014-10-19 09:36:52.243863716 -0400 +++ b/Documentation/scsi/st.txt 2014-10-19 09:43:19.222863447 -0400 @@ -506,9 +506,11 @@ DEBUGGING HINTS -To enable debugging messages, edit st.c and #define DEBUG 1. As seen -above, debugging can be switched off with an ioctl if debugging is -compiled into the driver. The debugging output is not voluminous. +Debugging code is now compiled in by default but debugging is turned off with +the kernel module parameter debug_flag defaulting to 0. +Debugging can still be switched on and off with an ioctl. +To enable debug at module load time add debug_flag=1 to the module load +options, the debugging output is not voluminous. If the tape seems to hang, I would be very interested to hear where the driver is waiting. With the command 'ps -l' you can see the state diff -Nur a/drivers/scsi/st.c b/drivers/scsi/st.c --- a/drivers/scsi/st.c 2014-10-19 09:35:45.673863756 -0400 +++ b/drivers/scsi/st.c 2014-10-19 09:35:30.621863483 -0400 @@ -56,7 +56,8 @@ /* The driver prints some debugging information on the console if DEBUG is defined and non-zero. */ -#define DEBUG 0 +#define DEBUG 1 +#define NO_DEBUG 0 #define ST_DEB_MSG KERN_NOTICE #if DEBUG @@ -80,6 +81,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +102,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +129,9 @@ }, { "try_direct_io", &try_direct_io +}, +{ +"debug_flag", &debug_flag } }; #endif @@ -4309,6 +4317,10 @@ printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", verstr, st_fixed_buffer_size, st_max_sg_segs); +debugging = (debug_flag > 0) ? debug_flag : NO_DEBUG; + if (debugging) +printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); + err = class_register(&st_sysfs_class); if (err) { pr_err("Unable register sysfs class for SCSI tapes\n"); - Original Message - From: "Kai Mäkisara (Kolumbus)" To: "Laurence Oberman" Cc: "Rob Evers" , linux-scsi@vger.kernel.org Sent: Sunday, October 19, 2014 4:54:10 AM Subject: Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Hello, I am responding to this, but noticed your next, fixed version. > On 17.10.2014, at 23.20, Laurence Oberman wrote: > > Hello Kai > > You have seen this patch before. The first time around, given that we don't > enable DEBUG by default, I let it go. > However we have been looking into defining DEBUG 1 by default here at Redhat > and then setting the default to disabled. > > Are you open to considering changing the driver based on this patch. > i.e. default DEFINE 1 and adding this code with default set to off. > Yes. I certainly think defining DEBUG 1 and changing the default to zero should be done if it is useful for supporting users. The runtime overhead is negligible and the extra code does not matter nowadays (it did matter, at least theoretically, for years ago). I am not so sure about the module option. When the debugging code is compiled in, debugging can be enabled and disabled for each device by the MTIOCTOP ioctl (e.g., mtst -f tape_device stsetoptions debug). The module option enables debugging for all tape devices. However, if you think this additional module option is useful, I am not against it. It does not remove the possibility for controlling debugging for each device for those who want to do it that way. Anyway, you should modify the documentation (Documentation/scsi/st.txt) according to the changes. > Note that with DEBUG 0, as you know you need to change that and recompile. > That is exactly what I am trying to avoid with Enterprise customers. > I have also noticed this when someone has asked me about some tape problems. > This patch adds a debug_flag parameter that can be set on module load, and > allows the DEBUG facility without a module recompile. > Note that now DEBUG 1 is the default with t
Re: Sparc ESP problem with blk-mq
On Sun, Oct 19, 2014 at 03:10:00PM +0300, mr...@linux.ee wrote: > > > Christoph, I don't see how the new tagging code with blk-mq can > > > be providing compatible behavior for existing SCSI drivers. > > > > It doesn't, and that's my fault. > > > > Please try the patch below: > > Seems to have worked - the machine booted up with scsi blk mq enabled, I > just can not log in since I forgot to apply the fault code ptach and mys > ssh is killed. Thanks for the testing. I will split, document and submit the patch ASAP. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH scsi] libcxgbi : support ipv6 address host_param
On Sun, Oct 19, 2014 at 04:07:59AM +, Anish Bhatt wrote: > Aah, thanks for the clarification. I have made mistakenly made this patch > against drivers-for-3.18 then, but it applies cleanly to drivers-for-3.17 as > well, please apply this to drivers-for-3.17. Linux 3.17 has been released. The current merge window is the one for 3.18, expected to be closed in about a week. So urgent patches go into that, maybe with a Cc to sta...@vger.kernel.org if they fix regressions. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
fix blk-mq for SPI hosts
Fix the assumption that we can treat all blk-mq requests as tagged. For traditional SCSI that's wrong, as being tagged has a very explicit meaning on the wire. This is a little bit different from the version Meelis tested earlier, but the concept is the same. I didn't want to add a Tested-by tag as it's different enough, though. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] Revert "block: all blk-mq requests are tagged"
This reverts commit fb3ccb5da71273e7f0d50b50bc879e50cedd60e7. SCSI-2/SPI actually needs the tagged/untagged flag in the request to work properly. Revert this patch and add a follow on to set it in the right place. Reported-by: Meelis Roos Signed-off-by: Christoph Hellwig Cc: sta...@vger.kernel.org --- include/linux/blkdev.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0207a78..51d0dc2 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1136,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) /* * tag stuff */ -#define blk_rq_tagged(rq) \ - ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED)) +#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) extern int blk_queue_start_tag(struct request_queue *, struct request *); extern struct request *blk_queue_find_tag(struct request_queue *, int); extern void blk_queue_end_tag(struct request_queue *, struct request *); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] scsi: set REQ_QUEUE for the blk-mq case
To generate the right SPI tag messages we need to properly set QUEUE_FLAG_QUEUED in the request_queue and mirror it to the request. Reported-by: Meelis Roos Signed-off-by: Christoph Hellwig Cc: sta...@vger.kernel.org --- drivers/scsi/scsi_lib.c | 5 + include/scsi/scsi_tcq.h | 8 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9eff8a3..50a6e1a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1893,6 +1893,11 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req, blk_mq_start_request(req); } + if (blk_queue_tagged(q)) + req->cmd_flags |= REQ_QUEUED; + else + req->cmd_flags &= ~REQ_QUEUED; + scsi_init_cmd_errh(cmd); cmd->scsi_done = scsi_mq_done; diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index e645835..56ed843 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h @@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) if (!sdev->tagged_supported) return; - if (!shost_use_blk_mq(sdev->host) && - !blk_queue_tagged(sdev->request_queue)) + if (shost_use_blk_mq(sdev->host)) + queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue); + else if (!blk_queue_tagged(sdev->request_queue)) blk_queue_init_tags(sdev->request_queue, depth, sdev->host->bqt); @@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) **/ static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth) { - if (!shost_use_blk_mq(sdev->host) && - blk_queue_tagged(sdev->request_queue)) + if (blk_queue_tagged(sdev->request_queue)) blk_queue_free_tags(sdev->request_queue); scsi_adjust_queue_depth(sdev, 0, depth); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] storvsc: set cmd_info and avoid mempool allocation for per-cmd data
Signed-off-by: Christoph Hellwig --- drivers/scsi/storvsc_drv.c | 118 +++-- 1 file changed, 7 insertions(+), 111 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 733e5f7..0ddb0b6 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -309,14 +308,6 @@ enum storvsc_request_type { * This is the end of Protocol specific defines. */ - -/* - * We setup a mempool to allocate request structures for this driver - * on a per-lun basis. The following define specifies the number of - * elements in the pool. - */ - -#define STORVSC_MIN_BUF_NR 64 static int storvsc_ringbuffer_size = (20 * PAGE_SIZE); module_param(storvsc_ringbuffer_size, int, S_IRUGO); @@ -346,7 +337,6 @@ static void storvsc_on_channel_callback(void *context); #define STORVSC_IDE_MAX_CHANNELS 1 struct storvsc_cmd_request { - struct list_head entry; struct scsi_cmnd *cmd; unsigned int bounce_sgl_count; @@ -357,7 +347,6 @@ struct storvsc_cmd_request { /* Synchronize the request/response if needed */ struct completion wait_event; - unsigned char *sense_buffer; struct hv_multipage_buffer data_buffer; struct vstor_packet vstor_packet; }; @@ -389,11 +378,6 @@ struct storvsc_device { struct storvsc_cmd_request reset_request; }; -struct stor_mem_pools { - struct kmem_cache *request_pool; - mempool_t *request_mempool; -}; - struct hv_host_device { struct hv_device *dev; unsigned int port; @@ -1070,10 +1054,8 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request) { struct scsi_cmnd *scmnd = cmd_request->cmd; struct hv_host_device *host_dev = shost_priv(scmnd->device->host); - void (*scsi_done_fn)(struct scsi_cmnd *); struct scsi_sense_hdr sense_hdr; struct vmscsi_request *vm_srb; - struct stor_mem_pools *memp = scmnd->device->hostdata; struct Scsi_Host *host; struct storvsc_device *stor_dev; struct hv_device *dev = host_dev->dev; @@ -1108,14 +1090,7 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request) cmd_request->data_buffer.len - vm_srb->data_transfer_length); - scsi_done_fn = scmnd->scsi_done; - - scmnd->host_scribble = NULL; - scmnd->scsi_done = NULL; - - scsi_done_fn(scmnd); - - mempool_free(cmd_request, memp->request_mempool); + scmnd->scsi_done(scmnd); } static void storvsc_on_io_completion(struct hv_device *device, @@ -1159,7 +1134,7 @@ static void storvsc_on_io_completion(struct hv_device *device, SRB_STATUS_AUTOSENSE_VALID) { /* autosense data available */ - memcpy(request->sense_buffer, + memcpy(request->cmd->sense_buffer, vstor_packet->vm_srb.sense_data, vstor_packet->vm_srb.sense_info_length); @@ -1377,55 +1352,6 @@ static int storvsc_do_io(struct hv_device *device, return ret; } -static int storvsc_device_alloc(struct scsi_device *sdevice) -{ - struct stor_mem_pools *memp; - int number = STORVSC_MIN_BUF_NR; - - memp = kzalloc(sizeof(struct stor_mem_pools), GFP_KERNEL); - if (!memp) - return -ENOMEM; - - memp->request_pool = - kmem_cache_create(dev_name(&sdevice->sdev_dev), - sizeof(struct storvsc_cmd_request), 0, - SLAB_HWCACHE_ALIGN, NULL); - - if (!memp->request_pool) - goto err0; - - memp->request_mempool = mempool_create(number, mempool_alloc_slab, - mempool_free_slab, - memp->request_pool); - - if (!memp->request_mempool) - goto err1; - - sdevice->hostdata = memp; - - return 0; - -err1: - kmem_cache_destroy(memp->request_pool); - -err0: - kfree(memp); - return -ENOMEM; -} - -static void storvsc_device_destroy(struct scsi_device *sdevice) -{ - struct stor_mem_pools *memp = sdevice->hostdata; - - if (!memp) - return; - - mempool_destroy(memp->request_mempool); - kmem_cache_destroy(memp->request_pool); - kfree(memp); - sdevice->hostdata = NULL; -} - static int storvsc_device_configure(struct scsi_device *sdevice) { scsi_adjust_queue_depth(sdevice, MSG_SIMPLE_TAG, @@ -1561,13 +1487,11 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) int ret; struct hv_host_device *host_dev = shost_priv(host); struct hv_device *dev = host_d
hyperv storvsc cleanup / optimization
Hi KY, can you throw the patch below into your testing rig? It converts the storvsc driver to use our new cmd_size field, and thus avoids all the slab/mepool infrastructure for private data in the driver. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: hyperv storvsc cleanup / optimization
> -Original Message- > From: Christoph Hellwig [mailto:h...@lst.de] > Sent: Sunday, October 19, 2014 8:18 AM > To: KY Srinivasan > Cc: linux-scsi@vger.kernel.org > Subject: hyperv storvsc cleanup / optimization > > Hi KY, > > can you throw the patch below into your testing rig? It converts the storvsc > driver to use our new cmd_size field, and thus avoids all the slab/mepool > infrastructure for private data in the driver. Will do. K. Y -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 03/12] scsi-mq: Add support for multiple hardware queues
On 10/7/2014 4:03 PM, Bart Van Assche wrote: Allow a SCSI LLD to declare how many hardware queues it supports by setting Scsi_Host.nr_hw_queues before calling scsi_add_host(). Note: it is assumed that each hardware queue has a queue depth of shost->can_queue. In other words, the total queue depth per host is (number of hardware queues) * (shost->can_queue). Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg --- drivers/scsi/scsi_lib.c | 2 +- include/scsi/scsi_host.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index db8c449..f829c42 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2072,7 +2072,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) memset(&shost->tag_set, 0, sizeof(shost->tag_set)); shost->tag_set.ops = &scsi_mq_ops; - shost->tag_set.nr_hw_queues = 1; + shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1; shost->tag_set.queue_depth = shost->can_queue; shost->tag_set.cmd_size = cmd_size; shost->tag_set.numa_node = NUMA_NO_NODE; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index cafb260..d38cab9 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -638,6 +638,10 @@ struct Scsi_Host { short unsigned int sg_prot_tablesize; unsigned int max_sectors; unsigned long dma_boundary; + /* +* In scsi-mq mode, the number of hardware queues supported by the LLD. +*/ + unsigned nr_hw_queues; /* * Used to assign serial numbers to the cmds. * Protected by the host lock. Reviewed-by: Sagi Grimberg -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Bug 81861] Oops by mvsas v0.8.16: sas: ataX: end_device-Y:0:Z: dev error handler -> general protection fault, RIP: mvs_task_prep_ata+0x80/0x3a0
https://bugzilla.kernel.org/show_bug.cgi?id=81861 linux-...@crashplan.pro changed: What|Removed |Added Kernel Version|3.16.0 |3.17.1 --- Comment #18 from linux-...@crashplan.pro --- Even after flashing the SAS2LP-MV8 its firmware from version 4.0.0.1800 to version 4.0.0.1812 the mvs_task_prep_ata+0x80/0x3a0 [mvsas] kernel oops issue persists on kernel: 1. "Linux ubuntu25 3.17.1-031701-generic #201410150735 SMP Wed Oct 15 11:36:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux" and 2. "Linux ubuntu25 3.17.0-999-generic #201410182205 SMP Sun Oct 19 02:06:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux" -- You are receiving this mail because: You are watching the assignee of the bug. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 04/12] scsi_tcq.h: Add support for multiple hardware queues
On 10/7/2014 4:04 PM, Bart Van Assche wrote: Modify scsi_find_tag() and scsi_host_find_tag() such that these fuctions can translate a tag generated by blk_mq_unique_tag(). Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg --- include/scsi/scsi_tcq.h | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index e645835..ea1ca9c 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h @@ -111,18 +111,21 @@ static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg) } static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost, - unsigned int hw_ctx, int tag) +int unique_tag) { - struct request *req; + u16 hwq = blk_mq_unique_tag_to_hwq(unique_tag); + struct request *req = NULL; - req = blk_mq_tag_to_rq(shost->tag_set.tags[hw_ctx], tag); + if (hwq < shost->tag_set.nr_hw_queues) + req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq], + blk_mq_unique_tag_to_tag(unique_tag)); return req ? (struct scsi_cmnd *)req->special : NULL; } /** * scsi_find_tag - find a tagged command by device * @SDpnt:pointer to the ScSI device - * @tag: the tag number + * @tag: tag generated by blk_mq_unique_tag() * * Notes: *Only works with tags allocated by the generic blk layer. @@ -133,9 +136,9 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag) if (tag != SCSI_NO_TAG) { if (shost_use_blk_mq(sdev->host)) - return scsi_mq_find_tag(sdev->host, 0, tag); + return scsi_mq_find_tag(sdev->host, tag); - req = blk_queue_find_tag(sdev->request_queue, tag); + req = blk_queue_find_tag(sdev->request_queue, tag); Why is this line different? return req ? (struct scsi_cmnd *)req->special : NULL; } @@ -174,7 +177,7 @@ static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) /** * scsi_host_find_tag - find the tagged command by host * @shost:pointer to scsi_host - * @tag: tag of the scsi_cmnd + * @tag: tag generated by blk_mq_unique_tag() * * Notes: *Only works with tags allocated by the generic blk layer. @@ -186,7 +189,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost, if (tag != SCSI_NO_TAG) { if (shost_use_blk_mq(shost)) - return scsi_mq_find_tag(shost, 0, tag); + return scsi_mq_find_tag(shost, tag); req = blk_map_queue_find_tag(shost->bqt, tag); return req ? (struct scsi_cmnd *)req->special : NULL; } -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 02/12] blk-mq: Add blk_mq_unique_tag()
On 10/13/2014 1:15 PM, Christoph Hellwig wrote: On Mon, Oct 13, 2014 at 11:21:54AM +0200, Bart Van Assche wrote: With the approach for block layer tag management proposed in this patch series SCSI LLDs no longer need to call this function. This means that the blk_mq_build_unique_tag() function can be eliminated by inlining it into blk_mq_unique_tag(). Would you like me to rework this patch accordingly ? Yes, please. With this bit you can add: Reviewed-by: Sagi Grimberg -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 07/12] IB/srp: Avoid that I/O hangs due to a cable pull during LUN scanning
On 10/7/2014 4:05 PM, Bart Van Assche wrote: If a cable is pulled during LUN scanning it can happen that the SRP rport and the SCSI host have been created but no LUNs have been added to the SCSI host. Since multipathd only sends SCSI commands to a SCSI target if one or more SCSI devices are present and since there is no keepalive mechanism for IB queue pairs this means that after a LUN scan failed and after a reconnect has succeeded no data will be sent over the QP and hence that a subsequent cable pull will not be detected. Avoid this by not creating an rport or SCSI host if a cable is pulled during a SCSI LUN scan. Note: so far the above behavior has only been observed with the kernel module parameter ch_count set to a value >= 2. Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer --- drivers/infiniband/ulp/srp/ib_srp.c | 60 +++-- drivers/infiniband/ulp/srp/ib_srp.h | 1 + 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 9608e7a..a662c29 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -,6 +,10 @@ static int srp_rport_reconnect(struct srp_rport *rport) int i, ret; srp_disconnect_target(target); + + if (target->state == SRP_TARGET_SCANNING) + return -ENODEV; + /* * Now get a new local CM ID so that we avoid confusing the target in * case things are really fouled up. Doing so also ensures that all CM @@ -2607,11 +2611,23 @@ static struct scsi_host_template srp_template = { .shost_attrs= srp_host_attrs }; +static int srp_sdev_count(struct Scsi_Host *host) +{ + struct scsi_device *sdev; + int c = 0; + + shost_for_each_device(sdev, host) + c++; + + return c; +} + Is this really an SRP specific routine? Can you move it to a more natural location? static int srp_add_target(struct srp_host *host, struct srp_target_port *target) { struct srp_rport_identifiers ids; struct srp_rport *rport; + target->state = SRP_TARGET_SCANNING; sprintf(target->target_name, "SRP.T10:%016llX", (unsigned long long) be64_to_cpu(target->id_ext)); @@ -2634,11 +2650,26 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target) list_add_tail(&target->list, &host->target_list); spin_unlock(&host->target_lock); - target->state = SRP_TARGET_LIVE; - scsi_scan_target(&target->scsi_host->shost_gendev, 0, target->scsi_id, SCAN_WILD_CARD, 0); + if (!target->connected || target->qp_in_error) { + shost_printk(KERN_INFO, target->scsi_host, +PFX "SCSI scan failed - removing SCSI host\n"); + srp_queue_remove_work(target); + goto out; + } So my impression is that by conditioning target->qp_in_error you are relying on the fact that SRP eh was invoked here (RC error), what if scsi eh was invoked prior to that? did you test this path? + + pr_debug(PFX "%s: SCSI scan succeeded - detected %d LUNs\n", +dev_name(&target->scsi_host->shost_gendev), +srp_sdev_count(target->scsi_host)); + + spin_lock_irq(&target->lock); + if (target->state == SRP_TARGET_SCANNING) + target->state = SRP_TARGET_LIVE; + spin_unlock_irq(&target->lock); + +out: return 0; } @@ -2982,6 +3013,12 @@ static ssize_t srp_create_target(struct device *dev, target->tl_retry_count = 7; target->queue_size = SRP_DEFAULT_QUEUE_SIZE; + /* +* Avoid that the SCSI host can be removed by srp_remove_target() +* before this function returns. +*/ + scsi_host_get(target->scsi_host); + mutex_lock(&host->add_target_mutex); ret = srp_parse_options(buf, target); @@ -3044,18 +3081,23 @@ static ssize_t srp_create_target(struct device *dev, if (ret) goto err_disconnect; - shost_printk(KERN_DEBUG, target->scsi_host, PFX -"new target: id_ext %016llx ioc_guid %016llx pkey %04x service_id %016llx sgid %pI6 dgid %pI6\n", -be64_to_cpu(target->id_ext), -be64_to_cpu(target->ioc_guid), -be16_to_cpu(target->path.pkey), -be64_to_cpu(target->service_id), -target->path.sgid.raw, target->path.dgid.raw); + if (target->state != SRP_TARGET_REMOVED) { + shost_printk(KERN_DEBUG, target->scsi_host, PFX +"new target: id_ext %016llx ioc_guid %016llx pkey %04x service_id %016llx sgid %pI6 dgid %pI6\n", +be64_to_cpu(target->id_ext), +be64_to_cpu(target->ioc_guid), +
Re: [PATCH v2 08/12] IB/srp: Introduce two new srp_target_port member variables
On 10/7/2014 4:05 PM, Bart Van Assche wrote: Introduce the srp_target_port member variables 'sgid' and 'pkey'. Change the type of 'orig_dgid' from __be16[8] into union ib_gid. This patch does not change any functionality but makes the "Separate target and channel variables" patch easier to verify. Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer --- drivers/infiniband/ulp/srp/ib_srp.c | 39 ++--- drivers/infiniband/ulp/srp/ib_srp.h | 4 +++- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index a662c29..5685062 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -262,7 +262,7 @@ static int srp_init_qp(struct srp_target_port *target, ret = ib_find_pkey(target->srp_host->srp_dev->dev, target->srp_host->port, - be16_to_cpu(target->path.pkey), + be16_to_cpu(target->pkey), &attr->pkey_index); if (ret) goto out; @@ -295,6 +295,10 @@ static int srp_new_cm_id(struct srp_target_port *target) if (target->cm_id) ib_destroy_cm_id(target->cm_id); target->cm_id = new_cm_id; + target->path.sgid = target->sgid; + target->path.dgid = target->orig_dgid; + target->path.pkey = target->pkey; + target->path.service_id = target->service_id; return 0; } @@ -689,7 +693,7 @@ static int srp_send_req(struct srp_target_port *target) */ if (target->io_class == SRP_REV10_IB_IO_CLASS) { memcpy(req->priv.initiator_port_id, - &target->path.sgid.global.interface_id, 8); + &target->sgid.global.interface_id, 8); memcpy(req->priv.initiator_port_id + 8, &target->initiator_ext, 8); memcpy(req->priv.target_port_id, &target->ioc_guid, 8); @@ -698,7 +702,7 @@ static int srp_send_req(struct srp_target_port *target) memcpy(req->priv.initiator_port_id, &target->initiator_ext, 8); memcpy(req->priv.initiator_port_id + 8, - &target->path.sgid.global.interface_id, 8); + &target->sgid.global.interface_id, 8); memcpy(req->priv.target_port_id, &target->id_ext, 8); memcpy(req->priv.target_port_id + 8, &target->ioc_guid, 8); } @@ -2175,8 +2179,8 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id, else shost_printk(KERN_WARNING, shost, PFX "SRP LOGIN from %pI6 to %pI6 REJECTED, reason 0x%08x\n", -target->path.sgid.raw, -target->orig_dgid, reason); +target->sgid.raw, +target->orig_dgid.raw, reason); } else shost_printk(KERN_WARNING, shost, " REJ reason: IB_CM_REJ_CONSUMER_DEFINED," @@ -2464,7 +2468,7 @@ static ssize_t show_pkey(struct device *dev, struct device_attribute *attr, { struct srp_target_port *target = host_to_target(class_to_shost(dev)); - return sprintf(buf, "0x%04x\n", be16_to_cpu(target->path.pkey)); + return sprintf(buf, "0x%04x\n", be16_to_cpu(target->pkey)); } static ssize_t show_sgid(struct device *dev, struct device_attribute *attr, @@ -2472,7 +2476,7 @@ static ssize_t show_sgid(struct device *dev, struct device_attribute *attr, { struct srp_target_port *target = host_to_target(class_to_shost(dev)); - return sprintf(buf, "%pI6\n", target->path.sgid.raw); + return sprintf(buf, "%pI6\n", target->sgid.raw); } static ssize_t show_dgid(struct device *dev, struct device_attribute *attr, @@ -2488,7 +2492,7 @@ static ssize_t show_orig_dgid(struct device *dev, { struct srp_target_port *target = host_to_target(class_to_shost(dev)); - return sprintf(buf, "%pI6\n", target->orig_dgid); + return sprintf(buf, "%pI6\n", target->orig_dgid.raw); } static ssize_t show_req_lim(struct device *dev, @@ -2826,11 +2830,15 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target) } for (i = 0; i < 16; ++i) { - strlcpy(dgid, p + i * 2, 3); - target->path.dgid.raw[i] = simple_strtoul(dgid, NULL, 16); + strlcpy(dgid, p + i * 2, sizeof(dgid)); + if (sscanf(dgid, "%hhx", + &target->orig_dgid.raw[i]) < 1) { +
Re: [PATCH v2 09/12] IB/srp: Separate target and channel variables
On 10/7/2014 4:05 PM, Bart Van Assche wrote: Changes in this patch: - Move channel variables into a new structure (struct srp_rdma_ch). - Add an srp_target_port pointer, 'lock' and 'comp_vector' members in struct srp_rdma_ch. - Add code to initialize these three new member variables. - Many boring "target->" into "ch->" changes. - The cm_id and completion handler context pointers are now of type srp_rdma_ch * instead of srp_target_port *. - Three kzalloc(a * b, f) calls have been changed into kcalloc(a, b, f) to avoid that this patch would trigger a checkpatch warning. - Two casts from u64 into unsigned long long have been left out because these are superfluous. Since considerable time u64 is defined as unsigned long long for all architectures supported by the Linux kernel. This patch is pretty exhausting... Didn't find anything wrong but I didn't carefully review every bit of it. You can add: Acked-by: Sagi Grimberg Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer --- drivers/infiniband/ulp/srp/ib_srp.c | 674 +++- drivers/infiniband/ulp/srp/ib_srp.h | 64 ++-- 2 files changed, 403 insertions(+), 335 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 5685062..cc0bf83b 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -125,8 +125,8 @@ MODULE_PARM_DESC(dev_loss_tmo, static void srp_add_one(struct ib_device *device); static void srp_remove_one(struct ib_device *device); -static void srp_recv_completion(struct ib_cq *cq, void *target_ptr); -static void srp_send_completion(struct ib_cq *cq, void *target_ptr); +static void srp_recv_completion(struct ib_cq *cq, void *ch_ptr); +static void srp_send_completion(struct ib_cq *cq, void *ch_ptr); static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event); static struct scsi_transport_template *ib_srp_transport_template; @@ -283,22 +283,23 @@ out: return ret; } -static int srp_new_cm_id(struct srp_target_port *target) +static int srp_new_cm_id(struct srp_rdma_ch *ch) { + struct srp_target_port *target = ch->target; struct ib_cm_id *new_cm_id; new_cm_id = ib_create_cm_id(target->srp_host->srp_dev->dev, - srp_cm_handler, target); + srp_cm_handler, ch); if (IS_ERR(new_cm_id)) return PTR_ERR(new_cm_id); - if (target->cm_id) - ib_destroy_cm_id(target->cm_id); - target->cm_id = new_cm_id; - target->path.sgid = target->sgid; - target->path.dgid = target->orig_dgid; - target->path.pkey = target->pkey; - target->path.service_id = target->service_id; + if (ch->cm_id) + ib_destroy_cm_id(ch->cm_id); + ch->cm_id = new_cm_id; + ch->path.sgid = target->sgid; + ch->path.dgid = target->orig_dgid; + ch->path.pkey = target->pkey; + ch->path.service_id = target->service_id; return 0; } @@ -447,8 +448,9 @@ static struct srp_fr_pool *srp_alloc_fr_pool(struct srp_target_port *target) dev->max_pages_per_mr); } -static int srp_create_target_ib(struct srp_target_port *target) +static int srp_create_ch_ib(struct srp_rdma_ch *ch) { + struct srp_target_port *target = ch->target; struct srp_device *dev = target->srp_host->srp_dev; struct ib_qp_init_attr *init_attr; struct ib_cq *recv_cq, *send_cq; @@ -462,15 +464,15 @@ static int srp_create_target_ib(struct srp_target_port *target) if (!init_attr) return -ENOMEM; - recv_cq = ib_create_cq(dev->dev, srp_recv_completion, NULL, target, - target->queue_size, target->comp_vector); + recv_cq = ib_create_cq(dev->dev, srp_recv_completion, NULL, ch, + target->queue_size, ch->comp_vector); if (IS_ERR(recv_cq)) { ret = PTR_ERR(recv_cq); goto err; } - send_cq = ib_create_cq(dev->dev, srp_send_completion, NULL, target, - m * target->queue_size, target->comp_vector); + send_cq = ib_create_cq(dev->dev, srp_send_completion, NULL, ch, + m * target->queue_size, ch->comp_vector); if (IS_ERR(send_cq)) { ret = PTR_ERR(send_cq); goto err_recv_cq; @@ -506,9 +508,9 @@ static int srp_create_target_ib(struct srp_target_port *target) "FR pool allocation failed (%d)\n", ret); goto err_qp; } - if (target->fr_pool) - srp_destroy_fr_pool(target->fr_pool); - target->fr_pool = fr_pool; + if (ch->fr_pool) + srp_destroy_fr_pool(ch->fr_pool); +
Re: [PATCH v2 11/12] IB/srp: Eliminate free_reqs list
On 10/17/2014 1:59 PM, Christoph Hellwig wrote: On Tue, Oct 07, 2014 at 03:06:54PM +0200, Bart Van Assche wrote: The free_reqs list is no longer needed now that we are using tags assigned by the block layer. Hence remove it. Is there any good reason not to fold this into the previous patch? Agree. Sagi. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] MAINTAINERS: Change Boaz Harrosh's email
From: Boaz Harrosh I have moved on, and do no longer have Panasas email access. Update to an email that can reach me. So change bharr...@panasas.com => o...@electrozaur.com Explain of email address: * electrozaur.com is a domain owned by me. * ooo - Stands for Open Osd . Org Another email alias that can be used is: open...@gmail.com CC: Greg KH Signed-off-by: Boaz Harrosh --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index f10ed39..fc2c9a8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6725,7 +6725,7 @@ S:Orphan F: drivers/net/wireless/orinoco/ OSD LIBRARY and FILESYSTEM -M: Boaz Harrosh +M: Boaz Harrosh M: Benny Halevy L: osd-...@open-osd.org W: http://open-osd.org -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] Boaz Harrosh - Fix broken email address
From: Boaz Harrosh I no longer have access to the Panasas email. So change to an email that can always reach me. Signed-off-by: Boaz Harrosh --- drivers/scsi/osd/Kbuild | 2 +- drivers/scsi/osd/Kconfig| 2 +- drivers/scsi/osd/osd_debug.h| 2 +- drivers/scsi/osd/osd_initiator.c| 4 ++-- drivers/scsi/osd/osd_uld.c | 4 ++-- fs/exofs/Kbuild | 2 +- fs/exofs/common.h | 2 +- fs/exofs/dir.c | 2 +- fs/exofs/exofs.h| 2 +- fs/exofs/file.c | 2 +- fs/exofs/inode.c| 2 +- fs/exofs/namei.c| 2 +- fs/exofs/ore.c | 4 ++-- fs/exofs/ore_raid.c | 2 +- fs/exofs/ore_raid.h | 2 +- fs/exofs/super.c| 2 +- fs/exofs/symlink.c | 2 +- fs/exofs/sys.c | 2 +- fs/nfs/objlayout/objio_osd.c| 2 +- fs/nfs/objlayout/objlayout.c| 2 +- fs/nfs/objlayout/objlayout.h| 2 +- fs/nfs/objlayout/pnfs_osd_xdr_cli.c | 2 +- include/linux/pnfs_osd_xdr.h| 2 +- include/scsi/osd_initiator.h| 2 +- include/scsi/osd_ore.h | 2 +- include/scsi/osd_protocol.h | 4 ++-- include/scsi/osd_sec.h | 2 +- include/scsi/osd_sense.h| 2 +- include/scsi/osd_types.h| 2 +- 29 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/osd/Kbuild b/drivers/scsi/osd/Kbuild index 5fd73d77..58cecd4 100644 --- a/drivers/scsi/osd/Kbuild +++ b/drivers/scsi/osd/Kbuild @@ -4,7 +4,7 @@ # Copyright (C) 2008 Panasas Inc. All rights reserved. # # Authors: -# Boaz Harrosh +# Boaz Harrosh # Benny Halevy # # This program is free software; you can redistribute it and/or modify diff --git a/drivers/scsi/osd/Kconfig b/drivers/scsi/osd/Kconfig index a070351..347cc5e 100644 --- a/drivers/scsi/osd/Kconfig +++ b/drivers/scsi/osd/Kconfig @@ -4,7 +4,7 @@ # Copyright (C) 2008 Panasas Inc. All rights reserved. # # Authors: -# Boaz Harrosh +# Boaz Harrosh # Benny Halevy # # This program is free software; you can redistribute it and/or modify diff --git a/drivers/scsi/osd/osd_debug.h b/drivers/scsi/osd/osd_debug.h index 579e491..2634126 100644 --- a/drivers/scsi/osd/osd_debug.h +++ b/drivers/scsi/osd/osd_debug.h @@ -4,7 +4,7 @@ * Copyright (C) 2008 Panasas Inc. All rights reserved. * * Authors: - * Boaz Harrosh + * Boaz Harrosh * Benny Halevy * * This program is free software; you can redistribute it and/or modify diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index 5f4cbf0..52e243b 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c @@ -7,7 +7,7 @@ * Copyright (C) 2008 Panasas Inc. All rights reserved. * * Authors: - * Boaz Harrosh + * Boaz Harrosh * Benny Halevy * * This program is free software; you can redistribute it and/or modify @@ -57,7 +57,7 @@ enum { OSD_REQ_RETRIES = 1 }; -MODULE_AUTHOR("Boaz Harrosh "); +MODULE_AUTHOR("Boaz Harrosh "); MODULE_DESCRIPTION("open-osd initiator library libosd.ko"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index e1d9a4c..92cdd4b 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c @@ -10,7 +10,7 @@ * Copyright (C) 2008 Panasas Inc. All rights reserved. * * Authors: - * Boaz Harrosh + * Boaz Harrosh * Benny Halevy * * This program is free software; you can redistribute it and/or modify @@ -74,7 +74,7 @@ static const char osd_name[] = "osd"; static const char *osd_version_string = "open-osd 0.2.1"; -MODULE_AUTHOR("Boaz Harrosh "); +MODULE_AUTHOR("Boaz Harrosh "); MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko"); MODULE_LICENSE("GPL"); MODULE_ALIAS_CHARDEV_MAJOR(SCSI_OSD_MAJOR); diff --git a/fs/exofs/Kbuild b/fs/exofs/Kbuild index 389ba83..b47c7b8 100644 --- a/fs/exofs/Kbuild +++ b/fs/exofs/Kbuild @@ -4,7 +4,7 @@ # Copyright (C) 2008 Panasas Inc. All rights reserved. # # Authors: -# Boaz Harrosh +# Boaz Harrosh # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 diff --git a/fs/exofs/common.h b/fs/exofs/common.h index 3bbd469..7d88ef5 100644 --- a/fs/exofs/common.h +++ b/fs/exofs/common.h @@ -4,7 +4,7 @@ * Copyright (C) 2005, 2006 * Avishay Traeger (avis...@gmail.com) * Copyright (C) 2008, 2009 - * Boaz Harrosh + * Boaz Harrosh * * Copyrights for code taken from ext2: * Copyright (C) 1992, 1993, 1994, 1995 diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index 49f51ab..d7defd5 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c @@ -2,7 +2,7 @@ * Copyright (C) 2005, 2006 * Avishay Traeger (avis...@gmail.com) * Copyright (C) 2008, 2009 - * Boaz Harrosh + * Boaz Harrosh *
Re: [PATCH v2 12/12] IB/srp: Add multichannel support
On 10/7/2014 4:07 PM, Bart Van Assche wrote: Improve performance by using multiple RDMA/RC channels per SCSI host for communication with an SRP target. About the implementation: - Introduce a loop over all channels in the code that uses target->ch. - Set the SRP_MULTICHAN_MULTI flag during login for the creation of the second and subsequent channels. - RDMA completion vectors are chosen such that RDMA completion interrupts are handled by the CPU socket that submitted the I/O request. As one can see in this patch it has been assumed if a system contains n CPU sockets and m RDMA completion vectors have been assigned to an RDMA HCA that IRQ affinity has been configured such that completion vectors [i*m/n..(i+1)*m/n) are bound to CPU socket i with 0 <= i < n. - Modify srp_free_ch_ib() and srp_free_req_data() such that it becomes safe to invoke these functions after the corresponding allocation function failed. - Add a ch_count sysfs attribute per target port. Signed-off-by: Bart Van Assche Cc: Sagi Grimberg Cc: Sebastian Parschauer --- Documentation/ABI/stable/sysfs-driver-ib_srp | 25 ++- drivers/infiniband/ulp/srp/ib_srp.c | 291 --- drivers/infiniband/ulp/srp/ib_srp.h | 3 +- 3 files changed, 238 insertions(+), 81 deletions(-) diff --git a/Documentation/ABI/stable/sysfs-driver-ib_srp b/Documentation/ABI/stable/sysfs-driver-ib_srp index b9688de..d5a459e 100644 --- a/Documentation/ABI/stable/sysfs-driver-ib_srp +++ b/Documentation/ABI/stable/sysfs-driver-ib_srp @@ -55,12 +55,12 @@ Description:Interface for making ib_srp connect to a new target. only safe with partial memory descriptor list support enabled (allow_ext_sg=1). * comp_vector, a number in the range 0..n-1 specifying the - MSI-X completion vector. Some HCA's allocate multiple (n) - MSI-X vectors per HCA port. If the IRQ affinity masks of - these interrupts have been configured such that each MSI-X - interrupt is handled by a different CPU then the comp_vector - parameter can be used to spread the SRP completion workload - over multiple CPU's. + MSI-X completion vector of the first RDMA channel. Some + HCA's allocate multiple (n) MSI-X vectors per HCA port. If + the IRQ affinity masks of these interrupts have been + configured such that each MSI-X interrupt is handled by a + different CPU then the comp_vector parameter can be used to + spread the SRP completion workload over multiple CPU's. This is fairly not trivial for the user... Aren't we requesting a bit too much awareness here? Can't we just "make it work"? The user hands out ch_count - why can't you do some least-used logic here? Maybe we can even go with per-cpu QPs and discard comp_vector argument? this would probably bring the best performance, wouldn't it? (fallback to least-used logic in case HW support less vectors) * tl_retry_count, a number in the range 2..7 specifying the IB RC retry count. * queue_size, the maximum number of commands that the @@ -88,6 +88,13 @@ Description: Whether ib_srp is allowed to include a partial memory descriptor list in an SRP_CMD when communicating with an SRP target. +What: /sys/class/scsi_host/host/ch_count +Date: November 1, 2014 +KernelVersion: 3.18 +Contact: linux-r...@vger.kernel.org +Description: Number of RDMA channels used for communication with the SRP + target. + What: /sys/class/scsi_host/host/cmd_sg_entries Date: May 19, 2011 KernelVersion:2.6.39 @@ -95,6 +102,12 @@ Contact:linux-r...@vger.kernel.org Description: Maximum number of data buffer descriptors that may be sent to the target in a single SRP_CMD request. +What: /sys/class/scsi_host/host/comp_vector +Date: September 2, 2013 +KernelVersion: 3.11 +Contact: linux-r...@vger.kernel.org +Description: Completion vector used for the first RDMA channel. + What: /sys/class/scsi_host/host/dgid Date: June 17, 2006 KernelVersion:2.6.17 diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index eccaf65..80699a9 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -123,6 +123,11 @@ MODULE_PARM_DESC(dev_loss_tmo, " if fast_io_fail_tmo has not been set. \"off\" means that" " this functionality is disabled."); +static unsigned ch_count; +module_param(ch_count, uint, 0444); +MODULE_PARM_DESC(ch_count, +"Number of RDMA channels to use for communication with an SRP target. Using more than one channel improves pe
[PATCH 3/3] Boaz Harrosh - fix email in Documentation
From: Boaz Harrosh I forgot to update Documentation/*.txt Signed-off-by: Boaz Harrosh --- Documentation/scsi/osd.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/scsi/osd.txt b/Documentation/scsi/osd.txt index da162f7..5a9879b 100644 --- a/Documentation/scsi/osd.txt +++ b/Documentation/scsi/osd.txt @@ -184,8 +184,7 @@ Any problems, questions, bug reports, lonely OSD nights, please email: More up-to-date information can be found on: http://open-osd.org -Boaz Harrosh -Benny Halevy +Boaz Harrosh References == -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH scsi] libcxgbi : support ipv6 address host_param
>> Anything that is an urgent and/or very small fix should just be against >> Linus' current tree and will go into the drivers branch for that tree. > >> Anything bigger and/or less urgent should be sent against the drivers >> branch for the next release. > Linux 3.17 has been released. The current merge window is the one for > 3.18, expected to be closed in about a week. So urgent patches go into > that, maybe with a Cc to sta...@vger.kernel.org if they fix regressions. I may not have understood you correctly. My understanding is "Linus' current tree and will go into the drivers branch for that tree." would imply scsi-queue/drivers-for-3.17. "drivers branch for next release" would imply be scsi-queue/drivers-for-3.18 So all patches go into drivers-for-3.18, but the ones fixing regressions need a CC to sta...@vger.kernel.org ? Either way, drivers-for-3.18 is fine. Please apply there -Anish -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request
> On 19.10.2014, at 16.44, Laurence Oberman wrote: > > Hello Kai > > Thanks. > > Here is v3 > > This patch adds a debug_flag parameter that can be set on module load, and > allows the DEBUG facility without a module recompile. > Note that now DEBUG 1 is the default with this patch. > > Usage: modprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman Acked-by: Kai Mäkisara Thanks, Kai > > diff -Nur a/Documentation/scsi/st.txt b/Documentation/scsi/st.txt > --- a/Documentation/scsi/st.txt 2014-10-19 09:36:52.243863716 -0400 > +++ b/Documentation/scsi/st.txt 2014-10-19 09:43:19.222863447 -0400 > @@ -506,9 +506,11 @@ > > DEBUGGING HINTS > > -To enable debugging messages, edit st.c and #define DEBUG 1. As seen > -above, debugging can be switched off with an ioctl if debugging is > -compiled into the driver. The debugging output is not voluminous. > +Debugging code is now compiled in by default but debugging is turned off > with > +the kernel module parameter debug_flag defaulting to 0. > +Debugging can still be switched on and off with an ioctl. > +To enable debug at module load time add debug_flag=1 to the module load > +options, the debugging output is not voluminous. > > If the tape seems to hang, I would be very interested to hear where > the driver is waiting. With the command 'ps -l' you can see the state > > diff -Nur a/drivers/scsi/st.c b/drivers/scsi/st.c > --- a/drivers/scsi/st.c 2014-10-19 09:35:45.673863756 -0400 > +++ b/drivers/scsi/st.c 2014-10-19 09:35:30.621863483 -0400 > @@ -56,7 +56,8 @@ > > /* The driver prints some debugging information on the console if DEBUG >is defined and non-zero. */ > -#define DEBUG 0 > +#define DEBUG 1 > +#define NO_DEBUG 0 > > #define ST_DEB_MSG KERN_NOTICE > #if DEBUG > @@ -80,6 +81,7 @@ > static int try_direct_io = TRY_DIRECT_IO; > static int try_rdio = 1; > static int try_wdio = 1; > +static int debug_flag = 0; > > static struct class st_sysfs_class; > static const struct attribute_group *st_dev_groups[]; > @@ -100,6 +102,9 @@ > MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to > use (256)"); > module_param_named(try_direct_io, try_direct_io, int, 0); > MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape > drive (1)"); > +module_param_named(debug_flag, debug_flag, int, 0); > +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); > + > > /* Extra parameters for testing */ > module_param_named(try_rdio, try_rdio, int, 0); > @@ -124,6 +129,9 @@ > }, > { > "try_direct_io", &try_direct_io > +}, > +{ > +"debug_flag", &debug_flag > } > }; > #endif > @@ -4309,6 +4317,10 @@ > printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", > verstr, st_fixed_buffer_size, st_max_sg_segs); > > +debugging = (debug_flag > 0) ? debug_flag : NO_DEBUG; > + if (debugging) > +printk(KERN_INFO "st: Debugging enabled debug_flag = > %d\n",debugging); > + > err = class_register(&st_sysfs_class); > if (err) { > pr_err("Unable register sysfs class for SCSI tapes\n"); -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/27] Implement scsi_opcode_sa_name
Implement a lookup array for SERVICE ACTION commands instead of hardcoding it in a large switch statement. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 131 +++ 1 file changed, 53 insertions(+), 78 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 8253f7b..092ea56 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -244,102 +244,76 @@ static const struct value_name_pair variable_length_arr[] = { }; #define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr) -static const char * get_sa_name(const struct value_name_pair * arr, - int arr_sz, int service_action) +struct sa_name_list { + int opcode; + const struct value_name_pair *arr; + int arr_sz; +}; + +static struct sa_name_list sa_names_arr[] = { + {VARIABLE_LENGTH_CMD, variable_length_arr, VARIABLE_LENGTH_SZ}, + {MAINTENANCE_IN, maint_in_arr, MAINT_IN_SZ}, + {MAINTENANCE_OUT, maint_out_arr, MAINT_OUT_SZ}, + {PERSISTENT_RESERVE_IN, pr_in_arr, PR_IN_SZ}, + {PERSISTENT_RESERVE_OUT, pr_out_arr, PR_OUT_SZ}, + {SERVICE_ACTION_IN_12, serv_in12_arr, SERV_IN12_SZ}, + {SERVICE_ACTION_OUT_12, serv_out12_arr, SERV_OUT12_SZ}, + {SERVICE_ACTION_BIDIRECTIONAL, serv_bidi_arr, SERV_BIDI_SZ}, + {SERVICE_ACTION_IN_16, serv_in16_arr, SERV_IN16_SZ}, + {SERVICE_ACTION_OUT_16, serv_out16_arr, SERV_OUT16_SZ}, + {THIRD_PARTY_COPY_IN, tpc_in_arr, TPC_IN_SZ}, + {THIRD_PARTY_COPY_OUT, tpc_out_arr, TPC_OUT_SZ}, + {0, NULL, 0}, +}; + +static bool scsi_opcode_sa_name(int opcode, int service_action, + const char **sa_name) { - int k; + struct sa_name_list *sa_name_ptr; + const struct value_name_pair *arr = NULL; + int arr_sz, k; + + for (sa_name_ptr = sa_names_arr; sa_name_ptr->arr; ++sa_name_ptr) { + if (sa_name_ptr->opcode == opcode) { + arr = sa_name_ptr->arr; + arr_sz = sa_name_ptr->arr_sz; + break; + } + } + if (!arr) + return false; for (k = 0; k < arr_sz; ++k, ++arr) { if (service_action == arr->value) break; } - return (k < arr_sz) ? arr->name : NULL; + if (k < arr_sz) + *sa_name = arr->name; + + return true; } /* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */ static void print_opcode_name(unsigned char * cdbp, int cdb_len) { int sa, len, cdb0; - int fin_name = 0; - const char * name; + const char *name = NULL; cdb0 = cdbp[0]; - switch(cdb0) { - case VARIABLE_LENGTH_CMD: + if (cdb0 == VARIABLE_LENGTH_CMD) { len = scsi_varlen_cdb_length(cdbp); if (len < 10) { printk("short variable length command, " "len=%d ext_len=%d", len, cdb_len); - break; + return; } sa = (cdbp[8] << 8) + cdbp[9]; - name = get_sa_name(variable_length_arr, VARIABLE_LENGTH_SZ, - sa); - if (name) - printk("%s", name); - else - printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa); - - if ((cdb_len > 0) && (len != cdb_len)) - printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len); - - break; - case MAINTENANCE_IN: - sa = cdbp[1] & 0x1f; - name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); - fin_name = 1; - break; - case MAINTENANCE_OUT: - sa = cdbp[1] & 0x1f; - name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa); - fin_name = 1; - break; - case PERSISTENT_RESERVE_IN: - sa = cdbp[1] & 0x1f; - name = get_sa_name(pr_in_arr, PR_IN_SZ, sa); - fin_name = 1; - break; - case PERSISTENT_RESERVE_OUT: - sa = cdbp[1] & 0x1f; - name = get_sa_name(pr_out_arr, PR_OUT_SZ, sa); - fin_name = 1; - break; - case SERVICE_ACTION_IN_12: - sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa); - fin_name = 1; - break; - case SERVICE_ACTION_OUT_12: - sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa); - fin_name = 1; - break; - case SERVICE_ACTION_BIDIRECTIONAL: - sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_bidi_arr, SERV_BIDI_SZ
[PATCH 16/27] scsi: consolidate opcode lookup in scsi_opcode_sa_name()
Consolidate the CDB opcode lookup in scsi_opcode_sa_name(), so that we don't have to call several functions to figure out the CDB opcode string. Reviewed_by: Robert Elliott Reviewed-by: Christoph Hellweg Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 37 ++--- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 0982df7..80a9942 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -29,6 +29,7 @@ #define THIRD_PARTY_COPY_OUT 0x83 #define THIRD_PARTY_COPY_IN 0x84 +#define VENDOR_SPECIFIC_CDB 0xc0 struct sa_name_list { int opcode; @@ -286,12 +287,19 @@ static struct sa_name_list sa_names_arr[] = { #endif /* CONFIG_SCSI_CONSTANTS */ static bool scsi_opcode_sa_name(int opcode, int service_action, - const char **sa_name) + const char **cdb_name, const char **sa_name) { struct sa_name_list *sa_name_ptr; const struct value_name_pair *arr = NULL; int arr_sz, k; + *cdb_name = NULL; + if (opcode >= VENDOR_SPECIFIC_CDB) + return false; + + if (opcode < ARRAY_SIZE(cdb_byte0_names)) + *cdb_name = cdb_byte0_names[opcode]; + for (sa_name_ptr = sa_names_arr; sa_name_ptr->arr; ++sa_name_ptr) { if (sa_name_ptr->opcode == opcode) { arr = sa_name_ptr->arr; @@ -316,7 +324,7 @@ static bool scsi_opcode_sa_name(int opcode, int service_action, static void print_opcode_name(unsigned char * cdbp, int cdb_len) { int sa, len, cdb0; - const char *name = NULL; + const char *cdb_name = NULL, *sa_name = NULL; cdb0 = cdbp[0]; if (cdb0 == VARIABLE_LENGTH_CMD) { @@ -332,21 +340,20 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len) len = cdb_len; } - if (!scsi_opcode_sa_name(cdb0, sa, &name)) { - if (cdb0 < 0xc0) { - if (ARRAY_SIZE(cdb_byte0_names) > 1) { - name = cdb_byte0_names[cdb0]; - if (name) - printk("%s", name); - else - printk("cdb[0]=0x%x (reserved)", cdb0); - } else - printk("cdb[0]=0x%x", cdb0); - } else + if (!scsi_opcode_sa_name(cdb0, sa, &cdb_name, &sa_name)) { + if (cdb_name) + printk("%s", cdb_name); + else if (cdb0 >= VENDOR_SPECIFIC_CDB) printk("cdb[0]=0x%x (vendor)", cdb0); + else if (cdb0 >= 0x60 && cdb0 < 0x7e) + printk("cdb[0]=0x%x (reserved)", cdb0); + else + printk("cdb[0]=0x%x", cdb0); } else { - if (name) - printk("%s", name); + if (sa_name) + printk("%s", sa_name); + else if (cdb_name) + printk("%s, sa=0x%x", cdb_name, sa); else printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/27] scsi: stop decoding if scsi_normalize_sense() fails
If scsi_normalize_sense() fails we couldn't decode the sense buffer, and the scsi_sense_hdr fields are invalid. For those cases we should rather dump the sense buffer and not try to decode invalid fields. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 34 -- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index f9e2317..0b74e94 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1435,26 +1435,21 @@ scsi_print_sense_hdr(const struct scsi_device *sdev, const char *name, EXPORT_SYMBOL(scsi_print_sense_hdr); static void -scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len, - struct scsi_sense_hdr *sshdr) +scsi_dump_sense_buffer(const unsigned char *sense_buffer, int sense_len) { - int k, num, res; - - res = scsi_normalize_sense(sense_buffer, sense_len, sshdr); - if (0 == res) { - /* this may be SCSI-1 sense data */ - num = (sense_len < 32) ? sense_len : 32; - printk("Unrecognized sense data (in hex):"); - for (k = 0; k < num; ++k) { - if (0 == (k % 16)) { - printk("\n"); - printk(KERN_INFO ""); - } - printk("%02x ", sense_buffer[k]); + int k, num; + + num = (sense_len < 32) ? sense_len : 32; + printk("Unrecognized sense data (in hex):"); + for (k = 0; k < num; ++k) { + if (0 == (k % 16)) { + printk("\n"); + printk(KERN_INFO ""); } - printk("\n"); - return; + printk("%02x ", sense_buffer[k]); } + printk("\n"); + return; } static void @@ -1524,7 +1519,10 @@ void __scsi_print_sense(const struct scsi_device *sdev, const char *name, { struct scsi_sense_hdr sshdr; - scsi_decode_sense_buffer(sense_buffer, sense_len, &sshdr); + if (!scsi_normalize_sense(sense_buffer, sense_len, &sshdr)) { + scsi_dump_sense_buffer(sense_buffer, sense_len); + return; + } scsi_show_sense_hdr(sdev, name, &sshdr); scsi_decode_sense_extras(sense_buffer, sense_len, &sshdr); scsi_show_extd_sense(sdev, name, sshdr.asc, sshdr.ascq); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/27] fas216: Update logging messages
Update logging messages to use dev_printk() variants for correct device annotations. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/arm/fas216.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 7fc6fd3..cea3463 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -308,8 +308,7 @@ static void fas216_log_command(FAS216_Info *info, int level, fas216_do_log(info, '0' + SCpnt->device->id, fmt, args); va_end(args); - printk(" CDB: "); - __scsi_print_command(SCpnt->cmnd); + scsi_print_command(SCpnt); } static void @@ -2079,12 +2078,11 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) break; default: - printk(KERN_ERR "scsi%d.%c: incomplete data transfer " - "detected: res=%08X ptr=%p len=%X CDB: ", - info->host->host_no, '0' + SCpnt->device->id, - SCpnt->result, info->scsi.SCp.ptr, - info->scsi.SCp.this_residual); - __scsi_print_command(SCpnt->cmnd); + scmd_printk(KERN_ERR, SCpnt, + "incomplete data transfer detected: res=%08X ptr=%p len=%X\n", + SCpnt->result, info->scsi.SCp.ptr, + info->scsi.SCp.this_residual); + scsi_print_command(SCpnt); set_host_byte(SCpnt, DID_ERROR); goto request_sense; } @@ -2157,12 +2155,11 @@ static void fas216_done(FAS216_Info *info, unsigned int result) * to transfer, we should not have a valid pointer. */ if (info->scsi.SCp.ptr && info->scsi.SCp.this_residual == 0) { - printk("scsi%d.%c: zero bytes left to transfer, but " - "buffer pointer still valid: ptr=%p len=%08x CDB: ", - info->host->host_no, '0' + SCpnt->device->id, - info->scsi.SCp.ptr, info->scsi.SCp.this_residual); + scmd_printk(KERN_INFO, SCpnt, + "zero bytes left to transfer, but buffer pointer still valid: ptr=%p len=%08x\n", + info->scsi.SCp.ptr, info->scsi.SCp.this_residual); info->scsi.SCp.ptr = NULL; - __scsi_print_command(SCpnt->cmnd); + scsi_print_command(SCpnt); } /* @@ -2663,8 +2660,7 @@ int fas216_eh_host_reset(struct scsi_cmnd *SCpnt) fas216_checkmagic(info); - printk("scsi%d.%c: %s: resetting host\n", - info->host->host_no, '0' + SCpnt->device->id, __func__); + fas216_log(info, LOG_ERROR, "resetting host"); /* * Reset the SCSI chip. -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/27] scsi: Use sdev as argument for sense code printing
We should be using the standard dev_printk() variants for sense code printing. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/53c700.c | 2 +- drivers/scsi/ch.c | 2 +- drivers/scsi/constants.c | 117 ++--- drivers/scsi/osst.c| 8 ++-- drivers/scsi/scsi.c| 2 +- drivers/scsi/scsi_error.c | 2 +- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/scsi_lib.c| 4 +- drivers/scsi/sd.c | 9 ++-- drivers/scsi/sg.c | 2 +- drivers/scsi/sr_ioctl.c| 6 +-- drivers/scsi/st.c | 6 ++- drivers/scsi/storvsc_drv.c | 3 +- include/scsi/scsi_dbg.h| 17 --- include/scsi/scsi_eh.h | 2 +- 15 files changed, 97 insertions(+), 87 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index fabd4be..68bf423 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -602,7 +602,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, #ifdef NCR_700_DEBUG printk(" ORIGINAL CMD %p RETURNED %d, new return is %d sense is\n", SCp, SCp->cmnd[7], result); - scsi_print_sense("53c700", SCp); + scsi_print_sense(SCp); #endif dma_unmap_single(hostdata->dev, slot->dma_handle, diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 52060e7..53621a3 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -206,7 +206,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, DPRINTK("result: 0x%x\n",result); if (driver_byte(result) & DRIVER_SENSE) { if (debug) - scsi_print_sense_hdr(ch->name, &sshdr); + scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); switch(sshdr.sense_key) { diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 2f44707..f9e2317 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1292,18 +1292,19 @@ static const struct error_info additional[] = struct error_info2 { unsigned char code1, code2_min, code2_max; + const char * str; const char * fmt; }; static const struct error_info2 additional2[] = { - {0x40, 0x00, 0x7f, "Ram failure (%x)"}, - {0x40, 0x80, 0xff, "Diagnostic failure on component (%x)"}, - {0x41, 0x00, 0xff, "Data path failure (%x)"}, - {0x42, 0x00, 0xff, "Power-on or self-test failure (%x)"}, - {0x4D, 0x00, 0xff, "Tagged overlapped commands (task tag %x)"}, - {0x70, 0x00, 0xff, "Decompression exception short algorithm id of %x"}, - {0, 0, 0, NULL} + {0x40, 0x00, 0x7f, "Ram failure", ""}, + {0x40, 0x80, 0xff, "Diagnostic failure on component", ""}, + {0x41, 0x00, 0xff, "Data path failure", ""}, + {0x42, 0x00, 0xff, "Power-on or self-test failure", ""}, + {0x4D, 0x00, 0xff, "Tagged overlapped commands", "task tag "}, + {0x70, 0x00, 0xff, "Decompression exception", "short algorithm id of "}, + {0, 0, 0, NULL, NULL} }; /* description of the sense key values */ @@ -1349,7 +1350,8 @@ EXPORT_SYMBOL(scsi_sense_key_string); * This string may contain a "%x" and should be printed with ascq as arg. */ const char * -scsi_extd_sense_format(unsigned char asc, unsigned char ascq) { +scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt) +{ #ifdef CONFIG_SCSI_CONSTANTS int i; unsigned short code = ((asc << 8) | ascq); @@ -1361,7 +1363,8 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq) { if (additional2[i].code1 == asc && ascq >= additional2[i].code2_min && ascq <= additional2[i].code2_max) - return additional2[i].fmt; + *fmt = additional2[i].fmt; + return additional2[i].str; } #endif return NULL; @@ -1369,49 +1372,53 @@ scsi_extd_sense_format(unsigned char asc, unsigned char ascq) { EXPORT_SYMBOL(scsi_extd_sense_format); void -scsi_show_extd_sense(unsigned char asc, unsigned char ascq) +scsi_show_extd_sense(const struct scsi_device *sdev, const char *name, +unsigned char asc, unsigned char ascq) { -const char *extd_sense_fmt = scsi_extd_sense_format(asc, ascq); + const char *extd_sense_fmt = NULL; + const char *extd_sense_str = scsi_extd_sense_format(asc, ascq, + &extd_sense_fmt); + + if (extd_sense_str) { + if (extd_sense_fmt) + sdev_prefix_printk(KERN_INFO, sdev, name, + "Add. Sense: %s (%s%x)", + extd_sense_str, extd_sense_fmt, +
[PATCH 03/27] aha152x: Debug output update and whitespace cleanup
Remove all uncommented debugging code and move all printk() statements over to dev_printk(). And while we're at it we should be doing a whitespace cleanup, too. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/aha152x.c | 994 +++-- 1 file changed, 224 insertions(+), 770 deletions(-) diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index e77b72f..2b960b3 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -230,7 +230,7 @@ * * ** - + see Documentation/scsi/aha152x.txt for configuration details **/ @@ -279,45 +279,11 @@ static LIST_HEAD(aha152x_host_list); #error define AUTOCONF or SETUP0 #endif -#if defined(AHA152X_DEBUG) -#define DEBUG_DEFAULT debug_eh - -#define DPRINTK(when,msgs...) \ - do { if(HOSTDATA(shpnt)->debug & (when)) printk(msgs); } while(0) - -#define DO_LOCK(flags) \ - do { \ - if(spin_is_locked(&QLOCK)) { \ - DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __func__, __LINE__, QLOCKER, QLOCKERL); \ - } \ - DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __func__, __LINE__); \ - spin_lock_irqsave(&QLOCK,flags); \ - DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __func__, __LINE__); \ - QLOCKER=__func__; \ - QLOCKERL=__LINE__; \ - } while(0) - -#define DO_UNLOCK(flags) \ - do { \ - DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __func__, __LINE__, QLOCKER, QLOCKERL); \ - spin_unlock_irqrestore(&QLOCK,flags); \ - DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __func__, __LINE__); \ - QLOCKER="(not locked)"; \ - QLOCKERL=0; \ - } while(0) - -#else -#define DPRINTK(when,msgs...) #defineDO_LOCK(flags) spin_lock_irqsave(&QLOCK,flags) #defineDO_UNLOCK(flags)spin_unlock_irqrestore(&QLOCK,flags) -#endif #define LEAD "(scsi%d:%d:%d) " -#define WARN_LEAD KERN_WARNINGLEAD #define INFO_LEAD KERN_INFO LEAD -#define NOTE_LEAD KERN_NOTICE LEAD -#define ERR_LEAD KERN_ERRLEAD -#define DEBUG_LEAD KERN_DEBUG LEAD #define CMDINFO(cmd) \ (cmd) ? ((cmd)->device->host->host_no) : -1, \ (cmd) ? ((cmd)->device->id & 0x0f) : -1, \ @@ -345,10 +311,10 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc) enum { not_issued = 0x0001, /* command not yet issued */ - selecting = 0x0002, /* target is beeing selected */ + selecting = 0x0002, /* target is being selected */ identified = 0x0004, /* IDENTIFY was sent */ disconnected= 0x0008, /* target disconnected */ - completed = 0x0010, /* target sent COMMAND COMPLETE */ + completed = 0x0010, /* target sent COMMAND COMPLETE */ aborted = 0x0020, /* ABORT was sent */ resetted= 0x0040, /* BUS DEVICE RESET was sent */ spiordy = 0x0080, /* waiting for SPIORDY to raise */ @@ -396,7 +362,6 @@ static int exttrans[] = {0, 0}; module_param_array(exttrans, int, NULL, 0); MODULE_PARM_DESC(exttrans,"use extended translation"); -#if !defined(AHA152X_DEBUG) static int aha152x[] = {0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0}; module_param_array(aha152x, int, NULL, 0); MODULE_PARM_DESC(aha152x, "parameters for first controller"); @@ -404,19 +369,6 @@ MODULE_PARM_DESC(aha152x, "parameters for first controller"); static int aha152x1[] = {0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0}; module_param_array(aha152x1, int, NULL, 0); MODULE_PARM_DESC(aha152x1, "parameters for second controller"); -#else -static int debug[] = {DEBUG_DEFAULT, DEBUG_DEFAULT}; -module_param_array(debug, int, NULL, 0); -MODULE_PARM_DESC(debug, "flags for driver debugging"); - -static int aha152x[] = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT}; -module_param_array(aha152x, int, NULL, 0); -MODULE_PARM_DESC(aha152x, "parameters for first controller"); - -static int aha152x1[] = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT}; -module_param_array(aha152x1, int, NULL, 0); -MODULE_PARM_DESC(aha152x1, "parameters for second controller"); -#endif /* !defined(AHA152X_DEBUG) */ #endif /* MODULE */ #ifdef __ISAPNP__ @@ -446,7 +398,7 @@ static struct scsi_host_template aha152x_driver_template; /* * internal states of the host * - */ + */ enum aha152x_state { idle=0, unknown
[PATCH 15/27] scsi: merge print_opcode_name()
Instead of having two versions of print_opcode_name() we should be consolidating them into one version. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 88 ++-- 1 file changed, 33 insertions(+), 55 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 092ea56..0982df7 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -30,6 +30,11 @@ #define THIRD_PARTY_COPY_IN 0x84 +struct sa_name_list { + int opcode; + const struct value_name_pair *arr; + int arr_sz; +}; #ifdef CONFIG_SCSI_CONSTANTS static const char * cdb_byte0_names[] = { @@ -244,12 +249,6 @@ static const struct value_name_pair variable_length_arr[] = { }; #define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr) -struct sa_name_list { - int opcode; - const struct value_name_pair *arr; - int arr_sz; -}; - static struct sa_name_list sa_names_arr[] = { {VARIABLE_LENGTH_CMD, variable_length_arr, VARIABLE_LENGTH_SZ}, {MAINTENANCE_IN, maint_in_arr, MAINT_IN_SZ}, @@ -266,6 +265,26 @@ static struct sa_name_list sa_names_arr[] = { {0, NULL, 0}, }; +#else /* ifndef CONFIG_SCSI_CONSTANTS */ +static const char *cdb_byte0_names[]; + +static struct sa_name_list sa_names_arr[] = { + {VARIABLE_LENGTH_CMD, NULL, 0}, + {MAINTENANCE_IN, NULL, 0}, + {MAINTENANCE_OUT, NULL, 0}, + {PERSISTENT_RESERVE_IN, NULL, 0}, + {PERSISTENT_RESERVE_OUT, NULL, 0}, + {SERVICE_ACTION_IN_12, NULL, 0}, + {SERVICE_ACTION_OUT_12, NULL, 0}, + {SERVICE_ACTION_BIDIRECTIONAL, NULL, 0}, + {SERVICE_ACTION_IN_16, NULL, 0}, + {SERVICE_ACTION_OUT_16, NULL, 0}, + {THIRD_PARTY_COPY_IN, NULL, 0}, + {THIRD_PARTY_COPY_OUT, NULL, 0}, + {0, NULL, 0}, +}; +#endif /* CONFIG_SCSI_CONSTANTS */ + static bool scsi_opcode_sa_name(int opcode, int service_action, const char **sa_name) { @@ -315,11 +334,14 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len) if (!scsi_opcode_sa_name(cdb0, sa, &name)) { if (cdb0 < 0xc0) { - name = cdb_byte0_names[cdb0]; - if (name) - printk("%s", name); - else - printk("cdb[0]=0x%x (reserved)", cdb0); + if (ARRAY_SIZE(cdb_byte0_names) > 1) { + name = cdb_byte0_names[cdb0]; + if (name) + printk("%s", name); + else + printk("cdb[0]=0x%x (reserved)", cdb0); + } else + printk("cdb[0]=0x%x", cdb0); } else printk("cdb[0]=0x%x (vendor)", cdb0); } else { @@ -333,50 +355,6 @@ static void print_opcode_name(unsigned char * cdbp, int cdb_len) } } -#else /* ifndef CONFIG_SCSI_CONSTANTS */ - -static void print_opcode_name(unsigned char * cdbp, int cdb_len) -{ - int sa, len, cdb0; - - cdb0 = cdbp[0]; - switch(cdb0) { - case VARIABLE_LENGTH_CMD: - len = scsi_varlen_cdb_length(cdbp); - if (len < 10) { - printk("short opcode=0x%x command, len=%d " - "ext_len=%d", cdb0, len, cdb_len); - break; - } - sa = (cdbp[8] << 8) + cdbp[9]; - printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa); - if (len != cdb_len) - printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len); - break; - case MAINTENANCE_IN: - case MAINTENANCE_OUT: - case PERSISTENT_RESERVE_IN: - case PERSISTENT_RESERVE_OUT: - case SERVICE_ACTION_IN_12: - case SERVICE_ACTION_OUT_12: - case SERVICE_ACTION_BIDIRECTIONAL: - case SERVICE_ACTION_IN_16: - case SERVICE_ACTION_OUT_16: - case THIRD_PARTY_COPY_IN: - case THIRD_PARTY_COPY_OUT: - sa = cdbp[1] & 0x1f; - printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa); - break; - default: - if (cdb0 < 0xc0) - printk("cdb[0]=0x%x", cdb0); - else - printk("cdb[0]=0x%x (vendor)", cdb0); - break; - } -} -#endif - void __scsi_print_command(unsigned char *cdb) { int k, len; -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/27] scsi: Remove scsi_print_command when calling abort
Calling scsi_print_command should not be necessary during abort; if the information is required one should enable scsi logging. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/53c700.c| 4 +--- drivers/scsi/NCR5380.c | 5 ++--- drivers/scsi/arm/fas216.c| 10 +++--- drivers/scsi/atari_NCR5380.c | 3 +-- drivers/scsi/ps3rom.c| 4 drivers/scsi/stex.c | 9 +++-- drivers/scsi/sun3_NCR5380.c | 3 +-- 7 files changed, 11 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 179a24e..474cc6d 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -1906,9 +1906,7 @@ NCR_700_abort(struct scsi_cmnd * SCp) { struct NCR_700_command_slot *slot; - scmd_printk(KERN_INFO, SCp, - "New error handler wants to abort command\n\t"); - scsi_print_command(SCp); + scmd_printk(KERN_INFO, SCp, "abort command\n"); slot = (struct NCR_700_command_slot *)SCp->host_scribble; diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 45da3c8..50873bb 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -2666,9 +2666,8 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) { struct Scsi_Host *instance = cmd->device->host; struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; Scsi_Cmnd *tmp, **prev; - - printk(KERN_WARNING "scsi%d : aborting command\n", instance->host_no); - scsi_print_command(cmd); + + scmd_printk(KERN_WARNING, cmd, "aborting command\n"); NCR5380_print_status(instance); diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index d2581cb..e64c3af 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2423,14 +2423,11 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt) info->stats.aborts += 1; - printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no); - __scsi_print_command(SCpnt->cmnd, SCpnt->cmd_len); + scmd_printk(KERN_WARNING, SCpnt, "abort command\n"); print_debug_list(); fas216_dumpstate(info); - printk(KERN_WARNING "scsi%d: abort %p ", info->host->host_no, SCpnt); - switch (fas216_find_command(info, SCpnt)) { /* * We found the command, and cleared it out. Either @@ -2438,7 +2435,7 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt) * target, or the busylun bit is not set. */ case res_success: - printk("success\n"); + scmd_printk(KERN_WARNING, SCpnt, "abort %p success\n", SCpnt); result = SUCCESS; break; @@ -2448,14 +2445,13 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt) * if the bus is free. */ case res_hw_abort: - /* * We are unable to abort the command for some reason. */ default: case res_failed: - printk("failed\n"); + scmd_printk(KERN_WARNING, SCpnt, "abort %p failed\n", SCpnt); break; } diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 79e6f04..229c61b 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c @@ -2623,8 +2623,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd) Scsi_Cmnd *tmp, **prev; unsigned long flags; - printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO); - scsi_print_command(cmd); + scmd_printk(KERN_NOTICE, cmd, "aborting command\n"); NCR5380_print_status(instance); diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index ef23fab..b3b48b5 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c @@ -220,10 +220,6 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd, unsigned char opcode; int res; -#ifdef DEBUG - scsi_print_command(cmd); -#endif - priv->curr_cmd = cmd; cmd->scsi_done = done; diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 1aa4bef..713af13 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -1162,9 +1162,7 @@ static int stex_abort(struct scsi_cmnd *cmd) int result = SUCCESS; unsigned long flags; - printk(KERN_INFO DRV_NAME - "(%s): aborting command\n", pci_name(hba->pdev)); - scsi_print_command(cmd); + scmd_printk(KERN_INFO, cmd, "aborting command\n"); base = hba->mmio_base; spin_lock_irqsave(host->host_lock, flags); @@ -1352,9 +1350,8 @@ static int stex_reset(struct scsi_cmnd *cmd) hba = (struct st_hba *) &cmd->device->host->hostdata[0]; - printk(KERN_INFO DRV_NAME - "(%s): resetting host\n", pci_name(hba->pdev)); - scsi_print_command(cmd); + shost_printk(KERN_INFO, cmd->device->host, +"resetting host\n");
[PATCH 11/27] scsi: do not decode sense extras
Currently we're only decoding sense extras for tape devices. And even there only for fixed format sense formats. As this is of rather limited use in the general case we should be stop trying to decode sense extras; the tape driver does its own decoding anyway. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 62 1 file changed, 62 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 0b74e94..ec69ec8 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1452,67 +1452,6 @@ scsi_dump_sense_buffer(const unsigned char *sense_buffer, int sense_len) return; } -static void -scsi_decode_sense_extras(const unsigned char *sense_buffer, int sense_len, -struct scsi_sense_hdr *sshdr) -{ - int k, num, res; - - if (sshdr->response_code < 0x72) - { - /* only decode extras for "fixed" format now */ - char buff[80]; - int blen, fixed_valid; - unsigned int info; - - fixed_valid = sense_buffer[0] & 0x80; - info = ((sense_buffer[3] << 24) | (sense_buffer[4] << 16) | - (sense_buffer[5] << 8) | sense_buffer[6]); - res = 0; - memset(buff, 0, sizeof(buff)); - blen = sizeof(buff) - 1; - if (fixed_valid) - res += snprintf(buff + res, blen - res, - "Info fld=0x%x", info); - if (sense_buffer[2] & 0x80) { - /* current command has read a filemark */ - if (res > 0) - res += snprintf(buff + res, blen - res, ", "); - res += snprintf(buff + res, blen - res, "FMK"); - } - if (sense_buffer[2] & 0x40) { - /* end-of-medium condition exists */ - if (res > 0) - res += snprintf(buff + res, blen - res, ", "); - res += snprintf(buff + res, blen - res, "EOM"); - } - if (sense_buffer[2] & 0x20) { - /* incorrect block length requested */ - if (res > 0) - res += snprintf(buff + res, blen - res, ", "); - res += snprintf(buff + res, blen - res, "ILI"); - } - if (res > 0) - printk("%s\n", buff); - } else if (sshdr->additional_length > 0) { - /* descriptor format with sense descriptors */ - num = 8 + sshdr->additional_length; - num = (sense_len < num) ? sense_len : num; - printk("Descriptor sense data with sense descriptors " - "(in hex):"); - for (k = 0; k < num; ++k) { - if (0 == (k % 16)) { - printk("\n"); - printk(KERN_INFO ""); - } - printk("%02x ", sense_buffer[k]); - } - - printk("\n"); - } - -} - /* Normalize and print sense buffer with name prefix */ void __scsi_print_sense(const struct scsi_device *sdev, const char *name, const unsigned char *sense_buffer, int sense_len) @@ -1524,7 +1463,6 @@ void __scsi_print_sense(const struct scsi_device *sdev, const char *name, return; } scsi_show_sense_hdr(sdev, name, &sshdr); - scsi_decode_sense_extras(sense_buffer, sense_len, &sshdr); scsi_show_extd_sense(sdev, name, sshdr.asc, sshdr.ascq); } EXPORT_SYMBOL(__scsi_print_sense); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/27] scsi: use 'bool' as return value for scsi_normalize_sense()
Convert scsi_normalize_sense() and frieds to return 'bool' instead of an integer. Reviewed-by: Robert Elliott Reviewed-by: Yoshihiro Yunomae Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_error.c | 16 drivers/scsi/scsi_lib.c | 2 +- include/scsi/scsi_eh.h| 14 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 6c99624..a113e99 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -2408,20 +2408,20 @@ EXPORT_SYMBOL(scsi_reset_provider); * responded to a SCSI command with the CHECK_CONDITION status. * * Return value: - * 1 if valid sense data information found, else 0; + * true if valid sense data information found, else false; */ -int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, - struct scsi_sense_hdr *sshdr) +bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len, + struct scsi_sense_hdr *sshdr) { if (!sense_buffer || !sb_len) - return 0; + return false; memset(sshdr, 0, sizeof(struct scsi_sense_hdr)); sshdr->response_code = (sense_buffer[0] & 0x7f); if (!scsi_sense_valid(sshdr)) - return 0; + return false; if (sshdr->response_code >= 0x72) { /* @@ -2451,12 +2451,12 @@ int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, } } - return 1; + return true; } EXPORT_SYMBOL(scsi_normalize_sense); -int scsi_command_normalize_sense(struct scsi_cmnd *cmd, -struct scsi_sense_hdr *sshdr) +bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd, + struct scsi_sense_hdr *sshdr) { return scsi_normalize_sense(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, sshdr); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index c3220b7..b853659 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -830,7 +830,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) struct request *req = cmd->request; int error = 0; struct scsi_sense_hdr sshdr; - int sense_valid = 0; + bool sense_valid = false; int sense_deferred = 0; enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY, ACTION_DELAYED_RETRY} action; diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index 3d720ca..1d3c254 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h @@ -27,10 +27,10 @@ struct scsi_sense_hdr { /* See SPC-3 section 4.5 */ u8 additional_length; /* always 0 for fixed sense format */ }; -static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr) +static inline bool scsi_sense_valid(const struct scsi_sense_hdr *sshdr) { if (!sshdr) - return 0; + return false; return (sshdr->response_code & 0x70) == 0x70; } @@ -42,12 +42,12 @@ extern void scsi_eh_flush_done_q(struct list_head *done_q); extern void scsi_report_bus_reset(struct Scsi_Host *, int); extern void scsi_report_device_reset(struct Scsi_Host *, int, int); extern int scsi_block_when_processing_errors(struct scsi_device *); -extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, - struct scsi_sense_hdr *sshdr); -extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd, - struct scsi_sense_hdr *sshdr); +extern bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len, +struct scsi_sense_hdr *sshdr); +extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd, +struct scsi_sense_hdr *sshdr); -static inline int scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr) +static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr) { return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1)); } -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/27] 53c700: remove scsi_print_sense() usage
The 53c700 driver would be using scsi_print_sense() in a debug statement, which was never compiled in. Plus the same information can get retrieved with logging. So remove it. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/53c700.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 68bf423..179a24e 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -592,19 +592,14 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, hostdata->cmd = NULL; if(SCp != NULL) { - struct NCR_700_command_slot *slot = + struct NCR_700_command_slot *slot = (struct NCR_700_command_slot *)SCp->host_scribble; - + dma_unmap_single(hostdata->dev, slot->pCmd, MAX_COMMAND_SIZE, DMA_TO_DEVICE); if (slot->flags == NCR_700_FLAG_AUTOSENSE) { char *cmnd = NCR_700_get_sense_cmnd(SCp->device); -#ifdef NCR_700_DEBUG - printk(" ORIGINAL CMD %p RETURNED %d, new return is %d sense is\n", - SCp, SCp->cmnd[7], result); - scsi_print_sense(SCp); -#endif dma_unmap_single(hostdata->dev, slot->dma_handle, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); /* restore the old result if the request sense was -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/27] acornscsi: use scsi_print_command()
Update acornscsi to use scsi_print_command() instead of the underscore version and use scmd_printk() in acornscsi_done(). This will add correct device annotations in the resulting message. And we should be using set_host_byte() for setting the final result. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/arm/acornscsi.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index d89b9b4..deaaf84 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c @@ -850,13 +850,13 @@ static void acornscsi_done(AS_Host *host, struct scsi_cmnd **SCpntp, break; default: - printk(KERN_ERR "scsi%d.H: incomplete data transfer detected: result=%08X command=", - host->host->host_no, SCpnt->result); - __scsi_print_command(SCpnt->cmnd); + scmd_printk(KERN_ERR, SCpnt, + "incomplete data transfer detected: " + "result=%08X", SCpnt->result); + scsi_print_command(SCpnt); acornscsi_dumpdma(host, "done"); - acornscsi_dumplog(host, SCpnt->device->id); - SCpnt->result &= 0x; - SCpnt->result |= DID_ERROR << 16; + acornscsi_dumplog(host, SCpnt->device->id); + set_host_byte(SCpnt, DID_ERROR); } } } -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/27] fas216: Return DID_ERROR for incomplete data transfer
fas216 returns DID_BAD_TARGET for an incomplete data transfer. The midlayer uses DID_BAD_TARGET to signal a non-existing or not reachable target. So we should rather be using DID_ERROR here. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/arm/fas216.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 71cfb1e..7fc6fd3 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2085,8 +2085,7 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) SCpnt->result, info->scsi.SCp.ptr, info->scsi.SCp.this_residual); __scsi_print_command(SCpnt->cmnd); - SCpnt->result &= ~(255 << 16); - SCpnt->result |= DID_BAD_TARGET << 16; + set_host_byte(SCpnt, DID_ERROR); goto request_sense; } } -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 27/27] scsi: ratelimit I/O error messages
There can be quite a lot of I/O error messages, even on smaller machines. So we need to ratelimit them to not overwhelm logging. Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_lib.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2df485f..9d248d2 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -1037,18 +1038,23 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) switch (action) { case ACTION_FAIL: /* Give up and fail the remainder of the request */ - if (unlikely(scsi_logging_level)) - level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT, - SCSI_LOG_MLQUEUE_BITS); - /* -* if logging is enabled the failure will be printed -* in scsi_log_completion(), so avoid duplicate messages -*/ - if (!level && !(req->cmd_flags & REQ_QUIET)) { - scsi_print_result(cmd, NULL, FAILED); - if (driver_byte(result) & DRIVER_SENSE) - scsi_print_sense(cmd); - scsi_print_command(cmd); + if (unlikely(scsi_logging_level)) { + static DEFINE_RATELIMIT_STATE(_rs, + DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + level = SCSI_LOG_LEVEL(SCSI_LOG_MLCOMPLETE_SHIFT, + SCSI_LOG_MLCOMPLETE_BITS); + /* +* if logging is enabled the failure will be printed +* in scsi_log_completion(), so avoid duplicate messages +*/ + if (__ratelimit(&_rs) && !level && + !(req->cmd_flags & REQ_QUIET)) { + scsi_print_result(cmd, NULL, FAILED); + if (driver_byte(result) & DRIVER_SENSE) + scsi_print_sense(cmd); + scsi_print_command(cmd); + } } if (!scsi_end_request(req, error, blk_rq_err_bytes(req), 0)) return; -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/27] sd: Remove scsi_print_sense() in sd_done()
sd_done() was calling scsi_print_sense() for a sense code of 'NO_SENSE'. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/sd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 0cb5c9f..0ccb459 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1730,7 +1730,6 @@ static int sd_done(struct scsi_cmnd *SCpnt) * unknown amount of data was transferred so treat it as an * error. */ - scsi_print_sense("sd", SCpnt); SCpnt->result = 0; memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); break; -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv7 00/27] scsi logging update (the boring part)
here is now the seventh iteration of my scsi logging update. With this I've included another patch for ratelimiting I/O error messages, which resolves the outstanding issue noted by Robert Elliot. Hannes Reinecke (27): Remove scsi_cmd_print_sense_hdr() sd: Remove scsi_print_sense() in sd_done() aha152x: Debug output update and whitespace cleanup scsi: introduce sdev_prefix_printk() scsi: Use sdev as argument for sense code printing acornscsi: use scsi_print_command() fas216: Return DID_ERROR for incomplete data transfer fas216: Update logging messages 53c700: remove scsi_print_sense() usage scsi: stop decoding if scsi_normalize_sense() fails scsi: do not decode sense extras scsi: use 'bool' as return value for scsi_normalize_sense() scsi: remove scsi_print_status() Implement scsi_opcode_sa_name scsi: merge print_opcode_name() scsi: consolidate opcode lookup in scsi_opcode_sa_name() scsi: repurpose the last argument from print_opcode_name() scsi: Remove scsi_print_command when calling abort scsi: separate out scsi_(host|driver)byte_string() sd: Cleanup logging scsi: simplify scsi_log_(send|completion) scsi: fixup logging messages in scsi_error.c scsi: use shost argument in scsi_eh_prt_fail_stats scsi_error: document scsi_try_to_abort_cmd scsi: check for correct return code in scsi_eh_abort_cmds() scsi: correct return values for .eh_abort_handler implementations scsi: ratelimit I/O error messages drivers/scsi/53c700.c | 13 +- drivers/scsi/NCR5380.c| 7 +- drivers/scsi/aha152x.c| 994 +- drivers/scsi/aha1740.c| 2 +- drivers/scsi/arm/acornscsi.c | 12 +- drivers/scsi/arm/fas216.c | 39 +- drivers/scsi/atari_NCR5380.c | 3 +- drivers/scsi/ch.c | 29 +- drivers/scsi/constants.c | 578 +- drivers/scsi/esas2r/esas2r_main.c | 2 +- drivers/scsi/hosts.c | 4 +- drivers/scsi/megaraid.c | 8 +- drivers/scsi/osst.c | 8 +- drivers/scsi/ps3rom.c | 4 - drivers/scsi/scsi.c | 45 +- drivers/scsi/scsi_error.c | 123 ++--- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/scsi_lib.c | 29 +- drivers/scsi/sd.c | 60 +-- drivers/scsi/sd.h | 6 +- drivers/scsi/sg.c | 6 +- drivers/scsi/sr.h | 3 +- drivers/scsi/sr_ioctl.c | 10 +- drivers/scsi/st.c | 9 +- drivers/scsi/stex.c | 9 +- drivers/scsi/storvsc_drv.c| 3 +- drivers/scsi/sun3_NCR5380.c | 3 +- include/scsi/scsi_dbg.h | 28 +- include/scsi/scsi_device.h| 9 + include/scsi/scsi_eh.h| 14 +- 30 files changed, 698 insertions(+), 1364 deletions(-) -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/27] scsi: repurpose the last argument from print_opcode_name()
print_opcode_name() was only ever called with a '0' argument from LLDDs and ULDs which were _not_ supporting variable length CDBs, so the 'if' clause was never triggered. Instead we should be using the last argument to specify the cdb length to avoid accidental overflow when reading the cdb buffer. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/arm/fas216.c | 2 +- drivers/scsi/ch.c | 24 +--- drivers/scsi/constants.c | 25 ++--- drivers/scsi/sr_ioctl.c | 4 ++-- include/scsi/scsi_dbg.h | 2 +- 5 files changed, 27 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index cea3463..d2581cb 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c @@ -2424,7 +2424,7 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt) info->stats.aborts += 1; printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no); - __scsi_print_command(SCpnt->cmnd); + __scsi_print_command(SCpnt->cmnd, SCpnt->cmd_len); print_debug_list(); fas216_dumpstate(info); diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 53621a3..226ef77 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -182,7 +182,7 @@ static int ch_find_errno(struct scsi_sense_hdr *sshdr) } static int -ch_do_scsi(scsi_changer *ch, unsigned char *cmd, +ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned buflength, enum dma_data_direction direction) { @@ -196,7 +196,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, errno = 0; if (debug) { DPRINTK("command: "); - __scsi_print_command(cmd); + __scsi_print_command(cmd, cmd_len); } result = scsi_execute_req(ch->device, cmd, direction, buffer, @@ -257,7 +257,8 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data) cmd[3] = elem& 0xff; cmd[5] = 1; cmd[9] = 255; - if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) { + if (0 == (result = ch_do_scsi(ch, cmd, 12, + buffer, 256, DMA_FROM_DEVICE))) { if (((buffer[16] << 8) | buffer[17]) != elem) { DPRINTK("asked for element 0x%02x, got 0x%02x\n", elem,(buffer[16] << 8) | buffer[17]); @@ -287,7 +288,7 @@ ch_init_elem(scsi_changer *ch) memset(cmd,0,sizeof(cmd)); cmd[0] = INITIALIZE_ELEMENT_STATUS; cmd[1] = (ch->device->lun & 0x7) << 5; - err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE); + err = ch_do_scsi(ch, cmd, 6, NULL, 0, DMA_NONE); VPRINTK(KERN_INFO, "... finished\n"); return err; } @@ -309,10 +310,10 @@ ch_readconfig(scsi_changer *ch) cmd[1] = (ch->device->lun & 0x7) << 5; cmd[2] = 0x1d; cmd[4] = 255; - result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE); + result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE); if (0 != result) { cmd[1] |= (1<<3); - result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE); + result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE); } if (0 == result) { ch->firsts[CHET_MT] = @@ -437,7 +438,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate) cmd[4] = (elem >> 8) & 0xff; cmd[5] = elem& 0xff; cmd[8] = rotate ? 1 : 0; - return ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE); + return ch_do_scsi(ch, cmd, 10, NULL, 0, DMA_NONE); } static int @@ -458,7 +459,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate) cmd[6] = (dest >> 8) & 0xff; cmd[7] = dest& 0xff; cmd[10] = rotate ? 1 : 0; - return ch_do_scsi(ch, cmd, NULL,0, DMA_NONE); + return ch_do_scsi(ch, cmd, 12, NULL,0, DMA_NONE); } static int @@ -484,7 +485,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src, cmd[9] = dest2 & 0xff; cmd[10] = (rotate1 ? 1 : 0) | (rotate2 ? 2 : 0); - return ch_do_scsi(ch, cmd, NULL,0, DMA_NONE); + return ch_do_scsi(ch, cmd, 12, NULL, 0, DMA_NONE); } static void @@ -534,7 +535,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem, memcpy(buffer,tag,32); ch_check_voltag(buffer); - result = ch_do_scsi(ch, cmd, buffer, 256, DMA_TO_DEVICE); + result = ch_do_scsi(ch, cmd, 12, buffer, 256, DMA_TO_DEVICE); kfree(buffer); return result; } @@ -765,7 +766,8 @@ static long ch_ioctl(struct file *file, ch_cmd[5] = 1; ch_cmd[9] = 255; - result = ch_do_scsi(ch, ch_cmd, buffer, 256, DMA_FROM_DEVICE); + result = ch_do_scsi(ch, ch_cmd, 12, +
[PATCH 01/27] Remove scsi_cmd_print_sense_hdr()
Unused. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 14 -- include/scsi/scsi_dbg.h | 2 -- 2 files changed, 16 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index d35a5d6..2f44707 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1428,20 +1428,6 @@ scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr) } EXPORT_SYMBOL(scsi_print_sense_hdr); -/* - * Print normalized SCSI sense header with device information and a prefix. - */ -void -scsi_cmd_print_sense_hdr(struct scsi_cmnd *scmd, const char *desc, - struct scsi_sense_hdr *sshdr) -{ - scmd_printk(KERN_INFO, scmd, "%s: ", desc); - scsi_show_sense_hdr(sshdr); - scmd_printk(KERN_INFO, scmd, "%s: ", desc); - scsi_show_extd_sense(sshdr->asc, sshdr->ascq); -} -EXPORT_SYMBOL(scsi_cmd_print_sense_hdr); - static void scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len, struct scsi_sense_hdr *sshdr) diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index e89844c..5a43a4c 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -9,8 +9,6 @@ extern void __scsi_print_command(unsigned char *); extern void scsi_show_extd_sense(unsigned char, unsigned char); extern void scsi_show_sense_hdr(struct scsi_sense_hdr *); extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); -extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *, -struct scsi_sense_hdr *); extern void scsi_print_sense(char *, struct scsi_cmnd *); extern void __scsi_print_sense(const char *name, const unsigned char *sense_buffer, -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 23/27] scsi: use shost argument in scsi_eh_prt_fail_stats
The EH statistics are per host, so we should be using shost_printk() here. Suggested-by: Robert Elliott Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 087ca02..c485f28 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -355,7 +355,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, if (cmd_cancel || cmd_failed) { SCSI_LOG_ERROR_RECOVERY(3, - sdev_printk(KERN_INFO, sdev, + shost_printk(KERN_INFO, shost, "%s: cmds failed: %d, cancel: %d\n", __func__, cmd_failed, cmd_cancel)); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 25/27] scsi: check for correct return code in scsi_eh_abort_cmds()
scsi_try_to_abort_cmd() might return SUCCESS, FAILED, or FAST_IO_FAIL. So just checking for FAILED will treat FAST_IO_FAIL as SUCCESS, which is wrong. Cc: Robert Elliott Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 9209407..06cd624 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1345,7 +1345,7 @@ static int scsi_eh_abort_cmds(struct list_head *work_q, scmd_printk(KERN_INFO, scmd, "%s: aborting cmd\n", current->comm)); rtn = scsi_try_to_abort_cmd(shost->hostt, scmd); - if (rtn == FAILED) { + if (rtn != SUCCESS) { SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, "%s: aborting cmd failed\n", -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/27] scsi: separate out scsi_(host|driver)byte_string()
Export functions for later use. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 58 include/scsi/scsi_dbg.h | 2 ++ 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index ea391f8..0fe50b4 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1406,38 +1406,68 @@ static const char * const hostbyte_table[]={ "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(int result) +#endif + +const char *scsi_hostbyte_string(int result) { + const char *hb_string = NULL; +#ifdef CONFIG_SCSI_CONSTANTS int hb = host_byte(result); - int db = driver_byte(result); - printk("Result: hostbyte=%s driverbyte=%s\n", - (hb < NUM_HOSTBYTE_STRS ? hostbyte_table[hb] : "invalid"), - (db < NUM_DRIVERBYTE_STRS ? driverbyte_table[db] : "invalid")); + if (hb < ARRAY_SIZE(hostbyte_table)) + hb_string = hostbyte_table[hb]; +#endif + return hb_string; } +EXPORT_SYMBOL(scsi_hostbyte_string); -#else +const char *scsi_driverbyte_string(int result) +{ + const char *db_string = NULL; +#ifdef CONFIG_SCSI_CONSTANTS + int db = driver_byte(result); + + if (db < ARRAY_SIZE(driverbyte_table)) + db_string = driverbyte_table[db]; +#endif + return db_string; +} +EXPORT_SYMBOL(scsi_driverbyte_string); void scsi_show_result(int result) { - printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n", - host_byte(result), driver_byte(result)); -} + const char *hb_string = scsi_hostbyte_string(result); + const char *db_string = scsi_driverbyte_string(result); -#endif + if (hb_string || db_string) + printk("Result: hostbyte=%s driverbyte=%s\n", + hb_string ? hb_string : "invalid", + db_string ? db_string : "invalid"); + else + printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n", + host_byte(result), driver_byte(result)); +} EXPORT_SYMBOL(scsi_show_result); void scsi_print_result(struct scsi_cmnd *cmd) { - scmd_printk(KERN_INFO, cmd, " "); - scsi_show_result(cmd->result); + const char *hb_string = scsi_hostbyte_string(cmd->result); + const char *db_string = scsi_driverbyte_string(cmd->result); + + if (hb_string || db_string) + scmd_printk(KERN_INFO, cmd, + "Result: hostbyte=%s driverbyte=%s", + hb_string ? hb_string : "invalid", + db_string ? db_string : "invalid"); + else + scmd_printk(KERN_INFO, cmd, + "Result: hostbyte=0x%02x driverbyte=0x%02x", + host_byte(cmd->result), driver_byte(cmd->result)); } EXPORT_SYMBOL(scsi_print_result); diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 81d0418..50f4d85 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -19,6 +19,8 @@ extern void __scsi_print_sense(const struct scsi_device *, const char *name, int sense_len); extern void scsi_show_result(int); extern void scsi_print_result(struct scsi_cmnd *); +extern const char *scsi_hostbyte_string(int); +extern const char *scsi_driverbyte_string(int); extern const char *scsi_sense_key_string(unsigned char); extern const char *scsi_extd_sense_format(unsigned char, unsigned char, const char **); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 24/27] scsi_error: document scsi_try_to_abort_cmd
scsi_try_to_abort_cmd() should only return SUCCESS, FAILED, or FAST_IO_FAIL. So document that in the function description and simplify the logging message. Suggested-by: Christoph Hellwig Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/scsi_error.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index c485f28..9209407 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -157,8 +157,9 @@ scmd_eh_abort_handler(struct work_struct *work) } else { SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, - "scmd %p abort failed, rtn %d\n", - scmd, rtn)); + "scmd %p abort %s\n", scmd, + (rtn == FAST_IO_FAIL) ? + "not send" : "failed")); } } @@ -869,7 +870,24 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) return rtn; } -static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd) +/** + * scsi_try_to_abort_cmd - Ask host to abort a SCSI command + * @scmd: SCSI cmd used to send a target reset + * + * Return value: + * SUCCESS, FAILED, or FAST_IO_FAIL + * + * Notes: + *SUCCESS does not necessarily indicate that the command + *has been aborted; it only indicates that the LLDDs + *has cleared all references to that command. + *LLDDs should return FAILED only if an abort was required + *but could not be executed. LLDDs should return FAST_IO_FAIL + *if the device is temporarily unavailable (eg due to a + *link down on FibreChannel) + */ +static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt, +struct scsi_cmnd *scmd) { if (!hostt->eh_abort_handler) return FAILED; -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/27] scsi: introduce sdev_prefix_printk()
Like scmd_printk(), but the device name is passed in as a string. Can be used by eg ULDs which do not have access to the scsi_cmnd structure. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/ch.c | 3 +-- drivers/scsi/sd.h | 6 +++--- drivers/scsi/sg.c | 4 ++-- drivers/scsi/sr.h | 3 +-- drivers/scsi/st.c | 3 +-- include/scsi/scsi_device.h | 9 + 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index ef5ae0d..52060e7 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -85,8 +85,7 @@ static const char * vendor_labels[CH_TYPES-4] = { // module_param_string_array(vendor_labels, NULL, 0444); #define ch_printk(prefix, ch, fmt, a...) \ - sdev_printk(prefix, (ch)->device, "[%s] " fmt, \ - (ch)->name, ##a) + sdev_prefix_printk(prefix, (ch)->device, (ch)->name, fmt, ##a) #define DPRINTK(fmt, arg...) \ do { \ diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h index 4c3ab83..19d20af 100644 --- a/drivers/scsi/sd.h +++ b/drivers/scsi/sd.h @@ -103,9 +103,9 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk) #define sd_printk(prefix, sdsk, fmt, a...) \ (sdsk)->disk ? \ - sdev_printk(prefix, (sdsk)->device, "[%s] " fmt,\ - (sdsk)->disk->disk_name, ##a) : \ - sdev_printk(prefix, (sdsk)->device, fmt, ##a) + sdev_prefix_printk(prefix, (sdsk)->device,\ +(sdsk)->disk->disk_name, fmt, ##a) : \ + sdev_printk(prefix, (sdsk)->device, fmt, ##a) #define sd_first_printk(prefix, sdsk, fmt, a...) \ do {\ diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 01cf888..87304c8 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -219,8 +219,8 @@ static void sg_device_destroy(struct kref *kref); #define SZ_SG_REQ_INFO sizeof(sg_req_info_t) #define sg_printk(prefix, sdp, fmt, a...) \ - sdev_printk(prefix, (sdp)->device, "[%s] " fmt, \ - (sdp)->disk->disk_name, ##a) + sdev_prefix_printk(prefix, (sdp)->device, \ + (sdp)->disk->disk_name, fmt, ##a) static int sg_allow_access(struct file *filp, unsigned char *cmd) { diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h index 1d1f6f4..1de3371 100644 --- a/drivers/scsi/sr.h +++ b/drivers/scsi/sr.h @@ -57,8 +57,7 @@ typedef struct scsi_cd { } Scsi_CD; #define sr_printk(prefix, cd, fmt, a...) \ - sdev_printk(prefix, (cd)->device, "[%s] " fmt, \ - (cd)->cdi.name, ##a) + sdev_prefix_printk(prefix, (cd)->device, (cd)->cdi.name, fmt, ##a) int sr_do_ioctl(Scsi_CD *, struct packet_command *); diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d3fd6e8..e479343 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -306,8 +306,7 @@ static inline char *tape_name(struct scsi_tape *tape) } #define st_printk(prefix, t, fmt, a...) \ - sdev_printk(prefix, (t)->device, "%s: " fmt, \ - tape_name(t), ##a) + sdev_prefix_printk(prefix, (t)->device, tape_name(t), fmt, ##a) #ifdef DEBUG #define DEBC_printk(t, fmt, a...) \ if (debugging) { st_printk(ST_DEB_MSG, t, fmt, ##a ); } diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 27ecee7..0b18a09 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -244,6 +244,15 @@ struct scsi_dh_data { #define sdev_dbg(sdev, fmt, a...) \ dev_dbg(&(sdev)->sdev_gendev, fmt, ##a) +/* + * like scmd_printk, but the device name is passed in + * as a string pointer + */ +#define sdev_prefix_printk(l, sdev, p, fmt, a...) \ + (p) ? \ + sdev_printk(l, sdev, "[%s] " fmt, p, ##a) : \ + sdev_printk(l, sdev, fmt, ##a) + #define scmd_printk(prefix, scmd, fmt, a...) \ (scmd)->request->rq_disk ? \ sdev_printk(prefix, (scmd)->device, "[%s] " fmt,\ -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/27] scsi: remove scsi_print_status()
Last caller is gone, so we can remove it. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 35 --- include/scsi/scsi_dbg.h | 1 - 2 files changed, 36 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index ec69ec8..8253f7b 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -433,41 +433,6 @@ void scsi_print_command(struct scsi_cmnd *cmd) } EXPORT_SYMBOL(scsi_print_command); -/** - * scsi_print_status - print scsi status description - * @scsi_status: scsi status value - * - * If the status is recognized, the description is printed. - * Otherwise "Unknown status" is output. No trailing space. - * If CONFIG_SCSI_CONSTANTS is not set, then print status in hex - * (e.g. "0x2" for Check Condition). - **/ -void -scsi_print_status(unsigned char scsi_status) { -#ifdef CONFIG_SCSI_CONSTANTS - const char * ccp; - - switch (scsi_status) { - case 0:ccp = "Good"; break; - case 0x2: ccp = "Check Condition"; break; - case 0x4: ccp = "Condition Met"; break; - case 0x8: ccp = "Busy"; break; - case 0x10: ccp = "Intermediate"; break; - case 0x14: ccp = "Intermediate-Condition Met"; break; - case 0x18: ccp = "Reservation Conflict"; break; - case 0x22: ccp = "Command Terminated"; break; /* obsolete */ - case 0x28: ccp = "Task set Full"; break;/* was: Queue Full */ - case 0x30: ccp = "ACA Active"; break; - case 0x40: ccp = "Task Aborted"; break; - default: ccp = "Unknown status"; - } - printk(KERN_INFO "%s", ccp); -#else - printk(KERN_INFO "0x%0x", scsi_status); -#endif -} -EXPORT_SYMBOL(scsi_print_status); - #ifdef CONFIG_SCSI_CONSTANTS struct error_info { diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index 6cbd179..386474e 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -19,7 +19,6 @@ extern void __scsi_print_sense(const struct scsi_device *, const char *name, int sense_len); extern void scsi_show_result(int); extern void scsi_print_result(struct scsi_cmnd *); -extern void scsi_print_status(unsigned char); extern const char *scsi_sense_key_string(unsigned char); extern const char *scsi_extd_sense_format(unsigned char, unsigned char, const char **); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 26/27] scsi: correct return values for .eh_abort_handler implementations
The .eh_abort_handler needs to return SUCCESS, FAILED, or FAST_IO_FAIL. So fixup all callers to adhere to this requirement. Cc: Robert Elliott Cc: Signed-off-by: Hannes Reinecke --- drivers/scsi/NCR5380.c| 2 +- drivers/scsi/aha1740.c| 2 +- drivers/scsi/esas2r/esas2r_main.c | 2 +- drivers/scsi/megaraid.c | 8 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 50873bb..e2c9e73 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -2703,7 +2703,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) { * aborted flag and get back into our main loop. */ - return 0; + return SUCCESS; } #endif diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 5f31017..31ace4b 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c @@ -531,7 +531,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy) * quiet as possible... */ - return 0; + return SUCCESS; } static struct scsi_host_template aha1740_template = { diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c index 6504a19..45aa684 100644 --- a/drivers/scsi/esas2r/esas2r_main.c +++ b/drivers/scsi/esas2r/esas2r_main.c @@ -1057,7 +1057,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd) cmd->scsi_done(cmd); - return 0; + return SUCCESS; } spin_lock_irqsave(&a->queue_lock, flags); diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index ac5d94c..2485255 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -1945,7 +1945,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) cmd->device->id, (u32)cmd->device->lun); if(list_empty(&adapter->pending_list)) - return FALSE; + return FAILED; list_for_each_safe(pos, next, &adapter->pending_list) { @@ -1968,7 +1968,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) (aor==SCB_ABORT) ? "ABORTING":"RESET", scb->idx); - return FALSE; + return FAILED; } else { @@ -1993,12 +1993,12 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) list_add_tail(SCSI_LIST(cmd), &adapter->completed_list); - return TRUE; + return SUCCESS; } } } - return FALSE; + return FAILED; } static inline int -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/27] sd: Cleanup logging
Open-code scsi_print_result in sd.c, and cleanup logging to not print duplicate informations. With that we can remove scsi_show_result in constants.c Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 16 drivers/scsi/sd.c| 50 +--- include/scsi/scsi_dbg.h | 1 - 3 files changed, 26 insertions(+), 41 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 0fe50b4..5e64afc 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1439,22 +1439,6 @@ const char *scsi_driverbyte_string(int result) } EXPORT_SYMBOL(scsi_driverbyte_string); -void scsi_show_result(int result) -{ - const char *hb_string = scsi_hostbyte_string(result); - const char *db_string = scsi_driverbyte_string(result); - - if (hb_string || db_string) - printk("Result: hostbyte=%s driverbyte=%s\n", - hb_string ? hb_string : "invalid", - db_string ? db_string : "invalid"); - else - printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n", - host_byte(result), driver_byte(result)); -} -EXPORT_SYMBOL(scsi_show_result); - - void scsi_print_result(struct scsi_cmnd *cmd) { const char *hb_string = scsi_hostbyte_string(cmd->result); diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 848b17d..ed40b85 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -116,7 +116,7 @@ static int sd_eh_action(struct scsi_cmnd *, int); static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); static void scsi_disk_release(struct device *cdev); static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); -static void sd_print_result(struct scsi_disk *, int); +static void sd_print_result(const struct scsi_disk *, const char *, int); static DEFINE_SPINLOCK(sd_index_lock); static DEFINE_IDA(sd_index_ida); @@ -1479,7 +1479,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp) } if (res) { - sd_print_result(sdkp, res); + sd_print_result(sdkp, "Synchronize Cache(10) failed", res); if (driver_byte(res) & DRIVER_SENSE) sd_print_sense_hdr(sdkp, &sshdr); @@ -1700,17 +1700,6 @@ static int sd_done(struct scsi_cmnd *SCpnt) if (sense_valid) sense_deferred = scsi_sense_is_deferred(&sshdr); } -#ifdef CONFIG_SCSI_LOGGING - SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt)); - if (sense_valid) { - SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, - "sd_done: sb[respc,sk,asc," - "ascq]=%x,%x,%x,%x\n", - sshdr.response_code, - sshdr.sense_key, sshdr.asc, - sshdr.ascq)); - } -#endif sdkp->medium_access_timed_out = 0; if (driver_byte(result) != DRIVER_SENSE && @@ -1765,6 +1754,10 @@ static int sd_done(struct scsi_cmnd *SCpnt) break; } out: + SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, + "sd_done: completed %d of %d bytes\n", + good_bytes, scsi_bufflen(SCpnt))); + if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) sd_dif_complete(SCpnt, good_bytes); @@ -1820,12 +1813,12 @@ sd_spinup_disk(struct scsi_disk *sdkp) /* no sense, TUR either succeeded or failed * with a status error */ if(!spintime && !scsi_status_is_good(the_result)) { - sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n"); - sd_print_result(sdkp, the_result); + sd_print_result(sdkp, "Test Unit Ready failed", + the_result); } break; } - + /* * The device does not want the automatic start to be issued. */ @@ -1941,7 +1934,6 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, struct scsi_sense_hdr *sshdr, int sense_valid, int the_result) { - sd_print_result(sdkp, the_result); if (driver_byte(the_result) & DRIVER_SENSE) sd_print_sense_hdr(sdkp, sshdr); else @@ -2022,7 +2014,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, } while (the_result && retries); if (the_r
[PATCH 21/27] scsi: simplify scsi_log_(send|completion)
Simplify scsi_log_(send|completion) by externalizing scsi_mlreturn_string() and always print the command address. Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/constants.c | 41 ++--- drivers/scsi/scsi.c | 43 ++- drivers/scsi/scsi_lib.c | 13 ++--- include/scsi/scsi_dbg.h | 3 ++- 4 files changed, 56 insertions(+), 44 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 5e64afc..65c0023 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1439,19 +1439,54 @@ const char *scsi_driverbyte_string(int result) } EXPORT_SYMBOL(scsi_driverbyte_string); -void scsi_print_result(struct scsi_cmnd *cmd) +#ifdef CONFIG_SCSI_CONSTANTS +#define scsi_mlreturn_name(result) { result, #result } +static const struct value_name_pair scsi_mlreturn_arr[] = { + scsi_mlreturn_name(NEEDS_RETRY), + scsi_mlreturn_name(SUCCESS), + scsi_mlreturn_name(FAILED), + scsi_mlreturn_name(QUEUED), + scsi_mlreturn_name(SOFT_ERROR), + scsi_mlreturn_name(ADD_TO_MLQUEUE), + scsi_mlreturn_name(TIMEOUT_ERROR), + scsi_mlreturn_name(SCSI_RETURN_NOT_HANDLED), + scsi_mlreturn_name(FAST_IO_FAIL) +}; +#endif + +const char *scsi_mlreturn_string(int result) +{ +#ifdef CONFIG_SCSI_CONSTANTS + const struct value_name_pair *arr = scsi_mlreturn_arr; + int k; + + for (k = 0; k < ARRAY_SIZE(scsi_mlreturn_arr); ++k, ++arr) { + if (result == arr->value) + return arr->name; + } +#endif + return NULL; +} +EXPORT_SYMBOL(scsi_mlreturn_string); + +void scsi_print_result(struct scsi_cmnd *cmd, const char *msg, int disposition) { + const char *mlret_string = scsi_mlreturn_string(disposition); const char *hb_string = scsi_hostbyte_string(cmd->result); const char *db_string = scsi_driverbyte_string(cmd->result); if (hb_string || db_string) scmd_printk(KERN_INFO, cmd, - "Result: hostbyte=%s driverbyte=%s", + "%s%s Result: hostbyte=%s driverbyte=%s", + msg ? msg : "", + mlret_string ? mlret_string : "UNKNOWN", hb_string ? hb_string : "invalid", db_string ? db_string : "invalid"); else scmd_printk(KERN_INFO, cmd, - "Result: hostbyte=0x%02x driverbyte=0x%02x", + "%s%s Result: hostbyte=0x%02x driverbyte=0x%02x", + msg ? msg : "", + mlret_string ? mlret_string : "UNKNOWN", host_byte(cmd->result), driver_byte(cmd->result)); } EXPORT_SYMBOL(scsi_print_result); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 61aeaf1..3d81a07 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -527,9 +527,9 @@ void scsi_log_send(struct scsi_cmnd *cmd) * * 1: nothing (match completion) * -* 2: log opcode + command of all commands +* 2: log opcode + command of all commands + cmd address * -* 3: same as 2 plus dump cmd address +* 3: same as 2 * * 4: same as 3 plus dump extra junk */ @@ -537,10 +537,8 @@ void scsi_log_send(struct scsi_cmnd *cmd) level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT, SCSI_LOG_MLQUEUE_BITS); if (level > 1) { - scmd_printk(KERN_INFO, cmd, "Send: "); - if (level > 2) - printk("0x%p ", cmd); - printk("\n"); + scmd_printk(KERN_INFO, cmd, + "Send: scmd 0x%p\n", cmd); scsi_print_command(cmd); if (level > 3) { printk(KERN_INFO "buffer = 0x%p, bufflen = %d," @@ -565,7 +563,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) * * 2: same as 1 but for all command completions. * -* 3: same as 2 plus dump cmd address +* 3: same as 2 * * 4: same as 3 plus dump extra junk */ @@ -574,36 +572,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) SCSI_LOG_MLCOMPLETE_BITS); if (((level > 0) && (cmd->result || disposition != SUCCESS)) || (level > 1)) { - scmd_printk(KERN_INFO, cmd, "Done: "); - if (level > 2) - printk("0x%p ", cmd); - /* -* Dump truncated values, so we usually fit within -
[PATCH 22/27] scsi: fixup logging messages in scsi_error.c
Use the matching scope for logging messages to allow for better command tracing. Suggested-by: Robert Elliott Reviewed-by: Robert Elliott Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke --- drivers/scsi/hosts.c | 4 +-- drivers/scsi/scsi_error.c | 77 +++ 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 6de80e3..06030e1 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -485,8 +485,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) WQ_UNBOUND | WQ_MEM_RECLAIM, 1, shost->host_no); if (!shost->tmf_work_q) { - printk(KERN_WARNING "scsi%d: failed to create tmf workq\n", - shost->host_no); + shost_printk(KERN_WARNING, shost, +"failed to create tmf workq\n"); goto fail_kthread; } scsi_proc_hostdir_add(shost->hostt); diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index a113e99..087ca02 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1156,9 +1156,9 @@ int scsi_eh_get_sense(struct list_head *work_q, shost = scmd->device->host; if (scsi_host_eh_past_deadline(shost)) { SCSI_LOG_ERROR_RECOVERY(3, - shost_printk(KERN_INFO, shost, - "skip %s, past eh deadline\n", -__func__)); + scmd_printk(KERN_INFO, scmd, + "%s: skip request sense, past eh deadline\n", +current->comm)); break; } if (status_byte(scmd->result) != CHECK_CONDITION) @@ -1265,9 +1265,9 @@ static int scsi_eh_test_devices(struct list_head *cmd_list, /* Push items back onto work_q */ list_splice_init(cmd_list, work_q); SCSI_LOG_ERROR_RECOVERY(3, - shost_printk(KERN_INFO, sdev->host, -"skip %s, past eh deadline", -__func__)); + sdev_printk(KERN_INFO, sdev, + "%s: skip test device, past eh deadline", + current->comm)); break; } } @@ -1318,21 +1318,20 @@ static int scsi_eh_abort_cmds(struct list_head *work_q, if (scsi_host_eh_past_deadline(shost)) { list_splice_init(&check_list, work_q); SCSI_LOG_ERROR_RECOVERY(3, - shost_printk(KERN_INFO, shost, - "skip %s, past eh deadline\n", -__func__)); + scmd_printk(KERN_INFO, scmd, + "%s: skip aborting cmd, past eh deadline\n", + current->comm)); return list_empty(work_q); } SCSI_LOG_ERROR_RECOVERY(3, - shost_printk(KERN_INFO, shost, -"%s: aborting cmd: 0x%p\n", -current->comm, scmd)); + scmd_printk(KERN_INFO, scmd, +"%s: aborting cmd\n", current->comm)); rtn = scsi_try_to_abort_cmd(shost->hostt, scmd); if (rtn == FAILED) { SCSI_LOG_ERROR_RECOVERY(3, - shost_printk(KERN_INFO, shost, -"%s: aborting cmd failed: 0x%p\n", -current->comm, scmd)); + scmd_printk(KERN_INFO, scmd, + "%s: aborting cmd failed\n", +current->comm)); list_splice_init(&check_list, work_q); return list_empty(work_q); } @@ -1390,9 +1389,9 @@ static int scsi_eh_stu(struct Scsi_Host *shost, shost_for_each_device(sdev, shost) { if (scsi_host_eh_past_deadline(shost)) { SCSI_LOG_ERROR_RECOVERY(3, - shost_printk(KERN_INFO, shost, - "skip %s, past eh deadline\n", -