From nobody Wed May 1 23:23:53 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1614778539; cv=none; d=zohomail.com; s=zohoarc; b=hbTwkzX9D8B+3m2K22lPt7P4dtI/NAkHdHSwGeJdiT9XP6+HqMdN6jFaTe6NuDFffPNQaYpEZzskgN3VEVCoX0uMtVpgwIE2Df9xO+XqvLogxiT+Dx7oPD9VN/nFaaY2Nyl4IYi3PzXsLq8aSmggnNOSjq7uiXAZJ9hBy/2nCXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614778539; 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=+3fgNRxL+XD9pST/iSFtGfYqiCSrIDsnAXyOOIlcPuA=; b=g0iRVE8EGasxpSqyO9LQfvih/mzuaxWm5lkJHOYOL+LWNJQ2memNru+8hB2FqqBvUpPvajot4JPO4va0Ydlf417J+Z4tQL7I0lS/7Vv4N7wSzceRsaVMbuTdXn5/j5YSDDiu8z3Dxv3dD6fvOz91fb+tdUS09CRAM27YTtdCDS8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1614778539340243.25386045917855; Wed, 3 Mar 2021 05:35:39 -0800 (PST) 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-259-qlXii2DmNRGGMtBVom8-Lw-1; Wed, 03 Mar 2021 08:35:35 -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 1529C189C44D; Wed, 3 Mar 2021 13:35:29 +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 DD1DB10023B0; Wed, 3 Mar 2021 13:35:28 +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 A220018095CB; Wed, 3 Mar 2021 13:35:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123DZRGT026454 for ; Wed, 3 Mar 2021 08:35:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 78B37100239A; Wed, 3 Mar 2021 13:35:27 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5DE1100164C for ; Wed, 3 Mar 2021 13:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614778538; 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=+3fgNRxL+XD9pST/iSFtGfYqiCSrIDsnAXyOOIlcPuA=; b=DcKtuoTE0PQoz7yN8MbVDONg4s6A5XAUKO1fuRrsEEqn4mDWods0CC3/299Yg2F+2UZnjy D1XCTLOQbDCr+wb0Lr6pJ+n4e6qdJbEnIP07V1LXWJEsQ2IYCq29rxd9YZpmXNeNbuVTA0 JHUenSWuGWiruE/PQrJ0eDLnueviNhE= X-MC-Unique: qlXii2DmNRGGMtBVom8-Lw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] vircgroup: enforce range limit for cpu.shares Date: Wed, 3 Mar 2021 14:35:20 +0100 Message-Id: <3d9ea1f927711e7627705dea5f20a6009e6c4320.1614778388.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Before the conversion to using systemd DBus API to set the cpu.shares there was some magic conversion done by kernel which was documented in virsh manpage as well. Now systemd errors out if the value is out of range. Since we enforce the range for other cpu cgroup attributes 'quota' and 'period' it makes sense to do the same for 'shares' as well. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 3 ++- docs/manpages/virsh.rst | 5 +---- src/conf/domain_validate.c | 10 ++++++++++ src/util/vircgroup.h | 2 ++ src/util/vircgroupv1.c | 10 ++++++++++ src/util/vircgroupv2.c | 10 ++++++++++ 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 937b0da012..b434ada8f0 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -742,7 +742,8 @@ CPU Tuning the domain. If this is omitted, it defaults to the OS provided defaults= . NB, There is no unit for the value, it's a relative measure based on the se= tting of other VM, e.g. A VM configured with value 2048 will get twice as muc= h CPU - time as a VM configured with value 1024. :since:`Since 0.9.0` + time as a VM configured with value 1024. The value should be in range + [2, 262144]. :since:`Since 0.9.0` ``period`` The optional ``period`` element specifies the enforcement interval (uni= t: microseconds). Within ``period``, each vCPU of the domain will not be a= llowed diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 8a4328faa0..d44c36e2e9 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3807,10 +3807,7 @@ If *--config* is specified, affect the next start of= a persistent guest. If *--current* is specified, it is equivalent to either *--live* or *--config*, depending on the current state of the guest. =20 -``Note``: The cpu_shares parameter has a valid value range of 0-262144; Ne= gative -values are wrapped to positive, and larger values are capped at the maximu= m. -Therefore, -1 is a useful shorthand for 262144. On the Linux kernel, the -values 0 and 1 are automatically converted to a minimal value of 2. +``Note``: The cpu_shares parameter has a valid value range of 2-262144. =20 ``Note``: The weight and cap parameters are defined only for the XEN_CREDIT scheduler. diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index b4e09e21fe..61cd0a07e5 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1229,6 +1229,16 @@ virDomainDefOSValidate(const virDomainDef *def, static int virDomainDefCputuneValidate(const virDomainDef *def) { + if (def->cputune.shares > 0 && + (def->cputune.shares < VIR_CGROUP_CPU_SHARES_MIN || + def->cputune.shares > VIR_CGROUP_CPU_SHARES_MAX)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Value of cputune 'shares' must be in range [%llu= , %llu]"), + VIR_CGROUP_CPU_SHARES_MIN, + VIR_CGROUP_CPU_SHARES_MAX); + return -1; + } + CPUTUNE_VALIDATE_PERIOD(period); CPUTUNE_VALIDATE_PERIOD(global_period); CPUTUNE_VALIDATE_PERIOD(emulator_period); diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index ec0902e301..7d9172d664 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -230,6 +230,8 @@ int virCgroupGetCpuShares(virCgroupPtr group, unsigned = long long *shares); int virCgroupSetupCpuShares(virCgroupPtr cgroup, unsigned long long shares, unsigned long long *realValue); =20 +#define VIR_CGROUP_CPU_SHARES_MIN 2LL +#define VIR_CGROUP_CPU_SHARES_MAX 262144LL #define VIR_CGROUP_CPU_PERIOD_MIN 1000LL #define VIR_CGROUP_CPU_PERIOD_MAX 1000000LL #define VIR_CGROUP_CPU_QUOTA_MIN 1000LL diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 79015ddaa4..f8bdca4e78 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1917,6 +1917,16 @@ static int virCgroupV1SetCpuShares(virCgroupPtr group, unsigned long long shares) { + if (shares < VIR_CGROUP_CPU_SHARES_MIN || + shares > VIR_CGROUP_CPU_SHARES_MAX) { + virReportError(VIR_ERR_INVALID_ARG, + _("shares '%llu' must be in range [%llu, %llu]"), + shares, + VIR_CGROUP_CPU_SHARES_MIN, + VIR_CGROUP_CPU_SHARES_MAX); + return -1; + } + if (group->unitName) { GVariant *value =3D g_variant_new("t", shares); =20 diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 24c7e64c67..669bf1b52e 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -1505,6 +1505,16 @@ static int virCgroupV2SetCpuShares(virCgroupPtr group, unsigned long long shares) { + if (shares < VIR_CGROUP_CPU_SHARES_MIN || + shares > VIR_CGROUP_CPU_SHARES_MAX) { + virReportError(VIR_ERR_INVALID_ARG, + _("shares '%llu' must be in range [%llu, %llu]"), + shares, + VIR_CGROUP_CPU_SHARES_MIN, + VIR_CGROUP_CPU_SHARES_MAX); + return -1; + } + if (group->unitName) { GVariant *value =3D g_variant_new("t", shares); =20 --=20 2.29.2 From nobody Wed May 1 23:23:53 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=1614778622; cv=none; d=zohomail.com; s=zohoarc; b=hp30nuuA7uDQ+6WniSxR4LPGJfNHVe6ilWfKKWDiS8PgYfqZs8Los/EUQ0AzZekQxp3xVIzMtyvg3xx//yDp/Ov9pRZJ1yuLZV+JOq75R1T1sPEPsQ9u32MeQ0eyTSbcaQwMW6SMwS7jUL5sPUInSD0FZvvMTAj4uwrZnyHSkPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614778622; 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=51Vkhedk6TG8DFOTczMSeMg5455Cu+NXY2rFE/bMWvA=; b=WYoVjLtoWFzlwYZqOlEG9yKwfmsicfGzlRB9nK80EkonYVinCqnwQi1fFBYHIbUijZCIJe1DJ49uIUUzhtBBYRPZzJnjKYPwHARURYq4fEVydjwIBUNR5i+llRRtdW5gHuHxwwbsv6D1uKv4awDZq8OTBr6Eg+kUSfVp2IRsqhE= 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) header.from= 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 1614778622827933.3521036290177; Wed, 3 Mar 2021 05:37:02 -0800 (PST) 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-523-ZV7D9EDUOFuyA7Hamq0kMA-1; Wed, 03 Mar 2021 08:35:42 -0500 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 DE0DE1020C30; Wed, 3 Mar 2021 13:35:35 +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 B93325C238; Wed, 3 Mar 2021 13:35:35 +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 7650B1809C90; Wed, 3 Mar 2021 13:35:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123DZSMO026462 for ; Wed, 3 Mar 2021 08:35:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5CADD10023B0; Wed, 3 Mar 2021 13:35:28 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDBC7100239A for ; Wed, 3 Mar 2021 13:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614778621; 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=51Vkhedk6TG8DFOTczMSeMg5455Cu+NXY2rFE/bMWvA=; b=C/btM+PsuSu3PSWHZtF49SHS5ebgxgxcNLPWqL5im1pTkjLLTeS03k9KKSNlekhWugXp+D XAm7gwgZRDj9xicLrg0RmTiyUtiCHUXVRqLtFvSO7lSjnY9kgWnm+MT3sTgynqwBg1hgan MpX+h9ohFkygRIHABEqBMGzt978YACQ= X-MC-Unique: ZV7D9EDUOFuyA7Hamq0kMA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] cgroup: use virCgroupSetCpuShares instead of virCgroupSetupCpuShares Date: Wed, 3 Mar 2021 14:35:21 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that we enforce the cpu.shares range kernel will no longer silently change the value that libvirt configures so there is no need to read the value back to get the actual configuration. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/lxc/lxc_cgroup.c | 4 +--- src/lxc/lxc_driver.c | 6 ++---- src/qemu/qemu_cgroup.c | 21 +-------------------- src/qemu/qemu_driver.c | 7 +++---- 4 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index 3c546861f1..af4322d6cf 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -39,10 +39,8 @@ static int virLXCCgroupSetupCpuTune(virDomainDefPtr def, virCgroupPtr cgroup) { if (def->cputune.sharesSpecified) { - unsigned long long val; - if (virCgroupSetupCpuShares(cgroup, def->cputune.shares, &val) < 0) + if (virCgroupSetCpuShares(cgroup, def->cputune.shares) < 0) return -1; - def->cputune.shares =3D val; } =20 return virCgroupSetupCpuPeriodQuota(cgroup, def->cputune.period, diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 4416acf923..61faceb2de 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1868,12 +1868,10 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr d= om, =20 if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) { if (def) { - unsigned long long val; - if (virCgroupSetupCpuShares(priv->cgroup, params[i].value.= ul, - &val) < 0) + if (virCgroupSetCpuShares(priv->cgroup, params[i].value.ul= ) < 0) goto endjob; =20 - def->cputune.shares =3D val; + def->cputune.shares =3D params[i].value.ul; def->cputune.sharesSpecified =3D true; } =20 diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 8c31bb4210..4d94b57e57 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -880,10 +880,6 @@ static int qemuSetupCpuCgroup(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virObjectEventPtr event =3D NULL; - virTypedParameterPtr eventParams =3D NULL; - int eventNparams =3D 0; - int eventMaxparams =3D 0; =20 if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) { if (vm->def->cputune.sharesSpecified) { @@ -896,23 +892,8 @@ qemuSetupCpuCgroup(virDomainObjPtr vm) } =20 if (vm->def->cputune.sharesSpecified) { - unsigned long long val; - if (virCgroupSetupCpuShares(priv->cgroup, vm->def->cputune.shares, - &val) < 0) + if (virCgroupSetCpuShares(priv->cgroup, vm->def->cputune.shares) <= 0) return -1; - - if (vm->def->cputune.shares !=3D val) { - vm->def->cputune.shares =3D val; - if (virTypedParamsAddULLong(&eventParams, &eventNparams, - &eventMaxparams, - VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES, - val) < 0) - return -1; - - event =3D virDomainEventTunableNewFromObj(vm, eventParams, eve= ntNparams); - } - - virObjectEventStateQueue(priv->driver->domainEventState, event); } =20 return 0; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d1a3659774..9a6934f30f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9324,17 +9324,16 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr = dom, =20 if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) { if (def) { - unsigned long long val; - if (virCgroupSetupCpuShares(priv->cgroup, value_ul, &val) = < 0) + if (virCgroupSetCpuShares(priv->cgroup, value_ul) < 0) goto endjob; =20 - def->cputune.shares =3D val; + def->cputune.shares =3D value_ul; def->cputune.sharesSpecified =3D true; =20 if (virTypedParamsAddULLong(&eventParams, &eventNparams, &eventMaxNparams, VIR_DOMAIN_TUNABLE_CPU_CPU_SHA= RES, - val) < 0) + value_ul) < 0) goto endjob; } =20 --=20 2.29.2 From nobody Wed May 1 23:23:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614778539; cv=none; d=zohomail.com; s=zohoarc; b=Ek5BBzyOnJ+d1W1Kdu6a/84NoSnTHy+P9SROnmC0biCcXs48mAxFqYzBISWzH1LwSCaOYnJ1r/Q/gLy3L+UXLB+o+hEsJ/CvEGdL/huE0Z481sQDQnUIlWd5+txUz8/bdaVg2hOR3EMYfFkGc/2tDJoCZya1LTeQM+C4bKoSbc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614778539; 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=J6IX6xypEcDBQ6DhNzmjuHKZPkbh9ZZSqy4zxyb5CKQ=; b=RGh+0K0pOUj1DZ87B0cTIhWlgO8CAU3EUa/wtQqmDnKk4CPpZyp7VicvG/5PQLvCuxKOmAsP+VbjoB8nRO4uJbJWOws5AVrIiZcGn41iaoBxqyTmdDwt3Qbp39h8saCMIOqqYdR5a+UTZ4O0o6Vhwg4omhENkYsnhbODSKYNFOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614778539812513.2206462026295; Wed, 3 Mar 2021 05:35:39 -0800 (PST) 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-368-JVG7IFolM6uDNEP6uZAZgQ-1; Wed, 03 Mar 2021 08:35:36 -0500 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 9B9AC1020C26; Wed, 3 Mar 2021 13:35:30 +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 76EED6062F; Wed, 3 Mar 2021 13:35: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 32F919985; Wed, 3 Mar 2021 13:35:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123DZTQR026471 for ; Wed, 3 Mar 2021 08:35:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3FA9C10023B0; Wed, 3 Mar 2021 13:35:29 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id B150D100239A for ; Wed, 3 Mar 2021 13:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614778538; 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=J6IX6xypEcDBQ6DhNzmjuHKZPkbh9ZZSqy4zxyb5CKQ=; b=EFm9gxXyzADWxqi2W12d7R9H6wOpP5BM9c07S5af7Rs+BZKgsJmF6VnR1F+FhaBUGdnUvN 2PwxtmbCbICtQRyj8kfc804EZh5bkQjFNbu5U+hKs0aCWpsqljNSd0IoEkWtwcpEflXmRX gHIijKnEwKnrACI5zl8BbNgrijgM8Ak= X-MC-Unique: JVG7IFolM6uDNEP6uZAZgQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] vircgroup: drop unused function virCgroupSetupCpuShares Date: Wed, 3 Mar 2021 14:35:22 +0100 Message-Id: <268b7889801d6f17238575a53f10581d5559cf36.1614778388.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previous commit removed all usage of this function so we can remove it. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 1 - src/util/vircgroup.c | 20 -------------------- src/util/vircgroup.h | 2 -- 3 files changed, 23 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2a3bbdc577..3e7de7744e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1934,7 +1934,6 @@ virCgroupSetupBlkioDeviceWriteBps; virCgroupSetupBlkioDeviceWriteIops; virCgroupSetupCpuPeriodQuota; virCgroupSetupCpusetCpus; -virCgroupSetupCpuShares; virCgroupSupportsCpuBW; virCgroupTerminateMachine; =20 diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index abc06b8cb0..5b6097c335 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3899,26 +3899,6 @@ virCgroupSetupCpusetCpus(virCgroupPtr cgroup, virBit= mapPtr cpumask) } =20 =20 -/* Per commit 97814d8ab3, the Linux kernel can consider a 'shares' - * value of '0' and '1' as 2, and any value larger than a maximum - * is reduced to maximum. - * - * The 'realValue' pointer holds the actual 'shares' value set by - * the kernel if the function returned success. */ -int -virCgroupSetupCpuShares(virCgroupPtr cgroup, unsigned long long shares, - unsigned long long *realValue) -{ - if (virCgroupSetCpuShares(cgroup, shares) < 0) - return -1; - - if (virCgroupGetCpuShares(cgroup, realValue) < 0) - return -1; - - return 0; -} - - int virCgroupSetupCpuPeriodQuota(virCgroupPtr cgroup, unsigned long long period, diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index 7d9172d664..4e6911f34c 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -227,8 +227,6 @@ virCgroupGetDomainTotalCpuStats(virCgroupPtr group, =20 int virCgroupSetCpuShares(virCgroupPtr group, unsigned long long shares); int virCgroupGetCpuShares(virCgroupPtr group, unsigned long long *shares); -int virCgroupSetupCpuShares(virCgroupPtr cgroup, unsigned long long shares, - unsigned long long *realValue); =20 #define VIR_CGROUP_CPU_SHARES_MIN 2LL #define VIR_CGROUP_CPU_SHARES_MAX 262144LL --=20 2.29.2