From 93e86295f5e9238779096fa599c3804a08e25bd1 Mon Sep 17 00:00:00 2001 From: Menglong Dong Date: Mon, 18 Jan 2021 00:04:55 -0800 Subject: [PATCH 1/3] workqueue: fix annotation for WQ_SYSFS 'wq_sysfs_register()' in annotation for 'WQ_SYSFS' is unavailable, change it to 'workqueue_sysfs_register()'. Signed-off-by: Menglong Dong Reviewed-by: Lai Jiangshan Signed-off-by: Tejun Heo --- include/linux/workqueue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 26de0cae2a0a..d15a7730ee18 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -311,7 +311,7 @@ enum { WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ WQ_HIGHPRI = 1 << 4, /* high priority */ WQ_CPU_INTENSIVE = 1 << 5, /* cpu intensive workqueue */ - WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ + WQ_SYSFS = 1 << 6, /* visible in sysfs, see workqueue_sysfs_register() */ /* * Per-cpu workqueues are generally preferred because they tend to From 7bf9c4a88e3e33cf593b2452776361c6db0f28b0 Mon Sep 17 00:00:00 2001 From: Zqiang Date: Mon, 4 Jan 2021 20:43:06 +0800 Subject: [PATCH 2/3] workqueue: tracing the name of the workqueue instead of it's address This patch tracing workqueue name instead of it's address, the new format is as follows. workqueue_queue_work: work struct=0000000084e3df56 function= drm_fb_helper_dirty_work workqueue=events req_cpu=256 cpu=1 This tell us to know which workqueue our work is queued. Signed-off-by: Zqiang Signed-off-by: Tejun Heo --- include/trace/events/workqueue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index 9b8ae961acc5..970cc2ea2850 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h @@ -30,7 +30,7 @@ TRACE_EVENT(workqueue_queue_work, TP_STRUCT__entry( __field( void *, work ) __field( void *, function) - __field( void *, workqueue) + __field( const char *, workqueue) __field( unsigned int, req_cpu ) __field( unsigned int, cpu ) ), @@ -38,12 +38,12 @@ TRACE_EVENT(workqueue_queue_work, TP_fast_assign( __entry->work = work; __entry->function = work->func; - __entry->workqueue = pwq->wq; + __entry->workqueue = pwq->wq->name; __entry->req_cpu = req_cpu; __entry->cpu = pwq->pool->cpu; ), - TP_printk("work struct=%p function=%ps workqueue=%p req_cpu=%u cpu=%u", + TP_printk("work struct=%p function=%ps workqueue=%s req_cpu=%u cpu=%u", __entry->work, __entry->function, __entry->workqueue, __entry->req_cpu, __entry->cpu) ); From e9ad2eb3d9ae05471c9b9fafcc0a31d8f565ca5b Mon Sep 17 00:00:00 2001 From: Stephen Zhang Date: Sat, 23 Jan 2021 16:04:00 +0800 Subject: [PATCH 3/3] workqueue: Use %s instead of function name It is better to replace the function name with %s, in case the function name changes. Signed-off-by: Stephen Zhang Signed-off-by: Tejun Heo --- kernel/workqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 9880b6c0e272..8b1b6160eab6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2964,8 +2964,8 @@ reflush: if (++flush_cnt == 10 || (flush_cnt % 100 == 0 && flush_cnt <= 1000)) - pr_warn("workqueue %s: drain_workqueue() isn't complete after %u tries\n", - wq->name, flush_cnt); + pr_warn("workqueue %s: %s() isn't complete after %u tries\n", + wq->name, __func__, flush_cnt); mutex_unlock(&wq->mutex); goto reflush;