Reminder

2014-11-10 Thread Thaung Lin Yan

Your partnership is needed for a profitable business transaction involving huge 
amounts of fund please contact me for more details.

---
Uw partnerschap is nodig voor een winstgevende business transactie waarbij 
enorme hoeveelheden fonds kunt u contact met mij op voor meer details.


Ihre Partnerschaft ist für ein profitables Geschäft Transaktion mit riesigen 
Mengen von Fonds kontaktieren Sie mich bitte für weitere Einzelheiten benötig
--
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/2] virtio_scsi: support multi hw queue of blk-mq

2014-11-10 Thread Paolo Bonzini
On 09/11/2014 17:57, Ming Lei wrote:
 Since virtio_scsi has supported multi virtqueue already,
 it is natural to map virtque to hw-queue of blk-mq.
 
 Cc: Paolo Bonzini pbonz...@redhat.com
 Signed-off-by: Ming Lei ming@canonical.com
 ---
  drivers/scsi/virtio_scsi.c |  154 
 
  1 file changed, 14 insertions(+), 140 deletions(-)

Nice. :)

FWIW, instead of force_blk_mq, it would be fine for me to make
virtio-scsi use a single queue if not using blk-mq.

Reviewed-by: Paolo Bonzini pbonz...@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


[3.16.y-ckt extended stable] Patch scsi: Fix error handling in SCSI_IOCTL_SEND_COMMAND has been added to staging queue

2014-11-10 Thread Luis Henriques
This is a note to let you know that I have just added a patch titled

scsi: Fix error handling in SCSI_IOCTL_SEND_COMMAND

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

 
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt1.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

--

From 3c8c784d1273b1f13ae894a5807ea7785be54623 Mon Sep 17 00:00:00 2001
From: Jan Kara j...@suse.cz
Date: Wed, 22 Oct 2014 20:13:39 -0600
Subject: scsi: Fix error handling in SCSI_IOCTL_SEND_COMMAND

commit 84ce0f0e94ac97217398b3b69c21c7a62ebeed05 upstream.

When sg_scsi_ioctl() fails to prepare request to submit in
blk_rq_map_kern() we jump to a label where we just end up copying
(luckily zeroed-out) kernel buffer to userspace instead of reporting
error. Fix the problem by jumping to the right label.

CC: Jens Axboe ax...@kernel.dk
CC: linux-scsi@vger.kernel.org
Coverity-id: 1226871
Signed-off-by: Jan Kara j...@suse.cz

Fixed up the, now unused, out label.

Signed-off-by: Jens Axboe ax...@fb.com
Signed-off-by: Luis Henriques luis.henriq...@canonical.com
---
 block/scsi_ioctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 84ab119b6ffa..de3bd8287d81 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -490,7 +490,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk 
*disk, fmode_t mode,

if (bytes  blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) {
err = DRIVER_ERROR  24;
-   goto out;
+   goto error;
}

memset(sense, 0, sizeof(sense));
@@ -499,7 +499,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk 
*disk, fmode_t mode,

blk_execute_rq(q, disk, rq, 0);

-out:
err = rq-errors  0xff;/* only 8 bit SCSI status */
if (err) {
if (rq-sense_len  rq-sense) {
--
2.1.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


[PATCH 1/7] megaraid_sas : Driver version upgrade

2014-11-10 Thread Sumit.Saxena
megaraid_sas driver version upgrade

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas.h  | 2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index a49914d..f3eccf1 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -33,7 +33,7 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION06.805.06.00-rc1
+#define MEGASAS_VERSION06.805.06.01-rc1
 #define MEGASAS_RELDATESep. 4, 2014
 #define MEGASAS_EXT_VERSIONThu. Sep. 4 17:00:00 PDT 2014
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index f6a69a3..36f463c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -18,7 +18,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  *  FILE: megaraid_sas_base.c
- *  Version : 06.805.06.00-rc1
+ *  Version : 06.805.06.01-rc1
  *
  *  Authors: LSI Corporation
  *   Sreenivas Bagalkote
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] megaraid_sas : Update MAINTAINERS for megaraid drivers

2014-11-10 Thread Sumit.Saxena
Update MAINTAINERS list for megaraid_sas driver

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
---
 MAINTAINERS |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index aefa948..94c393f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5830,10 +5830,14 @@ W:  http://linuxtv.org
 S: Odd Fixes
 F: drivers/media/parport/pms*
 
-MEGARAID SCSI DRIVERS
-M: Neela Syam Kolli megaraidli...@lsi.com
+MEGARAID SCSI/SAS DRIVERS
+M: Adam Radford adam.radf...@avagotech.com
+M: Kashyap Desai kashyap.de...@avagotech.com
+M: Sumit Saxena sumit.sax...@avagotech.com
+M: Uday Lingala uday.ling...@avagotech.com
+L: megaraidlinux@avagotech.com
 L: linux-scsi@vger.kernel.org
-W: http://megaraid.lsilogic.com
+W: http://www.lsi.com
 S: Maintained
 F: Documentation/scsi/megaraid.txt
 F: drivers/scsi/megaraid.*
-- 
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 4/7] megaraid_sas : Online Firmware upgrade suppport for Extended VD feature

2014-11-10 Thread Sumit.Saxena
This patch provides driver compatibility for updating firmware online to 
upgrade legacy(64 VD) firmware to Extended VD firmware
and viceversa. Currently, at driver load time only, driver will check whether 
Firmware is legacy or 240 VD. If legacy Firmware is
upgraded to Extended VD firmware without unloading-loading driver, driver will 
never come to know the underlying firmware is changed and
it will always acts as firmware type is same, which was queried at driver load 
time.
Below is the descriptions of code changes done-

1)This patch has added functionality to get controller information from 
OCR(Online Controller Rest) path(which is called after
firmware upgrade) and update the paramter of firmwware type flashed on 
controller-Extended VD firmware or Legacy VD firmware.
Driver will not change any other parameter except for this one.

2)Also added few code optimizations/fixes[memset after get_free_pages, and 
reduced redundant parameters in megasas_ctrl_info()
function.

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas.h|3 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   |   80 +++
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   55 +--
 3 files changed, 83 insertions(+), 55 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index a49914d..0408dda 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1931,8 +1931,7 @@ u16 get_updated_dev_handle(struct megasas_instance 
*instance,
struct LD_LOAD_BALANCE_INFO *lbInfo, struct IO_REQUEST_INFO *in_info);
 void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *map,
struct LD_LOAD_BALANCE_INFO *lbInfo);
-int megasas_get_ctrl_info(struct megasas_instance *instance,
-   struct megasas_ctrl_info *ctrl_info);
+int megasas_get_ctrl_info(struct megasas_instance *instance);
 int megasas_set_crash_dump_params(struct megasas_instance *instance,
u8 crash_buf_state);
 void megasas_free_host_crash_buffer(struct megasas_instance *instance);
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 7754eeb..9d5db5f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4034,25 +4034,81 @@ megasas_ld_list_query(struct megasas_instance 
*instance, u8 query_type)
return ret;
 }
 
+/*
+ * megasas_update_ext_vd_details : Update details w.r.t Extended VD
+ * instance : Controller's instance
+*/
+static void megasas_update_ext_vd_details(struct megasas_instance *instance)
+{
+   struct fusion_context *fusion;
+
+   fusion = instance-ctrl_context;
+   /* For MFI based controllers return dummy success */
+   if (!fusion)
+   return;
+
+   instance-supportmax256vd =
+   instance-ctrl_info-adapterOperations3.supportMaxExtLDs;
+   /* Below is additional check to address future FW enhancement */
+   if (instance-ctrl_info-max_lds  64)
+   instance-supportmax256vd = 1;
+
+   instance-drv_supported_vd_count = MEGASAS_MAX_LD_CHANNELS
+   * MEGASAS_MAX_DEV_PER_CHANNEL;
+   instance-drv_supported_pd_count = MEGASAS_MAX_PD_CHANNELS
+   * MEGASAS_MAX_DEV_PER_CHANNEL;
+   if (instance-supportmax256vd) {
+   instance-fw_supported_vd_count = MAX_LOGICAL_DRIVES_EXT;
+   instance-fw_supported_pd_count = MAX_PHYSICAL_DEVICES;
+   } else {
+   instance-fw_supported_vd_count = MAX_LOGICAL_DRIVES;
+   instance-fw_supported_pd_count = MAX_PHYSICAL_DEVICES;
+   }
+   dev_info(instance-pdev-dev, Firmware supports %d VD %d PD\n,
+   instance-fw_supported_vd_count,
+   instance-fw_supported_pd_count);
+   dev_info(instance-pdev-dev, Driver supports %d VD  %d PD\n,
+   instance-drv_supported_vd_count,
+   instance-drv_supported_pd_count);
+
+   fusion-old_map_sz =  sizeof(struct MR_FW_RAID_MAP) +
+   (sizeof(struct MR_LD_SPAN_MAP) *
+   (instance-fw_supported_vd_count - 1));
+   fusion-new_map_sz =  sizeof(struct MR_FW_RAID_MAP_EXT);
+   fusion-drv_map_sz =  sizeof(struct MR_DRV_RAID_MAP) +
+   (sizeof(struct MR_LD_SPAN_MAP) *
+   (instance-drv_supported_vd_count - 1));
+
+   fusion-max_map_sz = max(fusion-old_map_sz, fusion-new_map_sz);
+
+
+   if (instance-supportmax256vd)
+   fusion-current_map_sz = fusion-new_map_sz;
+   else
+   fusion-current_map_sz = fusion-old_map_sz;
+
+}
+
 /**
  * megasas_get_controller_info -   Returns FW's controller structure
  * @instance: 

[PATCH 6/7] megaraid_sas : Corrected return of wait_event from abort frame path

2014-11-10 Thread Sumit.Saxena
Corrected wait_event() call which was waiting for wrong completion status(0xFF).

Cc: sta...@vger.kernel.org

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 9d5db5f..4e0325c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1008,7 +1008,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance 
*instance,
cpu_to_le32(upper_32_bits(cmd_to_abort-frame_phys_addr));
 
cmd-sync_cmd = 1;
-   cmd-cmd_status = 0xFF;
+   cmd-cmd_status = ENODATA;
 
instance-instancet-issue_dcmd(instance, cmd);
 
-- 
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 5/7] megaraid_sas : Make HBA operational after LD_MAP_SYNC DCMD in OCR path

2014-11-10 Thread Sumit.Saxena
In OCR(Online Controller Reset) path, driver sets adapter state to 
MEGASAS_HBA_OPERATIONAL before getting new RAID map.
There will be a small window where IO will come from OS with old RAID map.
This patch will update adapter state to MEGASAS_HBA_OPERATIONAL, only after 
driver has new RAID map to avoid
any IOs getting build using old RAID map.

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index b8411a1..aeb76d3 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -2801,11 +2801,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int 
iotimeout)
}
}
 
-   clear_bit(MEGASAS_FUSION_IN_RESET,
- instance-reset_flags);
-   instance-instancet-enable_intr(instance);
-   instance-adprecovery = MEGASAS_HBA_OPERATIONAL;
-
if (megasas_get_ctrl_info(instance)) {
dev_info(instance-pdev-dev,
Failed from %s %d\n,
@@ -2823,6 +2818,11 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int 
iotimeout)
if (!megasas_get_map_info(instance))
megasas_sync_map_info(instance);
 
+   clear_bit(MEGASAS_FUSION_IN_RESET,
+ instance-reset_flags);
+   instance-instancet-enable_intr(instance);
+   instance-adprecovery = MEGASAS_HBA_OPERATIONAL;
+
/* Restart SR-IOV heartbeat */
if (instance-requestorId) {
if (!megasas_sriov_start_heartbeat(instance, 0))
-- 
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 7/7] megaraid_sas : Endinaness related bug fixes

2014-11-10 Thread Sumit.Saxena
This patch addresses few endianness related bug fixes.

Cc: sta...@vger.kernel.org

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas_fp.c |   17 +
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   13 +++--
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c 
b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 685e6f3..0f66d0e 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -183,14 +183,15 @@ void MR_PopulateDrvRaidMap(struct megasas_instance 
*instance)
/* New Raid map will not set totalSize, so keep expected value
 * for legacy code in ValidateMapInfo
 */
