Re: [PATCH v1 5/5] driver-core: add driver asynchronous probe support

2014-09-30 Thread Luis R. Rodriguez
On Sun, Sep 28, 2014 at 12:22:47PM -0700, Dmitry Torokhov wrote:
 Hi Luis,
 
 On Fri, Sep 26, 2014 at 02:57:17PM -0700, Luis R. Rodriguez wrote:
  +static bool drv_enable_async_probe(struct device_driver *drv,
  +  struct bus_type *bus)
  +{
  +   struct module *mod;
  +
  +   if (!drv-owner || drv-sync_probe)
  +   return false;
 
 This bit is one of the biggest issues I have with the patch set. Why async
 probing is limited to modules only?

Because Tejun wanted to address this separately, so its not that we will 
restrict
this but we should have non-module solution added as an evolution on top of 
this,
as a secondary step.

 I mentioned several times that we need
 async probing for built-in drivers and the way you are structuring the flags
 (async by default for modules, possibly opt-out of async for modules, forcibly
 sync for built-in) it is hard to extend the infrastructure for built-in case.

I confess I haven't tried enabling built-in as a secondary step but its just
due to lack of time right now but I don't think impossible and think actually
think it should be fairly trivial. Are there real blockers to do this that
you see as an evolutionary step?

 Also, as far as I can see, you are only considering the case where driver is
 being bound to already registered devices. If you have a module that creates a
 device for a driver that is already loaded and takes long time to probe you
 would still be probing synchronously even if driver/module requested async
 behavior.

Can you provide an example code path hit here? I'll certainly like to address
that as well.

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


Re: [PATCH v1 5/5] driver-core: add driver asynchronous probe support

2014-09-30 Thread Luis R. Rodriguez
On Mon, Sep 29, 2014 at 05:26:01PM -0400, Tejun Heo wrote:
 Hello, Luis.
 
 On Mon, Sep 29, 2014 at 11:22:08PM +0200, Luis R. Rodriguez wrote:
+   /* For now lets avoid stupid bug reports */
+   if (!strcmp(bus-name, pci) ||
+   !strcmp(bus-name, pci_express) ||
+   !strcmp(bus-name, hid) ||
+   !strcmp(bus-name, sdio) ||
+   !strcmp(bus-name, gameport) ||
+   !strcmp(bus-name, mmc) ||
+   !strcmp(bus-name, i2c) ||
+   !strcmp(bus-name, platform) ||
+   !strcmp(bus-name, usb))
+   return true;
   
   Ugh... things like this tend to become permanent.  Do we really need
   this?  And how are we gonna find out what's broken why w/o bug
   reports?
  
  Yeah... well we have two options, one is have something like this to
  at least make it generally useful or remove this and let folks who
  care start fixing async for all modules. The downside to removing
  this is it makes async probe pretty much useless on most systems
  right now, it would mean systemd would have to probably consider
  the list above if they wanted to start using this without expecting
  systems to not work.
 
 So, I'd much prefer blacklist approach if something like this is a
 necessity.  That way, we'd at least know what doesn't work.

For buses? Or do you mean you'd want to wait until we have a decent
list of drivers with the sync probe flag set? If the later it may take
a while to get that list for this to be somewhat useful.

  Luis
--
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] megaraid_sas: Enable shared tag map

2014-09-30 Thread Christoph Hellwig
On Mon, Sep 29, 2014 at 01:47:52PM +0200, Hannes Reinecke wrote:
 Megaraid_sas uses a shared pool of commands per HBA, so we
 should be enabling a shared tag map.
 This will allow the I/O scheduler to make better scheduling
 decisions and will avoid BUSY states in the driver.

