2020-10-24 02:38:39

by Daniel Díaz

[permalink] [raw]
Subject: kvm: x86-32 fails to link with tdp_mmu

Hello!

We found the following problem building torvalds/master, which
recently merged the for-linus tag from the KVM tree, when building
with gcc 7.3.0 and glibc 2.27 for x86 32-bits under OpenEmbedded:

| LD vmlinux.o
| MODPOST vmlinux.symvers
| MODINFO modules.builtin.modinfo
| GEN modules.builtin
| LD .tmp_vmlinux.kallsyms1
| arch/x86/kvm/mmu/tdp_mmu.o: In function `__handle_changed_spte':
| tdp_mmu.c:(.text+0x78a): undefined reference to `__umoddi3'
| /srv/oe/build/tmp-lkft-glibc/work-shared/intel-core2-32/kernel-source/Makefile:1164:
recipe for target 'vmlinux' failed
| make[1]: *** [vmlinux] Error 1
| /srv/oe/build/tmp-lkft-glibc/work-shared/intel-core2-32/kernel-source/Makefile:185:
recipe for target '__sub-make' failed
| make: *** [__sub-make] Error 2

This builds fine for x86 (64 bits) and arm (32/64 bits) with the same
toolchain. This also builds correctly (outside OpenEmbedded) with
gcc-8, gcc-9 and gcc-10 for: x86 (32/64 bits), arm (32/64 bits), MIPS,
and RISCV; and gcc-8 and gcc-9 for ARC.

We first noticed this when 0adc313c4f20 was pushed, but reverting
f9a705ad1c07 ("Merge tag 'for-linus' of
git://git.kernel.org/pub/scm/virt/kvm/kvm") brought it back into
building.

A follow-up bisection led to faaf05b00aec ("kvm: x86/mmu: Support
zapping SPTEs in the TDP MMU"). In that commit, the problematic code
was:

handle_changed_spte(kvm, as_id, iter->gfn, iter->old_spte, new_spte,
iter->level);

which was later changed by f8e144971c68 ("kvm: x86/mmu: Add access
tracking for tdp_mmu") to:

__handle_changed_spte(kvm, as_id, iter->gfn, iter->old_spte, new_spte,
iter->level);

Greetings!

Daniel Díaz
[email protected]


2020-10-24 02:51:10

by Sean Christopherson

[permalink] [raw]
Subject: Re: kvm: x86-32 fails to link with tdp_mmu

On Fri, Oct 23, 2020 at 09:13:21PM -0500, Daniel D?az wrote:
> Hello!
>
> We found the following problem building torvalds/master, which
> recently merged the for-linus tag from the KVM tree, when building
> with gcc 7.3.0 and glibc 2.27 for x86 32-bits under OpenEmbedded:
>
> | LD vmlinux.o
> | MODPOST vmlinux.symvers
> | MODINFO modules.builtin.modinfo
> | GEN modules.builtin
> | LD .tmp_vmlinux.kallsyms1
> | arch/x86/kvm/mmu/tdp_mmu.o: In function `__handle_changed_spte':
> | tdp_mmu.c:(.text+0x78a): undefined reference to `__umoddi3'

The problem is a % on a 64-bit value. Patches incoming, there's also a goof
in similar code that was tweaked last minute to avoid the %.

2020-10-24 10:56:22

by Sean Christopherson

[permalink] [raw]
Subject: Re: kvm: x86-32 fails to link with tdp_mmu

On Fri, Oct 23, 2020 at 07:17:54PM -0700, Sean Christopherson wrote:
> On Fri, Oct 23, 2020 at 09:13:21PM -0500, Daniel D?az wrote:
> > Hello!
> >
> > We found the following problem building torvalds/master, which
> > recently merged the for-linus tag from the KVM tree, when building
> > with gcc 7.3.0 and glibc 2.27 for x86 32-bits under OpenEmbedded:
> >
> > | LD vmlinux.o
> > | MODPOST vmlinux.symvers
> > | MODINFO modules.builtin.modinfo
> > | GEN modules.builtin
> > | LD .tmp_vmlinux.kallsyms1
> > | arch/x86/kvm/mmu/tdp_mmu.o: In function `__handle_changed_spte':
> > | tdp_mmu.c:(.text+0x78a): undefined reference to `__umoddi3'
>
> The problem is a % on a 64-bit value. Patches incoming, there's also a goof
> in similar code that was tweaked last minute to avoid the %.

Just the one patch actually, I misread some cleverness. Patch still inbound...