-   pDrvRaidMap-totalSize = sizeof(struct MR_FW_RAID_MAP_EXT);
+   pDrvRaidMap-totalSize =
+   cpu_to_le32(sizeof(struct MR_FW_RAID_MAP_EXT));
} else {
fw_map_old = (struct MR_FW_RAID_MAP_ALL *)
fusion-ld_map[(instance-map_id  1)];
pFwRaidMap = fw_map_old-raidMap;
 
 #if VD_EXT_DEBUG
-   for (i = 0; i  pFwRaidMap-ldCount; i++) {
+   for (i = 0; i  le16_to_cpu(pFwRaidMap-ldCount); i++) {
dev_dbg(instance-pdev-dev, (%d) :Index 0x%x 
Target Id 0x%x Seq Num 0x%x Size 0/%llx\n,
instance-unique_id, i,
@@ -202,12 +203,12 @@ void MR_PopulateDrvRaidMap(struct megasas_instance 
*instance)
 
memset(drv_map, 0, fusion-drv_map_sz);
pDrvRaidMap-totalSize = pFwRaidMap-totalSize;
-   pDrvRaidMap-ldCount = pFwRaidMap-ldCount;
+   pDrvRaidMap-ldCount = (__le16)pFwRaidMap-ldCount;
pDrvRaidMap-fpPdIoTimeoutSec = pFwRaidMap-fpPdIoTimeoutSec;
for (i = 0; i  MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; 
i++)
pDrvRaidMap-ldTgtIdToLd[i] =
(u8)pFwRaidMap-ldTgtIdToLd[i];
-   for (i = 0; i  pDrvRaidMap-ldCount; i++) {
+   for (i = 0; i  le16_to_cpu(pDrvRaidMap-ldCount); i++) {
pDrvRaidMap-ldSpanMap[i] = pFwRaidMap-ldSpanMap[i];
 #if VD_EXT_DEBUG
dev_dbg(instance-pdev-dev,
@@ -268,7 +269,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
else
expected_size =
(sizeof(struct MR_FW_RAID_MAP) - sizeof(struct 
MR_LD_SPAN_MAP) +
-   (sizeof(struct MR_LD_SPAN_MAP) * 
le32_to_cpu(pDrvRaidMap-ldCount)));
+   (sizeof(struct MR_LD_SPAN_MAP) * 
le16_to_cpu(pDrvRaidMap-ldCount)));
 
if (le32_to_cpu(pDrvRaidMap-totalSize) != expected_size) {
dev_err(instance-pdev-dev, map info structure size 0x%x is 
not matching with ld count\n,
@@ -284,7 +285,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
 
mr_update_load_balance_params(drv_map, lbInfo);
 
-   num_lds = le32_to_cpu(drv_map-raidMap.ldCount);
+   num_lds = le16_to_cpu(drv_map-raidMap.ldCount);
 
/*Convert Raid capability values to CPU arch */
for (ldCount = 0; ldCount  num_lds; ldCount++) {
@@ -457,7 +458,7 @@ u32 mr_spanset_get_span_block(struct megasas_instance 
*instance,
quad = map-raidMap.ldSpanMap[ld].
spanBlock[span].
block_span_info.quad[info];
-   if (le32_to_cpu(quad-diff == 0))
+   if (le32_to_cpu(quad-diff) == 0)
return SPAN_INVALID;
if (le64_to_cpu(quad-logStart) = row  
row = le64_to_cpu(quad-logEnd)  
@@ -520,7 +521,7 @@ static u64  get_row_from_strip(struct megasas_instance 
*instance,
span_set-span_row_data_width) * span_set-diff;
for (span = 0, span_offset = 0; span  raid-spanDepth; span++)
if 
(le32_to_cpu(map-raidMap.ldSpanMap[ld].spanBlock[span].
-   block_span_info.noElements = info+1)) {
+   block_span_info.noElements) = info+1) {
if (strip_offset =
span_set-strip_offset[span])
span_offset++;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index aeb76d3..a9d39c9 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -880,7 +880,7 @@ megasas_sync_map_info(struct megasas_instance *instance)
 
map = 

[PATCH 0/7] megaraid_sas : Description Patch

2014-11-10 Thread Sumit.Saxena
megaraid_sas driver changes.
Please consider this patch set for next kernel release.

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com

---
[PATCH 0/7] megaraid_sas : Description Patch 
[PATCH 1/7] megaraid_sas : Driver version upgrade 
[PATCH 2/7] megaraid_sas : Update MAINTAINERS for megaraid drivers
[PATCH 3/7] megaraid_sas : Do not process IOCTLs and SCSI commands during 
driver removal
[PATCH 4/7] megaraid_sas : Online Firmware upgrade suppport for Extended VD 
feature
[PATCH 5/7] megaraid_sas : Make HBA operational after LD_MAP_SYNC DCMD in OCR 
path
[PATCH 6/7] megaraid_sas : Corrected return of wait_event from abort frame path
[PATCH 7/7] megaraid_sas : Endinaness related bug fixes
--
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/7] megaraid_sas : Do not process IOCTLs and SCSI commands during driver removal

2014-11-10 Thread Sumit.Saxena
Do not process any SCSI and IOCTL command further(return them with appropriate 
return values to callers),
while driver removal is in progress/PCI shutdown is invoked. 

Signed-off-by: Sumit Saxena sumit.sax...@avagotech.com
Signed-off-by: Kashyap Desai kashyap.de...@avagotech.com
---
 drivers/scsi/megaraid/megaraid_sas_base.c |   20 
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index f6a69a3..7754eeb 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1572,6 +1572,12 @@ megasas_queue_command(struct Scsi_Host *shost, struct 
scsi_cmnd *scmd)
instance = (struct megasas_instance *)
scmd-device-host-hostdata;
 
+   if (instance-unload == 1) {
+   scmd-result = DID_NO_CONNECT  16;
+   scmd-scsi_done(scmd);
+   return 0;
+   }
+
if (instance-issuepend_done == 0)
return SCSI_MLQUEUE_HOST_BUSY;
 
@@ -4957,10 +4963,6 @@ static int megasas_io_attach(struct megasas_instance 
*instance)
return -ENODEV;
}
 
-   /*
-* Trigger SCSI to scan our drives
-*/
-   scsi_scan_host(host);
return 0;
 }
 
@@ -5288,6 +5290,10 @@ retry_irq_register:
goto fail_io_attach;
 
instance-unload = 0;
+   /*
+* Trigger SCSI to scan our drives
+*/
+   scsi_scan_host(host);
 
/*
 * Initiate AEN (Asynchronous Event Notification)
@@ -6051,6 +6057,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
megasas_issue_blocked_cmd(instance, cmd, 0);
cmd-sync_cmd = 0;
 
+   if (instance-unload == 1) {
+   dev_info(instance-pdev-dev, we are doing unload so no need
+   to submit data to application. This may be force exit
+   from driver\n);
+   goto out;
+   }
/*
 * copy out the kernel buffers to user buffers
 */
-- 
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


Re: [PATCH 2/2] virtio_scsi: support multi hw queue of blk-mq

2014-11-10 Thread Christoph Hellwig
On Mon, Nov 10, 2014 at 11:41:43AM +0100, Paolo Bonzini wrote:
 FWIW, instead of force_blk_mq, it would be fine for me to make
 virtio-scsi use a single queue if not using blk-mq.

I agree with that.  I'd rather move all of SCSI over after a fairly short
period instead of special cases like this, mostly out of fear of a horrible
transition we had to the new EH model 10 years ago.
--
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: bisected regression: qla2xxx endianness on sparc64

2014-11-10 Thread Christoph Hellwig
On Mon, Nov 03, 2014 at 03:09:47PM -0500, Chad Dupuis wrote:
 We should revert that change. What were some of the other failures you were
 seeing?

Can you please send me the revert ASAP?

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: bisected regression: qla2xxx endianness on sparc64

2014-11-10 Thread Christoph Hellwig
On Mon, Nov 03, 2014 at 11:32:14PM +0200, Meelis Roos wrote:
 Yes. I took the same 3.18.0-rc1-00422-g2cc9188-dirty kernel that had 
 just this patch reverted, it started the controller fine, detected disk, 
 mounted root, started multiple tasks and then some time after startin 
 exim it just hangs. This is consisten with what I saw during bisection.

Can you try to bisect this one as well?

--
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] hpsa: fix potential resource leak

2014-11-10 Thread Christoph Hellwig
Don, can you help me review Tomas hpsa patches, including those from the
last week of October?  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: bisected regression: qla2xxx endianness on sparc64

2014-11-10 Thread Meelis Roos
 On Mon, Nov 03, 2014 at 11:32:14PM +0200, Meelis Roos wrote:
  Yes. I took the same 3.18.0-rc1-00422-g2cc9188-dirty kernel that had 
  just this patch reverted, it started the controller fine, detected disk, 
  mounted root, started multiple tasks and then some time after startin 
  exim it just hangs. This is consisten with what I saw during bisection.
 
 Can you try to bisect this one as well?

I have tried for many evenings but it is not so easy. With current 
bisecting, I have lost good base version, even going back to 3.17 and 
3.16 breaks for now. I will try more after some days when I have an idea 
what did I change to break it (some conf option perhaps).

-- 
Meelis Roos (mr...@linux.ee)
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] Discard update for 3.19

2014-11-10 Thread Christoph Hellwig
Looks like there is no real dependency between these patches, so we
might take on each through the libata, scsi and block trees.

Can I get another review for the sd patch, 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 2/2] virtio_scsi: support multi hw queue of blk-mq

2014-11-10 Thread Ming Lei
On Mon, Nov 10, 2014 at 9:39 PM, Christoph Hellwig h...@lst.de wrote:
 On Mon, Nov 10, 2014 at 11:41:43AM +0100, Paolo Bonzini wrote:
 FWIW, instead of force_blk_mq, it would be fine for me to make
 virtio-scsi use a single queue if not using blk-mq.

 I agree with that.

For virtio-scsi, we can do that because only single vq is running at
the same time for previous multi-vq support.

 I'd rather move all of SCSI over after a fairly short
 period instead of special cases like this, mostly out of fear of a horrible
 transition we had to the new EH model 10 years ago.

It depends on how long the transition period is, and other drivers
with multi hwq support might be in the same situation with virtio-scsi. If
the period is a bit long, it would be painful for these drivers to support
both blk-mq and non-mq.

Also with force_blk_mq on virtio-scsi, people can test scsi-mq with
default setting, then it should be helpful to collect more test reports, :-)

But I don't have strong desire for force_blk_mq if you think it isn't good.

Thanks,
Ming Lei
--
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/11] scsi: remove ordered_tag host template field

2014-11-10 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Bart Van Assche bvanass...@acm.org
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
Reviewed-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/hosts.c  |  1 -
 drivers/usb/storage/uas.c |  1 -
 include/scsi/scsi_host.h  | 10 --
 3 files changed, 12 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 06030e1..8bb173e 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -418,7 +418,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template 
*sht, int privsize)
shost-cmd_per_lun = sht-cmd_per_lun;
shost-unchecked_isa_dma = sht-unchecked_isa_dma;
shost-use_clustering = sht-use_clustering;
-   shost-ordered_tag = sht-ordered_tag;
shost-no_write_same = sht-no_write_same;
 
if (shost_eh_deadline == -1 || !sht-eh_host_reset_handler)
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index b38bc13..1bc5df4 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -817,7 +817,6 @@ static struct scsi_host_template uas_host_template = {
.sg_tablesize = SG_NONE,
.cmd_per_lun = 1,   /* until we override it */
.skip_settle_delay = 1,
-   .ordered_tag = 1,
 
/*
 * The uas drivers expects tags not to be bigger than the maximum
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index bb9e278..5b03ba9 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -451,11 +451,6 @@ struct scsi_host_template {
 */
unsigned skip_settle_delay:1;
 
-   /*
-* True if we are using ordered write support.
-*/
-   unsigned ordered_tag:1;
-
/* True if the controller does not support WRITE SAME */
unsigned no_write_same:1;
 
@@ -670,11 +665,6 @@ struct Scsi_Host {
 */
unsigned reverse_ordering:1;
 
-   /*
-* Ordered write support
-*/
-   unsigned ordered_tag:1;
-
/* Task mgmt function in progress */
unsigned tmf_in_progress:1;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/11] scsi: remove ordered_tags scsi_device field

2014-11-10 Thread Christoph Hellwig
Remove the ordered_tags field, we haven't been issuing ordered tags based
on it since the big barrier rework in 2010.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Bart Van Assche bvanass...@acm.org
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
---
 drivers/message/fusion/mptscsih.c|  5 ++---
 drivers/scsi/bfa/bfad_im.c   | 11 +++
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 16 
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 15 +++
 drivers/scsi/qla2xxx/qla_os.c|  5 +
 drivers/scsi/scsi.c  | 13 ++---
 drivers/scsi/scsi_sysfs.c| 13 +++--
 drivers/scsi/vmw_pvscsi.c|  4 ++--
 drivers/target/loopback/tcm_loop.c   | 14 +-
 include/scsi/scsi_device.h   |  1 -
 include/scsi/scsi_tcq.h  |  9 -
 11 files changed, 25 insertions(+), 81 deletions(-)

diff --git a/drivers/message/fusion/mptscsih.c 
b/drivers/message/fusion/mptscsih.c
index e7dcb25..00bd13d 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2400,9 +2400,8 @@ mptscsih_slave_configure(struct scsi_device *sdev)
mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH,
SCSI_QDEPTH_DEFAULT);
dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
-   tagged %d, simple %d, ordered %d\n,
-   ioc-name,sdev-tagged_supported, sdev-simple_tags,
-   sdev-ordered_tags));
+   tagged %d, simple %d\n,
+   ioc-name,sdev-tagged_supported, sdev-simple_tags));
 
blk_queue_dma_alignment (sdev-request_queue, 512 - 1);
 
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index f067332..99280e8 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -868,14 +868,9 @@ bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct 
scsi_device *sdev)
if (bfa_lun_queue_depth  tmp_sdev-queue_depth) {
if (tmp_sdev-id != sdev-id)
continue;
-   if (tmp_sdev-ordered_tags)
-   scsi_adjust_queue_depth(tmp_sdev,
-   MSG_ORDERED_TAG,
-   tmp_sdev-queue_depth + 1);
-   else
-   scsi_adjust_queue_depth(tmp_sdev,
-   MSG_SIMPLE_TAG,
-   tmp_sdev-queue_depth + 1);
+   scsi_adjust_queue_depth(tmp_sdev,
+   MSG_SIMPLE_TAG,
+   tmp_sdev-queue_depth + 1);
 
itnim-last_ramp_up_time = jiffies;
}
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 
b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index ec36b91..69dc166 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1246,9 +1246,9 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int 
qdepth, int reason)
 
if (sdev-inquiry_len  7)
sdev_printk(KERN_INFO, sdev, qdepth(%d), tagged(%d), 
-   simple(%d), ordered(%d), scsi_level(%d), cmd_que(%d)\n,
+   simple(%d), scsi_level(%d), cmd_que(%d)\n,
sdev-queue_depth, sdev-tagged_supported, sdev-simple_tags,
-   sdev-ordered_tags, sdev-scsi_level,
+   sdev-scsi_level,
(sdev-inquiry[7]  2)  1);
 
return sdev-queue_depth;
@@ -3944,16 +3944,8 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd 
*scmd)
mpi_control = MPI2_SCSIIO_CONTROL_NODATATRANSFER;
 
/* set tags */
-   if (!(sas_device_priv_data-flags  MPT_DEVICE_FLAGS_INIT)) {
-   if (scmd-device-tagged_supported) {
-   if (scmd-device-ordered_tags)
-   mpi_control |= MPI2_SCSIIO_CONTROL_ORDEREDQ;
-   else
-   mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
-   } else
-   mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
-   } else
-   mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
+   mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
+
/* Make sure Device is not raid volume.
 * We do not expose raid functionality to upper layer for warpdrive.
 */
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 52464ac..d3abf25 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1114,9 +1114,9 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int 
qdepth, int reason)
 