What exact problem did you see?  Do you have a link to a bugzilla entry
or similar?  Was this observed on real hardware or your qemu emulation?

 
 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  drivers/scsi/megaraid/megaraid_sas_base.c | 34 
 ++-
  1 file changed, 33 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
 b/drivers/scsi/megaraid/megaraid_sas_base.c
 index f6a69a3..996fa9a 100644
 --- a/drivers/scsi/megaraid/megaraid_sas_base.c
 +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
 @@ -1659,7 +1659,7 @@ static int megasas_slave_configure(struct scsi_device 
 *sdev)
   */
   blk_queue_rq_timeout(sdev-request_queue,
   MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
 -
 + sdev-tagged_supported = 1;

 + /* We have a shared tag map, so TCQ is always supported */
 + sdev-tagged_supported = 1;
 +

Why doesn't the device return the proper data in the INQUIRY response?

And more importantly why do you want to do this twice?

   instance = megasas_lookup_instance(sdev-host-host_no);
   if (sdev-channel  MEGASAS_MAX_PD_CHANNELS) {
   /*
 @@ -1677,13 +1681,20 @@ static int megasas_slave_alloc(struct scsi_device 
 *sdev)
   sdev-id;
   if (instance-pd_list[pd_index].driveState ==
   MR_PD_STATE_SYSTEM) {
 + scsi_activate_tcq(sdev, MEGASAS_DEFAULT_CMD_PER_LUN);
   return 0;
   }
   return -ENXIO;
   }
 + scsi_activate_tcq(sdev, MEGASAS_DEFAULT_CMD_PER_LUN);
   return 0;

Please refactor the code so that the first case falls through to the
second, something like:


if (instance-pd_list[pd_index].driveState !=
MR_PD_STATE_SYSTEM)
return -ENXIO;
}

scsi_activate_tcq(sdev, MEGASAS_DEFAULT_CMD_PER_LUN);
return 0;

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


Re: [PATCH v1 5/5] driver-core: add driver asynchronous probe support

2014-09-30 Thread Luis R. Rodriguez
On Tue, Sep 30, 2014 at 04:27:51AM +0200, Luis R. Rodriguez wrote:
 On Sun, Sep 28, 2014 at 07:07:24PM +0200, Tom Gundersen wrote:
  On Fri, Sep 26, 2014 at 11:57 PM, Luis R. Rodriguez
  mcg...@do-not-panic.com wrote:
   From: Luis R. Rodriguez mcg...@suse.com
   0) Not all drivers are killed, the signal is just sent and
  the kill will only be acted upoon if the driver you loaded
  happens to have some code path that either uses kthreads (which
  as of 786235ee are now killable), or uses some code which checks for
  fatal_signal_pending() on the kernel somewhere -- i.e: pci_read_vpd().
  
  Shouldn't this be seen as something to be fixed in the kernel?
 
 That's a great question. In practice now after CVE-2012-4398 and its series of
 patches added which enabled OOM to kill things followed by 786235ee to also
 handle OOM on kthreads it seems imperative we strive towards this, in practive
 however if you're getting OOMs on boot you have far more serious issue to be
 concerned over than handling CVE-2012-4398. Another issue is that even if we
 wanted to address this a critical right now on module loading driver error
 paths tend to be pretty buggy and we'd probably end up causing more issues 
 than
 fixing anything if the sigkill that triggered this was an arbitrary timeout,
 specially if the timeout is not properly justified.

-- snip --

 So extending the kill onto more drivers *because* of the timeout is probably
 not a good reason as it would probably create more issue than fix anything
 right now.

A bit more on this. Tejun had added devres while trying to convert libata to
use iomap but in that process also help address buggy failure paths on drivers 
[0].
Even with devres in place and devm functions being available they actually
haven't been popularized until recent kernels [1]. There is even further
research on precicely these sorts of errors, such as Hector: Detecting
Resource-Release Omission Faults in error-handling code for systems software 
[2]
but unfortunately there is no data over time. Another paper is An approach to
improving the structure of error-handling code in the Linux kernel [3] which
tries to address moving error handling code in the middle of the function to 
gotos
to shared code at the end of the function...

So we have buggy error paths on drivers and trusting them unfortunately isn't
a good idea at this point. They should be fixed but saying we should equally
kill all drivers right now would likley introduce more issues than anything.

[0] http://lwn.net/Articles/215861/
[1] 
http://www.slideshare.net/ennael/kernel-recipes-2013?qid=f0888b85-377b-4b29-95c3-f4e59822f5b3v=defaultb=from_search=6
See slide 6 on graph usage of devm functions over time
[2] http://coccinelle.lip6.fr/papers/dsn2013.pdf
[3] http://coccinelle.lip6.fr/papers/lctes11.pdf

  Luis
--
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] xen/xenbus: Use 'void' instead of 'int' for the return of xenbus_switch_state()

2014-09-30 Thread Chen Gang
On 9/29/14 22:02, Konrad Rzeszutek Wilk wrote:
 On Sat, Sep 27, 2014 at 12:36:42AM +0800, Chen Gang wrote:
 When xenbus_switch_state() fails, it will call xenbus_switch_fatal()
 
 Only on the first depth, not on the subsequent ones (as in if
 the first xenbus_switch_fail fails, it won't try to call
 xenbus_switch_state again and again).
 

Yeah, I guess you want to give more completion for this comment, do not
mean the original comments is incorrect.

[...]

 Also need be sure that all callers which check the return value must let
 'err' be 0.
 
 I am bit uncomfortable with that, that is due to:
 
 
 .. snip..
 diff --git a/drivers/net/xen-netback/xenbus.c 
 b/drivers/net/xen-netback/xenbus.c
 index 9c47b89..b5c3d47 100644
 --- a/drivers/net/xen-netback/xenbus.c
 +++ b/drivers/net/xen-netback/xenbus.c
 @@ -337,10 +337,7 @@ static int netback_probe(struct xenbus_device *dev,
  if (err)
  pr_debug(Error writing multi-queue-max-queues\n);
  
 -err = xenbus_switch_state(dev, XenbusStateInitWait);
 -if (err)
 -goto fail;
 -
 +xenbus_switch_state(dev, XenbusStateInitWait);
 
 Which if it fails it won't call:
 
 354 fail: 
   
 355 pr_debug(failed\n); 
   
 356 netback_remove(dev);  
   
 357 return err; 
 

Originally, I intended left 'fail' code block for the next patch (which
I thought the next patch would need it).

Hmm... but any way, originally, I really need give additional comments
for it.

[...]

I skip all other contents which have already discussed by maintainers,
if I really miss something, please let me know.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
--
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


targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga

hi everybody,
I write to you for a problem that sound as my simple mistake
but I can't really find a solution after googling and reading
official doc.

I'm trying to configure a iscsi target on a centos 6.5 box with
a custom kernel compiled from vanilla 3.16.3.

I have compile:
CONFIG_TARGET_CORE=m
CONFIG_ISCSI_TARGET=m
CONFIG_CONFIGFS_FS=m

I mount configfs:
# mount | grep config
configfs on /sys/kernel/config type configfs (rw)

manually load iscsi_target_mod (and this show nothing in dmesg)

and when I run targetcli ls command this is the output:
# targetcli ls
o- / 
. [...]
  o- backstores 
.. [...]
  | o- block  [0 
Storage Object]
  | o- fileio ... [0 
Storage Object]
  | o- pscsi  [0 
Storage Object]
  o- loopback .. [0 
Targets]


I can't see o- iscsi so I can't create the iscsi target i need...

# targetcli version
targetcli version 2.0rc1.fb16

$ ls /sys/kernel/config/target/
core  version

# lsmod | grep scsi
iscsi_target_mod  205464  0
target_core_mod   229493  1 iscsi_target_mod
configfs   22151  3 iscsi_target_mod,target_core_mod
scsi_mod   93246  6 
iscsi_target_mod,target_core_mod,sg,sd_mod,sr_mod,libata


any idea of what I can check?

many thanks in advance
Luigi
--
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: targetcli do not show iscsi

2014-09-30 Thread Jerome Martin

Hi Luigi,

I am not 100% sure of that, as you are using the -fb branch, but it 
seems to me you haven't got the /sys/kernel/config/target/iscsi/ 
directory. Normally this is created by the initscript.


Can you either try creating it manually, and/or starting the target 
service susing the initscript ?


Best,
--
Jerome

On 09/30/2014 10:52 AM, Luigi Tarenga wrote:

hi everybody,
I write to you for a problem that sound as my simple mistake
but I can't really find a solution after googling and reading
official doc.

I'm trying to configure a iscsi target on a centos 6.5 box with
a custom kernel compiled from vanilla 3.16.3.

I have compile:
CONFIG_TARGET_CORE=m
CONFIG_ISCSI_TARGET=m
CONFIG_CONFIGFS_FS=m

I mount configfs:
# mount | grep config
configfs on /sys/kernel/config type configfs (rw)

manually load iscsi_target_mod (and this show nothing in dmesg)

and when I run targetcli ls command this is the output:
# targetcli ls
o- /
. [...]
   o- backstores
.. [...]
   | o- block  [0
Storage Object]
   | o- fileio ... [0
Storage Object]
   | o- pscsi  [0
Storage Object]
   o- loopback .. [0
Targets]

I can't see o- iscsi so I can't create the iscsi target i need...

# targetcli version
targetcli version 2.0rc1.fb16

$ ls /sys/kernel/config/target/
core  version

# lsmod | grep scsi
iscsi_target_mod  205464  0
target_core_mod   229493  1 iscsi_target_mod
configfs   22151  3 iscsi_target_mod,target_core_mod
scsi_mod   93246  6
iscsi_target_mod,target_core_mod,sg,sd_mod,sr_mod,libata

any idea of what I can check?

many thanks in advance
Luigi
--
To unsubscribe from this list: send the line unsubscribe target-devel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


Re: targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga

Hi Jerome,
thanks for the promptly reply. I'm not using the -fb branch.
I have installed targetcli from centos rpm:
# rpm -qi fcoe-target-utils-2.0rc1.fb16-5.el6.noarch
Name: fcoe-target-utilsRelocations: (not relocatable)
Version : 2.0rc1.fb16   Vendor: CentOS
Release : 5.el6 Build Date: Fri 22 Nov 2013 
06:52:35 PM CET
Install Date: Mon 29 Sep 2014 03:13:11 PM CEST  Build Host: 
c6b9.bsys.dev.centos.org
Group   : System Environment/Libraries   Source RPM: 
fcoe-target-utils-2.0rc1.fb16-5.el6.src.rpm

Size: 16   License: AGPLv3
Signature   : RSA/SHA1, Sun 24 Nov 2013 08:29:11 PM CET, Key ID 
0946fca2c105b9de

Packager: CentOS BuildSystem http://bugs.centos.org
URL : https://github.com/agrover/targetcli-fb
Summary : An administration shell for FCoE storage targets
Description :
An administration shell for TCM/LIO storage targets, most notably
Fiber Channel over Ethernet (FCoE) targets.

I'm not sure what is the initscript you mention. I have in /etc/init.d/:
# ls fcoe-target iscsi*
fcoe-target  iscsi  iscsid

but afaik those are for the initiatior or fcoe-target...

I tryed to manually create the directory but nothing changed:
# ll /sys/kernel/config/target/
total 0
drwxr-xr-x 3 root root0 Sep 30 10:25 core
drwxr-xr-x 3 root root0 Sep 30 10:59 iscsi
-r--r--r-- 1 root root 4096 Sep 30 10:59 version
[root@lizard init.d]#
[root@lizard init.d]# targetcli ls
o- / 
. 
[...]
  o- backstores 
.. 
[...]
  | o- block 
 
[0 Storage Object]
  | o- fileio 
... 
[0 Storage Object]
  | o- pscsi 
 
[0 Storage Object]
  o- loopback 
.. 
[0 Targets]


the only difference I see is that the module is now used:
iscsi_target_mod  205464  1

and I can't rmmod it.

Luigi

On 09/30/2014 10:56 AM, Jerome Martin wrote:

Hi Luigi,

I am not 100% sure of that, as you are using the -fb branch, but it 
seems to me you haven't got the /sys/kernel/config/target/iscsi/ 
directory. Normally this is created by the initscript.


Can you either try creating it manually, and/or starting the target 
service susing the initscript ?


Best,
--
Jerome

On 09/30/2014 10:52 AM, Luigi Tarenga wrote:

hi everybody,
I write to you for a problem that sound as my simple mistake
but I can't really find a solution after googling and reading
official doc.

I'm trying to configure a iscsi target on a centos 6.5 box with
a custom kernel compiled from vanilla 3.16.3.

I have compile:
CONFIG_TARGET_CORE=m
CONFIG_ISCSI_TARGET=m
CONFIG_CONFIGFS_FS=m

I mount configfs:
# mount | grep config
configfs on /sys/kernel/config type configfs (rw)

manually load iscsi_target_mod (and this show nothing in dmesg)

and when I run targetcli ls command this is the output:
# targetcli ls
o- /
. 
[...]

   o- backstores
.. [...]
   | o- block  [0
Storage Object]
   | o- fileio ... [0
Storage Object]
   | o- pscsi  [0
Storage Object]
   o- loopback .. [0
Targets]

I can't see o- iscsi so I can't create the iscsi target i need...

# targetcli version
targetcli version 2.0rc1.fb16

$ ls /sys/kernel/config/target/
core  version

# lsmod | grep scsi
iscsi_target_mod  205464  0
target_core_mod   229493  1 iscsi_target_mod
configfs   22151  3 iscsi_target_mod,target_core_mod
scsi_mod   93246  6
iscsi_target_mod,target_core_mod,sg,sd_mod,sr_mod,libata

any idea of what I can check?

many thanks in advance
Luigi
--
To unsubscribe from this list: send the line unsubscribe 
target-devel in

the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html


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


Re: [PATCH] megaraid_sas: Enable shared tag map

2014-09-30 Thread Hannes Reinecke
On 09/30/2014 09:43 AM, Christoph Hellwig wrote:
 On Mon, Sep 29, 2014 at 01:47:52PM +0200, Hannes Reinecke wrote:
 Megaraid_sas uses a shared pool of commands per HBA, so we
 should be enabling a shared tag map.
 This will allow the I/O scheduler to make better scheduling
 decisions and will avoid BUSY states in the driver.
 
 What exact problem did you see?  Do you have a link to a bugzilla entry
 or similar?  Was this observed on real hardware or your qemu emulation?
 
Well, _actually_ I just did it so that I could get the tag number
for my printk patchset :-)

But there is an underlying reason:
megaraid_sas uses an internal frame pool of a fixed size.
Once that's exhausted it cannot queue any more commands, and need to
return busy.
But as this is a per-host command pool all LUNs have to shared the
same frame pool, and the driver uses heuristics (ie 1/4 of the pool
size) to set cmd_per_lun. So if you have more than 4 LUNs you'll run
into issues as the pool can become exhausted.
Hence I thought it would be good to expose this to the block layer
so that we can avoid BUSY states in the driver.



 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  drivers/scsi/megaraid/megaraid_sas_base.c | 34 
 ++-
  1 file changed, 33 insertions(+), 1 deletion(-)

 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
 b/drivers/scsi/megaraid/megaraid_sas_base.c
 index f6a69a3..996fa9a 100644
 --- a/drivers/scsi/megaraid/megaraid_sas_base.c
 +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
 @@ -1659,7 +1659,7 @@ static int megasas_slave_configure(struct scsi_device 
 *sdev)
  */
  blk_queue_rq_timeout(sdev-request_queue,
  MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
 -
 +sdev-tagged_supported = 1;
 
 +/* We have a shared tag map, so TCQ is always supported */
 +sdev-tagged_supported = 1;
 +
 
 Why doesn't the device return the proper data in the INQUIRY response?
 
 And more importantly why do you want to do this twice?
 
Bah, Typo.

  instance = megasas_lookup_instance(sdev-host-host_no);
  if (sdev-channel  MEGASAS_MAX_PD_CHANNELS) {
  /*
 @@ -1677,13 +1681,20 @@ static int megasas_slave_alloc(struct scsi_device 
 *sdev)
  sdev-id;
  if (instance-pd_list[pd_index].driveState ==
  MR_PD_STATE_SYSTEM) {
 +scsi_activate_tcq(sdev, MEGASAS_DEFAULT_CMD_PER_LUN);
  return 0;
  }
  return -ENXIO;
  }
 +scsi_activate_tcq(sdev, MEGASAS_DEFAULT_CMD_PER_LUN);
  return 0;
 
 Please refactor the code so that the first case falls through to the
 second, something like:
 
 
   if (instance-pd_list[pd_index].driveState !=
   MR_PD_STATE_SYSTEM)
   return -ENXIO;
   }
 
   scsi_activate_tcq(sdev, MEGASAS_DEFAULT_CMD_PER_LUN);
   return 0;
 
Okay, will be doing it.

Cheers,

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


Re: targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga



I have installed targetcli from centos rpm:
# rpm -qi fcoe-target-utils-2.0rc1.fb16-5.el6.noarch


See the version here? fb16...


oh ok.

I'm not sure what is the initscript you mention. I have in /etc/init.d/:
# ls fcoe-target iscsi*
fcoe-target  iscsi  iscsid

but afaik those are for the initiatior or fcoe-target...


Well, given the name of the redhat package, my best best would be 
fcoe-target :-)




I started it but still no luck, actually I had to comment out 2 module 
loading since I didn't
compiled them (can this be the problem? would be strange since there is 
no module

dependencies...):

load_modules()
{
errmsg=$( /sbin/modprobe configfs 21 ) || return 1
errmsg=$( /sbin/modprobe target_core_mod 21 ) || return 1
#errmsg=$( /sbin/modprobe target_core_pscsi 21 ) || return 1
errmsg=$( /sbin/modprobe target_core_file 21 ) || return 1
#errmsg=$( /sbin/modprobe target_core_iblock 21 ) || return 1

return 0
}



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


Re: [PATCH v1 5/5] driver-core: add driver asynchronous probe support

2014-09-30 Thread Tom Gundersen
On Tue, Sep 30, 2014 at 4:27 AM, Luis R. Rodriguez mcg...@suse.com wrote:
 On Sun, Sep 28, 2014 at 07:07:24PM +0200, Tom Gundersen wrote:
 On Fri, Sep 26, 2014 at 11:57 PM, Luis R. Rodriguez
 mcg...@do-not-panic.com wrote:
  From: Luis R. Rodriguez mcg...@suse.com
  Systemd has a general timeout for all workers currently set to 180
  seconds after which it will send a sigkill signal. Systemd now has a
  warning which is issued once it reaches 1/3 of the timeout. The original
  motivation for the systemd timeout was to help track device drivers
  which do not use asynch firmware loading on init() and the timeout was
  originally set to 30 seconds.

 Please note that the motivation for the timeout in systemd had nothing
 to do with async firmware loading (that was just the case where
 problems cropped up).

 *Part *of the original kill logic, according to the commit log, was actually
 due to the assumption that the issues observed *were* synchronous firmware
 loading on module init():

 commit e64fae5573e566ce4fd9b23c68ac8f3096603314
 Author: Kay Sievers kay.siev...@vrfy.org
 Date:   Wed Jan 18 05:06:18 2012 +0100

 udevd: kill hanging event processes after 30 seconds

 Some broken kernel drivers load firmware synchronously in the module init
 path and block modprobe until the firmware request is fulfilled.
 ...

This was a workaround to avoid a deadlock between udev and the kernel.
The 180 s timeout was already in place before this change, and was not
motivated by firmware loading. Also note that this patch was not about
tracking device drivers, just about avoiding dead-lock.

 My point here is not to point fingers but to explain why we went on with
 this and how we failed to realize only until later that the driver core
 ran probe together with init. When a few folks pointed out the issues
 with the kill the issue was punted back to kernel developers and the
 assumption even among some kernel maintainers was that it was init paths
 with sync behaviour that was causing some delays and they were broken
 drivers. It is important to highlight these assumptions ended up setting
 us off on the wrong path for a while in a hunt to try to fix this issue
 either in driver or elsewhere.

Ok. I'm not sure the motivations for user-space changes is important
to include in the commit message, but if you do I'll try to clarify
things to avoid misunderstandings.

 Thanks for clarifying this, can you explain what issues could arise
 from making an exception to allowing kmod workers to hang around
 completing init + probe over a certain defined amount of time without
 being killed?

We could run out of udev workers and the whole boot would hang.

The way I see it, the current status from systemd's side is: our
short-term work-around is to increase the timeout, and at the moment
it appears no long-term solution is needed (i.e., it seems like the
right thing to do is to make sure insmod can be near instantaneous, it
appears people are working towards this goal, and so far no examples
have cropped up showing that it is fundamentally impossible (once/if
they do, we should of course revisit the problem)).

Cheers,

Tom
--
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: targetcli do not show iscsi

2014-09-30 Thread Jerome Martin

Luigi,

Out of curiosity, does it work as expected with the stock fedora 
packaged kernel ?


Best,
--
Jerome

On 09/30/2014 11:20 AM, Luigi Tarenga wrote:



I have installed targetcli from centos rpm:
# rpm -qi fcoe-target-utils-2.0rc1.fb16-5.el6.noarch


See the version here? fb16...


oh ok.

I'm not sure what is the initscript you mention. I have in /etc/init.d/:
# ls fcoe-target iscsi*
fcoe-target  iscsi  iscsid

but afaik those are for the initiatior or fcoe-target...


Well, given the name of the redhat package, my best best would be
fcoe-target :-)



I started it but still no luck, actually I had to comment out 2 module
loading since I didn't
compiled them (can this be the problem? would be strange since there is
no module
dependencies...):

load_modules()
{
 errmsg=$( /sbin/modprobe configfs 21 ) || return 1
 errmsg=$( /sbin/modprobe target_core_mod 21 ) || return 1
 #errmsg=$( /sbin/modprobe target_core_pscsi 21 ) || return 1
 errmsg=$( /sbin/modprobe target_core_file 21 ) || return 1
 #errmsg=$( /sbin/modprobe target_core_iblock 21 ) || return 1

 return 0
}



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

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


Re: targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga


On 09/30/2014 11:28 AM, Jerome Martin wrote:

Luigi,

Out of curiosity, does it work as expected with the stock fedora 
packaged kernel ?


Best,
--
Jerome



didn't test that configuration and since I can't find module 
iscsi_target_mod in stock
kernel I would have to recompile it against centos kernel. It's worth 
trying?


btw, I saw that after loading the module and manually create the iscsi 
directory this

content automatically appear:

# ll /sys/kernel/config/target/iscsi/
total 0
drwxr-xr-x 2 root root0 Sep 30 11:38 discovery_auth
-r--r--r-- 1 root root 4096 Sep 30 11:39 lio_version

I start suspecting a problem with targetcli or  configshell. I 
regenerated the log.txt file:


# targetcli /iscsi info
No such path /iscsi

# cat log.txt
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/shell.py:932 run_cmdline() 
Running command line '/iscsi info'.
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/shell.py:837 
_parse_cmdline() Parsing commandline.
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/shell.py:844 
_parse_cmdline() [('path', 0, 6, []), ('command', 7, 11, None)]
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/shell.py:848 
_parse_cmdline() Found path token /iscsi.
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/shell.py:848 
_parse_cmdline() Found command token info.
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/shell.py:861 
_parse_cmdline() Parse gave path='/iscsi' command='info' pparams=[] 
kparams={}
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/node.py:1857 get_node() 
Looking for path '/iscsi'
[DEBUG] 2014-30-09 11:40:52 
/usr/lib/python2.6/site-packages/configshell/node.py:1857 get_node() 
Looking for path 'iscsi'

[ERROR] 2014-30-09 11:40:52 No such path /iscsi

Luigi
--
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: targetcli do not show iscsi

2014-09-30 Thread Jerome Martin



On 09/30/2014 11:41 AM, Luigi Tarenga wrote:


On 09/30/2014 11:28 AM, Jerome Martin wrote:

Luigi,

Out of curiosity, does it work as expected with the stock fedora
packaged kernel ?

Best,
--
Jerome



didn't test that configuration and since I can't find module
iscsi_target_mod in stock


ok


kernel I would have to recompile it against centos kernel. It's worth
trying?


Sure :-)



btw, I saw that after loading the module and manually create the iscsi
directory this
content automatically appear:

# ll /sys/kernel/config/target/iscsi/
total 0
drwxr-xr-x 2 root root0 Sep 30 11:38 discovery_auth
-r--r--r-- 1 root root 4096 Sep 30 11:39 lio_version


Yes, it means that the iscsi module is correctly loaded.



I start suspecting a problem with targetcli or  configshell. I
regenerated the log.txt file:


Yes, as I said earlier I'll have to reproduce your setup and/or wait for 
Andy to come around.




# targetcli /iscsi info
No such path /iscsi

# cat log.txt
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/shell.py:932 run_cmdline()
Running command line '/iscsi info'.
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/shell.py:837
_parse_cmdline() Parsing commandline.
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/shell.py:844
_parse_cmdline() [('path', 0, 6, []), ('command', 7, 11, None)]
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/shell.py:848
_parse_cmdline() Found path token /iscsi.
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/shell.py:848
_parse_cmdline() Found command token info.
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/shell.py:861
_parse_cmdline() Parse gave path='/iscsi' command='info' pparams=[]
kparams={}
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/node.py:1857 get_node()
Looking for path '/iscsi'
[DEBUG] 2014-30-09 11:40:52
/usr/lib/python2.6/site-packages/configshell/node.py:1857 get_node()
Looking for path 'iscsi'
[ERROR] 2014-30-09 11:40:52 No such path /iscsi

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

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


Re: [PATCH] xen/xenbus: Use 'void' instead of 'int' for the return of xenbus_switch_state()

2014-09-30 Thread David Vrabel
On 26/09/14 17:36, Chen Gang wrote:
 When xenbus_switch_state() fails, it will call xenbus_switch_fatal()
 internally, so need not return any status value, then use 'void' instead
 of 'int' for xenbus_switch_state() and __xenbus_switch_state().
 
 Also need be sure that all callers which check the return value must let
 'err' be 0.
 
 And also need change the related comments for xenbus_switch_state().

Since this patch does not fix a bug and there is no unanimous agreement
on the API change I'm not going to apply it (nor the previous version).

David

--
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] xen/xenbus: Use 'void' instead of 'int' for the return of xenbus_switch_state()

2014-09-30 Thread Chen Gang
On 9/30/14 17:55, David Vrabel wrote:
 On 26/09/14 17:36, Chen Gang wrote:
 When xenbus_switch_state() fails, it will call xenbus_switch_fatal()
 internally, so need not return any status value, then use 'void' instead
 of 'int' for xenbus_switch_state() and __xenbus_switch_state().

 Also need be sure that all callers which check the return value must let
 'err' be 0.

 And also need change the related comments for xenbus_switch_state().
 
 Since this patch does not fix a bug and there is no unanimous agreement
 on the API change I'm not going to apply it (nor the previous version).
 

OK, at least for me, it is no problems.

But I still recommend to improve it in the future, it is not a good idea
to let all related things remain in current condition (for me, at lease
need some related code comments for it).


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
--
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 85151] pm80xx + 7805H + HP SAS port expander = mpi_smp_completion 2604:smp IO status 0x2 and sas: expander ... discovery failed(0xffffffa6)

2014-09-30 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=85151

--- Comment #10 from linux-...@crashplan.pro ---
After splitting module loading and connecting the expander, and enabling
verbose pm80xx logging in between:

1. disconnect cable
2. modprobe pm80xx
3. # echo 0xfff  $(find /sys -iname logging_level)
4. verify new verbose logging level: # cat $(find /sys -iname logging_level)
0fffh
5. plug cable

The new verbose dmesg output when connecting the HP Expander SAS Card
[468406-B21, 487738-001]:

[ 1642.564117] pm80xx pm8001_mpi_msg_consume 1450:: CI=11 PI=15
msgHeader=81002700
[ 1642.564580] pm80xx process_one_iomb 3464:OPC_OUB_HW_EVENT
[ 1642.565045] pm80xx mpi_hw_event 3106:portid:0 phyid:0 event:0x4 status:0x0
[ 1642.565551] pm80xx mpi_hw_event 3112:HW_EVENT_PHY_START_STATUS
[ 1642.566074] pm80xx hw_event_sas_phy_up 2863:portid:0; phyid:0; linkrate:4;
portstate:1; devicetype:2
[ 1642.59] pm80xx hw_event_sas_phy_up 2879:expander device.
[ 1642.567281] pm80xx pm8001_bytes_dmaed 3246:phy 0 byte dmaded.
[ 1642.567913] pm80xx pm8001_mpi_msg_free_set 1407: CI=12 PI=15
[ 1642.568563] pm80xx pm8001_mpi_msg_consume 1450:: CI=12 PI=15
msgHeader=81002700
[ 1642.569241] pm80xx process_one_iomb 3464:OPC_OUB_HW_EVENT
[ 1642.569943] pm80xx mpi_hw_event 3106:portid:0 phyid:1 event:0x4 status:0x0
[ 1642.570687] pm80xx mpi_hw_event 3112:HW_EVENT_PHY_START_STATUS
[ 1642.571451] pm80xx hw_event_sas_phy_up 2863:portid:0; phyid:1; linkrate:4;
portstate:1; devicetype:2
[ 1642.572286] pm80xx hw_event_sas_phy_up 2879:expander device.
[ 1642.573132] pm80xx pm8001_bytes_dmaed 3246:phy 1 byte dmaded.
[ 1642.574004] pm80xx pm8001_mpi_msg_free_set 1407: CI=13 PI=15
[ 1642.574895] pm80xx pm8001_mpi_msg_consume 1450:: CI=13 PI=15
msgHeader=81002700
[ 1642.575818] pm80xx process_one_iomb 3464:OPC_OUB_HW_EVENT
[ 1642.576761] pm80xx mpi_hw_event 3106:portid:0 phyid:2 event:0x4 status:0x0
[ 1642.577748] pm80xx mpi_hw_event 3112:HW_EVENT_PHY_START_STATUS
[ 1642.578755] pm80xx hw_event_sas_phy_up 2863:portid:0; phyid:2; linkrate:4;
portstate:1; devicetype:2
[ 1642.579835] pm80xx hw_event_sas_phy_up 2879:expander device.
[ 1642.580924] pm80xx pm8001_bytes_dmaed 3246:phy 2 byte dmaded.
[ 1642.582039] pm80xx pm8001_mpi_msg_free_set 1407: CI=14 PI=15
[ 1642.583175] pm80xx pm8001_mpi_msg_consume 1450:: CI=14 PI=15
msgHeader=81002700
[ 1642.584339] pm80xx process_one_iomb 3464:OPC_OUB_HW_EVENT
[ 1642.585525] pm80xx mpi_hw_event 3106:portid:0 phyid:3 event:0x4 status:0x0
[ 1642.586756] pm80xx mpi_hw_event 3112:HW_EVENT_PHY_START_STATUS
[ 1642.588006] pm80xx hw_event_sas_phy_up 2863:portid:0; phyid:3; linkrate:4;
portstate:1; devicetype:2
[ 1642.589325] pm80xx hw_event_sas_phy_up 2879:expander device.
[ 1642.590821] pm80xx pm8001_bytes_dmaed 3246:phy 3 byte dmaded.
[ 1642.592350] pm80xx pm8001_mpi_msg_free_set 1407: CI=15 PI=15
[ 1642.594488] sas: phy-4:0 added to port-4:0, phy_mask:0x1 (5001438023aad066)
[ 1642.596212] sas: phy-4:1 added to port-4:1, phy_mask:0x2 (5001438023aad066)
[ 1642.598079] sas: phy-4:2 added to port-4:2, phy_mask:0x4 (5001438023aad066)
[ 1642.599804] sas: phy-4:3 added to port-4:3, phy_mask:0x8 (5001438023aad066)
[ 1642.601494] sas: DOING DISCOVERY on port 0, pid:137
[ 1642.603161] pm80xx pm8001_dev_found_notify 643:Found device
[ 1642.604698] pm80xx pm8001_mpi_build_cmd 1368:INB Q 0 OPCODE:32 , UPDATED
PI=12 CI=11
[ 1642.606242] pm80xx pm8001_mpi_msg_consume 1450:: CI=15 PI=16
msgHeader=81002832
[ 1642.607848] pm80xx process_one_iomb 3489:OPC_OUB_DEV_REGIST
[ 1642.609443] pm80xx pm8001_mpi_reg_resp 3552: register device is status = 0
[ 1642.611074] pm80xx pm8001_mpi_reg_resp 3555:DEVREG_SUCCESS
[ 1642.612720] pm80xx pm8001_mpi_msg_free_set 1407: CI=16 PI=16
[ 1642.614386] pm80xx pm8001_task_exec 375:pm8001_task_exec device
[ 1642.614386]
[ 1642.614386] pm80xx pm80xx_chip_smp_req 3768:SMP Frame Length 8
[ 1642.619030] pm80xx pm80xx_chip_smp_req 3814:SMP REQUEST DIRECT MODE
[ 1642.620612] pm80xx pm80xx_chip_smp_req 3821:Byte[0]:40 (DMA data:40)
[ 1642.622209] pm80xx pm80xx_chip_smp_req 3821:Byte[1]:0 (DMA data:40)
[ 1642.623813] pm80xx pm80xx_chip_smp_req 3821:Byte[2]:0 (DMA data:40)
[ 1642.625417] pm80xx pm80xx_chip_smp_req 3821:Byte[3]:0 (DMA data:40)
[ 1642.626891] pm80xx pm80xx_chip_smp_req 3821:Byte[4]:0 (DMA data:40)
[ 1642.628352] pm80xx pm80xx_chip_smp_req 3821:Byte[5]:0 (DMA data:40)
[ 1642.629812] pm80xx pm80xx_chip_smp_req 3821:Byte[6]:0 (DMA data:40)
[ 1642.631273] pm80xx pm80xx_chip_smp_req 3821:Byte[7]:0 (DMA data:40)
[ 1642.632736] pm80xx pm8001_mpi_build_cmd 1368:INB Q 0 OPCODE:12 , UPDATED
PI=13 CI=12
[ 1642.634242] pm80xx pm8001_mpi_msg_consume 1450:: CI=16 PI=17
msgHeader=81002006
[ 1642.635782] pm80xx process_one_iomb 3479:OPC_OUB_SMP_COMP
[ 1642.637327] pm80xx mpi_smp_completion 2611:IO_SUCCESS
[ 1642.638886] pm80xx mpi_smp_completion 2619:DIRECT RESPONSE Length:28
[ 1642.640469] pm80xx mpi_smp_completion 2628:SMP Byte0 DMA data 0x41 psmp 0x41
[ 1642.642072] pm80xx mpi_smp_completion 2628:SMP Byte1 DMA 

Re: [PATCH] scsi_host: fix comment

2014-09-30 Thread Bart Van Assche

On 09/20/14 13:37, Sebastian Herbszt wrote:

Commit 1abf635 (scsi: use 64-bit value for 'max_luns') changed the order
of Scsi_Host members. Update the comment to reflect this.

Signed-off-by: Sebastian Herbszt herb...@gmx.de

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index ba20347..d4e0509 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -603,13 +603,13 @@ struct Scsi_Host {
unsigned long last_reset;


/*
 * These three parameters can be used to allow for wide scsi,
 * and for host adapters that support multiple busses
-* The first two should be set to 1 more than the actual max id
+* The last two should be set to 1 more than the actual max id
 * or lun (e.g. 8 for SCSI parallel systems).
 */
unsigned int max_channel;
unsigned int max_id;
u64 max_lun;


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


Re: [PATCH] scsi_host: fix comment

2014-09-30 Thread Hannes Reinecke
On 09/30/2014 01:13 PM, Bart Van Assche wrote:
 On 09/20/14 13:37, Sebastian Herbszt wrote:
 Commit 1abf635 (scsi: use 64-bit value for 'max_luns') changed the
 order
 of Scsi_Host members. Update the comment to reflect this.

 Signed-off-by: Sebastian Herbszt herb...@gmx.de

 diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
 index ba20347..d4e0509 100644
 --- a/include/scsi/scsi_host.h
 +++ b/include/scsi/scsi_host.h
 @@ -603,13 +603,13 @@ struct Scsi_Host {
   unsigned long last_reset;


   /*
* These three parameters can be used to allow for wide scsi,
* and for host adapters that support multiple busses
 - * The first two should be set to 1 more than the actual max id
 + * The last two should be set to 1 more than the actual max id
* or lun (e.g. 8 for SCSI parallel systems).
*/
   unsigned int max_channel;
   unsigned int max_id;
   u64 max_lun;
 
 Reviewed-by: Bart Van Assche bvanass...@acm.org
Reviewed-by: Hannes Reinecke h...@suse.de

Cheers,

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


[PATCH 02/23] sd: Remove scsi_print_sense() in sd_done()

2014-09-30 Thread Hannes Reinecke
sd_done() was calling scsi_print_sense() for a sense code
of 'NO_SENSE'.

Reviewed-by: Christoph Hellwig h...@infradead.org
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/sd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0cb5c9f..0ccb459 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1730,7 +1730,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 * unknown amount of data was transferred so treat it as an
 * error.
 */
-   scsi_print_sense(sd, SCpnt);
SCpnt-result = 0;
memset(SCpnt-sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
break;
-- 
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 14/23] scsi: merge print_opcode_name()

2014-09-30 Thread Hannes Reinecke
Instead of having two versions of print_opcode_name() we
should be consolidating them into one version.

Reviewed-by: Christoph Hellwig h...@lst.de
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 90 ++--
 1 file changed, 34 insertions(+), 56 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index bbe32ba..c1cdfab 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -30,6 +30,11 @@
 #define THIRD_PARTY_COPY_IN 0x84
 
 
+struct sa_name_list {
+   int cmd;
+   const struct value_name_pair *arr;
+   int arr_sz;
+};
 
 #ifdef CONFIG_SCSI_CONSTANTS
 static const char * cdb_byte0_names[] = {
@@ -244,12 +249,6 @@ static const struct value_name_pair variable_length_arr[] 
= {
 };
 #define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr)
 
-struct sa_name_list {
-   int cmd;
-   const struct value_name_pair *arr;
-   int arr_sz;
-};
-
 static struct sa_name_list sa_names_arr[] = {
{VARIABLE_LENGTH_CMD, variable_length_arr, VARIABLE_LENGTH_SZ},
{MAINTENANCE_IN, maint_in_arr, MAINT_IN_SZ},
@@ -266,6 +265,26 @@ static struct sa_name_list sa_names_arr[] = {
{0, NULL, 0},
 };
 
+#else /* ifndef CONFIG_SCSI_CONSTANTS */
+static const char *cdb_byte0_names[];
+
+static struct sa_name_list sa_names_arr[] = {
+   {VARIABLE_LENGTH_CMD, NULL, 0},
+   {MAINTENANCE_IN, NULL, 0},
+   {MAINTENANCE_OUT, NULL, 0},
+   {PERSISTENT_RESERVE_IN, NULL, 0},
+   {PERSISTENT_RESERVE_OUT, NULL, 0},
+   {SERVICE_ACTION_IN_12, NULL, 0},
+   {SERVICE_ACTION_OUT_12, NULL, 0},
+   {SERVICE_ACTION_BIDIRECTIONAL, NULL, 0},
+   {SERVICE_ACTION_IN_16, NULL, 0},
+   {SERVICE_ACTION_OUT_16, NULL, 0},
+   {THIRD_PARTY_COPY_IN, NULL, 0},
+   {THIRD_PARTY_COPY_OUT, NULL, 0},
+   {0, NULL, 0},
+};
+#endif /* CONFIG_SCSI_CONSTANTS */
+
 static bool scsi_opcode_sa_name(int cmd, int service_action,
const char **sa_name)
 {
@@ -273,7 +292,7 @@ static bool scsi_opcode_sa_name(int cmd, int service_action,
const struct value_name_pair *arr = NULL;
int arr_sz, k;
 
-   for (k = 0; sa_name_ptr-arr; ++k, ++sa_name_ptr) {
+   for (k = 0; k  ARRAY_SIZE(sa_names_arr); ++k, ++sa_name_ptr) {
if (sa_name_ptr-cmd == cmd) {
arr = sa_name_ptr-arr;
arr_sz = sa_name_ptr-arr_sz;
@@ -315,11 +334,14 @@ static void print_opcode_name(unsigned char * cdbp, int 
cdb_len)
 
if (!scsi_opcode_sa_name(cdb0, sa, name)) {
if (cdb0  0xc0) {
-   name = cdb_byte0_names[cdb0];
-   if (name)
-   printk(%s, name);
-   else
-   printk(cdb[0]=0x%x (reserved), cdb0);
+   if (ARRAY_SIZE(cdb_byte0_names)) {
+   name = cdb_byte0_names[cdb0];
+   if (name)
+   printk(%s, name);
+   else
+   printk(cdb[0]=0x%x (reserved), cdb0);
+   } else
+   printk(cdb[0]=0x%x, cdb0);
} else
printk(cdb[0]=0x%x (vendor), cdb0);
} else {
@@ -333,50 +355,6 @@ static void print_opcode_name(unsigned char * cdbp, int 
cdb_len)
}
 }
 
-#else /* ifndef CONFIG_SCSI_CONSTANTS */
-
-static void print_opcode_name(unsigned char * cdbp, int cdb_len)
-{
-   int sa, len, cdb0;
-
-   cdb0 = cdbp[0];
-   switch(cdb0) {
-   case VARIABLE_LENGTH_CMD:
-   len = scsi_varlen_cdb_length(cdbp);
-   if (len  10) {
-   printk(short opcode=0x%x command, len=%d 
-  ext_len=%d, cdb0, len, cdb_len);
-   break;
-   }
-   sa = (cdbp[8]  8) + cdbp[9];
-   printk(cdb[0]=0x%x, sa=0x%x, cdb0, sa);
-   if (len != cdb_len)
-   printk(, in_cdb_len=%d, ext_len=%d, len, cdb_len);
-   break;
-   case MAINTENANCE_IN:
-   case MAINTENANCE_OUT:
-   case PERSISTENT_RESERVE_IN:
-   case PERSISTENT_RESERVE_OUT:
-   case SERVICE_ACTION_IN_12:
-   case SERVICE_ACTION_OUT_12:
-   case SERVICE_ACTION_BIDIRECTIONAL:
-   case SERVICE_ACTION_IN_16:
-   case SERVICE_ACTION_OUT_16:
-   case THIRD_PARTY_COPY_IN:
-   case THIRD_PARTY_COPY_OUT:
-   sa = cdbp[1]  0x1f;
-   printk(cdb[0]=0x%x, sa=0x%x, cdb0, sa);
-   break;
-   default:
-   if (cdb0  0xc0)
-   printk(cdb[0]=0x%x, cdb0);
-   else
-   printk(cdb[0]=0x%x (vendor), cdb0);
-   break;
-   }
-}
-#endif
-
 void 

[PATCH 07/23] fas216: Update logging messages

2014-09-30 Thread Hannes Reinecke
Update logging messages to use dev_printk() variants for correct
device annotations.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/arm/fas216.c | 31 ++-
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 71cfb1e..b2fd18e 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -308,8 +308,7 @@ static void fas216_log_command(FAS216_Info *info, int level,
fas216_do_log(info, '0' + SCpnt-device-id, fmt, args);
va_end(args);
 
-   printk( CDB: );
-   __scsi_print_command(SCpnt-cmnd);
+   scsi_print_command(SCpnt);
 }
 
 static void
@@ -2079,14 +2078,13 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd 
*SCpnt, unsigned int result)
break;
 
default:
-   printk(KERN_ERR scsi%d.%c: incomplete data transfer 
-   detected: res=%08X ptr=%p len=%X CDB: ,
-   info-host-host_no, '0' + SCpnt-device-id,
-   SCpnt-result, info-scsi.SCp.ptr,
-   info-scsi.SCp.this_residual);
-   __scsi_print_command(SCpnt-cmnd);
-   SCpnt-result = ~(255  16);
-   SCpnt-result |= DID_BAD_TARGET  16;
+   scmd_printk(KERN_ERR, SCpnt,
+   incomplete data transfer 
+   detected: res=%08X ptr=%p len=%X\n,
+   SCpnt-result, info-scsi.SCp.ptr,
+   info-scsi.SCp.this_residual);
+   scsi_print_command(SCpnt);
+   set_host_byte(SCpnt, DID_ERROR);
goto request_sense;
}
}
@@ -2158,12 +2156,12 @@ static void fas216_done(FAS216_Info *info, unsigned int 
result)
 * to transfer, we should not have a valid pointer.
 */
if (info-scsi.SCp.ptr  info-scsi.SCp.this_residual == 0) {
-   printk(scsi%d.%c: zero bytes left to transfer, but 
-  buffer pointer still valid: ptr=%p len=%08x CDB: ,
-  info-host-host_no, '0' + SCpnt-device-id,
-  info-scsi.SCp.ptr, info-scsi.SCp.this_residual);
+   scmd_printk(KERN_INFO, SCpnt,
+   zero bytes left to transfer, but 
+   buffer pointer still valid: ptr=%p len=%08x\n,
+   info-scsi.SCp.ptr, info-scsi.SCp.this_residual);
info-scsi.SCp.ptr = NULL;
-   __scsi_print_command(SCpnt-cmnd);
+   scsi_print_command(SCpnt);
}
 
/*
@@ -2664,8 +2662,7 @@ int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
 
fas216_checkmagic(info);
 
-   printk(scsi%d.%c: %s: resetting host\n,
-   info-host-host_no, '0' + SCpnt-device-id, __func__);
+   fas216_log(info, LOG_ERROR, resetting host);
 
/*
 * Reset the SCSI chip.
-- 
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 21/23] scsi: fixup logging messages in scsi_error.c

2014-09-30 Thread Hannes Reinecke
Use the matching scope for logging messages to allow for
better command tracing.

Suggested-by: Robert Elliott elli...@hp.com
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/hosts.c  |  4 +--
 drivers/scsi/scsi_error.c | 82 +--
 2 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 6de80e3..06030e1 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -485,8 +485,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template 
*sht, int privsize)
WQ_UNBOUND | WQ_MEM_RECLAIM,
   1, shost-host_no);
if (!shost-tmf_work_q) {
-   printk(KERN_WARNING scsi%d: failed to create tmf workq\n,
-  shost-host_no);
+   shost_printk(KERN_WARNING, shost,
+failed to create tmf workq\n);
goto fail_kthread;
}
scsi_proc_hostdir_add(shost-hostt);
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 8a6d382..4d3f55c 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1156,9 +1156,10 @@ int scsi_eh_get_sense(struct list_head *work_q,
shost = scmd-device-host;
if (scsi_host_eh_past_deadline(shost)) {
SCSI_LOG_ERROR_RECOVERY(3,
-   shost_printk(KERN_INFO, shost,
-   skip %s, past eh deadline\n,
-__func__));
+   scmd_printk(KERN_INFO, scmd,
+   %s: skip request sense, 
+past eh deadline\n,
+current-comm));
break;
}
if (status_byte(scmd-result) != CHECK_CONDITION)
@@ -1265,9 +1266,10 @@ static int scsi_eh_test_devices(struct list_head 
*cmd_list,
/* Push items back onto work_q */
list_splice_init(cmd_list, work_q);
SCSI_LOG_ERROR_RECOVERY(3,
-   shost_printk(KERN_INFO, sdev-host,
-skip %s, past eh 
deadline,
-__func__));
+   sdev_printk(KERN_INFO, sdev,
+   %s: skip test device, 
+   past eh deadline,
+   current-comm));
break;
}
}
@@ -1318,21 +1320,22 @@ static int scsi_eh_abort_cmds(struct list_head *work_q,
if (scsi_host_eh_past_deadline(shost)) {
list_splice_init(check_list, work_q);
SCSI_LOG_ERROR_RECOVERY(3,
-   shost_printk(KERN_INFO, shost,
-   skip %s, past eh deadline\n,
-__func__));
+   scmd_printk(KERN_INFO, scmd,
+   %s: skip aborting cmd, 
+   past eh deadline\n,
+   current-comm));
return list_empty(work_q);
}
SCSI_LOG_ERROR_RECOVERY(3,
-   shost_printk(KERN_INFO, shost,
-%s: aborting cmd: 0x%p\n,
+   scmd_printk(KERN_INFO, scmd,
+%s: aborting cmd\n,
 current-comm, scmd));
rtn = scsi_try_to_abort_cmd(shost-hostt, scmd);
if (rtn == FAILED) {
SCSI_LOG_ERROR_RECOVERY(3,
-   shost_printk(KERN_INFO, shost,
-%s: aborting cmd failed: 0x%p\n,
-current-comm, scmd));
+   scmd_printk(KERN_INFO, scmd,
+   %s: aborting cmd failed\n,
+current-comm));
list_splice_init(check_list, work_q);
return list_empty(work_q);
}
@@ -1390,9 +1393,10 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
shost_for_each_device(sdev, shost) {
if (scsi_host_eh_past_deadline(shost)) {
SCSI_LOG_ERROR_RECOVERY(3,
-   shost_printk(KERN_INFO, shost,
-   skip %s, past 

[PATCH 01/23] Remove scsi_cmd_print_sense_hdr()

2014-09-30 Thread Hannes Reinecke
Unused.

Reviewed-by: Christoph Hellwig h...@infradead.org
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 14 --
 include/scsi/scsi_dbg.h  |  2 --
 2 files changed, 16 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index d35a5d6..2f44707 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1428,20 +1428,6 @@ scsi_print_sense_hdr(const char *name, struct 
scsi_sense_hdr *sshdr)
 }
 EXPORT_SYMBOL(scsi_print_sense_hdr);
 
-/*
- * Print normalized SCSI sense header with device information and a prefix.
- */
-void
-scsi_cmd_print_sense_hdr(struct scsi_cmnd *scmd, const char *desc,
- struct scsi_sense_hdr *sshdr)
-{
-   scmd_printk(KERN_INFO, scmd, %s: , desc);
-   scsi_show_sense_hdr(sshdr);
-   scmd_printk(KERN_INFO, scmd, %s: , desc);
-   scsi_show_extd_sense(sshdr-asc, sshdr-ascq);
-}
-EXPORT_SYMBOL(scsi_cmd_print_sense_hdr);
-
 static void
 scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len,
   struct scsi_sense_hdr *sshdr)
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index e89844c..5a43a4c 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -9,8 +9,6 @@ extern void __scsi_print_command(unsigned char *);
 extern void scsi_show_extd_sense(unsigned char, unsigned char);
 extern void scsi_show_sense_hdr(struct scsi_sense_hdr *);
 extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
-extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *,
-struct scsi_sense_hdr *);
 extern void scsi_print_sense(char *, struct scsi_cmnd *);
 extern void __scsi_print_sense(const char *name,
   const unsigned char *sense_buffer,
-- 
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 18/23] scsi: separate out scsi_(host|driver)byte_string()

2014-09-30 Thread Hannes Reinecke
Export functions for later use.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 58 
 include/scsi/scsi_dbg.h  |  2 ++
 2 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 713e1e0..d3e1900 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1404,38 +1404,68 @@ static const char * const hostbyte_table[]={
 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(int result)
+#endif
+
+const char *scsi_hostbyte_string(int result)
 {
+   const char *hb_string = NULL;
+#ifdef CONFIG_SCSI_CONSTANTS
int hb = host_byte(result);
-   int db = driver_byte(result);
 
-   printk(Result: hostbyte=%s driverbyte=%s\n,
-  (hb  NUM_HOSTBYTE_STRS ? hostbyte_table[hb] : invalid),
-  (db  NUM_DRIVERBYTE_STRS ? driverbyte_table[db] : invalid));
+   if (hb  ARRAY_SIZE(hostbyte_table))
+   hb_string = hostbyte_table[hb];
+#endif
+   return hb_string;
 }
+EXPORT_SYMBOL(scsi_hostbyte_string);
 
-#else
+const char *scsi_driverbyte_string(int result)
+{
+   const char *db_string = NULL;
+#ifdef CONFIG_SCSI_CONSTANTS
+   int db = driver_byte(result);
+
+   if (db  ARRAY_SIZE(driverbyte_table))
+   db_string = driverbyte_table[db];
+#endif
+   return db_string;
+}
+EXPORT_SYMBOL(scsi_driverbyte_string);
 
 void scsi_show_result(int result)
 {
-   printk(Result: hostbyte=0x%02x driverbyte=0x%02x\n,
-  host_byte(result), driver_byte(result));
-}
+   const char *hb_string = scsi_hostbyte_string(result);
+   const char *db_string = scsi_driverbyte_string(result);
 
-#endif
+   if (hb_string || db_string)
+   printk(Result: hostbyte=%s driverbyte=%s\n,
+  hb_string ? hb_string : invalid,
+  db_string ? db_string : invalid);
+   else
+   printk(Result: hostbyte=0x%02x driverbyte=0x%02x\n,
+  host_byte(result), driver_byte(result));
+}
 EXPORT_SYMBOL(scsi_show_result);
 
 
 void scsi_print_result(struct scsi_cmnd *cmd)
 {
-   scmd_printk(KERN_INFO, cmd,  );
-   scsi_show_result(cmd-result);
+   const char *hb_string = scsi_hostbyte_string(cmd-result);
+   const char *db_string = scsi_driverbyte_string(cmd-result);
+
+   if (hb_string || db_string)
+   scmd_printk(KERN_INFO, cmd,
+   Result: hostbyte=%s driverbyte=%s,
+   hb_string ? hb_string : invalid,
+   db_string ? db_string : invalid);
+   else
+   scmd_printk(KERN_INFO, cmd,
+   Result: hostbyte=0x%02x driverbyte=0x%02x,
+   host_byte(cmd-result), driver_byte(cmd-result));
 }
 EXPORT_SYMBOL(scsi_print_result);
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 44bea15..fb3e0d4 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -19,6 +19,8 @@ extern void __scsi_print_sense(struct scsi_device *, const 
char *name,
   int sense_len);
 extern void scsi_show_result(int);
 extern void scsi_print_result(struct scsi_cmnd *);
+extern const char *scsi_hostbyte_string(int);
+extern const char *scsi_driverbyte_string(int);
 extern const char *scsi_sense_key_string(unsigned char);
 extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
  const char **);
-- 
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 08/23] 53c700: remove scsi_print_sense() usage

2014-09-30 Thread Hannes Reinecke
The 53c700 driver would be using scsi_print_sense() in a debug
statement, which was never compiled in. Plus the same information
can get retrieved with logging. So remove it.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/53c700.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 68bf423..179a24e 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -592,19 +592,14 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters 
*hostdata,
hostdata-cmd = NULL;
 
if(SCp != NULL) {
-   struct NCR_700_command_slot *slot = 
+   struct NCR_700_command_slot *slot =
(struct NCR_700_command_slot *)SCp-host_scribble;
-   
+
dma_unmap_single(hostdata-dev, slot-pCmd,
 MAX_COMMAND_SIZE, DMA_TO_DEVICE);
if (slot-flags == NCR_700_FLAG_AUTOSENSE) {
char *cmnd = NCR_700_get_sense_cmnd(SCp-device);
-#ifdef NCR_700_DEBUG
-   printk( ORIGINAL CMD %p RETURNED %d, new return is %d 
sense is\n,
-  SCp, SCp-cmnd[7], result);
-   scsi_print_sense(SCp);
 
-#endif
dma_unmap_single(hostdata-dev, slot-dma_handle,
 SCSI_SENSE_BUFFERSIZE, 
DMA_FROM_DEVICE);
/* restore the old result if the request sense was
-- 
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 16/23] scsi: remove last argument from print_opcode_name()

2014-09-30 Thread Hannes Reinecke
print_opcode_name() was only ever called with a '0' argument
from LLDDs and ULDs which were _not_ supporting variable length
CDBs, so the 'if' clause was never triggered.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 2110d61..713e1e0 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -320,25 +320,21 @@ static bool scsi_opcode_sa_name(int cmd, int 
service_action,
return true;
 }
 
-/* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */
-static void print_opcode_name(unsigned char * cdbp, int cdb_len)
+static void print_opcode_name(unsigned char *cdbp)
 {
-   int sa, len, cdb0;
+   int sa, cdb0;
const char *cdb_name = NULL, *sa_name = NULL;
 
cdb0 = cdbp[0];
if (cdb0 == VARIABLE_LENGTH_CMD) {
-   len = scsi_varlen_cdb_length(cdbp);
+   int len = scsi_varlen_cdb_length(cdbp);
if (len  10) {
-   printk(short variable length command, 
-  len=%d ext_len=%d, len, cdb_len);
+   printk(short variable length command, len=%d, len);
return;
}
sa = (cdbp[8]  8) + cdbp[9];
-   } else {
+   } else
sa = cdbp[1]  0x1f;
-   len = cdb_len;
-   }
 
if (!scsi_opcode_sa_name(cdb0, sa, cdb_name, sa_name)) {
if (cdb_name)
@@ -356,9 +352,6 @@ static void print_opcode_name(unsigned char * cdbp, int 
cdb_len)
printk(%s, sa=0x%x, cdb_name, sa);
else
printk(cdb[0]=0x%x, sa=0x%x, cdb0, sa);
-
-   if (cdb_len  0  len != cdb_len)
-   printk(, in_cdb_len=%d, ext_len=%d, len, cdb_len);
}
 }
 
@@ -366,7 +359,7 @@ void __scsi_print_command(unsigned char *cdb)
 {
int k, len;
 
-   print_opcode_name(cdb, 0);
+   print_opcode_name(cdb);
len = scsi_command_size(cdb);
/* print out all bytes in cdb */
for (k = 0; k  len; ++k)
@@ -383,7 +376,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)
return;
 
scmd_printk(KERN_INFO, cmd, CDB: );
-   print_opcode_name(cmd-cmnd, cmd-cmd_len);
+   print_opcode_name(cmd-cmnd);
 
/* print out all bytes in cdb */
printk(:);
-- 
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 15/23] scsi: consolidate opcode lookup in scsi_opcode_sa_name()

2014-09-30 Thread Hannes Reinecke
Consolidate the CDB opcode lookup in scsi_opcode_sa_name(),
so that we don't have to call several functions to figure
out the CDB opcode string.

Reviewed-by: Christoph Hellweg h...@lst.de
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 37 ++---
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index c1cdfab..2110d61 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -29,6 +29,7 @@
 #define THIRD_PARTY_COPY_OUT 0x83
 #define THIRD_PARTY_COPY_IN 0x84
 
+#define VENDOR_SPECIFIC_CDB 0xc0
 
 struct sa_name_list {
int cmd;
@@ -286,12 +287,19 @@ static struct sa_name_list sa_names_arr[] = {
 #endif /* CONFIG_SCSI_CONSTANTS */
 
 static bool scsi_opcode_sa_name(int cmd, int service_action,
-   const char **sa_name)
+   const char **cdb_name, const char **sa_name)
 {
struct sa_name_list *sa_name_ptr = sa_names_arr;
const struct value_name_pair *arr = NULL;
int arr_sz, k;
 
+   *cdb_name = NULL;
+   if (cmd = VENDOR_SPECIFIC_CDB)
+   return false;
+
+   if (cmd  ARRAY_SIZE(cdb_byte0_names))
+   *cdb_name = cdb_byte0_names[cmd];
+
for (k = 0; k  ARRAY_SIZE(sa_names_arr); ++k, ++sa_name_ptr) {
if (sa_name_ptr-cmd == cmd) {
arr = sa_name_ptr-arr;
@@ -316,7 +324,7 @@ static bool scsi_opcode_sa_name(int cmd, int service_action,
 static void print_opcode_name(unsigned char * cdbp, int cdb_len)
 {
int sa, len, cdb0;
-   const char *name = NULL;
+   const char *cdb_name = NULL, *sa_name = NULL;
 
cdb0 = cdbp[0];
if (cdb0 == VARIABLE_LENGTH_CMD) {
@@ -332,21 +340,20 @@ static void print_opcode_name(unsigned char * cdbp, int 
cdb_len)
len = cdb_len;
}
 
-   if (!scsi_opcode_sa_name(cdb0, sa, name)) {
-   if (cdb0  0xc0) {
-   if (ARRAY_SIZE(cdb_byte0_names)) {
-   name = cdb_byte0_names[cdb0];
-   if (name)
-   printk(%s, name);
-   else
-   printk(cdb[0]=0x%x (reserved), cdb0);
-   } else
-   printk(cdb[0]=0x%x, cdb0);
-   } else
+   if (!scsi_opcode_sa_name(cdb0, sa, cdb_name, sa_name)) {
+   if (cdb_name)
+   printk(%s, cdb_name);
+   else if (cdb0  VENDOR_SPECIFIC_CDB)
printk(cdb[0]=0x%x (vendor), cdb0);
+   else if (cdb0  0x60  cdb0  0x7e)
+   printk(cdb[0]=0x%x (reserved), cdb0);
+   else
+   printk(cdb[0]=0x%x, cdb0);
} else {
-   if (name)
-   printk(%s, name);
+   if (sa_name)
+   printk(%s, sa_name);
+   else if (cdb_name)
+   printk(%s, sa=0x%x, cdb_name, sa);
else
printk(cdb[0]=0x%x, sa=0x%x, cdb0, sa);
 
-- 
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 09/23] scsi: stop decoding if scsi_normalize_sense() fails

2014-09-30 Thread Hannes Reinecke
If scsi_normalize_sense() fails we couldn't decode the sense
buffer, and the scsi_sense_hdr fields are invalid.
For those cases we should rather dump the sense buffer
and not try to decode invalid fields.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 34 --
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index dab8d74..a8d5962 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1435,26 +1435,21 @@ scsi_print_sense_hdr(struct scsi_device *sdev, const 
char *name,
 EXPORT_SYMBOL(scsi_print_sense_hdr);
 
 static void
-scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len,
-  struct scsi_sense_hdr *sshdr)
+scsi_dump_sense_buffer(const unsigned char *sense_buffer, int sense_len)
 {
-   int k, num, res;
-
-   res = scsi_normalize_sense(sense_buffer, sense_len, sshdr);
-   if (0 == res) {
-   /* this may be SCSI-1 sense data */
-   num = (sense_len  32) ? sense_len : 32;
-   printk(Unrecognized sense data (in hex):);
-   for (k = 0; k  num; ++k) {
-   if (0 == (k % 16)) {
-   printk(\n);
-   printk(KERN_INFO );
-   }
-   printk(%02x , sense_buffer[k]);
+   int k, num;
+
+   num = (sense_len  32) ? sense_len : 32;
+   printk(Unrecognized sense data (in hex):);
+   for (k = 0; k  num; ++k) {
+   if (0 == (k % 16)) {
+   printk(\n);
+   printk(KERN_INFO );
}
-   printk(\n);
-   return;
+   printk(%02x , sense_buffer[k]);
}
+   printk(\n);
+   return;
 }
 
 static void
@@ -1524,7 +1519,10 @@ void __scsi_print_sense(struct scsi_device *sdev, const 
char *name,
 {
struct scsi_sense_hdr sshdr;
 
-   scsi_decode_sense_buffer(sense_buffer, sense_len, sshdr);
+   if (!scsi_normalize_sense(sense_buffer, sense_len, sshdr)) {
+   scsi_dump_sense_buffer(sense_buffer, sense_len);
+   return;
+   }
scsi_show_sense_hdr(sdev, name, sshdr);
scsi_decode_sense_extras(sense_buffer, sense_len, sshdr);
scsi_show_extd_sense(sdev, name, sshdr.asc, sshdr.ascq);
-- 
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 17/23] scsi: Remove scsi_print_command when calling abort

2014-09-30 Thread Hannes Reinecke
Calling scsi_print_command should not be necessary during abort;
if the information is required one should enable scsi logging.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/53c700.c|  4 +---
 drivers/scsi/NCR5380.c   |  5 ++---
 drivers/scsi/arm/fas216.c| 10 +++---
 drivers/scsi/atari_NCR5380.c |  3 +--
 drivers/scsi/ps3rom.c|  4 
 drivers/scsi/stex.c  |  9 +++--
 drivers/scsi/sun3_NCR5380.c  |  3 +--
 7 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 179a24e..474cc6d 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1906,9 +1906,7 @@ NCR_700_abort(struct scsi_cmnd * SCp)
 {
struct NCR_700_command_slot *slot;
 
-   scmd_printk(KERN_INFO, SCp,
-   New error handler wants to abort command\n\t);
-   scsi_print_command(SCp);
+   scmd_printk(KERN_INFO, SCp, abort command\n);
 
slot = (struct NCR_700_command_slot *)SCp-host_scribble;
 
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 45da3c8..50873bb 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -2666,9 +2666,8 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
struct Scsi_Host *instance = cmd-device-host;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) 
instance-hostdata;
Scsi_Cmnd *tmp, **prev;
-   
-   printk(KERN_WARNING scsi%d : aborting command\n, instance-host_no);
-   scsi_print_command(cmd);
+
+   scmd_printk(KERN_WARNING, cmd, aborting command\n);
 
NCR5380_print_status(instance);
 
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index b2fd18e..c16aca1 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2425,14 +2425,11 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)
 
info-stats.aborts += 1;
 
-   printk(KERN_WARNING scsi%d: abort command , info-host-host_no);
-   __scsi_print_command(SCpnt-cmnd);
+   sdev_printk(KERN_WARNING, SCpnt, abort command\n);
 
print_debug_list();
fas216_dumpstate(info);
 
-   printk(KERN_WARNING scsi%d: abort %p , info-host-host_no, SCpnt);
-
switch (fas216_find_command(info, SCpnt)) {
/*
 * We found the command, and cleared it out.  Either
@@ -2440,7 +2437,7 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)
 * target, or the busylun bit is not set.
 */
case res_success:
-   printk(success\n);
+   sdev_printk(KERN_WARNING, SCpnt, abort %p success\n, SCpnt);
result = SUCCESS;
break;
 
@@ -2450,14 +2447,13 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)
 * if the bus is free.
 */
case res_hw_abort:
-   
 
/*
 * We are unable to abort the command for some reason.
 */
default:
case res_failed:
-   printk(failed\n);
+   sdev_printk(KERN_WARNING, SCpnt, abort %p failed\n, SCpnt);
break;
}
 
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 79e6f04..322f361 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -2623,8 +2623,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
Scsi_Cmnd *tmp, **prev;
unsigned long flags;
 
-   printk(KERN_NOTICE scsi%d: aborting command\n, HOSTNO);
-   scsi_print_command(cmd);
+   sdev_printk(KERN_NOTICE, cmd, aborting command\n);
 
NCR5380_print_status(instance);
 
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index ef23fab..b3b48b5 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -220,10 +220,6 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,
unsigned char opcode;
int res;
 
-#ifdef DEBUG
-   scsi_print_command(cmd);
-#endif
-
priv-curr_cmd = cmd;
cmd-scsi_done = done;
 
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 1aa4bef..713af13 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -1162,9 +1162,7 @@ static int stex_abort(struct scsi_cmnd *cmd)
int result = SUCCESS;
unsigned long flags;
 
-   printk(KERN_INFO DRV_NAME
-   (%s): aborting command\n, pci_name(hba-pdev));
-   scsi_print_command(cmd);
+   scmd_printk(KERN_INFO, cmd, aborting command\n);
 
base = hba-mmio_base;
spin_lock_irqsave(host-host_lock, flags);
@@ -1352,9 +1350,8 @@ static int stex_reset(struct scsi_cmnd *cmd)
 
hba = (struct st_hba *) cmd-device-host-hostdata[0];
 
-   printk(KERN_INFO DRV_NAME
-   (%s): resetting host\n, pci_name(hba-pdev));
-   scsi_print_command(cmd);
+   shost_printk(KERN_INFO, cmd-device-host,
+resetting host\n);
 
return stex_do_reset(hba) ? FAILED : SUCCESS;
 }
diff --git a/drivers/scsi/sun3_NCR5380.c 

[PATCH 04/23] scsi: introduce sdev_prefix_printk()

2014-09-30 Thread Hannes Reinecke
Like scmd_printk(), but the device name is passed in as
a string. Can be used by eg ULDs which do not have access
to the scsi_cmnd structure.

Reviewed-by: Christoph Hellwig h...@lst.de
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/ch.c  | 3 +--
 drivers/scsi/sd.h  | 7 ---
 drivers/scsi/sg.c  | 4 ++--
 drivers/scsi/sr.h  | 3 +--
 drivers/scsi/st.c  | 3 +--
 include/scsi/scsi_device.h | 9 +
 6 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index ef5ae0d..52060e7 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -85,8 +85,7 @@ static const char * vendor_labels[CH_TYPES-4] = {
 // module_param_string_array(vendor_labels, NULL, 0444);
 
 #define ch_printk(prefix, ch, fmt, a...) \
-   sdev_printk(prefix, (ch)-device, [%s]  fmt, \
-   (ch)-name, ##a)
+   sdev_prefix_printk(prefix, (ch)-device, (ch)-name, fmt, ##a)
 
 #define DPRINTK(fmt, arg...)   \
 do {   \
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 4c3ab83..c01dc89 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -103,9 +103,10 @@ static inline struct scsi_disk *scsi_disk(struct gendisk 
*disk)
 
 #define sd_printk(prefix, sdsk, fmt, a...) \
 (sdsk)-disk ? \
-   sdev_printk(prefix, (sdsk)-device, [%s]  fmt,\
-   (sdsk)-disk-disk_name, ##a) : \
-   sdev_printk(prefix, (sdsk)-device, fmt, ##a)
+ sdev_prefix_printk(prefix, (sdsk)-device,\
+(sdsk)-disk-disk_name, fmt, ##a) :   \
+ sdev_prefix_printk(prefix, (sdsk)-device,\
+NULL, fmt, ##a)
 
 #define sd_first_printk(prefix, sdsk, fmt, a...)   \
do {\
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 01cf888..87304c8 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -219,8 +219,8 @@ static void sg_device_destroy(struct kref *kref);
 #define SZ_SG_REQ_INFO sizeof(sg_req_info_t)
 
 #define sg_printk(prefix, sdp, fmt, a...) \
-   sdev_printk(prefix, (sdp)-device, [%s]  fmt, \
-   (sdp)-disk-disk_name, ##a)
+   sdev_prefix_printk(prefix, (sdp)-device,   \
+  (sdp)-disk-disk_name, fmt, ##a)
 
 static int sg_allow_access(struct file *filp, unsigned char *cmd)
 {
diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h
index 1d1f6f4..1de3371 100644
--- a/drivers/scsi/sr.h
+++ b/drivers/scsi/sr.h
@@ -57,8 +57,7 @@ typedef struct scsi_cd {
 } Scsi_CD;
 
 #define sr_printk(prefix, cd, fmt, a...) \
-   sdev_printk(prefix, (cd)-device, [%s]  fmt, \
-   (cd)-cdi.name, ##a)
+   sdev_prefix_printk(prefix, (cd)-device, (cd)-cdi.name, fmt, ##a)
 
 int sr_do_ioctl(Scsi_CD *, struct packet_command *);
 
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index d3fd6e8..e479343 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -306,8 +306,7 @@ static inline char *tape_name(struct scsi_tape *tape)
 }
 
 #define st_printk(prefix, t, fmt, a...) \
-   sdev_printk(prefix, (t)-device, %s:  fmt, \
-   tape_name(t), ##a)
+   sdev_prefix_printk(prefix, (t)-device, tape_name(t), fmt, ##a)
 #ifdef DEBUG
 #define DEBC_printk(t, fmt, a...) \
if (debugging) { st_printk(ST_DEB_MSG, t, fmt, ##a ); }
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 27ecee7..0b18a09 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -244,6 +244,15 @@ struct scsi_dh_data {
 #define sdev_dbg(sdev, fmt, a...) \
dev_dbg((sdev)-sdev_gendev, fmt, ##a)
 
+/*
+ * like scmd_printk, but the device name is passed in
+ * as a string pointer
+ */
+#define sdev_prefix_printk(l, sdev, p, fmt, a...)  \
+   (p) ?   \
+   sdev_printk(l, sdev, [%s]  fmt, p, ##a) : \
+   sdev_printk(l, sdev, fmt, ##a)
+
 #define scmd_printk(prefix, scmd, fmt, a...)   \
 (scmd)-request-rq_disk ? \
sdev_printk(prefix, (scmd)-device, [%s]  fmt,\
-- 
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 06/23] acornscsi: use scsi_print_command()

2014-09-30 Thread Hannes Reinecke
Update acornscsi to use scsi_print_command() instead of the
underscore version. This will add correct device annotations
in the resulting message.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/arm/acornscsi.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index d89b9b4..deaaf84 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -850,13 +850,13 @@ static void acornscsi_done(AS_Host *host, struct 
scsi_cmnd **SCpntp,
break;
 
default:
-   printk(KERN_ERR scsi%d.H: incomplete data transfer 
detected: result=%08X command=,
-   host-host-host_no, SCpnt-result);
-   __scsi_print_command(SCpnt-cmnd);
+   scmd_printk(KERN_ERR, SCpnt,
+   incomplete data transfer detected: 
+   result=%08X, SCpnt-result);
+   scsi_print_command(SCpnt);
acornscsi_dumpdma(host, done);
-   acornscsi_dumplog(host, SCpnt-device-id);
-   SCpnt-result = 0x;
-   SCpnt-result |= DID_ERROR  16;
+   acornscsi_dumplog(host, SCpnt-device-id);
+   set_host_byte(SCpnt, DID_ERROR);
}
}
}
-- 
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 05/23] scsi: Use sdev as argument for sense code printing

2014-09-30 Thread Hannes Reinecke
We should be using the standard dev_printk() variants for
sense code printing.

Reviewed-by: Christoph Hellwig h...@infradead.org
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/53c700.c  |   2 +-
 drivers/scsi/ch.c  |   2 +-
 drivers/scsi/constants.c   | 117 ++---
 drivers/scsi/osst.c|   8 ++--
 drivers/scsi/scsi.c|   2 +-
 drivers/scsi/scsi_error.c  |   2 +-
 drivers/scsi/scsi_ioctl.c  |   2 +-
 drivers/scsi/scsi_lib.c|   4 +-
 drivers/scsi/sd.c  |   9 ++--
 drivers/scsi/sg.c  |   2 +-
 drivers/scsi/sr_ioctl.c|   6 +--
 drivers/scsi/st.c  |   6 ++-
 drivers/scsi/storvsc_drv.c |   3 +-
 include/scsi/scsi_dbg.h|  17 ---
 14 files changed, 96 insertions(+), 86 deletions(-)

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index fabd4be..68bf423 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -602,7 +602,7 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
 #ifdef NCR_700_DEBUG
printk( ORIGINAL CMD %p RETURNED %d, new return is %d 
sense is\n,
   SCp, SCp-cmnd[7], result);
-   scsi_print_sense(53c700, SCp);
+   scsi_print_sense(SCp);
 
 #endif
dma_unmap_single(hostdata-dev, slot-dma_handle,
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 52060e7..53621a3 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -206,7 +206,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
DPRINTK(result: 0x%x\n,result);
if (driver_byte(result)  DRIVER_SENSE) {
if (debug)
-   scsi_print_sense_hdr(ch-name, sshdr);
+   scsi_print_sense_hdr(ch-device, ch-name, sshdr);
errno = ch_find_errno(sshdr);
 
switch(sshdr.sense_key) {
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 2f44707..dab8d74 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1292,18 +1292,19 @@ static const struct error_info additional[] =
 
 struct error_info2 {
unsigned char code1, code2_min, code2_max;
+   const char * str;
const char * fmt;
 };
 
 static const struct error_info2 additional2[] =
 {
-   {0x40, 0x00, 0x7f, Ram failure (%x)},
-   {0x40, 0x80, 0xff, Diagnostic failure on component (%x)},
-   {0x41, 0x00, 0xff, Data path failure (%x)},
-   {0x42, 0x00, 0xff, Power-on or self-test failure (%x)},
-   {0x4D, 0x00, 0xff, Tagged overlapped commands (task tag %x)},
-   {0x70, 0x00, 0xff, Decompression exception short algorithm id of %x},
-   {0, 0, 0, NULL}
+   {0x40, 0x00, 0x7f, Ram failure, },
+   {0x40, 0x80, 0xff, Diagnostic failure on component, },
+   {0x41, 0x00, 0xff, Data path failure, },
+   {0x42, 0x00, 0xff, Power-on or self-test failure, },
+   {0x4D, 0x00, 0xff, Tagged overlapped commands, task tag },
+   {0x70, 0x00, 0xff, Decompression exception, short algorithm id of },
+   {0, 0, 0, NULL, NULL}
 };
 
 /* description of the sense key values */
@@ -1349,7 +1350,8 @@ EXPORT_SYMBOL(scsi_sense_key_string);
  * This string may contain a %x and should be printed with ascq as arg.
  */
 const char *
-scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
+scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
+{
 #ifdef CONFIG_SCSI_CONSTANTS
int i;
unsigned short code = ((asc  8) | ascq);
@@ -1361,7 +1363,8 @@ scsi_extd_sense_format(unsigned char asc, unsigned char 
ascq) {
if (additional2[i].code1 == asc 
ascq = additional2[i].code2_min 
ascq = additional2[i].code2_max)
-   return additional2[i].fmt;
+   *fmt = additional2[i].fmt;
+   return additional2[i].str;
}
 #endif
return NULL;
@@ -1369,49 +1372,53 @@ scsi_extd_sense_format(unsigned char asc, unsigned char 
ascq) {
 EXPORT_SYMBOL(scsi_extd_sense_format);
 
 void
-scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
+scsi_show_extd_sense(struct scsi_device *sdev, const char *name,
+unsigned char asc, unsigned char ascq)
 {
-const char *extd_sense_fmt = scsi_extd_sense_format(asc, ascq);
+   const char *extd_sense_fmt = NULL;
+   const char *extd_sense_str = scsi_extd_sense_format(asc, ascq,
+   extd_sense_fmt);
+
+   if (extd_sense_str) {
+   if (extd_sense_fmt)
+   sdev_prefix_printk(KERN_INFO, sdev, name,
+  Add. Sense: %s (%s%x),
+  extd_sense_str, extd_sense_fmt,
+  ascq);
+   else
+   sdev_prefix_printk(KERN_INFO, 

[PATCH 03/23] aha152x: Debug output update and whitespace cleanup

2014-09-30 Thread Hannes Reinecke
Remove all uncommented debugging code and move all
printk() statements over to dev_printk().
And while we're at it we should be doing a whitespace
cleanup, too.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/aha152x.c | 994 +++--
 1 file changed, 224 insertions(+), 770 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index e77b72f..e1aba73 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -230,7 +230,7 @@
  *
  *
  **
- 
+
  see Documentation/scsi/aha152x.txt for configuration details
 
  **/
@@ -279,45 +279,11 @@ static LIST_HEAD(aha152x_host_list);
 #error define AUTOCONF or SETUP0
 #endif
 
-#if defined(AHA152X_DEBUG)
-#define DEBUG_DEFAULT debug_eh
-
-#define DPRINTK(when,msgs...) \
-   do { if(HOSTDATA(shpnt)-debug  (when)) printk(msgs); } while(0)
-
-#define DO_LOCK(flags) \
-   do { \
-   if(spin_is_locked(QLOCK)) { \
-   DPRINTK(debug_intr, DEBUG_LEAD (%s:%d) already locked 
at %s:%d\n, CMDINFO(CURRENT_SC), __func__, __LINE__, QLOCKER, QLOCKERL); \
-   } \
-   DPRINTK(debug_locking, DEBUG_LEAD (%s:%d) locking\n, 
CMDINFO(CURRENT_SC), __func__, __LINE__); \
-   spin_lock_irqsave(QLOCK,flags); \
-   DPRINTK(debug_locking, DEBUG_LEAD (%s:%d) locked\n, 
CMDINFO(CURRENT_SC), __func__, __LINE__); \
-   QLOCKER=__func__; \
-   QLOCKERL=__LINE__; \
-   } while(0)
-
-#define DO_UNLOCK(flags)   \
-   do { \
-   DPRINTK(debug_locking, DEBUG_LEAD (%s:%d) unlocking (locked at 
%s:%d)\n, CMDINFO(CURRENT_SC), __func__, __LINE__, QLOCKER, QLOCKERL); \
-   spin_unlock_irqrestore(QLOCK,flags); \
-   DPRINTK(debug_locking, DEBUG_LEAD (%s:%d) unlocked\n, 
CMDINFO(CURRENT_SC), __func__, __LINE__); \
-   QLOCKER=(not locked); \
-   QLOCKERL=0; \
-   } while(0)
-
-#else
-#define DPRINTK(when,msgs...)
 #defineDO_LOCK(flags)  spin_lock_irqsave(QLOCK,flags)
 #defineDO_UNLOCK(flags)spin_unlock_irqrestore(QLOCK,flags)
-#endif
 
 #define LEAD   (scsi%d:%d:%d) 
-#define WARN_LEAD  KERN_WARNINGLEAD
 #define INFO_LEAD  KERN_INFO   LEAD
-#define NOTE_LEAD  KERN_NOTICE LEAD
-#define ERR_LEAD   KERN_ERRLEAD
-#define DEBUG_LEAD KERN_DEBUG  LEAD
 #define CMDINFO(cmd) \
(cmd) ? ((cmd)-device-host-host_no) : -1, \
 (cmd) ? ((cmd)-device-id  0x0f) : -1, \
@@ -345,10 +311,10 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)
 
 enum {
not_issued  = 0x0001,   /* command not yet issued */
-   selecting   = 0x0002,   /* target is beeing selected */
+   selecting   = 0x0002,   /* target is beeing selected */
identified  = 0x0004,   /* IDENTIFY was sent */
disconnected= 0x0008,   /* target disconnected */
-   completed   = 0x0010,   /* target sent COMMAND COMPLETE */ 
+   completed   = 0x0010,   /* target sent COMMAND COMPLETE */
aborted = 0x0020,   /* ABORT was sent */
resetted= 0x0040,   /* BUS DEVICE RESET was sent */
spiordy = 0x0080,   /* waiting for SPIORDY to raise */
@@ -396,7 +362,6 @@ static int exttrans[] = {0, 0};
 module_param_array(exttrans, int, NULL, 0);
 MODULE_PARM_DESC(exttrans,use extended translation);
 
-#if !defined(AHA152X_DEBUG)
 static int aha152x[] = {0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0};
 module_param_array(aha152x, int, NULL, 0);
 MODULE_PARM_DESC(aha152x, parameters for first controller);
@@ -404,19 +369,6 @@ MODULE_PARM_DESC(aha152x, parameters for first 
controller);
 static int aha152x1[] = {0, 11, 7, 1, 1, 0, DELAY_DEFAULT, 0};
 module_param_array(aha152x1, int, NULL, 0);
 MODULE_PARM_DESC(aha152x1, parameters for second controller);
-#else
-static int debug[] = {DEBUG_DEFAULT, DEBUG_DEFAULT};
-module_param_array(debug, int, NULL, 0);
-MODULE_PARM_DESC(debug, flags for driver debugging);
-
-static int aha152x[]   = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT};
-module_param_array(aha152x, int, NULL, 0);
-MODULE_PARM_DESC(aha152x, parameters for first controller);
-
-static int aha152x1[]  = {0, 11, 7, 1, 1, 1, DELAY_DEFAULT, 0, DEBUG_DEFAULT};
-module_param_array(aha152x1, int, NULL, 0);
-MODULE_PARM_DESC(aha152x1, parameters for second controller);
-#endif /* !defined(AHA152X_DEBUG) */
 #endif /* MODULE */
 
 #ifdef __ISAPNP__
@@ -446,7 +398,7 @@ static struct scsi_host_template aha152x_driver_template;
 /*
  * internal states of the host
  *
- */ 
+ */
 enum aha152x_state {
idle=0,
unknown,
@@ -485,24 +437,16 @@ struct aha152x_hostdata {
spinlock_t lock;
  

[PATCH 10/23] scsi: do not decode sense extras

2014-09-30 Thread Hannes Reinecke
Currently we're only decoding sense extras for tape devices.
And even there only for fixed format sense formats.
As this is of rather limited use in the general case we should
be stop trying to decode sense extras; the tape driver does
its own decoding anyway.

Reviewed-by: Christoph Hellwig h...@lst.de
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 62 
 1 file changed, 62 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index a8d5962..55ece2a 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1452,67 +1452,6 @@ scsi_dump_sense_buffer(const unsigned char 
*sense_buffer, int sense_len)
return;
 }
 
-static void
-scsi_decode_sense_extras(const unsigned char *sense_buffer, int sense_len,
-struct scsi_sense_hdr *sshdr)
-{
-   int k, num, res;
-
-   if (sshdr-response_code  0x72)
-   {
-   /* only decode extras for fixed format now */
-   char buff[80];
-   int blen, fixed_valid;
-   unsigned int info;
-
-   fixed_valid = sense_buffer[0]  0x80;
-   info = ((sense_buffer[3]  24) | (sense_buffer[4]  16) |
-   (sense_buffer[5]  8) | sense_buffer[6]);
-   res = 0;
-   memset(buff, 0, sizeof(buff));
-   blen = sizeof(buff) - 1;
-   if (fixed_valid)
-   res += snprintf(buff + res, blen - res,
-   Info fld=0x%x, info);
-   if (sense_buffer[2]  0x80) {
-   /* current command has read a filemark */
-   if (res  0)
-   res += snprintf(buff + res, blen - res, , );
-   res += snprintf(buff + res, blen - res, FMK);
-   }
-   if (sense_buffer[2]  0x40) {
-   /* end-of-medium condition exists */
-   if (res  0)
-   res += snprintf(buff + res, blen - res, , );
-   res += snprintf(buff + res, blen - res, EOM);
-   }
-   if (sense_buffer[2]  0x20) {
-   /* incorrect block length requested */
-   if (res  0)
-   res += snprintf(buff + res, blen - res, , );
-   res += snprintf(buff + res, blen - res, ILI);
-   }
-   if (res  0)
-   printk(%s\n, buff);
-   } else if (sshdr-additional_length  0) {
-   /* descriptor format with sense descriptors */
-   num = 8 + sshdr-additional_length;
-   num = (sense_len  num) ? sense_len : num;
-   printk(Descriptor sense data with sense descriptors 
-  (in hex):);
-   for (k = 0; k  num; ++k) {
-   if (0 == (k % 16)) {
-   printk(\n);
-   printk(KERN_INFO );
-   }
-   printk(%02x , sense_buffer[k]);
-   }
-
-   printk(\n);
-   }
-
-}
-
 /* Normalize and print sense buffer with name prefix */
 void __scsi_print_sense(struct scsi_device *sdev, const char *name,
const unsigned char *sense_buffer, int sense_len)
@@ -1524,7 +1463,6 @@ void __scsi_print_sense(struct scsi_device *sdev, const 
char *name,
return;
}
scsi_show_sense_hdr(sdev, name, sshdr);
-   scsi_decode_sense_extras(sense_buffer, sense_len, sshdr);
scsi_show_extd_sense(sdev, name, sshdr.asc, sshdr.ascq);
 }
 EXPORT_SYMBOL(__scsi_print_sense);
-- 
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 23/23] scsi_trace: add tracepoint for completion

2014-09-30 Thread Hannes Reinecke
A tracepoint should be inserted upon completion to make tracing
equivalent to logging.

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/scsi_lib.c |  1 +
 drivers/scsi/scsi_trace.c   | 16 
 include/trace/events/scsi.h | 31 +++
 3 files changed, 48 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2df485f..5c67e4e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1626,6 +1626,7 @@ static void scsi_softirq_done(struct request *rq)
}
 
scsi_log_completion(cmd, disposition);
+   trace_scsi_cmd_completion(cmd, disposition);
 
switch (disposition) {
case SUCCESS:
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index 503594e..51a7737 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -286,3 +286,19 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char 
*cdb, int len)
return scsi_trace_misc(p, cdb, len);
}
 }
+
+const char *
+scsi_trace_mlreturn_name(struct trace_seq *p, int rtn)
+{
+   const char *ret = trace_seq_buffer_ptr(p);
+   const char *mlstr = scsi_mlreturn_string(rtn);
+
+   if (mlstr)
+   trace_seq_printf(p, %s, mlstr);
+   else
+   trace_seq_printf(p, UNKNOWN (0x%x), rtn);
+
+   trace_seq_putc(p, 0);
+
+   return ret;
+}
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index db6c935..8df94d3 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -6,6 +6,7 @@
 
 #include scsi/scsi_cmnd.h
 #include scsi/scsi_host.h
+#include scsi/scsi_dbg.h
 #include linux/tracepoint.h
 #include linux/trace_seq.h
 
@@ -195,6 +196,9 @@
scsi_prot_op_name(SCSI_PROT_READ_PASS), \
scsi_prot_op_name(SCSI_PROT_WRITE_PASS))
 
+const char *scsi_trace_mlreturn_name(struct trace_seq *, int);
+#define __mlreturn_name(rtn) scsi_trace_mlreturn_name(p, rtn)
+
 const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int);
 #define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len)
 
@@ -342,6 +346,33 @@ DEFINE_EVENT(scsi_cmd_done_timeout_template, 
scsi_dispatch_cmd_timeout,
 TP_PROTO(struct scsi_cmnd *cmd),
 TP_ARGS(cmd));
 
+TRACE_EVENT(scsi_cmd_completion,
+
+   TP_PROTO(struct scsi_cmnd *cmd, int rtn),
+
+   TP_ARGS(cmd, rtn),
+
+   TP_STRUCT__entry(
+   __field( unsigned int,  host_no )
+   __field( unsigned int,  channel )
+   __field( unsigned int,  id  )
+   __field( unsigned int,  lun )
+   __field( int,   rtn )
+   ),
+
+   TP_fast_assign(
+   __entry-host_no= cmd-device-host-host_no;
+   __entry-channel= cmd-device-channel;
+   __entry-id = cmd-device-id;
+   __entry-lun= cmd-device-lun;
+   __entry-rtn= rtn;
+   ),
+
+   TP_printk(host_no=%u channel=%u id=%u lun=%u disposition=%s,
+ __entry-host_no, __entry-channel, __entry-id,
+ __entry-lun, __mlreturn_name(__entry-rtn))
+);
+
 TRACE_EVENT(scsi_eh_wakeup,
 
TP_PROTO(struct Scsi_Host *shost),
-- 
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 19/23] sd: Cleanup logging

2014-09-30 Thread Hannes Reinecke
Open-code scsi_print_result in sd.c, and cleanup logging to
not print duplicate informations.

With that we can remove scsi_show_result in constants.c

Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 16 
 drivers/scsi/sd.c| 45 +++--
 include/scsi/scsi_dbg.h  |  1 -
 3 files changed, 23 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index d3e1900..b131900 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1437,22 +1437,6 @@ const char *scsi_driverbyte_string(int result)
 }
 EXPORT_SYMBOL(scsi_driverbyte_string);
 
-void scsi_show_result(int result)
-{
-   const char *hb_string = scsi_hostbyte_string(result);
-   const char *db_string = scsi_driverbyte_string(result);
-
-   if (hb_string || db_string)
-   printk(Result: hostbyte=%s driverbyte=%s\n,
-  hb_string ? hb_string : invalid,
-  db_string ? db_string : invalid);
-   else
-   printk(Result: hostbyte=0x%02x driverbyte=0x%02x\n,
-  host_byte(result), driver_byte(result));
-}
-EXPORT_SYMBOL(scsi_show_result);
-
-
 void scsi_print_result(struct scsi_cmnd *cmd)
 {
const char *hb_string = scsi_hostbyte_string(cmd-result);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 848b17d..2cc8703 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -116,7 +116,7 @@ static int sd_eh_action(struct scsi_cmnd *, int);
 static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
 static void scsi_disk_release(struct device *cdev);
 static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
-static void sd_print_result(struct scsi_disk *, int);
+static void sd_print_result(struct scsi_disk *, const char *, int);
 
 static DEFINE_SPINLOCK(sd_index_lock);
 static DEFINE_IDA(sd_index_ida);
@@ -1479,7 +1479,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
}
 
if (res) {
-   sd_print_result(sdkp, res);
+   sd_print_result(sdkp, SYNCHRONIZE_CACHE failed, res);
 
if (driver_byte(res)  DRIVER_SENSE)
sd_print_sense_hdr(sdkp, sshdr);
@@ -1700,17 +1700,9 @@ static int sd_done(struct scsi_cmnd *SCpnt)
if (sense_valid)
sense_deferred = scsi_sense_is_deferred(sshdr);
}
-#ifdef CONFIG_SCSI_LOGGING
-   SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
-   if (sense_valid) {
-   SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
-  sd_done: sb[respc,sk,asc,
-  ascq]=%x,%x,%x,%x\n,
-  sshdr.response_code,
-  sshdr.sense_key, sshdr.asc,
-  sshdr.ascq));
-   }
-#endif
+   SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
+  sd_done: completed %d bytes\n,
+  good_bytes));
sdkp-medium_access_timed_out = 0;
 
if (driver_byte(result) != DRIVER_SENSE 
@@ -1820,12 +1812,12 @@ sd_spinup_disk(struct scsi_disk *sdkp)
/* no sense, TUR either succeeded or failed
 * with a status error */
if(!spintime  !scsi_status_is_good(the_result)) {
-   sd_printk(KERN_NOTICE, sdkp, Unit Not 
Ready\n);
-   sd_print_result(sdkp, the_result);
+   sd_print_result(sdkp, Unit Not Ready,
+   the_result);
}
break;
}
-   
+
/*
 * The device does not want the automatic start to be issued.
 */
@@ -1941,7 +1933,7 @@ static void read_capacity_error(struct scsi_disk *sdkp, 
struct scsi_device *sdp,
struct scsi_sense_hdr *sshdr, int sense_valid,
int the_result)
 {
-   sd_print_result(sdkp, the_result);
+   sd_print_result(sdkp, READ CAPACITY failed, the_result);
if (driver_byte(the_result)  DRIVER_SENSE)
sd_print_sense_hdr(sdkp, sshdr);
else
@@ -3126,8 +3118,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, 
int start)
res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, sshdr,
   SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
if (res) {
-   sd_printk(KERN_WARNING, sdkp, START_STOP FAILED\n);
-   sd_print_result(sdkp, res);
+   sd_print_result(sdkp, START_STOP failed, res);
if 

[PATCHv4 00/23] scsi logging update (the boring part)

2014-09-30 Thread Hannes Reinecke
Hi all,

after the feedback from v3 I've decided to split off the printk
changes to a second patchset, to be applied on top of this.
So this patchset just contains some logging updates, code
reshuffling and sanity fixes. Nothing major.
Most of it has already been reviewed.

Hannes Reinecke (23):
  Remove scsi_cmd_print_sense_hdr()
  sd: Remove scsi_print_sense() in sd_done()
  aha152x: Debug output update and whitespace cleanup
  scsi: introduce sdev_prefix_printk()
  scsi: Use sdev as argument for sense code printing
  acornscsi: use scsi_print_command()
  fas216: Update logging messages
  53c700: remove scsi_print_sense() usage
  scsi: stop decoding if scsi_normalize_sense() fails
  scsi: do not decode sense extras
  scsi: use 'bool' as return value for scsi_normalize_sense()
  scsi: remove scsi_print_status()
  Implement scsi_opcode_sa_name
  scsi: merge print_opcode_name()
  scsi: consolidate opcode lookup in scsi_opcode_sa_name()
  scsi: remove last argument from print_opcode_name()
  scsi: Remove scsi_print_command when calling abort
  scsi: separate out scsi_(host|driver)byte_string()
  sd: Cleanup logging
  scsi: simplify scsi_log_(send|completion)
  scsi: fixup logging messages in scsi_error.c
  scsi: use shost argument in scsi_eh_prt_fail_stats
  scsi_trace: add tracepoint for completion

 drivers/scsi/53c700.c|  13 +-
 drivers/scsi/NCR5380.c   |   5 +-
 drivers/scsi/aha152x.c   | 994 ++-
 drivers/scsi/arm/acornscsi.c |  12 +-
 drivers/scsi/arm/fas216.c|  41 +-
 drivers/scsi/atari_NCR5380.c |   3 +-
 drivers/scsi/ch.c|   5 +-
 drivers/scsi/constants.c | 572 ++---
 drivers/scsi/hosts.c |   4 +-
 drivers/scsi/osst.c  |   8 +-
 drivers/scsi/ps3rom.c|   4 -
 drivers/scsi/scsi.c  |  45 +-
 drivers/scsi/scsi_error.c| 100 ++---
 drivers/scsi/scsi_ioctl.c|   2 +-
 drivers/scsi/scsi_lib.c  |  20 +-
 drivers/scsi/scsi_trace.c|  16 +
 drivers/scsi/sd.c|  55 +--
 drivers/scsi/sd.h|   7 +-
 drivers/scsi/sg.c|   6 +-
 drivers/scsi/sr.h|   3 +-
 drivers/scsi/sr_ioctl.c  |   6 +-
 drivers/scsi/st.c|   9 +-
 drivers/scsi/stex.c  |   9 +-
 drivers/scsi/storvsc_drv.c   |   3 +-
 drivers/scsi/sun3_NCR5380.c  |   3 +-
 include/scsi/scsi_dbg.h  |  26 +-
 include/scsi/scsi_device.h   |   9 +
 include/scsi/scsi_eh.h   |  14 +-
 include/trace/events/scsi.h  |  31 ++
 29 files changed, 693 insertions(+), 1332 deletions(-)

-- 
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 22/23] scsi: use shost argument in scsi_eh_prt_fail_stats

2014-09-30 Thread Hannes Reinecke
The EH statistics are per host, so we should be using
shost_printk() here.

Suggested-by: Robert Elliott elli...@hp.com
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/scsi_error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 4d3f55c..9daaf2a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -355,7 +355,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host 
*shost,
 
if (cmd_cancel || cmd_failed) {
SCSI_LOG_ERROR_RECOVERY(3,
-   sdev_printk(KERN_INFO, sdev,
+   shost_printk(KERN_INFO, shost,
%s: cmds failed: %d, cancel: %d\n,
__func__, cmd_failed,
cmd_cancel));
-- 
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 12/23] scsi: remove scsi_print_status()

2014-09-30 Thread Hannes Reinecke
Last caller is gone, so we can remove it.

Reviewed-by: Christoph Hellwig h...@lst.de
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 35 ---
 include/scsi/scsi_dbg.h  |  1 -
 2 files changed, 36 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 55ece2a..6e16b19 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -433,41 +433,6 @@ void scsi_print_command(struct scsi_cmnd *cmd)
 }
 EXPORT_SYMBOL(scsi_print_command);
 
-/**
- * scsi_print_status - print scsi status description
- * @scsi_status: scsi status value
- *
- * If the status is recognized, the description is printed.
- * Otherwise Unknown status is output. No trailing space.
- * If CONFIG_SCSI_CONSTANTS is not set, then print status in hex
- * (e.g. 0x2 for Check Condition).
- **/
-void
-scsi_print_status(unsigned char scsi_status) {
-#ifdef CONFIG_SCSI_CONSTANTS
-   const char * ccp;
-
-   switch (scsi_status) {
-   case 0:ccp = Good; break;
-   case 0x2:  ccp = Check Condition; break;
-   case 0x4:  ccp = Condition Met; break;
-   case 0x8:  ccp = Busy; break;
-   case 0x10: ccp = Intermediate; break;
-   case 0x14: ccp = Intermediate-Condition Met; break;
-   case 0x18: ccp = Reservation Conflict; break;
-   case 0x22: ccp = Command Terminated; break;   /* obsolete */
-   case 0x28: ccp = Task set Full; break;/* was: Queue Full */
-   case 0x30: ccp = ACA Active; break;
-   case 0x40: ccp = Task Aborted; break;
-   default:   ccp = Unknown status;
-   }
-   printk(KERN_INFO %s, ccp);
-#else
-   printk(KERN_INFO 0x%0x, scsi_status);
-#endif
-}
-EXPORT_SYMBOL(scsi_print_status);
-
 #ifdef CONFIG_SCSI_CONSTANTS
 
 struct error_info {
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index cd0c873..44bea15 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -19,7 +19,6 @@ extern void __scsi_print_sense(struct scsi_device *, const 
char *name,
   int sense_len);
 extern void scsi_show_result(int);
 extern void scsi_print_result(struct scsi_cmnd *);
-extern void scsi_print_status(unsigned char);
 extern const char *scsi_sense_key_string(unsigned char);
 extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
  const char **);
-- 
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 13/23] Implement scsi_opcode_sa_name

2014-09-30 Thread Hannes Reinecke
Implement a lookup array for SERVICE ACTION commands instead
of hardcoding it in a large switch statement.

Reviewed-by: Christoph Hellwig h...@infradead.org
Signed-off-by: Hannes Reinecke h...@suse.de
---
 drivers/scsi/constants.c | 131 +++
 1 file changed, 53 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 6e16b19..bbe32ba 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -244,102 +244,76 @@ static const struct value_name_pair 
variable_length_arr[] = {
 };
 #define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr)
 
-static const char * get_sa_name(const struct value_name_pair * arr,
-   int arr_sz, int service_action)
+struct sa_name_list {
+   int cmd;
+   const struct value_name_pair *arr;
+   int arr_sz;
+};
+
+static struct sa_name_list sa_names_arr[] = {
+   {VARIABLE_LENGTH_CMD, variable_length_arr, VARIABLE_LENGTH_SZ},
+   {MAINTENANCE_IN, maint_in_arr, MAINT_IN_SZ},
+   {MAINTENANCE_OUT, maint_out_arr, MAINT_OUT_SZ},
+   {PERSISTENT_RESERVE_IN, pr_in_arr, PR_IN_SZ},
+   {PERSISTENT_RESERVE_OUT, pr_out_arr, PR_OUT_SZ},
+   {SERVICE_ACTION_IN_12, serv_in12_arr, SERV_IN12_SZ},
+   {SERVICE_ACTION_OUT_12, serv_out12_arr, SERV_OUT12_SZ},
+   {SERVICE_ACTION_BIDIRECTIONAL, serv_bidi_arr, SERV_BIDI_SZ},
+   {SERVICE_ACTION_IN_16, serv_in16_arr, SERV_IN16_SZ},
+   {SERVICE_ACTION_OUT_16, serv_out16_arr, SERV_OUT16_SZ},
+   {THIRD_PARTY_COPY_IN, tpc_in_arr, TPC_IN_SZ},
+   {THIRD_PARTY_COPY_OUT, tpc_out_arr, TPC_OUT_SZ},
+   {0, NULL, 0},
+};
+
+static bool scsi_opcode_sa_name(int cmd, int service_action,
+   const char **sa_name)
 {
-   int k;
+   struct sa_name_list *sa_name_ptr = sa_names_arr;
+   const struct value_name_pair *arr = NULL;
+   int arr_sz, k;
+
+   for (k = 0; sa_name_ptr-arr; ++k, ++sa_name_ptr) {
+   if (sa_name_ptr-cmd == cmd) {
+   arr = sa_name_ptr-arr;
+   arr_sz = sa_name_ptr-arr_sz;
+   break;
+   }
+   }
+   if (!arr)
+   return false;
 
for (k = 0; k  arr_sz; ++k, ++arr) {
if (service_action == arr-value)
break;
}
-   return (k  arr_sz) ? arr-name : NULL;
+   if (k  arr_sz)
+   *sa_name = arr-name;
+
+   return true;
 }
 
 /* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */
 static void print_opcode_name(unsigned char * cdbp, int cdb_len)
 {
int sa, len, cdb0;
-   int fin_name = 0;
-   const char * name;
+   const char *name = NULL;
 
cdb0 = cdbp[0];
-   switch(cdb0) {
-   case VARIABLE_LENGTH_CMD:
+   if (cdb0 == VARIABLE_LENGTH_CMD) {
len = scsi_varlen_cdb_length(cdbp);
if (len  10) {
printk(short variable length command, 
   len=%d ext_len=%d, len, cdb_len);
-   break;
+   return;
}
sa = (cdbp[8]  8) + cdbp[9];
-   name = get_sa_name(variable_length_arr, VARIABLE_LENGTH_SZ,
-  sa);
-   if (name)
-   printk(%s, name);
-   else
-   printk(cdb[0]=0x%x, sa=0x%x, cdb0, sa);
-
-   if ((cdb_len  0)  (len != cdb_len))
-   printk(, in_cdb_len=%d, ext_len=%d, len, cdb_len);
-
-   break;
-   case MAINTENANCE_IN:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa);
-   fin_name = 1;
-   break;
-   case MAINTENANCE_OUT:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa);
-   fin_name = 1;
-   break;
-   case PERSISTENT_RESERVE_IN:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(pr_in_arr, PR_IN_SZ, sa);
-   fin_name = 1;
-   break;
-   case PERSISTENT_RESERVE_OUT:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(pr_out_arr, PR_OUT_SZ, sa);
-   fin_name = 1;
-   break;
-   case SERVICE_ACTION_IN_12:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa);
-   fin_name = 1;
-   break;
-   case SERVICE_ACTION_OUT_12:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa);
-   fin_name = 1;
-   break;
-   case SERVICE_ACTION_BIDIRECTIONAL:
-   sa = cdbp[1]  0x1f;
-   name = get_sa_name(serv_bidi_arr, SERV_BIDI_SZ, sa);
-   fin_name = 1;
-   

Re: [PATCH] fcoe: extend ethtool to FC port speed mapping

2014-09-30 Thread Christoph Hellwig
On Thu, Sep 25, 2014 at 11:55:42AM -0700, Vasu Dev wrote:
 From: Chris Leech cle...@redhat.com
 
 add support for 20 Gbit and 40 Gbit links
 
 Signed-off-by: Chris Leech cle...@redhat.com
 Signed-off-by: Vasu Dev vasu@intel.com

Thanks,

applied.
--
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_host: fix comment

2014-09-30 Thread Christoph Hellwig
Thanks, applied to the core-for-3.18 tree.

--
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: I/O path cleanup

2014-09-30 Thread Bart Van Assche

On 09/08/14 17:13, Christoph Hellwig wrote:

On Mon, Sep 08, 2014 at 09:22:40AM +0200, Bart Van Assche wrote:

On 09/07/14 18:31, Christoph Hellwig wrote:

This series cleans up a couple of lose ends I noticed during the scsi-mq
work, but which weren't important enough to address during the last cycle.


Is there perhaps a public git tree available with this patch series ? I
have tried to apply these patches on top of v3.17-rc4 but unfortunately
without success:


I've pushed a scsi-io-path-cleanups tree to my scsi-queue.git tree.

I think you were missing the patches from the core-for-3.18 branch which
overlap a bit.

I will also rebase the core-for-3.18 and drivers-for-18 branches soon
as -rc1 which they are currently based on has the percpu issues the
scsi + blk-mq can trigger easily.


(replying to an e-mail of three weeks ago)

Hello Christoph,

At least in the tests I ran myself these patches are working fine in 
combination with scsi-mq and the SRP initiator. The tree I have been 
testing with has commit ID ec8af1eb08f2 - this is the tree on top of 
v3.17-rc4.


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


Re: [PATCH 0/2] be2iscsi : Update to 10.4.114.0

2014-09-30 Thread Christoph Hellwig
Thanks,

applied both patches to drivers-for-3.18.

--
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: I/O path cleanup

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 03:31:25PM +0200, Bart Van Assche wrote:
 At least in the tests I ran myself these patches are working fine in
 combination with scsi-mq and the SRP initiator. The tree I have been testing
 with has commit ID ec8af1eb08f2 - this is the tree on top of v3.17-rc4.

Thanks.  Can you give me formal Reviewed-by: and Tested-by: tags for the
patches?

Also any chance someone in the Cc list can give me a second review so
that I can merge it into the core-for-3.18 tree?
--
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/2] iscsi patches for 3.18

2014-09-30 Thread Christoph Hellwig
On Mon, Sep 29, 2014 at 01:55:40PM -0500, micha...@cs.wisc.edu wrote:
 A couple patches made over the scsi-queue drivers-for-3.18 branch.
 They just fix a possible bug with be2iscsi that Dan reported and
 also export the iscsi port being used.

Thanks, applied both patches to drivers-for-3.18.

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


Re: [PATCH/RESEND V6 00/18] UFS: Power management support

2014-09-30 Thread Christoph Hellwig
I've had the series in a ufs-for-3.18 branch for a while, and the two
issues pointed out by the buildbot were quickly fixed.  Unless I get
a loud complaint I will merge the entire series including the two core
patches into drivers-for-3.18 tomorrow.

--
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 03/23] aha152x: Debug output update and whitespace cleanup

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:32PM +0200, Hannes Reinecke wrote:
 Remove all uncommented debugging code and move all
 printk() statements over to dev_printk().
 And while we're at it we should be doing a whitespace
 cleanup, too.

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 06/23] acornscsi: use scsi_print_command()

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:35PM +0200, Hannes Reinecke wrote:
 Update acornscsi to use scsi_print_command() instead of the
 underscore version. This will add correct device annotations
 in the resulting message.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Also includes a few scmd_printk converstions that should be mentioned
in the changelog, but otherwise looks fine.

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 07/23] fas216: Update logging messages

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:36PM +0200, Hannes Reinecke wrote:
 Update logging messages to use dev_printk() variants for correct
 device annotations.

 - printk( CDB: );
 - __scsi_print_command(SCpnt-cmnd);
 + scsi_print_command(SCpnt);

And a __scsi_print_command - scsi_print_command switch.  Which is
fine, but sould be mentioned.

 - SCpnt-result = ~(255  16);
 - SCpnt-result |= DID_BAD_TARGET  16;
 + scmd_printk(KERN_ERR, SCpnt,
 + incomplete data transfer 
 + detected: res=%08X ptr=%p len=%X\n,
 + SCpnt-result, info-scsi.SCp.ptr,
 + info-scsi.SCp.this_residual);
 + scsi_print_command(SCpnt);
 + set_host_byte(SCpnt, DID_ERROR);

But the canges to setting -result really do not belong into this
series.  I'll happily take them as a separate patch, though.

With that bit removed:

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


Re: [PATCH 08/23] 53c700: remove scsi_print_sense() usage

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:37PM +0200, Hannes Reinecke wrote:
 The 53c700 driver would be using scsi_print_sense() in a debug
 statement, which was never compiled in. Plus the same information
 can get retrieved with logging. So remove it.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 09/23] scsi: stop decoding if scsi_normalize_sense() fails

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:38PM +0200, Hannes Reinecke wrote:
 If scsi_normalize_sense() fails we couldn't decode the sense
 buffer, and the scsi_sense_hdr fields are invalid.
 For those cases we should rather dump the sense buffer
 and not try to decode invalid fields.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 16/23] scsi: remove last argument from print_opcode_name()

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:45PM +0200, Hannes Reinecke wrote:
 print_opcode_name() was only ever called with a '0' argument
 from LLDDs and ULDs which were _not_ supporting variable length
 CDBs, so the 'if' clause was never triggered.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 18/23] scsi: separate out scsi_(host|driver)byte_string()

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:47PM +0200, Hannes Reinecke wrote:
 Export functions for later use.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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] scsi: add a CONFIG_SCSI_MQ_DEFAULT option

2014-09-30 Thread Christoph Hellwig
Add a Kconfig option to enable the blk-mq path for SCSI by default
to ease testing and deployment in setups that know they benefit
from blk-mq.

Signed-off-by: Christoph Hellwig h...@lst.de
---
 drivers/scsi/Kconfig | 11 +++
 drivers/scsi/scsi.c  |  4 
 2 files changed, 15 insertions(+)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 18a3358..71b0877 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -45,6 +45,17 @@ config SCSI_NETLINK
default n
select NET
 
+config SCSI_MQ_DEFAULT
+   bool SCSI: use blk-mq I/O path by default
+   depends on SCSI
+   ---help---
+ This option enables the new blk-mq based I/O path for SCSI
+ devices by default.  With the option the scsi_mod.use_blk_mq
+ module/boot option defaults to Y, without it to N, but it can
+ still be overriden either way.
+
+ If unsure say N.
+
 config SCSI_PROC_FS
bool legacy /proc/scsi/ support
depends on SCSI  PROC_FS
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1423cb1..79c77b4 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1367,7 +1367,11 @@ MODULE_LICENSE(GPL);
 module_param(scsi_logging_level, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(scsi_logging_level, a bit mask of logging levels);
 
+#ifdef CONFIG_SCSI_MQ_DEFAULT
+bool scsi_use_blk_mq = true;
+#else
 bool scsi_use_blk_mq = false;
+#endif
 module_param_named(use_blk_mq, scsi_use_blk_mq, bool, S_IWUSR | S_IRUGO);
 
 static int __init init_scsi(void)
-- 
1.9.1

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


[PATCH 1/2] sg: fix sparse __user annotation warning

2014-09-30 Thread Christoph Hellwig
blk_trace_setup takes a __user pointer, so use the local void __user *
pointer instead of casting the argument to char * for it in the sg
ioctl handler.

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

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 01cf888..b94435b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1138,7 +1138,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned 
long arg)
   sdp-disk-disk_name,
   MKDEV(SCSI_GENERIC_MAJOR, sdp-index),
   NULL,
-  (char *)arg);
+  p);
case BLKTRACESTART:
return blk_trace_startstop(sdp-device-request_queue, 1);
case BLKTRACESTOP:
-- 
1.9.1

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


[PATCH] scsi: add a CONFIG_SCSI_MQ_DEFAULT option

2014-09-30 Thread Christoph Hellwig
Add a Kconfig option to enable the blk-mq path for SCSI by default
to ease testing and deployment in setups that know they benefit
from blk-mq.

Signed-off-by: Christoph Hellwig h...@lst.de
---
 drivers/scsi/Kconfig | 11 +++
 drivers/scsi/scsi.c  |  4 
 2 files changed, 15 insertions(+)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 18a3358..71b0877 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -45,6 +45,17 @@ config SCSI_NETLINK
default n
select NET
 
+config SCSI_MQ_DEFAULT
+   bool SCSI: use blk-mq I/O path by default
+   depends on SCSI
+   ---help---
+ This option enables the new blk-mq based I/O path for SCSI
+ devices by default.  With the option the scsi_mod.use_blk_mq
+ module/boot option defaults to Y, without it to N, but it can
+ still be overriden either way.
+
+ If unsure say N.
+
 config SCSI_PROC_FS
bool legacy /proc/scsi/ support
depends on SCSI  PROC_FS
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1423cb1..79c77b4 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1367,7 +1367,11 @@ MODULE_LICENSE(GPL);
 module_param(scsi_logging_level, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(scsi_logging_level, a bit mask of logging levels);
 
+#ifdef CONFIG_SCSI_MQ_DEFAULT
+bool scsi_use_blk_mq = true;
+#else
 bool scsi_use_blk_mq = false;
+#endif
 module_param_named(use_blk_mq, scsi_use_blk_mq, bool, S_IWUSR | S_IRUGO);
 
 static int __init init_scsi(void)
-- 
1.9.1

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


Re: [PATCH 20/23] scsi: simplify scsi_log_(send|completion)

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:49PM +0200, Hannes Reinecke wrote:
 Simplify scsi_log_(send|completion) by externalizing
 scsi_mlreturn_string() and always print the command address.
 
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 21/23] scsi: fixup logging messages in scsi_error.c

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:50PM +0200, Hannes Reinecke wrote:
 Use the matching scope for logging messages to allow for
 better command tracing.
 
 Suggested-by: Robert Elliott elli...@hp.com
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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 22/23] scsi: use shost argument in scsi_eh_prt_fail_stats

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:51PM +0200, Hannes Reinecke wrote:
 The EH statistics are per host, so we should be using
 shost_printk() here.
 
 Suggested-by: Robert Elliott elli...@hp.com
 Signed-off-by: Hannes Reinecke h...@suse.de

Looks good,

Reviewed-by: Christoph Hellwig h...@lst.de
--
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: targetcli do not show iscsi

2014-09-30 Thread Andy Grover

On 09/30/2014 02:45 AM, Jerome Martin wrote:



On 09/30/2014 11:41 AM, Luigi Tarenga wrote:


On 09/30/2014 11:28 AM, Jerome Martin wrote:

Luigi,

Out of curiosity, does it work as expected with the stock fedora
packaged kernel ?

Best,
--
Jerome



didn't test that configuration and since I can't find module
iscsi_target_mod in stock


iscsi is not a supported fabric on rhel/centos 6. Only FCoE uses LIO. 
scsi-target-utils (tgt) is the supported iscsi target on rhel6. rhel7 
uses LIO for both, as does Fedora.


Regards -- Andy

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


Re: [PATCH 23/23] scsi_trace: add tracepoint for completion

2014-09-30 Thread Christoph Hellwig
On Tue, Sep 30, 2014 at 01:50:52PM +0200, Hannes Reinecke wrote:
 A tracepoint should be inserted upon completion to make tracing
 equivalent to logging.
 
 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  drivers/scsi/scsi_lib.c |  1 +
  drivers/scsi/scsi_trace.c   | 16 
  include/trace/events/scsi.h | 31 +++
  3 files changed, 48 insertions(+)
 
 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
 index 2df485f..5c67e4e 100644
 --- a/drivers/scsi/scsi_lib.c
 +++ b/drivers/scsi/scsi_lib.c
 @@ -1626,6 +1626,7 @@ static void scsi_softirq_done(struct request *rq)
   }
  
   scsi_log_completion(cmd, disposition);
 + trace_scsi_cmd_completion(cmd, disposition);
  
   switch (disposition) {
   case SUCCESS:
 diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
 index 503594e..51a7737 100644
 --- a/drivers/scsi/scsi_trace.c
 +++ b/drivers/scsi/scsi_trace.c
 @@ -286,3 +286,19 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char 
 *cdb, int len)
   return scsi_trace_misc(p, cdb, len);
   }
  }
 +
 +const char *
 +scsi_trace_mlreturn_name(struct trace_seq *p, int rtn)
 +{
 + const char *ret = trace_seq_buffer_ptr(p);
 + const char *mlstr = scsi_mlreturn_string(rtn);
 +
 + if (mlstr)
 + trace_seq_printf(p, %s, mlstr);
 + else
 + trace_seq_printf(p, UNKNOWN (0x%x), rtn);
 +
 + trace_seq_putc(p, 0);
 +
 + return ret;
 +}

Nak, again this doesn't do the right thing for binary tracing.  Please
use __print_symbolic instead.

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


Re: [PATCH v1 5/5] driver-core: add driver asynchronous probe support

2014-09-30 Thread Luis R. Rodriguez
On Tue, Sep 30, 2014 at 11:22:14AM +0200, Tom Gundersen wrote:
 On Tue, Sep 30, 2014 at 4:27 AM, Luis R. Rodriguez mcg...@suse.com wrote:
  On Sun, Sep 28, 2014 at 07:07:24PM +0200, Tom Gundersen wrote:
  On Fri, Sep 26, 2014 at 11:57 PM, Luis R. Rodriguez
  mcg...@do-not-panic.com wrote:
   From: Luis R. Rodriguez mcg...@suse.com
   Systemd has a general timeout for all workers currently set to 180
   seconds after which it will send a sigkill signal. Systemd now has a
   warning which is issued once it reaches 1/3 of the timeout. The original
   motivation for the systemd timeout was to help track device drivers
   which do not use asynch firmware loading on init() and the timeout was
   originally set to 30 seconds.
 
  Please note that the motivation for the timeout in systemd had nothing
  to do with async firmware loading (that was just the case where
  problems cropped up).
 
  *Part *of the original kill logic, according to the commit log, was actually
  due to the assumption that the issues observed *were* synchronous firmware
  loading on module init():
 
  commit e64fae5573e566ce4fd9b23c68ac8f3096603314
  Author: Kay Sievers kay.siev...@vrfy.org
  Date:   Wed Jan 18 05:06:18 2012 +0100
 
  udevd: kill hanging event processes after 30 seconds
 
  Some broken kernel drivers load firmware synchronously in the module 
  init
  path and block modprobe until the firmware request is fulfilled.
  ...
 
 This was a workaround to avoid a deadlock between udev and the kernel.
 The 180 s timeout was already in place before this change, and was not
 motivated by firmware loading. Also note that this patch was not about
 tracking device drivers, just about avoiding dead-lock.

Thanks, can you elaborate on how a deadlock can occur if the kmod
worker is not at some point sigkilled?

  My point here is not to point fingers but to explain why we went on with
  this and how we failed to realize only until later that the driver core
  ran probe together with init. When a few folks pointed out the issues
  with the kill the issue was punted back to kernel developers and the
  assumption even among some kernel maintainers was that it was init paths
  with sync behaviour that was causing some delays and they were broken
  drivers. It is important to highlight these assumptions ended up setting
  us off on the wrong path for a while in a hunt to try to fix this issue
  either in driver or elsewhere.
 
 Ok. I'm not sure the motivations for user-space changes is important
 to include in the commit message, but if you do I'll try to clarify
 things to avoid misunderstandings.

I can try to omit it on the next series.

  Thanks for clarifying this, can you explain what issues could arise
  from making an exception to allowing kmod workers to hang around
  completing init + probe over a certain defined amount of time without
  being killed?
 
 We could run out of udev workers and the whole boot would hang.

Is the issue that if there is no extra worker available and all are
idling on sleep / synchronous long work boot will potentially hang
unless a new worker becomes available to do more work? If so I can
see the sigkill helping for hanging tasks but it doesn't necessarily
mean its a good idea to kill modules loading taking a while. Also
what if the sigkill is just avoided for *just* kmod workers?

 The way I see it, the current status from systemd's side is: our
 short-term work-around is to increase the timeout, and at the moment
 it appears no long-term solution is needed (i.e., it seems like the
 right thing to do is to make sure insmod can be near instantaneous, it
 appears people are working towards this goal, and so far no examples
 have cropped up showing that it is fundamentally impossible (once/if
 they do, we should of course revisit the problem)).

That again would be reactive behaviour, what would prevent avoiding the
sigkill only for kmod workers? Is it known the deadlock is immiment?
If the amount of workers for kmod that would hit the timeout is
considered low I don't see how that's possible and why not just lift
the sigkill.

  Luis
--
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: targetcli do not show iscsi

2014-09-30 Thread Jerome Martin


On 09/30/2014 05:21 PM, Andy Grover wrote:

iscsi is not a supported fabric on rhel/centos 6. Only FCoE uses LIO.
scsi-target-utils (tgt) is the supported iscsi target on rhel6. rhel7
uses LIO for both, as does Fedora.


Ha, that explains it then. Thanks Andy.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga


On 09/30/2014 05:21 PM, Andy Grover wrote:

On 09/30/2014 02:45 AM, Jerome Martin wrote:



On 09/30/2014 11:41 AM, Luigi Tarenga wrote:


On 09/30/2014 11:28 AM, Jerome Martin wrote:

Luigi,

Out of curiosity, does it work as expected with the stock fedora
packaged kernel ?

Best,
--
Jerome



didn't test that configuration and since I can't find module
iscsi_target_mod in stock


iscsi is not a supported fabric on rhel/centos 6. Only FCoE uses LIO. 
scsi-target-utils (tgt) is the supported iscsi target on rhel6. rhel7 
uses LIO for both, as does Fedora.


Regards -- Andy


Hi Andy,
I see LIO is a technology preview on rhel 6 but I'm not looking for 
official support, just play with it :)
that said I have a custom kernel compiled from vanilla so if we esclude 
some problem with
udev or other userspace services only kernel modules and targetcli is 
involved in this configuration.
I hope someone that maintain this module have some time to help me to 
get it running otherwise
I will try to use scst  (actually I compiled and installed it but still 
have to configure it).


My final goal is to have a litttle lab that let me write an integration 
module for my failover cluster
manager ( https://code.google.com/p/back-to-work/ ). I need to implement 
scsi fencing without

destroying a production server connected to a real SAN :P

Luigi
--
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] libfs: Replace rcu_assign_pointer() with RCU_INIT_POINTER()

2014-09-30 Thread Christoph Hellwig
Thanks,

applied to drivers-for-3.18
--
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: targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga


On 09/30/2014 05:35 PM, Luigi Tarenga wrote:


On 09/30/2014 05:21 PM, Andy Grover wrote:

On 09/30/2014 02:45 AM, Jerome Martin wrote:



On 09/30/2014 11:41 AM, Luigi Tarenga wrote:


On 09/30/2014 11:28 AM, Jerome Martin wrote:

Luigi,

Out of curiosity, does it work as expected with the stock fedora
packaged kernel ?

Best,
--
Jerome



didn't test that configuration and since I can't find module
iscsi_target_mod in stock


iscsi is not a supported fabric on rhel/centos 6. Only FCoE uses LIO. 
scsi-target-utils (tgt) is the supported iscsi target on rhel6. rhel7 
uses LIO for both, as does Fedora.


Regards -- Andy


Hi Andy,
I see LIO is a technology preview on rhel 6 but I'm not looking for 
official support, just play with it :)
that said I have a custom kernel compiled from vanilla so if we 
esclude some problem with
udev or other userspace services only kernel modules and targetcli is 
involved in this configuration.
I hope someone that maintain this module have some time to help me to 
get it running otherwise
I will try to use scst  (actually I compiled and installed it but 
still have to configure it).


My final goal is to have a litttle lab that let me write an 
integration module for my failover cluster
manager ( https://code.google.com/p/back-to-work/ ). I need to 
implement scsi fencing without

destroying a production server connected to a real SAN :P

Luigi


Maybe I misunderstood your statement. Are you saying that
the targetcli I'm using (fb16) does not support iscsi fabric?
In this case I will try to use the git version.

Luigi

--
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/2] sg: fix sparse __user annotation warning

2014-09-30 Thread Douglas Gilbert

On 14-09-30 11:20 AM, Christoph Hellwig wrote:

blk_trace_setup takes a __user pointer, so use the local void __user *
pointer instead of casting the argument to char * for it in the sg
ioctl handler.

Signed-off-by: Christoph Hellwig h...@lst.de


Acked-by: Douglas Gilbert dgilb...@interlog.com


---
  drivers/scsi/sg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 01cf888..b94435b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1138,7 +1138,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned 
long arg)
   sdp-disk-disk_name,
   MKDEV(SCSI_GENERIC_MAJOR, sdp-index),
   NULL,
-  (char *)arg);
+  p);
case BLKTRACESTART:
return blk_trace_startstop(sdp-device-request_queue, 1);
case BLKTRACESTOP:



--
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 27/38] Rearrange buffer formatting in printk()

2014-09-30 Thread Petr Mladek
On Mon 29-09-14 13:58:56, Hannes Reinecke wrote:
 Move buffer formatting to the start of the function as it
 doesn't require to be done under any locks.
 No functional change, required by the next patch.
 
 Cc: Steven Rostedt rost...@goodmis.org
 Cc: LKML linux-ker...@vger.kernel.org

printk stuff is maintained by Andrew in mm tree, so adding him into CC.

 Signed-off-by: Hannes Reinecke h...@suse.de

Reviewed-by: Petr Mladek pmla...@suse.cz

I do not see any obvious problem. Just note that
[sched_delayed] has already been removed in -mm tree. You might
want to base this patch on top of the commit 460d73c35ffa17979422290
(printk: git rid of [sched_delayed] message for printk_deferred)
from linux-next.

Best Regards,
Petr

 ---
  kernel/printk/printk.c | 21 ++---
  1 file changed, 10 insertions(+), 11 deletions(-)
 
 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
 index 1ce7706..d13675e 100644
 --- a/kernel/printk/printk.c
 +++ b/kernel/printk/printk.c
 @@ -1633,8 +1633,18 @@ asmlinkage int vprintk_emit(int facility, int level,
   if (level == SCHED_MESSAGE_LOGLEVEL) {
   level = -1;
   in_sched = true;
 +
 + /*
 +  * The printf needs to come first; we need the syslog
 +  * prefix which might be passed-in as a parameter.
 +  */
 + text_len = scnprintf(text, sizeof(textbuf),
 +  KERN_WARNING [sched_delayed] );
   }
  
 + text_len += vscnprintf(text + text_len,
 +sizeof(textbuf) - text_len, fmt, args);
 +
   boot_delay_msec(level);
   printk_delay();
  
 @@ -1676,17 +1686,6 @@ asmlinkage int vprintk_emit(int facility, int level,
strlen(recursion_msg));
   }
  
 - /*
 -  * The printf needs to come first; we need the syslog
 -  * prefix which might be passed-in as a parameter.
 -  */
 - if (in_sched)
 - text_len = scnprintf(text, sizeof(textbuf),
 -  KERN_WARNING [sched_delayed] );
 -
 - text_len += vscnprintf(text + text_len,
 -sizeof(textbuf) - text_len, fmt, args);
 -
   /* mark and strip a trailing newline */
   if (text_len  text[text_len-1] == '\n') {
   text_len--;
 -- 
 1.8.5.2
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
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 28/38] Externalize string buffer for printk

2014-09-30 Thread Petr Mladek
On Mon 29-09-14 13:58:57, Hannes Reinecke wrote:
 This patch splits off the actual logging from vprintk_emit()
 into printk_emit_string(), with vprintk_emit() just being a
 simple wrapper for formatting the message into a
 static buffer.
 
 With that the caller can pass in a local buffer for
 printk_emit_string() without increasing the overall stack size.
 
 Cc: Steven Rostedt rost...@goodmis.org
 Cc: LKML linux-ker...@vger.kernel.org

Adding Andrew into CC here as well.

There is one potential problem, see below.

 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  include/linux/printk.h |  5 +
  kernel/printk/printk.c | 36 
  2 files changed, 29 insertions(+), 12 deletions(-)
 
 diff --git a/include/linux/printk.h b/include/linux/printk.h
 index d78125f..9639900 100644
 --- a/include/linux/printk.h
 +++ b/include/linux/printk.h
 @@ -130,6 +130,11 @@ int vprintk_emit(int facility, int level,
const char *dict, size_t dictlen,
const char *fmt, va_list args);
  
 +asmlinkage
 +int printk_emit_string(int facility, int level,
 +const char *dict, size_t dictlen,
 +char *textbuf, size_t text_len);
 +
  asmlinkage __printf(1, 0)
  int vprintk(const char *fmt, va_list args);
  
 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
 index d13675e..303a1fe 100644
 --- a/kernel/printk/printk.c
 +++ b/kernel/printk/printk.c
 @@ -1618,22 +1618,11 @@ asmlinkage int vprintk_emit(int facility, int level,
   const char *dict, size_t dictlen,
   const char *fmt, va_list args)
  {
 - static int recursion_bug;
   static char textbuf[LOG_LINE_MAX];

   char *text = textbuf;
   size_t text_len = 0;
 - enum log_flags lflags = 0;
 - unsigned long flags;
 - int this_cpu;
 - int printed_len = 0;
 - bool in_sched = false;
 - /* cpu currently holding logbuf_lock in this function */
 - static volatile unsigned int logbuf_cpu = UINT_MAX;
  
   if (level == SCHED_MESSAGE_LOGLEVEL) {
 - level = -1;
 - in_sched = true;
 -
   /*
* The printf needs to come first; we need the syslog
* prefix which might be passed-in as a parameter.
 @@ -1644,6 +1633,24 @@ asmlinkage int vprintk_emit(int facility, int level,
  
   text_len += vscnprintf(text + text_len,
  sizeof(textbuf) - text_len, fmt, args);
 + return printk_emit_string(facility, level, dict, dictlen,
 +   textbuf, text_len);
 +}
 +EXPORT_SYMBOL(vprintk_emit);
 +
 +asmlinkage int printk_emit_string(int facility, int level,
 +   const char *dict, size_t dictlen,
 +   char *textbuf, size_t text_len)
 +{
 + static int recursion_bug;
 + char *text = textbuf;
 + enum log_flags lflags = 0;
 + unsigned long flags;
 + int this_cpu;
 + int printed_len = 0;
 + bool in_sched = false;
 + /* cpu currently holding logbuf_lock in this function */
 + static volatile unsigned int logbuf_cpu = UINT_MAX;

We should make sure that text_len is lower or equal LOG_LINE_MAX.

I am afraid that printk() code is not able to process longer
lines. For example, syslog_print() does:

   text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);

Then it calls msg_print_text() that works with entire messages. So,
any longer message would freeze syslog_print() because it would newer
fit into the buffer.

I guess that there are more locations like this.

Maybe, we should make LOG_LINE_MAX public, so it could be used on the
other location either to allocate the buffer or to check the size.

Best Regards,
Petr
  
   boot_delay_msec(level);
   printk_delay();
 @@ -1652,6 +1659,11 @@ asmlinkage int vprintk_emit(int facility, int level,
   local_irq_save(flags);
   this_cpu = smp_processor_id();
  
 + if (level == SCHED_MESSAGE_LOGLEVEL) {
 + level = -1;
 + in_sched = true;
 + }
 +
   /*
* Ouch, printk recursed into itself!
*/
 @@ -1789,7 +1801,7 @@ asmlinkage int vprintk_emit(int facility, int level,
  
   return printed_len;
  }
 -EXPORT_SYMBOL(vprintk_emit);
 +EXPORT_SYMBOL(printk_emit_string);
  
  asmlinkage int vprintk(const char *fmt, va_list args)
  {
 -- 
 1.8.5.2
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
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: targetcli do not show iscsi

2014-09-30 Thread Luigi Tarenga


iscsi is not a supported fabric on rhel/centos 6. Only FCoE uses 
LIO. scsi-target-utils (tgt) is the supported iscsi target on rhel6. 
rhel7 uses LIO for both, as does Fedora.


Regards -- Andy


Hi Andy,
I see LIO is a technology preview on rhel 6 but I'm not looking for 
official support, just play with it :)
that said I have a custom kernel compiled from vanilla so if we 
esclude some problem with
udev or other userspace services only kernel modules and targetcli is 
involved in this configuration.
I hope someone that maintain this module have some time to help me to 
get it running otherwise
I will try to use scst  (actually I compiled and installed it but 
still have to configure it).


My final goal is to have a litttle lab that let me write an 
integration module for my failover cluster
manager ( https://code.google.com/p/back-to-work/ ). I need to 
implement scsi fencing without

destroying a production server connected to a real SAN :P

Luigi


Maybe I misunderstood your statement. Are you saying that
the targetcli I'm using (fb16) does not support iscsi fabric?
In this case I will try to use the git version.

Luigi



got it working :D

# targetcli
targetcli shell version 2.1.fb37
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/ ls
o- / 
.. 
[...]
  o- backstores 
... 
[...]
  | o- block 
... 
[Storage Objects: 0]
  | o- fileio 
.. 
[Storage Objects: 0]
  | o- pscsi 
... 
[Storage Objects: 0]
  | o- ramdisk 
. 
[Storage Objects: 0]
  o- iscsi 
. 
[Targets: 0]
  o- loopback 
.. 
[Targets: 0]
  o- sbp 
... 
[Targets: 0]
  o- vhost 
. 
[Targets: 0]

/

I installed the last version from 
https://fedorahosted.org/releases/t/a/targetcli-fb/
and fortunally I had  python2.7 installed in /usr/local (I don't 
remember why I installed it :D)


builded and installed using python2.7

Thanks Andy for your hint and excuse me if I seemed stubborn :)
Thank to Martin too for his support!

regards
Luigi
--
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: targetcli do not show iscsi

2014-09-30 Thread Jerome Martin

On 09/30/2014 06:49 PM, Luigi Tarenga wrote:

Thanks Andy for your hint and excuse me if I seemed stubborn :)
Thank to Martin too for his support!


The first name's Jerome :-)

Just a quick note, as you are apparently doing some RD, may I suggest 
that you test v3.x instead ? I can use all reports I can get, and this 
is the way forward :-)


Regards,
--
Jerome
--
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: targetcli do not show iscsi

2014-09-30 Thread Jerome Martin

On 09/30/2014 07:01 PM, Luigi Tarenga wrote:


On 09/30/2014 06:52 PM, Jerome Martin wrote:
oops... ok Jerome I'll be happy to help doing some tests.
Just forgive me, I'm very new to LIO:
what do you mean for v3.x?


I mean targetcli version 3.x


or the targetcli branch from Datera?


OK, as you are new, a little catchup summary :-)

The targetcli branch from Datera is the main targetcli repository.
I am actually the original author of targetcli, and still develop it 
using the Datera repository on GitHub, which is the official home for 
targetcli on the web.


The fb branch done by Andy is a fork of targetcli version 2, and is 
used in RedHat distributions.


If you look a bit in the mailing list, you'll also notice discussions 
with Andy to reunify his fork and my code.


Best,
--
Jerome
--
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: [dm-devel] [PATCH 1/1] multipath-tools: Change path checker for IBM IPR devices

2014-09-30 Thread wenxiong


Quoting Christoph Hellwig h...@infradead.org:


On Thu, Sep 25, 2014 at 11:47:42AM -0500, Brian King wrote:

The issue we've run into started when this patch started making its
way into distros:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/scsi/scsi_error.c?id=14216561e164671ce147458653b1fea06a4ada1e

That changed the behaviour for user initiated TUR commands. After an ipr
adapter gets reset, all disk array devices require a start unit command
to be issued to them before they will accept commands. So, with the SCSI
EH change, we now end up in a scenario with dual ipr adapters where the
TUR getting issued from the health checker returns with a Not Ready response
and since SCSI EH no longer triggers the Start Unit in this scenario,
the path never recovers.

The alternative solution would be to change the TUR path checker in  
multipath-tools

to issue a Start Unit if it sees a 02/04/02.


Or we could fix up the check introduced by the commit, with something
ala:

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a2c3d3d..7228d9e 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -459,13 +459,18 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
if (! scsi_command_normalize_sense(scmd, sshdr))
return FAILED;  /* no valid sense data */

-   if (scmd-cmnd[0] == TEST_UNIT_READY  scmd-scsi_done != scsi_eh_done)
+   if (scmd-cmnd[0] == TEST_UNIT_READY 
+   scmd-request-cmd_type == REQ_TYPE_FS 
+   scmd-scsi_done != scsi_eh_done) {
/*
 * nasty: for mid-layer issued TURs, we need to return the
 * actual sense data without any recovery attempt.  For eh
-* issued ones, we need to try to recover and interpret
+* issued ones, we need to try to recover and interpret,
+* and for pass through TURs we just need to stay out of the
+* way, so that the device handlers can do the right thing.
 */
return SUCCESS;
+   }

scsi_report_sense(sdev, sshdr);




Hi Christoph,

We have verified above patch in our test group system yesterday and  
today. It works fine with their testcases.


Thanks,
Wendy




Thanks,

Brian

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


--
dm-devel mailing list
dm-de...@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

---end quoted text---

--
dm-devel mailing list
dm-de...@redhat.com
https://www.redhat.com/mailman/listinfo/dm-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


Re: [PATCH 23/23] scsi_trace: add tracepoint for completion

2014-09-30 Thread Hannes Reinecke

On 09/30/2014 05:21 PM, Christoph Hellwig wrote:

On Tue, Sep 30, 2014 at 01:50:52PM +0200, Hannes Reinecke wrote:

A tracepoint should be inserted upon completion to make tracing
equivalent to logging.

Signed-off-by: Hannes Reinecke h...@suse.de
---
  drivers/scsi/scsi_lib.c |  1 +
  drivers/scsi/scsi_trace.c   | 16 
  include/trace/events/scsi.h | 31 +++
  3 files changed, 48 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2df485f..5c67e4e 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1626,6 +1626,7 @@ static void scsi_softirq_done(struct request *rq)
}

scsi_log_completion(cmd, disposition);
+   trace_scsi_cmd_completion(cmd, disposition);

switch (disposition) {
case SUCCESS:
diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c
index 503594e..51a7737 100644
--- a/drivers/scsi/scsi_trace.c
+++ b/drivers/scsi/scsi_trace.c
@@ -286,3 +286,19 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char 
*cdb, int len)
return scsi_trace_misc(p, cdb, len);
}
  }
