[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220225173734.GA26252@blackbody.suse.cz>
Date: Fri, 25 Feb 2022 18:37:35 +0100
From: Michal Koutný <mkoutny@...e.com>
To: Vipin Sharma <vipinsh@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Tejun Heo <tj@...nel.org>,
seanjc@...gle.com, lizefan.x@...edance.com, hannes@...xchg.org,
dmatlack@...gle.com, jiangshanlai@...il.com, kvm@...r.kernel.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] KVM: Move VM's worker kthreads back to the original
cgroups before exiting.
Hi Vipin.
On Wed, Feb 16, 2022 at 09:37:45AM -0800, Vipin Sharma <vipinsh@...gle.com> wrote:
> On Thu, Jan 20, 2022 at 7:05 AM Michal Koutný <mkoutny@...e.com> wrote:
> > Have I missed an obstacle?
Aha...
[
> I used few other combination where I put kernel_wait() call after
> put_task_struct(k) call.
>
> Every time during the module exit, kernel was crashing like:
Thanks for trying this out.
]
> Do you have any suggestions what might be the right way to use this API?
...it has occured to me now -- the KVM kthread is not a child of the
wanna-wait user task. So the kernel_wait() silently errs with -ECHILD
and task_struct is released too early and that (probably) brings about
the crash.
I'm sorry for not realizing that initially.
(Generally, any kthread_create'd task would be affected by this. I guess
the KVM worker threads can't be forked from the kvm_create_vm() callers?
(It could prevent the double migration to and from caller's cgroup
though.))
Michal
Powered by blists - more mailing lists