xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Julien Grall <julien.grall@arm.com>, xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
	George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com,
	dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v6 02/12] xen: move XENMAPSPACE_grant_table code into grant_table.c
Date: Fri, 15 Sep 2017 09:25:54 +0200	[thread overview]
Message-ID: <b9fb9762-6c99-dd54-a3b9-43613b49255d@suse.com> (raw)
In-Reply-To: <9c69f140-26e2-22b0-6c1b-0551e024d7a6@arm.com>

On 14/09/17 19:20, Julien Grall wrote:
> Hi Juergen,
> 
> On 13/09/17 16:46, Juergen Gross wrote:
>> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
>> index 00ff075bd9..a462ea7905 100644
>> --- a/xen/common/grant_table.c
>> +++ b/xen/common/grant_table.c
>> @@ -3608,6 +3608,44 @@ int mem_sharing_gref_to_gfn(struct grant_table
>> *gt, grant_ref_t ref,
>>   }
>>   #endif
>>   +int gnttab_map_frame(struct domain *d, unsigned long idx, gfn_t gfn,
>> +                     mfn_t *mfn)
>> +{
>> +    int rc = 0;
>> +    struct grant_table *gt = d->grant_table;
>> +
>> +    grant_write_lock(gt);
>> +
>> +    if ( gt->gt_version == 0 )
>> +        gt->gt_version = 1;
>> +
>> +    if ( gt->gt_version == 2 &&
>> +         (idx & XENMAPIDX_grant_table_status) )
>> +    {
>> +        idx &= ~XENMAPIDX_grant_table_status;
>> +        if ( idx < nr_status_frames(gt) )
>> +            *mfn = _mfn(virt_to_mfn(gt->status[idx]));
>> +        else
>> +            rc = -EINVAL;
>> +    }
>> +    else
>> +    {
>> +        if ( (idx >= nr_grant_frames(gt)) && (idx < max_grant_frames) )
>> +            gnttab_grow_table(d, idx + 1);
>> +
>> +        if ( idx < nr_grant_frames(gt) )
>> +            *mfn = _mfn(virt_to_mfn(gt->shared_raw[idx]));
>> +        else
>> +            rc = -EINVAL;
>> +    }
>> +
>> +    gnttab_set_frame_gfn(d, idx, gfn);
> 
> This code is slightly different compare to the ARM implementation. The
> gfn is now set even if the rc is non-zero (i.e invalid MFN on the ARM
> implementation).
> 
> So I think you need to protect gnttab_set_frame_gfn with if ( !rc ).

Right, thanks for noticing.


Juergen

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

  reply	other threads:[~2017-09-15  7:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170913154651.2366-1-jgross@suse.com>
     [not found] ` <20170913154651.2366-5-jgross@suse.com>
2017-09-13 17:32   ` [PATCH v6 04/12] xen: add new domctl hypercall to set grant table resource limits Daniel De Graaf
     [not found] ` <20170913154651.2366-10-jgross@suse.com>
2017-09-14  5:41   ` [PATCH v6 09/12] xen: delay allocation of grant table sub structures Juergen Gross
     [not found] ` <20170913154651.2366-12-jgross@suse.com>
2017-09-14  5:42   ` [PATCH v6 11/12] xen: make grant resource limits per domain Juergen Gross
     [not found] ` <20170913154651.2366-3-jgross@suse.com>
2017-09-14 17:20   ` [PATCH v6 02/12] xen: move XENMAPSPACE_grant_table code into grant_table.c Julien Grall
2017-09-15  7:25     ` Juergen Gross [this message]
     [not found] ` <20170913154651.2366-11-jgross@suse.com>
2017-09-14 17:31   ` [PATCH v6 10/12] xen/arm: move arch specific grant table bits " Julien Grall
2017-09-15  7:22     ` Juergen Gross
2017-09-15  8:49       ` Julien Grall
2017-09-15  9:21         ` Juergen Gross
     [not found] ` <20170913154651.2366-2-jgross@suse.com>
2017-09-13 16:01   ` [PATCH v6 01/12] xen: correct gnttab_get_status_frames() Paul Durrant
2017-09-13 16:58     ` Juergen Gross
2017-09-13 17:36       ` Paul Durrant
2017-09-18 15:02   ` Wei Liu
     [not found] ` <20170913154651.2366-7-jgross@suse.com>
2017-09-18 15:22   ` [PATCH v6 06/12] tools: set grant limits for xenstore stubdom Wei Liu

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=b9fb9762-6c99-dd54-a3b9-43613b49255d@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --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).