if (sdev-inquiry_len  7)
sdev_printk(KERN_INFO, sdev, 

[PATCH 02/11] scsi: add new scsi-command flag for tagged commands

2014-11-10 Thread Christoph Hellwig
Currently scsi piggy backs on the block layer to define the concept
of a tagged command.  But we want to be able to have block-level host-wide
tags assigned even for untagged commands like the initial INQUIRY, so add
a new SCSI-level flag for commands that are tagged at the scsi level, so
that even commands without that set can have tags assigned to them.  Note
that this alredy is the case for the blk-mq code path, and this just lets
the old path catch up with it.

We also set this flag based upon sdev-simple_tags instead of the block
queue flag, so that it is entirely independent of the block layer tagging,
and thus always correct even if a driver doesn't use block level tagging
yet.

Also remove the old blk_rq_tagged; it was only used by SCSI drivers, and
removing it forces them to look for the proper replacement.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
Reviewed-by: Hannes Reinecke h...@suse.de
---
 Documentation/block/biodoc.txt |  4 
 block/blk-core.c   |  4 ++--
 drivers/scsi/53c700.c  |  6 +++---
 drivers/scsi/aic7xxx/aic7xxx_osm.c |  2 +-
 drivers/scsi/scsi_lib.c| 13 +
 drivers/usb/storage/uas.c  |  2 +-
 include/linux/blkdev.h |  1 -
 include/scsi/scsi_cmnd.h   |  4 
 include/scsi/scsi_tcq.h|  6 ++
 9 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt
index 2101e71..6b972b2 100644
--- a/Documentation/block/biodoc.txt
+++ b/Documentation/block/biodoc.txt
@@ -827,10 +827,6 @@ but in the event of any barrier requests in the tag queue 
we need to ensure
 that requests are restarted in the order they were queue. This may happen
 if the driver needs to use blk_queue_invalidate_tags().
 
-Tagging also defines a new request flag, REQ_QUEUED. This is set whenever
-a request is currently tagged. You should not use this flag directly,
-blk_rq_tagged(rq) is the portable way to do so.
-
 3.3 I/O Submission
 
 The routine submit_bio() is used to submit a single io. Higher level i/o
diff --git a/block/blk-core.c b/block/blk-core.c
index 0421b53..2e7424b 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1266,7 +1266,7 @@ void blk_requeue_request(struct request_queue *q, struct 
request *rq)
blk_clear_rq_complete(rq);
trace_block_rq_requeue(q, rq);
 
-   if (blk_rq_tagged(rq))
+   if (rq-cmd_flags  REQ_QUEUED)
blk_queue_end_tag(q, rq);
 
BUG_ON(blk_queued_rq(rq));
@@ -2554,7 +2554,7 @@ EXPORT_SYMBOL_GPL(blk_unprep_request);
  */
 void blk_finish_request(struct request *req, int error)
 {
-   if (blk_rq_tagged(req))
+   if (req-cmd_flags  REQ_QUEUED)
blk_queue_end_tag(req-q, req);
 
BUG_ON(blk_queued_rq(req));
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 474cc6d..5143d32 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1767,7 +1767,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void 
(*done)(struct scsi_cmnd *)
 */
if(NCR_700_get_depth(SCp-device) != 0
(!(hostdata-tag_negotiated  (1scmd_id(SCp)))
-  || !blk_rq_tagged(SCp-request))) {
+  || !(SCp-flags  SCMD_TAGGED))) {
CDEBUG(KERN_ERR, SCp, has non zero depth %d\n,
   NCR_700_get_depth(SCp-device));
return SCSI_MLQUEUE_DEVICE_BUSY;
@@ -1795,7 +1795,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void 
(*done)(struct scsi_cmnd *)
printk(53c700: scsi%d, command , SCp-device-host-host_no);
scsi_print_command(SCp);
 #endif
-   if(blk_rq_tagged(SCp-request)
+   if ((SCp-flags  SCMD_TAGGED)
(hostdata-tag_negotiated (1scmd_id(SCp))) == 0
NCR_700_get_tag_neg_state(SCp-device) == 
NCR_700_START_TAG_NEGOTIATION) {
scmd_printk(KERN_ERR, SCp, Enabling Tag Command Queuing\n);
@@ -1809,7 +1809,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void 
(*done)(struct scsi_cmnd *)
 *
 * FIXME: This will royally screw up on multiple LUN devices
 * */
-   if(!blk_rq_tagged(SCp-request)
+   if (!(SCp-flags  SCMD_TAGGED)
(hostdata-tag_negotiated (1scmd_id(SCp {
scmd_printk(KERN_INFO, SCp, Disabling Tag Command Queuing\n);
hostdata-tag_negotiated = ~(1scmd_id(SCp));
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c 
b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index d2c9bf3..63bae7c 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1447,7 +1447,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct 
ahc_linux_device *dev,
 * we are storing a full busy target *lun*
 * table in SCB space.
 */
-   if (!blk_rq_tagged(cmd-request)
+   if (!(cmd-flags  SCMD_TAGGED)
 (ahc-features  AHC_SCB_BTT) 

[PATCH 05/11] scsi: remove abuses of scsi_populate_tag

2014-11-10 Thread Christoph Hellwig
Unless we want to build a SPI tag message we should just check SCMD_TAGGED
instead of reverse engineering a tag type through the use of
scsi_populate_tag_msg.

Also rename the function to spi_populate_tag_msg, make it behave like the
other spi message helpers, and move it to the spi transport class.

Signed-off-by: Christoph Hellwig h...@lst.de
---
 drivers/s390/scsi/zfcp_fc.h| 14 +-
 drivers/scsi/53c700.c  |  2 +-
 drivers/scsi/aic7xxx/aic79xx_osm.c |  9 
 drivers/scsi/aic7xxx/aic7xxx_osm.c | 10 +
 drivers/scsi/bnx2fc/bnx2fc_io.c| 18 ++--
 drivers/scsi/csiostor/csio_scsi.c  | 29 ++--
 drivers/scsi/esp_scsi.c|  2 +-
 drivers/scsi/fnic/fnic_scsi.c  | 11 +
 drivers/scsi/ibmvscsi/ibmvfc.c | 16 ++-
 drivers/scsi/ipr.c | 34 ++
 drivers/scsi/lpfc/lpfc_scsi.c  | 16 +--
 drivers/scsi/pmcraid.c | 34 ++
 drivers/scsi/qla2xxx/qla_iocb.c| 92 ++
 drivers/scsi/qla2xxx/qla_mr.c  | 13 --
 drivers/scsi/qla4xxx/ql4_iocb.c| 10 -
 drivers/scsi/scsi_transport_spi.c  | 23 ++
 drivers/scsi/tmscsim.c | 12 +++--
 include/scsi/scsi_tcq.h| 21 -
 include/scsi/scsi_transport_spi.h  |  1 +
 19 files changed, 56 insertions(+), 311 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h
index b1d2024..df2b541 100644
--- a/drivers/s390/scsi/zfcp_fc.h
+++ b/drivers/s390/scsi/zfcp_fc.h
@@ -212,8 +212,6 @@ static inline
 void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi,
 u8 tm_flags)
 {
-   char tag[2];
-
int_to_scsilun(scsi-device-lun, (struct scsi_lun *) fcp-fc_lun);
 
if (unlikely(tm_flags)) {
@@ -221,17 +219,7 @@ void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct 
scsi_cmnd *scsi,
return;
}
 
-   if (scsi_populate_tag_msg(scsi, tag)) {
-   switch (tag[0]) {
-   case MSG_ORDERED_TAG:
-   fcp-fc_pri_ta |= FCP_PTA_ORDERED;
-   break;
-   case MSG_SIMPLE_TAG:
-   fcp-fc_pri_ta |= FCP_PTA_SIMPLE;
-   break;
-   };
-   } else
-   fcp-fc_pri_ta = FCP_PTA_SIMPLE;
+   fcp-fc_pri_ta = FCP_PTA_SIMPLE;
 
if (scsi-sc_data_direction == DMA_FROM_DEVICE)
fcp-fc_flags |= FCP_CFL_RDDATA;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 5143d32..1b36fd3 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1427,7 +1427,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
if((hostdata-tag_negotiated  (1scmd_id(SCp)))
(slot-tag != SCSI_NO_TAG  SCp-cmnd[0] != REQUEST_SENSE 
   slot-flags != NCR_700_FLAG_AUTOSENSE)) {
-   count += scsi_populate_tag_msg(SCp, hostdata-msgout[count]);
+   count += spi_populate_tag_msg(hostdata-msgout[count], SCp);
}
 
if(hostdata-fast 
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c 
b/drivers/scsi/aic7xxx/aic79xx_osm.c
index ed333669..d3b6d68 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1619,15 +1619,6 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct 
ahd_linux_device *dev,
}
 
if ((dev-flags  (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) {
-   int msg_bytes;
-   uint8_t tag_msgs[2];
-
-   msg_bytes = scsi_populate_tag_msg(cmd, tag_msgs);
-   if (msg_bytes  tag_msgs[0] != MSG_SIMPLE_TASK) {
-   hscb-control |= tag_msgs[0];
-   if (tag_msgs[0] == MSG_ORDERED_TASK)
-   dev-commands_since_idle_or_otag = 0;
-   } else
if (dev-commands_since_idle_or_otag == AHD_OTAG_THRESH
  (dev-flags  AHD_DEV_Q_TAGGED) != 0) {
hscb-control |= MSG_ORDERED_TASK;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c 
b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 63bae7c..33a5f95 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1501,15 +1501,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct 
ahc_linux_device *dev,
}
 
if ((dev-flags  (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) {
-   int msg_bytes;
-   uint8_t tag_msgs[2];
-   
-   msg_bytes = scsi_populate_tag_msg(cmd, tag_msgs);
-   if (msg_bytes  tag_msgs[0] != MSG_SIMPLE_TASK) {
-   hscb-control |= tag_msgs[0];
-   if (tag_msgs[0] == MSG_ORDERED_TASK)
-   dev-commands_since_idle_or_otag = 0;
-   } else if (dev-commands_since_idle_or_otag == AHC_OTAG_THRESH
+   if (dev-commands_since_idle_or_otag == AHC_OTAG_THRESH
 

tag handling refactor V2

2014-11-10 Thread Christoph Hellwig
The current SCSI handling suffers from large amounts of duplicate code, and
a general confusion of multiple concepts of tagging.

This series tries to reduce the amount of code, and introduce two separate
clear concepts of tagging:

 a) a driver can request block-level tagging to always have a valid index
assigned to cmd-request-tag by the block layer.  This is already
automatically done for the blk-mq case, but this gives the optional
legacy request taggign similar semantics.
 b) the concept of a SCSI tagged command is now entirely separate from
providing an actual tag, and always provided in a flag in the SCSI
command.  The driver does not need to opt-in this information, but
it doesn't have to use it.

While this series removes 750 lines of code and provides a much cleaner driver
API it also opens up new questions:

 - how is the change_queue_type API supposed to be used for most drivers?  It
   only changes the tag type from none to simple or back, but except for the
   special implementation in the 53c700 driver doesn't change the queue depth,
   which might cause it to issue multiple non-tagged command.  Fortunately
   most drivers never look at this information, but then again changing the
   queue type is useless to start with.
 - for those drivers looking at the command tagged information we'd need
   to quiesce the LUN.  No driver but the 53c700 driver does that, and the
   53c700 does it at a target-level, which despite a comment claiming it's
   needed doesn't seem to make sense given the code.  If we can make sure
   to quience all LUNs we could avoid the per-command flag for tagged commands
   and always look at the scsi_device flag.
 - similarly, do we need any synchronization when answering a tag message 
reject?
 - queue ramp down may drop to untagged mode, but queue ramp up never reverseѕ
   that.
 - the -tagged_supported and -simple_tags flags are bit-fields without clear
   locking protection.  We probably want to move these and similar fields to
   a proper atomic bit flags member.
 - should the MSG_*_TAG fields move to the SPI transport class?  That's where
   they are defined, and besides SPI drivers they are only (ab)used by the
   target code now.

Changes since V1:
 - small fixes for various review 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 01/11] scsi: provide a generic change_queue_type method

2014-11-10 Thread Christoph Hellwig
Most drivers use exactly the same implementation, so provide it as a
library function.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Bart Van Assche bvanass...@acm.org
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
Reviewed-by: Hannes Reinecke h...@suse.de
---
 drivers/infiniband/ulp/srp/ib_srp.c  | 24 +---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c|  2 +-
 drivers/scsi/esas2r/esas2r.h |  1 -
 drivers/scsi/esas2r/esas2r_main.c| 20 +---
 drivers/scsi/fcoe/fcoe.c |  2 +-
 drivers/scsi/fnic/fnic_main.c|  2 +-
 drivers/scsi/ibmvscsi/ibmvfc.c   | 25 +
 drivers/scsi/ipr.c   | 20 +++-
 drivers/scsi/libfc/fc_fcp.c  | 20 
 drivers/scsi/lpfc/lpfc_scsi.c| 24 ++--
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 24 +---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 25 +
 drivers/scsi/pmcraid.c   | 14 --
 drivers/scsi/qla2xxx/qla_os.c| 18 +-
 drivers/scsi/scsi.c  | 20 
 drivers/scsi/scsi_debug.c|  9 +
 drivers/target/loopback/tcm_loop.c   | 17 +
 include/scsi/libfc.h |  1 -
 include/scsi/scsi_tcq.h  |  2 ++
 19 files changed, 42 insertions(+), 228 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c 
b/drivers/infiniband/ulp/srp/ib_srp.c
index 62d2a18..51670d7 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2259,28 +2259,6 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct 
ib_cm_event *event)
 }
 
 /**
- * srp_change_queue_type - changing device queue tag type
- * @sdev: scsi device struct
- * @tag_type: requested tag type
- *
- * Returns queue tag type.
- */
-static int
-srp_change_queue_type(struct scsi_device *sdev, int tag_type)
-{
-   if (sdev-tagged_supported) {
-   scsi_set_tag_type(sdev, tag_type);
-   if (tag_type)
-   scsi_activate_tcq(sdev, sdev-queue_depth);
-   else
-   scsi_deactivate_tcq(sdev, sdev-queue_depth);
-   } else
-   tag_type = 0;
-
-   return tag_type;
-}
-
-/**
  * srp_change_queue_depth - setting device queue depth
  * @sdev: scsi device struct
  * @qdepth: requested queue depth
@@ -2600,7 +2578,7 @@ static struct scsi_host_template srp_template = {
.info   = srp_target_info,
.queuecommand   = srp_queuecommand,
.change_queue_depth = srp_change_queue_depth,
-   .change_queue_type  = srp_change_queue_type,
+   .change_queue_type  = scsi_change_queue_type,
.eh_abort_handler   = srp_abort,
.eh_device_reset_handler= srp_reset_device,
.eh_host_reset_handler  = srp_reset_host,
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 79e5c94..3c6dc8a 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2784,7 +2784,7 @@ static struct scsi_host_template bnx2fc_shost_template = {
.eh_host_reset_handler  = fc_eh_host_reset,
.slave_alloc= fc_slave_alloc,
.change_queue_depth = fc_change_queue_depth,
-   .change_queue_type  = fc_change_queue_type,
+   .change_queue_type  = scsi_change_queue_type,
.this_id= -1,
.cmd_per_lun= 3,
.use_clustering = ENABLE_CLUSTERING,
diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index 3fd305d..20ab211 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -976,7 +976,6 @@ int esas2r_slave_alloc(struct scsi_device *dev);
 int esas2r_slave_configure(struct scsi_device *dev);
 void esas2r_slave_destroy(struct scsi_device *dev);
 int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason);
-int esas2r_change_queue_type(struct scsi_device *dev, int type);
 long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
 
 /* SCSI error handler (eh) functions */
diff --git a/drivers/scsi/esas2r/esas2r_main.c 
b/drivers/scsi/esas2r/esas2r_main.c
index 45aa684..be09c62 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -258,7 +258,7 @@ static struct scsi_host_template driver_template = {
.slave_alloc= esas2r_slave_alloc,
.slave_destroy  = esas2r_slave_destroy,
.change_queue_depth = esas2r_change_queue_depth,
-   .change_queue_type  = esas2r_change_queue_type,
+   .change_queue_type  = scsi_change_queue_type,
.max_sectors= 0x,
 };
 
@@ -1268,24 

[PATCH 10/11] scsi: don't force tagged_supported in drivers

2014-11-10 Thread Christoph Hellwig
Now that we also get proper values in cmd-request-tag for untagged
commands, there is no need to force tagged_supported to on in drivers
that need host-wide tags.

Signed-off-by: Christoph Hellwig h...@lst.de
---
 drivers/scsi/fnic/fnic_main.c   |  2 --
 drivers/scsi/libsas/sas_scsi_host.c |  1 -
 drivers/scsi/qla4xxx/ql4_os.c   |  9 -
 drivers/scsi/scsi_debug.c   |  1 -
 drivers/scsi/stex.c | 11 ---
 drivers/scsi/ufs/ufshcd.c   |  6 +-
 6 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 0f29e3f..cf1560c 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -95,8 +95,6 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
 {
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
 
-   sdev-tagged_supported = 1;
-
if (!rport || fc_remote_port_chkready(rport))
return -ENXIO;
 
diff --git a/drivers/scsi/libsas/sas_scsi_host.c 
b/drivers/scsi/libsas/sas_scsi_host.c
index 56d698a..89e8b68 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -945,7 +945,6 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
SAS_DPRINTK(device %llx, LUN %llx doesn't support 
TCQ\n, SAS_ADDR(dev-sas_addr),
scsi_dev-lun);
-   scsi_dev-tagged_supported = 0;
scsi_adjust_queue_depth(scsi_dev, 1);
}
 
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 784f59e..f8724f2 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -162,7 +162,6 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd);
 static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd);
 static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd);
 static int qla4xxx_slave_alloc(struct scsi_device *device);
-static int qla4xxx_slave_configure(struct scsi_device *device);
 static umode_t qla4_attr_is_visible(int param_type, int param);
 static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type);
 static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth,
@@ -203,7 +202,6 @@ static struct scsi_host_template qla4xxx_driver_template = {
.eh_host_reset_handler  = qla4xxx_eh_host_reset,
.eh_timed_out   = qla4xxx_eh_cmd_timed_out,
 
-   .slave_configure= qla4xxx_slave_configure,
.slave_alloc= qla4xxx_slave_alloc,
.change_queue_depth = qla4xxx_change_queue_depth,
 
@@ -9059,7 +9057,6 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
ddb = sess-dd_data;
 
sdev-hostdata = ddb;
-   sdev-tagged_supported = 1;
 
if (ql4xmaxqdepth != 0  ql4xmaxqdepth = 0xU)
queue_depth = ql4xmaxqdepth;
@@ -9068,12 +9065,6 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
return 0;
 }
 
-static int qla4xxx_slave_configure(struct scsi_device *sdev)
-{
-   sdev-tagged_supported = 1;
-   return 0;
-}
-
 static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth,
  int reason)
 {
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index fce4e47..b025713 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2700,7 +2700,6 @@ static int scsi_debug_slave_configure(struct scsi_device 
*sdp)
devip = devInfoReg(sdp);
if (NULL == devip)
return 1;   /* no resources, will be marked offline */
-   sdp-tagged_supported = 1;
sdp-hostdata = devip;
blk_queue_max_segment_size(sdp-request_queue, -1U);
if (scsi_debug_no_uld)
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 2bb8a9e..98a62bc 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -544,21 +544,11 @@ stex_ss_send_cmd(struct st_hba *hba, struct req_msg *req, 
u16 tag)
 }
 
 static int
-stex_slave_alloc(struct scsi_device *sdev)
-{
-   /* Cheat: usually extracted from Inquiry data */
-   sdev-tagged_supported = 1;
-
-   return 0;
-}
-
-static int
 stex_slave_config(struct scsi_device *sdev)
 {
sdev-use_10_for_rw = 1;
sdev-use_10_for_ms = 1;
blk_queue_rq_timeout(sdev-request_queue, 60 * HZ);
-   sdev-tagged_supported = 1;
 
return 0;
 }
@@ -1380,7 +1370,6 @@ static struct scsi_host_template driver_template = {
.proc_name  = DRV_NAME,
.bios_param = stex_biosparam,
.queuecommand   = stex_queuecommand,
-   .slave_alloc= stex_slave_alloc,
.slave_configure= stex_slave_config,
.eh_abort_handler   = stex_abort,
.eh_host_reset_handler  = stex_reset,
diff --git a/drivers/scsi/ufs/ufshcd.c 

[PATCH 08/11] scsi: always assign block layer tags if enabled

2014-11-10 Thread Christoph Hellwig
Allow a driver to ask for block layer tags by setting .use_blk_tags in the
host template, in which case it will always see a valid value in
request-tag, similar to the behavior when using blk-mq.  This means even
SCSI untagged commands will now have a tag, which is especially useful
when using a host-wide tag map.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
Reviewed-by: Hannes Reinecke h...@suse.de
---
 Documentation/scsi/scsi_mid_low_api.txt | 38 +
 drivers/message/fusion/mptsas.c |  1 +
 drivers/scsi/53c700.c   | 12 +--
 drivers/scsi/aic7xxx/aic79xx_osm.c  | 11 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.c  | 11 +-
 drivers/scsi/aic94xx/aic94xx_init.c |  1 +
 drivers/scsi/bfa/bfad_im.c  |  8 +++
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c   |  1 +
 drivers/scsi/csiostor/csio_scsi.c   |  8 +++
 drivers/scsi/esas2r/esas2r_main.c   | 12 +--
 drivers/scsi/esp_scsi.c |  6 +++---
 drivers/scsi/fcoe/fcoe.c|  1 +
 drivers/scsi/fnic/fnic_main.c   |  3 ++-
 drivers/scsi/ibmvscsi/ibmvfc.c  | 11 +-
 drivers/scsi/ipr.c  |  1 +
 drivers/scsi/isci/init.c|  1 +
 drivers/scsi/libfc/fc_fcp.c |  7 +-
 drivers/scsi/libsas/sas_scsi_host.c | 11 +++---
 drivers/scsi/lpfc/lpfc_scsi.c   |  7 +++---
 drivers/scsi/mvsas/mv_init.c|  1 +
 drivers/scsi/pm8001/pm8001_init.c   |  1 +
 drivers/scsi/pmcraid.c  |  4 ++--
 drivers/scsi/qla2xxx/qla_os.c   |  6 ++
 drivers/scsi/qla4xxx/ql4_os.c   | 10 ++---
 drivers/scsi/scsi.c | 12 ---
 drivers/scsi/scsi_scan.c|  6 ++
 drivers/scsi/stex.c | 10 ++---
 drivers/scsi/tmscsim.c  |  3 ++-
 drivers/scsi/ufs/ufshcd.c   |  5 +++--
 drivers/target/loopback/tcm_loop.c  |  2 +-
 drivers/usb/storage/uas.c   |  4 ++--
 include/scsi/scsi_host.h|  5 +
 include/scsi/scsi_tcq.h | 34 -
 33 files changed, 86 insertions(+), 168 deletions(-)

diff --git a/Documentation/scsi/scsi_mid_low_api.txt 
b/Documentation/scsi/scsi_mid_low_api.txt
index d6a9bde..a671942 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -366,13 +366,11 @@ is initialized. The functions below are listed 
alphabetically and their
 names all start with scsi_.
 
 Summary:
-   scsi_activate_tcq - turn on tag command queueing
scsi_add_device - creates new scsi device (lu) instance
scsi_add_host - perform sysfs registration and set up transport class
scsi_adjust_queue_depth - change the queue depth on a SCSI device
scsi_bios_ptable - return copy of block device's partition table
scsi_block_requests - prevent further commands being queued to given host
-   scsi_deactivate_tcq - turn off tag command queueing
scsi_host_alloc - return a new scsi_host instance whose refcount==1
scsi_host_get - increments Scsi_Host instance's refcount
scsi_host_put - decrements Scsi_Host instance's refcount (free if 0)
@@ -390,24 +388,6 @@ Summary:
 Details:
 
 /**
- * scsi_activate_tcq - turn on tag command queueing (ordered task attribute)
- * @sdev:   device to turn on TCQ for
- * @depth:  queue depth
- *
- *  Returns nothing
- *
- *  Might block: no
- *
- *  Notes: Eventually, it is hoped depth would be the maximum depth
- *  the device could cope with and the real queue depth
- *  would be adjustable from 0 to depth.
- *
- *  Defined (inline) in: include/scsi/scsi_tcq.h
- **/
-void scsi_activate_tcq(struct scsi_device *sdev, int depth)
-
-
-/**
  * scsi_add_device - creates new scsi device (lu) instance
  * @shost:   pointer to scsi host instance
  * @channel: channel number (rarely other than 0)
@@ -471,9 +451,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * 
dev)
  *
  *  Notes: Can be invoked any time on a SCSI device controlled by this
  *  LLD. [Specifically during and after slave_configure() and prior to
- *  slave_destroy().] Can safely be invoked from interrupt code. Actual
- *  queue depth change may be delayed until the next command is being
- *  processed. See also scsi_activate_tcq() and scsi_deactivate_tcq().
+ *  slave_destroy().] Can safely be invoked from interrupt code.
  *
  *  Defined in: drivers/scsi/scsi.c [see source code for more notes]
  *
@@ -515,20 +493,6 @@ void scsi_block_requests(struct Scsi_Host * shost)
 
 
 /**
- * scsi_deactivate_tcq - turn off tag command queueing
- * @sdev:   device to turn off TCQ for
- * @depth:  queue depth (stored in sdev)
- *
- *  Returns nothing
- *
- *  Might block: no
- *
- *  Defined (inline) in: 

[PATCH 09/11] scsi: don't set tagging state from scsi_adjust_queue_depth

2014-11-10 Thread Christoph Hellwig
Remove the tagged argument from scsi_adjust_queue_depth, and just let it
handle the queue depth.  For most drivers those two are fairly separate,
given that most modern drivers don't care about the SCSI tagged status
of a command at all, and many old drivers allow queuing of multiple
untagged commands in the driver.

Instead we start out with the -simple_tags flag set before calling
-slave_configure, which is how all drivers actually looking at
-simple_tags except for one worke anyway.  The one other case looks
broken, but I've kept the behavior as-is for now.

Except for that we only change -simple_tags from the -change_queue_type,
and when rejecting a tag message in a single driver, so keeping this
churn out of scsi_adjust_queue_depth is a clear win.

Now that the usage of scsi_adjust_queue_depth is more obvious we can
also remove all the trivial instances in -slave_alloc or -slave_configure
that just set it to the cmd_per_lun default.

Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
---
 Documentation/scsi/scsi_mid_low_api.txt   | 12 --
 drivers/ata/libata-scsi.c |  4 ++--
 drivers/infiniband/ulp/srp/ib_srp.c   |  2 +-
 drivers/message/fusion/mptscsih.c |  2 +-
 drivers/s390/scsi/zfcp_scsi.c |  8 +++
 drivers/scsi/3w-9xxx.c|  2 +-
 drivers/scsi/3w-sas.c |  2 +-
 drivers/scsi/3w-.c|  2 +-
 drivers/scsi/53c700.c | 17 ++---
 drivers/scsi/BusLogic.c   |  4 ++--
 drivers/scsi/aacraid/linit.c  |  8 +++
 drivers/scsi/advansys.c   |  7 ++
 drivers/scsi/aic7xxx/aic79xx_osm.c|  7 ++
 drivers/scsi/aic7xxx/aic7xxx_osm.c|  8 ++-
 drivers/scsi/arcmsr/arcmsr_hba.c  |  2 +-
 drivers/scsi/bfa/bfad_im.c|  3 +--
 drivers/scsi/csiostor/csio_scsi.c |  2 +-
 drivers/scsi/dpt_i2o.c|  4 +---
 drivers/scsi/eata.c   |  8 +++
 drivers/scsi/esas2r/esas2r.h  |  3 ---
 drivers/scsi/esas2r/esas2r_main.c | 29 +-
 drivers/scsi/esp_scsi.c   | 17 ++---
 drivers/scsi/fnic/fnic_main.c |  2 +-
 drivers/scsi/gdth.c   |  1 -
 drivers/scsi/hpsa.c   |  2 +-
 drivers/scsi/hptiop.c |  2 +-
 drivers/scsi/ibmvscsi/ibmvfc.c|  8 +--
 drivers/scsi/ibmvscsi/ibmvscsi.c  |  3 +--
 drivers/scsi/ipr.c|  8 +++
 drivers/scsi/ips.c|  2 +-
 drivers/scsi/libfc/fc_fcp.c   |  6 ++---
 drivers/scsi/libiscsi.c   |  4 ++--
 drivers/scsi/libsas/sas_scsi_host.c   | 20 +---
 drivers/scsi/lpfc/lpfc_scsi.c |  4 ++--
 drivers/scsi/megaraid/megaraid_mbox.c |  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c |  3 +--
 drivers/scsi/mpt2sas/mpt2sas_scsih.c  |  2 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c  |  2 +-
 drivers/scsi/ncr53c8xx.c  |  5 +---
 drivers/scsi/pmcraid.c| 40 ++-
 drivers/scsi/qla1280.c|  5 ++--
 drivers/scsi/qla2xxx/qla_os.c |  6 ++---
 drivers/scsi/qla4xxx/ql4_os.c |  2 +-
 drivers/scsi/scsi.c   | 25 ---
 drivers/scsi/scsi_debug.c |  7 ++
 drivers/scsi/scsi_scan.c  |  6 +++--
 drivers/scsi/stex.c   |  2 --
 drivers/scsi/storvsc_drv.c|  3 +--
 drivers/scsi/sym53c8xx_2/sym_glue.c   |  4 +---
 drivers/scsi/tmscsim.c|  9 ++-
 drivers/scsi/u14-34f.c| 10 
 drivers/scsi/ufs/ufshcd.c |  4 ++--
 drivers/scsi/virtio_scsi.c|  4 +---
 drivers/scsi/vmw_pvscsi.c |  2 +-
 drivers/target/loopback/tcm_loop.c| 18 ++
 drivers/usb/storage/uas.c |  2 +-
 include/scsi/scsi_device.h|  2 +-
 57 files changed, 120 insertions(+), 260 deletions(-)

diff --git a/Documentation/scsi/scsi_mid_low_api.txt 
b/Documentation/scsi/scsi_mid_low_api.txt
index a671942..bee7d86 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -271,9 +271,9 @@ init_this_scsi_driver() +
   slave_destroy() ***
 
 
-The mid level invokes scsi_adjust_queue_depth() with tagged queuing off and
-cmd_per_lun for that host as the queue length. These settings can be
-overridden by a slave_configure() supplied by the LLD.
+The mid level invokes scsi_adjust_queue_depth() with cmd_per_lun for that
+host as the queue length. These settings can be overridden by a
+slave_configure() supplied by the LLD.
 
 *** 

[PATCH 07/11] scsi: remove use_blk_tcq Scsi_Host field

2014-11-10 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig h...@lst.de
Reviewed-by: Hannes Reinecke h...@suse.de
Reviewed-by: Martin K. Petersen martin.peter...@oracle.com
---
 include/scsi/scsi_host.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 5b03ba9..d6bd652 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -650,7 +650,6 @@ struct Scsi_Host {
unsigned active_mode:2;
unsigned unchecked_isa_dma:1;
unsigned use_clustering:1;
-   unsigned use_blk_tcq:1;
 
/*
 * Host has requested that no further requests come through for the
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/11] ufs: remove spurious scsi_set_tag_type call

2014-11-10 Thread Christoph Hellwig
ufs never looks at the tag type, so there is no need to set it either.

Signed-off-by: Christoph Hellwig h...@lst.de
---
 drivers/scsi/ufs/ufshcd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 67e2280..362b818 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2768,7 +2768,6 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
 
/* Mode sense(6) is not supported by UFS, so use Mode sense(10) */
sdev-use_10_for_ms = 1;
-   scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
 
/* allow SCSI layer to restart the device in case of errors */
sdev-allow_restart = 1;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: UNMAP command parameter list

2014-11-10 Thread Andras Kovacs
Andras Kovacs akovacs at fixstars.com writes:

 
 Elliott, Robert (Server Storage Elliott at hp.com writes:
 
  That is the data transferred for the command, not in the
  command descriptor block itself.
 
 Thank you. Then I guess I'll find the Paramerer List in the struct
 scsi_data_buffer sdb variable (within struct scsi_cmnd). Will check on 
 Monday.

  I've looked into it, but struct scsi_data_buffer doesn't contain a byte
array (rather a struct sg_table variable and some housekeeping vars). So my
question is still: where can I find the Parameter List associated with a
particular UNMAP command?


--
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/2] virtio_scsi: support multi hw queue of blk-mq

2014-11-10 Thread Christoph Hellwig
On Mon, Nov 10, 2014 at 10:25:43PM +0800, Ming Lei wrote:
 It depends on how long the transition period is, and other drivers
 with multi hwq support might be in the same situation with virtio-scsi. If
 the period is a bit long, it would be painful for these drivers to support
 both blk-mq and non-mq.

If it's too long we need to find better ways to control the behavior.  But
honestly I'd rather prefer to keep selected drivers on the old code for
that case than the other way around.

We currently still have two big blockers for having any sort of real
blk-mq by default decision for scsi:

 a) there is no multiath support for it, and we simply can't break existing
setups that use.
 b) there is no support for I/O schedulers at all.  This might be okay
for virtio-scsi, where in general you have a host scheduler, but for
real hardware that still has to deal with more spinning rust than
solid state it's a blocker.  Fortuntely Jens is working on that one.

 Also with force_blk_mq on virtio-scsi, people can test scsi-mq with
 default setting, then it should be helpful to collect more test reports, :-)

I think between the config and the module/boot option we've already got
ways to get reports.  Improvements welcome.
--
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: UNMAP command parameter list

2014-11-10 Thread Martin K. Petersen
 Andras == Andras Kovacs akov...@fixstars.com writes:

 Thank you. Then I guess I'll find the Paramerer List in the struct
 scsi_data_buffer sdb variable (within struct scsi_cmnd). Will check
 on Monday.

Andras I've looked into it, but struct scsi_data_buffer doesn't contain
Andras a byte array (rather a struct sg_table variable and some
Andras housekeeping vars). So my question is still: where can I find
Andras the Parameter List associated with a particular UNMAP command?

You'll have to traverse scatterlist and extract the descriptor from
there. You can use scsi_for_each_sg() to walk the list.

If you only care about in-kernel discards it's pretty easy since we only
issue a single descriptor. If you want to support arbitrary block pc
UNMAP commands you'll have to be able to deal with multiple descriptors
across multiple scatterlist elements. But the accessor macro makes that
easy so I suggest you take 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


[PATCH v6 1/7] vfs: Prepare for adding a new preadv/pwritev with user flags.

2014-11-10 Thread Milosz Tanski
Plumbing the flags argument through the vfs code so they can be passed down to
__generic_file_(read/write)_iter function that do the acctual work.

Signed-off-by: Milosz Tanski mil...@adfin.com
Reviewed-by: Christoph Hellwig h...@lst.de
Reviewed-by: Jeff Moyer jmo...@redhat.com
---
 drivers/target/target_core_file.c |  6 +++---
 fs/nfsd/vfs.c |  4 ++--
 fs/read_write.c   | 27 +++
 fs/splice.c   |  2 +-
 include/linux/aio.h   |  2 ++
 include/linux/fs.h|  4 ++--
 6 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/target/target_core_file.c 
b/drivers/target/target_core_file.c
index 7d6cdda..58d9a6d 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -350,9 +350,9 @@ static int fd_do_rw(struct se_cmd *cmd, struct scatterlist 
*sgl,
set_fs(get_ds());
 
if (is_write)
-   ret = vfs_writev(fd, iov[0], sgl_nents, pos);
+   ret = vfs_writev(fd, iov[0], sgl_nents, pos, 0);
else
-   ret = vfs_readv(fd, iov[0], sgl_nents, pos);
+   ret = vfs_readv(fd, iov[0], sgl_nents, pos, 0);
 
set_fs(old_fs);
 
@@ -528,7 +528,7 @@ fd_execute_write_same(struct se_cmd *cmd)
 
old_fs = get_fs();
set_fs(get_ds());
-   rc = vfs_writev(f, iov[0], iov_num, pos);
+   rc = vfs_writev(f, iov[0], iov_num, pos, 0);
set_fs(old_fs);
 
vfree(iov);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 989129e..ef01c78 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -872,7 +872,7 @@ __be32 nfsd_readv(struct file *file, loff_t offset, struct 
kvec *vec, int vlen,
 
oldfs = get_fs();
set_fs(KERNEL_DS);
-   host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, offset);
+   host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, offset, 
0);
set_fs(oldfs);
return nfsd_finish_read(file, count, host_err);
 }
@@ -960,7 +960,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, 
struct file *file,
 
/* Write the data. */
oldfs = get_fs(); set_fs(KERNEL_DS);
-   host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, pos);
+   host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, pos, 0);
set_fs(oldfs);
if (host_err  0)
goto out_nfserr;
diff --git a/fs/read_write.c b/fs/read_write.c
index 7d9318c..94b2d34 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -653,7 +653,8 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long 
nr_segs, size_t to)
 EXPORT_SYMBOL(iov_shorten);
 
 static ssize_t do_iter_readv_writev(struct file *filp, int rw, const struct 
iovec *iov,
-   unsigned long nr_segs, size_t len, loff_t *ppos, iter_fn_t fn)
+   unsigned long nr_segs, size_t len, loff_t *ppos, iter_fn_t fn,
+   int flags)
 {
struct kiocb kiocb;
struct iov_iter iter;
@@ -662,6 +663,7 @@ static ssize_t do_iter_readv_writev(struct file *filp, int 
rw, const struct iove
init_sync_kiocb(kiocb, filp);
kiocb.ki_pos = *ppos;
kiocb.ki_nbytes = len;
+   kiocb.ki_rwflags = flags;
 
iov_iter_init(iter, rw, iov, nr_segs, len);
ret = fn(kiocb, iter);
@@ -800,7 +802,8 @@ out:
 
 static ssize_t do_readv_writev(int type, struct file *file,
   const struct iovec __user * uvector,
-  unsigned long nr_segs, loff_t *pos)
+  unsigned long nr_segs, loff_t *pos,
+  int flags)
 {
size_t tot_len;
struct iovec iovstack[UIO_FASTIOV];
@@ -834,7 +837,7 @@ static ssize_t do_readv_writev(int type, struct file *file,
 
if (iter_fn)
ret = do_iter_readv_writev(file, type, iov, nr_segs, tot_len,
-   pos, iter_fn);
+   pos, iter_fn, flags);
else if (fnv)
ret = do_sync_readv_writev(file, iov, nr_segs, tot_len,
pos, fnv);
@@ -857,27 +860,27 @@ out:
 }
 
 ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
- unsigned long vlen, loff_t *pos)
+ unsigned long vlen, loff_t *pos, int flags)
 {
if (!(file-f_mode  FMODE_READ))
return -EBADF;
if (!(file-f_mode  FMODE_CAN_READ))
return -EINVAL;
 
-   return do_readv_writev(READ, file, vec, vlen, pos);
+   return do_readv_writev(READ, file, vec, vlen, pos, flags);
 }
 
 EXPORT_SYMBOL(vfs_readv);
 
 ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
-  unsigned long vlen, loff_t *pos)
+  unsigned long vlen, loff_t *pos, int flags)
 {
if (!(file-f_mode  FMODE_WRITE))
return 

Re: [PATCH 1/1] be2iscsi: add block valid bit to iBFT flag

2014-11-10 Thread Mike Christie
Adding Vikas to verify if qla4xxx has the same issue.

On 11/10/2014 12:52 AM, Minh Duc Tran wrote:
 From: Minh Tran minhduc.t...@emulex.com mailto:minhduc.t...@emulex.com
 
  
 
We are starting to see problems with certain open-iscsi
 versions out there checking block valid bit.  Iscsi boot target login
 will not happen without this bit being set.
 

What versions of open-iscsi? Is it just the SUSE based versions?

  
 
 Signed-off-by: Minh Tran minhduc.t...@emulex.com
 
 ---
 
 scsi/be2iscsi/be_main.c |4 ++--
 
 1 files changed, 2 insertions(+), 2 deletions(-)
 
  
 
 diff --git a/scsi/be2iscsi/be_main.c b/scsi/be2iscsi/be_main.c
 
 index 30d74a0..aacf223 100644
 
 --- a/scsi/be2iscsi/be_main.c
 
 +++ b/scsi/be2iscsi/be_main.c
 
 @@ -429,7 +429,7 @@ static ssize_t beiscsi_show_boot_tgt_info(void
 *data, int type, char *buf)
 
  auth_data.chap.intr_secret);
 
 break;
 
 case ISCSI_BOOT_TGT_FLAGS:
 
 -   rc = sprintf(str, 2\n);
 
 +   rc = sprintf(str, 3\n);
 
 break;
 
 case ISCSI_BOOT_TGT_NIC_ASSOC:
 
 rc = sprintf(str, 0\n);
 
 @@ -466,7 +466,7 @@ static ssize_t beiscsi_show_boot_eth_info(void
 *data, int type, char *buf)
 
  
 
 switch (type) {
 
 case ISCSI_BOOT_ETH_FLAGS:
 
 -   rc = sprintf(str, 2\n);
 
 +   rc = sprintf(str, 3\n);
 
 break;
 
 case ISCSI_BOOT_ETH_INDEX:
 
 rc = sprintf(str, 0\n);
 

I think we want to move SYSFS_FLAG_FW_SEL_BOOT from ql4_def.h to
include/linux/iscsi_boot_sysfs.h (also add a ISCSI_BOOT_ prefix), and
then have both drivers use it.

--
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: UNMAP command parameter list

2014-11-10 Thread Christoph Hellwig
On Mon, Nov 10, 2014 at 11:44:39AM -0500, Martin K. Petersen wrote:
 You'll have to traverse scatterlist and extract the descriptor from
 there. You can use scsi_for_each_sg() to walk the list.
 
 If you only care about in-kernel discards it's pretty easy since we only
 issue a single descriptor. If you want to support arbitrary block pc
 UNMAP commands you'll have to be able to deal with multiple descriptors
 across multiple scatterlist elements. But the accessor macro makes that
 easy so I suggest you take that approach.

Note that if the hardware doesn't actually implement UNMAP and you have
to emulate something you're probably better off emulating WRITE SAME
(16) with the UNMAP bit, as the format is a lot easier to handle,
and it's much better specified to start with.
--
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: UNMAP command parameter list

2014-11-10 Thread Martin K. Petersen
 Christoph == Christoph Hellwig h...@infradead.org writes:

Christoph Note that if the hardware doesn't actually implement UNMAP
Christoph and you have to emulate something you're probably better off
Christoph emulating WRITE SAME (16) with the UNMAP bit, as the format
Christoph is a lot easier to handle, and it's much better specified to
Christoph start with.

Yup, absolutely!

-- 
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: [PATCHv3 net-next 0/3] RDMA/cxgb4,cxgb4vf,cxgb4i,csiostor: Cleanup macros

2014-11-10 Thread David Miller
From: Hariprasad Shenai haripra...@chelsio.com
Date: Fri,  7 Nov 2014 09:35:22 +0530

 This series moves the debugfs code to a new file debugfs.c and cleans up
 macros/register defines.
 
 Various patches have ended up changing the style of the symbolic 
 macros/register
 defines and some of them used the macros/register defines that matches the
 output of the script from the hardware team.
 
 As a result, the current kernel.org files are a mix of different macro styles.
 Since this macro/register defines is used by five different drivers, a
 few patch series have ended up adding duplicate macro/register define entries
 with different styles. This makes these register define/macro files a complete
 mess and we want to make them clean and consistent.
 
 Will post few more series so that we can cover all the macros so that they all
 follow the same style to be consistent.
 
 The patches series is created against 'net-next' tree.
 And includes patches on cxgb4, cxgb4vf, iw_cxgb4, csiostor and cxgb4i driver.
 
 We have included all the maintainers of respective drivers. Kindly review the
 change and let us know in case of any review comments.
 ...
 V3: Use suffix instead of prefix for macros/register defines
 V2: Changes the description and cover-letter content to answer David Miller's
 question

Series applied, 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: tag handling refactor V2

2014-11-10 Thread Mike Christie
On 11/10/2014 09:56 AM, Christoph Hellwig wrote:
 The current SCSI handling suffers from large amounts of duplicate code, and
 a general confusion of multiple concepts of tagging.
 
 This series tries to reduce the amount of code, and introduce two separate
 clear concepts of tagging:
 
  a) a driver can request block-level tagging to always have a valid index
 assigned to cmd-request-tag by the block layer.  This is already
 automatically done for the blk-mq case, but this gives the optional
 legacy request taggign similar semantics.
  b) the concept of a SCSI tagged command is now entirely separate from
 providing an actual tag, and always provided in a flag in the SCSI
 command.  The driver does not need to opt-in this information, but
 it doesn't have to use it.
 
 While this series removes 750 lines of code and provides a much cleaner driver
 API it also opens up new questions:
 
  - how is the change_queue_type API supposed to be used for most drivers?  It
