From nobody Thu May 15 01:39:10 2025 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 1515757110445401.1521922468861; Fri, 12 Jan 2018 03:38:30 -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 851D6C054C5F; Fri, 12 Jan 2018 11:38:28 +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 81EF475554; Fri, 12 Jan 2018 11:38:25 +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 824BB4ED38; Fri, 12 Jan 2018 11:38:24 +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 w0CBcNuI018439 for ; Fri, 12 Jan 2018 06:38:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0A8D75D6A6; Fri, 12 Jan 2018 11:38:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 037FB5D6A3 for ; Fri, 12 Jan 2018 11:38:20 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBE6518C368 for ; Fri, 12 Jan 2018 11:38:13 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0CBYu1p022106 for ; Fri, 12 Jan 2018 06:38:13 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fesdqfcy2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 12 Jan 2018 06:38:13 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jan 2018 11:38:10 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Jan 2018 11:38:09 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0CBc8Gm35782892; Fri, 12 Jan 2018 11:38:08 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B9A6AE055; Fri, 12 Jan 2018 11:30:05 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E0E6FAE051; Fri, 12 Jan 2018 11:30:04 +0000 (GMT) Received: from s38lp19.boeblingen.de.ibm.com (unknown [9.152.161.19]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jan 2018 11:30:04 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Fri, 12 Jan 2018 12:38:01 +0100 In-Reply-To: <20180112113802.220469-1-bwalk@linux.vnet.ibm.com> References: <20180112113802.220469-1-bwalk@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18011211-0020-0000-0000-000003E9E62E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011211-0021-0000-0000-0000427C116D Message-Id: <20180112113802.220469-2-bwalk@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-12_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801120156 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 12 Jan 2018 11:38:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 12 Jan 2018 11:38:19 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v2 1/2] util: virsysinfo: parse frequency information on S390 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.32]); Fri, 12 Jan 2018 11:38:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let's also parse the available processor frequency information on S390 so that it can be utilized by virsh sysinfo: # virsh sysinfo ... 2964 IBM/S390 00 5000 145F07 ... Reviewed-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- src/util/virsysinfo.c | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index ab81b1f7..dc309a7c 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -34,6 +34,7 @@ #include "virsysinfo.h" #include "viralloc.h" #include "vircommand.h" +#include "virlog.h" #include "virfile.h" #include "virstring.h" =20 @@ -42,6 +43,7 @@ =20 #define VIR_FROM_THIS VIR_FROM_SYSINFO =20 +VIR_LOG_INIT("util.sysinfo"); =20 VIR_ENUM_IMPL(virSysinfo, VIR_SYSINFO_LAST, "smbios"); @@ -495,11 +497,12 @@ virSysinfoParseS390Processor(const char *base, virSys= infoDefPtr ret) char *tmp_base; char *manufacturer =3D NULL; char *procline =3D NULL; + char *ncpu =3D NULL; int result =3D -1; virSysinfoProcessorDefPtr processor; =20 if (!(tmp_base =3D virSysinfoParseS390Line(base, "vendor_id", &manufac= turer))) - goto cleanup; + goto error; =20 /* Find processor N: line and gather the processor manufacturer, version, serial number, and family */ @@ -507,10 +510,10 @@ virSysinfoParseS390Processor(const char *base, virSys= infoDefPtr ret) && (tmp_base =3D virSysinfoParseS390Line(tmp_base, "processor ", &procline))) { if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) - goto cleanup; + goto error; processor =3D &ret->processor[ret->nprocessor - 1]; if (VIR_STRDUP(processor->processor_manufacturer, manufacturer) < = 0) - goto cleanup; + goto error; if (!virSysinfoParseS390Delimited(procline, "version", &processor->processor_version, '=3D', ',') || @@ -520,15 +523,43 @@ virSysinfoParseS390Processor(const char *base, virSys= infoDefPtr ret) !virSysinfoParseS390Delimited(procline, "machine", &processor->processor_family, '=3D', '\n')) - goto cleanup; + goto error; =20 VIR_FREE(procline); } - result =3D 0; + + /* now, for each processor found, extract the frequency information */ + tmp_base =3D (char *) base; + + while ((tmp_base =3D strstr(tmp_base, "cpu number")) && + (tmp_base =3D virSysinfoParseS390Line(tmp_base, "cpu number", &= ncpu))) { + unsigned int n; + char *mhz =3D NULL; + + if (virStrToLong_uip(ncpu, NULL, 10, &n) < 0) + goto error; + + if (n >=3D ret->nprocessor) { + VIR_DEBUG("CPU number '%d' out of range", n); + goto cleanup; + } + + if (!(tmp_base =3D strstr(tmp_base, "cpu MHz static")) || + !virSysinfoParseS390Line(tmp_base, "cpu MHz static", &mhz)) + goto cleanup; + + ret->processor[n].processor_max_speed =3D mhz; + + VIR_FREE(ncpu); + } =20 cleanup: + result =3D 0; + + error: VIR_FREE(manufacturer); VIR_FREE(procline); + VIR_FREE(ncpu); return result; } =20 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list