xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Paul Durrant <paul.durrant@citrix.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 2/3] x86emul: correct handling of FPU insns faulting on memory write
Date: Wed, 15 Mar 2017 09:48:27 -0400	[thread overview]
Message-ID: <09a9ffef-9161-2185-22bd-1ebafc91ce7c@oracle.com> (raw)
In-Reply-To: <58C9504E0200007800143573@prv-mh.provo.novell.com>

On 03/15/2017 09:31 AM, Jan Beulich wrote:
>>>> On 15.03.17 at 14:24, <boris.ostrovsky@oracle.com> wrote:
>> On 03/15/2017 06:28 AM, Jan Beulich wrote:
>>> @@ -3716,9 +3720,9 @@ x86_emulate(
>>>          break;
>>>  
>>>      case 0x9b:  /* wait/fwait */
>>> -        fic.insn_bytes = 1;
>>>          host_and_vcpu_must_have(fpu);
>>>          get_fpu(X86EMUL_FPU_wait, &fic);
>>> +        fic.insn_bytes = 1;
>>>          asm volatile ( "fwait" ::: "memory" );
>>>          check_fpu_exn(&fic);
>>>          break;
>> Why is this needed?
> This isn't strictly needed, but desirable, due to the conditional being
> added in
>
> @@ -7916,7 +7920,7 @@ x86_emulate(
>      ctxt->regs->eflags &= ~X86_EFLAGS_RF;
>  
>   done:
> -    put_fpu(&fic, ctxt, ops);
> +    put_fpu(&fic, fic.insn_bytes > 0 && dst.type == OP_MEM, ctxt, ops);
>      put_stub(stub);
>      return rc;
>  #undef state
>
> (both host_and_vcpu_must_have() and get_fpu() may end up
> branching to "done"). Everywhere else the field is already being
> set after such basic checks.

Ah, OK.

But fic is a local variable that is not initialized (is it?) so
insn_bytes may be non-zero anyway?

-boris


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

  reply	other threads:[~2017-03-15 13:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 10:23 [PATCH v2 0/3] x86emul: FPU handling corrections Jan Beulich
2017-03-15 10:27 ` [PATCH v2 1/3] x86emul: centralize put_fpu() invocations Jan Beulich
2017-03-20 17:10   ` Andrew Cooper
2017-03-15 10:28 ` [PATCH v2 2/3] x86emul: correct handling of FPU insns faulting on memory write Jan Beulich
2017-03-15 12:06   ` Paul Durrant
2017-03-15 13:24   ` Boris Ostrovsky
2017-03-15 13:31     ` Jan Beulich
2017-03-15 13:48       ` Boris Ostrovsky [this message]
2017-03-15 15:46         ` Jan Beulich
2017-03-15 10:28 ` [PATCH v2 3/3] x86emul: correct FPU code/data pointers and opcode handling Jan Beulich
2017-03-20 17:26   ` Andrew Cooper
2017-03-15 10:29 ` [PATCH v2][XTF] add FPU/SIMD register state test 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=09a9ffef-9161-2185-22bd-1ebafc91ce7c@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=paul.durrant@citrix.com \
    --cc=suravee.suthikulpanit@amd.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).