only changes the tag type from none to simple or back, but except for the
special implementation in the 53c700 driver doesn't change the queue depth,
which might cause it to issue multiple non-tagged command.  Fortunately
most drivers never look at this information, but then again changing the
queue type is useless to start with.
  - for those drivers looking at the command tagged information we'd need
to quiesce the LUN.  No driver but the 53c700 driver does that, and the
53c700 does it at a target-level, which despite a comment claiming it's
needed doesn't seem to make sense given the code.  If we can make sure
to quience all LUNs we could avoid the per-command flag for tagged commands
and always look at the scsi_device flag.
  - similarly, do we need any synchronization when answering a tag message 
 reject?
  - queue ramp down may drop to untagged mode, but queue ramp up never reverseѕ
that.
  - the -tagged_supported and -simple_tags flags are bit-fields without clear
locking protection.  We probably want to move these and similar fields to
a proper atomic bit flags member.
  - should the MSG_*_TAG fields move to the SPI transport class?  That's where
they are defined, and besides SPI drivers they are only (ab)used by the
target code now.
 
 Changes since V1:
  - small fixes for various review comments
 

Looks nice 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: device handler cleanups V2

2014-11-10 Thread Mike Christie
On 10/30/2014 04:19 AM, Christoph Hellwig wrote:
 This series contains a couple easy cleanups for the device handler
 infrastructure.  I think some more work could be done in the longer run,
 e.g. by using a class_device interface to attach to the scsi_device,
 similar to how the /dev/sg devices work.
 
 Changes since V1:
  - fix -attach for rdac, pointed out by Mike Christie
 

