ACK: [B][SRU][PATCH 0/1] kvm: Add emulation for movups/movupd

Tim Gardner tim.gardner at canonical.com
Tue Aug 31 12:06:20 UTC 2021


Acked-by: Tim Gardner <tim.gardner at canonical.com>

On 8/30/21 10:27 PM, Po-Hsu Lin wrote:
> [Impact]
> Our Bionic 4.15 kernel lacks of movups/movupd emulation support.
> 
> With the following commit added into the emulator test in
> ubuntu_kvm_unit_tests:
>    commit 8726f9771911d6749dbd36ab2fc70f0f25e2b1a9
>    Author: Jacob Xu <jacobhxu at google.com>
>    Date: Wed Apr 21 16:12:57 2021 -0700
> 
>        x86: add movups/movupd sse testcases to emulator.c
> 
>        Here we add movups/movupd tests corresponding to functionality
>        introduced in commit 29916968c486 ("kvm: Add emulation for movups/movupd").
> 
>        Signed-off-by: Jacob Xu <jacobhxu at google.com>
>        Message-Id: <20210421231258.2583654-1-jacobhxu at google.com>
>        Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> 
> It will cause the emulator test in ubuntu_kvm_unit_tests fail with timeout:
>    ...
>    PASS: movdqu (read)
>    PASS: movdqu (write)
>    PASS: movaps (read)
>    PASS: movaps (write)
>    PASS: movapd (read)
>    PASS: movapd (write)
>    KVM internal error. Suberror: 1
>    emulation failure
>    RAX=000000000000000a RBX=ffffffffffffe000 RCX=00000000000003fd RDX=00000000000003f8
>    RSI=0000000000419991 RDI=0000000000419991 RBP=000000000051b490 RSP=000000000051b470
>    R8 =000000000000000a R9 =00000000000003f8 R10=000000000000000d R11=0000000000000000
>    R12=ffffffffffffe000 R13=1111111111111111 R14=ffffffffffffd000 R15=3333333333333333
>    RIP=0000000000400a1f RFL=00010006 [-----P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
>    ES =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
>    CS =0008 0000000000000000 ffffffff 00a09b00 DPL=0 CS64 [-RA]
>    SS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
>    DS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
>    FS =0010 0000000000000000 ffffffff 00c09300 DPL=0 DS [-WA]
>    GS =0010 000000000051a510 ffffffff 00c09300 DPL=0 DS [-WA]
>    LDT=0000 0000000000000000 0000ffff 00008200 DPL=0 LDT
>    TR =0080 000000000041207a 0000ffff 00008b00 DPL=0 TSS64-busy
>    GDT= 000000000041100a 0000106f
>    IDT= 0000000000410000 00000fff
>    CR0=80010011 CR2=0000000000000000 CR3=0000000001007000 CR4=00000220
>    DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
>    DR6=00000000ffff0ff0 DR7=0000000000000400
>    EFER=0000000000000500
>    Code=00 c7 45 e8 03 00 00 00 c7 45 ec 04 00 00 00 66 0f 6f 45 e0 <0f> 11 03 48 89 de 48 8d 7d e0 e8 e5 f9 ff ff 0f b6 f8 be a1 8f 41 00 b8 00 00 00 00 e8 07
>    qemu-system-x86_64: terminating on signal 15 from pid 15758 (timeout)
>    FAIL emulator (timeout; duration=90s)
> 
> [Fix]
> * 29916968c48691 kvm: Add emulation for movups/movupd
> 
> This patch can be cherry-picked into Bionic.
> 
> It can fix our test failure plus, as mentioned in the commit message,
> emulation failures with openbsd as guest and with Windows 10 with
> intel HD graphics pass through.
> 
> [Test]
> Test kernel can be found here:
> https://people.canonical.com/~phlin/kernel/lp-1932966-kvm-emulator/
> 
> Run the emulator test from ubuntu_kvm_unit_tests, with this patch
> applied it will pass without any issue:
>    ...
>    PASS: movdqu (read)
>    PASS: movdqu (write)
>    PASS: movaps (read)
>    PASS: movaps (write)
>    PASS: movapd (read)
>    PASS: movapd (write)
>    PASS: movups (read)
>    PASS: movups (write)
>    PASS: movupd (read)
>    PASS: movupd (write)
>    PASS: movups unaligned
>    PASS: movupd unaligned
>    PASS: unaligned movaps exception
>    PASS: movups unaligned crosspage
>    PASS: movups crosspage exception
>    PASS: movq (mmx, read)
>    PASS: movq (mmx, write)
>    PASS: movb $imm, 0(%rip)
>    PASS: shld (cl)
>    PASS: shrd (cl)
>    PASS: mov null, %ss
>    PASS: mov null, %ss (with ss.rpl != cpl)
>    PASS: Test ret/iret with a nullified segment
>    PASS: ltr
>    PASS: cmovnel
>    SKIP: skipping register-only tests, use kvm.force_emulation_prefix=1 to enable
>    PASS: push16
>    PASS: cross-page mmio read
>    PASS: cross-page mmio write
>    PASS: string_io_mmio
>    PASS: jump to non-canonical address
>    SKIP: illegal movbe
>    SUMMARY: 135 tests, 2 skipped
>    PASS emulator (135 tests, 2 skipped)
> 
> [Where problems could occur]
> I didn't see any other patch that claims to be a fix of this one in
> the upstream tree. The problem I think of for the moment is that we
> might see other failures when using this in the future.
> 
> 
> Stefan Fritsch (1):
>    kvm: Add emulation for movups/movupd
> 
>   arch/x86/kvm/emulate.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 

-- 
-----------
Tim Gardner
Canonical, Inc



More information about the kernel-team mailing list