WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [XenPPC] Re: [Xen-devel] [PATCH] [GNTTAB] expandable grant table

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [XenPPC] Re: [Xen-devel] [PATCH] [GNTTAB] expandable grant table
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Mon, 26 Feb 2007 18:05:18 -0600
Cc: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx, Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir@xxxxxxxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 26 Feb 2007 16:05:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C2092024.2B66%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <C2092024.2B66%Keir.Fraser@xxxxxxxxxxxx>
Reply-to: Hollis Blanchard <hollisb@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Mon, 2007-02-26 at 23:39 +0000, Keir Fraser wrote:
> On 26/2/07 23:31, "Hollis Blanchard" <hollisb@xxxxxxxxxx> wrote:
> 
> > 
> > Hi Yamahata-san, thanks very much for your patch!
> > 
> > I'm confused about one thing though: why do we need to take a lock to
> > read d->grant_table->nr_grant_frames? It's a simple integer, so no lock
> > is required or useful.
> 
> I haven't got the ppc code immediately to hand but the x86 code will
> dynamically grow the grant table based on requests made via the
> add_to_physmap hypercall, hence it needs to take the lock.

OK, I see x86's XENMAPSPACE_grant_table handler; the locking makes sense
there.

> I see ia64 takes
> it also even though it only reads from nr_grant_frames (it won;t dynamically
> expand via the add_to_physmap hypercall). That's possibly overkill although
> there is some concern over reading nr_grant_frames versus looking up a
> grant-table page that appears within the range [0, nr_grant_frames-1] which
> taking the lock trivially sidesteps. If ia64 didn't take the lock it might
> be possible to see an increased value of nr_grant_frames that the expand
> function hadn't yet fully installed the new grant-table pages for yet.

I don't believe that's a concern, since updating
grant_table->nr_grant_frames is the very last step in
gnttab_grow_table(), and it will only grow.

The comments about locking around nr_grant_frames() and
nr_grant_entries() are confusing at best, since you don't need a lock to
read an integer...

-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel