[PATCH V4 3/4] add xen pvscsi maintainer

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

Add myself as maintainer for the Xen pvSCSI stuff.

Signed-off-by: Juergen Gross jgr...@suse.com
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c2066f4..d020bfd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10046,6 +10046,14 @@ S: Supported
 F: arch/x86/pci/*xen*
 F: drivers/pci/*xen*
 
+XEN PVSCSI DRIVERS
+M: Juergen Gross jgr...@suse.com
+L: xen-de...@lists.xenproject.org (moderated for non-subscribers)
+S: Supported
+F: drivers/scsi/xen-scsifront.c
+F: drivers/xen/xen-scsiback.c
+F: include/xen/interface/io/vscsiif.h
+
 XEN SWIOTLB SUBSYSTEM
 M: Konrad Rzeszutek Wilk konrad.w...@oracle.com
 L: xen-de...@lists.xenproject.org (moderated for non-subscribers)
-- 
1.8.4.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


Add XEN pvSCSI support

2014-08-08 Thread jgross
This series adds XEN pvSCSI support. With pvSCSI it is possible to use physical
SCSI devices from a XEN domain.

The support consists of a backend in the privileged Domain-0 doing the real
I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.

The code is taken (and adapted) from the original pvSCSI implementation done
for Linux 2.6 in 2008 by Fujitsu.

[PATCH V2 1/4] Add XEN pvSCSI protocol description
[PATCH V2 2/4] Introduce xen-scsifront module
[PATCH V2 3/4] Introduce XEN scsiback module
[PATCH V2 4/4] add xen pvscsi maintainer

Changes in V4:
- Re-add define for VSCSIIF_ACT_SCSI_SG_PRESET to vscsiif.h to indicate this
  action value should not be used in future enhancements

Changes in V3:
- added some comments to the protocol header file
- removed the CDB emulation from xen-scsiback, handled by core target
  infrastructure
- several changes in xen-scsifront after comments from Christoph Hellwig

Changes in V2:
- use core target infrastructure by backend instead of pure SCSI passthrough
- add support for larger SG lists by putting them in grant page(s)
- add command abort capability

--
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 V4 4/4] Save command pool address of Scsi_Host

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

If a scsi host driver specifies .cmd_len in it's scsi_host_template, a driver's
private command pool is needed. scsi_find_host_cmd_pool() will locate it, but
scsi_alloc_host_cmd_pool() isn't saving the pool address in the host template.

This will result in an access error when the host is removed.

Avoid the problem by saving the address of a new allocated command pool where
it is expected.

Signed-off-by: Juergen Gross jgr...@suse.com
---
 drivers/scsi/scsi.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 88d46fe..b0cef5b 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -380,6 +380,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Host *shost)
pool-slab_flags |= SLAB_CACHE_DMA;
pool-gfp_mask = __GFP_DMA;
}
+
+   if (hostt-cmd_size)
+   hostt-cmd_pool = pool;
+
return pool;
 }
 
@@ -424,8 +428,10 @@ out:
 out_free_slab:
kmem_cache_destroy(pool-cmd_slab);
 out_free_pool:
-   if (hostt-cmd_size)
+   if (hostt-cmd_size) {
scsi_free_host_cmd_pool(pool);
+   hostt-cmd_pool = NULL;
+   }
goto out;
 }
 
@@ -447,8 +453,10 @@ static void scsi_put_host_cmd_pool(struct Scsi_Host *shost)
if (!--pool-users) {
kmem_cache_destroy(pool-cmd_slab);
kmem_cache_destroy(pool-sense_slab);
-   if (hostt-cmd_size)
+   if (hostt-cmd_size) {
scsi_free_host_cmd_pool(pool);
+   hostt-cmd_pool = NULL;
+   }
}
mutex_unlock(host_cmd_pool_mutex);
 }
-- 
1.8.4.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 V4 1/4] Introduce xen-scsifront module

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

Introduces the XEN pvSCSI frontend. With pvSCSI it is possible for a XEN domU
to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands
are passed to the pvSCSI backend in a driver domain (usually Dom0) which is
owner of the physical device. This allows e.g. to use SCSI tape drives in a
XEN domU.

The code is taken from the pvSCSI implementation in XEN done by Fujitsu based
on Linux kernel 2.6.18.

Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- move module to appropriate location in kernel tree
- adapt to Linux style guide
- some minor code simplifications
- replace constants with defines
- remove not used defines
- add support for larger SG lists by putting them in a granted page

Signed-off-by: Juergen Gross jgr...@suse.com

Xen related parts
Acked-by: David Vrabel david.vra...@citrix.com
---
 drivers/scsi/Kconfig |9 +
 drivers/scsi/Makefile|1 +
 drivers/scsi/xen-scsifront.c | 1011 ++
 3 files changed, 1021 insertions(+)
 create mode 100644 drivers/scsi/xen-scsifront.c

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index baca589..e860c16 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -611,6 +611,15 @@ config VMWARE_PVSCSI
  To compile this driver as a module, choose M here: the
  module will be called vmw_pvscsi.
 
+config XEN_SCSI_FRONTEND
+   tristate XEN SCSI frontend driver
+   depends on SCSI  XEN
+   help
+ The XEN SCSI frontend driver allows the kernel to access SCSI Devices
+ within another guest OS (usually Dom0).
+ Only needed if the kernel is running in a XEN guest and generic
+ SCSI access to a device is needed.
+
 config HYPERV_STORAGE
tristate Microsoft Hyper-V virtual storage driver
depends on SCSI  HYPERV
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index e172d4f..a4ee9c5 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -144,6 +144,7 @@ obj-$(CONFIG_SCSI_ESAS2R)   += esas2r/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
 obj-$(CONFIG_SCSI_VIRTIO)  += virtio_scsi.o
 obj-$(CONFIG_VMWARE_PVSCSI)+= vmw_pvscsi.o
+obj-$(CONFIG_XEN_SCSI_FRONTEND)+= xen-scsifront.o
 obj-$(CONFIG_HYPERV_STORAGE)   += hv_storvsc.o
 
 obj-$(CONFIG_ARM)  += arm/
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
new file mode 100644
index 000..7c60c68
--- /dev/null
+++ b/drivers/scsi/xen-scsifront.c
@@ -0,0 +1,1011 @@
+/*
+ * Xen SCSI frontend driver
+ *
+ * Copyright (c) 2008, FUJITSU Limited
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#define DEBUG
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/device.h
+#include linux/wait.h
+#include linux/interrupt.h
+#include linux/spinlock.h
+#include linux/sched.h
+#include linux/blkdev.h
+#include linux/pfn.h
+#include linux/slab.h
+
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_device.h
+#include scsi/scsi.h
+#include scsi/scsi_host.h
+
+#include xen/xen.h
+#include xen/xenbus.h
+#include xen/grant_table.h
+#include xen/events.h
+#include xen/page.h
+
+#include xen/interface/grant_table.h
+#include xen/interface/io/vscsiif.h
+#include xen/interface/io/protocols.h
+
+#include asm/xen/hypervisor.h
+
+
+#define GRANT_INVALID_REF  0
+
+#define VSCSIFRONT_OP_ADD_LUN  1
+#define VSCSIFRONT_OP_DEL_LUN  2
+
+#define DEFAULT_TASK_COMM_LEN  TASK_COMM_LEN
+
+/* tuning point*/
+#define VSCSIIF_DEFAULT_CMD_PER_LUN 10
+#define VSCSIIF_MAX_TARGET  64
+#define 

[PATCH V4 2/4] Introduce XEN scsiback module

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

Introduces the XEN pvSCSI backend. With pvSCSI it is possible for a XEN domU
to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands
are passed to the pvSCSI backend in a driver domain (usually Dom0) which is
owner of the physical device. This allows e.g. to use SCSI tape drives in a
XEN domU.

The code is taken from the pvSCSI implementation in XEN done by Fujitsu based
on Linux kernel 2.6.18.

Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- adapt to Linux style guide
- use target core infrastructure instead doing pure pass-through
- enable module unloading
- support SG-list in grant page(s)
- support task abort
- remove redundant struct backend
- allocate resources dynamically
- correct minor error in scsiback_fast_flush_area
- free allocated resources in case of error during I/O preparation
- remove CDB emulation, now handled by target core infrastructure

Signed-off-by: Juergen Gross jgr...@suse.com

Xen related parts
Acked-by: David Vrabel david.vra...@citrix.com
---
 drivers/xen/Kconfig|9 +
 drivers/xen/Makefile   |1 +
 drivers/xen/xen-scsiback.c | 2282 
 3 files changed, 2292 insertions(+)
 create mode 100644 drivers/xen/xen-scsiback.c

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index 38fb36e..42fb963 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -172,6 +172,15 @@ config XEN_PCIDEV_BACKEND
 
  If in doubt, say m.
 
+config XEN_SCSI_BACKEND
+   tristate XEN SCSI backend driver
+   depends on XEN  XEN_BACKEND  TARGET_CORE
+   help
+ The SCSI backend driver allows the kernel to export its SCSI Devices
+ to other guests via a high-performance shared-memory interface.
+ Only needed for systems running as XEN driver domains (e.g. Dom0) and
+ if guests need generic access to SCSI devices.
+
 config XEN_PRIVCMD
tristate
depends on XEN
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 45e00af..b42ee75 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_XEN_STUB)+= xen-stub.o
 obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY)  += xen-acpi-memhotplug.o
 obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU) += xen-acpi-cpuhotplug.o
 obj-$(CONFIG_XEN_ACPI_PROCESSOR)   += xen-acpi-processor.o
