Re: [RESEND PATCH v10 05/10] x86: spp: Introduce user-space SPP IOCTLs
From: Yang Weijiang
Date: Mon Jan 13 2020 - 03:17:15 EST
On Fri, Jan 10, 2020 at 10:10:53AM -0800, Sean Christopherson wrote:
> On Thu, Jan 02, 2020 at 02:13:14PM +0800, Yang Weijiang wrote:
> > User application, e.g., QEMU or VMI, must initialize SPP
> > before gets/sets SPP subpages, the dynamic initialization is to
> > reduce the extra storage cost if the SPP feature is not not used.
> >
> > Co-developed-by: He Chen <he.chen@xxxxxxxxxxxxxxx>
> > Signed-off-by: He Chen <he.chen@xxxxxxxxxxxxxxx>
> > Co-developed-by: Zhang Yi <yi.z.zhang@xxxxxxxxxxxxxxx>
> > Signed-off-by: Zhang Yi <yi.z.zhang@xxxxxxxxxxxxxxx>
> > Signed-off-by: Yang Weijiang <weijiang.yang@xxxxxxxxx>
> > ---
> > arch/x86/include/asm/kvm_host.h | 4 ++
> > arch/x86/kvm/mmu/spp.c | 44 +++++++++++++++
> > arch/x86/kvm/mmu/spp.h | 9 ++++
> > arch/x86/kvm/vmx/vmx.c | 15 ++++++
> > arch/x86/kvm/x86.c | 95 ++++++++++++++++++++++++++++++++-
> > include/uapi/linux/kvm.h | 3 ++
> > 6 files changed, 169 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> > index f5145b86d620..c7a9f03f39a7 100644
> > --- a/arch/x86/include/asm/kvm_host.h
> > +++ b/arch/x86/include/asm/kvm_host.h
> > @@ -1238,6 +1238,10 @@ struct kvm_x86_ops {
> >
> > bool (*apic_init_signal_blocked)(struct kvm_vcpu *vcpu);
> > int (*enable_direct_tlbflush)(struct kvm_vcpu *vcpu);
> > +
> > + int (*init_spp)(struct kvm *kvm);
> > + int (*flush_subpages)(struct kvm *kvm, u64 gfn, u32 npages);
> > + int (*get_inst_len)(struct kvm_vcpu *vcpu);
>
> If this is necessary, which hopefully it isn't, then get_insn_len() to be
> consistent with other KVM nomenclature.
>
Yep, will change it.
> A comment for the series overall, it needs a lot of work to properly order
> code between patches. E.g. this patch introduces get_inst_len() without
> any justification in the changelog and without a user. At best it's
> confusing, at worst this series will be impossible to bisect.
I'll double check the patch and add more comments on some confusing
points. Meanwhile, will re-order some code to make the serial testable,
thanks a lot for your careful review!