From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
Malcolm Crossley <malcolm.crossley@citrix.com>,
Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCHv11 3/4] gnttab: make the grant table lock a read-write lock
Date: Fri, 5 Jun 2015 15:39:12 +0100 [thread overview]
Message-ID: <5571B490.9080703@citrix.com> (raw)
In-Reply-To: <5571CFA20200007800081714@mail.emea.novell.com>
On 05/06/15 15:34, Jan Beulich wrote:
>>>> On 02.06.15 at 18:26, <david.vrabel@citrix.com> wrote:
>> @@ -970,9 +988,10 @@ __gnttab_unmap_common(
>> TRACE_1D(TRC_MEM_PAGE_GRANT_UNMAP, dom);
>>
>> rgt = rd->grant_table;
>> - double_gt_lock(lgt, rgt);
>>
>> - op->flags = op->map->flags;
>> + read_lock(&rgt->lock);
>> +
>> + op->flags = read_atomic(&op->map->flags);
>> if ( unlikely(!op->flags) || unlikely(op->map->domid != dom) )
>> {
>> gdprintk(XENLOG_WARNING, "Unstable handle %u\n", op->handle);
>> @@ -1019,31 +1038,34 @@ __gnttab_unmap_common(
>> act->pin -= GNTPIN_hstw_inc;
>> }
>>
>> - if ( gnttab_need_iommu_mapping(ld) )
>> + act_release_out:
>> + active_entry_release(act);
>> + unmap_out:
>> + read_unlock(&rgt->lock);
>
> Trying to answer the question on what protects the maptrack
> entries: With the flags check done first and, after initial setup, the
> ref field never changing, all modifications of flags as well as the
> decision whether to drop the maptrack handle appear to be guarded
> by ref's active entry lock. I think this is implicit enough to require
> being properly spelled out somewhere.
>
> Together with struct grant_mapping not being used elsewhere (I
> just now created a patch to make this more explicit by moving its
> declaration to the C file) I think this addresses that particular
> concern. If you agree, feel free to add
Yes, this was exactly my reasoning. I shall improve the docs/comments
to make this clearer in v12.
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Thanks!
David
next prev parent reply other threads:[~2015-06-05 14:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 16:26 [PATCHv11 0/4] gnttab: Improve scaleability David Vrabel
2015-06-02 16:26 ` [PATCHv11 1/4] gnttab: per-active entry locking David Vrabel
2015-06-05 13:32 ` Jan Beulich
2015-06-05 13:41 ` David Vrabel
2015-06-05 14:37 ` Jan Beulich
2015-06-02 16:26 ` [PATCHv11 2/4] gnttab: introduce maptrack lock David Vrabel
2015-06-05 13:35 ` Jan Beulich
2015-06-05 13:44 ` David Vrabel
2015-06-05 14:38 ` Jan Beulich
2015-06-05 14:41 ` David Vrabel
2015-06-02 16:26 ` [PATCHv11 3/4] gnttab: make the grant table lock a read-write lock David Vrabel
2015-06-05 14:34 ` Jan Beulich
2015-06-05 14:39 ` David Vrabel [this message]
2015-06-02 16:26 ` [PATCHv11 4/4] gnttab: use per-VCPU maptrack free lists David Vrabel
2015-06-03 9:00 ` David Vrabel
2015-06-05 14:51 ` Jan Beulich
2015-06-05 15:55 ` David Vrabel
2015-06-05 16:11 ` Jan Beulich
2015-06-05 16:42 ` David Vrabel
2015-06-08 6:54 ` Jan Beulich
2015-06-11 15:28 ` Tim Deegan
2015-06-12 7:00 ` Jan Beulich
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=5571B490.9080703@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=malcolm.crossley@citrix.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.