All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: george.dunlap@eu.citrix.com,
	xen-devel <xen-devel@lists.xenproject.org>,
	keir.xen@gmail.com, tim@xen.org
Subject: Re: [V7 PATCH 3/7] pvh dom0: implement XENMEM_add_to_physmap_range for x86
Date: Tue, 17 Dec 2013 14:40:40 +0000	[thread overview]
Message-ID: <1387291240.27441.66.camel@kazak.uk.xensource.com> (raw)
In-Reply-To: <52B06F8B020000780010E2B8@nat28.tlf.novell.com>

On Tue, 2013-12-17 at 14:36 +0000, Jan Beulich wrote:
> >>> On 17.12.13 at 14:59, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> > On Tue, 2013-12-17 at 13:07 +0000, Jan Beulich wrote:
> >> >>> On 17.12.13 at 03:38, Mukesh Rathor <mukesh.rathor@oracle.com> wrote:
> >> > --- a/xen/arch/x86/mm.c
> >> > +++ b/xen/arch/x86/mm.c
> >> > @@ -4675,6 +4675,39 @@ static int xenmem_add_to_physmap(struct domain *d,
> >> >      return xenmem_add_to_physmap_once(d, xatp);
> >> >  }
> >> >  
> >> > +static int xenmem_add_to_physmap_range(struct domain *d,
> >> > +                                       struct xen_add_to_physmap_range 
> > *xatpr)
> >> > +{
> >> > +    /* Process entries in reverse order to allow continuations */
> >> > +    while ( xatpr->size > 0 )
> >> > +    {
> >> > +        int rc;
> >> > +        xen_ulong_t idx;
> >> > +        xen_pfn_t gpfn;
> >> > +        struct xen_add_to_physmap xatp;
> >> > +
> >> > +        if ( copy_from_guest_offset(&idx, xatpr->idxs, xatpr->size-1, 1)  ||
> >> > +             copy_from_guest_offset(&gpfn, xatpr->gpfns, xatpr->size-1, 1) )
> >> > +            return -EFAULT;
> >> > +
> >> > +        xatp.space = xatpr->space;
> >> > +        xatp.idx = idx;
> >> > +        xatp.gpfn = gpfn;
> >> > +        rc = xenmem_add_to_physmap_once(d, &xatp);
> >> > +
> >> > +        if ( copy_to_guest_offset(xatpr->errs, xatpr->size-1, &rc, 1) )
> >> > +            return -EFAULT;
> >> > +
> >> > +        xatpr->size--;
> >> > +
> >> > +        /* Check for continuation if it's not the last interation */
> >> > +        if ( xatpr->size > 0 && hypercall_preempt_check() )
> >> > +            return -EAGAIN;
> >> > +    }
> >> > +
> >> > +    return 0;
> >> > +}
> >> 
> >> Now that I started looking into creating the compat wrapper for this,
> >> I realize that processing this request backwards is wrong: The effect
> >> of the entire hypercall can end up being different between forward
> >> and reverse processing, if an index or gpfn happens to be twice in
> >> the set. While that's perhaps not the usual thing to do, you never
> >> know how a creative user of the interface may find it useful to do so.
> > 
> > Hrm, the ARM code does things this way as well. But you are of course
> > right.
> > 
> > We could change the code but we could also tighten the interface
> > requirements, either by explicit specifying that the range is handled in
> > reverse order or by mandating that index/gpfn must not be repeated
> > (whether or not we actively try and detect such cases).
> 
> Specifying that this gets processed backwards would be, well,
> backwards. Requiring no duplicates (or else getting undefined
> behavior) would be possible. But processing the operation in the
> conventional order doesn't seem all that hard.

The reason I thought it would be tricky was finding somewhere to stash
the progress over the continuation. Do you have a cunning plan?

In principal the ABI on ARM is still subject to change (until 4.4) and
on x86 it does exist yet but TBH I'd rather find a way not too, either a
clever continuation trick or adding restrictions to the call.

Ian.

  reply	other threads:[~2013-12-17 14:40 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  2:38 [V7 PATCH 0/7]: PVH dom0 Mukesh Rathor
2013-12-17  2:38 ` [V7 PATCH 1/7] pvh dom0: move some pv specific code to static functions Mukesh Rathor
2013-12-17  2:38 ` [V7 PATCH 2/7] pvh dom0: construct_dom0 changes Mukesh Rathor
2013-12-17  2:38 ` [V7 PATCH 3/7] pvh dom0: implement XENMEM_add_to_physmap_range for x86 Mukesh Rathor
2013-12-17 13:07   ` Jan Beulich
2013-12-17 13:59     ` Ian Campbell
2013-12-17 14:36       ` Jan Beulich
2013-12-17 14:40         ` Ian Campbell [this message]
2013-12-17 15:11           ` Jan Beulich
2013-12-17 15:34             ` Ian Campbell
2013-12-18  7:55             ` Jan Beulich
2013-12-18 10:07               ` Ian Campbell
2013-12-18 10:34                 ` Jan Beulich
2013-12-18 10:41                   ` Ian Campbell
2013-12-18 10:55                     ` Jan Beulich
2013-12-17 23:57     ` Mukesh Rathor
2013-12-18 10:00       ` Ian Campbell
2013-12-17 16:56   ` Jan Beulich
2013-12-17  2:38 ` [V7 PATCH 4/7] pvh dom0: Introduce p2m_map_foreign Mukesh Rathor
2013-12-17  2:38 ` [V7 PATCH 5/7] pvh: change xsm_add_to_physmap Mukesh Rathor
2013-12-17  8:32   ` Jan Beulich
2013-12-18  0:19     ` Mukesh Rathor
2013-12-18  8:07       ` Jan Beulich
2013-12-19 15:50   ` Daniel De Graaf
2013-12-19 19:55     ` Mukesh Rathor
2014-01-28  1:55   ` Mukesh Rathor
2014-01-28 10:31     ` Jan Beulich
2014-01-29  2:08       ` Mukesh Rathor
2014-01-29 10:40         ` Ian Campbell
2014-01-29 11:38           ` Tim Deegan
2014-01-29 11:41             ` Ian Campbell
2014-01-29 11:48               ` Tim Deegan
2014-01-29 11:51                 ` Ian Campbell
2014-01-30  1:33                   ` Mukesh Rathor
2014-02-09 16:51                     ` Julien Grall
2014-02-10 13:42                       ` Ian Campbell
2014-02-10 15:16                         ` Julien Grall
2014-02-10 15:27                           ` Ian Campbell
2014-02-10 15:33                             ` Julien Grall
2014-02-10 15:37                               ` Ian Campbell
2014-02-20  2:37                               ` Mukesh Rathor
2014-02-20  8:31                                 ` Jan Beulich
2014-02-12 16:47   ` Julien Grall
2014-02-20  2:22     ` Mukesh Rathor
2014-02-20 13:49       ` Julien Grall
2014-02-21  1:22         ` Mukesh Rathor
2014-02-21 23:53           ` Mukesh Rathor
2014-02-22  0:20             ` Julien Grall
2013-12-17  2:38 ` [V7 PATCH 6/7] pvh dom0: Add and remove foreign pages Mukesh Rathor
2013-12-17  2:38 ` [V7 PATCH 7/7] pvh dom0: add opt_dom0pvh to setup.c Mukesh Rathor
2013-12-17 14:46 ` [V7 PATCH 0/7]: PVH dom0 Konrad Rzeszutek Wilk
2013-12-18  0:14   ` Mukesh Rathor

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=1387291240.27441.66.camel@kazak.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=keir.xen@gmail.com \
    --cc=tim@xen.org \
    --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 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.