[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABgObfYd4TWq4ObUzkDruj_e111cTniWtXckzB_Ft7SOdv7YMQ@mail.gmail.com>
Date: Mon, 10 Jun 2024 11:23:43 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Cc: "seanjc@...gle.com" <seanjc@...gle.com>, "Huang, Kai" <kai.huang@...el.com>,
"sagis@...gle.com" <sagis@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Zhao, Yan Y" <yan.y.zhao@...el.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"dmatlack@...gle.com" <dmatlack@...gle.com>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>
Subject: Re: [PATCH v2 09/15] KVM: x86/tdp_mmu: Support mirror root for TDP MMU
On Mon, Jun 10, 2024 at 2:09 AM Edgecombe, Rick P
<rick.p.edgecombe@...el.com> wrote:
> Agreed that this is less TDX specific and it means that this part of the generic
> MMU code doesn't need to know that the mirror/direct matches to private vs
> shared. I don't love that it has such a complicated conditional for the normal
> VM case, though. Just for readability.
>
> The previous versions checked kvm_gfn_shared_mask() more readily in various open
> coded spots. In this v2 we tried to reduce this and instead always rely on
> the "private" concept to switch between the roots in the generic code. I think
> it's arguably a little easier to understand if we stick to a single way of
> deciding which root to use.
But there isn't any other place that relies on is_private, right? So...
> But I don't feel like any of these solutions discussed is perfectly clean. So
> I'm ok taking the benefits you prefer. I guess doing bitwise operations when
> possible is kind of the KVM way, haha. :)
... while I'm definitely guilty of that, :) it does seem the cleanest
option to use fault->addr to go from struct kvm_page_fault to the kind
of root.
If you prefer, you can introduce a bool kvm_is_addr_direct(struct kvm
*kvm, gpa_t gpa), and use it here as kvm_is_addr_direct(kvm,
fault->addr). Maybe that's the best of both worlds.
Paolo
Powered by blists - more mailing lists