From nobody Sat May 11 07:48:17 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1648823926; cv=none; d=zohomail.com; s=zohoarc; b=dSTL8Ig2CA6bhCS4WkXEhjk6xARKwBWYSaBKZNb0NPCb7e9fA3Rvd2XLs+wU0mW4xOWGMtA2LlX5bVGbatlwWgPVW5G9vWY8AmBWGAkVk7JfHpvteDIoEBscwPsP4DqhZaoQjL4CAfs77/nIB4mwmLzQEVsNqTaqWknVV8R27+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648823926; h=Content-Type:Content-Transfer-Encoding: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=o649/lk57xdcfT5Dha+R4ROKnaWKzeEr2LUyUvIhzks=; b=SVgqAdqaViNvnRSCU2KfkBC1zJlQhCQ80jREfsqUYjzs2Fsunzw3ZocAkh1BKKAYAqmpkthglWD+gc5IFXKCuYo4sArUeA09/hfQQ1MutKL5p4JJXvLgzbrBqUgvqb+ZUEquXkfPTvI79q7E+HyuqocLtihW30/aSTYlVAU7iTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1648823926427842.1870841935818; Fri, 1 Apr 2022 07:38:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-421--AMNihjPMCWxFQbGpsCmAA-1; Fri, 01 Apr 2022 10:38:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECDD680281D; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5D52C5C86B; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00C2F1947BBF; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E40131947BBE for ; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D5DFE40F013; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E342403372 for ; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648823925; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=o649/lk57xdcfT5Dha+R4ROKnaWKzeEr2LUyUvIhzks=; b=FkaVS63D26dj0SE2yNYphLWAF43u3EM92uDIbGrGr8X+Z6cWSXhJvUA85zGhA3Locc0Jen GbkMUNnr6Eu6L+3+pCbBOnL3yjI3nOlc9sajBdcQnIMT6nGRFLEZEBJGAJWVvuPORTkixG asx6WsS79R2CYvKTCH2XCF3q0UGso3k= X-MC-Unique: -AMNihjPMCWxFQbGpsCmAA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] lib: Don't short circuit around virDomainCgroupSetupVcpuBW() Date: Fri, 1 Apr 2022 16:38:32 +0200 Message-Id: <79243a8413acd7cd296a384d5975814f1e0d1940.1648823888.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648823927995100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The virDomainCgroupSetupVcpuBW() is a NOP if both period and quota to set are zero. There's no need to check in all the callers for this special case. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/hypervisor/domain_cgroup.c | 6 ++---- src/qemu/qemu_driver.c | 12 ------------ src/qemu/qemu_process.c | 3 +-- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c index fc0ad284c8..920ec8c895 100644 --- a/src/hypervisor/domain_cgroup.c +++ b/src/hypervisor/domain_cgroup.c @@ -603,10 +603,8 @@ virDomainCgroupSetupGlobalCpuCgroup(virDomainObj *vm, autoNodeset, &mem_mask, -1) < = 0) return -1; =20 - if (period || quota) { - if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) - return -1; - } + if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) + return -1; =20 return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 77012eb527..547af4384f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8923,9 +8923,6 @@ static int qemuSetGlobalBWLive(virCgroup *cgroup, unsigned long long period, long long quota) { - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) return -1; =20 @@ -9104,9 +9101,6 @@ qemuSetVcpusBWLive(virDomainObj *vm, virCgroup *cgrou= p, { size_t i; =20 - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (!qemuDomainHasVcpuPids(vm)) return 0; =20 @@ -9135,9 +9129,6 @@ qemuSetEmulatorBandwidthLive(virCgroup *cgroup, { g_autoptr(virCgroup) cgroup_emulator =3D NULL; =20 - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (virCgroupNewThread(cgroup, VIR_CGROUP_THREAD_EMULATOR, 0, false, &cgroup_emulator) < 0) return -1; @@ -9155,9 +9146,6 @@ qemuSetIOThreadsBWLive(virDomainObj *vm, virCgroup *c= group, { size_t i; =20 - if (period =3D=3D 0 && quota =3D=3D 0) - return 0; - if (!vm->def->niothreadids) return 0; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f110e4f3dd..f3eb742406 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2699,8 +2699,7 @@ qemuProcessSetupPid(virDomainObj *vm, =20 } =20 - if ((period || quota) && - virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) + if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) goto cleanup; =20 /* Move the thread to the sub dir */ --=20 2.35.1 From nobody Sat May 11 07:48:17 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1648823927; cv=none; d=zohomail.com; s=zohoarc; b=Nj+YvhjZKC2n4PET6FiBIDQSpVJv6t0jwoYWnk1vaIUS9Z7So+uRnXF6+XpwTr0ZFCvWcE2xZRzTqTCdWwLyiax+zhsIGhEdNWt5Qf4CXycehVb+5C5uwbAtX0Tr0ZQ6rpC7+gEr16yIiohouYT48pX4pk6MPaYrAjf9ryZTJww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648823927; h=Content-Type:Content-Transfer-Encoding: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=wYFHiWBNUs0pAFZUlvWKyCHGxm6leE/qiipn8sg2MMk=; b=Ivp6tQADww8qO9H/WG0Ve/ysGRl70VFNi1KuYgZJJe91O5ARoo39ahH2gNF4G/XMs4RGYxnOfOSYSqY8QoEgoIxiL8H5UhEmvZ9UBRWm+Cl1n226KdrEYFDCMsj0twSzCf5MMNxjRK6LumTiYzYL1feQ0dEZ6AvTNZABwz5CXuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1648823927825960.5855112768508; Fri, 1 Apr 2022 07:38:47 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-267-i8obFuPjO9-9UA7BcaoENQ-1; Fri, 01 Apr 2022 10:38:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1816E86B8B0; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02E9F40D2969; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C7E491940349; Fri, 1 Apr 2022 14:38:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8F4D81947BBE for ; Fri, 1 Apr 2022 14:38:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 73AA040BAEE; Fri, 1 Apr 2022 14:38:38 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C210403372 for ; Fri, 1 Apr 2022 14:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648823926; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wYFHiWBNUs0pAFZUlvWKyCHGxm6leE/qiipn8sg2MMk=; b=JD5fkGXZ3oMYZlNGS6gG7z06jn70PmkZoZpjsM1C/M6d5Stp75Y+mi3LiI/cc7oh7PnRoW YtrJijR9UpT66xgyzcE+5bZUfTjEOhc5o6Z+tPU+5VaCORhZyhy9zxpFew8Cba0c7tUgUP t2YhKnnFsdkMKlAJPskTOqM1GQYCI6w= X-MC-Unique: i8obFuPjO9-9UA7BcaoENQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] hypervisor: Drop dead code in virDomainCgroupSetupGlobalCpuCgroup() Date: Fri, 1 Apr 2022 16:38:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648823929875100009 Content-Type: text/plain; charset="utf-8"; x-default="true" Since its introduction in v1.3.2-43-gef1fa55e46 there is a dead code in virDomainCgroupSetupGlobalCpuCgroup() (well, qemuSetupGlobalCpuCgroup() back then). The code formats NUMA nodeset but never sets it. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/ch/ch_process.c | 3 +-- src/hypervisor/domain_cgroup.c | 21 +-------------------- src/hypervisor/domain_cgroup.h | 3 +-- src/qemu/qemu_process.c | 2 +- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 00d94ddcbe..785e4f8769 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -526,8 +526,7 @@ virCHProcessStart(virCHDriver *driver, =20 VIR_DEBUG("Setting global CPU cgroup (if required)"); if (virDomainCgroupSetupGlobalCpuCgroup(vm, - priv->cgroup, - priv->autoNodeset) < 0) + priv->cgroup) < 0) goto cleanup; =20 VIR_DEBUG("Setting vCPU tuning/settings"); diff --git a/src/hypervisor/domain_cgroup.c b/src/hypervisor/domain_cgroup.c index 920ec8c895..5af88155bc 100644 --- a/src/hypervisor/domain_cgroup.c +++ b/src/hypervisor/domain_cgroup.c @@ -572,13 +572,10 @@ virDomainCgroupSetupCpusetCpus(virCgroup *cgroup, =20 int virDomainCgroupSetupGlobalCpuCgroup(virDomainObj *vm, - virCgroup *cgroup, - virBitmap *autoNodeset) + virCgroup *cgroup) { unsigned long long period =3D vm->def->cputune.global_period; long long quota =3D vm->def->cputune.global_quota; - g_autofree char *mem_mask =3D NULL; - virDomainNumatuneMemMode mem_mode; =20 if ((period || quota) && !virCgroupHasController(cgroup, VIR_CGROUP_CONTROLLER_CPU)) { @@ -587,22 +584,6 @@ virDomainCgroupSetupGlobalCpuCgroup(virDomainObj *vm, return -1; } =20 - /* - * If CPU cgroup controller is not initialized here, then we need - * neither period nor quota settings. And if CPUSET controller is - * not initialized either, then there's nothing to do anyway. - */ - if (!virCgroupHasController(cgroup, VIR_CGROUP_CONTROLLER_CPU) && - !virCgroupHasController(cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) - return 0; - - - if (virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) =3D=3D 0 && - mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT && - virDomainNumatuneMaybeFormatNodeset(vm->def->numa, - autoNodeset, &mem_mask, -1) < = 0) - return -1; - if (virDomainCgroupSetupVcpuBW(cgroup, period, quota) < 0) return -1; =20 diff --git a/src/hypervisor/domain_cgroup.h b/src/hypervisor/domain_cgroup.h index 20893e1b46..f8d261a080 100644 --- a/src/hypervisor/domain_cgroup.h +++ b/src/hypervisor/domain_cgroup.h @@ -98,8 +98,7 @@ virDomainCgroupSetupCpusetCpus(virCgroup *cgroup, virBitmap *cpumask); int virDomainCgroupSetupGlobalCpuCgroup(virDomainObj *vm, - virCgroup *cgroup, - virBitmap *autoNodeset); + virCgroup *cgroup); int virDomainCgroupRemoveCgroup(virDomainObj *vm, virCgroup *cgroup, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f3eb742406..bd13cc5103 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7642,7 +7642,7 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; =20 VIR_DEBUG("Setting global CPU cgroup (if required)"); - if (virDomainCgroupSetupGlobalCpuCgroup(vm, priv->cgroup, priv->autoNo= deset) < 0) + if (virDomainCgroupSetupGlobalCpuCgroup(vm, priv->cgroup) < 0) goto cleanup; =20 VIR_DEBUG("Setting vCPU tuning/settings"); --=20 2.35.1 From nobody Sat May 11 07:48:17 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1648823926; cv=none; d=zohomail.com; s=zohoarc; b=WQ7wyq7ma4mx88vq5GkzeNb20gnklcvmYi2oKVqVHaBG9r65QS5u1O2Jb6Fd3eZ7JvODbaJwoH3hkJshjMqgAmSV9ElyQrrYGgrn4LnFf5Uib6+fspKoCm5fhreN0lifC5ShRLD7lvYlTopxfqTqdRIDfvLLFz3E4yUS6tObXB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648823926; h=Content-Type:Content-Transfer-Encoding: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=xlkSuI6CPeW7pMNAk8DoFlimFwfuN5fCs7q4rZW6oS4=; b=FuIQWHxYAFfh2XlLE2BiH46OeEbtMX9pb3hDnwd/1SxXH7VxI6c7wXXDE4I3rBqsGzcim/0soAHavz0hEBUUNZr9Nrr9lWPHeahw/Y5oM0J6lM+11FkRS4khNdsEJjBekrw6mXHA3rPlTyLKQZXDit8/uZzsiGLLqCIpHoFcUz0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1648823926679917.1477278151332; Fri, 1 Apr 2022 07:38:46 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-i6Zg0JMgNGmh1B-n-Qp7eQ-1; Fri, 01 Apr 2022 10:38:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 753E5100BAA4; Fri, 1 Apr 2022 14:38:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FE7A400E553; Fri, 1 Apr 2022 14:38:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 24629194035B; Fri, 1 Apr 2022 14:38:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1F4F21940359 for ; Fri, 1 Apr 2022 14:38:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 13E0E40BAEE; Fri, 1 Apr 2022 14:38:39 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFA49403372 for ; Fri, 1 Apr 2022 14:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648823925; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xlkSuI6CPeW7pMNAk8DoFlimFwfuN5fCs7q4rZW6oS4=; b=CDG5gjFelCLapDE2Jl/1sHgI/ulYMkER9Lem1985t4xqKd8yhcNqd+KrSg450G4nUrqPXM O3no6BdisBSAcqZ6ShFxiaqHl51Qc/eIrU2hh2NAt/c7Bn1uHG5n/QmU30CR/6d+G1FrOw uIas2ogvY2ysm0IZmeHlLQLu9wLliNs= X-MC-Unique: i6Zg0JMgNGmh1B-n-Qp7eQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] ch: Explicitly forbid live changing nodeset for strict numatune Date: Fri, 1 Apr 2022 16:38:34 +0200 Message-Id: <83c4ede9d23b69169d81332debf39f27ba61fee8.1648823888.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648823927994100002 Content-Type: text/plain; charset="utf-8"; x-default="true" This is similar to v7.10.0-354-g06f405c627 except this time it fixes CH driver. With strict numatune we can't guarantee that all memory is moved to new location. Therefore, let's forbid moving memory in that case. However, allow it for restrictive mode, which is documented to be best effort. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/ch/ch_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 2fe7aba9d0..34ce0c1a0c 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1519,7 +1519,7 @@ chDomainSetNumaParamsLive(virDomainObj *vm, size_t i =3D 0; =20 if (virDomainNumatuneGetMode(vm->def->numa, -1, &mode) =3D=3D 0 && - mode !=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT) { + mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("change of nodeset for running domain requires st= rict numa mode")); return -1; --=20 2.35.1 From nobody Sat May 11 07:48:17 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1648823930; cv=none; d=zohomail.com; s=zohoarc; b=kt53VdX6TUqaBxD8ljRihjHheNyTjIM9moayQzWbhBzh6MrsHVECGc1q8Iya3P5lmT9Jwr/WmokN+WDzQSn0i3g4s253tK04HsMcE8LVZuf9PxtRkS4STX4AEsqvdb/oqpyjC0cUUgampru3ODa4dWXz+AtanNVwes9sRVLvC5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648823930; h=Content-Type:Content-Transfer-Encoding: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=euiRI9fdG2hqOC+RemeiWiAcOcfIjui2WZFQNO39p9s=; b=lRKYHkNxmk9IjlaGT9pq74qPDmSOTJLvmabGDDQZz4YPmsIQy+aL7yNOIBgJ7bK7zlkX8mguJ9CSJlErAWn1YO76P6LXuDpfRxlvmDKujm06OywXVhz6rNhlgsgWLOJS1YCGq3Zi5iDxXySdrbog/zREJoN81IRwrJR4YITbdc4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1648823930200516.2158977655048; Fri, 1 Apr 2022 07:38:50 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-486-cH0jgkgqNl6Yin3X02UjqA-1; Fri, 01 Apr 2022 10:38:45 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D5FA86B8B3; Fri, 1 Apr 2022 14:38:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8270063B201; Fri, 1 Apr 2022 14:38:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 605A21947BBF; Fri, 1 Apr 2022 14:38:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B186E1947BBE for ; Fri, 1 Apr 2022 14:38:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A5AE540F013; Fri, 1 Apr 2022 14:38:39 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E5AF40BAEE for ; Fri, 1 Apr 2022 14:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648823929; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=euiRI9fdG2hqOC+RemeiWiAcOcfIjui2WZFQNO39p9s=; b=VTqwVX5SbK+xbhh+qFXJxAkzHoNr2vdEpLvwH+iCIvWSjnw/UfoGL93O0aff5mWWf18BXN yMwD+tY2lU+3tm0PlFYNRMfOutBEUtGhISMaYgy4mRbjjbRCl+t4sMIWAP16kmZt+1Pw9Y 3i4YzI07TPgMh+pAxugQZXmFeUoO9iU= X-MC-Unique: cH0jgkgqNl6Yin3X02UjqA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/4] lib: Set up cpuset controller for restrictive numatune Date: Fri, 1 Apr 2022 16:38:35 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648823931931100011 Content-Type: text/plain; charset="utf-8"; x-default="true" The aim of 'restrictive' numatune mode is to rely solely on CGroups to have QEMU running on configured NUMA nodes. However, we were never setting the cpuset controller when a domain was starting up. We are doing so only when virDomainSetNumaParameters() is called (aka live pinning). This is obviously wrong. Fortunately, fix is simple as 'restrictive' is similar to 'strict' - every location where VIR_DOMAIN_NUMATUNE_MEM_STRICT occurs can be audited and VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE case can be added. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2070380 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/ch/ch_process.c | 3 ++- src/lxc/lxc_controller.c | 3 ++- src/qemu/qemu_process.c | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index 785e4f8769..977082d585 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -254,7 +254,8 @@ virCHProcessSetupPid(virDomainObj *vm, virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)= ) { =20 if (virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) =3D=3D = 0 && - mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT && + (mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT || + mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) && virDomainNumatuneMaybeFormatNodeset(vm->def->numa, priv->autoNodeset, &mem_mask, -1) < 0) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 677fa5a4fb..d936f34793 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -811,7 +811,8 @@ static int virLXCControllerSetupResourceLimits(virLXCCo= ntroller *ctrl) virDomainNumatuneMemMode mode; =20 if (virDomainNumatuneGetMode(ctrl->def->numa, -1, &mode) =3D=3D 0) { - if (mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT && + if ((mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT || + mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) && virCgroupControllerAvailable(VIR_CGROUP_CONTROLLER_CPUSET)) { /* Use virNuma* API iff necessary. Once set and child is exec(= )-ed, * there's no way for us to change it. Rely on cgroups (if ava= ilable diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index bd13cc5103..c4b349632e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2650,7 +2650,8 @@ qemuProcessSetupPid(virDomainObj *vm, virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)= ) { =20 if (virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) =3D=3D = 0 && - mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT && + (mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT || + mem_mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) && virDomainNumatuneMaybeFormatNodeset(vm->def->numa, priv->autoNodeset, &mem_mask, -1) < 0) @@ -3166,7 +3167,8 @@ static int qemuProcessHook(void *data) goto cleanup; =20 if (virDomainNumatuneGetMode(h->vm->def->numa, -1, &mode) =3D=3D 0) { - if (mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT && + if ((mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_STRICT || + mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) && h->cfg->cgroupControllers & (1 << VIR_CGROUP_CONTROLLER_CPUSET= ) && virCgroupControllerAvailable(VIR_CGROUP_CONTROLLER_CPUSET)) { /* Use virNuma* API iff necessary. Once set and child is exec(= )-ed, --=20 2.35.1