+obj-$(CONFIG_XEN_SCSI_BACKEND) += xen-scsiback.o
 xen-evtchn-y   := evtchn.o
 xen-gntdev-y   := gntdev.o
 xen-gntalloc-y := gntalloc.o
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
new file mode 100644
index 000..4a0d6e3
--- /dev/null
+++ b/drivers/xen/xen-scsiback.c
@@ -0,0 +1,2282 @@
+/*
+ * Xen SCSI backend driver
+ *
+ * Copyright (c) 2008, FUJITSU Limited
+ *
+ * Based on the blkback driver code.
+ * Adaption to kernel taget core infrastructure taken from vhost/scsi.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include stdarg.h
+
+#include linux/module.h
+#include linux/utsname.h
+#include linux/interrupt.h
+#include linux/slab.h
+#include linux/wait.h
+#include linux/sched.h
+#include linux/list.h
+#include linux/gfp.h
+#include linux/kthread.h
+#include linux/delay.h
+#include linux/spinlock.h
+#include linux/configfs.h
+
+#include generated/utsrelease.h
+
+#include scsi/scsi_dbg.h
+#include scsi/scsi_eh.h
+#include scsi/scsi_tcq.h
+
+#include target/target_core_base.h
+#include target/target_core_fabric.h
+#include target/target_core_configfs.h
+#include 

Re: [Xen-devel] Add XEN pvSCSI support

2014-08-08 Thread Jürgen Groß

Sorry, please ignore.

One wrong patch slipped in, while one is missing.

Will resend with correct patches.


Juergen

On 08/08/2014 09:43 AM, jgr...@suse.com wrote:

This series adds XEN pvSCSI support. With pvSCSI it is possible to use physical
SCSI devices from a XEN domain.

The support consists of a backend in the privileged Domain-0 doing the real
I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.

The code is taken (and adapted) from the original pvSCSI implementation done
for Linux 2.6 in 2008 by Fujitsu.

[PATCH V2 1/4] Add XEN pvSCSI protocol description
[PATCH V2 2/4] Introduce xen-scsifront module
[PATCH V2 3/4] Introduce XEN scsiback module
[PATCH V2 4/4] add xen pvscsi maintainer

Changes in V4:
- Re-add define for VSCSIIF_ACT_SCSI_SG_PRESET to vscsiif.h to indicate this
   action value should not be used in future enhancements

Changes in V3:
- added some comments to the protocol header file
- removed the CDB emulation from xen-scsiback, handled by core target
   infrastructure
- several changes in xen-scsifront after comments from Christoph Hellwig

Changes in V2:
- use core target infrastructure by backend instead of pure SCSI passthrough
- add support for larger SG lists by putting them in grant page(s)
- add command abort capability


___
Xen-devel mailing list
xen-de...@lists.xen.org
http://lists.xen.org/xen-devel



--
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


Add XEN pvSCSI support

2014-08-08 Thread jgross
This series adds XEN pvSCSI support. With pvSCSI it is possible to use physical
SCSI devices from a XEN domain.

The support consists of a backend in the privileged Domain-0 doing the real
I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.

The code is taken (and adapted) from the original pvSCSI implementation done
for Linux 2.6 in 2008 by Fujitsu.

[PATCH V2 1/4] Add XEN pvSCSI protocol description
[PATCH V2 2/4] Introduce xen-scsifront module
[PATCH V2 3/4] Introduce XEN scsiback module
[PATCH V2 4/4] add xen pvscsi maintainer

Changes in V4:
- Re-add define for VSCSIIF_ACT_SCSI_SG_PRESET to vscsiif.h to indicate this
  action value should not be used in future enhancements

Changes in V3:
- added some comments to the protocol header file
- removed the CDB emulation from xen-scsiback, handled by core target
  infrastructure
- several changes in xen-scsifront after comments from Christoph Hellwig

Changes in V2:
- use core target infrastructure by backend instead of pure SCSI passthrough
- add support for larger SG lists by putting them in grant page(s)
- add command abort capability

--
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 V4 1/4] Add XEN pvSCSI protocol description

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

Add the definition of pvSCSI protocol used between the pvSCSI frontend in a
XEN domU and the pvSCSI backend in a XEN driver domain (usually Dom0).

This header was originally provided by Fujitsu for XEN based on Linux 2.6.18.
Changes are:
- added comment
- adapt to Linux style guide
- add support for larger SG-lists by putting them in an own granted page
- remove stale definitions

Signed-off-by: Juergen Gross jgr...@suse.com
---
 include/xen/interface/io/vscsiif.h | 214 +
 1 file changed, 214 insertions(+)
 create mode 100644 include/xen/interface/io/vscsiif.h

diff --git a/include/xen/interface/io/vscsiif.h 
b/include/xen/interface/io/vscsiif.h
new file mode 100644
index 000..4291889
--- /dev/null
+++ b/include/xen/interface/io/vscsiif.h
@@ -0,0 +1,214 @@
+/**
+ * vscsiif.h
+ *
+ * Based on the blkif.h code.
+ *
+ * This interface is to be regarded as a stable API between XEN domains
+ * running potentially different Linux kernel versions.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright(c) FUJITSU Limited 2008.
+ */
+
+#ifndef __XEN__PUBLIC_IO_SCSI_H__
+#define __XEN__PUBLIC_IO_SCSI_H__
+
+#include ring.h
+#include ../grant_table.h
+
+/*
+ * Front-back notifications: When enqueuing a new request, sending a
+ * notification can be made conditional on req_event (i.e., the generic
+ * hold-off mechanism provided by the ring macros). Backends must set
+ * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()).
+ *
+ * Back-front notifications: When enqueuing a new response, sending a
+ * notification can be made conditional on rsp_event (i.e., the generic
+ * hold-off mechanism provided by the ring macros). Frontends must set
+ * rsp_event appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()).
+ */
+
+/*
+ * Feature and Parameter Negotiation
+ * =
+ * The two halves of a Xen pvSCSI driver utilize nodes within the XenStore to
+ * communicate capabilities and to negotiate operating parameters.  This
+ * section enumerates these nodes which reside in the respective front and
+ * backend portions of the XenStore, following the XenBus convention.
+ *
+ * All data in the XenStore is stored as strings.  Nodes specifying numeric
+ * values are encoded in decimal.  Integer value ranges listed below are
+ * expressed as fixed sized integer types capable of storing the conversion
+ * of a properly formated node string, without loss of information.
+ *
+ * Any specified default value is in effect if the corresponding XenBus node
+ * is not present in the XenStore.
+ *
+ * XenStore nodes in sections marked PRIVATE are solely for use by the
+ * driver side whose XenBus tree contains them.
+ *
+ *
+ *Backend XenBus Nodes
+ *
+ *
+ *-- Backend Device Identification (PRIVATE) --
+ *
+ * p-devname
+ *  Values: string
+ *
+ *  A free string used to identify the physical device (e.g. a disk name).
+ *
+ * p-dev
+ *  Values: string
+ *
+ *  A string specifying the backend device: either a 4-tuple h:c:t:l
+ *  (host, controller, target, lun, all integers), or a WWN (e.g.
+ *  naa.60014054ac780582).
+ *
+ * v-dev
+ *  Values: string
+ *
+ *  A string specifying the frontend device in form of a 4-tuple h:c:t:l
+ *  (host, controller, target, lun, all integers).
+ *
+ *- Features -
+ *
+ * feature-sg-grant
+ *  Values: uint16_t
+ *  Default Value:  0
+ *
+ *  Specifies the maximum number of scatter/gather elements in grant pages
+ *  

[PATCH V4 3/4] Introduce XEN scsiback module

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

Introduces the XEN pvSCSI backend. With pvSCSI it is possible for a XEN domU
to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands
are passed to the pvSCSI backend in a driver domain (usually Dom0) which is
owner of the physical device. This allows e.g. to use SCSI tape drives in a
XEN domU.

The code is taken from the pvSCSI implementation in XEN done by Fujitsu based
on Linux kernel 2.6.18.

Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- adapt to Linux style guide
- use target core infrastructure instead doing pure pass-through
- enable module unloading
- support SG-list in grant page(s)
- support task abort
- remove redundant struct backend
- allocate resources dynamically
- correct minor error in scsiback_fast_flush_area
- free allocated resources in case of error during I/O preparation
- remove CDB emulation, now handled by target core infrastructure

Signed-off-by: Juergen Gross jgr...@suse.com

Xen related parts
Acked-by: David Vrabel david.vra...@citrix.com
---
 drivers/xen/Kconfig|9 +
 drivers/xen/Makefile   |1 +
 drivers/xen/xen-scsiback.c | 2282 
 3 files changed, 2292 insertions(+)
 create mode 100644 drivers/xen/xen-scsiback.c

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index 38fb36e..42fb963 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -172,6 +172,15 @@ config XEN_PCIDEV_BACKEND
 
  If in doubt, say m.
 
+config XEN_SCSI_BACKEND
+   tristate XEN SCSI backend driver
+   depends on XEN  XEN_BACKEND  TARGET_CORE
+   help
+ The SCSI backend driver allows the kernel to export its SCSI Devices
+ to other guests via a high-performance shared-memory interface.
+ Only needed for systems running as XEN driver domains (e.g. Dom0) and
+ if guests need generic access to SCSI devices.
+
 config XEN_PRIVCMD
tristate
depends on XEN
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 45e00af..b42ee75 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_XEN_STUB)+= xen-stub.o
 obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY)  += xen-acpi-memhotplug.o
 obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU) += xen-acpi-cpuhotplug.o
 obj-$(CONFIG_XEN_ACPI_PROCESSOR)   += xen-acpi-processor.o
+obj-$(CONFIG_XEN_SCSI_BACKEND) += xen-scsiback.o
 xen-evtchn-y   := evtchn.o
 xen-gntdev-y   := gntdev.o
 xen-gntalloc-y := gntalloc.o
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
new file mode 100644
index 000..4a0d6e3
--- /dev/null
+++ b/drivers/xen/xen-scsiback.c
@@ -0,0 +1,2282 @@
+/*
+ * Xen SCSI backend driver
+ *
+ * Copyright (c) 2008, FUJITSU Limited
+ *
+ * Based on the blkback driver code.
+ * Adaption to kernel taget core infrastructure taken from vhost/scsi.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include stdarg.h
+
+#include linux/module.h
+#include linux/utsname.h
+#include linux/interrupt.h
+#include linux/slab.h
+#include linux/wait.h
+#include linux/sched.h
+#include linux/list.h
+#include linux/gfp.h
+#include linux/kthread.h
+#include linux/delay.h
+#include linux/spinlock.h
+#include linux/configfs.h
+
+#include generated/utsrelease.h
+
+#include scsi/scsi_dbg.h
+#include scsi/scsi_eh.h
+#include scsi/scsi_tcq.h
+
+#include target/target_core_base.h
+#include target/target_core_fabric.h
+#include target/target_core_configfs.h
+#include 

[PATCH V4 4/4] add xen pvscsi maintainer

2014-08-08 Thread jgross
From: Juergen Gross jgr...@suse.com

Add myself as maintainer for the Xen pvSCSI stuff.

Signed-off-by: Juergen Gross jgr...@suse.com
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c2066f4..d020bfd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10046,6 +10046,14 @@ S: Supported
 F: arch/x86/pci/*xen*
 F: drivers/pci/*xen*
 
+XEN PVSCSI DRIVERS
+M: Juergen Gross jgr...@suse.com
+L: xen-de...@lists.xenproject.org (moderated for non-subscribers)
+S: Supported
+F: drivers/scsi/xen-scsifront.c
+F: drivers/xen/xen-scsiback.c
+F: include/xen/interface/io/vscsiif.h
+
 XEN SWIOTLB SUBSYSTEM
 M: Konrad Rzeszutek Wilk konrad.w...@oracle.com
 L: xen-de...@lists.xenproject.org (moderated for non-subscribers)
-- 
1.8.4.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


[Bug 81861] mvsas.ko v0.8.16 error messages and kernel crashes attaching 4 SATA drives to specific HP SAS expander ports

2014-08-08 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=81861

--- Comment #1 from linux-...@crashplan.pro ---
After setting up netconsole using https://wiki.ubuntu.com/Kernel/Netconsole,
and enabling kernel boot parameters debug and ignore_loglevel there is are more
kernel crash log lines available:

[   77.094783] mvsas :01:00.0: mvsas: driver version 0.8.16
[   77.095405] mvsas :01:00.0: mvsas: PCI-E x8, Bandwidth Usage: 5.0 Gbps
[   83.881049] scsi5 : mvsas
[   83.883157] sas: phy-5:4 added to port-5:0, phy_mask:0x1 (50014380182cf0e6)
[   83.883190] /home/apw/COD/linux/drivers/scsi/mvsas/mv_sas.c 1218:set wide
port phy map 1
[   83.893532] sas: phy1 matched wide port0
[   83.893558] sas: phy-5:5 added to port-5:0, phy_mask:0x3 (50014380182cf0e6)
[   83.893580] /home/apw/COD/linux/drivers/scsi/mvsas/mv_sas.c 1218:set wide
port phy map 3
[   83.913447] sas: phy2 matched wide port0
[   83.913468] sas: phy-5:6 added to port-5:0, phy_mask:0x7 (50014380182cf0e6)
[   83.913491] /home/apw/COD/linux/drivers/scsi/mvsas/mv_sas.c 1218:set wide
port phy map 7
[   83.943257] sas: phy3 matched wide port0
[   83.943274] sas: phy-5:7 added to port-5:0, phy_mask:0xf (50014380182cf0e6)
[   83.943294] /home/apw/COD/linux/drivers/scsi/mvsas/mv_sas.c 1218:set wide
port phy map f
[   83.982994] sas: DOING DISCOVERY on port 0, pid:6
[   83.984660] sas: ex 50014380182cf0e6 phy00:D:0 attached: 
(no device)
[   83.985256] sas: ex 50014380182cf0e6 phy01:D:0 attached: 
(no device)
[   83.985851] sas: ex 50014380182cf0e6 phy02:D:0 attached: 
(no device)
[   83.986372] sas: ex 50014380182cf0e6 phy03:D:0 attached: 
(no device)
[   83.986933] sas: ex 50014380182cf0e6 phy04:D:0 attached: 
(no device)
[   83.987488] sas: ex 50014380182cf0e6 phy05:D:0 attached: 
(no device)
[   83.988086] sas: ex 50014380182cf0e6 phy06:D:0 attached: 
(no device)
[   83.988603] sas: ex 50014380182cf0e6 phy07:D:0 attached: 
(no device)
[   83.989197] sas: ex 50014380182cf0e6 phy08:D:0 attached: 
(no device)
[   83.989766] sas: ex 50014380182cf0e6 phy09:D:0 attached: 
(no device)
[   83.990300] sas: ex 50014380182cf0e6 phy10:D:0 attached: 
(no device)
[   83.990872] sas: ex 50014380182cf0e6 phy11:D:0 attached: 
(no device)
[   83.991401] sas: ex 50014380182cf0e6 phy12:D:0 attached: 
(no device)
[   83.991978] sas: ex 50014380182cf0e6 phy13:D:0 attached: 
(no device)
[   83.992515] sas: ex 50014380182cf0e6 phy14:D:0 attached: 
(no device)
[   83.993098] sas: ex 50014380182cf0e6 phy15:D:0 attached: 
(no device)
[   83.993625] sas: ex 50014380182cf0e6 phy16:D:0 attached: 
(no device)
[   83.994213] sas: ex 50014380182cf0e6 phy17:D:0 attached: 
(no device)
[   83.994785] sas: ex 50014380182cf0e6 phy18:D:0 attached: 
(no device)
[   83.995316] sas: ex 50014380182cf0e6 phy19:D:0 attached: 
(no device)
[   83.995890] sas: ex 50014380182cf0e6 phy20:D:0 attached: 
(no device)
[   83.996432] sas: ex 50014380182cf0e6 phy21:D:0 attached: 
(no device)
[   83.996998] sas: ex 50014380182cf0e6 phy22:D:0 attached: 
(no device)
[   83.997540] sas: ex 50014380182cf0e6 phy23:D:0 attached: 
(no device)
[   83.998189] sas: ex 50014380182cf0e6 phy24:U:A attached: 5005043011ab
(host)
[   83.998812] sas: ex 50014380182cf0e6 phy25:U:A attached: 5005043011ab
(host)
[   83.999386] sas: ex 50014380182cf0e6 phy26:U:A attached: 5005043011ab
(host)
[   84.12] sas: ex 50014380182cf0e6 phy27:U:A attached: 5005043011ab
(host)
[   84.000575] sas: ex 50014380182cf0e6 phy28:S:0 attached: 
(no device)
[   84.001581] sas: ex 50014380182cf0e6 phy29:S:0 attached: 
(no device)
[   84.002561] sas: ex 50014380182cf0e6 phy30:S:0 attached: 
(no device)
[   84.003550] sas: ex 50014380182cf0e6 phy31:S:0 attached: 
(no device)
[   84.004573] sas: ex 50014380182cf0e6 phy32:S:9 attached: 50014380182cf0e0
(stp)
[   84.005580] sas: ex 50014380182cf0e6 phy33:S:9 attached: 50014380182cf0e1
(stp)
[   84.006543] sas: ex 50014380182cf0e6 phy34:S:9 attached: 50014380182cf0e2
(stp)
[   84.007442] sas: ex 50014380182cf0e6 phy35:S:9 attached: 50014380182cf0e3
(stp)
[   84.008136] sas: ex 50014380182cf0e6 phy36:D:A attached: 50014380182cf0e5
(host+target)
[   84.009969] sas: DONE DISCOVERY on port 0, pid:6, result:0
[   84.010274] sas: Enter sas_scsi_recover_host busy: 0 failed: 0
[   84.010569] sas: ata6: end_device-5:0:32: dev error handler
[   84.010873] sas: ata7: end_device-5:0:33: dev error handler
[   84.011160] sas: ata8: end_device-5:0:34: dev error handler
[   84.011424] sas: ata9: end_device-5:0:35: dev error handler
[   84.164663] general 

[Bug 81861] Oops by mvsas v0.8.16: sas: ataX: end_device-Y:0:Z: dev error handler - general protection fault, RIP: mvs_task_prep_ata+0x80/0x3a0

2014-08-08 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=81861

linux-...@crashplan.pro changed:

   What|Removed |Added

Summary|mvsas.ko v0.8.16 error  |Oops by mvsas v0.8.16: sas:
   |messages and kernel crashes |ataX: end_device-Y:0:Z: dev
   |attaching 4 SATA drives to  |error handler - general
   |specific HP SAS expander|protection fault, RIP:
   |ports   |mvs_task_prep_ata+0x80/0x3a
   ||0

-- 
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


[Bug 81861] Oops by mvsas v0.8.16: sas: ataX: end_device-Y:0:Z: dev error handler - general protection fault, RIP: mvs_task_prep_ata+0x80/0x3a0

2014-08-08 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=81861

--- Comment #2 from linux-...@crashplan.pro ---
Created attachment 145681
  -- https://bugzilla.kernel.org/attachment.cgi?id=145681action=edit
Dmesg output from boot

-- 
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 1/3] libsas: modify SATA error handler

2014-08-08 Thread Xiangliang Yu
Hi, Dan

 Hi, some notes below:

 On Thu, Apr 24, 2014 at 6:27 AM, Xiangliang Yu yxlr...@gmail.com wrote:
 Add support for SATA port softreset and port multiplier error 
 handling.

 Some more detailed notes about the approach and any caveats would be 
 appreciated.


 Signed-off-by: Xiangliang Yu yxlr...@gmail.com
 ---
  drivers/scsi/libsas/sas_ata.c |  226 
 -
  include/scsi/libsas.h |6 +
  2 files changed, 231 insertions(+), 1 deletions(-)

 diff --git a/drivers/scsi/libsas/sas_ata.c 
 b/drivers/scsi/libsas/sas_ata.c index 766098a..29a19fd 100644
 --- a/drivers/scsi/libsas/sas_ata.c
 +++ b/drivers/scsi/libsas/sas_ata.c
 @@ -442,6 +442,226 @@ static int sas_ata_hard_reset(struct ata_link *link, 
 unsigned int *class,
 return ret;
  }

 +static void sas_ata_freeze(struct ata_port *ap) {
 +   struct domain_device *dev = ap-private_data;
 +   struct sas_ha_struct *sas_ha = dev-port-ha;
 +   struct Scsi_Host *host = sas_ha-core.shost;
 +   struct sas_internal *i = to_sas_internal(host-transportt);
 +
 +   if (i-dft-lldd_dev_freeze)
 +   i-dft-lldd_dev_freeze(dev); }
 +
 +static void sas_ata_thaw(struct ata_port *ap) {
 +   struct domain_device *dev = ap-private_data;
 +   struct sas_ha_struct *sas_ha = dev-port-ha;
 +   struct Scsi_Host *host = sas_ha-core.shost;
 +   struct sas_internal *i = to_sas_internal(host-transportt);
 +
 +   if (i-dft-lldd_dev_thaw)
 +   i-dft-lldd_dev_thaw(dev); }
 +
 +static int sas_ata_wait_task_done(struct sas_task *task, unsigned long 
 timeout,
 +   int (*check_done)(struct sas_task *task)) {

 Why do we need a custom check_done() routine?  Since we have a 
 sas_task we can use the normal completion infrastructure.  See 
 smp_execute_task().

You are right, I'll change it


 +   struct ata_port *ap = task-uldd_task;
 +   unsigned long deadline;
 +   int done;
 +
 +   if (!check_done) {
 +   SAS_DPRINTK(check function is null.\n);
 +   return -1;
 +   }
 +
 +   deadline = ata_deadline(jiffies, timeout);
 +   done = check_done(task);
 +
 +   while (done  time_before(jiffies, deadline)) {
 +   ata_msleep(ap, 1);
 +
 +   done = check_done(task);

 This can simply be:

 completion_done(task-slow_task-completion)

Yes


 +   }
 +
 +   return done;
 +}
 +
 +static int sas_ata_exec_polled_cmd(struct ata_port *ap, struct ata_taskfile 
 *tf,
 +   int pmp, unsigned long timeout) {
 +   struct domain_device *dev = ap-private_data;
 +   struct sas_ha_struct *sas_ha = dev-port-ha;
 +   struct Scsi_Host *host = sas_ha-core.shost;
 +   struct sas_internal *i = to_sas_internal(host-transportt);
 +   struct sas_task *task = NULL;
 +   int ret = -1;
 +
 +   if (!i-dft-lldd_execute_task) {
 +   SAS_DPRINTK(execute function is null.\n);
 +   return ret;
 +   }
 +
 +   task = sas_alloc_task(GFP_ATOMIC);

 I think this can be downgraded to GFP_NOIO.  We're in a sleepable context.

Yes, got it


 +   if (!task) {
 +   SAS_DPRINTK(failed to alloc sas task.\n);
 +   goto fail;
 +   }
 +
 +   task-dev = dev;
 +   task-task_proto = SAS_PROTOCOL_SATA;
 +   task-uldd_task = ap;
 +
 +   ata_tf_to_fis(tf, pmp, 0, (u8 *)task-ata_task.fis);
 +   task-ata_task.retry_count = 1;
 +   task-task_state_flags = SAS_TASK_STATE_PENDING;
 +   task-task_state_flags |= SAS_TASK_NEED_DEV_RESET;
 +
 +   ret = i-dft-lldd_execute_task(task, 1, GFP_ATOMIC);

 Same here.

 +   if (ret) {
 +   SAS_DPRINTK(failed to send internal task.\n);
 +   goto fail;
 +   }
 +
 +   if (timeout) {
 +   ret = sas_ata_wait_task_done(task, timeout,
 +   i-dft-lldd_wait_task_done);
 +   if (ret) {
 +   SAS_DPRINTK(get wrong status.\n);
 +   goto fail;
 +   }
 +   }
 +   list_del_init(task-list);
 +   sas_free_task(task);
 +
 +   return 0;
 +fail:
 +   if (task) {
 +   list_del_init(task-list);
 +   sas_free_task(task);
 +   }
 +
 +   return ret;
 +}
 +
 +static int sas_ata_soft_reset(struct ata_link *link, unsigned int *class,
 + unsigned long deadline) {
 +   struct ata_taskfile tf;
 +   struct ata_port *ap = link-ap;
 +   struct domain_device *dev = ap-private_data;
 +   struct sas_ha_struct *sas_ha = dev-port-ha;
 +   struct Scsi_Host *host = sas_ha-core.shost;
 +   struct sas_internal *i = to_sas_internal(host-transportt);
 +   struct sas_phy *phy;
 +   unsigned long now, msecs;
 +   unsigned int pmp;
 +   int ret = -1;
 +   int (*check_ready)(struct ata_link *link);
 +
 +   phy = sas_get_local_phy(dev);
 +   if 

[PATCH] mptfusion: Fix up kerneldoc

2014-08-08 Thread Thierry Reding
From: Thierry Reding tred...@nvidia.com

Commit c9834c70efba (mptfusion: make adapter prod_name[] a pointer)
removed the prod_name argument from the mpt_get_product_name() function
but didn't update the kerneldoc comment.

Signed-off-by: Thierry Reding tred...@nvidia.com
---
 drivers/message/fusion/mptbase.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index a896d948b79e..dd61cbab2de6 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1400,7 +1400,6 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
  * @vendor: pci vendor id
  * @device: pci device id
  * @revision: pci revision id
- * @prod_name: string returned
  *
  * Returns product string displayed when driver loads,
  * in /proc/mpt/summary and /sysfs/class/scsi_host/hostX/version_product
-- 
2.0.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


[RFC PATCH -logging 00/10] scsi/constants: Output continuous error messages on trace

2014-08-08 Thread Yoshihiro YUNOMAE
Hi All,

This patch set introduces new traceevents in order to output continuous error
messages. Current SCSI printk messages in upstream kernel can be divided by and
mixed with other messages. Even if each error message has its device id,
sometimes we can easily be lost in mixed logs because the message's device id
is separated from it's body. To avoid it, I'd like to use traceevents to
store error messages into the ftrace or perf buuffer, because traceevents
are atomically commited to the buffer.

In this patch set, all printk messages are removed based on a local
discussion with Hannes, but I think printk messages should be kept because all
users don't enable traceevents and rsyslog can store as files.

However, if printk of logging branch is kept, the messages are duplicate and
it can induce stack overflow by using local buffer(*1).

 (*1) https://lkml.org/lkml/2014/5/20/742

So, my suggestion is follows:

1) printk
Keeps current implemntation of upstream kernel.
The messages are divided and can be mixed, but all users can check the error
messages without any settings.

2) traceevents
To get the complete messages, we can use ftrace or perf (or something on them).
Users can always understand correct messages, but they need to set up the
tracers.

This patch set is based on Hannes' logging branch:
http://git.kernel.org/cgit/linux/kernel/git/hare/scsi-devel.git/log/?h=logging

[1/10] ~  [6/10]: just cleanup for logging branch
[7/10] ~ [10/10]: introduce new traceevents

Any comments are welcome!

Thanks,
Yoshihiro YUNOMAE

---

Yoshihiro YUNOMAE (10):
  scsi/constants: Cleanup printk message in __scsi_print_sense()
  scsi/constants: Cleanup printk message in scsi_decode_sense_extras()
  scsi/constants: Cleanup printk message in __scsi_print_command()
  scsi/constants: Cleanup printk message in scsi_dump_sense_buffer()
  scsi/trace: Use macros for getting driver byte, host byte, msg byte, and 
status byte
  scsi/sd: Delete extra scsi_show_extd_sense() in sd_print_sense_hdr()
  scsi/trace: Use scsi_show_result trace point instead of printk
  scsi/trace: Use scsi_print_sense trace point instead of printk
  scsi/trace: Add additional sense code and additional sense code qualifier 
to scsi_print_sense trace point
  scsi/trace: Use scsi_print_command trace point instead of printk


 drivers/scsi/Makefile   |2 
 drivers/scsi/constants.c| 1543 ---
 drivers/scsi/scsi_trace.c   | 1484 +
 drivers/scsi/sd.c   |2 
 include/scsi/scsi.h |8 
 include/scsi/scsi_dbg.h |2 
 include/scsi/scsi_eh.h  |7 
 include/trace/events/scsi.h |  145 
 8 files changed, 1633 insertions(+), 1560 deletions(-)
 delete mode 100644 drivers/scsi/constants.c

-- 
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae...@hitachi.com
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 08/10] scsi/trace: Use scsi_print_sense trace point instead of printk

2014-08-08 Thread Yoshihiro YUNOMAE
Previous sense messages can be mixed into other sense messages,
because continuous printk (KERN_CONT) was used. To avoid the problem,
patch d87f3a6f51 introduced a local buffer in Hannes's baranch (*1).
But using local buffers can induce stack overflow, so we want to solve the
problem without local buffer if possible.

trace_seq_printf can add log messages without local buffer, so we use it.

(*1) 
http://git.kernel.org/cgit/linux/kernel/git/hare/scsi-devel.git/log/?h=logging

- Result examples

Before (printk)
sd 2:0:0:0: [sda] Sense Key : Medium Error [current]

After (ftrace)
scsi_print_sense: host_no=2 channel=0 id=0 lun=0 [sda] Sense Key (Medium Error 
[current])

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c|  145 ++-
 drivers/scsi/scsi_trace.c   |  140 --
 include/scsi/scsi_eh.h  |7 ++
 include/trace/events/scsi.h |   48 ++
 4 files changed, 195 insertions(+), 145 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index f7b7f32..85b75c8 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -19,7 +19,7 @@
 #include scsi/scsi_eh.h
 #include scsi/scsi_dbg.h
 
-
+#include trace/events/scsi.h
 
 /* Commands with service actions that change the command name */
 #define SERVICE_ACTION_IN_12 0xab
