kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build
@ 2020-10-24  3:11 Sean Christopherson
  2020-10-24  6:29 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Christopherson @ 2020-10-24  3:11 UTC (permalink / raw)
  To: Paolo Bonzini, Linus Torvalds
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, Daniel Díaz

Replace a modulo operator with the more common pattern for computing the
gfn "offset" of a huge page to fix an i386 build error.

  arch/x86/kvm/mmu/tdp_mmu.c:212: undefined reference to `__umoddi3'

Fixes: 2f2fad0897cb ("kvm: x86/mmu: Add functions to handle changed TDP SPTEs")
Reported-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---

Linus, do you want to take this directly so that it's in rc1?  I don't
know whether Paolo will be checking mail before then.

 arch/x86/kvm/mmu/tdp_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index e246d71b8ea2..27e381c9da6c 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -209,7 +209,7 @@ static void __handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn,
 
 	WARN_ON(level > PT64_ROOT_MAX_LEVEL);
 	WARN_ON(level < PG_LEVEL_4K);
-	WARN_ON(gfn % KVM_PAGES_PER_HPAGE(level));
+	WARN_ON(gfn & (KVM_PAGES_PER_HPAGE(level) - 1));
 
 	/*
 	 * If this warning were to trigger it would indicate that there was a
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build
  2020-10-24  3:11 [PATCH] KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build Sean Christopherson
@ 2020-10-24  6:29 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-10-24  6:29 UTC (permalink / raw)
  To: Sean Christopherson, Linus Torvalds
  Cc: Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel, kvm,
	linux-kernel, Daniel Díaz

On 24/10/20 05:11, Sean Christopherson wrote:
> Replace a modulo operator with the more common pattern for computing the
> gfn "offset" of a huge page to fix an i386 build error.
> 
>   arch/x86/kvm/mmu/tdp_mmu.c:212: undefined reference to `__umoddi3'
> 
> Fixes: 2f2fad0897cb ("kvm: x86/mmu: Add functions to handle changed TDP SPTEs")
> Reported-by: Daniel Díaz <daniel.diaz@linaro.org>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> 
> Linus, do you want to take this directly so that it's in rc1?  I don't
> know whether Paolo will be checking mail before then

Yes, I am.  I also have another bugfix, I was going to wait a couple
days for any -rc1 issues to pop up but they came up faster than that.

Paolo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-24  6:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24  3:11 [PATCH] KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build Sean Christopherson
2020-10-24  6:29 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).