Re: Possible use after free in scsi_put_command()?
On 06/24/14 17:07, Maurizio Lombardi wrote: I've a question regarding the asynchronous scsi abort handler, look at the scsi_put_command() function: void scsi_put_command(struct scsi_cmnd *cmd) { unsigned long flags; [...] cancel_delayed_work(cmd-abort_work); __scsi_put_command(cmd-device-host, cmd); } cancel_delayed_work() may return while the abort handler is still running, the problem is that __scsi_put_command() frees the cmd pointer that is still used by the abort handler. Is it correct? Isn't safer to use cancel_delayed_work_sync() here? Hello Maurizio, I agree that that cancel_delayed_work() call is confusing. Hence [PATCH] Remove two cancel_delayed_work() calls from the mid-layer (http://thread.gmane.org/gmane.linux.scsi/91027). Had you already noticed that patch ? Best regards, Bart. -- 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: Possible use after free in scsi_put_command()?
Hi Bart, On 06/25/2014 08:52 AM, Bart Van Assche wrote: Hello Maurizio, I agree that that cancel_delayed_work() call is confusing. Hence [PATCH] Remove two cancel_delayed_work() calls from the mid-layer (http://thread.gmane.org/gmane.linux.scsi/91027). Had you already noticed that patch ? No, I missed it, thanks for pointing it out to me. Thanks, Maurizio Lombardi -- 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: Possible use after free in scsi_put_command()?
On 06/25/14 09:03, Maurizio Lombardi wrote: On 06/25/2014 08:52 AM, Bart Van Assche wrote: I agree that that cancel_delayed_work() call is confusing. Hence [PATCH] Remove two cancel_delayed_work() calls from the mid-layer (http://thread.gmane.org/gmane.linux.scsi/91027). Had you already noticed that patch ? No, I missed it, thanks for pointing it out to me. Hello James and Christoph, Is it correct that the patch mentioned above has not yet been queued up ? Has it already been decided in which kernel version that patch should be included ? Thanks, Bart. -- 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 1/3] scsi_cmnd: Introduce scsi_transfer_length helper
On 6/25/2014 6:32 AM, Mike Christie wrote: On 06/24/2014 12:08 PM, Mike Christie wrote: On 06/24/2014 12:00 PM, Mike Christie wrote: On 06/24/2014 11:30 AM, Christoph Hellwig wrote: On Tue, Jun 24, 2014 at 07:27:46PM +0300, Sagi Grimberg wrote: This condition only matters in the bidi case, which is not relevant for the PI case. I suggested to condition that in libiscsi (posted in the second thread, copy-paste below). Although I do agree that scsi_transfer_length() helper is not really just for PI and not more. I think Mike's way is cleaner. But for bidi there are two transfers. So either scsi_transfer_length() needs to take the scsi_data_buffer, or we need to avoid using it. For 3.16 I'd prefer something like you're patch below. This patch which has been rushed in last minute and not through the scsi tree has already causes enough harm. If you can come up with a clean version to transparently handle the bidi case I'd be happy to pick that up for 3.17. In the meantime please provide a version of the patch below with a proper description and signoff. It would be nice to just have one function to call and it just do the right thing for the drivers. I am fine with Sagi's libiscsi patch for now though: Acked-by: Mike Christie micha...@cs.wisc.edu Actually, let me take this back for a second. I am not sure if that is right. Hey Mike, Sagi's patch was not correct because scsi_in was hardcoded to the transfer len when bidi was used. Right, should have condition that in the direction. something like: transfer_length = sc-sc_data_direction == DMA_TO_DEVICE ? scsi_out(sc)-length : scsi_in(sc)-length; would probably hit that in testing before sending out a patch. I made the patch below which should fix both bidi support in iscsi and also WRITE_SAME (and similar commands) support. I'm a bit confused, for all commands (bidi or not) the iscsi header data_length should describe the scsi_data_buffer length, bidi information will lie in AHS header. (in case bidi will ever co-exist with PI, we might need another helper that will look in req-special + PI, something like scsi_bidi_transfer_length) So why not keep scsi_transfer_length to work on sdb length (take scsi_bufflen(scmnd) or scsi_out(scmnd)-length as MKP suggested) and that's it - don't touch libiscsi. Let me test that. There is one issue/question though. Is this working ok with LIO? I left scsi_transfer_length() with the same behavior as before assuming LIO was ok and only the iscsi initiator had suffered a regression. I think that if we go with scsi_in/out_transfer_length then scsi_transfer_length should be removed and LIO can be modified to use scsi_in/out_transfer_length. -- [PATCH] iscsi/scsi: Fix transfer len calculation I'll comment on the patch as well if we decide to go this way. This patch fixes the following regressions added in commit d77e65350f2d82dfa0557707d505711f5a43c8fd 1. The iscsi header data length is supposed to be the amount of data being transferred and not the total length of the operation like is given with blk_rq_bytes. 2. scsi_transfer_length is used in generic iscsi code paths, but did not take into account bidi commands. To fix both issues, this patch adds 2 new helpers that use the scsi_out/in(cmnd)-length values instead of blk_rq_bytes. Signed-off-by: Mike Christie micha...@cs.wisc.edu diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3d1bc67..ee79cdf 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -338,7 +338,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) struct iscsi_session *session = conn-session; struct scsi_cmnd *sc = task-sc; struct iscsi_scsi_req *hdr; - unsigned hdrlength, cmd_len, transfer_length; + unsigned hdrlength, cmd_len; itt_t itt; int rc; @@ -391,11 +391,11 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) if (scsi_get_prot_op(sc) != SCSI_PROT_NORMAL) task-protected = true; - transfer_length = scsi_transfer_length(sc); - hdr-data_length = cpu_to_be32(transfer_length); if (sc-sc_data_direction == DMA_TO_DEVICE) { + unsigned out_len = scsi_out_transfer_length(sc); struct iscsi_r2t_info *r2t = task-unsol_r2t; + hdr-data_length = cpu_to_be32(out_len); hdr-flags |= ISCSI_FLAG_CMD_WRITE; /* * Write counters: @@ -414,19 +414,18 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) memset(r2t, 0, sizeof(*r2t)); if (session-imm_data_en) { - if (transfer_length = session-first_burst) + if (out_len = session-first_burst) task-imm_count = min(session-first_burst, conn-max_xmit_dlength); else -
Re: Possible use after free in scsi_put_command()?
On Wed, Jun 25, 2014 at 09:45:07AM +0200, Bart Van Assche wrote: Hello James and Christoph, Is it correct that the patch mentioned above has not yet been queued up ? Has it already been decided in which kernel version that patch should be included ? I've got it in my local pending queue for 3.17. I'll push that one out soon. -- 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 1/3] scsi_cmnd: Introduce scsi_transfer_length helper
Mike, I'd prefer a fix on top of the core-for-3.16 branch in my scsi-queue tree, which already has the fix from Martin. I also really don't like these three confusing helpers: +static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) +{ + return __scsi_calculate_transfer_length(scmd, + blk_rq_bytes(scmd-request)); +} So here we use blk_rq_bytes still, which is incorrect for WRITE SAME. +static inline unsigned scsi_in_transfer_length(struct scsi_cmnd *scmd) +{ + return __scsi_calculate_transfer_length(scmd, scsi_in(scmd)-length); +} + +static inline unsigned scsi_out_transfer_length(struct scsi_cmnd *scmd) +{ + return __scsi_calculate_transfer_length(scmd, scsi_out(scmd)-length); And here we use the in/out length. And no documentation whatsover which one you'd want to choose. I think the easiest fix is to just pass a scsi_data_buffer to scsi_transfer_length(), and let the caller use scsi_in/scsi_out to find the right one. -- 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 1/3] scsi_cmnd: Introduce scsi_transfer_length helper
Sagi's patch was not correct because scsi_in was hardcoded to the transfer len when bidi was used. Right, should have condition that in the direction. something like: transfer_length = sc-sc_data_direction == DMA_TO_DEVICE ? scsi_out(sc)-length : scsi_in(sc)-length; would probably hit that in testing before sending out a patch. We could also pass the dma direction indeed. Compared to my suggestion of passing thr scsi_data_buffer this makes life a lot easier for drivers that don't try to support the bidi madness. There is one issue/question though. Is this working ok with LIO? I left scsi_transfer_length() with the same behavior as before assuming LIO was ok and only the iscsi initiator had suffered a regression. I think that if we go with scsi_in/out_transfer_length then scsi_transfer_length should be removed and LIO can be modified to use scsi_in/out_transfer_length. drivers/target/loopback/tcm_loop.c doesn't (and absolutely shouldn't!) use scsi_transfer_length in target context, it uses it in it's initiator side in the same way as iscsi, so the same semantics apply. -- 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: mptNsas MSI-X fixes
Hi James, This Patch set seems to be fine. Please consider this patch set as Acked-by: Sreekanth Reddy sreekanth.re...@avagotech.com Regards, Sreekanth -Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- ow...@vger.kernel.org] On Behalf Of Martin K. Petersen Sent: Saturday, January 04, 2014 5:47 AM To: linux-scsi@vger.kernel.org Subject: mptNsas MSI-X fixes We found a couple of MSI-X related problems with mptNsas on very large systems. The patches below contain fixes for mpt2sas and mpt3sas respectively. drivers/scsi/mpt2sas/mpt2sas_base.c | 64 -- drivers/scsi/mpt3sas/mpt3sas_base.c | 73 ++- --- 2 files changed, 44 insertions(+), 93 deletions(-) -- Martin K. Petersen Oracle Linux Engineering -- 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 -- 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 0/4] mpt2/mpt3 static checker fixups
James, This Patch set seems to be fine. Please consider this patch set as Acked-by: Sreekanth Reddy sreekanth.re...@avagotech.com Regards, Sreekanth -Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- ow...@vger.kernel.org] On Behalf Of Joe Lawrence Sent: Monday, June 02, 2014 8:04 PM To: linux-scsi@vger.kernel.org Cc: Dan Carpenter; Sreekanth Reddy; Joe Lawrence Subject: [PATCH 0/4] mpt2/mpt3 static checker fixups Hello Sreekanth, Dan, These are a few minor smatch and sparse static checker fixes for the LSI mpt2 and mpt3 drivers. The first three fix real potential bugs and the last cleans up a noisy complaint from sparse. Joe Lawrence (4): mpt2sas: correct scsi_{target,device} hostdata allocation mpt3sas: correct scsi_{target,device} hostdata allocation mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event mpt2sas: annotate ioc-reply_post_host_index as __iomem drivers/scsi/mpt2sas/mpt2sas_base.c |9 + drivers/scsi/mpt2sas/mpt2sas_base.h |2 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c |6 -- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 10 +++--- 4 files changed, 17 insertions(+), 10 deletions(-) -- 1.7.10.4 -- 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 -- 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: sd_setup_discard_cmnd: BUG: unable to handle kernel NULL pointer dereference at (null)
On Tue, Jun 24, 2014 at 07:11:47PM -0400, Martin K. Petersen wrote: Lars == Lars Ellenberg lars.ellenb...@linbit.com writes: Lars We are receiving (from network) and submitting (to lower level IO Lars stack) in the same context and would like the submit to be async. Lars Do you intend to provide an asynchronous interface? I guess we can look into that if there is a need. Do different clients share that context? I.e. does a synchronous discard block other clients from accessing the drbd server? Uhm, it's not like exactly like that, really. Because the way we do some internal bookkeeping, we announce a max discard of 4 MiB. So if some user on the active (Primary) DRBD does large discards, you will end up submitting lots of bios, and these are async. Bios are the entry point to DRBD. So DRBD ships these discard-bios over to the peer, which then right now submits them as bios, again async. So we do some pipelining, may have a number of discard bios in flight, and effectively the latency will be increased by something in the order of the network rtt. If we now have to use the synchronous interface on the peer for each discard bio, there is no longer any pipelining, and the overall latency of a single user level discard (that ends up doing many discard bios) will noticeably increase. Also, since the receiver is blocked in submit, we cannot meanwhile interleave other, normal BIOs, so a larger discard will block all write (and depending on configuration and current state, also read) within that DRBD resource (which again may be one or more DRBD minor devices or volumes). I don't have real-life numbers on how much that may hurt. Similar for the WRITE_SAME interface (which we do not properly support on the DRBD protocol level yet -- backward compatibility concerns -- but intend to support soon). If we only have a synchronous interface, we will probably have to either add some async wrapper, or defer such submissions to worker threads. I'd prefer to have an async submit path. Lars -- 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 08/14] block: Add a disk flag to block integrity profile
On Wed, Jun 11, 2014 at 09:30:34PM -0400, Martin K. Petersen wrote: /sys/block/foo/integrity/disk_is_formatted_with_pi /sys/block/foo/integrity/disk_is_integrity_capable /sys/block/foo/integrity/disk_supports_storing_pi Or would you prefer something other than disk? target? storage_device? I'd defintively prefer the target_ prefix and one of the descriptive suffixes. -- 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][SCSI]mpt2sas: Description Patch
Just resending below set of patches which I have sent on 14th March 2014. And I have removed below subjected patch since we have already have the module parameter port_mask to disable EEDP support. [PATCH 02/11][SCSI]mpt2sas: Added new driver module Parameter disable_eedp to Disable EEDP Support. Please consider this patch set for next kernel release. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- [RESEND][PATCH 01/10][SCSI]mpt2sas: Added driver module parameter max_msix_vectors. [RESEND][PATCH 02/10][SCSI]mpt2sas: MPI2 Rev Y (2.00.17) and Rev Z (2.00.18) specifications. [RESEND][PATCH 03/10][SCSI]mpt2sas: Copyright in driver sources is updated for year the 2014. [RESEND][PATCH 04/10][SCSI]mpt2sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced. [RESEND][PATCH 05/10][SCSI]mpt2sas: Bump mpt2sas driver version to 17.100.00.00. [RESEND][PATCH 06/10][SCSI]mpt2sas: For 2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive. [RESEND][PATCH 07/10][SCSI]mpt2sas: Added Reply Descriptor Post Queue (RDPQ) Array support. [RESEND][PATCH 08/10][SCSI]mpt2sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state. [RESEND][PATCH 09/10][SCSI]mpt2sas: Added module parameter 'unblock_io' to unblock IO's during disk addition. [RESEND][PATCH 10/10][SCSI]mpt2sas: Bump mpt2sas driver version to 18.100.00.00. -- 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
[RESEND][PATCH 01/10][SCSI]mpt2sas: Added driver module parameter max_msix_vectors
Added driver module parameter max_msix_vectors. Using this module parameter the maximum number of MSI-X vectors could be set. The number of MSI-X vectors used would be the minimum of MSI-X vectors supported by the HBA, the number of CPU cores and the value set to max_msix_vectors module parameters. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.c | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index bde63f7..ed810fb 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -80,6 +80,10 @@ static int msix_disable = -1; module_param(msix_disable, int, 0); MODULE_PARM_DESC(msix_disable, disable msix routed interrupts (default=0)); +static int max_msix_vectors = -1; +module_param(max_msix_vectors, int, 0); +MODULE_PARM_DESC(max_msix_vectors, max msix vectors ); + static int mpt2sas_fwfault_debug; MODULE_PARM_DESC(mpt2sas_fwfault_debug, enable detection of firmware fault and halt firmware - (default=0)); @@ -1420,6 +1424,16 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) ioc-reply_queue_count = min_t(int, ioc-cpu_count, ioc-msix_vector_count); + if (max_msix_vectors 0) { + ioc-reply_queue_count = min_t(int, max_msix_vectors, + ioc-reply_queue_count); + ioc-msix_vector_count = ioc-reply_queue_count; + } + + printk(MPT2SAS_INFO_FMT + MSI-X vectors supported: %d, no of cores: %d, max_msix_vectors: %d\n, +ioc-name, ioc-msix_vector_count, ioc-cpu_count, max_msix_vectors); + entries = kcalloc(ioc-reply_queue_count, sizeof(struct msix_entry), GFP_KERNEL); if (!entries) { -- 1.7.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
[RESEND][PATCH 06/10][SCSI]mpt2sas: For 2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive
There was a down casting of the volume max LBA from a U64 to a U32, which is taken out and now the max LBA is set appropriately to U64. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 6ae109b..4a0728a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -3865,7 +3865,8 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, u16 smid) { - u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size; + u32 p_lba, stripe_off, stripe_unit, column, io_size; + u64 v_lba; u32 stripe_sz, stripe_exp; u8 num_pds, *cdb_ptr, i; u8 cdb0 = scmd-cmnd[0]; @@ -3882,12 +3883,17 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | cdb_ptr[5])) { io_size = scsi_bufflen(scmd) raid_device-block_exponent; - i = (cdb0 READ_16) ? 2 : 6; + /* get virtual lba */ - v_lba = be32_to_cpu(*(__be32 *)(cdb_ptr[i])); + if (cdb0 READ_16) + v_lba = be32_to_cpu(*(__be32 *)(cdb_ptr[2])); + else + v_lba = be64_to_cpu(*(__be64 *)(cdb_ptr[2])); + + i = (cdb0 READ_16) ? 2 : 6; if (((u64)v_lba + (u64)io_size - 1) = - (u32)raid_device-max_lba) { + raid_device-max_lba) { stripe_sz = raid_device-stripe_sz; stripe_exp = raid_device-stripe_exponent; stripe_off = v_lba (stripe_sz - 1); -- 1.7.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
[RESEND][PATCH 05/10][SCSI]mpt2sas: Bump mpt2sas driver version to 17.100.00.00
Bump mpt2sas driver version to 17.100.00.00. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 80d26c1..0a6747a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -69,8 +69,8 @@ #define MPT2SAS_DRIVER_NAMEmpt2sas #define MPT2SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com #define MPT2SAS_DESCRIPTIONLSI MPT Fusion SAS 2.0 Device Driver -#define MPT2SAS_DRIVER_VERSION 16.100.00.00 -#define MPT2SAS_MAJOR_VERSION 16 +#define MPT2SAS_DRIVER_VERSION 17.100.00.00 +#define MPT2SAS_MAJOR_VERSION 17 #define MPT2SAS_MINOR_VERSION 100 #define MPT2SAS_BUILD_VERSION 00 #define MPT2SAS_RELEASE_VERSION00 -- 1.7.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
[RESEND][PATCH 07/10][SCSI]mpt2sas: Added Reply Descriptor Post Queue (RDPQ) Array support
Up to now, Driver allocates a single contiguous block of memory pool for all reply queues and passes down a single address in the ReplyDescriptorPostQueueAddress field of the IOC Init Request Message to the firmware. When firmware receives this address, it will program each of the Reply Descriptor Post Queue registers, as each reply queue has its own register. Thus the firmware, starting from a base address it determines the starting address of the subsequent reply queues through some simple arithmetic calculations. The size of this contiguous block of memory pool is directly proportional to number of MSI-X vectors and the HBA queue depth. For example higher MSIX vectors requires larger contiguous block of memory pool. But some of the OS kernels are unable to allocate this larger contiguous block of memory pool. So, the proposal is to allocate memory independently for each Reply Queue and pass down all of the addresses to the firmware. Then the firmware will just take each address and program the value into the correct register. When HBAs with older firmware(i.e. without RDPQ capability) is used with this new driver then the max_msix_vectors value would be set to 8 by default. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.c | 923 +-- drivers/scsi/mpt2sas/mpt2sas_base.h | 18 +- 2 files changed, 558 insertions(+), 383 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 774720f..81f1d58 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -1427,6 +1427,9 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) ioc-reply_queue_count = min_t(int, ioc-cpu_count, ioc-msix_vector_count); + if (!ioc-rdpq_array_enable max_msix_vectors == -1) + max_msix_vectors = 8; + if (max_msix_vectors 0) { ioc-reply_queue_count = min_t(int, max_msix_vectors, ioc-reply_queue_count); @@ -1480,6 +1483,335 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) } /** + * _base_wait_for_doorbell_int - waiting for controller interrupt(generated by + * a write to the doorbell) + * @ioc: per adapter object + * @timeout: timeout in second + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + * + * Notes: MPI2_HIS_IOC2SYS_DB_STATUS - set to one when IOC writes to doorbell. + */ +static int +_base_wait_for_doorbell_int(struct MPT2SAS_ADAPTER *ioc, int timeout, + int sleep_flag) +{ + u32 cntdn, count; + u32 int_status; + + count = 0; + cntdn = (sleep_flag == CAN_SLEEP) ? 1000*timeout : 2000*timeout; + do { + int_status = readl(ioc-chip-HostInterruptStatus); + if (int_status MPI2_HIS_IOC2SYS_DB_STATUS) { + dhsprintk(ioc, printk(MPT2SAS_INFO_FMT + %s: successful count(%d), timeout(%d)\n, + ioc-name, __func__, count, timeout)); + return 0; + } + if (sleep_flag == CAN_SLEEP) + msleep(1); + else + udelay(500); + count++; + } while (--cntdn); + + printk(MPT2SAS_ERR_FMT + %s: failed due to timeout count(%d), int_status(%x)!\n, + ioc-name, __func__, count, int_status); + return -EFAULT; +} + +/** + * _base_wait_for_doorbell_ack - waiting for controller to read the doorbell. + * @ioc: per adapter object + * @timeout: timeout in second + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + * + * Notes: MPI2_HIS_SYS2IOC_DB_STATUS - set to one when host writes to + * doorbell. + */ +static int +_base_wait_for_doorbell_ack(struct MPT2SAS_ADAPTER *ioc, int timeout, + int sleep_flag) +{ + u32 cntdn, count; + u32 int_status; + u32 doorbell; + + count = 0; + cntdn = (sleep_flag == CAN_SLEEP) ? 1000*timeout : 2000*timeout; + do { + int_status = readl(ioc-chip-HostInterruptStatus); + if (!(int_status MPI2_HIS_SYS2IOC_DB_STATUS)) { + dhsprintk(ioc, printk(MPT2SAS_INFO_FMT + %s: successful count(%d), timeout(%d)\n, + ioc-name, __func__, count, timeout)); + return 0; + } else if (int_status MPI2_HIS_IOC2SYS_DB_STATUS) { + doorbell = readl(ioc-chip-Doorbell); + if ((doorbell MPI2_IOC_STATE_MASK) == + MPI2_IOC_STATE_FAULT) { + mpt2sas_base_fault_info(ioc , doorbell); + return -EFAULT; + } + } else if (int_status == 0x) + goto out; + + if
[RESEND][PATCH 09/10][SCSI]mpt2sas: Added module parameter 'unblock_io' to unblock IO's during disk addition
During hot-plugging of a disk(having a flaky link) the disk addition stops and any further disk addition or removal doesn't happen on that controller. This is because, when driver receives DELAY_NOT_RESPONDING for a disk when it is undergoing addition in the SCSI Mid layer, the driver would block the I/O to that disk resulting in a deadlock. i.e the disk addition work couldn't be completed as it can't send any I/O to the disk as I/Os are blocked. Any device removal (TARGET_NOT_RESPONDING) or link update(RC_PHY_CHANGED) couldn't be processed as they are in the queue to get processed after disk addition. Description of Change: To handle such cases, unblock the I/Os to the disk in ISR context if the disk is undergoing addition. The I/Os would get unblocked only if the driver receives RC_PHY_CHANGED reason code when the device addition is within the SAS Transport layer. An module parameter 'unblock_io' is introduced which needs to be set to have this functionality enabled. By default this functionality is disabled. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.h |3 + drivers/scsi/mpt2sas/mpt2sas_scsih.c | 67 ++--- drivers/scsi/mpt2sas/mpt2sas_transport.c | 13 ++ 3 files changed, 76 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 32181a6..7de7ba4 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -356,6 +356,8 @@ struct _internal_cmd { * @phy: phy identifier provided in sas device page 0 * @responding: used in _scsih_sas_device_mark_responding * @pfa_led_on: flag for PFA LED status + * @pend_sas_rphy_add: flag to check if device is in sas_rphy_add() + * addition routine */ struct _sas_device { struct list_head list; @@ -375,6 +377,7 @@ struct _sas_device { u8 phy; u8 responding; u8 pfa_led_on; + u8 pend_sas_rphy_add; }; /** diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 4a0728a..b08d8fd 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -105,6 +105,11 @@ static int missing_delay[2] = {-1, -1}; module_param_array(missing_delay, int, NULL, 0); MODULE_PARM_DESC(missing_delay, device missing delay , io missing delay); +static int unblock_io; +module_param(unblock_io, int, 0); +MODULE_PARM_DESC(unblock_io, +unblocks I/O if set to 1 when device is undergoing addition (default=0)); + /* scsi-mid layer global parmeter is max_report_luns, which is 511 */ #define MPT2SAS_MAX_LUN (16895) static int max_lun = MPT2SAS_MAX_LUN; @@ -2972,6 +2977,34 @@ _scsih_ublock_io_device(struct MPT2SAS_ADAPTER *ioc, u64 sas_address) } /** + * _scsih_ublock_io_device_to_running - set the device state to SDEV_RUNNING + * @ioc: per adapter object + * @sas_addr: sas address + * + * unblock the device to receive IO during device addition. Device + * responsiveness is not checked before unblocking + */ +static void +_scsih_ublock_io_device_to_running(struct MPT2SAS_ADAPTER *ioc, u64 sas_address) +{ + struct MPT2SAS_DEVICE *sas_device_priv_data; + struct scsi_device *sdev; + + shost_for_each_device(sdev, ioc-shost) { + sas_device_priv_data = sdev-hostdata; + if (!sas_device_priv_data) + continue; + if (sas_device_priv_data-sas_target-sas_address + != sas_address) + continue; + if (sas_device_priv_data-block) { + sas_device_priv_data-block = 0; + scsi_internal_device_unblock(sdev, SDEV_RUNNING); + } + } +} + +/** * _scsih_block_io_all_device - set the device state to SDEV_BLOCK * @ioc: per adapter object * @handle: device handle @@ -3081,21 +3114,23 @@ _scsih_block_io_to_children_attached_to_ex(struct MPT2SAS_ADAPTER *ioc, } /** - * _scsih_block_io_to_children_attached_directly + * _scsih_handle_io_to_children_attached_directly * @ioc: per adapter object * @event_data: topology change event data * - * This routine set sdev state to SDEV_BLOCK for all devices - * direct attached during device pull. + * This routine set sdev state to SDEV_BLOCK or SDEV_RUNNING for all devices + * direct attached during device pull/reconnect. */ static void -_scsih_block_io_to_children_attached_directly(struct MPT2SAS_ADAPTER *ioc, -Mpi2EventDataSasTopologyChangeList_t *event_data) +_scsih_handle_io_to_children_attached_directly(struct MPT2SAS_ADAPTER *ioc, + Mpi2EventDataSasTopologyChangeList_t *event_data) { int i; u16 handle; u16 reason_code; u8 phy_number; + struct _sas_device *sas_device; + u8 link_rate, prev_link_rate; for (i = 0; i event_data-NumEntries;
[RESEND][PATCH 08/10][SCSI]mpt2sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state
The driver would send IOC facts only if HBA is in operational or ready state. If it is in fault state, a diagnostic reset would be issued. It would wait for 10 seconds to exit out of reset state. If the HBA continues to be in reset state, then the HBA wouldn't be claimed by the driver. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.c | 416 --- 1 files changed, 239 insertions(+), 177 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 81f1d58..697c841 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -1737,6 +1737,238 @@ _base_handshake_req_reply_wait(struct MPT2SAS_ADAPTER *ioc, int request_bytes, } /** + * mpt2sas_base_get_iocstate - Get the current state of a MPT adapter. + * @ioc: Pointer to MPT_ADAPTER structure + * @cooked: Request raw or cooked IOC state + * + * Returns all IOC Doorbell register bits if cooked==0, else just the + * Doorbell bits in MPI_IOC_STATE_MASK. + */ +u32 +mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked) +{ + u32 s, sc; + + s = readl(ioc-chip-Doorbell); + sc = s MPI2_IOC_STATE_MASK; + return cooked ? sc : s; +} + +/** + * _base_wait_on_iocstate - waiting on a particular ioc state + * @ioc_state: controller state { READY, OPERATIONAL, or RESET } + * @timeout: timeout in second + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + */ +static int +_base_wait_on_iocstate(struct MPT2SAS_ADAPTER *ioc, u32 ioc_state, int timeout, + int sleep_flag) +{ + u32 count, cntdn; + u32 current_state; + + count = 0; + cntdn = (sleep_flag == CAN_SLEEP) ? 1000*timeout : 2000*timeout; + do { + current_state = mpt2sas_base_get_iocstate(ioc, 1); + if (current_state == ioc_state) + return 0; + if (count current_state == MPI2_IOC_STATE_FAULT) + break; + if (sleep_flag == CAN_SLEEP) + msleep(1); + else + udelay(500); + count++; + } while (--cntdn); + + return current_state; +} + +/** + * _base_diag_reset - the big hammer start of day reset + * @ioc: per adapter object + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + */ +static int +_base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) +{ + u32 host_diagnostic; + u32 ioc_state; + u32 count; + u32 hcb_size; + + printk(MPT2SAS_INFO_FMT sending diag reset !!\n, ioc-name); + + drsprintk(ioc, printk(MPT2SAS_INFO_FMT clear interrupts\n, + ioc-name)); + + count = 0; + do { + /* Write magic sequence to WriteSequence register +* Loop until in diagnostic mode +*/ + drsprintk(ioc, printk(MPT2SAS_INFO_FMT write magic sequence\n + , ioc-name)); + writel(MPI2_WRSEQ_FLUSH_KEY_VALUE, ioc-chip-WriteSequence); + writel(MPI2_WRSEQ_1ST_KEY_VALUE, ioc-chip-WriteSequence); + writel(MPI2_WRSEQ_2ND_KEY_VALUE, ioc-chip-WriteSequence); + writel(MPI2_WRSEQ_3RD_KEY_VALUE, ioc-chip-WriteSequence); + writel(MPI2_WRSEQ_4TH_KEY_VALUE, ioc-chip-WriteSequence); + writel(MPI2_WRSEQ_5TH_KEY_VALUE, ioc-chip-WriteSequence); + writel(MPI2_WRSEQ_6TH_KEY_VALUE, ioc-chip-WriteSequence); + + /* wait 100 msec */ + if (sleep_flag == CAN_SLEEP) + msleep(100); + else + mdelay(100); + + if (count++ 20) + goto out; + + host_diagnostic = readl(ioc-chip-HostDiagnostic); + drsprintk(ioc, printk(MPT2SAS_INFO_FMT + wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n, + ioc-name, count, host_diagnostic)); + + } while ((host_diagnostic MPI2_DIAG_DIAG_WRITE_ENABLE) == 0); + + hcb_size = readl(ioc-chip-HCBSize); + + drsprintk(ioc, printk(MPT2SAS_INFO_FMT diag reset: issued\n, + ioc-name)); + writel(host_diagnostic | MPI2_DIAG_RESET_ADAPTER, +ioc-chip-HostDiagnostic); + + /*This delay allows the chip PCIe hardware time to finish reset tasks*/ + if (sleep_flag == CAN_SLEEP) + msleep(MPI2_HARD_RESET_PCIE_FIRST_READ_DELAY_MICRO_SEC/1000); + else + mdelay(MPI2_HARD_RESET_PCIE_FIRST_READ_DELAY_MICRO_SEC/1000); + + /* Approximately 300 second max wait */ + for (count = 0; count (3 / + MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC); count++) { + + host_diagnostic = readl(ioc-chip-HostDiagnostic); + + if
[RESEND][PATCH 10/10][SCSI]mpt2sas: Bump mpt2sas driver version to 18.100.00.00
Bump mpt2sas driver version to 18.100.00.00. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 6dbbaba..cc49cbf 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -69,8 +69,8 @@ #define MPT2SAS_DRIVER_NAMEmpt2sas #define MPT2SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com #define MPT2SAS_DESCRIPTIONLSI MPT Fusion SAS 2.0 Device Driver -#define MPT2SAS_DRIVER_VERSION 17.100.00.00 -#define MPT2SAS_MAJOR_VERSION 17 +#define MPT2SAS_DRIVER_VERSION 18.100.00.00 +#define MPT2SAS_MAJOR_VERSION 18 #define MPT2SAS_MINOR_VERSION 100 #define MPT2SAS_BUILD_VERSION 00 #define MPT2SAS_RELEASE_VERSION00 -- 1.7.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][SCSI]mpt3sas: Description Patch
Just resending below set of patches which I have sent on 14th March 2014. And I have removed below subjected patch since we have already have the module parameter port_mask to disable EEDP support. [PATCH 1/9][SCSI]mpt3sas: Added new driver module Parameter disable_eedp to Disable EEDP Support. Please consider this patch set for next kernel release. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- [RESEND][PATCH 1/8][SCSI]mpt3sas: MPI2.5 Rev G (2.5.2) specifications. [RESEND][PATCH 2/8][SCSI]mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced. [RESEND][PATCH 3/8][SCSI]mpt3sas: Bump mpt3sas driver version to 03.100.00.00. [RESEND][PATCH 4/8][SCSI]mpt3sas: MPI2.5 Rev H (2.5.3) specifications. [RESEND][PATCH 5/8][SCSI]mpt3sas: Copyright in driver sources is updated for year the 2014. [RESEND][PATCH 6/8][SCSI]mpt3sas: Added OEM branding Strings. [RESEND][PATCH 7/8][SCSI]mpt3sas: Added Reply Descriptor Post Queue (RDPQ) Array support. [RESEND][PATCH 8/8][SCSI]mpt3sas: Bump mpt3sas driver version to 04.100.00.00. -- 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
[RESEND][PATCH 1/8][SCSI]mpt3sas: MPI2.5 Rev G (2.5.2) specifications
Below is the change set in MPI2.5 Rev G specification and 2.00.31 header files 1) Added SCSIStatusQualifier to SCSI IO Error Reply message. 2) Added ATA Security Freeze Lock to IO Unit Page 1 Flags field. 3) Added Allow Protection Information bit for IR Volume Create. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpi/mpi2.h |6 -- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h |8 ++-- drivers/scsi/mpt3sas/mpi/mpi2_init.h |6 -- drivers/scsi/mpt3sas/mpi/mpi2_raid.h |6 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index 20da8f9..dc143dd 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -8,7 +8,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.29 + * mpi2.h Version: 02.00.31 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -86,6 +86,8 @@ * 11-27-12 02.00.28 Bumped MPI2_HEADER_VERSION_UNIT. * 12-20-12 02.00.29 Bumped MPI2_HEADER_VERSION_UNIT. * Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET. + * 04-09-13 02.00.30 Bumped MPI2_HEADER_VERSION_UNIT. + * 04-17-13 02.00.31 Bumped MPI2_HEADER_VERSION_UNIT. * -- */ @@ -119,7 +121,7 @@ #define MPI2_VERSION_02_05 (0x0205) /*Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x1D) +#define MPI2_HEADER_VERSION_UNIT(0x1F) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 889aa70..5b0e5c1 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -6,7 +6,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.24 + * mpi2_cnfg.h Version: 02.00.25 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -160,6 +160,9 @@ * 12-20-12 02.00.24 Marked MPI2_SASIOUNIT1_CONTROL_CLEAR_AFFILIATION as * obsolete for MPI v2.5 and later. * Added some defines for 12G SAS speeds. + * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. + * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to + * match the specification. * -- */ @@ -792,6 +795,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1 { #define MPI2_IOUNITPAGE1_PAGEVERSION(0x04) /*IO Unit Page 1 Flags defines */ +#define MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK (0x4000) #define MPI25_IOUNITPAGE1_NEW_DEVICE_FAST_PATH_DISABLE (0x2000) #define MPI25_IOUNITPAGE1_DISABLE_FAST_PATH (0x1000) #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY(0x0800) @@ -870,7 +874,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_5 { #define MPI2_IOUNITPAGE5_PAGEVERSION(0x00) /*defines for IO Unit Page 5 DmaEngineCapabilities field */ -#define MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS (0xFF00) +#define MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS (0x) #define MPI2_IOUNITPAGE5_DMA_CAP_SHIFT_MAX_REQUESTS (16) #define MPI2_IOUNITPAGE5_DMA_CAP_EEDP (0x0008) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_init.h b/drivers/scsi/mpt3sas/mpi/mpi2_init.h index f7928bf..b3e3331 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_init.h @@ -6,7 +6,7 @@ * Title: MPI SCSI initiator mode messages and structures * Creation Date: June 23, 2006 * - * mpi2_init.h Version: 02.00.14 + * mpi2_init.h Version: 02.00.15 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -44,6 +44,8 @@ * Priority to match SAM-4. * Added EEDPErrorOffset to MPI2_SCSI_IO_REPLY. * 07-10-12 02.00.14 Added MPI2_SCSIIO_CONTROL_SHIFT_DATADIRECTION. + * 04-09-13 02.00.15 Added SCSIStatusQualifier field to MPI2_SCSI_IO_REPLY, + * replacing the Reserved4 field. * -- */ @@ -347,7 +349,7 @@ typedef struct _MPI2_SCSI_IO_REPLY { U32 SenseCount; /*0x18 */ U32 ResponseInfo; /*0x1C */ U16 TaskTag;
[RESEND][PATCH 2/8][SCSI]mpt3sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced
Added code to send an SEP message that turns off the Predictive Failure LED when a drive is removed (if Predictive Failure LED was turned on). Added a new flag 'pfa_led_on' per device that tracks the status of Predictive Failure LED. When the drive is removed, this flag is checked and sends an SEP message to turn off the respective Predictive Failure LED. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpt3sas_base.h |5 ++- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 67 +- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index b1494ce..3007521 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -272,8 +272,10 @@ struct _internal_cmd { * @channel: target channel * @slot: number number * @phy: phy identifier provided in sas device page 0 - * @fast_path: fast path feature enable bit * @responding: used in _scsih_sas_device_mark_responding + * @fast_path: fast path feature enable bit + * @pfa_led_on: flag for PFA LED status + * */ struct _sas_device { struct list_head list; @@ -293,6 +295,7 @@ struct _sas_device { u8 phy; u8 responding; u8 fast_path; + u8 pfa_led_on; }; /** diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 1056cbf..905c82c 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -162,7 +162,7 @@ struct sense_info { }; #define MPT3SAS_PROCESS_TRIGGER_DIAG (0xFFFB) -#define MPT3SAS_TURN_ON_FAULT_LED (0xFFFC) +#define MPT3SAS_TURN_ON_PFA_LED (0xFFFC) #define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD) #define MPT3SAS_ABRT_TASK_SET (0xFFFE) #define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0x) @@ -3903,7 +3903,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, #endif /** - * _scsih_turn_on_fault_led - illuminate Fault LED + * _scsih_turn_on_pfa_led - illuminate PFA LED * @ioc: per adapter object * @handle: device handle * Context: process @@ -3911,10 +3911,15 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, * Return nothing. */ static void -_scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) +_scsih_turn_on_pfa_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) { Mpi2SepReply_t mpi_reply; Mpi2SepRequest_t mpi_request; + struct _sas_device *sas_device; + + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); + if (!sas_device) + return; memset(mpi_request, 0, sizeof(Mpi2SepRequest_t)); mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; @@ -3929,6 +3934,7 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) __FILE__, __LINE__, __func__); return; } + sas_device-pfa_led_on = 1; if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { dewtprintk(ioc, pr_info(MPT3SAS_FMT @@ -3938,9 +3944,46 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER *ioc, u16 handle) return; } } +/** + * _scsih_turn_off_pfa_led - turn off Fault LED + * @ioc: per adapter object + * @sas_device: sas device whose PFA LED has to turned off + * Context: process + * + * Return nothing. + */ +static void +_scsih_turn_off_pfa_led(struct MPT3SAS_ADAPTER *ioc, + struct _sas_device *sas_device) +{ + Mpi2SepReply_t mpi_reply; + Mpi2SepRequest_t mpi_request; + memset(mpi_request, 0, sizeof(Mpi2SepRequest_t)); + mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; + mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; + mpi_request.SlotStatus = 0; + mpi_request.Slot = cpu_to_le16(sas_device-slot); + mpi_request.DevHandle = 0; + mpi_request.EnclosureHandle = cpu_to_le16(sas_device-enclosure_handle); + mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; + if ((mpt3sas_base_scsi_enclosure_processor(ioc, mpi_reply, + mpi_request)) != 0) { + printk(MPT3SAS_FMT failure at %s:%d/%s()!\n, ioc-name, + __FILE__, __LINE__, __func__); + return; + } + + if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { + dewtprintk(ioc, printk(MPT3SAS_FMT +enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n, +ioc-name, le16_to_cpu(mpi_reply.IOCStatus), +le32_to_cpu(mpi_reply.IOCLogInfo))); + return; + } +} /** - * _scsih_send_event_to_turn_on_fault_led - fire delayed event + * _scsih_send_event_to_turn_on_pfa_led - fire delayed event * @ioc: per adapter object * @handle: device handle * Context: interrupt. @@ -3948,14 +3991,14 @@ _scsih_turn_on_fault_led(struct MPT3SAS_ADAPTER
[RESEND][PATCH 4/8][SCSI]mpt3sas: MPI2.5 Rev H (2.5.3) specifications
Below is the change set in MPI2.5 Rev H specification and 2.00.32 header files 1) Added reserved fields to IO Unit Page 7 for future use. 2) Added optional functionality to IOCInit Request so that the host may specify a separate base address for each Reply Descriptor Post Queue. IOC support for this is indicated using a new IOCCapabilities bit in the IOCFacts Reply. 3) Added Toolbox Console Text Display Tool The host uses the Console Text Display Tool to send a string to IOC's Console using different console types (eg: UART serial terminal or Ethernet terminal). 4) Firmware images can now be signed using an encrypted hash. 5) Added MPI2_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL 6) Added more details about configuration page restrictions when Host Based Discovery is enabled Enabling host based discovery affects the availability of some configuration pages and events. The SAS Expander, SAS Device, and SAS Enclosure configuration pages are not available from the IOC. The IOC returns an error status to any Configuration Request message attempting to access these pages. The IOC does not send the SAS Discovery Event, the SAS Topology Change List Event, or the SAS Enclosure Device Status Change Event when host based discovery is enabled. 7) Bit 13 of the SAS IO Unit Page 1 ControlFlags field is now obsolete. It was used to enable limiting direct attached SATA maximum link rate to 1.5 Gbps. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 10 - drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 62 - drivers/scsi/mpt3sas/mpi/mpi2_sas.h |6 ++- drivers/scsi/mpt3sas/mpi/mpi2_tool.h | 43 +++- 4 files changed, 114 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index 5b0e5c1..becee07 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -6,7 +6,7 @@ * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.25 + * mpi2_cnfg.h Version: 02.00.26 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -163,6 +163,8 @@ * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to * match the specification. + * 08-19-13 02.00.26 Added reserved words to MPI2_CONFIG_PAGE_IO_UNIT_7 for + * future use. * -- */ @@ -924,11 +926,15 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_7 { U8 BoardTemperatureUnits; /*0x16 */ U8 Reserved3; /*0x17 */ + U32 Reserved4; /* 0x18 */ + U32 Reserved5; /* 0x1C */ + U32 Reserved6; /* 0x20 */ + U32 Reserved7; /* 0x24 */ } MPI2_CONFIG_PAGE_IO_UNIT_7, *PTR_MPI2_CONFIG_PAGE_IO_UNIT_7, Mpi2IOUnitPage7_t, *pMpi2IOUnitPage7_t; -#define MPI2_IOUNITPAGE7_PAGEVERSION(0x02) +#define MPI2_IOUNITPAGE7_PAGEVERSION (0x04) /*defines for IO Unit Page 7 CurrentPowerMode and PreviousPowerMode fields */ #define MPI25_IOUNITPAGE7_PM_INIT_MASK (0xC0) diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h index e2bb821..15813f3 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h @@ -6,7 +6,7 @@ * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: October 11, 2006 * - * mpi2_ioc.h Version: 02.00.22 + * mpi2_ioc.h Version: 02.00.23 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -127,6 +127,11 @@ * 07-26-12 02.00.22 Added MPI2_IOCFACTS_EXCEPT_PARTIAL_MEMORY_FAILURE. * Added ElapsedSeconds field to * MPI2_EVENT_DATA_IR_OPERATION_STATUS. + * 08-19-13 02.00.23 For IOCInit, added MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE + * and MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY. + * Added MPI2_IOCFACTS_CAPABILITY_RDPQ_ARRAY_CAPABLE. + * Added MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY. + * Added Encrypted Hash Extended Image. * -- */ @@ -182,6 +187,10 @@ typedef struct _MPI2_IOC_INIT_REQUEST { #define MPI2_WHOINIT_HOST_DRIVER(0x04) #define MPI2_WHOINIT_MANUFACTURER
[RESEND][PATCH 6/8][SCSI]mpt3sas: Added OEM branding Strings
Added following branding Strings for Intel custom HBAs support. Driver String: Vendor ID Device ID SubSystemVendor ID SubSystemDevice ID Intel(R) Integrated RAID Module RMS3JC080 0x1000 0x0097 0x8086 0x3521 Intel(R) RAID Controller RS3GC008 0x1000 0x0097 0x8086 0x3522 Intel(R) RAID Controller RS3FC044 0x1000 0x0097 0x8086 0x3523 Intel(R) RAID Controller RS3UC080 0x1000 0x0097 0x8086 0x3524 Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpt3sas_base.c | 49 +++ drivers/scsi/mpt3sas/mpt3sas_base.h | 18 + 2 files changed, 67 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 8c77cd4..f1406cc 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -2219,6 +2219,53 @@ mpt3sas_base_put_smid_default(struct MPT3SAS_ADAPTER *ioc, u16 smid) ioc-scsi_lookup_lock); } +/** + * _base_display_intel_branding - Display branding string + * @ioc: per adapter object + * + * Return nothing. + */ +static void +_base_display_intel_branding(struct MPT3SAS_ADAPTER *ioc) +{ + if (ioc-pdev-subsystem_vendor != PCI_VENDOR_ID_INTEL) + return; + + switch (ioc-pdev-device) { + case MPI25_MFGPAGE_DEVID_SAS3008: + switch (ioc-pdev-subsystem_device) { + case MPT3SAS_INTEL_RMS3JC080_SSDID: + pr_info(MPT3SAS_FMT %s\n, ioc-name, + MPT3SAS_INTEL_RMS3JC080_BRANDING); + break; + + case MPT3SAS_INTEL_RS3GC008_SSDID: + pr_info(MPT3SAS_FMT %s\n, ioc-name, + MPT3SAS_INTEL_RS3GC008_BRANDING); + break; + case MPT3SAS_INTEL_RS3FC044_SSDID: + pr_info(MPT3SAS_FMT %s\n, ioc-name, + MPT3SAS_INTEL_RS3FC044_BRANDING); + break; + case MPT3SAS_INTEL_RS3UC080_SSDID: + pr_info(MPT3SAS_FMT %s\n, ioc-name, + MPT3SAS_INTEL_RS3UC080_BRANDING); + break; + default: + pr_info(MPT3SAS_FMT + Intel(R) Controller: Subsystem ID: 0x%X\n, + ioc-name, ioc-pdev-subsystem_device); + break; + } + break; + default: + pr_info(MPT3SAS_FMT + Intel(R) Controller: Subsystem ID: 0x%X\n, + ioc-name, ioc-pdev-subsystem_device); + break; + } +} + /** @@ -2250,6 +2297,8 @@ _base_display_ioc_capabilities(struct MPT3SAS_ADAPTER *ioc) (bios_version 0xFF00) 8, bios_version 0x00FF); + _base_display_intel_branding(ioc); + pr_info(MPT3SAS_FMT Protocol=(, ioc-name); if (ioc-facts.ProtocolFlags MPI2_IOCFACTS_PROTOCOL_SCSI_INITIATOR) { diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index f163423..f61765c 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -130,7 +130,25 @@ #define MPT_TARGET_FLAGS_DELETED 0x04 #define MPT_TARGET_FASTPATH_IO 0x08 +/* + * Intel HBA branding + */ +#define MPT3SAS_INTEL_RMS3JC080_BRANDING \ + Intel(R) Integrated RAID Module RMS3JC080 +#define MPT3SAS_INTEL_RS3GC008_BRANDING \ + Intel(R) RAID Controller RS3GC008 +#define MPT3SAS_INTEL_RS3FC044_BRANDING \ + Intel(R) RAID Controller RS3FC044 +#define MPT3SAS_INTEL_RS3UC080_BRANDING \ + Intel(R) RAID Controller RS3UC080 +/* + * Intel HBA SSDIDs + */ +#define MPT3SAS_INTEL_RMS3JC080_SSDID 0x3521 +#define MPT3SAS_INTEL_RS3GC008_SSDID 0x3522 +#define MPT3SAS_INTEL_RS3FC044_SSDID 0x3523 +#define MPT3SAS_INTEL_RS3UC080_SSDID0x3524 /* * status bits for ioc-diag_buffer_status -- 1.7.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
[RESEND][PATCH 5/8][SCSI]mpt3sas: Copyright in driver sources is updated for year the 2014
Copyright in driver sources is updated for year the 2014. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/Kconfig|2 +- drivers/scsi/mpt3sas/mpi/mpi2.h |2 +- drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h|2 +- drivers/scsi/mpt3sas/mpi/mpi2_init.h|2 +- drivers/scsi/mpt3sas/mpi/mpi2_ioc.h |2 +- drivers/scsi/mpt3sas/mpi/mpi2_raid.h|2 +- drivers/scsi/mpt3sas/mpi/mpi2_sas.h |2 +- drivers/scsi/mpt3sas/mpi/mpi2_tool.h|2 +- drivers/scsi/mpt3sas/mpi/mpi2_type.h|2 +- drivers/scsi/mpt3sas/mpt3sas_base.c |2 +- drivers/scsi/mpt3sas/mpt3sas_base.h |2 +- drivers/scsi/mpt3sas/mpt3sas_config.c |2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.c |2 +- drivers/scsi/mpt3sas/mpt3sas_ctl.h |2 +- drivers/scsi/mpt3sas/mpt3sas_debug.h|2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c|2 +- drivers/scsi/mpt3sas/mpt3sas_transport.c|2 +- drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c |2 +- drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h |2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig index d53e1b0..4d235dd 100644 --- a/drivers/scsi/mpt3sas/Kconfig +++ b/drivers/scsi/mpt3sas/Kconfig @@ -2,7 +2,7 @@ # Kernel configuration file for the MPT3SAS # # This code is based on drivers/scsi/mpt3sas/Kconfig -# Copyright (C) 2012-2013 LSI Corporation +# Copyright (C) 2012-2014 LSI Corporation # (mailto:dl-mptfusionli...@lsi.com) # This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h index dc143dd..c34c115 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h index becee07..e261a31 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_cnfg.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_init.h b/drivers/scsi/mpt3sas/mpi/mpi2_init.h index b3e3331..068c98e 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_init.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_init.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h index 15813f3..4908309 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_ioc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_ioc.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h index fbe3aae..13d93ca 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_raid.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_sas.h b/drivers/scsi/mpt3sas/mpi/mpi2_sas.h index 361a275..156e305 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_sas.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_sas.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_sas.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_tool.h b/drivers/scsi/mpt3sas/mpi/mpi2_tool.h index 94e32c2..904910d 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_tool.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_tool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_tool.h diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_type.h b/drivers/scsi/mpt3sas/mpi/mpi2_type.h index ba1fed5..99ab093 100644 --- a/drivers/scsi/mpt3sas/mpi/mpi2_type.h +++ b/drivers/scsi/mpt3sas/mpi/mpi2_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_type.h diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index d46956e..8c77cd4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -3,7 +3,7 @@ * for access to MPT (Message Passing Technology) firmware. * * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.c - * Copyright (C) 2012-2013 LSI Corporation + * Copyright (C) 2012-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com)
[RESEND][PATCH 3/8][SCSI]mpt3sas: Bump mpt3sas driver version to 03.100.00.00
Bump mpt3sas driver version to 03.100.00.00. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpt3sas_base.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 3007521..0f7add9 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -70,8 +70,8 @@ #define MPT3SAS_DRIVER_NAMEmpt3sas #define MPT3SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com #define MPT3SAS_DESCRIPTIONLSI MPT Fusion SAS 3.0 Device Driver -#define MPT3SAS_DRIVER_VERSION 02.100.00.00 -#define MPT3SAS_MAJOR_VERSION 2 +#define MPT3SAS_DRIVER_VERSION 03.100.00.00 +#define MPT3SAS_MAJOR_VERSION 3 #define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_RELEASE_VERSION00 -- 1.7.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
[RESEND][PATCH 8/8][SCSI]mpt3sas: Bump mpt3sas driver version to 04.100.00.00
Bump mpt3sas driver version to 04.100.00.00. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpt3sas_base.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 8fb2a38..09545fc 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -70,8 +70,8 @@ #define MPT3SAS_DRIVER_NAMEmpt3sas #define MPT3SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com #define MPT3SAS_DESCRIPTIONLSI MPT Fusion SAS 3.0 Device Driver -#define MPT3SAS_DRIVER_VERSION 03.100.00.00 -#define MPT3SAS_MAJOR_VERSION 3 +#define MPT3SAS_DRIVER_VERSION 04.100.00.00 +#define MPT3SAS_MAJOR_VERSION 4 #define MPT3SAS_MINOR_VERSION 100 #define MPT3SAS_BUILD_VERSION 0 #define MPT3SAS_RELEASE_VERSION00 -- 1.7.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
[RESEND][PATCH 7/8][SCSI]mpt3sas: Added Reply Descriptor Post Queue (RDPQ) Array support
Up to now, Driver allocates a single contiguous block of memory pool for all reply queues and passes down a single address in the ReplyDescriptorPostQueueAddress field of the IOC Init Request Message to the firmware. When firmware receives this address, it will program each of the Reply Descriptor Post Queue registers, as each reply queue has its own register. Thus the firmware, starting from a base address it determines the starting address of the subsequent reply queues through some simple arithmetic calculations. The size of this contiguous block of memory pool is directly proportional to number of MSI-X vectors and the HBA queue depth. For example higher MSIX vectors requires larger contiguous block of memory pool. But some of the OS kernels are unable to allocate this larger contiguous block of memory pool. So, the proposal is to allocate memory independently for each Reply Queue and pass down all of the addresses to the firmware. Then the firmware will just take each address and program the value into the correct register. When HBAs with older firmware(i.e. without RDPQ capability) is used with this new driver then the max_msix_vectors value would be set to 8 by default. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpt3sas_base.c | 916 --- drivers/scsi/mpt3sas/mpt3sas_base.h | 19 +- 2 files changed, 543 insertions(+), 392 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index f1406cc..483785b 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -82,10 +82,10 @@ static int msix_disable = -1; module_param(msix_disable, int, 0); MODULE_PARM_DESC(msix_disable, disable msix routed interrupts (default=0)); -static int max_msix_vectors = 8; +static int max_msix_vectors = -1; module_param(max_msix_vectors, int, 0); MODULE_PARM_DESC(max_msix_vectors, -max msix vectors - (default=8)); +max msix vectors); static int mpt3sas_fwfault_debug; MODULE_PARM_DESC(mpt3sas_fwfault_debug, @@ -1728,6 +1728,9 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) ioc-reply_queue_count = min_t(int, ioc-cpu_count, ioc-msix_vector_count); + if (!ioc-rdpq_array_enable max_msix_vectors == -1) + max_msix_vectors = 8; + printk(MPT3SAS_FMT MSI-X vectors supported: %d, no of cores : %d, max_msix_vectors: %d\n, ioc-name, ioc-msix_vector_count, ioc-cpu_count, max_msix_vectors); @@ -1782,6 +1785,334 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) } /** + * _base_wait_for_doorbell_int - waiting for controller interrupt(generated by + * a write to the doorbell) + * @ioc: per adapter object + * @timeout: timeout in second + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + * + * Notes: MPI2_HIS_IOC2SYS_DB_STATUS - set to one when IOC writes to doorbell. + */ +static int +_base_wait_for_doorbell_int(struct MPT3SAS_ADAPTER *ioc, int timeout, + int sleep_flag) +{ + u32 cntdn, count; + u32 int_status; + + count = 0; + cntdn = (sleep_flag == CAN_SLEEP) ? 1000*timeout : 2000*timeout; + do { + int_status = readl(ioc-chip-HostInterruptStatus); + if (int_status MPI2_HIS_IOC2SYS_DB_STATUS) { + dhsprintk(ioc, pr_info(MPT3SAS_FMT + %s: successfull count(%d), timeout(%d)\n, + ioc-name, __func__, count, timeout)); + return 0; + } + if (sleep_flag == CAN_SLEEP) + msleep(1); + else + udelay(500); + count++; + } while (--cntdn); + + pr_err(MPT3SAS_FMT + %s: failed due to timeout count(%d), int_status(%x)!\n, + ioc-name, __func__, count, int_status); + return -EFAULT; +} + +/** + * _base_wait_for_doorbell_ack - waiting for controller to read the doorbell. + * @ioc: per adapter object + * @timeout: timeout in second + * @sleep_flag: CAN_SLEEP or NO_SLEEP + * + * Returns 0 for success, non-zero for failure. + * + * Notes: MPI2_HIS_SYS2IOC_DB_STATUS - set to one when host writes to + * doorbell. + */ +static int +_base_wait_for_doorbell_ack(struct MPT3SAS_ADAPTER *ioc, int timeout, + int sleep_flag) +{ + u32 cntdn, count; + u32 int_status; + u32 doorbell; + + count = 0; + cntdn = (sleep_flag == CAN_SLEEP) ? 1000*timeout : 2000*timeout; + do { + int_status = readl(ioc-chip-HostInterruptStatus); + if (!(int_status MPI2_HIS_SYS2IOC_DB_STATUS)) { + dhsprintk(ioc, pr_info(MPT3SAS_FMT + %s: successfull count(%d), timeout(%d)\n, + ioc-name, __func__, count, timeout)); + return 0; +
[RESEND][PATCH 03/10][SCSI]mpt2sas: Copyright in driver sources is updated for year the 2014
Copyright in driver sources is updated for year the 2014. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/Kconfig |2 +- drivers/scsi/mpt2sas/mpt2sas_base.c |2 +- drivers/scsi/mpt2sas/mpt2sas_base.h |2 +- drivers/scsi/mpt2sas/mpt2sas_config.c|2 +- drivers/scsi/mpt2sas/mpt2sas_ctl.c |2 +- drivers/scsi/mpt2sas/mpt2sas_ctl.h |2 +- drivers/scsi/mpt2sas/mpt2sas_debug.h |2 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c |2 +- drivers/scsi/mpt2sas/mpt2sas_transport.c |2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/mpt2sas/Kconfig b/drivers/scsi/mpt2sas/Kconfig index 39f08dd..657b45c 100644 --- a/drivers/scsi/mpt2sas/Kconfig +++ b/drivers/scsi/mpt2sas/Kconfig @@ -2,7 +2,7 @@ # Kernel configuration file for the MPT2SAS # # This code is based on drivers/scsi/mpt2sas/Kconfig -# Copyright (C) 2007-2012 LSI Corporation +# Copyright (C) 2007-2014 LSI Corporation # (mailto:dl-mptfusionli...@lsi.com) # This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 7355b28..774720f 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -3,7 +3,7 @@ * for access to MPT (Message Passing Technology) firmware. * * This code is based on drivers/scsi/mpt2sas/mpt2_base.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 61b02ee..863a248 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -3,7 +3,7 @@ * for access to MPT (Message Passing Technology) firmware. * * This code is based on drivers/scsi/mpt2sas/mpt2_base.h - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c index 0c47425..c72a2ff 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_config.c +++ b/drivers/scsi/mpt2sas/mpt2sas_config.c @@ -2,7 +2,7 @@ * This module provides common API for accessing firmware configuration pages * * This code is based on drivers/scsi/mpt2sas/mpt2_base.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index b7f887c..5221c4b 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c @@ -3,7 +3,7 @@ * controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.h b/drivers/scsi/mpt2sas/mpt2sas_ctl.h index 8b2ac18..fa0567c 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.h +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.h @@ -3,7 +3,7 @@ * controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.h - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_debug.h b/drivers/scsi/mpt2sas/mpt2sas_debug.h index a9021cb..cc57ef3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_debug.h +++ b/drivers/scsi/mpt2sas/mpt2sas_debug.h @@ -2,7 +2,7 @@ * Logging Support for MPT (Message Passing Technology) based controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_debug.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index d502728..5ee6bf0 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -2,7 +2,7 @@ * Scsi Host Layer for MPT (Message Passing Technology) based controllers * * This code is based on drivers/scsi/mpt2sas/mpt2_scsih.c - * Copyright (C) 2007-2013 LSI Corporation + * Copyright (C) 2007-2014 LSI Corporation * (mailto:dl-mptfusionli...@lsi.com) * * This program is free software; you can redistribute it and/or diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index
[RESEND][PATCH 02/10][SCSI]mpt2sas: MPI2 Rev Y (2.00.17) and Rev Z (2.00.18) specifications
Below is the change set in MPI2 Rev Y specification and in 2.00.17 header files 1) Added SCSIStatusQualifier to SCSI IO Error Reply message. 2) Added ATA Security Freeze Lock to IO Unit Page 1 Flags field. Below is the change set in MPI2 Rev Z specification and in 2.00.19 header files 1) Added reserved fields to IO Unit Page 7 for future use. 2) Added optional functionality to IOCInit Request so that the host may specify a separate base address for each Reply Descriptor Post Queue. IOC support for this is indicated using a new IOCCapabilities bit in the IOCFacts Reply. 3) Added Toolbox Console Text Display Tool The host uses the Console Text Display Tool to send a string to IOC's Console using different console types (eg: UART serial terminal or Ethernet terminal). The copyright in the mpi files is updated for year 2014 Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpi/mpi2.h | 12 - drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h | 29 ++ drivers/scsi/mpt2sas/mpi/mpi2_init.h |8 ++- drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | 74 +- drivers/scsi/mpt2sas/mpi/mpi2_raid.h |8 +++- drivers/scsi/mpt2sas/mpi/mpi2_sas.h |2 +- drivers/scsi/mpt2sas/mpi/mpi2_tool.h | 44 +++- drivers/scsi/mpt2sas/mpi/mpi2_type.h |2 +- 8 files changed, 148 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpi/mpi2.h b/drivers/scsi/mpt2sas/mpi/mpi2.h index 7b14a01..088eefa 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2.h @@ -8,7 +8,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.28 + * mpi2.h Version: 02.00.32 * * Version History * --- @@ -78,6 +78,11 @@ * 07-10-12 02.00.26 Bumped MPI2_HEADER_VERSION_UNIT. * 07-26-12 02.00.27 Bumped MPI2_HEADER_VERSION_UNIT. * 11-27-12 02.00.28 Bumped MPI2_HEADER_VERSION_UNIT. + * 12-20-12 02.00.29 Bumped MPI2_HEADER_VERSION_UNIT. + * Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET. + * 04-09-13 02.00.30 Bumped MPI2_HEADER_VERSION_UNIT. + * 04-17-13 02.00.31 Bumped MPI2_HEADER_VERSION_UNIT. + * 08-19-13 02.00.32 Bumped MPI2_HEADER_VERSION_UNIT. * -- */ @@ -103,7 +108,7 @@ #define MPI2_VERSION_02_00 (0x0200) /* versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT(0x1C) +#define MPI2_HEADER_VERSION_UNIT(0x20) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -263,6 +268,7 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS #define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FF) #define MPI2_RPHI_MSIX_INDEX_MASK (0xFF00) #define MPI2_RPHI_MSIX_INDEX_SHIFT (24) +#define MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x030C) /* MPI v2.5 only */ /* * Defines for the HCBSize and address diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h index 88cb7f8..510ef0d 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2000-2013 LSI Corporation. + * Copyright (c) 2000-2014 LSI Corporation. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - *mpi2_cnfg.h Version: 02.00.23 + *mpi2_cnfg.h Version: 02.00.26 * * Version History * --- @@ -150,7 +150,13 @@ * Added UEFIVersion field to BIOS Page 1 and defined new * BiosOptions bits. * 11-27-12 02.00.23 Added MPI2_MANPAGE7_FLAG_EVENTREPLAY_SLOT_ORDER. - * Added MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID. + * Added MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID. + * 12-20-12 02.00.24 Marked MPI2_SASIOUNIT1_CONTROL_CLEAR_AFFILIATION as + * obsolete for MPI v2.5 and later. + * Added some defines for 12G SAS speeds. + * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. + * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to + * match the specification. * -- */ @@ -773,6 +779,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1 #define MPI2_IOUNITPAGE1_PAGEVERSION(0x04) /* IO Unit Page 1 Flags defines */ +#define MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK (0x4000) #define
[RESEND][PATCH 04/10][SCSI]mpt2sas: Clear PFA Status on SGPIO when PFA Drive is Removed or Replaced
Added code to send a SEP message that turns off the Predictive Failure LED when a drive is removed (if Predictive Failure LED was turned on). Added a new flag 'pfa_led_on' per device that tracks the status of Predictive Failure LED. When the drive is removed, this flag is checked and sends the SEP message to turn off the respective Predictive Failure LED. Signed-off-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.h |2 + drivers/scsi/mpt2sas/mpt2sas_scsih.c | 70 + 2 files changed, 63 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 863a248..80d26c1 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -355,6 +355,7 @@ struct _internal_cmd { * @slot: number number * @phy: phy identifier provided in sas device page 0 * @responding: used in _scsih_sas_device_mark_responding + * @pfa_led_on: flag for PFA LED status */ struct _sas_device { struct list_head list; @@ -373,6 +374,7 @@ struct _sas_device { u16 slot; u8 phy; u8 responding; + u8 pfa_led_on; }; /** diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 5ee6bf0..6ae109b 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -150,7 +150,7 @@ struct sense_info { }; -#define MPT2SAS_TURN_ON_FAULT_LED (0xFFFC) +#define MPT2SAS_TURN_ON_PFA_LED (0xFFFC) #define MPT2SAS_PORT_ENABLE_COMPLETE (0xFFFD) #define MPT2SAS_REMOVE_UNRESPONDING_DEVICES (0x) /** @@ -4325,7 +4325,7 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, #endif /** - * _scsih_turn_on_fault_led - illuminate Fault LED + * _scsih_turn_on_pfa_led - illuminate PFA LED * @ioc: per adapter object * @handle: device handle * Context: process @@ -4333,10 +4333,15 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, * Return nothing. */ static void -_scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) +_scsih_turn_on_pfa_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) { Mpi2SepReply_t mpi_reply; Mpi2SepRequest_t mpi_request; + struct _sas_device *sas_device; + + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); + if (!sas_device) + return; memset(mpi_request, 0, sizeof(Mpi2SepRequest_t)); mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; @@ -4351,6 +4356,47 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) __FILE__, __LINE__, __func__); return; } + sas_device-pfa_led_on = 1; + + + if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { + dewtprintk(ioc, printk(MPT2SAS_INFO_FMT +enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n, +ioc-name, le16_to_cpu(mpi_reply.IOCStatus), +le32_to_cpu(mpi_reply.IOCLogInfo))); + return; + } +} + +/** + * _scsih_turn_off_pfa_led - turn off PFA LED + * @ioc: per adapter object + * @sas_device: sas device whose PFA LED has to turned off + * Context: process + * + * Return nothing. + */ +static void +_scsih_turn_off_pfa_led(struct MPT2SAS_ADAPTER *ioc, + struct _sas_device *sas_device) +{ + Mpi2SepReply_t mpi_reply; + Mpi2SepRequest_t mpi_request; + + memset(mpi_request, 0, sizeof(Mpi2SepRequest_t)); + mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; + mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; + mpi_request.SlotStatus = 0; + mpi_request.Slot = cpu_to_le16(sas_device-slot); + mpi_request.DevHandle = 0; + mpi_request.EnclosureHandle = cpu_to_le16(sas_device-enclosure_handle); + mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; + if ((mpt2sas_base_scsi_enclosure_processor(ioc, mpi_reply, + mpi_request)) != 0) { + printk(MPT2SAS_ERR_FMT failure at %s:%d/%s()!\n, ioc-name, + __FILE__, __LINE__, __func__); + return; + } if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { dewtprintk(ioc, printk(MPT2SAS_INFO_FMT enclosure_processor: @@ -4362,7 +4408,7 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) } /** - * _scsih_send_event_to_turn_on_fault_led - fire delayed event + * _scsih_send_event_to_turn_on_pfa_led - fire delayed event * @ioc: per adapter object * @handle: device handle * Context: interrupt. @@ -4370,14 +4416,14 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) * Return nothing. */ static void -_scsih_send_event_to_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) +_scsih_send_event_to_turn_on_pfa_led(struct MPT2SAS_ADAPTER *ioc, u16 handle)
Re: [PATCH 1/1] Add defines for new FC port speeds.
Can I get another review for this one? On Fri, Jun 13, 2014 at 04:40:36PM +, Dick Kennedy wrote: These speeds are to support the next generation of FCoE port speeds. Signed-off-by: rkenn...@emulex.com --- drivers/scsi/scsi_transport_fc.c |4 include/scsi/scsi_transport_fc.h |4 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index f80908f..454cc28 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -262,6 +262,10 @@ static const struct { { FC_PORTSPEED_8GBIT, 8 Gbit }, { FC_PORTSPEED_16GBIT, 16 Gbit }, { FC_PORTSPEED_32GBIT, 32 Gbit }, + { FC_PORTSPEED_20GBIT, 20 Gbit }, + { FC_PORTSPEED_40GBIT, 40 Gbit }, + { FC_PORTSPEED_50GBIT, 50 Gbit }, + { FC_PORTSPEED_100GBIT, 100 Gbit }, { FC_PORTSPEED_NOT_NEGOTIATED, Not Negotiated }, }; fc_bitfield_name_search(port_speed, fc_port_speed_names) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 8c79980..007a0bc 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -131,6 +131,10 @@ enum fc_vport_state { #define FC_PORTSPEED_8GBIT 0x10 #define FC_PORTSPEED_16GBIT0x20 #define FC_PORTSPEED_32GBIT0x40 +#define FC_PORTSPEED_20GBIT0x80 +#define FC_PORTSPEED_40GBIT0x100 +#define FC_PORTSPEED_50GBIT0x200 +#define FC_PORTSPEED_100GBIT 0x400 #define FC_PORTSPEED_NOT_NEGOTIATED(1 15) /* Speed not established */ /* -- 1.6.6 -- 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 ---end quoted text--- -- 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 0/7] mptfusion static checker fixups
Can I get another review for this series? On Wed, Jun 04, 2014 at 12:49:42PM -0400, Joe Lawrence wrote: While reviewing the mpt2/mpt3 static checker fixup patchset, Christoph inquired about mptfusion. None of the sparse / smatch warnings from the earlier patchset directly apply to fusion, but there were a few easy to fix warnings (compile tested only). The patchset is ordered from the smallest/easiest change up to the last three, which are bit more involved and should be reviewed by LSI, especially the last one mptfusion: tweak null pointer checks. See the commentary in those patches after the signed-off-by line. Cc: Christoph Hellwig h...@infradead.org Cc: Dan Carpenter dan.carpen...@oracle.com Cc: Sreekanth Reddy sreekanth.re...@lsi.com Joe Lawrence (7): mptfusion: mark file-private functions as static mptfusion: remove redundant kfree checks mptfusion: initChainBuffers should return errno mptfusion: zero kernel-space source of copy_to_user mptfusion: make adapter prod_name[] a pointer mptfusion: combine fw_event_work and its event_data mptfusion: tweak null pointer checks drivers/message/fusion/mptbase.c | 29 +-- drivers/message/fusion/mptbase.h |2 +- drivers/message/fusion/mptctl.c |2 +- drivers/message/fusion/mptfc.c|3 +- drivers/message/fusion/mptsas.c | 57 +++-- drivers/message/fusion/mptsas.h |2 +- drivers/message/fusion/mptscsih.c |7 +++-- drivers/message/fusion/mptspi.c |5 ++-- 8 files changed, 52 insertions(+), 55 deletions(-) -- 1.7.10.4 -- 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 ---end quoted text--- -- 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 V1 0/4] LU queue depth manament
On Thu, Jun 05, 2014 at 03:44:18PM +0300, Dolev Raviv wrote: Resending patch 4, to fix the author. Please resend the whole series, and include all the existing reviewed-by or acked-by tags. Thanks! -- 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 0/4] ARM randconfig fixes for SCSI
Can I get another set of reviews for these? On Thu, Jun 05, 2014 at 11:29:45PM +0200, Arnd Bergmann wrote: Hi James, These are some fixes for ancient randconfig build bugs I ran into on ARM. Clearly none of these are urgent, but it would be nice to have them merged for 3.17 if they look good to you. Arnd Bergmann (4): [SCSI] Don't build AdvanSys on ARM [SCSI] pas16: don't call free_dma() [SCSI] qlogicfas: don't call free_dma() [SCSI] NCR53c406a: don't call free_dma() by default drivers/scsi/Kconfig | 2 +- drivers/scsi/NCR53c406a.c | 2 +- drivers/scsi/pas16.c | 2 -- drivers/scsi/qlogicfas.c | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) -- 1.8.3.2 Cc: Matthew Wilcox matt...@wil.cx Cc: Finn Thain fth...@telegraphics.com.au Cc: Michael Schmitz schmitz...@gmail.com -- 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 ---end quoted text--- -- 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] scsi_lib: removes ambiguous Unhandled error code messages.
Can I get another review for this one? On Fri, Jun 06, 2014 at 10:10:35AM +0200, Maurizio Lombardi wrote: During IO with fabric faults, one generally sees several Unhandled error code messages in the syslog as shown below: sd 4:0:6:2: [sdbw] Unhandled error code sd 4:0:6:2: [sdbw] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK sd 4:0:6:2: [sdbw] CDB: Read(10): 28 00 00 00 00 00 00 00 08 00 end_request: I/O error, dev sdbw, sector 0 This comes from scsi_io_completion (in scsi_lib.c) while handling error codes other than DID_RESET or not deferred sense keys i.e. this is actually handled by the SCSI mid layer. But what gets displayed here is Unhandled error code which is quite misleading as it indicates something that is not addressed by the mid layer. This patch removes Unhandled error code and replaces Unhandled sense code with Failing command with sense code:. Signed-off-by: Maurizio Lombardi mlomb...@redhat.com --- drivers/scsi/scsi_lib.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9db097a..b3c25cd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -955,14 +955,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) action = ACTION_FAIL; break; default: - description = Unhandled sense code; + description = Failing command with sense code:; action = ACTION_FAIL; break; } - } else { - description = Unhandled error code; + } else action = ACTION_FAIL; - } if (action != ACTION_FAIL time_before(cmd-jiffies_at_alloc + wait_for, jiffies)) { -- Maurizio Lombardi -- 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 ---end quoted text--- -- 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 RESEND] [SCSI] aic94xx: Remove broken fallback for missing 'Ctrl-A' user settings
On Sun, Jun 08, 2014 at 11:37:44PM +0100, Ben Hutchings wrote: asd_process_ctrl_a_user() attempts to find user settings in flash, and if they are missing it prepares a substitute structure containing default values for PHY settings. But having done so, it will still try to read user settings - from some random address in flash, as the local variable 'offs' has not been initialised. Since asd_common_setup() already sets default PHY settings, there seems to be no need to repeat them here, and we can just return 0. Compile-tested only. Signed-off-by: Ben Hutchings b...@decadent.org.uk Looks good, Reviewed-by: Christoph Hellwig h...@lst.de Can I get another review, too please? -- 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 RESEND] [SCSI] bfa: Fix undefined bit shift on big-endian architectures with 32-bit DMA address
Looks good, Reviewed-by: Christoph Hellwig h...@lst.de Can I get another review, too please? -- 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 6/6] scsi_scan: Fixup scsilun_to_int()
scsilun_to_int() has an error which prevents it from generating correct LUN numbers for 64bit values. Also we should remove the misleading comment about portions of the LUN being ignored; the initiator should treat the LUN as an opaque value. And, finally, the example given should use the correct prefix (here: extended flat space addressing scheme). This patch includes the modifications suggested by Bart van Assche. Cc: Bart van Assche bvanass...@acm.org Cc: Christoph Hellwig h...@infradead.org Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: James Bottomley jbottom...@parallels.com --- drivers/scsi/scsi_scan.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index fa57a04..553e1c7 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1263,14 +1263,15 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget, * truncation before using this function. * * Notes: - * The struct scsi_lun is assumed to be four levels, with each level - * effectively containing a SCSI byte-ordered (big endian) short; the - * addressing bits of each level are ignored (the highest two bits). * For a description of the LUN format, post SCSI-3 see the SCSI * Architecture Model, for SCSI-3 see the SCSI Controller Commands. * - * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns - * the integer: 0x0b030a04 + * Given a struct scsi_lun of: d2 04 0b 03 00 00 00 00, this function + * returns the integer: 0x0b03d204 + * + * This encoding will return a standard integer LUN for LUNs smaller + * than 256, which typically use a single level LUN structure with + * addressing method 0. **/ u64 scsilun_to_int(struct scsi_lun *scsilun) { @@ -1279,8 +1280,8 @@ u64 scsilun_to_int(struct scsi_lun *scsilun) lun = 0; for (i = 0; i sizeof(lun); i += 2) - lun = lun | (((scsilun-scsi_lun[i] 8) | - scsilun-scsi_lun[i + 1]) (i * 8)); + lun = lun | (((u64)scsilun-scsi_lun[i] ((i + 1) *8)) | +((u64)scsilun-scsi_lun[i + 1] (i * 8))); return lun; } EXPORT_SYMBOL(scsilun_to_int); @@ -1294,13 +1295,10 @@ EXPORT_SYMBOL(scsilun_to_int); * Reverts the functionality of the scsilun_to_int, which packed * an 8-byte lun value into an int. This routine unpacks the int * back into the lun value. - * Note: the scsilun_to_int() routine does not truly handle all - * 8bytes of the lun value. This functions restores only as much - * as was set by the routine. * * Notes: - * Given an integer : 0x0b030a04, this function returns a - * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00 + * Given an integer : 0x0b03d204, this function returns a + * struct scsi_lun of: d2 04 0b 03 00 00 00 00 * **/ void int_to_scsilun(u64 lun, struct scsi_lun *scsilun) -- 1.7.12.4 -- 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: mptNsas MSI-X fixes
On Wed, Jun 25, 2014 at 02:40:32PM +0530, Sreekanth Reddy wrote: Hi James, This Patch set seems to be fine. Please consider this patch set as Acked-by: Sreekanth Reddy sreekanth.re...@avagotech.com Any reason you didn't simply include them in your resent driver update series? Also any chance you could start sending these series threaded? Preferably you'd just use git-send-email to send the patches as that gets everything right for you. -- 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 1/3] scsi_cmnd: Introduce scsi_transfer_length helper
Christoph == Christoph Hellwig h...@infradead.org writes: Christoph So here we use blk_rq_bytes still, which is incorrect for Christoph WRITE SAME. Yeah, scsi_transfer_length() needs to go away completely if we go with the in and out variants. Christoph I think the easiest fix is to just pass a scsi_data_buffer to Christoph scsi_transfer_length(), and let the caller use Christoph scsi_in/scsi_out to find the right one. I'm perfectly OK with that approach. -- Martin K. Petersen Oracle Linux Engineering -- 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 1/3] scsi_cmnd: Introduce scsi_transfer_length helper
On Wed, Jun 25, 2014 at 01:32:39PM +0300, Sagi Grimberg wrote: So I tested a bidirectional command using: $ sg_raw --infile=/root/filex --send=1024 --request=1024 --outfile=/root/filex /dev/bsg/7:0:0:0 53 00 00 00 00 00 00 00 02 00 And I see: kernel: session1: iscsi_prep_scsi_cmd_pdu iscsi prep [bidirectional cid 0 sc 880468ca1e00 cdb 0x53 itt 0x16 len 1024 bidi_len 1024 cmdsn 223 win 64] This confirms what I wrote above, so AFAICT no additional fix is required for libiscsi wrt bidi commands support. Good to know. I'd really prefer just going with the fix from Martin that I have already queued up for 3.16, and then we can have the fully fledged out new scsi_transfer_length() for 3.17. -- 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 08/14] block: Add a disk flag to block integrity profile
Christoph == Christoph Hellwig h...@infradead.org writes: Christoph On Wed, Jun 11, 2014 at 09:30:34PM -0400, Martin K. Petersen wrote: /sys/block/foo/integrity/disk_is_formatted_with_pi /sys/block/foo/integrity/disk_is_integrity_capable /sys/block/foo/integrity/disk_supports_storing_pi Or would you prefer something other than disk? target? storage_device? Christoph I'd defintively prefer the target_ prefix and one of the Christoph descriptive suffixes. OK, will tweak. -- Martin K. Petersen Oracle Linux Engineering -- 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] scsi: advansys.c: Cleaning up variable is set more than once
A struct member variable is set to the same value more than once This was found using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/advansys.c |2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index d814588..8281ae0 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -11592,7 +11592,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, adv_dvc_varp-cfg-disc_enable; ep_38C0800-bios_ctrl = adv_dvc_varp-bios_ctrl; ep_38C0800-wdtr_able = adv_dvc_varp-wdtr_able; - ep_38C0800-tagqng_able = adv_dvc_varp-tagqng_able; ep_38C0800-sdtr_speed1 = adv_dvc_varp-sdtr_speed1; ep_38C0800-sdtr_speed2 = adv_dvc_varp-sdtr_speed2; ep_38C0800-sdtr_speed3 = adv_dvc_varp-sdtr_speed3; @@ -11620,7 +11619,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, adv_dvc_varp-cfg-disc_enable; ep_38C1600-bios_ctrl = adv_dvc_varp-bios_ctrl; ep_38C1600-wdtr_able = adv_dvc_varp-wdtr_able; - ep_38C1600-tagqng_able = adv_dvc_varp-tagqng_able; ep_38C1600-sdtr_speed1 = adv_dvc_varp-sdtr_speed1; ep_38C1600-sdtr_speed2 = adv_dvc_varp-sdtr_speed2; ep_38C1600-sdtr_speed3 = adv_dvc_varp-sdtr_speed3; -- 1.7.10.4 -- 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 5/6] scsi: use 64-bit value for 'max_luns'
On Tue, Jun 03, 2014 at 10:58:56AM +0200, Hannes Reinecke wrote: Now that we're using 64-bit LUNs internally we need to increase the size of max_luns to 64 bits, too. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Christoph Hellwig h...@infradead.org Reviewed-by: Ewan Milne emi...@redhat.com I just noticed that this has changes to the module param code. These should be split into a separate patch and be ACKed by the modules maintainer. I'd still love to take the change through the SCSI tree to be able to get this into 3.17 easily. moduleparam changes below: diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 204a677..21e2ba6 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -381,6 +381,11 @@ extern int param_set_ulong(const char *val, const struct kernel_param *kp); extern int param_get_ulong(char *buffer, const struct kernel_param *kp); #define param_check_ulong(name, p) __param_check(name, p, unsigned long) +extern struct kernel_param_ops param_ops_ullong; +extern int param_set_ullong(const char *val, const struct kernel_param *kp); +extern int param_get_ullong(char *buffer, const struct kernel_param *kp); +#define param_check_ullong(name, p) __param_check(name, p, unsigned long long) + extern struct kernel_param_ops param_ops_charp; extern int param_set_charp(const char *val, const struct kernel_param *kp); extern int param_get_charp(char *buffer, const struct kernel_param *kp); diff --git a/kernel/params.c b/kernel/params.c index b00142e..2b2a9dd 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -253,6 +253,7 @@ STANDARD_PARAM_DEF(int, int, %i, kstrtoint); STANDARD_PARAM_DEF(uint, unsigned int, %u, kstrtouint); STANDARD_PARAM_DEF(long, long, %li, kstrtol); STANDARD_PARAM_DEF(ulong, unsigned long, %lu, kstrtoul); +STANDARD_PARAM_DEF(ullong, unsigned long long, %llu, kstrtoull); int param_set_charp(const char *val, const struct kernel_param *kp) { -- 1.7.12.4 -- 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 ---end quoted text--- -- 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 5/6] scsi: use 64-bit value for 'max_luns'
On 06/25/2014 02:28 PM, Christoph Hellwig wrote: On Tue, Jun 03, 2014 at 10:58:56AM +0200, Hannes Reinecke wrote: Now that we're using 64-bit LUNs internally we need to increase the size of max_luns to 64 bits, too. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Christoph Hellwig h...@infradead.org Reviewed-by: Ewan Milne emi...@redhat.com I just noticed that this has changes to the module param code. These should be split into a separate patch and be ACKed by the modules maintainer. I'd still love to take the change through the SCSI tree to be able to get this into 3.17 easily. moduleparam changes below: Guess I need to redo the patchset yet again ... Oh well. Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- 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 5/6] scsi: use 64-bit value for 'max_luns'
On Wed, Jun 25, 2014 at 02:31:31PM +0200, Hannes Reinecke wrote: Guess I need to redo the patchset yet again ... If you plan to resend it please also include these fixes for the mptfusion driver: diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index 02a3eef..bf2a2ce 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c @@ -204,7 +204,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, || (loops 0 ioc-active == 0)) { spin_unlock_irqrestore(shost-host_lock, flags); dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT - mptfc_block_error_handler.%d: %d:%d, port status is + mptfc_block_error_handler.%d: %d:%llu, port status is %x, active flag %d, deferring %s recovery.\n, ioc-name, ioc-sh-host_no, SCpnt-device-id, SCpnt-device-lun, @@ -218,7 +218,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, if (ready == DID_NO_CONNECT || !SCpnt-device-hostdata || ioc-active == 0) { dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT - %s.%d: %d:%d, failing recovery, + %s.%d: %d:%llu, failing recovery, port state %x, active %d, vdevice %p.\n, caller, ioc-name, ioc-sh-host_no, SCpnt-device-id, SCpnt-device-lun, ready, @@ -226,7 +226,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, return FAILED; } dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT - %s.%d: %d:%d, executing recovery.\n, caller, + %s.%d: %d:%llu, executing recovery.\n, caller, ioc-name, ioc-sh-host_no, SCpnt-device-id, SCpnt-device-lun)); return (*func)(SCpnt); diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 82d991d..5b06d68 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -536,7 +536,7 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pSc } scsi_print_command(sc); - printk(MYIOC_s_DEBUG_FMT \tfw_channel = %d, fw_id = %d, lun = %d\n, + printk(MYIOC_s_DEBUG_FMT \tfw_channel = %d, fw_id = %d, lun = %llu\n, ioc-name, pScsiReply-Bus, pScsiReply-TargetID, sc-device-lun); printk(MYIOC_s_DEBUG_FMT \trequest_len = %d, underflow = %d, resid = %d\n, ioc-name, scsi_bufflen(sc), sc-underflow, @@ -1155,7 +1155,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI return; ioc = hd-ioc; if (time - hd-last_queue_full 10 * HZ) { - dprintk(ioc, printk(MYIOC_s_WARN_FMT Device (%d:%d:%d) reported QUEUE_FULL!\n, + dprintk(ioc, printk(MYIOC_s_WARN_FMT Device (%d:%d:%llu) reported QUEUE_FULL!\n, ioc-name, 0, sc-device-id, sc-device-lun)); hd-last_queue_full = time; } @@ -2380,7 +2380,7 @@ mptscsih_slave_configure(struct scsi_device *sdev) vdevice = sdev-hostdata; dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT - device @ %p, channel=%d, id=%d, lun=%d\n, + device @ %p, channel=%d, id=%d, lun=%llu\n, ioc-name, sdev, sdev-channel, sdev-id, sdev-lun)); if (ioc-bus_type == SPI) dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT -- 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: [ANNOUNCE] scsi patch queue tree
And here are the for-3.16 driver changes: Brian King (2): ibmvscsi: Abort init sequence during error recovery ibmvscsi: Add memory barriers for send / receive Maurizio Lombardi (2): pm8001: Fix potential null pointer dereference and memory leak. bnx2fc: do not scan uninitialized lists in case of error. Neil Horman (2): fc: ensure scan_work isn't active when freeing fc_rport bnx2fc: Improve stats update mechanism Paolo Bonzini (2): virtio-scsi: avoid cancelling uninitialized work items virtio-scsi: fix various bad behavior on aborted requests Quinn Tran (1): qla2xxx: Fix sparse warning in qla_target.c. Reddy, Sreekanth (1): MAINTAINERS: Update LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) maintainers Email IDs Tomas Henzl (2): be2iscsi: add an missing goto in error path be2iscsi: remove potential junk pointer free MAINTAINERS |9 + drivers/scsi/be2iscsi/be_main.c |2 ++ drivers/scsi/be2iscsi/be_mgmt.c |4 +--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 16 drivers/scsi/bnx2fc/bnx2fc_io.c |2 ++ drivers/scsi/ibmvscsi/ibmvscsi.c | 13 - drivers/scsi/pm8001/pm8001_init.c | 13 ++--- drivers/scsi/qla2xxx/qla_target.c | 17 +++-- drivers/scsi/qla2xxx/qla_target.h |4 ++-- drivers/scsi/scsi_transport_fc.c |1 + drivers/scsi/virtio_scsi.c| 26 +- 11 files changed, 75 insertions(+), 32 deletions(-) -- 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 1/1] Add defines for new FC port speeds.
On Fri, 2014-06-13 at 16:40 +, Dick Kennedy wrote: These speeds are to support the next generation of FCoE port speeds. Signed-off-by: rkenn...@emulex.com --- drivers/scsi/scsi_transport_fc.c |4 include/scsi/scsi_transport_fc.h |4 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index f80908f..454cc28 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -262,6 +262,10 @@ static const struct { { FC_PORTSPEED_8GBIT, 8 Gbit }, { FC_PORTSPEED_16GBIT, 16 Gbit }, { FC_PORTSPEED_32GBIT, 32 Gbit }, + { FC_PORTSPEED_20GBIT, 20 Gbit }, + { FC_PORTSPEED_40GBIT, 40 Gbit }, + { FC_PORTSPEED_50GBIT, 50 Gbit }, + { FC_PORTSPEED_100GBIT, 100 Gbit }, { FC_PORTSPEED_NOT_NEGOTIATED, Not Negotiated }, }; fc_bitfield_name_search(port_speed, fc_port_speed_names) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 8c79980..007a0bc 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -131,6 +131,10 @@ enum fc_vport_state { #define FC_PORTSPEED_8GBIT 0x10 #define FC_PORTSPEED_16GBIT0x20 #define FC_PORTSPEED_32GBIT0x40 +#define FC_PORTSPEED_20GBIT0x80 +#define FC_PORTSPEED_40GBIT0x100 +#define FC_PORTSPEED_50GBIT0x200 +#define FC_PORTSPEED_100GBIT 0x400 #define FC_PORTSPEED_NOT_NEGOTIATED(1 15) /* Speed not established */ /* -- 1.6.6 -- 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 Reviewed-by: Ewan D. Milne emi...@redhat.com -- 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: SCSI eats error from flush failure during hot plug
On Thu, Jun 19, 2014 at 11:05:59AM -0700, James Bottomley wrote: That's not really a good idea either ... I did think of it. We'll end up with a cmd_type of REQ_TYPE_FS which because of REQ_FLUSH (or REQ_FUA or REQ_DISCARD or any number of other things) we have to treat as though it were REQ_TYPE_BLOCK_PC. It's much better to tune handling expectations according to req-cmd_type because that's what we already do. These commands are actually set up by our handlers, so it's up to us to mark the request type correctly. Looking at the places where the SCSI midlayer cares about the request type: - scsi_finish_command to call -done for non-PC requests. Given that we called into the driver to setup flush/discard/etc we should also call into the driver on request completion - scsi_eh_action: ditto for error handling - scsi_noretry_cmd: I don't see why we'd want to treat flush request as having an implicit failfast flag - scsi_io_completion: this mostly opts out of all kinds of error handling and retries, not really what we'd want either - scsi_unprep_fn: calls -uninit_command only for !PC request, so your patch introduces a leak for discard requests -- 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 4/4] scsi_scan: Fixup scsilun_to_int()
scsilun_to_int() has an error which prevents it from generating correct LUN numbers for 64bit values. Also we should remove the misleading comment about portions of the LUN being ignored; the initiator should treat the LUN as an opaque value. And, finally, the example given should use the correct prefix (here: extended flat space addressing scheme). This patch includes the modifications suggested by Bart van Assche. Cc: Bart van Assche bvanass...@acm.org Cc: Christoph Hellwig h...@infradead.org Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: James Bottomley jbottom...@parallels.com --- drivers/scsi/scsi_scan.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index fa57a04..553e1c7 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1263,14 +1263,15 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget, * truncation before using this function. * * Notes: - * The struct scsi_lun is assumed to be four levels, with each level - * effectively containing a SCSI byte-ordered (big endian) short; the - * addressing bits of each level are ignored (the highest two bits). * For a description of the LUN format, post SCSI-3 see the SCSI * Architecture Model, for SCSI-3 see the SCSI Controller Commands. * - * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns - * the integer: 0x0b030a04 + * Given a struct scsi_lun of: d2 04 0b 03 00 00 00 00, this function + * returns the integer: 0x0b03d204 + * + * This encoding will return a standard integer LUN for LUNs smaller + * than 256, which typically use a single level LUN structure with + * addressing method 0. **/ u64 scsilun_to_int(struct scsi_lun *scsilun) { @@ -1279,8 +1280,8 @@ u64 scsilun_to_int(struct scsi_lun *scsilun) lun = 0; for (i = 0; i sizeof(lun); i += 2) - lun = lun | (((scsilun-scsi_lun[i] 8) | - scsilun-scsi_lun[i + 1]) (i * 8)); + lun = lun | (((u64)scsilun-scsi_lun[i] ((i + 1) *8)) | +((u64)scsilun-scsi_lun[i + 1] (i * 8))); return lun; } EXPORT_SYMBOL(scsilun_to_int); @@ -1294,13 +1295,10 @@ EXPORT_SYMBOL(scsilun_to_int); * Reverts the functionality of the scsilun_to_int, which packed * an 8-byte lun value into an int. This routine unpacks the int * back into the lun value. - * Note: the scsilun_to_int() routine does not truly handle all - * 8bytes of the lun value. This functions restores only as much - * as was set by the routine. * * Notes: - * Given an integer : 0x0b030a04, this function returns a - * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00 + * Given an integer : 0x0b03d204, this function returns a + * struct scsi_lun of: d2 04 0b 03 00 00 00 00 * **/ void int_to_scsilun(u64 lun, struct scsi_lun *scsilun) -- 1.7.12.4 -- 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
[PATCHv5 0/4] Support 64-bit LUNs
Hi all, this patchset updates the SCSI stack to support full 64-bit LUNs. The first patche update the SCSI stack and all drivers to use 64-bit LUNs where appropriate. The second patch updates the kernel module parameter functions to accept a new 'ullong' parameter. The third the updates the 'max_lun' parameter to accept 64-bit values, too. And finally we need to update the conversion routines scsilun_to_int to cope with 64bit LUNs. The patchset is relative to the 'core-for-3.17' git tree from hch. Changes to v4: - Drop patches already merged - Include fixes from Bart van Assche for scsilun_to_int() - Include missing patches for mptfc.c and mptscsih.c - Split module parameter changes into separate patch Changes to v3: - Modified scsilun_to_int() as suggested by James B. Changes to v2: - Add patch to fixup scsilun_to_int - Add Reviewed-by: where applicable - Remove last references to SCSI_MULTI_LUN Hannes Reinecke (4): scsi: use 64-bit LUNs Add module param type 'ullong' scsi: use 64-bit value for 'max_luns' scsi_scan: Fixup scsilun_to_int() drivers/ata/libata-scsi.c| 2 +- drivers/ata/libata.h | 2 +- drivers/message/fusion/mptbase.h | 2 +- drivers/message/fusion/mptfc.c | 6 +-- drivers/message/fusion/mptscsih.c| 14 +++--- drivers/message/fusion/mptscsih.h| 4 +- drivers/message/i2o/i2o_scsi.c | 11 +++-- drivers/s390/scsi/zfcp_dbf.c | 3 +- drivers/s390/scsi/zfcp_unit.c| 4 +- drivers/scsi/NCR5380.c | 28 ++-- drivers/scsi/aacraid/linit.c | 2 +- drivers/scsi/advansys.c | 2 +- drivers/scsi/aha152x.c | 6 +-- drivers/scsi/aic7xxx/aic79xx.h | 2 +- drivers/scsi/aic7xxx/aic79xx_osm.c | 6 +-- drivers/scsi/aic7xxx/aic79xx_proc.c | 2 +- drivers/scsi/aic7xxx/aic7xxx_osm.c | 11 ++--- drivers/scsi/aic7xxx/aic7xxx_proc.c | 2 +- drivers/scsi/arcmsr/arcmsr_hba.c | 8 ++-- drivers/scsi/csiostor/csio_scsi.c| 24 +-- drivers/scsi/cxgbi/libcxgbi.c| 2 +- drivers/scsi/cxgbi/libcxgbi.h| 2 +- drivers/scsi/dc395x.c| 42 +- drivers/scsi/eata.c | 4 +- drivers/scsi/fnic/fnic_scsi.c| 4 +- drivers/scsi/hpsa.c | 2 +- drivers/scsi/ibmvscsi/ibmvfc.c | 4 +- drivers/scsi/libiscsi.c | 8 ++-- drivers/scsi/libsas/sas_scsi_host.c | 11 ++--- drivers/scsi/lpfc/lpfc_attr.c| 10 - drivers/scsi/lpfc/lpfc_scsi.c| 36 drivers/scsi/megaraid.c | 6 +-- drivers/scsi/megaraid/mega_common.h | 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +- drivers/scsi/pmcraid.c | 2 +- drivers/scsi/qla2xxx/qla_def.h | 6 +-- drivers/scsi/qla2xxx/qla_gbl.h | 18 drivers/scsi/qla2xxx/qla_iocb.c | 11 +++-- drivers/scsi/qla2xxx/qla_isr.c | 4 +- drivers/scsi/qla2xxx/qla_mbx.c | 12 +++--- drivers/scsi/qla2xxx/qla_mr.c| 8 ++-- drivers/scsi/qla2xxx/qla_os.c| 41 +- drivers/scsi/qla4xxx/ql4_glbl.h | 4 +- drivers/scsi/qla4xxx/ql4_iocb.c | 2 +- drivers/scsi/qla4xxx/ql4_isr.c | 22 +- drivers/scsi/qla4xxx/ql4_mbx.c | 6 +-- drivers/scsi/qla4xxx/ql4_os.c| 20 - drivers/scsi/scsi.c | 8 ++-- drivers/scsi/scsi_debug.c| 15 --- drivers/scsi/scsi_priv.h | 2 +- drivers/scsi/scsi_proc.c | 2 +- drivers/scsi/scsi_scan.c | 82 ++-- drivers/scsi/scsi_sysfs.c| 14 +++--- drivers/scsi/scsi_transport_fc.c | 4 +- drivers/scsi/scsi_transport_iscsi.c | 4 +- drivers/scsi/scsi_transport_sas.c| 2 +- drivers/scsi/sg.c| 4 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 2 +- drivers/scsi/sym53c8xx_2/sym_hipd.h | 2 +- drivers/target/loopback/tcm_loop.c | 2 +- drivers/target/target_core_pscsi.c | 12 +++--- drivers/usb/storage/sddr09.c | 4 +- drivers/usb/storage/usb.c| 10 +++-- include/linux/moduleparam.h | 5 +++ include/scsi/scsi.h | 2 +- include/scsi/scsi_device.h | 22 +- include/scsi/scsi_host.h | 6 +-- include/scsi/scsi_transport.h| 2 +- kernel/params.c | 1 + 69 files changed, 322 insertions(+), 319 deletions(-) -- 1.7.12.4 -- 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 3/4] scsi: use 64-bit value for 'max_luns'
Now that we're using 64-bit LUNs internally we need to increase the size of max_luns to 64 bits, too. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Christoph Hellwig h...@infradead.org Reviewed-by: Ewan Milne emi...@redhat.com --- drivers/message/i2o/i2o_scsi.c | 2 +- drivers/scsi/advansys.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c| 2 +- drivers/scsi/cxgbi/libcxgbi.h| 2 +- drivers/scsi/dc395x.c| 2 +- drivers/scsi/eata.c | 2 +- drivers/scsi/ibmvscsi/ibmvfc.c | 4 ++-- drivers/scsi/lpfc/lpfc_attr.c| 10 +- drivers/scsi/megaraid.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 ++-- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_os.c| 6 +++--- drivers/scsi/scsi_scan.c | 6 +++--- include/scsi/scsi_host.h | 6 +++--- 14 files changed, 30 insertions(+), 22 deletions(-) diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index e7de92c..8152e9fa 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c @@ -287,7 +287,7 @@ static int i2o_scsi_probe(struct device *dev) } if (le64_to_cpu(lun) = scsi_host-max_lun) { - osm_warn(SCSI device lun (%llu) = max_lun of I2O host (%d), + osm_warn(SCSI device lun (%llu) = max_lun of I2O host (%llu), le64_to_cpu(lun), scsi_host-max_lun); return -EFAULT; } diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index d814588..e716d0a 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3345,7 +3345,7 @@ static void asc_prt_driver_conf(struct seq_file *m, struct Scsi_Host *shost) shost-host_no); seq_printf(m, - host_busy %u, max_id %u, max_lun %u, max_channel %u\n, + host_busy %u, max_id %u, max_lun %llu, max_channel %u\n, shost-host_busy, shost-max_id, shost-max_lun, shost-max_channel); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index b44c1cf..dc812069 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -245,7 +245,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) } EXPORT_SYMBOL_GPL(cxgbi_hbas_remove); -int cxgbi_hbas_add(struct cxgbi_device *cdev, unsigned int max_lun, +int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, unsigned int max_id, struct scsi_host_template *sht, struct scsi_transport_template *stt) { diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 8135f04..538d7a6 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h @@ -692,7 +692,7 @@ struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int); void cxgbi_device_unregister(struct cxgbi_device *); void cxgbi_device_unregister_all(unsigned int flag); struct cxgbi_device *cxgbi_device_find_by_lldev(void *); -int cxgbi_hbas_add(struct cxgbi_device *, unsigned int, unsigned int, +int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int, struct scsi_host_template *, struct scsi_transport_template *); void cxgbi_hbas_remove(struct cxgbi_device *); diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index dff461f..0c6be0a 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -4638,7 +4638,7 @@ static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host) SPRINTF(irq_level 0x%04x, , acb-irq_level); SPRINTF( SelTimeout %ims\n, (1638 * acb-sel_timeout) / 1000); - SPRINTF(MaxID %i, MaxLUN %i, , host-max_id, host-max_lun); + SPRINTF(MaxID %i, MaxLUN %llu, , host-max_id, host-max_lun); SPRINTF(AdapterID %i\n, host-this_id); SPRINTF(tag_max_num %i, acb-tag_max_num); diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 0f27ac1..03372cf 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -1399,7 +1399,7 @@ static int port_detect(unsigned long port_base, unsigned int j, if (shost-max_id 8 || shost-max_lun 8) printk - (%s: wide SCSI support enabled, max_id %u, max_lun %u.\n, + (%s: wide SCSI support enabled, max_id %u, max_lun %llu.\n, ha-board_name, shost-max_id, shost-max_lun); for (i = 0; i = shost-max_channel; i++) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 8dd4768..6eb47b6 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -46,7 +46,7 @@ static unsigned int init_timeout = IBMVFC_INIT_TIMEOUT; static unsigned int default_timeout = IBMVFC_DEFAULT_TIMEOUT; -static unsigned int max_lun = IBMVFC_MAX_LUN; +static u64 max_lun = IBMVFC_MAX_LUN; static unsigned int max_targets =
[PATCH 2/4] Add module param type 'ullong'
Some driver might want to pass in an 64-bit value, so introduce a module param type 'ullong'. Cc: Rusty Russel ru...@rustcorp.com.au Cc: Linux Kernel linux-ker...@vger.kernel.org Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Christoph Hellwig h...@infradead.org Reviewed-by: Ewan Milne emi...@redhat.com --- include/linux/moduleparam.h | 5 + kernel/params.c | 1 + 2 files changed, 6 insertions(+) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index b1990c5..494f99e 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -381,6 +381,11 @@ extern int param_set_ulong(const char *val, const struct kernel_param *kp); extern int param_get_ulong(char *buffer, const struct kernel_param *kp); #define param_check_ulong(name, p) __param_check(name, p, unsigned long) +extern struct kernel_param_ops param_ops_ullong; +extern int param_set_ullong(const char *val, const struct kernel_param *kp); +extern int param_get_ullong(char *buffer, const struct kernel_param *kp); +#define param_check_ullong(name, p) __param_check(name, p, unsigned long long) + extern struct kernel_param_ops param_ops_charp; extern int param_set_charp(const char *val, const struct kernel_param *kp); extern int param_get_charp(char *buffer, const struct kernel_param *kp); diff --git a/kernel/params.c b/kernel/params.c index 1e52ca2..34f5270 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -256,6 +256,7 @@ STANDARD_PARAM_DEF(int, int, %i, kstrtoint); STANDARD_PARAM_DEF(uint, unsigned int, %u, kstrtouint); STANDARD_PARAM_DEF(long, long, %li, kstrtol); STANDARD_PARAM_DEF(ulong, unsigned long, %lu, kstrtoul); +STANDARD_PARAM_DEF(ullong, unsigned long long, %llu, kstrtoull); int param_set_charp(const char *val, const struct kernel_param *kp) { -- 1.7.12.4 -- 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] scsi: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once
A struct member variable is set to different values without having used in between. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/pm8001/pm80xx_hwi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index d70587f..2698227 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -249,7 +249,6 @@ moreData: sprintf(pm8001_ha- forensic_info.data_buf.direct_data, %08x , 4); - pm8001_ha-forensic_info.data_buf.read_len = 0x; pm8001_ha-forensic_info.data_buf.direct_len = 0; pm8001_ha-forensic_info.data_buf.direct_offset = 0; pm8001_ha-forensic_info.data_buf.read_len = 0; -- 1.7.10.4 -- 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] scsi: bnx2i: bnx2i_iscsi.c: Cleaning up variable is set more than once
A struct member variable is set to different values without having used in between. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/bnx2i/bnx2i_iscsi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 166543f..fdf7bc3 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1643,7 +1643,6 @@ static void bnx2i_conn_get_stats(struct iscsi_cls_conn *cls_conn, stats-r2t_pdus = conn-r2t_pdus_cnt; stats-tmfcmd_pdus = conn-tmfcmd_pdus_cnt; stats-tmfrsp_pdus = conn-tmfrsp_pdus_cnt; - stats-custom_length = 3; strcpy(stats-custom[2].desc, eh_abort_cnt); stats-custom[2].value = conn-eh_abort_cnt; stats-digest_err = 0; -- 1.7.10.4 -- 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 0/7] mptfusion static checker fixups
Hi Christoph, Sreekanth, Would it be easier to combine this set with the mpt2/mpt3 changes and repost a V2? There were a few changes Christoph request in each set, so I can post those up later today. -- Joe On Wed, 25 Jun 2014 13:01:50 +0200 Christoph Hellwig h...@infradead.org wrote: Can I get another review for this series? On Wed, Jun 04, 2014 at 12:49:42PM -0400, Joe Lawrence wrote: While reviewing the mpt2/mpt3 static checker fixup patchset, Christoph inquired about mptfusion. None of the sparse / smatch warnings from the earlier patchset directly apply to fusion, but there were a few easy to fix warnings (compile tested only). The patchset is ordered from the smallest/easiest change up to the last three, which are bit more involved and should be reviewed by LSI, especially the last one mptfusion: tweak null pointer checks. See the commentary in those patches after the signed-off-by line. Cc: Christoph Hellwig h...@infradead.org Cc: Dan Carpenter dan.carpen...@oracle.com Cc: Sreekanth Reddy sreekanth.re...@lsi.com Joe Lawrence (7): mptfusion: mark file-private functions as static mptfusion: remove redundant kfree checks mptfusion: initChainBuffers should return errno mptfusion: zero kernel-space source of copy_to_user mptfusion: make adapter prod_name[] a pointer mptfusion: combine fw_event_work and its event_data mptfusion: tweak null pointer checks drivers/message/fusion/mptbase.c | 29 +-- drivers/message/fusion/mptbase.h |2 +- drivers/message/fusion/mptctl.c |2 +- drivers/message/fusion/mptfc.c|3 +- drivers/message/fusion/mptsas.c | 57 +++-- drivers/message/fusion/mptsas.h |2 +- drivers/message/fusion/mptscsih.c |7 +++-- drivers/message/fusion/mptspi.c |5 ++-- 8 files changed, 52 insertions(+), 55 deletions(-) -- 1.7.10.4 -- 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 ---end quoted text--- -- 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 -- 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 0/7] mptfusion static checker fixups
On Wed, Jun 25, 2014 at 10:18:11AM -0400, Joe Lawrence wrote: Hi Christoph, Sreekanth, Would it be easier to combine this set with the mpt2/mpt3 changes and repost a V2? There were a few changes Christoph request in each set, so I can post those up later today. Fine with me. -- 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: bnx2i: bnx2i_iscsi.c: Cleaning up variable is set more than once
Hi, On 06/25/2014 04:04 PM, Rickard Strandqvist wrote: A struct member variable is set to different values without having used in between. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/bnx2i/bnx2i_iscsi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 166543f..fdf7bc3 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1643,7 +1643,6 @@ static void bnx2i_conn_get_stats(struct iscsi_cls_conn *cls_conn, stats-r2t_pdus = conn-r2t_pdus_cnt; stats-tmfcmd_pdus = conn-tmfcmd_pdus_cnt; stats-tmfrsp_pdus = conn-tmfrsp_pdus_cnt; - stats-custom_length = 3; strcpy(stats-custom[2].desc, eh_abort_cnt); stats-custom[2].value = conn-eh_abort_cnt; stats-digest_err = 0; Eddie, The code modifies the content of stats-custom[2], so shouldn't custom_length be set to 3? Why is it set to zero at the end of this function? Regards, Maurizio Lombardi -- 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 6/6] scsi: use dev_printk variants where possible
Using dev_printk variants prefixes the logging message with the originating device, which makes debugging easier. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/hosts.c | 15 ++-- drivers/scsi/scsi.c | 18 ++--- drivers/scsi/scsi_error.c | 179 +- drivers/scsi/scsi_lib.c | 22 +++--- drivers/scsi/scsi_scan.c | 62 5 files changed, 157 insertions(+), 139 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 3cbb57a..0632eee 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -204,12 +204,12 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, struct scsi_host_template *sht = shost-hostt; int error = -EINVAL; - printk(KERN_INFO scsi%d : %s\n, shost-host_no, + shost_printk(KERN_INFO, shost, %s\n, sht-info ? sht-info(shost) : sht-name); if (!shost-can_queue) { - printk(KERN_ERR %s: can_queue = 0 no longer supported\n, - sht-name); + shost_printk(KERN_ERR, shost, +can_queue = 0 no longer supported\n); goto fail; } @@ -450,8 +450,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost-ehandler = kthread_run(scsi_error_handler, shost, scsi_eh_%d, shost-host_no); if (IS_ERR(shost-ehandler)) { - printk(KERN_WARNING scsi%d: error handler thread failed to spawn, error = %ld\n, - shost-host_no, PTR_ERR(shost-ehandler)); + shost_printk(KERN_WARNING, shost, + error handler thread failed to spawn, error = %ld\n, + PTR_ERR(shost-ehandler)); goto fail_kfree; } @@ -584,7 +585,7 @@ EXPORT_SYMBOL(scsi_is_host_device); int scsi_queue_work(struct Scsi_Host *shost, struct work_struct *work) { if (unlikely(!shost-work_q)) { - printk(KERN_ERR + shost_printk(KERN_ERR, shost, ERROR: Scsi host '%s' attempted to queue scsi-work, when no workqueue created.\n, shost-hostt-name); dump_stack(); @@ -603,7 +604,7 @@ EXPORT_SYMBOL_GPL(scsi_queue_work); void scsi_flush_work(struct Scsi_Host *shost) { if (!shost-work_q) { - printk(KERN_ERR + shost_printk(KERN_ERR, shost, ERROR: Scsi host '%s' attempted to flush scsi-work, when no workqueue created.\n, shost-hostt-name); dump_stack(); diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index bff351b..ce5b4e5 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -655,7 +655,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) /* Check to see if the scsi lld made this device blocked. */ if (unlikely(scsi_device_blocked(cmd-device))) { - /* + /* * in blocked state, the command is just put back on * the device queue. The suspend state has already * blocked the queue so future requests should not @@ -665,7 +665,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); - SCSI_LOG_MLQUEUE(3, printk(queuecommand : device blocked \n)); + SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, + queuecommand : device blocked\n)); /* * NOTE: rtn is still zero here because we don't need the @@ -674,7 +675,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) goto out; } - /* + /* * If SCSI-2 or lower, store the LUN value in cmnd. */ if (cmd-device-scsi_level = SCSI_2 @@ -690,8 +691,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) * length exceeds what the host adapter can handle. */ if (cmd-cmd_len cmd-device-host-max_cmd_len) { - SCSI_LOG_MLQUEUE(3, - printk(queuecommand : command too long. + SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, + queuecommand : command too long. cdb_size=%d host-max_cmd_len=%d\n, cmd-cmd_len, cmd-device-host-max_cmd_len)); cmd-result = (DID_ABORT 16); @@ -715,14 +716,13 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) rtn != SCSI_MLQUEUE_TARGET_BUSY) rtn = SCSI_MLQUEUE_HOST_BUSY; - scsi_queue_insert(cmd, rtn); + SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, + queuecommand :
[PATCH 5/6] scsi: use dev_printk() variants for ioctl
Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_ioctl.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index d9564fb..1aaaf43 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -91,12 +91,14 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, int result; struct scsi_sense_hdr sshdr; - SCSI_LOG_IOCTL(1, printk(Trying ioctl with scsi command %d\n, *cmd)); + SCSI_LOG_IOCTL(1, sdev_printk(KERN_INFO, sdev, + Trying ioctl with scsi command %d\n, *cmd)); result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, timeout, retries, NULL); - SCSI_LOG_IOCTL(2, printk(Ioctl returned 0x%x\n, result)); + SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, + Ioctl returned 0x%x\n, result)); if ((driver_byte(result) DRIVER_SENSE) (scsi_sense_valid(sshdr))) { @@ -105,9 +107,11 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, if (cmd[0] == ALLOW_MEDIUM_REMOVAL) sdev-lockable = 0; else - printk(KERN_INFO ioctl_internal_command: - ILLEGAL REQUEST asc=0x%x ascq=0x%x\n, - sshdr.asc, sshdr.ascq); + sdev_printk(KERN_INFO, sdev, + ioctl_internal_command: + ILLEGAL REQUEST + asc=0x%x ascq=0x%x\n, + sshdr.asc, sshdr.ascq); break; case NOT_READY: /* This happens if there is no disc in drive */ if (sdev-removable) @@ -127,7 +131,8 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, } } - SCSI_LOG_IOCTL(2, printk(IOCTL Releasing command\n)); + SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, + IOCTL Releasing command\n)); return result; } -- 1.7.12.4 -- 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
[PATCHv2 0/6] First batch of logging cleanup
Hi all, this is the first patch of my SCSI logging cleanup. The basic idea here is to use dev_printk() and friends throughout the midlayer, so that any logging messages are attached with the correct device information. This patchset is relative to the core-for-3.17 git tree from hch + my 64-bit LUN patchset. Changes to v1: - Rebase to apply after 64-bit LUN patchset Hannes Reinecke (6): scsi: Implement sr_printk() scsi: Implement sg_printk() scsi: Implement ch_printk() scsi: Implement st_printk() scsi: use dev_printk() variants for ioctl scsi: use dev_printk variants where possible drivers/scsi/ch.c | 14 +- drivers/scsi/hosts.c | 15 +- drivers/scsi/scsi.c | 18 +- drivers/scsi/scsi_error.c | 179 +++--- drivers/scsi/scsi_ioctl.c | 17 +- drivers/scsi/scsi_lib.c | 22 +- drivers/scsi/scsi_scan.c | 62 ++--- drivers/scsi/sg.c | 163 +++-- drivers/scsi/sr.c | 61 ++--- drivers/scsi/sr.h | 4 + drivers/scsi/sr_ioctl.c | 26 +- drivers/scsi/sr_vendor.c | 36 +-- drivers/scsi/st.c | 605 -- 13 files changed, 653 insertions(+), 569 deletions(-) -- 1.7.12.4 -- 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 3/6] scsi: Implement ch_printk()
Update the ch driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/ch.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 2a32374..ba1c3bf 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -84,15 +84,19 @@ 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) + #define DPRINTK(fmt, arg...) \ do { \ if (debug) \ - printk(KERN_DEBUG %s: fmt, ch-name, ##arg); \ + ch_printk(KERN_DEBUG, ch, fmt, ##arg); \ } while (0) #define VPRINTK(level, fmt, arg...)\ do { \ if (verbose)\ - printk(level %s: fmt, ch-name, ##arg); \ + ch_printk(level, ch, fmt, ##arg); \ } while (0) /* --- */ @@ -196,7 +200,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, __scsi_print_command(cmd); } -result = scsi_execute_req(ch-device, cmd, direction, buffer, + result = scsi_execute_req(ch-device, cmd, direction, buffer, buflength, sshdr, timeout * HZ, MAX_RETRIES, NULL); @@ -924,8 +928,8 @@ static int ch_probe(struct device *dev) MKDEV(SCSI_CHANGER_MAJOR, ch-minor), ch, s%s, ch-name); if (IS_ERR(class_dev)) { - printk(KERN_WARNING ch%d: device_create failed\n, - ch-minor); + sdev_printk(KERN_WARNING, sd, ch%d: device_create failed\n, + ch-minor); ret = PTR_ERR(class_dev); goto remove_idr; } -- 1.7.12.4 -- 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/6] scsi: Implement sr_printk()
Update the sr driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/sr.c| 61 +--- drivers/scsi/sr.h| 4 drivers/scsi/sr_ioctl.c | 26 + drivers/scsi/sr_vendor.c | 36 ++-- 4 files changed, 70 insertions(+), 57 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 93cbd36..a7ea27c 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -292,8 +292,8 @@ do_tur: if (!cd-tur_changed) { if (cd-get_event_changed) { if (cd-tur_mismatch++ 8) { - sdev_printk(KERN_WARNING, cd-device, - GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n); + sr_printk(KERN_WARNING, cd, + GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n); cd-ignore_get_event = true; } } else { @@ -322,7 +322,7 @@ static int sr_done(struct scsi_cmnd *SCpnt) struct scsi_cd *cd = scsi_cd(SCpnt-request-rq_disk); #ifdef DEBUG - printk(sr.c done: %x\n, result); + scmd_printk(KERN_INFO, SCpnt, done: %x\n, result); #endif /* @@ -398,13 +398,14 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) * is used for a killable error condition */ ret = BLKPREP_KILL; - SCSI_LOG_HLQUEUE(1, printk(Doing sr request, dev = %s, block = %d\n, - cd-disk-disk_name, block)); + SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt, + Doing sr request, block = %d\n, block)); if (!cd-device || !scsi_device_online(cd-device)) { - SCSI_LOG_HLQUEUE(2, printk(Finishing %u sectors\n, - blk_rq_sectors(rq))); - SCSI_LOG_HLQUEUE(2, printk(Retry with 0x%p\n, SCpnt)); + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, + Finishing %u sectors\n, blk_rq_sectors(rq))); + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, + Retry with 0x%p\n, SCpnt)); goto out; } @@ -425,7 +426,8 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) if (!in_interrupt()) sr_set_blocklength(cd, 2048); else - printk(sr: can't switch blocksize: in interrupt\n); + scmd_printk(KERN_INFO, SCpnt, + can't switch blocksize: in interrupt\n); } if (s_size != 512 s_size != 1024 s_size != 2048) { @@ -438,7 +440,7 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) goto out; SCpnt-cmnd[0] = WRITE_10; SCpnt-sc_data_direction = DMA_TO_DEVICE; - cd-cdi.media_written = 1; + cd-cdi.media_written = 1; } else if (rq_data_dir(rq) == READ) { SCpnt-cmnd[0] = READ_10; SCpnt-sc_data_direction = DMA_FROM_DEVICE; @@ -475,11 +477,11 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) this_count = (scsi_bufflen(SCpnt) 9) / (s_size 9); - SCSI_LOG_HLQUEUE(2, printk(%s : %s %d/%u 512 byte blocks.\n, - cd-cdi.name, - (rq_data_dir(rq) == WRITE) ? + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, + %s %d/%u 512 byte blocks.\n, + (rq_data_dir(rq) == WRITE) ? writing : reading, - this_count, blk_rq_sectors(rq))); + this_count, blk_rq_sectors(rq))); SCpnt-cmnd[1] = 0; block = (unsigned int)blk_rq_pos(rq) / (s_size 9); @@ -810,8 +812,8 @@ static void get_sectorsize(struct scsi_cd *cd) case 512: break; default: - printk(%s: unsupported sector size %d.\n, - cd-cdi.name, sector_size); + sr_printk(KERN_INFO, cd, + unsupported sector size %d., sector_size); cd-capacity = 0; } @@ -853,7 +855,7 @@ static void get_capabilities(struct scsi_cd *cd) /* allocate transfer buffer */ buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); if (!buffer) { - printk(KERN_ERR sr: out of memory.\n); + sr_printk(KERN_ERR, cd, out of
[PATCH 4/6] scsi: Implement st_printk()
Update the st driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke h...@suse.de Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/st.c | 605 -- 1 file changed, 311 insertions(+), 294 deletions(-) diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 14eb4b2..aff9689 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -58,11 +58,11 @@ static const char *verstr = 20101219; is defined and non-zero. */ #define DEBUG 0 +#define ST_DEB_MSG KERN_NOTICE #if DEBUG /* The message level for the debug messages is currently set to KERN_NOTICE so that people can easily see the messages. Later when the debugging messages in the drivers are more widely classified, this may be changed to KERN_DEBUG. */ -#define ST_DEB_MSG KERN_NOTICE #define DEB(a) a #define DEBC(a) if (debugging) { a ; } #else @@ -305,6 +305,15 @@ static inline char *tape_name(struct scsi_tape *tape) return tape-disk-disk_name; } +#define st_printk(prefix, t, fmt, a...) \ + sdev_printk(prefix, (t)-device, %s: fmt, \ + tape_name(t), ##a) +#ifdef DEBUG +#define DEBC_printk(t, fmt, a...) \ + if (debugging) { st_printk(ST_DEB_MSG, t, fmt, ##a ); } +#else +#define DEBC_printk(t, fmt, a...) +#endif static void st_analyze_sense(struct st_request *SRpnt, struct st_cmdstatus *s) { @@ -358,21 +367,20 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) else scode = 0; -DEB( -if (debugging) { -printk(ST_DEB_MSG %s: Error: %x, cmd: %x %x %x %x %x %x\n, - name, result, - SRpnt-cmd[0], SRpnt-cmd[1], SRpnt-cmd[2], - SRpnt-cmd[3], SRpnt-cmd[4], SRpnt-cmd[5]); + DEB( + if (debugging) { + st_printk(ST_DEB_MSG, STp, + Error: %x, cmd: %x %x %x %x %x %x\n, result, + SRpnt-cmd[0], SRpnt-cmd[1], SRpnt-cmd[2], + SRpnt-cmd[3], SRpnt-cmd[4], SRpnt-cmd[5]); if (cmdstatp-have_sense) __scsi_print_sense(name, SRpnt-sense, SCSI_SENSE_BUFFERSIZE); } ) /* end DEB */ if (!debugging) { /* Abnormal conditions for tape */ if (!cmdstatp-have_sense) - printk(KERN_WARNING - %s: Error %x (driver bt 0x%x, host bt 0x%x).\n, - name, result, driver_byte(result), - host_byte(result)); + st_printk(KERN_WARNING, STp, + Error %x (driver bt 0x%x, host bt 0x%x).\n, + result, driver_byte(result), host_byte(result)); else if (cmdstatp-have_sense scode != NO_SENSE scode != RECOVERED_ERROR @@ -411,7 +419,7 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) STp-recover_count++; STp-recover_reg++; -DEB( + DEB( if (debugging) { if (SRpnt-cmd[0] == READ_6) stp = read; @@ -419,8 +427,9 @@ static int st_chk_result(struct scsi_tape *STp, struct st_request * SRpnt) stp = write; else stp = ioctl; - printk(ST_DEB_MSG %s: Recovered %s error (%d).\n, name, stp, - STp-recover_count); + st_printk(ST_DEB_MSG, STp, + Recovered %s error (%d).\n, + stp, STp-recover_count); } ) /* end DEB */ if (cmdstatp-flags == 0) @@ -437,8 +446,8 @@ static struct st_request *st_allocate_request(struct scsi_tape *stp) if (streq) streq-stp = stp; else { - DEBC(printk(KERN_ERR %s: Can't get SCSI request.\n, - tape_name(stp));); + st_printk(KERN_ERR, stp, + Can't get SCSI request.\n); if (signal_pending(current)) stp-buffer-syscall_result = -EINTR; else @@ -525,8 +534,8 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd /* if async, make sure there's no command outstanding */ if (!do_wait ((STp-buffer)-last_SRpnt)) { - printk(KERN_ERR %s: Async command already active.\n, - tape_name(STp)); + st_printk(KERN_ERR, STp, + Async command already active.\n);
[PATCH 2/6] scsi: Implement sg_printk()
Update the sg driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke h...@suse.de Acked-by: Doug Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/sg.c | 163 +++--- 1 file changed, 95 insertions(+), 68 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f27b70d..cb2a18e 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -199,11 +199,11 @@ static ssize_t sg_new_write(Sg_fd *sfp, struct file *file, static int sg_common_write(Sg_fd * sfp, Sg_request * srp, unsigned char *cmnd, int timeout, int blocking); static int sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer); -static void sg_remove_scat(Sg_scatter_hold * schp); +static void sg_remove_scat(Sg_fd * sfp, Sg_scatter_hold * schp); static void sg_build_reserve(Sg_fd * sfp, int req_size); static void sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size); static void sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp); -static Sg_fd *sg_add_sfp(Sg_device * sdp, int dev); +static Sg_fd *sg_add_sfp(Sg_device * sdp); static void sg_remove_sfp(struct kref *); static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id); static Sg_request *sg_add_request(Sg_fd * sfp); @@ -217,6 +217,10 @@ static void sg_device_destroy(struct kref *kref); #define SZ_SG_IOVEC sizeof(sg_iovec_t) #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) + static int sg_allow_access(struct file *filp, unsigned char *cmd) { struct sg_fd *sfp = filp-private_data; @@ -275,13 +279,15 @@ sg_open(struct inode *inode, struct file *filp) int retval; nonseekable_open(inode, filp); - SCSI_LOG_TIMEOUT(3, printk(sg_open: dev=%d, flags=0x%x\n, dev, flags)); if ((flags O_EXCL) (O_RDONLY == (flags O_ACCMODE))) return -EPERM; /* Can't lock it with read only access */ sdp = sg_get_dev(dev); if (IS_ERR(sdp)) return PTR_ERR(sdp); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, + sg_open: flags=0x%x\n, flags)); + /* This driver's module count bumped by fops_get in linux/fs.h */ /* Prevent the device driver from vanishing while we sleep */ retval = scsi_device_get(sdp-device); @@ -330,7 +336,7 @@ sg_open(struct inode *inode, struct file *filp) q = sdp-device-request_queue; sdp-sg_tablesize = queue_max_segments(q); } - sfp = sg_add_sfp(sdp, dev); + sfp = sg_add_sfp(sdp); if (IS_ERR(sfp)) { retval = PTR_ERR(sfp); goto out_undo; @@ -369,7 +375,7 @@ sg_release(struct inode *inode, struct file *filp) if ((!(sfp = (Sg_fd *) filp-private_data)) || (!(sdp = sfp-parentdp))) return -ENXIO; - SCSI_LOG_TIMEOUT(3, printk(sg_release: %s\n, sdp-disk-disk_name)); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, sg_release\n)); mutex_lock(sdp-open_rel_lock); scsi_autopm_put_device(sdp-device); @@ -401,8 +407,8 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) if ((!(sfp = (Sg_fd *) filp-private_data)) || (!(sdp = sfp-parentdp))) return -ENXIO; - SCSI_LOG_TIMEOUT(3, printk(sg_read: %s, count=%d\n, - sdp-disk-disk_name, (int) count)); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, + sg_read: count=%d\n, (int) count)); if (!access_ok(VERIFY_WRITE, buf, count)) return -EFAULT; @@ -587,8 +593,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) if ((!(sfp = (Sg_fd *) filp-private_data)) || (!(sdp = sfp-parentdp))) return -ENXIO; - SCSI_LOG_TIMEOUT(3, printk(sg_write: %s, count=%d\n, - sdp-disk-disk_name, (int) count)); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, + sg_write: count=%d\n, (int) count)); if (atomic_read(sdp-detaching)) return -ENODEV; if (!((filp-f_flags O_NONBLOCK) || @@ -609,7 +615,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) return -EIO;/* The minimum scsi command length is 6 bytes. */ if (!(srp = sg_add_request(sfp))) { - SCSI_LOG_TIMEOUT(1, printk(sg_write: queue full\n)); + SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sdp, + sg_write: queue full\n)); return
Re: [PATCHv5 0/4] Support 64-bit LUNs
Thanks Hannes, I've applied this and the logging series to the core-for-3.17 branch. Note that I will still rebase this branch to deal with whatever feedback Rusty might have on the modparam changes. -- 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: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once
This one looks good to me, Reviewed-by: Maurizio Lombardi mlomb...@redhat.com On 06/25/2014 04:01 PM, Rickard Strandqvist wrote: A struct member variable is set to different values without having used in between. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/pm8001/pm80xx_hwi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index d70587f..2698227 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -249,7 +249,6 @@ moreData: sprintf(pm8001_ha- forensic_info.data_buf.direct_data, %08x , 4); - pm8001_ha-forensic_info.data_buf.read_len = 0x; pm8001_ha-forensic_info.data_buf.direct_len = 0; pm8001_ha-forensic_info.data_buf.direct_offset = 0; pm8001_ha-forensic_info.data_buf.read_len = 0; -- 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 34422] Error-valued pointers used in pointer arithmetic in SCSI
https://bugzilla.kernel.org/show_bug.cgi?id=34422 xerofo...@gmail.com changed: What|Removed |Added CC||xerofo...@gmail.com --- Comment #1 from xerofo...@gmail.com --- Please check this bug against a newer kernel to see if it's fixed. Cheers Nick -- 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 1/3] scsi_cmnd: Introduce scsi_transfer_length helper
On Jun 25, 2014, at 6:35 AM, Christoph Hellwig h...@infradead.org wrote: On Wed, Jun 25, 2014 at 01:32:39PM +0300, Sagi Grimberg wrote: So I tested a bidirectional command using: $ sg_raw --infile=/root/filex --send=1024 --request=1024 --outfile=/root/filex /dev/bsg/7:0:0:0 53 00 00 00 00 00 00 00 02 00 And I see: kernel: session1: iscsi_prep_scsi_cmd_pdu iscsi prep [bidirectional cid 0 sc 880468ca1e00 cdb 0x53 itt 0x16 len 1024 bidi_len 1024 cmdsn 223 win 64] This confirms what I wrote above, so AFAICT no additional fix is required for libiscsi wrt bidi commands support. Good to know. I'd really prefer just going with the fix from Martin that I have already queued up for 3.16, and then we can have the fully fledged out new scsi_transfer_length() for 3.17. I am fine with this too. I was way off track. I was more concerned with not wanting to use multiple functions/macros to get the transfer len. That should definitely be done when there is more time. -- 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: pm8001: pm80xx_hwi.c: Cleaning up variable is set more than once
Hi, On 06/25/2014 05:41 PM, Purush Gupta wrote: Its possible HW may require programming those fields? I'm looking at the code and it doesn't look so, did you see something suspicious? May be original contributor of the driver should review...No offense! I believe it requires the maintainer ACK and it takes precedence in any case, am I wrong? Regards, Maurizio Lombardi thanks, Purush On Wed, Jun 25, 2014 at 8:34 AM, Maurizio Lombardi mlomb...@redhat.com wrote: This one looks good to me, Reviewed-by: Maurizio Lombardi mlomb...@redhat.com On 06/25/2014 04:01 PM, Rickard Strandqvist wrote: A struct member variable is set to different values without having used in between. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/pm8001/pm80xx_hwi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index d70587f..2698227 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -249,7 +249,6 @@ moreData: sprintf(pm8001_ha- forensic_info.data_buf.direct_data, %08x , 4); - pm8001_ha-forensic_info.data_buf.read_len = 0x; pm8001_ha-forensic_info.data_buf.direct_len = 0; pm8001_ha-forensic_info.data_buf.direct_offset = 0; pm8001_ha-forensic_info.data_buf.read_len = 0; -- 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 -- 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/14] scsi: only maintain target_blocked if the driver has a target queue limit
This saves us an atomic operation for each I/O submission and completion for the usual case where the driver doesn't set a per-target can_queue value. Only a few iscsi hardware offload drivers set the per-target can_queue value at the moment. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a39d5ba..a64b9d3 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -295,7 +295,8 @@ void scsi_device_unbusy(struct scsi_device *sdev) unsigned long flags; atomic_dec(shost-host_busy); - atomic_dec(starget-target_busy); + if (starget-can_queue 0) + atomic_dec(starget-target_busy); if (unlikely(scsi_host_in_recovery(shost) (shost-host_failed || shost-host_eh_scheduled))) { @@ -1335,6 +1336,9 @@ static inline int scsi_target_queue_ready(struct Scsi_Host *shost, spin_unlock_irq(shost-host_lock); } + if (starget-can_queue = 0) + return 1; + busy = atomic_inc_return(starget-target_busy) - 1; if (busy == 0 atomic_read(starget-target_blocked) 0) { if (atomic_dec_return(starget-target_blocked) 0) @@ -1344,7 +1348,7 @@ static inline int scsi_target_queue_ready(struct Scsi_Host *shost, unblocking target at zero depth\n)); } - if (starget-can_queue 0 busy = starget-can_queue) + if (busy = starget-can_queue) goto starved; if (atomic_read(starget-target_blocked) 0) goto starved; @@ -1356,7 +1360,8 @@ starved: list_move_tail(sdev-starved_entry, shost-starved_list); spin_unlock_irq(shost-host_lock); out_dec: - atomic_dec(starget-target_busy); + if (starget-can_queue 0) + atomic_dec(starget-target_busy); return 0; } @@ -1473,7 +1478,8 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) */ atomic_inc(sdev-device_busy); atomic_inc(shost-host_busy); - atomic_inc(starget-target_busy); + if (starget-can_queue 0) + atomic_inc(starget-target_busy); blk_complete_request(req); } @@ -1642,7 +1648,8 @@ static void scsi_request_fn(struct request_queue *q) return; host_not_ready: - atomic_dec(scsi_target(sdev)-target_busy); + if (scsi_target(sdev)-can_queue 0) + atomic_dec(scsi_target(sdev)-target_busy); not_ready: /* * lock q, handle tag, requeue req, and decrement device_busy. We -- 1.7.10.4 -- 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
scsi-mq V2
This is the second post of the scsi-mq series. At this point the code is ready for merging and use by developers and early adopters. The core blk-mq code isn't that suitable for slow devices yet, mostly due to the lack of an I/O scheduler, but Jens is working on it. Similarly there is no dm-multipath support for drivers using blk-mq yet, but I'm working on it. It should also be noted that the code doesn't actually support multiple hardware queues or fine grained tuning of the blk-mq parameters yet. All these could be added fairly easily as soon as low-level drivers want to make use of them. The amount of chances to the existing code are fairly small, and mostly speedups or cleanups that also apply to the old path as well. Because of this I also haven't bothered to put it under a config option, just like the blk-mq core. The usage of blk-mq dramatically decreases CPU usage under all workloads going down from 100% CPU usage that the old setup can hit easily to usually less than 20% for maxing out storage subsystems with 512byte reads and writes, and it allows to easily archive millions of IOPS. Bart and Robert have helped with some very detailed measurements that they might be able to send in reply to this, although these usually involve significantly reworked low level drivers to avoid other bottle necks. One major objection to previous iterations of this code was the simple replacement of the host_lock with atomic counters for the host and busy counters. The host_lock avoidance on it's own already improves performance, and with the patch to avoid maintaining the per-target busy counter unless needed we now replace a lock round trip on the host_lock with just a single atomic increment in the submission path, and a single atomic decrement in completion path, which should provide benefits even for the oddest RISC architecture. Longer term I'd still love to get rid of these entirely and use the counters in blk-mq, but due to the difference in how they are maintained this doesn't seem feasible as long as we still need to support the legacy request code path. Changes from V1: - rebased on top of the core-for-3.17 branch, most notable the scsi logging changes - fixed handling of cmd_list to prevent crashes for some heavy workloads - fixed incorrect handling of !target-can_queue - avoid scheduling a workqueue on I/O completions when no queues are congested In addition to the patches in this thread there also is a git available at: git://git.infradead.org/users/hch/scsi.git scsi-mq.2 This work was sponsored by the ION division of Fusion IO. -- 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/14] scsi: push host_lock down into scsi_{host,target}_queue_ready
Prepare for not taking a host-wide lock in the dispatch path by pushing the lock down into the places that actually need it. Note that this patch is just a preparation step, as it will actually increase lock roundtrips and thus decrease performance on its own. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 75 --- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6989b6f..18e6449 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1300,18 +1300,18 @@ static inline int scsi_dev_queue_ready(struct request_queue *q, /* * scsi_target_queue_ready: checks if there we can send commands to target * @sdev: scsi device on starget to check. - * - * Called with the host lock held. */ static inline int scsi_target_queue_ready(struct Scsi_Host *shost, struct scsi_device *sdev) { struct scsi_target *starget = scsi_target(sdev); + int ret = 0; + spin_lock_irq(shost-host_lock); if (starget-single_lun) { if (starget-starget_sdev_user starget-starget_sdev_user != sdev) - return 0; + goto out; starget-starget_sdev_user = sdev; } @@ -1319,57 +1319,66 @@ static inline int scsi_target_queue_ready(struct Scsi_Host *shost, /* * unblock after target_blocked iterates to zero */ - if (--starget-target_blocked == 0) { - SCSI_LOG_MLQUEUE(3, starget_printk(KERN_INFO, starget, -unblocking target at zero depth\n)); - } else - return 0; + if (--starget-target_blocked != 0) + goto out; + + SCSI_LOG_MLQUEUE(3, starget_printk(KERN_INFO, starget, +unblocking target at zero depth\n)); } if (scsi_target_is_busy(starget)) { list_move_tail(sdev-starved_entry, shost-starved_list); - return 0; + goto out; } - return 1; + scsi_target(sdev)-target_busy++; + ret = 1; +out: + spin_unlock_irq(shost-host_lock); + return ret; } /* * scsi_host_queue_ready: if we can send requests to shost, return 1 else * return 0. We must end up running the queue again whenever 0 is * returned, else IO can hang. - * - * Called with host_lock held. */ static inline int scsi_host_queue_ready(struct request_queue *q, struct Scsi_Host *shost, struct scsi_device *sdev) { + int ret = 0; + + spin_lock_irq(shost-host_lock); + if (scsi_host_in_recovery(shost)) - return 0; + goto out; if (shost-host_busy == 0 shost-host_blocked) { /* * unblock after host_blocked iterates to zero */ - if (--shost-host_blocked == 0) { - SCSI_LOG_MLQUEUE(3, - shost_printk(KERN_INFO, shost, -unblocking host at zero depth\n)); - } else { - return 0; - } + if (--shost-host_blocked != 0) + goto out; + + SCSI_LOG_MLQUEUE(3, + shost_printk(KERN_INFO, shost, +unblocking host at zero depth\n)); } if (scsi_host_is_busy(shost)) { if (list_empty(sdev-starved_entry)) list_add_tail(sdev-starved_entry, shost-starved_list); - return 0; + goto out; } /* We're OK to process the command, so we can't be starved */ if (!list_empty(sdev-starved_entry)) list_del_init(sdev-starved_entry); - return 1; + shost-host_busy++; + ret = 1; +out: + spin_unlock_irq(shost-host_lock); + return ret; } /* @@ -1550,7 +1559,7 @@ static void scsi_request_fn(struct request_queue *q) blk_start_request(req); sdev-device_busy++; - spin_unlock(q-queue_lock); + spin_unlock_irq(q-queue_lock); cmd = req-special; if (unlikely(cmd == NULL)) { printk(KERN_CRIT impossible request in %s.\n @@ -1560,7 +1569,6 @@ static void scsi_request_fn(struct request_queue *q) blk_dump_rq_flags(req, foo); BUG(); } - spin_lock(shost-host_lock); /* * We hit this when the driver is using a host wide @@ -1571,9 +1579,11 @@ static void
[PATCH 14/14] fnic: reject device resets without assigned tags for the blk-mq case
Current the midlayer fakes up a struct request for the explicit reset ioctls, and those don't have a tag allocated to them. The fnic driver pokes into midlayer structures to paper over this design issue, but that won't work for the blk-mq case. Either someone who can actually test the hardware will have to come up with a similar hack for the blk-mq case, or we'll have to bite the bullet and fix the way the EH ioctls work for real, but until that happens we fail these explicit requests here. Signed-off-by: Christoph Hellwig h...@lst.de Cc: Hiral Patel hiral...@cisco.com Cc: Suma Ramars sram...@cisco.com Cc: Brian Uchino buch...@cisco.com --- drivers/scsi/fnic/fnic_scsi.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 3f88f56..961bdf5 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -2224,6 +2224,22 @@ int fnic_device_reset(struct scsi_cmnd *sc) tag = sc-request-tag; if (unlikely(tag 0)) { + /* +* XXX(hch): current the midlayer fakes up a struct +* request for the explicit reset ioctls, and those +* don't have a tag allocated to them. The below +* code pokes into midlayer structures to paper over +* this design issue, but that won't work for blk-mq. +* +* Either someone who can actually test the hardware +* will have to come up with a similar hack for the +* blk-mq case, or we'll have to bite the bullet and +* fix the way the EH ioctls work for real, but until +* that happens we fail these explicit requests here. +*/ + if (shost_use_blk_mq(sc-device-host)) + goto fnic_device_reset_end; + tag = fnic_scsi_host_start_tag(fnic, sc); if (unlikely(tag == SCSI_NO_TAG)) goto fnic_device_reset_end; -- 1.7.10.4 -- 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/14] scsi: add support for a blk-mq based I/O path.
This patch adds support for an alternate I/O path in the scsi midlayer which uses the blk-mq infrastructure instead of the legacy request code. Use of blk-mq is fully transparent to drivers, although for now a host template field is provided to opt out of blk-mq usage in case any unforseen incompatibilities arise. In general replacing the legacy request code with blk-mq is a simple and mostly mechanical transformation. The biggest exception is the new code that deals with the fact the I/O submissions in blk-mq must happen from process context, which slightly complicates the I/O completion handler. The second biggest differences is that blk-mq is build around the concept of preallocated requests that also include driver specific data, which in SCSI context means the scsi_cmnd structure. This completely avoids dynamic memory allocations for the fast path through I/O submission. Due the preallocated requests the MQ code path exclusively uses the host-wide shared tag allocator instead of a per-LUN one. This only affects drivers actually using the block layer provided tag allocator instead of their own. Unlike the old path blk-mq always provides a tag, although drivers don't have to use it. For now the blk-mq path is disable by defauly and must be enabled using the use_blk_mq module parameter. Once the remaining work in the block layer to make blk-mq more suitable for slow devices is complete I hope to make it the default and eventually even remove the old code path. Based on the earlier scsi-mq prototype by Nicholas Bellinger. Thanks to Bart Van Assche and Robert Elliot for testing, benchmarking and various sugestions and code contributions. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/hosts.c | 30 ++- drivers/scsi/scsi.c |5 +- drivers/scsi/scsi_lib.c | 475 +++-- drivers/scsi/scsi_priv.h |3 + drivers/scsi/scsi_scan.c |5 +- drivers/scsi/scsi_sysfs.c |2 + include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 28 ++- 8 files changed, 494 insertions(+), 72 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 0632eee..6322e6c 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -213,9 +213,24 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } + if (shost_use_blk_mq(shost)) { + error = scsi_mq_setup_tags(shost); + if (error) + goto fail; + } + + /* +* Note that we allocate the freelist even for the MQ case for now, +* as we need a command set aside for scsi_reset_provider. Having +* the full host freelist and one command available for that is a +* little heavy-handed, but avoids introducing a special allocator +* just for this. Eventually the structure of scsi_reset_provider +* will need a major overhaul. +*/ error = scsi_setup_command_freelist(shost); if (error) - goto fail; + goto out_destroy_tags; + if (!shost-shost_gendev.parent) shost-shost_gendev.parent = dev ? dev : platform_bus; @@ -226,7 +241,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, error = device_add(shost-shost_gendev); if (error) - goto out; + goto out_destroy_freelist; pm_runtime_set_active(shost-shost_gendev); pm_runtime_enable(shost-shost_gendev); @@ -279,8 +294,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, device_del(shost-shost_dev); out_del_gendev: device_del(shost-shost_gendev); - out: + out_destroy_freelist: scsi_destroy_command_freelist(shost); + out_destroy_tags: + if (shost_use_blk_mq(shost)) + scsi_mq_destroy_tags(shost); fail: return error; } @@ -309,7 +327,9 @@ static void scsi_host_dev_release(struct device *dev) } scsi_destroy_command_freelist(shost); - if (shost-bqt) + if (shost_use_blk_mq(shost) shost-tag_set.tags) + scsi_mq_destroy_tags(shost); + else if (shost-bqt) blk_free_tags(shost-bqt); kfree(shost-shost_data); @@ -436,6 +456,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) else shost-dma_boundary = 0x; + shost-use_blk_mq = scsi_use_blk_mq !shost-hostt-disable_blk_mq; + device_initialize(shost-shost_gendev); dev_set_name(shost-shost_gendev, host%d, shost-host_no); shost-shost_gendev.bus = scsi_bus_type; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index b362058..c089812 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -809,7 +809,7 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags) * is more IO
[PATCH 07/14] scsi: convert host_busy to atomic_t
Avoid taking the host-wide host_lock to check the per-host queue limit. Instead we do an atomic_inc_return early on to grab our slot in the queue, and if nessecary decrement it after finishing all checks. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/advansys.c |4 +- drivers/scsi/libiscsi.c |4 +- drivers/scsi/libsas/sas_scsi_host.c |5 ++- drivers/scsi/qlogicpti.c|2 +- drivers/scsi/scsi.c |2 +- drivers/scsi/scsi_error.c |7 ++-- drivers/scsi/scsi_lib.c | 71 +-- drivers/scsi/scsi_sysfs.c |9 - include/scsi/scsi_host.h| 10 ++--- 9 files changed, 66 insertions(+), 48 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index e716d0a..43761c1 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -2512,7 +2512,7 @@ static void asc_prt_scsi_host(struct Scsi_Host *s) printk(Scsi_Host at addr 0x%p, device %s\n, s, dev_name(boardp-dev)); printk( host_busy %u, host_no %d,\n, - s-host_busy, s-host_no); + atomic_read(s-host_busy), s-host_no); printk( base 0x%lx, io_port 0x%lx, irq %d,\n, (ulong)s-base, (ulong)s-io_port, boardp-irq); @@ -3346,7 +3346,7 @@ static void asc_prt_driver_conf(struct seq_file *m, struct Scsi_Host *shost) seq_printf(m, host_busy %u, max_id %u, max_lun %llu, max_channel %u\n, - shost-host_busy, shost-max_id, + atomic_read(shost-host_busy), shost-max_id, shost-max_lun, shost-max_channel); seq_printf(m, diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index f2db82b..f9f3a12 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2971,7 +2971,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) */ for (;;) { spin_lock_irqsave(session-host-host_lock, flags); - if (!session-host-host_busy) { /* OK for ERL == 0 */ + if (!atomic_read(session-host-host_busy)) { /* OK for ERL == 0 */ spin_unlock_irqrestore(session-host-host_lock, flags); break; } @@ -2979,7 +2979,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) msleep_interruptible(500); iscsi_conn_printk(KERN_INFO, conn, iscsi conn_destroy(): host_busy %d host_failed %d\n, - session-host-host_busy, + atomic_read(session-host-host_busy), session-host-host_failed); /* * force eh_abort() to unblock diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 7d02a19..24e477d 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -813,7 +813,7 @@ retry: spin_unlock_irq(shost-host_lock); SAS_DPRINTK(Enter %s busy: %d failed: %d\n, - __func__, shost-host_busy, shost-host_failed); + __func__, atomic_read(shost-host_busy), shost-host_failed); /* * Deal with commands that still have SAS tasks (i.e. they didn't * complete via the normal sas_task completion mechanism), @@ -858,7 +858,8 @@ out: goto retry; SAS_DPRINTK(--- Exit %s: busy: %d failed: %d tries: %d\n, - __func__, shost-host_busy, shost-host_failed, tries); + __func__, atomic_read(shost-host_busy), + shost-host_failed, tries); } enum blk_eh_timer_return sas_scsi_timed_out(struct scsi_cmnd *cmd) diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 6d48d30..740ae49 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -959,7 +959,7 @@ static inline void update_can_queue(struct Scsi_Host *host, u_int in_ptr, u_int /* Temporary workaround until bug is found and fixed (one bug has been found already, but fixing it makes things even worse) -jj */ int num_free = QLOGICPTI_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr) - 64; - host-can_queue = host-host_busy + num_free; + host-can_queue = atomic_read(host-host_busy) + num_free; host-sg_tablesize = QLOGICPTI_MAX_SG(num_free); } diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index d3bd6cf..35a23e2 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -603,7 +603,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) if (level 3) scmd_printk(KERN_INFO, cmd, scsi host busy %d failed %d\n, - cmd-device-host-host_busy,
[PATCH 12/14] scatterlist: allow chaining to preallocated chunks
Blk-mq drivers usually preallocate their S/G list as part of the request, but if we want to support the very large S/G lists currently supported by the SCSI code that would tie up a lot of memory in the preallocated request pool. Add support to the scatterlist code so that it can initialize a S/G list that uses a preallocated first chunks and dynamically allocated additional chunks. That way the scsi-mq code can preallocate a first page worth of S/G entries as part of the request, and dynamically extent the S/G list when needed. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 16 +++- include/linux/scatterlist.h |6 +++--- lib/scatterlist.c | 24 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 58534fd..900b1c0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -567,6 +567,11 @@ static struct scatterlist *scsi_sg_alloc(unsigned int nents, gfp_t gfp_mask) return mempool_alloc(sgp-pool, gfp_mask); } +static void scsi_free_sgtable(struct scsi_data_buffer *sdb) +{ + __sg_free_table(sdb-table, SCSI_MAX_SG_SEGMENTS, false, scsi_sg_free); +} + static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, gfp_t gfp_mask) { @@ -575,19 +580,12 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, BUG_ON(!nents); ret = __sg_alloc_table(sdb-table, nents, SCSI_MAX_SG_SEGMENTS, - gfp_mask, scsi_sg_alloc); + NULL, gfp_mask, scsi_sg_alloc); if (unlikely(ret)) - __sg_free_table(sdb-table, SCSI_MAX_SG_SEGMENTS, - scsi_sg_free); - + scsi_free_sgtable(sdb); return ret; } -static void scsi_free_sgtable(struct scsi_data_buffer *sdb) -{ - __sg_free_table(sdb-table, SCSI_MAX_SG_SEGMENTS, scsi_sg_free); -} - /* * Function:scsi_release_buffers() * diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index a964f72..f4ec8bb 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -229,10 +229,10 @@ void sg_init_one(struct scatterlist *, const void *, unsigned int); typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t); typedef void (sg_free_fn)(struct scatterlist *, unsigned int); -void __sg_free_table(struct sg_table *, unsigned int, sg_free_fn *); +void __sg_free_table(struct sg_table *, unsigned int, bool, sg_free_fn *); void sg_free_table(struct sg_table *); -int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t, -sg_alloc_fn *); +int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, +struct scatterlist *, gfp_t, sg_alloc_fn *); int sg_alloc_table(struct sg_table *, unsigned int, gfp_t); int sg_alloc_table_from_pages(struct sg_table *sgt, struct page **pages, unsigned int n_pages, diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 3a8e8e8..48c15d2 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -165,6 +165,7 @@ static void sg_kfree(struct scatterlist *sg, unsigned int nents) * __sg_free_table - Free a previously mapped sg table * @table: The sg table header to use * @max_ents: The maximum number of entries per single scatterlist + * @skip_first_chunk: don't free the (preallocated) first scatterlist chunk * @free_fn: Free function * * Description: @@ -174,7 +175,7 @@ static void sg_kfree(struct scatterlist *sg, unsigned int nents) * **/ void __sg_free_table(struct sg_table *table, unsigned int max_ents, -sg_free_fn *free_fn) +bool skip_first_chunk, sg_free_fn *free_fn) { struct scatterlist *sgl, *next; @@ -202,7 +203,9 @@ void __sg_free_table(struct sg_table *table, unsigned int max_ents, } table-orig_nents -= sg_size; - free_fn(sgl, alloc_size); + if (!skip_first_chunk) + free_fn(sgl, alloc_size); + skip_first_chunk = false; sgl = next; } @@ -217,7 +220,7 @@ EXPORT_SYMBOL(__sg_free_table); **/ void sg_free_table(struct sg_table *table) { - __sg_free_table(table, SG_MAX_SINGLE_ALLOC, sg_kfree); + __sg_free_table(table, SG_MAX_SINGLE_ALLOC, false, sg_kfree); } EXPORT_SYMBOL(sg_free_table); @@ -241,8 +244,8 @@ EXPORT_SYMBOL(sg_free_table); * **/ int __sg_alloc_table(struct sg_table *table, unsigned int nents, -unsigned int max_ents, gfp_t gfp_mask, -sg_alloc_fn *alloc_fn) +unsigned int max_ents, struct scatterlist *first_chunk, +gfp_t gfp_mask, sg_alloc_fn *alloc_fn) { struct scatterlist *sg, *prv; unsigned int left; @@ -269,7 +272,12 @@ int
[PATCH 09/14] scsi: fix the {host,target,device}_blocked counter mess
Seems like these counters are missing any sort of synchronization for updates, as a over 10 year old comment from me noted. Fix this by using atomic counters, and while we're at it also make sure they are in the same cacheline as the _busy counters and not needlessly stored to in every I/O completion. With the new model the _busy counters can temporarily go negative, so all the readers are updated to check for 0 values. Longer term every successful I/O completion will reset the counters to zero, so the temporarily negative values will not cause any harm. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi.c| 21 ++-- drivers/scsi/scsi_lib.c| 82 +--- drivers/scsi/scsi_sysfs.c | 10 +- include/scsi/scsi_device.h |7 ++-- include/scsi/scsi_host.h |7 ++-- 5 files changed, 64 insertions(+), 63 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 35a23e2..b362058 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -729,17 +729,16 @@ void scsi_finish_command(struct scsi_cmnd *cmd) scsi_device_unbusy(sdev); -/* - * Clear the flags which say that the device/host is no longer - * capable of accepting new commands. These are set in scsi_queue.c - * for both the queue full condition on a device, and for a - * host full condition on the host. -* -* XXX(hch): What about locking? - */ -shost-host_blocked = 0; - starget-target_blocked = 0; -sdev-device_blocked = 0; + /* +* Clear the flags which say that the device/target/host is no longer +* capable of accepting new commands. +*/ + if (atomic_read(shost-host_blocked)) + atomic_set(shost-host_blocked, 0); + if (atomic_read(starget-target_blocked)) + atomic_set(starget-target_blocked, 0); + if (atomic_read(sdev-device_blocked)) + atomic_set(sdev-device_blocked, 0); /* * If we have valid sense information, then some kind of recovery diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e23fef5..a39d5ba 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -99,14 +99,16 @@ scsi_set_blocked(struct scsi_cmnd *cmd, int reason) */ switch (reason) { case SCSI_MLQUEUE_HOST_BUSY: - host-host_blocked = host-max_host_blocked; + atomic_set(host-host_blocked, host-max_host_blocked); break; case SCSI_MLQUEUE_DEVICE_BUSY: case SCSI_MLQUEUE_EH_RETRY: - device-device_blocked = device-max_device_blocked; + atomic_set(device-device_blocked, + device-max_device_blocked); break; case SCSI_MLQUEUE_TARGET_BUSY: - starget-target_blocked = starget-max_target_blocked; + atomic_set(starget-target_blocked, + starget-max_target_blocked); break; } } @@ -351,30 +353,39 @@ static void scsi_single_lun_run(struct scsi_device *current_sdev) spin_unlock_irqrestore(shost-host_lock, flags); } -static inline int scsi_device_is_busy(struct scsi_device *sdev) +static inline bool scsi_device_is_busy(struct scsi_device *sdev) { if (atomic_read(sdev-device_busy) = sdev-queue_depth) - return 1; - if (sdev-device_blocked) - return 1; + return true; + if (atomic_read(sdev-device_blocked) 0) + return true; return 0; } -static inline int scsi_target_is_busy(struct scsi_target *starget) +static inline bool scsi_target_is_busy(struct scsi_target *starget) { - return ((starget-can_queue 0 -atomic_read(starget-target_busy) = starget-can_queue) || -starget-target_blocked); + if (starget-can_queue 0) { + if (atomic_read(starget-target_busy) = starget-can_queue) + return true; + if (atomic_read(starget-target_blocked) 0) + return true; + } + + return false; } -static inline int scsi_host_is_busy(struct Scsi_Host *shost) +static inline bool scsi_host_is_busy(struct Scsi_Host *shost) { - if ((shost-can_queue 0 -atomic_read(shost-host_busy) = shost-can_queue) || - shost-host_blocked || shost-host_self_blocked) - return 1; + if (shost-can_queue 0) { + if (atomic_read(shost-host_busy) = shost-can_queue) + return true; + if (atomic_read(shost-host_blocked) 0) + return true; + if (shost-host_self_blocked) + return true; + } - return 0; + return false; } static void scsi_starved_list_run(struct Scsi_Host *shost) @@
[PATCH 11/14] scsi: unwind blk_end_request_all and blk_end_request_err calls
Replace the calls to the various blk_end_request variants with opencode equivalents. Blk-mq is using a model that gives the driver control between the bio updates and the actual completion, and making the old code follow that same model allows us to keep the code more similar for both pathes. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 61 --- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index a64b9d3..58534fd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -625,6 +625,37 @@ static void scsi_release_bidi_buffers(struct scsi_cmnd *cmd) cmd-request-next_rq-special = NULL; } +static bool scsi_end_request(struct request *req, int error, + unsigned int bytes, unsigned int bidi_bytes) +{ + struct scsi_cmnd *cmd = req-special; + struct scsi_device *sdev = cmd-device; + struct request_queue *q = sdev-request_queue; + unsigned long flags; + + + if (blk_update_request(req, error, bytes)) + return true; + + /* Bidi request must be completed as a whole */ + if (unlikely(bidi_bytes) + blk_update_request(req-next_rq, error, bidi_bytes)) + return true; + + if (blk_queue_add_random(q)) + add_disk_randomness(req-rq_disk); + + spin_lock_irqsave(q-queue_lock, flags); + blk_finish_request(req, error); + spin_unlock_irqrestore(q-queue_lock, flags); + + if (bidi_bytes) + scsi_release_bidi_buffers(cmd); + scsi_release_buffers(cmd); + scsi_next_command(cmd); + return false; +} + /** * __scsi_error_from_host_byte - translate SCSI error code into errno * @cmd: SCSI command (unused) @@ -697,7 +728,7 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) *be put back on the queue and retried using the same *command as before, possibly after a delay. * - * c) We can call blk_end_request() with -EIO to fail + * c) We can call scsi_end_request() with -EIO to fail *the remainder of the request. */ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) @@ -749,13 +780,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) * both sides at once. */ req-next_rq-resid_len = scsi_in(cmd)-resid; - - scsi_release_buffers(cmd); - scsi_release_bidi_buffers(cmd); - - blk_end_request_all(req, 0); - - scsi_next_command(cmd); + if (scsi_end_request(req, 0, blk_rq_bytes(req), + blk_rq_bytes(req-next_rq))) + BUG(); return; } } @@ -794,15 +821,16 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) /* * If we finished all bytes in the request we are done now. */ - if (!blk_end_request(req, error, good_bytes)) - goto next_command; + if (!scsi_end_request(req, error, good_bytes, 0)) + return; /* * Kill remainder if no retrys. */ if (error scsi_noretry_cmd(cmd)) { - blk_end_request_all(req, error); - goto next_command; + if (scsi_end_request(req, error, blk_rq_bytes(req), 0)) + BUG(); + return; } /* @@ -947,8 +975,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) scsi_print_sense(, cmd); scsi_print_command(cmd); } - if (!blk_end_request_err(req, error)) - goto next_command; + if (!scsi_end_request(req, error, blk_rq_err_bytes(req), 0)) + return; /*FALLTHRU*/ case ACTION_REPREP: requeue: @@ -967,11 +995,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) __scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY, 0); break; } - return; - -next_command: - scsi_release_buffers(cmd); - scsi_next_command(cmd); } static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, -- 1.7.10.4 -- 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 03/14] scsi: centralize command re-queueing in scsi_dispatch_fn
Make sure we only have the logic for requeing commands in one place. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi.c | 35 --- drivers/scsi/scsi_lib.c |9 ++--- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index ce5b4e5..dcc43fd 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -648,9 +648,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) * returns an immediate error upwards, and signals * that the device is no longer present */ cmd-result = DID_NO_CONNECT 16; - scsi_done(cmd); - /* return 0 (because the command has been processed) */ - goto out; + goto done; } /* Check to see if the scsi lld made this device blocked. */ @@ -662,17 +660,9 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) * occur until the device transitions out of the * suspend state. */ - - scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY); - SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, queuecommand : device blocked\n)); - - /* -* NOTE: rtn is still zero here because we don't need the -* queue to be plugged on return (it's already stopped) -*/ - goto out; + return SCSI_MLQUEUE_DEVICE_BUSY; } /* @@ -696,20 +686,19 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) cdb_size=%d host-max_cmd_len=%d\n, cmd-cmd_len, cmd-device-host-max_cmd_len)); cmd-result = (DID_ABORT 16); - - scsi_done(cmd); - goto out; + goto done; } if (unlikely(host-shost_state == SHOST_DEL)) { cmd-result = (DID_NO_CONNECT 16); - scsi_done(cmd); - } else { - trace_scsi_dispatch_cmd_start(cmd); - cmd-scsi_done = scsi_done; - rtn = host-hostt-queuecommand(host, cmd); + goto done; + } + trace_scsi_dispatch_cmd_start(cmd); + + cmd-scsi_done = scsi_done; + rtn = host-hostt-queuecommand(host, cmd); if (rtn) { trace_scsi_dispatch_cmd_error(cmd, rtn); if (rtn != SCSI_MLQUEUE_DEVICE_BUSY @@ -718,12 +707,12 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, queuecommand : request rejected\n)); - - scsi_queue_insert(cmd, rtn); } - out: return rtn; + done: + scsi_done(cmd); + return 0; } /** diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2667c75..63bf844 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1583,9 +1583,12 @@ static void scsi_request_fn(struct request_queue *q) * Dispatch the command to the low-level driver. */ rtn = scsi_dispatch_cmd(cmd); - spin_lock_irq(q-queue_lock); - if (rtn) + if (rtn) { + scsi_queue_insert(cmd, rtn); + spin_lock_irq(q-queue_lock); goto out_delay; + } + spin_lock_irq(q-queue_lock); } return; @@ -1605,7 +1608,7 @@ static void scsi_request_fn(struct request_queue *q) blk_requeue_request(q, req); sdev-device_busy--; out_delay: - if (sdev-device_busy == 0) + if (sdev-device_busy == 0 !scsi_device_blocked(sdev)) blk_delay_queue(q, SCSI_QUEUE_DELAY); } -- 1.7.10.4 -- 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/14] scsi: set -scsi_done before calling scsi_dispatch_cmd
The blk-mq code path will set this to a different function, so make the code simpler by setting it up in a legacy-request specific place. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi.c | 23 +-- drivers/scsi/scsi_lib.c | 20 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index dcc43fd..d3bd6cf 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -72,8 +72,6 @@ #define CREATE_TRACE_POINTS #include trace/events/scsi.h -static void scsi_done(struct scsi_cmnd *cmd); - /* * Definitions and constants. */ @@ -696,8 +694,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) } trace_scsi_dispatch_cmd_start(cmd); - - cmd-scsi_done = scsi_done; rtn = host-hostt-queuecommand(host, cmd); if (rtn) { trace_scsi_dispatch_cmd_error(cmd, rtn); @@ -711,28 +707,11 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) return rtn; done: - scsi_done(cmd); + cmd-scsi_done(cmd); return 0; } /** - * scsi_done - Invoke completion on finished SCSI command. - * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives - * ownership back to SCSI Core -- i.e. the LLDD has finished with it. - * - * Description: This function is the mid-level's (SCSI Core) interrupt routine, - * which regains ownership of the SCSI command (de facto) from a LLDD, and - * calls blk_complete_request() for further processing. - * - * This function is interrupt context safe. - */ -static void scsi_done(struct scsi_cmnd *cmd) -{ - trace_scsi_dispatch_cmd_done(cmd); - blk_complete_request(cmd-request); -} - -/** * scsi_finish_command - cleanup and pass command back to upper layer * @cmd: the command * diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 63bf844..6989b6f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -29,6 +29,8 @@ #include scsi/scsi_eh.h #include scsi/scsi_host.h +#include trace/events/scsi.h + #include scsi_priv.h #include scsi_logging.h @@ -1480,6 +1482,23 @@ static void scsi_softirq_done(struct request *rq) } } +/** + * scsi_done - Invoke completion on finished SCSI command. + * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives + * ownership back to SCSI Core -- i.e. the LLDD has finished with it. + * + * Description: This function is the mid-level's (SCSI Core) interrupt routine, + * which regains ownership of the SCSI command (de facto) from a LLDD, and + * calls blk_complete_request() for further processing. + * + * This function is interrupt context safe. + */ +static void scsi_done(struct scsi_cmnd *cmd) +{ + trace_scsi_dispatch_cmd_done(cmd); + blk_complete_request(cmd-request); +} + /* * Function:scsi_request_fn() * @@ -1582,6 +1601,7 @@ static void scsi_request_fn(struct request_queue *q) /* * Dispatch the command to the low-level driver. */ + cmd-scsi_done = scsi_done; rtn = scsi_dispatch_cmd(cmd); if (rtn) { scsi_queue_insert(cmd, rtn); -- 1.7.10.4 -- 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/14] scsi: split __scsi_queue_insert
Factor out a helper to set the _blocked values, which we'll reuse for the blk-mq code path. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c | 44 ++-- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d5d22e4..2667c75 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -75,28 +75,12 @@ struct kmem_cache *scsi_sdb_cache; */ #define SCSI_QUEUE_DELAY 3 -/** - * __scsi_queue_insert - private queue insertion - * @cmd: The SCSI command being requeued - * @reason: The reason for the requeue - * @unbusy: Whether the queue should be unbusied - * - * This is a private queue insertion. The public interface - * scsi_queue_insert() always assumes the queue should be unbusied - * because it's always called before the completion. This function is - * for a requeue after completion, which should only occur in this - * file. - */ -static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy) +static void +scsi_set_blocked(struct scsi_cmnd *cmd, int reason) { struct Scsi_Host *host = cmd-device-host; struct scsi_device *device = cmd-device; struct scsi_target *starget = scsi_target(device); - struct request_queue *q = device-request_queue; - unsigned long flags; - - SCSI_LOG_MLQUEUE(1, scmd_printk(KERN_INFO, cmd, - Inserting command %p into mlqueue\n, cmd)); /* * Set the appropriate busy bit for the device/host. @@ -123,6 +107,30 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy) starget-target_blocked = starget-max_target_blocked; break; } +} + +/** + * __scsi_queue_insert - private queue insertion + * @cmd: The SCSI command being requeued + * @reason: The reason for the requeue + * @unbusy: Whether the queue should be unbusied + * + * This is a private queue insertion. The public interface + * scsi_queue_insert() always assumes the queue should be unbusied + * because it's always called before the completion. This function is + * for a requeue after completion, which should only occur in this + * file. + */ +static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy) +{ + struct scsi_device *device = cmd-device; + struct request_queue *q = device-request_queue; + unsigned long flags; + + SCSI_LOG_MLQUEUE(1, scmd_printk(KERN_INFO, cmd, + Inserting command %p into mlqueue\n, cmd)); + + scsi_set_blocked(cmd, reason); /* * Decrement the counters, since these commands are no longer -- 1.7.10.4 -- 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/14] scsi: convert target_busy to an atomic_t
Avoid taking the host-wide host_lock to check the per-target queue limit. Instead we do an atomic_inc_return early on to grab our slot in the queue, and if nessecary decrement it after finishing all checks. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/scsi_lib.c| 52 ++-- include/scsi/scsi_device.h |4 ++-- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 18e6449..5e269d6 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -294,7 +294,7 @@ void scsi_device_unbusy(struct scsi_device *sdev) spin_lock_irqsave(shost-host_lock, flags); shost-host_busy--; - starget-target_busy--; + atomic_dec(starget-target_busy); if (unlikely(scsi_host_in_recovery(shost) (shost-host_failed || shost-host_eh_scheduled))) scsi_eh_wakeup(shost); @@ -361,7 +361,7 @@ static inline int scsi_device_is_busy(struct scsi_device *sdev) static inline int scsi_target_is_busy(struct scsi_target *starget) { return ((starget-can_queue 0 -starget-target_busy = starget-can_queue) || +atomic_read(starget-target_busy) = starget-can_queue) || starget-target_blocked); } @@ -1305,37 +1305,49 @@ static inline int scsi_target_queue_ready(struct Scsi_Host *shost, struct scsi_device *sdev) { struct scsi_target *starget = scsi_target(sdev); - int ret = 0; + unsigned int busy; - spin_lock_irq(shost-host_lock); if (starget-single_lun) { + spin_lock_irq(shost-host_lock); if (starget-starget_sdev_user - starget-starget_sdev_user != sdev) - goto out; + starget-starget_sdev_user != sdev) { + spin_unlock_irq(shost-host_lock); + return 0; + } starget-starget_sdev_user = sdev; + spin_unlock_irq(shost-host_lock); } - if (starget-target_busy == 0 starget-target_blocked) { + busy = atomic_inc_return(starget-target_busy) - 1; + if (busy == 0 starget-target_blocked) { /* * unblock after target_blocked iterates to zero */ - if (--starget-target_blocked != 0) - goto out; + spin_lock_irq(shost-host_lock); + if (--starget-target_blocked != 0) { + spin_unlock_irq(shost-host_lock); + goto out_dec; + } + spin_unlock_irq(shost-host_lock); SCSI_LOG_MLQUEUE(3, starget_printk(KERN_INFO, starget, unblocking target at zero depth\n)); } - if (scsi_target_is_busy(starget)) { - list_move_tail(sdev-starved_entry, shost-starved_list); - goto out; - } + if (starget-can_queue 0 busy = starget-can_queue) + goto starved; + if (starget-target_blocked) + goto starved; - scsi_target(sdev)-target_busy++; - ret = 1; -out: + return 1; + +starved: + spin_lock_irq(shost-host_lock); + list_move_tail(sdev-starved_entry, shost-starved_list); spin_unlock_irq(shost-host_lock); - return ret; +out_dec: + atomic_dec(starget-target_busy); + return 0; } /* @@ -1445,7 +1457,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) spin_unlock(sdev-request_queue-queue_lock); spin_lock(shost-host_lock); shost-host_busy++; - starget-target_busy++; + atomic_inc(starget-target_busy); spin_unlock(shost-host_lock); spin_lock(sdev-request_queue-queue_lock); @@ -1615,9 +1627,7 @@ static void scsi_request_fn(struct request_queue *q) return; host_not_ready: - spin_lock_irq(shost-host_lock); - scsi_target(sdev)-target_busy--; - spin_unlock_irq(shost-host_lock); + atomic_dec(scsi_target(sdev)-target_busy); not_ready: /* * lock q, handle tag, requeue req, and decrement device_busy. We diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 816e8a2..446f741 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -290,8 +290,8 @@ struct scsi_target { unsigned intexpecting_lun_change:1; /* A device has reported * a 3F/0E UA, other devices on * the same target will also. */ - /* commands actually active on LLD. protected by host lock. */ - unsigned inttarget_busy; + /* commands actually active on LLD. */ + atomic_ttarget_busy;
[PATCH 08/14] scsi: convert device_busy to atomic_t
Avoid taking the queue_lock to check the per-device queue limit. Instead we do an atomic_inc_return early on to grab our slot in the queue, and if nessecary decrement it after finishing all checks. Unlike the host and target busy counters this doesn't allow us to avoid the queue_lock in the request_fn due to the way the interface works, but it'll allow us to prepare for using the blk-mq code, which doesn't use the queue_lock at all, and it at least avoids a queue_lock rountrip in scsi_device_unbusy, which is still important given how busy the queue_lock is. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/message/fusion/mptsas.c |2 +- drivers/scsi/scsi_lib.c | 50 ++- drivers/scsi/scsi_sysfs.c | 10 +++- drivers/scsi/sg.c |2 +- include/scsi/scsi_device.h |4 +--- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 711fcb5..d636dbe 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -3763,7 +3763,7 @@ mptsas_send_link_status_event(struct fw_event_work *fw_event) printk(MYIOC_s_DEBUG_FMT SDEV OUTSTANDING CMDS %d\n, ioc-name, - sdev-device_busy)); + atomic_read(sdev-device_busy))); } } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 5d37d79..e23fef5 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -302,9 +302,7 @@ void scsi_device_unbusy(struct scsi_device *sdev) spin_unlock_irqrestore(shost-host_lock, flags); } - spin_lock_irqsave(sdev-request_queue-queue_lock, flags); - sdev-device_busy--; - spin_unlock_irqrestore(sdev-request_queue-queue_lock, flags); + atomic_dec(sdev-device_busy); } /* @@ -355,9 +353,10 @@ static void scsi_single_lun_run(struct scsi_device *current_sdev) static inline int scsi_device_is_busy(struct scsi_device *sdev) { - if (sdev-device_busy = sdev-queue_depth || sdev-device_blocked) + if (atomic_read(sdev-device_busy) = sdev-queue_depth) + return 1; + if (sdev-device_blocked) return 1; - return 0; } @@ -1224,7 +1223,7 @@ scsi_prep_return(struct request_queue *q, struct request *req, int ret) * queue must be restarted, so we schedule a callback to happen * shortly. */ - if (sdev-device_busy == 0) + if (atomic_read(sdev-device_busy) == 0) blk_delay_queue(q, SCSI_QUEUE_DELAY); break; default: @@ -1281,26 +1280,32 @@ static void scsi_unprep_fn(struct request_queue *q, struct request *req) static inline int scsi_dev_queue_ready(struct request_queue *q, struct scsi_device *sdev) { - if (sdev-device_busy == 0 sdev-device_blocked) { + unsigned int busy; + + busy = atomic_inc_return(sdev-device_busy) - 1; + if (busy == 0 sdev-device_blocked) { /* * unblock after device_blocked iterates to zero */ - if (--sdev-device_blocked == 0) { - SCSI_LOG_MLQUEUE(3, - sdev_printk(KERN_INFO, sdev, - unblocking device at zero depth\n)); - } else { + if (--sdev-device_blocked != 0) { blk_delay_queue(q, SCSI_QUEUE_DELAY); - return 0; + goto out_dec; } + SCSI_LOG_MLQUEUE(3, sdev_printk(KERN_INFO, sdev, + unblocking device at zero depth\n)); } - if (scsi_device_is_busy(sdev)) - return 0; + + if (busy = sdev-queue_depth) + goto out_dec; + if (sdev-device_blocked) + goto out_dec; return 1; +out_dec: + atomic_dec(sdev-device_busy); + return 0; } - /* * scsi_target_queue_ready: checks if there we can send commands to target * @sdev: scsi device on starget to check. @@ -1470,7 +1475,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q) * bump busy counts. To bump the counters, we need to dance * with the locks as normal issue path does. */ - sdev-device_busy++; + atomic_inc(sdev-device_busy); atomic_inc(shost-host_busy); atomic_inc(starget-target_busy); @@ -1566,7 +1571,7 @@ static void scsi_request_fn(struct request_queue *q) * accept it. */
[PATCH 01/14] sd: don't use rq-cmd_len before setting it up
Unlike the old request code blk-mq doesn't initialize cmd_len with a default value, so don't rely on it being set in sd_setup_write_same_cmnd. Signed-off-by: Christoph Hellwig h...@lst.de --- drivers/scsi/sd.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9c86e3d..6ec4ffe 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -824,15 +824,16 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) rq-__data_len = sdp-sector_size; rq-timeout = SD_WRITE_SAME_TIMEOUT; - memset(rq-cmd, 0, rq-cmd_len); if (sdkp-ws16 || sector 0x || nr_sectors 0x) { rq-cmd_len = 16; + memset(rq-cmd, 0, rq-cmd_len); rq-cmd[0] = WRITE_SAME_16; put_unaligned_be64(sector, rq-cmd[2]); put_unaligned_be32(nr_sectors, rq-cmd[10]); } else { rq-cmd_len = 10; + memset(rq-cmd, 0, rq-cmd_len); rq-cmd[0] = WRITE_SAME; put_unaligned_be32(sector, rq-cmd[2]); put_unaligned_be16(nr_sectors, rq-cmd[7]); -- 1.7.10.4 -- 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: [regression] fix 32-bit breakage in block device read(2) (was Re: 32-bit bug in iovec iterator changes)
Al, just checking - did you expect me to take this from the email, or are you preparing a pull request? Linus On Mon, Jun 23, 2014 at 12:44 AM, Al Viro v...@zeniv.linux.org.uk wrote: OK, here it is, hopefully with sufficient comments: -- 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] sg: limit maximum cdb size to 252 bytes
Boaz Harrosh commented on the [PATCH v5] sg: relax 16 byte cdb restriction thread that SCSI variable length commands (which are all SCSI commands greater than 16 bytes long) must themselves be a multiple of 4 bytes long. ChangeLog - limit the maximum cdb size permitted by the sg v3 interface to 252 bytes. Commands that large are called variable length and their length needs to be a multiple of 4. Original patch: Reviewed-by: Boaz Harrosh b...@electrozaur.com Signed-off-by: Douglas Gilbert dgilb...@interlog.com diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index b6d183a..2e01a9d 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -74,9 +74,10 @@ static void sg_proc_cleanup(void); #define SG_MAX_DEVS 32768 /* SG_MAX_CDB_SIZE should be 260 (spc4r37 section 3.1.30) however the type - * of sg_io_hdr::cmd_len can only represent 255 + * of sg_io_hdr::cmd_len can only represent 255. All SCSI commands greater + * than 16 bytes are variable length whose length is a multiple of 4 */ -#define SG_MAX_CDB_SIZE 255 +#define SG_MAX_CDB_SIZE 252 /* * Suppose you want to calculate the formula muldiv(x,m,d)=int(x * m / d)
Re: [PATCH] scsi: bnx2i: bnx2i_iscsi.c: Cleaning up variable is set more than once
On Wed, 2014-06-25 at 16:26 +0200, Maurizio Lombardi wrote: Hi, On 06/25/2014 04:04 PM, Rickard Strandqvist wrote: A struct member variable is set to different values without having used in between. This was found using a static code analysis program called cppcheck Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se --- drivers/scsi/bnx2i/bnx2i_iscsi.c |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 166543f..fdf7bc3 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1643,7 +1643,6 @@ static void bnx2i_conn_get_stats(struct iscsi_cls_conn *cls_conn, stats-r2t_pdus = conn-r2t_pdus_cnt; stats-tmfcmd_pdus = conn-tmfcmd_pdus_cnt; stats-tmfrsp_pdus = conn-tmfrsp_pdus_cnt; - stats-custom_length = 3; strcpy(stats-custom[2].desc, eh_abort_cnt); stats-custom[2].value = conn-eh_abort_cnt; stats-digest_err = 0; Eddie, The code modifies the content of stats-custom[2], so shouldn't custom_length be set to 3? Why is it set to zero at the end of this function? Nice find. This is literally a day1 bug. Yes, I agree that the custom_length should be left at 3. Otherwise, the nlmsg replied back to the application would not have the custom message. Thanks. Regards, Maurizio Lombardi -- 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] scsi_lib: removes ambiguous Unhandled error code messages.
On 06/06/2014 03:10 AM, Maurizio Lombardi wrote: During IO with fabric faults, one generally sees several Unhandled error code messages in the syslog as shown below: sd 4:0:6:2: [sdbw] Unhandled error code sd 4:0:6:2: [sdbw] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK sd 4:0:6:2: [sdbw] CDB: Read(10): 28 00 00 00 00 00 00 00 08 00 end_request: I/O error, dev sdbw, sector 0 This comes from scsi_io_completion (in scsi_lib.c) while handling error codes other than DID_RESET or not deferred sense keys i.e. this is actually handled by the SCSI mid layer. But what gets displayed here is Unhandled error code which is quite misleading as it indicates something that is not addressed by the mid layer. This patch removes Unhandled error code and replaces Unhandled sense code with Failing command with sense code:. Signed-off-by: Maurizio Lombardi mlomb...@redhat.com --- drivers/scsi/scsi_lib.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9db097a..b3c25cd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -955,14 +955,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) action = ACTION_FAIL; break; default: - description = Unhandled sense code; + description = Failing command with sense code:; action = ACTION_FAIL; break; } - } else { - description = Unhandled error code; + } else action = ACTION_FAIL; - } if (action != ACTION_FAIL time_before(cmd-jiffies_at_alloc + wait_for, jiffies)) { Looks ok to me. Reviewed-by: Mike Christie micha...@cs.wisc.edu -- 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 00/22] Add and use pci_zalloc_consistent
On Mon, Jun 23, 2014 at 06:41:28AM -0700, Joe Perches wrote: Adding the helper reduces object code size as well as overall source size line count. It's also consistent with all the various zalloc mechanisms in the kernel. Done with a simple cocci script and some typing. Joe Perches (22): ipw2100: Use pci_zalloc_consistent mwl8k: Use pci_zalloc_consistent rtl818x: Use pci_zalloc_consistent rtlwifi: Use pci_zalloc_consistent Sure, fine by me. -- John W. LinvilleSomeday the world will need a hero, and you linvi...@tuxdriver.com might be all we have. Be ready. -- 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 2/6] scsi: Implement sg_printk()
On 14-06-25 10:39 AM, Hannes Reinecke wrote: Update the sg driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke h...@suse.de Acked-by: Doug Gilbert dgilb...@interlog.com ^^^ A comment below as I believe you are going to make another sweep through these printk()s in the future. Doug Gilbert Reviewed-by: Martin K. Petersen martin.peter...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/scsi/sg.c | 163 +++--- 1 file changed, 95 insertions(+), 68 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index f27b70d..cb2a18e 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -199,11 +199,11 @@ static ssize_t sg_new_write(Sg_fd *sfp, struct file *file, static int sg_common_write(Sg_fd * sfp, Sg_request * srp, unsigned char *cmnd, int timeout, int blocking); static int sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer); -static void sg_remove_scat(Sg_scatter_hold * schp); +static void sg_remove_scat(Sg_fd * sfp, Sg_scatter_hold * schp); static void sg_build_reserve(Sg_fd * sfp, int req_size); static void sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size); static void sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp); -static Sg_fd *sg_add_sfp(Sg_device * sdp, int dev); +static Sg_fd *sg_add_sfp(Sg_device * sdp); static void sg_remove_sfp(struct kref *); static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id); static Sg_request *sg_add_request(Sg_fd * sfp); @@ -217,6 +217,10 @@ static void sg_device_destroy(struct kref *kref); #define SZ_SG_IOVEC sizeof(sg_iovec_t) #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) + static int sg_allow_access(struct file *filp, unsigned char *cmd) { struct sg_fd *sfp = filp-private_data; @@ -275,13 +279,15 @@ sg_open(struct inode *inode, struct file *filp) int retval; nonseekable_open(inode, filp); - SCSI_LOG_TIMEOUT(3, printk(sg_open: dev=%d, flags=0x%x\n, dev, flags)); if ((flags O_EXCL) (O_RDONLY == (flags O_ACCMODE))) return -EPERM; /* Can't lock it with read only access */ sdp = sg_get_dev(dev); if (IS_ERR(sdp)) return PTR_ERR(sdp); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, + sg_open: flags=0x%x\n, flags)); + /* This driver's module count bumped by fops_get in linux/fs.h */ /* Prevent the device driver from vanishing while we sleep */ retval = scsi_device_get(sdp-device); @@ -330,7 +336,7 @@ sg_open(struct inode *inode, struct file *filp) q = sdp-device-request_queue; sdp-sg_tablesize = queue_max_segments(q); } - sfp = sg_add_sfp(sdp, dev); + sfp = sg_add_sfp(sdp); if (IS_ERR(sfp)) { retval = PTR_ERR(sfp); goto out_undo; @@ -369,7 +375,7 @@ sg_release(struct inode *inode, struct file *filp) if ((!(sfp = (Sg_fd *) filp-private_data)) || (!(sdp = sfp-parentdp))) return -ENXIO; - SCSI_LOG_TIMEOUT(3, printk(sg_release: %s\n, sdp-disk-disk_name)); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, sg_release\n)); mutex_lock(sdp-open_rel_lock); scsi_autopm_put_device(sdp-device); @@ -401,8 +407,8 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) if ((!(sfp = (Sg_fd *) filp-private_data)) || (!(sdp = sfp-parentdp))) return -ENXIO; - SCSI_LOG_TIMEOUT(3, printk(sg_read: %s, count=%d\n, - sdp-disk-disk_name, (int) count)); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, + sg_read: count=%d\n, (int) count)); if (!access_ok(VERIFY_WRITE, buf, count)) return -EFAULT; @@ -587,8 +593,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) if ((!(sfp = (Sg_fd *) filp-private_data)) || (!(sdp = sfp-parentdp))) return -ENXIO; - SCSI_LOG_TIMEOUT(3, printk(sg_write: %s, count=%d\n, - sdp-disk-disk_name, (int) count)); + SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, + sg_write: count=%d\n, (int) count)); if (atomic_read(sdp-detaching)) return -ENODEV; if (!((filp-f_flags O_NONBLOCK) || @@ -609,7 +615,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) return -EIO;/* The minimum scsi command length is 6 bytes. */ if (!(srp = sg_add_request(sfp))) { - SCSI_LOG_TIMEOUT(1,
RE: [PATCH V2] scsi_lib: removes ambiguous Unhandled error code messages.
-Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- ow...@vger.kernel.org] On Behalf Of Christoph Hellwig Sent: Wednesday, 25 June, 2014 6:07 AM To: Maurizio Lombardi Cc: james.bottom...@hansenpartnership.com; linux-scsi@vger.kernel.org; h...@infradead.org Subject: Re: [PATCH V2] scsi_lib: removes ambiguous Unhandled error code messages. Can I get another review for this one? On Fri, Jun 06, 2014 at 10:10:35AM +0200, Maurizio Lombardi wrote: ... diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c ... @@ -955,14 +955,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) action = ACTION_FAIL; break; default: - description = Unhandled sense code; + description = Failing command with sense code:; The default case handles sense keys other than: #define NOT_READY 0x02 #define ILLEGAL_REQUEST 0x05 #define UNIT_ATTENTION 0x06 #define ABORTED_COMMAND 0x0b #define VOLUME_OVERFLOW 0x0d which means these #defines (and any other values) #define NO_SENSE0x00 #define RECOVERED_ERROR 0x01 #define MEDIUM_ERROR0x03 #define HARDWARE_ERROR 0x04 #define DATA_PROTECT0x07 #define BLANK_CHECK 0x08 #define COPY_ABORTED0x0a #define MISCOMPARE 0x0e The other description strings that result in ACTION_FAIL are based on the sense key and sometimes the additional sense code: description = Media Changed; description = Host Data Integrity Failure; description = Discard failure; description = Write same failure; description = Invalid command failure; description = Target Data Integrity Failure; description = Device not ready; Also, there is this one, which is not based on the sense key: description = Command timed out; Since the ACTION_FAIL case always prints the sense key and additional sense code: if (!(req-cmd_flags REQ_QUIET)) { if (description) scmd_printk(KERN_INFO, cmd, % \n, description); scsi_print_result(cmd); if (driver_byte(result) DRIVER_SENSE) scsi_print_sense(, cmd); scsi_print_command(cmd); } perhaps the description string should be removed altogether? In this example: sd 1:0:0:0: [sdb] Unhandled sense code sd 1:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE sd 1:0:0:0: [sdb] Sense Key : Medium Error [current] sd 1:0:0:0: [sdb] Add. Sense: Unrecovered read error sd 1:0:0:0: [sdb] CDB: Read(10): 28 00 00 18 f8 a8 00 00 08 00 end_request: critical medium error, dev sdb, sector 1636520 Sense Key : Medium Error is much more informative than Unhandled sense code or Failing command with sense code. All the other descriptions represent failing commands, so using different wording is a bit confusing. For the Unhandled error code (for which you are proposing removing the string) and the timeout case, the scsi_print_result call already prints hostbyte and driverbyte, which explain what happened in more detail: sd 1:0:0:0: [sda] Unhandled error code sd 1:0:0:0: [sda] Result: hostbyte=DID_TIME_OUT driverbyte=DRIVER_OK sd 1:0:0:0: [sda] CDB: Test Unit Ready: end_request: I/O error, dev sda, sector 481013632 --- Rob ElliottHP Server Storage -- 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 v2 00/11] mptfusion/mpt2/mpt3 static checker fixups
v2: Combined the mptfusion and mpt{2,3}sas static checker patches, re-ordering them by driver. Updated Reviewed-by and Acked-by tags as well as Sreekanth's email address. Based off v3.16-rc2, compile tested. patches dropped: * mpt3sas: fix possible memory leak in mpt3sas_send_trigger_data_event Christoph suggested combining this into a single allocation, so this patch was transformed into two new patches (removing the Reviewed-by and Acked-by tags): mpt2sas-combine-fw_event_work-and-its-event_data.patch mpt3sas-combine-fw_event_work-and-its-event_data.patch * mptfusion: initChainBuffers should return errno Christoph noted that the whole callchain uses -1 instead of errno. Let it be. patches modified: * mptfusion: zero kernel-space source of copy_to_user A static checker false-positive brought me here, Christoph suggested using memdup_user. * mptfusion: combine fw_event_work and its event_data Remove the unnecessary sz variables. * mptfusion: tweak null pointer checks Moved commentry from myself (JL) and Christoph (HCH) into the commit message. In the mpt{2,3}sas-combine-fw_event_work-and-its-event_data patches, I was wondering if the alignment attribute should be: __attribute__ ((aligned (sizeof(unsigned long instead of: char event_data[0] __aligned(4) Regards, Joe Lawrence (11): mpt2sas: correct scsi_{target,device} hostdata allocation mpt2sas: combine fw_event_work and its event_data mpt2sas: annotate ioc-reply_post_host_index as __iomem mpt3sas: correct scsi_{target,device} hostdata allocation mpt3sas: combine fw_event_work and its event_data mptfusion: mark file-private functions as static mptfusion: remove redundant kfree checks mptfusion: use memdup_user mptfusion: make adapter prod_name[] a pointer mptfusion: combine fw_event_work and its event_data mptfusion: tweak null pointer checks drivers/message/fusion/mptbase.c | 23 +-- drivers/message/fusion/mptbase.h |2 +- drivers/message/fusion/mptctl.c | 18 +++-- drivers/message/fusion/mptfc.c |3 +- drivers/message/fusion/mptsas.c | 74 -- drivers/message/fusion/mptsas.h |2 +- drivers/message/fusion/mptscsih.c| 19 - drivers/message/fusion/mptspi.c |5 +-- drivers/scsi/mpt2sas/mpt2sas_base.c |9 +++-- drivers/scsi/mpt2sas/mpt2sas_base.h |2 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 58 +++--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 62 +++- 12 files changed, 137 insertions(+), 140 deletions(-) -- 1.7.10.4 -- 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 v2 01/11] mpt2sas: correct scsi_{target,device} hostdata allocation
In _scsih_{slave,target}_alloc, an incorrect structure type is passed to sizeof() when allocating storage for hostdata. Luckily larger structure types were used, so at least the wrong sizes were safe: struct scsi_device (1784 bytes) struct MPT2SAS_DEVICE (24 bytes) struct scsi_target (760 bytes) struct MPT2SAS_TARGET (40 bytes) This fixes the following smatch warnings: drivers/scsi/mpt2sas/mpt2sas_scsih.c:1295 _scsih_target_alloc() warn: struct type mismatch 'MPT2SAS_TARGET vs scsi_target' drivers/scsi/mpt2sas/mpt2sas_scsih.c:1409 _scsih_slave_alloc() warn: struct type mismatch 'MPT2SAS_DEVICE vs scsi_device' Signed-off-by: Joe Lawrence joe.lawre...@stratus.com Cc: Dan Carpenter dan.carpen...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de Acked-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_scsih.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 5055f92..13e49c3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c @@ -1292,7 +1292,8 @@ _scsih_target_alloc(struct scsi_target *starget) unsigned long flags; struct sas_rphy *rphy; - sas_target_priv_data = kzalloc(sizeof(struct scsi_target), GFP_KERNEL); + sas_target_priv_data = kzalloc(sizeof(*sas_target_priv_data), + GFP_KERNEL); if (!sas_target_priv_data) return -ENOMEM; @@ -1406,7 +1407,8 @@ _scsih_slave_alloc(struct scsi_device *sdev) struct _sas_device *sas_device; unsigned long flags; - sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL); + sas_device_priv_data = kzalloc(sizeof(*sas_device_priv_data), + GFP_KERNEL); if (!sas_device_priv_data) return -ENOMEM; -- 1.7.10.4 -- 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 v2 04/11] mpt3sas: correct scsi_{target,device} hostdata allocation
In _scsih_{slave,target}_alloc, an incorrect structure type is passed to sizeof() when allocating storage for hostdata. Luckily larger structure types were used, so at least the wrong sizes were safe: struct scsi_device (1784 bytes) struct MPT3SAS_DEVICE (24 bytes) struct scsi_target (760 bytes) struct MPT3SAS_TARGET (32 bytes) This fixes the following smatch warnings: drivers/scsi/mpt3sas/mpt3sas_scsih.c:1166 _scsih_target_alloc() warn: struct type mismatch 'MPT3SAS_TARGET vs scsi_target' drivers/scsi/mpt3sas/mpt3sas_scsih.c:1280 _scsih_slave_alloc() warn: struct type mismatch 'MPT3SAS_DEVICE vs scsi_device' Signed-off-by: Joe Lawrence joe.lawre...@stratus.com Cc: Dan Carpenter dan.carpen...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de Acked-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt3sas/mpt3sas_scsih.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 18e713d..f3ee3b4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -1163,7 +1163,8 @@ _scsih_target_alloc(struct scsi_target *starget) unsigned long flags; struct sas_rphy *rphy; - sas_target_priv_data = kzalloc(sizeof(struct scsi_target), GFP_KERNEL); + sas_target_priv_data = kzalloc(sizeof(*sas_target_priv_data), + GFP_KERNEL); if (!sas_target_priv_data) return -ENOMEM; @@ -1277,7 +1278,8 @@ _scsih_slave_alloc(struct scsi_device *sdev) struct _sas_device *sas_device; unsigned long flags; - sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL); + sas_device_priv_data = kzalloc(sizeof(*sas_device_priv_data), + GFP_KERNEL); if (!sas_device_priv_data) return -ENOMEM; -- 1.7.10.4 -- 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 v2 03/11] mpt2sas: annotate ioc-reply_post_host_index as __iomem
The MPT2SAS_ADAPTER reply_post_host_index[] holds calculated addresses in memory mapped register space. Add an __iomem annotation to silence the following sparse warnings: drivers/scsi/mpt2sas/mpt2sas_base.c:1006:43: warning: incorrect type in argument 2 (different address spaces) expected void volatile [noderef] asn:2*addr got unsigned long long [usertype] *noident drivers/scsi/mpt2sas/mpt2sas_base.c:4299:22: warning: cast removes address space of expression drivers/scsi/mpt2sas/mpt2sas_base.c:4303:27: warning: cast removes address space of expression Signed-off-by: Joe Lawrence joe.lawre...@stratus.com Cc: Dan Carpenter dan.carpen...@oracle.com Reviewed-by: Christoph Hellwig h...@lst.de Acked-by: Sreekanth Reddy sreekanth.re...@avagotech.com --- drivers/scsi/mpt2sas/mpt2sas_base.c |9 + drivers/scsi/mpt2sas/mpt2sas_base.h |2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 8b88118..a31397c 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -4295,12 +4295,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) goto out_free_resources; if (ioc-is_warpdrive) { - ioc-reply_post_host_index[0] = - (resource_size_t *)ioc-chip-ReplyPostHostIndex; + ioc-reply_post_host_index[0] = (resource_size_t __iomem *) + ioc-chip-ReplyPostHostIndex; for (i = 1; i ioc-cpu_msix_table_sz; i++) - ioc-reply_post_host_index[i] = (resource_size_t *) - ((u8 *)ioc-chip-Doorbell + (0x4000 + ((i - 1) + ioc-reply_post_host_index[i] = + (resource_size_t __iomem *) + ((u8 __iomem *)ioc-chip-Doorbell + (0x4000 + ((i - 1) * 4))); } diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index fd3b998..0ac5815 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h @@ -837,7 +837,7 @@ struct MPT2SAS_ADAPTER { u8 msix_enable; u16 msix_vector_count; u8 *cpu_msix_table; - resource_size_t **reply_post_host_index; + resource_size_t __iomem **reply_post_host_index; u16 cpu_msix_table_sz; u32 ioc_reset_count; MPT2SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds; -- 1.7.10.4 -- 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 v2 05/11] mpt3sas: combine fw_event_work and its event_data
Tack the firmware reply event_data payload to the end of its corresponding struct fw_event_work allocation. This matches the convention in the mptfusion driver and simplifies the code. This avoids the following smatch warning: drivers/scsi/mpt3sas/mpt3sas_scsih.c:2519 mpt3sas_send_trigger_data_event() warn: possible memory leak of 'fw_event' Signed-off-by: Joe Lawrence joe.lawre...@stratus.com Cc: Dan Carpenter dan.carpen...@oracle.com Cc: Sreekanth Reddy sreekanth.re...@avagotech.com Cc: Christoph Hellwig h...@lst.de --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 56 +++--- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index f3ee3b4..a14be8f 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -190,7 +190,7 @@ struct fw_event_work { u8 VP_ID; u8 ignore; u16 event; - void*event_data; + charevent_data[0] __aligned(4); }; /* raid transport support */ @@ -2492,7 +2492,6 @@ _scsih_fw_event_free(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work spin_lock_irqsave(ioc-fw_event_lock, flags); list_del(fw_event-list); - kfree(fw_event-event_data); kfree(fw_event); spin_unlock_irqrestore(ioc-fw_event_lock, flags); } @@ -2513,12 +2512,10 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER *ioc, if (ioc-is_driver_loading) return; - fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); + fw_event = kzalloc(sizeof(*fw_event) + sizeof(*event_data), + GFP_ATOMIC); if (!fw_event) return; - fw_event-event_data = kzalloc(sizeof(*event_data), GFP_ATOMIC); - if (!fw_event-event_data) - return; fw_event-event = MPT3SAS_PROCESS_TRIGGER_DIAG; fw_event-ioc = ioc; memcpy(fw_event-event_data, event_data, sizeof(*event_data)); @@ -3213,7 +3210,8 @@ _scsih_check_topo_delete_events(struct MPT3SAS_ADAPTER *ioc, if (fw_event-event != MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST || fw_event-ignore) continue; - local_event_data = fw_event-event_data; + local_event_data = (Mpi2EventDataSasTopologyChangeList_t *) + fw_event-event_data; if (local_event_data-ExpStatus == MPI2_EVENT_SAS_TOPO_ES_ADDED || local_event_data-ExpStatus == @@ -5045,7 +5043,9 @@ _scsih_sas_topology_change_event(struct MPT3SAS_ADAPTER *ioc, u64 sas_address; unsigned long flags; u8 link_rate, prev_link_rate; - Mpi2EventDataSasTopologyChangeList_t *event_data = fw_event-event_data; + Mpi2EventDataSasTopologyChangeList_t *event_data = + (Mpi2EventDataSasTopologyChangeList_t *) + fw_event-event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc-logging_level MPT_DEBUG_EVENT_WORK_TASK) @@ -5243,7 +5243,8 @@ _scsih_sas_device_status_change_event(struct MPT3SAS_ADAPTER *ioc, u64 sas_address; unsigned long flags; Mpi2EventDataSasDeviceStatusChange_t *event_data = - fw_event-event_data; + (Mpi2EventDataSasDeviceStatusChange_t *) + fw_event-event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc-logging_level MPT_DEBUG_EVENT_WORK_TASK) @@ -5339,6 +5340,7 @@ _scsih_sas_enclosure_dev_status_change_event(struct MPT3SAS_ADAPTER *ioc, #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc-logging_level MPT_DEBUG_EVENT_WORK_TASK) _scsih_sas_enclosure_dev_status_change_event_debug(ioc, +(Mpi2EventDataSasEnclDevStatusChange_t *) fw_event-event_data); #endif } @@ -5363,7 +5365,9 @@ _scsih_sas_broadcast_primitive_event(struct MPT3SAS_ADAPTER *ioc, u32 termination_count; u32 query_count; Mpi2SCSITaskManagementReply_t *mpi_reply; - Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event-event_data; + Mpi2EventDataSasBroadcastPrimitive_t *event_data = + (Mpi2EventDataSasBroadcastPrimitive_t *) + fw_event-event_data; u16 ioc_status; unsigned long flags; int r; @@ -5515,7 +5519,8 @@ static void _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) { - Mpi2EventDataSasDiscovery_t *event_data = fw_event-event_data; + Mpi2EventDataSasDiscovery_t *event_data = + (Mpi2EventDataSasDiscovery_t *) fw_event-event_data; #ifdef CONFIG_SCSI_MPT3SAS_LOGGING if (ioc-logging_level MPT_DEBUG_EVENT_WORK_TASK) { @@ -6001,7 +6006,9 @@
[PATCH v2 06/11] mptfusion: mark file-private functions as static
Fixes the following sparse warnings: drivers/message/fusion/mptbase.c:7011:1: warning: symbol 'mpt_SoftResetHandler' was not declared. Should it be static? drivers/message/fusion/mptsas.c:1578:23: warning: symbol 'mptsas_refreshing_device_handles' was not declared. Should it be static? drivers/message/fusion/mptsas.c:3653:24: warning: symbol 'mptsas_expander_add' was not declared. Should it be static? drivers/message/fusion/mptsas.c:5327:1: warning: symbol 'mptsas_shutdown' was not declared. Should it be static? drivers/message/fusion/mptspi.c:624:1: warning: symbol 'mptscsih_quiesce_raid' was not declared. Should it be static? Signed-off-by: Joe Lawrence joe.lawre...@stratus.com Cc: Dan Carpenter dan.carpen...@oracle.com Cc: Sreekanth Reddy sreekanth.re...@avagotech.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/message/fusion/mptbase.c |2 +- drivers/message/fusion/mptsas.c |6 +++--- drivers/message/fusion/mptspi.c |2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index ebc0af7..ea30033 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -7007,7 +7007,7 @@ EXPORT_SYMBOL(mpt_halt_firmware); * IOC doesn't reply to any outstanding request. This will transfer IOC * to READY state. **/ -int +static int mpt_SoftResetHandler(MPT_ADAPTER *ioc, int sleepFlag) { int rc; diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 711fcb5..54b51a9 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -1575,7 +1575,7 @@ mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info) mptsas_port_delete(ioc, phy_info-port_details); } -struct mptsas_phyinfo * +static struct mptsas_phyinfo * mptsas_refreshing_device_handles(MPT_ADAPTER *ioc, struct mptsas_devinfo *sas_device) { @@ -3648,7 +3648,7 @@ mptsas_send_expander_event(struct fw_event_work *fw_event) * @handle: * */ -struct mptsas_portinfo * +static struct mptsas_portinfo * mptsas_expander_add(MPT_ADAPTER *ioc, u16 handle) { struct mptsas_portinfo buffer, *port_info; @@ -5321,7 +5321,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) return error; } -void +static void mptsas_shutdown(struct pci_dev *pdev) { MPT_ADAPTER *ioc = pci_get_drvdata(pdev); diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 49d1133..7b4db9a 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c @@ -620,7 +620,7 @@ static void mptspi_read_parameters(struct scsi_target *starget) spi_width(starget) = (nego MPI_SCSIDEVPAGE0_NP_WIDE) ? 1 : 0; } -int +static int mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) { MPT_ADAPTER *ioc = hd-ioc; -- 1.7.10.4 -- 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 v2 09/11] mptfusion: make adapter prod_name[] a pointer
The struct _MPT_ADAPTER doesn't need a full copy of the product string, so prod_name can point to the string literal storage that the driver already provides. Avoids the following smatch warning: drivers/message/fusion/mptbase.c:2858 MptDisplayIocCapabilities() warn: this array is probably non-NULL. 'ioc-prod_name' Signed-off-by: Joe Lawrence joe.lawre...@stratus.com Cc: Dan Carpenter dan.carpen...@oracle.com Cc: Sreekanth Reddy sreekanth.re...@avagotech.com Reviewed-by: Christoph Hellwig h...@lst.de --- drivers/message/fusion/mptbase.c | 11 +-- drivers/message/fusion/mptbase.h |2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index ea30033..9d4c782 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -1408,8 +1408,8 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) * in /proc/mpt/summary and /sysfs/class/scsi_host/hostX/version_product * **/ -static void -mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name) +static const char* +mpt_get_product_name(u16 vendor, u16 device, u8 revision) { char *product_str = NULL; @@ -1635,8 +1635,7 @@ mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name) } out: - if (product_str) - sprintf(prod_name, %s, product_str); + return product_str; } /** @@ -1887,8 +1886,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) dinitprintk(ioc, printk(MYIOC_s_INFO_FMT facts @ %p, pfacts[0] @ %p\n, ioc-name, ioc-facts, ioc-pfacts[0])); - mpt_get_product_name(pdev-vendor, pdev-device, pdev-revision, -ioc-prod_name); + ioc-prod_name = mpt_get_product_name(pdev-vendor, pdev-device, + pdev-revision); switch (pdev-device) { diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 76c05bc..78c8104 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -605,7 +605,7 @@ typedef struct _MPT_ADAPTER int id;/* Unique adapter id N {0,1,2,...} */ int pci_irq; /* This irq */ char name[MPT_NAME_LENGTH]; /* iocN */ - char prod_name[MPT_NAME_LENGTH];/* LSIFC9x9 */ + const char *prod_name;/* LSIFC9x9 */ #ifdef CONFIG_FUSION_LOGGING /* used in mpt_display_event_info */ char evStr[EVENT_DESCR_STR_SZ]; -- 1.7.10.4 -- 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