[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZHaL/d0XhoCmoo3q@google.com>
Date: Tue, 30 May 2023 16:51:25 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Yan Zhao <yan.y.zhao@...el.com>
Cc: Chao Gao <chao.gao@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, pbonzini@...hat.com
Subject: Re: [PATCH v2 1/6] KVM: x86/mmu: add a new mmu zap helper to indicate
memtype changes
On Tue, May 30, 2023, Yan Zhao wrote:
> On Thu, May 25, 2023 at 08:54:15AM -0700, Sean Christopherson wrote:
> And I combined the __kvm_mmu_honors_guest_mtrrs() into
> kvm_mmu_honors_guest_mtrrs(). Not sure if you like it :)
I would prefer to provide a separater inner helper, mainly so that the common
case callers don't need to pass %false. I don't love passing bools, but it's
tolerable for a one-off use of an inner helper.
> +/*
> + * Returns if KVM honors guest MTRRs
> + * @override_vm_has_noncoherent_dma: Allow caller to override non-coherent DMA
> + * status returned from
> + * kvm_arch_has_noncoherent_dma()
> + */
> +bool kvm_mmu_honors_guest_mtrrs(struct kvm *kvm,
> + bool override_vm_has_noncoherent_dma)
> +{
> + bool noncoherent_dma = override_vm_has_noncoherent_dma ? true :
> + kvm_arch_has_noncoherent_dma(kvm);
The "override" name is confusing, e.g. it won't be clear when it's safe/correct
for a new caller to override kvm_arch_has_noncoherent_dma(). If we go with a
single helper, I could live with:
bool kvm_mmu_honors_guest_mtrrs(struct kvm *kvm, bool stopping_noncoherent_dma)
{
bool noncoherent_dma = stopping_noncoherent_dma ||
kvm_arch_has_noncoherent_dma(kvm);
...
}
but that makes it awkward to use common code for start+stop assignment, and as
above there are three "normal" callers that would have to pass magic %false
values regardless of the name.
Powered by blists - more mailing lists