<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/scsi/scsi_scan.c, branch v3.4.83</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>SCSI: Fix 'Device not ready' issue on mpt2sas</title>
<updated>2012-09-14T17:00:32+00:00</updated>
<author>
<name>James Bottomley</name>
<email>JBottomley@Parallels.com</email>
</author>
<published>2012-07-25T19:55:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d3ed1731ba6bca32ac0ac96377cae8fd735e16e6'/>
<id>d3ed1731ba6bca32ac0ac96377cae8fd735e16e6</id>
<content type='text'>
commit 14216561e164671ce147458653b1fea06a4ada1e upstream.

This is a particularly nasty SCSI ATA Translation Layer (SATL) problem.

SAT-2 says (section 8.12.2)

        if the device is in the stopped state as the result of
        processing a START STOP UNIT command (see 9.11), then the SATL
        shall terminate the TEST UNIT READY command with CHECK CONDITION
        status with the sense key set to NOT READY and the additional
        sense code of LOGICAL UNIT NOT READY, INITIALIZING COMMAND
        REQUIRED;

mpt2sas internal SATL seems to implement this.  The result is very confusing
standby behaviour (using hdparm -y).  If you suspend a drive and then send
another command, usually it wakes up.  However, if the next command is a TEST
UNIT READY, the SATL sees that the drive is suspended and proceeds to follow
the SATL rules for this, returning NOT READY to all subsequent commands.  This
means that the ordering of TEST UNIT READY is crucial: if you send TUR and
then a command, you get a NOT READY to both back.  If you send a command and
then a TUR, you get GOOD status because the preceeding command woke the drive.

This bit us badly because

commit 85ef06d1d252f6a2e73b678591ab71caad4667bb
Author: Tejun Heo &lt;tj@kernel.org&gt;
Date:   Fri Jul 1 16:17:47 2011 +0200

    block: flush MEDIA_CHANGE from drivers on close(2)

Changed our ordering on TEST UNIT READY commands meaning that SATA drives
connected to an mpt2sas now suspend and refuse to wake (because the mpt2sas
SATL sees the suspend *before* the drives get awoken by the next ATA command)
resulting in lots of failed commands.

The standard is completely nuts forcing this inconsistent behaviour, but we
have to work around it.

The fix for this is twofold:

   1. Set the allow_restart flag so we wake the drive when we see it has been
      suspended

   2. Return all TEST UNIT READY status directly to the mid layer without any
      further error handling which prevents us causing error handling which
      may offline the device just because of a media check TUR.

Reported-by: Matthias Prager &lt;linux@matthiasprager.de&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 14216561e164671ce147458653b1fea06a4ada1e upstream.

This is a particularly nasty SCSI ATA Translation Layer (SATL) problem.

SAT-2 says (section 8.12.2)

        if the device is in the stopped state as the result of
        processing a START STOP UNIT command (see 9.11), then the SATL
        shall terminate the TEST UNIT READY command with CHECK CONDITION
        status with the sense key set to NOT READY and the additional
        sense code of LOGICAL UNIT NOT READY, INITIALIZING COMMAND
        REQUIRED;

mpt2sas internal SATL seems to implement this.  The result is very confusing
standby behaviour (using hdparm -y).  If you suspend a drive and then send
another command, usually it wakes up.  However, if the next command is a TEST
UNIT READY, the SATL sees that the drive is suspended and proceeds to follow
the SATL rules for this, returning NOT READY to all subsequent commands.  This
means that the ordering of TEST UNIT READY is crucial: if you send TUR and
then a command, you get a NOT READY to both back.  If you send a command and
then a TUR, you get GOOD status because the preceeding command woke the drive.

This bit us badly because

commit 85ef06d1d252f6a2e73b678591ab71caad4667bb
Author: Tejun Heo &lt;tj@kernel.org&gt;
Date:   Fri Jul 1 16:17:47 2011 +0200

    block: flush MEDIA_CHANGE from drivers on close(2)

Changed our ordering on TEST UNIT READY commands meaning that SATA drives
connected to an mpt2sas now suspend and refuse to wake (because the mpt2sas
SATL sees the suspend *before* the drives get awoken by the next ATA command)
resulting in lots of failed commands.

The standard is completely nuts forcing this inconsistent behaviour, but we
have to work around it.

The fix for this is twofold:

   1. Set the allow_restart flag so we wake the drive when we see it has been
      suspended

   2. Return all TEST UNIT READY status directly to the mid layer without any
      further error handling which prevents us causing error handling which
      may offline the device just because of a media check TUR.

