[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6ae58c5e-a909-6cd4-7aaa-669758d71570@redhat.com>
Date: Thu, 5 Apr 2018 10:51:31 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Wanpeng Li <kernellwp@...il.com>
Cc: David Hildenbrand <david@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, kvm <kvm@...r.kernel.org>,
Radim Krčmář <rkrcmar@...hat.com>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Liran Alon <liran.alon@...cle.com>
Subject: Re: [PATCH v5 2/2] KVM: X86: Add Force Emulation Prefix for "emulate
the next instruction"
On 05/04/2018 02:04, Wanpeng Li wrote:
>>> emulate_instruction(vcpu, 0) can handle invalid instruction.
>> But David's observation is still better because your code doesn't handle usermode exits.
> My code handles it, return emulate_instruction(vcpu, 0) ==
> EMULATE_DONE, it will return 0 since EMULATE_USER_EXIT == EMULATE_DONE
> fails.
>
>> I've fixed this up.
> Thanks. The codes similar to my v3 but more beauty. :) I change to
> this view since Radim's comments to v3
> https://www.spinics.net/lists/kvm/msg166999.html
And after I actually woke up I think I disagree with Radim. Tests can
trap the #UD to test emulation at CPL0 and skip or fail the test for
instructions unknown to the emulator. It's much better than sending an
emulation failure to userspace, which would abort the guest.
Paolo
Powered by blists - more mailing lists