[PATCH] fnic: use simple_open instead of fnic_trace_ctrl_open

2013-07-11 Thread Camelia Groza
This removes the open coded fnic_trace_ctrl_open() function
and replaces file operations references to the function
with simple_open() instead.

Found using coccinelle.

Signed-off-by: Camelia Groza 
---
 drivers/scsi/fnic/fnic_debugfs.c |   19 +--
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index cbcb012..ddc7e94 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -25,23 +25,6 @@ static struct dentry *fnic_trace_debugfs_file;
 static struct dentry *fnic_trace_enable;
 
 /*
- * fnic_trace_ctrl_open - Open the trace_enable file
- * @inode: The inode pointer.
- * @file: The file pointer to attach the trace enable/disable flag.
- *
- * Description:
- * This routine opens a debugsfs file trace_enable.
- *
- * Returns:
- * This function returns zero if successful.
- */
-static int fnic_trace_ctrl_open(struct inode *inode, struct file *filp)
-{
-   filp->private_data = inode->i_private;
-   return 0;
-}
-
-/*
  * fnic_trace_ctrl_read - Read a trace_enable debugfs file
  * @filp: The file pointer to read from.
  * @ubuf: The buffer to copy the data to.
@@ -222,7 +205,7 @@ static int fnic_trace_debugfs_release(struct inode *inode,
 
 static const struct file_operations fnic_trace_ctrl_fops = {
.owner = THIS_MODULE,
-   .open = fnic_trace_ctrl_open,
+   .open = simple_open,
.read = fnic_trace_ctrl_read,
.write = fnic_trace_ctrl_write,
 };
-- 
1.7.10.4

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


Re: [PATCHv3 0/9] New EH command timeout handler

2013-07-11 Thread Hannes Reinecke
On 07/12/2013 06:14 AM, Ren Mingxin wrote:
> Hi, Hannes:
> 
> On 07/01/2013 10:24 PM, Hannes Reinecke wrote:
>> With the original SCSI EH I got:
>> # time dd if=/dev/zero of=/dev/dm-2 bs=4k count=4k oflag=direct
>> 4096+0 records in
>> 4096+0 records out
>> 16777216 bytes (17 MB) copied, 142.652 s, 118 kB/s
>>
>> real2m22.657s
>> user0m0.013s
>> sys0m0.145s
>>
>> With this patchset I got:
>> # time dd if=/dev/zero of=/dev/dm-2 bs=4k count=4k oflag=direct
>> 4096+0 records in
>> 4096+0 records out
>> 16777216 bytes (17 MB) copied, 52.1579 s, 322 kB/s
>>
>> real0m52.163s
>> user0m0.012s
>> sys0m0.145s
>>
>> Test was to disable RSCN on the target port, disable the
>> target port, and then start the 'dd' command as indicated.
> 
> Do you mean disabling RSCN/port is enough? I'm afraid I couldn't
> reproduce the problem by your steps. Both with and without your
> patchset are the same 'dd' result: 27s. Please let me know where I
> neglected or mistook:
> 
> 1) I made a dm-multipath target 'dm-0' whose grouping policy was
>failover;
> 2) Disable RSCN/port via brocade fc switch:
>SW300:root> portcfg rscnsupr 15 --enable; portDisable 15
> 3) Start the 'dd' command:
># time dd if=/dev/zero of=/dev/dm-0 bs=4k count=4k oflag=direct
>dd: writing `/dev/sde': Input/output error
>1+0 records in
>0+0 records out
>0 bytes (0 B) copied, 27.8588 s, 0.0 kB/s
> 
>real0m27.860s
>user0m0.001s
>sys 0m0.000s

You are aware that you have to disable RSCNs on the _target_ port,
right?
Disabling RSCNs on the _initiator_ ports is a well-tested case, and
the one which actually makes sense (and is even implemented in
QLogic switches).
Disabling RSCNs for the _target_ port, OTOH, has a very questionable
nature (hence QLogic switches don't even allow you to do this).

[ .. ]

> Another question:
> 
> I also tried to produce timeouts by modifying Yasui's module(please
> see APPENDIX A):
> http://www.spinics.net/lists/linux-scsi/msg35091.html
> 
> But I got a bug with your this patchset by follwing steps(there was
> not such bug without your patchset):
> 
> # grep lpfc_template /proc/kallsyms
> a00f9240 d lpfc_template[lpfc]
> # multipath -ll
> ...
> mpathb (36000b5d0006a006a14e7000c) dm-1 FUJITSU,ETERNUS_DX400
> size=50G features='1 queue_if_no_path' hwhandler='0' wp=rw
> |-+- policy='round-robin 0' prio=130 status=active
> | `- 2:0:0:1 sdf 8:80  active ready running
> `-+- policy='round-robin 0' prio=130 status=enabled
>   `- 3:0:0:1 sdh 8:112 active ready running
> # insmod scsi_tmo_mod.ko param=0xa00f9240,2:0:0:1; time dd
> if=/dev/zero of=/dev/dm-1 bs=4k count=4k oflag=direct
> 4096+0 records in
> 4096+0 records out
> 16777216 bytes (17 MB) copied, 151.194 s, 111 kB/s
> 
> real2m31.195s
> user0m0.004s
> sys0m0.111s
> 
> Please see logs in APPENDIX B. Do you think this bug is irrelevant to
> your patchset?
> 
Hmm. No, sadly not.

'cancel_work_sync' cannot be called from an interrupt context;
guess I'll need to convert it to delayed work.

Thanks for testing; will be updating the patchset.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv2 0/7] Limit overall SCSI EH runtime

2013-07-11 Thread Ren Mingxin

Hi, Ewan:

On 07/11/2013 04:35 AM, Ewan Milne wrote:

On Mon, 2013-07-01 at 08:50 +0200, Hannes Reinecke wrote:

This patchset implements a new 'eh_deadline' attribute to the
SCSI host. It will limit the overall SCSI EH runtime by a given
timeout. If the timeout is reached all intermediate EH steps
will be skipped and host reset will be scheduled immediately.

For this patch I've re-used the existing 'last_reset' field
of the SCSI host to store the initial time SCSI EH started.
Also the field 'resetting' has been removed as it never has
been used as intended.

As 'last_reset' might be in use by transport-specific EH
implementation I've disallowed eh_deadline setting there.

Changes from the initial version:
- Add list_splice_init() calls to avoid stale commands
- Rename function to scsi_host_eh_past_deadline

Hannes Reinecke (7):
   dpt_i2o: Remove DPTI_STATE_IOCTL
   dpt_i2o: return SCSI_MLQUEUE_HOST_BUSY when in reset
   advansys: Remove 'last_reset' references
   tmscsim: Move 'last_reset' into host structure
   dc395: Move 'last_reset' into internal host structure
   scsi: remove check for 'resetting'
   scsi: Add 'eh_deadline' to limit SCSI EH runtime

  drivers/scsi/advansys.c   |   8 +--
  drivers/scsi/dc395x.c |  24 +
  drivers/scsi/dpt_i2o.c|  35 +
  drivers/scsi/dpti.h   |   1 -
  drivers/scsi/hosts.c  |   7 +++
  drivers/scsi/scsi.c   |  28 --
  drivers/scsi/scsi_error.c | 130 +++---
  drivers/scsi/scsi_sysfs.c |  37 +
  drivers/scsi/tmscsim.c|  14 ++---
  drivers/scsi/tmscsim.h|   1 +
  include/scsi/scsi_host.h  |   4 +-
  11 files changed, 208 insertions(+), 81 deletions(-)


Looks good.  We have been testing this extensively.


I'm wondering how do you test, with a special hardware or self-made
module?Would you mind pasting your test method() and result?

Thanks,
Ren



Acked-by: Ewan D. Milne


--
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 0/9] New EH command timeout handler

2013-07-11 Thread Ren Mingxin

Hi, Hannes:

On 07/01/2013 10:24 PM, Hannes Reinecke wrote:

With the original SCSI EH I got:
# time dd if=/dev/zero of=/dev/dm-2 bs=4k count=4k oflag=direct
4096+0 records in
4096+0 records out
16777216 bytes (17 MB) copied, 142.652 s, 118 kB/s

real2m22.657s
user0m0.013s
sys 0m0.145s

With this patchset I got:
# time dd if=/dev/zero of=/dev/dm-2 bs=4k count=4k oflag=direct
4096+0 records in
4096+0 records out
16777216 bytes (17 MB) copied, 52.1579 s, 322 kB/s

real0m52.163s
user0m0.012s
sys 0m0.145s

Test was to disable RSCN on the target port, disable the
target port, and then start the 'dd' command as indicated.


Do you mean disabling RSCN/port is enough? I'm afraid I couldn't
reproduce the problem by your steps. Both with and without your
patchset are the same 'dd' result: 27s. Please let me know where I
neglected or mistook:

1) I made a dm-multipath target 'dm-0' whose grouping policy was
   failover;
2) Disable RSCN/port via brocade fc switch:
   SW300:root> portcfg rscnsupr 15 --enable; portDisable 15
3) Start the 'dd' command:
   # time dd if=/dev/zero of=/dev/dm-0 bs=4k count=4k oflag=direct
   dd: writing `/dev/sde': Input/output error
   1+0 records in
   0+0 records out
   0 bytes (0 B) copied, 27.8588 s, 0.0 kB/s

   real0m27.860s
   user0m0.001s
   sys 0m0.000s
#) Corresponding logs in /var/log/messages
Jul  9 14:56:06 build kernel: lpfc :0d:00.1: 1:1305 Link Down Event 
x4 received Data: x4 x20 x110 x0 x0
Jul  9 14:56:36 build kernel: rport-3:0-2: blocked FC remote port time 
out: removing target and saving binding

Jul  9 14:56:36 build kernel: sd 3:0:0:0: rejecting I/O to offline device
Jul  9 14:56:36 build kernel: lpfc :0d:00.1: 1:(0):0203 Devloss 
timeout on WWPN 20:41:00:0b:5d:6a:14:e7 NPort x620700 Data: x0 x8 x0

Jul  9 14:56:36 build kernel: sd 3:0:0:0: [sde] Synchronizing SCSI cache
Jul  9 14:56:36 build kernel: sd 3:0:0:0: [sde]
Jul  9 14:56:36 build kernel: Result: hostbyte=DID_NO_CONNECT 
driverbyte=DRIVER_OK

Jul  9 14:56:36 build kernel: sd 3:0:0:1: [sdf] Synchronizing SCSI cache
Jul  9 14:56:36 build kernel: sd 3:0:0:1: [sdf]
Jul  9 14:56:36 build kernel: Result: hostbyte=DID_NO_CONNECT 
driverbyte=DRIVER_OK

Jul  9 14:56:36 build multipathd: sdf: remove path (uevent)
Jul  9 14:56:36 build multipathd: mpatha: load table [0 104857600 
multipath 1 queue_if_no_path 0 1 1 round-robin 0 1 1 8:112 1]

Jul  9 14:56:36 build multipathd: sdf: path removed from map mpatha
Jul  9 14:56:36 build udevd-work[8420]: error opening 
ATTR{/sys/devices/pci:00/:00:03.0/:01:00.0/:02:01.0/:0a:00.0/:0b:01.0/:0d:00.1/host3/rport-3:0-2/target3:0:0/3:0:0:0/block/sde/queue/iosched/slice_idle} 
for writing: No such file or directory
Jul  9 14:56:36 build udevd-work[8420]: error opening 
ATTR{/sys/devices/pci:00/:00:03.0/:01:00.0/:02:01.0/:0a:00.0/:0b:01.0/:0d:00.1/host3/rport-3:0-2/target3:0:0/3:0:0:0/block/sde/queue/iosched/quantum} 
for writing: No such file or directory

Jul  9 14:56:36 build multipathd: sde: remove path (uevent)
Jul  9 14:56:36 build multipathd: mpathb: load table [0 104857600 
multipath 1 queue_if_no_path 0 1 1 round-robin 0 1 1 8:96 1]

Jul  9 14:56:36 build multipathd: sde: path removed from map mpathb
* there are two disks sde and sdf connected via port 15

Another question:

I also tried to produce timeouts by modifying Yasui's module(please
see APPENDIX A):
http://www.spinics.net/lists/linux-scsi/msg35091.html

But I got a bug with your this patchset by follwing steps(there was
not such bug without your patchset):

# grep lpfc_template /proc/kallsyms
a00f9240 d lpfc_template[lpfc]
# multipath -ll
...
mpathb (36000b5d0006a006a14e7000c) dm-1 FUJITSU,ETERNUS_DX400
size=50G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=130 status=active
| `- 2:0:0:1 sdf 8:80  active ready running
`-+- policy='round-robin 0' prio=130 status=enabled
  `- 3:0:0:1 sdh 8:112 active ready running
# insmod scsi_tmo_mod.ko param=0xa00f9240,2:0:0:1; time dd 
if=/dev/zero of=/dev/dm-1 bs=4k count=4k oflag=direct

4096+0 records in
4096+0 records out
16777216 bytes (17 MB) copied, 151.194 s, 111 kB/s

real2m31.195s
user0m0.004s
sys0m0.111s

Please see logs in APPENDIX B. Do you think this bug is irrelevant to
your patchset?

Thanks,
Ren

APPENDIX A:

/*
 * scsi timeout injection module
 */