Look 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 1/1] be2iscsi: add block valid bit to iBFT flag

2014-11-10 Thread Minh Duc Tran
Adding Vikas to verify if qla4xxx has the same issue.

On 11/10/2014 12:52 AM, Minh Duc Tran wrote:
 From: Minh Tran minhduc.t...@emulex.com 
 mailto:minhduc.t...@emulex.com
 
We are starting to see problems with certain open-iscsi 
 versions out there checking block valid bit.  Iscsi boot target login 
 will not happen without this bit being set.
 

What versions of open-iscsi? Is it just the SUSE based versions?

Yes, it's just the new SUSE open-iscsi for now.

I think we want to move SYSFS_FLAG_FW_SEL_BOOT from ql4_def.h to 
include/linux/iscsi_boot_sysfs.h (also add a ISCSI_BOOT_ prefix), and then 
have both drivers use it.

--
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: UNMAP command parameter list

2014-11-10 Thread Andras Kovacs
Christoph Hellwig hch at infradead.org writes:

 
 On Mon, Nov 10, 2014 at 11:44:39AM -0500, Martin K. Petersen wrote:
  You'll have to traverse scatterlist and extract the descriptor from
  there. You can use scsi_for_each_sg() to walk the list.

  Thank you; I'm working on it.

  
  If you only care about in-kernel discards it's pretty easy since we only
  issue a single descriptor. If you want to support arbitrary block pc
  UNMAP commands you'll have to be able to deal with multiple descriptors
  across multiple scatterlist elements. But the accessor macro makes that
  easy so I suggest you take that approach.
 
 Note that if the hardware doesn't actually implement UNMAP and you have
 to emulate something you're probably better off emulating WRITE SAME
 (16) with the UNMAP bit, as the format is a lot easier to handle,
 and it's much better specified to start with.

  Actually, my case is that the HW (at least in its current iteration)
