From: "Jan Beulich" <JBeulich@suse.com>
To: Tamas K Lengyel <tamas@tklengyel.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
Razvan Cojocaru <rcojocaru@bitdefender.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v4 8/8] x86/vm_event: Add HVM debug exception vm_events
Date: Mon, 30 May 2016 08:16:25 -0600 [thread overview]
Message-ID: <574C675902000078000EFB1F@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1464561430-13465-8-git-send-email-tamas@tklengyel.com>
>>> On 30.05.16 at 00:37, <tamas@tklengyel.com> wrote:
> @@ -117,7 +133,11 @@ int hvm_monitor_breakpoint(unsigned long rip,
>
> req.vcpu_id = curr->vcpu_id;
>
> - return vm_event_monitor_traps(curr, 1, &req);
> + rc = vm_event_monitor_traps(curr, sync, &req);
> + if ( type == HVM_MONITOR_DEBUG_EXCEPTION && rc == 1 && !sync )
> + rc = 0;
> +
> + return rc;
> }
To someone like me, not intimately familiar with the code, this added
logic looks pretty arbitrary. Please add a comment indicating why
under these special circumstances rc needs to be altered here, which
then will hopefully also clarify why that can't be done right in
vm_event_monitor_traps().
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3377,9 +3377,25 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> HVMTRACE_1D(TRAP_DEBUG, exit_qualification);
> write_debugreg(6, exit_qualification | DR_STATUS_RESERVED_ONE);
> if ( !v->domain->debugger_attached )
> - vmx_propagate_intr(intr_info);
> + {
> + unsigned long insn_length = 0;
> + int handled;
The variable name suggests it wants to be bool_t, but ...
> + unsigned long trap_type = MASK_EXTR(intr_info,
> + INTR_INFO_INTR_TYPE_MASK);
> +
> + if( trap_type >= X86_EVENTTYPE_SW_INTERRUPT )
> + __vmread(VM_EXIT_INSTRUCTION_LEN, &insn_length);
> +
> + handled = hvm_monitor_debug(regs->eip,
> + HVM_MONITOR_DEBUG_EXCEPTION,
> + trap_type, insn_length);
> + if ( handled <= 0 )
... it clearly can't. Please use a better name (could by just "rc" or
"ret"). (Otoh I see that code you modify further down uses that
same naming for a similar purpose variable. Let's see what the VMX
maintainers say.)
> + vmx_propagate_intr(intr_info);
> +
> + }
> else
> domain_pause_for_debugger();
> +
> break;
> case TRAP_int3:
If anywhere, this added blank line wants to go after the break.
> @@ -3393,8 +3409,9 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> }
> else {
> int handled =
> - hvm_monitor_breakpoint(regs->eip,
> - HVM_MONITOR_SOFTWARE_BREAKPOINT);
> + hvm_monitor_debug(regs->eip,
> + HVM_MONITOR_SOFTWARE_BREAKPOINT,
> + X86_EVENTTYPE_SW_EXCEPTION, 1);
Please let's not add further mistakes like this, assuming INT3 can't
have any prefixes. It can, even if they're useless.
> @@ -3721,8 +3738,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> vmx_update_cpu_exec_control(v);
> if ( v->arch.hvm_vcpu.single_step )
> {
> - hvm_monitor_breakpoint(regs->eip,
> - HVM_MONITOR_SINGLESTEP_BREAKPOINT);
> + hvm_monitor_debug(regs->eip, HVM_MONITOR_SINGLESTEP_BREAKPOINT, 0, 0);
How come the 3rd argument is literal zero here?
Also you're creating a long line here.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-30 14:16 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-29 22:37 [PATCH v4 1/8] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-05-29 22:37 ` [PATCH v4 2/8] monitor: Rename vm_event_monitor_guest_request Tamas K Lengyel
2016-05-30 7:05 ` Razvan Cojocaru
2016-05-30 13:51 ` Jan Beulich
2016-05-29 22:37 ` [PATCH v4 3/8] monitor: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-05-30 7:08 ` Razvan Cojocaru
2016-05-30 13:53 ` Jan Beulich
2016-05-29 22:37 ` [PATCH v4 4/8] monitor: ARM SMC events Tamas K Lengyel
2016-06-01 11:37 ` Julien Grall
[not found] ` <CABfawhmO9tUG3-OcorfwqdOgZTkjoUk+u=dHySGonBDvobqyKw@mail.gmail.com>
[not found] ` <CABfawhmK2GAmQqZMhrgjYzeUZ_XaoyRUPuJxyPK5LJEHwsp5SA@mail.gmail.com>
[not found] ` <CABfawh=J1fwinTYKGvJNrFPOsGLSXz6U3GE8fxPz3-KsXSWfbQ@mail.gmail.com>
[not found] ` <CABfawhn7zvE=hn0hq1ryH+sW-jdkAXgZM1C2KxwZVUE8pbp8cQ@mail.gmail.com>
2016-06-01 15:41 ` Tamas K Lengyel
2016-06-02 14:23 ` Julien Grall
2016-06-02 22:31 ` Tamas K Lengyel
2016-07-04 19:13 ` Tamas K Lengyel
2016-07-04 20:02 ` Julien Grall
2016-07-04 21:05 ` Tamas K Lengyel
2016-07-05 9:58 ` Julien Grall
2016-05-29 22:37 ` [PATCH v4 5/8] arm/vm_event: get/set registers Tamas K Lengyel
2016-05-30 7:09 ` Razvan Cojocaru
2016-05-30 11:50 ` Jan Beulich
2016-05-30 19:47 ` Tamas K Lengyel
2016-05-30 20:20 ` Julien Grall
2016-05-30 20:37 ` Tamas K Lengyel
2016-05-30 20:46 ` Razvan Cojocaru
2016-05-30 20:53 ` Tamas K Lengyel
2016-05-30 21:35 ` Julien Grall
2016-05-30 21:41 ` Tamas K Lengyel
2016-05-31 7:54 ` Jan Beulich
2016-05-31 8:06 ` Razvan Cojocaru
2016-05-31 8:30 ` Jan Beulich
2016-05-31 16:20 ` Tamas K Lengyel
2016-05-31 7:48 ` Jan Beulich
2016-05-31 16:28 ` Tamas K Lengyel
2016-06-01 8:41 ` Jan Beulich
2016-06-01 11:24 ` Julien Grall
2016-06-01 18:21 ` Tamas K Lengyel
2016-06-01 19:34 ` Razvan Cojocaru
2016-06-01 19:43 ` Julien Grall
2016-06-02 7:35 ` Jan Beulich
2016-06-02 8:26 ` Razvan Cojocaru
2016-06-02 9:38 ` Jan Beulich
2016-06-02 9:42 ` Razvan Cojocaru
2016-06-01 19:38 ` Julien Grall
2016-06-01 19:49 ` Julien Grall
2016-06-01 19:50 ` Tamas K Lengyel
2016-05-29 22:37 ` [PATCH v4 6/8] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-05-29 22:37 ` [PATCH v4 7/8] tools/xen-access: add test-case for ARM SMC Tamas K Lengyel
2016-05-30 9:56 ` Wei Liu
2016-05-29 22:37 ` [PATCH v4 8/8] x86/vm_event: Add HVM debug exception vm_events Tamas K Lengyel
2016-05-30 7:29 ` Razvan Cojocaru
2016-05-30 14:16 ` Jan Beulich [this message]
2016-05-30 20:13 ` Tamas K Lengyel
2016-05-30 20:58 ` Andrew Cooper
2016-05-31 7:59 ` Jan Beulich
2016-06-01 21:46 ` Tamas K Lengyel
2016-06-01 22:17 ` Andrew Cooper
2016-06-02 0:01 ` Tamas K Lengyel
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=574C675902000078000EFB1F@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=rcojocaru@bitdefender.com \
--cc=tamas@tklengyel.com \
--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 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).