From: Tamas K Lengyel <tamas@tklengyel.com>
To: Jan Beulich <JBeulich@suse.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 v5 8/9] x86/vm_event: Add HVM debug exception vm_events
Date: Fri, 3 Jun 2016 08:34:03 -0600 [thread overview]
Message-ID: <CABfawhn5LsDgB9wC14Cu5jsRDH8zUjWQT_5OCQ3wGnvb1g9oaA@mail.gmail.com> (raw)
In-Reply-To: <5751AF1402000078000F1A15@prv-mh.provo.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 4040 bytes --]
On Jun 3, 2016 08:23, "Jan Beulich" <JBeulich@suse.com> wrote:
>
> >>> On 03.06.16 at 15:29, <tamas@tklengyel.com> wrote:
> > On Jun 3, 2016 04:49, "Jan Beulich" <JBeulich@suse.com> wrote:
> >>
> >> >>> On 03.06.16 at 00:52, <tamas@tklengyel.com> wrote:
> >> > --- a/xen/arch/x86/hvm/vmx/vmx.c
> >> > +++ b/xen/arch/x86/hvm/vmx/vmx.c
> >> > @@ -3377,10 +3377,33 @@ 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;
> >>
> >> It's insn_len further down - please try to be consistent.
> >>
> >> > + int rc;
> >> > + 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);
> >> > +
> >> > + rc = hvm_monitor_debug(regs->eip,
> >> > + HVM_MONITOR_DEBUG_EXCEPTION,
> >> > + trap_type, insn_length);
> >> > + if ( !rc )
> >> > + {
> >> > + vmx_propagate_intr(intr_info);
> >> > + break;
> >> > + }
> >> > + else if ( rc > 0 )
> >> > + break;
> >>
> >> So you've removed the odd / hard to understand return value
> >> adjustment from hvm_monitor_debug(), but this isn't any better:
> >> What does the return value being positive really mean? And btw.,
> >> no point using "else" after an unconditional "break" in the previous
> >> if().
> >
> > As the commit message explains in the other patch rc is 1 when the vCPU
is
> > paused. This means a synchronous event where we are waiting for the
> > vm_event response thus work here is done.
>
> The commit message of _another_ patch doesn't help at all a future
> reader to understand what's going on here.
This is already used elsewhere in similar fashion so I don't see why we
would need to treat this case any differently. Its not like I'm introducing
a totally new way of doing this. So IMHO adding a comment would be an OK
middle ground but my goal is really not to rework everything.
> >> > + }
> >> > else
> >> > + {
> >> > domain_pause_for_debugger();
> >> > - break;
> >> > + break;
> >> > + }
> >> > +
> >> > + goto exit_and_crash;
> >>
> >> There was no such goto before, i.e. you introduce this. I'm rather
> >> hesitant to see such getting added without a good reason, and
> >> that good reason should be stated in a comment. Also it looks like
> >> the change would be easier to grok if you didn't alter the code
> >> down here, but instead inverted the earlier if:
> >>
> >> if ( unlikely(rc < 0) )
> >> /* ... */
> >> goto exit_and_crash;
> >> if ( !rc )
> >> vmx_propagate_intr(intr_info);
> >>
> >> Which imo would get us closer to code being at least half way
> >> self-explanatory.
> >
> > I agree it may be more intuitive that way but adding the goto the way I
did
> > is whats consistent with the already established handling of int3
events. I
> > either go for consistency or reworking more code at other spots too.
>
> Well, as always I'll leave it to the maintainers to decide, but I think
> my suggestion would make this code better readable, and doesn't
> require immediate re-work elsewhere.
>
If we are aiming for consistency then I think it does. Lets hear from the
maintainers and will go from there. I rather not start reworking
preexisting stuff because it tends to snowball into a lot more patches.
Tamas
[-- Attachment #1.2: Type: text/html, Size: 5882 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-03 14:34 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 22:52 [PATCH v5 1/9] vm_event: clear up return value of vm_event_monitor_traps Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 2/9] monitor: Rename vm_event_monitor_get_capabilities Tamas K Lengyel
2016-06-17 19:07 ` Tamas K Lengyel
2016-06-21 9:20 ` Julien Grall
2016-06-02 22:52 ` [PATCH v5 3/9] monitor: Rename vm_event_monitor_guest_request Tamas K Lengyel
2016-06-17 19:10 ` Tamas K Lengyel
2016-06-21 9:18 ` Julien Grall
2016-06-02 22:52 ` [PATCH v5 4/9] monitor: Rename hvm/event to hvm/monitor Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 5/9] monitor: ARM SMC events Tamas K Lengyel
2016-06-03 9:49 ` Julien Grall
2016-06-03 13:40 ` Tamas K Lengyel
2016-06-03 14:43 ` Julien Grall
2016-06-03 15:03 ` Tamas K Lengyel
2016-06-03 15:06 ` Julien Grall
2016-06-03 15:42 ` Tamas K Lengyel
2016-06-03 15:27 ` Tamas K Lengyel
2016-06-03 15:34 ` Tamas K Lengyel
2016-06-04 9:03 ` Edgar E. Iglesias
2016-06-04 17:40 ` Tamas K Lengyel
2016-06-06 10:07 ` Julien Grall
[not found] ` <CABfawh=tOsUP1dQi9oAZM+iy3rMmCKDW=VByT-L-xYdAMBiMKw@mail.gmail.com>
[not found] ` <CABfawhkSXqky9WWp8NyKEUrH_ZzSJToxAncTeSYeKBg1q63rwg@mail.gmail.com>
2016-06-06 15:24 ` Tamas K Lengyel
2016-06-06 15:54 ` Julien Grall
2016-06-06 15:56 ` Tamas K Lengyel
2016-06-06 16:14 ` Tamas K Lengyel
2016-06-06 16:38 ` Julien Grall
2016-06-06 17:28 ` Tamas K Lengyel
2016-06-07 7:13 ` Jan Beulich
2016-06-07 10:30 ` Stefano Stabellini
2016-06-07 16:06 ` Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 6/9] arm/vm_event: get/set registers Tamas K Lengyel
2016-06-03 10:34 ` Jan Beulich
2016-06-03 19:27 ` Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 7/9] tools/libxc: add xc_monitor_privileged_call Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 8/9] x86/vm_event: Add HVM debug exception vm_events Tamas K Lengyel
2016-06-03 10:49 ` Jan Beulich
2016-06-03 13:29 ` Tamas K Lengyel
2016-06-03 14:23 ` Jan Beulich
2016-06-03 14:34 ` Tamas K Lengyel [this message]
2016-06-03 14:45 ` Jan Beulich
2016-06-03 14:51 ` Tamas K Lengyel
2016-06-02 22:52 ` [PATCH v5 9/9] tools/xen-access: add test-case for ARM SMC Tamas K Lengyel
2016-06-03 7:08 ` [PATCH v5 1/9] vm_event: clear up return value of vm_event_monitor_traps Razvan Cojocaru
2016-06-03 15:54 ` Jan Beulich
2016-06-03 16:03 ` Tamas K Lengyel
2016-06-17 19:09 ` Tamas K Lengyel
2016-06-24 10:58 ` Tian, Kevin
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=CABfawhn5LsDgB9wC14Cu5jsRDH8zUjWQT_5OCQ3wGnvb1g9oaA@mail.gmail.com \
--to=tamas@tklengyel.com \
--cc=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=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).