From patchwork Mon Oct 2 15:11:23 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: 13406370 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 97146E784BC for ; Mon, 2 Oct 2023 15:24:17 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.611655.951202 (Exim 4.92) (envelope-from ) id 1qnKm9-0000Gg-53; Mon, 02 Oct 2023 15:24:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 611655.951202; Mon, 02 Oct 2023 15:24:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qnKm9-0000GX-25; Mon, 02 Oct 2023 15:24:01 +0000 Received: by outflank-mailman (input) for mailman id 611655; Mon, 02 Oct 2023 15:23:59 +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 1qnKb0-0000iK-TO for xen-devel@lists.xenproject.org; Mon, 02 Oct 2023 15:12:31 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 198510d0-6136-11ee-98d2-6d05b1d4d9a1; Mon, 02 Oct 2023 17:12:29 +0200 (CEST) Received: from mail-bn1nam02lp2041.outbound.protection.outlook.com (HELO NAM02-BN1-obe.outbound.protection.outlook.com) ([104.47.51.41]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 Oct 2023 11:12:25 -0400 Received: from MW4PR03MB6428.namprd03.prod.outlook.com (2603:10b6:303:123::8) by PH0PR03MB6680.namprd03.prod.outlook.com (2603:10b6:510:b8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Mon, 2 Oct 2023 15:12:20 +0000 Received: from MW4PR03MB6428.namprd03.prod.outlook.com ([fe80::ddbc:172e:c4a3:ec6f]) by MW4PR03MB6428.namprd03.prod.outlook.com ([fe80::ddbc:172e:c4a3:ec6f%4]) with mapi id 15.20.6813.035; Mon, 2 Oct 2023 15:12:19 +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: 198510d0-6136-11ee-98d2-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1696259549; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=Wmu57Iweb823GQ+wLjFQQNOvbip8ENNcd7NtaI7MLwQ=; b=aI8rct8KLy1qSPrjQ3Ao32aMqGT6Dyu4IhzXADtJU6iwFrmCrTQp7QsZ F6DdYsW2McBgig5NOdEfrYnwrUKG99Bss4rdt7hHVgFq1Bc5fbEPLRUF2 lHVz4IC3s+JjxicZjoPR+adaMg0C/U+WbCoJmOj8mReJwkiwGgR6JetEI k=; X-CSE-ConnectionGUID: 17r7I/A3QciTLPErLc/vrw== X-CSE-MsgGUID: Y0x82eQ+TISu8fIK4QEFhg== X-IronPort-RemoteIP: 104.47.51.41 X-IronPort-MID: 124817032 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAY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7q90ca7Lk80maQa3WBVB8bBYOCEghrOEGgB1/qA/9SIIUSXmtK1l5 0QFpSWYOeaMbEQt7ef3ODXKbcdKNnsytHWuQ/dpU0dMz2DvctbnnZE4gXwKDwHeOFfb6BJba Z1fqB81kedkXJ8VLXCOlA1G9Ltivfsj5zcbRsPF3ccmXWzZWPB0s+AL/CAtC1uKQ9y/Q== X-Talos-CUID: 9a23:DkldGWCjkBtp7zT6E3A47hE1Xel+S3bc8FPoDlWcAiF3UqLAHA== X-Talos-MUID: 9a23:rpP3kwlfC++2O4zE68F7dnpTbNc4uamXS3wsqohWteinaRVdFTeS2WE= X-IronPort-AV: E=Sophos;i="6.03,194,1694750400"; d="scan'208";a="124817032" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ijVBSAH1E9YQm/+RCyuPbs9r4A3PfVJK6X/TQLGxd7jMFFhWSu0XvDX02bCHpKM9JHEyagfdUedlb69SaMcBz3PRwy0rLR01/UBQZ8pX0+qcpHuES7dvoDXguBWMWVA2EAzBzV2v6/qgFVJq+AM6jqJ5XfE6Z3c9RuMlyWT+p4aGaCxqE1g0bxcNcUVX3YO44h1tPYjEf3Rw5CHtFiXId1JMbr0IU5C80xCFGYUP72lhYQVSyc0O2uHFR2J18perd5fPPfG8vK/SfryzdcfFuFETLo7+dT1LJgrCLyl0tXpzWoVqBZrT6QuloQPK8CgDpLEizSTVR4aX8zBNAiC+eA== 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=nvG7viCgQSkvoHQeBIteDFdRPqHhGGdm2eXXhEsoH1M=; b=F1xlt7C10eGaajsY+JSCnVRwUBX4DCKUW4xsPzSz8IeJI365bHfn3uwSfBluPkUn8rwuoBRAikJld8Lqu3Bf5h0+Ce10McXOxQPW5AzU1p10qiiKOTsyWIKm9n99tEZL+ZVtVs4B6XGZrkloTI3l4AvCM/eJxRixDpfz/SbI9ZjlH9Bk+gG3aSKxtvckSILYBXMY0fVdapOIa3E4heLKCB+/awb82prxq+9pczC4uNeulRVvVksCE4qVbcMs1xDVkoTnxYmlZhBOrr8QeZ8qUusUR4H4PRiVdbdzch8QJS2q9dm5Pkxf19UKWo/6e1ViOsk3Vyo5z0FZO2OCdXI0bQ== 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=nvG7viCgQSkvoHQeBIteDFdRPqHhGGdm2eXXhEsoH1M=; b=EjX48Uk6vz3+maFxMsbIzx6buFCGHFxQwehUB9iNLc0oKzYuwBHJW/a/h/FzaUh/CJ77FyXAJxEKwxvx9NYS7BJyej0in377R7d2SnhqDMbE4xMffesJiA/FsyJduEMD0ATqWm/giOXelQGza6cTSp/sqa151yqLD5KhSUFO09I= 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, henry.wang@arm.com 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 v5 06/10] x86/mem-sharing: copy GADDR based shared guest areas Date: Mon, 2 Oct 2023 17:11:23 +0200 Message-ID: <20231002151127.71020-7-roger.pau@citrix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231002151127.71020-1-roger.pau@citrix.com> References: <20231002151127.71020-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0168.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::11) To MW4PR03MB6428.namprd03.prod.outlook.com (2603:10b6:303:123::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR03MB6428:EE_|PH0PR03MB6680:EE_ X-MS-Office365-Filtering-Correlation-Id: 048fe6c9-26a6-425c-3660-08dbc359f871 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: o0aZu6URk6qrBrXCnjvk0o2cgRxkoHQ7WLTEXSuXT4G/lxOvxW3so3DXGwsQ8OQMZ1eDUuDsiXAwHK0scbuleeSasBJytL/bX+TBfGjPwjvhhbNWOuKLNbde9FsHpYaEnnJQ7REIzLn0reeNBGmVPNEdih/yQidKVZxkiFYdB033oLQ9fdaYh/lDnCg4qt0/smNtaBRDkoXpCI7GKaA1Yijj3eu4y+8iFmCQsuk0WzA7BqAeLM9d/DdUiVVouOzk0olH+BaEXZeisat4rA+ol4+kexAsIPnK2W/hVcPUcYHWlknTkVtI9uCHAhA2p+Cv5dNFOYXqqPkRwM8Wdf5NARjBid9kKd0weKnK7kmgqtIF1jLYXpqOZwxtzara78YeRoonLxFtnp5tUbZlLF2/W/mFxKMWa8cMwMNHSFyXSYCvQ6yiuENDLXT8TyQiZE12Hr1DBoPLU1eAXCEl1w5yP1RLgT9VRs74VmviAct6UmIjKLz6AvId7UE9F5PopDtxoqPgGudDAfcrkuBSDKl0wso4KiHYg1OjI/55adM/bFlfo3MdC6PJ5Iop89iwEOUn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR03MB6428.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(396003)(346002)(136003)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(36756003)(2906002)(7416002)(26005)(478600001)(4326008)(8676002)(8936002)(6666004)(6486002)(6512007)(6506007)(2616005)(1076003)(41300700001)(316002)(54906003)(66556008)(66476007)(66946007)(5660300002)(38100700002)(86362001)(82960400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZhO4HXBFbQLm56BG6R++4bOcdp0M?= =?utf-8?q?oAzEWac2N5/3gU7fSIG5JopOoL+TmBLC60ATn71CCNjj4LOjtLH8Df7iIUj66qAkb?= =?utf-8?q?KTlTxbfp0qeouXhwxE5yTqXm7FgpBwNMI+UdARB+KhaDlu7ccm+Aqm97PEc9nO504?= =?utf-8?q?A89I8JnaMWGrL0TI09x1+VVfQt9aysSkNE21H3Vico0+MFbRwdXAasx9vPIm9vCW2?= =?utf-8?q?4j+iIgHWtDN53HQxDtR357I7JovLirNEn0LypUzOZqX/DGDIHtIWDI11wTwWohjo8?= =?utf-8?q?rvIQhGwiTyDakdPgqX6pqnGO01rnClFDdde3wtgD+s6s+Oa+g0dlYklI2yQQWvL3m?= =?utf-8?q?m5g9EA1FkScIlDWqApL+Tu7cJ/mCBleKUQRGiGjT8YfztZCi+P+xeLvW+CqcIqXuo?= =?utf-8?q?qpfdTEcobE8edDbHGxMwUichNa74bKtP3hxUPYiM+VjlFYmLB209eRU0+ibV1oFAP?= =?utf-8?q?zopTxN2CrA10nRMLQOfhW3tYW6RIYYqlHN5W7cVqTcqbiFRq7rXljZ3v6enAAdq14?= =?utf-8?q?UqK2CXC3TXejEQwp65v3YkCsMGw/Oij0fhGTd4zRn0g9JmpbNKG5S7CNwFMKVAWfw?= =?utf-8?q?2NVVz4GSVVNYS45BSMe39T0+GvWUJG+KhcbM+g/fJHbkQEIP72gIyAd5hS8TnUCcV?= =?utf-8?q?8BZMhb7dQN71VnlW+f/OATGbm24eh0+U7MrppQ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-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0sR0FkxPL30dtLdZMUUerZTSSjwWvza8b4CdnVpbP0uZYTWtZJD37d39OuYKZtsWdMCKcP04vMQ9QkQwnnQYUGDVS8v00GUZZbsvxdgs0ATy+9vz5Ayp3f4na7eZtT6zdkcLuoPrDKRh6thQ7Tn8v0ynyHfkfG2vTXjUUSBKyjynXKDNb0wkQ9lRPIDjZpYF0UR2ggTqDVkUno8kppbxyu1HfV0a/NEfHUhn7ua5m7qoJfbXcfxJyMmYP7B7SYLEr2+P3jPleURGnA2bEPae6inSEF3kkIvGH4cvX/lgo+64Q9EG3G8iwlC/ebVdShZs08VjY4chfE3FxewH2ReGq+sZis6vJzSKzQ3MEato4SPAldbn4uYmeKHEiLENE43+OTEWLpP8J9hxqle8p1k2OQnK4NMj/R8xwLRnnTxMz4KoddeyuCJztDOscjurxVgJUmOm5b3KrhL0S/seT+bwjpSykCYrcMskGIv4NdL3rHm1ITkdSMTTpk3I7iDyfyk6+NcUy54LsOdbBZNOnumzgeu7BkB3krMtf+8m4KU8O+u92YYKONCzIZeW/gRDHrDNXHVCRrxoWffBASSKnWV3K2XRcsqYL6w7XX97j7w80lhYMT3lnfeHq0IDITLvjv0flFxBrn2oDmWZt79iFwwDi+s9qUEPniYazWl/Rzr6CFiMPeWfCr5GitfAggCSfGWv/8Webf8Dz9LUpDBJ8K4D2OqfGF4tk9WcYra+327EuvfLFYfwEdxrQHqWSrVMDjcw5DJmOfBl9Nfq7gedsVNs6kVWiXKaynUbEy9qfE9pLFbcsXcR54VR4C8sCmd3tgWgbwsIwnEz+BZaTgyjIJMe/gTmxllhghY335wdRhLPSyuNGsbv0MTYMICwNpZjhJ75oQZbF7GMnzNdcUV9FT789cHa+sXBic4uct1XEAy5rBM= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 048fe6c9-26a6-425c-3660-08dbc359f871 X-MS-Exchange-CrossTenant-AuthSource: MW4PR03MB6428.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:12:19.2895 (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: ul2ZOnIbcaYNCp/oRCJoS/UtestZo3QuqEcgayIi/Gc2xT7xAFIes/XeZrCkKZMm2bWJYh6jRpg41FIx7+qnFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR03MB6680 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é --- Changes since v4: - Rely on map_guest_area() to populate the child p2m if necessary. --- xen/arch/x86/mm/mem_sharing.c | 31 +++++++++++++++++++++++++++++++ xen/common/domain.c | 7 +++++++ 2 files changed, 38 insertions(+) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index 5f8f1fb4d871..99cf001fd70f 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,10 @@ int mem_sharing_fork_reset(struct domain *d, bool reset_state, state: if ( reset_state ) + { rc = copy_settings(d, pd); + /* TBD: What to do here with -ERESTART? */ + } 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