#include 
#include 
#include 
#include 

static struct scsi_host_template *sht;
static char config[32];

static struct target {
short host;
uint channel;
uint id;
uint lun;
} st;

static int (*org_qc)(struct Scsi_Host *, struct scsi_cmnd *);


static inline int check_dev(struct target *st, struct scsi_cmnd *cmd)
{
return (st->host == cmd->device->host->host_no &&
st->channel == cmd->device->channel &&
st->id == cmd->device->id &&
st->lun == cmd->device->lun);

Re: [Ksummit-2013-discuss] [ATTEND] scsi-mq prototype discussion

2013-07-11 Thread Nicholas A. Bellinger
On Thu, 2013-07-11 at 18:02 -0700, Greg KH wrote:
> On Thu, Jul 11, 2013 at 05:23:32PM -0700, Nicholas A. Bellinger wrote:
> > Drilling down the work items ahead of a real mainline push is high on
> > priority list for discussion.
> > 
> > The parties to be included in such a discussion are:
> > 
> >   - Jens Axboe (blk-mq author)
> >   - James Bottomley (scsi maintainer)
> >   - Christoph Hellwig (scsi)
> >   - Martin Petersen (scsi)
> >   - Tejun Heo (block + libata)
> >   - Hannes Reinecke (scsi error recovery)
> >   - Kent Overstreet (block, per-cpu ida)
> >   - Stephen Cameron (scsi-over-pcie driver)
> >   - Andrew Vasquez (qla2xxx LLD)
> >   - James Smart (lpfc LLD)
> 
> Isn't this something that should have been discussed at the storage
> mini-summit a few months ago?

The scsi-mq prototype, along with blk-mq (in it's current form) did not
exist a few short months ago.  ;)

>  It seems very specific to one subsystem to be a kernel summit topic,
> don't you think?

It's no more subsystem specific than half of the other proposals so far,
and given it's reach across multiple subsystems (block, scsi, target),
and the amount of off-list interest on the topic, I think it would make
a good candidate for discussion.

Thanks,

--nab 

--
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: [Ksummit-2013-discuss] [ATTEND] scsi-mq prototype discussion

2013-07-11 Thread Greg KH
On Thu, Jul 11, 2013 at 05:23:32PM -0700, Nicholas A. Bellinger wrote:
> Drilling down the work items ahead of a real mainline push is high on
> priority list for discussion.
> 
> The parties to be included in such a discussion are:
> 
>   - Jens Axboe (blk-mq author)
>   - James Bottomley (scsi maintainer)
>   - Christoph Hellwig (scsi)
>   - Martin Petersen (scsi)
>   - Tejun Heo (block + libata)
>   - Hannes Reinecke (scsi error recovery)
>   - Kent Overstreet (block, per-cpu ida)
>   - Stephen Cameron (scsi-over-pcie driver)
>   - Andrew Vasquez (qla2xxx LLD)
>   - James Smart (lpfc LLD)

Isn't this something that should have been discussed at the storage
mini-summit a few months ago?  It seems very specific to one subsystem
to be a kernel summit topic, don't you think?

thanks,

greg k-h
--
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


[ATTEND] scsi-mq prototype discussion

2013-07-11 Thread Nicholas A. Bellinger
Hello,

I would like to attend the 2013 Kernel Summit.

At the summit, I would like to discuss scsi-mq, a high performance SCSI
initiator prototype that utilizes the next-generation blk-mq effort by
Jens Axboe.  The long-term goal is a path to move beyond the
long-standing small block random I/O limitations vs. raw make_request
based drivers of the existing Linux/SCSI client stack.

Along with using blk-mq's excellent native per-cpu primitive + NUMA
local friendly queuing of pre-allocated struct request descriptor
memory, the scsi-mq prototype currently avoids all I/O fast-path access
of legacy scsi_host->host_lock, and bypasses existing scsi_request_fn()
dispatch into scsi-mq enabled LLD code.

It also allows scsi-core to eliminate all fast-path memory allocations
using struct scsi_cmnd + $LLD_CMD pre-allocations based on a per struct
blk_mq_hw_ctx -> scsi_device->sdev_mq_req context, along with per
scsi_cmnd descriptor pre-allocation of SGL and sense buffer memory.

So far the initial conversion of virtio-scsi + scsi-debug LLDs has been
completed.  Also, the intention is to keep the conversion requirements
for existing LLDs to scsi-mq as simple as possible.

There are still many areas that have been conveniently left out of the
initial prototype, including proper fast-path get_device() +
put_device() reference counting, a functioning scsi-generic IOCTL,
anything close to per struct scsi_device error handling, amongst other
things..

Drilling down the work items ahead of a real mainline push is high on
priority list for discussion.

The parties to be included in such a discussion are:

  - Jens Axboe (blk-mq author)
  - James Bottomley (scsi maintainer)
  - Christoph Hellwig (scsi)
  - Martin Petersen (scsi)
  - Tejun Heo (block + libata)
  - Hannes Reinecke (scsi error recovery)
  - Kent Overstreet (block, per-cpu ida)
  - Stephen Cameron (scsi-over-pcie driver)
  - Andrew Vasquez (qla2xxx LLD)
  - James Smart (lpfc LLD)

Thank you,

--nab

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


[PATCH 1/2] BNX2I: Update version and copyright year 2013

2013-07-11 Thread Eddie Wai
Old version: 2.7.2.2
New version: 2.7.6.2

Signed-off-by: Eddie Wai 
---
 drivers/scsi/bnx2i/57xx_iscsi_constants.h |2 +-
 drivers/scsi/bnx2i/57xx_iscsi_hsi.h   |2 +-
 drivers/scsi/bnx2i/bnx2i.h|2 +-
 drivers/scsi/bnx2i/bnx2i_hwi.c|2 +-
 drivers/scsi/bnx2i/bnx2i_init.c   |6 +++---
 drivers/scsi/bnx2i/bnx2i_iscsi.c  |2 +-
 drivers/scsi/bnx2i/bnx2i_sysfs.c  |2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/bnx2i/57xx_iscsi_constants.h 
b/drivers/scsi/bnx2i/57xx_iscsi_constants.h
index 25093a0..3d33767 100644
--- a/drivers/scsi/bnx2i/57xx_iscsi_constants.h
+++ b/drivers/scsi/bnx2i/57xx_iscsi_constants.h
@@ -1,6 +1,6 @@
 /* 57xx_iscsi_constants.h: Broadcom NetXtreme II iSCSI HSI
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/bnx2i/57xx_iscsi_hsi.h 
b/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
index f2db5fe..37049e4 100644
--- a/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
+++ b/drivers/scsi/bnx2i/57xx_iscsi_hsi.h
@@ -1,6 +1,6 @@
 /* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index f109e3b..6940f09 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -1,6 +1,6 @@
 /* bnx2i.h: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index a28b03e..af3e675 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1,6 +1,6 @@
 /* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index 50fef69..b6f6f43 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -1,6 +1,6 @@
 /* bnx2i.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
@@ -18,8 +18,8 @@ static struct list_head adapter_list = 
LIST_HEAD_INIT(adapter_list);
 static u32 adapter_count;
 
 #define DRV_MODULE_NAME"bnx2i"
-#define DRV_MODULE_VERSION "2.7.2.2"
-#define DRV_MODULE_RELDATE "Apr 25, 2012"
+#define DRV_MODULE_VERSION "2.7.6.2"
+#define DRV_MODULE_RELDATE "Jun 06, 2013"
 
 static char version[] =
"Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 0056e47..fabeb88 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1,7 +1,7 @@
 /*
  * bnx2i_iscsi.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2006 - 2012 Broadcom Corporation
+ * Copyright (c) 2006 - 2013 Broadcom Corporation
  * Copyright (c) 2007, 2008 Red Hat, Inc.  All rights reserved.
  * Copyright (c) 2007, 2008 Mike Christie
  *
diff --git a/drivers/scsi/bnx2i/bnx2i_sysfs.c b/drivers/scsi/bnx2i/bnx2i_sysfs.c
index c61cf7a..a0a3d9f 100644
--- a/drivers/scsi/bnx2i/bnx2i_sysfs.c
+++ b/drivers/scsi/bnx2i/bnx2i_sysfs.c
@@ -1,6 +1,6 @@
 /* bnx2i_sysfs.c: Broadcom NetXtreme II iSCSI driver.
  *
- * Copyright (c) 2004 - 2012 Broadcom Corporation
+ * Copyright (c) 2004 - 2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
-- 
1.7.7.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/2] MAINTAINER: Added maintainer info for bnx2i

2013-07-11 Thread Eddie Wai
Signed-off-by: Eddie Wai 
---
 MAINTAINERS |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 50105f9..e297cb0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1816,6 +1816,12 @@ L:   linux-scsi@vger.kernel.org
 S: Supported
 F: drivers/scsi/bnx2fc/
 
+BROADCOM BNX2I 1/10 GIGABIT iSCSI DRIVER
+M: Eddie Wai 
+L: linux-scsi@vger.kernel.org
+S: Supported
+F: drivers/scsi/bnx2i/
+
 BROADCOM SPECIFIC AMBA DRIVER (BCMA)
 M: Rafał Miłecki 
 L: linux-wirel...@vger.kernel.org
-- 
1.7.7.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: [RFC/PATCH 4/4] block: Add URGENT request notification support to CFQ scheduler

2013-07-11 Thread Jeff Moyer
Tanya Brokhman  writes:

> When the scheduler reports to the block layer that there is an urgent
> request pending, the device driver may decide to stop the transmission
> of the current request in order to handle the urgent one. This is done
> in order to reduce the latency of an urgent request. For example:
> long WRITE may be stopped to handle an urgent READ.

In general, I don't like the approach taken.  I would much rather see
a low-level cancellation method, and layer your urgent request handling
on top of that.  That could actually be used by the aio subsystem as
well (with a lot of work, of course).  That aside, I've provided some
comments below.

>
> Signed-off-by: Tatyana Brokhman 
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 3ab3a62..705f4f9 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -2090,7 +2090,10 @@ static void blk_account_io_completion(struct request 
> *req, unsigned int bytes)
>  
>   cpu = part_stat_lock();
>   part = req->part;
> - part_stat_add(cpu, part, sectors[rw], bytes >> 9);
> + if (part == NULL)
> + pr_err("%s: YANIV - BUG START", __func__);
> + else
> + part_stat_add(cpu, part, sectors[rw], bytes >> 9);

This looks like leftover debugging.

>   part_stat_unlock();
>   }
>  }
> @@ -2111,12 +2114,13 @@ static void blk_account_io_done(struct request *req)
>   cpu = part_stat_lock();
>   part = req->part;
>  
> - part_stat_inc(cpu, part, ios[rw]);
> - part_stat_add(cpu, part, ticks[rw], duration);
> - part_round_stats(cpu, part);
> - part_dec_in_flight(part, rw);
> -
> - hd_struct_put(part);
> + if (req->part != NULL) {
> + part_stat_inc(cpu, part, ios[rw]);
> + part_stat_add(cpu, part, ticks[rw], duration);
> + part_round_stats(cpu, part);
> + part_dec_in_flight(part, rw);
> + hd_struct_put(part);
> + }

A comment about why we now expect req->part might be null would be nice.

>   part_stat_unlock();
>   }
>  }
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index d5bbdcf..f936cb9 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -320,6 +320,9 @@ struct cfq_data {
>   unsigned long workload_expires;
>   struct cfq_group *serving_group;
>  
> + unsigned int nr_urgent_pending;
> + unsigned int nr_urgent_in_flight;
> +
>   /*
>* Each priority tree is sorted by next_request position.  These
>* trees are used when determining if two or more queues are
> @@ -2783,6 +2786,14 @@ static void cfq_dispatch_insert(struct request_queue 
> *q, struct request *rq)
>   (RQ_CFQG(rq))->dispatched++;
>   elv_dispatch_sort(q, rq);
>  
> + if (rq->cmd_flags & REQ_URGENT) {
> + if (!cfqd->nr_urgent_pending)
> + WARN_ON(1);
> + else
> + cfqd->nr_urgent_pending--;
> + cfqd->nr_urgent_in_flight++;
> + }
> +

This is a rather ugly construct, and gets repeated later.  I'd be
inclined to just BUG.

>   cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]++;
>   cfqq->nr_sectors += blk_rq_sectors(rq);
>   cfqg_stats_update_dispatch(cfqq->cfqg, blk_rq_bytes(rq), rq->cmd_flags);
> @@ -3909,6 +3920,68 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct 
> cfq_queue *cfqq,
>   }
>  }
>  
> +/*
> + * Called when a request (rq) is reinserted (to cfqq). Check if there's
> + * something we should do about it
> + */
> +static void
> +cfq_rq_requeued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
> + struct request *rq)
> +{
> + struct cfq_io_cq *cic = RQ_CIC(rq);
> +
> + cfqd->rq_queued++;
> + if (rq->cmd_flags & REQ_PRIO)
> + cfqq->prio_pending++;
> +
> + cfqq->dispatched--;
> + (RQ_CFQG(rq))->dispatched--;
> +
> + cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--;
> +
> + cfq_update_io_thinktime(cfqd, cfqq, cic);
> + cfq_update_io_seektime(cfqd, cfqq, rq);
> + cfq_update_idle_window(cfqd, cfqq, cic);
> +
> + cfqq->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq);
> +
> + if (cfqq == cfqd->active_queue) {
> + if (cfq_cfqq_wait_request(cfqq)) {
> + if (blk_rq_bytes(rq) > PAGE_CACHE_SIZE ||
> + cfqd->busy_queues > 1) {
> + cfq_del_timer(cfqd, cfqq);
> + cfq_clear_cfqq_wait_request(cfqq);
> + } else {
> + cfqg_stats_update_idle_time(cfqq->cfqg);
> + cfq_mark_cfqq_must_dispatch(cfqq);
> + }
> + }
> + } else if (cfq_should_preempt(cfqd, cfqq, rq)) {
> + cfq_preempt_queue(cfqd, cfqq);
> + }
> +}

