在 QEMU 上启动 Ubuntu 时无法禁用“信息:任务 kworker/u8:3:116 阻塞超过 120 秒”

在 QEMU 上启动 Ubuntu 时无法禁用“信息:任务 kworker/u8:3:116 阻塞超过 120 秒”

我有一个模拟硬件设备,启动时可能需要 120 秒以上才能运行。我总是收到以下消息:

[  242.914490] INFO: task kworker/u8:0:9 blocked for more than 120 seconds.
[  242.914512]       Not tainted 5.15.0-78-generic #85-Ubuntu
[  242.914530] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  242.914553] task:kworker/u8:0    state:D stack:    0 pid:    9 ppid:     2 flags:0x00004000
[  242.914583] Workqueue: events_unbound async_run_entry_fn
[  242.914606] Call Trace:
[  242.914616]  <TASK>
[  242.914628]  __schedule+0x24e/0x590
[  242.914649]  schedule+0x69/0x110
[  242.914669]  schedule_timeout+0x103/0x140
[  242.914690]  __wait_for_common+0xae/0x150
[  242.914712]  ? usleep_range_state+0x90/0x90
[  242.914733]  wait_for_completion+0x24/0x30
[  242.914755]  __flush_work.isra.0+0x175/0x280
[  242.914774]  ? ttwu_do_wakeup+0x1c/0x170
[  242.914795]  ? worker_detach_from_pool+0xc0/0xc0
[  242.914820]  flush_work+0xe/0x20
[  242.914837]  nvme_async_probe+0x19/0x40 [nvme]
[  242.914870]  async_run_entry_fn+0x33/0x120
[  242.914891]  process_one_work+0x22b/0x3d0
[  242.914911]  worker_thread+0x53/0x420
[  242.914929]  ? process_one_work+0x3d0/0x3d0
[  242.914949]  kthread+0x12a/0x150
[  242.914968]  ? set_kthread_struct+0x50/0x50
[  242.914990]  ret_from_fork+0x22/0x30
[  242.915014]  </TASK>
[  242.915025] INFO: task kworker/u8:1:101 blocked for more than 120 seconds.
[  242.915047]       Not tainted 5.15.0-78-generic #85-Ubuntu
[  242.915066] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  242.915088] task:kworker/u8:1    state:D stack:    0 pid:  101 ppid:     2 flags:0x00004000
[  242.915118] Workqueue: events_unbound async_run_entry_fn
[  242.915141] Call Trace:
[  242.915152]  <TASK>
[  242.915163]  __schedule+0x24e/0x590
[  242.915183]  ? __schedule+0x256/0x590
[  242.915205]  schedule+0x69/0x110
[  242.915224]  async_synchronize_cookie_domain+0xd0/0x110
[  242.915248]  ? wait_woken+0x70/0x70
[  242.915267]  async_synchronize_cookie+0x15/0x20
[  242.915289]  async_port_probe+0x4e/0x80
[  242.915310]  async_run_entry_fn+0x33/0x120
[  242.915331]  process_one_work+0x22b/0x3d0
[  242.915351]  worker_thread+0x53/0x420
[  242.915369]  ? process_one_work+0x3d0/0x3d0
[  242.915389]  kthread+0x12a/0x150
[  242.915408]  ? set_kthread_struct+0x50/0x50
[  242.915430]  ret_from_fork+0x22/0x30
[  242.915454]  </TASK>
[  242.915464] INFO: task kworker/u8:3:116 blocked for more than 120 seconds.
[  242.915486]       Not tainted 5.15.0-78-generic #85-Ubuntu
[  242.915505] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  242.915527] task:kworker/u8:3    state:D stack:    0 pid:  116 ppid:     2 flags:0x00004000
[  242.915557] Workqueue: events_unbound async_run_entry_fn
[  242.915580] Call Trace:
[  242.915591]  <TASK>
[  242.915602]  __schedule+0x24e/0x590
[  242.915622]  ? __schedule+0x256/0x590
[  242.915644]  schedule+0x69/0x110
[  242.915663]  async_synchronize_cookie_domain+0xd0/0x110
[  242.915687]  ? wait_woken+0x70/0x70
[  242.915706]  async_synchronize_cookie+0x15/0x20
[  242.915728]  async_port_probe+0x4e/0x80
[  242.915749]  async_run_entry_fn+0x33/0x120
[  242.915770]  process_one_work+0x22b/0x3d0
[  242.915790]  worker_thread+0x53/0x420
[  242.915808]  ? process_one_work+0x3d0/0x3d0
[  242.915828]  kthread+0x12a/0x150
[  242.915847]  ? set_kthread_struct+0x50/0x50
[  242.915869]  ret_from_fork+0x22/0x30
[  242.915893]  </TASK>

我只是想禁用这些消息,我修改了 sysctl.confsudo vi /etc/sysctl.conf并添加了kernel.hung_task_timeout_secs = 0.当我运行时cat /proc/sys/kernel/hung_task_timeout_secs它返回 0 值。我还尝试增加 grub 中的 udev.event_timeout 以避免出现消息。然而它们都不起作用。重新启动系统时我总是看到相同的消息。我正在使用在 QEMU 上运行的 Ubuntu 22.04.3 LTS 云服务器。这是我正在使用的 QEMU 命令:

qemu-system-x86_64 -M q35,accel=tcg,kernel-irqchip=split -m 4G -smp 4 \
-device virtio-net-pci,netdev=net0 -net nic -netdev type=user,id=net0,hostfwd=tcp::2222-:22 \
-serial mon:stdio \
-device intel-iommu,intremap=on,device-iotlb=on \
-drive if=virtio,file=jammy-server-cloudimg-amd64.img,format=qcow2 \
-drive if=virtio,file=user-data.img,format=raw 

你知道原因吗?有没有办法永久禁用这些消息?谢谢你们!

相关内容