Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4000361pxb; Fri, 11 Feb 2022 12:36:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7M0GCJzDztTSVgsA0sQSLUVG7NxjicUFVTPtwwB5fNayPvNqyQMaUGsbxfqniSMg0Btqt X-Received: by 2002:a17:902:e743:: with SMTP id p3mr3150367plf.152.1644611813310; Fri, 11 Feb 2022 12:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644611813; cv=none; d=google.com; s=arc-20160816; b=wdPhjXe/dFmvLRec+/vPZyVKH72pcTi9UHCHMtpLLbxVAl6bk2HmyueCvF9rk/cQBb d/Oj0l1MOf6E4v1UYebIKLwUmcz6D0YsX+DIPpusQ1RW+1ewryhcj6140tZEQwBm3TrZ RMuMKlvD9ElvfcQwg7eCVRVJZ3WHTUeSkL9J6CfFc+oVYN1LSZTyGh3Q1NhHUdEVHMex WIUs/BXDEzUddEtFC1LHKUVxG4Gka/wqDvCJiVprTpezx8CtznasJAXS/m9XD23xb/Fd 8NU0JKduq3b+HXE5YZBn5+oAHD0bDoU/EeH+VN4tYK/Nv4owBdqHiB/Z/8SQRPo4Sqkv i4hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Q7Yj/WHUmr9v6/YtpG86Ztj5f1af9VlUf1YMxG56kZI=; b=Inpb1qAZ6iVxMRMekYB1Z/IfVjJ+qZkuNA/RlE96JHADq+Keut5aPKJS0y2tYnBoZT CLDxM51To+dqC8WcQVnextVjurpOkdEEtpRW914ThOtMshflg4tU+1Qeet5Ds2E/U7Sw dkgNWEXrfSr4qhKPIO8X2oSALYuVhFA+pL4yEx4IADwbb4+pnvdf4ZDBqQR3oewOGs5f pajKJfx8EPlZI++ZwFOT2Wkllq31+NXXqsgA63/QsSSOAdXCvwNnDX0Jjd+Zd8gX0jsH o+Ci+go7jHO+FTzs0oDd8Etuz+13qL0syB/c41jZgic9a41+NGh2OSIQeArqk9lFRKeL A3IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VtZ9uV7g; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13si6565388pls.127.2022.02.11.12.36.39; Fri, 11 Feb 2022 12:36:53 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=VtZ9uV7g; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239179AbiBKLSO (ORCPT + 99 others); Fri, 11 Feb 2022 06:18:14 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243407AbiBKLSN (ORCPT ); Fri, 11 Feb 2022 06:18:13 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C253CDA for ; Fri, 11 Feb 2022 03:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644578291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q7Yj/WHUmr9v6/YtpG86Ztj5f1af9VlUf1YMxG56kZI=; b=VtZ9uV7gdC4SGAAzB2ANnHjs7a/oFjTnbGrS4yGKe5YfEso1teKUy4OnEJ2KQWHpRwQUnq 85HAZNkYECsdab3u6Hs85kaQ2YtQjT0yFBndi4vt9AAQeB+pgnmJlswXwBFzu//EcPOo2W kvVgRKKgUZQLHTm0uVQpHekHgpbViHs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-329-bQZ-hnV_O8a7Xg2Ri6euqA-1; Fri, 11 Feb 2022 06:18:10 -0500 X-MC-Unique: bQZ-hnV_O8a7Xg2Ri6euqA-1 Received: by mail-wm1-f69.google.com with SMTP id j39-20020a05600c1c2700b0037becd18addso2379726wms.4 for ; Fri, 11 Feb 2022 03:18:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Q7Yj/WHUmr9v6/YtpG86Ztj5f1af9VlUf1YMxG56kZI=; b=W8jE0v039K/7NWyJkRzIvUr39iDUYzSu83iEcCyBObL2F9q2BRpYV/mPk9oI8xrRVV 7BS18FLZsoDsUArKuNJRxa+hm0RpGAvf1olrgRYBw/YsxoZijywa3PC6btUrmA8U0aQO Xa+BZ4Qpu8mknQPuuS51JP6/1bjtF5VtgHvjl9OeT0kqcHEMbHXLBKQmJiTDnUPiNd7S O4uhJly6PNS0k5Fazk0KZz+Ne8Ddc6f+kIgB0F/FKlJkPaQ+lpUXF5gA1mEjNRnh8S3s OQDmvlPsDVq1jkRcHUdsPHtyWwYcSEkwjbEdVOAMuSZOZzLEgqELOU2sG5Z8yuseFL37 +GSA== X-Gm-Message-State: AOAM533Bs6sCLQNoCwWgHDsxTVsBtByf9djQC0v4jJNmRA+OMArSYlAD 3iCcJbxOVDGtSGW/zgkPczAkYGYezJZAmCPwCKdvnYOKfymLBpiwOvQvtHkGzDyuEh9+YwUDvIc 3Jl42blJ8VuEPlpc+/IxnguqY X-Received: by 2002:a05:6000:16c5:: with SMTP id h5mr982879wrf.364.1644578288918; Fri, 11 Feb 2022 03:18:08 -0800 (PST) X-Received: by 2002:a05:6000:16c5:: with SMTP id h5mr982863wrf.364.1644578288694; Fri, 11 Feb 2022 03:18:08 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id r13sm9590084wro.89.2022.02.11.03.18.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 03:18:08 -0800 (PST) Message-ID: <94cb12a0-ba01-57b0-0aeb-9b179d89c874@redhat.com> Date: Fri, 11 Feb 2022 12:18:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 04/12] KVM: MMU: WARN if PAE roots linger after kvm_mmu_unload Content-Language: en-US To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, vkuznets@redhat.com, mlevitsk@redhat.com, dmatlack@google.com References: <20220209170020.1775368-1-pbonzini@redhat.com> <20220209170020.1775368-5-pbonzini@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 2/11/22 00:20, Sean Christopherson wrote: > On Wed, Feb 09, 2022, Paolo Bonzini wrote: >> Signed-off-by: Paolo Bonzini >> --- >> arch/x86/kvm/mmu/mmu.c | 17 +++++++++++++---- >> 1 file changed, 13 insertions(+), 4 deletions(-) >> >> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c >> index e0c0f0bc2e8b..7b5765ced928 100644 >> --- a/arch/x86/kvm/mmu/mmu.c >> +++ b/arch/x86/kvm/mmu/mmu.c >> @@ -5065,12 +5065,21 @@ int kvm_mmu_load(struct kvm_vcpu *vcpu) >> return r; >> } >> >> +static void __kvm_mmu_unload(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu) >> +{ >> + int i; >> + kvm_mmu_free_roots(vcpu, mmu, KVM_MMU_ROOTS_ALL); >> + WARN_ON(VALID_PAGE(mmu->root_hpa)); >> + if (mmu->pae_root) { >> + for (i = 0; i < 4; ++i) >> + WARN_ON(IS_VALID_PAE_ROOT(mmu->pae_root[i])); >> + } > > I'm somewhat ambivalent, but if you're at all on the fence, I vote to drop this > one. I've always viewed the WARN on root_hpa as gratuitous. > > But, if it helped during development, then why not... Well, it was not really helping in that the WARN triggered, but rather it was ruling out the more blatant violations of invariants. The one in patch 5 triggered a lot, though. Paolo