+
+const char *
+scsi_trace_mlreturn_name(struct trace_seq *p, int rtn)
+{
+   const char *ret = trace_seq_buffer_ptr(p);
+   const char *mlstr = scsi_mlreturn_string(rtn);
+
+   if (mlstr)
+   trace_seq_printf(p, %s, mlstr);
+   else
+   trace_seq_printf(p, UNKNOWN (0x%x), rtn);
+
+   trace_seq_putc(p, 0);
+
+   return ret;
+}


Nak, again this doesn't do the right thing for binary tracing.  Please
use __print_symbolic instead.


Okay, will be dropping it. It's of no consequence for the patchset.

Cheers,

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


Re: [PATCH 27/38] Rearrange buffer formatting in printk()

2014-09-30 Thread Petr Mladek
On Tue 30-09-14 18:16:20, Petr Mladek wrote:
 On Mon 29-09-14 13:58:56, Hannes Reinecke wrote:
  Move buffer formatting to the start of the function as it
  doesn't require to be done under any locks.
  No functional change, required by the next patch.
  
  Cc: Steven Rostedt rost...@goodmis.org
  Cc: LKML linux-ker...@vger.kernel.org
 
 printk stuff is maintained by Andrew in mm tree, so adding him into CC.
 
  Signed-off-by: Hannes Reinecke h...@suse.de
 
 Reviewed-by: Petr Mladek pmla...@suse.cz

