mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny@suse.com>
To: Vipin Sharma <vipinsh@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Tejun Heo <tj@kernel.org>,
	seanjc@google.com, lizefan.x@bytedance.com, hannes@cmpxchg.org,
	dmatlack@google.com, jiangshanlai@gmail.com, kvm@vger.kernel.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: Move VM's worker kthreads back to the original cgroups before exiting.
Date: Fri, 25 Feb 2022 18:37:35 +0100	[thread overview]
Message-ID: <20220225173734.GA26252@blackbody.suse.cz> (raw)
In-Reply-To: <CAHVum0fOP-2XcUcG3PqW08DY7CmpDroG6Fcv9KoD1FqLmGpB8w@mail.gmail.com>

Hi Vipin.

On Wed, Feb 16, 2022 at 09:37:45AM -0800, Vipin Sharma <vipinsh@google.com> wrote:
> On Thu, Jan 20, 2022 at 7:05 AM Michal Koutný <mkoutny@suse.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


      parent reply	other threads:[~2022-02-25 17:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 22:53 Vipin Sharma
2021-12-28 17:17 ` Sean Christopherson
2022-01-18 19:53   ` Vipin Sharma
2022-01-05 18:04 ` Michal Koutný
2022-01-18 20:25   ` Vipin Sharma
2022-01-18 20:39     ` Tejun Heo
2022-01-19 18:02       ` Paolo Bonzini
2022-01-19 18:30         ` Tejun Heo
2022-01-19 18:49           ` Vipin Sharma
2022-01-19 19:05             ` Tejun Heo
2022-01-20 15:05           ` Michal Koutný
2022-02-16 17:37             ` Vipin Sharma
2022-02-16 19:48               ` Paolo Bonzini
2022-02-25 17:37               ` Michal Koutný [this message]

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=20220225173734.GA26252@blackbody.suse.cz \
    --to=mkoutny@suse.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dmatlack@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=jiangshanlai@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tj@kernel.org \
    --cc=vipinsh@google.com \
    /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®