Huge

Re: [PATCH 1/1] ipr: Add sereral new CCIN definitions for new adapters support

2013-07-11 Thread Brian King
Acked-by: Brian King 

-- 
Brian King
Power Linux I/O
IBM Linux Technology Center


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


[Bug 59601] commit 97dec564fd4948e0e560869c80b76e166ca2a83e breaks communication with XYRATEX disk shelves

2013-07-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=59601

Jack Hill  changed:

   What|Removed |Added

 Kernel Version||>2.6.38-rc2

--- Comment #10 from Jack Hill  ---
Saurav,

Yes, in my initial testing that patch does resolve the issue.

Thanks,
Jack

P.S. I set the kernel version field, becasue bugzilla was not letting me submit
this comment with it empty.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH 4/4] block: Add URGENT request notification support to CFQ scheduler

2013-07-11 Thread Santosh Y
On Thu, Jul 11, 2013 at 6:31 PM, Tanya Brokhman  wrote:
> When the scheduler reports to the block layer that there is an urgent
> request pending, the device driver may decide to stop the transmission
> of the current request in order to handle the urgent one. This is done
> in order to reduce the latency of an urgent request. For example:
> long WRITE may be stopped to handle an urgent READ.
>
> Signed-off-by: Tatyana Brokhman 
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 3ab3a62..705f4f9 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -2090,7 +2090,10 @@ static void blk_account_io_completion(struct request 
> *req, unsigned int bytes)
>
> cpu = part_stat_lock();
> part = req->part;
> -   part_stat_add(cpu, part, sectors[rw], bytes >> 9);
> +   if (part == NULL)
> +   pr_err("%s: YANIV - BUG START", __func__);
> +   else
> +   part_stat_add(cpu, part, sectors[rw], bytes >> 9);
> part_stat_unlock();
> }
>  }
> @@ -2111,12 +2114,13 @@ static void blk_account_io_done(struct request *req)
> cpu = part_stat_lock();
> part = req->part;
>
> -   part_stat_inc(cpu, part, ios[rw]);
> -   part_stat_add(cpu, part, ticks[rw], duration);
> -   part_round_stats(cpu, part);
> -   part_dec_in_flight(part, rw);
> -
> -   hd_struct_put(part);
> +   if (req->part != NULL) {
> +   part_stat_inc(cpu, part, ios[rw]);
> +   part_stat_add(cpu, part, ticks[rw], duration);
> +   part_round_stats(cpu, part);
> +   part_dec_in_flight(part, rw);
> +   hd_struct_put(part);
> +   }
> part_stat_unlock();
> }
>  }
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index d5bbdcf..f936cb9 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -320,6 +320,9 @@ struct cfq_data {
> unsigned long workload_expires;
> struct cfq_group *serving_group;
>
> +   unsigned int nr_urgent_pending;
> +   unsigned int nr_urgent_in_flight;
> +
> /*
>  * Each priority tree is sorted by next_request position.  These
>  * trees are used when determining if two or more queues are
> @@ -2783,6 +2786,14 @@ static void cfq_dispatch_insert(struct request_queue 
> *q, struct request *rq)
> (RQ_CFQG(rq))->dispatched++;
> elv_dispatch_sort(q, rq);
>
> +   if (rq->cmd_flags & REQ_URGENT) {
> +   if (!cfqd->nr_urgent_pending)
> +   WARN_ON(1);
> +   else
> +   cfqd->nr_urgent_pending--;
> +   cfqd->nr_urgent_in_flight++;
> +   }
> +
> cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]++;
> cfqq->nr_sectors += blk_rq_sectors(rq);
> cfqg_stats_update_dispatch(cfqq->cfqg, blk_rq_bytes(rq), 
> rq->cmd_flags);
> @@ -3909,6 +3920,68 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct 
> cfq_queue *cfqq,
> }
>  }
>
> +/*
> + * Called when a request (rq) is reinserted (to cfqq). Check if there's
> + * something we should do about it
> + */
> +static void
> +cfq_rq_requeued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
> +   struct request *rq)
> +{
> +   struct cfq_io_cq *cic = RQ_CIC(rq);
> +
> +   cfqd->rq_queued++;
> +   if (rq->cmd_flags & REQ_PRIO)
> +   cfqq->prio_pending++;
> +
> +   cfqq->dispatched--;
> +   (RQ_CFQG(rq))->dispatched--;
> +
> +   cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--;
> +
> +   cfq_update_io_thinktime(cfqd, cfqq, cic);
> +   cfq_update_io_seektime(cfqd, cfqq, rq);
> +   cfq_update_idle_window(cfqd, cfqq, cic);
> +
> +   cfqq->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq);
> +
> +   if (cfqq == cfqd->active_queue) {
> +   if (cfq_cfqq_wait_request(cfqq)) {
> +   if (blk_rq_bytes(rq) > PAGE_CACHE_SIZE ||
> +   cfqd->busy_queues > 1) {
> +   cfq_del_timer(cfqd, cfqq);
> +   cfq_clear_cfqq_wait_request(cfqq);
> +   } else {
> +   cfqg_stats_update_idle_time(cfqq->cfqg);
> +   cfq_mark_cfqq_must_dispatch(cfqq);
> +   }
> +   }
> +   } else if (cfq_should_preempt(cfqd, cfqq, rq)) {
> +   cfq_preempt_queue(cfqd, cfqq);
> +   }
> +}
> +
> +static int cfq_reinsert_request(struct request_queue *q, struct request *rq)
> +{
> +   struct cfq_data *cfqd = q->elevator->elevator_data;
> +   struct cfq_queue *cfqq = RQ_CFQQ(rq);
> +
> +   if (!cfqq || cfqq->cfqd != cfqd)
> +   return -EIO;
> +
> +   cfq_log_cfqq(cfqd, cfqq, "re-insert_request");
> +

[RFC/PATCH 4/4] block: Add URGENT request notification support to CFQ scheduler

2013-07-11 Thread Tanya Brokhman
When the scheduler reports to the block layer that there is an urgent
request pending, the device driver may decide to stop the transmission
of the current request in order to handle the urgent one. This is done
in order to reduce the latency of an urgent request. For example:
long WRITE may be stopped to handle an urgent READ.

Signed-off-by: Tatyana Brokhman 

diff --git a/block/blk-core.c b/block/blk-core.c
index 3ab3a62..705f4f9 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2090,7 +2090,10 @@ static void blk_account_io_completion(struct request 
*req, unsigned int bytes)
 
cpu = part_stat_lock();
part = req->part;
-   part_stat_add(cpu, part, sectors[rw], bytes >> 9);
+   if (part == NULL)
+   pr_err("%s: YANIV - BUG START", __func__);
+   else
+   part_stat_add(cpu, part, sectors[rw], bytes >> 9);
part_stat_unlock();
}
 }
