From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Mike Christie <michael.christie@oracle.com>,
oleg@redhat.com, linux@leemhuis.info, axboe@kernel.dk,
ebiederm@xmission.com, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, mst@redhat.com,
sgarzare@redhat.com, jasowang@redhat.com, stefanha@redhat.com,
brauner@kernel.org
Subject: Re: [PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
Date: Fri, 2 Jun 2023 16:34:37 +0200 [thread overview]
Message-ID: <e8431649-6389-bea3-58ab-9764dba83b3e@6wind.com> (raw)
In-Reply-To: <20230601183232.8384-1-michael.christie@oracle.com>
Le 01/06/2023 à 20:32, Mike Christie a écrit :
> When switching from kthreads to vhost_tasks two bugs were added:
> 1. The vhost worker tasks's now show up as processes so scripts doing
> ps or ps a would not incorrectly detect the vhost task as another
> process. 2. kthreads disabled freeze by setting PF_NOFREEZE, but
> vhost tasks's didn't disable or add support for them.
>
> To fix both bugs, this switches the vhost task to be thread in the
> process that does the VHOST_SET_OWNER ioctl, and has vhost_worker call
> get_signal to support SIGKILL/SIGSTOP and freeze signals. Note that
> SIGKILL/STOP support is required because CLONE_THREAD requires
> CLONE_SIGHAND which requires those 2 signals to be supported.
>
> This is a modified version of the patch written by Mike Christie
> <michael.christie@oracle.com> which was a modified version of patch
> originally written by Linus.
>
> Much of what depended upon PF_IO_WORKER now depends on PF_USER_WORKER.
> Including ignoring signals, setting up the register state, and having
> get_signal return instead of calling do_group_exit.
>
> Tidied up the vhost_task abstraction so that the definition of
> vhost_task only needs to be visible inside of vhost_task.c. Making
> it easier to review the code and tell what needs to be done where.
> As part of this the main loop has been moved from vhost_worker into
> vhost_task_fn. vhost_worker now returns true if work was done.
>
> The main loop has been updated to call get_signal which handles
> SIGSTOP, freezing, and collects the message that tells the thread to
> exit as part of process exit. This collection clears
> __fatal_signal_pending. This collection is not guaranteed to
> clear signal_pending() so clear that explicitly so the schedule()
> sleeps.
>
> For now the vhost thread continues to exist and run work until the
> last file descriptor is closed and the release function is called as
> part of freeing struct file. To avoid hangs in the coredump
> rendezvous and when killing threads in a multi-threaded exec. The
> coredump code and de_thread have been modified to ignore vhost threads.
>
> Remvoing the special case for exec appears to require teaching
> vhost_dev_flush how to directly complete transactions in case
> the vhost thread is no longer running.
>
> Removing the special case for coredump rendezvous requires either the
> above fix needed for exec or moving the coredump rendezvous into
> get_signal.
>
> Fixes: 6e890c5d5021 ("vhost: use vhost_tasks for worker threads")
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> Co-developed-by: Mike Christie <michael.christie@oracle.com>
> Signed-off-by: Mike Christie <michael.christie@oracle.com>
Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
next prev parent reply other threads:[~2023-06-02 14:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 18:32 Mike Christie
2023-06-01 19:11 ` Michael S. Tsirkin
2023-06-02 0:43 ` Eric W. Biederman
2023-06-02 14:34 ` Nicolas Dichtel [this message]
2023-06-02 19:22 ` Oleg Nesterov
2023-06-03 3:44 ` Eric W. Biederman
2023-06-05 13:26 ` Oleg Nesterov
2023-06-03 4:15 ` [CFT][PATCH v3] " Eric W. Biederman
2023-06-04 3:28 ` michael.christie
2023-06-05 15:10 ` Oleg Nesterov
2023-06-05 15:46 ` Mike Christie
2023-06-06 12:16 ` Oleg Nesterov
2023-06-06 15:57 ` Mike Christie
2023-06-06 19:39 ` Oleg Nesterov
2023-06-06 20:38 ` Mike Christie
2023-06-14 6:02 ` Can vhost translate to io_uring? Eric W. Biederman
2023-06-14 6:25 ` michael.christie
2023-06-14 14:30 ` Jens Axboe
2023-06-14 17:59 ` Mike Christie
2023-06-14 14:20 ` Michael S. Tsirkin
2023-06-14 15:02 ` Michael S. Tsirkin
2023-06-11 20:27 ` [CFT][PATCH v3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression Eric W. Biederman
2023-06-14 17:08 ` Oleg Nesterov
2023-06-05 12:38 ` Oleg Nesterov
2023-06-05 13:48 ` [PATCH 1/1] " Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e8431649-6389-bea3-58ab-9764dba83b3e@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@leemhuis.info \
--cc=michael.christie@oracle.com \
--cc=mst@redhat.com \
--cc=oleg@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®