[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac81dcba-13db-8286-0f2e-f46a413a09cf@redhat.com>
Date: Wed, 15 Dec 2021 19:27:44 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Vipin Sharma <vipinsh@...gle.com>, seanjc@...gle.com,
"Michael S. Tsirkin" <mst@...hat.com>
Cc: dmatlack@...gle.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: Move VM's worker kthreads back to the original
cgroups before exiting.
On 12/14/21 06:07, Vipin Sharma wrote:
>
> KVM terminates the worker kthreads by calling kthread_stop() which waits
> on the signal generated by exit_mm() in do_exit() during kthread's exit.
Instead of "signal", please spell it as "the 'exited' completion,
triggered by exit_mm(), via mm_release(), during the kthread's exit".
That makes things a bit clearer.
So the issue is that the kthread_stop happens around the time
exit_task_work() destroys the VM, but the process can go on and signal
its demise to the parent process before the kthread has been completely
dropped. Not even close() can fix it, though it may reduce the window
completely, so I agree that this is a bug and vhost has the same bug too.
Due to the issue with kthreadd_task not being exported, perhaps you can
change cgroup_attach_task_all to use kthreadd_task if the "from"
argument is NULL?
Paolo
Powered by blists - more mailing lists