@@ -1267,58 +1267,8 @@ static const struct error_info2 additional2[] =
{0x70, 0x00, 0xff, Decompression exception short algorithm id of %x},
{0, 0, 0, NULL}
 };
-
-/* description of the sense key values */
-static const char * const snstext[] = {
-   No Sense, /* 0: There is no sense information */
-   Recovered Error,  /* 1: The last command completed successfully
- but used error correction */
-   Not Ready,/* 2: The addressed target is not ready */
-   Medium Error, /* 3: Data error detected on the medium */
-   Hardware Error,   /* 4: Controller or device failure */
-   Illegal Request,  /* 5: Error in request */
-   Unit Attention,   /* 6: Removable medium was changed, or
- the target has been reset, or ... */
-   Data Protect, /* 7: Access to the data is blocked */
-   Blank Check,  /* 8: Reached unexpected written or unwritten
- region of the medium */
-   Vendor Specific(9),
-   Copy Aborted, /* A: COPY or COMPARE was aborted */
-   Aborted Command,  /* B: The target aborted the command */
-   Equal,/* C: A SEARCH DATA command found data equal,
- reserved in SPC-4 rev 36 */
-   Volume Overflow,  /* D: Medium full with still data to be written */
-   Miscompare,   /* E: Source data and data on the medium
- do not agree */
-   Completed,/* F: command completed sense data reported,
- may occur for successful command */
-};
-#else
-static const char * const snstext[] = {
-   0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7,
-   0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
-};
 #endif
 
