[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B936B27.1050207@redhat.com>
Date: Sun, 07 Mar 2010 11:00:23 +0200
From: Avi Kivity <avi@...hat.com>
To: Gleb Natapov <gleb@...hat.com>
CC: john cooper <john.cooper@...rd-harmonic.com>,
Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>,
linux-kernel@...r.kernel.org, mingo@...e.hu, mtosatti@...hat.com,
zamsden@...hat.com
Subject: Re: use of setjmp/longjmp in x86 emulator.
On 03/02/2010 09:28 AM, Gleb Natapov wrote:
> On Mon, Mar 01, 2010 at 02:13:32PM -0500, john cooper wrote:
>
>> Gleb Natapov wrote:
>>
>>
>>> Think about what happens if in the middle of
>>> instruction emulation some data from device emulated in userspace is
>>> needed. Emulator should be able to tell KVM that exit to userspace is
>>> needed and restart instruction emulation when data is available.
>>>
>> setjmp/longjmp are useful constructs in general but
>> IME are better suited for infrequent exceptions vs.
>> routine usage.
>>
> Exception condition during instruction emulation _is_
> infrequent.
Well, with mmio you'd expect it to happen every read access.
> Although setjmp/longjmp that I know about
> are routine usage. See QEMU TCG main loop or userspace
> thread libraries.
>
Agreed, nothing magical about it.
>> If the issue is finding some clean and regular way
>> to back out from (and possibly reeneter) logic
>> expressed within nested function invocations, have
>> you considered turning the problem inside out and
>> using a state machine approach?
>>
> I don't see how state machine will help. But the goal
> is not to rewrite emulator.c (this will no be excepted
> by kvm maintainers), but improve it gradually.
>
That is orthogonal. If we decide a state machine is the best
implementation, then we'll find a way to move over to that. However, I
don't think a state machine is a good representation considering some of
the code paths are very complicated and depend on a many memory accesses
(e.g. hardware task switches).
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists