From: Petre Ovidiu PIRCALABU <ppircalabu@bitdefender.com>
To: "jbeulich@suse.com" <jbeulich@suse.com>
Cc: "kevin.tian@intel.com" <kevin.tian@intel.com>,
"sstabellini@kernel.org" <sstabellini@kernel.org>,
"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
"George.Dunlap@eu.citrix.com" <George.Dunlap@eu.citrix.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
"tim@xen.org" <tim@xen.org>,
"paul.durrant@citrix.com" <paul.durrant@citrix.com>,
"tamas@tklengyel.com" <tamas@tklengyel.com>,
"jun.nakajima@intel.com" <jun.nakajima@intel.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v9 1/2] x86emul: New return code for unimplemented instruction
Date: Tue, 5 Sep 2017 15:23:38 +0000 [thread overview]
Message-ID: <1504625018.4551.29.camel@bitdefender.com> (raw)
In-Reply-To: <59AE3955020000780010592B@prv-mh.provo.novell.com>
On Lu, 2017-09-04 at 23:42 -0600, Jan Beulich wrote:
> > >
> > > >
> > > > @@ -5177,7 +5177,7 @@ x86_emulate(
> > > > goto done;
> > > > break;
> > > > default:
> > > > - goto cannot_emulate;
> > > > + goto unimplemented_insn;
> > > While I can see why you do this change, for many/all of the ones
> > > I'll leave in context below I think you rather want to switch to
> > > generate_exception(EXC_UD).
> > Some of the opcodes are valid but not supported by the emulator. In
> > this case X86EMUL_UNIMPLEMENTED should be returned to allow the
> > monitor
> > app to handle this case. Also, in the worst case scenario, when the
> > opcode doesn't correspond to a valid x86(-64) instruction, if the
> > monitor app for example tries to single-step it on the real
> > hardware an
> > UD exception will also be reported.
> Please be more precise with "some of the opcodes are valid". When I
> looked through your change, I don't think I've seen any such case for
> the
> places I meant the comment to apply to. Also, as far as the emulator
> changes themselves go, please leave aside considerations of what a
> monitor app may or may not do. These changes need to be consistent
> all by themselves.
>
Sorry about the poor wording. I was under the impression that you
required the invalid opcodes to be handled differently from the ones
which are valid but unimplemented (directly generate EXC_UD instead of
returning X86EMUL_UNIMPLEMENTED and let the caller handle it).
e.g. for X86EMUL_OPC_VEX(0x0f38, 0xf3): /* Grp 17 */
the mod R/M possible values are 1,2,3 (source: http://sandpile.org/x86/
opc_grp.htm).
From my perspective I wouldn't differentiate between those 2 cases and
return X86EMUL_UNIMPLEMENTED. The performance penalty is negligible if
the monitor is neither present nor it implements
XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED. The monitor can only offer
a "second-chance" re-execution of the faulty instruction and does not
affect the internal logic of x86_decode/x86_emulate.
> > >
> > > >
> > > > @@ -7716,6 +7716,9 @@ x86_emulate(
> > > > }
> > > >
> > Thanks for noticing it. I will change it back to cannot_emulate as
> > there are no other valid instructions for this opcodes.
> I have trouble understanding this comment of yours, not the least
> because I don't recall having asked (in particular around here) that
> you switch anything back.
>
> Jan
>
>
> ________________________
> This email was scanned by Bitdefender
Many thanks for your support,
//Petre
________________________
This email was scanned by Bitdefender
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-05 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 18:57 [PATCH v9 0/2] Notify monitor when emulating an unimplemented instruction Petre Pircalabu
2017-08-30 18:57 ` [PATCH v9 1/2] x86emul: New return code for " Petre Pircalabu
2017-09-01 10:33 ` Jan Beulich
2017-09-04 17:20 ` Petre Ovidiu PIRCALABU
2017-09-05 5:42 ` Jan Beulich
2017-09-05 15:23 ` Petre Ovidiu PIRCALABU [this message]
2017-09-05 15:46 ` Jan Beulich
2017-09-05 16:20 ` Petre Ovidiu PIRCALABU
2017-09-06 9:49 ` Jan Beulich
2017-08-30 18:57 ` [PATCH v9 2/2] x86/monitor: Notify monitor if an emulation fails Petre Pircalabu
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=1504625018.4551.29.camel@bitdefender.com \
--to=ppircalabu@bitdefender.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=paul.durrant@citrix.com \
--cc=rcojocaru@bitdefender.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.com \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.