From nobody Fri May 17 05:26:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1650284646; cv=pass; d=zohomail.com; s=zohoarc; b=DssTgPmRb86FQsvuuVTflmqg1pdM2Qy4IZ84e8iA6KYB4wQOgu3CqhKiTS58m+uUowdD1kDZpVhSoTHGncdl7RPW8rN8L9SpSt+3tsAQqa79wrSU9ti/wd/nfNBfEsqxp/ZTqSqean3iZ+o0mNxNNmlPTZEEfKK/lQBa9zCsGzM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650284646; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TVQetJuWhfla6PNj0JS8SWxjHJNlo5AFHEjQX+4a0Lw=; b=YTV34DTW+Iw5AIW1g44lQay6BsVeSRT7bViS9znknQvnCFlVqybVluGD1w+rN6Ex0DI9MCF2pTdsbCAacrzdF5o/51RXh5+CNFrJI9S2dmx3FyeVuemtodl99xGCumWs1cqsTit/3d5TARyBYau9SaYekO8DaLlk3SsC1kpG+JI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1650284646414189.83019286602564; Mon, 18 Apr 2022 05:24:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.307191.522499 (Exim 4.92) (envelope-from ) id 1ngQPv-0002u0-OB; Mon, 18 Apr 2022 12:23:43 +0000 Received: by outflank-mailman (output) from mailman id 307191.522499; Mon, 18 Apr 2022 12:23:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQPv-0002ts-KZ; Mon, 18 Apr 2022 12:23:43 +0000 Received: by outflank-mailman (input) for mailman id 307191; Mon, 18 Apr 2022 12:23:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQPt-0002c3-JV for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 12:23:41 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0629.outbound.protection.outlook.com [2a01:111:f400:fe0c::629]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 60e10c57-bf12-11ec-a405-831a346695d4; Mon, 18 Apr 2022 14:23:40 +0200 (CEST) Received: from DB6PR0601CA0043.eurprd06.prod.outlook.com (2603:10a6:4:17::29) by AM0PR08MB5474.eurprd08.prod.outlook.com (2603:10a6:208:187::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 12:23:38 +0000 Received: from DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:17:cafe::14) by DB6PR0601CA0043.outlook.office365.com (2603:10a6:4:17::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Mon, 18 Apr 2022 12:23:37 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT060.mail.protection.outlook.com (10.152.21.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:37 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Mon, 18 Apr 2022 12:23:37 +0000 Received: from a8fc1654a874.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C85D2999-8FFD-4078-A829-6B8863DA15D5.1; Mon, 18 Apr 2022 12:23:30 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a8fc1654a874.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 12:23:30 +0000 Received: from AS9PR06CA0110.eurprd06.prod.outlook.com (2603:10a6:20b:465::29) by DBBPR08MB4458.eurprd08.prod.outlook.com (2603:10a6:10:c8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:16 +0000 Received: from VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:465:cafe::ed) by AS9PR06CA0110.outlook.office365.com (2603:10a6:20b:465::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:15 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT028.mail.protection.outlook.com (10.152.18.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:15 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:11 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 12:23:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 60e10c57-bf12-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TVQetJuWhfla6PNj0JS8SWxjHJNlo5AFHEjQX+4a0Lw=; b=lNkNZueafa1r82+6Wfv37bHAv6HTYX35lMDpf2fvhu1TK0W6ZrFyqUdm5+3qZTFVEAzvIX/hE91eGSYYpOk9Ysu8dNb0LqPYIEr8Sh07ECoIFxKj3QX5Q1Cn7YZCR9ewOYMajMVAuQpnagSdOkadDpDJC0kBSH1gq22wAffb1vk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 0c2d8033ba52ada8 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kpa8zWvqRKZa7pQ4AECf3K18vcoNb5ntfSm+zpqbZL5hRDwuV+iZJzoXJm5Gnjocek/CiyyUDTRKoRlfJlfXV9dg8MHcVLpV1040D7jYR3rWvmJ2qdpiMOuDOdLIrMjMIZ2ZFOxCDQ8HAuxg3MWKdSWlOiRF6UOAuhVzAc5D9OK78R+eR7XYLLq4Ed+uHVP6XRKXwfvBx42h/NkhtlpMlPsCBUaHyVmMmvFjnyiwlaoodhs8h2nIS9DKnBVBLR8jHpW0SFpsWNaBri0BqhcxNytA7GO8lBsADu+c5KPMeyetZ+b7wRCX+ogjdBfBya0lXH+YChyyiqrsHeIo+/TVFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TVQetJuWhfla6PNj0JS8SWxjHJNlo5AFHEjQX+4a0Lw=; b=UNIRTC2XwI+u7M9pj22U/BWjCPgq4tLdCIf3lPSFagSLsyBHOvGx8jbOXBoqLupIYWwZvX5q79kr1XAJhtGg/vV5fvaVQa9qa7+Ml9Q4xH29ZVxJwefqQ71lESrjAogxD7+ZjZd0of1FdG++OcKhp6kTDlElyjd1kcdMwZQj21AJjIKIX54zo34YVAGSheKw0YQkOyBXFLQEGwh+7+TDRqDiek9dwRfo78HFFCnQr5SkPUgPMGUNqjeCs99sUakaSrrq9xIUcv8bcpiDRV/Cpb6AqY1fhqMo4xflTK0SrgDnmP60ri94o1Zb7Ug1SMD36geKtzQdgq5ddEpPv5bpuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TVQetJuWhfla6PNj0JS8SWxjHJNlo5AFHEjQX+4a0Lw=; b=lNkNZueafa1r82+6Wfv37bHAv6HTYX35lMDpf2fvhu1TK0W6ZrFyqUdm5+3qZTFVEAzvIX/hE91eGSYYpOk9Ysu8dNb0LqPYIEr8Sh07ECoIFxKj3QX5Q1Cn7YZCR9ewOYMajMVAuQpnagSdOkadDpDJC0kBSH1gq22wAffb1vk= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , Penny Zheng , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu , Penny Zheng Subject: [PATCH v2 1/6] xen/arm: do not free reserved memory into heap Date: Mon, 18 Apr 2022 20:22:46 +0800 Message-ID: <20220418122251.3583049-2-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418122251.3583049-1-Penny.Zheng@arm.com> References: <20220418122251.3583049-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 357b6f0c-3161-4241-ebea-08da213643b9 X-MS-TrafficTypeDiagnostic: DBBPR08MB4458:EE_|DB5EUR03FT060:EE_|AM0PR08MB5474:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: IxurwQ1CQavmlIrI8U3eRmgIvuhwToBh/0G4jEjR9rFbOv8mq62GHuKZuV8nsJ1vqidLGwv4qEoZSrgW+5JpQ2nnf+4lh33mfW+KQnSofOIeZZyoac2ubh4pf+6dPqlIFmprhJUvLHb/TBA7hiQMVM93kNFIfCWVNlFP+jp3s/pnhVrkBJxepgFSblIzpbpWkoudyxqVNvQSxhI2n0sYbKvG0o1pV7x5kFSNiFXhIzEL/5kAxt1k0RrBVDun+J713vS6qDr6j1XhC+td5iPMEjewyIfpj2XZnVK0M3czcBUrmgWRSErzWlKTa5q+tyfVoF1qZy3w6Eghqp3vKubE7vOPq9Z3fFghEwZV/o6oedCG5CUKU5PQ9yYQXxtkrp7VdUBcM1QBxEr/eSpCVMlDjlT9/YkzIUhFWQbGlZkn3iDcuf2WdRATogMf5fq3vtvspK6e9px29f8VogdqJBhenNxm7LCuyy/aYBt/hqGyS3SWUAXixVe6fdZ7e3e2ysJpxRexB2ftWds5eNZDL+L5eXXfZ/5ehXfdP4HzavAqYu0Td6tJbKCm4RjsJ4slz0o1WkvJWUrNNcOjPmJSBuMaaB1Jzb1xwPhwQF2sQmrb9vIoTaO39xA5xZOYQqCc/l1nsbd6qyqMI1ZrNcCLFRXN9afbKLzmSZSORzY0NV4wrh/dbqu+Upzcv3HuSF+d1Awpbx48tiasp0Rp2OfUxxQZWA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(426003)(26005)(86362001)(36756003)(83380400001)(336012)(5660300002)(54906003)(356005)(70206006)(70586007)(186003)(6916009)(2906002)(6666004)(1076003)(2616005)(40460700003)(47076005)(7696005)(82310400005)(316002)(36860700001)(81166007)(4326008)(8676002)(8936002)(508600001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4458 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 231a9c3f-ecac-47a8-8f80-08da213636b8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jHMtAGm645GbQ8H4TlrlHTr1bQSbmtCY5Qu+1iUhmPr6Xn13WL0wuBI1ijkb048Qtchq5nuLIbpj6wxYzedV8ZhrZR673m2v4VL/YiPo+oNz/RXSgK6Fcf6gWtyYowvICgoEmDic5Q0PXo67QyB3H4/JYYUhD2OhbDtEetlKDNcVA843fBe5kzbf05GUNBUH9PykkQaVdxWVqycMUg60zTQOLsSVshXKMqbehc9kR5V7ndJNz02XGjJ8KLPqAiMg9Wed6jtA7p94GJxGcNgnFbHqSTmyvwQTo08RzeW+38laA/pCp7SytzpiElKigDx7eAsO1FYP+W6GSnCqHmu6XHIcIleKVxD3oWwZq4o7YuXmEbOmeQsxLyjSeZE/3H/Az5D4G4PBeEOv0G7vOD13XeyWcAfYUOIWKof2GMwARdkAZ7YziW3veP+1zlLsIZZKe33Y+n/vR1C4noa2QOPSdH504ddwbAEEo/YUNym1zkEdqL15xqviB9Bm2ESJd3ZHW2yqLEyYZ0HGdrB3BX0nH9BfUUAKCZsWqTosgnY1+tyfUoJ/HBYvKX0y6YSDlT9Iu9VsXbuXDn7Zr+C6vkXdHyyt0DVfHgwdIvz7ndQM7R52sVHwsB5p9Qs1vzsu3DYVmkL10os6qfWgLr1mAh5/HvxyMADX5+zzm1jJ1UVaAY+5Dkk33ei2c2Cm6n6usYHS X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(2616005)(1076003)(82310400005)(7696005)(2906002)(26005)(6666004)(86362001)(8936002)(336012)(426003)(47076005)(508600001)(186003)(40460700003)(316002)(5660300002)(83380400001)(6916009)(81166007)(54906003)(36756003)(70586007)(70206006)(4326008)(36860700001)(8676002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 12:23:37.4555 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 357b6f0c-3161-4241-ebea-08da213643b9 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5474 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1650284647913100003 Content-Type: text/plain; charset="utf-8" Pages as guest RAM for static domain, shall be reserved to this domain only. So in case reserved pages being used for other purpose, users shall not free them back to heap, even when last ref gets dropped. free_staticmem_pages will be called by free_domheap_pages in runtime for static domain freeing memory resource, so let's drop the __init flag. Signed-off-by: Penny Zheng --- v2 changes: - new commit --- xen/common/page_alloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 319029140f..9a3e9c1328 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -2488,7 +2488,13 @@ void free_domheap_pages(struct page_info *pg, unsign= ed int order) scrub =3D 1; } =20 - free_heap_pages(pg, order, scrub); +#ifdef CONFIG_STATIC_MEMORY + if ( pg->count_info & PGC_reserved ) + /* Reserved page shall not go back to the heap. */ + free_staticmem_pages(pg, 1 << order, scrub); + else +#endif + free_heap_pages(pg, order, scrub); } =20 if ( drop_dom_ref ) @@ -2636,7 +2642,7 @@ struct domain *get_pg_owner(domid_t domid) =20 #ifdef CONFIG_STATIC_MEMORY /* Equivalent of free_heap_pages to free nr_mfns pages of static memory. */ -void __init free_staticmem_pages(struct page_info *pg, unsigned long nr_mf= ns, +void free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns, bool need_scrub) { mfn_t mfn =3D page_to_mfn(pg); --=20 2.25.1 From nobody Fri May 17 05:26:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1650284645; cv=pass; d=zohomail.com; s=zohoarc; b=Cp1pK77iw4DsW4WGK7lvlAENTIuvc69houkN4SpDXpjRWrPNHvRSG4h1nBlEjZ0RVC9KauUqtwL/cN3216ou1lg+Q9F6hSJ+PjnfU1XW4PUUIzmWXkqFPAuX2Lu/CA0mjlY4XRaG7WGe9/XidFLOzvVOzQQU1mk7dLXdWNPFW1g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650284645; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VsBClypD3Wkaou4TbtLWlS8ixNFn1OaoB4eWjjlhZLY=; b=bsZdsQQLLESlC3paeYrw9SYIekl11i7W0YMm8es2eRxTDlsCXtvGfZ6+SSlfpq5Zji9js5hTOpgV+p1KcFv/gvr0K3D8zgWd18qpVLPcBVgYGCzFU5m0e/W3mxS0xk3bd8DTjGCwXdzx05Q+scwCyvqzuPMQzhc/NO1vS9X0Vxw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1650284645269807.1933701517736; Mon, 18 Apr 2022 05:24:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.307190.522488 (Exim 4.92) (envelope-from ) id 1ngQPu-0002d1-DC; Mon, 18 Apr 2022 12:23:42 +0000 Received: by outflank-mailman (output) from mailman id 307190.522488; Mon, 18 Apr 2022 12:23:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQPu-0002cu-92; Mon, 18 Apr 2022 12:23:42 +0000 Received: by outflank-mailman (input) for mailman id 307190; Mon, 18 Apr 2022 12:23:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQPs-0002c3-Qa for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 12:23:40 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0604.outbound.protection.outlook.com [2a01:111:f400:fe0a::604]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5f1db000-bf12-11ec-a405-831a346695d4; Mon, 18 Apr 2022 14:23:39 +0200 (CEST) Received: from AM6P192CA0005.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::18) by VI1PR08MB4208.eurprd08.prod.outlook.com (2603:10a6:803:ec::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:33 +0000 Received: from AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:83:cafe::85) by AM6P192CA0005.outlook.office365.com (2603:10a6:209:83::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 12:23:33 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT063.mail.protection.outlook.com (10.152.16.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:32 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Mon, 18 Apr 2022 12:23:32 +0000 Received: from 004be2d42b56.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A3F84FA2-5A5B-42EB-8079-4A7752AE7F25.1; Mon, 18 Apr 2022 12:23:26 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 004be2d42b56.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 12:23:26 +0000 Received: from AM6P193CA0094.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::35) by VI1PR08MB4623.eurprd08.prod.outlook.com (2603:10a6:803:b8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.25; Mon, 18 Apr 2022 12:23:22 +0000 Received: from VE1EUR03FT019.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::c1) by AM6P193CA0094.outlook.office365.com (2603:10a6:209:88::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.21 via Frontend Transport; Mon, 18 Apr 2022 12:23:22 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT019.mail.protection.outlook.com (10.152.18.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:21 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:20 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 12:23:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 5f1db000-bf12-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VsBClypD3Wkaou4TbtLWlS8ixNFn1OaoB4eWjjlhZLY=; b=XMw0DXRrIiWYDMUlgcUxvWzO33jcuxIrFxUjIkIQG5KMtYpwgB5d7bk/BBXBcoNNEoqvDibZML0a+4lOZuShhHz+RN2vcQDx7gwKCM5BmNgLVvya0Dc8bDInoJcrRXOb3OzY9mgrP++nCqUy4WZAzVC2U3qhTRuUSPiecy/RSNA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: f18c35403e40e7b4 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TuWLliA54m3uLQnWMXGz6AaT4+4IEDItBQEgMCFMI+T7TvHa+HSCO3e3oso/c2LMtJgjplY/qjSRfWnQsaWEuLgzHVOO+sSwyFU+TBLw5YvfNkHrAAcrW1bDb0Bl1frXB4ukKe9YAs6NoFFbTWo65RxfV/76Aji+DBfeUwWr/cfMDQr/hSph2/pnC5gosJoBZuurLG96O8zR9fAq8AMFdx6u6Ch2fdcJii9TYW9RqmJsA827LHHG45wQiCFxNDdVe5AnvRq8x3zuFqUbvr5ndorsNXDrQUNL2Gyok4ir4nQ5xdZONgbkzocWw8w0S1vqmxQjxM6iPJ1Mz/XqoLwvaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VsBClypD3Wkaou4TbtLWlS8ixNFn1OaoB4eWjjlhZLY=; b=Z+4r/H9JyyeKjnw2euYP1/ozHcE8Dn0p/X6hHcUceeq64JrOD7VzCQkAcuOLxy4i/w9aFgSXLKgMQ3xHv1NTF76U2NJnbzP27TnmIIbmxUv9buyD3g6R2k3HdijN2ik2oW6zRD7/KK+xrsOXcO0c0ebtS9FOM9Ny+OCvfRlLHVNVa/TtuA49xQ01aGKl3R78p8aHFIWSCo9h+fWFB9+ys3tRBy1qUkx/KMwt54gNnipDTl9rc26C/1LIQa74FbaZK6FH435rDTdgK7cRCzO8nG/jvv6ph3TN8U1XbNUClBAWIW6QT1iZcHq+nsauDk7cFVDqJuNMl9Jm1ftpfvrj2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VsBClypD3Wkaou4TbtLWlS8ixNFn1OaoB4eWjjlhZLY=; b=XMw0DXRrIiWYDMUlgcUxvWzO33jcuxIrFxUjIkIQG5KMtYpwgB5d7bk/BBXBcoNNEoqvDibZML0a+4lOZuShhHz+RN2vcQDx7gwKCM5BmNgLVvya0Dc8bDInoJcrRXOb3OzY9mgrP++nCqUy4WZAzVC2U3qhTRuUSPiecy/RSNA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , Penny Zheng , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu , Penny Zheng Subject: [PATCH v2 2/6] xen/arm: do not merge reserved pages in free_heap_pages() Date: Mon, 18 Apr 2022 20:22:47 +0800 Message-ID: <20220418122251.3583049-3-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418122251.3583049-1-Penny.Zheng@arm.com> References: <20220418122251.3583049-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 345cdf11-6447-4125-6ccc-08da213640d1 X-MS-TrafficTypeDiagnostic: VI1PR08MB4623:EE_|AM5EUR03FT063:EE_|VI1PR08MB4208:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: DUe8vwslOtQMM3VjM/l2nefFS84nARDr4352AY8d4ixXR1jt8VzU5BCAuYzApb2eSw33RALJzy41Wb5AcCU8zhV/Qau4jxcrfsmh5FgqwALH9lYCnP80qc9m3IAeSF1EpSP3FH15i4/YMVDG467dennqFfy7u0TNz1auL7ZY/Qiq66HtLEW2luBCP4DB1V055GBEsoLmKF8ruPGI0/0qffSiX/kv1kpVDCYvYbOqQVFUnXXFksD906PG0x/dJzGHkTc7gf1ZUhh96jOFohJxFQ8aQhldn/viuBYW2Rix6XzYC3GkYvO2rYr6D2ML/M6bfI1iKKrLnH2aEXsVXzkugNd6SCrU56J7i5lezlj3Dw1WGT4j8pMiue8iReO3UqlcFTAXs3vaV5DQX+tT/t/2MIzgEnC1YkS02vAaBZ8w6vNADRkSWG8viJ6lS6z2fpYL1+5fCJ+ghKE+AJ0CcxBS4wO8TX9Vaq36+69TM1Ovg6oGMWoljzJYLZR0TUsxOKt/p+4i07liob0EOyo8bwoA0P+znRhJatS+A/0atNSxiLEjM+71cXPdxi2Ix/6HrW18CBeIkBOWi9WhUPcOKwh0lZeIUKCK1pIhF7vPu96t+mvBh7jMTQWiCBlhZTC3GyCNo4lQL28XJfaqVtkAQhdclqcUqe21jlr1N6VeKNh0k+6NI7Hmgguufxkw2o+PpqWD X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(83380400001)(8676002)(86362001)(4326008)(7696005)(70206006)(70586007)(82310400005)(2906002)(26005)(356005)(2616005)(508600001)(81166007)(36860700001)(36756003)(1076003)(6666004)(6916009)(54906003)(316002)(186003)(336012)(426003)(5660300002)(47076005)(8936002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4623 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 189f755d-ff31-45a7-38ca-08da21363a8e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uiPmoukHoBDPcPGxFpmKDJMBH42XjXn7BN7jd5XkIGQTtR/k7rpG9s/HBLhYyeY/WXlPdupVWps+GPyvUQuTL0bOpLxV0b+JKBxNvOmNzw+EYFFv9FG129tvDcAz+X81kfVrrf09eGjuBMSSxbtLGOKgkNMwIKCQxc7t46uTGh9rJ0UO8iuoqDbBMnESc1m88EwzAW/zFkFcHcROHsB98aADt2acSGb83hQG0K1RoMEBziZWxBh7BMfv4d2Fyvj7a7WOtJIEUVwVYfcv7+qh4d3hUV+j1bSOCc45FxB8w0Z+sMuXHUcFy+J39q/rSwbeXAWQxWT7QcHoRHFdeTFxuuTfHahp9e2VYmMHRZtx2L/WXOgDzR5FpLrfPYRJoXHJUoI4Ztxwc8qAEljkpGOdcJWj2I/6AQM/TugSW9HgpSQX7eVpu6BhJBRdwf17nbkzcj6HzREk0Wv5znvqmNTCEakWNy2y6gRNJON2ksMcB0TB+QK+kjU7sgUUOFV+QLuN/4Jtow8wgQTEDAnMJbEIGDzMuNOecm+ggdGIa6HCSEmshc7EnIsYu/7Kxw28ojRyfxQ7tyNkWC/JJXueNNk1QirpTHiDOpVuAlGfuU/N5R05Nxf2VAjJU6sNhQ0R/3e9gE04OwYKKHeN+ZWsH4747w== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(6666004)(36860700001)(83380400001)(26005)(4326008)(54906003)(7696005)(47076005)(82310400005)(426003)(186003)(336012)(1076003)(2616005)(2906002)(5660300002)(8936002)(70586007)(70206006)(316002)(508600001)(6916009)(8676002)(36756003)(81166007)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 12:23:32.5138 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 345cdf11-6447-4125-6ccc-08da213640d1 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4208 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1650284646821100001 Content-Type: text/plain; charset="utf-8" There is a slim chance that free_heap_pages() may decide to merge a chunk from the static region(PGC_reserved) with the about-to-be-free chunk. So in order to avoid the above scenario, this commit updates free_heap_page= s() to check whether the predecessor and/or successor has PGC_reserved set, when trying to merge the about-to-be-freed chunk with the predecessor and/or successor. Signed-off-by: Penny Zheng --- v2 changes: - new commit --- xen/common/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 9a3e9c1328..8ba38bca9a 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1479,6 +1479,7 @@ static void free_heap_pages( /* Merge with predecessor block? */ if ( !mfn_valid(page_to_mfn(predecessor)) || !page_state_is(predecessor, free) || + (predecessor->count_info & PGC_reserved) || (PFN_ORDER(predecessor) !=3D order) || (phys_to_nid(page_to_maddr(predecessor)) !=3D node) ) break; @@ -1502,6 +1503,7 @@ static void free_heap_pages( /* Merge with successor block? */ if ( !mfn_valid(page_to_mfn(successor)) || !page_state_is(successor, free) || + (successor->count_info & PGC_reserved) || (PFN_ORDER(successor) !=3D order) || (phys_to_nid(page_to_maddr(successor)) !=3D node) ) break; --=20 2.25.1 From nobody Fri May 17 05:26:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1650284647; cv=pass; d=zohomail.com; s=zohoarc; b=ZZZ+twFx8Yy4chtifZG8r3wGJE6ergfwHtUSix3PWt/FWSe/Y7Q/Oj1eyKHvCYh5atcVC8kp5HxKzPxftxo9STBH4bhgy3cRHZngxaa/CZLdcshgtw9splQCIWTSklQQHniy+5/mgFCzFJ9P+uWQEbbmKoB8+MC/7IMg6q3wOCM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650284647; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uyBX+fsNkrz5HUOuaIVqm6IKexBIh5lxFql//sHUJM4=; b=gNeaXspIYDzczuewHCeczAAI7ETvRcV7u79wRONehr2hOCu3GAOkyv5qNP49ZzTX9VtBtHgYMJqozcD175kmc58pgLLCiWLWiLVVpdTmVmiHrRpwwZuBN7i4R2jw8mYMbhMvSWiOgyzeks7rDAKsxdu/BUYcT4SIisOWf4WGDmY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16502846478651011.5939689230194; Mon, 18 Apr 2022 05:24:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.307192.522509 (Exim 4.92) (envelope-from ) id 1ngQQ0-0003FG-1n; Mon, 18 Apr 2022 12:23:48 +0000 Received: by outflank-mailman (output) from mailman id 307192.522509; Mon, 18 Apr 2022 12:23:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQPz-0003F7-Up; Mon, 18 Apr 2022 12:23:47 +0000 Received: by outflank-mailman (input) for mailman id 307192; Mon, 18 Apr 2022 12:23:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQPy-0002c3-E5 for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 12:23:46 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on060a.outbound.protection.outlook.com [2a01:111:f400:fe05::60a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 63f4bba1-bf12-11ec-a405-831a346695d4; Mon, 18 Apr 2022 14:23:45 +0200 (CEST) Received: from AS8PR04CA0095.eurprd04.prod.outlook.com (2603:10a6:20b:31e::10) by AM0PR08MB4019.eurprd08.prod.outlook.com (2603:10a6:208:128::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:42 +0000 Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:31e:cafe::5f) by AS8PR04CA0095.outlook.office365.com (2603:10a6:20b:31e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Mon, 18 Apr 2022 12:23:42 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:42 +0000 Received: ("Tessian outbound 9613c00560a5:v118"); Mon, 18 Apr 2022 12:23:42 +0000 Received: from 38a061796f99.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 30740B92-F3AC-480E-8C36-58F0DADEA8C2.1; Mon, 18 Apr 2022 12:23:35 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 38a061796f99.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 12:23:34 +0000 Received: from AS9PR06CA0498.eurprd06.prod.outlook.com (2603:10a6:20b:49b::24) by HE1PR08MB2892.eurprd08.prod.outlook.com (2603:10a6:7:30::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:33 +0000 Received: from VE1EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49b:cafe::9a) by AS9PR06CA0498.outlook.office365.com (2603:10a6:20b:49b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18 via Frontend Transport; Mon, 18 Apr 2022 12:23:32 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT027.mail.protection.outlook.com (10.152.18.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:32 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:29 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 12:23:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 63f4bba1-bf12-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uyBX+fsNkrz5HUOuaIVqm6IKexBIh5lxFql//sHUJM4=; b=vLA7Be18p24LEiOJS5tLPPWUKlFHVYaztq6P+wHHsznD1M9kSS/wbVuzMD1jhquag9RAF32Ih79iVW4HNZOYlIuzyLQwQKgtHWUYYriHOa+2bvQesQ33IQAlRKrtc6wNEcOCk4GqPUVEZzGpReDNomoDnvB6S7f+dm92KZWJ9TM= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: b53748e9b814031d X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lm3HNdec7I7A5Zrn0/ClCUvK1ljQZTEn34QR8kILz2lNZbnYM2h/X0CJDXRjAlOhjDki8BdlSrksyhjw98X4Qv8PyG2EL5CHmhsyjE+LOU3Ku2U6jcfGMlMj+fto2qEaEgMMLy+gCH1wfyrjxcsZ6pA6v196k52xS7/61MIAliF9ur1UKtXR6sgZHVrHywdmiYiG/2WrcuNyGtvz7/WyZyJzVDpv/dTAISxsvTqHdYiSzTT63UOVJ0WeN8MmEnon1SQ4SJB6wgJXNQz9366EbX16t6dT4bOI2QgbY8y3aTToD40n/8uVSY3QtVRDzk/F1/YOJ+NnXRzb1iWfg94/Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uyBX+fsNkrz5HUOuaIVqm6IKexBIh5lxFql//sHUJM4=; b=P/suv8TqTHF/CxyTi+2iJJiaDz4VnQaFX5mO36/viASAP6w/K0pdf/LBPm9VJABZa4dJvkTN43WtSLVgqBgZbWRRO4GbdL6giIWprbwY7swd+8OZDLXIdzWIm7ofDmf836mv6zEf5VeOmqFNfn2chXVZ6sGnRrhPnueDyVxCGHo4piE2Gji0z1A3muFgT8qiCLqzJ2Y+TUPue7+Kx9QVupji24SjDQvYigma9SYwZIa3VdHSsqcgDY3vxfdKvfVPR9NdoEJ6K/PUqBMQ+BsWA5yjWd3w/VQBAoWC+0JUcZaRRzTbys25RnzEFWa3u81ZTq0lb9IkzR+mtrj5BYr+UQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uyBX+fsNkrz5HUOuaIVqm6IKexBIh5lxFql//sHUJM4=; b=vLA7Be18p24LEiOJS5tLPPWUKlFHVYaztq6P+wHHsznD1M9kSS/wbVuzMD1jhquag9RAF32Ih79iVW4HNZOYlIuzyLQwQKgtHWUYYriHOa+2bvQesQ33IQAlRKrtc6wNEcOCk4GqPUVEZzGpReDNomoDnvB6S7f+dm92KZWJ9TM= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , Penny Zheng Subject: [PATCH v2 3/6] xen: add field "flags" to cover all internal CDF_XXX Date: Mon, 18 Apr 2022 20:22:48 +0800 Message-ID: <20220418122251.3583049-4-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418122251.3583049-1-Penny.Zheng@arm.com> References: <20220418122251.3583049-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: a5dcc233-7aa2-4a92-4021-08da21364697 X-MS-TrafficTypeDiagnostic: HE1PR08MB2892:EE_|AM5EUR03FT043:EE_|AM0PR08MB4019:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: grONejuSOQg698IMeUKWD7yEXpzELpn6Y+M11a+Dc/JLxyLtEIDfRLpiOMDHP9EMu8oKMbeFNGd0c0FemCVgHiBshOX8K7CCl6rF7aktdQm+9DZNgiqAAvJCj53zq+hX1cFJht6ExMDZPzBfsHkEJo5KIPhXwITK6dqLCAzSSQgguxQXfjBkV79dWlyX6zY3XfBnIGFTzgxqZ1yD06ziXZQe8Z4HodpJRpai6ObJZrrZC7c8R9GlCe/YOdb99Ku/kpFd//b3Lab5wZTiJqMsdH3Q+RE+KdqdvriVnZyKUOWTUya1GfmgVDfesFJclYgjBeQ++xrWcaQuy41TbcLajQZtbxYt2Ybeo2yIa3RQ2z4Ifpq+EqopmVnURmg2NNWUhi8w1DvqeIVeYpyUQ6rhsScnOHE5D4s5w130Wif3f+lIknV+n/CBWWSs+3Mwitga7IpF79Cx2ukkdSut+JcqbnSALSN/eVXyssNZQB/HIIB2XydhrTZDnmxVhY2T57PQ4GZ5bv7TncA3dTnx3lKVmC2w1UUW9rz8JAPCmTBZnF8tqJ8kwJPhmUJDJhSmY037Bk7idRpiUmXdCxSKyO3Dzm2VavEgvGjCK3RpNEO7DV2YRXxWBNPU7uiOHY0Q8vKlC3fQXwdzdrXd3s4P71B3UdKO3FViiCe8uDC7IImvGTjj6lgwXvJ2A+qFlExAeSi6LfvfapI+GvuR1MUGusJGNKqye24usTxHFijxLeAZ4/s= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(356005)(1076003)(26005)(5660300002)(4326008)(36756003)(36860700001)(70206006)(83380400001)(81166007)(82310400005)(8676002)(70586007)(8936002)(54906003)(6916009)(2906002)(316002)(186003)(2616005)(40460700003)(7696005)(86362001)(6666004)(508600001)(336012)(426003)(47076005)(21314003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2892 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 59e0dada-653e-4a91-9d43-08da21364090 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 56Y2qAUXbbPHavPrlibf2hrbe0jXKcK+X4Vd89J4OgTeD002+Wy3I+RxwqQNb3WhcB7+1Q+fQshxk6mdTcS7OOc+JA6eIQ8xHVSoVgzrO4Ff9zhF/xIgsxrJ124PIuigO9gcIzWtJTE760D73rxp+vvxahX5wtjaXy1ACvpLBayKxl4nPOErRHrJeDiqgyP41PiXz6MCCsRUK5b4nncYIXtxiKtrgwNjk+L4tiJMhSsQLG34Gaydf6eBr0SnQO9+V+3s0Co3VEuQymja36sQw5i3i0Fa+gjIF05cF6s4wmDBHvjqJJGyLnGtbWdA/wt2EIZK5qwHGY6M81KfwNhG3Zs8elBzzAWfpeQOOyCYXVr/mrDYVHi1uBS+9FR4aceSE+pjpAGXVYxpynJN2lRPNvOTdfFgyQq6QRzPad/VrLs43WFDKWWbFk2i32NnHxlRAa303wZw7+573sUFo6Y6gM3wNHxT9ZPfPfwWmZIeOvRcVClHS+tMHejROL1Wy8e+0Km/ZTm+8NIIomn80Cqj7E+nzykTkum+IrooCFb/TVflBSZ4GQ/baCsEA92LCbWXecZA6nLzDx0hefssfv7tLsnDHCIgkzSahjoxyWI+uaQAUkwu5r5M2NfQRV3nl8Vh/lQ0f6tK+IzSqlBIh6l169PSsZj9PK1C+7Gnh3R28HZLy3tdD6Ca/B+znmmWs1vbJnp18xTHlCAXIw6Zn+wXBg== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8936002)(6916009)(40460700003)(54906003)(498600001)(6666004)(5660300002)(81166007)(83380400001)(36756003)(86362001)(2906002)(7696005)(8676002)(4326008)(82310400005)(26005)(70206006)(36860700001)(70586007)(1076003)(47076005)(2616005)(426003)(336012)(186003)(21314003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 12:23:42.1989 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5dcc233-7aa2-4a92-4021-08da21364697 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4019 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1650284650153100007 Content-Type: text/plain; charset="utf-8" With more and more CDF_xxx internal flags in and to save the space, this commit introduces a new field "flags" in struct domain to store CDF_* internal flags directly. Another new CDF_xxx will be introduced in the next patch. Signed-off-by: Penny Zheng --- v2 changes: - let "flags" live in the struct domain. So other arch can take advantage of it in the future - fix coding style --- xen/arch/arm/domain.c | 2 -- xen/arch/arm/include/asm/domain.h | 3 +-- xen/common/domain.c | 3 +++ xen/include/xen/sched.h | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 8110c1df86..74189d9878 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -709,8 +709,6 @@ int arch_domain_create(struct domain *d, ioreq_domain_init(d); #endif =20 - d->arch.directmap =3D flags & CDF_directmap; - /* p2m_init relies on some value initialized by the IOMMU subsystem */ if ( (rc =3D iommu_domain_init(d, config->iommu_opts)) !=3D 0 ) goto fail; diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/d= omain.h index ed63c2b6f9..36ec00e62d 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -29,7 +29,7 @@ enum domain_type { #define is_64bit_domain(d) (0) #endif =20 -#define is_domain_direct_mapped(d) (d)->arch.directmap +#define is_domain_direct_mapped(d) ((d)->flags & CDF_directmap) =20 /* * Is the domain using the host memory layout? @@ -103,7 +103,6 @@ struct arch_domain void *tee; #endif =20 - bool directmap; } __cacheline_aligned; =20 struct arch_vcpu diff --git a/xen/common/domain.c b/xen/common/domain.c index 351029f8b2..859cc13d3b 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -568,6 +568,9 @@ struct domain *domain_create(domid_t domid, /* Sort out our idea of is_system_domain(). */ d->domain_id =3D domid; =20 + /* Holding CDF_* internal flags. */ + d->flags =3D flags; + /* Debug sanity. */ ASSERT(is_system_domain(d) ? config =3D=3D NULL : config !=3D NULL); =20 diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index ed8539f6d2..68eb08058e 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -591,6 +591,9 @@ struct domain struct ioreq_server *server[MAX_NR_IOREQ_SERVERS]; } ioreq_server; #endif + + /* Holding CDF_* constant. Internal flags for domain creation. */ + uint32_t flags; }; =20 static inline struct page_list_head *page_to_list( --=20 2.25.1 From nobody Fri May 17 05:26:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1650284659; cv=pass; d=zohomail.com; s=zohoarc; b=jsWrbpIn6i09lZth8tYfD1Wrofm5jSp9JoUhRWmX0WUjYg5RgZ1DtWppzODPEqRU5JZCnQqthFsbIRS2v8eVS6skb8ikxghN7uPXND0gIS1+pvvhwjq/cIW8sv2gyS1e2xlZEbCq/72GY7+D23S+r6E88h+YUw25O/CDhH004Co= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650284659; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1mDieelJvb1HIU1cidQRUGTfXl8e3DylFrqxsNNPrcs=; b=XpQhlvNQ3zMh7lQdDG7Y+6rBfEHP8ulD3OWioJttkmbbfRoKXljEJL5XPd/9ao8T6KnjdeUQByUUeULpwnFznLWpriU3FoldL6U4kkUvaqpd8L2qZFevaFIRxJ2h0veoimLNVDshvJY8Tn2MGeM0FUKv7Ph7Zpz9qKa51tKznIg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1650284659859653.6833994370376; Mon, 18 Apr 2022 05:24:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.307194.522521 (Exim 4.92) (envelope-from ) id 1ngQQA-0003uD-BM; Mon, 18 Apr 2022 12:23:58 +0000 Received: by outflank-mailman (output) from mailman id 307194.522521; Mon, 18 Apr 2022 12:23:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQQA-0003u2-8A; Mon, 18 Apr 2022 12:23:58 +0000 Received: by outflank-mailman (input) for mailman id 307194; Mon, 18 Apr 2022 12:23:57 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQQ9-0002c3-0W for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 12:23:57 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0618.outbound.protection.outlook.com [2a01:111:f400:fe0c::618]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6a3a52f4-bf12-11ec-a405-831a346695d4; Mon, 18 Apr 2022 14:23:56 +0200 (CEST) Received: from AM6PR0502CA0047.eurprd05.prod.outlook.com (2603:10a6:20b:56::24) by VI1PR08MB2702.eurprd08.prod.outlook.com (2603:10a6:802:1e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:51 +0000 Received: from AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::57) by AM6PR0502CA0047.outlook.office365.com (2603:10a6:20b:56::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 12:23:51 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT024.mail.protection.outlook.com (10.152.16.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:51 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Mon, 18 Apr 2022 12:23:51 +0000 Received: from e29f6da64349.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8820953C-0C6B-4FA7-A917-066E529E9D5C.1; Mon, 18 Apr 2022 12:23:44 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e29f6da64349.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 12:23:44 +0000 Received: from AM6P195CA0018.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:81::31) by DB7PR08MB4603.eurprd08.prod.outlook.com (2603:10a6:10:75::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19; Mon, 18 Apr 2022 12:23:40 +0000 Received: from VE1EUR03FT030.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:81:cafe::9a) by AM6P195CA0018.outlook.office365.com (2603:10a6:209:81::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 12:23:40 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT030.mail.protection.outlook.com (10.152.18.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:40 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:38 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:37 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 12:23:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 6a3a52f4-bf12-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1mDieelJvb1HIU1cidQRUGTfXl8e3DylFrqxsNNPrcs=; b=K4W6TSM7Alvw8B7lvq1YytYxHhz0/bzuCRtEbPw61p+RpBd6hmGGH+a4hYw8Bd02S1W2JpdubbwNpFMHY2wnu6D4qhBk9DL6kGgTHH4uorr+jpk8w98s6ldfj9uySK54ypm95+hzLiaEyZzPjT1rJJQnkHt9Z1yInvdZVZ+yqiw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 1a1646ab449e3623 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kIhNxDcOmyaw4juOGJZ/GX+RK+qwmky0FL4/A6z1EaN7HyR0MrwTH2DN2Gut8Gk5Etek4mq+gpKK7Ajh+Qe5My/oQGdyqoYbNz6Gp7ZtTOfi+ET47OMAA9pd324bL34O5SL94qkIdnedaS5Sy09h2rBRDjVXK39Pc39HeJJexQltb75C9XPDdLhIYAGX4WPQbjqQGrQInhe5ntbdIW/VDLkcjchC00BpQAWGM0FuXNqHP/jTM7ZxCKdzr7s6jcqJ0R5n3nB3WoS1TPqzvMnrsWQvfzdwToIJm9gqDG0dpqmmJLcxZ/oinoHUw/NplfTGWYe4NwE65Q96Ayp9GHnxLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1mDieelJvb1HIU1cidQRUGTfXl8e3DylFrqxsNNPrcs=; b=b5ro8J7WQdbIDk9HVRgCQeZT4U6pwfxcKrAhEhf+cCg2ZAcuxpOdShABEMdAebwINiO1TJcURBBTLmEvZNuEwu0OJUpnuYGCSEQA5v6R3ar335wO641FqJaWDoNVjntVwTY/NHHaIvPxVqg0JoRM1/nRUHLa8jeN3YS7thnJPAJQtM2BdOQJIr/N0ptRbvXfzeL8XInglWeJOvyQ83k5ldJyVEm8t4f6Maz2IaQbOiRTmsnXsi1aDSt+z0xs01J1q0q8lhls9j7/W5x4NvSIGgLsP3oL9Yl5jZxEC4c8jxeeqw60/oW9Cmfj3VaCwuLKNnJ420VMrWABC/IKw15TEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1mDieelJvb1HIU1cidQRUGTfXl8e3DylFrqxsNNPrcs=; b=K4W6TSM7Alvw8B7lvq1YytYxHhz0/bzuCRtEbPw61p+RpBd6hmGGH+a4hYw8Bd02S1W2JpdubbwNpFMHY2wnu6D4qhBk9DL6kGgTHH4uorr+jpk8w98s6ldfj9uySK54ypm95+hzLiaEyZzPjT1rJJQnkHt9Z1yInvdZVZ+yqiw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , Penny Zheng Subject: [PATCH v2 4/6] xen/arm: introduce CDF_staticmem Date: Mon, 18 Apr 2022 20:22:49 +0800 Message-ID: <20220418122251.3583049-5-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418122251.3583049-1-Penny.Zheng@arm.com> References: <20220418122251.3583049-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 44f5ffe0-a21d-4559-9e64-08da21364c28 X-MS-TrafficTypeDiagnostic: DB7PR08MB4603:EE_|AM5EUR03FT024:EE_|VI1PR08MB2702:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1U7j5DI8E7i8W8LYObBaBcllMn07c/OAXFKyEWrUqp/yQOZkAfB1oGK9fiLnmLxUKlxjJwFf7t1n3ZkZcezdUEcWiCgug5z9N74WJBFRmyP40WLi+RF3EOrZugxCwRRbo3hx3fGRT/rFr9TnwBNjJWWfZbuLB3AtV+HMM7AvtrX/UvhOLCGHzBDmRXriSLPGw3st/Xavw/lokY5cv1l6Jr6YtTRjLV7NiuSpp8K4nlbTTM0tVgw+ry0HWupE8Uht63pULPQyC+GHs8e9U0Cxx4IP3h7qaVYDgfoAh9qTGHbQCI5XrfKLRIePJcqNelOCxLApk95IAcPEqbA8104PQ7+pf/qgctGje+4FLuhhdGd+8b7bvnck+qfQ2SvCXdS2FXINwljV5eG1LQwJEYuyb1hrp9Uy0ProogutF5z8o1sevxrhkk0SeWhVjNntCUSzOIiRxyZ9GybyP/farRiGyHOhrzaBqOwVRTa6EMsN+MnPOPMdYuMUjoaWdLM7UaRsxgNfE/LrGEhDbpfWQ1cudcRXamg8c1HabeQ1SOTl2BscKJ5Vh7J9N0t7GcQ/h6hJvg/xU6BnLq3DbCB5XOdCJ0/GVYJ0NCHlKcRrGMeNdXqfgpcBP22D3D9p+62GvSi/J+371XqRdp1/k0TeIKaGAGw/DLdFrsZduW91clMDnpXYkS8ErA5l4LDgMsIOWVYu X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(36840700001)(508600001)(83380400001)(8936002)(2616005)(2906002)(186003)(4326008)(8676002)(1076003)(70206006)(36756003)(70586007)(86362001)(6916009)(5660300002)(54906003)(81166007)(316002)(7696005)(26005)(6666004)(36860700001)(82310400005)(47076005)(426003)(336012)(356005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4603 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9742ef45-520a-4323-45ca-08da2136454f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cUK60Wv/Pa/9zpmPFYA9v4iGO4FAgdlJwb1oEbksgx4gbkgrze7GBqHLeg6lwht/z5pQZizPZcumxvwMItegwg0QM6nKM/2ke/JZiVpQN3ClHDm66V++ONgG97Ep2rCbN78Fw4vFBHVOTKWgMCILbGsKxrpBI0S0BWucPlzT+/Bvfo/Xth4aoCQbGnjz4IbuyOBPPlKqtIXx4VTVIo+CcANWJuLsqSNKUs5BhzuJkAolNp0jJSkMk07D99nJVg1VyFvWdXaXjJ1QuzUsYWMgQ/nQ3wYEUdLcKBk+8rW2luWunUmYjVpU0+CxW9pK8g1FU/jtlbpsRGyYwLrPLB9rBXL+qcxbASIL8mrv7jwBo2um2SHDhhf2Sf0qHGBeRTJacoP4eHceosOMM6RPohULK9x8x1bMqPrjbUM737/Tkoncp5SdZP4de7khVoSriUQDqV6q8vEC6IXY5cToMuflZsZIt3a4skO8NeDxfR0ag9DEkpqtDqJQ2GCAnlzMUW81XRaSlzx2XjyO5mp7z9zaL6c3EtUCfM6tfdWJn0ep80KcnZrpoRBUj42C/6VB6EQ7WrhRZriojoHI5N1Iy17nsL553SVRn5OhTDvbhrLK2WlpXS0XmzL+UCd2hyssTCDnpGJNWLgR59nGhDzFMjeHVA== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(2906002)(47076005)(186003)(2616005)(8936002)(86362001)(6666004)(7696005)(83380400001)(508600001)(26005)(1076003)(336012)(426003)(4326008)(36756003)(36860700001)(70206006)(70586007)(5660300002)(316002)(8676002)(81166007)(82310400005)(54906003)(6916009);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 12:23:51.5402 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44f5ffe0-a21d-4559-9e64-08da21364c28 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB2702 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1650284661953100001 Content-Type: text/plain; charset="utf-8" In order to have an easy and quick way to find out whether this domain memo= ry is statically configured, this commit introduces a new flag CDF_staticmem a= nd a new helper is_domain_static to tell. Signed-off-by: Penny Zheng Reviewed-by: Stefano Stabellini --- v2 changes: - change name from "is_domain_on_static_allocation" to "is_domain_static()" --- xen/arch/arm/domain_build.c | 5 ++++- xen/arch/arm/include/asm/domain.h | 2 ++ xen/include/xen/domain.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 8be01678de..4e62fd0bf1 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3191,9 +3191,12 @@ void __init create_domUs(void) if ( !dt_device_is_compatible(node, "xen,domain") ) continue; =20 + if ( dt_find_property(node, "xen,static-mem", NULL) ) + flags |=3D CDF_staticmem; + if ( dt_property_read_bool(node, "direct-map") ) { - if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !dt_find_property(no= de, "xen,static-mem", NULL) ) + if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !(flags & CDF_static= mem) ) panic("direct-map is not valid for domain %s without stati= c allocation.\n", dt_node_name(node)); =20 diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/d= omain.h index 36ec00e62d..b097433f9f 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -31,6 +31,8 @@ enum domain_type { =20 #define is_domain_direct_mapped(d) ((d)->flags & CDF_directmap) =20 +#define is_domain_static(d) ((d)->flags & CDF_staticmem) + /* * Is the domain using the host memory layout? * diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 1c3c88a14d..35dc7143a4 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -34,6 +34,8 @@ void arch_get_domain_info(const struct domain *d, #ifdef CONFIG_ARM /* Should domain memory be directly mapped? */ #define CDF_directmap (1U << 1) +/* Is domain memory on static allocation? */ +#define CDF_staticmem (1U << 2) #endif =20 /* --=20 2.25.1 From nobody Fri May 17 05:26:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1650284669; cv=pass; d=zohomail.com; s=zohoarc; b=YfTLUcb7pvIZbv8jdGlr0PBrTDAJZua9ME2swOi6VAwkLN6KdIAwO5dlNPY5cIrzrNPIWb4dq8VBmvuuu8O4fFBVjyBeMgceZMLKkslwioMYrDo1EqXIzVg+HNSDLg6yJhFUcM3RrwCAnJiNcxwMMQ8+2EHS0okMvys7m17d0os= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650284669; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rYZ7/21bXTduzlBPK071K+W97NWodHf7d5105P0sD+8=; b=XpLvYcJTGs0XF5Ndj4WpR1eb1j0KAWRiScpkNnRY0iz+c0SUqwZOfVoFkafWYDX84WnC+ckneJjwFov4x0BKbO+0SGpedfanJGYukV8CCGet4Df9LbECAGXB7emDc+CgObtuMCx07eu4y9I/Q2HAdCq3eWU3xboBPclcFsfxDDQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1650284669729414.431884441638; Mon, 18 Apr 2022 05:24:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.307205.522532 (Exim 4.92) (envelope-from ) id 1ngQQK-0004eM-Qa; Mon, 18 Apr 2022 12:24:08 +0000 Received: by outflank-mailman (output) from mailman id 307205.522532; Mon, 18 Apr 2022 12:24:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQQK-0004d5-MP; Mon, 18 Apr 2022 12:24:08 +0000 Received: by outflank-mailman (input) for mailman id 307205; Mon, 18 Apr 2022 12:24:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQQJ-0002K3-Bb for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 12:24:07 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20621.outbound.protection.outlook.com [2a01:111:f400:7e1b::621]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6e91ce18-bf12-11ec-8fbe-03012f2f19d4; Mon, 18 Apr 2022 14:24:03 +0200 (CEST) Received: from AM6P193CA0060.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::37) by VI1PR08MB4622.eurprd08.prod.outlook.com (2603:10a6:803:bc::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.25; Mon, 18 Apr 2022 12:23:59 +0000 Received: from VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::30) by AM6P193CA0060.outlook.office365.com (2603:10a6:209:8e::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 12:23:59 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT018.mail.protection.outlook.com (10.152.18.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:58 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Mon, 18 Apr 2022 12:23:58 +0000 Received: from c37794760062.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7BDC8C1E-EAB9-4136-86E0-ECA025413728.1; Mon, 18 Apr 2022 12:23:51 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c37794760062.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 12:23:51 +0000 Received: from AM7PR03CA0019.eurprd03.prod.outlook.com (2603:10a6:20b:130::29) by AS8PR08MB5896.eurprd08.prod.outlook.com (2603:10a6:20b:294::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:50 +0000 Received: from VE1EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::f4) by AM7PR03CA0019.outlook.office365.com (2603:10a6:20b:130::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 12:23:50 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT043.mail.protection.outlook.com (10.152.19.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:49 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:47 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 12:23:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 6e91ce18-bf12-11ec-8fbe-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rYZ7/21bXTduzlBPK071K+W97NWodHf7d5105P0sD+8=; b=2JdSqc/a/HH+0YeJVglTUEVJZ8GBNb7c0sUcnsJdzTPBDapohw7w4OsrF7JwKc1V4X8qtxxsNYDq8Uv1UtKmHb/a+ZE7hUStjh7c4WhnfpWbftnIPQwWQa0BGC64R3YXp7u0lsMjRf1pSZr7376qjwzcIg2b4XPH7/2FFC3gRow= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: 2fe4311b042f5cc7 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fi7naA2IVcQ6csHoeDpsrjgzM2CJ1KJ7f5msPQViNdXN3EcC6okm1zTRoBYfHG9kZlb2HwF0mh7yjJdKohf2ZUjXrImQvUBjXxuMBXRtmUQXW87E1TolNn/FDJld7jPMv8Bg6ZK23NOZThAIQPo0D/5bLILwaG6AzVY/7YmdUQ4mWQAMRwcMrYRyvddYFkvF2XeYTBs+p68+stPboUV9WUWHIkS2Iw6I1UhR4t1xEmSEoShX0V2WNoBCEXhiv3cWyKhuuXdPhEUSy7i1LdiV6eDhoAqxSqOML3673z0dVEFSojGEl/VuYBdTEVdzOhkf9XSRPtZSJIssHgOW8NoZsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rYZ7/21bXTduzlBPK071K+W97NWodHf7d5105P0sD+8=; b=M6shXsTSgJjqPVu43i5yYDUlD25Ar2lrCcFFhT7fcu1g7PGmRUf9o+dmCcUUySU9D3mSiaVdlRQD0ks3rHfgX+DsBTEb1egNegCqh5ndajYgOTbxVa1H6mc7LiUGE3icYX0ZxWqJXHsLhR4K+X7bOi6iPISfhczVUcADOwNdltwGQxPOrXG4rMjC/t83GdfgfWpSLT6HXoUjsDsH0YkuTGJIaT/4mI9A2UnuwpBFarVnQK4t+uRE6aVVlgs7oZqc8//khSWwVCiEcZfCyxiOIKTQresSltm853X3NiECjQlEgDrO/XsNY1B+Zy+kXh2mgW8veZE3JUA8cSI7dxIQKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rYZ7/21bXTduzlBPK071K+W97NWodHf7d5105P0sD+8=; b=2JdSqc/a/HH+0YeJVglTUEVJZ8GBNb7c0sUcnsJdzTPBDapohw7w4OsrF7JwKc1V4X8qtxxsNYDq8Uv1UtKmHb/a+ZE7hUStjh7c4WhnfpWbftnIPQwWQa0BGC64R3YXp7u0lsMjRf1pSZr7376qjwzcIg2b4XPH7/2FFC3gRow= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , Penny Zheng , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , Penny Zheng Subject: [PATCH v2 5/6] xen/arm: unpopulate memory when domain is static Date: Mon, 18 Apr 2022 20:22:50 +0800 Message-ID: <20220418122251.3583049-6-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418122251.3583049-1-Penny.Zheng@arm.com> References: <20220418122251.3583049-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 4999d099-47ea-49ad-774f-08da2136508c X-MS-TrafficTypeDiagnostic: AS8PR08MB5896:EE_|VE1EUR03FT018:EE_|VI1PR08MB4622:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: heFRGt/zvBO88kv4uV5RbbLIEAze6cFninXGuepuAzUWODN8h4+Il3IJzxSrnyuRVRiL/FJbGyIXRIfc7l1kvkbskGVduj9x6RTDPg57Xoe478FpzwKTBam/WcI583DguEe77zisEpwNjLWIG5d2BAWuE/O+X+NpCKHPda+ILiGkO0QsfjV/GNnTrFBFVXBaD+lCLG6mKdqoWZrMw9XClmMdwOc8wF+iKom9tkbDiBtV4JPQeHwncEKiBa1U9kTVuv/Bao5Qj4EmoKHM/3TixWnNTMiGfK3cofaHYo8lDck4Qstk3uhbFB1dXhFP3hQy4YIVtXCxlc7mnk7A08omfrFG8n5ZUQkL7kNPTv5+c2Vv0edaCwuy3CIgBl5QQkhFsd+zwuZp1HTozQQFoDNOWRaxPgrJIa/KnFhdfB2Bl6+ca0NgJWwv12cOJic4ZuoOPulVeejBm7obK0lq3IIfUArLXakKKuB41ISORBj0wQkjWnoT4GRnVZ1rnd4/0/wxVN37zDMzMPE2xQ+PYOpvt3eVjrvGScpkOKQNOw1phwILSSUOyit/nuLeRW7/NlhG4Cg2gawBICw7gI04fyZ+PW7tSgv4enUWoh9Fiwz2Bdto4xI+wRMiDkT4xQ1/02HYoH8L14RpxgkQg6SAYbEGZNrcH8sW/U3V+azflKWleNgIaD0v/vgkz4T5P2t47LFTBNWQbEeP1koacciHB1ca/w== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(47076005)(4326008)(7696005)(81166007)(8676002)(1076003)(40460700003)(2906002)(6916009)(86362001)(2616005)(186003)(26005)(36756003)(82310400005)(70206006)(70586007)(426003)(8936002)(6666004)(356005)(508600001)(336012)(36860700001)(5660300002)(54906003)(316002)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5896 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0c959f4a-48b3-4d0c-a3db-08da21364ab5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SKGn8JWLqKzecWzAYMG4ooNeXI7VoXzjq+j9J8SRUHqb500j1Dw3NYalF0Wr86vi3gvv+yc55A4zLydEzQlcGKQF5AgPOdEhZyWr52dpf+rcV6v0/awF1uwM0pKGKkkt2Oe93vnPOJmf+dePVUgaq+Qm+DpkY0EpaoWghHTQfAwajZSE45eR4HN4bvNzs2qHQVqOBFWEd7HiGvCUAosDGolUzJEGwELdfTcC9YjYWMlnO7vPt9IMF+/9W37+n7ZOQ7h/Fu+J9UZRdg0CH9tpPi024nFoPeSzO41ra66jJvOfyONMksKQ7WvOHfMPI1XLowRHLa4K/OUMrffL7FcYjnKHNm4ijtF92IBtIwDPLd/xfVfl113KbZKaI3Y4DFJuty7Sx+YkcMCz2BjJpGW/HICGLh8E8ePxNC0pZjIXLkJy8AVQIlHHS1VdBEenbCmwXgLE0eZ8q2c87KAy5MCLv55G6328PkhTPsYsIaP/OqM8RaVp9EqeXu+IqV6B6oYB20BZVYggvCW3OU1f0tgmIStkgJE1hRyCWqyKkJ8waoIecBweVgi9rwwNEzfe3T/I4b3hcU494gNki7WZxFXl7TQPstvClet498nnihWDQE4U4KfWZXPig2eKdTlRctJ5u6jUkD1ELUYvX2pFla20Zw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(36840700001)(46966006)(83380400001)(82310400005)(2906002)(186003)(81166007)(7696005)(70206006)(70586007)(1076003)(2616005)(5660300002)(316002)(36756003)(26005)(6666004)(426003)(336012)(47076005)(508600001)(54906003)(6916009)(36860700001)(8936002)(8676002)(4326008)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 12:23:58.8586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4999d099-47ea-49ad-774f-08da2136508c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4622 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1650284670152100001 Content-Type: text/plain; charset="utf-8" Today when a domain unpopulates the memory on runtime, they will always hand the memory back to the heap allocator. And it will be a problem if dom= ain is static. Pages as guest RAM for static domain shall be reserved to only this domain and not be used for any other purposes, so they shall never go back to heap allocator. This commit puts reserved pages on the new list resv_page_list only after having taken them off the "normal" list, when the last ref dropped. Signed-off-by: Penny Zheng --- v2 changes: - put reserved pages on resv_page_list after having taken them off the "normal" list --- xen/arch/arm/include/asm/mm.h | 17 +++++++++++++++++ xen/common/domain.c | 4 ++++ xen/include/xen/sched.h | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index 424aaf2823..a2dde01cfa 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -358,6 +358,23 @@ void clear_and_clean_page(struct page_info *page); =20 unsigned int arch_get_dma_bitsize(void); =20 +/* + * Put free pages on the resv page list after having taken them + * off the "normal" page list, when pages from static memory + */ +#ifdef CONFIG_STATIC_MEMORY +#define arch_free_heap_page(d, pg) { \ + if ( (pg)->count_info & PGC_reserved ) \ + { \ + page_list_del(pg, page_to_list(d, pg)); \ + page_list_add_tail(pg, &(d)->resv_page_list); \ + (d)->resv_pages++; \ + } \ + else \ + page_list_del(pg, page_to_list(d, pg)); \ +} +#endif + #endif /* __ARCH_ARM_MM__ */ /* * Local variables: diff --git a/xen/common/domain.c b/xen/common/domain.c index 859cc13d3b..b499cf8d2c 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -605,6 +605,10 @@ struct domain *domain_create(domid_t domid, INIT_PAGE_LIST_HEAD(&d->page_list); INIT_PAGE_LIST_HEAD(&d->extra_page_list); INIT_PAGE_LIST_HEAD(&d->xenpage_list); +#ifdef CONFIG_STATIC_MEMORY + INIT_PAGE_LIST_HEAD(&d->resv_page_list); +#endif + =20 spin_lock_init(&d->node_affinity_lock); d->node_affinity =3D NODE_MASK_ALL; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 68eb08058e..85ef378752 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -376,6 +376,9 @@ struct domain struct page_list_head page_list; /* linked list */ struct page_list_head extra_page_list; /* linked list (size extra_page= s) */ struct page_list_head xenpage_list; /* linked list (size xenheap_pages= ) */ +#ifdef CONFIG_STATIC_MEMORY + struct page_list_head resv_page_list; /* linked list (size resv_pages)= */ +#endif =20 /* * This field should only be directly accessed by domain_adjust_tot_pa= ges() @@ -395,6 +398,9 @@ struct domain #ifdef CONFIG_MEM_PAGING atomic_t paged_pages; /* paged-out pages */ #endif +#ifdef CONFIG_STATIC_MEMORY + unsigned int resv_pages; /* reserved pages from static regi= on. */ +#endif =20 /* Scheduling. */ void *sched_priv; /* scheduler-specific data */ --=20 2.25.1 From nobody Fri May 17 05:26:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=2; a=rsa-sha256; t=1650284684; cv=pass; d=zohomail.com; s=zohoarc; b=UYS/WhAsLX43aYScgOvirdkWdFUrkXMUtx5oglH1xLH92ppezV3tndtbXSDIP3ktxtdFuHE+EWkxBI+FAuIvC7xSSvKtTzzc6ihn4FXaA5V9mTkfsseWmqWXFgzViZDGleDbeMhziqvS5SSx5R2QtIjXRUa9/lG/UfPu9wlbgRM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650284684; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LpppyH+TZRPMImSMb65msgwXr8BDg+yB7jYmPGh/pdI=; b=O9QQUaEaO7uXOIOcwmf9mh53F5NSUJpU9gbcBE5IdRJCJaRyNw4qpjFG1XkcfQwOkhU2c7XzwqpkRBZL755GnOK2lNBLkDkWI0YEWGNCq8dFB91jEn4d1i1pJiZRbUsNZvVOFOlG6q6GP+DiWkNFxm1ojSKer99nMIRRPSIJJ38= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=arm.com); dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1650284684050252.67086283309345; Mon, 18 Apr 2022 05:24:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.307208.522543 (Exim 4.92) (envelope-from ) id 1ngQQb-0005S9-6P; Mon, 18 Apr 2022 12:24:25 +0000 Received: by outflank-mailman (output) from mailman id 307208.522543; Mon, 18 Apr 2022 12:24:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQQb-0005Ru-17; Mon, 18 Apr 2022 12:24:25 +0000 Received: by outflank-mailman (input) for mailman id 307208; Mon, 18 Apr 2022 12:24:23 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ngQQZ-0002c3-49 for xen-devel@lists.xenproject.org; Mon, 18 Apr 2022 12:24:23 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20613.outbound.protection.outlook.com [2a01:111:f400:7d00::613]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7278a62d-bf12-11ec-a405-831a346695d4; Mon, 18 Apr 2022 14:24:18 +0200 (CEST) Received: from AS8PR07CA0002.eurprd07.prod.outlook.com (2603:10a6:20b:451::31) by AM0PR08MB3634.eurprd08.prod.outlook.com (2603:10a6:208:d6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:24:06 +0000 Received: from VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:451:cafe::85) by AS8PR07CA0002.outlook.office365.com (2603:10a6:20b:451::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.12 via Frontend Transport; Mon, 18 Apr 2022 12:24:06 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT025.mail.protection.outlook.com (10.152.18.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:24:05 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Mon, 18 Apr 2022 12:24:05 +0000 Received: from e4e3ea6435ab.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 40C510F7-811A-4D4C-AD76-32739D5FC527.1; Mon, 18 Apr 2022 12:23:59 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e4e3ea6435ab.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Apr 2022 12:23:59 +0000 Received: from AS8P251CA0013.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::28) by DB9PR08MB6633.eurprd08.prod.outlook.com (2603:10a6:10:23d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Mon, 18 Apr 2022 12:23:58 +0000 Received: from VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f2:cafe::44) by AS8P251CA0013.outlook.office365.com (2603:10a6:20b:2f2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Mon, 18 Apr 2022 12:23:57 +0000 Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT038.mail.protection.outlook.com (10.152.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Mon, 18 Apr 2022 12:23:57 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:56 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Mon, 18 Apr 2022 12:23:54 +0000 Received: from a011292.shanghai.arm.com (10.169.190.94) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 12:23:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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" X-Inumbo-ID: 7278a62d-bf12-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LpppyH+TZRPMImSMb65msgwXr8BDg+yB7jYmPGh/pdI=; b=1rVz0EKHXAFIUCMUxXT1dInfz/BwBq7Pd3RkzgzBbbwbsiuPsNoU/jkciSX6HtOVis1yw4FtaZBN3Er7SBFCKOD9NMg+Pp+AfelIIZOcEeVvmHFBjHg3Q2FfUHEip+cYYODwN6n/BxjVNV85KXQOADN0+9wO5ehWXNduW7irHbc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-CheckRecipientChecked: true X-CR-MTA-CID: b244345b88eeedf2 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JjWGpL5fQ0fNuvmUduLTGOrJxUMWmvOIMyZZy1wlYP8OrlWOV6Yt6/gBJIhU/MX70DgMQ1/3xmPtYm4gJ+P5KQ5apLARF8LngJvcLcCeN5PgPZ/oH89PWzQOhg6gFA401sIZBL4qhdZJItIwu2xIf3phXQWPOgPHWJU+8SmBxXmDmD0h+Cn2Ine2kVdWeiC1+hLEkEN/vO7ekdsRDkGX0pin14/g9C1EUdUr++BwK2E3xQe2YuZeoGgoyvB8v7n4XMXAIDdkkbSx6lukz1J/S6S9nnAWLQTQ6uMSM9qRQ+vmE7pMWrEYLbqXkgm2xnBA+rv8KhBidZljIrD9b3vl0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LpppyH+TZRPMImSMb65msgwXr8BDg+yB7jYmPGh/pdI=; b=PqpgCseApIDd0YTSoWNfojInYWQspPzDvckhhD0cBJq05WhFoKJDkvSOizkyfEQURo5tJ96/nzHd+V6t2Pcp0QEcJvMq2g1+TuJIQGDRxhuDDF2hfcZOBq8P+yzH93M/vYD2g3QO0QqHcTsRvCFkkEntpwRyW5R4c777NwRQTK80+acENv2hZnrI3AjzgizPJhU54XiEXC2rkgHyg6PHmSH72CBF98L8Ve1AkKGSpxvidms2LKxmXblGowYNgfINKobncMP5PTWaSwypNvCyZ3eTlI7N4dQG4OWPdwGw9f+OpNjk1Tb/JKkG9gOXKqGI2gfSm6jzi2xOVScOUn9lAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LpppyH+TZRPMImSMb65msgwXr8BDg+yB7jYmPGh/pdI=; b=1rVz0EKHXAFIUCMUxXT1dInfz/BwBq7Pd3RkzgzBbbwbsiuPsNoU/jkciSX6HtOVis1yw4FtaZBN3Er7SBFCKOD9NMg+Pp+AfelIIZOcEeVvmHFBjHg3Q2FfUHEip+cYYODwN6n/BxjVNV85KXQOADN0+9wO5ehWXNduW7irHbc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; From: Penny Zheng To: CC: , Penny Zheng , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu , Penny Zheng Subject: [PATCH v2 6/6] xen/arm: retrieve reserved pages on populate_physmap Date: Mon, 18 Apr 2022 20:22:51 +0800 Message-ID: <20220418122251.3583049-7-Penny.Zheng@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220418122251.3583049-1-Penny.Zheng@arm.com> References: <20220418122251.3583049-1-Penny.Zheng@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 350dfaa3-c7ac-4f11-8f93-08da213654cc X-MS-TrafficTypeDiagnostic: DB9PR08MB6633:EE_|VE1EUR03FT025:EE_|AM0PR08MB3634:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: yZHreejEepp+S4felBM7EMQVtmCTlQr34VytMaysREGzNcXtiJd60MIlPCOeT2jlKvNsFUAQH72n1Fd4dbYHJz3Q6QtZdWB+oZIPIn02pu07gqqHP9UZz9M4OrmBajdJ51B6YLZKPQtkJUeLO0Z6ien6Q4dRDoe5I35fqwYYts6QfNglv7kAbIYcHEgZjoJG0zh3BsLE1vJF/QwqfN/b+Oje4vBU42HrFdmNAoHFPE3/Hc9+fa3zwz3VBfS0uVBMVETMVlQhY1Ky7jOGW8X8+6Rhu+aUVWRjyFfsa6YhvVDBdR4tTymbiJufRz34LiuUqXXWC9PtSPcV9DAWwNDtC/sQJFZxDwebqgxsVt7b2cMaf5DVWxAu0QIDUuwlh/UEyZwiO5XINXkllbg4roN9ZF693vnjNlQp1RJqWUz+lgzE+xBYauv7X5MziDJTsN8Njva9Xe6TNbpizCyGUFDtsbxNgIh+CPxvB7CivXPnNV4nStUCmlNiHivsq6Io7csEjLfcQXPUE9wry7I3b69YZ9s/VYmS849ruLsrm9iXyynSrp+UyEhGTSibByghJSh5So89THrM33mTslbuEDi8EhYQC7HX5hJ1XGDcAjj3oE1A2D9E/igWqfvVsc887R/mCFfGitC5xojJGchhq/dOIHhpxsrTYTolpUsXsHnDmqOmYEuIlzRLiuD8YcswdcjjViq2KygZzlVv4ckgz2HAiA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(426003)(5660300002)(47076005)(6666004)(86362001)(83380400001)(6916009)(54906003)(70586007)(336012)(70206006)(316002)(26005)(186003)(356005)(36860700001)(40460700003)(2616005)(1076003)(4326008)(8676002)(81166007)(508600001)(8936002)(36756003)(7696005)(2906002)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6633 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 08f7a41c-bed6-4869-df99-08da21364fa3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bk898ASg9yrzEoDJJ0v4wdiLXfu0dpP2bD5/GwdDMDyFHTLRuUVjJvySydwjdeMxDXhBoqQWpFm6HgAD6Bd6+VAwVlrIH6dknNrWDHFdxg/iVHZ2Ll3HMv8zIHgFvBDpHnEAYOrwxfDYQYxdM5DlqeTBYR2TIWrX9Hh6G3wjxcnLgjyJwPnd4+nuA6Fh0E2ZL+Z67KVizuO+5lfKfH6AZ/uPbQXUyyCaQJWRTj/EppVpfhyIgE9qSf7q5eZTkpvtoPipw4/6g4gjubdZOCWlA4BNsRV5j41WoqQCyH4JuaprWtFgqoAhSiFUjIjoTOhl8lYUOFOcbTBZakFYItdVbWysFkwGya6S9nXI7bKteGHn71jWW99oQQYlOheFH5aC8zF66s7d47F4BwK3yfB5K46E67Vz4lNevn5hRYiWgoNrDHnOVpQ4X4zRQdyilcizUU0sdCK3rNn5zmO8KPLRzSHMhFbPL+6IMHe2G3ykqcWOH/Z6Tlmi8TeZ+U+FFM/w/e9Z6kGCSUUs5HnJt15ksOF3GsTeqhj5IvySx6kV0kje9GkzpnFtx/wgSwahTb/RXKYWm0VgjxnqZW0ubEkgOEg142admvH5T+0ONQFnOSVosPkyniKTaQeZN4HvVIGC1FGNksPoB2UEtWkW3lZvu2qAmeqjiUlA3QSflpOzVCHj6h2+GwJSDRZD9UEKf9h6 X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(82310400005)(36860700001)(81166007)(4326008)(8676002)(8936002)(498600001)(54906003)(70206006)(5660300002)(70586007)(336012)(426003)(26005)(86362001)(186003)(36756003)(83380400001)(2616005)(40460700003)(47076005)(7696005)(2906002)(6916009)(6666004)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 12:24:05.9951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 350dfaa3-c7ac-4f11-8f93-08da213654cc X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3634 X-ZohoMail-DKIM: pass (identity @armh.onmicrosoft.com) X-ZM-MESSAGEID: 1650284686049100001 Content-Type: text/plain; charset="utf-8" When static domain populates memory through populate_physmap on runtime, other than allocating from heap, it shall retrieve reserved pages from resv_page_list to make sure that guest RAM is still restricted in statically configured memory regions. And this commit introduces a new helper acquire_reserved_page to make it work. Signed-off-by: Penny Zheng --- v2 changes: - introduce acquire_reserved_page to retrieve reserved pages from resv_page_list - forbid non-zero-order requests in populate_physmap - let is_domain_static return ((void)(d), false) on x86 --- xen/common/memory.c | 29 +++++++++++++++++++++++++++++ xen/common/page_alloc.c | 28 ++++++++++++++++++++++++++++ xen/include/xen/mm.h | 1 + 3 files changed, 58 insertions(+) diff --git a/xen/common/memory.c b/xen/common/memory.c index 69b0cd1e50..f7729dfa5c 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -35,6 +35,10 @@ #include #endif =20 +#ifndef is_domain_static +#define is_domain_static(d) ((void)(d), false) +#endif + struct memop_args { /* INPUT */ struct domain *domain; /* Domain to be affected. */ @@ -245,6 +249,31 @@ static void populate_physmap(struct memop_args *a) =20 mfn =3D _mfn(gpfn); } +#ifdef CONFIG_STATIC_MEMORY + else if ( is_domain_static(d) ) + { + /* + * No easy way to guarantee the retreived pages are contig= uous, + * so forbid non-zero-order requests here. + */ + if ( a->extent_order !=3D 0 ) + { + gdprintk(XENLOG_INFO, + "Could not allocate non-zero-order pages for = static %pd.\n.", + d); + goto out; + } + + mfn =3D acquire_reserved_page(d, a->memflags); + if ( mfn_eq(mfn, INVALID_MFN) ) + { + gdprintk(XENLOG_INFO, + "%pd: failed to retrieve a reserved page.\n.", + d); + goto out; + } + } +#endif else { page =3D alloc_domheap_pages(d, a->extent_order, a->memfla= gs); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 8ba38bca9a..759d612eb8 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -2770,6 +2770,34 @@ int __init acquire_domstatic_pages(struct domain *d,= mfn_t smfn, =20 return 0; } + +/* + * Acquire a page from reserved page list(resv_page_list), when populating + * memory for static domain on runtime. + */ +mfn_t acquire_reserved_page(struct domain *d, unsigned int memflags) +{ + struct page_info *page; + mfn_t smfn; + + /* Acquire a page from reserved page list(resv_page_list). */ + page =3D page_list_remove_head(&d->resv_page_list); + if ( unlikely(!page) ) + { + printk(XENLOG_ERR + "%pd: failed to acquire a reserved page %"PRI_mfn".\n", + d, mfn_x(page_to_mfn(page))); + return INVALID_MFN; + } + d->resv_pages--; + + smfn =3D page_to_mfn(page); + + if ( acquire_domstatic_pages(d, smfn, 1, memflags) ) + return INVALID_MFN; + + return smfn; +} #endif =20 /* diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 3be754da92..6ef5a6adcd 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -91,6 +91,7 @@ void free_staticmem_pages(struct page_info *pg, unsigned = long nr_mfns, bool need_scrub); int acquire_domstatic_pages(struct domain *d, mfn_t smfn, unsigned int nr_= mfns, unsigned int memflags); +mfn_t acquire_reserved_page(struct domain *d, unsigned int memflags); #endif =20 /* Map machine page range in Xen virtual address space. */ --=20 2.25.1