Reported-by: Matthias Prager &lt;linux@matthiasprager.de&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>SCSI: fix hot unplug vs async scan race</title>
<updated>2012-08-09T15:31:28+00:00</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2012-06-22T06:47:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f07d3f59e35eb0fc8847587f601f84b8cfa8dd38'/>
<id>f07d3f59e35eb0fc8847587f601f84b8cfa8dd38</id>
<content type='text'>
commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.

The following crash results from cases where the end_device has been
removed before scsi_sysfs_add_sdev has had a chance to run.

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
 IP: [&lt;ffffffff8115e100&gt;] sysfs_create_dir+0x32/0xb6
 ...
 Call Trace:
  [&lt;ffffffff8125e4a8&gt;] kobject_add_internal+0x120/0x1e3
  [&lt;ffffffff81075149&gt;] ? trace_hardirqs_on+0xd/0xf
  [&lt;ffffffff8125e641&gt;] kobject_add_varg+0x41/0x50
  [&lt;ffffffff8125e70b&gt;] kobject_add+0x64/0x66
  [&lt;ffffffff8131122b&gt;] device_add+0x12d/0x63a
  [&lt;ffffffff814b65ea&gt;] ? _raw_spin_unlock_irqrestore+0x47/0x56
  [&lt;ffffffff8107de15&gt;] ? module_refcount+0x89/0xa0
  [&lt;ffffffff8132f348&gt;] scsi_sysfs_add_sdev+0x4e/0x28a
  [&lt;ffffffff8132dcbb&gt;] do_scan_async+0x9c/0x145

...teach scsi_sysfs_add_devices() to check for deleted devices() before
trying to add them, and teach scsi_remove_target() how to remove targets
that have not been added via device_add().

Reported-by: Dariusz Majchrzak &lt;dariusz.majchrzak@intel.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.

The following crash results from cases where the end_device has been
removed before scsi_sysfs_add_sdev has had a chance to run.

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
 IP: [&lt;ffffffff8115e100&gt;] sysfs_create_dir+0x32/0xb6
 ...
 Call Trace:
  [&lt;ffffffff8125e4a8&gt;] kobject_add_internal+0x120/0x1e3
  [&lt;ffffffff81075149&gt;] ? trace_hardirqs_on+0xd/0xf
  [&lt;ffffffff8125e641&gt;] kobject_add_varg+0x41/0x50
  [&lt;ffffffff8125e70b&gt;] kobject_add+0x64/0x66
  [&lt;ffffffff8131122b&gt;] device_add+0x12d/0x63a
  [&lt;ffffffff814b65ea&gt;] ? _raw_spin_unlock_irqrestore+0x47/0x56
  [&lt;ffffffff8107de15&gt;] ? module_refcount+0x89/0xa0
  [&lt;ffffffff8132f348&gt;] scsi_sysfs_add_sdev+0x4e/0x28a
  [&lt;ffffffff8132dcbb&gt;] do_scan_async+0x9c/0x145

...teach scsi_sysfs_add_devices() to check for deleted devices() before
trying to add them, and teach scsi_remove_target() how to remove targets
that have not been added via device_add().

Reported-by: Dariusz Majchrzak &lt;dariusz.majchrzak@intel.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>Merge 3.3-rc7 into usb-next</title>
<updated>2012-03-12T16:13:31+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2012-03-12T16:13:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f7a0d426f3e7ec321b8037238b6426566df36edb'/>
<id>f7a0d426f3e7ec321b8037238b6426566df36edb</id>
<content type='text'>
This resolves the conflict with drivers/usb/host/ehci-fsl.h that
happened with changes in Linus's and this branch at the same time.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This resolves the conflict with drivers/usb/host/ehci-fsl.h that
happened with changes in Linus's and this branch at the same time.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] scsi_scan: Fix 'Poison overwritten' warning caused by using freed 'shost'</title>
<updated>2012-02-18T14:52:48+00:00</updated>
<author>
<name>Huajun Li</name>
<email>huajun.li.lee@gmail.com</email>
</author>
<published>2012-02-12T11:59:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=267a6ad4aefaafbde607804c60945bcf97f91c1b'/>
<id>267a6ad4aefaafbde607804c60945bcf97f91c1b</id>
<content type='text'>
In do_scan_async(), calling scsi_autopm_put_host(shost) may reference
freed shost, and cause Posison overwitten warning.
Yes, this case can happen, for example, an USB is disconnected just
when do_scan_async() thread starts to run, then scsi_host_put() called
in scsi_finish_async_scan() will lead to shost be freed(because the
refcount of shost-&gt;shost_gendev decreases to 1 after USB disconnects),
at this point, if references shost again, system will show following
warning msg.

To make scsi_autopm_put_host(shost) always reference a valid shost,
put it just before scsi_host_put() in function
scsi_finish_async_scan().

