Re: [PATCH] KVM: x86/mmu: Embed direct bits into gpa for KVM_PRE_FAULT_MEMORY
From: Edgecombe, Rick P
Date: Thu Jun 12 2025 - 14:40:38 EST
On Thu, 2025-06-12 at 20:20 +0800, Yan Zhao wrote:
> What about passing is is_private instead?
>
> static inline bool kvm_is_mirror_fault(struct kvm *kvm, bool is_private)
> {
> return kvm_has_mirrored_tdp(kvm) && is_private;
> }
>
> tdp_mmu_get_root_for_fault() and kvm_tdp_mmu_gpa_is_mapped() can pass in
> faul->is_private or is_private directly, leaving the parsing of error_code &
> PFERR_PRIVATE_ACCESS only in kvm_mmu_do_page_fault().
General question about the existing code...
Why do we have the error code bits separated out into bools in struct
kvm_page_fault? It transitions between:
1. Native exit info (exit qualification, AMD error code, etc)
2. Synthetic error codes
3. struct kvm_page_fault bools *and* synthetic error code.
Why don't we go right to struct kvm_page_fault bools? Or just leave the
synthetic error code in struct kvm_page_fault and refer to it? Having both in
struct kvm_page_fault seems wrong, at least.