From nobody Thu May 15 02:01:35 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 1513678169829342.14951463406294; Tue, 19 Dec 2017 02:09:29 -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 D79DB80462; Tue, 19 Dec 2017 10:09:27 +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 B393860BF3; Tue, 19 Dec 2017 10:09:27 +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 7C47A180121A; Tue, 19 Dec 2017 10:09:27 +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 vBJA8Oe8029151 for ; Tue, 19 Dec 2017 05:08:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id F39681853C; Tue, 19 Dec 2017 10:08:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC57C18537 for ; Tue, 19 Dec 2017 10:08:21 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 AB5667E425 for ; Tue, 19 Dec 2017 10:08:20 +0000 (UTC) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBJA895g031985 for ; Tue, 19 Dec 2017 05:08:20 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ey02pj0s2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Dec 2017 05:08:18 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 19 Dec 2017 10:08:11 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 19 Dec 2017 10:08:09 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vBJA88H947710286; Tue, 19 Dec 2017 10:08:08 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 482BF5204E; Tue, 19 Dec 2017 09:01:08 +0000 (GMT) Received: from s38lp19.boeblingen.de.ibm.com (unknown [9.152.161.19]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1DC6E5204C; Tue, 19 Dec 2017 09:01:08 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Tue, 19 Dec 2017 11:08:02 +0100 In-Reply-To: <20171219100802.254672-1-bwalk@linux.vnet.ibm.com> References: <20171219100802.254672-1-bwalk@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17121910-0016-0000-0000-0000050EAFB2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121910-0017-0000-0000-0000284AD6C5 Message-Id: <20171219100802.254672-4-bwalk@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-19_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-1712190147 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.27]); Tue, 19 Dec 2017 10:08:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 19 Dec 2017 10:08:20 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-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.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH 3/3] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 19 Dec 2017 10:09:28 +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 5000 145F07 ... Reviewed-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- src/util/virsysinfo.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index ab81b1f7..0c2267e3 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -495,6 +495,7 @@ virSysinfoParseS390Processor(const char *base, virSysin= foDefPtr ret) char *tmp_base; char *manufacturer =3D NULL; char *procline =3D NULL; + char *ncpu =3D NULL; int result =3D -1; virSysinfoProcessorDefPtr processor; =20 @@ -524,11 +525,41 @@ virSysinfoParseS390Processor(const char *base, virSys= infoDefPtr ret) =20 VIR_FREE(procline); } + + /* 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_ui(ncpu, NULL, 10, &n) < 0 || n >=3D ret->nproces= sor) + goto cleanup; + + if (!(tmp_base =3D strstr(tmp_base, "cpu MHz dynamic")) || + !virSysinfoParseS390Line(tmp_base, "cpu MHz dynamic", &mhz) || + !mhz) + goto cleanup; + + ret->processor[n].processor_external_clock =3D mhz; + + if (!(tmp_base =3D strstr(tmp_base, "cpu MHz static")) || + !virSysinfoParseS390Line(tmp_base, "cpu MHz static", &mhz) || + !mhz) + goto cleanup; + + ret->processor[n].processor_max_speed =3D mhz; + + VIR_FREE(ncpu); + } + result =3D 0; =20 cleanup: 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