-/* Get sense key string or NULL if not available */
-const char *
-scsi_sense_key_string(unsigned char key) {
-   return snstext[key  0xf];
-}
-EXPORT_SYMBOL(scsi_sense_key_string);
-
-const char *
-scsi_sense_type_string(struct scsi_sense_hdr *sshdr)
-{
-   return scsi_sense_is_deferred(sshdr) ? [deferred] : [current];
-}
-
-const char *
-scsi_sense_format_string(struct scsi_sense_hdr *sshdr)
-{
-   return sshdr-response_code = 0x72 ? [descriptor] : ;
-}
-
 /*
  * Get additional sense code string or NULL if not available.
  * This string may contain a %x and should be printed with ascq as arg.
@@ -1375,105 +1325,22 @@ void
 scsi_print_sense_hdr(struct scsi_device *sdev, const char *name,
 struct scsi_sense_hdr *sshdr)
 {
-   sdev_printk(KERN_INFO, sdev, [%s] Sense Key : %s %s%s\n, name,
-   scsi_sense_key_string(sshdr-sense_key),
-   scsi_sense_type_string(sshdr),
-   scsi_sense_format_string(sshdr));
+   trace_scsi_print_sense(sdev, name, sshdr, NULL, 0, 0);
scsi_show_extd_sense(sdev, name, sshdr-asc, sshdr-ascq);
 }
 EXPORT_SYMBOL(scsi_print_sense_hdr);
 
-static void
-scsi_dump_sense_buffer(struct scsi_device *sdev, const char *prefix,
-  const unsigned char *sense_buffer, int sense_len)
-{
-   char linebuf[128];
-   int i, linelen, remaining;
-
-   if (sense_len  32)
-   

[RFC PATCH 06/10] scsi/sd: Delete extra scsi_show_extd_sense() in sd_print_sense_hdr()

2014-08-08 Thread Yoshihiro YUNOMAE
sd_print_sense_hdr() calls scsi_show_extd_sense(),
but scsi_print_sense_hdr() also calls scsi_show_extd_sense().
We can get same result, so we delete it.

Note:
Calling scsi_show_extd_sense() is introduced in fdd8b297.

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/sd.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8d7204a..22dd214 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3286,8 +3286,6 @@ static void sd_print_sense_hdr(struct scsi_disk *sdkp,
   struct scsi_sense_hdr *sshdr)
 {
scsi_print_sense_hdr(sdkp-device, sdkp-disk-disk_name, sshdr);
-   scsi_show_extd_sense(sdkp-device, sdkp-disk-disk_name,
-sshdr-asc, sshdr-ascq);
 }
 
 static void sd_print_result(struct scsi_disk *sdkp, int result)

--
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


[RFC PATCH 09/10] scsi/trace: Add additional sense code and additional sense code qualifier to scsi_print_sense trace point

2014-08-08 Thread Yoshihiro YUNOMAE
There are no mean that additional sense code and additional sense code qualifier
are output as different messages of sense key, so those information are added.

Note:
scsi_show_extd_sense() is changed from export symbol to non-export symbol.

 - Result examples

Before (printk)
sd 2:0:0:0: [sda] Add. Sense: Unrecovered read error

After (ftrace, merged into scsi_print_sense traceevent)
scsi_print_sense: host_no=2 channel=0 id=0 lun=0 [sda] Sense Key (Medium Error 
[current])  Add. Sense (Unrecovered read error)

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c|  932 ---
 drivers/scsi/scsi_trace.c   |  920 ++
 include/scsi/scsi_dbg.h |2 
 include/trace/events/scsi.h |   10 
 4 files changed, 928 insertions(+), 936 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 85b75c8..ce9ceb8 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -14,12 +14,6 @@
 
 #include scsi/scsi.h
 #include scsi/scsi_cmnd.h
-#include scsi/scsi_device.h
-#include scsi/scsi_host.h
-#include scsi/scsi_eh.h
-#include scsi/scsi_dbg.h
-
-#include trace/events/scsi.h
 
 /* Commands with service actions that change the command name */
 #define SERVICE_ACTION_IN_12 0xab
@@ -429,929 +423,3 @@ void scsi_print_command(struct scsi_cmnd *cmd)
print_opcode_name(cmd-device, devname, cmd-cmnd, cmd-cmd_len);
 }
 EXPORT_SYMBOL(scsi_print_command);
-
-#ifdef CONFIG_SCSI_CONSTANTS
-
-struct error_info {
-   unsigned short code12;  /* 0x0302 looks better than 0x03,0x02 */
-   const char * text;
-};
-
-/*
- * The canonical list of T10 Additional Sense Codes is available at:
- * http://www.t10.org/lists/asc-num.txt [most recent: 20130605]
- */
-
-static const struct error_info additional[] =
-{
-   {0x, No additional sense information},
-   {0x0001, Filemark detected},
-   {0x0002, End-of-partition/medium detected},
-   {0x0003, Setmark detected},
-   {0x0004, Beginning-of-partition/medium detected},
-   {0x0005, End-of-data detected},
-   {0x0006, I/O process terminated},
-   {0x0007, Programmable early warning detected},
-   {0x0011, Audio play operation in progress},
-   {0x0012, Audio play operation paused},
-   {0x0013, Audio play operation successfully completed},
-   {0x0014, Audio play operation stopped due to error},
-   {0x0015, No current audio status to return},
-   {0x0016, Operation in progress},
-   {0x0017, Cleaning requested},
-   {0x0018, Erase operation in progress},
-   {0x0019, Locate operation in progress},
-   {0x001A, Rewind operation in progress},
-   {0x001B, Set capacity operation in progress},
-   {0x001C, Verify operation in progress},
-   {0x001D, ATA pass through information available},
-   {0x001E, Conflicting SA creation request},
-   {0x001F, Logical unit transitioning to another power condition},
-   {0x0020, Extended copy information available},
-
-   {0x0100, No index/sector signal},
-
-   {0x0200, No seek complete},
-
-   {0x0300, Peripheral device write fault},
-   {0x0301, No write current},
-   {0x0302, Excessive write errors},
-
-   {0x0400, Logical unit not ready, cause not reportable},
-   {0x0401, Logical unit is in process of becoming ready},
-   {0x0402, Logical unit not ready, initializing command required},
-   {0x0403, Logical unit not ready, manual intervention required},
-   {0x0404, Logical unit not ready, format in progress},
-   {0x0405, Logical unit not ready, rebuild in progress},
-   {0x0406, Logical unit not ready, recalculation in progress},
-   {0x0407, Logical unit not ready, operation in progress},
-   {0x0408, Logical unit not ready, long write in progress},
-   {0x0409, Logical unit not ready, self-test in progress},
-   {0x040A, Logical unit not accessible, asymmetric access state 
-transition},
-   {0x040B, Logical unit not accessible, target port in standby state},
-   {0x040C, Logical unit not accessible, target port in unavailable 
-state},
-   {0x040D, Logical unit not ready, structure check required},
-   {0x0410, Logical unit not ready, auxiliary memory not accessible},
-   {0x0411, Logical unit not ready, notify (enable spinup) required},
-   {0x0412, Logical unit not ready, offline},
-   {0x0413, Logical unit not ready, SA creation in progress},
-   {0x0414, Logical unit not ready, space allocation in progress},
-   {0x0415, Logical unit not ready, robotics 

[RFC PATCH 02/10] scsi/constants: Cleanup printk message in scsi_decode_sense_extras()

2014-08-08 Thread Yoshihiro YUNOMAE
If sense_flags and fixed_valid are zero, the kernel does not need to
output a printk message. So, if those conditions are met, it just returns.

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index a0e8159..9c38b8d 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1438,6 +1438,9 @@ scsi_decode_sense_extras(struct scsi_device *sdev, const 
char *name,
sense_flags |= ucp[3]  0xe0;
}
 
+   if (!sense_flags  !fixed_valid)
+   return;
+
res = 0;
memset(buff, 0, sizeof(buff));
blen = sizeof(buff) - 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


[RFC PATCH 05/10] scsi/trace: Use macros for getting driver byte, host byte, msg byte, and status byte

2014-08-08 Thread Yoshihiro YUNOMAE
For getting driver byte, host byte, msg byte, and status byte, macros are
implemented in scsi/scsi.h, so we use it.

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 include/trace/events/scsi.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index db6c935..8aecdc2 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -328,10 +328,10 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
  show_opcode_name(__entry-opcode),
  __parse_cdb(__get_dynamic_array(cmnd), __entry-cmd_len),
  __print_hex(__get_dynamic_array(cmnd), __entry-cmd_len),
- show_driverbyte_name(((__entry-result)  24)  0xff),
- show_hostbyte_name(((__entry-result)  16)  0xff),
- show_msgbyte_name(((__entry-result)  8)  0xff),
- show_statusbyte_name(__entry-result  0xff))
+ show_driverbyte_name(driver_byte(__entry-result)),
+ show_hostbyte_name(host_byte(__entry-result)),
+ show_msgbyte_name(msg_byte(__entry-result)),
+ show_statusbyte_name(status_byte(__entry-result)))
 );
 
 DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done,

--
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


[RFC PATCH 07/10] scsi/trace: Use scsi_show_result trace point instead of printk

2014-08-08 Thread Yoshihiro YUNOMAE
Current SCSI trace has hostbyte table and driverbyte table, so we don't need to
have the same table in scsi/constants.c.

- Result examples

Before (printk)
sd 2:0:0:0: [sda] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE

After (ftrace)
scsi_show_result: host_no=2 channel=0 id=0 lun=0 [sda] 
result=(driver=DRIVER_SENSE host=DID_OK)

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c|   52 ---
 drivers/scsi/scsi_trace.c   |   16 +
 include/trace/events/scsi.h |   38 +++
 3 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 6fad6b4..f7b7f32 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1488,55 +1488,3 @@ void scsi_print_sense(struct scsi_cmnd *cmd)
   SCSI_SENSE_BUFFERSIZE);
 }
 EXPORT_SYMBOL(scsi_print_sense);