I have just realized that textbuf[LOG_LINE_MAX] is a static variable.
It means that it must be used under the lock and this patch is wrong.
I want to take back the Reviewed-by and instead do

Nacked-by: Petr Mladek pmla...@suse.cz

also it means that it does not take the extra space on the stack
and you probably does not need the two patches at all.

Best Regards,
Petr
 
 I do not see any obvious problem. Just note that
 [sched_delayed] has already been removed in -mm tree. You might
 want to base this patch on top of the commit 460d73c35ffa17979422290
 (printk: git rid of [sched_delayed] message for printk_deferred)
 from linux-next.
 
 Best Regards,
 Petr
 
  ---
   kernel/printk/printk.c | 21 ++---
   1 file changed, 10 insertions(+), 11 deletions(-)
  
  diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
  index 1ce7706..d13675e 100644
  --- a/kernel/printk/printk.c
  +++ b/kernel/printk/printk.c
  @@ -1633,8 +1633,18 @@ asmlinkage int vprintk_emit(int facility, int level,
  if (level == SCHED_MESSAGE_LOGLEVEL) {
  level = -1;
  in_sched = true;
  +
  +   /*
  +* The printf needs to come first; we need the syslog
  +* prefix which might be passed-in as a parameter.
  +*/
  +   text_len = scnprintf(text, sizeof(textbuf),
  +KERN_WARNING [sched_delayed] );
  }
   
  +   text_len += vscnprintf(text + text_len,
  +  sizeof(textbuf) - text_len, fmt, args);
  +
  boot_delay_msec(level);
  printk_delay();
   
  @@ -1676,17 +1686,6 @@ asmlinkage int vprintk_emit(int facility, int level,
   strlen(recursion_msg));
  }
   
  -   /*
  -* The printf needs to come first; we need the syslog
  -* prefix which might be passed-in as a parameter.
  -*/
  -   if (in_sched)
  -   text_len = scnprintf(text, sizeof(textbuf),
  -KERN_WARNING [sched_delayed] );
  -
  -   text_len += vscnprintf(text + text_len,
  -  sizeof(textbuf) - text_len, fmt, args);
  -
  /* mark and strip a trailing newline */
  if (text_len  text[text_len-1] == '\n') {
  text_len--;
  -- 
  1.8.5.2
  
  --
  To unsubscribe from this list: send the line unsubscribe linux-kernel in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
  Please read the FAQ at  http://www.tux.org/lkml/
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
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 v2 3/6] kthread: warn on kill signal if not OOM

