Message ID | 20240809222827.3211998-2-matthew.brost@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Use user-defined workqueue lockdep map for drm sched | expand |
Hello, kernel test robot noticed "sysfs:cannot_create_duplicate_filename" on: commit: 589686d5b8d589e30478cfb8db2e8e2cd54c20e9 ("[PATCH v3 1/5] workqueue: Split alloc_workqueue into internal function and lockdep init") url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Brost/workqueue-Split-alloc_workqueue-into-internal-function-and-lockdep-init/20240810-122131 base: https://git.kernel.org/cgit/linux/kernel/git/tj/wq.git for-next patch link: https://lore.kernel.org/all/20240809222827.3211998-2-matthew.brost@intel.com/ patch subject: [PATCH v3 1/5] workqueue: Split alloc_workqueue into internal function and lockdep init in testcase: boot compiler: clang-18 test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G (please refer to attached dmesg/kmsg for entire log/backtrace) +----------------------------------------+------------+------------+ | | 3b47e19ebc | 589686d5b8 | +----------------------------------------+------------+------------+ | sysfs:cannot_create_duplicate_filename | 0 | 18 | +----------------------------------------+------------+------------+ If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <oliver.sang@intel.com> | Closes: https://lore.kernel.org/oe-lkp/202408121610.d1cdf757-oliver.sang@intel.com [ OK ] Started User Login Management. Starting LSB: Load kernel image with kexec... [ 11.888312][ T131] ata_piix 0000:00:01.1: version 2.13 [ OK ] Started OpenBSD Secure Shell server. [ 11.890919][ T131] scsi host0: ata_piix [ 11.893885][ T131] sysfs: cannot create duplicate filename '/devices/virtual/workqueue/scsi_tmf_4945632' [ 11.895088][ T131] CPU: 0 UID: 0 PID: 131 Comm: systemd-udevd Not tainted 6.11.0-rc1-00010-g589686d5b8d5 #1 [ 11.896222][ T131] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 11.897360][ T131] Call Trace: [ 11.897806][ T131] <TASK> [ 11.898206][ T131] dump_stack_lvl (kbuild/src/consumer/lib/dump_stack.c:121) [ 11.898801][ T131] sysfs_create_dir_ns (kbuild/src/consumer/fs/sysfs/dir.c:32 kbuild/src/consumer/fs/sysfs/dir.c:63) [ 11.899453][ T131] kobject_add_internal (kbuild/src/consumer/lib/kobject.c:74 kbuild/src/consumer/lib/kobject.c:240) [ 11.900074][ T131] kobject_add (kbuild/src/consumer/lib/kobject.c:430) The kernel config and materials to reproduce are available at: https://download.01.org/0day-ci/archive/20240812/202408121610.d1cdf757-oliver.sang@intel.com
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 1745ca788ede..90a98c9b0ac6 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5612,9 +5612,9 @@ static void wq_adjust_max_active(struct workqueue_struct *wq) } __printf(1, 4) -struct workqueue_struct *alloc_workqueue(const char *fmt, - unsigned int flags, - int max_active, ...) +static struct workqueue_struct *__alloc_workqueue(const char *fmt, + unsigned int flags, + int max_active, ...) { va_list args; struct workqueue_struct *wq; @@ -5680,12 +5680,11 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, INIT_LIST_HEAD(&wq->flusher_overflow); INIT_LIST_HEAD(&wq->maydays); - wq_init_lockdep(wq); INIT_LIST_HEAD(&wq->list); if (flags & WQ_UNBOUND) { if (alloc_node_nr_active(wq->node_nr_active) < 0) - goto err_unreg_lockdep; + goto err_free_wq; } /* @@ -5724,9 +5723,6 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, kthread_flush_worker(pwq_release_worker); free_node_nr_active(wq->node_nr_active); } -err_unreg_lockdep: - wq_unregister_lockdep(wq); - wq_free_lockdep(wq); err_free_wq: free_workqueue_attrs(wq->unbound_attrs); kfree(wq); @@ -5737,6 +5733,25 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, destroy_workqueue(wq); return NULL; } + +__printf(1, 4) +struct workqueue_struct *alloc_workqueue(const char *fmt, + unsigned int flags, + int max_active, ...) +{ + struct workqueue_struct *wq; + va_list args; + + va_start(args, max_active); + wq = __alloc_workqueue(fmt, flags, max_active, args); + va_end(args); + if (!wq) + return NULL; + + wq_init_lockdep(wq); + + return wq; +} EXPORT_SYMBOL_GPL(alloc_workqueue); static bool pwq_busy(struct pool_workqueue *pwq)
Will help enable user-defined lockdep maps for workqueues. Cc: Tejun Heo <tj@kernel.org> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> --- kernel/workqueue.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)