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: [Xen-devel] [PATCH] Do not set page's count_info directly

To: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Do not set page's count_info directly
From: Gianluca Guida <glguida@xxxxxxxxx>
Date: Thu, 5 Mar 2009 13:32:38 +0100
Cc: Gianluca.guida@xxxxxxxxxxxxx, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Delivery-date: Thu, 05 Mar 2009 04:33:03 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=yurs4dcT+nkm8p0O5n91vUbh2rguainXVANn1zpTtVI=; b=knNvaJZW+vJj7bogUlD9g16MeZW0pBS8Urd0oDsqTen5+kGS5a9v+DgqZSWm3HEMWG c0lOnYH3Ob1rnWkfSiVVB8gS1MJhgbQz/vz3c5eLiRh5nIVD2zeLwbTG31wr/fsSwnA/ tiU/pVgUQ4NXL/LTmMVOunYpJAbiaByw3JTZ4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=xjp5xUIAk43aGhtobFOOQ25V4deEKNOpnSB5aYRQpKEUngoWSKoVPqD9ijhFXrENmQ fhBzcjT88aBAy04kNBPTKGqnaJ+2ejA6SenY9KRZkwEQ+bFkKj7hPCywLAwJS24e5Qdl txLwwEd7YMkWWjPdejrGg1MGJbd9NTdWEHASM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <E2263E4A5B2284449EEBD0AAB751098401C7CE8E0E@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E2263E4A5B2284449EEBD0AAB751098401C7CE8E0E@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, Mar 5, 2009 at 10:11 AM, Jiang, Yunhong <yunhong.jiang@xxxxxxxxx> wrote:
> Page offline patch add several flag to page_info->count_info. However, 
> currently some code will try to set count_info after alloc_domheap_pages 
> without using "&" or "|" operation, this may cause the new flags lost, since 
> there are no protection. This patch try to make sure all write to count_info 
> will only impact specific field.

Hm, wouldn't be better to add some comments in mm.h or do this through
a macro? I think that one would normally tend to suppose, after you
allocate a page, that the count_info is all yours to set. It usually
is, since the offlining should be a rare event (I hope?), so catching
this kind of bug would be very hard, and make the whole mechanism very
fragile.

> Also currently shadow code assume count_info is 0 for shadow page, however, 
> this is invalid after the new flags. Change some assert in shadow code.

Yes, that's correct. I find, though, (count_info & PGC_count_mask !=
0) as a check if the page is a shadow *very* confusing. Could you
define a macro with something like page_is_a_shadow_page() and hide
this mm.c dirty secret?

Thanks,
Gianluca

-- 
It was a type of people I did not know, I found them very strange and
they did not inspire confidence at all. Later I learned that I had been
introduced to electronic engineers.
                                                  E. W. Dijkstra

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