2014-09-30 Thread Pavel Machek

On Mon 2014-09-22 13:23:54, Dmitry Torokhov wrote:
 On Monday, September 22, 2014 09:49:06 PM Pavel Machek wrote:
  On Thu 2014-09-11 13:23:54, Dmitry Torokhov wrote:
   On Thu, Sep 11, 2014 at 12:59:25PM -0700, James Bottomley wrote:

Yes, but we mostly do this anyway.  SCSI for instance does asynchronous
scanning of attached devices (once the cards are probed)
   
   What would it do it card was a bit slow to probe?
   
but has a sync
point for ordering.
   
   Quite often we do not really care about ordering of devices. I mean,
   does it matter if your mouse is discovered before your keyboard or
   after?
  
  Actually yes, I suspect it does.
  
  I do evtest /dev/input/eventX by hand, occassionaly. It would be
  annoying if they moved between reboots.
 
 I am sorry but you will have to cope with such annoyances. It' snot like we 
 fail to boot the box here.
 
 The systems are now mostly hot-pluggable and userland is supposed to
 handle it, and it does, at least for input devices. If you want stable naming
 use udev facilities to rename devices as needed or add needed symlinks 
 (by-id, 
 etc.).

Well, it would be nice if udev was not mandatory. Do the sync points
for ordering actually cost us something?
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v2 3/6] kthread: warn on kill signal if not OOM

