From: David Matlack <dmatlack@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kvm list <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: MMU: propagate alloc_workqueue failure
Date: Thu, 31 Mar 2022 15:23:44 -0700 [thread overview]
Message-ID: <CALzav=ch2ZEA6OGvYnucZCWG12uhSuTnQpxc8e9FwvP5VCSvcw@mail.gmail.com> (raw)
In-Reply-To: <0c830e36-fcf2-fab6-aed9-7b6a6736140f@redhat.com>
On Thu, Mar 31, 2022 at 2:34 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 3/31/22 01:51, David Matlack wrote:
> >> -void kvm_mmu_init_vm(struct kvm *kvm)
> >> +int kvm_mmu_init_vm(struct kvm *kvm)
> >> {
> >> struct kvm_page_track_notifier_node *node = &kvm->arch.mmu_sp_tracker;
> >> + int r;
> >>
> >> + INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
> >> + INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages);
> >> + INIT_LIST_HEAD(&kvm->arch.lpage_disallowed_mmu_pages);
> >
> > I agree with moving these but that should probably be done in a separate
> > commit.
>
> Ok.
>
> >> - kvm->arch.tdp_mmu_zap_wq =
> >> - alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0);
> >> -
> >> - return true;
> >> + kvm->arch.tdp_mmu_zap_wq = wq;
> >
> > Suggest moving this to just after checking the return value of
> > alloc_workqueue().
>
> This is intentional, in case we have other future allocations, to avoid
> having to NULL out the field in the unwind path. It's a matter of taste
> I guess.
Oh ok, that makes sense. I agree it's a matter of taste.
>
> >> + return 1;
> >
> > Perhaps return 0 until we have a reason to differentiate the 2 cases.
>
> Yeah, though I wanted to preserve the previous behavior.
>
> >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >> index fe2171b11441..89b6efb7f504 100644
> >> --- a/arch/x86/kvm/x86.c
> >> +++ b/arch/x86/kvm/x86.c
> >> @@ -11629,12 +11629,13 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
> >>
> >> ret = kvm_page_track_init(kvm);
> >> if (ret)
> >> - return ret;
> >> + goto out;
> >
> > nit: This goto is unnecessary.
>
> True, but I prefer to be consistent in using "goto" so that any future
> additions are careful about preserving the chain.
Sounds good.
>
> Paolo
>
prev parent reply other threads:[~2022-03-31 22:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 16:55 [PATCH] KVM: MMU: propagate alloc_workqueue failure Paolo Bonzini
2022-03-30 23:51 ` David Matlack
2022-03-31 9:34 ` Paolo Bonzini
2022-03-31 22:23 ` David Matlack [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='CALzav=ch2ZEA6OGvYnucZCWG12uhSuTnQpxc8e9FwvP5VCSvcw@mail.gmail.com' \
--to=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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;
as well as URLs for NNTP newsgroup(s).