[PATCH] scsi: cxlflash: Select SCSI_SCAN_ASYNC

2018-02-18 Thread Vaibhav Jain
The cxlflash driver uses "Asynchronous SCSI scanning" enabled by
CONFIG_SCSI_SCAN_ASYNC. Without this enabled the modprobe of cxlflash
module gets hung with following backtrace:

Call Trace:
 __switch_to+0x2cc/0x470
 __schedule+0x288/0xab0
 schedule+0x40/0xc0
 schedule_timeout+0x254/0x4f0
 wait_for_common+0xdc/0x260
 flush_work+0x140/0x2a0
 work_on_cpu+0x88/0xb0
 pci_device_probe+0x1d0/0x220
 driver_probe_device+0x408/0x5b0
 __driver_attach+0x16c/0x1a0
 bus_for_each_dev+0xb8/0x110
 driver_attach+0x3c/0x60
 bus_add_driver+0x1d8/0x370
 driver_register+0x9c/0x180
 __pci_register_driver+0x74/0xa0
 init_cxlflash+0x158/0x1cc
 do_one_initcall+0x68/0x1e0
 do_init_module+0x90/0x254
 load_module+0x2f8c/0x3720
 SyS_finit_module+0xcc/0x140
 system_call+0x58/0x6c

Signed-off-by: Vaibhav Jain 
---
 drivers/scsi/cxlflash/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/cxlflash/Kconfig b/drivers/scsi/cxlflash/Kconfig
index a011c5dbf214..f054c1b0fff3 100644
--- a/drivers/scsi/cxlflash/Kconfig
+++ b/drivers/scsi/cxlflash/Kconfig
@@ -6,6 +6,7 @@ config CXLFLASH
tristate "Support for IBM CAPI Flash"
depends on PCI && SCSI && CXL && EEH
select IRQ_POLL
+   select SCSI_SCAN_ASYNC
default m
help
  Allows CAPI Accelerated IO to Flash
-- 
2.14.3



Re: iSCSI session logout regression after fbce4d97fd ("scsi: fixup kernel warning during rmmod()")

