Re: [PATCH] KVM: x86: switch hugepage recovery thread to vhost_task

Keith Busch
2024-12-19T18:08:56Z

On Thu, Dec 19, 2024 at 06:42:09PM +0100, Paolo Bonzini wrote:
> On 12/19/24 18:32, Keith Busch wrote:
> > This appears to be causing a user space regression. The library
> > "minijail" is used by virtual machine manager "crossvm". crossvm uses
> > minijail to fork processes, but the library requires the process be
> > single threaded. Prior to this patch, the process was single threaded,
> > but this change creates a relationship from the kvm thread to the user
> > process that fails minijail's test.
>
> Thanks for the report.
>
> The minijail code has a flag that's documented like this:
>
> /// Disables the check that prevents forking in a multithreaded environment.
> /// This is only safe if the child process calls exec immediately after
> /// forking. The state of locks, and whether or not they will unlock
> /// is undefined. Additionally, objects allocated on other threads that
> /// expect to be dropped when those threads cease execution will not be
> /// dropped.
> /// Thus, nothing should be called that relies on shared synchronization
> /// primitives referenced outside of the current thread. The safest
> /// way to use this is to immediately exec in the child.
>
> Is crosvm trying to do anything but exec? If not, it should probably use the
> flag.

Good point, and I'm not sure right now. I don't think I know any crosvm
developer experts but I'm working on that to get a better explanation of
what's happening,