From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] vm_event: make sure the domain is paused in key domctls Date: Thu, 28 Jan 2016 14:10:38 +0000 Message-ID: <56AA215E.5020605@citrix.com> References: <1453989160-8002-1-git-send-email-rcojocaru@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1453989160-8002-1-git-send-email-rcojocaru@bitdefender.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Razvan Cojocaru , xen-devel@lists.xen.org Cc: tamas@tklengyel.com, keir@xen.org, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org On 28/01/16 13:52, Razvan Cojocaru wrote: > This patch pauses the domain for all writes through the 'ad' > pointer in monitor_domctl(), defers a domain_unpause() call until > after the CRs are updated for the MONITOR_EVENT_WRITE_CTRLREG > case, and makes sure that the domain is paused for both vm_event > enable and disable cases in vm_event_domctl(). > Thanks go to Andrew Cooper for his review and suggestions. > > Signed-off-by: Razvan Cojocaru Would you mind annotating each of the checks for d != current->domain with /* no domain_pause(). */, which is our normal practice. I think it might be better to move the current check for XEN_DOMCTL_monitor_op into monitor_domctl() itself, to have all checks together in one place. > @@ -144,6 +146,8 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) > if ( rc ) > return rc; > > + domain_pause(d); > + > if ( mop->op == XEN_DOMCTL_MONITOR_OP_ENABLE && > mop->u.mov_to_msr.extended_capture ) > { > @@ -154,7 +158,6 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) You will need to rework the return -EOPNOTSUPP between these two hunks to avoid missing the domain_unpause() It would probably be better to pull the check forwards to before the domain_pause(). > } else > ad->monitor.mov_to_msr_extended = 0; > > - domain_pause(d); > ad->monitor.mov_to_msr_enabled = !status; > domain_unpause(d); > break; > @@ -196,9 +199,8 @@ int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop) > The other codepaths look fine. ~Andrew