From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BEACC433EF for ; Fri, 11 Feb 2022 11:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349410AbiBKLSO (ORCPT ); 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-Google-Smtp-Source: ABdhPJyDcgpMTGH6f6BVy2LLyhE/vujiSOoCqg6ifnUovFsPfT65EG9BHiOZVdUE59P/9kZOzEcMIw== 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 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