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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE897C433FE for ; Thu, 18 Nov 2021 18:02:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC41C6137B for ; Thu, 18 Nov 2021 18:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233023AbhKRSFX (ORCPT ); Thu, 18 Nov 2021 13:05:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229997AbhKRSFX (ORCPT ); Thu, 18 Nov 2021 13:05:23 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1411C061574 for ; Thu, 18 Nov 2021 10:02:22 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id w33-20020a17090a6ba400b001a722a06212so7182070pjj.0 for ; Thu, 18 Nov 2021 10:02:22 -0800 (PST) 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=F/aX29JhqFiyWVGDBmlPUQzn5wyWn1RYbWmxi309hXQ=; b=dLDlUhL5ow168T0suaa5qUj0qznT4FI0Kvp1pJZVbA6U5MqG8zkvt2V0dGhbVnoF3d iw8ATMy/dmp/5sYGhxyr1yY+4M3hLd+Mb7z1QeArTOOIGfFv8h3jsUmYQimnoniT0Qg9 5vReWRUgBQ3g2tZ2V60pYHvER1CRDSwTfD6AbTIgWwZaCa/+A91r4GU0pLEIIx1yKdTk nUrjN9fr7tGJ+I4zAdW9+KUIMd4qEe7FkvRYzSKu78FY80CIXc2tiQ2+ICviGXBqevGU 5yYon1Dnj5eD9Z782nk0E5NsErh+lxQaxQDLu8Ajf1/oU8i14AO9e+p68Lz3oekxCWpl hcIQ== 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=F/aX29JhqFiyWVGDBmlPUQzn5wyWn1RYbWmxi309hXQ=; b=Uh5fgWDnat9wtRq6I9Q3HI/BzZbgwbHk6DBrmvJvDjXvuHlfUB17VXVBLFFP+zxLeh OcSGOKpZR7T5IjAHxm3NCaCFJIVXZ8VVJkU1+L37WjZ3MNhojI1GJAbRXqO4A/RWbzcl p/vwrDGFx2QCUkbv/r6ByzOYBKr9I8b1SUZaNUuGdniP6YEe3Tt1jnBszqXNT8DZmK1x x/Vm+pbK8V9veeOKANaZrLn7U9gDgOCZIfl4aGwRo6vHBzOM4KwiwuT/22kvGWxixYaj OZut/3/NBA8a2MRrRzPZOUtwj/ZyjHvwxbp0PxLHqE7IiMSHmzxib1/mOJSkjOPKR6Ti IGOQ== X-Gm-Message-State: AOAM533YPMOP+I9SHTy1FH9K7Jgo6OnyeHaM8gSSOjw1y4owpyKWerVh LuEsvsWw3+YwBS6+dggZdbpRlg== X-Google-Smtp-Source: ABdhPJxtYIXOknnHt8eU9kz70UZuSvvfxYXDubUQj+PZrhnxNrUfqT1GLVQ70vZ8Vjxz+b0l/mdMLw== X-Received: by 2002:a17:902:e544:b0:144:e3fa:3c2e with SMTP id n4-20020a170902e54400b00144e3fa3c2emr749574plf.17.1637258542157; Thu, 18 Nov 2021 10:02:22 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id y7sm245178pge.44.2021.11.18.10.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 10:02:21 -0800 (PST) Date: Thu, 18 Nov 2021 18:02:17 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: Ben Gardon , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Peter Xu , Peter Shier , David Matlack , Mingwei Zhang , Yulei Zhang , Wanpeng Li , Xiao Guangrong , Kai Huang , Keqian Zhu , David Hildenbrand Subject: Re: [RFC 11/19] KVM: x86/mmu: Factor shadow_zero_check out of make_spte Message-ID: References: <20211110223010.1392399-1-bgardon@google.com> <20211110223010.1392399-12-bgardon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 18, 2021, Paolo Bonzini wrote: > On 11/18/21 17:37, Sean Christopherson wrote: > > > It's a bit ugly in that we'd pass both @kvm and @vcpu, so that needs some more > > > thought, but at minimum it means there's no need to recalc the reserved bits. > > > > Ok, I think my final vote is to have the reserved bits passed in, but with the > > non-nested TDP reserved bits being computed at MMU init. > > Yes, and that's also where I was getting with the idea of moving part of the > "direct" MMU (man, naming these things is so hard) to struct kvm: split the > per-vCPU state from the constant one and initialize the latter just once. > Though perhaps I was putting the cart slightly before the horse. > > On the topic of naming, we have a lot of things to name: > > - the two MMU codebases: you Googlers are trying to grandfather "legacy" and > "TDP" into upstream Heh, I think that's like 99.9% me. > but that's not a great name because the former is used also when shadowing > EPT/NPT. I'm thinking of standardizing on "shadow" and "TDP" (it's not > perfect because of the 32-bit and tdp_mmu=0 cases, but it's a start). Maybe > even split parts of mmu.c out into shadow_mmu.c. But shadow is flat out wrong until EPT and NPT support is ripped out of the "legacy" MMU. > - the two walkers (I'm quite convinced of splitting that part out of struct > kvm_mmu and getting rid of walk_mmu/nested_mmu): that's easy, it can be > walk01 and walk12 with "walk" pointing to one of them I am all in favor of walk01 and walk12, the guest_mmu vs. nested_mmu confusion is painful. > - the two MMUs: with nested_mmu gone, root_mmu and guest_mmu are much less > confusing and we can keep those names. I would prefer root_mmu and nested_tdp_mmu. guest_mmu is misleading because its not used for all cases of sp->role.guest_mode=1, i.e. when L1 is not using TDP then guest_mode=1 but KVM isn't using guest_mmu.