From patchwork Fri May 24 22:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 13673777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84547C25B74 for ; Fri, 24 May 2024 22:55:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.729961.1135300 (Exim 4.92) (envelope-from ) id 1sAdoq-0003hd-4x; Fri, 24 May 2024 22:55:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 729961.1135300; Fri, 24 May 2024 22:55:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAdoq-0003hW-29; Fri, 24 May 2024 22:55:24 +0000 Received: by outflank-mailman (input) for mailman id 729961; Fri, 24 May 2024 22:55:22 +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 1sAdoo-0003hQ-91 for xen-devel@lists.xenproject.org; Fri, 24 May 2024 22:55:22 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on20601.outbound.protection.outlook.com [2a01:111:f403:2409::601]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b12c02b0-1a20-11ef-b4bb-af5377834399; Sat, 25 May 2024 00:55:19 +0200 (CEST) Received: from MN2PR10CA0017.namprd10.prod.outlook.com (2603:10b6:208:120::30) by DS0PR12MB8271.namprd12.prod.outlook.com (2603:10b6:8:fb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.19; Fri, 24 May 2024 22:55:16 +0000 Received: from MN1PEPF0000ECD6.namprd02.prod.outlook.com (2603:10b6:208:120:cafe::76) by MN2PR10CA0017.outlook.office365.com (2603:10b6:208:120::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.19 via Frontend Transport; Fri, 24 May 2024 22:55:16 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by MN1PEPF0000ECD6.mail.protection.outlook.com (10.167.242.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7611.14 via Frontend Transport; Fri, 24 May 2024 22:55:15 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:55:15 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 24 May 2024 17:55:15 -0500 Received: from ubuntu-20.04.2-arm64.shared (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 24 May 2024 17:55:14 -0500 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: b12c02b0-1a20-11ef-b4bb-af5377834399 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P86ml2ImLLdk0tR6fwVig6HAwv6f1oKe4wo8swBuavm1i8csO3VXvyeV881K++Xq8A6jePiAwrevgE8xTpb0aAAhxUki8hBPZee+S0mC387RSMuGT64JZGHq5sLoQzqmX+AWl558TsUP0MUdyhk7cjINDMRqXJAOp1D8K9XNkBX/Ww85+jkuX+pGU6WvCZ0mP7FJboaDs3gBe5/8RwVG7tw9Gfrkc9IuaoUFYc+19aWp41Re3x9Znx2YdXEWXJZYyW1hrDy7MFM66s+jv9EoiVoYux6BTLEyG1rMO9FK8QnSS3jBoHqZh9IrbR1DE+UPWxZTh8hpQtwxMhKdhbV4rQ== 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=zd6BFqoJqToWgUD+RZyQpDUm3wIFhBhW1r1MhJgBycU=; b=HCtN/bF8na234H4nRW/nRWfKOqQ5OcMBtDCUCqZ5J2UaFzHdQC7vQyI80/VdGc1UukNqEGuBRksbRtbAVUId6G54hM9PeDQ4rYNa4JW2XhLla12zzjOI+SY/qbnW8l490Xs/uO3kK6nfRuMQCFBIb0jk3iHkiU3geb79GO1W89kG4dmZ0p9HA6zJ5bScqXV1rXs3HpynM6/cFPMrRlPNgqFmH1JBuo7unOk6ti5qmxMyie127IKk1jR+A3zvwryDIM1fOxsd/OueFHeO+ScAN+x4QRuHD8J9T4wkW2XAbcOL3+AqNiboXuCds9iBtpofK4ghKbmpqHfvvrPyrPV3Bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zd6BFqoJqToWgUD+RZyQpDUm3wIFhBhW1r1MhJgBycU=; b=VSsEzGCuLGL5QYFaKjUbZ3QABhzl8S3f8cqLOGZa7b+7qVL+9qURueBlgvVU1fLYZpT0Exp3VglABrRSyn7hERcHrHZn76ifdSde2BbvjwkYAXJP1Rco0ZcJyX3HWtuFVx347YOyu5OmfsQqLxikuJGMGOh7KDDv/Q7Wk+MKcfA= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Date: Fri, 24 May 2024 15:55:14 -0700 From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: CC: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Anthony PERARD , Andrew Cooper , "George Dunlap" , Jan Beulich Subject: [PATCH v4 0/4] Guest XenStore page allocation for 11 Dom0less domUs Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD6:EE_|DS0PR12MB8271:EE_ X-MS-Office365-Filtering-Correlation-Id: 88e9a090-8f59-498d-f46e-08dc7c4493c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|82310400017|1800799015|376005; X-Microsoft-Antispam-Message-Info: 2eIF8jllDoHxAC+ykwwriGf8r73p+yCM5gVA1usKfJHwRUZ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Xs7YOvOg6HRaQwhgbFR+7+czZtX79E8WjXxNgXFiQNjL7wzGu1AeXFB8DsIWCArTlwjgwzML6JK3EC2UdYmrujlQSv12DTwQoEIyLOKHp8jTGmZqvwH7ugjOi2y2VBQ/QRTQbRpH22zdfQG5f2VRYlP9O0ueA99iVnSPsBPRAlS3tNQLvKFVPszzHiRU0FcCEcFiFrCYKb6uNqsyFc4p9nl3xl+bxSXkmuH4Xw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(82310400017)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2024 22:55:15.8299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88e9a090-8f59-498d-f46e-08dc7c4493c5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000ECD6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8271 Hi all, This series is trying to fix the reported guest magic region alloc issue for 11 Dom0less domUs, an error message can seen from the init-dom0less application on 1:1 direct-mapped Dom0less DomUs: ``` Allocating magic pages memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1 Error on alloc magic pages ``` This is because populate_physmap() automatically assumes gfn == mfn for direct mapped domains. This cannot be true for the magic pages that are allocated later for 1:1 Dom0less DomUs from the init-dom0less helper application executed in Dom0. For domain using statically allocated memory but not 1:1 direct-mapped, similar error "failed to retrieve a reserved page" can be seen as the reserved memory list is empty at that time. In [1] I've tried to fix this issue by the domctl approach, and discussions in [2] and [3] indicates that a domctl is not really necessary, as we can simplify the issue to "allocate the Dom0less guest magic regions at the Dom0less DomU build time and pass the region base PFN to init-dom0less application". The later on discussion [4] reached an agreement that we only need to allocate one single page for XenStore, and set the HVM_PARAM_STORE_PFN from hypervisor with some Linux XenStore late init protocol improvements. Therefore, this series tries to fix the issue based on all discussions. The first patch puts a restriction that static shared memory on direct-mapped DomUs should also be direct mapped, as otherwise it will clash [5]. Patch 2 allocates the XenStore page from Xen and set the initial connection status to RECONNECTED. Patch 3 is the update of the init-dom0less application with all of the changes. Patch 4 is the doc change to reflect the changes introduced by this series. **NOTE**: This series should work with the Linux change [6]. [1] https://lore.kernel.org/xen-devel/20240409045357.236802-1-xin.wang2@amd.com/ [2] https://lore.kernel.org/xen-devel/c7857223-eab8-409a-b618-6ec70f6165aa@apertussolutions.com/ [3] https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2404251508470.3940@ubuntu-linux-20-04-desktop/ [4] https://lore.kernel.org/xen-devel/d33ea00d-890d-45cc-9583-64c953abd70f@xen.org/ [5] https://lore.kernel.org/xen-devel/686ba256-f8bf-47e7-872f-d277bf7df0aa@xen.org/ [6] https://lore.kernel.org/xen-devel/20240517011516.1451087-1-xin.wang2@amd.com/ Henry Wang (4): xen/arm/static-shmem: Static-shmem should be direct-mapped for direct-mapped domains xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor tools/init-dom0less: Avoid hardcoding GUEST_MAGIC_BASE docs/features/dom0less: Update the late XenStore init protocol