From patchwork Mon Jan 9 13:39:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13093593 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 6B496C54EBD for ; Mon, 9 Jan 2023 13:39:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.473633.734335 (Exim 4.92) (envelope-from ) id 1pEsN4-0005zc-4Z; Mon, 09 Jan 2023 13:39:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 473633.734335; Mon, 09 Jan 2023 13:39:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEsN4-0005zV-1s; Mon, 09 Jan 2023 13:39:26 +0000 Received: by outflank-mailman (input) for mailman id 473633; Mon, 09 Jan 2023 13:39:25 +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 1pEsN3-0005zN-HI for xen-devel@lists.xenproject.org; Mon, 09 Jan 2023 13:39:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 06bc94a5-9023-11ed-b8d0-410ff93cb8f0; Mon, 09 Jan 2023 14:39:23 +0100 (CET) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM7PR04MB6936.eurprd04.prod.outlook.com (2603:10a6:20b:106::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Mon, 9 Jan 2023 13:39:21 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389%7]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:39:21 +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: 06bc94a5-9023-11ed-b8d0-410ff93cb8f0 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJ4khDbk3cVq5YTxYUB4dk52fiu5dfEC2JdUpW/bgZv2WY4hGFK1tBOFRAKW6PERxDS3fGqBKaU5o3WgW9kF91NC79dhBf/lmHYJ/El8M1LQrCJgrghnQd+Oj2ZFAXVZN2/h1HQ7HfdDqrBZp8VJpfWXm2zBF7Y57ccWVL9ylBPuplVn7cSABZiTj3X7vrEIE1vjV1D/4K3Fmu6GFNN/oyyxwvzi0GbjPx2MYoVs2Ln7voabdMqnq0u4dHlgTQiSxvpx3IiuOQjZfYu8rGE5IZP51NCjeBB4OhMEgAfamRRA4waQ3TleAM+axyU+f4GO76YEnbi7jxfG1gfQesa5Sg== 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=yskimPD3tXl4FmikgAtMvcJ03/xUebDIDOeJX91rW+Q=; b=KHg1zGii2t2RB72aGsH9fmlw3vmZPlqXjVHO7pzslCdobHcGatCoTv9lqqku7VPFh7EH0C7B/P468G781vvy+zF+HzikvP/D2mdGQTXzrXbJFzE7/G1X5bgVwPxoJZGtTdUk1+5FwOt0OhUQGEng+ols/27ZQDIIyiLC74le5KUwrGV1SjiOSH3OzDFc0gxqDFFF59UHCY7GNjZC4FhKvSWx6cq7SGR/8l4rqmyHlcP8yarDoSbhidczflPHj/FVmWXtMxr6h3COwwG4qRG/iJ/WOPIbG2oQHTXSn1FTsT86LoGpKEHvIbxJaBOIl3+Zj3VRx3NtBXRMuWDLFawBgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yskimPD3tXl4FmikgAtMvcJ03/xUebDIDOeJX91rW+Q=; b=Xr6MwYYcMAQZp0cWnSjmdvTPUgEAldOpZaNZi1DcyPVEvdasfK2vGAWgDyMGlhDcT94jY9xLTtQWC3Upnw0ERYe7RrOBRBNmpzxygdr5eaQ2D93NcWLZuD8SvNb/+Dc8u2gLzzqTVq0RToVwkB7YHKmCAPJJdr5SePdVcPSLvTxw4BIR8fdel1N6zPRA2Keu6O5raCcgjOd/fUBGoVrJfuLrT1xmmhwPW/q4ICsUPRsEpMZ8xw3PCN06hNt1WCl6rhvnrVDjCMDUgF74nJA9fJoainBEWPJfZnEwK2dlCRCy5u7cagri84AngwnuRkPvtLRhhRwNo12ctg853aw8yA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <67b9378f-cf4a-f210-aa2d-85af51c51ab0@suse.com> Date: Mon, 9 Jan 2023 14:39:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH v2 1/5] x86/paging: fold most HAP and shadow final teardown Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tim Deegan References: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> In-Reply-To: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> X-ClientProxiedBy: FR3P281CA0208.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a5::18) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM7PR04MB6936:EE_ X-MS-Office365-Filtering-Correlation-Id: a8da4fec-62f9-4d64-4f16-08daf246e9ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X8wAcUZhned8iPJmlDUNadU0pDJVOBRfbCBt5jvVCZK43MGOY4X9xudFhiswrm6j9hbeWHRQ4C1EW3QILnI7s1A76WawJvgtGfVTA8w02zeYcDflNQbCOH1UtNbVMqxZUe3pWb0s112qQqKTITaZ5gqIr62dXjI+IaAUZK/0UovstgPdoBIuiJ7Bx5QBNCo0MeYVhg6i9e4o4TN4xfg9P6EDOVygnaaqVR/dyKkxA4XBwi6+WjZ7QwJU+bHHgWb62mbvJeBt3aGQg6u6qD27skqKJZYAqEzq5q55bY8hu6HuEFxmCyQjGMTgsZtkjCezDndY1Egw4JKuKPzMDLm5I2KkWjQXuoh6HHmK8F/AGehnyBz0Bsv58O4eb0YOCZIVCsfBwDm6BNlmLR2Eg1wmh3pSbN3GZPg3YsxAyr+mzFM+J3U973K73e4j/+lV3WHSOxvSjI+F1SptEMegEu9OIuFlqU5jgGYPlwut3QUQiywqx4yhnjjfnOb7jVI1yQOgMxVrftHcY21n64I7JOFQTr4bz1xmznEtS/9G4krLAkgj43x4OeOtGORzavZbbg3Q6vogR1pOTHoI4/h44mKKAGyLIaupwoYWQ6lkyo0g3FmrIsTOfPalB01L9BEKmbDArqm/0VgHfHZxv1T6C5YcJ/bCxbHuIVIbUHqxgUu142wHyN58wgSuODM5qu2ml9iUOhI9cwVXmOwotOtQItiO+KxG5ARLzCNWumqnEbraIl0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39850400004)(396003)(136003)(366004)(346002)(376002)(451199015)(83380400001)(86362001)(31696002)(38100700002)(5660300002)(41300700001)(2616005)(8676002)(478600001)(6512007)(6506007)(316002)(4326008)(66476007)(186003)(26005)(66946007)(6486002)(6916009)(2906002)(66556008)(54906003)(31686004)(8936002)(36756003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jNep1vE1PrOAWt646MSVifthtxBQ?= =?utf-8?q?6ch6M9DoAqw2kOv4F0H0MZvYJhAlbBqKrMvHLaxF/yr2OfRhkRCy2oaVcdYEJFfEx?= =?utf-8?q?DYVOhS3g+qCDrvP1zvXylPlk2LSgLpWBUjBLfvCJS+Kmm35JB4DfVEvN6KKk8oIkk?= =?utf-8?q?IL3IdM4QBYdz048qgQSY85+1djVdvD6/4M3YFm09yagaUXHvGQWGLs39bqCURJE6n?= =?utf-8?q?DEGwmfr4gHEJReQJefDL6FG6aj05uqy2KjT5iIa47RQ3BTvNa2kLHAXgFANG1Yu9T?= =?utf-8?q?Vn7Td5cJIUpBQ+btogk8NsHpNO1xMWZO+BWv1MN3O+Kh4klFtqpYYwyQ8mBZi2ubM?= =?utf-8?q?1pObs7+T7Qj9Dx2qkeyaTOoIy/BBjev7T+r2rS0qBVtCXfcRezG9QPqWR64Azd4Ev?= =?utf-8?q?KJ12uum+NCG9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dI+DTOyEFezLIw652y2Bw+V7HIcaVA6svX?= =?utf-8?q?dIIx6Xu3epdNAX2pBKyDhRxSVOrdOot7bm+wOWsCBoKgwCv1gemEEI6U2Fwd2nZZs?= =?utf-8?q?/S4rP40wWVc4OBcI1+VuwpHOKIBGKYCMOq5+WYixph0lLtxGWwg835Y2SPAlW5bZs?= =?utf-8?q?9cVtX+DtQHHABnwnK9VWIv7f4Ngsspe4dbTQDXhTP2h73RvZdGR01CsJJKI1TfDgx?= =?utf-8?q?sQ/fNL6vJZQP?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8da4fec-62f9-4d64-4f16-08daf246e9ff X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:39:21.5677 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Uyl3MhlNygBrjHdR+lDpUwNRec7MV4mrWTXFOA6NSVVpznR13HuBvtfkBhV67UpiqcvBCM5WTvZkk3foDuueAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6936 HAP does a few things beyond what's common, which are left there at least for now. Common operations, however, are moved to paging_final_teardown(), allowing shadow_final_teardown() to go away. While moving (and hence generalizing) the respective SHADOW_PRINTK() drop the logging of total_pages from the 2nd instance - the value is necessarily zero after {hap,shadow}_set_allocation() - and shorten the messages, in part accounting for PAGING_PRINTK() logging __func__ already. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- The remaining parts of hap_final_teardown() could be moved as well, at the price of a CONFIG_HVM conditional. I wasn't sure whether that was deemed reasonable. --- v2: Shorten PAGING_PRINTK() messages. Adjust comments while being moved. --- a/xen/arch/x86/include/asm/shadow.h +++ b/xen/arch/x86/include/asm/shadow.h @@ -78,9 +78,6 @@ int shadow_domctl(struct domain *d, void shadow_vcpu_teardown(struct vcpu *v); void shadow_teardown(struct domain *d, bool *preempted); -/* Call once all of the references to the domain have gone away */ -void shadow_final_teardown(struct domain *d); - void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all); /* Adjust shadows ready for a guest page to change its type. */ --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -268,8 +268,8 @@ static void hap_free(struct domain *d, m /* * For dying domains, actually free the memory here. This way less work is - * left to hap_final_teardown(), which cannot easily have preemption checks - * added. + * left to paging_final_teardown(), which cannot easily have preemption + * checks added. */ if ( unlikely(d->is_dying) ) { @@ -552,18 +552,6 @@ void hap_final_teardown(struct domain *d for (i = 0; i < MAX_NESTEDP2M; i++) { p2m_teardown(d->arch.nested_p2m[i], true, NULL); } - - if ( d->arch.paging.total_pages != 0 ) - hap_teardown(d, NULL); - - p2m_teardown(p2m_get_hostp2m(d), true, NULL); - /* Free any memory that the p2m teardown released */ - paging_lock(d); - hap_set_allocation(d, 0, NULL); - ASSERT(d->arch.paging.p2m_pages == 0); - ASSERT(d->arch.paging.free_pages == 0); - ASSERT(d->arch.paging.total_pages == 0); - paging_unlock(d); } void hap_vcpu_teardown(struct vcpu *v) --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -842,10 +842,45 @@ int paging_teardown(struct domain *d) /* Call once all of the references to the domain have gone away */ void paging_final_teardown(struct domain *d) { - if ( hap_enabled(d) ) + bool hap = hap_enabled(d); + + PAGING_PRINTK("%pd start: total = %u, free = %u, p2m = %u\n", + d, d->arch.paging.total_pages, + d->arch.paging.free_pages, d->arch.paging.p2m_pages); + + if ( hap ) hap_final_teardown(d); + + /* + * Remove remaining paging memory. This can be nonzero on certain error + * paths. + */ + if ( d->arch.paging.total_pages ) + { + if ( hap ) + hap_teardown(d, NULL); + else + shadow_teardown(d, NULL); + } + + /* It is now safe to pull down the p2m map. */ + p2m_teardown(p2m_get_hostp2m(d), true, NULL); + + /* Free any paging memory that the p2m teardown released. */ + paging_lock(d); + + if ( hap ) + hap_set_allocation(d, 0, NULL); else - shadow_final_teardown(d); + shadow_set_allocation(d, 0, NULL); + + PAGING_PRINTK("%pd done: free = %u, p2m = %u\n", + d, d->arch.paging.free_pages, d->arch.paging.p2m_pages); + ASSERT(!d->arch.paging.p2m_pages); + ASSERT(!d->arch.paging.free_pages); + ASSERT(!d->arch.paging.total_pages); + + paging_unlock(d); p2m_final_teardown(d); } --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1194,7 +1194,7 @@ void shadow_free(struct domain *d, mfn_t /* * For dying domains, actually free the memory here. This way less - * work is left to shadow_final_teardown(), which cannot easily have + * work is left to paging_final_teardown(), which cannot easily have * preemption checks added. */ if ( unlikely(dying) ) @@ -2898,35 +2898,6 @@ out: } } -void shadow_final_teardown(struct domain *d) -/* Called by arch_domain_destroy(), when it's safe to pull down the p2m map. */ -{ - SHADOW_PRINTK("dom %u final teardown starts." - " Shadow pages total = %u, free = %u, p2m=%u\n", - d->domain_id, d->arch.paging.total_pages, - d->arch.paging.free_pages, d->arch.paging.p2m_pages); - - /* Double-check that the domain didn't have any shadow memory. - * It is possible for a domain that never got domain_kill()ed - * to get here with its shadow allocation intact. */ - if ( d->arch.paging.total_pages != 0 ) - shadow_teardown(d, NULL); - - /* It is now safe to pull down the p2m map. */ - p2m_teardown(p2m_get_hostp2m(d), true, NULL); - /* Free any shadow memory that the p2m teardown released */ - paging_lock(d); - shadow_set_allocation(d, 0, NULL); - SHADOW_PRINTK("dom %u final teardown done." - " Shadow pages total = %u, free = %u, p2m=%u\n", - d->domain_id, d->arch.paging.total_pages, - d->arch.paging.free_pages, d->arch.paging.p2m_pages); - ASSERT(d->arch.paging.p2m_pages == 0); - ASSERT(d->arch.paging.free_pages == 0); - ASSERT(d->arch.paging.total_pages == 0); - paging_unlock(d); -} - static int shadow_one_bit_enable(struct domain *d, u32 mode) /* Turn on a single shadow mode feature */ { From patchwork Mon Jan 9 13:39:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13093594 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 42ADFC54EBD for ; Mon, 9 Jan 2023 13:40:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.473637.734346 (Exim 4.92) (envelope-from ) id 1pEsNg-0006yt-Ew; Mon, 09 Jan 2023 13:40:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 473637.734346; Mon, 09 Jan 2023 13:40:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEsNg-0006y3-Aj; Mon, 09 Jan 2023 13:40:04 +0000 Received: by outflank-mailman (input) for mailman id 473637; Mon, 09 Jan 2023 13:40:02 +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 1pEsNe-0006U7-QZ for xen-devel@lists.xenproject.org; Mon, 09 Jan 2023 13:40:02 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2072.outbound.protection.outlook.com [40.107.22.72]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1d298941-9023-11ed-b8d0-410ff93cb8f0; Mon, 09 Jan 2023 14:40:00 +0100 (CET) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DU2PR04MB8550.eurprd04.prod.outlook.com (2603:10a6:10:2d5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:39:58 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389%7]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:39:58 +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: 1d298941-9023-11ed-b8d0-410ff93cb8f0 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIhcv3sj7hHMzNyVFwdLe1PWuBigcoIRGMpDC8tsMA/bODvEVSAaL27RqYaMEImUl13K4mpaxLlGbj/rmL52XmaVssCUuUWA/TTZkZb3yFTshLar+yv2ORSjothtefUNEebr4RVkJ5rmju1xgDE0zZUMWGUZaxvGPBttKwp+jkWM8LOPQ1O6cfmXRXYGdNoJwdE/wu/42364wwAj+d3emm0VeeBuxa5uGbxZQqe41ZQijNRkBuev5PqeYiegxtdZVo7vMsFOgSMt6rYyoOO8JRPXiO3x/N8+atwLovccpyQuBmMb2pwxfPlKIh8hJVCFoF9ps8Q/lCSaaY3oUXXA5A== 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=qCeUlm4/DsmO3G3gcntNt7cjbvdyT3iGeg4tOoUssFE=; b=Mb28XGvCoXUrcF1+Lw16yDhoZmXYAcfjSlEQK9Q9E9/7QkQ6VL84YzTOuRTmnmxNGgzYx58HTUZcdMdVGw3LK397B4UGXJ0SxAQ1lKxNhYSw1VFxwQEtOVG9sIfQfVKktS5UffBB3HKpuOtY61vkRuRxHn5KuZcMEK63+vqkt/8C2H7rbFNrYQrsakeq/N9EUWjPe2eeHj9XTpOU4znF7W/Ae+PALX26xWXRFs2HyyOFFxWsqfw05bffkg+e+MIOnZFnw7/zRmeJwYFtC17tF4EKzUU1PUgzaH/bdrDGQTgH6d1JILea/upUPDSqUIVsmNQNCj2mwqgS7adLaOzaIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qCeUlm4/DsmO3G3gcntNt7cjbvdyT3iGeg4tOoUssFE=; b=RQLvGu4kdQVpYmpAfMhbQ8clm6tM9gVB2KHZAo+K+VXk+RA0TY1xDLpoIroxA9l7dQY2MgLklH+CL+C4oHerutN92UD+eKaIgYykQ8DXr+tJDc+zaP7gmYUWvkJaGjkffTgPHUtxpDT7V1P8kmKsK75b1Z1jCgNu5Htfqy/Ul35SBCVH/ZLQ52DSwnAzlJ4FkdZamytXuVpSBEkEwJiwzDR8xd/MZFTwwjeBEhe6jZ4556QGBF7fkcVXmvBp5Uu1Tif/LA8xpK5xpoQLTXPsSV5JaL4guXRkoZiOqfOu0FCLi+yOidWbnHRk3+0WniymMsnNMJaPM9j/pLyvn6r1Yg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <99270ce9-39d8-1f3e-f922-afc2c0289205@suse.com> Date: Mon, 9 Jan 2023 14:39:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH v2 2/5] x86/paging: drop set-allocation from final-teardown Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tim Deegan References: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> In-Reply-To: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> X-ClientProxiedBy: FR3P281CA0198.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a5::20) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DU2PR04MB8550:EE_ X-MS-Office365-Filtering-Correlation-Id: f2aad4a9-77f8-42c4-650d-08daf246fd8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m9tBaVBaKZbhgx18EP3tSG9OpEvRjlycY+WpeubIJEdOPBtQPibYDHuzJ1Y2C+gatL/vlWPQde7TAS0PWRY4bD4JrXpMslTtAttWfh384sPLqnvx5Xya3z6bOA3+8Ll2S0RIpRFAyDM8jygW2I4PiEbuL/m6CaMZPfQ5VCeSOOSGpVzgK8joMdowooy9QY1XqhDu0+WOGhoCCjt4KQApghc7SPLraXgUvIGNgzE9UiEENC94tEP0q1m+fMDG2fkct/Lu+38tkIZN5Wn9mZw5opMSCfeIlWSXsxJIF/9JouiBlctiSj6PrJofM1joULwUBkrBPaKobxIbGgzGw85h/ljSXszZHlHDuYGTpOUquNhLQ28Ji6RpMB3usbiEVjLJHOoDkJ+naEavCjZAJLzJRC8J4Le10VfgA1B3jYQHFJX8DBt2eZJERTrpWYf8Q/6oyImPHPTXlIRTxtXtJOsiaBs+/pT9KVLsvB8gAiVVSwzT/N8KT9Isn8Bj+F1ugyo3+SCtyoetSfGu7DoDXfeALfIzE7uAvlMJikajcP/2uoXlYIdTSP/rn/wslHhN1MvnqxkF+okSH40aYrumVy/zfk51IPlfoCFFx5WzwevMPpo3B2APjtP8YYBm51/BmR9K36uwvkugwyQ6qYNSyzmG8reH2c3OIoj7qug89HIFDyjJ9BGbisZLSRc/P5eS82gUplTfRDIPt7X1j79TGU27p/h1eSKbbMLAPk1bEbbY7/o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(39860400002)(366004)(396003)(346002)(451199015)(4326008)(316002)(66476007)(66946007)(8676002)(6916009)(66556008)(54906003)(2906002)(5660300002)(8936002)(41300700001)(86362001)(478600001)(83380400001)(31696002)(6486002)(6666004)(6506007)(186003)(6512007)(38100700002)(26005)(2616005)(31686004)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YrOMTemP79Y7VEtaglq2oeTRZwGR?= =?utf-8?q?gGT4+8J1XGk2dhghY2ZLwuFY9aWou1u3p3Rcii68E7BtKUuG00rINWxTJKshYs/A8?= =?utf-8?q?VZNfGteyngDI5foCFsU8xYXtWXlTy4cs0kfemlpatI5HxsSUbuL0+fzbtJ1rTmANF?= =?utf-8?q?DU4coJenZT2wB+HPnJv2np3M13IANS+nG8uTxzTNMil1ST7QhxRfuLff9GMAT7N4k?= =?utf-8?q?klS+M6UsO2blKDMJrFlsJZLGVHu88Q78JAzofhhur7GvJENmoVQcASV+YqQnFl+/H?= =?utf-8?q?y9hOGCbMFKc3lE5EK5n8bFrPf+YBr1Ihu11vpR2wWdHFWVQ2/3oP8uhRJ5IhMn4Qx?= =?utf-8?q?Nj8oo9aYo6BykKBoC9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hICnKo+pz28p4hv3km+DjNtVazz3+hck9BrYzfll3HXGpP9yRfTjTZm1b?= =?utf-8?q?mWeRZMEfxR1zDSUSMJzbz7o0v4oKY9jX2ftaw6k91NYi09IkX0oY8Qji5rYue3Dlw?= =?utf-8?q?TKt60XSGLIwxzr+e3KRyCMvPyumRcTQSWvcrI63gfgr4iCYdIDd6Pl0T5GZ4U1UM1?= =?utf-8?q?h+sFr/83E0QjIOKO4gO3fOzvU2QVZcw0r4qM2M7gRwFYVPdgtcznBkA2ml4p7HFyE?= =?utf-8?q?ExjaBBDkaA0CR/MheDjWbZyxtOnMxp7sAX8mjMtYGjX3rtenkGIxyZONNtxRgBOSO?= =?utf-8?q?yIQltmDDN5NW?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2aad4a9-77f8-42c4-650d-08daf246fd8b X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:39:58.3309 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ko1/NrRBmWHa3rQMRF+oY26kiEWQWNFhraKKk9YOkZnubMeS/nEGTkBpjxHs/sqO8BSa0lkBY7KJk5iTyy0dNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8550 The fixes for XSA-410 have arranged for P2M pages being freed by P2M code to be properly freed directly, rather than being put back on the paging pool list. Therefore whatever p2m_teardown() may return will no longer need taking care of here. Drop the code, leaving the assertions in place and adding "total" back to the PAGING_PRINTK() message. With merely the (optional) log message and the assertions left, there's really no point anymore to hold the paging lock there, so drop that too. Requested-by: Andrew Cooper Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- The remaining parts of hap_final_teardown() could be moved as well, at the price of a CONFIG_HVM conditional. I wasn't sure whether that was deemed reasonable. --- v2: New. --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -866,22 +866,13 @@ void paging_final_teardown(struct domain /* It is now safe to pull down the p2m map. */ p2m_teardown(p2m_get_hostp2m(d), true, NULL); - /* Free any paging memory that the p2m teardown released. */ - paging_lock(d); - - if ( hap ) - hap_set_allocation(d, 0, NULL); - else - shadow_set_allocation(d, 0, NULL); - - PAGING_PRINTK("%pd done: free = %u, p2m = %u\n", - d, d->arch.paging.free_pages, d->arch.paging.p2m_pages); + PAGING_PRINTK("%pd done: total = %u, free = %u, p2m = %u\n", + d, d->arch.paging.total_pages, + d->arch.paging.free_pages, d->arch.paging.p2m_pages); ASSERT(!d->arch.paging.p2m_pages); ASSERT(!d->arch.paging.free_pages); ASSERT(!d->arch.paging.total_pages); - paging_unlock(d); - p2m_final_teardown(d); } From patchwork Mon Jan 9 13:40:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13093598 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 31CAAC5479D for ; Mon, 9 Jan 2023 13:41:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.473645.734356 (Exim 4.92) (envelope-from ) id 1pEsOW-0007rv-OO; Mon, 09 Jan 2023 13:40:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 473645.734356; Mon, 09 Jan 2023 13:40:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEsOW-0007ro-Lc; Mon, 09 Jan 2023 13:40:56 +0000 Received: by outflank-mailman (input) for mailman id 473645; Mon, 09 Jan 2023 13:40:55 +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 1pEsOV-0007rg-5U for xen-devel@lists.xenproject.org; Mon, 09 Jan 2023 13:40:55 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2065.outbound.protection.outlook.com [40.107.22.65]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3c310292-9023-11ed-b8d0-410ff93cb8f0; Mon, 09 Jan 2023 14:40:52 +0100 (CET) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DU2PR04MB8550.eurprd04.prod.outlook.com (2603:10a6:10:2d5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:40:51 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389%7]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:40:51 +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: 3c310292-9023-11ed-b8d0-410ff93cb8f0 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QQpHT/Nv3OY2ry+Y8Ale1DrdmBcnB0vBQjPagKUY7FTV9Cru5ZtKL2Zg2Rz7tNKu1qvQA+iaYDfNzxwaUL6FXlD2g7/6qysoNA7SfID0PgQu+lO936x8d9F8H7iucmN/IgxWQndhTd/2CxBF/GFaK/ZmKHmqHH2vWudnOj/lxX/dTHK9TxlGRqvZku9AUtk8xpiHTMoYinnbXrHPAbtkR9J6PA6gJ5U4cPU2RYhcGv66Zmw4I+vkEt8tZJ1t9fWcpXfL7/lgKVUZB/Y+AoB4Fo9cKaLIuwK4X0nwj18A+oizjVWbyDrYBV6ya+mxGxpl9p1PwpK6xhCdwcSuuOcHCQ== 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=vUyDk05ke+Lt65CNEbe0BSHjvjrpHd5u/KRVoCvKhts=; b=lGP7OYN1LiCKVZ9k0E2X2/mb+8MceoRYqBkqiSeXrzHy3wbwoLV9E9kM+pBNZUEAneOojnq+FRJQCoA2BWjS0P3cSY94RfzXeZBS/uriivXaHg5rblEHqDArzITfNYsHHW1ntmwcjc1cLNWiQ9KGcj0rWDgidgbt7FBgUPSpAusCXLrOtOQiOI37IpMlscqJ0VMK5XXxWiYQeTncNFTsaEeqm/rKyZ/XA3sMB6OUkgzEXRWXKIulth38O1aeK5MqFdWSmPWoB+KvLRjdZogFNvqnFeIk/IgddG2+2/WePbIoyKqYuASBe7/OM/1WBUCDI/A3t7QPwChCuCIpktfKJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vUyDk05ke+Lt65CNEbe0BSHjvjrpHd5u/KRVoCvKhts=; b=Tm5yIrxHS+9jHq2W4Jw1DNVTJkJGuTJJ6jzLXMQAiJEkCFNkCG8SXYXfI87/uvgBMjRj9CCZ8WPzpA5ox4jVM/Qm3po/BJ48y7Y2pQelTwimAl9FRuuXvCTLVQP1w/15ZMkX0bWIkfgY36EJU3/rGW4zTVOGhWgzrW6KztdsO4o21mIf1Oe7Ett1TgI53tgsOVtRbteVkhXZ+v8msOns8wInO8U8blQ/rGk+04FPR7wB0U7WCv3yHVCQK2CMdTBglD+OL3wX8d5TT3vfy7KMr0xO5PYv2uPu2duJ4oWoeyI7a7LhEi7r/ZoFO03+/f2VAeOn5v6sb+m16XSq1lKsYg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <032e81c2-ac86-638a-1611-43bc3bea6d0e@suse.com> Date: Mon, 9 Jan 2023 14:40:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH v2 3/5] x86/paging: move update_paging_modes() hook Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tim Deegan References: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> In-Reply-To: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> X-ClientProxiedBy: FR3P281CA0085.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::22) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DU2PR04MB8550:EE_ X-MS-Office365-Filtering-Correlation-Id: f09e2cb6-95b1-4992-45f2-08daf2471faf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sdWw33qHo136i0GX5j/Fo0xqKIOXT/zIlUFUuz864Q2aKElOBFPZBz4NHScC2F60po4BLRovpDpjylu8UZbbZB6r7jCRQjU9xpwc1NFDJMFiYeoEsdVFZuU3n4vFwuQ2HuOP7kpNzHWWqUJFx793qAiUYb2O4ESV3ludPTv0M0L0zZBd7CYThDnaCs9qurWt7WgurTN9GMYFIQjL3ywqRdXAuQ2cDWLwiWtJd9Mzsor3rMYj7ynv33S0LJ+d18Z/bCuNTq0a/sNbclpUGWobvRP/SDcn9QunVs1F3mb9uB6lJjv31O2YdLwBdRhAhfkou05SRiglWdGZGW901blgctH0Q0QYCnzGY/A7sYjxeNy6gcVbPfvJo3R0ZVBJMC6lRIspHNsHB8mTdO1z1lFTRZxnAaW0R5PlGd4cB53F1zE9NX++JrcKwShi1kvAbBIlutpknYyI4Rzk7XnurB+q0PLGdvui9wt5HQ/beDZdyjmXDTbBE/YqDm+rtoNqU1qeVZ5x8sMtT2lPKZ2TEG9gGYYIe1EJoqwyZNCob+F6xkBS0cPReZ7FyiHl6Kk8dN4Mb7x2lkpXq4dn7xbUfvoAELepild6pKcCDFwgyab0RyTmkeaA7mWBODb5He16YUBavB2zQ3BiUSI+uvwWUv7itUl/lruUosQUgCs19AnLkPUN2u4JuA2XxydbpIfnQJImb6/FpS4wjrTGVAI8B6oWuil4xMVjrjp0aJOnOzt2Awc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(39860400002)(366004)(396003)(346002)(451199015)(4326008)(316002)(66476007)(66946007)(8676002)(6916009)(66556008)(54906003)(15650500001)(2906002)(5660300002)(8936002)(41300700001)(86362001)(478600001)(83380400001)(31696002)(6486002)(6506007)(186003)(6512007)(38100700002)(26005)(2616005)(31686004)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 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ef23tjg8p2mTAuP4KPpGUq6cbyneR4JGGUk0/vLe2CC/JdpX78EPKipy1NrUh?= =?utf-8?q?F1Zzan8jlKY9gGqYLjENvbpyOjMn2sUJh0BKHOwN99dwx3ndFQE4IRkmexUnfwWTd?= =?utf-8?q?msM+GztjX9NmGeRedL5fdkdogoG/tsMUGbrweTRIAS2SxkanpWMqGJ10bGurThkyk?= =?utf-8?q?DcGA6BnLl25Br8GaXoPTC/46yl5qXiIvKWunNKXUwY2sWbdKnCvoC1gMLep6E2Sci?= =?utf-8?q?8apoKqEf61PCyK5SgrO9HhdltjvbmyAoC6eb+sbWHw3OMWCkX8lo+N0TVhmVFqSqw?= =?utf-8?q?9Vx/iSSqNnSNUWcy6e2RtRs5FD5uvHaloxrkuj8Dp80jZqGwl31VDRRzCSnRcDVSP?= =?utf-8?q?97d5Gskv41CXfV89RUHhvHJoNr6Fgdk0E9+IKrlT+N3een2ebI+uHQrnJF0I4IHG1?= =?utf-8?q?OiiCsJZLWzlHFXzGPzwnSDlbyPn/q/+Hw0xn4yaZcdIAWjg5ysfUuPr2QAye/Ik/x?= =?utf-8?q?szHmZJTfGzKn9UWR1SYASIKvEvtzmK6/H9o4IlMKv5qNfAEUzV3xm0ysFHuCrVdao?= =?utf-8?q?ycdQmonuVThgxDHs3YTXyu+BdwALnBrdqe3briROgP9Fa8sglouZtyxCBJQTiMOXI?= =?utf-8?q?APNW5N92/rLNKzpYc1MP6+2pXq8y0io2bQcuiLJgLl8sXFVm3EnwXqDRkBkAkOyFy?= =?utf-8?q?Bat4RTGQVx4i?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f09e2cb6-95b1-4992-45f2-08daf2471faf X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:40:51.5307 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JTgmkumJEz7iXBQOIbUDj5bHglMfbJ2w36hZK77H9b5qicC8w9rKmsMNeG6CLc/xecGtgpRE7g4YDHgyRmAquA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8550 The hook isn't mode dependent, hence it's misplaced in struct paging_mode. (Or alternatively I see no reason why the alloc_page() and free_page() hooks don't also live there.) Move it to struct paging_domain. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné --- v2: Undo rename (plural -> singular). Add a comment in shadow/none.c. --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -235,6 +235,8 @@ struct paging_domain { * (used by p2m and log-dirty code for their tries) */ struct page_info * (*alloc_page)(struct domain *d); void (*free_page)(struct domain *d, struct page_info *pg); + + void (*update_paging_modes)(struct vcpu *v); }; struct paging_vcpu { --- a/xen/arch/x86/include/asm/paging.h +++ b/xen/arch/x86/include/asm/paging.h @@ -140,7 +140,6 @@ struct paging_mode { #endif void (*update_cr3 )(struct vcpu *v, int do_locking, bool noflush); - void (*update_paging_modes )(struct vcpu *v); bool (*flush_tlb )(const unsigned long *vcpu_bitmap); unsigned int guest_levels; @@ -316,7 +315,7 @@ static inline void paging_update_cr3(str * has changed, and when bringing up a VCPU for the first time. */ static inline void paging_update_paging_modes(struct vcpu *v) { - paging_get_hostmode(v)->update_paging_modes(v); + v->domain->arch.paging.update_paging_modes(v); } #ifdef CONFIG_PV --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -443,6 +443,9 @@ static void hap_destroy_monitor_table(st /************************************************/ /* HAP DOMAIN LEVEL FUNCTIONS */ /************************************************/ + +static void cf_check hap_update_paging_modes(struct vcpu *v); + void hap_domain_init(struct domain *d) { static const struct log_dirty_ops hap_ops = { @@ -453,6 +456,8 @@ void hap_domain_init(struct domain *d) /* Use HAP logdirty mechanism. */ paging_log_dirty_init(d, &hap_ops); + + d->arch.paging.update_paging_modes = hap_update_paging_modes; } /* return 0 for success, -errno for failure */ @@ -842,7 +847,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_real_mode, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_real_mode, .update_cr3 = hap_update_cr3, - .update_paging_modes = hap_update_paging_modes, .flush_tlb = flush_tlb, .guest_levels = 1 }; @@ -853,7 +857,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_2_levels, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_2_levels, .update_cr3 = hap_update_cr3, - .update_paging_modes = hap_update_paging_modes, .flush_tlb = flush_tlb, .guest_levels = 2 }; @@ -864,7 +867,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_3_levels, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_3_levels, .update_cr3 = hap_update_cr3, - .update_paging_modes = hap_update_paging_modes, .flush_tlb = flush_tlb, .guest_levels = 3 }; @@ -875,7 +877,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_4_levels, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_4_levels, .update_cr3 = hap_update_cr3, - .update_paging_modes = hap_update_paging_modes, .flush_tlb = flush_tlb, .guest_levels = 4 }; --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -45,6 +45,8 @@ static int cf_check sh_enable_log_dirty( static int cf_check sh_disable_log_dirty(struct domain *); static void cf_check sh_clean_dirty_bitmap(struct domain *); +static void cf_check shadow_update_paging_modes(struct vcpu *); + /* Set up the shadow-specific parts of a domain struct at start of day. * Called for every domain from arch_domain_create() */ int shadow_domain_init(struct domain *d) @@ -60,6 +62,8 @@ int shadow_domain_init(struct domain *d) /* Use shadow pagetables for log-dirty support */ paging_log_dirty_init(d, &sh_ops); + d->arch.paging.update_paging_modes = shadow_update_paging_modes; + #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) d->arch.paging.shadow.oos_active = 0; #endif @@ -2516,7 +2520,12 @@ static void sh_update_paging_modes(struc v->arch.paging.mode->update_cr3(v, 0, false); } -void cf_check shadow_update_paging_modes(struct vcpu *v) +/* + * Update all the things that are derived from the guest's CR0/CR3/CR4. + * Called to initialize paging structures if the paging mode has changed, + * and when bringing up a VCPU for the first time. + */ +static void cf_check shadow_update_paging_modes(struct vcpu *v) { paging_lock(v->domain); sh_update_paging_modes(v); --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -4203,7 +4203,6 @@ const struct paging_mode sh_paging_mode .gva_to_gfn = sh_gva_to_gfn, #endif .update_cr3 = sh_update_cr3, - .update_paging_modes = shadow_update_paging_modes, .flush_tlb = shadow_flush_tlb, .guest_levels = GUEST_PAGING_LEVELS, .shadow.detach_old_tables = sh_detach_old_tables, --- a/xen/arch/x86/mm/shadow/none.c +++ b/xen/arch/x86/mm/shadow/none.c @@ -18,8 +18,14 @@ static void cf_check _clean_dirty_bitmap ASSERT(is_pv_domain(d)); } +static void cf_check _update_paging_modes(struct vcpu *v) +{ + ASSERT_UNREACHABLE(); +} + int shadow_domain_init(struct domain *d) { + /* For HVM set up pointers for safety, then fail. */ static const struct log_dirty_ops sh_none_ops = { .enable = _enable_log_dirty, .disable = _disable_log_dirty, @@ -27,6 +33,9 @@ int shadow_domain_init(struct domain *d) }; paging_log_dirty_init(d, &sh_none_ops); + + d->arch.paging.update_paging_modes = _update_paging_modes; + return is_hvm_domain(d) ? -EOPNOTSUPP : 0; } @@ -57,11 +66,6 @@ static void cf_check _update_cr3(struct ASSERT_UNREACHABLE(); } -static void cf_check _update_paging_modes(struct vcpu *v) -{ - ASSERT_UNREACHABLE(); -} - static const struct paging_mode sh_paging_none = { .page_fault = _page_fault, .invlpg = _invlpg, @@ -69,7 +73,6 @@ static const struct paging_mode sh_pagin .gva_to_gfn = _gva_to_gfn, #endif .update_cr3 = _update_cr3, - .update_paging_modes = _update_paging_modes, }; void shadow_vcpu_init(struct vcpu *v) --- a/xen/arch/x86/mm/shadow/private.h +++ b/xen/arch/x86/mm/shadow/private.h @@ -426,11 +426,6 @@ void cf_check sh_write_guest_entry( intpte_t cf_check sh_cmpxchg_guest_entry( struct vcpu *v, intpte_t *p, intpte_t old, intpte_t new, mfn_t gmfn); -/* Update all the things that are derived from the guest's CR0/CR3/CR4. - * Called to initialize paging structures if the paging mode - * has changed, and when bringing up a VCPU for the first time. */ -void cf_check shadow_update_paging_modes(struct vcpu *v); - /* Unhook the non-Xen mappings in this top-level shadow mfn. * With user_only == 1, unhooks only the user-mode mappings. */ void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only); From patchwork Mon Jan 9 13:41:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13093599 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 9E51AC5479D for ; Mon, 9 Jan 2023 13:41:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.473650.734368 (Exim 4.92) (envelope-from ) id 1pEsP7-0008RK-4x; Mon, 09 Jan 2023 13:41:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 473650.734368; Mon, 09 Jan 2023 13:41:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEsP7-0008RD-1T; Mon, 09 Jan 2023 13:41:33 +0000 Received: by outflank-mailman (input) for mailman id 473650; Mon, 09 Jan 2023 13:41:31 +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 1pEsP4-0008Qk-WE for xen-devel@lists.xenproject.org; Mon, 09 Jan 2023 13:41:31 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 51afb927-9023-11ed-91b6-6bf2151ebd3b; Mon, 09 Jan 2023 14:41:29 +0100 (CET) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DB9PR04MB8348.eurprd04.prod.outlook.com (2603:10a6:10:25c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:41:27 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389%7]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:41:27 +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: 51afb927-9023-11ed-91b6-6bf2151ebd3b ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LtmaXcXgS4IYt11xQ1Y8vbtpaMjDLWD9QtxAfrLcN2h22vqk1LIYlXhlwrAJengpnqQype31VEk70YlCffD0DQOTesj351CGLyoA1KUtZ9q288HPoZdTjGTKjmzt6cwP8oqkpI1NVJO/1MiKk56KMbWwcAu5/a1G8WjhUEww+AaMEnm4xGenu3ZpQ+UX5sxHHIPKxHlRY7YwVdXPFE4dNi+Kp3Iakj3CAEv8d0vv2DHSRIp/sm4hbZKwuIjcPTM91Zkx31dtWKlBSMM5dqZhNtOI74jVDbjygQKXRTb5Ou8HWzEEnE1uue9LAxxYUOBkLzhOOx42BJcFGhlKd7VLlQ== 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=jKVxpWRnLLsiXUS1L42o6OfU5C2lD6jrUePiBTdkwDc=; b=iHbeyBn/ssFl0VWeJAeZ/KS9Tio7CdbHTyepVjQzUqgOQyYhW2P95xCyvU6HGcqxwBmG5OwvOEt34tN6QFiIuvHLr9EoIP+aPBl4MJ/fyKlj9vK6knCqX5LJX66nKff+wplprgVxeriDgIZ2qgVXTGaNbEUrfdNc/E12d8xdBOQ8mcEqE63lDCv7ftGnLfHaAMepTB2KK9VZUEjTUywHrTL9HM4bg/kGi+AUhTGsTDQtPOG2iAgFWhT1dIu4tMo38AOuSm/SASQgYYZCks2GfE6/YNNasOPo36zAadOCJ+RmHEXctyjiCvqIk9NjCOoz6evex/kEC+fpJlDuIBxTPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jKVxpWRnLLsiXUS1L42o6OfU5C2lD6jrUePiBTdkwDc=; b=vMcMN10EbPFfT4G1KVaVUqa9ZSuTYv00rVEh7EAlmIcvHyfwZddIQ6VtD/EZCXVfpRYz3buWTr1ruyrZRDZO52FS8DsKkcirQ/2U5Zl+P1C9dTfAp4hIY478Go014eDjFSXTtTrUkotMYN3+frr27UfzY+Qyvkixu/FRrF1t5il1yTXyu0jtofT/acYuNmn3ZOTVSJhC29Fh6RrVz8jhu1kHsAIIuD2HOBr01JDRX2HR3toPSOSFXVSzSFzKZqyYZxqML2vg6SIk1VLET0SFIsHfJj3wcNIFxJ+M7sDXotNJPUguJWKjSBJantpXixdR5nuKIuvXsNIqi/ZtOX+Dpg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Mon, 9 Jan 2023 14:41:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH v2 4/5] x86/paging: move and conditionalize flush_tlb() hook Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tim Deegan References: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> In-Reply-To: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> X-ClientProxiedBy: FR3P281CA0151.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::12) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DB9PR04MB8348:EE_ X-MS-Office365-Filtering-Correlation-Id: bfde1e5e-1d07-4bc2-69fd-08daf24734f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0unLGsazmk15rLIvSqnFfWdz5C1osJOQGM1aoaq8KPwUdnc8n5+Abhqz+YpnFOPry4ZNZ56XAZiZz9AEERMkoJpayuTgOmnd9kBYS8G/ukVsHBKCiZXHcUcA4RaKhj3ZTv7NP9vMJUjxjiLo965cw+mFKGqgst2U/sJflSxb/rLL0txNlJD+G7nKYLBsIiiIkQPWXz1tP9SHF2iCoelV8PgBB5oc00SkiV+Obffjp/E6f39Xohf8+qhJweEhkNk6HxSFbTy8+768XSoP8Ji6iv8ECrieHApxorqSrlv1BfXwZTTKnVWTlO6QKyFlQ69GoKWPxyo/8QrwZ+06zAv/bfTyP/tC0Pb9vnAl3mbMxlztpXP40K/VFj9tnaYlFU6BhlYQ3tX6SkJyzWcYbelx3sm51dTTDd9N59xvgLWPWZPnTRvX5Tbn1jEr8UGB6OjXQfhBHy3iguns61+Xl6nLlGZg84niKnXEDJhwnR9YXkrH6NjV0FmIyi9EvoR2tMdnYybxwHNMHW9vDVsRkLLYv8RVYtWbp4ghjActDeGJfwLxLcrkmyK8QPI4f2Rxd4aRa7UYOkyRexj7mwFmjZHGUAI5AmCSQyPV+XNpfEHzk13i385t1uQ0cfNtxeqrrXa1H5Y85NEy6xqnqQfWJdVAyLLw7yCi6OAQF5e8ZU8Vxu7J/K/TY/qDC+I73FexcetisPHGTpQOx68NJaBDaMLtecNN/aOHn/WNrY7TwCl56ZQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(396003)(376002)(39860400002)(136003)(346002)(366004)(451199015)(478600001)(36756003)(86362001)(54906003)(5660300002)(31696002)(4326008)(66556008)(66946007)(8676002)(66476007)(38100700002)(41300700001)(316002)(26005)(8936002)(6486002)(83380400001)(2906002)(6916009)(31686004)(66899015)(6506007)(6512007)(186003)(2616005)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cJ0vI5ys5N1NQm/LPrfYRqE4245E?= =?utf-8?q?i25jf83Qbtksq9D5Wc+IFTZ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Mx/6+JmkeAfeJbSBTr+kXc62ghAgNoBd0dzWMUxiQpYm?= =?utf-8?q?gid4aryzU/43ZrKVeGmTSykuQGeQ2/F4JBymB4fCZrhfkQvS/XAFsU2N/LNEzakVt?= =?utf-8?q?X6dXUekXSCEzcKsVV2RE8PbbfD+ZzyH1AocqYpKuCeGe06vvnsoE3gc3Q899W91KX?= =?utf-8?q?NbeMexFaXCk1hhfWx9fob0XGdX4kEeSxG2CvPWYf26gD0BLYxqDnjeYE8iOkXPu4i?= =?utf-8?q?bnsWGuwRZQAwSctRzuOsfk6t8APlxiCjjaR8EuV2LfR/kVWG++tZagwQ+kLuFwrdU?= =?utf-8?q?+3499cLpLMDFZfs+uylVmQvZgSRjUIsUX28dPUOoAfO+SGSfKkbE/awZOrndIDNmB?= =?utf-8?q?w5CZeYrP6PIOKuHT1XSwOJtQBCwLhow5HLSqJ/G8rYM2Bt0zI5hts/ZrnK6bHZzM1?= =?utf-8?q?Ua4UqVH6GfFeNWroYpv2/ss4mOgGAGJqwVmD/s7bAxrigg7TigqqqkleQ3CdFYrlR?= =?utf-8?q?P99NCHLUITarOgsvvqSSCCqu/6+uPZs9l0Ixo6+TU2/gTGw79yCBfAseGDqvkLLW+?= =?utf-8?q?ghxfd/oAsekUNlSvI4jHS/r5KYGNgq0hIbxXQJVeZ5OLEcCOoHXz27WHGR8KeH/U0?= =?utf-8?q?QQGCA+UcojOG?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: bfde1e5e-1d07-4bc2-69fd-08daf24734f4 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:41:27.2316 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 81YsYPoRvEOYWZRseE3AHjHUeqUF1GH5K++BWi6muNxpn31yw4f1XSTE/Rrw8M/wv0Qy4yZ+TTkqECabKDkKAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8348 The hook isn't mode dependent, hence it's misplaced in struct paging_mode. (Or alternatively I see no reason why the alloc_page() and free_page() hooks don't also live there.) Move it to struct paging_domain. The hook also is used for HVM guests only, so make respective pieces conditional upon CONFIG_HVM. While there also add __must_check to the hook declaration, as it's imperative that callers deal with getting back "false". While moving the shadow implementation, introduce a "curr" local variable. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- v2: Re-base over changes earlier in the series. --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -237,6 +237,11 @@ struct paging_domain { void (*free_page)(struct domain *d, struct page_info *pg); void (*update_paging_modes)(struct vcpu *v); + +#ifdef CONFIG_HVM + /* Flush selected vCPUs TLBs. NULL for all. */ + bool __must_check (*flush_tlb)(const unsigned long *vcpu_bitmap); +#endif }; struct paging_vcpu { --- a/xen/arch/x86/include/asm/paging.h +++ b/xen/arch/x86/include/asm/paging.h @@ -140,7 +140,6 @@ struct paging_mode { #endif void (*update_cr3 )(struct vcpu *v, int do_locking, bool noflush); - bool (*flush_tlb )(const unsigned long *vcpu_bitmap); unsigned int guest_levels; @@ -300,6 +299,12 @@ static inline unsigned long paging_ga_to page_order); } +/* Flush selected vCPUs TLBs. NULL for all. */ +static inline bool paging_flush_tlb(const unsigned long *vcpu_bitmap) +{ + return current->domain->arch.paging.flush_tlb(vcpu_bitmap); +} + #endif /* CONFIG_HVM */ /* Update all the things that are derived from the guest's CR3. @@ -408,12 +413,6 @@ static always_inline unsigned int paging return bits; } -/* Flush selected vCPUs TLBs. NULL for all. */ -static inline bool paging_flush_tlb(const unsigned long *vcpu_bitmap) -{ - return paging_get_hostmode(current)->flush_tlb(vcpu_bitmap); -} - #endif /* XEN_PAGING_H */ /* --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -445,6 +445,7 @@ static void hap_destroy_monitor_table(st /************************************************/ static void cf_check hap_update_paging_modes(struct vcpu *v); +static bool cf_check flush_tlb(const unsigned long *vcpu_bitmap); void hap_domain_init(struct domain *d) { @@ -458,6 +459,7 @@ void hap_domain_init(struct domain *d) paging_log_dirty_init(d, &hap_ops); d->arch.paging.update_paging_modes = hap_update_paging_modes; + d->arch.paging.flush_tlb = flush_tlb; } /* return 0 for success, -errno for failure */ @@ -847,7 +849,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_real_mode, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_real_mode, .update_cr3 = hap_update_cr3, - .flush_tlb = flush_tlb, .guest_levels = 1 }; @@ -857,7 +858,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_2_levels, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_2_levels, .update_cr3 = hap_update_cr3, - .flush_tlb = flush_tlb, .guest_levels = 2 }; @@ -867,7 +867,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_3_levels, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_3_levels, .update_cr3 = hap_update_cr3, - .flush_tlb = flush_tlb, .guest_levels = 3 }; @@ -877,7 +876,6 @@ static const struct paging_mode hap_pagi .gva_to_gfn = hap_gva_to_gfn_4_levels, .p2m_ga_to_gfn = hap_p2m_ga_to_gfn_4_levels, .update_cr3 = hap_update_cr3, - .flush_tlb = flush_tlb, .guest_levels = 4 }; --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -68,6 +68,7 @@ int shadow_domain_init(struct domain *d) d->arch.paging.shadow.oos_active = 0; #endif #ifdef CONFIG_HVM + d->arch.paging.flush_tlb = shadow_flush_tlb; d->arch.paging.shadow.pagetable_dying_op = 0; #endif @@ -3092,66 +3093,6 @@ static void cf_check sh_clean_dirty_bitm paging_unlock(d); } - -static bool flush_vcpu(const struct vcpu *v, const unsigned long *vcpu_bitmap) -{ - return !vcpu_bitmap || test_bit(v->vcpu_id, vcpu_bitmap); -} - -/* Flush TLB of selected vCPUs. NULL for all. */ -bool cf_check shadow_flush_tlb(const unsigned long *vcpu_bitmap) -{ - static DEFINE_PER_CPU(cpumask_t, flush_cpumask); - cpumask_t *mask = &this_cpu(flush_cpumask); - struct domain *d = current->domain; - struct vcpu *v; - - /* Avoid deadlock if more than one vcpu tries this at the same time. */ - if ( !spin_trylock(&d->hypercall_deadlock_mutex) ) - return false; - - /* Pause all other vcpus. */ - for_each_vcpu ( d, v ) - if ( v != current && flush_vcpu(v, vcpu_bitmap) ) - vcpu_pause_nosync(v); - - /* Now that all VCPUs are signalled to deschedule, we wait... */ - for_each_vcpu ( d, v ) - if ( v != current && flush_vcpu(v, vcpu_bitmap) ) - while ( !vcpu_runnable(v) && v->is_running ) - cpu_relax(); - - /* All other vcpus are paused, safe to unlock now. */ - spin_unlock(&d->hypercall_deadlock_mutex); - - cpumask_clear(mask); - - /* Flush paging-mode soft state (e.g., va->gfn cache; PAE PDPE cache). */ - for_each_vcpu ( d, v ) - { - unsigned int cpu; - - if ( !flush_vcpu(v, vcpu_bitmap) ) - continue; - - paging_update_cr3(v, false); - - cpu = read_atomic(&v->dirty_cpu); - if ( is_vcpu_dirty_cpu(cpu) ) - __cpumask_set_cpu(cpu, mask); - } - - /* Flush TLBs on all CPUs with dirty vcpu state. */ - guest_flush_tlb_mask(d, mask); - - /* Done. */ - for_each_vcpu ( d, v ) - if ( v != current && flush_vcpu(v, vcpu_bitmap) ) - vcpu_unpause(v); - - return true; -} - /**************************************************************************/ /* Shadow-control XEN_DOMCTL dispatcher */ --- a/xen/arch/x86/mm/shadow/hvm.c +++ b/xen/arch/x86/mm/shadow/hvm.c @@ -719,6 +719,66 @@ static void sh_emulate_unmap_dest(struct atomic_inc(&v->domain->arch.paging.shadow.gtable_dirty_version); } +static bool flush_vcpu(const struct vcpu *v, const unsigned long *vcpu_bitmap) +{ + return !vcpu_bitmap || test_bit(v->vcpu_id, vcpu_bitmap); +} + +/* Flush TLB of selected vCPUs. NULL for all. */ +bool cf_check shadow_flush_tlb(const unsigned long *vcpu_bitmap) +{ + static DEFINE_PER_CPU(cpumask_t, flush_cpumask); + cpumask_t *mask = &this_cpu(flush_cpumask); + const struct vcpu *curr = current; + struct domain *d = curr->domain; + struct vcpu *v; + + /* Avoid deadlock if more than one vcpu tries this at the same time. */ + if ( !spin_trylock(&d->hypercall_deadlock_mutex) ) + return false; + + /* Pause all other vcpus. */ + for_each_vcpu ( d, v ) + if ( v != curr && flush_vcpu(v, vcpu_bitmap) ) + vcpu_pause_nosync(v); + + /* Now that all VCPUs are signalled to deschedule, we wait... */ + for_each_vcpu ( d, v ) + if ( v != curr && flush_vcpu(v, vcpu_bitmap) ) + while ( !vcpu_runnable(v) && v->is_running ) + cpu_relax(); + + /* All other vcpus are paused, safe to unlock now. */ + spin_unlock(&d->hypercall_deadlock_mutex); + + cpumask_clear(mask); + + /* Flush paging-mode soft state (e.g., va->gfn cache; PAE PDPE cache). */ + for_each_vcpu ( d, v ) + { + unsigned int cpu; + + if ( !flush_vcpu(v, vcpu_bitmap) ) + continue; + + paging_update_cr3(v, false); + + cpu = read_atomic(&v->dirty_cpu); + if ( is_vcpu_dirty_cpu(cpu) ) + __cpumask_set_cpu(cpu, mask); + } + + /* Flush TLBs on all CPUs with dirty vcpu state. */ + guest_flush_tlb_mask(d, mask); + + /* Done. */ + for_each_vcpu ( d, v ) + if ( v != curr && flush_vcpu(v, vcpu_bitmap) ) + vcpu_unpause(v); + + return true; +} + mfn_t sh_make_monitor_table(const struct vcpu *v, unsigned int shadow_levels) { struct domain *d = v->domain; --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -4203,7 +4203,6 @@ const struct paging_mode sh_paging_mode .gva_to_gfn = sh_gva_to_gfn, #endif .update_cr3 = sh_update_cr3, - .flush_tlb = shadow_flush_tlb, .guest_levels = GUEST_PAGING_LEVELS, .shadow.detach_old_tables = sh_detach_old_tables, #ifdef CONFIG_PV From patchwork Mon Jan 9 13:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13093600 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 C821CC5479D for ; Mon, 9 Jan 2023 13:42:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.473652.734379 (Exim 4.92) (envelope-from ) id 1pEsPS-0000We-Ch; Mon, 09 Jan 2023 13:41:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 473652.734379; Mon, 09 Jan 2023 13:41:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEsPS-0000WX-9q; Mon, 09 Jan 2023 13:41:54 +0000 Received: by outflank-mailman (input) for mailman id 473652; Mon, 09 Jan 2023 13:41:53 +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 1pEsPR-0000WK-Tt for xen-devel@lists.xenproject.org; Mon, 09 Jan 2023 13:41:53 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2088.outbound.protection.outlook.com [40.107.20.88]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5f5c314d-9023-11ed-b8d0-410ff93cb8f0; Mon, 09 Jan 2023 14:41:52 +0100 (CET) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by DB9PR04MB8348.eurprd04.prod.outlook.com (2603:10a6:10:25c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:41:50 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::2991:58a4:e308:4389%7]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:41: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: 5f5c314d-9023-11ed-b8d0-410ff93cb8f0 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=My+JoqO6h5y27qEa+gNkIzD5XbmjuEeij+vbmCg7+wb+oDbVVbZmF+k8hPhK3yujbhBr21qZLHItaForEQSwG9QtC4WklzHJwa7qaFp4HXgLG4HwqA5JtsEHw57C3Ua2vCFxTe2JCaH1TqQ+GBHZ274vONz3eHlEr6u39etx28WmMED5srjoMKmdAJkwGsmD0mrq3WtHI5cu6X+u0GFo/n0o3DsYiZE7sf3Z2Xkdi+HEvqor9t4dAKuezNmbBCvWxUnEJfCubtekRKfjAY4f46pjYxn7yOsWR51GVMiXah3u4gfAxodMCVVeHyigp8hzrVW622mj6xc4ZZe2s2jYgQ== 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=ldmrcBpaOs88X5aWnm3c9XzMTqcT0z7U/BEsg7rlocA=; b=oOpP5kcDhrQNgTmKSkFoukYGoyZ5AeCfPw8RHlKIP28B/2cMUN/EIVwJlJbI99T3l/tmBqTCRTYIBSD9F/gxT4WmfT8DwO7CF5mHMgiE17H22BmAMolr4H+BkKtHvBHkGGQLU2T5zS3jaRCHg7iGZNx3//jM1HeJv28rhyQgg6cVPOrFs+dkIgOCt38jVDLNOdvIXuCIr+rBnXSVm+wgoSVpxBtYIR+JvS8Xzl/hw9oERG4zqj/4opGmSc6ZA/iSJ0SMy0tx7UcovYF2iFyLBGWttTjcvIyevk8tGySfqeBw7mxuxDldUOvc3axY2VfFPoyH1lLZ2OvVGKF6lEfeSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ldmrcBpaOs88X5aWnm3c9XzMTqcT0z7U/BEsg7rlocA=; b=4AWJ/z4QMmbuE+TdW4gHklaV7jUuMXm4kCBH5TEScwQ2pH+leo9Qlfy8kKfztQEjz5doiBGb9nsx7WlE2iJsIPWGt/CWf5+EZKpC3PnEM/HuPPEdgyRU2yyJ4SneWmI9ZE/2owoXVNut7QL6medqo62wR2eMASBREimJpCGkTsgQB3GfoV65eWRGzmIQjD15O+4u02hbYaKCMlTAWFU9qNftZe1KcacDm/vJN0hymupxdIWGj7jydJH2b4XPhHxqIHjdU8MSN6dzpbmhZ36HN4okSU6cn3qbiGF3MM121AbFWPmLeGUJRS7iKL6Gu/CN5TxeRUCrLfYThG6uGC1YlQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Mon, 9 Jan 2023 14:41:49 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH v2 5/5] x86/shadow: drop zero initialization from shadow_domain_init() Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tim Deegan References: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> In-Reply-To: <882f700f-9d79-67d5-7e13-e42c3c79ba11@suse.com> X-ClientProxiedBy: FR0P281CA0016.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::21) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|DB9PR04MB8348:EE_ X-MS-Office365-Filtering-Correlation-Id: eebc57dd-0faa-4bb9-2a30-08daf24742de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /g5Fhg/WFGQ3i6EQjIuIAJrgx6d+r9ywCwbB+v8XzL0fn21OiVNDh1YoO3qgfd284PczrIxwKp/ISWhMeA6SWTD+fc7h4qOERKFWHZ3FiFu43P1snWsQwaEFLDxoFg7Xz/RnWsxVy2gzDJtjprBBLjWy1pApzjpFuO1n7hyAE98GFMF/6s7gVbJJsHGYp3ixwmrtyQb/D6+aD2gGJw+zaKuHH2WYteZDDvkR1sPGWO66G9hbUCgaiDQMeAKZKDgrzfFF67DulJ5LNXNQR2F2rUhthshatkOAomcq71fIJX6SlpYv3XBDLJA7YnBraa3zt+JnnuQN5QnpPqJwAJ3BNAtlg/Vt1kQ4tVOEGvSBHgfVIBbI/cggmOYDRmGYk7c65Mr0ETZAok6awTwcy+ZYT1SSPwS7IVsHA15CKSzYDue2XwOoVEIJwcBZl4jfqVETb23RUA4ut5EOMFjufpLG0ykBOBG0XPgHsg2toEr19TY3E0aTReC1ZbKB2uCZLQV0JjL3jVqwT7Mc+vyh+K2d6jupE647EUwTweV0QDRkj7lYt8Xu6KZ14JoJXEen84GgdurfxFl3So9H2DUOB2+JisEhqdpGLCoRZxIstVR49NOwgP82ZcDsij3gwt5QTccWUYen1TaMjKnu4lBOO2t8fOqui/mWKwWXsbYFcHAJQmNZ03a8uCUQAF/4lvPv2zTkrERHupkxKMzmVqOhyUQtjAAESjYfAwZFHnn4vlxPq+A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(396003)(376002)(39860400002)(136003)(346002)(366004)(451199015)(478600001)(36756003)(86362001)(4744005)(54906003)(5660300002)(31696002)(4326008)(66556008)(66946007)(8676002)(66476007)(38100700002)(41300700001)(316002)(26005)(8936002)(6486002)(83380400001)(2906002)(6916009)(31686004)(6506007)(6512007)(186003)(2616005)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?RJtELjuJyijzF4PI5SGjbdXRpXKI?= =?utf-8?q?Ws95SfmGcMKks4B43GlCwVKZLYbeh3lE2Vgm2J1jgFHl8UtpO+1fUPLLFWuuoknnU?= =?utf-8?q?7uhI94ByMXNmv5dxBHfVTsUApq5ow6iAExA1PzEVme9LM3cLNSekJLnsdARYg6QoZ?= =?utf-8?q?gGNgL7ZNkLVs2hmkc8HZWbFQSB4EumX/vBkz4PcRVqzegQP/9Lhb6EmsihgP8woom?= =?utf-8?q?FbhwifMUECF/XKrjFXU3PMBP0akiKLMe5PwrQ6UxvRsV/latVh28/gvQaoGTUr8PD?= =?utf-8?q?5rcO539Udo3BwF04eSJ1rnHJ5Owg4TmHIp2PABOG5Ra2r5YxWCU+Mq/GNf+Plp63y?= =?utf-8?q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sfnbTVkTILvUVcL/0QVKlb4Gl/+NMjeF8DgMQOLSEcMsC6LztyWGhw?= =?utf-8?q?F7y9RAeFvdKar3KJgllRjCu+Khs/bhWzgLe/RtKt9h9DjRj+Dd0/noqsoyriifUdh?= =?utf-8?q?0E15xamZwr0gX8NZdayodD08tHsVsYvD4EJvgSWzsoGM9ttgjJ/cgZtUtSgnBTyez?= =?utf-8?q?G20rF0U1ClWKG9Rmf0eQIMDZnWNFN9uQ/UAHPMcGDvdLmyi2Fp9n5RwBHQk7yDlGz?= =?utf-8?q?qny2OR3GLZrOv3GDN+UC2xzITOrnPG9Re4jNCmXzSMMj+ICz+JUswmbRvaLJsG4vz?= =?utf-8?q?q7dGK4JXPJeQ?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: eebc57dd-0faa-4bb9-2a30-08daf24742de X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:41:50.6364 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ydGtY3AoJ3GhLG0asHd4xt16nog1wJxntn0TmoVTnoRM71INdJBM91TvfEUzCA5g2D5o2E8wImVHh8qTUVmHuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8348 There's no need for this as struct domain starts out zero-filled. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- v2: Re-base over changes earlier in the series. --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -64,12 +64,8 @@ int shadow_domain_init(struct domain *d) d->arch.paging.update_paging_modes = shadow_update_paging_modes; -#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) - d->arch.paging.shadow.oos_active = 0; -#endif #ifdef CONFIG_HVM d->arch.paging.flush_tlb = shadow_flush_tlb; - d->arch.paging.shadow.pagetable_dying_op = 0; #endif return 0;