Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1718040pxb; Sat, 2 Apr 2022 00:29:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbh5KFRmTxgjV2Y04MWWgQvV2atCsPj4YvnlZJjB1y8Hh50l7DtUvrNtU3b6dc4oVBIenZ X-Received: by 2002:a05:6402:278f:b0:41b:79b1:39b4 with SMTP id b15-20020a056402278f00b0041b79b139b4mr11729658ede.163.1648884595393; Sat, 02 Apr 2022 00:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648884595; cv=none; d=google.com; s=arc-20160816; b=OtKEknccwxxPoNhpFoNFIIJfu1mftcGpohfNvbPTUg+2bJYo1qWgx6I8lF4c79xXS6 EhlBxNl6rcIAPSovsAxUnGhkCcRjtJIk9yCJZx/9wriWJzDhzrJpvYn6d1ndn901A9Ix +gNOzFDu2sA6s/nKAHWe6eb4QTq3h+C07lG5yObZ7igrXoaRhSMH7VZVlhKzwwNbiu4W aPPkBNPZDB8ntDwsnxq6POe2hhqS2vsWJFElVI89J31sSMN28sxcpAQtJrnajgkFp0qG sm1I/btzSxiI3/ET9/VZl+SZJS9f3Xb7AQ8pVq5hTUrRAizfoCetbEgsclqyoJNpUfS9 Rwlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FP8sOgFMKdQHyzKTsWIeV2u7i9jzT+8IqNj2W9h0y6Y=; b=f1SGLYYv0q9hfLvZZf/+ceC4MUrWxeJJuqNYJfC+Sxxj/C8mScdI2Eo+R7UxjArdHP BpaqqNTCkChyIQlwL8PnQQ37LyJ4DlDPx8y1LGE3aOM4B+LRQE9x9HJdJspUJsvRyTjo Y2DPmD7jIfPIvYHZZdw7n568gfLijxsM/BjP5eqbj2SzlU8pE2RSDYbHZY/7XOMuDTxi clrPj7mcxd4xr4s8qcuuzljgHNRMs6uTMcdPTZo71fkJBuHUPFB/zj1eZ2xJlP25GiUv aq7NSnTzc9A7wKjX9fOpFhBz1GoK7V2K8AJvuHE0AVk6EGWNEYmfY9+02ShMw6mpdfxK 8rng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mgJpIhoR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a056402524a00b00418c2b5bd84si3277468edd.102.2022.04.02.00.29.21; Sat, 02 Apr 2022 00:29:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mgJpIhoR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242426AbiCaW0C (ORCPT + 99 others); Thu, 31 Mar 2022 18:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242429AbiCaW0B (ORCPT ); Thu, 31 Mar 2022 18:26:01 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1628B193230 for ; Thu, 31 Mar 2022 15:24:13 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id bt26so1674461lfb.3 for ; Thu, 31 Mar 2022 15:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FP8sOgFMKdQHyzKTsWIeV2u7i9jzT+8IqNj2W9h0y6Y=; b=mgJpIhoRYTQaPKyD3ets4VfMCGuyuUERLeqqLiU6SYa8F/zYOQ+h8/g1J0qezFVtOK O9SUhLAx/Ggx5tyWGuHYOABMZhIskcWmon0TsLGOFa2UpeiysS8LHeBZHAL6LGKFlLwh fhbO10znZh8RNnVHLo/dtXGYwPnlRcoIIZyVp0/wY+x6gBkYTdqjvOIjvfrsmOxR18GC futWvmXYez+5heCAfp/zr9jgJzzw79AeOjnRIbDFSupqzBYfYkrEyaUE2EpSfF0iMQov PHDqvCl8rCy0XQj9zBoaT1ikVu3p0u3FdN1Ni1zcCOZ2Q23HUkirni5TmfR3nlFTd/Z8 02qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FP8sOgFMKdQHyzKTsWIeV2u7i9jzT+8IqNj2W9h0y6Y=; b=R+lBKmGm2ckL+PbEBY/ceEnTzYU6+kv2PgW1j3z0wer2sUoQIOnwoV1TbGpYU3BFoB 9sL6fGtamC5z5KVAqoBk9HTFuhFAPC5uGJ8HiXKOIR3aXC+/a/uZKqRDDoSt6KS7n5YT 0LaSdVXEUNTGBSaN710EMy6f20VyiIktStBvTIGGjMBqWWHW0m5YJlKhfUmYRK9oRk/Y d+KvDJPq8NgaVVi+0dE64w5sWlfsUOc72U2utbV7pUiz5BoLmNbIqkR3rKYLdj5qZtkQ P9KQczmePGobrvWEFCrw6HaR7myMzR04k7CvTsSVWJJe3z3LJzbqu7xTLB7PVDdmXobc VhPg== X-Gm-Message-State: AOAM531SyA+VAvZhLHN3d9KlpWulvumluPr3mFJAHQwY2l2CnG1HWEge Oh65YSpkUA0rdUJfgDEqGG2W1c+twq/36pQec+3Od89fJEE= X-Received: by 2002:a19:490f:0:b0:448:4bf8:6084 with SMTP id w15-20020a19490f000000b004484bf86084mr11842370lfa.537.1648765451129; Thu, 31 Mar 2022 15:24:11 -0700 (PDT) MIME-Version: 1.0 References: <20220330165510.213111-1-pbonzini@redhat.com> <0c830e36-fcf2-fab6-aed9-7b6a6736140f@redhat.com> In-Reply-To: <0c830e36-fcf2-fab6-aed9-7b6a6736140f@redhat.com> From: David Matlack Date: Thu, 31 Mar 2022 15:23:44 -0700 Message-ID: Subject: Re: [PATCH] KVM: MMU: propagate alloc_workqueue failure To: Paolo Bonzini Cc: LKML , kvm list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 31, 2022 at 2:34 AM Paolo Bonzini 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 >