Commit 5c750d58 authored by Steffen Maier's avatar Steffen Maier Committed by Martin K. Petersen

scsi: zfcp: workqueue: set description for port work items with their WWPN as context

As a prerequisite, complement commit 3d1cb205 ("workqueue: include
workqueue info when printing debug dump of a worker task") to be usable with
kernel modules by exporting the symbol set_worker_desc().  Current built-in
user was introduced with commit ef3b1019 ("writeback: set worker desc to
identify writeback workers in task dumps").

Can help distinguishing work items which do not have adapter scope.
Description is printed out with task dump for debugging on WARN, BUG, panic,
or magic-sysrq [show-task-states(t)].

Example:
$ echo 0 >| /sys/bus/ccw/drivers/zfcp/0.0.1880/0x50050763031bd327/failed &
$ echo 't' >| /proc/sysrq-trigger
$ dmesg
sysrq: SysRq : Show State
  task                        PC stack   pid father
...
zfcp_q_0.0.1880 S14640  2165      2 0x02000000
Call Trace:
([<00000000009df464>] __schedule+0xbf4/0xc78)
 [<00000000009df57c>] schedule+0x94/0xc0
 [<0000000000168654>] rescuer_thread+0x33c/0x3a0
 [<000000000016f8be>] kthread+0x166/0x178
 [<00000000009e71f2>] kernel_thread_starter+0x6/0xc
 [<00000000009e71ec>] kernel_thread_starter+0x0/0xc
no locks held by zfcp_q_0.0.1880/2165.
...
kworker/u512:2  D11280  2193      2 0x02000000
Workqueue: zfcp_q_0.0.1880 zfcp_scsi_rport_work [zfcp] (zrpd-50050763031bd327)
                                                        ^^^^^^^^^^^^^^^^^^^^^
Call Trace:
([<00000000009df464>] __schedule+0xbf4/0xc78)
 [<00000000009df57c>] schedule+0x94/0xc0
 [<00000000009e50c0>] schedule_timeout+0x488/0x4d0
 [<00000000001e425c>] msleep+0x5c/0x78                  >>test code only<<
 [<000003ff8008a21e>] zfcp_scsi_rport_work+0xbe/0x100 [zfcp]
 [<0000000000167154>] process_one_work+0x3b4/0x718
 [<000000000016771c>] worker_thread+0x264/0x408
 [<000000000016f8be>] kthread+0x166/0x178
 [<00000000009e71f2>] kernel_thread_starter+0x6/0xc
 [<00000000009e71ec>] kernel_thread_starter+0x0/0xc
2 locks held by kworker/u512:2/2193:
 #0:  (name){++++.+}, at: [<0000000000166f4e>] process_one_work+0x1ae/0x718
 #1:  ((&(&port->rport_work)->work)){+.+.+.}, at: [<0000000000166f4e>] process_one_work+0x1ae/0x718
...

=============================================
Showing busy workqueues and worker pools:
workqueue zfcp_q_0.0.1880: flags=0x2000a
  pwq 512: cpus=0-255 flags=0x4 nice=0 active=1/1
    in-flight: 2193:zfcp_scsi_rport_work [zfcp]
pool 512: cpus=0-255 flags=0x4 nice=0 hung=0s workers=4 idle: 5 2354 2311

Work items with adapter scope are already identified by the workqueue name
"zfcp_q_<devbusid>" and the work item function name.
Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 674595d8
...@@ -425,6 +425,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work) ...@@ -425,6 +425,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work)
struct zfcp_port *port = container_of(work, struct zfcp_port, struct zfcp_port *port = container_of(work, struct zfcp_port,
gid_pn_work); gid_pn_work);
set_worker_desc("zgidpn%16llx", port->wwpn); /* < WORKER_DESC_LEN=24 */
ret = zfcp_fc_ns_gid_pn(port); ret = zfcp_fc_ns_gid_pn(port);
if (ret) { if (ret) {
/* could not issue gid_pn for some reason */ /* could not issue gid_pn for some reason */
...@@ -559,6 +560,7 @@ void zfcp_fc_link_test_work(struct work_struct *work) ...@@ -559,6 +560,7 @@ void zfcp_fc_link_test_work(struct work_struct *work)
container_of(work, struct zfcp_port, test_link_work); container_of(work, struct zfcp_port, test_link_work);
int retval; int retval;
set_worker_desc("zadisc%16llx", port->wwpn); /* < WORKER_DESC_LEN=24 */
get_device(&port->dev); get_device(&port->dev);
port->rport_task = RPORT_DEL; port->rport_task = RPORT_DEL;
zfcp_scsi_rport_work(&port->rport_work); zfcp_scsi_rport_work(&port->rport_work);
......
...@@ -730,6 +730,9 @@ void zfcp_scsi_rport_work(struct work_struct *work) ...@@ -730,6 +730,9 @@ void zfcp_scsi_rport_work(struct work_struct *work)
struct zfcp_port *port = container_of(work, struct zfcp_port, struct zfcp_port *port = container_of(work, struct zfcp_port,
rport_work); rport_work);
set_worker_desc("zrp%c-%16llx",
(port->rport_task == RPORT_ADD) ? 'a' : 'd',
port->wwpn); /* < WORKER_DESC_LEN=24 */
while (port->rport_task) { while (port->rport_task) {
if (port->rport_task == RPORT_ADD) { if (port->rport_task == RPORT_ADD) {
port->rport_task = RPORT_NONE; port->rport_task = RPORT_NONE;
......
...@@ -4350,6 +4350,7 @@ void set_worker_desc(const char *fmt, ...) ...@@ -4350,6 +4350,7 @@ void set_worker_desc(const char *fmt, ...)
worker->desc_valid = true; worker->desc_valid = true;
} }
} }
EXPORT_SYMBOL_GPL(set_worker_desc);
/** /**
* print_worker_info - print out worker information and description * print_worker_info - print out worker information and description
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment