[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd67487b-9fe7-1de3-b5c3-51ea56ebf4ec@redhat.com>
Date: Mon, 10 Jul 2017 18:21:50 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Nadav Amit <nadav.amit@...il.com>, Wanpeng Li <kernellwp@...il.com>
Cc: Radim Krcmar <rkrcmar@...hat.com>, kvm <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Jan Kiszka <jan.kiszka@....de>
Subject: Re: RFC: Task switch emulation fails for VM86 mode
On 10/07/2017 17:48, Nadav Amit wrote:
>>>
>>> Any proposal is a great appreciated. :)
> I don’t see a (very) easy solution. The code was (apparently) never built to
> deal with a task switch during an instruction emulation.
>
> AFAIU kvm_task_switch() expects information about the task-switch from the
> CPU “task-switch assist” mechanisms, and this information (or even the fact
> that a task-switch is needed due to an exception) are unavailable from the
> instruction emulator. The instruction emulator itself does not know to
> emulate task-switches, e.g., during far CALL and JMP.
>
> A complete solution is therefore complicated and requires some work. Your
> specific problem may be addressed by detecting the injection of an exception
> while having invalid guest state in vm86 in vmx_queue_exception() or in
> handle_invalid_guest_state(), and emulating the “task-switch assist”
> mechanism.
I agree, the right solution would be to read the IDT in
vmx_queue_exception if vmx->emulation_required, and inject the exception
manually. It would be an extension of what
kvm_inject_realmode_interrupt already does.
Paolo
Powered by blists - more mailing lists