xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <JBeulich@suse.com>
Cc: StefanoStabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"Tim (Xen.org)" <tim@xen.org>,
	George Dunlap <George.Dunlap@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Ian Jackson <Ian.Jackson@citrix.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH v13 05/11] x86/mm: add HYPERVISOR_memory_op to acquire guest resources
Date: Fri, 24 Nov 2017 09:59:31 +0000	[thread overview]
Message-ID: <9e1c4a63ebba462a89f8d842b8678165@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <5A17FB240200007800191C38@prv-mh.provo.novell.com>

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 24 November 2017 09:58
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Julien Grall <julien.grall@arm.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>; George Dunlap
> <George.Dunlap@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Wei Liu
> <wei.liu2@citrix.com>; StefanoStabellini <sstabellini@kernel.org>; xen-
> devel@lists.xenproject.org; Konrad Rzeszutek Wilk
> <konrad.wilk@oracle.com>; Daniel De Graaf <dgdegra@tycho.nsa.gov>; Tim
> (Xen.org) <tim@xen.org>
> Subject: RE: [PATCH v13 05/11] x86/mm: add HYPERVISOR_memory_op to
> acquire guest resources
> 
> >>> On 24.11.17 at 10:36, <Paul.Durrant@citrix.com> wrote:
> >> From: Jan Beulich [mailto:JBeulich@suse.com]
> >> Sent: 23 November 2017 16:42
> >> >>> On 30.10.17 at 18:48, <paul.durrant@citrix.com> wrote:
> >> > +    if ( !paging_mode_translate(currd) )
> >> > +    {
> >> > +        if ( copy_to_guest(xmar.frame_list, mfn_list, xmar.nr_frames) )
> >> > +            rc = -EFAULT;
> >> > +    }
> >> > +    else
> >> > +    {
> >> > +        xen_pfn_t gfn_list[ARRAY_SIZE(mfn_list)];
> >> > +        unsigned int i;
> >> > +
> >> > +        rc = -EFAULT;
> >> > +        if ( copy_from_guest(gfn_list, xmar.frame_list, xmar.nr_frames) )
> >> > +            goto out;
> >>
> >> This will result in requests with nr_frames being zero to fail with
> >> -EFAULT afaict. Let's please have such no-op requests succeed.
> >
> > Oh, I was labouring under the assumption that a copy_from_guest() with a
> > zero count would succeed... I should have checked.
> 
> I don't think it would fail. The problem is that you won't enter ...
> 
> >> > +        for ( i = 0; i < xmar.nr_frames; i++ )
> >> > +        {
> 
> ... the body of this loop then, and hence rc will remain at -EFAULT.
> 
> >> > +            rc = set_foreign_p2m_entry(currd, gfn_list[i],
> >> > +                                       _mfn(mfn_list[i]));
> >> > +            if ( rc )
> >> > +            {
> >> > +                /*
> >> > +                 * Make sure rc is -EIO for any iteration other than
> >> > +                 * the first.
> >> > +                 */
> >> > +                rc = (i != 0) ? -EIO : rc;
> >>
> >> Along the lines of what I've said above, "!=0" could be dropped
> >> here, too.
> >
> > The reason for the != 0 here is make the failure explicitly EIO for the case
> > where at least one iteration has successfully set_foreign_p2m_entry() but
> a
> > subsequent one has failed, which matches what is stated in the header.
> > (Specifically it means that, on ARM, the -EOPNOTSUPP from
> > set_foreign_p2m_entry() will get back to the caller).
> 
> I'm not asking for the condition to be removed, just for it to be
> simplified to
> 
>                 rc = i ? -EIO : rc;
> 

Ah, ok. That's fine then.

Thanks,

   Paul

> Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2017-11-24  9:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30 17:48 [PATCH v13 00/11] x86: guest resource mapping Paul Durrant
2017-10-30 17:48 ` [PATCH v13 01/11] x86/hvm/ioreq: maintain an array of ioreq servers rather than a list Paul Durrant
2017-10-30 17:48 ` [PATCH v13 02/11] x86/hvm/ioreq: simplify code and use consistent naming Paul Durrant
2017-10-30 17:48 ` [PATCH v13 03/11] x86/hvm/ioreq: use gfn_t in struct hvm_ioreq_page Paul Durrant
2017-10-30 17:48 ` [PATCH v13 04/11] x86/hvm/ioreq: defer mapping gfns until they are actually requsted Paul Durrant
2017-10-30 17:48 ` [PATCH v13 05/11] x86/mm: add HYPERVISOR_memory_op to acquire guest resources Paul Durrant
2017-11-23 16:42   ` Jan Beulich
2017-11-24  9:36     ` Paul Durrant
2017-11-24  9:57       ` Jan Beulich
2017-11-24  9:59         ` Paul Durrant [this message]
2017-10-30 17:48 ` [PATCH v13 06/11] x86/hvm/ioreq: add a new mappable resource type Paul Durrant
2017-11-24 10:52   ` Jan Beulich
2017-11-24 10:57     ` Paul Durrant
2017-10-30 17:48 ` [PATCH v13 07/11] x86/mm: add an extra command to HYPERVISOR_mmu_update Paul Durrant
2017-10-30 17:48 ` [PATCH v13 08/11] tools/libxenforeignmemory: add support for resource mapping Paul Durrant
2017-10-30 17:48 ` [PATCH v13 09/11] tools/libxenforeignmemory: reduce xenforeignmemory_restrict code footprint Paul Durrant
2017-10-30 17:48 ` [PATCH v13 10/11] common: add a new mappable resource type: XENMEM_resource_grant_table Paul Durrant
2017-11-27 14:47   ` Jan Beulich
2017-10-30 17:48 ` [PATCH v13 11/11] tools/libxenctrl: use new xenforeignmemory API to seed grant table Paul Durrant

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=9e1c4a63ebba462a89f8d842b8678165@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --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 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).