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/
Home Products Support Community News


[Xen-devel] Re: [PATCH] mem_sharing: fix race condition of nominate and

To: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] mem_sharing: fix race condition of nominate and unshare
From: Jui-Hao Chiang <juihaochiang@xxxxxxxxx>
Date: Thu, 13 Jan 2011 23:24:59 +0800
Cc: MaoXiaoyun <tinnycloud@xxxxxxxxxxx>, xen devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 13 Jan 2011 07:25:48 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ZmTEF5iYPvkwqWbLfOWq40+G4kV2f2elH4NXSWazEaw=; b=FboO+58c6D6pis2lrQUvg3SpfeyXPdYj2Ke6MC/jfo1HP8oIEzPw0/dOHC4lwNP7QW huO/PwEzEukbQLemDgrdSTYFlpyqUoJ1JeUZIwaEfw34ZTeqil0xTwg63vBpuSQl2s5n V8Qm5d6fdiOP94RmgSOwYrl2Jkf+d+tZpsC5s=
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=lS2SsBYAaDhEOAQROPJXaoqMTTH6IaSI4PLPROiG0ljDOf8wqSPfdgHrJi0xuAvv4M +6w1w6XL6pg/9MqYj/t3denvuDWClCjgb4Po+X/9s4yGtGxSeo8LxbnTcecUUEmDcofZ jvSqlRMCILCMMqWRzf1DlAOuM+uaI9y//LiPg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110113092427.GJ5651@xxxxxxxxxxxxxxxxxxxxxxx>
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: <AANLkTinmpiusLqegGZA+bZWpDXPM+7Wq2nt8MZa0Ocet@xxxxxxxxxxxxxx> <AANLkTinf-A_4NEPQeCw0pftM5Bks8BYPRhMx3-stTHxa@xxxxxxxxxxxxxx> <BLU157-ds1E01DEBE18840E5FBB6D1DA0E0@xxxxxxx> <AANLkTikBaB5awvRu3Sn3WfuoS3LRmeBH=pG8c7H1n4Cw@xxxxxxxxxxxxxx> <AANLkTinoXve=zBzB9qN1qXRz+iJmhiQ+-gB7MwFoY5Dg@xxxxxxxxxxxxxx> <20110112105405.GH5651@xxxxxxxxxxxxxxxxxxxxxxx> <BLU157-w59C63325262D0BE99E6C43DAF10@xxxxxxx> <20110112140223.GI5651@xxxxxxxxxxxxxxxxxxxxxxx> <BLU157-w1861EFE53CB51FC710011FDAF10@xxxxxxx> <AANLkTimOz_uauDEnu_XaPEgwD1EZJWEgOO1oiFccFNs1@xxxxxxxxxxxxxx> <20110113092427.GJ5651@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi, Tim:

>> (2) The major problem is the __put_page_type() never handle the
>> special case for shared pages.
>> If the (1) is changed as I said, the problem still exists as the following
>> /* Before nominating domain 1, gfn 0x63 */
>> (XEN) Debug for domain=1, gfn=63, Debug page: MFN=4836c7 is
>> ci=8000000000000002, ti=0, owner_id=1
>> /* After a failed nominate  [desired: ci=8000000000000002, ti=0]*/
>> (XEN) Debug for domain=1, gfn=63, Debug page: MFN=4836c7 is
>> ci=8000000000000002, ti=8400000000000000, owner_id=1
> Is this causing a real problem other than this printout?
> One of the reasons to use get_page_and_type/put_page_and_type was that
> it gets rid of the code that requires pages to have PGT_none before
> they're shared.
> As I have been trying to explain, when a page has typecount 0 its type
> is only relevant for the TLB flushing logic.  If there's still a place
> in the page-sharing code that relies on (type == PGT_none && count == 0)
> then AFAICS that's a bug.

Thanks for the clarification. As you said, the following is excerpted
from the mm.c
"* So, type_count is a count of the number of times a frame is being
 * referred to in its current incarnation. Therefore, a page can only
 * change its type when its type count is zero."

After testing the code with your patch, it's ok for the mem_sharing.
And as the argument says, when (type_count & PGT_count_mask) is zero,
it's ok for changing the page type. (even when there is a old value in
type_count & PGT_type_mask, e.g., ti=8400000000000000)


Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>