On Mon, May 15, 2023 at 8:52 AM Jens Axboe <axboe@xxxxxxxxx> wrote: > > On 5/15/23 9:44?AM, Linus Torvalds wrote: > > > > So I think the patch should just look something like the attached. > > Mike, can you test this on whatever vhost test-suite? > > Seems like that didn't get attached... Blush. I decided to built-test it, and then forgot to attach it. Here. Linus
kernel/fork.c | 12 +++--------- kernel/vhost_task.c | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index ed4e01daccaa..cd06b137418f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2338,14 +2338,10 @@ __latent_entropy struct task_struct *copy_process( p->flags |= PF_KTHREAD; if (args->user_worker) p->flags |= PF_USER_WORKER; - if (args->io_thread) { - /* - * Mark us an IO worker, and block any signal that isn't - * fatal or STOP - */ + if (args->io_thread) p->flags |= PF_IO_WORKER; + if (args->ignore_signals) siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP)); - } if (args->name) strscpy_pad(p->comm, args->name, sizeof(p->comm)); @@ -2517,9 +2513,6 @@ __latent_entropy struct task_struct *copy_process( if (retval) goto bad_fork_cleanup_io; - if (args->ignore_signals) - ignore_signals(p); - stackleak_task_init(p); if (pid != &init_struct_pid) { @@ -2861,6 +2854,7 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node) .fn_arg = arg, .io_thread = 1, .user_worker = 1, + .ignore_signals = 1, }; return copy_process(NULL, 0, node, &args); diff --git a/kernel/vhost_task.c b/kernel/vhost_task.c index b7cbd66f889e..2e334b2d7cc4 100644 --- a/kernel/vhost_task.c +++ b/kernel/vhost_task.c @@ -75,7 +75,8 @@ struct vhost_task *vhost_task_create(int (*fn)(void *), void *arg, const char *name) { struct kernel_clone_args args = { - .flags = CLONE_FS | CLONE_UNTRACED | CLONE_VM, + .flags = CLONE_FS | CLONE_UNTRACED | CLONE_VM | + CLONE_THREAD | CLONE_SIGHAND, .exit_signal = 0, .fn = vhost_task_fn, .name = name,
_______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization