From nobody Thu Apr 25 15:22:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620039582; cv=none; d=zohomail.com; s=zohoarc; b=CRJHZ5x2jvHv1ldYqkznduzQXDT+ZOc7IzjkVhvyuB/xrM/zYVUcXeW9Ayma1Oxqafa8QBS5KK3Y0z6q/gNNoG1gvoSNFZYmdoD/SlXJqcbOhdC6XtJCw/RXAVLbGPKlMuBo59/XZ7Lk3lOWtUp9ZBtlp/YglO2TuLcCHwhjY+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620039582; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QZatndtEgmu+kxoc/tJEbeUHdCaWYEM9bXwU1A7N4Uc=; b=X2pK+u/0Gd1fBirOAkSQDEy6KtTutiTJU2b1J6+ocNb7NNukJrXkrSNFOA9ChQyE+jfMr6bPPz/aIdUZNlnzbwp5lcOPqQAmqz/TD+hBXbPWupNqaAhNTIzv4xFxuWWe/M3Iyh/6tg47h5Ra5KF8Q4lO++Z5FQDQcpc5zyXXrZc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620039582650995.6866286178093; Mon, 3 May 2021 03:59:42 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-bi9pXywKPQKxnBBehUXX4A-1; Mon, 03 May 2021 06:59:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A2048049CC; Mon, 3 May 2021 10:59:32 +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 79BF9369A; Mon, 3 May 2021 10:59:32 +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 340A61800BBE; Mon, 3 May 2021 10:59:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 143AxVUj006009 for ; Mon, 3 May 2021 06:59:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64AC31D0B0; Mon, 3 May 2021 10:59:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E2789E9B for ; Mon, 3 May 2021 10:59:25 +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 5E0B48058DC for ; Mon, 3 May 2021 10:59:25 +0000 (UTC) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.23]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-307-bL1uMTqUPQCWu0L1VAITlw-1; Mon, 03 May 2021 06:59:23 -0400 Received: from sender by smtp.strato.de (RZmta 47.25.4 AUTH) with ESMTPSA id m06458x43AuJ0m0 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 3 May 2021 12:56:19 +0200 (CEST) X-MC-Unique: bi9pXywKPQKxnBBehUXX4A-1 X-MC-Unique: bL1uMTqUPQCWu0L1VAITlw-1 X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAgtl+1b1FMstFZvCqIQN5N7TvWFg4vzhFVdoKAuQ" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: libvir-list@redhat.com Subject: [PATCH v1 1/4] libxl: remove obsolete VIR_LIBXL_EVENT_CONST Date: Mon, 3 May 2021 12:56:10 +0200 Message-Id: <20210503105613.19554-2-olaf@aepfle.de> In-Reply-To: <20210503105613.19554-1-olaf@aepfle.de> References: <20210503105613.19554-1-olaf@aepfle.de> MIME-Version: 1.0 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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Olaf Hering 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.11 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 Content-Type: text/plain; charset="utf-8" In Xen 4.2 struct libxl_event_hooks had a member which was erroneously declared const. Since libvirt requires at least Xen 4.6, remove the dead code. Signed-off-by: Olaf Hering Reviewed-by: Jim Fehlig --- src/libxl/libxl_domain.c | 2 +- src/libxl/libxl_domain.h | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 917f6f1d81..d78765ad84 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -641,7 +641,7 @@ libxlDomainHandleDeath(libxlDriverPrivate *driver, virD= omainObj *vm) * Handle previously registered domain event notification from libxenlight. */ void -libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *eve= nt) +libxlDomainEventHandler(void *data, libxl_event *event) { libxlDriverPrivate *driver =3D data; libxl_shutdown_reason xl_reason =3D event->u.domain_shutdown.shutdown_= reason; diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index 8223b1d255..cbe7ba19ba 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -117,20 +117,8 @@ void libxlDomainCleanup(libxlDriverPrivate *driver, virDomainObj *vm); =20 -/* - * Note: Xen 4.3 removed the const from the event handler signature. - * Detect which signature to use based on - * LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG. - */ -#ifdef LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG -# define VIR_LIBXL_EVENT_CONST /* empty */ -#else -# define VIR_LIBXL_EVENT_CONST const -#endif - void -libxlDomainEventHandler(void *data, - VIR_LIBXL_EVENT_CONST libxl_event *event); +libxlDomainEventHandler(void *data, libxl_event *event); =20 int libxlDomainAutoCoreDump(libxlDriverPrivate *driver, From nobody Thu Apr 25 15:22:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620039578; cv=none; d=zohomail.com; s=zohoarc; b=dVyklXGW790Iz4LalJEtjgSAO1lydDDL/2UP9PKnFwAQrNUV1she9Mr6GYAqa8dXCke4ug4tXT291dvcH094yUojlKqnMqaibz2sEmeIVpVDKsaRU2wJAoknJoJj/gH291NixA52W0sTVGS5ccRmMXGDDTA0BHI8QQnbgKlmODc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620039578; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pJIBQKjzaBq2ayDJ4aeGbI1HPUReW+rwmvPrCIFZkzM=; b=f6EnjAHVzqcziOxOO+Q57tPvGzN2lePdlM1UTRLhiWbeV9OEjIHF7mQkcmX/KvnEneyM0V/ciIHzPL6ngXW9MYQ3KBqZtk5ZZ3hlft4PZBBP12+t4hEdWLtIsZP4CEzbpCa3uyHa/KScF+fB5JrkOQiiLZR6bV/Azxi3GbJtp2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620039578238828.1022325650736; Mon, 3 May 2021 03:59:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-121-BP8pQc4vNZSiRZQJINp9sQ-1; Mon, 03 May 2021 06:59:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CDF3800D62; Mon, 3 May 2021 10:59:29 +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 EE7635C559; Mon, 3 May 2021 10:59:26 +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 7A2A155346; Mon, 3 May 2021 10:59:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 143AxPcp005960 for ; Mon, 3 May 2021 06:59:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C1521D0AC; Mon, 3 May 2021 10:59:25 +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 05F8B1D0B0 for ; Mon, 3 May 2021 10:59:22 +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 228CD18E0920 for ; Mon, 3 May 2021 10:59:22 +0000 (UTC) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.25]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-7DjJ2WNMPKmZgd2cRwdlgA-1; Mon, 03 May 2021 06:59:19 -0400 Received: from sender by smtp.strato.de (RZmta 47.25.4 AUTH) with ESMTPSA id m06458x43AuK0m1 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 3 May 2021 12:56:20 +0200 (CEST) X-MC-Unique: BP8pQc4vNZSiRZQJINp9sQ-1 X-MC-Unique: 7DjJ2WNMPKmZgd2cRwdlgA-1 X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAgtl+1b1FMstFZvCqIQN5N7TvWFg4vzhFVdoKAuQ" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: libvir-list@redhat.com Subject: [PATCH v1 2/4] libxl: remove obsolete check for result of xc_get_max_cpus Date: Mon, 3 May 2021 12:56:11 +0200 Message-Id: <20210503105613.19554-3-olaf@aepfle.de> In-Reply-To: <20210503105613.19554-1-olaf@aepfle.de> References: <20210503105613.19554-1-olaf@aepfle.de> MIME-Version: 1.0 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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Olaf Hering 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.16 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 Content-Type: text/plain; charset="utf-8" xc_get_max_cpus from Xen version 4.3 may return 0 in case xc_physinfo fails. This has been fixed in Xen 4.4. Remove the obsolete result check from libvirt. Just convert libxl error codes to plain -1. Signed-off-by: Olaf Hering Reviewed-by: Jim Fehlig --- src/libxl/libxl_driver.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index cf3ee4db3d..99a170ff2a 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -972,11 +972,7 @@ libxlConnectGetMaxVcpus(virConnectPtr conn, const char= *type G_GNUC_UNUSED) =20 cfg =3D libxlDriverConfigGet(driver); ret =3D libxl_get_max_cpus(cfg->ctx); - /* On failure, libxl_get_max_cpus() will return ERROR_FAIL from Xen 4.4 - * onward, but it ever returning 0 is obviously wrong too (and it is - * what happens, on failure, on Xen 4.3 and earlier). Therefore, a 'le= ss - * or equal' is the catchall we want. */ - if (ret <=3D 0) + if (ret < 0) ret =3D -1; =20 virObjectUnref(cfg); From nobody Thu Apr 25 15:22:32 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 ARC-Seal: i=1; a=rsa-sha256; t=1620039581; cv=none; d=zohomail.com; s=zohoarc; b=dCyWknYPavIY71dY+1M/99Dlf8RcOv6KOuXTK7ofi0fYFp0hCRIXdhuZMeCq/YHShS+549Tsoj2sFTB0SSMpSmWxiuVmRMefMvwb8cCUCDrNnKiNlevqt33fAFn7dmURwIy5L3P6vZFB2kREieGvgjfFKB/JnU8hnXJ4YYwKMuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620039581; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uauArfXUX+kdGX4MMmcw4obiWtX3GmTZVFAV+pw6ZdE=; b=e5Dbpqts3GUBLAWcTXB1lOUYp7Q9kuqL1JgGDgm5boOs1LBNxC9XEY5yGc//98V6ZBEH89wG/b6rIBDMqJLm4u/SXXiOYpdpG9Ydq2Rfa10ExQjTuEfys26dHJHd2KbIIGsGFZ6t57kb9eUpEh0qw13TFOPvisNUSDe2pEPARpc= ARC-Authentication-Results: i=1; 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 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 1620039581947190.53872038569511; Mon, 3 May 2021 03:59:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-598-swmkyq4YPwK9LdL9hRBM8Q-1; Mon, 03 May 2021 06:59:39 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 596D18049F8; Mon, 3 May 2021 10:59:34 +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 350175C230; Mon, 3 May 2021 10:59:34 +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 0563B1800BC1; Mon, 3 May 2021 10:59:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 143AxRfJ005972 for ; Mon, 3 May 2021 06:59:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id F2BF2205FAA2; Mon, 3 May 2021 10:59:26 +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 EDA38205FAB2 for ; Mon, 3 May 2021 10:59:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 87CA91066559 for ; Mon, 3 May 2021 10:59:24 +0000 (UTC) Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.51]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-hEy50Qn1P-eNb9qrI5zuig-1; Mon, 03 May 2021 06:59:22 -0400 Received: from sender by smtp.strato.de (RZmta 47.25.4 AUTH) with ESMTPSA id m06458x43AuK0m2 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 3 May 2021 12:56:20 +0200 (CEST) X-MC-Unique: swmkyq4YPwK9LdL9hRBM8Q-1 X-MC-Unique: hEy50Qn1P-eNb9qrI5zuig-1 X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAgtl+1b1FMstFZvCqIQN5N7TvWFg4vzhFVdoKAuQ" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: libvir-list@redhat.com Subject: [PATCH v1 3/4] libxl: remove obsolete libxlDomainSetVcpuAffinities function Date: Mon, 3 May 2021 12:56:12 +0200 Message-Id: <20210503105613.19554-4-olaf@aepfle.de> In-Reply-To: <20210503105613.19554-1-olaf@aepfle.de> References: <20210503105613.19554-1-olaf@aepfle.de> MIME-Version: 1.0 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.4 X-loop: libvir-list@redhat.com Cc: Olaf Hering 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.16 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 Content-Type: text/plain; charset="utf-8" Since Xen 4.5 the libxl allows to set affinities during domain creation. This enables Xen to allocate the domain memory on NUMA nodes close to the specified pcpus. Remove the old approach, which moved vcpus after Xen had already allocated domain memory. Signed-off-by: Olaf Hering --- src/libxl/libxl_domain.c | 46 ---------------------------------------- src/libxl/libxl_domain.h | 4 ---- 2 files changed, 50 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index d78765ad84..625e04a9b0 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -967,49 +967,6 @@ libxlDomainAutoCoreDump(libxlDriverPrivate *driver, return 0; } =20 -int -libxlDomainSetVcpuAffinities(libxlDriverPrivate *driver, virDomainObj *vm) -{ - g_autoptr(libxlDriverConfig) cfg =3D libxlDriverConfigGet(driver); - virDomainVcpuDef *vcpu; - libxl_bitmap map; - virBitmap *cpumask =3D NULL; - size_t i; - int ret =3D -1; - - libxl_bitmap_init(&map); - - for (i =3D 0; i < virDomainDefGetVcpus(vm->def); ++i) { - vcpu =3D virDomainDefGetVcpu(vm->def, i); - - if (!vcpu->online) - continue; - - if (!(cpumask =3D vcpu->cpumask)) - cpumask =3D vm->def->cpumask; - - if (!cpumask) - continue; - - if (virBitmapToData(cpumask, &map.map, (int *)&map.size) < 0) - goto cleanup; - - if (libxl_set_vcpuaffinity(cfg->ctx, vm->def->id, i, &map, NULL) != =3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to pin vcpu '%zu' with libxenlight"),= i); - goto cleanup; - } - - libxl_bitmap_dispose(&map); /* Also returns to freshly-init'd stat= e */ - } - - ret =3D 0; - - cleanup: - libxl_bitmap_dispose(&map); - return ret; -} - static int libxlDomainFreeMem(libxl_ctx *ctx, libxl_domain_config *d_config) { @@ -1460,9 +1417,6 @@ libxlDomainStart(libxlDriverPrivate *driver, goto destroy_dom; } =20 - if (libxlDomainSetVcpuAffinities(driver, vm) < 0) - goto destroy_dom; - if (!start_paused) { libxlDomainUnpauseWrapper(cfg->ctx, domid); virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BO= OTED); diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h index cbe7ba19ba..928ee8f5cd 100644 --- a/src/libxl/libxl_domain.h +++ b/src/libxl/libxl_domain.h @@ -124,10 +124,6 @@ int libxlDomainAutoCoreDump(libxlDriverPrivate *driver, virDomainObj *vm); =20 -int -libxlDomainSetVcpuAffinities(libxlDriverPrivate *driver, - virDomainObj *vm); - int libxlDomainStartNew(libxlDriverPrivate *driver, virDomainObj *vm, From nobody Thu Apr 25 15:22:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620039604; cv=none; d=zohomail.com; s=zohoarc; b=b+3jSnd3ZWqojeXfRoJM/MrXzLw7htgfMBlOpMdQv6sekKGDCMsuEKk/+WjZrOdeKpWy9VaJl1XheKkv3imTK3iw2kPDNHjux//uP+GaCIO0v5sw0+p81/8DIpRAI3TLdhJ5SP88MSkEhjQ7FU2nsKzbDt8x8kLlQfPhKj2O5mQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620039604; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pv+ih/EiUxeVOIB4/6sdpQwaeQJejQGNYXblHN7ZKvE=; b=IZF3yajPnbE9Bsu+Q67qfqPMQ1OhTkvsEggt64wST95T6oGUWhvQ5jWA3ZmfhDR/XVtXD3a4o0xDEUXcHbR20VEB+LOujbQsA0Kx1CWR/rn6EIhaBCGInKgoRluzHpbPGCMjz3FMM1jPn0Af/eUK8sifjgmvdTAQ58gX+9pLets= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620039604519822.1923181001231; Mon, 3 May 2021 04:00:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-iGmcxboLOpKYaqCIp_7UNw-1; Mon, 03 May 2021 06:59:36 -0400 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 951531854E25; Mon, 3 May 2021 10:59:30 +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 6A14710027A5; Mon, 3 May 2021 10:59:30 +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 3014018005B6; Mon, 3 May 2021 10:59:30 +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 143AxSwP005985 for ; Mon, 3 May 2021 06:59:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id A5BEC215689A; Mon, 3 May 2021 10:59:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A22092156899 for ; Mon, 3 May 2021 10:59:25 +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 0EB8F80B914 for ; Mon, 3 May 2021 10:59:25 +0000 (UTC) Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [81.169.146.166]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-d5MrSLHiO-mndyzeCtDhMg-1; Mon, 03 May 2021 06:59:23 -0400 Received: from sender by smtp.strato.de (RZmta 47.25.4 AUTH) with ESMTPSA id m06458x43AuK0m4 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 3 May 2021 12:56:20 +0200 (CEST) X-MC-Unique: iGmcxboLOpKYaqCIp_7UNw-1 X-MC-Unique: d5MrSLHiO-mndyzeCtDhMg-1 X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAgtl+1b1FMstFZvCqIQN5N7TvWFg4vzhFVdoKAuQ" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: libvir-list@redhat.com Subject: [PATCH v1 4/4] libxl: set vcpu affinity during domain creation Date: Mon, 3 May 2021 12:56:13 +0200 Message-Id: <20210503105613.19554-5-olaf@aepfle.de> In-Reply-To: <20210503105613.19554-1-olaf@aepfle.de> References: <20210503105613.19554-1-olaf@aepfle.de> MIME-Version: 1.0 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-loop: libvir-list@redhat.com Cc: Olaf Hering 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 Content-Type: text/plain; charset="utf-8" Since Xen 4.5 libxl allows to set affinities during domain creation. This enables Xen to allocate the domain memory on NUMA systems close to the specified pcpus. Libvirt can now handle in domU.xml correctly. Without this change, Xen will create the domU and assign NUMA memory and vcpu affinities on its own. Later libvirt will adjust the affinity, which may move the vcpus away from the assigned NUMA node. Signed-off-by: Olaf Hering --- src/libxl/libxl_conf.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 3ccb00ec35..3a969c38cd 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -283,6 +283,56 @@ libxlMakeChrdevStr(virDomainChrDef *def, char **buf) return 0; } =20 +static int +libxlDomainSetVcpuAffinities(virDomainDef *def, + libxl_ctx *ctx, + libxl_domain_build_info *b_info) +{ + libxl_bitmap *vcpu_affinity_array; + unsigned int vcpuid; + unsigned int vcpu_idx =3D 0; + virDomainVcpuDef *vcpu; + bool has_vcpu_pin =3D false; + + /* Get highest vcpuid with cpumask */ + for (vcpuid =3D 0; vcpuid < b_info->max_vcpus; vcpuid++) { + vcpu =3D virDomainDefGetVcpu(def, vcpuid); + if (!vcpu) + continue; + if (!vcpu->cpumask) + continue; + vcpu_idx =3D vcpuid; + has_vcpu_pin =3D true; + } + /* Nothing to do */ + if (!has_vcpu_pin) + return 0; + + /* Adjust index */ + vcpu_idx++; + + b_info->num_vcpu_hard_affinity =3D vcpu_idx; + /* Will be released by libxl_domain_config_dispose */ + b_info->vcpu_hard_affinity =3D calloc(vcpu_idx, sizeof(libxl_bitmap)); + vcpu_affinity_array =3D b_info->vcpu_hard_affinity; + + for (vcpuid =3D 0; vcpuid < vcpu_idx; vcpuid++) { + libxl_bitmap *map =3D &vcpu_affinity_array[vcpuid]; + libxl_bitmap_init(map); + /* libxl owns the bitmap */ + if (libxl_cpu_bitmap_alloc(ctx, map, 0)) + return -1; + vcpu =3D virDomainDefGetVcpu(def, vcpuid); + /* Apply the given mask, or allow unhandled vcpus to run anywhere = */ + if (vcpu && vcpu->cpumask) + virBitmapToDataBuf(vcpu->cpumask, map->map, map->size); + else + libxl_bitmap_set_any(map); + } + libxl_defbool_set(&b_info->numa_placement, false); + return 0; +} + static int libxlMakeDomBuildInfo(virDomainDef *def, libxlDriverConfig *cfg, @@ -320,6 +370,9 @@ libxlMakeDomBuildInfo(virDomainDef *def, for (i =3D 0; i < virDomainDefGetVcpus(def); i++) libxl_bitmap_set((&b_info->avail_vcpus), i); =20 + if (libxlDomainSetVcpuAffinities(def, ctx, b_info)) + return -1; + switch ((virDomainClockOffsetType) clock.offset) { case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE: if (clock.data.variable.basis =3D=3D VIR_DOMAIN_CLOCK_BASIS_LOCALT= IME)