> -----Original Message-----
> From: Andrew Cooper [mailto:andrew.coop...@citrix.com]
> Sent: 13 December 2018 20:23
> To: Xen-devel <xen-de...@lists.xen.org>
> Cc: Andrew Cooper <andrew.coop...@citrix.com>; Jan Beulich
> <jbeul...@suse.com>; Wei Liu <wei.l...@citrix.com>; Roger Pau Monne
> <roger....@citrix.com>; Paul Durrant <paul.durr...@citrix.com>; Boris
> Ostrovsky <boris.ostrov...@oracle.com>; Suravee Suthikulpanit
> <suravee.suthikulpa...@amd.com>; Brian Woods <brian.wo...@amd.com>
> Subject: [PATCH v2 2/3] x86/svm: Improve diagnostics when
> svm_get_insn_len() fails
> 
> Sadly, a lone:
> 
>   (XEN) emulate.c:156:d2v0 svm_get_insn_len: Mismatch between expected and
> actual instruction: eip = fffff804564139c0
> 
> on the console is of no use trying to identify what went wrong.  Dump as
> much
> state as we can to help identify what went wrong.
> 
> Reported-by: Paul Durrant <paul.durr...@citrix.com>
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
> Acked-by: Brian Woods <brian.wo...@amd.com>

Reviewed-by: Paul Durrant <paul.durr...@citrix.com>

> ---
> CC: Jan Beulich <jbeul...@suse.com>
> CC: Wei Liu <wei.l...@citrix.com>
> CC: Roger Pau Monné <roger....@citrix.com>
> CC: Paul Durrant <paul.durr...@citrix.com>
> CC: Boris Ostrovsky <boris.ostrov...@oracle.com>
> CC: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com>
> CC: Brian Woods <brian.wo...@amd.com>
> 
> v2:
>  * Drop anonymous union
>  * Rebase
> ---
>  xen/arch/x86/hvm/svm/emulate.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/svm/emulate.c
> b/xen/arch/x86/hvm/svm/emulate.c
> index 3f695b9..73cef5b 100644
> --- a/xen/arch/x86/hvm/svm/emulate.c
> +++ b/xen/arch/x86/hvm/svm/emulate.c
> @@ -143,8 +143,17 @@ int svm_get_insn_len(struct vcpu *v, enum
> instruction_index insn)
>      }
> 
>      gdprintk(XENLOG_WARNING,
> -             "%s: Mismatch between expected and actual instruction: "
> -             "eip = %lx\n",  __func__, (unsigned long)vmcb->rip);
> +             "%s: Mismatch between expected and actual instruction:\n",
> +             __func__);
> +    gdprintk(XENLOG_WARNING,
> +             "  insn_index %d, opcode %#x modrm %#x\n",
> +             insn, opc_tab[insn].opcode, ((opc_tab[insn].modrm.rm  << 6)
> |
> +                                          (opc_tab[insn].modrm.reg << 3)
> |
> +                                          (opc_tab[insn].modrm.mod)));
> +    gdprintk(XENLOG_WARNING, "  rip %#lx, nextrip %#lx, len %lu\n",
> +             vmcb->rip, vmcb->nextrip, vmcb->nextrip - vmcb->rip);
> +    hvm_dump_emulation_state(XENLOG_G_WARNING, "SVM Insn len",
> +                             &ctxt, X86EMUL_UNHANDLEABLE);
> 
>   out:
>      hvm_inject_hw_exception(TRAP_gp_fault, 0);
> --
> 2.1.4

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

Reply via email to