2018-02-18 Thread Hannes Reinecke
On 02/18/2018 07:33 PM, Max Ivanov wrote:
> Hi,
> 
> on my system I can't logout from iSCSI session when on 4.4.18, but
> 4.3.19 works just fine. git bisect points to  fbce4d97fd ("scsi: fixup
> kernel warning during rmmod()")
> 
> Bug manifests itself like following:
>   - iSCSI session logout hangs and never completes
>   - 1 kworker per iSCSI session start consuming 100% CPU
>   - very shortly one of 2 errors show up in dmesg (full listings are below):
>   * kernel: list_del corruption, 88c1cd6bb810->next is LIST_POISON1
>   * kernel BUG at mm/slub.c:295!
> 
> Ways to trigger bug:
>   1. initiate iSCSI sessions to multiple portals
>   2. let multipathd to create multipath devices
>   3. run 'iscsiadm -m node --logoutall=all'
> 
> Bugs is NOT triggered and iSCSI logout succeeds when either:
>   - multipathd is masked and never started
>   - I manually delete all scsi devices via /sys/block/$d/device/delete
> before attempting
> to do iSCSI logout
> 
> list_del_corrpution:
> 
> Feb 16 10:37:11 localhost.localdomain kernel: alua: device handler registered
> Feb 16 10:37:11 localhost.localdomain kernel: emc: device handler registered
> Feb 16 10:37:11 localhost.localdomain kernel: rdac: device handler registered
> Feb 16 10:37:11 localhost.localdomain kernel: device-mapper: multipath
> service-time: version 0.3.0 loaded
> Feb 16 10:38:38 localhost.localdomain kernel: list_del corruption,
> 88c1cd6bb810->next is LIST_POISON1 (dead0100)
> Feb 16 10:38:38 localhost.localdomain kernel: [ cut here
> ]
> Feb 16 10:38:38 localhost.localdomain kernel: kernel BUG at 
> lib/list_debug.c:47!
> Feb 16 10:38:38 localhost.localdomain kernel: invalid opcode:  [#1] SMP 
> PTI
> Feb 16 10:38:38 localhost.localdomain kernel: Modules linked in:
> dm_service_time dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua
> binfmt_misc iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi
> ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink
> ebtable_nat ebtable_broute bridge stp llc ip6tabl
> Feb 16 10:38:38 localhost.localdomain kernel:  pata_acpi
> Feb 16 10:38:38 localhost.localdomain kernel: CPU: 2 PID: 5 Comm:
> kworker/u24:0 Not tainted 4.14.18-300.fc27.x86_64 #1
> Feb 16 10:38:38 localhost.localdomain kernel: Hardware name: VMware,
> Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS
> 6.00 09/21/2015
> Feb 16 10:38:38 localhost.localdomain kernel: Workqueue: scsi_wq_5
> __iscsi_unbind_session [scsi_transport_iscsi]
> Feb 16 10:38:38 localhost.localdomain kernel: task: 88bdede83e80
> task.stack: b15043158000
> Feb 16 10:38:38 localhost.localdomain kernel: RIP:
> 0010:__list_del_entry_valid+0x4e/0x90
> Feb 16 10:38:38 localhost.localdomain kernel: RSP:
> 0018:b1504315bd88 EFLAGS: 00010082
> Feb 16 10:38:38 localhost.localdomain kernel: RAX: 004e
> RBX: 88c1cd6bbf38 RCX: 
> Feb 16 10:38:38 localhost.localdomain kernel: RDX: 
> RSI: 88bdefc96a38 RDI: 88bdefc96a38
> Feb 16 10:38:38 localhost.localdomain kernel: RBP: 0246
> R08: 07be R09: 00aa
> Feb 16 10:38:38 localhost.localdomain kernel: R10: b1504315bd58
> R11:  R12: 88c1ebb659c0
> Feb 16 10:38:38 localhost.localdomain kernel: R13: 88bdec827010
> R14: 88c1cd6bb800 R15: 88c1cd6bb800
> Feb 16 10:38:38 localhost.localdomain kernel: FS:
> () GS:88bdefc8()
> knlGS:
> Feb 16 10:38:38 localhost.localdomain kernel: CS:  0010 DS:  ES:
>  CR0: 80050033
> Feb 16 10:38:38 localhost.localdomain kernel: CR2: 563d0c1ed280
> CR3: 00057120a001 CR4: 001606e0
> Feb 16 10:38:38 localhost.localdomain kernel: Call Trace:
> Feb 16 10:38:38 localhost.localdomain kernel:
> scsi_device_dev_release_usercontext+0x52/0x250
> Feb 16 10:38:38 localhost.localdomain kernel:  ? __schedule+0x10f/0x880
> Feb 16 10:38:38 localhost.localdomain kernel:
> execute_in_process_context+0x21/0x60
> Feb 16 10:38:38 localhost.localdomain kernel:  device_release+0x30/0x80
> Feb 16 10:38:38 localhost.localdomain kernel:  kobject_put+0x80/0x1a0
> Feb 16 10:38:38 localhost.localdomain kernel:  scsi_remove_target+0x16d/0x1b0
> Feb 16 10:38:38 localhost.localdomain kernel:
> __iscsi_unbind_session+0xad/0x150 [scsi_transport_iscsi]
> Feb 16 10:38:38 localhost.localdomain kernel:  process_one_work+0x184/0x3a0
> Feb 16 10:38:38 localhost.localdomain kernel:  worker_thread+0x2e/0x380
> Feb 16 10:38:38 localhost.localdomain kernel:  ? process_one_work+0x3a0/0x3a0
> Feb 16 10:38:38 localhost.localdomain kernel:  kthread+0x11a/0x130
> Feb 16 10:38:38 localhost.localdomain kernel:  ? kthread_park+0x60/0x60
> Feb 16 10:38:38 localhost.localdomain kernel:  ret_from_fork+0x35/0x40
> Feb 16 10:38:38 localhost.localdomain kernel: Code: 74 2b 48 8b 32 48
> 39 fe 75 34 48 8b 50 08 48 39 f2 75 3f b8 01 00 00 00 c3 48 89 fe 48
> 89 c2 48 c7 

Re: [PATCH 1/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer

2018-02-18 Thread Adrian Hunter
On 18/02/18 11:45, Avri Altman wrote:
> 
> 
>> -Original Message-
>> From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
>> ow...@vger.kernel.org] On Behalf Of Adrian Hunter
>> Sent: Friday, February 16, 2018 2:01 PM
>> To: Vinayak Holikatti ; Martin K. Petersen
>> ; James E.J. Bottomley
>> 
>> Cc: Stanislav Nijnikov ; Jaegeuk Kim
>> ; Bart Van Assche ; linux-
>> s...@vger.kernel.org; linux-ker...@vger.kernel.org; Michal Potomski
>> ; Szymon Mielczarek
>> 
>> Subject: [PATCH 1/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer
>>
>> UFS host controllers may support an autonomous power management
>> feature called the Auto-Hibernate Idle Timer. The timer is set to the number
>> of microseconds of idle time before the UFS host controller will
>> autonomously put the link into Hibernate state. That will save power at the
>> expense of increased latency. Any access to the host controller interface
>> registers will automatically put the link out of Hibernate state. So once
>> configured, the feature is transparent to the driver.
>>
>> Expose the Auto-Hibernate Idle Timer value via SysFS to allow users to
>> choose between power efficiency or lower latency. Set a default value of
>> 150 ms.
>>
>> Signed-off-by: Adrian Hunter 
>> ---
>>  Documentation/ABI/testing/sysfs-driver-ufs | 15 ++
>>  drivers/scsi/ufs/ufs-sysfs.c   | 77 
>> ++
>>  drivers/scsi/ufs/ufshcd.c  | 26 ++
>>  drivers/scsi/ufs/ufshcd.h  |  3 ++
>>  drivers/scsi/ufs/ufshci.h  |  7 +++
>>  5 files changed, 128 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-driver-ufs
>> b/Documentation/ABI/testing/sysfs-driver-ufs
>> index 07f1c2f8dbfc..c7f9441079eb 100644
>> --- a/Documentation/ABI/testing/sysfs-driver-ufs
>> +++ b/Documentation/ABI/testing/sysfs-driver-ufs
>> @@ -1,3 +1,18 @@
>> +What:   /sys/bus/*/drivers/ufshcd/*/auto_hibern8
>> +Date:   February 2018
>> +Contact:linux-scsi@vger.kernel.org
>> +Description:
>> +This file contains the auto-hibernate idle timer setting of a
>> +UFS host controller. A value of '-1' means auto-hibernate is
>> not
>> +supported. A value of '0' means auto-hibernate is not
>> enabled.
>> +Otherwise the value is the number of microseconds of idle
>> time
>> +before the UFS host controller will autonomously put the link
>> +into hibernate state. That will save power at the expense of
>> +increased latency. Note that the hardware supports 10-bit
>> values
>> +with a power-of-ten multiplier which allows a maximum
>> value of
>> +10230. Refer to the UFS Host Controller Interface
>> +specification for more details.
>> +
>>  What:
>>  /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_type
>>  Date:   February 2018
>>  Contact:Stanislav Nijnikov 
>> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c 
>> index
>> cd7174d2d225..a0e38776dc92 100644
>> --- a/drivers/scsi/ufs/ufs-sysfs.c
>> +++ b/drivers/scsi/ufs/ufs-sysfs.c
>> @@ -3,6 +3,7 @@
>>
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>
>>  #include "ufs.h"
>> @@ -123,12 +124,88 @@ static ssize_t spm_lvl_store(struct device *dev,
>>  return ufs_sysfs_pm_lvl_store(dev, attr, buf, count, false);  }
>>
>> +static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit) {
>> +unsigned long flags;
>> +
>> +if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
>> +return;
>> +
>> +spin_lock_irqsave(hba->host->host_lock, flags);
>> +if (hba->ahit == ahit)
>> +goto out_unlock;
>> +hba->ahit = ahit;
>> +if (!pm_runtime_suspended(hba->dev))
>> +ufshcd_writel(hba, hba->ahit,
>> REG_AUTO_HIBERNATE_IDLE_TIMER);
>> +out_unlock:
>> +spin_unlock_irqrestore(hba->host->host_lock, flags); }
>> +
>> +/* Convert Auto-Hibernate Idle Timer register value to microseconds */
>> +static int ufshcd_ahit_to_us(u32 ahit) {
>> +int timer = FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, ahit);
>> +int scale = FIELD_GET(UFSHCI_AHIBERN8_SCALE_MASK, ahit);
>> +
>> +for (; scale > 0; --scale)
>> +timer *= UFSHCI_AHIBERN8_SCALE_FACTOR;
>> +
>> +return timer;
>> +}
>> +
>> +/* Convert microseconds to Auto-Hibernate Idle Timer register value */
>> +static u32 ufshcd_us_to_ahit(unsigned int timer) {
>> +unsigned int scale;
>> +
>> +for (scale = 0; timer > UFSHCI_AHIBERN8_TIMER_MASK; ++scale)
>> +timer /= UFSHCI_AHIBERN8_SCALE_FACTOR;
>> +
>> +return FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, timer) |

[Bug 198817] New: backport of the megaraid_sas driver from kernel 4.14.20 to kernel 4.9.82

2018-02-18 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=198817

Bug ID: 198817
   Summary: backport of the megaraid_sas driver from kernel
4.14.20 to kernel 4.9.82
   Product: SCSI Drivers
   Version: 2.5
Kernel Version: 4.9.82 4.14.20
  Hardware: Intel
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: high
  Priority: P1
 Component: Other
  Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org
  Reporter: doru.iorgules...@gmail.com
Regression: No

Created attachment 274227
  --> https://bugzilla.kernel.org/attachment.cgi?id=274227=edit
backport of the megaraid_sas driver from kernel 4.14.20 to kernel 4.9.82

backport of the megaraid_sas driver from kernel 4.14.20 to kernel 4.9.82

Hi,

Hardware:
DMI: Intel Corporation S2600WFT/S2600WFT, BIOS
SE5C620.86B.00.01.0009.101920170742 10/19/2017

I copy /usr/src/linux-4.14.20/drivers/scsi/megaraid  to
/usr/src/linux-4.9.82/drivers/scsi/megaraid . I copile the kernel 4.9.82 and is
OK !
I send dmesg atached.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


Re: [PATCH] scsi: qla4xxx: Use dma_pool_zalloc()

2018-02-18 Thread Rangankar, Manish


On 15/02/18 12:30 AM, "Souptick Joarder"  wrote:

>Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
>Signed-off-by: Souptick Joarder 
>---
> drivers/scsi/qla4xxx/ql4_mbx.c | 6 ++
> drivers/scsi/qla4xxx/ql4_os.c  | 4 +---
> 2 files changed, 3 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c
>b/drivers/scsi/qla4xxx/ql4_mbx.c
>index bda2e64..5d56904 100644
>--- a/drivers/scsi/qla4xxx/ql4_mbx.c
>+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
>@@ -1584,12 +1584,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha,
>char *username, char *password,
>   struct ql4_chap_table *chap_table;
>   dma_addr_t chap_dma;
>
>-  chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
>+  chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
>   if (chap_table == NULL)
>   return -ENOMEM;
>
>   chap_size = sizeof(struct ql4_chap_table);
>-  memset(chap_table, 0, chap_size);
>
>   if (is_qla40XX(ha))
>   offset = FLASH_CHAP_OFFSET | (idx * chap_size);
>@@ -1648,13 +1647,12 @@ int qla4xxx_set_chap(struct scsi_qla_host *ha,
>char *username, char *password,
>   uint32_t chap_size = 0;
>   dma_addr_t chap_dma;
>
>-  chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
>+  chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
>   if (chap_table == NULL) {
>   ret =  -ENOMEM;
>   goto exit_set_chap;
>   }
>
>-  memset(chap_table, 0, sizeof(struct ql4_chap_table));
>   if (bidi)
>   chap_table->flags |= BIT_6; /* peer */
>   else
>diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
>index 82e889b..5896343 100644
>--- a/drivers/scsi/qla4xxx/ql4_os.c
>+++ b/drivers/scsi/qla4xxx/ql4_os.c
>@@ -825,12 +825,10 @@ static int qla4xxx_delete_chap(struct Scsi_Host
>*shost, uint16_t chap_tbl_idx)
>   uint32_t chap_size;
>   int ret = 0;
>
>-  chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
>+  chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, _dma);
>   if (chap_table == NULL)
>   return -ENOMEM;
>
>-  memset(chap_table, 0, sizeof(struct ql4_chap_table));
>-
>   if (is_qla80XX(ha))
>   max_chap_entries = (ha->hw.flt_chap_size / 2) /
>  sizeof(struct ql4_chap_table);
>--
>1.9.1

Thanks,

Acked-by: Manish Rangankar 




Re: [PATCH v8 2/5] dt-bindings: scsi: ufs: add document for hisi-ufs

2018-02-18 Thread Rob Herring
On Tue, Feb 13, 2018 at 06:14:09PM +0800, Li Wei wrote:
> add ufs node document for Hisilicon.
> 
> Signed-off-by: Li Wei 
> ---
>  Documentation/devicetree/bindings/ufs/ufs-hisi.txt | 37 
> ++
>  1 file changed, 37 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/ufs/ufs-hisi.txt

Reviewed-by: Rob Herring 



Send your prices

2018-02-18 Thread MR.UDU ATTAH
-- 
Dear Sir/Madam,

We need your product and price list catalog.
We are urgently in need of your item .
It is meant for purchase in large quantity by our government of Ecowas
Procurement Inquiry.
Terms of Payment: 80% down payment through T.T while remaining 20% by
L/C will be paid before Shipment.

THANKS,
MR. UDU ATTAH
UDU HOLDINGS GHANA.
6 ACCRA GHANA,
GHANA.
Phone : Phone :+233 261 815595.

EMAIL : agddec...@gmail.com


iSCSI session logout regression after fbce4d97fd ("scsi: fixup kernel warning during rmmod()")

2018-02-18 Thread Max Ivanov
Hi,

on my system I can't logout from iSCSI session when on 4.4.18, but
4.3.19 works just fine. git bisect points to  fbce4d97fd ("scsi: fixup
kernel warning during rmmod()")

Bug manifests itself like following:
  - iSCSI session logout hangs and never completes
  - 1 kworker per iSCSI session start consuming 100% CPU
  - very shortly one of 2 errors show up in dmesg (full listings are below):
  * kernel: list_del corruption, 88c1cd6bb810->next is LIST_POISON1
  * kernel BUG at mm/slub.c:295!

Ways to trigger bug:
  1. initiate iSCSI sessions to multiple portals
  2. let multipathd to create multipath devices
  3. run 'iscsiadm -m node --logoutall=all'

Bugs is NOT triggered and iSCSI logout succeeds when either:
  - multipathd is masked and never started
  - I manually delete all scsi devices via /sys/block/$d/device/delete
before attempting
to do iSCSI logout

list_del_corrpution:

Feb 16 10:37:11 localhost.localdomain kernel: alua: device handler registered
Feb 16 10:37:11 localhost.localdomain kernel: emc: device handler registered
Feb 16 10:37:11 localhost.localdomain kernel: rdac: device handler registered
Feb 16 10:37:11 localhost.localdomain kernel: device-mapper: multipath
service-time: version 0.3.0 loaded
Feb 16 10:38:38 localhost.localdomain kernel: list_del corruption,
88c1cd6bb810->next is LIST_POISON1 (dead0100)
Feb 16 10:38:38 localhost.localdomain kernel: [ cut here
]
Feb 16 10:38:38 localhost.localdomain kernel: kernel BUG at lib/list_debug.c:47!
Feb 16 10:38:38 localhost.localdomain kernel: invalid opcode:  [#1] SMP PTI
Feb 16 10:38:38 localhost.localdomain kernel: Modules linked in:
dm_service_time dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua
binfmt_misc iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi
ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink
ebtable_nat ebtable_broute bridge stp llc ip6tabl
Feb 16 10:38:38 localhost.localdomain kernel:  pata_acpi
Feb 16 10:38:38 localhost.localdomain kernel: CPU: 2 PID: 5 Comm:
kworker/u24:0 Not tainted 4.14.18-300.fc27.x86_64 #1
Feb 16 10:38:38 localhost.localdomain kernel: Hardware name: VMware,
Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS
6.00 09/21/2015
Feb 16 10:38:38 localhost.localdomain kernel: Workqueue: scsi_wq_5
__iscsi_unbind_session [scsi_transport_iscsi]
Feb 16 10:38:38 localhost.localdomain kernel: task: 88bdede83e80
task.stack: b15043158000
Feb 16 10:38:38 localhost.localdomain kernel: RIP:
0010:__list_del_entry_valid+0x4e/0x90
Feb 16 10:38:38 localhost.localdomain kernel: RSP:
0018:b1504315bd88 EFLAGS: 00010082
Feb 16 10:38:38 localhost.localdomain kernel: RAX: 004e
RBX: 88c1cd6bbf38 RCX: 
Feb 16 10:38:38 localhost.localdomain kernel: RDX: 
RSI: 88bdefc96a38 RDI: 88bdefc96a38
Feb 16 10:38:38 localhost.localdomain kernel: RBP: 0246
R08: 07be R09: 00aa
Feb 16 10:38:38 localhost.localdomain kernel: R10: b1504315bd58
R11:  R12: 88c1ebb659c0
Feb 16 10:38:38 localhost.localdomain kernel: R13: 88bdec827010
R14: 88c1cd6bb800 R15: 88c1cd6bb800
Feb 16 10:38:38 localhost.localdomain kernel: FS:
() GS:88bdefc8()
knlGS:
Feb 16 10:38:38 localhost.localdomain kernel: CS:  0010 DS:  ES:
 CR0: 80050033
Feb 16 10:38:38 localhost.localdomain kernel: CR2: 563d0c1ed280
CR3: 00057120a001 CR4: 001606e0
Feb 16 10:38:38 localhost.localdomain kernel: Call Trace:
Feb 16 10:38:38 localhost.localdomain kernel:
scsi_device_dev_release_usercontext+0x52/0x250
Feb 16 10:38:38 localhost.localdomain kernel:  ? __schedule+0x10f/0x880
Feb 16 10:38:38 localhost.localdomain kernel:
execute_in_process_context+0x21/0x60
Feb 16 10:38:38 localhost.localdomain kernel:  device_release+0x30/0x80
Feb 16 10:38:38 localhost.localdomain kernel:  kobject_put+0x80/0x1a0
Feb 16 10:38:38 localhost.localdomain kernel:  scsi_remove_target+0x16d/0x1b0
Feb 16 10:38:38 localhost.localdomain kernel:
__iscsi_unbind_session+0xad/0x150 [scsi_transport_iscsi]
Feb 16 10:38:38 localhost.localdomain kernel:  process_one_work+0x184/0x3a0
Feb 16 10:38:38 localhost.localdomain kernel:  worker_thread+0x2e/0x380
Feb 16 10:38:38 localhost.localdomain kernel:  ? process_one_work+0x3a0/0x3a0
Feb 16 10:38:38 localhost.localdomain kernel:  kthread+0x11a/0x130
Feb 16 10:38:38 localhost.localdomain kernel:  ? kthread_park+0x60/0x60
Feb 16 10:38:38 localhost.localdomain kernel:  ret_from_fork+0x35/0x40
Feb 16 10:38:38 localhost.localdomain kernel: Code: 74 2b 48 8b 32 48
39 fe 75 34 48 8b 50 08 48 39 f2 75 3f b8 01 00 00 00 c3 48 89 fe 48
89 c2 48 c7 c7 90 c6 0c bf e8 0d 94 cc ff <0f> 0b 48 89 fe 48 c7 c7 c8
c6 0c bf e8 fc 93 cc ff 0f 0b 48 89
Feb 16 10:38:38 localhost.localdomain kernel: RIP:
__list_del_entry_valid+0x4e/0x90 RSP: b1504315bd88
Feb 16 10:38:38 

hpsa: hung task on boot

2018-02-18 Thread Mark Bloch
Hi,

Trying to boot 4.16-rc1 I'm hitting this:

[   68.600133] hpsa :02:00.0: scsi 2:1:0:0: resetting logical  
Direct-Access HP   LOGICAL VOLUME   RAID-0 SSDSmartPathCap- En- Exp=1   
   
[   97.391584] systemd-udevd[361]: seq 3310 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda7'
 is taking a long time
[   97.464708] systemd-udevd[361]: seq 3308 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda5'
 is taking a long time
[   97.529588] systemd-udevd[361]: seq 3307 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda2'
 is taking a long time
[   97.594326] systemd-udevd[361]: seq 3306 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda1'
 is taking a long time
[   97.661573] systemd-udevd[361]: seq 3309 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda6'
 is taking a long time
[  217.391581] systemd-udevd[361]: seq 3306 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda1'
 killed   
[  217.456892] systemd-udevd[361]: seq 3308 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda5'
 killed   
[  217.519926] systemd-udevd[361]: seq 3310 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda7'
 killed   
[  217.579005] systemd-udevd[361]: seq 3307 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda2'
 killed   
[  217.638554] systemd-udevd[361]: seq 3309 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda6'
 killed   
[  217.697731] systemd-udevd[361]: worker [392] terminated by signal 9 (Killed) 
  
[  217.731567] systemd-udevd[361]: worker [392] failed while handling 
'/devices/pci:00/:00:02.2/:02:00.0/host2/target2:1:0/2:1:0:0/block/sda/sda1'
[  242.652048] INFO: task scsi_eh_2:405 blocked for more than 120 seconds.  
  
[  242.687059]   Not tainted 4.16.0-rc1+ #20
  
[  242.710430] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this 
message.  
[  242.748217] scsi_eh_2   D0   405  2 0x8000   
  
[  242.776101] Call Trace:  
  
[  242.789343]  ? __schedule+0x3cb/0x850
  
[  242.808664]  schedule+0x32/0x80  
  
[  242.824328]  hpsa_eh_device_reset_handler+0x6b2/0x720 [hpsa] 
  
[  242.851889]  ? wait_woken+0x80/0x80  
  
[  242.870089]  scsi_eh_ready_devs+0x35a/0xc10  
  
[  242.890486]  ? __pm_runtime_resume+0x54/0x70 
  
[  242.911263]  scsi_error_handler+0x4dc/0x5d0  
  
[  242.931646]  kthread+0xf5/0x130  
  
[  242.947270]  ? scsi_eh_get_sense+0x210/0x210 
  
[  242.968063]  ? kthread_create_worker_on_cpu+0x70/0x70
  
[  242.992494]  ret_from_fork+0x35/0x40 
  
[  363.484028] INFO: task systemd-udevd:379 blocked for more than 120 seconds.  
  
[  363.521118]   Not tainted 4.16.0-rc1+ #20
   

RE: [PATCH 1/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer

2018-02-18 Thread Avri Altman


> -Original Message-
> From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
> ow...@vger.kernel.org] On Behalf Of Adrian Hunter
> Sent: Friday, February 16, 2018 2:01 PM
> To: Vinayak Holikatti ; Martin K. Petersen
> ; James E.J. Bottomley
> 
> Cc: Stanislav Nijnikov ; Jaegeuk Kim
> ; Bart Van Assche ; linux-
> s...@vger.kernel.org; linux-ker...@vger.kernel.org; Michal Potomski
> ; Szymon Mielczarek
> 
> Subject: [PATCH 1/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer
> 
> UFS host controllers may support an autonomous power management
> feature called the Auto-Hibernate Idle Timer. The timer is set to the number
> of microseconds of idle time before the UFS host controller will
> autonomously put the link into Hibernate state. That will save power at the
> expense of increased latency. Any access to the host controller interface
> registers will automatically put the link out of Hibernate state. So once
> configured, the feature is transparent to the driver.
> 
> Expose the Auto-Hibernate Idle Timer value via SysFS to allow users to
> choose between power efficiency or lower latency. Set a default value of
> 150 ms.
> 
> Signed-off-by: Adrian Hunter 
> ---
>  Documentation/ABI/testing/sysfs-driver-ufs | 15 ++
>  drivers/scsi/ufs/ufs-sysfs.c   | 77 
> ++
>  drivers/scsi/ufs/ufshcd.c  | 26 ++
>  drivers/scsi/ufs/ufshcd.h  |  3 ++
>  drivers/scsi/ufs/ufshci.h  |  7 +++
>  5 files changed, 128 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-driver-ufs
> b/Documentation/ABI/testing/sysfs-driver-ufs
> index 07f1c2f8dbfc..c7f9441079eb 100644
> --- a/Documentation/ABI/testing/sysfs-driver-ufs
> +++ b/Documentation/ABI/testing/sysfs-driver-ufs
> @@ -1,3 +1,18 @@
> +What:/sys/bus/*/drivers/ufshcd/*/auto_hibern8
> +Date:February 2018
> +Contact: linux-scsi@vger.kernel.org
> +Description:
> + This file contains the auto-hibernate idle timer setting of a
> + UFS host controller. A value of '-1' means auto-hibernate is
> not
> + supported. A value of '0' means auto-hibernate is not
> enabled.
> + Otherwise the value is the number of microseconds of idle
> time
> + before the UFS host controller will autonomously put the link
> + into hibernate state. That will save power at the expense of
> + increased latency. Note that the hardware supports 10-bit
> values
> + with a power-of-ten multiplier which allows a maximum
> value of
> + 10230. Refer to the UFS Host Controller Interface
> + specification for more details.
> +
>  What:
>   /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_type
>  Date:February 2018
>  Contact: Stanislav Nijnikov 
> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index
> cd7174d2d225..a0e38776dc92 100644
> --- a/drivers/scsi/ufs/ufs-sysfs.c
> +++ b/drivers/scsi/ufs/ufs-sysfs.c
> @@ -3,6 +3,7 @@
> 
>  #include 
>  #include 
> +#include 
>  #include 
> 
>  #include "ufs.h"
> @@ -123,12 +124,88 @@ static ssize_t spm_lvl_store(struct device *dev,
>   return ufs_sysfs_pm_lvl_store(dev, attr, buf, count, false);  }
> 
> +static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit) {
> + unsigned long flags;
> +
> + if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
> + return;
> +
> + spin_lock_irqsave(hba->host->host_lock, flags);
> + if (hba->ahit == ahit)
> + goto out_unlock;
> + hba->ahit = ahit;
> + if (!pm_runtime_suspended(hba->dev))
> + ufshcd_writel(hba, hba->ahit,
> REG_AUTO_HIBERNATE_IDLE_TIMER);
> +out_unlock:
> + spin_unlock_irqrestore(hba->host->host_lock, flags); }
> +
> +/* Convert Auto-Hibernate Idle Timer register value to microseconds */
> +static int ufshcd_ahit_to_us(u32 ahit) {
> + int timer = FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, ahit);
> + int scale = FIELD_GET(UFSHCI_AHIBERN8_SCALE_MASK, ahit);
> +
> + for (; scale > 0; --scale)
> + timer *= UFSHCI_AHIBERN8_SCALE_FACTOR;
> +
> + return timer;
> +}
> +
> +/* Convert microseconds to Auto-Hibernate Idle Timer register value */
> +static u32 ufshcd_us_to_ahit(unsigned int timer) {
> + unsigned int scale;
> +
> + for (scale = 0; timer > UFSHCI_AHIBERN8_TIMER_MASK; ++scale)
> + timer /= UFSHCI_AHIBERN8_SCALE_FACTOR;
> +
> + return FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, timer) |
> +FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, scale); }
> +
> +static ssize_t auto_hibern8_show(struct device