-
-#ifdef CONFIG_SCSI_CONSTANTS
-
-static const char * const hostbyte_table[]={
-DID_OK, DID_NO_CONNECT, DID_BUS_BUSY, DID_TIME_OUT, DID_BAD_TARGET,
-DID_ABORT, DID_PARITY, DID_ERROR, DID_RESET, DID_BAD_INTR,
-DID_PASSTHROUGH, DID_SOFT_ERROR, DID_IMM_RETRY, DID_REQUEUE,
-DID_TRANSPORT_DISRUPTED, DID_TRANSPORT_FAILFAST, DID_TARGET_FAILURE,
-DID_NEXUS_FAILURE };
-#define NUM_HOSTBYTE_STRS ARRAY_SIZE(hostbyte_table)
-
-static const char * const driverbyte_table[]={
-DRIVER_OK, DRIVER_BUSY, DRIVER_SOFT,  DRIVER_MEDIA, DRIVER_ERROR,
-DRIVER_INVALID, DRIVER_TIMEOUT, DRIVER_HARD, DRIVER_SENSE};
-#define NUM_DRIVERBYTE_STRS ARRAY_SIZE(driverbyte_table)
-
-void scsi_show_result(struct scsi_device *sdev, const char *name, int result)
-{
-   int hb = host_byte(result);
-   int db = driver_byte(result);
-   const char *hb_string;
-   const char *db_string;
-
-   hb_string = (hb  NUM_HOSTBYTE_STRS) ? hostbyte_table[hb] : invalid;
-   db_string = (db  NUM_DRIVERBYTE_STRS) ?
-   driverbyte_table[db] : invalid;
-
-
-   sdev_printk(KERN_INFO, sdev,
-   [%s] Result: hostbyte=%s driverbyte=%s\n,
-   name, hb_string, db_string);
-}
-
-#else
-
-void scsi_show_result(struct scsi_device *sdev, const char *name, int result)
-{
-   sdev_printk(KERN_INFO, sdev,
-   [%s] Result: hostbyte=0x%02x driverbyte=0x%02x\n,
-   name, host_byte(result), driver_byte(result));
-}
-
-#endif
-EXPORT_SYMBOL(scsi_show_result);
-
-void scsi_print_result(struct scsi_cmnd *cmd)
-{
-   const char *devname = cmd-request-rq_disk ?
-   cmd-request-rq_disk-disk_name : scsi;
-   scsi_show_result(cmd-device, devname, cmd-result);
-}
-EXPORT_SYMBOL(scsi_print_result);
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index 2bea4f0..6ffbc40 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -19,6 +19,8 @@
 #include linux/trace_seq.h
 #include trace/events/scsi.h
 
+#include scsi/scsi_dbg.h
+
 #define SERVICE_ACTION16(cdb) (cdb[1]  0x1f)
 #define SERVICE_ACTION32(cdb) ((cdb[8]  8) | cdb[9])
 
@@ -286,3 +288,17 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char 
*cdb, int len)
return scsi_trace_misc(p, cdb, len);
}
 }
+
+void scsi_show_result(struct scsi_device *sdev, const char *name, int result)
+{
+   trace_scsi_show_result(sdev, name, result);
+}
+EXPORT_SYMBOL(scsi_show_result);
+
+void scsi_print_result(struct scsi_cmnd *cmd)
+{
+   const char *devname = cmd-request-rq_disk ?
+   cmd-request-rq_disk-disk_name : scsi;
+   scsi_show_result(cmd-device, devname, cmd-result);
+}
+EXPORT_SYMBOL(scsi_print_result);
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index 8aecdc2..0675195 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -123,7 +123,11 @@
scsi_hostbyte_name(DID_IMM_RETRY),  \
scsi_hostbyte_name(DID_REQUEUE),\
scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED),\
-   scsi_hostbyte_name(DID_TRANSPORT_FAILFAST))
+   scsi_hostbyte_name(DID_TRANSPORT_FAILFAST), \
+   scsi_hostbyte_name(DID_TARGET_FAILURE), \
+   scsi_hostbyte_name(DID_NEXUS_FAILURE),  \
+   scsi_hostbyte_name(DID_ALLOC_FAILURE),  \
+   scsi_hostbyte_name(DID_MEDIUM_ERROR))
 
 #define scsi_driverbyte_name(result)   { result, #result }
 #define show_driverbyte_name(val)  \
@@ -359,6 +363,38 @@ TRACE_EVENT(scsi_eh_wakeup,
TP_printk(host_no=%u, __entry-host_no)
 

[RFC PATCH 03/10] scsi/constants: Cleanup printk message in __scsi_print_command()

2014-08-08 Thread Yoshihiro YUNOMAE
All bytes in CDB should be output after linebuf is filled because
[%s] CDB: %s\n message is output many times in loop.

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 9c38b8d..5956d4d 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -413,9 +413,8 @@ void __scsi_print_command(struct scsi_device *sdev, const 
char *prefix,
 
hex_dump_to_buffer(cdb + i, linelen, 16, 1,
   linebuf, sizeof(linebuf), false);
-   sdev_printk(KERN_INFO, sdev, [%s] CDB: %s\n,
-   prefix, linebuf);
}
+   sdev_printk(KERN_INFO, sdev, [%s] CDB: %s\n, prefix, linebuf);
 }
 EXPORT_SYMBOL(__scsi_print_command);
 

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


[RFC PATCH 10/10] scsi/trace: Use scsi_print_command trace point instead of printk

2014-08-08 Thread Yoshihiro YUNOMAE
Previous printk messages of SCSI command can be mixed into other printk
messages because multiple printk messages are output for it. To avoid the
problem, patch 4e64bb8d6 in Hannes' branch(*1) introduced a local buffer.
But using local buffers can induce stack overflow, so we want to solve the
problem without local buffer if possible.

trace_seq_printf can add log messages without local buffer, so we use it.

Note:
We don't need constans.c any more.

(*1) 
http://git.kernel.org/cgit/linux/kernel/git/hare/scsi-devel.git/log/?h=logging

 - Result examples

Before (printk)
sd 2:0:0:0: [sda] CDB: Read(10)

After
scsi_print_command: host_no=2 channel=0 id=0 lun=0 [sda] CDB (Read(10))

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/Makefile   |2 
 drivers/scsi/constants.c|  425 ---
 drivers/scsi/scsi_trace.c   |  408 +
 include/scsi/scsi.h |8 +
 include/trace/events/scsi.h |   45 +
 5 files changed, 461 insertions(+), 427 deletions(-)
 delete mode 100644 drivers/scsi/constants.c

diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 5f0d299..c56f692 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -158,7 +158,7 @@ obj-$(CONFIG_SCSI_OSD_INITIATOR) += osd/
 # This goes last, so that real scsi devices probe earlier
 obj-$(CONFIG_SCSI_DEBUG)   += scsi_debug.o
 
-scsi_mod-y += scsi.o hosts.o scsi_ioctl.o constants.o \
+scsi_mod-y += scsi.o hosts.o scsi_ioctl.o \
   scsicam.o scsi_error.o scsi_lib.o
 scsi_mod-$(CONFIG_SCSI_DMA)+= scsi_lib_dma.o
 scsi_mod-y += scsi_scan.o scsi_sysfs.o scsi_devinfo.o
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
deleted file mode 100644
index ce9ceb8..000
--- a/drivers/scsi/constants.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * ASCII values for a number of symbolic constants, printing functions,
- * etc.
- * Additions for SCSI 2 and Linux 2.2.x by D. Gilbert (990422)
- * Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 07 3 May 2002)
- *   by D. Gilbert and aeb (20020609)
- * Updated to SPC-4 T10/1713-D Rev 36g, D. Gilbert 20130701
- */
-
-#include linux/blkdev.h
-#include linux/module.h
-#include linux/kernel.h
-#include asm/unaligned.h
-
-#include scsi/scsi.h
-#include scsi/scsi_cmnd.h
-
-/* Commands with service actions that change the command name */
-#define SERVICE_ACTION_IN_12 0xab
-#define SERVICE_ACTION_OUT_12 0xa9
-#define SERVICE_ACTION_BIDIRECTIONAL 0x9d
-#define SERVICE_ACTION_IN_16 0x9e
-#define SERVICE_ACTION_OUT_16 0x9f
-#define THIRD_PARTY_COPY_OUT 0x83
-#define THIRD_PARTY_COPY_IN 0x84
-
-
-
-#ifdef CONFIG_SCSI_CONSTANTS
-static const char * cdb_byte0_names[] = {
-/* 00-03 */ Test Unit Ready, Rezero Unit/Rewind, NULL, Request Sense,
-/* 04-07 */ Format Unit/Medium, Read Block Limits, NULL,
-   Reassign Blocks,
-/* 08-0d */ Read(6), NULL, Write(6), Seek(6), NULL, NULL,
-/* 0e-12 */ NULL, Read Reverse, Write Filemarks, Space, Inquiry,
-/* 13-16 */ Verify(6), Recover Buffered Data, Mode Select(6),
-   Reserve(6),
-/* 17-1a */ Release(6), Copy, Erase, Mode Sense(6),
-/* 1b-1d */ Start/Stop Unit, Receive Diagnostic, Send Diagnostic,
-/* 1e-1f */ Prevent/Allow Medium Removal, NULL,
-/* 20-22 */  NULL, NULL, NULL,
-/* 23-28 */ Read Format Capacities, Set Window,
-   Read Capacity(10), NULL, NULL, Read(10),
-/* 29-2d */ Read Generation, Write(10), Seek(10), Erase(10),
-Read updated block,
-/* 2e-31 */ Write Verify(10), Verify(10), Search High, Search Equal,
-/* 32-34 */ Search Low, Set Limits, Prefetch/Read Position,
-/* 35-37 */ Synchronize Cache(10), Lock/Unlock Cache(10),
-   Read Defect Data(10),
-/* 38-3c */ Medium Scan, Compare, Copy Verify, Write Buffer,
-   Read Buffer,
-/* 3d-3f */ Update Block, Read Long(10),  Write Long(10),
-/* 40-41 */ Change Definition, Write Same(10),
-/* 42-48 */ Unmap/Read sub-channel, Read TOC/PMA/ATIP,
-   Read density support, Play audio(10), Get configuration,
-   Play audio msf, Sanitize/Play audio track/index,
-/* 49-4f */ Play track relative(10), Get event status notification,
-Pause/resume, Log Select, Log Sense, Stop play/scan,
-NULL,
-/* 50-55 */ Xdwrite, Xpwrite, Read disk info, Xdread, Read track info,
-Reserve track, Send OPC info, Mode Select(10),
-/* 56-5b */ Reserve(10), Release(10), Repair track, Read master cue,
-Mode Sense(10), Close track/session,
-/* 5c-5f */ Read buffer capacity, Send cue sheet, Persistent reserve in,
-

[RFC PATCH 01/10] scsi/constants: Cleanup printk message in __scsi_print_sense()

2014-08-08 Thread Yoshihiro YUNOMAE
A device name is output like sda: Sense Key : Medium Error [current]
in __scsi_print_sense(), but it should be [sda] Sense Key : Medium Error
[current] because other printk messages output a device name like [sda] foo.

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index c6a7a4a..a0e8159 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1470,7 +1470,7 @@ void __scsi_print_sense(struct scsi_device *sdev, const 
char *name,
return;
}
 
-   sdev_printk(KERN_INFO, sdev, %s: Sense Key : %s %s%s\n, name,
+   sdev_printk(KERN_INFO, sdev, [%s] Sense Key : %s %s%s\n, name,
   scsi_sense_key_string(sshdr.sense_key),
   scsi_sense_type_string(sshdr),
   scsi_sense_format_string(sshdr));

--
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


[RFC PATCH 04/10] scsi/constants: Cleanup printk message in scsi_dump_sense_buffer()

2014-08-08 Thread Yoshihiro YUNOMAE
Unrecognized sense data should be output after linebuf is filled because
[%s] Unrecognized sense data (in hex): %s message is output many times in
loop.

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Cc: Hannes Reinecke h...@suse.de
Cc: Doug Gilbert dgilb...@interlog.com
Cc: Martin K. Petersen martin.peter...@oracle.com
Cc: Christoph Hellwig h...@lst.de
Cc: James E.J. Bottomley jbottom...@parallels.com
Cc: Hidehiro Kawai hidehiro.kawai...@hitachi.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
---
 drivers/scsi/constants.c |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 5956d4d..6fad6b4 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1385,16 +1385,13 @@ EXPORT_SYMBOL(scsi_print_sense_hdr);
 
 static void
 scsi_dump_sense_buffer(struct scsi_device *sdev, const char *prefix,
-  const unsigned char *sense_buffer, int sense_len,
-  struct scsi_sense_hdr *sshdr)
+  const unsigned char *sense_buffer, int sense_len)
 {
char linebuf[128];
int i, linelen, remaining;
 
if (sense_len  32)
sense_len = 32;
-   sdev_printk(KERN_INFO, sdev,
-   [%s] Unrecognized sense data (in hex):, prefix);
 
remaining = sense_len;
for (i = 0; i  sense_len; i += 16) {
@@ -1403,9 +1400,10 @@ scsi_dump_sense_buffer(struct scsi_device *sdev, const 
char *prefix,
 
hex_dump_to_buffer(sense_buffer + i, linelen, 16, 1,
   linebuf, sizeof(linebuf), false);
-   sdev_printk(KERN_INFO, sdev, [%s] Sense: %s\n,
-   prefix, linebuf);
}
+   sdev_printk(KERN_INFO, sdev,
+   [%s] Unrecognized sense data (in hex): %s,
+   prefix, linebuf);
 }
 
 static void
@@ -1467,8 +1465,7 @@ void __scsi_print_sense(struct scsi_device *sdev, const 
char *name,
 
if (!scsi_normalize_sense(sense_buffer, sense_len, sshdr)) {
/* this may be SCSI-1 sense data */
-   scsi_dump_sense_buffer(sdev, name, sense_buffer,
-  sense_len, sshdr);
+   scsi_dump_sense_buffer(sdev, name, sense_buffer, sense_len);
return;
}
 

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


[PATCH v2 3/17] arcmsr: Add code to support system hibernation

2014-08-08 Thread Ching Huang
From: Ching Huang ching2...@areca.com.tw

This patch adds code to support system hibernation.

Changes in v2 of 3/17:
* merge patch 18/18 to this patch

Signed-off-by: Ching Huang ching2...@areca.com.tw
---

Thanks to Tomas's advice.

diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-08-01 17:54:46.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-08-08 19:03:48.0 +0800
@@ -89,11 +89,15 @@ static int arcmsr_bios_param(struct scsi
 static int arcmsr_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
 static int arcmsr_probe(struct pci_dev *pdev,
const struct pci_device_id *id);
+static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state);
+static int arcmsr_resume(struct pci_dev *pdev);
 static void arcmsr_remove(struct pci_dev *pdev);
 static void arcmsr_shutdown(struct pci_dev *pdev);
 static void arcmsr_iop_init(struct AdapterControlBlock *acb);
 static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb);
 static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb);
+static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb,
+   u32 intmask_org);
 static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb);
 static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb);
 static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
