Re: [PATCH v3 22/40] KVM: x86/hyperv: Eliminate an unnecessary include of x86.h in hyperv.h

From: Huang, Kai

Date: Thu Jun 04 2026 - 07:06:03 EST


On Fri, 2026-05-29 at 15:22 -0700, Sean Christopherson wrote:
> Drop an mostly unused include of x86.h from hyperv.h, and instead pull in
> regs.h, which is need for at least is_guest_mode(). This eliminates the
> last include of x86.h from a common x86 header, i.e. solidifies that x86.h
> is the top of the pyramid.
>
> Add a missing x86.h include in cpuid.c to avoid build breakage.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Reviewed-by: Kai Huang <kai.huang@xxxxxxxxx>

> ---
> arch/x86/kvm/cpuid.c | 1 +
> arch/x86/kvm/hyperv.h | 3 ++-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index fd3b02575cd0..db8be9173bd0 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -28,6 +28,7 @@
> #include "trace.h"
> #include "pmu.h"
> #include "xen.h"
> +#include "x86.h"

FWIW:

This made me think whether we should just add "x86.h" inclusion in patch

KVM: x86: Swap the include order between x86.h and mmu.h

.. due to the fact that cpuid.c includes "mmu.h" but not "x86.h" directly, and
that patch removed "x86.h" inclusion in "mmu.h".

But that patch doesn't break the build (I also tried at my side), because
cpuid.c also includes "lapic.h", which includes "hyperv.h", which includes
"x86.h".  

So cpuid.c actually has "x86.h" included indirectly, until this patch.

From this perspective, it makes sense to make cpuid.c explicitly include "x86.h"
in this patch.

A side thing:

I also spotted that cpuid.c uses "double quote" way to include linux/lockdep.h:

#include "linux/lockdep.h"

After couple of minutes thinking why, I concluded we should just use

#include <linux/lockdep.h>

For that I sent a patch to fix, assuming I am not missing anything.