doesn't support WRITE SAME but does support UNMAP. But it seems that the
discard option given to ext4 at mount time is ineffective in the sense of
not keeping up a high write transfer rate to the device (it looks like write
amplification is happening, something which discard -- and UNMAP -- ought to
preempt). So now I'm writing code to 'debug' the UNMAP commands which get
passed to the device.


--
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/5] [SCSI] Fnic: Improper resue of exchange Ids

2014-11-10 Thread Hiral Shah
IOs belonging to an rport are aborted with Internal terminate option
when rport goes offline. Any new IO issued to the rport during this
time can reuse the terminated exchange which will cause inconsistent
state of the exchange between local port and remote port.

fc_rport_priv is set to RPORT_ST_DELETE before exchanges are aborted by libfc.
Not issuing amy more I/O requests when RPORT_ST_DELETE is set, will avoid
inconsistent state of the exchange between local port and remote port.

- Increment fnic version from 1.6.0.13 to 1.6.0.14

Signed-off-by: Hiral Shah his...@cisco.com
Signed-off-by: Sesidhar Baddela sebad...@cisco.com
Signed-off-by: Anil Chintalapati achin...@cisco.com
---
 drivers/scsi/fnic/fnic.h  |  2 +-
 drivers/scsi/fnic/fnic_scsi.c | 11 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index dbc69ad..5336e8d 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
 
 #define DRV_NAME   fnic
 #define DRV_DESCRIPTIONCisco FCoE HBA Driver
-#define DRV_VERSION1.6.0.13
+#define DRV_VERSION1.6.0.14
 #define PFXDRV_NAME : 
 #define DFX DRV_NAME %d: 
 
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 961bdf5..d59d4c1 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -430,6 +430,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void 
(*done)(struct scsi_
int sg_count = 0;
unsigned long flags;
unsigned long ptr;
+   struct fc_rport_priv *rdata;
 
if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
return SCSI_MLQUEUE_HOST_BUSY;
@@ -443,6 +444,16 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, 
void (*done)(struct scsi_
return 0;
}
 
+   rdata = lp-tt.rport_lookup(lp, rport-port_id);
+   if (!rdata || (rdata-rp_state == RPORT_ST_DELETE)) {
+   FNIC_SCSI_DBG(KERN_DEBUG, fnic-lport-host,
+   returning IO as rport is removed\n);
+   atomic64_inc(fnic_stats-misc_stats.rport_not_ready);
+   sc-result = DID_NO_CONNECT;
+   done(sc);
+   return 0;
+   }
+
if (lp-state != LPORT_ST_READY || !(lp-link_up))
return SCSI_MLQUEUE_HOST_BUSY;
 
-- 
1.8.5.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 5/5] [SCSI] Fnic: Fnic Driver crashed with NULL pointer reference

2014-11-10 Thread Hiral Shah
When issuing I/O request, if the I/O completes before returning from
fnic_queuecommand(), we may be referencing scsi_cmnd structure that may
be freed by interrupt handler. Acquring IO lock would synchronize
fnic_queuecommand and interrupt handler.

- Increment fnic version from 1.6.0.15 to 1.6.0.16

Signed-off-by: Hiral Shah his...@cisco.com
Signed-off-by: Sesidhar Baddela sebad...@cisco.com
Signed-off-by: Anil Chintalapati achin...@cisco.com
---
 drivers/scsi/fnic/fnic.h  |  2 +-
 drivers/scsi/fnic/fnic_scsi.c | 21 ++---
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 977960b..3b73b96 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
 
 #define DRV_NAME   fnic
 #define DRV_DESCRIPTIONCisco FCoE HBA Driver
-#define DRV_VERSION1.6.0.15
+#define DRV_VERSION1.6.0.16
 #define PFXDRV_NAME : 
 #define DFX DRV_NAME %d: 
 
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index d59d4c1..1b8d5c2 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -428,9 +428,10 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, 
void (*done)(struct scsi_
int ret;
u64 cmd_trace;
int sg_count = 0;
-   unsigned long flags;
+   unsigned long flags = 0;
unsigned long ptr;
struct fc_rport_priv *rdata;
+   spinlock_t *io_lock = NULL;
 
if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
return SCSI_MLQUEUE_HOST_BUSY;
@@ -516,6 +517,13 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, 
void (*done)(struct scsi_
}
}
 
+   /*
+   * Will acquire lock defore setting to IO initialized.
+   */
+
+   io_lock = fnic_io_lock_hash(fnic, sc);
+   spin_lock_irqsave(io_lock, flags);
+
/* initialize rest of io_req */
io_req-port_id = rport-port_id;
io_req-start_time = jiffies;
@@ -532,11 +540,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, 
void (*done)(struct scsi_
 * In case another thread cancelled the request,
 * refetch the pointer under the lock.
 */
-   spinlock_t *io_lock = fnic_io_lock_hash(fnic, sc);
FNIC_TRACE(fnic_queuecommand, sc-device-host-host_no,
  sc-request-tag, sc, 0, 0, 0,
  (((u64)CMD_FLAGS(sc)  32) | CMD_STATE(sc)));
-   spin_lock_irqsave(io_lock, flags);
io_req = (struct fnic_io_req *)CMD_SP(sc);
CMD_SP(sc) = NULL;
CMD_STATE(sc) = FNIC_IOREQ_CMD_COMPLETE;
@@ -545,6 +551,10 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, 
void (*done)(struct scsi_
fnic_release_ioreq_buf(fnic, io_req, sc);
mempool_free(io_req, fnic-io_req_pool);
}
+   atomic_dec(fnic-in_flight);
+   /* acquire host lock before returning to SCSI */
+   spin_lock(lp-host-host_lock);
+   return ret;
} else {
atomic64_inc(fnic_stats-io_stats.active_ios);
atomic64_inc(fnic_stats-io_stats.num_ios);
@@ -566,6 +576,11 @@ out:
  sc-request-tag, sc, io_req,
  sg_count, cmd_trace,
  (((u64)CMD_FLAGS(sc)  32) | CMD_STATE(sc)));
+
+   /* if only we issued IO, will we have the io lock */
+   if (CMD_FLAGS(sc)  FNIC_IO_INITIALIZED)
+   spin_unlock_irqrestore(io_lock, flags);
+
atomic_dec(fnic-in_flight);
/* acquire host lock before returning to SCSI */
spin_lock(lp-host-host_lock);
-- 
1.8.5.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 4/5] [SCSI] Fnic: For Standalone C series, sending VLAN request message seen even if the link is down

2014-11-10 Thread Hiral Shah
When physical link between standalone C series and switch is down,
the fip timer is not turned off and timer expiration will keep sending
vlan request.

It can be fixed by stopping the fip_timer and
it will be restarted automatically when Link is up.

- Increment fnic version from 1.6.0.14 to 1.6.0.15

Signed-off-by: Hiral Shah his...@cisco.com
Signed-off-by: Sesidhar Baddela sebad...@cisco.com
Signed-off-by: Anil Chintalapati achin...@cisco.com
---
 drivers/scsi/fnic/fnic.h | 2 +-
 drivers/scsi/fnic/fnic_fcs.c | 5 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 5336e8d..977960b 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
 
 #define DRV_NAME   fnic
 #define DRV_DESCRIPTIONCisco FCoE HBA Driver
