xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86emul: minor cleanup
Date: Mon, 12 Jun 2017 16:03:41 +0100	[thread overview]
Message-ID: <efe2db68-f240-471f-983e-281c6a8da6f4@citrix.com> (raw)
In-Reply-To: <593EBC070200007800162064@prv-mh.provo.novell.com>

On 12/06/17 15:06, Jan Beulich wrote:
>>>> On 12.06.17 at 14:41, <andrew.cooper3@citrix.com> wrote:
>> On 12/06/17 07:23, Jan Beulich wrote:
>>>>>> On 09.06.17 at 19:50, <andrew.cooper3@citrix.com> wrote:
>>>> On 08/06/17 16:49, Jan Beulich wrote:
>>>>> Drop a redundant input constraint, correct a comment, and (re)move
>>>>> fix.insn_bytes adjustments (these aren't needed for custom stub
>>>>> invocations when the instruction placed in the stub can't raise #XF)
>>>> I'm not sure these are wise to remove.  Even if we don't expect an
>>>> exception, should one occur, fpu_handle_exception() will fail to step
>>>> over the instruction, and will re-execute it.
>>> Ah, perhaps I shouldn't have split this off the remaining
>>> emulator series I have ready - you refer to a no longer
>>> existing function (in my code base).
>> So you have dropped the legacy FPU exception infrastructure in the series?
> Yes.
>
>>> Once there, do_trap()
>>> will panic() as usual in that case, which I think it is sort of
>>> appropriate if we receive an exception that shouldn't occur -
>>> after all we then don't really know what to do with it. This
>>> btw goes along the lines of me not really being happy about
>>> us handling all sorts of exceptions once an .ex_table entry
>>> is associated with an instruction, rather than just the ones
>>> we really mean to recover from. You may recall such a
>>> discussion from a few years back.
>> I don't follow what you mean here. 
> 1) An exception when we don't expect one is bad.

Agreed.

>
> 2) If we get an exception we don't expect, we better don't
> behave as if all was well.

The grammar is a little awkward.  A more common way of phrasing that is
"we shouldn't behave as if".

Also, agreed.

>
> 3) This would imo better extend to our already existing
> exception recovery too, e.g. by .ex_table entries providing
> a bitmap of expected (i.e. to be recovered from) exceptions.

Ah - I remember now.  That was a long time ago.

ISTR part of the same conversation was to try and turn as many fatal
conditions into domain crashes as we reasonably could.  We should
probably get started on that at some point.

>
>>> Would you be okay with temporarily adding a respective
>>> BUG_ON(!fic->insn_bytes) to fpu_handle_exception() to
>>> achieve the same effect?
>> That would be better than nothing, but is fic->insn_bytes a useful field
>> with the legacy handling removed?  As all recovery is return-address
>> based, the length of the instruction (so long as it fits within the
>> stub) isn't important.
> The whole struct fpu_insn_ctxt is going away together with
> the conversion to the "normal" exception handling model. So
> adding the suggested BUG_ON() would be only a temporary
> thing until that other patch could be committed. insn_bytes
> is becoming a local variable, used solely for code outside of
> the big switch() to know where to place the RET instruction.

That also sounds like a good improvement.

>
>>> As a side note, I'm removing these here since the further
>>> SIMD emulation patches I have ready, but would prefer to
>>> post only once 4.9 is out, do not add respective code in the
>>> first place. Without knowing this in advance I'm not even
>>> sure this would be reliably spottable during review.
>> These what?  Again sorry, I don't understand what you mean.
> I have patches to add full AVX, F16C, FMA4, FMA, AVX2, XOP,
> and 3DNow! support to the emulator. Various of the instructions
> added can't raise #XM, and the patches don't set insn_bytes if
> it's not needed for aforementioned generic code inserting RET.
> I.e. what the patch here removes is what those patches won't
> add in the first place, yielding an overall consistent result.

Does this mean you have altered some of the instructions to be straight
inline?  I can't see how you could get away without a RET otherwise.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-06-12 15:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 15:49 [PATCH] x86emul: minor cleanup Jan Beulich
2017-06-09 17:50 ` Andrew Cooper
2017-06-12  6:23   ` Jan Beulich
2017-06-12 12:41     ` Andrew Cooper
2017-06-12 14:06       ` Jan Beulich
2017-06-12 15:03         ` Andrew Cooper [this message]
2017-06-12 15:21           ` Jan Beulich

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=efe2db68-f240-471f-983e-281c6a8da6f4@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.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 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).