From nobody Sat May 4 16:26:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163820395123594.0443286454082; Mon, 29 Nov 2021 08:39:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-424-5J12NdBVMJ-mBSaKAcnwzA-1; Mon, 29 Nov 2021 11:39:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F1D483DD22; Mon, 29 Nov 2021 16:39:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C5C225F4EE; Mon, 29 Nov 2021 16:39:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 40DFF1809C8A; Mon, 29 Nov 2021 16:38:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ATGcvIl017700 for ; Mon, 29 Nov 2021 11:38:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4FA141402408; Mon, 29 Nov 2021 16:38:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A33C1402406 for ; Mon, 29 Nov 2021 16:38:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2CEF910726A2 for ; Mon, 29 Nov 2021 16:38:57 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-20-kkFT3GOTNGCf0jdroB6Kcw-1; Mon, 29 Nov 2021 11:38:55 -0500 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2058.outbound.protection.outlook.com [104.47.0.58]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-14-zpUfJoqROsGFwFJOwVso4A-1; Mon, 29 Nov 2021 17:38:53 +0100 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM0PR0402MB3587.eurprd04.prod.outlook.com (2603:10a6:208:26::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20; Mon, 29 Nov 2021 16:38:52 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6%4]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 16:38:52 +0000 Received: from localhost (75.169.35.15) by AM6P191CA0056.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20 via Frontend Transport; Mon, 29 Nov 2021 16:38:51 +0000 X-MC-Unique: 5J12NdBVMJ-mBSaKAcnwzA-1 X-MC-Unique: kkFT3GOTNGCf0jdroB6Kcw-1 X-MC-Unique: zpUfJoqROsGFwFJOwVso4A-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH 1/6] libxl: Disable death events after receiving a shutdown event Date: Mon, 29 Nov 2021 09:38:40 -0700 Message-ID: <20211129163845.12713-2-jfehlig@suse.com> In-Reply-To: <20211129163845.12713-1-jfehlig@suse.com> References: <20211129163845.12713-1-jfehlig@suse.com> X-ClientProxiedBy: AM6P191CA0056.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::33) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e4b9359-e39c-45c6-643c-08d9b356b9e9 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3587: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:628 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: T2NLPHBQf6KQEz/+sc3ueulHZeBpXAb4klaTTSboVgI/J0oKOrQZA0irphp4Luwr0IHARlyiltGiHsGwpoK6/gWtxhBC0PTDREIndOxnHOiPfPOLJAfA6p2JV4RV6aOkgApBLCQYXyxTBI6TD10P8QH9UmgU3wN/NSiHVT0pweDGzJFqV2Zm4qWgqskVpuFn1jkuK6Nq3lRyCnJ4qcI1Jkhc9EBlWUmzYzvrTmWgyc5E6qRwfAumWiRlAvlzHbGJuuyxQOzFV8qR5ZH5eWpKGO67OEEnFRV57KOvw+wV4TzcAwAi0xpmDSVLFP8BpzHJbFxm/OVvDAXBToCQJUJEjK5JcqJNqyz3NyHQNQbBd7rTarJbmJtQ6rWSuLPcCgW3b0aSJjruvSnL01MW0/8xo0yIIPaysxrJIf5Z9CdB/QxqV7rh3yHZklgQUx4pGHZG3iteug64kc4zG6o4z4fxnnimEni6Ek/XvPhH8vke3DBV5jhRqgA40PaZu+8kBmG+uLMkNjb3M8P+CJdRjvRLgiNuH61VM+PIEIs7Ld1YmmDmWfrVF0Speb2XqfobIfqnLtH6kPh8tQWWJgvHzgpUVVSb2qgfLq8p7HEHvjK+Gb1E4ML2ipHDaxFIr5falVxMtVukKOeDJsN/qnS7NZ+5ogSJkXWa4t7k5zyzUBXJsrIl8qL1FiS/RORYiv2yE3ck3jsnTs5Dt3QbHj1erS0poA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6666004)(508600001)(66476007)(83380400001)(86362001)(1076003)(6916009)(6496006)(66556008)(66946007)(186003)(2906002)(36756003)(5660300002)(956004)(8676002)(2616005)(316002)(8936002)(38100700002)(6486002)(26005)(219283001); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Mze1gPIyOzKOfPuIMeT4Vr3+vPKMxnabuW08j2EBOgKb8Elyuya0mSvLevpU?= =?us-ascii?Q?z+yLmflIeRrcDQzDpIEUXS1nXUdVSiSSC7NW/YlwaLb+vmFErQyuIkWbgBLP?= =?us-ascii?Q?/Myn4k32TaXcynLXKdLOSrkpIDCySUx0xuiZgXESnNpO4n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/Iqh/bGoyyjBSjEhxy86IiaG1cD/HQdBOoZc?= =?us-ascii?Q?5ZBoSEKtnvfeJ+Jg/iw+qJ7BukW8mL5zQijPfO3HBzOeF1rbJoKl+T2/Rxq6?= =?us-ascii?Q?g5cHCxhZGiZjugmuQ7UsLIfrEL6JvBKL977muRBXFOBjTWIKZmdUI6x1xYgz?= =?us-ascii?Q?JYXNVRI2P57B9UaxCT7KaIHU6guVXaPqVQe1RBclXyZWVusc32dfrWZv7uHS?= =?us-ascii?Q?XMN7FCaUo1QMf0U0IsWkKQOW42w1t0f7MZSJesr1Nb56cZr82ToNexIlsxnK?= =?us-ascii?Q?xOFJA+NAVbAL25JCeK0UCYYs8RvnEbXSy5jsrdrC9U5d8wCB/V1sn5KynkOv?= =?us-ascii?Q?WVpQpos6jBEuiCMT/Kl8XoiYuXb1yKN1frwBacHW2xfeBoazgwmKXcvIZlcd?= =?us-ascii?Q?/VFhQnryuu4A2puWCWETljuZoWqUPxyJqrI2SRGpPEuZO7CNAG646quobjoF?= =?us-ascii?Q?ZhicBpfB25VtevjsBTg1wLdcjtv127ytyl/2iwtZC6lbltJy6UmbyqaQMCO7?= =?us-ascii?Q?ZtOHtKw7wr2PC5HJKIHE77eJUFkr7G6QLTw2J0Y/egvxIfptx5vnJqHMg8DC?= =?us-ascii?Q?aNRj54UNHQIfb0r3T1Vcx/c=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e4b9359-e39c-45c6-643c-08d9b356b9e9 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 16:38:52.0194 (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: 7bw5xjuVNUyINOVqXM+sNgNkuGtvk59n8jEe3pXueM7ni8LsvjUaxeF4o8X1be2Kk1ovAUSEDeYWsc/OS6W8WQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3587 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1ATGcvIl017700 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1638203952398100001 Content-Type: text/plain; charset="utf-8" The libxl driver will handle all domain destruction and cleanup when receiving a domain shutdown event from libxl. Commit fa30ee04a2a introduced the ignoreDeathEvent boolean in the DomainObjPrivate struct to ignore subsequent death events from libxl. But libxl already provides a mechanism to disable death events via libxl_evdisable_domain_death. This patch partially reverts commit fa30ee04a2a and instead uses libxl_evdisable_domain_death to disable subsequent death events when processing a shutdown event. Signed-off-by: Jim Fehlig Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_domain.c | 23 +++++------------------ src/libxl/libxl_domain.h | 3 --- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index db2966a599..bbcbd4c74f 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -616,12 +616,6 @@ static void libxlDomainHandleDeath(libxlDriverPrivate *driver, virDomainObj *vm) { virObjectEvent *dom_event =3D NULL; - libxlDomainObjPrivate *priv =3D vm->privateData; - - if (priv->ignoreDeathEvent) { - priv->ignoreDeathEvent =3D false; - return; - } =20 if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) return; @@ -671,7 +665,6 @@ libxlDomainEventHandler(void *data, libxl_event *event) } =20 if (event->type =3D=3D LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN) { - libxlDomainObjPrivate *priv =3D vm->privateData; struct libxlShutdownThreadInfo *shutdown_info =3D NULL; virThread thread; g_autofree char *name =3D NULL; @@ -688,12 +681,9 @@ libxlDomainEventHandler(void *data, libxl_event *event) name =3D g_strdup_printf("ev-%d", event->domid); /* * Cleanup will be handled by the shutdown thread. - * Ignore the forthcoming death event from libxl */ - priv->ignoreDeathEvent =3D true; if (virThreadCreateFull(&thread, false, libxlDomainShutdownThread, name, false, shutdown_info) < 0) { - priv->ignoreDeathEvent =3D false; /* * Not much we can do on error here except log it. */ @@ -859,18 +849,17 @@ libxlDomainDestroyInternal(libxlDriverPrivate *driver, libxlDomainObjPrivate *priv =3D vm->privateData; int ret =3D -1; =20 - /* Ignore next LIBXL_EVENT_TYPE_DOMAIN_DEATH as the caller will handle - * domain death appropriately already (having more info, like the reas= on). - */ - priv->ignoreDeathEvent =3D true; + if (priv->deathW) { + libxl_evdisable_domain_death(cfg->ctx, priv->deathW); + priv->deathW =3D NULL; + } + /* Unlock virDomainObj during destroy, which can take considerable * time on large memory domains. */ virObjectUnlock(vm); ret =3D libxl_domain_destroy(cfg->ctx, vm->def->id, NULL); virObjectLock(vm); - if (ret) - priv->ignoreDeathEvent =3D false; =20 return ret; } @@ -921,8 +910,6 @@ libxlDomainCleanup(libxlDriverPrivate *driver, priv->deathW =3D NULL; } =20 - priv->ignoreDeathEvent =3D false; - if (!!g_atomic_int_dec_and_test(&driver->nactive) && driver->inhibitCa= llback) driver->inhibitCallback(false, driver->inhibitOpaque); =20 diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index 661610bd3f..981bfc2bca 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -54,9 +54,6 @@ struct _libxlDomainObjPrivate { /* console */ virChrdevs *devs; libxl_evgen_domain_death *deathW; - /* Flag to indicate the upcoming LIBXL_EVENT_TYPE_DOMAIN_DEATH is caus= ed - * by libvirt and should not be handled separately */ - bool ignoreDeathEvent; virThread *migrationDstReceiveThr; unsigned short migrationPort; char *lockState; --=20 2.33.0 From nobody Sat May 4 16:26:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638204018917665.6945500750043; Mon, 29 Nov 2021 08:40:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-hE72fnvzNMqplIgLfXzFsA-1; Mon, 29 Nov 2021 11:40:15 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC01F344E0; Mon, 29 Nov 2021 16:40:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86F6C1002388; Mon, 29 Nov 2021 16:40:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 560C21809CB8; Mon, 29 Nov 2021 16:40:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ATGd4Pc017731 for ; Mon, 29 Nov 2021 11:39:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 449B92166B2D; Mon, 29 Nov 2021 16:39:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E1BF2166B26 for ; Mon, 29 Nov 2021 16:39:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18D9C80122B for ; Mon, 29 Nov 2021 16:39:00 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-493-g488sccxMNatgqRu3fKCiw-1; Mon, 29 Nov 2021 11:38:58 -0500 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2051.outbound.protection.outlook.com [104.47.0.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-18-CblRVZgcMCabl4S2REGJ-w-1; Mon, 29 Nov 2021 17:38:56 +0100 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM0PR0402MB3587.eurprd04.prod.outlook.com (2603:10a6:208:26::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20; Mon, 29 Nov 2021 16:38:55 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6%4]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 16:38:55 +0000 Received: from localhost (75.169.35.15) by AM6P191CA0052.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Mon, 29 Nov 2021 16:38:54 +0000 X-MC-Unique: hE72fnvzNMqplIgLfXzFsA-1 X-MC-Unique: g488sccxMNatgqRu3fKCiw-1 X-MC-Unique: CblRVZgcMCabl4S2REGJ-w-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH 2/6] libxl: Rename libxlShutdownThreadInfo struct Date: Mon, 29 Nov 2021 09:38:41 -0700 Message-ID: <20211129163845.12713-3-jfehlig@suse.com> In-Reply-To: <20211129163845.12713-1-jfehlig@suse.com> References: <20211129163845.12713-1-jfehlig@suse.com> X-ClientProxiedBy: AM6P191CA0052.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::29) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6aa83e7-2535-4382-0ef0-08d9b356bbf7 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3587: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: q6UFP/wBFOJcuuBfmhfqVSvpJkLE83hC0zGZGoQk0T9Qh57kkPvvWnHAP7m04SdwbDZQtuCLfYHr1Anzyf+fxyZDxa9ml97qRnrPGWJaf5wsetrwflyKKiUab1hOChMoG/nRZptWpOHOF1PDznYVIrq1o0zz4n2WNAoHMxW0EWsi36jO13yOgv5bjebslSIh850iaWnxBOFap+4Ptk3xNBpSz+P/a1QxXg0+ddPQW4l8H0etHEUb0o2nFNBHz7AIQd47rSOhQncqgWJEsTrdgjVQVJAP9lhu5f3QMVswo4g4bj2xEPZWjJu56BZw1iYH3sQry57ovtDdrOoCG3DMKOQI+B1mJGlR5gowe6ci+rnNfQjNzx0l4p3d42iLg+UxJKIkyWGE+mXOnt1zPPPwOEMELObb8uaOR+YYFOWnUb6uad9mz7wtQjUuSsIGC+SjNXZayV/YVgqOhDKcTKcnx77CYSowWwcFjO/0P4t5gZxrEkKjQd618mugV4/4eSkskKyeOzRrzroONCMdUAj/RySAfCZAYS2omdSADT0/MdfxC4zL7t4lllur4ilcIRWQAl2SBu6cbHb74B3DfuZQxXcqZqtO8O4iB7Ar1Qe0el3Yj7VgiPLvBSDXCmyoPpUcWz1m1VuxcKAQ9EV0cMKgy6a0H8iRv7lomZ9rl5Qu/t03lSa6LlOVph5zlEo7MI1890Vu5dO3i9aCqwyFhzxBww== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6666004)(508600001)(66476007)(83380400001)(86362001)(1076003)(6916009)(6496006)(66556008)(66946007)(186003)(2906002)(36756003)(5660300002)(956004)(8676002)(2616005)(316002)(8936002)(38100700002)(6486002)(26005)(145543001); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tj3x5RfiYrGwdlFhVARMYrG+E3oPHIfExl4FsAcbK6B0pBLs8rk5jswklvU2?= =?us-ascii?Q?BZ7DWE2Aq8i/bVvfl7sxUrF447Qrs5cbDMJGAumHUIAtLDitabter9wDyIE4?= =?us-ascii?Q?Q0Pu3Y0BFPAi7qxHpjtcV8/bLxfgtWDdU2gC1GFZU228jO70BVjhPo7cwO/y?= =?us-ascii?Q?FEv1KaXoDGHsHnT6KGYwTqlPB/ct72rrB0YgiEBAOyehXLm3PtA206q8En2B?= =?us-ascii?Q?W6qPYSWK/BVOIlnGFFee+iHwDXzo1PD04V1/vp5iiW2NJX/66VtlK0hJGsv2?= =?us-ascii?Q?IRaERa3VFcs+BJ4H5ImXHIDUY4mse654NaNPjuFV/K5ek+PDvaktvYampRPd?= =?us-ascii?Q?K5bwUlzk0BBYSyvUV59tiiMpmpfdqOXNIdWYMNRwCwP3yOczMJkZ57oRtw+W?= =?us-ascii?Q?YKRnhEsQrWBW5fES8Tlwe4j4p5jPW8L7fQnBFcuF3Hyzw1TWlp5+x6dHPUl7?= =?us-ascii?Q?aqrcDnIWZgBT5Lv6EzGbviILCDDY6Wayoi98ODN39lxsctz5qLs54sURT52N?= =?us-ascii?Q?2T6NvEyAKvsZDq+kTPMKZd7gpeCqlZZYujSKFh/yaEpQU6xmP62/pQKhHZPZ?= =?us-ascii?Q?49DCDk7GHcmBoefPJAs9tNovtiZzggmiL9PjFVu8C2Q0LZemzc1uGU+wlD5Q?= =?us-ascii?Q?Na4tMbbjwFFnTUKJrQnOsDTQvuy9Y6hU+qZwJDU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6zbC+L26c1vJSalYiH5MrdvIXGO/449VS4yJHE0?= =?us-ascii?Q?7bFiGZoKa+yaGYSnKerpPe8=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6aa83e7-2535-4382-0ef0-08d9b356bbf7 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 16:38:55.2835 (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: fqFGCc6xyMhOVjrZeAtxRsS1UzveaGD6Km4wSU8CICu9YBMnrI8UxzyFSYQLGbZrCbBISLsc/OnV7Tf2aK6bqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3587 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1ATGd4Pc017731 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1638204019990100001 Content-Type: text/plain; charset="utf-8" An upcoming change will use the struct in a thread created to process death events. Rename libxlShutdownThreadInfo to libxlEventHandlerThreadInfo to reflect the more generic usage. Signed-off-by: Jim Fehlig Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_domain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index bbcbd4c74f..2c0cbab269 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -477,7 +477,7 @@ libxlDomainShutdownHandleRestart(libxlDriverPrivate *dr= iver, } =20 =20 -struct libxlShutdownThreadInfo +struct libxlEventHandlerThreadInfo { libxlDriverPrivate *driver; virDomainObj *vm; @@ -488,7 +488,7 @@ struct libxlShutdownThreadInfo static void libxlDomainShutdownThread(void *opaque) { - struct libxlShutdownThreadInfo *shutdown_info =3D opaque; + struct libxlEventHandlerThreadInfo *shutdown_info =3D opaque; virDomainObj *vm =3D shutdown_info->vm; libxl_event *ev =3D shutdown_info->event; libxlDriverPrivate *driver =3D shutdown_info->driver; @@ -665,7 +665,7 @@ libxlDomainEventHandler(void *data, libxl_event *event) } =20 if (event->type =3D=3D LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN) { - struct libxlShutdownThreadInfo *shutdown_info =3D NULL; + struct libxlEventHandlerThreadInfo *shutdown_info =3D NULL; virThread thread; g_autofree char *name =3D NULL; =20 @@ -673,7 +673,7 @@ libxlDomainEventHandler(void *data, libxl_event *event) * Start a thread to handle shutdown. We don't want to be tying up * libxl's event machinery by doing a potentially lengthy shutdown. */ - shutdown_info =3D g_new0(struct libxlShutdownThreadInfo, 1); + shutdown_info =3D g_new0(struct libxlEventHandlerThreadInfo, 1); =20 shutdown_info->driver =3D driver; shutdown_info->vm =3D vm; @@ -693,7 +693,7 @@ libxlDomainEventHandler(void *data, libxl_event *event) } /* * virDomainObjEndAPI is called in the shutdown thread, where - * libxlShutdownThreadInfo and libxl_event are also freed. + * libxlEventHandlerThreadInfo and libxl_event are also freed. */ return; } else if (event->type =3D=3D LIBXL_EVENT_TYPE_DOMAIN_DEATH) { --=20 2.33.0 From nobody Sat May 4 16:26:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638204015041973.9364519117495; Mon, 29 Nov 2021 08:40:15 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-484-crHWzHpIOsKwGWHVpj6_0g-1; Mon, 29 Nov 2021 11:40:10 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F33A343D8; Mon, 29 Nov 2021 16:40:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 380391002388; Mon, 29 Nov 2021 16:40:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0575D4BB7C; Mon, 29 Nov 2021 16:40:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ATGd3Na017726 for ; Mon, 29 Nov 2021 11:39:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 82E8B4047279; Mon, 29 Nov 2021 16:39:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E5DC4047272 for ; Mon, 29 Nov 2021 16:39:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66F2110726A1 for ; Mon, 29 Nov 2021 16:39:03 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-NG-UnChQMUiUoJuOv3BI4w-1; Mon, 29 Nov 2021 11:39:01 -0500 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2050.outbound.protection.outlook.com [104.47.0.50]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-24-v8Hc5RlnPReqc8EGsdKMyA-1; Mon, 29 Nov 2021 17:38:59 +0100 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM0PR0402MB3587.eurprd04.prod.outlook.com (2603:10a6:208:26::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20; Mon, 29 Nov 2021 16:38:58 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6%4]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 16:38:58 +0000 Received: from localhost (75.169.35.15) by AM6P191CA0049.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.21 via Frontend Transport; Mon, 29 Nov 2021 16:38:57 +0000 X-MC-Unique: crHWzHpIOsKwGWHVpj6_0g-1 X-MC-Unique: NG-UnChQMUiUoJuOv3BI4w-1 X-MC-Unique: v8Hc5RlnPReqc8EGsdKMyA-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH 3/6] libxl: Modify name of shutdown thread Date: Mon, 29 Nov 2021 09:38:42 -0700 Message-ID: <20211129163845.12713-4-jfehlig@suse.com> In-Reply-To: <20211129163845.12713-1-jfehlig@suse.com> References: <20211129163845.12713-1-jfehlig@suse.com> X-ClientProxiedBy: AM6P191CA0049.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::26) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77649415-22ab-451f-89a5-08d9b356bdcb X-MS-TrafficTypeDiagnostic: AM0PR0402MB3587: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: c3xuZLS1jJ3QpKxQ874DdOMDzDp1/4xUFqyU+L2SGhzmm7FvwMoSlDrETrwlFmTVgtaN75X1Qk/olpOIJlZYlPO8pfMwXgdQNrvmeuWPpjfYXBhh8t55+JVCgkL6Vlyqk+PbEsT7d+n3t8mk2Idz+GRpdzYDHtQIcaeTxcmTmDRafYSNK5G/iUrqBrYjJQl5kQQZqEkwJg6AuiaIMzFZjCB/gVGGC/D7lKnf4ERTu3iYTYWkNONbv4ZAXtD+ZGGd9FIqze0LKJrEah+pRdxyjH+dBTnvwhRWY+D8v7e3M2oLXGUQPlSFJcN1PQMXGNNLP8HOfC0wvFy/x0m3t8FYu9HG0HdnLuDpJhHfWbhOjKHidfo/KzWQ2N2plgId6xYkSeF6eF3BIltKA/rKaLZuQ7xVOarAKAV3yQel5EuldpQoOMqW1J52j4adCgyuYvAQ7unCU82AgzfWCjP9C+ZlJxG4Hcw7VIwmyv2XUWgjpFsrxsEUC183Fi+PQEZ4mC7InseWiK4fSnY6OUmdUeKMHt7JSDFWFZZGTT7o60P/+0KBkQ+wCbrLXVa4BuN6U7siLGfbatEyf5Lszlhk4AljMMn91rqSuxKor20OPiST74KHSgoVtd3BZ7kb4THCA7t6aqHZ5R62S8vHLuk+f4AaLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(6666004)(508600001)(66476007)(83380400001)(86362001)(1076003)(6916009)(6496006)(66556008)(66946007)(186003)(2906002)(36756003)(5660300002)(956004)(8676002)(2616005)(316002)(8936002)(38100700002)(6486002)(4744005)(26005); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yfHRN03S+qE24+KVRlGphJ1TftW3aNHmgvILXn+hwGR7wHV43Qwu+Y+71V9m?= =?us-asc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pVZNoCedyax7KIujvu/ss/m?= =?us-ascii?Q?WCJUOAj3Mu9qc9phqz9CU2/ZkQ1cwaDqtduBCmsQDYfOrPQImxfng3uVKGKi?= =?us-ascii?Q?nwQ7WHdC7GXewm+wV2QH0cVNlXY080JJcCzzdopF3XWUlVQqarFjQu3oxE+B?= =?us-ascii?Q?IOxS4wQ9IowIFA1zRiccUDKrG5phMO8N+NQxhUQkBL5lGcGx3qzckU22SimG?= =?us-ascii?Q?F/dpmOEkxiV7n6lJkxu8O15u4oeJkzhFALRbeUb/NmY2uPGgGm8roWLyxYXB?= =?us-ascii?Q?lBL+prS1Tj+FsfWDaEwja1M3NAkBwJxO2cRmXBIu0NW3idQEY+DxgqRZxirY?= =?us-ascii?Q?h5fiwAY/ul47CYM3kMwt9xgUfEGX+V8Jw3BOz+6XFLJgOmpT/zI2W3/t2ygH?= =?us-ascii?Q?fqWxN0i+uxff9AaEtqzqVaQso8Pj6op9KPVHs0bfMw15iuEgxOptafILg0K2?= =?us-ascii?Q?e1lPGnBULoZ9LErEunbbUXLsSFWp2pDDzLedRk6iiotFN7kzGGg2WpdpHj6Y?= =?us-ascii?Q?A9Cl+G4pOklPms0dMnT7axKtdLN/MyZAmvj7ihOGGynkQboOifeHL+I7domP?= =?us-ascii?Q?sNcP1FqewMu2PQATwNCy2+4mvmKF9yK/tuRYiJeI9UneVpH80cxBY+GxhWXg?= =?us-ascii?Q?tuu38iSapeoCW4r5Hehk18PrwIaOl5YRT1mZ0HKWpTDAHBI2lYr58pw7JP40?= =?us-ascii?Q?Wn5dOdM68aD+SDS982S9+Sw=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77649415-22ab-451f-89a5-08d9b356bdcb X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 16:38:58.3417 (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: 6E31Hin79Ban6w0xg/LJiGuKcpj0P39r/thoTSG0XH0kUukuYI0Gb+yV5aixYQGIxba/WXCUC928dME834IUAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3587 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1ATGd3Na017726 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1638204017059100001 Content-Type: text/plain; charset="utf-8" The current thread name 'ev-' is a bit terse. Change the name to 'shutdown-event-', allowing it to be distinguished between thread handling other event types. Signed-off-by: Jim Fehlig Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 2c0cbab269..5d0034102e 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -678,7 +678,7 @@ libxlDomainEventHandler(void *data, libxl_event *event) shutdown_info->driver =3D driver; shutdown_info->vm =3D vm; shutdown_info->event =3D (libxl_event *)event; - name =3D g_strdup_printf("ev-%d", event->domid); + name =3D g_strdup_printf("shutdown-event-%d", event->domid); /* * Cleanup will be handled by the shutdown thread. */ --=20 2.33.0 From nobody Sat May 4 16:26:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638204019529549.4352027442891; Mon, 29 Nov 2021 08:40:19 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-27-3PT-jBxLPaGqW_IpI5zkrw-1; Mon, 29 Nov 2021 11:40:15 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C9A718A0F27; Mon, 29 Nov 2021 16:40:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4220D1002388; Mon, 29 Nov 2021 16:40:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0B7434A705; Mon, 29 Nov 2021 16:40:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ATGd6Vd017747 for ; Mon, 29 Nov 2021 11:39:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7DF122166B2D; Mon, 29 Nov 2021 16:39:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77AE22166B26 for ; Mon, 29 Nov 2021 16:39:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5899E10726A5 for ; Mon, 29 Nov 2021 16:39:06 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-363-SOe01rxGMlWYHCMaH4OU1g-1; Mon, 29 Nov 2021 11:39:04 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2050.outbound.protection.outlook.com [104.47.14.50]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-32-Ea54k0QoOf-6jj0dHGEGjg-1; Mon, 29 Nov 2021 17:39:02 +0100 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM9PR04MB7537.eurprd04.prod.outlook.com (2603:10a6:20b:282::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Mon, 29 Nov 2021 16:39:01 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6%4]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 16:39:01 +0000 Received: from localhost (75.169.35.15) by AM6P191CA0045.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Mon, 29 Nov 2021 16:39:00 +0000 X-MC-Unique: 3PT-jBxLPaGqW_IpI5zkrw-1 X-MC-Unique: SOe01rxGMlWYHCMaH4OU1g-1 X-MC-Unique: Ea54k0QoOf-6jj0dHGEGjg-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH 4/6] libxl: Handle domain death events in a thread Date: Mon, 29 Nov 2021 09:38:43 -0700 Message-ID: <20211129163845.12713-5-jfehlig@suse.com> In-Reply-To: <20211129163845.12713-1-jfehlig@suse.com> References: <20211129163845.12713-1-jfehlig@suse.com> X-ClientProxiedBy: AM6P191CA0045.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::22) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6e761f8-2422-487c-1786-08d9b356bf86 X-MS-TrafficTypeDiagnostic: AM9PR04MB7537: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: mEK45e9cqWCJ7Kwkb+n+sv401pgCNViF2BnT963Kdoip6ysPpTjAdoWsa6pa+YK6EzmjFO1Kcwu1rUzUmtTRXm+5jMfCs0iUxgR9dP/9KS/MmQdEXfedYJw124PiYpdlHUlbCzpZnfNVETdou9KYhNqdFgP4BaJNRGI8b1Crh/tnrhh17asnjuwC9EHNgQzldENy13J0d622NwRcGdAK1X91OZXWx/QXls2prZzsSzSvj+4zMzpNjjZMMYapwU/HSPYLL35cLGO3bgJviQsXv5C6sYrHfCBt6w535Bdh5s3u0dEkjxtbTYUdB6c0EIyH1TBaWdkkon4hoFnqX4WTxO/9cn7MIfG6y0uduH3vlaQzlgfs9FpncfSFvEUyHLMfGv4oLyDfJL7SO16GEY+NYMDNSlfxcJTQDC6BFad/h5H4SK61VB7t2zBoeZCHwdq/apX17WmRExEGS+tFPfjiCHSQiM4MvsidHWIAxvKsnm4a7n3z5DzakdkNxb6UV2Q5bZ00x4pTx8ZsYddD678kX+HPL3GTYgH2WPhQblPE4iOS4z5Wbe6W8VRuz+QU+CJOkWH/PwwlycoJSi/OrCq5ri48IEToWsjhQ7Lm+JtvtL0023sZIzly1JaujDldclUzKIo4yVF9+aay5e2ce/WJale2WZLttyjbUtE0f9FlujYeEb2bVlmMaFlWQ7WIMMIj9Rn2STnXGrBAnmaZWv92bw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(86362001)(316002)(66946007)(66556008)(2906002)(956004)(8676002)(38100700002)(6496006)(6666004)(186003)(508600001)(2616005)(66476007)(8936002)(6486002)(1076003)(83380400001)(26005)(5660300002)(36756003)(6916009)(219283001); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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ny2tSZ3CNU3Jgy0KoaB83J2Nda6Oh4sUa7vnl24XJcbnRzyvph?= =?us-ascii?Q?PS+yCgHS9CALeypIF9N0dFBdSiBXy5GpYP5BpA9A7E6xOGtc7RLEgxrUNR+n?= =?us-ascii?Q?YJ/6oDoc89icLKNt9lsbV3jf4v4TzkZnrGNH5Z6W75uOxTI273fybS1hnvYT?= =?us-ascii?Q?S9ML7kc5xNSRiGPyfnn6GlPKG0Nhu5TPgRPwBH/kOzqa75a9FKWgUGTVQfPI?= =?us-ascii?Q?oA50QrMm1ibABE+00nOP9fI5lBlf5kNMKaI3M6CvsC1LGIgupR/5fL5Pk2Nd?= =?us-ascii?Q?fsueG+XJFs2KaYbCFTf91Wzvrx4HhiK+Td6G2BgfAci89MfX3xSCIHpyJahP?= =?us-ascii?Q?fPsidJn44SzzePmHAmqRl9ygN4EmIaGIXUaj8+SDSeK9ShFmKxXdUhe/MPMT?= =?us-ascii?Q?8f96TciuvmEZDlaENSEEYu0ywbMK0t8iB2vAWj3vo/X75CD5BIuZuDo1vPIw?= =?us-ascii?Q?HY1RtmfycIavn59ifkvvZLaBnHjcSvgRd6W1BB5Sd3TGMEseN3szzQB1hOZ5?= =?us-ascii?Q?ppTHY1sJIjfxqL1cHLcckd66xCxyFmJOolBYGWour6kyw7YAAN1f/CjG6uaX?= =?us-ascii?Q?0a3ZslE57KSh5TkRA/1WOo9OZjOD6Up3C2OZXgKcx+7kSoto8Z8Fj5FMnXvH?= =?us-ascii?Q?EQWRxjSbqTA7f0X/PHeVIr9vMnBbP0ROF9Y7PEGo8pVY7gvKav7xP3m205+4?= =?us-ascii?Q?itlkatA33cI7JywcidoBit/80V0+CQ1QhxNziROTxCpzQUkem7cZrNW6HcYQ?= =?us-ascii?Q?+cvZLKoJm5GwOvYSRdvaKUI=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6e761f8-2422-487c-1786-08d9b356bf86 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 16:39:01.4189 (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: MTewY3zCyz4H6kHWbclsUlmtjURV43ScS3oYLLR2OPcgD9rW2gCRcal/J0wA8Unlt/ca024PIpS/6ad3Lk3tyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7537 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1ATGd6Vd017747 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1638204020161100003 Content-Type: text/plain; charset="utf-8" Similar to domain shutdown events, processing domain death events can be a lengthy process and we don't want to block the event handler while the operation completes. Move the death handling function to a thread. Signed-off-by: Jim Fehlig Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_domain.c | 67 ++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 5d0034102e..d6c5f7e5b7 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -613,12 +613,17 @@ libxlDomainShutdownThread(void *opaque) } =20 static void -libxlDomainHandleDeath(libxlDriverPrivate *driver, virDomainObj *vm) +libxlDomainDeathThread(void *opaque) { + struct libxlEventHandlerThreadInfo *death_info =3D opaque; + virDomainObj *vm =3D death_info->vm; + libxl_event *ev =3D death_info->event; + libxlDriverPrivate *driver =3D death_info->driver; virObjectEvent *dom_event =3D NULL; + g_autoptr(libxlDriverConfig) cfg =3D libxlDriverConfigGet(driver); =20 if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) - return; + goto cleanup; =20 virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_DESTRO= YED); dom_event =3D virDomainEventLifecycleNewFromObj(vm, @@ -629,6 +634,11 @@ libxlDomainHandleDeath(libxlDriverPrivate *driver, vir= DomainObj *vm) virDomainObjListRemove(driver->domains, vm); libxlDomainObjEndJob(driver, vm); virObjectEventStateQueue(driver->domainEventState, dom_event); + + cleanup: + virDomainObjEndAPI(&vm); + libxl_event_free(cfg->ctx, ev); + VIR_FREE(death_info); } =20 =20 @@ -642,6 +652,9 @@ libxlDomainEventHandler(void *data, libxl_event *event) libxl_shutdown_reason xl_reason =3D event->u.domain_shutdown.shutdown_= reason; virDomainObj *vm =3D NULL; g_autoptr(libxlDriverConfig) cfg =3D NULL; + struct libxlEventHandlerThreadInfo *thread_info =3D NULL; + virThread thread; + g_autofree char *thread_name =3D NULL; =20 VIR_DEBUG("Received libxl event '%d' for domid '%d'", event->type, eve= nt->domid); =20 @@ -664,31 +677,27 @@ libxlDomainEventHandler(void *data, libxl_event *even= t) goto cleanup; } =20 + /* + * Start event-specific threads to handle shutdown and death. + * They are potentially lengthy operations and we don't want to be + * blocking this event handler while they are in progress. + */ if (event->type =3D=3D LIBXL_EVENT_TYPE_DOMAIN_SHUTDOWN) { - struct libxlEventHandlerThreadInfo *shutdown_info =3D NULL; - virThread thread; - g_autofree char *name =3D NULL; + thread_info =3D g_new0(struct libxlEventHandlerThreadInfo, 1); =20 - /* - * Start a thread to handle shutdown. We don't want to be tying up - * libxl's event machinery by doing a potentially lengthy shutdown. - */ - shutdown_info =3D g_new0(struct libxlEventHandlerThreadInfo, 1); - - shutdown_info->driver =3D driver; - shutdown_info->vm =3D vm; - shutdown_info->event =3D (libxl_event *)event; - name =3D g_strdup_printf("shutdown-event-%d", event->domid); + thread_info->driver =3D driver; + thread_info->vm =3D vm; + thread_info->event =3D (libxl_event *)event; + thread_name =3D g_strdup_printf("shutdown-event-%d", event->domid); /* * Cleanup will be handled by the shutdown thread. */ if (virThreadCreateFull(&thread, false, libxlDomainShutdownThread, - name, false, shutdown_info) < 0) { + thread_name, false, thread_info) < 0) { /* * Not much we can do on error here except log it. */ VIR_ERROR(_("Failed to create thread to handle domain shutdown= ")); - VIR_FREE(shutdown_info); goto cleanup; } /* @@ -697,15 +706,33 @@ libxlDomainEventHandler(void *data, libxl_event *even= t) */ return; } else if (event->type =3D=3D LIBXL_EVENT_TYPE_DOMAIN_DEATH) { + thread_info =3D g_new0(struct libxlEventHandlerThreadInfo, 1); + + thread_info->driver =3D driver; + thread_info->vm =3D vm; + thread_info->event =3D (libxl_event *)event; + thread_name =3D g_strdup_printf("death-event-%d", event->domid); /* - * On death the domain is cleaned up from Xen's perspective. - * Cleanup on the libvirt side can be done synchronously. + * Cleanup will be handled by the death thread. */ - libxlDomainHandleDeath(driver, vm); + if (virThreadCreateFull(&thread, false, libxlDomainDeathThread, + thread_name, false, thread_info) < 0) { + /* + * Not much we can do on error here except log it. + */ + VIR_ERROR(_("Failed to create thread to handle domain death")); + goto cleanup; + } + /* + * virDomainObjEndAPI is called in the death thread, where + * libxlEventHandlerThreadInfo and libxl_event are also freed. + */ + return; } =20 cleanup: virDomainObjEndAPI(&vm); + VIR_FREE(thread_info); cfg =3D libxlDriverConfigGet(driver); /* Cast away any const */ libxl_event_free(cfg->ctx, (libxl_event *)event); --=20 2.33.0 From nobody Sat May 4 16:26:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638203961479385.50490341279135; Mon, 29 Nov 2021 08:39:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-rxfgbGY2NpaOdO2cLOcoIA-1; Mon, 29 Nov 2021 11:39:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2601A19357BE; Mon, 29 Nov 2021 16:39:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0731560622; Mon, 29 Nov 2021 16:39:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 943D84A700; Mon, 29 Nov 2021 16:39:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ATGd9MP017761 for ; Mon, 29 Nov 2021 11:39:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 90220401E4B; Mon, 29 Nov 2021 16:39:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8ADAC401E2A for ; Mon, 29 Nov 2021 16:39:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B15E8007B1 for ; Mon, 29 Nov 2021 16:39:09 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-pWWwZ--wNeufbfLMgfyQiw-1; Mon, 29 Nov 2021 11:39:07 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2056.outbound.protection.outlook.com [104.47.14.56]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-40-YJUZ_jb1MiiEbivwUArn1Q-1; Mon, 29 Nov 2021 17:39:05 +0100 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM9PR04MB7537.eurprd04.prod.outlook.com (2603:10a6:20b:282::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Mon, 29 Nov 2021 16:39:04 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6%4]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 16:39:04 +0000 Received: from localhost (75.169.35.15) by AS9PR06CA0066.eurprd06.prod.outlook.com (2603:10a6:20b:464::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Mon, 29 Nov 2021 16:39:03 +0000 X-MC-Unique: rxfgbGY2NpaOdO2cLOcoIA-1 X-MC-Unique: pWWwZ--wNeufbfLMgfyQiw-1 X-MC-Unique: YJUZ_jb1MiiEbivwUArn1Q-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH 5/6] libxl: Search for virDomainObj in event handler threads Date: Mon, 29 Nov 2021 09:38:44 -0700 Message-ID: <20211129163845.12713-6-jfehlig@suse.com> In-Reply-To: <20211129163845.12713-1-jfehlig@suse.com> References: <20211129163845.12713-1-jfehlig@suse.com> X-ClientProxiedBy: AS9PR06CA0066.eurprd06.prod.outlook.com (2603:10a6:20b:464::11) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68bf9063-c053-474f-2e5e-08d9b356c15b X-MS-TrafficTypeDiagnostic: AM9PR04MB7537: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: vGvcwRabEDJBrdMg+9aAaLJvR0CW+hVFmBNwTwfMKLjjGz+NV8O/s6G7pxWTesfDeTjd4VSseoPoV04ClKEAlVf8i9JTKwwxJzsphWAo8cgkopAXfWiD5F3JHjJpu+29XQwEF5jvCqs1GI3G1YEp2kyzr5Ve2wZ7641V+5zFaP4jQKYy3U7otiKuX7hQr5IyHViazgwSUxjoWB/kf965AfWZtUFHXgNoCxUC6oP3GPLreWIdQCLmU0T9guVlHopOko9M81tRsrQREfXdxQtlAVbgAxvzEGWf2Tq+3Kj3Ojft89KK/Lq0Fv+2JLfbN2p1axLdvKEXM3GdH6RO9ZD+xPoLi2rtQ2NfoQyU9vMwwDU4FmlK799cA+DrfsDSCft8pOss++Z8NdWCCiyodON+jCaYhHwogr0rVJtDoWo2kQX3w07a34VblMBf9R+2gg2RNz3ALbT6SqazG3e75GnUbU2FpoHBvEUg4TN9PrWwY1OOtA4s1gdwyv58KeI2bSbF3WbWrd4N0eHFRRQcsvD4YBgfiO3LnqzEpGLa6j/s1hom2k1hSlc2Edv3XPD0OjkuLfVxukoi7JrJfs2nKhnv34cgLAef6xYXFtvxlPNaNFTJWG+iNaEUzwk0lWWXhze3OcwyrtRivTVad9ITQUhq/g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(86362001)(316002)(66946007)(66556008)(2906002)(956004)(8676002)(38100700002)(6496006)(6666004)(186003)(508600001)(2616005)(66476007)(8936002)(6486002)(1076003)(83380400001)(26005)(5660300002)(36756003)(6916009); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?A86Fnk9ODIbTQFVz5kL3ECCLg6lLh7IrCtVHEW5XHrAwI+mEej/n1Bqd4GxN?= =?us-ascii?Q?kvdN067AQM02Gy/3aKK/kmFuAOR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GMe9qsU+KC3pC68vBD+qMw09kZHwT6PyWqADhJNQcclPneWCzzgwPDpwK?= =?us-ascii?Q?GhAJxex1ON7bT0f3NZo85RzFe992lEkf52NwSZS/0Gt6fP4mRo+wc6Wl4FvH?= =?us-ascii?Q?t97bhDBGK/ZD4AXVDGlD6OoKukaBkaduSrdjrCTO2nzdYeHTSxdO+zZGKWOH?= =?us-ascii?Q?TR0KDOUNWDhO8wqp3V4V/Sa962NH23LJZa9zYX5dzId5nFNYOsxqhIOhG2g2?= =?us-ascii?Q?xLOAd0mLpOZ2NQYGdaEMC494p/wOUvwW5qf941BMzQZmxl9RGw4UkcphQHy3?= =?us-ascii?Q?jzsTKjVvO8DN8AxZhkWk0tSPzNYvqPHAmYpCSNQynXBni9G/Pxw+rNWr0nyD?= =?us-ascii?Q?DpWS5zM5rVz7ihuYreX5dlNbKgdm3OWfHdIGm/LB72VmiNc7QM2w754za+zG?= =?us-ascii?Q?xPQG54ZUIChImqaC86Id1b6KrbjdYi7AVux0dJkScOT4O6siIF3IYh7EVLIp?= =?us-ascii?Q?Z7fM8BSxx3IvPTBHPa2oSvySKfP+7ZsfalQybaUVPqSlJOFcK6nMsh73wvRJ?= =?us-ascii?Q?lq3Q4gXH2yjg+xxN7Z7G+rodjbc+TyiCfzKNMF+WMyvrcMArhUPsEpSZTj33?= =?us-ascii?Q?R95Or/W+MYEMCD02OLHemYRdhgunGqXKJgLfn/1DSCAkvt6VhvRVVeGnJg6T?= =?us-ascii?Q?46bd6y7wttbae4AnoeRMQrU=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68bf9063-c053-474f-2e5e-08d9b356c15b X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 16:39:04.4901 (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: nMN0U4FVR/hoa+IJjaptSiK9ShMhRHE5Ej/gKzVatHhaPXGRHJow8VPyOchd1+YjRGx1FWOA/TKcfMc53jF9kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7537 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1ATGd9MP017761 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1638203962856100001 Content-Type: text/plain; charset="utf-8" libxl can deliver events and invoke callbacks on any application thread calling into libxl. This can cause deadlock in the libvirt libxl driver Thread 19 (Thread 0x7f31411ec700 (LWP 14068) "libvirtd"): #0 0x00007f318520cc7d in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x00007f3185205ed5 in pthread_mutex_lock () from /lib64/libpthread.so.0 #2 0x00007f3189488015 in virMutexLock (m=3D) at ../../src/u= til/virthread.c:79 #3 0x00007f3189463f3b in virObjectLock (anyobj=3D) at ../..= /src/util/virobject.c:433 #4 0x00007f31894f2f41 in virDomainObjListSearchID (payload=3D0x7f317400a6d= 0, name=3D, data=3D0x7f31411eaeac) at ../../src/conf/virdoma= inobjlist.c:105 JWF: the 'payload' is virDomainObj with domid 28712, 'data'= is domid 28710. So looking for 28710 but firsh compare with 28712, which i= s the virDomainObj we started working with in f15 and is locked. #5 0x00007f3189437ac5 in virHashSearch (ctable=3D0x7f3124025a30, iter=3Dit= er@entry=3D0x7f31894f2f30 , data=3Ddata@entry=3D0= x7f31411eaeac, name=3Dname@entry=3D0x0) at ../../src/util/virhash.c:745 #6 0x00007f31894f3919 in virDomainObjListFindByID (doms=3D0x7f3124025430, = id=3D) at ../../src/conf/virdomainobjlist.c:121 #7 0x00007f3152f292e5 in libxlDomainEventHandler (data=3D0x7f3124023d80, e= vent=3D0x7f310c010ae0) at ../../src/libxl/libxl_domain.c:660 #8 0x00007f3152c6ff5d in egc_run_callbacks (egc=3Degc@entry=3D0x7f31411eaf= 50) at libxl_event.c:1427 #9 0x00007f3152c718bd in libxl__egc_cleanup (egc=3D0x7f31411eaf50) at libx= l_event.c:1458 #10 libxl__ao_inprogress (ao=3Dao@entry=3D0x7f310c00b8a0, file=3Dfile@entry= =3D0x7f3152cce987 "libxl_domain.c", line=3Dline@entry=3D730, func=3Dfunc@en= try=3D0x7f3152ccf750 <__func__.22238> "libxl_domain_unpause") at libxl_even= t.c:2047 #11 0x00007f3152c8c5b8 in libxl_domain_unpause (ctx=3D0x7f3124015a40, domid= =3D, ao_how=3Dao_how@entry=3D0x0) at libxl_domain.c:730 #12 0x00007f3152f2a584 in libxl_domain_unpause_0x041200 (domid=3D, ctx=3D) at /usr/include/libxl.h:1756 #13 libxlDomainStart (driver=3Ddriver@entry=3D0x7f3124023d80, vm=3Dvm@entry= =3D0x7f317400a6d0, start_paused=3Dstart_paused@entry=3Dfalse, restore_fd=3D= restore_fd@entry=3D-1, restore_ver=3D, restore_ver@entry=3D2= ) at ../../src/libxl/libxl_domain.c:1482 #14 0x00007f3152f2a6e3 in libxlDomainStartNew (driver=3Ddriver@entry=3D0x7f= 3124023d80, vm=3Dvm@entry=3D0x7f317400a6d0, start_paused=3Dstart_paused@ent= ry=3Dfalse) at ../../src/libxl/libxl_domain.c:1545 #15 0x00007f3152f2a789 in libxlDomainShutdownHandleRestart (driver=3D0x7f31= 24023d80, vm=3D0x7f317400a6d0) at ../../src/libxl/libxl_domain.c:464 JWF: d= omid here is 28712 #16 0x00007f3152f2a9e4 in libxlDomainShutdownThread (opaque=3D) at ../../src/libxl/libxl_domain.c:559 #17 0x00007f3189487ee2 in virThreadHelper (data=3D) at ../..= /src/util/virthread.c:196 #18 0x00007f3185203539 in start_thread () from /lib64/libpthread.so.0 #19 0x00007f3184f3becf in clone () from /lib64/libc.so.6 Frame 16 runs a thread created to handle domain shutdown processing for domid 28712. In this case the event contained the reboot reason, so the old domain is destroyed and a new one is created by libxlDomainStart new. After starting the domain, it is unpaused by calling libxl_domain_unpause in frame 12. While the thread is running within libxl, libxl takes the opportunity to deliver a pending domain shutdown event for unrelated domid 28710. While searching for the associated virDomainObj by ID, a deadlock is encountered when attempting to lock the virDomainObj for domid 28712, which is already locked since this thread is processing its shutdown event. The deadlock can be avoided by moving the search for a virDomainObj associated with the event domid to the shutdown thread. The same is done for the death thread. Signed-off-by: Jim Fehlig Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_domain.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index d6c5f7e5b7..366e3b9263 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -480,7 +480,6 @@ libxlDomainShutdownHandleRestart(libxlDriverPrivate *dr= iver, struct libxlEventHandlerThreadInfo { libxlDriverPrivate *driver; - virDomainObj *vm; libxl_event *event; }; =20 @@ -489,7 +488,7 @@ static void libxlDomainShutdownThread(void *opaque) { struct libxlEventHandlerThreadInfo *shutdown_info =3D opaque; - virDomainObj *vm =3D shutdown_info->vm; + virDomainObj *vm =3D NULL; libxl_event *ev =3D shutdown_info->event; libxlDriverPrivate *driver =3D shutdown_info->driver; virObjectEvent *dom_event =3D NULL; @@ -499,6 +498,12 @@ libxlDomainShutdownThread(void *opaque) =20 libxl_domain_config_init(&d_config); =20 + vm =3D virDomainObjListFindByID(driver->domains, ev->domid); + if (!vm) { + /* Nothing to do if we can't find the virDomainObj */ + goto cleanup; + } + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto cleanup; =20 @@ -616,12 +621,18 @@ static void libxlDomainDeathThread(void *opaque) { struct libxlEventHandlerThreadInfo *death_info =3D opaque; - virDomainObj *vm =3D death_info->vm; + virDomainObj *vm =3D NULL; libxl_event *ev =3D death_info->event; libxlDriverPrivate *driver =3D death_info->driver; virObjectEvent *dom_event =3D NULL; g_autoptr(libxlDriverConfig) cfg =3D libxlDriverConfigGet(driver); =20 + vm =3D virDomainObjListFindByID(driver->domains, ev->domid); + if (!vm) { + /* Nothing to do if we can't find the virDomainObj */ + goto cleanup; + } + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto cleanup; =20 @@ -650,7 +661,6 @@ libxlDomainEventHandler(void *data, libxl_event *event) { libxlDriverPrivate *driver =3D data; libxl_shutdown_reason xl_reason =3D event->u.domain_shutdown.shutdown_= reason; - virDomainObj *vm =3D NULL; g_autoptr(libxlDriverConfig) cfg =3D NULL; struct libxlEventHandlerThreadInfo *thread_info =3D NULL; virThread thread; @@ -671,12 +681,6 @@ libxlDomainEventHandler(void *data, libxl_event *event) if (xl_reason =3D=3D LIBXL_SHUTDOWN_REASON_SUSPEND) goto cleanup; =20 - vm =3D virDomainObjListFindByID(driver->domains, event->domid); - if (!vm) { - /* Nothing to do if we can't find the virDomainObj */ - goto cleanup; - } - /* * Start event-specific threads to handle shutdown and death. * They are potentially lengthy operations and we don't want to be @@ -686,7 +690,6 @@ libxlDomainEventHandler(void *data, libxl_event *event) thread_info =3D g_new0(struct libxlEventHandlerThreadInfo, 1); =20 thread_info->driver =3D driver; - thread_info->vm =3D vm; thread_info->event =3D (libxl_event *)event; thread_name =3D g_strdup_printf("shutdown-event-%d", event->domid); /* @@ -701,15 +704,14 @@ libxlDomainEventHandler(void *data, libxl_event *even= t) goto cleanup; } /* - * virDomainObjEndAPI is called in the shutdown thread, where - * libxlEventHandlerThreadInfo and libxl_event are also freed. + * libxlEventHandlerThreadInfo and libxl_event are freed in the + * shutdown thread */ return; } else if (event->type =3D=3D LIBXL_EVENT_TYPE_DOMAIN_DEATH) { thread_info =3D g_new0(struct libxlEventHandlerThreadInfo, 1); =20 thread_info->driver =3D driver; - thread_info->vm =3D vm; thread_info->event =3D (libxl_event *)event; thread_name =3D g_strdup_printf("death-event-%d", event->domid); /* @@ -724,14 +726,13 @@ libxlDomainEventHandler(void *data, libxl_event *even= t) goto cleanup; } /* - * virDomainObjEndAPI is called in the death thread, where - * libxlEventHandlerThreadInfo and libxl_event are also freed. + * libxlEventHandlerThreadInfo and libxl_event are freed in the + * death thread */ return; } =20 cleanup: - virDomainObjEndAPI(&vm); VIR_FREE(thread_info); cfg =3D libxlDriverConfigGet(driver); /* Cast away any const */ --=20 2.33.0 From nobody Sat May 4 16:26:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638203969300410.8121418359242; Mon, 29 Nov 2021 08:39:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-M55JYeJdMbihboHxOTVmDQ-1; Mon, 29 Nov 2021 11:39:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7078E1015DBB; Mon, 29 Nov 2021 16:39:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F73560BF1; Mon, 29 Nov 2021 16:39:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EDCC44A707; Mon, 29 Nov 2021 16:39:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1ATGdCIQ017772 for ; Mon, 29 Nov 2021 11:39:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id D94154047279; Mon, 29 Nov 2021 16:39:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3A964047272 for ; Mon, 29 Nov 2021 16:39:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B933F185A794 for ; Mon, 29 Nov 2021 16:39:12 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-136-iU1cTZLPPoGc6YAYapDJkg-1; Mon, 29 Nov 2021 11:39:10 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2055.outbound.protection.outlook.com [104.47.14.55]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-8-5FbFwQ7XNcyFpiowTMKpaA-1; Mon, 29 Nov 2021 17:39:08 +0100 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) by AM9PR04MB7537.eurprd04.prod.outlook.com (2603:10a6:20b:282::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Mon, 29 Nov 2021 16:39:08 +0000 Received: from AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6]) by AM0PR04MB4899.eurprd04.prod.outlook.com ([fe80::c58b:de4e:3ba7:9ef6%4]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 16:39:08 +0000 Received: from localhost (75.169.35.15) by AS9PR06CA0075.eurprd06.prod.outlook.com (2603:10a6:20b:464::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Mon, 29 Nov 2021 16:39:07 +0000 X-MC-Unique: M55JYeJdMbihboHxOTVmDQ-1 X-MC-Unique: iU1cTZLPPoGc6YAYapDJkg-1 X-MC-Unique: 5FbFwQ7XNcyFpiowTMKpaA-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [PATCH 6/6] libxl: Protect access to libxlLogger files hash table Date: Mon, 29 Nov 2021 09:38:45 -0700 Message-ID: <20211129163845.12713-7-jfehlig@suse.com> In-Reply-To: <20211129163845.12713-1-jfehlig@suse.com> References: <20211129163845.12713-1-jfehlig@suse.com> X-ClientProxiedBy: AS9PR06CA0075.eurprd06.prod.outlook.com (2603:10a6:20b:464::23) To AM0PR04MB4899.eurprd04.prod.outlook.com (2603:10a6:208:c5::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 346f7fd6-9eaa-4123-9c4a-08d9b356c369 X-MS-TrafficTypeDiagnostic: AM9PR04MB7537: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: 7vwGhkTAFRewghaM+e2Sm8n0h+ozDb/TQK5VuDzvSXYFf1ITYit/5SlFL92fw7AnXeWB84JDgYceirz7PK5zUG1+vN59Zc3omJWCnfS5gY7QALboBwXN/hYk4+Lm09o5YGsNRQX++19hwpPMvOjCG4T7QSM3PPb0obljrWvEo04MpN6oRbQx1f7vjR0mwXYdJUWW1sqvxCyi5p9ZwRHpGQ95fGeqDmfTYaY9kKYFByjFhGScqvBN4Vk8fFqzzDdFRoqQ5iolQq4qAiZMM6tkq1dE69lirtZ1CCgiHw7bQOM2pSzXh6uslgFf8jzCRG+BJRRAZr/6pvlCH5WJ9Lj/rLvks6UCjAd5ZAuTOXfokyJRneZebeyn2OJfWNQ326ZFL4aYB1LL1N8DIbIZjHE6gdD8HPludbibMSdGXlehH+S2ye4LfqSXqguJjkjhZdAIgq3VozDlBc1GJ7txWQWlZzc6xF4yd0RC6Dd4dvTx2YvtdT+MBLJwK9Palon7IRMQTzO8YHTSvBzR7s8BebbPja4dVt2BQ0/Zda5TDkWri9rcemDOsVXtkDlMfANEzFU/EVip3G6W32O+PU8yQ6cpYfsFcz55VFcF65ej/mh+sXSHndYZzA1fyfqBTg6hHBv+se1VIwOeozcF+bqlfjJAR4PeYikX3pjKQRQA+dxhzwjPouz6XA8vGIzNFhzl0YpTQVFneJvdvPtU7N6RCdfH8w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4899.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(86362001)(316002)(66946007)(66556008)(2906002)(956004)(8676002)(38100700002)(6496006)(6666004)(186003)(508600001)(2616005)(66476007)(8936002)(6486002)(1076003)(83380400001)(26005)(43170500006)(5660300002)(36756003)(6916009); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SajKeNYsIhyIl+8oPXIafFcxh9cqnIGarSxM8aaPI69KI/s7qZEU5iIrlxe8?= =?us-ascii?Q?4IMNtRiRwM6KEvmVG4zCw2yngLp7vDX83o2pZQlpxiwPHdFiDPkjyKu7l+DH?= =?us-ascii?Q?JxOIBK1FtPKaTfo4TYxoArn1cZr72qX1xnqi5B6S7jvSJP1zXtfsFXo49x8l?= =?us-ascii?Q?XPfkZvofS0ixnV1UeMmFllHmjhVmzilP+Tr3Aad7AeyCScaBHRlnLnrIPkrb?= =?us-ascii?Q?Rvg24nDfSX6udS19VLtTSc75hj0Ko+QejTA3n/soPBILyVLvXaUOq+OmK0Cw?= =?us-ascii?Q?wRBi99zVjmeQN7/eNmmOMEJsAF84DUi/sACT0IN9RuG4ZEKU4xAdUhw5UzAe?= =?us-ascii?Q?FhGyVfmb6vd2Naq/obyBcVDQIMp8/pdkkSHX3dWUafE+LBY5h10zQknVmm62?= =?us-ascii?Q?arUtcFevIrFTFey1AQ/oPKTaPpCyUkXQfcfkdjWyZJ2InLsR5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nNTxiwlIG8DvWQt/gxu3q6U4B7cJlL?= =?us-ascii?Q?JZEavm4GsP2maxmkXjcxIOIr7CMcoGvINx/UPoJ5QZwMq50CyoVdskjL5KtQ?= =?us-ascii?Q?JIMMFheFXhuWvuOkIuPBHc65nql27yFP8V4tvHnTVZLAoTA2JibUBWxUpySL?= =?us-ascii?Q?davwwGV6bgXsrh7WBnGaAPVJc0K0K3Ai828ep8SLH43sX/4SeLyoj0QBZs8O?= =?us-ascii?Q?KVUe0CpOxL3d+FY4SKHzFKB7hZ+Hr+JXgKBfFe2dA/IpwvsE+AjMG68XYWPA?= =?us-ascii?Q?ovc8bIur/8I7kv2DcNUpj/I=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 346f7fd6-9eaa-4123-9c4a-08d9b356c369 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4899.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2021 16:39:08.0021 (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: b/MCYwDpo/98nkv9+5P+DnlYE/cgqENgenmLyowzZY90hmAsIb32Z6y4wL9FUmLYmjt6rcWneSYaVEcwEzKUwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7537 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 1ATGdCIQ017772 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1638203970667100001 Content-Type: text/plain; charset="utf-8" The hash table of log file objects in libxlLogger is not protected against concurrent access. It is possible for one thread to remove an entry while another is updating it. Add a mutex to the libxlLogger object and lock it when accessing the files hash table. Signed-off-by: Jim Fehlig Reviewed-by: J=C3=A1n Tomko --- src/libxl/libxl_logger.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c index f7b5c8ee16..27f8f50b1c 100644 --- a/src/libxl/libxl_logger.c +++ b/src/libxl/libxl_logger.c @@ -28,6 +28,7 @@ #include "util/virfile.h" #include "util/virhash.h" #include "util/virstring.h" +#include "util/virthread.h" #include "util/virtime.h" =20 #define VIR_FROM_THIS VIR_FROM_LIBXL @@ -43,6 +44,7 @@ struct xentoollog_logger_libvirt { =20 /* map storing the opened fds: "domid" -> FILE* */ GHashTable *files; + virMutex tableLock; FILE *defaultLogFile; }; =20 @@ -85,7 +87,9 @@ libvirt_vmessage(xentoollog_logger *logger_in, start =3D start + 9; *end =3D '\0'; =20 + virMutexLock(&lg->tableLock); domainLogFile =3D virHashLookup(lg->files, start); + virMutexUnlock(&lg->tableLock); if (domainLogFile) logFile =3D domainLogFile; =20 @@ -149,11 +153,14 @@ libxlLoggerNew(const char *logDir, virLogPriority min= Level) break; } logger.logDir =3D logDir; + if (virMutexInit(&logger.tableLock) < 0) + return NULL; logger.files =3D virHashNew(libxlLoggerFileFree); =20 path =3D g_strdup_printf("%s/libxl-driver.log", logDir); =20 if ((logger.defaultLogFile =3D fopen(path, "a")) =3D=3D NULL) { + virMutexDestroy(&logger.tableLock); virHashFree(logger.files); return NULL; } @@ -168,6 +175,7 @@ libxlLoggerFree(libxlLogger *logger) if (logger->defaultLogFile) VIR_FORCE_FCLOSE(logger->defaultLogFile); virHashFree(logger->files); + virMutexDestroy(&logger->tableLock); xtl_logger_destroy(xtl_logger); } =20 @@ -189,7 +197,9 @@ libxlLoggerOpenFile(libxlLogger *logger, path, g_strerror(errno)); return; } + virMutexLock(&logger->tableLock); ignore_value(virHashAddEntry(logger->files, domidstr, logFile)); + virMutexUnlock(&logger->tableLock); =20 /* domain_config is non NULL only when starting a new domain */ if (domain_config) { @@ -204,5 +214,7 @@ libxlLoggerCloseFile(libxlLogger *logger, int id) g_autofree char *domidstr =3D NULL; domidstr =3D g_strdup_printf("%d", id); =20 + virMutexLock(&logger->tableLock); ignore_value(virHashRemoveEntry(logger->files, domidstr)); + virMutexUnlock(&logger->tableLock); } --=20 2.33.0