-#define DRV_VERSION1.6.0.14
+#define DRV_VERSION1.6.0.15
 #define PFXDRV_NAME : 
 #define DFX DRV_NAME %d: 
 
diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index f3984b4..bf0bbd4 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -135,6 +135,11 @@ void fnic_handle_link(struct work_struct *work)
fnic-lport-host-host_no, FNIC_FC_LE,
Link Status: UP_DOWN,
strlen(Link Status: UP_DOWN));
+   if (fnic-config.flags  VFCF_FIP_CAPABLE) {
+   FNIC_FCS_DBG(KERN_DEBUG, fnic-lport-host,
+   deleting fip-timer during link-down\n);
+   del_timer_sync(fnic-fip_timer);
+   }
fcoe_ctlr_link_down(fnic-ctlr);
}
 
-- 
1.8.5.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 2/5] [SCSI] Fnic: Memcopy only mimumum of data or trace buffer [SCSI] Fnic: Memcopy only mimumum of data or trace buffer

2014-11-10 Thread Hiral Shah
In case of receive path, we do not have eth header or fcoe header available when
we take a trace so we fill the fc trace buffer with 0xff for both values. We 
copy only
mimimum of received data or trace buffer size - fc header - eth and fcoe header

- Increment fnic version from 1.6.0.12 to 1.6.0.13

Signed-off-by: Hiral Shah his...@cisco.com
Signed-off-by: Sesidhar Baddela sebad...@cisco.com
Signed-off-by: Anil Chintalapati achin...@cisco.com
---
 drivers/scsi/fnic/fnic.h   | 2 +-
 drivers/scsi/fnic/fnic_trace.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 69dee68..dbc69ad 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
 
 #define DRV_NAME   fnic
 #define DRV_DESCRIPTIONCisco FCoE HBA Driver
-#define DRV_VERSION1.6.0.12
+#define DRV_VERSION1.6.0.13
 #define PFXDRV_NAME : 
 #define DFX DRV_NAME %d: 
 
diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c
index acf1f95..65a9bde 100644
--- a/drivers/scsi/fnic/fnic_trace.c
+++ b/drivers/scsi/fnic/fnic_trace.c
@@ -624,12 +624,12 @@ int fnic_fc_trace_set_data(u32 host_no, u8 frame_type,
if (frame_type == FNIC_FC_RECV) {
eth_fcoe_hdr_len = sizeof(struct ethhdr) +
sizeof(struct fcoe_hdr);
-   fc_trc_frame_len = fc_trc_frame_len + eth_fcoe_hdr_len;
memset((char *)fc_trace, 0xff, eth_fcoe_hdr_len);
/* Copy the rest of data frame */
memcpy((char *)(fc_trace + eth_fcoe_hdr_len), (void *)frame,
min_t(u8, fc_trc_frame_len,
-   (u8)(FC_TRC_SIZE_BYTES - FC_TRC_HEADER_SIZE)));
+   (u8)(FC_TRC_SIZE_BYTES - FC_TRC_HEADER_SIZE
+   - eth_fcoe_hdr_len)));
} else {
memcpy((char *)fc_trace, (void *)frame,
min_t(u8, fc_trc_frame_len,
-- 
1.8.5.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/5] [SCSI] Fnic: Not probing all the vNICS via fnic_probe on boot

2014-11-10 Thread Hiral Shah
In fnic_dev_wait, Wait for finish to complete at least three times in two
seconds while loop before returning -ETIMEDOUT as sometime
 schedule_timeout_uninterruptible takes more than two seconds to wake up.

- Increment fnic version from 1.6.0.11 to 1.6.0.12

Signed-off-by: Hiral Shah his...@cisco.com
Signed-off-by: Sesidhar Baddela sebad...@cisco.com
Signed-off-by: Anil Chintalapati achin...@cisco.com
---
 drivers/scsi/fnic/fnic.h  |  2 +-
 drivers/scsi/fnic/fnic_main.c | 13 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index bf8d34c..69dee68 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
 
 #define DRV_NAME   fnic
 #define DRV_DESCRIPTIONCisco FCoE HBA Driver
-#define DRV_VERSION1.6.0.11
+#define DRV_VERSION1.6.0.12
 #define PFXDRV_NAME : 
 #define DFX DRV_NAME %d: 
 
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 8c56fdc..782e6a8 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -438,21 +438,30 @@ static int fnic_dev_wait(struct vnic_dev *vdev,
unsigned long time;
int done;
int err;
+   int count;
+
+   count = 0;
 
err = start(vdev, arg);
if (err)
return err;
 
-   /* Wait for func to complete...2 seconds max */
+   /* Wait for func to complete.
+   * Sometime schedule_timeout_uninterruptible take long time
+   * to wake up so we do not retry as we are only waiting for
+   * 2 seconds in while loop. By adding count, we make sure
+   * we try atleast three times before returning -ETIMEDOUT
+   */
time = jiffies + (HZ * 2);
do {
err = finished(vdev, done);
+   count++;
if (err)
return err;
if (done)
return 0;
schedule_timeout_uninterruptible(HZ / 10);
-   } while (time_after(time, jiffies));
+   } while (time_after(time, jiffies) || (count  3));
 
return -ETIMEDOUT;
 }
-- 
1.8.5.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: tag handling refactor V2

2014-11-10 Thread Jens Axboe

On 2014-11-10 08:56, Christoph Hellwig wrote:

The current SCSI handling suffers from large amounts of duplicate code, and
a general confusion of multiple concepts of tagging.

This series tries to reduce the amount of code, and introduce two separate
clear concepts of tagging:

  a) a driver can request block-level tagging to always have a valid index
 assigned to cmd-request-tag by the block layer.  This is already
 automatically done for the blk-mq case, but this gives the optional
 legacy request taggign similar semantics.
  b) the concept of a SCSI tagged command is now entirely separate from
 providing an actual tag, and always provided in a flag in the SCSI
 command.  The driver does not need to opt-in this information, but
 it doesn't have to use it.

While this series removes 750 lines of code and provides a much cleaner driver
API it also opens up new questions:

  - how is the change_queue_type API supposed to be used for most drivers?  It
only changes the tag type from none to simple or back, but except for the
special implementation in the 53c700 driver doesn't change the queue depth,
which might cause it to issue multiple non-tagged command.  Fortunately
most drivers never look at this information, but then again changing the
queue type is useless to start with.
  - for those drivers looking at the command tagged information we'd need
to quiesce the LUN.  No driver but the 53c700 driver does that, and the
53c700 does it at a target-level, which despite a comment claiming it's
needed doesn't seem to make sense given the code.  If we can make sure
to quience all LUNs we could avoid the per-command flag for tagged commands
and always look at the scsi_device flag.
  - similarly, do we need any synchronization when answering a tag message 
reject?
  - queue ramp down may drop to untagged mode, but queue ramp up never reverseѕ
that.
  - the -tagged_supported and -simple_tags flags are bit-fields without clear
locking protection.  We probably want to move these and similar fields to
a proper atomic bit flags member.
  - should the MSG_*_TAG fields move to the SPI transport class?  That's where
they are defined, and besides SPI drivers they are only (ab)used by the
target code now.

Changes since V1:
  - small fixes for various review comments


Looks good to me, nice cleanup and the diffstat is excellent :-)

--
Jens Axboe

--
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: Fix more error handling in SCSI_IOCTL_SEND_COMMAND

2014-11-10 Thread Tony Battersby
Fix an error path in SCSI_IOCTL_SEND_COMMAND that calls
blk_put_request(rq) on an invalid IS_ERR(rq) pointer.

Fixes: a492f075450f (block,scsi: fixup blk_get_request dead queue scenarios)
Signed-off-by: Tony Battersby to...@cybernetics.com
---

(resending, since no one picked it up last time)

For inclusion in 3.18 only.  This fixes a problem
introduced in 3.18.

Note: this fixes a *different* problem from Jan Kara's
patch with a similar subject line, which has already
been applied to mainline.

--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -458,7 +458,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk 
*disk, fmode_t mode,
rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT);
if (IS_ERR(rq)) {
err = PTR_ERR(rq);
-   goto error;
+   goto error_free_buffer;
}
blk_rq_set_block_pc(rq);
 
@@ -531,9 +531,11 @@ out:
}

 error:
+   blk_put_request(rq);
+
+error_free_buffer:
kfree(buffer);
-   if (rq)
-   blk_put_request(rq);
+
return err;
 }
 EXPORT_SYMBOL_GPL(sg_scsi_ioctl);

--
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: Fix more error handling in SCSI_IOCTL_SEND_COMMAND

2014-11-10 Thread Jens Axboe

On 2014-11-10 15:40, Tony Battersby wrote:

Fix an error path in SCSI_IOCTL_SEND_COMMAND that calls
blk_put_request(rq) on an invalid IS_ERR(rq) pointer.

Fixes: a492f075450f (block,scsi: fixup blk_get_request dead queue scenarios)
Signed-off-by: Tony Battersby to...@cybernetics.com


Thanks, good catch. Might be an idea to have blk_put_request() do 
warn-and-return check on error pointers being passed in, just in case.


--
Jens Axboe

--
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/3] sd: Disable discard_zeroes_data for UNMAP

2014-11-10 Thread Paolo Bonzini
On 07/11/2014 06:08, Martin K. Petersen wrote:
 The T10 SBC UNMAP command does not provide any hard guarantees that
 blocks will return zeroes on a subsequent READ. This is due to the fact
 that the device server is free to silently ignore all or parts of the
 request.
 
 The only way to ensure that a block consistently returns zeroes after
 being unmapped is to use WRITE SAME with the UNMAP bit set. Should the
 device be unable to unmap one or more blocks described by the command it
 is required to manually write zeroes to them.
 
 Until now we have preferred UNMAP over the WRITE SAME variants to
 accommodate thinly provisioned devices that predated the final SBC-3
 spec. This patch changes the heuristic so that we favor WRITE SAME(16)
 or (10) over UNMAP if these commands are marked as supported in the
 Logical Block Provisioning VPD page.
 
 The patch also disables discard_zeroes_data for devices operating in
 UNMAP mode.
 
 Signed-off-by: Martin K. Petersen martin.peter...@oracle.com
 ---
  drivers/scsi/sd.c | 10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
 index b041eca8955d..95bfb7bfbb9d 100644
 --- a/drivers/scsi/sd.c
 +++ b/drivers/scsi/sd.c
 @@ -656,7 +656,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, 
 unsigned int mode)
   unsigned int logical_block_size = sdkp-device-sector_size;
   unsigned int max_blocks = 0;
  
 - q-limits.discard_zeroes_data = sdkp-lbprz;
 + q-limits.discard_zeroes_data = 0;
   q-limits.discard_alignment = sdkp-unmap_alignment *
   logical_block_size;
   q-limits.discard_granularity =
 @@ -680,11 +680,13 @@ static void sd_config_discard(struct scsi_disk *sdkp, 
 unsigned int mode)
   case SD_LBP_WS16:
   max_blocks = min_not_zero(sdkp-max_ws_blocks,
 (u32)SD_MAX_WS16_BLOCKS);
 + q-limits.discard_zeroes_data = sdkp-lbprz;
   break;
  
   case SD_LBP_WS10:
   max_blocks = min_not_zero(sdkp-max_ws_blocks,
 (u32)SD_MAX_WS10_BLOCKS);
 + q-limits.discard_zeroes_data = sdkp-lbprz;
   break;
  
   case SD_LBP_ZERO:
 @@ -2622,12 +2624,12 @@ static void sd_read_block_limits(struct scsi_disk 
 *sdkp)
  
   } else {/* LBP VPD page tells us what to use */
  
 - if (sdkp-lbpu  sdkp-max_unmap_blocks)
 - sd_config_discard(sdkp, SD_LBP_UNMAP);
 - else if (sdkp-lbpws)
 + if (sdkp-lbpws)
   sd_config_discard(sdkp, SD_LBP_WS16);
   else if (sdkp-lbpws10)
   sd_config_discard(sdkp, SD_LBP_WS10);
 + else if (sdkp-lbpu  sdkp-max_unmap_blocks)
 + sd_config_discard(sdkp, SD_LBP_UNMAP);
   else
   sd_config_discard(sdkp, SD_LBP_DISABLE);
   }
 

Reviewed-by: Paolo Bonzini pbonz...@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: [PATCH 3/3] block: Introduce blkdev_issue_zeroout_discard() function

2014-11-10 Thread Darrick J. Wong
On Fri, Nov 07, 2014 at 12:08:14AM -0500, Martin K. Petersen wrote:
 blkdev_issue_discard() will zero a given block range on disk. This is
 done by way of either WRITE SAME or regular WRITE. I.e. the blocks on
 disk will be written and thus provisioned.
 
 There are use cases where the desired behavior is to zero the blocks but
 unprovision them if possible. The blocks must deterministically contain
 zeroes when they are subsequently read back.
 
 This patch introduces a blkdev_issue_zeroout_discard() call that
 provides this functionality. If a block device guarantees
 discard_zeroes_data the new function will use discard to clear the block
 range. If the device does not support discard_zeroes_data or if the
 discard request fails we will fall back to blkdev_issue_zeroout() to
 ensure predictable results.

Can this be plumbed into a BLK* ioctl too?  I'll write a patch, if this is ok
with everyone:

struct blkzeroout_t {
__u64 start;
__u64 end;
__u32 flags;
};
#define BLKZEROOUT_DISCARD_OK   1

#define BLKZEROOUT_V2   _IOR(0x12, 127, sizeof(struct blkzeroout_t))

...and make it zap the page cache per earlier discussion.  This seems to be a
good fit with what we've been discussing for mke2fs.

