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 23825C433EF for ; Thu, 10 Feb 2022 09:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239153AbiBJJwJ (ORCPT ); Thu, 10 Feb 2022 04:52:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbiBJJwH (ORCPT ); Thu, 10 Feb 2022 04:52:07 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CEB57250 for ; Thu, 10 Feb 2022 01:52:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644486727; 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=f91FCCeGq06aNvkcPfCWFTAXz7qvGKLhqYaagKj3uqI=; b=h4QKx5wmBGT+br1O0JuB7DG56PFn0M3Sc0IDBABMbcg0Blf0SrsITO2CP0UmvF2PtUbKNK NSKDejGgm+N0z4sZfm/w6f4LXmW9ITOsV2iSgrQftgnxXXEXeqbKUCUmyZfCWNMdNDDtdW brgNrJRDhwt8c6g4Unze0dk9uARF9K0= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-456-E_MUAZ_PMeixPoIgC_t4Hg-1; Thu, 10 Feb 2022 04:52:06 -0500 X-MC-Unique: E_MUAZ_PMeixPoIgC_t4Hg-1 Received: by mail-ej1-f69.google.com with SMTP id v2-20020a170906292200b006a94a27f903so2477271ejd.8 for ; Thu, 10 Feb 2022 01:52:06 -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=f91FCCeGq06aNvkcPfCWFTAXz7qvGKLhqYaagKj3uqI=; b=O7YlLSitvc1mNAZGnkbGmYDCFBvkynWU0KkmcbGOH98HHk2Z+AARXvjp6R3QeYeTHq xMMII2I6xp+WVticGTfvjjKQd6EWJT14rJng+3NzQ7aPW17gHWQ0VFz/hHGmWdtbM3+B C/4oHriLrfoHmPrS2YPx8aEYm9KT7Qf7BLQI46RQZeaaiHsO0MkvEUzu8KGDdnAzNPqG P5AcidOSbPQVqumijcFl1gG4NJ4KTCC1CMttIBAorBwjco4M42Z0sTYOJTx+flX8R3H2 uMr9QCz/8qLUErCM2E+4IqQ1XvaoVsiplmnu3P8GpXD8avTQjqlOxmJKu2oFpRvnWte2 ffBw== X-Gm-Message-State: AOAM533slZzmVXwqOguxwGrQSMjKnDKtNvvRK5WE4d/ud5nCD4udcqoa 9D4JAn7xN+wL9ET9up8UVM77iw1heVcK+FMwnqGVoOAQAGOv71WM8j/wLDzmao99M2WHuyBzgJM TCHDr3UWPt6+MBLaRXPGuy7Jg X-Received: by 2002:a17:907:16aa:: with SMTP id hc42mr5656294ejc.307.1644486725361; Thu, 10 Feb 2022 01:52:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzPiWFgV580SgcmFbsoPownArFuAX6Qoh20+/Wh5oVOlIGwlHf3OkEF/WdgZ58aQXeQy1XtA== X-Received: by 2002:a17:907:16aa:: with SMTP id hc42mr5656283ejc.307.1644486725183; Thu, 10 Feb 2022 01:52:05 -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 r3sm6926943ejd.129.2022.02.10.01.52.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Feb 2022 01:52:04 -0800 (PST) Message-ID: <1e8c38eb-d66a-60e7-9432-eb70e7ec1dd4@redhat.com> Date: Thu, 10 Feb 2022 10:52:03 +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 07/23] KVM: MMU: remove kvm_mmu_calc_root_page_role Content-Language: en-US To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, dmatlack@google.com, vkuznets@redhat.com References: <20220204115718.14934-1-pbonzini@redhat.com> <20220204115718.14934-8-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/10/22 01:47, Sean Christopherson wrote: > The nested mess is likely easily solved, I don't see any obvious issue with swapping > the order. But I still don't love the subtlety. I do like shaving cycles, just > not the subtlety... Not so easily, but it's doable and it's essentially what I did in the other series (the one that reworks the root cache). Quick spoiler: there's a complicated dependency between the _old_ values in kvm_mmu and the root cache, so that the root cache code currently needs both the old MMU state (especially shadow_root_level/root_level) and the new role. kvm_mmu_reset_context does the expensive kvm_mmu_unload to cop out of having to know in advance the new role; the crux of the other series is to remove that need, so that kvm_mmu_reset_context does not have to cop out anymore. > If we do rework things to have kvm_mmu_new_pgd() pull the role from the mmu, then > we should first add a long overdue audit/warn that KVM never runs with a mmu_role > that isn't consistent with respect to its root SP's role. There's a much cheaper check that can be done to enforce the invariant that kvm_mmu_new_pgd must follow kvm_init_mmu: kvm_init_mmu sets a not_ready flag, kvm_mmu_new_pgd clears it, and kvm_mmu_reload screams if it sees not_ready == 1. Paolo