2014-09-30 Thread Dmitry Torokhov
On Tue, Sep 30, 2014 at 11:06:34PM +0200, Pavel Machek wrote:
 
 On Mon 2014-09-22 13:23:54, Dmitry Torokhov wrote:
  On Monday, September 22, 2014 09:49:06 PM Pavel Machek wrote:
   On Thu 2014-09-11 13:23:54, Dmitry Torokhov wrote:
On Thu, Sep 11, 2014 at 12:59:25PM -0700, James Bottomley wrote:
 
 Yes, but we mostly do this anyway.  SCSI for instance does 
 asynchronous
 scanning of attached devices (once the cards are probed)

What would it do it card was a bit slow to probe?

 but has a sync
 point for ordering.

Quite often we do not really care about ordering of devices. I mean,
does it matter if your mouse is discovered before your keyboard or
after?
   
   Actually yes, I suspect it does.
   
   I do evtest /dev/input/eventX by hand, occassionaly. It would be
   annoying if they moved between reboots.
  
  I am sorry but you will have to cope with such annoyances. It' snot like we 
  fail to boot the box here.
  
  The systems are now mostly hot-pluggable and userland is supposed to
  handle it, and it does, at least for input devices. If you want stable 
  naming
  use udev facilities to rename devices as needed or add needed symlinks 
  (by-id, 
  etc.).
 
 Well, it would be nice if udev was not mandatory. Do the sync points
 for ordering actually cost us something?

