[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5fO5bac8ohqUH1D@kbusch-mbp>
Date: Mon, 27 Jan 2025 11:22:29 -0700
From: Keith Busch <kbusch@...nel.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86/mmu: Ensure NX huge page recovery thread is
alive before waking
On Mon, Jan 27, 2025 at 08:48:03AM -0800, Sean Christopherson wrote:
> > > - vhost_task_start(kvm->arch.nx_huge_page_recovery_thread);
> > > + if (!nx_thread)
> > > + return;
> > > +
> > > + vhost_task_start(nx_thread);
> > > +
> > > + /* Make the task visible only once it is fully started. */
> > > + WRITE_ONCE(kvm->arch.nx_huge_page_recovery_thread, nx_thread);
> >
> > I believe the WRITE_ONCE needs to happen before the vhost_task_start to
> > ensure the parameter update callback can see it before it's started.
>
> It's not clear to me that calling vhost_task_wake() before vhost_task_start() is
> allowed, which is why I deliberately waited until the task was started to make it
> visible. Though FWIW, doing "vhost_task_wake(nx_thread)" before vhost_task_start()
> doesn't explode.
Hm, it does look questionable to try to wake a process that hadn't been
started yet, but I think it may be okay: task state will be TASK_NEW
before vhost_task_start(), which looks like will cause wake_up_process()
to do nothing.
Powered by blists - more mailing lists