From: Gleb Natapov <gleb@redhat.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, avi@redhat.com,
mtosatti@redhat.com, zamsden@redhat.com
Subject: Re: use of setjmp/longjmp in x86 emulator.
Date: Mon, 1 Mar 2010 15:26:09 +0200 [thread overview]
Message-ID: <20100301132609.GJ16909@redhat.com> (raw)
In-Reply-To: <4B8BBE61.3020503@oss.ntt.co.jp>
On Mon, Mar 01, 2010 at 10:17:21PM +0900, Takuya Yoshikawa wrote:
> Gleb Natapov wrote:
> >On Mon, Mar 01, 2010 at 09:45:46PM +0900, Takuya Yoshikawa wrote:
> >>Gleb Natapov wrote:
> >>>I am looking at improving KVM x86 emulator. Current code does not
> >>Does your plan also include making the emulator independent of KVM?
> >Yes, I am planning to make it more independent from KVM that it is now
> >(by adding more callbacks to x86_emulate_ops).
> >
> >>Could you tell me about the future plan if possible?
> >>
> >We saw a lot of problems and shortcomings in the emulator recently, so
> >the plan is to improve its correctness. There is also a requirement to be
> >able single step emulated code. Having setjmp/longjmp will greatly simplify
> >the code. What are you interested in?
>
> I am mainly interested in clearly understanding the KVM x86 emulator.
>
> In that sense, what I felt first was it's impossible to understand why
> it is working without the deep(whole) knowledge of the KVM's architecture.
> If emulator itself is self contained, it will be much help for me.
You will need some knowledge of KVM in any case since KVM design shapes
emulator design. 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.
>
> Though I do not think every instruction should be implemented, it would be
> nice if each instruction emulated is independent of KVM: if we can check the
> validity of them using only SDM, it would be really nice!
>
Agree. That is my goal too.
> Thanks,
> Takuya
>
> >
> >>>handle some special cases correctly (code execution from ROM, ins/outs
> >>>to/from MMIO) and many exception conditions during instruction emulation
> >>>are not handled correctly. There is a lot of code in emulator that is
> >>>there only for exception propagation. Using setjmp/longjmp will be very
> >>>beneficial here as exception condition during instruction execution
> >>>maps very naturally to setjmp/longjmp, so my question is what about
> >>>adding setjmp/longjmp implementation to the kernel, or alternatively,
> >>>if there is a fear that it can be abused, add it locally to emulator.c?
> >>>Note that instruction emulation is always done in process context.
> >>>
> >>>--
> >>> Gleb.
> >>>--
> >>>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> >>>the body of a message to majordomo@vger.kernel.org
> >>>More majordomo info at http://vger.kernel.org/majordomo-info.html
> >>>Please read the FAQ at http://www.tux.org/lkml/
> >
> >--
> > Gleb.
--
Gleb.
next prev parent reply other threads:[~2010-03-01 13:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 9:18 use of setjmp/longjmp in x86 emulator Gleb Natapov
2010-03-01 12:45 ` Takuya Yoshikawa
2010-03-01 12:52 ` Gleb Natapov
2010-03-01 13:17 ` Takuya Yoshikawa
2010-03-01 13:26 ` Gleb Natapov [this message]
2010-03-01 19:13 ` john cooper
2010-03-02 7:28 ` Gleb Natapov
2010-03-07 9:00 ` Avi Kivity
2010-03-08 23:11 ` Eric W. Biederman
2010-03-09 6:28 ` Gleb Natapov
2010-03-01 16:13 ` Zachary Amsden
2010-03-01 17:47 ` Gleb Natapov
2010-03-01 18:39 ` Zachary Amsden
2010-03-01 18:47 ` Luca Barbieri
2010-03-01 19:03 ` Gleb Natapov
2010-03-01 19:18 ` Zachary Amsden
2010-03-01 22:31 ` H. Peter Anvin
2010-03-01 22:56 ` H. Peter Anvin
2010-03-01 23:34 ` Zachary Amsden
2010-03-01 23:43 ` H. Peter Anvin
2010-03-02 8:05 ` Gleb Natapov
2010-03-02 8:49 ` Gleb Natapov
2010-03-07 9:04 ` Avi Kivity
2010-03-08 0:08 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100301132609.GJ16909@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mtosatti@redhat.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
--cc=zamsden@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).