Yes, boot time. We can save a second or two off the boot time if we probe
several devices/drivers simultaneously.

Thanks.

-- 
Dmitry
--
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 V6 02/18] scsi: sysfs: don't add scsi_device if its already added

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

 If LLD has added scsi device (by calling scsi_add_device) before
 scheduling async scsi_scan_host then scsi_finish_async_scan() will
 end up calling scsi_sysfs_add_sdev for scsi device which was already
 added by LLD.  This patch fixes this issue by skipping the call to
 scsi_sysfs_add_sdev() if it's already visible to rest of the kernel.

Reviewed-by: Martin K. Petersen martin.peter...@oracle.com

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


Re: [PATCH] scsi: add a CONFIG_SCSI_MQ_DEFAULT option

2014-09-30 Thread Martin K. Petersen
 Christoph == Christoph Hellwig h...@lst.de writes:

Christoph Add a Kconfig option to enable the blk-mq path for SCSI by
Christoph default to ease testing and deployment in setups that know
Christoph they benefit from blk-mq.

Looks OK to me.

Reviewed-by: Martin K. Petersen martin.peter...@oracle.com

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


RE: [PATCH] scsi: add a CONFIG_SCSI_MQ_DEFAULT option

2014-09-30 Thread Elliott, Robert (Server Storage)


 -Original Message-
 From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
 ow...@vger.kernel.org] On Behalf Of Christoph Hellwig
