From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517239934758670.4521907838512; Mon, 29 Jan 2018 07:32:14 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 0C2F4C036758; Mon, 29 Jan 2018 15:32: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 D48FF18986; Mon, 29 Jan 2018 15:32:09 +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 8C0334EBDC; Mon, 29 Jan 2018 15:32:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TFVsth032579 for ; Mon, 29 Jan 2018 10:31:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33B6418986; Mon, 29 Jan 2018 15:31:54 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0593018A2A for ; Mon, 29 Jan 2018 15:31:50 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id AF57A120470 for ; Mon, 29 Jan 2018 16:31:49 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 16:31:41 +0100 Message-Id: <1ecd912ba4724e4566cb6990a92d58ea5b58a32d.1517239847.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] util: Check for empty allocation instead of just NULL pointer 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 29 Jan 2018 15:32:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When working on the CAT series one of the changes was that the pointer got allocated in another part of the code, even when resctrl was not available = on the host system. However this one particular place neglected that so it ne= eds to be fixed in order to get the proper error message when requesting on HW with no support for it. Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 754820ee463e..03218a481dc0 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -1472,7 +1472,7 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl, if (!alloc) return 0; =20 - if (!resctrl) { + if (virResctrlInfoIsEmpty(resctrl)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Resource control is not supported on this host")= ); return -1; --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517239936234385.02026178683036; Mon, 29 Jan 2018 07:32:16 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id EBAE35B2F8; Mon, 29 Jan 2018 15:32:13 +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 B35F117DD4; Mon, 29 Jan 2018 15:32:13 +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 520EF18033DA; Mon, 29 Jan 2018 15:32:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TFVuk4032594 for ; Mon, 29 Jan 2018 10:31:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 548EC17DD4; Mon, 29 Jan 2018 15:31:56 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24F801825C for ; Mon, 29 Jan 2018 15:31:51 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id BA5C6120479 for ; Mon, 29 Jan 2018 16:31:49 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 16:31:42 +0100 Message-Id: <431e874f84765ae9e73a8d51fb7d240c4850ebef.1517239847.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] util: Use "resctrl" instead of "resctrlfs" spelling 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 29 Jan 2018 15:32:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Pointed out during review on one or two places, but it actually appears in = lot more places. So let's be consistent. Signed-off-by: Martin Kletzander --- src/qemu/qemu_process.c | 2 +- src/util/virresctrl.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 3a697de037e1..0577f4c35d08 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5936,7 +5936,7 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuProcessSetupEmulator(vm) < 0) goto cleanup; =20 - VIR_DEBUG("Setting up resctrlfs"); + VIR_DEBUG("Setting up resctrl"); if (qemuProcessResctrlCreate(driver, vm) < 0) goto cleanup; =20 diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 03218a481dc0..a1d09c547e45 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -76,7 +76,7 @@ struct _virResctrlInfoPerType { unsigned int max_cache_id; =20 /* In order to be self-sufficient we need size information per cache. - * Funnily enough, one of the outcomes of the resctrlfs design is that= it + * Funnily enough, one of the outcomes of the resctrl design is that it * does not account for different sizes per cache on the same level. = So * for the sake of easiness, let's copy that, for now. */ unsigned long long size; @@ -302,12 +302,12 @@ virResctrlLockInternal(int op) int fd =3D open(SYSFS_RESCTRL_PATH, O_DIRECTORY | O_CLOEXEC); =20 if (fd < 0) { - virReportSystemError(errno, "%s", _("Cannot open resctrlfs")); + virReportSystemError(errno, "%s", _("Cannot open resctrl")); return -1; } =20 if (flock(fd, op) < 0) { - virReportSystemError(errno, "%s", _("Cannot lock resctrlfs")); + virReportSystemError(errno, "%s", _("Cannot lock resctrl")); VIR_FORCE_CLOSE(fd); return -1; } @@ -328,7 +328,7 @@ static inline int virResctrlLockWrite(void) { virReportSystemError(ENOSYS, "%s", - _("resctrlfs not supported on this platform")); + _("resctrl not supported on this platform")); return -1; } =20 @@ -347,11 +347,11 @@ virResctrlUnlock(int fd) /* The lock gets unlocked by closing the fd, which we need to do anywa= y in * order to clean up properly */ if (VIR_CLOSE(fd) < 0) { - virReportSystemError(errno, "%s", _("Cannot close resctrlfs")); + virReportSystemError(errno, "%s", _("Cannot close resctrl")); =20 /* Trying to save the already broken */ if (flock(fd, LOCK_UN) < 0) - virReportSystemError(errno, "%s", _("Cannot unlock resctrlfs")= ); + virReportSystemError(errno, "%s", _("Cannot unlock resctrl")); return -1; } #endif /* ! __linux__ */ @@ -486,7 +486,7 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) =20 if (i_level->types[type]) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Duplicate cache type in resctrlfs for level = %u"), + _("Duplicate cache type in resctrl for level %u= "), level); goto cleanup; } --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517239938735192.22637118450928; Mon, 29 Jan 2018 07:32:18 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 381BE356F2; Mon, 29 Jan 2018 15:32:17 +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 0E51C60499; Mon, 29 Jan 2018 15:32:17 +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 9462018033DE; Mon, 29 Jan 2018 15:32:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TFVuPS032595 for ; Mon, 29 Jan 2018 10:31:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 57E0C17F38; Mon, 29 Jan 2018 15:31:56 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23C016FDD2 for ; Mon, 29 Jan 2018 15:31:51 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id C5C5B120480 for ; Mon, 29 Jan 2018 16:31:49 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 16:31:43 +0100 Message-Id: <47d37b4b93be754a90bc2eb33fcfff2ed171f7c2.1517239847.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] util: Make it possible for virResctrlAllocSetMask to replace existing mask 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 29 Jan 2018 15:32:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This wil be used in the future, but it makes sense for now as well. It mak= es sure there is no mask leftover that would leak. Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index a1d09c547e45..89b1382b6857 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -1239,6 +1239,7 @@ virResctrlAllocSetMask(virResctrlAllocPerTypePtr a_ty= pe, cache - a_type->nmasks + 1) < 0) return -1; =20 + virBitmapFree(a_type->masks[cache]); a_type->masks[cache] =3D mask; =20 return 0; --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517239942439196.96943208133837; Mon, 29 Jan 2018 07:32:22 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDCB666237; Mon, 29 Jan 2018 15:32:20 +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 AF72C18145; Mon, 29 Jan 2018 15:32:20 +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 46FBD18033DE; Mon, 29 Jan 2018 15:32:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TFVuHR032596 for ; Mon, 29 Jan 2018 10:31:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5A86617DD8; Mon, 29 Jan 2018 15:31:56 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 253D218246 for ; Mon, 29 Jan 2018 15:31:51 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id D10A2120487 for ; Mon, 29 Jan 2018 16:31:49 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 16:31:44 +0100 Message-Id: <6847e0d7d1ebe29c47b71dfd376cb6746969a77c.1517239847.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] util: Remove unused variable in virResctrlGetInfo 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 29 Jan 2018 15:32:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 89b1382b6857..684cb22fd8a2 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -392,7 +392,6 @@ int virResctrlGetInfo(virResctrlInfoPtr resctrl) { DIR *dirp =3D NULL; - char *info_path =3D NULL; char *endptr =3D NULL; char *tmp_str =3D NULL; int ret =3D -1; @@ -507,7 +506,6 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) ret =3D 0; cleanup: VIR_DIR_CLOSE(dirp); - VIR_FREE(info_path); if (i_type) VIR_FREE(i_type->cbm_mask); VIR_FREE(i_type); --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517240280353869.2709367061572; Mon, 29 Jan 2018 07:38:00 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id F3F1DC049D43; Mon, 29 Jan 2018 15:37:58 +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 64DC26E401; Mon, 29 Jan 2018 15:37:58 +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 7F66D18033DA; Mon, 29 Jan 2018 15:37:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TFbuwd001364 for ; Mon, 29 Jan 2018 10:37:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id A88455DD69; Mon, 29 Jan 2018 15:37:56 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7BAEB51292 for ; Mon, 29 Jan 2018 15:37:54 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id BEDE91200FE for ; Mon, 29 Jan 2018 16:37:52 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 16:37:41 +0100 Message-Id: <179f3bd95385a5ca2287dba2de1e707d86609ddf.1517240010.git.mkletzan@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4.5/4 variant 1] util: Don't check if entries under /sys/fs/resctrl/info/ are directories 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 29 Jan 2018 15:37:59 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We are skipping non-directories under /sys/fs/resctrl/info/ since those are= not interesting for us. However in tests it can sometimes happen that ent->d_t= ype is 0 instead of 4 (DT_DIR) for directories. I've seen it fail on two machines. Different machines, different systems, I cannot reproduce it even using the same setup. So one of the ways how to w= ork around this is call stat() on it. The other one is not checking if it is a directory since we'll find out eventually when we want to read some files underneath it. Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 684cb22fd8a2..0e09c67802a6 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -410,10 +410,6 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) =20 while ((rv =3D virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0= ) { VIR_DEBUG("Parsing info type '%s'", ent->d_name); - - if (ent->d_type !=3D DT_DIR) - continue; - if (ent->d_name[0] !=3D 'L') continue; =20 @@ -436,19 +432,28 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) rv =3D virFileReadValueUint(&i_type->control.max_allocation, SYSFS_RESCTRL_PATH "/info/%s/num_closids= ", ent->d_name); - if (rv =3D=3D -2) - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get num_closids from resctrl cache in= fo")); - if (rv < 0) + if (rv =3D=3D -2) { + /* The file doesn't exist, so it's unusable for us, + * but we can scan further */ + VIR_WARN("The path '" SYSFS_RESCTRL_PATH "/info/%s/num_closids= ' " + "does not exist", + ent->d_name); + } else if (rv < 0) { + /* Other failures are fatal, so just quit */ goto cleanup; + } =20 rv =3D virFileReadValueString(&i_type->cbm_mask, SYSFS_RESCTRL_PATH "/info/%s/cbm_mask", ent->d_name); - if (rv =3D=3D -2) + if (rv =3D=3D -2) { + /* If the previous file exists, so should this one. Hence -2 = is + * fatal in this case as well - the kernel interface might've + * changed too much or something else is wrong. */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot get cbm_mask from resctrl cache info"= )); + } if (rv < 0) goto cleanup; =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517240287441612.7305732249208; Mon, 29 Jan 2018 07:38:07 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 8DF65356F4; Mon, 29 Jan 2018 15:38:05 +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 180FE605E2; Mon, 29 Jan 2018 15:38:05 +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 D31FF18033DE; Mon, 29 Jan 2018 15:38:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TFc3RK001379 for ; Mon, 29 Jan 2018 10:38:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 50E8361F24; Mon, 29 Jan 2018 15:38:03 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2403F61F31 for ; Mon, 29 Jan 2018 15:38:00 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id ED75D1200FE for ; Mon, 29 Jan 2018 16:37:58 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 16:37:57 +0100 Message-Id: <024a75c710d412d1a32e42782b69239f9c7c6d30.1517240003.git.mkletzan@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4.5/4 variant 2] util: Use stat() on files under /sys/fs/resctrl/info 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 29 Jan 2018 15:38:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We are skipping non-directories under /sys/fs/resctrl/info/ since those are= not interesting for us. However in tests it can sometimes happen that ent->d_t= ype is 0 instead of 4 (DT_DIR) for directories. I've seen it fail on two machines. Different machines, different systems, I cannot reproduce it even using the same setup. So one of the ways how to w= ork around this is call stat() on it. Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 684cb22fd8a2..12dda76f9d33 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -409,11 +409,32 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) } while ((rv =3D virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0= ) { + struct stat st; + char *path =3D NULL; + VIR_DEBUG("Parsing info type '%s'", ent->d_name); + if (virAsprintf(&path, SYSFS_RESCTRL_PATH "/info/%s", ent->d_name)= < 0) + continue; + + if (stat(path, &st) < 0) { + virReportSystemError(errno, _("Cannot stat '%s'"), path); + VIR_FREE(path); + continue; + } + VIR_FREE(path); + + /* + * So this doesn't work on some machines when we're mocking syscal= ls in tests + if (ent->d_type !=3D DT_DIR) continue; + But the following does, for some reason. + */ + if ((st.st_mode & S_IFMT) !=3D S_IFDIR) + continue; + if (ent->d_name[0] !=3D 'L') continue; -- 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517244356720118.11392919290859; Mon, 29 Jan 2018 08:45:56 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 195003B3C0; Mon, 29 Jan 2018 16:45:55 +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 E19D86EE4B; Mon, 29 Jan 2018 16:45:54 +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 A53DB4EBD8; Mon, 29 Jan 2018 16:45:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TGjrFs014717 for ; Mon, 29 Jan 2018 11:45:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 475DF18AB0; Mon, 29 Jan 2018 16:45:53 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C58318AC8 for ; Mon, 29 Jan 2018 16:45:47 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id 017691200FE for ; Mon, 29 Jan 2018 17:45:46 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 17:45:44 +0100 Message-Id: <048e145980460225911fb492a307acb8cb760480.1517244312.git.mkletzan@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4.5/4 variant 1] util: Don't check if entries under /sys/fs/resctrl/info/ are directories 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 29 Jan 2018 16:45:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We are skipping non-directories under /sys/fs/resctrl/(info/) since those a= re not interesting for us. However in tests it can sometimes happen that ent->d_t= ype is 0 instead of 4 (DT_DIR) for directories. I've seen it fail on two machines. Different machines, different systems, I cannot reproduce it even using the same setup. So one of the ways how to w= ork around this is call stat() on it. The other one is not checking if it is a directory since we'll find out eventually when we want to read some files underneath it. Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 684cb22fd8a2..ad4294c26b1e 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -410,10 +410,6 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) =20 while ((rv =3D virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0= ) { VIR_DEBUG("Parsing info type '%s'", ent->d_name); - - if (ent->d_type !=3D DT_DIR) - continue; - if (ent->d_name[0] !=3D 'L') continue; =20 @@ -436,19 +432,28 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) rv =3D virFileReadValueUint(&i_type->control.max_allocation, SYSFS_RESCTRL_PATH "/info/%s/num_closids= ", ent->d_name); - if (rv =3D=3D -2) - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get num_closids from resctrl cache in= fo")); - if (rv < 0) + if (rv =3D=3D -2) { + /* The file doesn't exist, so it's unusable for us, + * but we can scan further */ + VIR_WARN("The path '" SYSFS_RESCTRL_PATH "/info/%s/num_closids= ' " + "does not exist", + ent->d_name); + } else if (rv < 0) { + /* Other failures are fatal, so just quit */ goto cleanup; + } =20 rv =3D virFileReadValueString(&i_type->cbm_mask, SYSFS_RESCTRL_PATH "/info/%s/cbm_mask", ent->d_name); - if (rv =3D=3D -2) + if (rv =3D=3D -2) { + /* If the previous file exists, so should this one. Hence -2 = is + * fatal in this case as well - the kernel interface might've + * changed too much or something else is wrong. */ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot get cbm_mask from resctrl cache info"= )); + } if (rv < 0) goto cleanup; =20 @@ -1169,9 +1174,6 @@ virResctrlAllocGetUnused(virResctrlInfoPtr resctrl) goto error; =20 while ((rv =3D virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH)) > 0) { - if (ent->d_type !=3D DT_DIR) - continue; - if (STREQ(ent->d_name, "info")) continue; =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 06:54:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517244333543330.79949813244457; Mon, 29 Jan 2018 08:45:33 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id DFC023E50B; Mon, 29 Jan 2018 16:45:31 +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 1CA911825C; Mon, 29 Jan 2018 16:45:31 +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 B865518033DD; Mon, 29 Jan 2018 16:45:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0TGjRI8014670 for ; Mon, 29 Jan 2018 11:45:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5D6A878E84; Mon, 29 Jan 2018 16:45:27 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 316E178E9C for ; Mon, 29 Jan 2018 16:45:05 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id 2C17E1200FE for ; Mon, 29 Jan 2018 17:45:04 +0100 (CET) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 29 Jan 2018 17:45:01 +0100 Message-Id: <51b20206e8bea823e0b206d3458c5d40dad1025b.1517244250.git.mkletzan@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4.5/4 variant 2] util: Use stat() on files under /sys/fs/resctrl/info 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 29 Jan 2018 16:45:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We are skipping non-directories under /sys/fs/resctrl/(info/) since those a= re not interesting for us. However in tests it can sometimes happen that ent->d_t= ype is 0 instead of 4 (DT_DIR) for directories. I've seen it fail on two machines. Different machines, different systems, I cannot reproduce it even using the same setup. So one of the ways how to w= ork around this is call stat() on it. Signed-off-by: Martin Kletzander --- src/util/virresctrl.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++= +- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 684cb22fd8a2..2c1d07ff3a25 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -409,9 +409,30 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl) } =20 while ((rv =3D virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0= ) { + struct stat st; + char *path =3D NULL; + VIR_DEBUG("Parsing info type '%s'", ent->d_name); =20 - if (ent->d_type !=3D DT_DIR) + if (virAsprintf(&path, SYSFS_RESCTRL_PATH "/info/%s", ent->d_name)= < 0) + continue; + + if (stat(path, &st) < 0) { + virReportSystemError(errno, _("Cannot stat '%s'"), path); + VIR_FREE(path); + continue; + } + VIR_FREE(path); + + /* + * So this doesn't work on some machines when we're mocking syscal= ls in tests + * + * if (ent->d_type !=3D DT_DIR) + * continue; + * + * But the following does, for some reason. + */ + if ((st.st_mode & S_IFMT) !=3D S_IFDIR) continue; =20 if (ent->d_name[0] !=3D 'L') @@ -1169,6 +1190,32 @@ virResctrlAllocGetUnused(virResctrlInfoPtr resctrl) goto error; =20 while ((rv =3D virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH)) > 0) { + struct stat st; + char *path =3D NULL; + + VIR_DEBUG("Parsing info type '%s'", ent->d_name); + + if (virAsprintf(&path, SYSFS_RESCTRL_PATH "/%s", ent->d_name) < 0) + continue; + + if (stat(path, &st) < 0) { + virReportSystemError(errno, _("Cannot stat '%s'"), path); + VIR_FREE(path); + continue; + } + VIR_FREE(path); + + /* + * So this doesn't work on some machines when we're mocking syscal= ls in tests + * + * if (ent->d_type !=3D DT_DIR) + * continue; + * + * But the following does, for some reason. + */ + if ((st.st_mode & S_IFMT) !=3D S_IFDIR) + continue; + if (ent->d_type !=3D DT_DIR) continue; =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list