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 A2DB4C433EF for ; Thu, 10 Feb 2022 17:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245271AbiBJRnM (ORCPT ); Thu, 10 Feb 2022 12:43:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245236AbiBJRnK (ORCPT ); Thu, 10 Feb 2022 12:43:10 -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 1E95AF6F for ; Thu, 10 Feb 2022 09:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644514990; 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=l/BBZqEoVfgrKabodXFBIfVfpq8FM92AHBedmxW/K9E=; b=Ie9G2HPtAKVSAEIcfInoE5ALNo6uWflVIFlj+duFdB76nem09Ewr9yn5JvWhylDytu7INp 9dD+rjZPMVZkeiucrjC/nZF+tjuyCMdT64udZYcKoQZWzYHih36iHUTTKOrB952DegyqsJ a2KuieNsqw+RhbDmH2ASzi5NySiAG9o= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-cEIs4wIqMSKCWU4JMM8PxA-1; Thu, 10 Feb 2022 12:43:04 -0500 X-MC-Unique: cEIs4wIqMSKCWU4JMM8PxA-1 Received: by mail-ed1-f70.google.com with SMTP id u24-20020a50d518000000b0040f8cef2463so3742553edi.21 for ; Thu, 10 Feb 2022 09:43:03 -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=l/BBZqEoVfgrKabodXFBIfVfpq8FM92AHBedmxW/K9E=; b=68c5adAMY6hbycPX5/AHkBqOpr3TCjF6D1Y5bZlcP6ttTc/TlXGbTEbaKdz/BWxM6x oEauzDOKG493REj4ayAxszQb5n5kecNcN0CrXjWlDnMrH8DbqbCsp73UEsUbdSJ4IzKl CE/eu++jzYxGxGDEMEIKabO43BsnoxMeSahvJ3GeN3DnoiMURJLPp9036ZJL+MBWTszJ nIxfnIdaYTYutZR1w/8IhXFHX3j0WQjUVyvfq/Va24OZVy4r6gIIXcsIKW+0ACErBHIM 1iND00lGDwfoKcIr0pqcoGXvXclCyEaqZhQlUr2K+tmJoqdcz28lYrA8K9EF9Rz/qi6m Tq4w== X-Gm-Message-State: AOAM530mZVDIt21BG7J0ongGBu2Qnf3O6eKXQdP1B76o1HLDf+pvw0XR 0Nh9ukQK8ZrrFDro1iCmS2wwmQnsTZgfhHDJtEBUXYUaFxObtN/X3VQTkZc+lDgMIYVPTr4OFiA 6UzfA4cMGxOgSRop6tTOgmBPJ X-Received: by 2002:a17:907:7292:: with SMTP id dt18mr6977861ejc.667.1644514982869; Thu, 10 Feb 2022 09:43:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKjfhznrr9laZMtcRaScaaUKLhriNA5xwcpXInITqCA6iv3CF/yPelg05zk1+mdpH7+t1itQ== X-Received: by 2002:a17:907:7292:: with SMTP id dt18mr6977851ejc.667.1644514982705; Thu, 10 Feb 2022 09:43:02 -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 z22sm8979452edq.9.2022.02.10.09.43.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Feb 2022 09:43:01 -0800 (PST) Message-ID: <88d3f309-9424-9035-b2ef-88c5d7fb088f@redhat.com> Date: Thu, 10 Feb 2022 18:43:00 +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> <1e8c38eb-d66a-60e7-9432-eb70e7ec1dd4@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 18:29, Sean Christopherson wrote: > On Thu, Feb 10, 2022, Paolo Bonzini wrote: >> 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). > > Sounds like I should reveiw that series first? Yeah, this one is still a nice step in the direction of guest pt walk from shadow pt build(*), but with no immediate use for TDP MMU root reuse. The original idea was to use the MMU role to decide whether to do kvm_mmu_unload(), but that would have still been a bandaid---inefficient and a bad idea overall. Patches 6+7 of this series (once fixed, because they were buggy as hell) turned out to be enough to tame the PGD cache and remove kvm_mmu_unload() altogether from kvm_mmu_reset_context(). Paolo (*) Your idea of detecting stale roots is quite easily implemented on top of these, for example, because a root is stale if and only if the root_role changes.