All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tamas Lengyel <tamas.lengyel@zentific.com>
To: Tim Deegan <tim@xen.org>
Cc: Kevin Tian <kevin.tian@intel.com>,
	wei.liu2@citrix.com, Ian Campbell <ian.campbell@citrix.com>,
	Steven Maresca <steve@zentific.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Eddie Dong <eddie.dong@intel.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org,
	Andres Lagar-Cavilla <andres@lagarcavilla.org>,
	Jan Beulich <jbeulich@suse.com>,
	rshriram@cs.ubc.ca, Keir Fraser <keir@xen.org>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	yanghy@cn.fujitsu.com
Subject: Re: [PATCH V6 11/13] xen/vm_event: Relocate memop checks
Date: Thu, 12 Mar 2015 16:55:04 +0100	[thread overview]
Message-ID: <CABfawhmUgTPWZxwnpE5FN_oG1FzydzsPtKcpZ1o-200FPQc0PQ@mail.gmail.com> (raw)
In-Reply-To: <20150312153611.GI22158@deinos.phlegethon.org>


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

On Thu, Mar 12, 2015 at 4:36 PM, Tim Deegan <tim@xen.org> wrote:

> Hi,
>
> At 01:11 +0100 on 18 Feb (1424218301), Tamas K Lengyel wrote:
> > -int mem_paging_memop(struct domain *d, xen_mem_paging_op_t *mpo)
> > +int mem_paging_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_paging_op_t) arg)
> >  {
> > -    int rc = -ENODEV;
> > -    if ( unlikely(!d->vm_event->paging.ring_page) )
> > +    int rc;
> > +    xen_mem_paging_op_t mpo;
> > +    struct domain *d;
> > +    bool_t copyback = 0;
> > +
> > +    rc = -EFAULT;
> > +    if ( copy_from_guest(&mpo, arg, 1) )
> >          return rc;
>
> ISTR Jan suggested that you just 'return -EFAULT' here since you won't
> be reusing the rc.
>

Ack, already fixed in v7.


>
> > -    switch( mpo->op )
> > +    rc = rcu_lock_live_remote_domain_by_id(mpo.domain, &d);
> > +    if ( rc )
> > +        goto out;
>
> This one should be a return too; you only need the goto out if this
> succeeded.
>

Ack, also fixed in v7.


>
> > +    rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_paging_op);
> > +    if ( rc )
> > +        goto out;
> > +
> > +    rc = -ENODEV;
> > +    if ( unlikely(!d->vm_event->paging.ring_page) )
> > +        goto out;
> > +
> > +    switch( mpo.op )
> >      {
> >      case XENMEM_paging_op_nominate:
> > -        rc = p2m_mem_paging_nominate(d, mpo->gfn);
> > +        rc = p2m_mem_paging_nominate(d, mpo.gfn);
> >          break;
> >
> >      case XENMEM_paging_op_evict:
> > -        rc = p2m_mem_paging_evict(d, mpo->gfn);
> > +        rc = p2m_mem_paging_evict(d, mpo.gfn);
> >          break;
> >
> >      case XENMEM_paging_op_prep:
> > -        rc = p2m_mem_paging_prep(d, mpo->gfn, mpo->buffer);
> > +    {
>
> I don't think these braces are needed.
>

Ack.


>
> [...]
> >      /* Only HAP is supported */
> > +    rc = -ENODEV;
> >      if ( !hap_enabled(d) || !d->arch.hvm_domain.mem_sharing_enabled )
> > -         return -ENODEV;
> > +         rc = -ENODEV;
> >
>
> You need a 'goto out' here, or the rc gets overwritten immediately.
>

Ack, already fixed. I really need to get v7 posted =)


>
> Cheers,
>
> Tim.
>
> > -    switch(mec->op)
> > +    rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_sharing_op);
> > +    if ( rc )
> > +        goto out;
>
>
Thanks,
Tamas

[-- Attachment #1.2: Type: text/html, Size: 3909 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:[~2015-03-12 15:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18  0:11 [PATCH V6 00/13] xen: Clean-up of mem_event subsystem Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 01/13] xen/mem_event: Cleanup of mem_event structures Tamas K Lengyel
2015-03-11 16:45   ` Ian Campbell
2015-03-12 12:13   ` Tim Deegan
2015-03-12 12:32     ` Tamas Lengyel
2015-02-18  0:11 ` [PATCH V6 02/13] xen/mem_event: Cleanup mem_event names in rings, functions and domctls Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 03/13] xen/mem_paging: Convert mem_event_op to mem_paging_op and cleanup Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 04/13] xen: Rename mem_event to vm_event Tamas K Lengyel
2015-02-18  9:46   ` Jan Beulich
2015-02-18 12:21     ` Tamas K Lengyel
2015-02-18 13:35       ` Jan Beulich
2015-02-18 15:55         ` Tamas K Lengyel
2015-02-18 17:22           ` Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 05/13] xen/vm_event: Style fixes Tamas K Lengyel
2015-03-12 12:52   ` Tim Deegan
2015-02-18  0:11 ` [PATCH V6 06/13] tools/tests: Clean-up tools/tests/xen-access Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 07/13] x86/hvm: factor out and rename vm_event related functions Tamas K Lengyel
2015-03-12 12:57   ` Tim Deegan
2015-02-18  0:11 ` [PATCH V6 08/13] xen: Introduce monitor_op domctl Tamas K Lengyel
2015-02-18 18:15   ` Tamas Lengyel
2015-03-12 14:01   ` Tim Deegan
2015-02-18  0:11 ` [PATCH V6 09/13] xen/vm_event: Deprecate VM_EVENT_FLAG_DUMMY flag Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 10/13] xen/vm_event: Decouple vm_event and mem_access Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 11/13] xen/vm_event: Relocate memop checks Tamas K Lengyel
2015-03-12 15:36   ` Tim Deegan
2015-03-12 15:55     ` Tamas Lengyel [this message]
2015-02-18  0:11 ` [PATCH V6 12/13] xen/xsm: Split vm_event_op into three separate labels Tamas K Lengyel
2015-02-18  0:11 ` [PATCH V6 13/13] xen/vm_event: Add RESUME option to vm_event_op domctl Tamas K Lengyel
2015-03-12 15:56   ` Tim Deegan
2015-03-12 16:00     ` Tamas Lengyel
2015-03-11 16:49 ` [PATCH V6 00/13] xen: Clean-up of mem_event subsystem Ian Campbell
2015-03-11 17:16   ` Tamas K Lengyel
2015-03-12 15:58 ` Tim Deegan

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=CABfawhmUgTPWZxwnpE5FN_oG1FzydzsPtKcpZ1o-200FPQc0PQ@mail.gmail.com \
    --to=tamas.lengyel@zentific.com \
    --cc=andres@lagarcavilla.org \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=rshriram@cs.ubc.ca \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=steve@zentific.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yanghy@cn.fujitsu.com \
    /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.