xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH] vmx: Restore debug registers when injecting #DB traps
Date: Fri, 11 Mar 2016 08:41:59 -0700	[thread overview]
Message-ID: <56E2F55702000078000DBA95@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1457707891-20044-1-git-send-email-ross.lagerwall@citrix.com>

>>> On 11.03.16 at 15:51, <ross.lagerwall@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3091,24 +3091,23 @@ static int vmx_handle_eoi_write(void)
>   * It is the callers responsibility to ensure that this function is only used
>   * in the context of an appropriate vmexit.
>   */
> -static void vmx_propagate_intr(void)
> +static void vmx_propagate_intr(unsigned long intr)
>  {
> -    unsigned long intr, tmp;
> -
> -    __vmread(VM_EXIT_INTR_INFO, &intr);
> -
> -    ASSERT(intr & INTR_INFO_VALID_MASK);
> -
> -    __vmwrite(VM_ENTRY_INTR_INFO, intr);
> +    struct hvm_trap trap = {
> +        .vector = intr & INTR_INFO_VECTOR_MASK,
> +        .type = MASK_EXTR(intr, INTR_INFO_INTR_TYPE_MASK) };

Please use MASK_EXTR() for both. Also the closing brace would better
go on the next line.

> +    unsigned long tmp;
>  
>      if ( intr & INTR_INFO_DELIVER_CODE_MASK )
>      {
>          __vmread(VM_EXIT_INTR_ERROR_CODE, &tmp);
> -        __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, tmp);
> +        trap.error_code = tmp;
>      }
> -
> +    else
> +        trap.error_code = HVM_DELIVER_NO_ERROR_CODE;
>      __vmread(VM_EXIT_INSTRUCTION_LEN, &tmp);
> -    __vmwrite(VM_ENTRY_INSTRUCTION_LEN, tmp);
> +    trap.insn_len = tmp;

For this one I was unsure already for the original change (but it had
gone in already by the time I got to see it): The VM-exit instruction
length field is undefined (i.e. not necessarily zero) for the #AC
intercept case, and also for some (most) of the #DB ones. I therefore
think this needs some qualification, with zero getting used otherwise.

Jan


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

      reply	other threads:[~2016-03-11 15:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 14:51 [PATCH] vmx: Restore debug registers when injecting #DB traps Ross Lagerwall
2016-03-11 15:41 ` Jan Beulich [this message]

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=56E2F55702000078000DBA95@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=xen-devel@lists.xen.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).