From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70EFDC433B4 for ; Tue, 18 May 2021 09:45:59 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3582461184 for ; Tue, 18 May 2021 09:45:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3582461184 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.128995.242135 (Exim 4.92) (envelope-from ) id 1liwIG-0007lB-5C; Tue, 18 May 2021 09:45:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 128995.242135; Tue, 18 May 2021 09:45:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1liwIG-0007l4-28; Tue, 18 May 2021 09:45:40 +0000 Received: by outflank-mailman (input) for mailman id 128995; Tue, 18 May 2021 09:45:38 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1liwIE-0007kw-Sv for xen-devel@lists.xenproject.org; Tue, 18 May 2021 09:45:38 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1liwIE-0007xr-Mw; Tue, 18 May 2021 09:45:38 +0000 Received: from [54.239.6.190] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1liwIE-0006WW-HA; Tue, 18 May 2021 09:45:38 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=s+1ASYDTgKbn0iWzEQV8ALRZyiGQ0s1pFIA8eajwG8s=; b=KOlehsTrTQ1iwT/AdUByONkJhn ybzWLipvsHkD7MfNDs7tcpizWlg77b3mZMvvYGwJ4LWMCEABV/XCkBSSW0CPPKLKqWIBbskpAye40 Zryg8Yaocap6QVuXYPGkcXlSznkfUKD+WGZI8s5XoZAs7HM9FbmjajEOCj5Fm2QqdbN4=; Subject: Re: [PATCH 03/10] xen/arm: introduce PGC_reserved To: Penny Zheng , xen-devel@lists.xenproject.org, sstabellini@kernel.org Cc: Bertrand.Marquis@arm.com, Wei.Chen@arm.com, nd@arm.com References: <20210518052113.725808-1-penny.zheng@arm.com> <20210518052113.725808-4-penny.zheng@arm.com> From: Julien Grall Message-ID: Date: Tue, 18 May 2021 10:45:36 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210518052113.725808-4-penny.zheng@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit On 18/05/2021 06:21, Penny Zheng wrote: > In order to differentiate pages of static memory, from those allocated from > heap, this patch introduces a new page flag PGC_reserved to tell. > > New struct reserved in struct page_info is to describe reserved page info, > that is, which specific domain this page is reserved to. > > Helper page_get_reserved_owner and page_set_reserved_owner are > designated to get/set reserved page's owner. > > Struct domain is enlarged to more than PAGE_SIZE, due to newly-imported > struct reserved in struct page_info. struct domain may embed a pointer to a struct page_info but never directly embed the structure. So can you clarify what you mean? > > Signed-off-by: Penny Zheng > --- > xen/include/asm-arm/mm.h | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h > index 0b7de3102e..d8922fd5db 100644 > --- a/xen/include/asm-arm/mm.h > +++ b/xen/include/asm-arm/mm.h > @@ -88,7 +88,15 @@ struct page_info > */ > u32 tlbflush_timestamp; > }; > - u64 pad; > + > + /* Page is reserved. */ > + struct { > + /* > + * Reserved Owner of this page, > + * if this page is reserved to a specific domain. > + */ > + struct domain *domain; > + } reserved; The space in page_info is quite tight, so I would like to avoid introducing new fields unless we can't get away from it. In this case, it is not clear why we need to differentiate the "Owner" vs the "Reserved Owner". It might be clearer if this change is folded in the first user of the field. As an aside, for 32-bit Arm, you need to add a 4-byte padding. > }; > > #define PG_shift(idx) (BITS_PER_LONG - (idx)) > @@ -108,6 +116,9 @@ struct page_info > /* Page is Xen heap? */ > #define _PGC_xen_heap PG_shift(2) > #define PGC_xen_heap PG_mask(1, 2) > + /* Page is reserved, referring static memory */ I would drop the second part of the sentence because the flag could be used for other purpose. One example is reserved memory when Live Updating. > +#define _PGC_reserved PG_shift(3) > +#define PGC_reserved PG_mask(1, 3) > /* ... */ > /* Page is broken? */ > #define _PGC_broken PG_shift(7) > @@ -161,6 +172,9 @@ extern unsigned long xenheap_base_pdx; > #define page_get_owner(_p) (_p)->v.inuse.domain > #define page_set_owner(_p,_d) ((_p)->v.inuse.domain = (_d)) > > +#define page_get_reserved_owner(_p) (_p)->reserved.domain > +#define page_set_reserved_owner(_p,_d) ((_p)->reserved.domain = (_d)) > + > #define maddr_get_owner(ma) (page_get_owner(maddr_to_page((ma)))) > > #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) > Cheers, -- Julien Grall