On Wed, Oct 20, 2021, Maciej S. Szmigiero wrote: > On 20.10.2021 00:24, Sean Christopherson wrote: > > E.g. the whole thing can be > > > > if (!kvm->arch.n_requested_mmu_pages && > > (change == KVM_MR_CREATE || change == KVM_MR_DELETE)) { > > unsigned long nr_mmu_pages; > > > > if (change == KVM_MR_CREATE) { > > kvm->arch.n_memslots_pages += new->npages; > > } else { > > WARN_ON(kvm->arch.n_memslots_pages < old->npages); > > kvm->arch.n_memslots_pages -= old->npages; > > } > > > > nr_mmu_pages = (unsigned long)kvm->arch.n_memslots_pages; > > nr_mmu_pages *= (KVM_PERMILLE_MMU_PAGES / 1000); > > The above line will set nr_mmu_pages to zero since KVM_PERMILLE_MMU_PAGES > is 20, so when integer-divided by 1000 will result in a multiplication > coefficient of zero. Ugh, math. And thus do_div() to avoid the whole 64-bit divide issue on 32-bit KVM. Bummer.