[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b4f7b9ae-0a5a-b7fe-deb6-750933c1ca18@redhat.com>
Date: Mon, 28 Nov 2016 18:19:23 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Kyle Huey <me@...ehuey.com>
Cc: Radim Krčmář <rkrcmar@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Joerg Roedel <joro@...tes.org>, kvm list <kvm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/5] KVM: VMX: Handle RFLAGS.TF in
skip_emulated_instruction
On 28/11/2016 17:13, Kyle Huey wrote:
> On Mon, Nov 28, 2016 at 3:42 AM, Paolo Bonzini <pbonzini@...hat.com> wrote:
>> This code is pretty much the same as kvm_vcpu_check_singlestep. Let's
>> not duplicate the code and implement skip_emulated_instruction can be
>> implemented in x86.c, like
>>
>> unsigned long rflags = kvm_x86_ops->get_rflags(vcpu);
>> int r = EMULATE_DONE;
>>
>> /* This would be the no_trap variant */
>> kvm_x86_ops->skip_emulated_instruction(vcpu);
>> kvm_vcpu_check_singlestep(vcpu, rflags, &r);
>> return r == EMULATE_DONE;
>>
>> (because x86.c/vmx.c/svm.c are separate modules, when moving the function
>> to x86.c you should rename it to kvm_skip_emulated_instruction).
>>
>> Paolo
>
> They're not exactly the same. For some reason I don't understand
> kvm_vcpu_check_singlestep clears the trap flag. Perhaps that is also
> a bug?
The Intel manual says "The processor clears the TF flag before calling
the exception handler" (17.3.1.4), so I think you should do it too.
Paolo
Powered by blists - more mailing lists