[  299.281565] =============================================================================
[  299.281634] BUG kmalloc-4096 (Tainted: G          I ): Poison overwritten
[  299.281682] -----------------------------------------------------------------------------
[  299.281684]
[  299.281752] INFO: 0xffff880056c305d0-0xffff880056c305d0. First byte
0x6a instead of 0x6b
[  299.281816] INFO: Allocated in scsi_host_alloc+0x4a/0x490 age=1688
cpu=1 pid=2004
[  299.281870] 	__slab_alloc+0x617/0x6c1
[  299.281901] 	__kmalloc+0x28c/0x2e0
[  299.281931] 	scsi_host_alloc+0x4a/0x490
[  299.281966] 	usb_stor_probe1+0x5b/0xc40 [usb_storage]
[  299.282010] 	storage_probe+0xa4/0xe0 [usb_storage]
[  299.282062] 	usb_probe_interface+0x172/0x330 [usbcore]
[  299.282105] 	driver_probe_device+0x257/0x3b0
[  299.282138] 	__driver_attach+0x103/0x110
[  299.282171] 	bus_for_each_dev+0x8e/0xe0
[  299.282201] 	driver_attach+0x26/0x30
[  299.282230] 	bus_add_driver+0x1c4/0x430
[  299.282260] 	driver_register+0xb6/0x230
[  299.282298] 	usb_register_driver+0xe5/0x270 [usbcore]
[  299.282337] 	0xffffffffa04ab03d
[  299.282364] 	do_one_initcall+0x47/0x230
[  299.282396] 	sys_init_module+0xa0f/0x1fe0
[  299.282429] INFO: Freed in scsi_host_dev_release+0x18a/0x1d0 age=85
cpu=0 pid=2008
[  299.282482] 	__slab_free+0x3c/0x2a1
[  299.282510] 	kfree+0x296/0x310
[  299.282536] 	scsi_host_dev_release+0x18a/0x1d0
[  299.282574] 	device_release+0x74/0x100
[  299.282606] 	kobject_release+0xc7/0x2a0
[  299.282637] 	kobject_put+0x54/0xa0
[  299.282668] 	put_device+0x27/0x40
[  299.282694] 	scsi_host_put+0x1d/0x30
[  299.282723] 	do_scan_async+0x1fc/0x2b0
[  299.282753] 	kthread+0xdf/0xf0
[  299.282782] 	kernel_thread_helper+0x4/0x10
[  299.282817] INFO: Slab 0xffffea00015b0c00 objects=7 used=7 fp=0x
      (null) flags=0x100000000004080
[  299.282882] INFO: Object 0xffff880056c30000 @offset=0 fp=0x          (null)
[  299.282884]
...

Signed-off-by: Huajun Li &lt;huajun.li.lee@gmail.com&gt;
Cc: stable@kernel.org
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In do_scan_async(), calling scsi_autopm_put_host(shost) may reference
freed shost, and cause Posison overwitten warning.
Yes, this case can happen, for example, an USB is disconnected just
when do_scan_async() thread starts to run, then scsi_host_put() called
in scsi_finish_async_scan() will lead to shost be freed(because the
refcount of shost-&gt;shost_gendev decreases to 1 after USB disconnects),
at this point, if references shost again, system will show following
warning msg.

To make scsi_autopm_put_host(shost) always reference a valid shost,
put it just before scsi_host_put() in function
scsi_finish_async_scan().

[  299.281565] =============================================================================
[  299.281634] BUG kmalloc-4096 (Tainted: G          I ): Poison overwritten
[  299.281682] -----------------------------------------------------------------------------
[  299.281684]
[  299.281752] INFO: 0xffff880056c305d0-0xffff880056c305d0. First byte
0x6a instead of 0x6b
[  299.281816] INFO: Allocated in scsi_host_alloc+0x4a/0x490 age=1688
cpu=1 pid=2004
[  299.281870] 	__slab_alloc+0x617/0x6c1
[  299.281901] 	__kmalloc+0x28c/0x2e0
[  299.281931] 	scsi_host_alloc+0x4a/0x490
[  299.281966] 	usb_stor_probe1+0x5b/0xc40 [usb_storage]
[  299.282010] 	storage_probe+0xa4/0xe0 [usb_storage]
[  299.282062] 	usb_probe_interface+0x172/0x330 [usbcore]
[  299.282105] 	driver_probe_device+0x257/0x3b0
[  299.282138] 	__driver_attach+0x103/0x110
[  299.282171] 	bus_for_each_dev+0x8e/0xe0
[  299.282201] 	driver_attach+0x26/0x30
[  299.282230] 	bus_add_driver+0x1c4/0x430
[  299.282260] 	driver_register+0xb6/0x230
[  299.282298] 	usb_register_driver+0xe5/0x270 [usbcore]
[  299.282337] 	0xffffffffa04ab03d
[  299.282364] 	do_one_initcall+0x47/0x230
[  299.282396] 	sys_init_module+0xa0f/0x1fe0
[  299.282429] INFO: Freed in scsi_host_dev_release+0x18a/0x1d0 age=85
cpu=0 pid=2008
[  299.282482] 	__slab_free+0x3c/0x2a1
[  299.282510] 	kfree+0x296/0x310
[  299.282536] 	scsi_host_dev_release+0x18a/0x1d0
[  299.282574] 	device_release+0x74/0x100
[  299.282606] 	kobject_release+0xc7/0x2a0
[  299.282637] 	kobject_put+0x54/0xa0
[  299.282668] 	put_device+0x27/0x40
[  299.282694] 	scsi_host_put+0x1d/0x30
[  299.282723] 	do_scan_async+0x1fc/0x2b0
[  299.282753] 	kthread+0xdf/0xf0
[  299.282782] 	kernel_thread_helper+0x4/0x10
[  299.282817] INFO: Slab 0xffffea00015b0c00 objects=7 used=7 fp=0x
      (null) flags=0x100000000004080
