vhost: Support SIGKILL by flushing and exiting
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 22 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | vhost-scsi: Handle vhost_vq_work_queue failures for eventsdrivers/ | +12 | 0 replies | |
| 2/9 | vhost-scsi: Handle vhost_vq_work_queue failures for cmdsdrivers/ | +12 | 0 replies | |
| 3/9 | vhost-scsi: Use system wq to flush dev for TMFsdrivers/ | +19 | 0 replies | |
| 4/9 | vhost: Remove vhost_vq_flushdrivers/ drivers/ | +0 | 0 replies | |
| 5/9 | vhost_scsi: Handle vhost_vq_work_queue failures for TMFsdrivers/ | +2 | 0 replies | |
| 6/9 | vhost: Use virtqueue mutex for swapping workerdrivers/ | +12 | 0 replies | |
| 7/9 | vhost: Release worker mutex during flushesdrivers/ | +30 | 0 replies | |
| 8/9 | vhost_task: Handle SIGKILL by flushing work and exitingdrivers/ drivers/ include/ +1 more | +88 | 0 replies | |
| 9/9 | kernel: Remove signal hacks for vhost_tasksfs/ kernel/ kernel/ | +3 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/9] vhost: Support SIGKILL by flushing and exiting
The following patches were made over Linus's tree and also apply over mst's vhost branch. The patches add the ability for vhost_tasks to handle SIGKILL by flushing queued works, stop new works from being queued, and prepare the task for an early exit.
This removes the need for the signal/coredump hacks added in:
Commit f9010dbdce91 ("fork, vhost: Use CLONE_THREAD to fix freezer/ps regression")
when the vhost_task patches were initially merged and fix the issue in this thread:
https://lore.kernel.org/all/[email protected]/
Long Background:
The original vhost worker code didn't support any signals. If the userspace application that owned the worker got a SIGKILL, the app/ process would exit dropping all references to the device and then the file operation's release function would be called. From there we would wait on running IO then cleanup the device's memory.
When we switched to vhost_tasks being a thread in the owner's process we added some hacks to the signal/coredump code so we could continue to wait on running IO and process it from the vhost_task. The idea was that we would eventually remove the hacks. We recently hit this bug:
https://lore.kernel.org/all/[email protected]/
It turns out only vhost-scsi had an issue where it would send a command to the block/LIO layer, wait for a response and then process in the vhost task. So patches 1-5 prepares vhost-scsi to handle when the vhost_task is killed while we still have commands outstanding. The next patches then prepare and convert the vhost and vhost_task layers to handle SIGKILL by flushing running works, marking the vhost_task as dead so there's no future uses, then exiting.