Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

From: Oleg Nesterov
Date: Tue May 16 2023 - 09:19:34 EST


On 05/15, Mike Christie wrote:
>
> Oleg and Christian,
>
>
> Below is an updated patch that doesn't check for PF_USER_WORKER in the
> signal.c code and instead will check for if we have blocked the signal.

Looks like I need to read the whole series... will try tomorrow.

> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -2336,8 +2336,15 @@ __latent_entropy struct task_struct *copy_process(
> p->flags &= ~PF_KTHREAD;
> if (args->kthread)
> p->flags |= PF_KTHREAD;
> - if (args->user_worker)
> + if (args->user_worker) {
> + /*
> + * User worker are similar to io_threads but they do not
> + * support signals and cleanup is driven via another kernel
> + * interface so even SIGKILL is blocked.
> + */
> p->flags |= PF_USER_WORKER;
> + siginitsetinv(&p->blocked, 0);

I never liked the fact that io-threads block the signals, this adds
another precedent... OK, this needs another discussion.

> +static void try_set_pending_sigkill(struct task_struct *t)
> +{
> + /*
> + * User workers don't support signals and their exit is driven through
> + * their kernel layer, so by default block even SIGKILL.
> + */
> + if (sigismember(&t->blocked, SIGKILL))
> + return;
> +
> + sigaddset(&t->pending.signal, SIGKILL);
> + signal_wake_up(t, 1);
> +}

so why do you need this? to avoid fatal_signal_pending() or signal_pending() ?

In the latter case this change is not enough.

Oleg.