Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp837097imw; Thu, 14 Jul 2022 11:42:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u+k+pSdS+9YJ5Il3yrLJDML6ZNiTT7lgzlna8Bfez974xuIxKmDhvfkzPtclErq4dYWhY+ X-Received: by 2002:a17:902:d4c2:b0:16b:ffc5:9705 with SMTP id o2-20020a170902d4c200b0016bffc59705mr9542078plg.142.1657824165457; Thu, 14 Jul 2022 11:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657824165; cv=none; d=google.com; s=arc-20160816; b=qjkIW7Y0bVXzYFulY3+dsqa7s9jWgR5G4BlXKTb6RytDJqGwZsugUDodaTen8WslTK 9nShm9mQr7Jz9EF0NrZWAYrp27DFM75sFbuLox+gNep8TEKKmaiQd3a/Fu3wXvzmQMDJ o2IeN20vBzzZyrGHbcgH3Xc86vdHVVS/OWs3X6OSXYPwqNyxQLbLTO+9uZZZa3GFBJlQ ETGeWpgznk9vvuMS8M6Fl8OWmkalO4mbhY3FH9+gH6Rariu0GLmIu2oaYh7r3ub8J/Yi UW0ryq+0XPuKiyeNWpFVNA+eyglil1ICfx5Z1cCAVe1Ec3ZUkIYDU6+Ni62rgCT3Uf7n 7Glg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tiWgUvy6b45CWDd/HT0PEWri5Zoyvp2wLT2egCbCO20=; b=MjP+vdW02SrLeS/vsM9215294yXsNT1YhuH+gkAbqOP1rCoJ+mbrQdxkJgy43Rzv2H qedgdpHoQAJtJ5bKLaVxFu9GGtdN4R6FtHez7iHEaO7oLIT6Zvse5T9r1eyx6en7xmJb nVqN3gVnAC3kEpD1mwW9V8KsB1aBdOd0TAvQZUxCgF2B97IohJf6BrKY6UP2EKdATIg4 RJcm3XVLpztQEyM/838boggGk+GS3EDbomSuji5TWnKAa7/T+KUpDIvSZDjjJejVG6nm GpiaxGJosCKwS3DYJl/cCULMlK6TTTukGMj7S34cM9aeapQialI5H62mOY0wMkd5vITF oCrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dIgBlRTq; 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 j66-20020a625545000000b0052ab81e9278si2978946pfb.26.2022.07.14.11.42.30; Thu, 14 Jul 2022 11:42:45 -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=dIgBlRTq; 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 S240614AbiGNSYE (ORCPT + 99 others); Thu, 14 Jul 2022 14:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233542AbiGNSYD (ORCPT ); Thu, 14 Jul 2022 14:24:03 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4548410E9 for ; Thu, 14 Jul 2022 11:24:01 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id g4so2332394pgc.1 for ; Thu, 14 Jul 2022 11:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tiWgUvy6b45CWDd/HT0PEWri5Zoyvp2wLT2egCbCO20=; b=dIgBlRTqASHmCeIp8hmpFhrD3seWd7DxAiOdzSeHp+7sX7MDEiFRNz8a8T3N+vmkot sIdhzb4rEGsicPy4lOlEMfn2SYjmuwI1PXT4tvYyXt5HNdKvYs0OZejBtdXC3RLyXM9D Z2+QYX5QY/xUCjm4iPLDr7a06j0UoiTX4x51UH6u0eeVIHOBQMq1nnqUHycEOM3aHNTW WJVCgX4nNtiS9Z8bWZwpQp4UiMwz7Dk3Vddq7vkfYZUQtN2TaiOCin+zMtujmGxGqXth TBAUphWaCI98VSautIghtaipwWw7VPJs6T+UKNotPA09/FdTUazxT16+J025lTS03R9U 7oaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tiWgUvy6b45CWDd/HT0PEWri5Zoyvp2wLT2egCbCO20=; b=zkdAhDow+dLkGRXLrVfamVhdghgIptVpbTOFHp7UvEwTnPNUL4zjBbSqL5EeFs6WUz M6F4OhNQT8YYlUZlb7rlUEhGGWMbH772vZ5zGFEVT9AuK1nXyJ2/2m9UmyEpqFyyNa0s 87HWhNahu3iJG5lvJnkaLjP7hXQ72o80IkolGKrEB99rtpXILxBPeBXt6r7NbGKuNszT WOsgsfsnouKPTTbh2USyVApdeEtiSSoVdnp39kdhAulCe6feUvJHps6cI6bnkQ5AGSte +oMUQrIk/PO5WRSc7U6n8zYJlmqNyfLYvNbl0l0yfbpAO1d83GO/6GGBwRUOomHue7rX gw0w== X-Gm-Message-State: AJIora8WmdmjLkdYMQDmLxGRM2r36WMggL0IYln5ag3Jdiq5UFo/Bacw HTU5Df9cIdFN3g9Ng6qJPfG5zA== X-Received: by 2002:a63:d1e:0:b0:40d:379e:bff8 with SMTP id c30-20020a630d1e000000b0040d379ebff8mr8987266pgl.215.1657823040721; Thu, 14 Jul 2022 11:24:00 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id md11-20020a17090b23cb00b001f10b31e7a7sm156628pjb.32.2022.07.14.11.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 11:24:00 -0700 (PDT) Date: Thu, 14 Jul 2022 18:23:57 +0000 From: Sean Christopherson To: Peter Xu Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] KVM: x86/mmu: Defer "full" MMU setup until after vendor hardware_setup() Message-ID: References: <20220624232735.3090056-1-seanjc@google.com> <20220624232735.3090056-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Jul 12, 2022, Peter Xu wrote: > On Fri, Jun 24, 2022 at 11:27:33PM +0000, Sean Christopherson wrote: > > @@ -11937,6 +11932,10 @@ int kvm_arch_hardware_setup(void *opaque) > > > > kvm_ops_update(ops); > > > > + r = kvm_mmu_hardware_setup(); > > + if (r) > > + goto out_unsetup; > > + > > kvm_register_perf_callbacks(ops->handle_intel_pt_intr); > > > > if (!kvm_cpu_cap_has(X86_FEATURE_XSAVES)) > > @@ -11960,12 +11959,18 @@ int kvm_arch_hardware_setup(void *opaque) > > kvm_caps.default_tsc_scaling_ratio = 1ULL << kvm_caps.tsc_scaling_ratio_frac_bits; > > kvm_init_msr_list(); > > return 0; > > + > > +out_unsetup: > > + static_call(kvm_x86_hardware_unsetup)(); > > Should this be kvm_mmu_hardware_unsetup()? Or did I miss something?.. There is no kvm_mmu_hardware_unsetup(). This path is called if kvm_mmu_hardware_setup() fails, i.e. the common code doesn't need to unwind anything. The vendor call is not shown in the patch diff, but it's before this as: r = ops->hardware_setup(); if (r != 0) return r there's no existing error paths after that runs, which is why the vendor unsetup call is new.