@@ -167,6 +171,8 @@ static struct pci_driver arcmsr_pci_driv
.id_table   = arcmsr_device_id_table,
.probe  = arcmsr_probe,
.remove = arcmsr_remove,
+   .suspend= arcmsr_suspend,
+   .resume = arcmsr_resume,
.shutdown   = arcmsr_shutdown,
 };
 /*
@@ -772,6 +778,76 @@ static void arcmsr_free_irq(struct pci_d
free_irq(pdev-irq, acb);
 }
 
+static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+   uint32_t intmask_org;
+   struct Scsi_Host *host = pci_get_drvdata(pdev);
+   struct AdapterControlBlock *acb =
+   (struct AdapterControlBlock *)host-hostdata;
+
+   intmask_org = arcmsr_disable_outbound_ints(acb);
+   arcmsr_free_irq(pdev, acb);
+   del_timer_sync(acb-eternal_timer);
+   flush_work(acb-arcmsr_do_message_isr_bh);
+   arcmsr_stop_adapter_bgrb(acb);
+   arcmsr_flush_adapter_cache(acb);
+   pci_set_drvdata(pdev, host);
+   pci_save_state(pdev);
+   pci_disable_device(pdev);
+   pci_set_power_state(pdev, pci_choose_state(pdev, state));
+   return 0;
+}
+
+static int arcmsr_resume(struct pci_dev *pdev)
+{
+   int error;
+   struct Scsi_Host *host = pci_get_drvdata(pdev);
+   struct AdapterControlBlock *acb =
+   (struct AdapterControlBlock *)host-hostdata;
+
+   pci_set_power_state(pdev, PCI_D0);
+   pci_enable_wake(pdev, PCI_D0, 0);
+   pci_restore_state(pdev);
+   if (pci_enable_device(pdev)) {
+   pr_warn(%s: pci_enable_device error\n, __func__);
+   return -ENODEV;
+   }
+   error = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
+   if (error) {
+   error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+   if (error) {
+   pr_warn(scsi%d: No suitable DMA mask available\n,
+  host-host_no);
+   goto controller_unregister;
+   }
+   }
+   pci_set_master(pdev);
+   if (arcmsr_request_irq(pdev, acb) == FAILED)
+   goto controller_stop;
+   arcmsr_iop_init(acb);
+   INIT_WORK(acb-arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn);
+   atomic_set(acb-rq_map_token, 16);
+   atomic_set(acb-ante_token_value, 16);
+   acb-fw_flag = FW_NORMAL;
+   init_timer(acb-eternal_timer);
+   acb-eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ);
+   acb-eternal_timer.data = (unsigned long) acb;
+   acb-eternal_timer.function = arcmsr_request_device_map;
+   add_timer(acb-eternal_timer);
+   return 0;
+controller_stop:
+   arcmsr_stop_adapter_bgrb(acb);
+   arcmsr_flush_adapter_cache(acb);
+controller_unregister:
+   scsi_remove_host(host);
+   arcmsr_free_ccb_pool(acb);
+   arcmsr_unmap_pciregion(acb);
+   pci_release_regions(pdev);
+   scsi_host_put(host);
+   pci_disable_device(pdev);
+   return -ENODEV;
+}
+
 static uint8_t arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
 {
struct MessageUnit_A __iomem *reg = acb-pmuA;


--
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] qla2xxx: Move mailbox failure messages to a default debug level.

2014-08-08 Thread Chad Dupuis
Move the mailbox failure messages to a default debugging level so that
benign failures won't flood the system logs but will still show up if
default debug messaging is enabled (ql2xextended_error_logging=1).

Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com
Signed-off-by: Chad Dupuis chad.dup...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_mbx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index d9aafc0..a7a373f 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -373,7 +373,7 @@ premature_exit:
 
 mbx_done:
if (rval) {
-   ql_log(ql_log_warn, base_vha, 0x1020,
+   ql_dbg(ql_dbg_disc, base_vha, 0x1020,
 Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, mb[3]=%x, 
cmd=%x .\n,
mcp-mb[0], mcp-mb[1], mcp-mb[2], mcp-mb[3], command);
} else {
-- 
1.8.5.2

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


[PATCH 2/2] qla2xxx: Remove restriction on starting remote device discovery on port update.

2014-08-08 Thread Chad Dupuis
Limiting which port update events will allow the driver to kick off a
name server scan has been problematic in some corner cases so remove the
restriction and restore the previous semantic. Also move the link
up/down informational messages to the LOOP_UP and LOOP_DOWN events.

Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com
Signed-off-by: Chad Dupuis chad.dup...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_dbg.c |  2 +-
 drivers/scsi/qla2xxx/qla_isr.c | 10 --
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index c72ee97b..41117b3 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -34,7 +34,7 @@
  * |  || 0x5047,0x5052  |
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
- * |  || 0x507b
|
+ * |  || 0x507b,0x505f |
  * | Timer Routines   |   0x6012   ||
  * | User Space Interactions  |   0x70e2   | 0x7018,0x702e  |
  * | || 0x7020,0x7024  |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 550a4a3..d89e3c4 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -730,7 +730,7 @@ skip_rio:
else
ha-link_data_rate = mb[1];
 
-   ql_dbg(ql_dbg_async, vha, 0x500a,
+   ql_log(ql_log_info, vha, 0x500a,
LOOP UP detected (%s Gbps).\n,
qla2x00_get_link_speed_str(ha, ha-link_data_rate));
 
@@ -743,7 +743,7 @@ skip_rio:
? RD_REG_WORD(reg24-mailbox4) : 0;
mbx = (IS_P3P_TYPE(ha)) ? RD_REG_WORD(reg82-mailbox_out[4])
: mbx;
-   ql_dbg(ql_dbg_async, vha, 0x500b,
+   ql_log(ql_log_info, vha, 0x500b,
LOOP DOWN detected (%x %x %x %x).\n,
mb[1], mb[2], mb[3], mbx);
 
@@ -908,7 +908,8 @@ skip_rio:
 * it.  Otherwise ignore it and Wait for RSCN to come in.
 */
atomic_set(vha-loop_down_timer, 0);
-   if (mb[1] != 0x || (mb[2] != 0x6  mb[2] != 0x4)) {
+   if (atomic_read(vha-loop_state) != LOOP_DOWN 
+   atomic_read(vha-loop_state) != LOOP_DEAD) {
ql_dbg(ql_dbg_async, vha, 0x5011,
Asynchronous PORT UPDATE ignored 
%04x/%04x/%04x.\n,
mb[1], mb[2], mb[3]);
@@ -920,9 +921,6 @@ skip_rio:
ql_dbg(ql_dbg_async, vha, 0x5012,
Port database changed %04x %04x %04x.\n,
mb[1], mb[2], mb[3]);
-   ql_log(ql_log_warn, vha, 0x505f,
-   Link is operational (%s Gbps).\n,
-   qla2x00_get_link_speed_str(ha, ha-link_data_rate));
 
/*
 * Mark all devices as missing so we will login again.
-- 
1.8.5.2

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


[PATCH v2 4/17] arcmsr: limit max. number of SCSI command request

2014-08-08 Thread Ching Huang
From: Ching Huang ching2...@areca.com.tw

This patch limits the max. number of SCSI command request to avoid command 
overflow.

Changes in v2 4/17:
* set the correct host-can_queue value after read adapter's limitation.

Signed-off-by: Ching Huang ching2...@areca.com.tw
---

Thanks to Tomas's advice.

diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-05-06 15:24:06.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-05-06 15:22:36.0 +0800
@@ -45,11 +45,12 @@
 #include linux/interrupt.h
 struct device_attribute;
 /*The limit of outstanding scsi command that firmware can handle*/
-#define ARCMSR_MAX_OUTSTANDING_CMD 
256
 #ifdef CONFIG_XEN
#define ARCMSR_MAX_FREECCB_NUM  160
+#define ARCMSR_MAX_OUTSTANDING_CMD 155
 #else
#define ARCMSR_MAX_FREECCB_NUM  320
+#define ARCMSR_MAX_OUTSTANDING_CMD 255
 #endif
 #define ARCMSR_DRIVER_VERSION  v1.30.00.04-20140428
 #define ARCMSR_SCSI_INITIATOR_ID   
255
@@ -598,6 +599,7 @@ struct AdapterControlBlock
#define FW_DEADLOCK 0x0010
atomic_trq_map_token;
atomic_tante_token_value;
+   uint32_tmaxOutstanding;
int msix_vector_count;
 };/* HW_DEVICE_EXTENSION */
 /*
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-08-08 19:03:48.0 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-08-08 19:35:46.0 +0800
@@ -134,7 +134,7 @@ static struct scsi_host_template arcmsr_
.eh_bus_reset_handler   = arcmsr_bus_reset,
.bios_param = arcmsr_bios_param,
.change_queue_depth = arcmsr_adjust_disk_queue_depth,
-   .can_queue  = ARCMSR_MAX_FREECCB_NUM,
+   .can_queue  = ARCMSR_MAX_OUTSTANDING_CMD,
.this_id= ARCMSR_SCSI_INITIATOR_ID,
.sg_tablesize   = ARCMSR_DEFAULT_SG_ENTRIES, 
.max_sectors= ARCMSR_MAX_XFER_SECTORS_C, 
@@ -693,7 +693,7 @@ static int arcmsr_probe(struct pci_dev *
host-max_lun = ARCMSR_MAX_TARGETLUN;
host-max_id = ARCMSR_MAX_TARGETID; /*16:8*/
host-max_cmd_len = 16; /*this is issue of 
64bit LBA ,over 2T byte*/
-   host-can_queue = ARCMSR_MAX_FREECCB_NUM;   /* max simultaneous 
cmds */ 
+   host-can_queue = ARCMSR_MAX_OUTSTANDING_CMD;   /* max simultaneous 
cmds */ 
host-cmd_per_lun = ARCMSR_MAX_CMD_PERLUN;  
host-this_id = ARCMSR_SCSI_INITIATOR_ID;
host-unique_id = (bus  8) | dev_fun;
@@ -2215,9 +2215,6 @@ static int arcmsr_queue_command_lck(stru
arcmsr_handle_virtual_command(acb, cmd);
return 0;
}
-   if (atomic_read(acb-ccboutstandingcount) =
-   ARCMSR_MAX_OUTSTANDING_CMD)
-   return SCSI_MLQUEUE_HOST_BUSY;
ccb = arcmsr_get_freeccb(acb);
if (!ccb)
return SCSI_MLQUEUE_HOST_BUSY;
@@ -2427,12 +2424,27 @@ static bool arcmsr_get_hbc_config(struct
 }
 static bool arcmsr_get_firmware_spec(struct AdapterControlBlock *acb)
 {
-   if (acb-adapter_type == ACB_ADAPTER_TYPE_A)
-   return arcmsr_get_hba_config(acb);
-   else if (acb-adapter_type == ACB_ADAPTER_TYPE_B)
-   return arcmsr_get_hbb_config(acb);
+   bool rtn = false;
+
+   switch (acb-adapter_type) {
+   case ACB_ADAPTER_TYPE_A:
+   rtn = arcmsr_get_hba_config(acb);
+   break;
+   case ACB_ADAPTER_TYPE_B:
+   rtn = arcmsr_get_hbb_config(acb);
+   break;
+   case ACB_ADAPTER_TYPE_C:
+   rtn = arcmsr_get_hbc_config(acb);
+   break;
+   default:
+   break;
+   }
+   if(acb-firm_numbers_queue  ARCMSR_MAX_OUTSTANDING_CMD)
+   acb-maxOutstanding = ARCMSR_MAX_OUTSTANDING_CMD;
else
-   return arcmsr_get_hbc_config(acb);
+   acb-maxOutstanding = acb-firm_numbers_queue - 1;
+   acb-host-can_queue = acb-maxOutstanding;
+   return rtn;
 }
 
 static int arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,


--
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 -logging 00/10] scsi/constants: Output continuous error messages on trace

