From nobody Thu Dec 26 21:00:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1732641629; cv=pass; d=zohomail.com; s=zohoarc; b=maVrDMJ0+K4QuF3smqcRXjYWZrOl40r8AuO41d+Mj4qIdAZnuGBelQj9/RwWVjr+nXYko9jlQeI1+STKNhMNJKDKCkTPkdHYZwMOY9PeTiaZQkvAYENw7cRADjV22RGOOnRBrCVNARdtQZnKGPnbLQ4Z6QYMwSbLkYktxglIVVY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732641629; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uu7AKaBE7cQGMVaJpznh0ldBUuYX3CfpL80utGtzydc=; b=NGPnBwzFVvyEt+iZsKTehJELffrWBVHKc6+mRov65N2IKuceirawdxbdLR3MZdgCJf5gsT3nja4jpPDY2zZvGnQUQt3dFKHZjIDp/Vsc7rzkU5jVRRXafhSDa4+TM/ibPLePFWG1o89D6XjhN6quoqeWCANADp2UI1ZOcGY4JSY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732641629332350.3942440992919; Tue, 26 Nov 2024 09:20:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.843947.1259526 (Exim 4.92) (envelope-from ) id 1tFzEO-0004vY-QR; Tue, 26 Nov 2024 17:20:08 +0000 Received: by outflank-mailman (output) from mailman id 843947.1259526; Tue, 26 Nov 2024 17:20:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFzEO-0004uv-MS; Tue, 26 Nov 2024 17:20:08 +0000 Received: by outflank-mailman (input) for mailman id 843947; Tue, 26 Nov 2024 17:20:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFzEN-0004k8-9N for xen-devel@lists.xenproject.org; Tue, 26 Nov 2024 17:20:07 +0000 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2060f.outbound.protection.outlook.com [2a01:111:f403:2407::60f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ab4bdcd1-ac1a-11ef-99a3-01e77a169b0f; Tue, 26 Nov 2024 18:20:02 +0100 (CET) Received: from BLAPR03CA0041.namprd03.prod.outlook.com (2603:10b6:208:32d::16) by MW6PR12MB8900.namprd12.prod.outlook.com (2603:10b6:303:244::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Tue, 26 Nov 2024 17:19:55 +0000 Received: from BN3PEPF0000B06B.namprd21.prod.outlook.com (2603:10b6:208:32d:cafe::55) by BLAPR03CA0041.outlook.office365.com (2603:10b6:208:32d::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.20 via Frontend Transport; Tue, 26 Nov 2024 17:19:54 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.0 via Frontend Transport; Tue, 26 Nov 2024 17:19:54 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 26 Nov 2024 11:19:52 -0600 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.39; Tue, 26 Nov 2024 11:19:52 -0600 Received: from amd-BIRMANPLUS.mshome.net (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 26 Nov 2024 11:19:52 -0600 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ab4bdcd1-ac1a-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjQwNzo6NjBmIiwiaGVsbyI6Ik5BTTAyLUJOMS1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImFiNGJkY2QxLWFjMWEtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMyNjQxNjAyLjYxNjgyMSwic2VuZGVyIjoiamFzb24uYW5kcnl1a0BhbWQuY29tIiwicmVjaXBpZW50IjoieGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnIn0= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yunzMZ21GMUd/h77Vtl5ARGp3smqCcADElWnwjFAsOL5l564FOgeLRyYBAQPeo0mpnqzClvmuXssQej9JXavHmxx+Z8ykwm4Fw4232E+0wbjaVwwGfGt8klngqoiQ2MXuH8Rcoidvg93ebVECMp4rc8/Uw5D8sevObOWB1ki+zgjLrbdPpvfOnBdM9Rro7tpte4ARXkrSPzr1AFDN0TXrpmQYAvcvbtBpQJhTOU67vnGgwROjIHlBir1kpAzZx04Lm8rgPQkvBUdVTdqOentKJGBHxupET37lAZikvESgIUVxATB5V+z71dNi4DJR22Fbz0BFdo51T965lECQuyMMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uu7AKaBE7cQGMVaJpznh0ldBUuYX3CfpL80utGtzydc=; b=aCSim3baJZEMxj3tiQqZUrWXJgBNyUsqBRVSAeWC5kBfX96ardZkI4EfTozwA7XDPj9b0NVtQJRIzioGToFPIslZCP789ou00ei9pUZewKBg20fpZvjAYQCmT3EZo1u75mRyCcClDZ1Z3uhcrGdhd2EXDD3j003o7sMZ3uUzCg5rUG67vgheaBwpdizZCFaIdL4BUwzj8HmDxGlgbKXWVRiS/hT5/IFOw8uL83afT0ILTPJCMcip8WaJ1AqctHaOo3Jgx1urtMUYgahOGoFQj1CqnOIFAw6BLWb0WBDXajye4WYZNjuvCWY+HdMMK3hCGit4IejhtXd4TQzWm6T8Dg== 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=uu7AKaBE7cQGMVaJpznh0ldBUuYX3CfpL80utGtzydc=; b=a2L/qfJ7d9ZR14WBQdIZUGrGNRqa3IbBew/U5mRWIRCdbw3njicCiJ/DyO/EW4OMExoGF4AK4m8GjyuQYY+sWUPB2Dt3BHZH3KLJRzpbGQETxMPPPuHcbpYlCdZECILTBYvbpWAZ1AL+bxM9kMSok3tH4vHXGuRQBdEy7HzMtKg= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Jason Andryuk To: CC: Jason Andryuk , Anthony PERARD Subject: [PATCH v2 1/2] xl: Keep monitoring suspended domain Date: Tue, 26 Nov 2024 12:19:40 -0500 Message-ID: <20241126171941.170897-2-jason.andryuk@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241126171941.170897-1-jason.andryuk@amd.com> References: <20241126171941.170897-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06B:EE_|MW6PR12MB8900:EE_ X-MS-Office365-Filtering-Correlation-Id: 147dd5bd-b82b-443a-eaae-08dd0e3e8b76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5npzX6wCUbq63ixJdcRcao1pPiyeHxd2pm5rjOhPzqENbH73qBffa0Bb2zQk?= =?us-ascii?Q?M3qe65qSHdNbo26CltgT9w9RQxwHLoIvt9fFrjdFKzomqWGLIg0mBVeBrzxD?= =?us-ascii?Q?tx7LTyyUgMOooR3+tooKpJsbeke2//XmUDoBYX6WhbMsH9hJrvnwN0dAiD+N?= =?us-ascii?Q?SN95vsDw/inpSS+u7M+X70e/V79tVOAn7DaKiWSrWRy642PSFFGG1vqlKDEh?= =?us-ascii?Q?/o2PCYWuWPL8zWXtwvHwwV3NE70HbNu7Ly9j3nOOUhvdw5+orOq4vuquEUnO?= =?us-ascii?Q?ylNa2aq+VOYWobsZGRUwtK1zVpydJzXgg9UeQiCg1ohi4mCNNhOxsBcbhzk1?= =?us-ascii?Q?hanQX9pqDRs+1Koh3gvSYqfythe3EFKPZ13ZXCBAkq4Px87/rYvJ9lgurlT2?= =?us-ascii?Q?l4V+oKAvJ+6Km1B67WS1xFv+C2H3YFe0tHysxLELEuL2J1yG7ByRzYmV0gaG?= =?us-ascii?Q?V46GAkPKbAyQf889a+pETT8GopS3ualWwF33NDrZWuyabK6j6KQE2wVoEZHI?= =?us-ascii?Q?z041TaQ+rD5BnK7XxRrj+nNRs44eG2N1OwpGfTALyibTvik9itnnLYyNb1rG?= =?us-ascii?Q?XdUbOq6Ml+XfeDAog8J3o4P/AWHo5XR4jyCfLgbtO6+Jg5iqJYiD7h8JlUnJ?= =?us-ascii?Q?0ySZ3guZ39Rm/jMfZLHkXLr6x2H89AOOScag6/RFndUTKL4vTt+OxykG+Vrj?= =?us-ascii?Q?zsA8mwdxrS6vPNXsbA6H4Pu2rUuO1sii0XhzNh0FuEiHe9cvt7KnCGcMEsmX?= =?us-ascii?Q?k6epN7NmNv8boCYYHv5Dh0K8LtqUSZUMA36XMax8SGXnA0NqK/XREMia+hng?= =?us-ascii?Q?dORNbhF+Qf47VOIgKN2GGEU2/yLZyCyqZDK5bm53Bk5iWlxJoQ9V/XbrMD52?= =?us-ascii?Q?zhALCt14QdHj7uhi87lF/sA/j+hnrHLcBzfVzxRWiKc3PXTvVF9Nf4t3bcCV?= =?us-ascii?Q?tH1qWrqysUVISQCPWggayamDB2WSR3d3puyx1/B6iWTQksYOV4ZnSOggvdsl?= =?us-ascii?Q?kcyJxUYglq0oLrwp1UHPwuNa6wdItYh2oTNfzCiREEbsRH7p6PkHhUOMSiwZ?= =?us-ascii?Q?ORSZCKmvFy5mEAwLdePN+q/0AKvf/FaXGxULk8VjeKy0Xy/JWlhndpdfBpPV?= =?us-ascii?Q?q9QwWlYhDOrGZn1terZdtkbeND/YQGYKsR27KzyUiamuQPbx6gGipzQn4rqj?= =?us-ascii?Q?2l5ZXSHAgAWdK1DKFI1dPGAWc0lBYngJFFiNvtVduUcvkagr31UJdhftxCzv?= =?us-ascii?Q?8aWNPMMDuykx487SWCdq+3Id+I98OYeEEaOQYzszDs7Uz3Wpc3IodWu8+JhC?= =?us-ascii?Q?WwE95szjYcrGeG2FrOFoH/oD5NPvVMiLtcsCrH+lrK5ARUm7qklGEKbwin22?= =?us-ascii?Q?MBYJLhpssUy4DUXsGSYI5b4WhZfm0IcTtyoNg82/nrWV2EwT/MlwK9YngWFF?= =?us-ascii?Q?NPp6VO7wshVIFrDEIJTIE2CkqNS0Znp1?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 17:19:54.6441 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 147dd5bd-b82b-443a-eaae-08dd0e3e8b76 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06B.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8900 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1732641629777019100 Content-Type: text/plain; charset="utf-8" When a VM transitioned to LIBXL_SHUTDOWN_REASON_SUSPEND, the xl daemon was exiting as 0 =3D DOMAIN_RESTART_NONE "No domain restart". Later, when the VM actually shutdown, the missing xl daemon meant the domain wasn't cleaned up properly. Add a new DOMAIN_RESTART_SUSPENDED to handle the case. The xl daemon keeps running to react to future shutdown events. The domain death event needs to be re-enabled to catch subsequent events. The libxl_evgen_domain_death is moved from death_list to death_reported, and then it isn't found on subsequent iterations through death_list. We enable the new event before disabling the old event, to keep the xenstore watch active. If it is unregistered and re-registered, it'll fire immediately for our suspended domain which will end up continuously re-triggering. Signed-off-by: Jason Andryuk Reviewed-by: Anthony PERARD --- tools/xl/xl.h | 1 + tools/xl/xl_vmcontrol.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 9c86bb1d98..967d034cfe 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -301,6 +301,7 @@ typedef enum { DOMAIN_RESTART_NORMAL, /* Domain should be restarted */ DOMAIN_RESTART_RENAME, /* Domain should be renamed and restarted= */ DOMAIN_RESTART_SOFT_RESET, /* Soft reset should be performed */ + DOMAIN_RESTART_SUSPENDED, /* Domain suspended - keep looping */ } domain_restart_type; =20 extern void printf_info_sexp(int domid, libxl_domain_config *d_config, FIL= E *fh); diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index fa1a4420e3..c45d497c28 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -417,7 +417,7 @@ static domain_restart_type handle_domain_death(uint32_t= *r_domid, break; case LIBXL_SHUTDOWN_REASON_SUSPEND: LOG("Domain has suspended."); - return 0; + return DOMAIN_RESTART_SUSPENDED; case LIBXL_SHUTDOWN_REASON_CRASH: action =3D d_config->on_crash; break; @@ -1030,6 +1030,7 @@ start: } } while (1) { + libxl_evgen_domain_death *deathw2 =3D NULL; libxl_event *event; ret =3D domain_wait_event(domid, &event); if (ret) goto out; @@ -1100,9 +1101,24 @@ start: ret =3D 0; goto out; =20 + case DOMAIN_RESTART_SUSPENDED: + LOG("Continue waiting for domain %u", domid); + /* + * Enable a new event before disabling the old. This ensu= res + * the xenstore watch remains active. Otherwise it'll fire + * immediately on re-registration and find our suspended d= omain. + */ + ret =3D libxl_evenable_domain_death(ctx, domid, 0, &deathw= 2); + if (ret) goto out; + libxl_evdisable_domain_death(ctx, deathw); + deathw =3D deathw2; + deathw2 =3D NULL; + break; + default: abort(); } + break; =20 case LIBXL_EVENT_TYPE_DOMAIN_DEATH: LOG("Domain %u has been destroyed.", domid); --=20 2.34.1 From nobody Thu Dec 26 21:00:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1732641624; cv=pass; d=zohomail.com; s=zohoarc; b=W2sFzhdTc3EWTnbVOg2NrrzEjsqRYVcS0zoSnlWzrwg1UlkEiAPs0DYrWS5DNkbq6rzOKeDvQPgBagrrOZrqIkABdtMKr/tfhl5GmhAHj6t9JPY+JhPkZ5d5Mru1GhdbvJeOxd0tw68dpmYEhnKV+05bX+E/IvsKRr+jZ9X+8aE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732641624; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hhTkzwMxV7eXeFIK7XcXjiaxfIWPWWwchPU8SykcV3U=; b=eIA59rKTCv7W0Rc7ERJQLfv5hzmn/SsC6OnP63KGDhSPvHp8+thxb6YGDCdBS5ffsPUGfgFq1tMPYflgz9BbFBNUSe+hT5gR5qjz2n90fIxcGD3xJbCjQdRxiYFyKMKtLKcy3Tpd3qW7tD1FIA/sTaLwgASnmPMWREilbYqsY/k= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732641623951324.11842596989106; Tue, 26 Nov 2024 09:20:23 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.843946.1259522 (Exim 4.92) (envelope-from ) id 1tFzEO-0004tA-Iv; Tue, 26 Nov 2024 17:20:08 +0000 Received: by outflank-mailman (output) from mailman id 843946.1259522; Tue, 26 Nov 2024 17:20:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFzEO-0004t3-G1; Tue, 26 Nov 2024 17:20:08 +0000 Received: by outflank-mailman (input) for mailman id 843946; Tue, 26 Nov 2024 17:20:07 +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 1tFzEN-0004Pz-7M for xen-devel@lists.xenproject.org; Tue, 26 Nov 2024 17:20:07 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20628.outbound.protection.outlook.com [2a01:111:f403:2416::628]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ac2105f9-ac1a-11ef-a0cd-8be0dac302b0; Tue, 26 Nov 2024 18:20:04 +0100 (CET) Received: from DM6PR02CA0165.namprd02.prod.outlook.com (2603:10b6:5:332::32) by CY8PR12MB8411.namprd12.prod.outlook.com (2603:10b6:930:6e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.19; Tue, 26 Nov 2024 17:19:59 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:5:332:cafe::54) by DM6PR02CA0165.outlook.office365.com (2603:10b6:5:332::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 17:19:58 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8207.12 via Frontend Transport; Tue, 26 Nov 2024 17:19:58 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.39; Tue, 26 Nov 2024 11:19:57 -0600 Received: from amd-BIRMANPLUS.mshome.net (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 26 Nov 2024 11:19:57 -0600 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac2105f9-ac1a-11ef-a0cd-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjQxNjo6NjI4IiwiaGVsbyI6Ik5BTTExLUNPMS1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImFjMjEwNWY5LWFjMWEtMTFlZi1hMGNkLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyNjQxNjA0LjQ0MDY4Mywic2VuZGVyIjoiamFzb24uYW5kcnl1a0BhbWQuY29tIiwicmVjaXBpZW50IjoieGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnIn0= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FGoTd8PZBTxsibYfTlg5gL9ItuxwWoGfkI7Rqye8kxQH5Il8ID2wwdYDclpZhymDgrjOysyprzHbby8TSm0FCsI62tk9mu6Al3L8Xbm+Ve+dqqTFwRx1gSCuxxnWw3wZES9hzmdzJ2vRoCI1yJ5uO2VHslfG5KkVjXyslYKrdRojPDqYhuoHwOdtGqaIp9EdLeXMwHsT5TaC83rxxwAypKsHSbIzrvAVE1TI0dITsqqAVifS5qDSj44xzaywsu9s0oytTHnl6gkiqHRamak+nAdJXO6pa27W9KqHOvf0DUTCr0axKVflc5WNEjPIv+omKh+L6SJVVwcbNTs1YjL/sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=hhTkzwMxV7eXeFIK7XcXjiaxfIWPWWwchPU8SykcV3U=; b=jbO+B0ursgyD7cx4e0NtsOYz3jQHMwD0FYwKItPNTBDpPqDyiQRPq0BCO3aBZQ0ljg0AbYhn9zQsdn43OopohAZFTcofMoupHgwNfZaYvcoTQaBlJ7MtsGmWyBck0kSD/9KABbFotM02GPuW/kPbFE11ZZjgg2lPpxaOXII5pXwk9E0pqgB9RBS6B+c/W33FLOsUumXSG41zLE4RfytqcXyWomQ4P6JiyM8xPmp8Z5uv8arrjVb0b92FJJfHVEZ3b5bPStlDJP9+/ANv3+icGZxbNnwdZmqE8afsstGugdzRYY9aW+nqD+mdaql2EdMdHRwfNKRf9JrjHZIWmzNi3Q== 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=hhTkzwMxV7eXeFIK7XcXjiaxfIWPWWwchPU8SykcV3U=; b=hWcLAfsqjNN46rx/RXzHZPIQjHqZekj91PQZB5xhbjnr/CyORc2ZluQ88cq1wdDnUGhtIbbz39J8qMTLsEtQScSVDnejpOOMtyyAskZLXeCYobYm4v4mQvt+RMdQLP/9kpq38PjexuyAd1O/9oM5EItiuceAFcq5f5Cg45wfiHQ= 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 (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of 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 From: Jason Andryuk To: CC: =?UTF-8?q?zithro=20/=20Cyril=20R=C3=A9bert?= , "Anthony PERARD" , Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jason Andryuk Subject: [PATCH v2 2/2] tools/xl: add suspend and resume subcommands Date: Tue, 26 Nov 2024 12:19:41 -0500 Message-ID: <20241126171941.170897-3-jason.andryuk@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241126171941.170897-1-jason.andryuk@amd.com> References: <20241126171941.170897-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB03.amd.com: jason.andryuk@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|CY8PR12MB8411:EE_ X-MS-Office365-Filtering-Correlation-Id: 54c6437b-a83c-43a8-6c5c-08dd0e3e8dbb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?B?RGhKQzlZVXorcTFMdWF5bUhJcEp0c25VK04wQWNuZVlobzlEZHYzWkQ2SU5n?= =?utf-8?B?WFl0Wktvb01ZYkR2SnFVa1luU09LNXpqNmhIYnpsNG1zaTMrS3IrN0dDSmdD?= =?utf-8?B?bld4OGp2RGlMTURRRUJxU1M3M1Q5eDFhekFnZitmVlBEMmI0K1dwRVdDdDNR?= =?utf-8?B?R0p4NFNza0hVcDNyekQ2MXlqRlIwNHFVM2xhL0EvTzJvMW1QN2VaZGxYR2oy?= =?utf-8?B?QmZjVFNJSENpSnZWRjh6cWpVb09lM0FzclZHeXBJdldXR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ONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2024 17:19:58.4016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54c6437b-a83c-43a8-6c5c-08dd0e3e8dbb 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: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8411 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1732641625922019100 From: zithro / Cyril R=C3=A9bert The xl command doesn't provide suspend/resume, so add them : xl suspend xl resume This patch follows a discussion on XenDevel: when you want the virtualized equivalent of "sleep"-ing a host, it's better to suspend/resume than to pause/unpause a domain. Suggested-by: Andrew Cooper Suggested-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Cyril R=C3=A9bert (zithro) Signed-off-by: Jason Andryuk --- Rename command to just "suspend" Move inside the HAVE_NO_SUSPEND_RESUME --- docs/man/xl.1.pod.in | 12 ++++++++++++ tools/xl/xl.h | 2 ++ tools/xl/xl_cmdtable.c | 10 ++++++++++ tools/xl/xl_vmcontrol.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in index bed8393473..fe38724b2b 100644 --- a/docs/man/xl.1.pod.in +++ b/docs/man/xl.1.pod.in @@ -682,6 +682,10 @@ Pass the VNC password to vncviewer via stdin. =20 =3Dback =20 +=3Ditem B I + +Resume a domain, after having been suspended. + =3Ditem B [I] I I [I] =20 Saves a running domain to a state file so that it can be restored @@ -760,6 +764,14 @@ in response to this event. =20 =3Dback =20 +=3Ditem B I + +Suspend a domain. This is a cooperative operation where the domain must +respond to the xenstore trigger. When in a suspended state the domain +still consumes allocated resources (such as memory), but is not eligible +for scheduling by the Xen hypervisor. It is in a shutdown state, but +not dying. + =3Ditem B I I =20 Send a to the domain, each type of request is diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 967d034cfe..45745f0dbb 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -129,6 +129,8 @@ int main_restore(int argc, char **argv); int main_migrate_receive(int argc, char **argv); int main_save(int argc, char **argv); int main_migrate(int argc, char **argv); +int main_suspend(int argc, char **argv); +int main_resume(int argc, char **argv); #endif int main_dump_core(int argc, char **argv); int main_pause(int argc, char **argv); diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 53fc22d344..06a0039718 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -193,6 +193,16 @@ const struct cmd_spec cmd_table[] =3D { "Restore a domain from a saved state", "- for internal use only", }, + { "suspend", + &main_suspend, 0, 1, + "Suspend a domain to RAM", + "", + }, + { "resume", + &main_resume, 0, 1, + "Resume a domain from RAM", + "", + }, #endif { "dump-core", &main_dump_core, 0, 1, diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index c45d497c28..3160966972 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -42,6 +42,16 @@ static void unpause_domain(uint32_t domid) libxl_domain_unpause(ctx, domid, NULL); } =20 +static void suspend_domain(uint32_t domid) +{ + libxl_domain_suspend_only(ctx, domid, NULL); +} + +static void resume_domain(uint32_t domid) +{ + libxl_domain_resume(ctx, domid, 1, NULL); +} + static void destroy_domain(uint32_t domid, int force) { int rc; @@ -82,6 +92,32 @@ int main_unpause(int argc, char **argv) return EXIT_SUCCESS; } =20 +int main_suspend(int argc, char **argv) +{ + int opt; + + SWITCH_FOREACH_OPT(opt, "", NULL, "suspend", 1) { + /* No options */ + } + + suspend_domain(find_domain(argv[optind])); + + return EXIT_SUCCESS; +} + +int main_resume(int argc, char **argv) +{ + int opt; + + SWITCH_FOREACH_OPT(opt, "", NULL, "resume", 1) { + /* No options */ + } + + resume_domain(find_domain(argv[optind])); + + return EXIT_SUCCESS; +} + int main_destroy(int argc, char **argv) { int opt; --=20 2.34.1