On Tue, Nov 01, 2022, Josh Poimboeuf wrote: > On Mon, Oct 31, 2022 at 05:37:46PM +0000, Sean Christopherson wrote: > > > diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c > > > index cb50589a7102..90da275ad223 100644 > > > --- a/arch/x86/kernel/asm-offsets.c > > > +++ b/arch/x86/kernel/asm-offsets.c > > > @@ -111,6 +111,7 @@ static void __used common(void) > > > > > > if (IS_ENABLED(CONFIG_KVM_INTEL)) { > > > BLANK(); > > > + OFFSET(VMX_vcpu_arch_regs, vcpu_vmx, vcpu.arch.regs); > > > > Is there an asm-offsets-like solution that doesn't require exposing vcpu_vmx > > outside of KVM? We (Google) want to explore loading multiple instances of KVM, > > i.e. loading multiple versions of kvm.ko at the same time, to allow intra-host > > migration between versions of KVM to upgrade/rollback KVM without changing the > > kernel (RFC coming soon-ish). IIRC, asm-offsets is the only place where I haven't > > been able to figure out a simple way to avoid exposing KVM's internal structures > > outside of KVM (so that the structures can change across KVM instances without > > breaking kernel code). > > Is that really a problem? Would it even make sense for non-KVM kernel > code to use 'vcpu_vmx' anyway? vcpu_vmx itself isn't a problem as non-KVM kernel code _shouldn't_ be using vcpu_vmx, but I want to go beyond "shouldn't" and make it all-but-impossible for non-KVM code to reference internal KVM structures/state, e.g. I want to bury all kvm_host.h headers in kvm/ code instead of exposing them in include/asm/.