smpboot: CPU 1 is now offline
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
kworker/u8:0/12 is trying to acquire lock:
ffff888160adce18 (kn->active#5){++++}-{0:0}, at: __kernfs_remove+0x493/0x910

but task is already holding lock:
ffffffff8fbe7d70 (cpu_hotplug_lock){++++}-{0:0}, at: acpi_processor_post_eject+0xe9/0x360

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (cpu_hotplug_lock){++++}-{0:0}:
       percpu_down_write+0x4f/0x330
       _cpu_up+0x75/0x5b0
       cpu_up+0x1d2/0x220
       cpuhp_bringup_mask+0xb2/0x1a0
       cpuhp_bringup_cpus_parallel+0x109/0x120
       bringup_nonboot_cpus+0x17/0x30
       smp_init+0x32/0x110
       kernel_init_freeable+0x27f/0x3e0
       kernel_init+0x22/0x1d0
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #2 (cpu_add_remove_lock){+.+.}-{4:4}:
       __mutex_lock+0x197/0x15a0
       cpu_device_down+0x3e/0xc0
       device_offline+0x2d2/0x3c0
       acpi_bus_offline+0x245/0x440
       acpi_device_hotplug+0x5a1/0xd60
       acpi_hotplug_work_fn+0x55/0x80
       process_scheduled_works+0xc3d/0x1630
       worker_thread+0xa47/0xfb0
       kthread+0x38b/0x480
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

-> #1 (&device->physical_node_lock){+.+.}-{4:4}:
       __mutex_lock+0x197/0x15a0
       acpi_companion_match+0x8e/0x120
       acpi_device_uevent_modalias+0x1a/0x30
       platform_uevent+0x3c/0xb0
       dev_uevent+0x412/0x870
       kobject_uevent_env+0x475/0x9e0
       kobject_synth_uevent+0x45e/0x950
       uevent_store+0x26/0x70
       kernfs_fop_write_iter+0x3a4/0x540
       vfs_write+0x612/0xba0
       ksys_write+0x150/0x270
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (kn->active#5){++++}-{0:0}:
       __lock_acquire+0x164c/0x2de0
       lock_acquire+0x115/0x350
       kernfs_drain+0x293/0x640
       __kernfs_remove+0x493/0x910
       kernfs_remove_by_name_ns+0xc0/0x140
       device_del+0x503/0x8f0
       device_unregister+0x21/0xf0
       unregister_cpu+0x99/0x150
       acpi_processor_post_eject+0xfe/0x360
       acpi_device_hotplug+0xa02/0xd60
       acpi_hotplug_work_fn+0x55/0x80
       process_scheduled_works+0xc3d/0x1630
       worker_thread+0xa47/0xfb0
       kthread+0x38b/0x480
       ret_from_fork+0x514/0xb70
       ret_from_fork_asm+0x1a/0x30

other info that might help us debug this:

Chain exists of:
  kn->active#5 --> cpu_add_remove_lock --> cpu_hotplug_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(cpu_hotplug_lock);
                               lock(cpu_add_remove_lock);
                               lock(cpu_hotplug_lock);
  lock(kn->active#5);

 *** DEADLOCK ***

locks held by kworker/u8:0/12: 6, last CPU#0:
 #0: ffff8881062b2940 ((wq_completion)kacpi_hotplug){+.+.}-{0:0}, at: process_scheduled_works+0x97a/0x1630
 #1: ffffc90000117c40 ((work_completion)(&hpw->work)){+.+.}-{0:0}, at: process_scheduled_works+0x97a/0x1630
 #2: ffffffff90803920 (device_hotplug_lock){+.+.}-{4:4}, at: acpi_device_hotplug+0x82/0xd60
 #3: ffffffff905f6c00 (acpi_scan_lock){+.+.}-{4:4}, at: acpi_device_hotplug+0x90/0xd60
 #4: ffffffff8fbe7c40 (cpu_add_remove_lock){+.+.}-{4:4}, at: acpi_processor_post_eject+0xe4/0x360
 #5: ffffffff8fbe7d70 (cpu_hotplug_lock){++++}-{0:0}, at: acpi_processor_post_eject+0xe9/0x360

stack backtrace:
CPU: 0 UID: 0 PID: 12 Comm: kworker/u8:0 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: kacpi_hotplug acpi_hotplug_work_fn
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 print_circular_bug+0x2e2/0x300
 check_noncircular+0x12f/0x150
 __lock_acquire+0x164c/0x2de0
 lock_acquire+0x115/0x350
 kernfs_drain+0x293/0x640
 __kernfs_remove+0x493/0x910
 kernfs_remove_by_name_ns+0xc0/0x140
 device_del+0x503/0x8f0
 device_unregister+0x21/0xf0
 unregister_cpu+0x99/0x150
 acpi_processor_post_eject+0xfe/0x360
 acpi_device_hotplug+0xa02/0xd60
 acpi_hotplug_work_fn+0x55/0x80
 process_scheduled_works+0xc3d/0x1630
 worker_thread+0xa47/0xfb0
 kthread+0x38b/0x480
 ret_from_fork+0x514/0xb70
 ret_from_fork_asm+0x1a/0x30
 </TASK>