[  299.282882] INFO: Object 0xffff880056c30000 @offset=0 fp=0x          (null)
[  299.282884]
...

Signed-off-by: Huajun Li &lt;huajun.li.lee@gmail.com&gt;
Cc: stable@kernel.org
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>SCSI &amp; usb-storage: add flags for VPD pages and REPORT LUNS</title>
<updated>2012-02-09T01:36:41+00:00</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2012-01-10T18:43:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=09b6b51b0b6c1b9bb61815baf205e4d74c89ff04'/>
<id>09b6b51b0b6c1b9bb61815baf205e4d74c89ff04</id>
<content type='text'>
This patch (as1507) adds a skip_vpd_pages flag to struct scsi_device
and a no_report_luns flag to struct scsi_target.  The first is used to
control whether sd will look at VPD pages for information on block
provisioning, limits, and characteristics.  The second prevents
scsi_report_lun_scan() from issuing a REPORT LUNS command.

The patch also modifies usb-storage to set the new flag bits for all
USB devices and targets, and to stop adjusting the scsi_level value.

Historically we have seen that USB mass-storage devices often don't
support VPD pages or REPORT LUNS properly.  Until now we have avoided
these things by setting the scsi_level to SCSI_2 for all USB devices.
But this has the side effect of storing the LUN bits into the second
byte of each CDB, and now we have a report of a device which doesn't
like that.  The best solution is to stop abusing scsi_level and
instead have separate flags for VPD pages and REPORT LUNS.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Perry Wagle &lt;wagle@mac.com&gt;
CC: Matthew Dharm &lt;mdharm-usb@one-eyed-alien.net&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch (as1507) adds a skip_vpd_pages flag to struct scsi_device
and a no_report_luns flag to struct scsi_target.  The first is used to
control whether sd will look at VPD pages for information on block
provisioning, limits, and characteristics.  The second prevents
scsi_report_lun_scan() from issuing a REPORT LUNS command.

The patch also modifies usb-storage to set the new flag bits for all
USB devices and targets, and to stop adjusting the scsi_level value.

Historically we have seen that USB mass-storage devices often don't
support VPD pages or REPORT LUNS properly.  Until now we have avoided
these things by setting the scsi_level to SCSI_2 for all USB devices.
But this has the side effect of storing the LUN bits into the second
byte of each CDB, and now we have a report of a device which doesn't
like that.  The best solution is to stop abusing scsi_level and
instead have separate flags for VPD pages and REPORT LUNS.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Perry Wagle &lt;wagle@mac.com&gt;
CC: Matthew Dharm &lt;mdharm-usb@one-eyed-alien.net&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>block: misc updates to blk_get_queue()</title>
<updated>2011-12-13T23:33:38+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-12-13T23:33:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=09ac46c429464c919d04bb737b27edd84d944f02'/>
<id>09ac46c429464c919d04bb737b27edd84d944f02</id>
<content type='text'>
* blk_get_queue() is peculiar in that it returns 0 on success and 1 on
  failure instead of 0 / -errno or boolean.  Update it such that it
  returns %true on success and %false on failure.

* Make sure the caller checks for the return value.

* Separate out __blk_get_queue() which doesn't check whether @q is
  dead and put it in blk.h.  This will be used later.

This patch doesn't introduce any functional changes.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* blk_get_queue() is peculiar in that it returns 0 on success and 1 on
  failure instead of 0 / -errno or boolean.  Update it such that it
  returns %true on success and %false on failure.

* Make sure the caller checks for the return value.

