Re: [PATCH 1/2] Kernel/time: Introduce a new timestamp function local_time_seconds()

2013-05-15 Thread James Bottomley
On Wed, 2013-05-15 at 11:32 +0800, Gu Zheng wrote:
 On 05/14/2013 11:57 PM, John Stultz wrote:
 
  On 05/14/2013 12:45 AM, Gu Zheng wrote:
   From 18072c1c3506a7e37ee485307a2c343efe5af4d0 Mon Sep 17 00:00:00 2001
  From: Gu Zheng guz.f...@cn.fujitsu.com
  Date: Mon, 13 May 2013 15:45:24 +0900
  Subject: [PATCH 1/2] Kernel/time: Introduce a new timestamp function 
  local_time_seconds()
 
  Introduce a new timestamp function local_time_seconds() to hide the 
  conversion of system time in UTC to local time seconds.
  
  So, why is this useful/needed?
 
 Hi John,
There are some subsystems use local time seconds as a timestamp,
 such as scsi(refer
 to:http://www.spinics.net/lists/linux-scsi/msg66089.html),
 and so do many out-of-kernel-tree code I think.

I don't think the 3ware drivers, which are the only ones that do this
actually care.  I think jiffies to seconds would suit the event
timestamps equally well, so I don't really see a need to make this a
formal kernel export given that it's only a single driver family in the
entirety of the kernel.

James


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


Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead

2013-05-15 Thread Liu Jiang

On Wed 15 May 2013 02:52:51 AM CST, Yinghai Lu wrote:

On Tue, May 14, 2013 at 9:57 AM, Liu Jiang liu...@gmail.com wrote:

On Tue 14 May 2013 11:10:33 PM CST, Yinghai Lu wrote:


On Tue, May 14, 2013 at 7:59 AM, Liu Jiang liu...@gmail.com wrote:


On 05/14/2013 04:26 PM, Gu Zheng wrote:
  I suggest to use pci_release_dev() instead because it also needs to
release OF related resources.
I will update it in next version.

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bc075a3..2ac6338 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1281,7 +1281,7 @@ static struct pci_dev *pci_scan_device(struct
pci_bus
*bus
  pci_set_of_node(dev);

  if (pci_setup_device(dev)) {
-   kfree(dev);
+   pci_release_dev(dev-dev);
  return NULL;



no, should move pci_set_of_node calling into pci_setup_device.

Yinghai



I'm not sure whether we should call pci_set_of_node() for SR-IOV devices
too,
any suggestions here?


or just move down pci_set_of_node after pci_setup_device?

anyway that is another bug.

Yinghai
I'm not familiar with the OF logic and can't make sure whether 
pci_setup_device()
has dependency on dev-of_node. Feel it's more safe to call 
pci_release_of_node()

on failing path instead of tuning call-site of pci_set_of_node().
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead

2013-05-15 Thread Yinghai Lu
On Wed, May 15, 2013 at 7:39 AM, Liu Jiang liu...@gmail.com wrote:
 On Wed 15 May 2013 02:52:51 AM CST, Yinghai Lu wrote:

 On Tue, May 14, 2013 at 9:57 AM, Liu Jiang liu...@gmail.com wrote:

 On Tue 14 May 2013 11:10:33 PM CST, Yinghai Lu wrote:


 On Tue, May 14, 2013 at 7:59 AM, Liu Jiang liu...@gmail.com wrote:


 On 05/14/2013 04:26 PM, Gu Zheng wrote:
   I suggest to use pci_release_dev() instead because it also needs
 to
 release OF related resources.
 I will update it in next version.

 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
 index bc075a3..2ac6338 100644
 --- a/drivers/pci/probe.c
 +++ b/drivers/pci/probe.c
 @@ -1281,7 +1281,7 @@ static struct pci_dev *pci_scan_device(struct
 pci_bus
 *bus
   pci_set_of_node(dev);

   if (pci_setup_device(dev)) {
 -   kfree(dev);
 +   pci_release_dev(dev-dev);
   return NULL;



 no, should move pci_set_of_node calling into pci_setup_device.

 Yinghai



 I'm not sure whether we should call pci_set_of_node() for SR-IOV devices
 too,
 any suggestions here?


 or just move down pci_set_of_node after pci_setup_device?

 anyway that is another bug.

 I'm not familiar with the OF logic and can't make sure whether
 pci_setup_device()
 has dependency on dev-of_node. Feel it's more safe to call
 pci_release_of_node()
 on failing path instead of tuning call-site of pci_set_of_node().

that is another bug, let of guy handle it.

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


Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead

2013-05-15 Thread Liu Jiang

On Wed 15 May 2013 10:43:02 PM CST, Yinghai Lu wrote:

On Wed, May 15, 2013 at 7:39 AM, Liu Jiang liu...@gmail.com wrote:

On Wed 15 May 2013 02:52:51 AM CST, Yinghai Lu wrote:


On Tue, May 14, 2013 at 9:57 AM, Liu Jiang liu...@gmail.com wrote:


On Tue 14 May 2013 11:10:33 PM CST, Yinghai Lu wrote:



On Tue, May 14, 2013 at 7:59 AM, Liu Jiang liu...@gmail.com wrote:



On 05/14/2013 04:26 PM, Gu Zheng wrote:
   I suggest to use pci_release_dev() instead because it also needs
to
release OF related resources.
I will update it in next version.

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bc075a3..2ac6338 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1281,7 +1281,7 @@ static struct pci_dev *pci_scan_device(struct
pci_bus
*bus
   pci_set_of_node(dev);

   if (pci_setup_device(dev)) {
-   kfree(dev);
+   pci_release_dev(dev-dev);
   return NULL;




no, should move pci_set_of_node calling into pci_setup_device.

Yinghai




I'm not sure whether we should call pci_set_of_node() for SR-IOV devices
too,
any suggestions here?



or just move down pci_set_of_node after pci_setup_device?

anyway that is another bug.



I'm not familiar with the OF logic and can't make sure whether
pci_setup_device()
has dependency on dev-of_node. Feel it's more safe to call
pci_release_of_node()
on failing path instead of tuning call-site of pci_set_of_node().


that is another bug, let of guy handle it.

Yinghai

Hi Yinghai,
  I don't know any OF exports, could you please help to CC
some OF experts?
Thanks,
Gerry

--
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/1] ibmvfc: Fix for offlining devices during error recovery

2013-05-15 Thread Brian King

This fixes an issue seen with devices getting marked offline
in a scenario where a VIOS was getting rebooted while a
client VFC adapter is in SCSI EH and prevents unnecessary
EH escalation in some scenarios.

Signed-off-by: Brian King brk...@linux.vnet.ibm.com
---

 drivers/scsi/ibmvscsi/ibmvfc.c |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff -puN drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_abort_during_reset 
drivers/scsi/ibmvscsi/ibmvfc.c
--- linux/drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_abort_during_reset  
2013-05-15 10:02:13.0 -0500
+++ linux-bjking1/drivers/scsi/ibmvscsi/ibmvfc.c2013-05-15 
10:02:13.0 -0500
@@ -2208,7 +2208,10 @@ static int ibmvfc_cancel_all(struct scsi
 
if (rsp_rc != 0) {
sdev_printk(KERN_ERR, sdev, Failed to send cancel event. 
rc=%d\n, rsp_rc);
-   return -EIO;
+   /* If failure is received, the host adapter is most likely going
+through reset, return success so the caller will wait for the 
command
+being cancelled to get returned */
+   return 0;
}
 
sdev_printk(KERN_INFO, sdev, Cancelling outstanding commands.\n);
@@ -2221,7 +2224,15 @@ static int ibmvfc_cancel_all(struct scsi
 
if (status != IBMVFC_MAD_SUCCESS) {
sdev_printk(KERN_WARNING, sdev, Cancel failed with rc=%x\n, 
status);
-   return -EIO;
+   switch (status) {
+   case IBMVFC_MAD_DRIVER_FAILED:
+   case IBMVFC_MAD_CRQ_ERROR:
+   /* Host adapter most likely going through reset, return 
success to
+the caller will wait for the command being cancelled 
to get returned */
+   return 0;
+   default:
+   return -EIO;
+   };
}
 
sdev_printk(KERN_INFO, sdev, Successfully cancelled outstanding 
commands\n);
_

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


mpt2sas,mpt3sas watchdog device removal

2013-05-15 Thread Joe Lawrence
This is a followup to the earlier discussion of MPT watchdog device
removal calling directly into PCI core API:

[1] http://thread.gmane.org/gmane.linux.scsi/80629

I've tested two safer, alternative methods of removing MPT hosts from
the SCSI topology. Both involve wrapping the existing MPT .remove
routine, ensuring mutual exclusion between regularly scheduled PCI
device removal and the drivers' periodic watchdog thread. Both changes
tested well against surprise PCI removal of LSI SAS 9211-8i HBAs while
driving direct IO out to attached disks.

The first version is straightforward, essentially just adding a common
mutex and checking that the driver still cares about a given PCI device
before removing.

The second version is an attempt to detach only from the SCSI topology as
soon as possible. Later PCI removal cleans up the rest of the resources.

Neither patch maps cleanly to the MPT fusion driver as its watchdog
thread resides in the mptbase module. The code currently uses PCI core
API pci_remove_bus_device to route around the driver's module
dependencies to call from mptbase to mptsas:

Module  Size  Used by
mptsas 62366  8   PCI .remove
mptscsih   38803  1 mptsas
mptbase99878  2 mptsas,mptscsih   watchdog

The fusion driver has devised other means of calling from mptbase to
mptscsih, for example, via the schedule_dead_ioc_flush_running_cmds
function pointer. The two changes I explored were made with a relatively
light hand, so I didn't know how best to proceed with a MPT fusion
patch.

Comments on either removal patch strategy welcome. It would also be
great if we had documentation guiding the SCSI LLDs in how to safely and
completely remove attached hosts in hotplug and defective HW scenarios.

Regards,

-- Joe
--
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] mpt2sas,mpt3sas: make watchdog instantiated device removal safe

2013-05-15 Thread Joe Lawrence
From 9fc1a958ad48718216fbdc19405297dd11d11539 Mon Sep 17 00:00:00 2001
From: Joe Lawrence joe.lawre...@stratus.com
Date: Tue, 14 May 2013 15:41:17 -0400
Subject: [PATCH] mpt2sas,mpt3sas: make watchdog instantiated device removal
 safe

Calling pci_stop_and_remove_bus_device from a SCSI LLD may introduce
device removal races with PCI callback functions such as device removal.

Modify the MPT PCI callbacks to verify Scsi_Host attachment under a
common mutex to prevent racing the driver's watchdog device removal.
(PCI callbacks can trust pci_dev existence.)

To protect the watchdog device removal thread from racing PCI removal,
first wrapper the existing PCI device .remove function. The watchdog
should directly call this function, not PCI hotplug API. Under the same
common mutex, this routine should verify that pci_dev is on driver's
ioc_list before proceeding with device removal. (Asynchronous driver
watchdog kthread cannot trust pci_dev existence.)

Signed-off-by: Joe Lawrence joe.lawre...@stratus.com
---
 drivers/scsi/mpt2sas/mpt2sas_base.c  | 24 +++--
 drivers/scsi/mpt2sas/mpt2sas_base.h  |  2 +
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 96 
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 22 +++--
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  2 +
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 95 ---
 6 files changed, 171 insertions(+), 70 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index bcb23d2..eb24ddd 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -116,24 +116,16 @@ module_param_call(mpt2sas_fwfault_debug, 
_scsih_set_fwfault_debug,
 
 /**
  *  mpt2sas_remove_dead_ioc_func - kthread context to remove dead ioc
- * @arg: input argument, used to derive ioc
+ * @pdev: PCI device struct
  *
- * Return 0 if controller is removed from pci subsystem.
- * Return -1 for other case.
+ * Returns 0.
  */
-static int mpt2sas_remove_dead_ioc_func(void *arg)
+static int
+mpt2sas_remove_dead_ioc_func(void *arg)
 {
-   struct MPT2SAS_ADAPTER *ioc = (struct MPT2SAS_ADAPTER *)arg;
-   struct pci_dev *pdev;
-
-   if ((ioc == NULL))
-   return -1;
-
-   pdev = ioc-pdev;
-   if ((pdev == NULL))
-   return -1;
-   pci_stop_and_remove_bus_device(pdev);
-   return 0;
+   /* mpt2sas_scsih_detach_pci will validate pci_dev */
+   mpt2sas_scsih_detach_pci((struct pci_dev *)arg);
+   return 0;
 }
 
 
@@ -192,7 +184,7 @@ _base_fault_reset_work(struct work_struct *work)
 */
ioc-remove_host = 1;
/*Remove the Dead Host */
-   p = kthread_run(mpt2sas_remove_dead_ioc_func, ioc,
+   p = kthread_run(mpt2sas_remove_dead_ioc_func, ioc-pdev,
mpt2sas_dead_ioc_%d, ioc-id);
if (IS_ERR(p)) {
printk(MPT2SAS_ERR_FMT
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h 
b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 4caaac1..d88515d 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -1079,6 +1079,8 @@ void mpt2sas_port_enable_complete(struct MPT2SAS_ADAPTER 
*ioc);
 
 void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
 
+void mpt2sas_scsih_detach_pci(struct pci_dev *pdev);
+
 /* config shared API */
 u8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
 u32 reply);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 
b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index c6bdc92..8bff162 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -78,6 +78,8 @@ static int _scsih_scan_finished(struct Scsi_Host *shost, 
unsigned long time);
 LIST_HEAD(mpt2sas_ioc_list);
 
 /* local parameters */
+DEFINE_MUTEX(_mpt2sas_pci_mutex);
+
 static u8 scsi_io_cb_idx = -1;
 static u8 tm_cb_idx = -1;
 static u8 ctl_cb_idx = -1;
@@ -7660,11 +7662,17 @@ _scsih_ir_shutdown(struct MPT2SAS_ADAPTER *ioc)
 static void
 _scsih_shutdown(struct pci_dev *pdev)
 {
-   struct Scsi_Host *shost = pci_get_drvdata(pdev);
-   struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
+   struct Scsi_Host *shost;
+   struct MPT2SAS_ADAPTER *ioc;
struct workqueue_struct *wq;
unsigned long flags;
 
+   mutex_lock(_mpt2sas_pci_mutex);
+   shost = pci_get_drvdata(pdev);
+   if (!shost)
+   goto out;
+   ioc = shost_priv(shost);
+
ioc-remove_host = 1;
_scsih_fw_event_cleanup_queue(ioc);
 
@@ -7677,26 +7685,41 @@ _scsih_shutdown(struct pci_dev *pdev)
 
_scsih_ir_shutdown(ioc);
mpt2sas_base_detach(ioc);
+out:
+   mutex_unlock(_mpt2sas_pci_mutex);
 }
 
 /**
- * _scsih_remove - detach and remove add host
+ * mpt2sas_scsih_detach_pci - detach shost from PCI device
  * 

Re: mpt2sas,mpt3sas watchdog device removal

2013-05-15 Thread Joe Lawrence
From 84ac7a35ebd61e84d4254eae78bb967de17254c2 Mon Sep 17 00:00:00 2001
From: Joe Lawrence joe.lawre...@stratus.com
Date: Wed, 15 May 2013 12:52:31 -0400
Subject: [PATCH] mpt2sas,mpt3sas: make watchdog instantiated device removal
 safe

Calling pci_stop_and_remove_bus_device from a SCSI LLD may introduce
device removal races with PCI callback functions.

Simplify the mpt2sas watchdog mechanism by separating PCI device removal
from SCSI midlayer detachment. When the watchdog wishes to remove a SCSI
device from the topology, detach from the SCSI midlayer, leaving the PCI
device alone. Adjust various pci_driver callbacks to account for a
potentially SCSI detached PCI device.

Signed-off-by: Joe Lawrence joe.lawre...@stratus.com
---
 drivers/scsi/mpt2sas/mpt2sas_base.c  | 43 +---
 drivers/scsi/mpt2sas/mpt2sas_base.h  |  2 +
 drivers/scsi/mpt2sas/mpt2sas_scsih.c | 97 +---
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 43 +---
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  2 +
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 65 +++-
 6 files changed, 105 insertions(+), 147 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index bcb23d2..cc1bf28 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -57,7 +57,6 @@
 #include linux/sort.h
 #include linux/io.h
 #include linux/time.h
-#include linux/kthread.h
 #include linux/aer.h
 
 #include mpt2sas_base.h
@@ -115,29 +114,6 @@ module_param_call(mpt2sas_fwfault_debug, 
_scsih_set_fwfault_debug,
 param_get_int, mpt2sas_fwfault_debug, 0644);
 
 /**
- *  mpt2sas_remove_dead_ioc_func - kthread context to remove dead ioc
- * @arg: input argument, used to derive ioc
- *
- * Return 0 if controller is removed from pci subsystem.
- * Return -1 for other case.
- */
-static int mpt2sas_remove_dead_ioc_func(void *arg)
-{
-   struct MPT2SAS_ADAPTER *ioc = (struct MPT2SAS_ADAPTER *)arg;
-   struct pci_dev *pdev;
-
-   if ((ioc == NULL))
-   return -1;
-
-   pdev = ioc-pdev;
-   if ((pdev == NULL))
-   return -1;
-   pci_stop_and_remove_bus_device(pdev);
-   return 0;
-}
-
-
-/**
  * _base_fault_reset_work - workq handling ioc fault conditions
  * @work: input argument, used to derive ioc
  * Context: sleep.
@@ -152,7 +128,6 @@ _base_fault_reset_work(struct work_struct *work)
unsigned longflags;
u32 doorbell;
int rc;
-   struct task_struct *p;
 
spin_lock_irqsave(ioc-ioc_reset_in_progress_lock, flags);
if (ioc-shost_recovery || ioc-pci_error_recovery)
@@ -186,23 +161,7 @@ _base_fault_reset_work(struct work_struct *work)
 * command back from HW.
 */
ioc-schedule_dead_ioc_flush_running_cmds(ioc);
-   /*
-* Set remove_host flag early since kernel thread will
-* take some time to execute.
-*/
-   ioc-remove_host = 1;
-   /*Remove the Dead Host */
-   p = kthread_run(mpt2sas_remove_dead_ioc_func, ioc,
-   mpt2sas_dead_ioc_%d, ioc-id);
-   if (IS_ERR(p)) {
-   printk(MPT2SAS_ERR_FMT
-   %s: Running mpt2sas_dead_ioc thread failed \n,
-   ioc-name, __func__);
-   } else {
-   printk(MPT2SAS_ERR_FMT
-   %s: Running mpt2sas_dead_ioc thread success \n,
-   ioc-name, __func__);
-   }
+   mpt2sas_scsih_detach(ioc);
 
return; /* don't rearm timer */
}
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h 
b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 4caaac1..94d0e98 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -817,6 +817,7 @@ struct MPT2SAS_ADAPTER {
u8  broadcast_aen_busy;
u16 broadcast_aen_pending;
u8  shost_recovery;
+   u8  shost_attached;
 
struct mutexreset_in_progress_mutex;
spinlock_t  ioc_reset_in_progress_lock;
@@ -1078,6 +1079,7 @@ struct _sas_device 
*mpt2sas_scsih_sas_device_find_by_sas_address(
 void mpt2sas_port_enable_complete(struct MPT2SAS_ADAPTER *ioc);
 
 void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
+void mpt2sas_scsih_detach(struct MPT2SAS_ADAPTER *ioc);
 
 /* config shared API */
 u8 mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c 
b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index c6bdc92..a06662c 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -7652,51 +7652,23 @@ _scsih_ir_shutdown(struct MPT2SAS_ADAPTER *ioc)
 }
 
 

[PATCH 1/1] bfa: Fixes for 0-terminated strncpy and possible null pointer dereference

2013-05-15 Thread Jakob Normark
This patch fixes two cppcheck errors in drivers/scsi/bfa/bfad_im.c
Kernel version: v3.10-rc1

Signed-off-by: Jakob Normark jakobnorm...@gmail.com
---
 drivers/scsi/bfa/bfad_im.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 5864f98..9489c56 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -944,13 +944,15 @@ static int
 bfad_im_slave_alloc(struct scsi_device *sdev)
 {
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
-   struct bfad_itnim_data_s *itnim_data =
-   (struct bfad_itnim_data_s *) rport-dd_data;
-   struct bfa_s *bfa = itnim_data-itnim-bfa_itnim-bfa;
+   struct bfad_itnim_data_s *itnim_data;
+   struct bfa_s *bfa;
 
if (!rport || fc_remote_port_chkready(rport))
return -ENXIO;
 
+   itnim_data = (struct bfad_itnim_data_s *) rport-dd_data;
+   bfa = itnim_data-itnim-bfa_itnim-bfa;
+
if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) {
/*
 * We should not mask LUN 0 - since this will translate
@@ -1037,6 +1039,7 @@ bfad_fc_host_init(struct bfad_im_port_s *im_port)
 
strncpy(symname, bfad-bfa_fcs.fabric.bport.port_cfg.sym_name.symname,
BFA_SYMNAME_MAXLEN);
+   symname[BFA_SYMNAME_MAXLEN - 1] = '\0';
sprintf(fc_host_symbolic_name(host), %s, symname);
 
fc_host_supported_speeds(host) = bfad_im_supported_speeds(bfad-bfa);
-- 
1.7.9.5

--
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/6] Drivers: scsi: storvsc: Update the storage protocol to win8 level

2013-05-15 Thread K. Y. Srinivasan
Update the storage protocol to the win8 level.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/scsi/storvsc_drv.c |  203 
 1 files changed, 168 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 8d29a95..a3cf85c 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -55,10 +55,15 @@
  * V1 RC  2008/1/31: 1.0
  * V1 RC  2008/1/31:  2.0
  * Win7: 4.2
+ * Win8: 5.1
  */
 
-#define VMSTOR_CURRENT_MAJOR  4
-#define VMSTOR_CURRENT_MINOR  2
+
+#define VMSTOR_WIN7_MAJOR 4
+#define VMSTOR_WIN7_MINOR 2
+
+#define VMSTOR_WIN8_MAJOR 5
+#define VMSTOR_WIN8_MINOR 1
 
 
 /*  Packet structure describing virtual storage requests. */
@@ -74,18 +79,103 @@ enum vstor_packet_operation {
VSTOR_OPERATION_QUERY_PROTOCOL_VERSION  = 9,
VSTOR_OPERATION_QUERY_PROPERTIES= 10,
VSTOR_OPERATION_ENUMERATE_BUS   = 11,
-   VSTOR_OPERATION_MAXIMUM = 11
+   VSTOR_OPERATION_FCHBA_DATA  = 12,
+   VSTOR_OPERATION_CREATE_SUB_CHANNELS = 13,
+   VSTOR_OPERATION_MAXIMUM = 13
+};
+
+/*
+ * WWN packet for Fiber Channel HBA
+ */
+
+struct hv_fc_wwn_packet {
+   boolprimary_active;
+   u8  reserved1;
+   u8  reserved2;
+   u8  primary_port_wwn[8];
+   u8  primary_node_wwn[8];
+   u8  secondary_port_wwn[8];
+   u8  secondary_node_wwn[8];
 };
 
+
+
+/*
+ * SRB Flag Bits
+ */
+
+#define SRB_FLAGS_QUEUE_ACTION_ENABLE  0x0002
+#define SRB_FLAGS_DISABLE_DISCONNECT   0x0004
+#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER   0x0008
+#define SRB_FLAGS_BYPASS_FROZEN_QUEUE  0x0010
+#define SRB_FLAGS_DISABLE_AUTOSENSE0x0020
+#define SRB_FLAGS_DATA_IN  0x0040
+#define SRB_FLAGS_DATA_OUT 0x0080
+#define SRB_FLAGS_NO_DATA_TRANSFER 0x
+#define SRB_FLAGS_UNSPECIFIED_DIRECTION(SRB_FLAGS_DATA_IN | 
SRB_FLAGS_DATA_OUT)
+#define SRB_FLAGS_NO_QUEUE_FREEZE  0x0100
+#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x0200
+#define SRB_FLAGS_FREE_SENSE_BUFFER0x0400
+
+/*
+ * This flag indicates the request is part of the workflow for processing a D3.
+ */
+#define SRB_FLAGS_D3_PROCESSING0x0800
+#define SRB_FLAGS_IS_ACTIVE0x0001
+#define SRB_FLAGS_ALLOCATED_FROM_ZONE  0x0002
+#define SRB_FLAGS_SGLIST_FROM_POOL 0x0004
+#define SRB_FLAGS_BYPASS_LOCKED_QUEUE  0x0008
+#define SRB_FLAGS_NO_KEEP_AWAKE0x0010
+#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE   0x0020
+#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x0040
+#define SRB_FLAGS_DONT_START_NEXT_PACKET   0x0080
+#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F00
+#define SRB_FLAGS_CLASS_DRIVER_RESERVED0xF000
+
+
 /*
  * Platform neutral description of a scsi request -
  * this remains the same across the write regardless of 32/64 bit
  * note: it's patterned off the SCSI_PASS_THROUGH structure
  */
 #define STORVSC_MAX_CMD_LEN0x10
-#define STORVSC_SENSE_BUFFER_SIZE  0x12
+
+#define POST_WIN7_STORVSC_SENSE_BUFFER_SIZE0x14
+#define PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE 0x12
+
+#define STORVSC_SENSE_BUFFER_SIZE  0x14
 #define STORVSC_MAX_BUF_LEN_WITH_PADDING   0x14
 
+/*
+ * Sense buffer size changed in win8; have a run-time
+ * variable to track the size we should use.
+ */
+static int sense_buffer_size;
+
+/*
+ * The size of the vmscsi_request has changed in win8. The
+ * additional size is because of new elements added to the
+ * structure. These elements are valid only when we are talking
+ * to a win8 host.
+ * Track the correction to size we need to apply.
+ */
+
+static int vmscsi_size_delta;
+static int vmstor_current_major;
+static int vmstor_current_minor;
+
+struct vmscsi_win8_extension {
+   /*
+* The following were added in Windows 8
+*/
+   u16 reserve;
+   u8  queue_tag;
+   u8  queue_action;
+   u32 srb_flags;
+   u32 time_out_value;
+   u32 queue_sort_ey;
+} __packed;
+
 struct vmscsi_request {
u16 length;
u8 srb_status;
@@ -108,6 +198,11 @@ struct vmscsi_request {
u8 sense_data[STORVSC_SENSE_BUFFER_SIZE];
u8 reserved_array[STORVSC_MAX_BUF_LEN_WITH_PADDING];
};
+   /*
+* The following was added in win8.
+*/
+   struct vmscsi_win8_extension win8_extension;
+
 } __attribute((packed));
 
 
@@ -115,22 +210,18 @@ struct vmscsi_request {
  * This structure is sent during the intialization phase to get the different
  * properties of the channel.
  */
+
+#define 

[PATCH 6/6] Drivers: scsi: storvsc: Support FC devices

2013-05-15 Thread K. Y. Srinivasan
Add support for synthetic Fiber Channel devices.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/scsi/storvsc_drv.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index bed8d23..14bc922 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1698,6 +1698,7 @@ static struct scsi_host_template scsi_driver = {
 enum {
SCSI_GUID,
IDE_GUID,
+   SFC_GUID,
 };
 
 static const struct hv_vmbus_device_id id_table[] = {
@@ -1709,6 +1710,11 @@ static const struct hv_vmbus_device_id id_table[] = {
{ HV_IDE_GUID,
  .driver_data = IDE_GUID
},
+   /* Fiber Channel GUID */
+   {
+ HV_SYNTHFC_GUID,
+ .driver_data = SFC_GUID
+   },
{ },
 };
 
-- 
1.7.4.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 v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead

2013-05-15 Thread Benjamin Herrenschmidt
On Wed, 2013-05-15 at 22:46 +0800, Liu Jiang wrote:
I don't know any OF exports, could you please help to CC
 some OF experts?

I wrote that code I think. Sorry, I've missed the beginning of the
thread, what is the problem ?

Cheers,
Ben.


--
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 0/6] Drivers: hv/scsi: Implement multi-channel support

2013-05-15 Thread K. Y. Srinivasan
This patch-set implements multi-channel support for Hyper-V devices. Also
support for synthetic Fiber Channel device is included. The first two
patches in the series are the foundational pieces for the remaining patches.

James, once Greg accepts the first two patches, you can consider the scsi
patches.


K. Y. Srinivasan (6):
  Drivers: hv: vmbus: Implement multi-channel support
  Drivers: hv: Add the GUID fot synthetic fiber channel device
  Drivers: scsi: storvsc: Make the scsi timeout a module parameter
  Drivers: scsi: storvsc: Update the storage protocol to win8 level
  Drivers: scsi: storvsc: Implement multi-channel support
  Drivers: scsi: storvsc: Support FC devices

 drivers/hv/channel.c   |   41 +-
 drivers/hv/channel_mgmt.c  |  117 +++-
 drivers/scsi/storvsc_drv.c |  340 +++-
 include/linux/hyperv.h |   70 +
 4 files changed, 522 insertions(+), 46 deletions(-)

-- 
1.7.4.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 1/6] Drivers: hv: vmbus: Implement multi-channel support

2013-05-15 Thread K. Y. Srinivasan
Starting with Win8, the host supports multiple sub-channels for a given
device. As in the past, the initial channel offer specifies the device and
is associated with both the type and the instance GUIDs. For performance
critical devices, the host may support multiple sub-channels. The sub-channels
share the same type and instance GUID as the primary channel. The number of
sub-channels offerrred to the guest depends on the number of virtual CPUs
assigned to the guest. The guest can request the creation of these sub-channels
and once created and opened, the guest can distribute the traffic across all
the channels (the primary and the sub-channels). A request sent on a sub-channel
will have the response delivered on the same sub-channel.

At channel (sub-channel) creation we bind the channel interrupt to a CPU and
with this sub-channel support we will be able to spread the interrupt load
of a given device across all available CPUs.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/hv/channel.c  |   41 ++--
 drivers/hv/channel_mgmt.c |  117 +++--
 include/linux/hyperv.h|   62 +++-
 3 files changed, 211 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 0b122f8..c219e9f 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -216,6 +216,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
list_del(open_info-msglistentry);
spin_unlock_irqrestore(vmbus_connection.channelmsg_lock, flags);
 
+   if (err == 0)
+   newchannel-state = CHANNEL_OPENED_STATE;
+
kfree(open_info);
return err;
 
@@ -500,15 +503,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, 
u32 gpadl_handle)
 }
 EXPORT_SYMBOL_GPL(vmbus_teardown_gpadl);
 
-/*
- * vmbus_close - Close the specified channel
- */
-void vmbus_close(struct vmbus_channel *channel)
+static void vmbus_close_internal(struct vmbus_channel *channel)
 {
struct vmbus_channel_close_channel *msg;
int ret;
unsigned long flags;
 
+   channel-state = CHANNEL_OPEN_STATE;
+   channel-sc_creation_callback = NULL;
/* Stop callback and cancel the timer asap */
spin_lock_irqsave(channel-inbound_lock, flags);
channel-onchannel_callback = NULL;
@@ -538,6 +540,37 @@ void vmbus_close(struct vmbus_channel *channel)
 
 
 }
+
+/*
+ * vmbus_close - Close the specified channel
+ */
+void vmbus_close(struct vmbus_channel *channel)
+{
+   struct list_head *cur, *tmp;
+   struct vmbus_channel *cur_channel;
+
+   if (channel-primary_channel != NULL) {
+   /*
+* We will only close sub-channels when
+* the primary is closed.
+*/
+   return;
+   }
+   /*
+* Close all the sub-channels first and then close the
+* primary channel.
+*/
+   list_for_each_safe(cur, tmp, channel-sc_list) {
+   cur_channel = list_entry(cur, struct vmbus_channel, sc_list);
+   if (cur_channel-state != CHANNEL_OPENED_STATE)
+   continue;
+   vmbus_close_internal(cur_channel);
+   }
+   /*
+* Now close the primary.
+*/
+   vmbus_close_internal(channel);
+}
 EXPORT_SYMBOL_GPL(vmbus_close);
 
 /**
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 21ef689..834dff3 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -115,6 +115,9 @@ static struct vmbus_channel *alloc_channel(void)
return NULL;
 
spin_lock_init(channel-inbound_lock);
+   spin_lock_init(channel-sc_lock);
+
+   INIT_LIST_HEAD(channel-sc_list);
 
channel-controlwq = create_workqueue(hv_vmbus_ctl);
if (!channel-controlwq) {
@@ -166,6 +169,7 @@ static void vmbus_process_rescind_offer(struct work_struct 
*work)
 struct vmbus_channel,
 work);
unsigned long flags;
+   struct vmbus_channel *primary_channel;
struct vmbus_channel_relid_released msg;
 
vmbus_device_unregister(channel-device_obj);
@@ -174,9 +178,16 @@ static void vmbus_process_rescind_offer(struct work_struct 
*work)
msg.header.msgtype = CHANNELMSG_RELID_RELEASED;
vmbus_post_msg(msg, sizeof(struct vmbus_channel_relid_released));
 
-   spin_lock_irqsave(vmbus_connection.channel_lock, flags);
-   list_del(channel-listentry);
-   spin_unlock_irqrestore(vmbus_connection.channel_lock, flags);
+   if (channel-primary_channel == NULL) {
+   spin_lock_irqsave(vmbus_connection.channel_lock, flags);
+   list_del(channel-listentry);
+   spin_unlock_irqrestore(vmbus_connection.channel_lock, flags);
+   } else 

[PATCH 5/6] Drivers: scsi: storvsc: Implement multi-channel support

2013-05-15 Thread K. Y. Srinivasan
Implement multi-channel support for the storage devices.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/scsi/storvsc_drv.c |  124 ++--
 1 files changed, 120 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index a3cf85c..bed8d23 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -330,6 +330,8 @@ MODULE_PARM_DESC(storvsc_timeout, Device timeout 
(seconds));
 
 #define STORVSC_MAX_IO_REQUESTS128
 
+static void storvsc_on_channel_callback(void *context);
+
 /*
  * In Hyper-V, each port/path/target maps to 1 scsi host adapter.  In
  * reality, the path/target is not used (ie always set to 0) so our
@@ -757,12 +759,99 @@ static unsigned int copy_to_bounce_buffer(struct 
scatterlist *orig_sgl,
return total_copied;
 }
 
+static void handle_sc_creation(struct vmbus_channel *new_sc)
+{
+   struct hv_device *device = new_sc-primary_channel-device_obj;
+   struct storvsc_device *stor_device;
+   struct vmstorage_channel_properties props;
+
+   stor_device = get_out_stor_device(device);
+   if (!stor_device)
+   return;
+
+
+   memset(props, 0, sizeof(struct vmstorage_channel_properties));
+
+   vmbus_open(new_sc,
+  storvsc_ringbuffer_size,
+  storvsc_ringbuffer_size,
+  (void *)props,
+  sizeof(struct vmstorage_channel_properties),
+  storvsc_on_channel_callback, new_sc);
+}
+
+static void  handle_multichannel_storage(struct hv_device *device, int 
max_chns)
+{
+   struct storvsc_device *stor_device;
+   int num_cpus = num_online_cpus();
+   int num_sc;
+   struct storvsc_cmd_request *request;
+   struct vstor_packet *vstor_packet;
+   int ret, t;
+
+   num_sc = ((max_chns  num_cpus) ? num_cpus : max_chns);
+   stor_device = get_out_stor_device(device);
+   if (!stor_device)
+   return;
+
+   request = stor_device-init_request;
+   vstor_packet = request-vstor_packet;
+
+   /*
+* Establish a handler for dealing with subchannels.
+*/
+   set_sc_create_callback(device-channel, handle_sc_creation);
+
+   /*
+* Check to see if sub-channels have already been created. This
+* can happen when this driver is re-loaded after unloading.
+*/
+
+   if (subchannels_present(device-channel))
+   return;
+
+   /*
+* Request the host to create sub-channels.
+*/
+   memset(request, 0, sizeof(struct storvsc_cmd_request));
+   init_completion(request-wait_event);
+   vstor_packet-operation = VSTOR_OPERATION_CREATE_SUB_CHANNELS;
+   vstor_packet-flags = REQUEST_COMPLETION_FLAG;
+   vstor_packet-sub_channel_count = num_sc;
+
+   ret = vmbus_sendpacket(device-channel, vstor_packet,
+  (sizeof(struct vstor_packet) -
+  vmscsi_size_delta),
+  (unsigned long)request,
+  VM_PKT_DATA_INBAND,
+  VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
+
+   if (ret != 0)
+   return;
+
+   t = wait_for_completion_timeout(request-wait_event, 10*HZ);
+   if (t == 0)
+   return;
+
+   if (vstor_packet-operation != VSTOR_OPERATION_COMPLETE_IO ||
+   vstor_packet-status != 0)
+   return;
+
+   /*
+* Now that we created the sub-channels, invoke the check; this
+* will trigger the callback.
+*/
+   subchannels_present(device-channel);
+}
+
 static int storvsc_channel_init(struct hv_device *device)
 {
struct storvsc_device *stor_device;
struct storvsc_cmd_request *request;
struct vstor_packet *vstor_packet;
int ret, t;
+   int max_chns;
+   bool process_sub_channels = false;
 
stor_device = get_out_stor_device(device);
if (!stor_device)
@@ -857,6 +946,19 @@ static int storvsc_channel_init(struct hv_device *device)
vstor_packet-status != 0)
goto cleanup;
 
+   /*
+* Check to see if multi-channel support is there.
+* Hosts that implement protocol version of 5.1 and above
+* support multi-channel.
+*/
+   max_chns = vstor_packet-storage_channel_properties.max_channel_cnt;
+   if ((vmbus_proto_version != VERSION_WIN7) 
+  (vmbus_proto_version != VERSION_WS2008))  {
+   if (vstor_packet-storage_channel_properties.flags 
+   STORAGE_CHANNEL_SUPPORTS_MULTI_CHANNEL)
+   process_sub_channels = true;
+   }
+
memset(vstor_packet, 0, sizeof(struct vstor_packet));
vstor_packet-operation = VSTOR_OPERATION_END_INITIALIZATION;

[PATCH 2/6] Drivers: hv: Add the GUID fot synthetic fiber channel device

2013-05-15 Thread K. Y. Srinivasan
In preparation for supporting synthetic Fiber Channel device, add the GUID for
this service.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 include/linux/hyperv.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index a1a97a7..bffee1d 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1389,6 +1389,16 @@ void vmbus_driver_unregister(struct hv_driver 
*hv_driver);
}
 
 /*
+ * Synthetic FC GUID
+ * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
+ */
+#define HV_SYNTHFC_GUID \
+   .guid = { \
+   0x4A, 0xCC, 0x9B, 0x2F, 0x69, 0x00, 0xF3, 0x4A, \
+   0xB7, 0x6B, 0x6F, 0xD0, 0xBE, 0x52, 0x8C, 0xDA \
+   }
+
+/*
  * Common header for Hyper-V ICs
  */
 
-- 
1.7.4.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 3/6] Drivers: scsi: storvsc: Make the scsi timeout a module parameter

2013-05-15 Thread K. Y. Srinivasan
The standard scsi timeout is not appropriate in some of the environments where
Hyper-V is deployed. Set this timeout appropriately for all devices managed
by this driver. Further make this a module parameter.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/scsi/storvsc_drv.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 16a3a0c..8d29a95 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -221,6 +221,13 @@ static int storvsc_ringbuffer_size = (20 * PAGE_SIZE);
 module_param(storvsc_ringbuffer_size, int, S_IRUGO);
 MODULE_PARM_DESC(storvsc_ringbuffer_size, Ring buffer size (bytes));
 
+/*
+ * Timeout in seconds for all devices managed by this driver.
+ */
+static int storvsc_timeout = 180;
+module_param(storvsc_timeout, uint, (S_IRUGO | S_IWUSR));
+MODULE_PARM_DESC(storvsc_timeout, Device timeout (seconds));
+
 #define STORVSC_MAX_IO_REQUESTS128
 
 /*
@@ -1204,6 +1211,8 @@ static int storvsc_device_configure(struct scsi_device 
*sdevice)
 
blk_queue_bounce_limit(sdevice-request_queue, BLK_BOUNCE_ANY);
 
+   blk_queue_rq_timeout(sdevice-request_queue, (storvsc_timeout * HZ));
+
sdevice-no_write_same = 1;
 
return 0;
-- 
1.7.4.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


[GIT PULL] target fixes for v3.10-rc2

2013-05-15 Thread Nicholas A. Bellinger
Hi Linus,

The following are target fixes currently in the queue for v3.10-rc2.  

Please go ahead and pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git queue

A handful of fixes + minor changes this time around, along with one
important = v3.9 regression fix for IBLOCK backends.  The highlights
include:

 - Use FD_MAX_SECTORS in FILEIO for block_device as well as files (agrover)
 - Fix processing of out-of-order CmdSNs with iSBD driver (shlomo)
 - Close long-standing target_put_sess_cmd() vs. core_tmr_abort_task() race
   with the addition of kref_put_spinlock_irqsave() (joern + greg-kh)
 - Fix IBLOCK WCE=1 + DPOFUA=1 backend WRITE regression in = v3.9 (nab + bootc)

Note these four patches are CC'ed to stable.

Also, there is still some work left to be done on the active I/O
shutdown path in target_wait_for_sess_cmds() used by tcm_qla2xxx +
ib_isert fabrics that is still being discussed on the list, and will
hopefully be resolved soon.

Thank you,

--nab

Andy Grover (3):
  target: Remove unused struct members in se_dev_entry
  target: Use FD_MAX_SECTORS/FD_BLOCKSIZE for blockdevs using fileio
  target: Have dev/enable show if TCM device is configured

Geert Uytterhoeven (1):
  iscsi-target: Make buf param of iscsit_do_crypto_hash_buf() const
void *

Joern Engel (2):
  target: removed unused transport_state flag
  target: close target_put_sess_cmd() vs. core_tmr_abort_task() race

Nicholas Bellinger (5):
  iscsi-target: Fix NULL pointer dereference in iscsit_send_reject
  target/rd: Add ramdisk bit for NULLIO operation
  iscsi-target: Fix typos in RDMAEXTENSIONS macro usage
  MAINTAINERS: Update target git tree URL
  target/iblock: Fix WCE=1 + DPOFUA=1 backend WRITE regression

Shlomo Pongratz (1):
  iscsi-target: Fix processing of OOO commands

 MAINTAINERS|2 +-
 drivers/target/iscsi/iscsi_target.c|   63 ++--
 drivers/target/iscsi/iscsi_target_erl1.c   |7 ++-
 drivers/target/iscsi/iscsi_target_parameters.c |8 ++--
 drivers/target/iscsi/iscsi_target_parameters.h |4 +-
 drivers/target/target_core_configfs.c  |   11 +++-
 drivers/target/target_core_device.c|   14 -
 drivers/target/target_core_file.c  |9 +---
 drivers/target/target_core_iblock.c|2 +
 drivers/target/target_core_internal.h  |1 -
 drivers/target/target_core_rd.c|   21 +++-
 drivers/target/target_core_rd.h|1 +
 drivers/target/target_core_transport.c |   13 ++---
 include/linux/kref.h   |   33 
 include/target/target_core_base.h  |5 --
 15 files changed, 107 insertions(+), 87 deletions(-)

-- 
1.7.2.5

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


Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead

2013-05-15 Thread Liu Jiang

On Thu 16 May 2013 05:29:31 AM CST, Benjamin Herrenschmidt wrote:

On Wed, 2013-05-15 at 22:46 +0800, Liu Jiang wrote:

I don't know any OF exports, could you please help to CC
some OF experts?


I wrote that code I think. Sorry, I've missed the beginning of the
thread, what is the problem ?

Cheers,
Ben.



Hi,
Just found a little memory leak issue that we should call 
pci_release_of_node()

on error recovery path in function pci_scan_device().
   pci_set_of_node(dev);

   if (pci_setup_device(dev)) {
   kfree(dev);
   return NULL;
   }

Regards!
Gerry

--
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: [GIT PULL] target fixes for v3.10-rc2

2013-05-15 Thread Or Gerlitz
On Wed, May 15, 2013 at 5:50 PM, Nicholas A. Bellinger
n...@linux-iscsi.org wrote:
 A handful of fixes + minor changes this time around, along with one
 important = v3.9 regression fix for IBLOCK backends.  The highlights include:

Hi Nic,

Are you pushing also a patch which would allow to actually test NULL
based RAM target (e.g target backend that does no actual IO)

Or.


 Nicholas Bellinger (5):
   iscsi-target: Fix NULL pointer dereference in iscsit_send_reject
   target/rd: Add ramdisk bit for NULLIO operation
   iscsi-target: Fix typos in RDMAEXTENSIONS macro usage
   MAINTAINERS: Update target git tree URL
   target/iblock: Fix WCE=1 + DPOFUA=1 backend WRITE regression

 Shlomo Pongratz (1):
   iscsi-target: Fix processing of OOO commands
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] Drivers: hv/scsi: Implement multi-channel support

2013-05-15 Thread Greg KH
On Wed, May 15, 2013 at 03:02:00PM -0700, K. Y. Srinivasan wrote:
 This patch-set implements multi-channel support for Hyper-V devices. Also
 support for synthetic Fiber Channel device is included. The first two
 patches in the series are the foundational pieces for the remaining patches.
 
 James, once Greg accepts the first two patches, you can consider the scsi
 patches.

I have no objection for these first two patches to go through James's
tree, I'll go add my ack to them.  That should make it easier for
everyone involved.

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


Re: [PATCH 1/6] Drivers: hv: vmbus: Implement multi-channel support

2013-05-15 Thread Greg KH
On Wed, May 15, 2013 at 03:02:29PM -0700, K. Y. Srinivasan wrote:
 +/*
 + * Retrieve the (sub) channel on which to send an outgoing request.
 + * When a primary channel has multiple sub-channels, we choose a
 + * channel whose VCPU binding is closest to the VCPU on which
 + * this call is being made.
 + */
 +struct vmbus_channel *get_outgoing_channel(struct vmbus_channel *primary)

That's a _very_ vague global symbol name you are adding to the kernel.
Same goes for the other functions you are adding here, please fix that,
and make them have the vmbus_ prefix, like everything else in this
patch.

So, sorry, no ack here.

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


Re: [PATCH 2/6] Drivers: hv: Add the GUID fot synthetic fiber channel device

2013-05-15 Thread Greg KH
On Wed, May 15, 2013 at 03:02:30PM -0700, K. Y. Srinivasan wrote:
 In preparation for supporting synthetic Fiber Channel device, add the GUID for
 this service.
 
 Signed-off-by: K. Y. Srinivasan k...@microsoft.com
 Reviewed-by: Haiyang Zhang haiya...@microsoft.com
 ---
  include/linux/hyperv.h |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)

Acked-by: Greg Kroah-Hartman gre...@linuxfoundation.org
--
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: [GIT PULL] target fixes for v3.10-rc2

2013-05-15 Thread Nicholas A. Bellinger
On Wed, 2013-05-15 at 23:40 -0400, Or Gerlitz wrote:
 On Wed, May 15, 2013 at 5:50 PM, Nicholas A. Bellinger
 n...@linux-iscsi.org wrote:
  A handful of fixes + minor changes this time around, along with one
  important = v3.9 regression fix for IBLOCK backends.  The highlights 
  include:
 
 Hi Nic,
 
 Are you pushing also a patch which would allow to actually test NULL
 based RAM target (e.g target backend that does no actual IO)
 

Yes, that's the patch included in the PULL request here:

http://git.kernel.org/cgit/linux/kernel/git/nab/target-pending.git/commit/?h=queueid=52c07423a819091b0fe9abbf26977098b996f85b

Btw, It still needs to be enabled in userspace, but appending a
rd_nullio=1 to the /control parameters with the following lio-utils
patch should work for your testing purposes atm..

--nab

diff --git a/tcm-py/tcm_ramdisk.py b/tcm-py/tcm_ramdisk.py
index 2f66aeb..3340705 100755
--- a/tcm-py/tcm_ramdisk.py
+++ b/tcm-py/tcm_ramdisk.py
@@ -14,7 +14,7 @@ def createvirtdev(path, params):
 #  print Calling ramdisk createvirtdev: params  + str(params)
rd_pages = params[0]
 
-   rd_params = rd_pages= + rd_pages
+   rd_params = rd_pages= + rd_pages + ,rd_nullio=1
 #  print rd_params:  + rd_params
 
control_opt = echo -n  + rd_params.rstrip() ++ cfs_path + 
/control


 Or.
 
 
  Nicholas Bellinger (5):
iscsi-target: Fix NULL pointer dereference in iscsit_send_reject
target/rd: Add ramdisk bit for NULLIO operation
iscsi-target: Fix typos in RDMAEXTENSIONS macro usage
MAINTAINERS: Update target git tree URL
target/iblock: Fix WCE=1 + DPOFUA=1 backend WRITE regression
 
  Shlomo Pongratz (1):
iscsi-target: Fix processing of OOO commands
 --
 To unsubscribe from this list: send the line unsubscribe target-devel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html


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