All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corneliu ZUZU <czuzu@bitdefender.com>
To: Tamas K Lengyel <tamas@tklengyel.com>
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Razvan Cojocaru <rcojocaru@bitdefender.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH v4 2/2] xen/vm-events: Move parts of monitor_domctl code to common-side.
Date: Tue, 16 Feb 2016 19:48:20 +0200	[thread overview]
Message-ID: <56C360E4.4080707@bitdefender.com> (raw)
In-Reply-To: <CABfawhmc7ysZUXn2H6i5cNA_V9f7i4zmvEfwpym9r4C60snKVQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3190 bytes --]

On 2/16/2016 6:02 PM, Tamas K Lengyel wrote:
>
>
>     @@ -143,77 +72,75 @@ int monitor_domctl(struct domain *d, struct
>     xen_domctl_monitor_op *mop)
>
>          case XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR:
>          {
>
>
> So since we will now have two separate booleans, requested_status and 
> old_status and then manually verify they are opposite..
>
>     -        bool_t status = ad->monitor.mov_to_msr_enabled;
>     +        bool_t old_status = ad->monitor.mov_to_msr_enabled;
>
>
> ...here we should set the field to requested_status, not !old_status. 
> While they are technically equivalent, the code would read better to 
> other way around.
>
>
>     -        ad->monitor.mov_to_msr_enabled = !status;
>     +        ad->monitor.mov_to_msr_enabled = !old_status; 
>
>              domain_unpause(d);
>              break;
>          }
>
>          case XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP:
>          {
>     -        bool_t status = ad->monitor.singlestep_enabled;
>     +        bool_t old_status = ad->monitor.singlestep_enabled;
>
>     -        rc = status_check(mop, status);
>     -        if ( rc )
>     -            return rc;
>     +        if ( unlikely(old_status == requested_status) )
>     +            return -EEXIST;
>
>              domain_pause(d);
>
>
> Here as well..
>
>     -        ad->monitor.singlestep_enabled = !status;
>     +        ad->monitor.singlestep_enabled = !old_status;
>              domain_unpause(d);
>              break;
>          }
>
>          case XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT:
>          {
>     -        bool_t status = ad->monitor.software_breakpoint_enabled;
>     +        bool_t old_status = ad->monitor.software_breakpoint_enabled;
>
>     -        rc = status_check(mop, status);
>     -        if ( rc )
>     -            return rc;
>     +        if ( unlikely(old_status == requested_status) )
>     +            return -EEXIST;
>
>              domain_pause(d);
>
>
> ..and here..
>
>     -        ad->monitor.software_breakpoint_enabled = !status;
>     +        ad->monitor.software_breakpoint_enabled = !old_status;
>              domain_unpause(d);
>              break;
>          }
>
>          case XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST:
>          {
>     -        bool_t status = ad->monitor.guest_request_enabled;
>     +        bool_t old_status = ad->monitor.guest_request_enabled;
>
>     -        rc = status_check(mop, status);
>     -        if ( rc )
>     -            return rc;
>     +        if ( unlikely(old_status == requested_status) )
>     +            return -EEXIST;
>
>              domain_pause(d);
>              ad->monitor.guest_request_sync = mop->u.guest_request.sync;
>
>
> ..and here.
>
>     -        ad->monitor.guest_request_enabled = !status;
>     +        ad->monitor.guest_request_enabled = !old_status;
>              domain_unpause(d);
>              break;
>          }
>
>
> Otherwise the patch looks good.
>
> Thanks,
> Tamas
>

Oh, right, that would look better. Shall I send a v5 then with that 
change? (and if yes I guess it won't hurt if I also include the 
left-shift sanity checks I mentioned I should have added (?))

Thanks,
Corneliu.

[-- Attachment #1.2: Type: text/html, Size: 7049 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

  reply	other threads:[~2016-02-16 17:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  7:07 [PATCH v4 0/2] Vm-events: move monitor vm-events code to common-side Corneliu ZUZU
2016-02-16  7:07 ` [PATCH v4 1/2] xen/arm: fix file comments Corneliu ZUZU
2016-02-16  7:08 ` [PATCH v4 2/2] xen/vm-events: Move parts of monitor_domctl code to common-side Corneliu ZUZU
2016-02-16  8:13   ` Corneliu ZUZU
2016-02-16 10:45     ` Jan Beulich
2016-02-16 11:20       ` Corneliu ZUZU
2016-02-16 12:34         ` Jan Beulich
2016-02-16 13:03           ` Corneliu ZUZU
2016-02-16 10:54   ` Stefano Stabellini
2016-02-16 14:10   ` Razvan Cojocaru
2016-02-16 16:02   ` Tamas K Lengyel
2016-02-16 17:48     ` Corneliu ZUZU [this message]
2016-02-16 17:53       ` 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=56C360E4.4080707@bitdefender.com \
    --to=czuzu@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=rcojocaru@bitdefender.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tamas@tklengyel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.