@@ -2111,12 +2114,13 @@ static void blk_account_io_done(struct request *req)
cpu = part_stat_lock();
part = req->part;
 
-   part_stat_inc(cpu, part, ios[rw]);
-   part_stat_add(cpu, part, ticks[rw], duration);
-   part_round_stats(cpu, part);
-   part_dec_in_flight(part, rw);
-
-   hd_struct_put(part);
+   if (req->part != NULL) {
+   part_stat_inc(cpu, part, ios[rw]);
+   part_stat_add(cpu, part, ticks[rw], duration);
+   part_round_stats(cpu, part);
+   part_dec_in_flight(part, rw);
+   hd_struct_put(part);
+   }
part_stat_unlock();
}
 }
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index d5bbdcf..f936cb9 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -320,6 +320,9 @@ struct cfq_data {
unsigned long workload_expires;
struct cfq_group *serving_group;
 
+   unsigned int nr_urgent_pending;
+   unsigned int nr_urgent_in_flight;
+
/*
 * Each priority tree is sorted by next_request position.  These
 * trees are used when determining if two or more queues are
@@ -2783,6 +2786,14 @@ static void cfq_dispatch_insert(struct request_queue *q, 
struct request *rq)
(RQ_CFQG(rq))->dispatched++;
elv_dispatch_sort(q, rq);
 
+   if (rq->cmd_flags & REQ_URGENT) {
+   if (!cfqd->nr_urgent_pending)
+   WARN_ON(1);
+   else
+   cfqd->nr_urgent_pending--;
+   cfqd->nr_urgent_in_flight++;
+   }
+
cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]++;
cfqq->nr_sectors += blk_rq_sectors(rq);
cfqg_stats_update_dispatch(cfqq->cfqg, blk_rq_bytes(rq), rq->cmd_flags);
@@ -3909,6 +3920,68 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue 
*cfqq,
}
 }
 
+/*
+ * Called when a request (rq) is reinserted (to cfqq). Check if there's
+ * something we should do about it
+ */
+static void
+cfq_rq_requeued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
+   struct request *rq)
+{
+   struct cfq_io_cq *cic = RQ_CIC(rq);
+
+   cfqd->rq_queued++;
+   if (rq->cmd_flags & REQ_PRIO)
+   cfqq->prio_pending++;
+
+   cfqq->dispatched--;
+   (RQ_CFQG(rq))->dispatched--;
+
+   cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--;
+
+   cfq_update_io_thinktime(cfqd, cfqq, cic);
+   cfq_update_io_seektime(cfqd, cfqq, rq);
+   cfq_update_idle_window(cfqd, cfqq, cic);
+
+   cfqq->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq);
+
+   if (cfqq == cfqd->active_queue) {
+   if (cfq_cfqq_wait_request(cfqq)) {
+   if (blk_rq_bytes(rq) > PAGE_CACHE_SIZE ||
+   cfqd->busy_queues > 1) {
+   cfq_del_timer(cfqd, cfqq);
+   cfq_clear_cfqq_wait_request(cfqq);
+   } else {
+   cfqg_stats_update_idle_time(cfqq->cfqg);
+   cfq_mark_cfqq_must_dispatch(cfqq);
+   }
+   }
+   } else if (cfq_should_preempt(cfqd, cfqq, rq)) {
+   cfq_preempt_queue(cfqd, cfqq);
+   }
+}
+
+static int cfq_reinsert_request(struct request_queue *q, struct request *rq)
+{
+   struct cfq_data *cfqd = q->elevator->elevator_data;
+   struct cfq_queue *cfqq = RQ_CFQQ(rq);
+
+   if (!cfqq || cfqq->cfqd != cfqd)
+   return -EIO;
+
+   cfq_log_cfqq(cfqd, cfqq, "re-insert_request");
+   list_add(&rq->queuelist, &cfqq->fifo);
+   cfq_add_rq_rb(rq);
+
+   cfq_rq_requeued(cfqd, cfqq, rq);
+   if (rq->cmd_flags & REQ_URGENT) {
+   if (cfqd->nr_urgent_in_flight)
+   cfqd->nr_urgent_in_flight--;
+   cfqd->nr_ur

[RFC/PATCH 1/4] block: make rq->cmd_flags be 64-bit

2013-07-11 Thread Tanya Brokhman
From: Jens Axboe 

We have officially run out of flags in a 32-bit space. Extend it
to 64-bit even on 32-bit archs.

Signed-off-by: Jens Axboe 

diff --git a/block/blk-core.c b/block/blk-core.c
index 93a18d1..cfa4dd3 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -174,9 +174,9 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
 {
int bit;
 
-   printk(KERN_INFO "%s: dev %s: type=%x, flags=%x\n", msg,
+   printk(KERN_INFO "%s: dev %s: type=%x, flags=%llx\n", msg,
rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->cmd_type,
-   rq->cmd_flags);
+   (unsigned long long) rq->cmd_flags);
 
printk(KERN_INFO "  sector %llu, nr/cnr %u/%u\n",
   (unsigned long long)blk_rq_pos(rq),
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 04ceb7e..000abe2 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2886,9 +2886,9 @@ static void do_fd_request(struct request_queue *q)
return;
 
if (WARN(atomic_read(&usage_count) == 0,
-"warning: usage count=0, current_req=%p sect=%ld type=%x 
flags=%x\n",
+"warning: usage count=0, current_req=%p sect=%ld type=%x 
flags=%llx\n",
 current_req, (long)blk_rq_pos(current_req), 
current_req->cmd_type,
-current_req->cmd_flags))
+(unsigned long long) current_req->cmd_flags))
return;
 
if (test_and_set_bit(0, &fdc_busy)) {
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 80f39b8..aa81364 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -994,7 +994,7 @@ static int sd_prep_fn(struct request_queue *q, struct 
request *rq)
SCpnt->cmnd[0] = READ_6;
SCpnt->sc_data_direction = DMA_FROM_DEVICE;
} else {
-   scmd_printk(KERN_ERR, SCpnt, "Unknown command %x\n", 
rq->cmd_flags);
+   scmd_printk(KERN_ERR, SCpnt, "Unknown command %llx\n", 
(unsigned long long) rq->cmd_flags);
goto out;
}
 
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index fa1abeb..c26801e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -181,16 +181,16 @@ enum rq_flag_bits {
__REQ_NR_BITS,  /* stops here */
 };
 
-#define REQ_WRITE  (1 << __REQ_WRITE)
-#define REQ_FAILFAST_DEV   (1 << __REQ_FAILFAST_DEV)
-#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
-#define REQ_FAILFAST_DRIVER(1 << __REQ_FAILFAST_DRIVER)
-#define REQ_SYNC   (1 << __REQ_SYNC)
-#define REQ_META   (1 << __REQ_META)
-#define REQ_PRIO   (1 << __REQ_PRIO)
-#define REQ_DISCARD(1 << __REQ_DISCARD)
-#define REQ_WRITE_SAME (1 << __REQ_WRITE_SAME)
-#define REQ_NOIDLE (1 << __REQ_NOIDLE)
+#define REQ_WRITE  (1ULL << __REQ_WRITE)
+#define REQ_FAILFAST_DEV   (1ULL << __REQ_FAILFAST_DEV)
+#define REQ_FAILFAST_TRANSPORT (1ULL << __REQ_FAILFAST_TRANSPORT)
+#define REQ_FAILFAST_DRIVER(1ULL << __REQ_FAILFAST_DRIVER)
+#define REQ_SYNC   (1ULL << __REQ_SYNC)
+#define REQ_META   (1ULL << __REQ_META)
+#define REQ_PRIO   (1ULL << __REQ_PRIO)
+#define REQ_DISCARD(1ULL << __REQ_DISCARD)
+#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME)
+#define REQ_NOIDLE (1ULL << __REQ_NOIDLE)
 
 #define REQ_FAILFAST_MASK \
(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
@@ -206,28 +206,28 @@ enum rq_flag_bits {
 #define REQ_NOMERGE_FLAGS \
(REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA)
 
-#define REQ_RAHEAD (1 << __REQ_RAHEAD)
-#define REQ_THROTTLED  (1 << __REQ_THROTTLED)
-
-#define REQ_SORTED (1 << __REQ_SORTED)
-#define REQ_SOFTBARRIER(1 << __REQ_SOFTBARRIER)
-#define REQ_FUA(1 << __REQ_FUA)
-#define REQ_NOMERGE(1 << __REQ_NOMERGE)
-#define REQ_STARTED(1 << __REQ_STARTED)
-#define REQ_DONTPREP   (1 << __REQ_DONTPREP)
-#define REQ_QUEUED (1 << __REQ_QUEUED)
-#define REQ_ELVPRIV(1 << __REQ_ELVPRIV)
-#define REQ_FAILED (1 << __REQ_FAILED)
-#define REQ_QUIET  (1 << __REQ_QUIET)
-#define REQ_PREEMPT(1 << __REQ_PREEMPT)
-#define REQ_ALLOCED(1 << __REQ_ALLOCED)
-#define REQ_COPY_USER  (1 << __REQ_COPY_USER)
-#define REQ_FLUSH  (1 << __REQ_FLUSH)
-#define REQ_FLUSH_SEQ  (1 << __REQ_FLUSH_SEQ)
-#define REQ_IO_STAT(1 << __REQ_IO_STAT)
-#define REQ_MIXED_MERGE(1 << __REQ_MIXED_MERGE)
-#define REQ_SECURE (1 << __REQ_SECURE)
-#define REQ_KERNEL (1 << __REQ_KERNEL)
-#define REQ_PM (1 << __REQ_PM)
+#define REQ_RAHEAD (1ULL << __REQ_RAHEAD)
+#define REQ_THROTTLED  (1ULL << __REQ_THRO

[Bug 59601] commit 97dec564fd4948e0e560869c80b76e166ca2a83e breaks communication with XYRATEX disk shelves

2013-07-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=59601

--- Comment #9 from Saurav Kashyap  ---
Created attachment 106870
  --> https://bugzilla.kernel.org/attachment.cgi?id=106870&action=edit
Properly-set-the-tagging-for-commands

Hi Jack,
Try this patch and see if this resolves this issue.

thanks,
~Saurav

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V3 2/2] scsi: ufs: Add runtime PM support for UFS host controller driver

2013-07-11 Thread Sujit Reddy Thumma

On 7/10/2013 7:01 PM, Seungwon Jeon wrote:

On Tue, July 09, 2013, Sujit Reddy Thumma wrote:

Add runtime PM helpers to suspend/resume UFS controller at runtime.
Enable runtime PM by default for pci and platform drivers as the
initialized hardware can suspend if it is not used after bootup.

Signed-off-by: Sujit Reddy Thumma 
---
  drivers/scsi/ufs/ufshcd-pci.c|   65 ++---
  drivers/scsi/ufs/ufshcd-pltfrm.c |   51 +-
  drivers/scsi/ufs/ufshcd.c|8 +
  3 files changed, 117 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd-pci.c b/drivers/scsi/ufs/ufshcd-pci.c
index 48be39a..7bd8faa 100644
--- a/drivers/scsi/ufs/ufshcd-pci.c
+++ b/drivers/scsi/ufs/ufshcd-pci.c
@@ -35,6 +35,7 @@

  #include "ufshcd.h"
  #include 
+#include 

  #ifdef CONFIG_PM
  /**
@@ -44,7 +45,7 @@
   *
   * Returns -ENOSYS
   */
-static int ufshcd_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+static int ufshcd_pci_suspend(struct device *dev)
  {
/*
 * TODO:
@@ -61,7 +62,7 @@ static int ufshcd_pci_suspend(struct pci_dev *pdev, 
pm_message_t state)
   *
   * Returns -ENOSYS
   */
-static int ufshcd_pci_resume(struct pci_dev *pdev)
+static int ufshcd_pci_resume(struct device *dev)
  {
/*
 * TODO:
@@ -71,8 +72,48 @@ static int ufshcd_pci_resume(struct pci_dev *pdev)

return -ENOSYS;
  }
+#else
+#define ufshcd_pci_suspend NULL
+#define ufshcd_pci_resume  NULL
  #endif /* CONFIG_PM */

+#ifdef CONFIG_PM_RUNTIME
+static int ufshcd_pci_runtime_suspend(struct device *dev)
+{
+   struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+   struct ufs_hba *hba = pci_get_drvdata(pdev);

Can be replaced:
struct ufs_hba *hba = dev_get_drvdata(dev);


Yes.




+
+   if (!hba)
+   return 0;
+
+   return ufshcd_runtime_suspend(hba);
+}
+static int ufshcd_pci_runtime_resume(struct device *dev)
+{
+   struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+   struct ufs_hba *hba = pci_get_drvdata(pdev);

Same as above.


Okay.





+
+   if (!hba)
+   return 0;
+
+   return ufshcd_runtime_resume(hba);
+}
+static int ufshcd_pci_runtime_idle(struct device *dev)
+{
+   struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
+   struct ufs_hba *hba = pci_get_drvdata(pdev);

Same as above.


Okay.



+
+   if (!hba)
+   return 0;
+
+   return ufshcd_runtime_idle(hba);
+}
+#else /* !CONFIG_PM_RUNTIME */
+#define ufshcd_pci_runtime_suspend NULL
+#define ufshcd_pci_runtime_resume  NULL
+#define ufshcd_pci_runtime_idleNULL
+#endif /* CONFIG_PM_RUNTIME */
+
  /**
   * ufshcd_pci_shutdown - main function to put the controller in reset state
   * @pdev: pointer to PCI device handle
@@ -91,6 +132,9 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
  {
struct ufs_hba *hba = pci_get_drvdata(pdev);

+   pm_runtime_forbid(&pdev->dev);
+   pm_runtime_get_noresume(&pdev->dev);
+
disable_irq(pdev->irq);
ufshcd_remove(hba);
pci_release_regions(pdev);
@@ -168,6 +212,8 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
}

pci_set_drvdata(pdev, hba);
+   pm_runtime_put_noidle(&pdev->dev);
+   pm_runtime_allow(&pdev->dev);

return 0;

@@ -182,6 +228,14 @@ out_error:
return err;
  }

+static const struct dev_pm_ops ufshcd_pci_pm_ops = {
+   .suspend= ufshcd_pci_suspend,
+   .resume = ufshcd_pci_resume,
+   .runtime_suspend = ufshcd_pci_runtime_suspend,
+   .runtime_resume  = ufshcd_pci_runtime_resume,
+   .runtime_idle= ufshcd_pci_runtime_idle,
+};
+
  static DEFINE_PCI_DEVICE_TABLE(ufshcd_pci_tbl) = {
{ PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ } /* terminate list */
@@ -195,10 +249,9 @@ static struct pci_driver ufshcd_pci_driver = {
.probe = ufshcd_pci_probe,
.remove = ufshcd_pci_remove,
.shutdown = ufshcd_pci_shutdown,
-#ifdef CONFIG_PM
-   .suspend = ufshcd_pci_suspend,
-   .resume = ufshcd_pci_resume,
-#endif
+   .driver = {
+   .pm = &ufshcd_pci_pm_ops
+   },
  };

  module_pci_driver(ufshcd_pci_driver);
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index c42db40..b1f2605 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -34,6 +34,7 @@
   */

  #include 
+#include 

  #include "ufshcd.h"

@@ -87,6 +88,43 @@ static int ufshcd_pltfrm_resume(struct device *dev)
  #define ufshcd_pltfrm_resume  NULL
  #endif

+#ifdef CONFIG_PM_RUNTIME
+static int ufshcd_pltfrm_runtime_suspend(struct device *dev)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+   struct ufs_hba *hba =  platform_get_drvdata(pdev);

Same as above.

Okay.




+
+   if (!hba)
+   return 0;

Re: [PATCH V3 1/2] scsi: ufs: Add support for host assisted background operations

2013-07-11 Thread Sujit Reddy Thumma

On 7/10/2013 7:01 PM, Seungwon Jeon wrote:

I'm not sure that BKOPS with runtime-pm associates.
Do you think it's helpful for power management?
How about hibernation scheme for runtime-pm?
I'm testing and I can introduce soon.


Well, I am thinking on following approach when we introduce
power management.

ufshcd_runtime_suspend() {
if (bkops_status >= NON_CRITICAL) { /* 0x1 */
ufshcd_enable_auto_bkops();
hibernate(); /* only the link and the device
should be able to cary out bkops */
} else {
hibernate(); /* Link and the device for more savings */
}
}

Let me know if this is okay.



On Tue, July 09, 2013, Sujit Reddy Thumma wrote:

Background operations in the UFS device can be disabled by
the host to reduce the response latency of transfer requests.
Add support for enabling/disabling the background operations
during runtime suspend/resume of the device.

If the device is in critical need of BKOPS it will raise an
URGENT_BKOPS exception which should be handled by the host to
make sure the device performs as expected.

During bootup, the BKOPS is enabled in the device by default.
The disable of BKOPS is supported only when the driver supports
runtime suspend/resume operations as the runtime PM framework
provides a way to determine the device idleness and hence BKOPS
can be managed effectively. During runtime resume the BKOPS is
disabled to reduce latency and during runtime suspend the BKOPS
is enabled to allow device to carry out idle time BKOPS.

In some cases where the BKOPS is disabled during runtime resume
and due to continuous data transfers the runtime suspend is not
triggered, the BKOPS is enabled when the device raises a level-2
exception (outstanding operations - performance impact).

Signed-off-by: Sujit Reddy Thumma 
---
  drivers/scsi/ufs/ufs.h|   25 -
  drivers/scsi/ufs/ufshcd.c |  338 +
  drivers/scsi/ufs/ufshcd.h |   10 ++
  3 files changed, 372 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index db5bde4..549a652 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -107,7 +107,29 @@ enum {

  /* Flag idn for Query Requests*/
  enum flag_idn {
-   QUERY_FLAG_IDN_FDEVICEINIT = 0x01,
+   QUERY_FLAG_IDN_FDEVICEINIT  = 0x01,
+   QUERY_FLAG_IDN_BKOPS_EN = 0x04,
+};
+
+/* Attribute idn for Query requests */
+enum attr_idn {
+   QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
+   QUERY_ATTR_IDN_EE_CONTROL   = 0x0D,
+   QUERY_ATTR_IDN_EE_STATUS= 0x0E,
+};
+
+/* Exception event mask values */
+enum {
+   MASK_EE_STATUS  = 0x,
+   MASK_EE_URGENT_BKOPS= (1 << 2),
+};
+
+/* Background operation status */
+enum {
+   BKOPS_STATUS_NO_OP   = 0x0,
+   BKOPS_STATUS_NON_CRITICAL= 0x1,
+   BKOPS_STATUS_PERF_IMPACT = 0x2,
+   BKOPS_STATUS_CRITICAL= 0x3,
  };

  /* UTP QUERY Transaction Specific Fields OpCode */
@@ -156,6 +178,7 @@ enum {
MASK_TASK_RESPONSE  = 0xFF00,
MASK_RSP_UPIU_RESULT= 0x,
MASK_QUERY_DATA_SEG_LEN = 0x,
+   MASK_RSP_EXCEPTION_EVENT = 0x1,
  };

  /* Task management service response */
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 96ccb28..a25de66 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -268,6 +268,21 @@ ufshcd_get_rsp_upiu_result(struct utp_upiu_rsp 
*ucd_rsp_ptr)
  }

  /**
+ * ufshcd_is_exception_event - Check if the device raised an exception event
+ * @ucd_rsp_ptr: pointer to response UPIU
+ *
+ * The function checks if the device raised an exception event indicated in
+ * the Device Information field of response UPIU.
+ *
+ * Returns true if exception is raised, false otherwise.
+ */
+static inline bool ufshcd_is_exception_event(struct utp_upiu_rsp *ucd_rsp_ptr)
+{
+   return be32_to_cpu(ucd_rsp_ptr->header.dword_2) &
+   MASK_RSP_EXCEPTION_EVENT ? true : false;
+}
+
+/**
   * ufshcd_config_int_aggr - Configure interrupt aggregation values.
   *Currently there is no use case where we want to configure
   *interrupt aggregation dynamically. So to configure interrupt
@@ -1174,6 +1189,86 @@ out_no_mem:
  }

  /**
+ * ufshcd_query_attr - Helper function for composing attribute requests
+ * hba: per-adapter instance
+ * opcode: attribute opcode
+ * idn: attribute idn to access
+ * index: index field
+ * selector: selector field
+ * attr_val: the attribute value after the query request completes
+ *
+ * Returns 0 for success, non-zero in case of failure
+*/
+int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
+   enum attr_idn idn, u8 index, u8 selector, u32 *attr_val)
+{
+   struct ufs_query_req *query;
+   struct ufs_query_res *response;
+   int err = -ENOMEM;
+
+  

Re: [PATCH V3 1/2] scsi: ufs: Add support for sending NOP OUT UPIU

2013-07-11 Thread Sujit Reddy Thumma
On 7/10/2013 6:58 PM, Seungwon Jeon wrote:
> On Tue, July 09, 2013, Sujit Reddy Thumma wrote:
>> As part of device initialization sequence, sending NOP OUT UPIU and
>> waiting for NOP IN UPIU response is mandatory. This confirms that the
>> device UFS Transport (UTP) layer is functional and the host can configure
>> the device with further commands. Add support for sending NOP OUT UPIU to
>> check the device connection path and test whether the UTP layer on the
>> device side is functional during initialization.
>>
>> A tag is acquired from the SCSI tag map space in order to send the device
>> management command. When the tag is acquired by internal command the scsi
>> command is rejected with host busy flag in order to requeue the request.
>> To avoid frequent collisions between internal commands and scsi commands
>> the device management command tag is allocated in the opposite direction
>> w.r.t block layer tag allocation.
>>
>> Signed-off-by: Sujit Reddy Thumma 
>> Signed-off-by: Dolev Raviv 
>> ---
>>   drivers/scsi/ufs/ufs.h|   43 +++-
>>   drivers/scsi/ufs/ufshcd.c |  596 
>> +
>>   drivers/scsi/ufs/ufshcd.h |   29 ++-
>>   3 files changed, 552 insertions(+), 116 deletions(-)
>>
>> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
>> index 139bc06..14c0a4e 100644
>> --- a/drivers/scsi/ufs/ufs.h
>> +++ b/drivers/scsi/ufs/ufs.h
>> @@ -36,10 +36,16 @@
>>   #ifndef _UFS_H
>>   #define _UFS_H
>>
>> +#include 
>> +#include 
>> +
>>   #define MAX_CDB_SIZE   16
>> +#define GENERAL_UPIU_REQUEST_SIZE 32
>> +#define UPIU_HEADER_DATA_SEGMENT_MAX_SIZE   ((ALIGNED_UPIU_SIZE) - \
>> +(GENERAL_UPIU_REQUEST_SIZE))
>>
>>   #define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
>> -((byte3 << 24) | (byte2 << 16) |\
>> +cpu_to_be32((byte3 << 24) | (byte2 << 16) |\
>>   (byte1 << 8) | (byte0))
>>
>>   /*
>> @@ -73,6 +79,7 @@ enum {
>>  UPIU_TRANSACTION_TASK_RSP   = 0x24,
>>  UPIU_TRANSACTION_READY_XFER = 0x31,
>>  UPIU_TRANSACTION_QUERY_RSP  = 0x36,
>> +UPIU_TRANSACTION_REJECT_UPIU= 0x3F,
>>   };
>>
>>   /* UPIU Read/Write flags */
>> @@ -110,6 +117,12 @@ enum {
>>  UPIU_COMMAND_SET_TYPE_QUERY = 0x2,
>>   };
>>
>> +/* UTP Transfer Request Command Offset */
>> +#define UPIU_COMMAND_TYPE_OFFSET28
>> +
>> +/* Offset of the response code in the UPIU header */
>> +#define UPIU_RSP_CODE_OFFSET8
>> +
>>   enum {
>>  MASK_SCSI_STATUS= 0xFF,
>>  MASK_TASK_RESPONSE  = 0xFF00,
>> @@ -138,26 +151,32 @@ struct utp_upiu_header {
>>
>>   /**
>>* struct utp_upiu_cmd - Command UPIU structure
>> - * @header: UPIU header structure DW-0 to DW-2
>>* @data_transfer_len: Data Transfer Length DW-3
>>* @cdb: Command Descriptor Block CDB DW-4 to DW-7
>>*/
>>   struct utp_upiu_cmd {
>> -struct utp_upiu_header header;
>>  u32 exp_data_transfer_len;
>>  u8 cdb[MAX_CDB_SIZE];
>>   };
>>
>>   /**
>> - * struct utp_upiu_rsp - Response UPIU structure
>> - * @header: UPIU header DW-0 to DW-2
>> + * struct utp_upiu_req - general upiu request structure
>> + * @header:UPIU header structure DW-0 to DW-2
>> + * @sc: fields structure for scsi command DW-3 to DW-7
>> + */
>> +struct utp_upiu_req {
>> +struct utp_upiu_header header;
>> +struct utp_upiu_cmd sc;
>> +};
>> +
>> +/**
>> + * struct utp_cmd_rsp - Response UPIU structure
>>* @residual_transfer_count: Residual transfer count DW-3
>>* @reserved: Reserved double words DW-4 to DW-7
>>* @sense_data_len: Sense data length DW-8 U16
>>* @sense_data: Sense data field DW-8 to DW-12
>>*/
>> -struct utp_upiu_rsp {
>> -struct utp_upiu_header header;
>> +struct utp_cmd_rsp {
>>  u32 residual_transfer_count;
>>  u32 reserved[4];
>>  u16 sense_data_len;
>> @@ -165,6 +184,16 @@ struct utp_upiu_rsp {
>>   };
>>
>>   /**
>> + * struct utp_upiu_rsp - general upiu response structure
>> + * @header: UPIU header structure DW-0 to DW-2
>> + * @sr: fields structure for scsi command DW-3 to DW-12
>> + */
>> +struct utp_upiu_rsp {
>> +struct utp_upiu_header header;
>> +struct utp_cmd_rsp sr;
>> +};
>> +
>> +/**
>>* struct utp_upiu_task_req - Task request UPIU structure
>>* @header - UPIU header structure DW0 to DW-2
>>* @input_param1: Input parameter 1 DW-3
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index b743bd6..3f482b6 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -43,6 +43,11 @@
>>   /* UIC command timeout, unit: ms */
>>   #define UIC_CMD_TIMEOUT500
>>
>> +/* NOP OUT retries waiting for NOP IN response */
>> +#define NOP_OUT_RETRIES10
>> +/* Timeout after 30 msecs if NOP OUT hangs without response */
>> +#define NOP_OUT_TIMEOUT30 /* msecs */
>> +
>>   enum {
>>  UFSHCD_MAX_CHANNEL  = 0,
>>  UFSHCD_MAX_ID