2014-08-08 Thread Douglas Gilbert

On 14-08-08 01:50 PM, Yoshihiro YUNOMAE wrote:

Hi All,

This patch set introduces new traceevents in order to output continuous error
messages. Current SCSI printk messages in upstream kernel can be divided by and
mixed with other messages. Even if each error message has its device id,
sometimes we can easily be lost in mixed logs because the message's device id
is separated from it's body. To avoid it, I'd like to use traceevents to
store error messages into the ftrace or perf buuffer, because traceevents
are atomically commited to the buffer.

In this patch set, all printk messages are removed based on a local
discussion with Hannes, but I think printk messages should be kept because all
users don't enable traceevents and rsyslog can store as files.

However, if printk of logging branch is kept, the messages are duplicate and
it can induce stack overflow by using local buffer(*1).

  (*1) https://lkml.org/lkml/2014/5/20/742

So, my suggestion is follows:

1) printk
Keeps current implemntation of upstream kernel.
The messages are divided and can be mixed, but all users can check the error
messages without any settings.

2) traceevents
To get the complete messages, we can use ftrace or perf (or something on them).
Users can always understand correct messages, but they need to set up the
tracers.

This patch set is based on Hannes' logging branch:
http://git.kernel.org/cgit/linux/kernel/git/hare/scsi-devel.git/log/?h=logging

[1/10] ~  [6/10]: just cleanup for logging branch
[7/10] ~ [10/10]: introduce new traceevents

Any comments are welcome!


In sg3_utils there are now string yielding equivalents
to the sense buffer print functions. They take a form
like this:
  char * get_sense_str(const unsigned char * sense_buffer,
   int sb_len, int blen, char * b);

So this just does the hard work of decoding the sense buffer
(or saying it is invalid) the result of which it places in
buffer 'b'. And 'b' is returned (so this function can be in
the arguments of a driver's printing function).

Adding such string functions would give other parts of the
SCSI subsystem the capability of tailoring their own
messages that include sense data information.


Existing sense buffer print function could be kept and
implemented using the newer _str variants. Would that
be worth the trouble?

Doug Gilbert


--
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 3/17] arcmsr: Add code to support system hibernation

2014-08-08 Thread Tomas Henzl
On 08/08/2014 02:05 PM, Ching Huang wrote:
 From: Ching Huang ching2...@areca.com.tw

 This patch adds code to support system hibernation.

 Changes in v2 of 3/17:
 * merge patch 18/18 to this patch

Thanks, and please mark the the 18/18 as obsolete - add a comment there 

In my previous response were other comments too, you haven't probably 
noticed them. I could be wrong with my comments, but if you want a review
you should explain why the code is ok as it is.


 Signed-off-by: Ching Huang ching2...@areca.com.tw
 ---

 Thanks to Tomas's advice.

 diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c 
 b/drivers/scsi/arcmsr/arcmsr_hba.c
 --- a/drivers/scsi/arcmsr/arcmsr_hba.c2014-08-01 17:54:46.0 
 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c2014-08-08 19:03:48.0 
 +0800
 @@ -89,11 +89,15 @@ static int arcmsr_bios_param(struct scsi
  static int arcmsr_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
  static int arcmsr_probe(struct pci_dev *pdev,
   const struct pci_device_id *id);
 +static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state);
 +static int arcmsr_resume(struct pci_dev *pdev);
  static void arcmsr_remove(struct pci_dev *pdev);
  static void arcmsr_shutdown(struct pci_dev *pdev);
  static void arcmsr_iop_init(struct AdapterControlBlock *acb);
  static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb);
  static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb);
 +static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb,
 + u32 intmask_org);
  static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb);
  static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb);
  static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb);
 @@ -167,6 +171,8 @@ static struct pci_driver arcmsr_pci_driv
   .id_table   = arcmsr_device_id_table,
   .probe  = arcmsr_probe,
   .remove = arcmsr_remove,
 + .suspend= arcmsr_suspend,
 + .resume = arcmsr_resume,
   .shutdown   = arcmsr_shutdown,
  };
  /*
 @@ -772,6 +778,76 @@ static void arcmsr_free_irq(struct pci_d
   free_irq(pdev-irq, acb);
  }
  
 +static int arcmsr_suspend(struct pci_dev *pdev, pm_message_t state)
 +{
 + uint32_t intmask_org;
 + struct Scsi_Host *host = pci_get_drvdata(pdev);
 + struct AdapterControlBlock *acb =
 + (struct AdapterControlBlock *)host-hostdata;
 +
 + intmask_org = arcmsr_disable_outbound_ints(acb);
 + arcmsr_free_irq(pdev, acb);
 + del_timer_sync(acb-eternal_timer);
 + flush_work(acb-arcmsr_do_message_isr_bh);
 + arcmsr_stop_adapter_bgrb(acb);
 + arcmsr_flush_adapter_cache(acb);
 + pci_set_drvdata(pdev, host);
 + pci_save_state(pdev);
 + pci_disable_device(pdev);
 + pci_set_power_state(pdev, pci_choose_state(pdev, state));
 + return 0;
 +}
 +
 +static int arcmsr_resume(struct pci_dev *pdev)
 +{
 + int error;
 + struct Scsi_Host *host = pci_get_drvdata(pdev);
 + struct AdapterControlBlock *acb =
 + (struct AdapterControlBlock *)host-hostdata;
 +
 + pci_set_power_state(pdev, PCI_D0);
 + pci_enable_wake(pdev, PCI_D0, 0);
 + pci_restore_state(pdev);
 + if (pci_enable_device(pdev)) {
 + pr_warn(%s: pci_enable_device error\n, __func__);
 + return -ENODEV;
 + }
 + error = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
 + if (error) {
 + error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
 + if (error) {
 + pr_warn(scsi%d: No suitable DMA mask available\n,
 +host-host_no);
 + goto controller_unregister;
 + }
 + }
 + pci_set_master(pdev);
 + if (arcmsr_request_irq(pdev, acb) == FAILED)
 + goto controller_stop;
 + arcmsr_iop_init(acb);
 + INIT_WORK(acb-arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn);
 + atomic_set(acb-rq_map_token, 16);
 + atomic_set(acb-ante_token_value, 16);
 + acb-fw_flag = FW_NORMAL;
 + init_timer(acb-eternal_timer);
 + acb-eternal_timer.expires = jiffies + msecs_to_jiffies(6 * HZ);
 + acb-eternal_timer.data = (unsigned long) acb;
 + acb-eternal_timer.function = arcmsr_request_device_map;
 + add_timer(acb-eternal_timer);
 + return 0;
 +controller_stop:
 + arcmsr_stop_adapter_bgrb(acb);
 + arcmsr_flush_adapter_cache(acb);
 +controller_unregister:
 + scsi_remove_host(host);
 + arcmsr_free_ccb_pool(acb);
 + arcmsr_unmap_pciregion(acb);
 + pci_release_regions(pdev);
 + scsi_host_put(host);
 + pci_disable_device(pdev);
 + return -ENODEV;
 +}
 +
  static uint8_t arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
  {
   struct MessageUnit_A __iomem *reg = acb-pmuA;


 --
 To unsubscribe from this list: 

Re: [PATCH 1/1] dpt_i2o: delete unnecessary null test on array

2014-08-08 Thread walter harms


Am 06.08.2014 12:39, schrieb Julia Lawall:
 From: Julia Lawall julia.law...@lip6.fr
 
 Delete NULL test on array (always false).
 
 A simplified version of the semantic match that finds this problem is as
 follows: (http://coccinelle.lip6.fr/)
 
 // smpl
 @r@
 type T;
 T [] e;
 position p;
 @@
 e ==@p NULL
 
 @ disable fld_to_ptr@
 expression e;
 identifier f;
 position r.p;
 @@
 * e.f ==@p NULL
 // /smpl
 
 Signed-off-by: Julia Lawall julia.law...@lip6.fr
 
 ---
 I don't know if this is the correct change, or if some other test was
 intended.  But the code has been this way since at least 2.4.20, so it
 would seem that no one has been bothered by the lack of whatever this was
 supposed to test for.
 
  drivers/scsi/dpt_i2o.c |5 -
  1 file changed, 5 deletions(-)
 
 diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
 index 67283ef..62e276b 100644
 --- a/drivers/scsi/dpt_i2o.c
 +++ b/drivers/scsi/dpt_i2o.c
 @@ -1169,11 +1169,6 @@ static struct adpt_device* adpt_find_device(adpt_hba* 
 pHba, u32 chan, u32 id, u6
   if(chan  0 || chan = MAX_CHANNEL)
   return NULL;
   

chan is u32 and u32  0 ?
for the next round.

re,
 wh

 - if( pHba-channel[chan].device == NULL){
 - printk(KERN_DEBUGAdaptec I2O RAID: Trying to find device 
 before they are allocated\n);
 - return NULL;
 - }
 -
   d = pHba-channel[chan].device[id];
   if(!d || d-tid == 0) {
   return NULL;
 
 --
 To unsubscribe from this list: send the line unsubscribe kernel-janitors in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 0/2] ahci_xgene: Fixes related to APM X-Gene SATA host controller driver.

2014-08-08 Thread Suman Tripathi
This patch set contains a couple of fixes related to APM X-Gene SATA
controller driver.

v2 Change:
   1. Drop the Link down retry patch from this patch set.

v4 Change:
   1. Drop the patch to fix the csr-mask in dts for PHY clock
 node of SATA Host Controller 1.
   2. Add the patch to correct the OOB tunning parameters for
 the COMINIT/COMWAKE parameters.
   3. Add the patch to remove the NCQ support from the APM
 X-Gene AHCI SATA Host controller driver.
   4. Add the patch to remove the clock and PHY reference nodes
 from the APM X-Gene Host controller dts node.

v5 Change :
   1. All the patches are based on 3.16.0-rc6/for-3.17 kernel.
   2. Drop the patch to remove the clock and PHY reference nodes
 from the APM X-Gene Host controller dts node as it breaks
 with old firmware.
   3. Add the patch to skip phy and clock initialisation if
 already done in the firmware.
   4. Add the patch to fix the csr-mask in dts for PHY clock
 node of SATA Host Controller 1.
   5. Add the patch to remove the NCQ support from the APM
 X-Gene AHCI SATA Host controller driver based on 3.16.0-rc6/
 for-3.17 kernel.
   6. Drop the patch to correct the OOB tunning parameters for
 the COMINIT/COMWAKE parameters as it is already applied to
 3.16/for-3.17 branch by the maintainer.
   7. Drop the patch to fix the watermark threshold as it is
 already applied to 3.16/for-3.17 branch by the maintainer.

v6 change :
   1. Drop the patch to skip phy and clock initialisation if
 already done in the firmware.
   2. Drop the patch to fix the csr-mask in dts for PHY clock
 node of SATA Host Controller 1.
   3. Add the remove the clock and PHY node patch as it
 fixes the dropped patches together. This patch works with
 old and new firmware as well.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---

Suman Tripathi (2):
  ahci_xgene: Removing NCQ support from the APM X-Gene SoC AHCI SATA
Host Controller driver.
  arm64: Remove the clock and PHY reference from the APM X-Gene SoC AHCI
SATA Host controller dts node.

 .../devicetree/bindings/ata/apm-xgene.txt  | 10 +--
 arch/arm64/boot/dts/apm-storm.dtsi | 93 --
 drivers/ata/ahci_xgene.c   |  4 +-
 3 files changed, 7 insertions(+), 100 deletions(-)

--
1.8.2.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 v6 1/2] ahci_xgene: Removing NCQ support from the APM X-Gene SoC AHCI SATA Host Controller driver.

2014-08-08 Thread Suman Tripathi
This patch removes the NCQ support from the APM X-Gene SoC AHCI
Host Controller driver as it doesn't support it.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---
 drivers/ata/ahci_xgene.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 1cfbdca..f416495 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -344,7 +344,7 @@ static struct ata_port_operations xgene_ahci_ops = {
 };

 static const struct ata_port_info xgene_ahci_port_info = {
-   .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
+   .flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
.port_ops = xgene_ahci_ops,
@@ -481,7 +481,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
/* Configure the host controller */
xgene_ahci_hw_init(hpriv);

