From patchwork Wed Oct 4 13:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13408806 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 0BECFE7B61D for ; Wed, 4 Oct 2023 13:54:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.612588.952554 (Exim 4.92) (envelope-from ) id 1qo2KS-0000Va-LM; Wed, 04 Oct 2023 13:54:20 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 612588.952554; Wed, 04 Oct 2023 13:54:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qo2KS-0000VT-IL; Wed, 04 Oct 2023 13:54:20 +0000 Received: by outflank-mailman (input) for mailman id 612588; Wed, 04 Oct 2023 13:54:18 +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 1qo2KQ-0000VJ-FO for xen-devel@lists.xenproject.org; Wed, 04 Oct 2023 13:54:18 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 81608d21-62bd-11ee-98d3-6d05b1d4d9a1; Wed, 04 Oct 2023 15:54:16 +0200 (CEST) Received: from mail-dm6nam11lp2172.outbound.protection.outlook.com (HELO NAM11-DM6-obe.outbound.protection.outlook.com) ([104.47.57.172]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Oct 2023 09:53:52 -0400 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) by SA3PR03MB7347.namprd03.prod.outlook.com (2603:10b6:806:394::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.37; Wed, 4 Oct 2023 13:53:50 +0000 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::66ca:3a42:baeb:9ecf]) by SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::66ca:3a42:baeb:9ecf%6]) with mapi id 15.20.6838.030; Wed, 4 Oct 2023 13:53:50 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 81608d21-62bd-11ee-98d3-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1696427656; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=zAKKZrXT40kxGi6o7MaetvKBywZS5ao8NsgvC6VvEWU=; b=DFuoUs+9IDDi059DLdcMbdi6VeMSSSzBAVS2vzKXIfma+UGQ1wV9GQdJ FpQ5wUplqb7+nPMFyrBG/tqTMkNyehOMAQ2VIazBtPAm/OVwpqlt4prO7 cW9hs9C247FP1kWm+WU9bF89HpFj6FMal9+f7YgmYqJxyloerAWEJAQGI g=; X-CSE-ConnectionGUID: afEOUnMJSoK2u26v7J9LPA== X-CSE-MsgGUID: NdccwdNhQSGL/FQWsIsuQQ== X-IronPort-RemoteIP: 104.47.57.172 X-IronPort-MID: 123862573 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $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hRotKOTOLhILGFvAH0WKP+V3d8mjFh5dgPM RbAtdD4b/LfD9HZK/BiWHXcurIguP3iJxA7d2us0uFJjsaDp2IgT0JaTpyRSZNNXR77NcCZd OhDo0tnUvSRV0nKuCAQlUVVenKoNPG0LrgfB49HhYirCWekD+y77b+Mh6AmjMTSSlGz7sO+X XM11WR3NTvj9iLjjvnk0PD5ZVfn9XsjvNFGcy3k8AQbhn8lwqyY4xlerua+BQ4uvum5loGmM TF5z0gI8NwwXXMeXzdm2qm5yDQlBIVr1Pyw16RhnXu5eT/WTIBEsJEwaZUaAHQ5UYMtMx1lP sj5RPTi7NnSTf72Ajt7dnBUB9n0mKyvHoZiOYWy1hSS5EXZrN9pZEWuGlVDJADNiTn751PKp gnMOjsoNJtNX+KZXHQuWdihPSqQ3QIBx+DBnMPv8SEugIm6ExR/g89/ogyj30A/JUyR91v/O LfKJllk7lIU4s/cb99LP1pe7r3NkX9BTb3dE6CK1XuE68Kf1jXrYTs3bkz7Oa2PLQV0ZoJno jbWl8wjx99R6vXM7zM4HR3yGGOfI3kNg6dj/22pqIJ9YEUfYCbcRFqEzsV4o+dS/Z2OLyvZx /8AuMQPxbZFxqfJW945XyBZ3BsEwhubCRsgKdcZ7uvmLO9FmS4jJ2sTN/jYJzQLB0DZkTTRl M+YRmbHrQz0qnsYA61vCTs X-Talos-CUID: 9a23:mzEc6WNJPQ1KAO5DUSdK03MSP+IedV6H0S2OPRCaWEJRYejA X-Talos-MUID: 9a23:3bmEKwQXbCuQS8wWRXTKiDppK8tO452VJ2RKv6w5oOifKBVJbmI= X-IronPort-AV: E=Sophos;i="6.03,200,1694750400"; d="scan'208";a="123862573" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lc8Nlzvo3wpBZtm4WxUJlkkJNrtNRm29oSBAoWL512XpmfoPbqgs617ntNhE445EMq8GmasLNSe29BZ//nJA4764AeGrhjYcGoKsr8QWHICqXNyybLNgvXfzKDPiJfdXkl//3n+I+n14xSlGYTeMNeWHgcreGaprbcN1bCfCykIwpxE++hXuQagcTDH3pSo4F4ZNBWyAKJi0ojXwAnoYbcKTbB3tNLqrNM3r46XCF2ZBm0nHDJAmQhPayFjCwZ10VyjJUvg3mfV0YPb8QzHc4WchkgemW7yigaAhsLd4QjP9tr8r9Nmjr2dqSZQwhxDItRy4GsOH6y81H7VENlI02g== 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=9T/LvJTMaYmy7DqmDRI5rV0oXDj3OflcxEBGo3ICrt0=; b=WrucLJMBaTxMaAoYul6J0Y7UdDFstTzegWpRX/3Kuts482Ot2rH7MEsB2clfMeDDFysggKTbFFEqMt5MmDa72vSqZ+cPztCwDxAa9eS0nCEIzPbl4cnxcWun3d0wyCY8WDS09aqs9cqA0uYlXrT23Z5ZrjxM8n2z/Ik+JlrtM7gGBPgoiblEEgxj7rKqL9Pr0bqii4bZ18UoJrCHlPqWUrQAQK5QE+B639gG+/kq9LW7YfsxFDn52+Gc8ZnbhzxwGiJ/e4VqkL4q+gN2WjEOJJrCj6DAR2rNpak6RNdPqK3IINfPdKsPiah79RSJY19ALTrEL10LePwbBKSPDq2ABQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9T/LvJTMaYmy7DqmDRI5rV0oXDj3OflcxEBGo3ICrt0=; b=JLKMTIgbeAWPtBLEvDruwuue3Ij6yRGNX/2bCxG0PI80+i9drQpPIZI1fAWoUzwd5O+qgaAN0xVdVaHpmEsKoHAm14zgWrGKk2onCBJpTKZ6/+2nYABmOFXWrAyuVpZnuX8Fizykb0wYA+grtS+KyKx1e9WpRipIdlD9lRRHD80= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Tamas K Lengyel , Andrew Cooper , George Dunlap , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Julien Grall , Stefano Stabellini Subject: [PATCH v6 06/10] x86/mem-sharing: copy GADDR based shared guest areas Date: Wed, 4 Oct 2023 15:53:31 +0200 Message-ID: <20231004135331.83736-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <081ae245-9d47-4cab-ad64-54b33566429c@xen.org> References: <081ae245-9d47-4cab-ad64-54b33566429c@xen.org> X-ClientProxiedBy: LO6P123CA0048.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:310::15) To SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6423:EE_|SA3PR03MB7347:EE_ X-MS-Office365-Filtering-Correlation-Id: 2443ec4a-f5bf-4cd2-ce9c-08dbc4e15677 X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XaRcixdKIqFT2rYIbNeW4CiKYExu2UJE5kWHoQKWjpIARjgcTxgpcflQ2PxDb0HXIH1rGRHp+ebHW8IarosCdfFZHmBjtyoAeOyIPXddYGxo1TmF56WwVDf8yoLEJ5Acfk8ZUMbZs/HI7WHbc+8c7kHtyyCvyxBte885a5qbMXiy7Y5lI/Ua2/QGi3eiNWeo1sY2jr5qX+Za1iIULSrV/+sJ3c1iv4MwuQlUuZzqKNLxpV0XasG12QsjkqHXPiserQP9ScL9rzTUPgQcQLze5cvkqn8qzuFRP9JM23AzKnH+VleqULQx74g/yS6mB0YQN8Pdgclig2pEo1FspIkU6Nb5yOxGEFy5nmUQCWMfxYv7YgEU++j4XNv1eMFtC7Jqj8WVbNuWcFroANiK62oU0f1bM5AeJ4GL9y5eP3KEhzss5Xqw9pzYzmt47/uAlKP1YdxCoCCscgAYt7DNsIpGlS9HM6Y6pbqx3eUBejcbzddicR+0Yt/xneRU6rtqpj/fiUaJYaCrnMhLvhJWUZm9Mkrdjd1NpK/Yvv0yeEjnMKkfYELUC1yNMdCL+ukZ8L8b X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6423.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(39860400002)(396003)(136003)(376002)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(2616005)(66476007)(54906003)(66556008)(66946007)(6916009)(316002)(41300700001)(1076003)(6512007)(26005)(6666004)(36756003)(6506007)(478600001)(6486002)(38100700002)(82960400001)(86362001)(2906002)(4326008)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OsaOlFCESsjGDFjMPNy5LfVxjKY3?= =?utf-8?q?dRLGKuJclATvcHiPFjmWrbpn7qbBK5WXskEmzc9ylhWwzd6cGJc844gyd8JsQX5QD?= =?utf-8?q?n83eI6Dh1xRh2PJXJvnParFEIGwEwmV9RGcDM/FUZ3qxScO2co0SakGLRxb7gpOlF?= =?utf-8?q?X0RomgdH7F6pFszACKoqFoKSLPDXLLuRp8AkXeXmWjow4pUKIR9c1ZLp+9Y/uyNEH?= =?utf-8?q?eXgDPbw86Kxiuyk4Ewpsu9F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VxprksH3sNiNhzxmPGwqwtXE602g+Yb/dem28M1HpFLG3PHsm5hQrgvvOEeccVviw5VFx6IgDO+LdWP7og/bxfqY9k6aL2WkW60BsD40HOauH4G4+E/2Pobxn/IPwpbNS3dd39EK5NS2YcWkD7mHGW1XPPhx2u1yK7tfiZkksOhn37woGved4cGaG8CmP6XCWut8nB6NR3Ztl2f9fr4cw3zw/BFFEC0Z981Uka1YCQQzDugO0SOs8bKzlCSSBnwwprn6kBx4rS4Xq23u7BGDpYHBulH+OhSLvGlOH8yuZIpYoObJt8jpkJyy0dVWNJeAHYlIN0+3PW1EvFWfULv6qTFu0vW4qvCl45BA8h+vkYkVpVgsSoCXbP0UEBNYcb0H02r4D25FYA3JKo+FlgyPaltRovjVE+RaH9F0GnHoRVh51BZa0etYb7dNrkNkfvg06OeZqgHzhJ7UMopZP7uIn2bw== X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2443ec4a-f5bf-4cd2-ce9c-08dbc4e15677 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6423.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 13:53:50.3224 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OX2E9CXCg6XQ/ASnebKPf+84llvbYN8wEcXUH72YEvHpyDuEfFYXSPeS1vkuBdlLueBGfdkdixXWTduQPKwQPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR03MB7347 From: Jan Beulich In preparation of the introduction of new vCPU operations allowing to register the respective areas (one of the two is x86-specific) by guest-physical address, add the necessary fork handling (with the backing function yet to be filled in). Signed-off-by: Jan Beulich Signed-off-by: Roger Pau Monné Acked-by: Tamas K Lengyel --- Changes since v5: - Convert -ERESTART to -EAGAIN. Changes since v4: - Rely on map_guest_area() to populate the child p2m if necessary. --- xen/arch/x86/mm/mem_sharing.c | 36 +++++++++++++++++++++++++++++++++++ xen/common/domain.c | 7 +++++++ 2 files changed, 43 insertions(+) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index 5f8f1fb4d871..445947b6a918 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1641,6 +1641,24 @@ static void copy_vcpu_nonreg_state(struct vcpu *d_vcpu, struct vcpu *cd_vcpu) hvm_set_nonreg_state(cd_vcpu, &nrs); } +static int copy_guest_area(struct guest_area *cd_area, + const struct guest_area *d_area, + struct vcpu *cd_vcpu, + const struct domain *d) +{ + unsigned int offset; + + /* Check if no area to map, or already mapped. */ + if ( !d_area->pg || cd_area->pg ) + return 0; + + offset = PAGE_OFFSET(d_area->map); + return map_guest_area(cd_vcpu, gfn_to_gaddr( + mfn_to_gfn(d, page_to_mfn(d_area->pg))) + + offset, + PAGE_SIZE - offset, cd_area, NULL); +} + static int copy_vpmu(struct vcpu *d_vcpu, struct vcpu *cd_vcpu) { struct vpmu_struct *d_vpmu = vcpu_vpmu(d_vcpu); @@ -1709,6 +1727,16 @@ static int copy_vcpu_settings(struct domain *cd, const struct domain *d) return ret; } + /* Same for the (physically registered) runstate and time info areas. */ + ret = copy_guest_area(&cd_vcpu->runstate_guest_area, + &d_vcpu->runstate_guest_area, cd_vcpu, d); + if ( ret ) + return ret; + ret = copy_guest_area(&cd_vcpu->arch.time_guest_area, + &d_vcpu->arch.time_guest_area, cd_vcpu, d); + if ( ret ) + return ret; + ret = copy_vpmu(d_vcpu, cd_vcpu); if ( ret ) return ret; @@ -1950,7 +1978,15 @@ int mem_sharing_fork_reset(struct domain *d, bool reset_state, state: if ( reset_state ) + { rc = copy_settings(d, pd); + if ( rc == -ERESTART ) + /* + * Translate to -EAGAIN, see TODO comment at top of function about + * hypercall continuations. + */ + rc = -EAGAIN; + } domain_unpause(d); diff --git a/xen/common/domain.c b/xen/common/domain.c index d4958ec5e149..47fc90271901 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1601,6 +1601,13 @@ void unmap_vcpu_info(struct vcpu *v) put_page_and_type(mfn_to_page(mfn)); } +int map_guest_area(struct vcpu *v, paddr_t gaddr, unsigned int size, + struct guest_area *area, + void (*populate)(void *dst, struct vcpu *v)) +{ + return -EOPNOTSUPP; +} + /* * This is only intended to be used for domain cleanup (or more generally only * with at least the respective vCPU, if it's not the current one, reliably