--D

 
 Signed-off-by: Martin K. Petersen martin.peter...@oracle.com
 ---
  block/blk-lib.c| 44 ++--
  include/linux/blkdev.h |  2 ++
  2 files changed, 44 insertions(+), 2 deletions(-)
 
 diff --git a/block/blk-lib.c b/block/blk-lib.c
 index 8411be3c19d3..2ffec6a01c71 100644
 --- a/block/blk-lib.c
 +++ b/block/blk-lib.c
 @@ -278,14 +278,18 @@ static int __blkdev_issue_zeroout(struct block_device 
 *bdev, sector_t sector,
  }
  
  /**
 - * blkdev_issue_zeroout - zero-fill a block range
 + * blkdev_issue_zeroout - zero-fill and provision a block range
   * @bdev:blockdev to write
   * @sector:  start sector
   * @nr_sects:number of sectors to write
   * @gfp_mask:memory allocation flags (for bio_alloc)
   *
   * Description:
 - *  Generate and issue number of bios with zerofiled pages.
 + *  Zero-fill a block range. The blocks will be provisioned
 + *  (allocated/anchored) and are guaranteed to return zeroes when read
 + *  back. This function will attempt to use WRITE SAME to optimize the
 + *  process if the block device supports it. Otherwise it will fall back
 + *  to zeroing the blocks using regular WRITE calls.
   */
  
  int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
 @@ -305,3 +309,39 @@ int blkdev_issue_zeroout(struct block_device *bdev, 
 sector_t sector,
   return __blkdev_issue_zeroout(bdev, sector, nr_sects, gfp_mask);
  }
  EXPORT_SYMBOL(blkdev_issue_zeroout);
 +
 +/**
 + * blkdev_issue_zeroout_discard - zero-fill and attempt to discard block 
 range
 + * @bdev:blockdev to write
 + * @sector:  start sector
 + * @nr_sects:number of sectors to write
 + * @gfp_mask:memory allocation flags (for bio_alloc)
 + *
 + * Description:
 + *  Zero-fill a block range. In contrast to blkdev_issue_zeroout() this
 + *  function will attempt to deprovision (deallocate/discard) the blocks
 + *  in question. It will only do so if the underlying device guarantees
 + *  that subsequent READ operations to the block range in question will
 + *  return zeroes. If the device does not provide hard guarantees or if
 + *  the DISCARD attempt should fail the block range will be explicitly
 + *  zeroed using blkdev_issue_zeroout().
 + */
 +
 +int blkdev_issue_zeroout_discard(struct block_device *bdev, sector_t sector,
 +  sector_t nr_sects, gfp_t gfp_mask)
 +{
 + struct request_queue *q = bdev_get_queue(bdev);
 +
 + if (blk_queue_discard(q)  q-limits.discard_zeroes_data) {
 + unsigned char bdn[BDEVNAME_SIZE];
 +
 + if (!blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, 0))
 + return 0;
 +
 + bdevname(bdev, bdn);
 + pr_err(%s: DISCARD failed. Manually zeroing.\n, bdn);
 + }
 +
 + return blkdev_issue_zeroout(bdev, sector, nr_sects, gfp_mask);
 +}
 +EXPORT_SYMBOL(blkdev_issue_zeroout_discard);
 diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
 index aac0f9ea952a..078b6e5f488a 100644
 --- a/include/linux/blkdev.h
 +++ b/include/linux/blkdev.h
 @@ -1164,6 +1164,8 @@ extern int blkdev_issue_write_same(struct block_device 
 *bdev, sector_t sector,
   sector_t nr_sects, gfp_t gfp_mask, struct page *page);
  extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
   sector_t nr_sects, gfp_t gfp_mask);
 +extern int blkdev_issue_zeroout_discard(struct block_device *bdev,
 + sector_t sector, sector_t nr_sects, gfp_t gfp_mask);
  static inline int sb_issue_discard(struct super_block *sb, sector_t block,
   sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags)
  {
 -- 
 1.9.3
 
 --
 To 

Re: [PATCH v4 10/25] virtio: add API to enable VQs early

2014-11-10 Thread Andy Grover

On 10/13/2014 12:50 AM, Michael S. Tsirkin wrote:

virtio spec 0.9.X requires DRIVER_OK to be set before
VQs are used, but some drivers use VQs before probe
function returns.
Since DRIVER_OK is set after probe, this violates the spec.

Even though under virtio 1.0 transitional devices support this
behaviour, we want to make it possible for those early callers to become
spec compliant and eventually support non-transitional devices.

Add API for drivers to call before using VQs.

Sets DRIVER_OK internally.

Signed-off-by: Michael S. Tsirkin m...@redhat.com
Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com
---
  include/linux/virtio_config.h | 17 +
  1 file changed, 17 insertions(+)

diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e8f8f71..e36403b 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,6 +109,23 @@ struct virtqueue *virtio_find_single_vq(struct 
virtio_device *vdev,
return vq;
  }

+/**
+ * virtio_device_ready - enable vq use in probe function
+ * @vdev: the device
+ *
+ * Driver must call this to use vqs in the probe function.
+ *
+ * Note: vqs are enabled automatically after probe returns.
+ */
+static inline
+void virtio_device_ready(struct virtio_device *dev)
+{
+   unsigned status = dev-config-get_status(dev);
+
+   BUG_ON(status  VIRTIO_CONFIG_S_DRIVER_OK);
+   dev-config-set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
+}


Getting a BUG when booting via KVM, host Fedora 20, guest Fedora 20.

my config is at:

https://fedorapeople.org/~grover/config-20141110



[0.828494] [ cut here ]
[0.829039] kernel BUG at 
/home/agrover/git/kernel/include/linux/virtio_config.h:125!

[0.831266] invalid opcode:  [#1] SMP DEBUG_PAGEALLOC
[0.831266] Modules linked in:
[0.831266] CPU: 1 PID: 30 Comm: kworker/1:1 Not tainted 3.18.0-rc4 #120
[0.831266] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[0.831266] Workqueue: events control_work_handler
[0.831266] task: 88003cd98000 ti: 88003cd94000 task.ti: 
88003cd94000
[0.831266] RIP: 0010:[81445004]  [81445004] 
add_port+0x264/0x410

[0.831266] RSP: :88003cd97c78  EFLAGS: 00010202
[0.831266] RAX: 0007 RBX: 88003c58c400 RCX: 
0001
[0.831266] RDX: c132 RSI: 81a955e9 RDI: 
0001c132
[0.831266] RBP: 88003cd97cc8 R08:  R09: 

[0.831266] R10: 0001 R11:  R12: 
88003c58be00
[0.831266] R13: 0001 R14: 8800395ca800 R15: 
88003c58c420
[0.831266] FS:  () GS:88003fa0() 
knlGS:

[0.831266] CS:  0010 DS:  ES:  CR0: 8005003b
[0.831266] CR2:  CR3: 01c11000 CR4: 
06e0
[0.831266] DR0:  DR1:  DR2: 

[0.831266] DR3:  DR6: fffe0ff0 DR7: 
0400

[0.831266] Stack:
[0.831266]  8801 0292  
0001
[0.831266]  88003cd97cc8 88003dfa8a20 88003c58beb8 
88003c58be10
[0.831266]  8800395a2000  88003cd97d38 
8144531a

[0.831266] Call Trace:
[0.831266]  [8144531a] control_work_handler+0x16a/0x3c0
[0.831266]  [8108b0c8] ? process_one_work+0x208/0x500
[0.831266]  [8108b16c] process_one_work+0x2ac/0x500
[0.831266]  [8108b0c8] ? process_one_work+0x208/0x500
[0.831266]  [8108b68e] worker_thread+0x2ce/0x4e0
[0.831266]  [8108b3c0] ? process_one_work+0x500/0x500
[0.831266]  [81090b28] kthread+0xf8/0x100
[0.831266]  [810bad7d] ? trace_hardirqs_on+0xd/0x10
[0.831266]  [81090a30] ? kthread_stop+0x140/0x140
[0.831266]  [816ea92c] ret_from_fork+0x7c/0xb0
[0.831266]  [81090a30] ? kthread_stop+0x140/0x140
[0.831266] Code: c7 c2 48 31 01 83 48 c7 c6 e9 55 a9 81 e8 55 b4 c6 
ff 4d 8b b4 24 58 01 00 00 49 8b 86 e8 04 00 00 4c 89 f7 ff 50 10 a8 04 
74 0c 0f 0b 66 2e 0f 1f 84 00 00 00 00 00 49 8b 96 e8 04 00 00 83 c8

[0.831266] RIP  [81445004] add_port+0x264/0x410
[0.831266]  RSP 88003cd97c78
[0.878202] ---[ end trace f98fbb172cc7bbf4 ]---

Thanks -- Andy

--
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 3/3] block: Introduce blkdev_issue_zeroout_discard() function

2014-11-10 Thread Martin K. Petersen
 Darrick == Darrick J Wong darrick.w...@oracle.com writes:

Darrick Can this be plumbed into a BLK* ioctl too?  I'll write a patch,
Darrick if this is ok with everyone:

Darrick ...and make it zap the page cache per earlier discussion.  This
Darrick seems to be a good fit with what we've been discussing for
Darrick mke2fs.

That sounds good to me. I'll get the updated patch out tomorrow.

-- 
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 v4 10/25] virtio: add API to enable VQs early

2014-11-10 Thread Michael S. Tsirkin
On Mon, Nov 10, 2014 at 04:45:09PM -0800, Andy Grover wrote:
 On 10/13/2014 12:50 AM, Michael S. Tsirkin wrote:
 virtio spec 0.9.X requires DRIVER_OK to be set before
 VQs are used, but some drivers use VQs before probe
 function returns.
 Since DRIVER_OK is set after probe, this violates the spec.
 
 Even though under virtio 1.0 transitional devices support this
 behaviour, we want to make it possible for those early callers to become
 spec compliant and eventually support non-transitional devices.
 
 Add API for drivers to call before using VQs.
 
 Sets DRIVER_OK internally.
 
 Signed-off-by: Michael S. Tsirkin m...@redhat.com
 Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com
 ---
   include/linux/virtio_config.h | 17 +
   1 file changed, 17 insertions(+)
 
 diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
 index e8f8f71..e36403b 100644
 --- a/include/linux/virtio_config.h
 +++ b/include/linux/virtio_config.h
 @@ -109,6 +109,23 @@ struct virtqueue *virtio_find_single_vq(struct 
 virtio_device *vdev,
  return vq;
   }
 
 +/**
 + * virtio_device_ready - enable vq use in probe function
 + * @vdev: the device
 + *
 + * Driver must call this to use vqs in the probe function.
 + *
 + * Note: vqs are enabled automatically after probe returns.
 + */
 +static inline
 +void virtio_device_ready(struct virtio_device *dev)
 +{
 +unsigned status = dev-config-get_status(dev);
 +
 +BUG_ON(status  VIRTIO_CONFIG_S_DRIVER_OK);
 +dev-config-set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
 +}
 
 Getting a BUG when booting via KVM, host Fedora 20, guest Fedora 20.
 
 my config is at:
 
 https://fedorapeople.org/~grover/config-20141110
 

The fix is here:
http://article.gmane.org/gmane.linux.kernel.virtualization/23324/raw

I'm surprised it's not merged yet.

Rusty, could you pick it up please?


 
 [0.828494] [ cut here ]
 [0.829039] kernel BUG at
 /home/agrover/git/kernel/include/linux/virtio_config.h:125!
 [0.831266] invalid opcode:  [#1] SMP DEBUG_PAGEALLOC
 [0.831266] Modules linked in:
 [0.831266] CPU: 1 PID: 30 Comm: kworker/1:1 Not tainted 3.18.0-rc4 #120
 [0.831266] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 [0.831266] Workqueue: events control_work_handler
 [0.831266] task: 88003cd98000 ti: 88003cd94000 task.ti:
 88003cd94000
 [0.831266] RIP: 0010:[81445004]  [81445004]
 add_port+0x264/0x410
 [0.831266] RSP: :88003cd97c78  EFLAGS: 00010202
 [0.831266] RAX: 0007 RBX: 88003c58c400 RCX:
 0001
 [0.831266] RDX: c132 RSI: 81a955e9 RDI:
 0001c132
 [0.831266] RBP: 88003cd97cc8 R08:  R09:
 
 [0.831266] R10: 0001 R11:  R12:
 88003c58be00
 [0.831266] R13: 0001 R14: 8800395ca800 R15:
 88003c58c420
 [0.831266] FS:  () GS:88003fa0()
 knlGS:
 [0.831266] CS:  0010 DS:  ES:  CR0: 8005003b
 [0.831266] CR2:  CR3: 01c11000 CR4:
 06e0
 [0.831266] DR0:  DR1:  DR2:
 
 [0.831266] DR3:  DR6: fffe0ff0 DR7:
 0400
 [0.831266] Stack:
 [0.831266]  8801 0292 
 0001
 [0.831266]  88003cd97cc8 88003dfa8a20 88003c58beb8
 88003c58be10
 [0.831266]  8800395a2000  88003cd97d38
 8144531a
 [0.831266] Call Trace:
 [0.831266]  [8144531a] control_work_handler+0x16a/0x3c0
 [0.831266]  [8108b0c8] ? process_one_work+0x208/0x500
 [0.831266]  [8108b16c] process_one_work+0x2ac/0x500
 [0.831266]  [8108b0c8] ? process_one_work+0x208/0x500
 [0.831266]  [8108b68e] worker_thread+0x2ce/0x4e0
 [0.831266]  [8108b3c0] ? process_one_work+0x500/0x500
 [0.831266]  [81090b28] kthread+0xf8/0x100
 [0.831266]  [810bad7d] ? trace_hardirqs_on+0xd/0x10
 [0.831266]  [81090a30] ? kthread_stop+0x140/0x140
 [0.831266]  [816ea92c] ret_from_fork+0x7c/0xb0
 [0.831266]  [81090a30] ? kthread_stop+0x140/0x140
 [0.831266] Code: c7 c2 48 31 01 83 48 c7 c6 e9 55 a9 81 e8 55 b4 c6 ff
 4d 8b b4 24 58 01 00 00 49 8b 86 e8 04 00 00 4c 89 f7 ff 50 10 a8 04 74 0c
 0f 0b 66 2e 0f 1f 84 00 00 00 00 00 49 8b 96 e8 04 00 00 83 c8
 [0.831266] RIP  [81445004] add_port+0x264/0x410
 [0.831266]  RSP 88003cd97c78
 [0.878202] ---[ end trace f98fbb172cc7bbf4 ]---
 
 Thanks -- Andy
--
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