Re: [PATCH 01/11] KVM: x86: use a separate asm-offsets.c file

From: Sean Christopherson
Date: Wed Nov 09 2022 - 10:06:41 EST


On Wed, Nov 09, 2022, Paolo Bonzini wrote:
> This already removes the ugly #includes from asm-offsets.c, but especially
> it avoids a future error when asm-offsets will try to include svm/svm.h.
>
> This would not work for kernel/asm-offsets.c, because svm/svm.h
> includes kvm_cache_regs.h which is not in the include path when
> compiling asm-offsets.c. The problem is not there if the .c file is
> in arch/x86/kvm.
>
> Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: a149180fbcf3 ("x86: Add magic AMD return-thunk")
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---

Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx>

> diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S
> index 8477d8bdd69c..0b5db4de4d09 100644
> --- a/arch/x86/kvm/vmx/vmenter.S
> +++ b/arch/x86/kvm/vmx/vmenter.S
> @@ -1,12 +1,12 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> #include <linux/linkage.h>
> #include <asm/asm.h>
> -#include <asm/asm-offsets.h>
> #include <asm/bitsperlong.h>
> #include <asm/kvm_vcpu_regs.h>
> #include <asm/nospec-branch.h>
> #include <asm/percpu.h>
> #include <asm/segment.h>
> +#include "kvm-asm-offsets.h"

Do you have a preference on KVM files using dashes or underscores? Outside of
kvm-x86-ops.h and kvm-x86-pmu-ops.h, KVM x86 uses underscores. I actually prefer
dashes because they're slightly easier to type, but when there are only a few
outliers I constantly mistype the names. If dashes are generally, maybe we could
gradually/opportunistically move in that direction?