* Separate out __blk_get_queue() which doesn't check whether @q is
  dead and put it in blk.h.  This will be used later.

This patch doesn't introduce any functional changes.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] fix WARNING: at drivers/scsi/scsi_lib.c:1704</title>
<updated>2011-11-09T18:05:23+00:00</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@HansenPartnership.com</email>
</author>
<published>2011-11-07T14:51:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4e6c82b3614a18740ef63109d58743a359266daf'/>
<id>4e6c82b3614a18740ef63109d58743a359266daf</id>
<content type='text'>
On Mon, 2011-11-07 at 17:24 +1100, Stephen Rothwell wrote:
&gt; Hi all,
&gt;
&gt; Starting some time last week I am getting the following during boot on
&gt; our PPC970 blade:
&gt;
&gt; calling  .ipr_init+0x0/0x68 @ 1
&gt; ipr: IBM Power RAID SCSI Device Driver version: 2.5.2 (April 27, 2011)
&gt; ipr 0000:01:01.0: Found IOA with IRQ: 26
&gt; ipr 0000:01:01.0: Starting IOA initialization sequence.
&gt; ipr 0000:01:01.0: Adapter firmware version: 06160039
&gt; ipr 0000:01:01.0: IOA initialized.
&gt; scsi0 : IBM 572E Storage Adapter
&gt; ------------[ cut here ]------------
&gt; WARNING: at drivers/scsi/scsi_lib.c:1704
&gt; Modules linked in:
&gt; NIP: c00000000053b3d4 LR: c00000000053e5b0 CTR: c000000000541d70
&gt; REGS: c0000000783c2f60 TRAP: 0700   Not tainted  (3.1.0-autokern1)
&gt; MSR: 8000000000029032 &lt;EE,ME,CE,IR,DR&gt;  CR: 24002024  XER: 20000002
&gt; TASK = c0000000783b8000[1] 'swapper' THREAD: c0000000783c0000 CPU: 0
&gt; GPR00: 0000000000000001 c0000000783c31e0 c000000000cf38b0 c00000000239a9d0
&gt; GPR04: c000000000cbe8f8 0000000000000000 c0000000783c3040 0000000000000000
&gt; GPR08: c000000075daf488 c000000078a3b7ff c000000000bcacc8 0000000000000000
&gt; GPR12: 0000000044002028 c000000007ffb000 0000000002e40000 000000000099b800
&gt; GPR16: 0000000000000000 c000000000bba5fc c000000000a61db8 0000000000000000
&gt; GPR20: 0000000001b77200 0000000000000000 c000000078990000 0000000000000001
&gt; GPR24: c000000002396828 0000000000000000 0000000000000000 c000000078a3b938
&gt; GPR28: fffffffffffffffa c0000000008ad2c0 c000000000c7faa8 c00000000239a9d0
&gt; NIP [c00000000053b3d4] .scsi_free_queue+0x24/0x90
&gt; LR [c00000000053e5b0] .scsi_alloc_sdev+0x280/0x2e0
&gt; Call Trace:
&gt; [c0000000783c31e0] [c000000000c7faa8] wireless_seq_fops+0x278d0/0x2eb88 (unreliable)
&gt; [c0000000783c3270] [c00000000053e5b0] .scsi_alloc_sdev+0x280/0x2e0
&gt; [c0000000783c3330] [c00000000053eba0] .scsi_probe_and_add_lun+0x390/0xb40
&gt; [c0000000783c34a0] [c00000000053f7ec] .__scsi_scan_target+0x16c/0x650
&gt; [c0000000783c35f0] [c00000000053fd90] .scsi_scan_channel+0xc0/0x100
&gt; [c0000000783c36a0] [c00000000053fefc] .scsi_scan_host_selected+0x12c/0x1c0
&gt; [c0000000783c3750] [c00000000083dcb4] .ipr_probe+0x2c0/0x390
&gt; [c0000000783c3830] [c0000000003f50b4] .local_pci_probe+0x34/0x50
&gt; [c0000000783c38a0] [c0000000003f5f78] .pci_device_probe+0x148/0x150
&gt; [c0000000783c3950] [c0000000004e1e8c] .driver_probe_device+0xdc/0x210
&gt; [c0000000783c39f0] [c0000000004e20cc] .__driver_attach+0x10c/0x110
&gt; [c0000000783c3a80] [c0000000004e1228] .bus_for_each_dev+0x98/0xf0
&gt; [c0000000783c3b30] [c0000000004e1bf8] .driver_attach+0x28/0x40
&gt; [c0000000783c3bb0] [c0000000004e07d8] .bus_add_driver+0x218/0x340
&gt; [c0000000783c3c60] [c0000000004e2a2c] .driver_register+0x9c/0x1b0
&gt; [c0000000783c3d00] [c0000000003f62d4] .__pci_register_driver+0x64/0x140
&gt; [c0000000783c3da0] [c000000000b99f88] .ipr_init+0x4c/0x68
&gt; [c0000000783c3e20] [c00000000000ad24] .do_one_initcall+0x1a4/0x1e0
&gt; [c0000000783c3ee0] [c000000000b512d0] .kernel_init+0x14c/0x1fc
&gt; [c0000000783c3f90] [c000000000022468] .kernel_thread+0x54/0x70
&gt; Instruction dump:
&gt; ebe1fff8 7c0803a6 4e800020 7c0802a6 fba1ffe8 fbe1fff8 7c7f1b78 f8010010
&gt; f821ff71 e8030398 3120ffff 7c090110 &lt;0b000000&gt; e86303b0 482de065 60000000
&gt; ---[ end trace 759bed76a85e8dec ]---
&gt; scsi 0:0:1:0: Direct-Access     IBM-ESXS MAY2036RC        T106 PQ: 0 ANSI: 5
&gt; ------------[ cut here ]------------
&gt;
&gt; I get lots more of these.  The obvious commit to point the finger at
&gt; is 3308511c93e6 ("[SCSI] Make scsi_free_queue() kill pending SCSI
&gt; commands") but the root cause may be something different.

Caused by

commit f7c9c6bb14f3104608a3a83cadea10a6943d2804
Author: Anton Blanchard &lt;anton@samba.org&gt;
Date:   Thu Nov 3 08:56:22 2011 +1100

    [SCSI] Fix block queue and elevator memory leak in scsi_alloc_sdev

Doesn't completely do the teardown.  The true fix is to do a proper
teardown instead of hand rolling it

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Tested-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Cc: stable@kernel.org	#2.6.38+
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On Mon, 2011-11-07 at 17:24 +1100, Stephen Rothwell wrote:
&gt; Hi all,
&gt;
&gt; Starting some time last week I am getting the following during boot on
&gt; our PPC970 blade:
&gt;
&gt; calling  .ipr_init+0x0/0x68 @ 1
&gt; ipr: IBM Power RAID SCSI Device Driver version: 2.5.2 (April 27, 2011)
&gt; ipr 0000:01:01.0: Found IOA with IRQ: 26
&gt; ipr 0000:01:01.0: Starting IOA initialization sequence.
&gt; ipr 0000:01:01.0: Adapter firmware version: 06160039
&gt; ipr 0000:01:01.0: IOA initialized.
&gt; scsi0 : IBM 572E Storage Adapter
&gt; ------------[ cut here ]------------
&gt; WARNING: at drivers/scsi/scsi_lib.c:1704
&gt; Modules linked in:
&gt; NIP: c00000000053b3d4 LR: c00000000053e5b0 CTR: c000000000541d70
&gt; REGS: c0000000783c2f60 TRAP: 0700   Not tainted  (3.1.0-autokern1)
&gt; MSR: 8000000000029032 &lt;EE,ME,CE,IR,DR&gt;  CR: 24002024  XER: 20000002
&gt; TASK = c0000000783b8000[1] 'swapper' THREAD: c0000000783c0000 CPU: 0
&gt; GPR00: 0000000000000001 c0000000783c31e0 c000000000cf38b0 c00000000239a9d0
&gt; GPR04: c000000000cbe8f8 0000000000000000 c0000000783c3040 0000000000000000
&gt; GPR08: c000000075daf488 c000000078a3b7ff c000000000bcacc8 0000000000000000
&gt; GPR12: 0000000044002028 c000000007ffb000 0000000002e40000 000000000099b800
&gt; GPR16: 0000000000000000 c000000000bba5fc c000000000a61db8 0000000000000000
&gt; GPR20: 0000000001b77200 0000000000000000 c000000078990000 0000000000000001
&gt; GPR24: c000000002396828 0000000000000000 0000000000000000 c000000078a3b938
&gt; GPR28: fffffffffffffffa c0000000008ad2c0 c000000000c7faa8 c00000000239a9d0
&gt; NIP [c00000000053b3d4] .scsi_free_queue+0x24/0x90
&gt; LR [c00000000053e5b0] .scsi_alloc_sdev+0x280/0x2e0
&gt; Call Trace:
&gt; [c0000000783c31e0] [c000000000c7faa8] wireless_seq_fops+0x278d0/0x2eb88 (unreliable)
&gt; [c0000000783c3270] [c00000000053e5b0] .scsi_alloc_sdev+0x280/0x2e0
&gt; [c0000000783c3330] [c00000000053eba0] .scsi_probe_and_add_lun+0x390/0xb40
&gt; [c0000000783c34a0] [c00000000053f7ec] .__scsi_scan_target+0x16c/0x650
&gt; [c0000000783c35f0] [c00000000053fd90] .scsi_scan_channel+0xc0/0x100
&gt; [c0000000783c36a0] [c00000000053fefc] .scsi_scan_host_selected+0x12c/0x1c0
&gt; [c0000000783c3750] [c00000000083dcb4] .ipr_probe+0x2c0/0x390
&gt; [c0000000783c3830] [c0000000003f50b4] .local_pci_probe+0x34/0x50
&gt; [c0000000783c38a0] [c0000000003f5f78] .pci_device_probe+0x148/0x150
&gt; [c0000000783c3950] [c0000000004e1e8c] .driver_probe_device+0xdc/0x210
&gt; [c0000000783c39f0] [c0000000004e20cc] .__driver_attach+0x10c/0x110
&gt; [c0000000783c3a80] [c0000000004e1228] .bus_for_each_dev+0x98/0xf0
&gt; [c0000000783c3b30] [c0000000004e1bf8] .driver_attach+0x28/0x40
&gt; [c0000000783c3bb0] [c0000000004e07d8] .bus_add_driver+0x218/0x340
&gt; [c0000000783c3c60] [c0000000004e2a2c] .driver_register+0x9c/0x1b0
&gt; [c0000000783c3d00] [c0000000003f62d4] .__pci_register_driver+0x64/0x140
&gt; [c0000000783c3da0] [c000000000b99f88] .ipr_init+0x4c/0x68
&gt; [c0000000783c3e20] [c00000000000ad24] .do_one_initcall+0x1a4/0x1e0
&gt; [c0000000783c3ee0] [c000000000b512d0] .kernel_init+0x14c/0x1fc
&gt; [c0000000783c3f90] [c000000000022468] .kernel_thread+0x54/0x70
&gt; Instruction dump:
&gt; ebe1fff8 7c0803a6 4e800020 7c0802a6 fba1ffe8 fbe1fff8 7c7f1b78 f8010010
&gt; f821ff71 e8030398 3120ffff 7c090110 &lt;0b000000&gt; e86303b0 482de065 60000000
&gt; ---[ end trace 759bed76a85e8dec ]---
&gt; scsi 0:0:1:0: Direct-Access     IBM-ESXS MAY2036RC        T106 PQ: 0 ANSI: 5
&gt; ------------[ cut here ]------------
&gt;
&gt; I get lots more of these.  The obvious commit to point the finger at
&gt; is 3308511c93e6 ("[SCSI] Make scsi_free_queue() kill pending SCSI
&gt; commands") but the root cause may be something different.

Caused by

commit f7c9c6bb14f3104608a3a83cadea10a6943d2804
Author: Anton Blanchard &lt;anton@samba.org&gt;
Date:   Thu Nov 3 08:56:22 2011 +1100

    [SCSI] Fix block queue and elevator memory leak in scsi_alloc_sdev

Doesn't completely do the teardown.  The true fix is to do a proper
teardown instead of hand rolling it

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Tested-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Cc: stable@kernel.org	#2.6.38+
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] Fix block queue and elevator memory leak in scsi_alloc_sdev</title>
<updated>2011-11-03T07:19:50+00:00</updated>
<author>
<name>Anton Blanchard</name>
<email>anton@samba.org</email>
</author>
<published>2011-11-02T21:56:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f7c9c6bb14f3104608a3a83cadea10a6943d2804'/>
<id>f7c9c6bb14f3104608a3a83cadea10a6943d2804</id>
<content type='text'>
When looking at memory consumption issues I noticed quite a
lot of memory in the kmalloc-2048 bucket:

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
  6561   6471  98%    2.30K    243       27     15552K kmalloc-2048

Over 15MB. slub debug shows that cfq is responsible for almost
all of it:

# sort -nr /sys/kernel/slab/kmalloc-2048/alloc_calls
6402 .cfq_init_queue+0xec/0x460 age=43423/43564/43655 pid=1 cpus=4,11,13

In scsi_alloc_sdev we do scsi_alloc_queue but if slave_alloc
fails we don't free it with scsi_free_queue.

The patch below fixes the issue:

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
   135     72  53%    2.30K      5       27       320K kmalloc-2048

# cat /sys/kernel/slab/kmalloc-2048/alloc_calls
3 .cfq_init_queue+0xec/0x460 age=3811/3876/3925 pid=1 cpus=4,11,13

Signed-off-by: Anton Blanchard &lt;anton@samba.org&gt;
Cc: &lt;stable@kernel.org&gt;		#2.6.38+
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When looking at memory consumption issues I noticed quite a
lot of memory in the kmalloc-2048 bucket:

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
  6561   6471  98%    2.30K    243       27     15552K kmalloc-2048

Over 15MB. slub debug shows that cfq is responsible for almost
all of it:

# sort -nr /sys/kernel/slab/kmalloc-2048/alloc_calls
6402 .cfq_init_queue+0xec/0x460 age=43423/43564/43655 pid=1 cpus=4,11,13

In scsi_alloc_sdev we do scsi_alloc_queue but if slave_alloc
fails we don't free it with scsi_free_queue.

The patch below fixes the issue:

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
   135     72  53%    2.30K      5       27       320K kmalloc-2048

# cat /sys/kernel/slab/kmalloc-2048/alloc_calls
3 .cfq_init_queue+0xec/0x460 age=3811/3876/3925 pid=1 cpus=4,11,13

Signed-off-by: Anton Blanchard &lt;anton@samba.org&gt;
Cc: &lt;stable@kernel.org&gt;		#2.6.38+
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[SCSI] Fix oops caused by queue refcounting failure</title>
<updated>2011-06-02T09:34:43+00:00</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@HansenPartnership.com</email>
</author>
<published>2011-05-25T20:52:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e73e079bf128d68284efedeba1fbbc18d78610f9'/>
<id>e73e079bf128d68284efedeba1fbbc18d78610f9</id>
<content type='text'>
In certain circumstances, we can get an oops from a torn down device.
Most notably this is from CD roms trying to call scsi_ioctl.  The root
cause of the problem is the fact that after scsi_remove_device() has
been called, the queue is fully torn down.  This is actually wrong
since the queue can be used until the sdev release function is called.
Therefore, we add an extra reference to the queue which is released in
sdev-&gt;release, so the queue always exists.

Reported-by: Parag Warudkar &lt;parag.lkml@gmail.com&gt;
Cc: stable@kernel.org
Signed-off-by: James Bottomley &lt;jbottomley@parallels.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In certain circumstances, we can get an oops from a torn down device.
Most notably this is from CD roms trying to call scsi_ioctl.  The root
cause of the problem is the fact that after scsi_remove_device() has
been called, the queue is fully torn down.  This is actually wrong
since the queue can be used until the sdev release function is called.
Therefore, we add an extra reference to the queue which is released in
sdev-&gt;release, so the queue always exists.

Reported-by: Parag Warudkar &lt;parag.lkml@gmail.com&gt;
Cc: stable@kernel.org
Signed-off-by: James Bottomley &lt;jbottomley@parallels.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: remove performance regression due to async queue run</title>
<updated>2011-05-17T09:04:44+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>jaxboe@fusionio.com</email>
</author>
<published>2011-05-17T09:04:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9937a5e2f32892db0dbeefc2b3bc74b3ae3ea9c7'/>
<id>9937a5e2f32892db0dbeefc2b3bc74b3ae3ea9c7</id>
<content type='text'>
Commit c21e6beb removed our queue request_fn re-enter
protection, and defaulted to always running the queues from
kblockd to be safe. This was a known potential slow down,
but should be safe.

Unfortunately this is causing big performance regressions for
some, so we need to improve this logic. Looking into the details
of the re-enter, the real issue is on requeue of requests.

Requeue of requests upon seeing a BUSY condition from the device
ends up re-running the queue, causing traces like this:

scsi_request_fn()
        scsi_dispatch_cmd()
                scsi_queue_insert()
                        __scsi_queue_insert()
                                scsi_run_queue()
					scsi_request_fn()
						...

potentially causing the issue we want to avoid. So special
case the requeue re-run of the queue, but improve it to offload
the entire run of local queue and starved queue from a single
workqueue callback. This is a lot better than potentially
kicking off a workqueue run for each device seen.

This also fixes the issue of the local device going into recursion,
since the above mentioned commit never moved that queue run out
of line.

Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit c21e6beb removed our queue request_fn re-enter
protection, and defaulted to always running the queues from
kblockd to be safe. This was a known potential slow down,
but should be safe.

Unfortunately this is causing big performance regressions for
some, so we need to improve this logic. Looking into the details
of the re-enter, the real issue is on requeue of requests.

Requeue of requests upon seeing a BUSY condition from the device
ends up re-running the queue, causing traces like this:

scsi_request_fn()
        scsi_dispatch_cmd()
                scsi_queue_insert()
                        __scsi_queue_insert()
                                scsi_run_queue()
					scsi_request_fn()
						...

potentially causing the issue we want to avoid. So special
case the requeue re-run of the queue, but improve it to offload
the entire run of local queue and starved queue from a single
workqueue callback. This is a lot better than potentially
kicking off a workqueue run for each device seen.

This also fixes the issue of the local device going into recursion,
since the above mentioned commit never moved that queue run out
of line.

Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
