From: Sean Christopherson <seanjc@google.com> To: Maxim Levitsky <mlevitsk@redhat.com> Cc: kvm@vger.kernel.org, Joerg Roedel <joro@8bytes.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>, Vitaly Kuznetsov <vkuznets@redhat.com>, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@kernel.org>, "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@vger.kernel.org>, Jim Mattson <jmattson@google.com>, Wanpeng Li <wanpengli@tencent.com>, Paolo Bonzini <pbonzini@redhat.com> Subject: Re: [PATCH] KVM: x86: fix 32 bit build Date: Wed, 16 Jun 2021 15:59:23 +0000 [thread overview] Message-ID: <YMof22ameZYUHNdi@google.com> (raw) In-Reply-To: <20210616155032.1117176-1-mlevitsk@redhat.com> On Wed, Jun 16, 2021, Maxim Levitsky wrote: > Now that kvm->stat.nx_lpage_splits is 64 bit, use DIV_ROUND_UP_ULL > when doing division. I went the "cast to an unsigned long" route. I prefer the cast approach because to_zap is also an unsigned long, i.e. using DIV_ROUND_UP_ULL() could look like a truncation bug. In practice, nx_lpage_splits can't be more than an unsigned long so it's largely a moot point, I just like the more explicit "this is doing something odd". https://lkml.kernel.org/r/20210615162905.2132937-1-seanjc@google.com > Fixes: 7ee093d4f3f5 ("KVM: switch per-VM stats to u64") > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > --- > arch/x86/kvm/mmu/mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index 720ceb0a1f5c..97372225f183 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -6054,7 +6054,7 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) > write_lock(&kvm->mmu_lock); > > ratio = READ_ONCE(nx_huge_pages_recovery_ratio); > - to_zap = ratio ? DIV_ROUND_UP(kvm->stat.nx_lpage_splits, ratio) : 0; > + to_zap = ratio ? DIV_ROUND_UP_ULL(kvm->stat.nx_lpage_splits, ratio) : 0; > for ( ; to_zap; --to_zap) { > if (list_empty(&kvm->arch.lpage_disallowed_mmu_pages)) > break; > -- > 2.26.3 >
next prev parent reply other threads:[~2021-06-16 15:59 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-16 15:50 Maxim Levitsky 2021-06-16 15:59 ` Sean Christopherson [this message] 2021-06-16 18:59 ` Maxim Levitsky
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YMof22ameZYUHNdi@google.com \ --to=seanjc@google.com \ --cc=bp@alien8.de \ --cc=hpa@zytor.com \ --cc=jmattson@google.com \ --cc=joro@8bytes.org \ --cc=kvm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mingo@redhat.com \ --cc=mlevitsk@redhat.com \ --cc=pbonzini@redhat.com \ --cc=tglx@linutronix.de \ --cc=vkuznets@redhat.com \ --cc=wanpengli@tencent.com \ --cc=x86@kernel.org \ --subject='Re: [PATCH] KVM: x86: fix 32 bit build' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.