[PATCH] RISC-V: KVM: Account G-stage page table memory

kernel test robot lkp at intel.com
Wed Nov 25 09:58:18 PST 2026


Hi Tan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kvm-riscv/riscv_kvm_next]
[also build test WARNING on linus/master next-20261124]
[cannot apply to tj-cgroup/for-next kvm/queue kvm/next mst-vhost/linux-next kvm/linux-next v7.4-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tan-Chi/RISC-V-KVM-Account-G-stage-page-table-memory/20261125-205023
base:   https://github.com/kvm-riscv/linux.git riscv_kvm_next
patch link:    https://lore.kernel.org/r/20261125125024.1983082-1-tanchi25%40mails.ucas.ac.cn
patch subject: [PATCH] RISC-V: KVM: Account G-stage page table memory
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20261126/20261126015340.s7bzBtEB-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 2012344e5da8e03ea4b8283ecd6fad6e13f09d64)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261126/20261126015340.s7bzBtEB-lkp@intel.com/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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261126015340.s7bzBtEB-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/riscv/kvm/mmu.c:850:5: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551612 to -4 [-Wconstant-conversion]
     849 |                 kvm_account_pgtable_pages(pgd,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~
     850 |                                 -(kvm_riscv_gstage_pgd_size >> PAGE_SHIFT));
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +850 arch/riscv/kvm/mmu.c

   827	
   828	void kvm_riscv_mmu_free_pgd(struct kvm *kvm)
   829	{
   830		struct kvm_gstage gstage;
   831		void *pgd = NULL;
   832		bool flush = false;
   833	
   834		write_lock(&kvm->mmu_lock);
   835		if (kvm->arch.pgd) {
   836			kvm_riscv_gstage_init(&gstage, kvm);
   837			flush = kvm_riscv_gstage_unmap_all(&gstage);
   838			pgd = READ_ONCE(kvm->arch.pgd);
   839			kvm->arch.pgd = NULL;
   840			kvm->arch.pgd_phys = 0;
   841			kvm->arch.pgd_levels = 0;
   842		}
   843		write_unlock(&kvm->mmu_lock);
   844	
   845		if (flush)
   846			kvm_flush_remote_tlbs(kvm);
   847	
   848		if (pgd) {
   849			kvm_account_pgtable_pages(pgd,
 > 850					-(kvm_riscv_gstage_pgd_size >> PAGE_SHIFT));
   851			free_pages((unsigned long)pgd, get_order(kvm_riscv_gstage_pgd_size));
   852		}
   853	}
   854	

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



More information about the kvm-riscv mailing list