-   hflags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
+   hflags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ;

rc = ahci_platform_init_host(pdev, hpriv, xgene_ahci_port_info,
 hflags, 0, 0);
--
1.8.2.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 v6 2/2] arm64: Remove the clock and PHY reference from the APM X-Gene SoC AHCI SATA Host controller dts node.

2014-08-08 Thread Suman Tripathi
This patch removes all clocks and PHY references from the APM X-Gene
SoC AHCI SATA host controller and PHY DTS nodes. The clock and PHY
are no longer needed as they are handled by the firmware. By removing
only the reference is not enough as any un-used clock entry will get
disabled by the clock framework. This patch also updates the APM X-Gene
SOC AHCI SATA Host controller clock and PHY bindings as optional
properties.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---
 .../devicetree/bindings/ata/apm-xgene.txt  | 10 +--
 arch/arm64/boot/dts/apm-storm.dtsi | 93 --
 2 files changed, 5 insertions(+), 98 deletions(-)

diff --git a/Documentation/devicetree/bindings/ata/apm-xgene.txt 
b/Documentation/devicetree/bindings/ata/apm-xgene.txt
index a668f0e..4cd32c2 100644
--- a/Documentation/devicetree/bindings/ata/apm-xgene.txt
+++ b/Documentation/devicetree/bindings/ata/apm-xgene.txt
@@ -17,16 +17,16 @@ Required properties:
  5th optional memory resource shall be the host
  controller MUX memory resource if required.
 - interrupts   : Interrupt-specifier for SATA host controller IRQ.
-- clocks   : Reference to the clock entry.
-- phys : A list of phandles + phy-specifiers, one for each
- entry in phy-names.
-- phy-names: Should contain:
-  * sata-phy for the SATA 6.0Gbps PHY

 Optional properties:
 - dma-coherent : Present if dma operations are coherent
 - status   : Shall be ok if enabled or disabled if disabled.
  Default is ok.
+- clocks   : Reference to the clock entry.
+- phys : A list of phandles + phy-specifiers, one for each
+ entry in phy-names.
+- phy-names: Should contain:
+  * sata-phy for the SATA 6.0Gbps PHY

 Example:
sataclk: sataclk {
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi 
b/arch/arm64/boot/dts/apm-storm.dtsi
index 40aa96c..4a56bcf 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -177,87 +177,6 @@
clock-output-names = eth8clk;
};

-   sataphy1clk: sataphy1clk@1f21c000 {
-   compatible = apm,xgene-device-clock;
-   #clock-cells = 1;
-   clocks = socplldiv2 0;
-   reg = 0x0 0x1f21c000 0x0 0x1000;
-   reg-names = csr-reg;
-   clock-output-names = sataphy1clk;
-   status = disabled;
-   csr-offset = 0x4;
-   csr-mask = 0x00;
-   enable-offset = 0x0;
-   enable-mask = 0x06;
-   };
-
-   sataphy2clk: sataphy1clk@1f22c000 {
-   compatible = apm,xgene-device-clock;
-   #clock-cells = 1;
-   clocks = socplldiv2 0;
-   reg = 0x0 0x1f22c000 0x0 0x1000;
-   reg-names = csr-reg;
-   clock-output-names = sataphy2clk;
-   status = ok;
-   csr-offset = 0x4;
-   csr-mask = 0x3a;
-   enable-offset = 0x0;
-   enable-mask = 0x06;
-   };
-
-   sataphy3clk: sataphy1clk@1f23c000 {
-   compatible = apm,xgene-device-clock;
-   #clock-cells = 1;
-   clocks = socplldiv2 0;
-   reg = 0x0 0x1f23c000 0x0 0x1000;
-   reg-names = csr-reg;
-   clock-output-names = sataphy3clk;
-   status = ok;
-   csr-offset = 0x4;
-   csr-mask = 0x3a;
-   enable-offset = 0x0;
-   enable-mask = 0x06;
-   };
-
-   sata01clk: sata01clk@1f21c000 {
-   compatible = apm,xgene-device-clock;
-   #clock-cells = 1;
-   clocks = socplldiv2 0;
-   reg = 0x0 0x1f21c000 0x0 0x1000;
-   reg-names = csr-reg;
-   clock-output-names = sata01clk;
-   csr-offset = 0x4;
-   csr-mask = 0x05;
-   enable-offset = 0x0;
-   

Re: [PATCH 1/1] dpt_i2o: delete unnecessary null test on array

2014-08-08 Thread James Bottomley
On Wed, 2014-08-06 at 12:39 +0200, Julia Lawall wrote:
 From: Julia Lawall julia.law...@lip6.fr
 
 Delete NULL test on array (always false).
 
 A simplified version of the semantic match that finds this problem is as
 follows: (http://coccinelle.lip6.fr/)
 
 // smpl
 @r@
 type T;
 T [] e;
 position p;
 @@
 e ==@p NULL
 
 @ disable fld_to_ptr@
 expression e;
 identifier f;
 position r.p;
 @@
 * e.f ==@p NULL
 // /smpl
 
 Signed-off-by: Julia Lawall julia.law...@lip6.fr
 
 ---
 I don't know if this is the correct change, or if some other test was
 intended.  But the code has been this way since at least 2.4.20, so it
 would seem that no one has been bothered by the lack of whatever this was
 supposed to test for.
 
  drivers/scsi/dpt_i2o.c |5 -
  1 file changed, 5 deletions(-)
 
 diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
 index 67283ef..62e276b 100644
 --- a/drivers/scsi/dpt_i2o.c
 +++ b/drivers/scsi/dpt_i2o.c
 @@ -1169,11 +1169,6 @@ static struct adpt_device* adpt_find_device(adpt_hba* 
 pHba, u32 chan, u32 id, u6
   if(chan  0 || chan = MAX_CHANNEL)
   return NULL;
   
 - if( pHba-channel[chan].device == NULL){
 - printk(KERN_DEBUGAdaptec I2O RAID: Trying to find device 
 before they are allocated\n);
 - return NULL;
 - }

dpt_i2o is always weirdly fun, but I think, based on the message, this
check is supposed to be 

if( pHba-channel[chan].device[id] == NULL){

Since device is an array of device pointers which are allocated by
parsing data.

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 1/1] dpt_i2o: delete unnecessary null test on array

2014-08-08 Thread Julia Lawall
  diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
  index 67283ef..62e276b 100644
  --- a/drivers/scsi/dpt_i2o.c
  +++ b/drivers/scsi/dpt_i2o.c
  @@ -1169,11 +1169,6 @@ static struct adpt_device* 
  adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u6
  if(chan  0 || chan = MAX_CHANNEL)
  return NULL;
 
  -   if( pHba-channel[chan].device == NULL){
  -   printk(KERN_DEBUGAdaptec I2O RAID: Trying to find device 
  before they are allocated\n);
  -   return NULL;
  -   }

 dpt_i2o is always weirdly fun, but I think, based on the message, this
 check is supposed to be

 if( pHba-channel[chan].device[id] == NULL){

 Since device is an array of device pointers which are allocated by
 parsing data.

That seems to be already checked immediately below:

d = pHba-channel[chan].device[id];
if(!d || d-tid == 0) {
return NULL;
}

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


Re: [PATCH 1/1] dpt_i2o: delete unnecessary null test on array

2014-08-08 Thread James Bottomley
On Fri, 2014-08-08 at 19:03 +0200, Julia Lawall wrote:
   diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
   index 67283ef..62e276b 100644
   --- a/drivers/scsi/dpt_i2o.c
   +++ b/drivers/scsi/dpt_i2o.c
   @@ -1169,11 +1169,6 @@ static struct adpt_device* 
   adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u6
 if(chan  0 || chan = MAX_CHANNEL)
 return NULL;
  
   - if( pHba-channel[chan].device == NULL){
   - printk(KERN_DEBUGAdaptec I2O RAID: Trying to find device 
   before they are allocated\n);
   - return NULL;
   - }
 
  dpt_i2o is always weirdly fun, but I think, based on the message, this
  check is supposed to be
 
  if( pHba-channel[chan].device[id] == NULL){
 
  Since device is an array of device pointers which are allocated by
  parsing data.
 
 That seems to be already checked immediately below:
 
 d = pHba-channel[chan].device[id];
   if(!d || d-tid == 0) {
 return NULL;

Yes, I know, but no message is emitted.  The message seems to be for a
violation of the state machine which device[id] = NULL implies.

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 1/1] dpt_i2o: delete unnecessary null test on array

2014-08-08 Thread Julia Lawall
On Fri, 8 Aug 2014, James Bottomley wrote:

 On Fri, 2014-08-08 at 19:03 +0200, Julia Lawall wrote:
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 67283ef..62e276b 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1169,11 +1169,6 @@ static struct adpt_device* 
adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u6
if(chan  0 || chan = MAX_CHANNEL)
return NULL;
   
-   if( pHba-channel[chan].device == NULL){
-   printk(KERN_DEBUGAdaptec I2O RAID: Trying to find 
device before they are allocated\n);
-   return NULL;
-   }
  
   dpt_i2o is always weirdly fun, but I think, based on the message, this
   check is supposed to be
  
   if( pHba-channel[chan].device[id] == NULL){
  
   Since device is an array of device pointers which are allocated by
   parsing data.
 
  That seems to be already checked immediately below:
 
  d = pHba-channel[chan].device[id];
  if(!d || d-tid == 0) {
  return NULL;

 Yes, I know, but no message is emitted.  The message seems to be for a
 violation of the state machine which device[id] = NULL implies.

OK, if the message seems helpful, then I can split up the tests.

julia
--
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/5] be2iscsi: Update to 10.4.74.0

2014-08-08 Thread Mike Christie
On 08/08/2014 12:00 AM, Jay Kallickal wrote:
 From: Jayamohan Kallickal jayamohan.kallic...@emulex.com
 
  This patchset updates be2iscsi driver to 10.4.74.0
 
 These patches are based on for-next branch of scsi.git.
 
 0001 - Fix the sparse warning  
 0002 - Update the copyright year
 0003 - Fix updating the boot enteries in sysfs
 0004 - Fix processing CQE before freeing connection resources
 0005 - Bump the driver version
 

Patches look ok to me. I am still behind on working on another fix for
4/5 which is more invasive, so that is ok with me.

Reviewed-by: Mike Christie micha...@cs.wisc.edu

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


RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support

2014-08-08 Thread Anish Bhatt
Mike, I presume you meant the
8846bab
scsi_cmnd: Introduce scsi_transfer_length helper
d77e653
libiscsi, iser: Adjust data_length to include protection information

  Martin's fix after that 
5616b0
use the scsi data buffer length to extract transfer size

I see the commits in the branches, but not in master. Do the patches need to be
 rebased onto drivers-for-3.17 then ?
-Anish

From: Anish Bhatt
Sent: Wednesday, August 06, 2014 7:35 PM
To: Mike Christie
Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; 
Karen Xie; Manoj Malviya
Subject: RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support

This patch was made over scsi-devel/master, I'll rebase it to Christoph's tree
-Anish

From: Mike Christie [micha...@cs.wisc.edu]
Sent: Wednesday, August 06, 2014 7:25 PM
To: Anish Bhatt
Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; 
Karen Xie; Manoj Malviya
Subject: Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support

 On 08/06/2014 05:37 PM, Anish Bhatt wrote
 @@ -436,12 +473,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task 
 *task)
   /* No unsolicit Data-Out's */
   hdr-flags |= ISCSI_FLAG_CMD_FINAL;
   } else {
 + unsigned in_len = iscsi_scsi_in_total_length(sc);
   hdr-flags |= ISCSI_FLAG_CMD_FINAL;
   zero_data(hdr-dlength);
 - hdr-data_length = cpu_to_be32(scsi_in(sc)-length);
 -
   if (sc-sc_data_direction == DMA_FROM_DEVICE)
   hdr-flags |= ISCSI_FLAG_CMD_READ;
 + hdr-data_length = cpu_to_be32(in_len);
   }


What tree and branch did you make these over? Have you seen the patches
from Sagi for iser and libiscsi support?

Could you rebuild this over Christoph's tree which has his patches:

git://git.infradead.org/users/hch/scsi-queue.git
--
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