xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: tim@xen.org, sstabellini@kernel.org, wei.liu2@citrix.com,
	andrew.cooper3@citrix.com, Ian.Jackson@eu.citrix.com,
	george.dunlap@citrix.com, xen-devel@lists.xen.org,
	Julien Grall <julien.grall@arm.com>,
	shannon.zhao@linaro.org
Subject: Re: [for-4.7 1/2] xen: XENMEM_add_physmap_batch: Mark 'foreign_id' as reserved for dev_mmio
Date: Wed, 25 May 2016 15:04:31 +0100	[thread overview]
Message-ID: <20160525140431.GO22076@citrix.com> (raw)
In-Reply-To: <5745C0DE02000078000EEADC@prv-mh.provo.novell.com>

On Wed, May 25, 2016 at 07:12:30AM -0600, Jan Beulich wrote:
> >>> On 25.05.16 at 13:41, <julien.grall@arm.com> wrote:
> > --- a/xen/arch/arm/mm.c
> > +++ b/xen/arch/arm/mm.c
> > @@ -1143,6 +1143,10 @@ int xenmem_add_to_physmap_one(
> >          break;
> >      }
> >      case XENMAPSPACE_dev_mmio:
> > +        /* The field 'foreign_domid' is reserved for future use */
> > +        if ( foreign_domid )
> > +            return -ENOSYS;
> 
> This should return -EINVAL or maybe -EOPNOTSUPP, but
> definitely not -ENOSYS.
> 
> > --- a/xen/common/memory.c
> > +++ b/xen/common/memory.c
> > @@ -639,9 +639,11 @@ static int xenmem_add_to_physmap(struct domain *d,
> >  {
> >      unsigned int done = 0;
> >      long rc = 0;
> > +    /* The field 'foreign_id' should be 0 when mapping MMIO. */
> > +    domid_t inv = (xatp->space != XENMAPSPACE_dev_mmio) ? DOMID_INVALID : 0;
> 
> This is a bad type for something that now isn't a domain ID anymore.
> Please use u16 or even better unsigned int. Eventually we should
> fix xenmem_add_to_physmap_one()'s respective parameter type
> accordingly.
> 
> Also I think the condition would better be space == gmfn_foreign.
> 
> > @@ -658,7 +660,7 @@ static int xenmem_add_to_physmap(struct domain *d,
> >  
> >      while ( xatp->size > done )
> >      {
> > -        rc = xenmem_add_to_physmap_one(d, xatp->space, DOMID_INVALID,
> > +        rc = xenmem_add_to_physmap_one(d, xatp->space, inv,
> >                                         xatp->idx, xatp->gpfn);
> 
> This instance you could actually leave alone (as it's dealing with
> XENMAPSPACE_gmfn_range only).
> 
> > --- a/xen/include/public/memory.h
> > +++ b/xen/include/public/memory.h
> > @@ -259,7 +259,7 @@ struct xen_add_to_physmap_batch {
> >  
> >      /* Number of pages to go through */
> >      uint16_t size;
> > -    domid_t foreign_domid; /* IFF gmfn_foreign */
> > +    domid_t foreign_domid; /* IFF gmfn_foreign. Should be 0 for other spaces. */
> 
> I wonder whether we shouldn't fix up the structure here right away,
> instead of deferring that to after 4.7. After all, as above, we don't
> really want a domain ID here generally anymore, so this should
> either become "u16 aux" (or some such) or a union (all of course only
> for new enough __XEN_INTERFACE_VERSION__).
> 
> Plus I think we will want this to be IN/OUT, such that if the
> implementation, rather than failing, uses a replacement attribute,
> that could be communicated back. Of course that would matter
> only if we don't go the union route mentioned above.
> 
> Wei, would that be still acceptable for 4.7?
> 

Sure. It's a simple in term of code change and should be fairly easy to
review.

Wei.

> Jan
> 

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

  reply	other threads:[~2016-05-25 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 11:41 [for-4.7 0/2] xen: Julien Grall
2016-05-25 11:41 ` [for-4.7 1/2] xen: XENMEM_add_physmap_batch: Mark 'foreign_id' as reserved for dev_mmio Julien Grall
2016-05-25 13:12   ` Jan Beulich
2016-05-25 14:04     ` Wei Liu [this message]
2016-05-25 14:28     ` Julien Grall
2016-05-25 11:41 ` [for-4.7 2/2] xen/arm: Document the behavior of XENMAPSPACE_dev_mmio Julien Grall
2016-05-25 13:14   ` Jan Beulich
2016-05-25 14:43     ` Julien Grall
2016-05-25 14:53       ` Jan Beulich
2016-05-26  9:18       ` Stefano Stabellini
2016-05-26  9:28         ` Julien Grall
2016-05-25 11:42 ` xen: XENMEM_add_physmap_batch: Mark 'foreign_is' as reserved for dev_mmio (WAS Re: [for-4.7 0/2] xen:) Julien Grall

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=20160525140431.GO22076@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --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 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).