...
 Add a Kconfig option to enable the blk-mq path for SCSI by default
 to ease testing and deployment in setups that know they benefit
 from blk-mq.
...
 diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
 index 1423cb1..79c77b4 100644
 --- a/drivers/scsi/scsi.c
 +++ b/drivers/scsi/scsi.c
 @@ -1367,7 +1367,11 @@ MODULE_LICENSE(GPL);
  module_param(scsi_logging_level, int, S_IRUGO|S_IWUSR);
  MODULE_PARM_DESC(scsi_logging_level, a bit mask of logging levels);
 
 +#ifdef CONFIG_SCSI_MQ_DEFAULT
 +bool scsi_use_blk_mq = true;
 +#else
  bool scsi_use_blk_mq = false;
 +#endif
  module_param_named(use_blk_mq, scsi_use_blk_mq, bool, S_IWUSR | S_IRUGO);
 
  static int __init init_scsi(void)

A printk indicating the choice would be helpful; there's no indication
in the Command line or Kernel command line lines after this patch.

Reviewed-by: Robert Elliott elli...@hp.com
Tested-by: Robert Elliott elli...@hp.com

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


RE: [PATCH scsi] cxgb4i : Avoid holding mutex in interrupt context

2014-09-30 Thread Anish Bhatt
Little late, but I was hoping this would be pushed as part of fixes to 3.17. 
Is it too late for that ?
-Anish

From: Christoph Hellwig [h...@infradead.org]
Sent: Monday, September 22, 2014 7:45 AM
To: Anish Bhatt
Cc: linux-scsi@vger.kernel.org; jbottom...@parallels.com; Karen Xie; Manoj 
Malviya
Subject: Re: [PATCH scsi] cxgb4i : Avoid holding mutex in interrupt context

Thanks,

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