Re: [PATCH v2] KVM: x86: Don't read guest CR3 when doing async pf while the MMU is direct

From: kernel test robot

Date: Fri Dec 12 2025 - 20:39:50 EST


Hi Xiaoyao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7d0a66e4bb9081d75c82ec4957c50034cb0ea449]

url: https://github.com/intel-lab-lkp/linux/commits/Xiaoyao-Li/KVM-x86-Don-t-read-guest-CR3-when-doing-async-pf-while-the-MMU-is-direct/20251212-220612
base: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
patch link: https://lore.kernel.org/r/20251212135051.2155280-1-xiaoyao.li%40intel.com
patch subject: [PATCH v2] KVM: x86: Don't read guest CR3 when doing async pf while the MMU is direct
config: i386-buildonly-randconfig-004-20251213 (https://download.01.org/0day-ci/archive/20251213/202512130905.LJZI3LOt-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251213/202512130905.LJZI3LOt-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512130905.LJZI3LOt-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/mmu/mmu.c:4525:14: warning: implicit conversion from 'gpa_t' (aka 'unsigned long long') to 'unsigned long' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
4525 | arch.cr3 = INVALID_GPA;
| ~ ^~~~~~~~~~~
include/linux/kvm_types.h:54:22: note: expanded from macro 'INVALID_GPA'
54 | #define INVALID_GPA (~(gpa_t)0)
| ^~~~~~~~~
1 warning generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for I2C_K1
Depends on [n]: I2C [=m] && HAS_IOMEM [=y] && (ARCH_SPACEMIT || COMPILE_TEST [=y]) && OF [=n]
Selected by [m]:
- MFD_SPACEMIT_P1 [=m] && HAS_IOMEM [=y] && (ARCH_SPACEMIT || COMPILE_TEST [=y]) && I2C [=m]


vim +4525 arch/x86/kvm/mmu/mmu.c

4514
4515 static bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu,
4516 struct kvm_page_fault *fault)
4517 {
4518 struct kvm_arch_async_pf arch;
4519
4520 arch.token = alloc_apf_token(vcpu);
4521 arch.gfn = fault->gfn;
4522 arch.error_code = fault->error_code;
4523 arch.direct_map = vcpu->arch.mmu->root_role.direct;
4524 if (arch.direct_map)
> 4525 arch.cr3 = INVALID_GPA;
4526 else
4527 arch.cr3 = kvm_mmu_get_guest_pgd(vcpu, vcpu->arch.mmu);
4528
4529 return kvm_setup_async_pf(vcpu, fault->addr,
4530 kvm_vcpu_gfn_to_hva(vcpu, fault->gfn), &arch);
4531 }
4532

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki