From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>, David Vrabel <david.vrabel@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Christoph Egger <chegger@amazon.de>, Tim Deegan <tim@xen.org>,
MattWilson <msw@amazon.com>,
xen-devel@lists.xenproject.org,
Malcolm Crossley <malcolm.crossley@citrix.com>
Subject: Re: [PATCHv8 1/3] gnttab: Introduce rwlock to protect updates to grant table state
Date: Tue, 19 May 2015 14:20:54 +0100 [thread overview]
Message-ID: <555B38B6.8080708@citrix.com> (raw)
In-Reply-To: <555B0A3D020000780007B755@mail.emea.novell.com>
On 19/05/15 09:02, Jan Beulich wrote:
>
> Which then of course raises the question - is taking the read lock
> here and in several other places really sufficient? The thing that the
> original spin lock appears to protect here is not only the grant table
> structure itself, but also the active entry. I.e. relaxing to a read
> lock would seem possible only after having put per-active-entry
> locking in place.
Yes, this series was split the wrong way round. I could:
a) squash the first two patches back together;
b) refactor the first two patches into
- introduce active entry locks
- introduce maptrack lock
- convert grant table lock to rw lock.
Which approach is preferred (obviously (a) is a lot less work)?
>> @@ -64,6 +64,11 @@ struct grant_mapping {
>>
>> /* Per-domain grant information. */
>> struct grant_table {
>> + /*
>> + * Lock protecting updates to grant table state (version, active
>> + * entry list, etc.)
>> + */
>> + rwlock_t lock;
>> /* Table size. Number of frames shared with guest */
>> unsigned int nr_grant_frames;
>> /* Shared grant table (see include/public/grant_table.h). */
>> @@ -82,8 +87,8 @@ struct grant_table {
>> struct grant_mapping **maptrack;
>> unsigned int maptrack_head;
>> unsigned int maptrack_limit;
>> - /* Lock protecting updates to active and shared grant tables. */
>> - spinlock_t lock;
>> + /* Lock protecting the maptrack page list, head, and limit */
>> + spinlock_t maptrack_lock;
>> /* The defined versions are 1 and 2. Set to 0 if we don't know
>> what version to use yet. */
>> unsigned gt_version;
>
> So in order for fields protected by one of the locks to be as likely
> as possible on the same cache line as the lock itself, I think
> gt_version should also be moved up in the structure. We may
> even want/need to add some separator between basic and
> maptrack data to ensure they end up on different cache lines.
I think this sort of structure field shuffling should be a follow on patch.
David
next prev parent reply other threads:[~2015-05-19 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 14:15 [PATCHv8 0/3] gnttab: Improve scaleability David Vrabel
2015-05-12 14:15 ` [PATCHv8 1/3] gnttab: Introduce rwlock to protect updates to grant table state David Vrabel
2015-05-19 8:02 ` Jan Beulich
2015-05-19 13:20 ` David Vrabel [this message]
2015-05-19 13:31 ` Jan Beulich
2015-05-12 14:15 ` [PATCHv8 2/3] gnttab: per-active entry locking David Vrabel
2015-05-19 8:27 ` Jan Beulich
2015-05-19 13:46 ` David Vrabel
2015-05-12 14:15 ` [PATCHv8 3/3] gnttab: use per-VCPU maptrack free lists David Vrabel
2015-05-19 7:36 ` [PATCHv8 0/3] gnttab: Improve scaleability 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=555B38B6.8080708@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--cc=chegger@amazon.de \
--cc=ian.campbell@citrix.com \
--cc=keir@xen.org \
--cc=malcolm.crossley@citrix.com \
--cc=msw@amazon.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.