From nobody Wed May 15 10:47:49 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=1608049563; cv=none; d=zohomail.com; s=zohoarc; b=KD5OWwUNLBhkfzM0/JPFAjbHe4jS1YpaHDamhyUpAQn/bs8kZW6isvLHUXzEowCZZnsZx/HYGMEaSO1PPHp00+LFCIPl3xUpZrTOO3bMJiwdUirNQrkgSHr8LUZWvTOeT58Ms2jNbbIVvsYWMUDSDuAy4RwZcvlr7i/n151ZNuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049563; h=Content-Type:Content-Transfer-Encoding:Cc: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=uCnSSabIGbh4u6DZ4e2G95Un4ld+cmCONp87epC0j+I=; b=DPrEN3WWa5UmxJdyeZTlNg0Grr3S+tgUCZrS44NpBjz+FX2wYtEZ1bV0wgHpFv99v1eFnkRjsrhH3M3O1tOalH28QFOnSjlwpVh5TD9GaP8RDpnxlT7Jc6P49UnZ4EdOSArS+xBMZdN2oeMFsE3YV+2eBsEXRpIww8A0CuLHK4s= 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 1608049563186757.5921174940391; Tue, 15 Dec 2020 08:26:03 -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-355-hA6kEA8eMCeKZDo_NhmMgA-1; Tue, 15 Dec 2020 11:25:57 -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 874CABBEE2; Tue, 15 Dec 2020 16:25:41 +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 6568713470; Tue, 15 Dec 2020 16:25:41 +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 2F6DE4E590; Tue, 15 Dec 2020 16:25:41 +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 0BFGPIjo025574 for ; Tue, 15 Dec 2020 11:25:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id F32CA5D9E4; Tue, 15 Dec 2020 16:25:17 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38A7A5D9D7; Tue, 15 Dec 2020 16:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049560; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=uCnSSabIGbh4u6DZ4e2G95Un4ld+cmCONp87epC0j+I=; b=L+M9uSR7dyqaTATGQ84c9x6EfWCqMm0KE+M7VDiXGzMK6141C11ekSuJjvKwULtQpaKhsJ yR+7mt2mzLNBU2RIPKZ+JHX2oSa06XYIIEQlZiaDjUaVe/Soz3MTr4xxn12GFW/Hm7OGAa SX51Fowm8Cy/4TPRMlyk8yvme++B2Hk= X-MC-Unique: hA6kEA8eMCeKZDo_NhmMgA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/29] cpu-cpuid: Shorten overly long line Date: Tue, 15 Dec 2020 17:24:47 +0100 Message-Id: <20201215162515.53742-2-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" flake8 was complaining. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-cpuid.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py index 37d00e3c97..dac43debb6 100755 --- a/tests/cputestdata/cpu-cpuid.py +++ b/tests/cputestdata/cpu-cpuid.py @@ -158,8 +158,9 @@ def parseMap(): cpuMap =3D {} for feature in data["cpus"]["feature"]: for fType in ["cpuid", "msr"]: - if fType in feature: - cpuMap[feature["@name"]] =3D parseMapFeature(fType, featur= e[fType]) + if fType not in feature: + continue + cpuMap[feature["@name"]] =3D parseMapFeature(fType, feature[fT= ype]) =20 return cpuMap =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049867; cv=none; d=zohomail.com; s=zohoarc; b=BwvbJU61boxBp27ajKMRcT3u3K+GDV6IYWbjGqjFn4fYye1EtIcld/5PVgkRRAHjesWsykhQneGBSEf6sTVyl8Y5P8rXshol9CnA3VLaIjgg8F7XL+JwPa4sX9SsWe6egv3R2sa2mk0qKdhu4X8fZvCMyUVsEn+ELPheTc7ll8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049867; h=Content-Type:Content-Transfer-Encoding:Cc: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=NvQWab/KjhQtNXMSUrldyf5YM6qflz4v4VSuPbZwVoI=; b=YjRMsx02ANOdlDpFvDvZn7dYcWEPZ+iGc7iuYjeX82jBvzEkIGTKq5BW5yBC9Rl+VzysDO6fhvZn9zeqEuQZQ1iXh3YnySmP9tjDlyWqtrz5OqfWuxkRRXaf2lEgPkcCX+0kdOL/QsM8qxaJBhbHbdFWz7UrYW6O1RO3PDkRY0M= 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 1608049867812613.8069189622348; Tue, 15 Dec 2020 08:31:07 -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-276-6t2WzhTPO6yCNfNXZydx2g-1; Tue, 15 Dec 2020 11:26:00 -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 90D3D875108; Tue, 15 Dec 2020 16:25:44 +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 22EB5704D9; Tue, 15 Dec 2020 16:25:44 +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 DA2994EE7F; Tue, 15 Dec 2020 16:25:43 +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 0BFGPJfW025584 for ; Tue, 15 Dec 2020 11:25:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 36B305D9E8; Tue, 15 Dec 2020 16:25:19 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B15B5D9D7; Tue, 15 Dec 2020 16:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049564; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=NvQWab/KjhQtNXMSUrldyf5YM6qflz4v4VSuPbZwVoI=; b=g66pLtSBrhGfjPjS2lIosXqmPOEICHbfCMmQc4rWsAOs/3TgeaXKk9f4v3QCmveEYA91UL j2FKEuEhp8bQUOZVUNGIUDTqUPbBpvRr8uJd984vYQ6iQEm3urcECf3M6Kr6OUcqUQHl0u ebdTnSDrjOlFrLTFl6qMRn0bIM/MfwQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049865; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=NvQWab/KjhQtNXMSUrldyf5YM6qflz4v4VSuPbZwVoI=; b=VkoVKqsZObqQNcfUjdlT/VjyPe4pH/Xyk+GFF4vxozKyXvusTwiv831N1HG6nM2FlSuHZr 2k4xoXohW7nhgjbbXVFqeRNCV5+tGDE93YmPetVRlbvn6RmQDGxDXl1impdNJDwSzwAzEW vEhvmZpmuQcZ8BcnpXbtcexdcYVEhfg= X-MC-Unique: 6t2WzhTPO6yCNfNXZydx2g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/29] cpu-gather: Create python wrapper for shell script Date: Tue, 15 Dec 2020 17:24:48 +0100 Message-Id: <20201215162515.53742-3-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This changes the invocation from ./cpu-gather.sh | ./cpu-parse.sh to ./cpu-gather.py | ./cpu-parse.sh Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 13 +++++++++++++ tests/cputestdata/cpu-gather.sh | 5 +++++ 2 files changed, 18 insertions(+) create mode 100755 tests/cputestdata/cpu-gather.py diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py new file mode 100755 index 0000000000..f7030eb48b --- /dev/null +++ b/tests/cputestdata/cpu-gather.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import os +import subprocess + + +def main(): + os.environ["CPU_GATHER_PY"] =3D "true" + subprocess.check_call("./cpu-gather.sh") + + +if __name__ =3D=3D "__main__": + main() diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index 7574324d1c..cd65d74da5 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -4,6 +4,11 @@ # distro does not provide such package, you can find the sources or binary # packages at https://www.etallen.com/cpuid.html =20 +if [ -z "${CPU_GATHER_PY}" ]; then + echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instea= d." + exit 1 +fi + grep 'model name' /proc/cpuinfo | head -n1 =20 cpuid -1r --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050145; cv=none; d=zohomail.com; s=zohoarc; b=ZsoDTdgbSfIydNGu+Bp1lpYu72NC6aUULXd2GBo4TdEUxG0MHc/H1mCMTRqtaXXOEWiAULv8ttESa70583pyX1C32hwO+tJRXOwnz6eJz+JF15HjFrcVsvzxjg8OOFl/9F55zj2jH9NtxqnUv9PCfBrYUI4d6NdH5I6/s/rdMIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050145; h=Content-Type:Content-Transfer-Encoding:Cc: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=Eu0mphIcxg9V4oM8tn/s5MdNs8AQ5eU8jIvkeN0wIvg=; b=bJZ3gSpurCZm7bVQzFl5Qes4dpd5yqdt3tNJMRkRjMFYorwlIUjJaMy5Ct+TOdo2+uq0cemdRqy9imPWiNdQo+AmDHE8azgz8mh6cifVUymFgwJymW8/LhLXirZRT9Z5xCd/grxqMhsGiNwXVuHNfAT1XWBP8Sqecj8qAx9ZwLs= 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 1608050144761713.3588711191153; Tue, 15 Dec 2020 08:35:44 -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-548-z8VFomOBMbK8VdPa-swdJg-1; Tue, 15 Dec 2020 11:31:37 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83B6A107ACE4; Tue, 15 Dec 2020 16:31:30 +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 26ED36087C; Tue, 15 Dec 2020 16:31: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 172A41809C9F; Tue, 15 Dec 2020 16:31: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 0BFGPKDs025598 for ; Tue, 15 Dec 2020 11:25:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 585C75D9E3; Tue, 15 Dec 2020 16:25:20 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90DAC5D9D7; Tue, 15 Dec 2020 16:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049899; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Eu0mphIcxg9V4oM8tn/s5MdNs8AQ5eU8jIvkeN0wIvg=; b=Pdh9ezP2IMUXb01oqwFtwQVA25NdhC92/OmjZrJZEshlRpkC7dGQjkbwLU2YPF1SV2OaJt EbITjjfKr/oj8/b80R1l8L2tXmNVVpn9sXPit3GHuAOp6MJQOHkvProCD9eoJjUVFfanjU +7V9Yd+vXzq0zqKuMjWJBTNW/uLEYMQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050140; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Eu0mphIcxg9V4oM8tn/s5MdNs8AQ5eU8jIvkeN0wIvg=; b=EuZniX3GdNKNCXmVgatqM9TlrB73TelxmNxvnjp9ns+bL4bPau2kRPhu+q6iO38mW6JKk/ ec3W9eoc/8Ts2mVjg9GCUQKDpkeVmWFhPbQMQIfiYAyMtcNmE+4rRjGboW2loDImVwq8rL RIl3TTBSfxvqBU0k86wlA0JzVyQAE2o= X-MC-Unique: z8VFomOBMbK8VdPa-swdJg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/29] cpu-gather: Move model_name to new script Date: Tue, 15 Dec 2020 17:24:49 +0100 Message-Id: <20201215162515.53742-4-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.13 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 13 +++++++++++++ tests/cputestdata/cpu-gather.sh | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index f7030eb48b..1b02df6ec7 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -4,7 +4,20 @@ import os import subprocess =20 =20 +def gather_name(): + with open("/proc/cpuinfo", "rt") as f: + for line in f.readlines(): + if line.startswith("model name"): + return line.split(":", 2)[1].strip() + + exit("Error: '/proc/cpuinfo' does not contain a model name.") + + def main(): + name =3D gather_name() + print("model name\t: {}".format(name)) + + print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" subprocess.check_call("./cpu-gather.sh") =20 diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index cd65d74da5..b671f223a5 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -9,8 +9,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then exit 1 fi =20 -grep 'model name' /proc/cpuinfo | head -n1 - cpuid -1r echo =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049905; cv=none; d=zohomail.com; s=zohoarc; b=UkkDvMCRbckiq/oyNT4Go2kmlsRs6JPNnMgdNY27niZs2q4yAERYLkqrl/BNSOAdg2zV7ER3OV7sAPBTVpYmoaFKYbjTMygzGqcK5rO/OL0a4NboAMP3nKn6S3Ke/szFvSdiPJd4CtEhNR4OLp/AeiMRiRIGVHD6WRqfBXLidCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049905; h=Content-Type:Content-Transfer-Encoding:Cc: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=ipFoGqWXvweNCFX5dZcRUxl18INdiWxHcMHmRMWoRnc=; b=ZJVmmXcVrPy7+5HMmPdemAcTiLbcwAIKRM4Vrz3MrK+MqXKvl/2I38DgZ1/iPrUGfT8dXWKRss7Q2j2lUOLsjpGMNWG6QFJxsW3pYWiqENhSXn0h45GZWrf7daw4KCeHNzyelpXzWMak3wjaQ8dTNHRoIuOROI/3hh30Z8vdNBM= 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 1608049905825647.4798315577531; Tue, 15 Dec 2020 08:31:45 -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-246-zsXpNTKFO4iI3hduqoFuiQ-1; Tue, 15 Dec 2020 11:31:40 -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 ADEFC6D532; Tue, 15 Dec 2020 16:31:34 +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 591ED17577; Tue, 15 Dec 2020 16:31:34 +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 085181809CA2; Tue, 15 Dec 2020 16:31:34 +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 0BFGPLen025613 for ; Tue, 15 Dec 2020 11:25:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 71C355D9E8; Tue, 15 Dec 2020 16:25:21 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B32DF5D9D7; Tue, 15 Dec 2020 16:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049903; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=ipFoGqWXvweNCFX5dZcRUxl18INdiWxHcMHmRMWoRnc=; b=bHY+X6spgY8pcWrc+Q/qmS+/YRe6Z4sTT3Gmwfa2Wr7ZwdCmYOzDNjRw1mXgdwixeeIXTX 6e3WMn8MwbEiTZ4LBFpXci20NV36j4vrHislkv2ZubR7ICFs0KprZXCe9lnv6pI0/cpEll CXgMHgk/IEX/yPfr2qV1HlydQcUNMyM= X-MC-Unique: zsXpNTKFO4iI3hduqoFuiQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/29] cpu-gather: Allow overwriting model name Date: Tue, 15 Dec 2020 17:24:50 +0100 Message-Id: <20201215162515.53742-5-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Some hardware, e.g. exotic platforms or pre-production hardware, may report wrong or random data for the cpu model name. As the name of the created files is derived from that name, this may lead to issues. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 1b02df6ec7..4e8c72e4f4 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -1,20 +1,33 @@ #!/usr/bin/env python3 =20 +import argparse import os import subprocess =20 =20 -def gather_name(): +def gather_name(args): + if args.name: + return args.name + with open("/proc/cpuinfo", "rt") as f: for line in f.readlines(): if line.startswith("model name"): return line.split(":", 2)[1].strip() =20 - exit("Error: '/proc/cpuinfo' does not contain a model name.") + exit("Error: '/proc/cpuinfo' does not contain a model name.\n" + "Use '--model' to set a model name.") =20 =20 def main(): - name =3D gather_name() + parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") + parser.add_argument( + "--name", + help=3D"CPU model name. " + "If unset, model name is read from '/proc/cpuinfo'.") + + args =3D parser.parse_args() + + name =3D gather_name(args) print("model name\t: {}".format(name)) =20 print(end=3D"", flush=3DTrue) --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049871; cv=none; d=zohomail.com; s=zohoarc; b=H0Nz6YlmRVcBb5J0oQYq3/KXCV9s/cPxKsabZvA2rBkY/0wyae0Cwm+RQHmd1+oVHhW5y2SK3jbm8H1yJjb+gdwUoONuEh6n3dVxgyyNrXvyPg82P98b84PyICAcwzfasOXPQrmPz1f64R4+z2Spqy/C1Pj7PIf1RIqIgSCSwac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049871; h=Content-Type:Content-Transfer-Encoding:Cc: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=x4wgoOwTH0slBIc6SiVXq/eondXgdvKYbq/wv3eTIRs=; b=BywPbhintjv8xTxBDxelaDOQE4neXT9x3u9V8qYc3CqvJgRi75OO39RYYCZO1B2bEpWClAuwzGHLj5//xl+GlSn2WgSw7AOT5gw36owz9ZNFknS9qv37jsSjc5ebryyOLoq1jBg5r6pAn3RrnyT5AuYxzAgFlN0ps7PznKwa4i8= 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 1608049871848214.02367267414388; Tue, 15 Dec 2020 08:31:11 -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-18-UQSgChrCNVa87Vvly9jp0g-1; Tue, 15 Dec 2020 11:25:42 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17DF21015CAE; Tue, 15 Dec 2020 16:25:30 +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 E29D737A0; Tue, 15 Dec 2020 16:25:29 +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 A9B01180954D; Tue, 15 Dec 2020 16:25:29 +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 0BFGPMj2025623 for ; Tue, 15 Dec 2020 11:25:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id A23BD5D9E4; Tue, 15 Dec 2020 16:25:22 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC5D35D9D7; Tue, 15 Dec 2020 16:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049624; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=x4wgoOwTH0slBIc6SiVXq/eondXgdvKYbq/wv3eTIRs=; b=O+zPr0EwUqM7q78DnfGrN2IU6XNKFx737cPBH+/rFuobYnBYGFoVpDTDTYC1IkSpmhLq/x oBV1pbi6YJDanG3VBqk7sLECwQ3sSL7aVYerWTlijoAckbLgUhSwxbB5Co0e9ZFbgCgA36 S9Yp/tLlswrc4RG05IQ4XFBDTkgXqz0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049866; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=x4wgoOwTH0slBIc6SiVXq/eondXgdvKYbq/wv3eTIRs=; b=VP9F+9rlwE4rR3qzJ0wl8y6dg51/DohySMotaaOzwxvXNardQ2RAvqUwxarshe9WxmlmZZ hATXl/av5DJuCifOYFV2TU+kf4ENCI08lJtsZOrkLY/rhn7X6ggnZDkwHlNrP7IXq8pzNE DGxd5hZnRe/s7Oh8SC14mXyIoEMG0+Y= X-MC-Unique: UQSgChrCNVa87Vvly9jp0g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/29] cpu-gather: Move cpuid call to new script Date: Tue, 15 Dec 2020 17:24:51 +0100 Message-Id: <20201215162515.53742-6-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.15 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Turn the comment on how to aquire cpuid into a runtime error message. Use "http" instead of "https" in the URL, as the latter is broken. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 25 +++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 7 ------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 4e8c72e4f4..97655399c8 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -18,6 +18,25 @@ def gather_name(args): "Use '--model' to set a model name.") =20 =20 +def gather_cpuid_leaves(): + try: + output =3D subprocess.check_output( + ["cpuid", "-1r"], + universal_newlines=3DTrue) + except FileNotFoundError as e: + exit("Error: '{}' not found.\n'cpuid' can be usually found in a " + "package named identically. If your distro does not provide s= uch " + "package, you can find the sources or binary packages at " + "'http://www.etallen.com/cpuid.html'.".format(e.filename)) + + for line in output.split("\n"): + if not line: + continue + if line =3D=3D "CPU:": + continue + yield line.strip() + + def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") parser.add_argument( @@ -30,6 +49,12 @@ def main(): name =3D gather_name(args) print("model name\t: {}".format(name)) =20 + leaves =3D gather_cpuid_leaves() + print("CPU:") + for leave in leaves: + print(" {}".format(leave)) + print() + print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" subprocess.check_call("./cpu-gather.sh") diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index b671f223a5..f84215e777 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -1,17 +1,10 @@ #!/bin/bash -# -# The cpuid tool can be usually found in a package called "cpuid". If your -# distro does not provide such package, you can find the sources or binary -# packages at https://www.etallen.com/cpuid.html =20 if [ -z "${CPU_GATHER_PY}" ]; then echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instea= d." exit 1 fi =20 -cpuid -1r -echo - python3 < (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 160804955205482.65717937666341; Tue, 15 Dec 2020 08:25:52 -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-343-rJisYbeuN1-7Zi2Pq15xBg-1; Tue, 15 Dec 2020 11:25:44 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B85011012E96; Tue, 15 Dec 2020 16:25:27 +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 EFEE05D9E3; Tue, 15 Dec 2020 16:25:26 +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 155D84BB40; Tue, 15 Dec 2020 16:25:24 +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 0BFGPND4025635 for ; Tue, 15 Dec 2020 11:25:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA16A5D9E3; Tue, 15 Dec 2020 16:25:23 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FD595D9D7; Tue, 15 Dec 2020 16:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049547; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=7aEwJBoiuK3UNB3SnBcj41Q8dJ827mwqeixVQJ8OBSc=; b=cWvBwDb3oT+ihS4uTOMwzuSGOwCkCDGg44dmxz/aUiyQEe1nyVic9IP69L96P/vbX7DjI7 SzAxQj0JNtblO0yUbKhqniuCvIfIqF2ucQwBqTy6N22S0nJoqKZ89W++N6Wu7dhFyEsOXH cjVqWI6K5Ah6XVnE/Mc21WyG4PbdQFA= X-MC-Unique: rJisYbeuN1-7Zi2Pq15xBg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/29] cpu-gather: Allow overwriting cpuid binary location Date: Tue, 15 Dec 2020 17:24:52 +0100 Message-Id: <20201215162515.53742-7-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.14 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" This is useful if cpuid was compiled from source in a non-standard location. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 97655399c8..75cf290a28 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -18,10 +18,11 @@ def gather_name(args): "Use '--model' to set a model name.") =20 =20 -def gather_cpuid_leaves(): +def gather_cpuid_leaves(args): + cpuid =3D args.path_to_cpuid or "cpuid" try: output =3D subprocess.check_output( - ["cpuid", "-1r"], + [cpuid, "-1r"], universal_newlines=3DTrue) except FileNotFoundError as e: exit("Error: '{}' not found.\n'cpuid' can be usually found in a " @@ -43,13 +44,18 @@ def main(): "--name", help=3D"CPU model name. " "If unset, model name is read from '/proc/cpuinfo'.") + parser.add_argument( + "--path-to-cpuid", + metavar=3D"PATH", + help=3D"Path to 'cpuid' utility. " + "If unset, the first executable 'cpuid' in $PATH is used.") =20 args =3D parser.parse_args() =20 name =3D gather_name(args) print("model name\t: {}".format(name)) =20 - leaves =3D gather_cpuid_leaves() + leaves =3D gather_cpuid_leaves(args) print("CPU:") for leave in leaves: print(" {}".format(leave)) --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050151; cv=none; d=zohomail.com; s=zohoarc; b=l92X4NFjxNiwsvQCJRLlbr9lHn1eIlkBhr0CpujWy9YJF/s5LfCs+QbfsDShjpW7AGQclPFUDG/e5Ig1/Gb+koNzU/RUgRnYhUu8lNBAP6OR+fCBoPdJ3gbNcJl1jihDMCi343ELqTi9CXNyG+qZaB8NjC1aOMUHJNG71mDNHY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050151; h=Content-Type:Content-Transfer-Encoding:Cc: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=5H5eFOavJlLcVf1wsbhxmW43kVo4gJfHap/hhZsVr2I=; b=CJfF+IAEdS4hn+dXhBdk/1OHC6rR7sJQzE+KkOZZ4e6YFPNy3wpwHuC5IZ+Wef/lODrFODS8vVK7Sg5BAc9xS5jB4tHxFE3XQtDpWtbDIKIYFIBY+Mz4MOQieTX6XQgX5OJHfkLNuZ9NGcfmUM/v9z8wkUbqo744WSMDuzpP92U= 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 1608050151303399.2718724925867; Tue, 15 Dec 2020 08:35:51 -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-132-rKYmJlaPNMaR1bIIr1RCMQ-1; Tue, 15 Dec 2020 11:31:43 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8EF1C84A5E0; Tue, 15 Dec 2020 16:31:37 +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 6B0F860873; Tue, 15 Dec 2020 16:31:37 +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 2CF6E1809CA5; Tue, 15 Dec 2020 16:31:37 +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 0BFGPOgX025644 for ; Tue, 15 Dec 2020 11:25:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id EF5AB5D9E3; Tue, 15 Dec 2020 16:25:24 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38F425D9D7; Tue, 15 Dec 2020 16:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049906; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=5H5eFOavJlLcVf1wsbhxmW43kVo4gJfHap/hhZsVr2I=; b=Xy7aMvuQ6tphDHICw8/hD88J8QyJRc7QySGHf4wt6yO9kmjJ0VErw+XICH5wX6fcfcXRe5 1PuRgMXVPeVQ6KBYcfO1t8FJAGXpZAGlnpFGc2+w/yJh94/yCR3pztfwMDTHvPHBIdDZcD xK+Zy1i+1TrHsF1asTgzz24nVQcv6Ag= X-MC-Unique: rKYmJlaPNMaR1bIIr1RCMQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/29] cpu-gather: Move msr decoding to new script Date: Tue, 15 Dec 2020 17:24:53 +0100 Message-Id: <20201215162515.53742-8-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.13 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" Fixes the leaking file descriptors. Does not silently ignore errors (e.g. permission denied on /dev/cpu/0/msr if run as non-root) and always attempt to read from /dev/kvm if /dev/cpu/0/msr failed. 'gather_msr()' returns a dictionary of values, as a later patch will add more registers to be interrogated. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 34 ++++++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 40 --------------------------------- 2 files changed, 34 insertions(+), 40 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 75cf290a28..db2348b460 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -1,8 +1,11 @@ #!/usr/bin/env python3 =20 import argparse +import fcntl import os +import struct import subprocess +import sys =20 =20 def gather_name(args): @@ -38,6 +41,31 @@ def gather_cpuid_leaves(args): yield line.strip() =20 =20 +def gather_msr(): + IA32_ARCH_CAPABILITIES_MSR =3D 0x10a + KVM_GET_MSRS =3D 0xc008ae88 + + try: + with open("/dev/cpu/0/msr", "rb") as f: + f.seek(IA32_ARCH_CAPABILITIES_MSR) + buf =3D f.read(8) + msr =3D struct.unpack("=3DQ", buf)[0] + return "", {IA32_ARCH_CAPABILITIES_MSR: msr} + except IOError as e: + print("Warning: {}".format(e), file=3Dsys.stderr) + + try: + bufIn =3D struct.pack("=3DLLLLQ", 1, 0, IA32_ARCH_CAPABILITIES_MSR= , 0, 0) + with open("/dev/kvm", "rb") as f: + bufOut =3D fcntl.ioctl(f, KVM_GET_MSRS, bufIn) + msr =3D struct.unpack("=3DLLLLQ", bufOut)[4] + return " via KVM", {IA32_ARCH_CAPABILITIES_MSR: msr} + except IOError as e: + print("Warning: {}".format(e), file=3Dsys.stderr) + + return None, {} + + def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") parser.add_argument( @@ -61,6 +89,12 @@ def main(): print(" {}".format(leave)) print() =20 + via, msr =3D gather_msr() + if via is not None: + print("MSR{}:".format(via)) + for key, value in sorted(msr.items()): + print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) + print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" subprocess.check_call("./cpu-gather.sh") diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index f84215e777..427b81a64b 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -5,46 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then exit 1 fi =20 -python3 < (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 1608049930096720.7311304922586; Tue, 15 Dec 2020 08:32:10 -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-496-iYBosArNPlKZ5WI-vs1-wQ-1; Tue, 15 Dec 2020 11:25:55 -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 8A44D1005D7D; Tue, 15 Dec 2020 16:25:41 +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 60E6A10023B9; Tue, 15 Dec 2020 16:25:41 +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 2C92E4E58F; Tue, 15 Dec 2020 16:25:41 +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 0BFGPQgT025661 for ; Tue, 15 Dec 2020 11:25:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1E4F75D9E4; Tue, 15 Dec 2020 16:25:26 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 534985D9D7; Tue, 15 Dec 2020 16:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049627; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=MCVvu2htwRGSkNnw2hfrg6eJydcnB2nKhGbbwvNj5JY=; b=YQjX/KiIoMSXWFt1f188Z4wKgwy55TOqx2lEvR9QpZ/xYCREMFb4egsBJvMKAyLhUXPOwW mx0o16RghaeL15o4fr7cuCDTaTfb159tJmDGalbZi18lThOzkGzxIkBSlNsAZRVuhlYSso 1Uy3ZJoh6e7bp6T13L37tMpzAPz/rtM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049927; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=MCVvu2htwRGSkNnw2hfrg6eJydcnB2nKhGbbwvNj5JY=; b=iGG2SY49BERFtij97bNgL6nlKRSAfHtcXGYtz3vBbsmqW7Xg4oup1HwqLhiHja2eKGMuLD JwIcSZEH+uhMHabeSXpBzAtuOJYYfM4dIFnxcND9+BEFGHyefvph9yNuwTFFI58iJ0udHc vqKv8HmphHPPWxHAl5ZeVKFsU2YaQRI= X-MC-Unique: iYBosArNPlKZ5WI-vs1-wQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/29] cpu-gather: Move qemu detection to new script Date: Tue, 15 Dec 2020 17:24:54 +0100 Message-Id: <20201215162515.53742-9-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 17 +++++++++++++++++ tests/cputestdata/cpu-gather.sh | 8 -------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index db2348b460..7f9479f78d 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -77,9 +77,25 @@ def main(): metavar=3D"PATH", help=3D"Path to 'cpuid' utility. " "If unset, the first executable 'cpuid' in $PATH is used.") + parser.add_argument( + "--path-to-qemu", + metavar=3D"PATH", + help=3D"Path to qemu. " + "If unset, will try '/usr/bin/qemu-system-x86_64', " + "'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.") =20 args =3D parser.parse_args() =20 + if not args.path_to_qemu: + args.path_to_qemu =3D "qemu-system-x86_64" + search =3D [ + "/usr/bin/qemu-system-x86_64", + "/usr/bin/qemu-kvm", + "/usr/libexec/qemu-kvm"] + for f in search: + if os.path.isfile(f): + args.path_to_qemu =3D f + name =3D gather_name(args) print("model name\t: {}".format(name)) =20 @@ -97,6 +113,7 @@ def main(): =20 print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" + os.environ["qemu"] =3D args.path_to_qemu subprocess.check_call("./cpu-gather.sh") =20 =20 diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index 427b81a64b..4b4ac1a47c 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -5,14 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then exit 1 fi =20 -qemu=3Dqemu-system-x86_64 -for cmd in /usr/bin/$qemu /usr/bin/qemu-kvm /usr/libexec/qemu-kvm; do - if [[ -x $cmd ]]; then - qemu=3D$cmd - break - fi -done - qom_get() { path=3D'/machine/unattached/device[0]' --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050159; cv=none; d=zohomail.com; s=zohoarc; b=UY1xNZp3etXwpDAuMd+hziN3PU5cHgL/wh9nr5Dj9H4oBq/T1FyXBSjYvVGLZfAVJUswXCfCKZoORatw/Ska84LF7S3J8djuZzM/B9pKdYqvhnDeeVtWoqvXfFkRmbZrDbv1iVFwmoOSq6SfbP13IdkKjB/jVTh9To6b75X4Jd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050159; h=Content-Type:Content-Transfer-Encoding:Cc: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=7LmJNBJARr++gxPvFkt8SFj8jR73TPYKqgwlhzmG2ao=; b=A1XHJ+z/VQZCZ9RMSzXTDoLSasL4UtvToRVnhXbdrPrDvFGb+xChPYip9yqKXiXkkfIMGeU4MfdslTxlmqdT/bG+TwoRPzVDBJqGmsZ9D/I3mFlkYrPIv/n2DDEyxMm17ABTgTGZM6gfX9hrq/haAdmpSv+J5On5d2+g/TN5aKY= 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 1608050158865279.11001759538533; Tue, 15 Dec 2020 08:35:58 -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-228-e3xWyV1fMz6UstkV1M40cA-1; Tue, 15 Dec 2020 11:31:49 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83605AFA92; Tue, 15 Dec 2020 16:31:41 +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 5D1C25D9E4; Tue, 15 Dec 2020 16:31:41 +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 3A0174BB7B; Tue, 15 Dec 2020 16:31:40 +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 0BFGPREA025667 for ; Tue, 15 Dec 2020 11:25:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 378845D9E4; Tue, 15 Dec 2020 16:25:27 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73AA45D9D7; Tue, 15 Dec 2020 16:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049912; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=7LmJNBJARr++gxPvFkt8SFj8jR73TPYKqgwlhzmG2ao=; b=cYIKhK56QtJFKhz1rl8j3YgLZaWgos9MtLc3eXE6Oh2c5W5bRjJ+zFekSqUdb8YjM+0/PV xyawsXl/zJF8JNybSkjcGJaYnWc0QZDHIBKvIymfR+R0MfKEfVKCb36KemKM4KRxlSSumn E92GiOKVEvcZCVt0g6unDfmZ2S6B8jE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=7LmJNBJARr++gxPvFkt8SFj8jR73TPYKqgwlhzmG2ao=; b=M4ahbFENkKOHaNLqCRLfTPgu0MF5pIwJ8//xmLJoCGGZ30Q2SsQzpGwJWYn94loznrqDJf 3G/P0qbjeQeq/TB4TtZUGO/oyl+TQDdGxcoq3mLhxQdLZJeFKMtxE2a5pxYj7wXzECBgVg Y0XTqqtEH7TOlSaQBpmrHhkZF2FCibM= X-MC-Unique: e3xWyV1fMz6UstkV1M40cA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/29] cpu-gather: Move static model expansion to new script Date: Tue, 15 Dec 2020 17:24:55 +0100 Message-Id: <20201215162515.53742-10-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.14 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 45 +++++++++++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 7 ----- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 7f9479f78d..e4a82fc949 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -2,6 +2,7 @@ =20 import argparse import fcntl +import json import os import struct import subprocess @@ -66,6 +67,47 @@ def gather_msr(): return None, {} =20 =20 +def call_qemu(qemu, qmp_cmds): + cmd =3D [ + qemu, + "-machine", "accel=3Dkvm", + "-cpu", "host", + "-nodefaults", + "-nographic", + "-qmp", "stdio"] + + stdin =3D list() + stdin.append("{\"execute\": \"qmp_capabilities\"}") + stdin.extend([json.dumps(o) for o in qmp_cmds]) + stdin.append("{\"execute\": \"quit\"}") + + try: + output =3D subprocess.check_output( + cmd, + universal_newlines=3DTrue, + input=3D"\n".join(stdin)) + except subprocess.CalledProcessError: + exit("Error: Non-zero exit code from '{}'.".format(qemu)) + except FileNotFoundError: + exit("Error: File not found: '{}'.".format(qemu)) + + return output + + +def gather_static_model(args): + output =3D call_qemu(args.path_to_qemu, [ + { + "execute": "query-cpu-model-expansion", + "arguments": + { + "type": "static", + "model": {"name": "host"} + }, + "id": "model-expansion" + }]) + return output + + def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") parser.add_argument( @@ -111,9 +153,12 @@ def main(): for key, value in sorted(msr.items()): print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) =20 + static_model =3D gather_static_model(args) + print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" os.environ["qemu"] =3D args.path_to_qemu + os.environ["model"] =3D static_model subprocess.check_call("./cpu-gather.sh") =20 =20 diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index 4b4ac1a47c..af0f40b61c 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -21,13 +21,6 @@ model_expansion() '{"type":"'"$mode"'","model":'"$model"'},"id":"model-expansion"}' } =20 -model=3D$( - $qemu -machine accel=3Dkvm -cpu host -nodefaults -nographic -qmp stdio= < (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 1608049940125612.9211387302995; Tue, 15 Dec 2020 08:32:20 -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-153-KuQvXKt7On6NRWtpprVG2Q-1; Tue, 15 Dec 2020 11:32:13 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F03B107AD26; Tue, 15 Dec 2020 16:31:44 +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 5A94262AF8; Tue, 15 Dec 2020 16:31:44 +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 1B4AA5002E; Tue, 15 Dec 2020 16:31:44 +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 0BFGPSjN025686 for ; Tue, 15 Dec 2020 11:25:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 566135D9E4; Tue, 15 Dec 2020 16:25:28 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E8775D9D7; Tue, 15 Dec 2020 16:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049936; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=qcWnb5+TowlvBohK8QgkUjyYpQc7wVXBKxCLbNbTYvE=; b=WUrlU/6v88cmdHEy/9nTe1Sn6jdw3FRjNppSkX+XQj8I7r+XMZY08LN8GEyG+GZvi+Ssy8 Pl+VAIz0YuZQ3RACPcr2FwKynhEChy5tE4YXDLqoRhzVk/13OYqoIKhA88ot6KorbJJ/my NAdOOVDnZuN1AkRKnbJz5pZDTyWqDJE= X-MC-Unique: KuQvXKt7On6NRWtpprVG2Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/29] cpu-gather: Move static model extraction to new script Date: Tue, 15 Dec 2020 17:24:56 +0100 Message-Id: <20201215162515.53742-11-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.15 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 13 ++++++++++--- tests/cputestdata/cpu-gather.sh | 5 ----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index e4a82fc949..0c8d8e93d0 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -91,7 +91,9 @@ def call_qemu(qemu, qmp_cmds): except FileNotFoundError: exit("Error: File not found: '{}'.".format(qemu)) =20 - return output + for line in output.split("\n"): + if line: + yield json.loads(line) =20 =20 def gather_static_model(args): @@ -105,7 +107,12 @@ def gather_static_model(args): }, "id": "model-expansion" }]) - return output + + for o in output: + if o.get("id") =3D=3D "model-expansion": + return o["return"]["model"] + + return None =20 =20 def main(): @@ -158,7 +165,7 @@ def main(): print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" os.environ["qemu"] =3D args.path_to_qemu - os.environ["model"] =3D static_model + os.environ["model"] =3D json.dumps(static_model) if static_model else = "" subprocess.check_call("./cpu-gather.sh") =20 =20 diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index af0f40b61c..726f013908 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -21,11 +21,6 @@ model_expansion() '{"type":"'"$mode"'","model":'"$model"'},"id":"model-expansion"}' } =20 -model=3D$( - echo "$model" | \ - sed -ne 's/^{"return": {"model": {\(.*{.*}\)}}, .*/{\1}/p' -) - $qemu -machine accel=3Dkvm -cpu host -nodefaults -nographic -qmp stdio < (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 1608049566043706.4410808006744; Tue, 15 Dec 2020 08:26:06 -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-193-Cmq1iFZ9MEiBHpsyGj8sJQ-1; Tue, 15 Dec 2020 11:25:59 -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 62DA6874997; Tue, 15 Dec 2020 16:25:44 +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 2976B7444F; Tue, 15 Dec 2020 16:25:44 +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 D41261809CA1; Tue, 15 Dec 2020 16:25:43 +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 0BFGPT7e025693 for ; Tue, 15 Dec 2020 11:25:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 807135D9E4; Tue, 15 Dec 2020 16:25:29 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B30D55D9D7; Tue, 15 Dec 2020 16:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049563; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=1hFyXDBA+OeCGb6shbFC9KxSz0yLvAKLkdcrCS13btA=; b=C3tlBrYFTWadXiz63ZjG5m2/N0Vk3WU4p9TETh5f7B9oXOFxCgRKA5K1f1VMcr0qOjSxw0 JQHROx82AIBR+Vcy63zaCz1p/HxghbF+NgMqSBw6+O88Ej7400tBReyfPbRAcaXPEBkX3f k0WOIafsLKZ0zznOqy1fnbNDTv44RLo= X-MC-Unique: Cmq1iFZ9MEiBHpsyGj8sJQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 11/29] cpu-gather: Move simple model extraction to new script Date: Tue, 15 Dec 2020 17:24:57 +0100 Message-Id: <20201215162515.53742-12-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 60 +++++++++++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 13 ------- 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 0c8d8e93d0..5c03d226b6 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -115,6 +115,63 @@ def gather_static_model(args): return None =20 =20 +def gather_full_model(args, static_model): + if static_model: + return [] + else: + return call_qemu(args.path_to_qemu, [ + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "feature-words" + }, + "id": "feature-words" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "family" + }, + "id": "family" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "model" + }, + "id": "model" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "stepping" + }, + "id": "stepping" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "model-id" + }, + "id": "model-id" + }, + { + "execute": "query-cpu-definitions", + "id": "definitions" + } + ]) + + def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") parser.add_argument( @@ -161,6 +218,9 @@ def main(): print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) =20 static_model =3D gather_static_model(args) + model =3D gather_full_model(args, static_model) + for o in model: + print(json.dumps(o)) =20 print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index 726f013908..05faf14a96 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -5,13 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then exit 1 fi =20 -qom_get() -{ - path=3D'/machine/unattached/device[0]' - echo '{"execute":"qom-get","arguments":{"path":"'$path'",' \ - '"property":"'$1'"},"id":"'$1'"}' -} - model_expansion() { mode=3D$1 @@ -26,12 +19,6 @@ $qemu -machine accel=3Dkvm -cpu host -nodefaults -nograp= hic -qmp stdio < (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 1608049583096338.41155798923705; Tue, 15 Dec 2020 08:26:23 -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-199-qlNU-2JzPa-f9cjfFNttQA-1; Tue, 15 Dec 2020 11:26:05 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94DD7809DCE; Tue, 15 Dec 2020 16:25:47 +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 555DF5D9F1; Tue, 15 Dec 2020 16:25:47 +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 1354F1809CA2; Tue, 15 Dec 2020 16:25:47 +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 0BFGPUi1025708 for ; Tue, 15 Dec 2020 11:25:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id AFE0E5D9E4; Tue, 15 Dec 2020 16:25:30 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDEB35D9D7; Tue, 15 Dec 2020 16:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049581; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=XfiZwIJ2VJ9GhIReOgstqydA3JuynQ05z9IADR4vh+M=; b=Jku9uaAW+WOBEvrNE1MhnA1GwVjdg83fAOwyUa3MXVE02KljX/dMqrHEpW66OOFB0Sp18N WDC52pP8yKIO02CsYGJC69D0Pvb/YSO59TC8v26+166km9Oz72E3O0UmC+GHZshgOtDakW K97ZpUB8TE7KHfvt0+a8JuLHlCa5HVo= X-MC-Unique: qlNU-2JzPa-f9cjfFNttQA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 12/29] cpu-gather: Move full model extraction to new script Date: Tue, 15 Dec 2020 17:24:58 +0100 Message-Id: <20201215162515.53742-13-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.14 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 16 +++++++++++++++- tests/cputestdata/cpu-gather.sh | 20 -------------------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 5c03d226b6..ea1d42f1ec 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -117,7 +117,21 @@ def gather_static_model(args): =20 def gather_full_model(args, static_model): if static_model: - return [] + return call_qemu(args.path_to_qemu, [ + { + "execute": "query-cpu-model-expansion", + "arguments": + { + "type": "full", + "model": static_model + }, + "id": "model-expansion" + }, + { + "execute": "query-cpu-definitions", + "id": "definitions" + } + ]) else: return call_qemu(args.path_to_qemu, [ { diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh index 05faf14a96..5cef26c8e6 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -4,23 +4,3 @@ if [ -z "${CPU_GATHER_PY}" ]; then echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instea= d." exit 1 fi - -model_expansion() -{ - mode=3D$1 - model=3D$2 - - echo '{"execute":"query-cpu-model-expansion","arguments":' \ - '{"type":"'"$mode"'","model":'"$model"'},"id":"model-expansion"}' -} - -$qemu -machine accel=3Dkvm -cpu host -nodefaults -nographic -qmp stdio < (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 1608049575903518.3462610940269; Tue, 15 Dec 2020 08:26:15 -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-375-s8xZ9oUCN2GX_nil84Zbow-1; Tue, 15 Dec 2020 11:26:10 -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 602541081B4B; Tue, 15 Dec 2020 16:25:50 +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 397B871D4F; Tue, 15 Dec 2020 16:25:50 +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 F24725002C; Tue, 15 Dec 2020 16:25:49 +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 0BFGPVKI025722 for ; Tue, 15 Dec 2020 11:25:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id D60615D9E4; Tue, 15 Dec 2020 16:25:31 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1876A5D9D7; Tue, 15 Dec 2020 16:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049573; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=vYWjGbLp2qY31OMb7chKm+UCIrzTiywwCuqyp7ROpwk=; b=XLP8BM57+f8jtmaT2e+5GG5XWMRHt15r/I9x/7fPKqeSinw8UhkxC97jRIKrQ6kbp9toCU jv23q9BXA7eJPmZd+uvm+F8hXv6aRw05g5cCjiT7VGSSu2Ry8pGx2pdXT5dsK4aIjEoq2U 4M2kRYHg+M3XA3KL4j1CBkn3Xs4D2+4= X-MC-Unique: s8xZ9oUCN2GX_nil84Zbow-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 13/29] cpu-gather: Merge model gathering logic Date: Tue, 15 Dec 2020 17:24:59 +0100 Message-Id: <20201215162515.53742-14-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index ea1d42f1ec..c639c433d2 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -96,7 +96,7 @@ def call_qemu(qemu, qmp_cmds): yield json.loads(line) =20 =20 -def gather_static_model(args): +def gather_model(args): output =3D call_qemu(args.path_to_qemu, [ { "execute": "query-cpu-model-expansion", @@ -108,14 +108,11 @@ def gather_static_model(args): "id": "model-expansion" }]) =20 + static_model =3D None for o in output: if o.get("id") =3D=3D "model-expansion": - return o["return"]["model"] + static_model =3D o["return"]["model"] =20 - return None - - -def gather_full_model(args, static_model): if static_model: return call_qemu(args.path_to_qemu, [ { @@ -231,15 +228,13 @@ def main(): for key, value in sorted(msr.items()): print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) =20 - static_model =3D gather_static_model(args) - model =3D gather_full_model(args, static_model) + model =3D gather_model(args) for o in model: print(json.dumps(o)) =20 print(end=3D"", flush=3DTrue) os.environ["CPU_GATHER_PY"] =3D "true" os.environ["qemu"] =3D args.path_to_qemu - os.environ["model"] =3D json.dumps(static_model) if static_model else = "" subprocess.check_call("./cpu-gather.sh") =20 =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049958; cv=none; d=zohomail.com; s=zohoarc; b=WeLMsSAhYAQoiWHGEi+iSUIRiOOeCRz2ZPqCN938B1UHAbr81hzf8KUmratLPsrGdEIEh3EXb63Ocj91v5HkZXfp53uzF5mIJv43qVRLmCCONkSO0WJlfW4LqlBQZrw79r3gZVp68jHm1+dkq6H729eQszZupR4ZB6sUr/zzzrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049958; h=Content-Type:Content-Transfer-Encoding:Cc: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=hjItNc8KEkSv7J9mWbcG3Wyc95I9Oq2mdL/e79COSf0=; b=hfgLGUbzstMTpTwSGDtE86lXlazWBF9gPNy2d7jBT8vfgJl1xJgJnUOA/MsQV3yvS1l1pbLdy1YU9yZYb8h2Rmlsv3ilGdP/sJqWj7+fiBR15EjotbFQ7F2A/iUbQGJDPM7y0vsyRPHL217caXf1vEpNB88TcpWKUTX91uTvDVA= 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 1608049958966217.67070420357504; Tue, 15 Dec 2020 08:32:38 -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-413-ql6mHSaGNYij1TEx3wudZw-1; Tue, 15 Dec 2020 11:32:28 -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 EBACF1937FC5; Tue, 15 Dec 2020 16:31:48 +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 6DCCF1962E; Tue, 15 Dec 2020 16:31:48 +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 2BFF35002F; Tue, 15 Dec 2020 16:31:48 +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 0BFGPX3h025737 for ; Tue, 15 Dec 2020 11:25:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0B6FC5D9E8; Tue, 15 Dec 2020 16:25:33 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F18D5D9D7; Tue, 15 Dec 2020 16:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049956; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=hjItNc8KEkSv7J9mWbcG3Wyc95I9Oq2mdL/e79COSf0=; b=K4ozozTLP5uVJ89K1zzEfN/fMFjGV20f8y+gDZFIg/dWXYRMk7bMeMUPQNxOauNkQNX7DE gEIvB4M3VvaFfCGHH5gvqrx0crwI0x/kxaDTSOLjbt8cfC7P7LzUvmgsTl7Jt7vstJPd3+ 03WEkmBkPcqi5cSQ1V8Xed+LKjlH3iY= X-MC-Unique: ql6mHSaGNYij1TEx3wudZw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 14/29] cpu-gather: Delete old script Date: Tue, 15 Dec 2020 17:25:00 +0100 Message-Id: <20201215162515.53742-15-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 5 ----- tests/cputestdata/cpu-gather.sh | 6 ------ 2 files changed, 11 deletions(-) delete mode 100755 tests/cputestdata/cpu-gather.sh diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index c639c433d2..9c609aa6e9 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -232,11 +232,6 @@ def main(): for o in model: print(json.dumps(o)) =20 - print(end=3D"", flush=3DTrue) - os.environ["CPU_GATHER_PY"] =3D "true" - os.environ["qemu"] =3D args.path_to_qemu - subprocess.check_call("./cpu-gather.sh") - =20 if __name__ =3D=3D "__main__": main() diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather= .sh deleted file mode 100755 index 5cef26c8e6..0000000000 --- a/tests/cputestdata/cpu-gather.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -if [ -z "${CPU_GATHER_PY}" ]; then - echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instea= d." - exit 1 -fi --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050164; cv=none; d=zohomail.com; s=zohoarc; b=YY/sqoqRiYs+L67it1hSifNunXzgsQibhdw7gxi25OgscbalwpSCEl5rn6twMRqVzIih4ACIYWLAo3H3CJiYywsQKO1HGp0/yvMjEs5PgkZIyILs7Y03v85ZQYXLERFK2tRCwR397M0wA/3LIaUnodKrmeVkgSKXB3DmXaWlQv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050164; h=Content-Type:Content-Transfer-Encoding:Cc: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=vOJRvAbon90dj3ynAoLFDYQ7z1K4uODUAHbPD/JD1Iw=; b=gFUXs8P8taykX1Gx85mJ4Nk+9wJxlrMetsGzEgNJK+pYVN6xSOJZFgapdoCWnHn68fp+daoIn/h1+kbwqWgWdqna9Olp6jOHNIDyh8Brq3EAywu72WsW2DvH9AkerJfRQsmJk/P3O8blPrmYPIFgywykPvaI/HrvXv6E5RR9ocg= 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 1608050164912266.6661060951028; Tue, 15 Dec 2020 08:36:04 -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-375-3W83hcptN3yiVp-kLKEvFQ-1; Tue, 15 Dec 2020 11:25:57 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87701BBEE3; Tue, 15 Dec 2020 16:25:41 +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 617315D9D7; Tue, 15 Dec 2020 16:25:41 +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 286271809C9F; Tue, 15 Dec 2020 16:25:41 +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 0BFGPYDR025748 for ; Tue, 15 Dec 2020 11:25:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3765C5D968; Tue, 15 Dec 2020 16:25:34 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 661565D9D7; Tue, 15 Dec 2020 16:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049560; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=vOJRvAbon90dj3ynAoLFDYQ7z1K4uODUAHbPD/JD1Iw=; b=D9aNBGGQfYMgCzJG/We46HUbl95FkekW71/A6jzhIQc9HMJ2iuHIbNM7Fo73iH0W22Ea64 5mECpY4YJ9QF2g+dVkXUVrcae+Myv0eXpMxNGRJbxVQhFfdiaW6Ov23w2MVhfg6IL7dV77 XUwDk/jQSKclpuINFILK3hr9I+WxuWs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050162; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=vOJRvAbon90dj3ynAoLFDYQ7z1K4uODUAHbPD/JD1Iw=; b=Lmz6MSvw0Q00wSeC0pdl6KGBRIghGbSEJIYFS/SQUDuv2+tJi0t19r7MijUvRt/4hiSZ1W JK9LO7cqaNOdNHqlmjrz7RgdwaC5r918idTitrpVyU1yRlPBnjkuXOBSxb6RwIYW/K+UgP SWwVnZoV9qvo1xwykzxLABQNi/QX4WA= X-MC-Unique: 3W83hcptN3yiVp-kLKEvFQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 15/29] cpu-gather: Separate data input and output Date: Tue, 15 Dec 2020 17:25:01 +0100 Message-Id: <20201215162515.53742-16-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.14 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is a preparatory step to replace the output format with something more readable. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 50 +++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 9c609aa6e9..005d1019b6 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -183,6 +183,36 @@ def gather_model(args): ]) =20 =20 +def gather(args): + result =3D dict() + result["name"] =3D gather_name(args) + result["leaves"] =3D list(gather_cpuid_leaves(args)) + result["via"], result["msr"] =3D gather_msr() + result["model"] =3D list(gather_model(args)) + return result + + +def output_to_text(data): + output =3D list() + + output.append("model name\t: {}".format(data["name"])) + + output.append("CPU:") + for leave in data["leaves"]: + output.append(" {}".format(leave)) + output.append("") + + if data["via"] is not None: + output.append("MSR{}:".format(data["via"])) + for key, value in sorted(data["msr"].items()): + output.append(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) + + for o in data["model"]: + output.append(json.dumps(o)) + + return "\n".join(output) + + def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") parser.add_argument( @@ -213,24 +243,8 @@ def main(): if os.path.isfile(f): args.path_to_qemu =3D f =20 - name =3D gather_name(args) - print("model name\t: {}".format(name)) - - leaves =3D gather_cpuid_leaves(args) - print("CPU:") - for leave in leaves: - print(" {}".format(leave)) - print() - - via, msr =3D gather_msr() - if via is not None: - print("MSR{}:".format(via)) - for key, value in sorted(msr.items()): - print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) - - model =3D gather_model(args) - for o in model: - print(json.dumps(o)) + data =3D gather(args) + print(output_to_text(data)) =20 =20 if __name__ =3D=3D "__main__": --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050645; cv=none; d=zohomail.com; s=zohoarc; b=Jb0tWGm9afS6/VLUzMBaI9aaPw8C4v5BIAVZ7mmm4jVJinsk0Rve7/YjajqvKSRcrXzHHDerNlpWEsnIjs8ei+UQh7E7lUDqieLPhClCdPFmXLU9sEkalyRMry2VC3VmvA7yDLbS1V4ZkkATGNp6vPagad13mSl2oGGixBN6Fg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050645; h=Content-Type:Content-Transfer-Encoding:Cc: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=zPmWZphn3HgfajwS7/B8sAz/BAyRMqpi5itr9Uw7LBY=; b=YAch+HiI2ZSuTvOQO1pFQK5AN7VNqdib9mdhTXCh7KNdiOSnWuUgLXJOwdhv3xAh09Vhw26hCetVuwNZxyQsrqQltsJiWZgS4sPKsihGBL7V4yNh0rLC9b7X3OvQUQrCsenevfukThI5npH2Va0hc5+DsFCrZwLoYA/qVXOibLM= 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 1608050645200671.0046664653034; Tue, 15 Dec 2020 08:44:05 -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-346-fJ0YPpZKNJKerR3qiML8iw-1; Tue, 15 Dec 2020 11:32:28 -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 AFAB68FE9B8; Tue, 15 Dec 2020 16:31:51 +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 7064919635; Tue, 15 Dec 2020 16:31:51 +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 30A3F1809CA6; Tue, 15 Dec 2020 16:31:51 +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 0BFGPZhI025761 for ; Tue, 15 Dec 2020 11:25:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6A0A45D9E4; Tue, 15 Dec 2020 16:25:35 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EB525D9D7; Tue, 15 Dec 2020 16:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050642; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=zPmWZphn3HgfajwS7/B8sAz/BAyRMqpi5itr9Uw7LBY=; b=bGKkdVivN8pA9NpGHJKaBuehcVFooJWiJJafNtR7d+hj2aPqimaxhKApAhzLCX4vkrcnFg ca+hKRvRi91h4SHe9hxk+Urz9BdYs/13eR/F9bcFGf1IIUwU3HJlaBjG4DZjEjYv/FZyxf XCXwXt5kaY5bmm1zi7+qsJWEEFnyBbQ= X-MC-Unique: fJ0YPpZKNJKerR3qiML8iw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 16/29] cpu-parse: Wrap with python script Date: Tue, 15 Dec 2020 17:25:02 +0100 Message-Id: <20201215162515.53742-17-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" This changes the invocation from ./cpu-gather.py | ./cpu-parse.sh to ./cpu-gather.py [--gather] | ./cpu-gather.py --parse Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 29 +++++++++++++++++++++++++++-- tests/cputestdata/cpu-parse.sh | 6 ++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 005d1019b6..83f175d342 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -192,6 +192,15 @@ def gather(args): return result =20 =20 +def parse(args): + os.environ["CPU_GATHER_PY"] =3D "true" + output =3D subprocess.check_output( + "./cpu-parse.sh", + stderr=3Dsubprocess.STDOUT, + universal_newlines=3DTrue) + print(output) + + def output_to_text(data): output =3D list() =20 @@ -231,8 +240,21 @@ def main(): "If unset, will try '/usr/bin/qemu-system-x86_64', " "'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.") =20 + mode =3D parser.add_mutually_exclusive_group() + mode.add_argument( + "--gather", + action=3D"store_true", + help=3D"Acquire data on target system. This is the default.") + mode.add_argument( + "--parse", + action=3D"store_true", + help=3D"Parse data for libvirt use.") + args =3D parser.parse_args() =20 + if not args.gather and not args.parse: + args.gather =3D True + if not args.path_to_qemu: args.path_to_qemu =3D "qemu-system-x86_64" search =3D [ @@ -243,8 +265,11 @@ def main(): if os.path.isfile(f): args.path_to_qemu =3D f =20 - data =3D gather(args) - print(output_to_text(data)) + if args.gather: + data =3D gather(args) + print(output_to_text(data)) + else: + parse(args) =20 =20 if __name__ =3D=3D "__main__": diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index 7501c57cba..fa4344b6ad 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -1,7 +1,9 @@ #!/bin/bash =20 -# Usage: -# ./cpu-gather.sh | ./cpu-parse.sh +if [ -z "${CPU_GATHER_PY}" ]; then + echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instea= d." + exit 1 +fi =20 data=3D`cat` =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050792; cv=none; d=zohomail.com; s=zohoarc; b=Z8qe6iw7zdVj7gsSQiI6ynGdmTC6aZklJoiZ443nBcK4om9GMnlh0Ik+AIjo6QfqiLJUTtLp1iFFWJTBHBLejX9lqIAVQT6qioIh1p0mlo8ZSK51mLb2iyUG+jlKeWrYt5+Dy+7wMpESS1MGKKHTennpuqHKpu7fMzEkwwB7Uig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050792; h=Content-Type:Content-Transfer-Encoding:Cc: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=V1OkfndGO0eEmmKNJNsaRf756ReI+DQSd5J79EH6wuQ=; b=bAZKdclPjmkb8d/TISgYw9832ZylrN4F6TWyBz4GeT2KXV02s5SJ5lriLnh6jlAemrdSV0Y9Juewyc+svmYBCHYBfHDb6asYDEc+r1fd1abD0l4XkvTPHb0k+NHtxYrlMkCRVifA/jk+GHK7rOk9NLVNeR1BTGaJVFQ1wX7z0f4= 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 160805079242469.17988890052993; Tue, 15 Dec 2020 08:46:32 -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-322-LOgWzaKHMxKWRX9lWzpJ8w-1; Tue, 15 Dec 2020 11:32:40 -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 D7E88921C00; Tue, 15 Dec 2020 16:31:54 +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 552C270497; Tue, 15 Dec 2020 16:31: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 1810F1809CAA; Tue, 15 Dec 2020 16:31:54 +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 0BFGPatP025772 for ; Tue, 15 Dec 2020 11:25:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8EA005D9E3; Tue, 15 Dec 2020 16:25:36 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id C14455D9D7; Tue, 15 Dec 2020 16:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049962; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=V1OkfndGO0eEmmKNJNsaRf756ReI+DQSd5J79EH6wuQ=; b=fiJUxDodevFwxajc+Jz+NkaqMzcqyxUkAnjy+ogGQu+Ql85Bo1R2NfD//zK3oBEhCSw90+ plP8prMOqqm7EG+RYJZVg65ZTOdI1r3zOHJALZCQ0xKo1lumTaPMiR1hMEMefE2z5wdLVl 2N/HWdjmjKhZWyBROe6NpUEEJr7cAso= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050789; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=V1OkfndGO0eEmmKNJNsaRf756ReI+DQSd5J79EH6wuQ=; b=arahpL0/e1HMSw2pLm9/cjEMOGm6CtwZ2fT7VXPr/NGp/2rZCJH5py/bQlnt474pfmOg8S COFEgVMH8UTSCGnX1Exaw9aUmJmCATWUdsIuPsD0h4+ddHu+Q7J9VqA9vkxD4+eTWs2eGr jFktZ5lAMr17zXByExliYYzDuiW3gSY= X-MC-Unique: LOgWzaKHMxKWRX9lWzpJ8w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 17/29] cpu-gather: Transport data as json Date: Tue, 15 Dec 2020 17:25:03 +0100 Message-Id: <20201215162515.53742-18-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" More reliable, easier to parse, easier to edit. Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 83f175d342..7c51a47353 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -193,9 +193,12 @@ def gather(args): =20 =20 def parse(args): + data =3D json.load(sys.stdin) + os.environ["CPU_GATHER_PY"] =3D "true" output =3D subprocess.check_output( "./cpu-parse.sh", + input=3Doutput_to_text(data), stderr=3Dsubprocess.STDOUT, universal_newlines=3DTrue) print(output) @@ -267,7 +270,7 @@ def main(): =20 if args.gather: data =3D gather(args) - print(output_to_text(data)) + json.dump(data, sys.stdout, indent=3D2) else: parse(args) =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049983; cv=none; d=zohomail.com; s=zohoarc; b=nFjbNaiL91FIqm8nFEajphinB5hgZz1sZd2tFCjCRfvUwT5U/lH1TvQSblBIzIf2hnrCKT5ZB8J87MgvFKdAQt2TumPKCoaHTOymkkVMEGy4C6JDJuQOQxWy98euM+rOuNZEd0v/nYAxefri6g8bET0FA5Ig6jlKBrb9IzD3Blc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049983; h=Content-Type:Content-Transfer-Encoding:Cc: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=0XJwXy20bfCt1n0mfvyS/j2dMXIoAO3eP2ScW3iMaLA=; b=ajzFnArq3JK517GC1PJN9kK4k5N4sql45lcJqyfm4Xj4fC6QXlPR0XhoRviUdtxUACE0pIYiPhX9FgHRmDrbbixuMtBA41X9Cwt4kdW5f3mSwOYTqH+rsZXP16NsZVSAkRjJMXQ5rSQtzMkJCfKqqmpnMWU5wkbzCpdeDDRxohY= 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 1608049982616729.4621110549451; Tue, 15 Dec 2020 08:33: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-239-rZUP9aWkPQKAy75k4dBKCA-1; Tue, 15 Dec 2020 11:32:51 -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 9D1451007300; Tue, 15 Dec 2020 16:31:57 +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 78A511E5; Tue, 15 Dec 2020 16:31:57 +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 3CE1B50033; Tue, 15 Dec 2020 16:31: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 0BFGPbYR025791 for ; Tue, 15 Dec 2020 11:25:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id B79CF5D9E4; Tue, 15 Dec 2020 16:25:37 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB6985D9E3; Tue, 15 Dec 2020 16:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049978; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=0XJwXy20bfCt1n0mfvyS/j2dMXIoAO3eP2ScW3iMaLA=; b=EjGc9Bz+oKr6c87dQkNeQIyRKX04x1tDC8gfXzxmbSyOoNMmcW2HFVAHe8mB8eUxBMUz+E hsGlCHtOvG///65kX192r7Ap/I91PhsQG26XmO8aFhfkxMCjiZom7rCb3+A0MquR2R5X2k wGV0BjBnjd+5bOZQPCv+IKABkNoyo/A= X-MC-Unique: rZUP9aWkPQKAy75k4dBKCA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 18/29] cpu-parse: Move model name detection to new script Date: Tue, 15 Dec 2020 17:25:04 +0100 Message-Id: <20201215162515.53742-19-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 1 + tests/cputestdata/cpu-parse.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 7c51a47353..0b1019456c 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -196,6 +196,7 @@ def parse(args): data =3D json.load(sys.stdin) =20 os.environ["CPU_GATHER_PY"] =3D "true" + os.environ["model"] =3D data["name"] output =3D subprocess.check_output( "./cpu-parse.sh", input=3Doutput_to_text(data), diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index fa4344b6ad..5b8e57e427 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -7,8 +7,6 @@ fi =20 data=3D`cat` =20 -model=3D`sed -ne '/^model name[ ]*:/ {s/^[^:]*: \(.*\)/\1/p; q}' <<<"$dat= a"` - fname=3D`sed -e 's/^ *//; s/ *$//; s/[ -]\+ \+/ /g; --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049567; cv=none; d=zohomail.com; s=zohoarc; b=OOp40W2AO7fVAyVmjbYjbdHx/hNxqpJ4XTeaQECHMnKN2MVGEAIwr/Z3RRSmHlBxcnxSHqOUA/OAseToIP5X8AeeZwrVYd8Ab/7vLWYHBzzS7/O+xqkweII9qu4Q+xWChxmdY15HuKFbR0oheFCpJ8Q3cOq3iwJOVPmIsfc1nc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049567; h=Content-Type:Content-Transfer-Encoding:Cc: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=sj+VUFfDu5K7sZAMKFBzACf7YN9/s5ZHMOxBcIYR/Jo=; b=akdczoPkDiguwQRyscGHlbWw/ie3j2crL3cA2jymuP547TGeBmCk+bgDqxbr9HeambeqYF5P9w8bV/d8m/yIvDNUBA6x0pxiwFtm3P6F7qJPH9vTrgWVJ0bbvnwoQt8FnxdW27+u/OHNjOBApGgY4L3s4e80Dqejwc4GlGm8+dY= 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 1608049567639187.46492512273392; Tue, 15 Dec 2020 08:26:07 -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-36-aLgz5DTVMj6GAmjuFHcmwg-1; Tue, 15 Dec 2020 11:26:02 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 48240107AD32; Tue, 15 Dec 2020 16:25:44 +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 1C7FE60C15; Tue, 15 Dec 2020 16:25:44 +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 D416E4EE0B; Tue, 15 Dec 2020 16:25:43 +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 0BFGPcY8025800 for ; Tue, 15 Dec 2020 11:25:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id D947E5D9E3; Tue, 15 Dec 2020 16:25:38 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E1A35D9D7; Tue, 15 Dec 2020 16:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049564; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=sj+VUFfDu5K7sZAMKFBzACf7YN9/s5ZHMOxBcIYR/Jo=; b=cSkdWfve8Cy5Xn6D9WmfumWeA6MRefMOOjXPWlQtk9h8CRMspffO302DXtZ1aswe9zzseD EmrP+kDvPVGMequDvpLlHtorCxvROrliSWMMPOn4UMfZzVMgpuOTFxzpwHfenJREXteU4w XHmnvvUact7pHGRFtxrGMdj4MKGyVGU= X-MC-Unique: aLgz5DTVMj6GAmjuFHcmwg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 19/29] cpu-parse: Move file name generation to new script Date: Tue, 15 Dec 2020 17:25:05 +0100 Message-Id: <20201215162515.53742-20-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.12 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 18 ++++++++++++++++++ tests/cputestdata/cpu-parse.sh | 13 ------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 0b1019456c..1a15cc1ff0 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -4,6 +4,7 @@ import argparse import fcntl import json import os +import re import struct import subprocess import sys @@ -192,11 +193,28 @@ def gather(args): return result =20 =20 +def parse_filename(data): + filename =3D data["name"].strip() + filename =3D re.sub("[ -]+ +", " ", filename) + filename =3D re.sub("\\(([Rr]|[Tt][Mm])\\)", "", filename) + filename =3D re.sub(".*(Intel|AMD) ", "", filename) + filename =3D re.sub(" (Duo|Quad|II X[0-9]+)", " ", filename) + filename =3D re.sub(" (CPU|Processor)", "", filename) + filename =3D re.sub(" @.*", "", filename) + filename =3D re.sub(" APU .*", "", filename) + filename =3D re.sub(" SE$", "", filename) + filename =3D re.sub(" ", "-", filename) + return "x86_64-cpuid-{}".format(filename) + + def parse(args): data =3D json.load(sys.stdin) =20 + filename =3D parse_filename(data) + os.environ["CPU_GATHER_PY"] =3D "true" os.environ["model"] =3D data["name"] + os.environ["fname"] =3D filename output =3D subprocess.check_output( "./cpu-parse.sh", input=3Doutput_to_text(data), diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index 5b8e57e427..2a41897538 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -7,19 +7,6 @@ fi =20 data=3D`cat` =20 -fname=3D`sed -e 's/^ *//; - s/ *$//; - s/[ -]\+ \+/ /g; - s/(\([Rr]\|[Tt][Mm]\))//g; - s/.*\(Intel\|AMD\) //; - s/ \(Duo\|Quad\|II X[0-9]\+\) / /; - s/ \(CPU\|Processor\)\>//; - s/ @.*//; - s/ APU .*//; - s/ SE$//; - s/ /-/g' <<<"$model"` -fname=3D"x86_64-cpuid-$fname" - xml() { hex=3D'\(0x[0-9a-f]\+\)' --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049579; cv=none; d=zohomail.com; s=zohoarc; b=VqBBw69giB7mGSExSrOkmKhhzCK0N0fEP+oplTudZkY1I6aGO7GYyqZrEIH2bpupiPdlsQ4F2n3eRMaAaf0p52cvFB7/a7ak/XGTXjxMo2o0awVPlPKEgv4zguDB+uArHtv1D9u+DNkge4IZenYwLzVySGoWeQcNOiDNhayg7o8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049579; h=Content-Type:Content-Transfer-Encoding:Cc: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=2940OYERded0nuBRSa/Hw2pV7v73ofwaJv6B/9AaI/I=; b=Hjn6TLbsAiknJWgtTEOGXaCe69TRyb22osWcUDXOf/6gdM1NN8K5uiOBQhnkUMXkpq6lAd5xKwnjAyfnffOtSs37G4Oe7wC+p7hMRSyhwVRoNdoZ8GVbgZb+RIqQfW9Rjzqn1akahPrEMA57XmY6r9r3fI5d4TQ50gM4v5IKTo4= 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 1608049579662169.7055490655672; Tue, 15 Dec 2020 08:26:19 -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-173--4qcnK9CMruoXlZm3g0n8Q-1; Tue, 15 Dec 2020 11:26:08 -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 4FA36100F36A; Tue, 15 Dec 2020 16:25:53 +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 DF3F7722E7; Tue, 15 Dec 2020 16:25:52 +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 A3B521809C9F; Tue, 15 Dec 2020 16:25:52 +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 0BFGPeE6025809 for ; Tue, 15 Dec 2020 11:25:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B3D05D9E4; Tue, 15 Dec 2020 16:25:40 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 464035D9D7; Tue, 15 Dec 2020 16:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049576; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=2940OYERded0nuBRSa/Hw2pV7v73ofwaJv6B/9AaI/I=; b=B0kL2+pX6YQW8xFvF8oiVkdxqicdGD7lnbBiNQSugYshxS86N7F+iKXruCEVevmtDBrbCv 0F5luXa9mWAdCqNKBNVX5lXHqz9fdxF0Ulcyg+LCa6sVS5qg5wau/Jt9L3a+vb1aKyWb5/ fNGXiqo1x84W3dEMkKbLrbW+0b+MN0k= X-MC-Unique: -4qcnK9CMruoXlZm3g0n8Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 20/29] cpu-parse: Move xml output to new script Date: Tue, 15 Dec 2020 17:25:06 +0100 Message-Id: <20201215162515.53742-21-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 40 +++++++++++++++++++++++++++++++++ tests/cputestdata/cpu-parse.sh | 18 --------------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 1a15cc1ff0..bc5c7dbb15 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -207,10 +207,50 @@ def parse_filename(data): return "x86_64-cpuid-{}".format(filename) =20 =20 +def output_xml(data, filename): + leave_pattern =3D re.compile( + "^\\s*" + "(0x[0-9a-f]+)\\s*" + "(0x[0-9a-f]+):\\s*" + "eax=3D(0x[0-9a-f]+)\\s*" + "ebx=3D(0x[0-9a-f]+)\\s*" + "ecx=3D(0x[0-9a-f]+)\\s*" + "edx=3D(0x[0-9a-f]+)\\s*$") + + leave_template =3D \ + " \n" + + msr_template =3D " \n" + + print(filename) + with open(filename, "wt") as f: + f.write("\n".format(data["name"])) + f.write("\n") + for line in data["leaves"]: + match =3D leave_pattern.match(line) + f.write(leave_template.format(*match.groups())) + for key, value in sorted(data["msr"].items()): + f.write(msr_template.format( + int(key), + 0xffffffff & (value >> 32), + 0xffffffff & (value >> 0))) + f.write("\n") + + def parse(args): data =3D json.load(sys.stdin) =20 filename =3D parse_filename(data) + filename_xml =3D "{}.xml".format(filename) + + output_xml(data, filename_xml) =20 os.environ["CPU_GATHER_PY"] =3D "true" os.environ["model"] =3D data["name"] diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index 2a41897538..84d37d0df4 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -7,21 +7,6 @@ fi =20 data=3D`cat` =20 -xml() -{ - hex=3D'\(0x[0-9a-f]\+\)' - matchCPUID=3D"$hex $hex: eax=3D$hex ebx=3D$hex ecx=3D$hex edx=3D$hex" - substCPUID=3D"" - - matchMSR=3D"$hex: $hex\(.......[0-9a-f]\)" - substMSR=3D"" - - echo "" - echo "" - sed -ne "s/^ *$matchCPUID$/ $substCPUID/p; s/^ *$matchMSR$/ $substMS= R/p" - echo "" -} - json() { first=3Dtrue @@ -36,9 +21,6 @@ json() done } =20 -xml <<<"$data" >$fname.xml -echo $fname.xml - json <<<"$data" >$fname.json if [[ -s $fname.json ]]; then echo $fname.json --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049588; cv=none; d=zohomail.com; s=zohoarc; b=PDCCoyFsUabzZ9MSJiMJ9RFAkt5hDXIn77nQVnX0YT8hmMXu/Ui6U6IBb6KvSCojWtjUGsjPvPD8JHcB7HARNgVbAYjLk6aqGftjDwRZTzSNQFG6NlkwMaPTEIJ0BOD3bvQkEPn1iuOj1FBNB0FuLzai6BmFWAU9fTBAuk+C7H4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049588; h=Content-Type:Content-Transfer-Encoding:Cc: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=uPYTqmZl1uMZwqQEY2buTyK6t0ccFliq9VUI7hF/mfQ=; b=lukfrn//MvPEccfXQmoRIaPlA2Yk9ZPPinI+5mdwofGcQPscaXZ3CIqwU8Oft43CHutkVUZUFkXIe+PTjKOxS+scULTnds2i5egBk8w3a4ZX2xZrNzMiFH/5usWnounZx2BBJSZ9crP1JUSgWpWDsPMf7wbCQVuCKGj1r2i6WJQ= 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 1608049587938436.82734684738523; Tue, 15 Dec 2020 08:26:27 -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-429-1zpDpM9VOgivhUjeCus8Hg-1; Tue, 15 Dec 2020 11:26:03 -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 73307100A254; Tue, 15 Dec 2020 16:25:47 +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 35CA87444C; Tue, 15 Dec 2020 16:25:47 +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 E514F5002F; Tue, 15 Dec 2020 16:25:46 +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 0BFGPfcK025825 for ; Tue, 15 Dec 2020 11:25:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 420565D9E4; Tue, 15 Dec 2020 16:25:41 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74A835D9D7; Tue, 15 Dec 2020 16:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049582; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=uPYTqmZl1uMZwqQEY2buTyK6t0ccFliq9VUI7hF/mfQ=; b=eI+osu6OsGsX9lrX4Dam79k3fm5Y21YiDXugkydnKZ8iHEnCA0FblDLTiuXm4MtUY8jFtf 4c9SnWNDOgV33BEju2kKb6NOMRCpKs7sGms6OT5PWz/LwV5ZGFr/nDTNZbFI5MSTMez3CX maLfW0LSgmByhF9eAaeFjkvwaEnnJwU= X-MC-Unique: 1zpDpM9VOgivhUjeCus8Hg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 21/29] cpu-parse: Move json output to new script Date: Tue, 15 Dec 2020 17:25:07 +0100 Message-Id: <20201215162515.53742-22-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 30 ++++++++++++++++++++++++++++++ tests/cputestdata/cpu-parse.sh | 16 ---------------- tests/cputestdata/cpu-reformat.py | 9 --------- 3 files changed, 30 insertions(+), 25 deletions(-) delete mode 100755 tests/cputestdata/cpu-reformat.py diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index bc5c7dbb15..2c3f39ab35 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -244,13 +244,43 @@ def output_xml(data, filename): f.write("\n") =20 =20 +def output_json(data, filename): + replies =3D list() + for reply in data["model"]: + if "QMP" in reply: + continue + if "timestamp" in reply: + continue + if "return" in reply and not reply["return"]: + continue + replies.append(reply) + + if not replies: + return + + if "model-expansion" not in [reply.get("id") for reply in replies]: + exit( + "Error: Missing query-cpu-model-expansion reply in " + "{}".format(filename)) + + print(filename) + with open(filename, "wt") as f: + for reply in replies: + if reply is not replies[0]: + f.write("\n") + json.dump(reply, f, indent=3D2) + f.write("\n") + + def parse(args): data =3D json.load(sys.stdin) =20 filename =3D parse_filename(data) filename_xml =3D "{}.xml".format(filename) + filename_json =3D "{}.json".format(filename) =20 output_xml(data, filename_xml) + output_json(data, filename_json) =20 os.environ["CPU_GATHER_PY"] =3D "true" os.environ["model"] =3D data["name"] diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index 84d37d0df4..aeb6e4e07f 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -7,23 +7,7 @@ fi =20 data=3D`cat` =20 -json() -{ - first=3Dtrue - sed -ne '/{"QMP".*/d; - /{"return": {}}/d; - /{"timestamp":.*/d; - /^{/p' <<<"$data" | \ - while read; do - $first || echo - first=3Dfalse - $(dirname $0)/cpu-reformat.py <<<"$REPLY" - done -} - -json <<<"$data" >$fname.json if [[ -s $fname.json ]]; then - echo $fname.json if ! grep -q model-expansion $fname.json; then echo "Missing query-cpu-model-expansion reply in $name.json" >&2 exit 1 diff --git a/tests/cputestdata/cpu-reformat.py b/tests/cputestdata/cpu-refo= rmat.py deleted file mode 100755 index fcc6b8ab41..0000000000 --- a/tests/cputestdata/cpu-reformat.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import json - -dec =3D json.JSONDecoder() -data, pos =3D dec.raw_decode(sys.stdin.read()) -json.dump(data, sys.stdout, indent=3D2, separators=3D(',', ': ')) -print("") --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049870; cv=none; d=zohomail.com; s=zohoarc; b=I5e73nhAKIiVky2M1qoxUB06VuKf5+dKAi6NDCxwBshcirpJMZqJpQHC1bBKtZDdDu3qcLEThgO3uSX0V/FNtFh5F9SbT2U61p7U/AqOebGgaz/SeAyJ6gsyJiEbHv9pwcgSfmG/3WUfv0YgMsIYlyI20Qf9s20wwjFmYunoSTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049870; h=Content-Type:Content-Transfer-Encoding:Cc: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=UUtXi2+p1iHJOIKW0Qtw27mjwwE0QHBhUia+tbyf5x8=; b=ViXiT+1TIWbU87fnJ330LxV/cZgXX7FeXVikiK0oosbRtuEkHhHeOe2M+5mmauuEvV4wDGrmU/ftpDZ1QdInmwi2Hg/tWvjFz/MQcUhwURHnh5N4EilRR7EFN07449RpTXtk8aBij99aR/LDnTHsiPmL63iogEJea1+VIMre9pE= 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 160804986915979.4809736065805; Tue, 15 Dec 2020 08:31:09 -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-552-4tpQblayNGaOBksAKoFfwQ-1; Tue, 15 Dec 2020 11:26:09 -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 47963195D593; Tue, 15 Dec 2020 16:25:50 +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 0F6CC10023B2; Tue, 15 Dec 2020 16:25:50 +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 C3A8D5002E; Tue, 15 Dec 2020 16:25:49 +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 0BFGPgdF025837 for ; Tue, 15 Dec 2020 11:25:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 628DC5D9D7; Tue, 15 Dec 2020 16:25:42 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 990015D9E4; Tue, 15 Dec 2020 16:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049624; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=UUtXi2+p1iHJOIKW0Qtw27mjwwE0QHBhUia+tbyf5x8=; b=cHrsl2Fv3ElyMG/axLyS/vhbMn6lvA941wvsGRrBZas2cJ72t7fhFkHhHFI1OgdFCBlO59 92mM6GX/I0kcfAyN/v3uQNvPucb4dimzjXBwzD/AnxbD3JU8oLbVns/PHfWs3Vb5cUOtBA SmSjTGUAIhAV437lhX4cIeedoayp9wg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049866; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=UUtXi2+p1iHJOIKW0Qtw27mjwwE0QHBhUia+tbyf5x8=; b=Kb56D35kHfkAKQYSyNAj/vxkEoZ9Nqp7T0+7eFHZoR/AKdeBgjkfLOekYMyjnxA6JMwcLn bmE1oHOCLbaHWhO9MzQRj78d3Rvf6IDAX3wNQpQbFrqHxOlAaqpm9Fu9IcVyGiobENsJkF R8OkameneqMEng07BUzmOTmlCiRYC7g= X-MC-Unique: 4tpQblayNGaOBksAKoFfwQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 22/29] cpu-parse: Move call to cpu-cpuid.py to new script Date: Tue, 15 Dec 2020 17:25:08 +0100 Message-Id: <20201215162515.53742-23-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 10 ++++++++++ tests/cputestdata/cpu-parse.sh | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 2c3f39ab35..373f179c8d 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -282,6 +282,16 @@ def parse(args): output_xml(data, filename_xml) output_json(data, filename_json) =20 + if not os.path.isfile(filename_json): + return + if os.path.getsize(filename_json) =3D=3D 0: + return + + output =3D subprocess.check_output( + ["./cpu-cpuid.py", "diff", filename_json], + universal_newlines=3DTrue) + print(output) + os.environ["CPU_GATHER_PY"] =3D "true" os.environ["model"] =3D data["name"] os.environ["fname"] =3D filename diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh index aeb6e4e07f..eea15ded2e 100755 --- a/tests/cputestdata/cpu-parse.sh +++ b/tests/cputestdata/cpu-parse.sh @@ -6,13 +6,3 @@ if [ -z "${CPU_GATHER_PY}" ]; then fi =20 data=3D`cat` - -if [[ -s $fname.json ]]; then - if ! grep -q model-expansion $fname.json; then - echo "Missing query-cpu-model-expansion reply in $name.json" >&2 - exit 1 - fi - $(dirname $0)/cpu-cpuid.py diff $fname.json -else - rm $fname.json -fi --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049702; cv=none; d=zohomail.com; s=zohoarc; b=i4UbNtNKIu0sa8eO0xyvaZM8KwDeOGysK73M0irVwbp9vukKw6SDHQzAIEsYhhlhdasXpXa3pzO/a+R0yOZ4jNZ7/oHHUt18ie1FaqRJttU0WxiVqjpvJP/TwdSNwGvKTthyYffbKYSYgnC0b88DHHcR10nQ2nd86tHYxbz3mk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049702; h=Content-Type:Content-Transfer-Encoding:Cc: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=dtgB8W4aLcwiiAAS9+uIRn6qU5CK+EOVGuqJn/aacnk=; b=Dn4ML4svaNosh+wC0eHfBFWlNxv8u6fegcUS15+7WKYV1p5Db0Seq6HZUF7dWXJmuDNzMZTjt6dnhPcAPIz03RtMFvoS+EKiFH3j7+EvbnfOgi6MNKRJpkSqWCjsefpiQwz16Zq+hRarEYCr7J0dRbTyznl1j5F9xdc2jzbtQuM= 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 1608049702568369.2240096371221; Tue, 15 Dec 2020 08:28:22 -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-214-TPencJGQOACuhaxF_iGiig-1; Tue, 15 Dec 2020 11:26:12 -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 B913681F02F; Tue, 15 Dec 2020 16:25:56 +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 97DE31894E; Tue, 15 Dec 2020 16:25:56 +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 650A05002C; Tue, 15 Dec 2020 16:25:56 +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 0BFGPhdF025851 for ; Tue, 15 Dec 2020 11:25:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7B90C5D9E8; Tue, 15 Dec 2020 16:25:43 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5B235D9D7; Tue, 15 Dec 2020 16:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049626; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=dtgB8W4aLcwiiAAS9+uIRn6qU5CK+EOVGuqJn/aacnk=; b=jTds+Qx9DPeTZBNOSXsGQf0tNi2Aepy/TzO0KuZdEnUpRdXl2fs7VHTvWYKPvv0OifakLF HxF5bpKXRmNWBXV3gSr2PY9wR72BGusHf65sI3oKTJ8ksw1xphhq3rxzbbIh0ESPGGQypa pZibeav9btVudaVkgVkLhOdftojiH8g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049697; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=dtgB8W4aLcwiiAAS9+uIRn6qU5CK+EOVGuqJn/aacnk=; b=gSUFwvMgycTUNKSatsXvfRocFVcg4u+YYT1tfKVuQcvntFooevv0HRrAc5ndaO+8V6ygY4 i2kzixa+2K2+h7mSZvmwrIjeGad+P+JRXiIoh3Z1KjbOjA/ZG2IIHIsv63agLE10fy+JHe UTzoIA7Ui72R+My2Z4Y1AVdLsZM0qcs= X-MC-Unique: TPencJGQOACuhaxF_iGiig-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 23/29] cpu-parse: Delete old script Date: Tue, 15 Dec 2020 17:25:09 +0100 Message-Id: <20201215162515.53742-24-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 31 ------------------------------- tests/cputestdata/cpu-parse.sh | 8 -------- 2 files changed, 39 deletions(-) delete mode 100755 tests/cputestdata/cpu-parse.sh diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 373f179c8d..b6acae9eb7 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -292,37 +292,6 @@ def parse(args): universal_newlines=3DTrue) print(output) =20 - os.environ["CPU_GATHER_PY"] =3D "true" - os.environ["model"] =3D data["name"] - os.environ["fname"] =3D filename - output =3D subprocess.check_output( - "./cpu-parse.sh", - input=3Doutput_to_text(data), - stderr=3Dsubprocess.STDOUT, - universal_newlines=3DTrue) - print(output) - - -def output_to_text(data): - output =3D list() - - output.append("model name\t: {}".format(data["name"])) - - output.append("CPU:") - for leave in data["leaves"]: - output.append(" {}".format(leave)) - output.append("") - - if data["via"] is not None: - output.append("MSR{}:".format(data["via"])) - for key, value in sorted(data["msr"].items()): - output.append(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) - - for o in data["model"]: - output.append(json.dumps(o)) - - return "\n".join(output) - =20 def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh deleted file mode 100755 index eea15ded2e..0000000000 --- a/tests/cputestdata/cpu-parse.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ -z "${CPU_GATHER_PY}" ]; then - echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instea= d." - exit 1 -fi - -data=3D`cat` --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049982; cv=none; d=zohomail.com; s=zohoarc; b=gcFS+SnIgL1DaT0znm8YfXFIWXRaFoNnlANRQQwamoP020YhfjxS1zSJvgwmE5xKDPxxyZjxoaQzKkK5DLcZnobGD8gXGXlX5vgDWHmWD3bnfzm5n/owVfOME5r/c+RU7HcsExXPzemKF2LrIpK1mN/4KhmXddr5mAF6esINB8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049982; h=Content-Type:Content-Transfer-Encoding:Cc: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=D10jg+gmAFYFON7hJKGNNk6/nNxKjVtS604ga2ZlCK8=; b=N+ut2bpD1Go+zGbIWkrAD16JBvNJkB11D+swuSBaqQknIvUHZ8iqXlcpgU1eUcjyLUzrCw2Lu3IqPC/uIZAaE4ozxUZcVr8DfnR7ixc7VVPtNHmRrqeot4tIjVLJRfobz3+HebB0Cgds5xkbgbHu2ru+LdTHB1G3tTNJDRlJIl4= 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 1608049982189644.335684296528; Tue, 15 Dec 2020 08:33: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-296-GfV6s1p4M8m_-5wLS38IMA-1; Tue, 15 Dec 2020 11:32:54 -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 96FD2CE647; Tue, 15 Dec 2020 16:32:00 +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 7591B18A60; Tue, 15 Dec 2020 16:32:00 +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 3DF6050037; Tue, 15 Dec 2020 16:32:00 +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 0BFGPiSE025864 for ; Tue, 15 Dec 2020 11:25:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id A33A35D9D7; Tue, 15 Dec 2020 16:25:44 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id D84CE5D9F1; Tue, 15 Dec 2020 16:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049978; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=D10jg+gmAFYFON7hJKGNNk6/nNxKjVtS604ga2ZlCK8=; b=hmmxkV/f+owJd5feGA0TN4W1YAXbtV/HOo5YausWDVPVjC3qAupPd681WvwHprtRWk6YzI J8uDA5xljPnvHW3/hkfPZ+QDYd/BFvhLOmDAzQPg/f9zeN7y2n7PIcf5xPXkxaVdarly0a KXBM5NvHZXjJ9xqcvlBodlJo7YryVn8= X-MC-Unique: GfV6s1p4M8m_-5wLS38IMA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 24/29] cpu-gather: Ignore empty responses from qemu Date: Tue, 15 Dec 2020 17:25:10 +0100 Message-Id: <20201215162515.53742-25-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index b6acae9eb7..10dbeb87cf 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -93,8 +93,12 @@ def call_qemu(qemu, qmp_cmds): exit("Error: File not found: '{}'.".format(qemu)) =20 for line in output.split("\n"): - if line: - yield json.loads(line) + if not line: + continue + response =3D json.loads(line) + if "return" in response and not response["return"]: + continue + yield response =20 =20 def gather_model(args): --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049679; cv=none; d=zohomail.com; s=zohoarc; b=FshaziISwufdzvMULikuncssL8zAo/e5FHnPzn5zscp3faZYQQ0etg22DYaJY19hP6OA2Nz56id9FBISGT4ydZWqA091Wf5DMAsy8Q/whyWt+Xs7VagCb+u1wE00rCjXjAUCpUZgoA88CmqzBvPXyK6nSK13PqvuenoRwl7loYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049679; h=Content-Type:Content-Transfer-Encoding:Cc: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=yJaqLKiCKFzuFsPRUJA9kY7D7xdMFiPsOKRirEVLVSA=; b=WP7D2Pbh7j8tFZfk7USJyZ2d06TbAOKOesiJlQxxLxxIWzBj3Pz7e7MHyHnng6Wg0p3XwhGE7AWPMzQQwq3U1eC5k/tKrk9X2UMjYgu5PJSr1/4pUsN5rQapPKVugjcOAB0W9HuVWUhyQ3RRYYkpG0L2W4bte7eoMeyuElV5Ri0= 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 1608049679571472.25015706365957; Tue, 15 Dec 2020 08:27:59 -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-36-0XwKKjWHOai_imJTLW1GPw-1; Tue, 15 Dec 2020 11:26:14 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9034B104ED3F; Tue, 15 Dec 2020 16:25:59 +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 392ED37A0; Tue, 15 Dec 2020 16:25:59 +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 035425002E; Tue, 15 Dec 2020 16:25:59 +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 0BFGPj02025874 for ; Tue, 15 Dec 2020 11:25:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA46D5D9E3; Tue, 15 Dec 2020 16:25:45 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04D915D9D7; Tue, 15 Dec 2020 16:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049676; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=yJaqLKiCKFzuFsPRUJA9kY7D7xdMFiPsOKRirEVLVSA=; b=VUJb+wcQVQr7yA/gXVTK8Bn/qnpwka9q1iziiw8zVOeT3CZ8cYPqT5onbfNNsAqUEFXZho eF47sqhMYc5oxGY9hjvIcBz4Y005Wi7N2O8+vdd4qFvkIfxl4J/kmilPods5HmHmuheuMo RQPgWhf1Yx8ExNWbSG30aPb9zJCDUkg= X-MC-Unique: 0XwKKjWHOai_imJTLW1GPw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 25/29] cpu-gather: Ignore shutdown messages from qemu Date: Tue, 15 Dec 2020 17:25:11 +0100 Message-Id: <20201215162515.53742-26-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.15 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 10dbeb87cf..49c72df320 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -98,6 +98,8 @@ def call_qemu(qemu, qmp_cmds): response =3D json.loads(line) if "return" in response and not response["return"]: continue + if response.get("event") =3D=3D "SHUTDOWN": + continue yield response =20 =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608051899; cv=none; d=zohomail.com; s=zohoarc; b=nbiGEzf8nBY/pGthG9nh1rfecCRKvTTEbMbg6rRHpG5qzTgPVSl/HLc6DsWsQmGehxMvxo6xNo1i+xlEioNxbVr3SXFPH6flwCP4AQ8dqf8KLh6OdAWqVd1eWgjxcaoe+nxeTT1qG5Ge03gfiBrkEvnAbDaDkRHew7CVW8b5ATg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608051899; h=Content-Type:Content-Transfer-Encoding:Cc: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=L/E3RNENtg48Bwsia32GOogZ0/MgLHwnkhmNG+w0NDg=; b=ETn7rKR3/C5hBm06DZtCn1jWA+3f5WPiUnB4yFpxQSk0jSbk37M/0WvpBiDajkdsFgR/XFHBhgz7IcVqVL23bVGJ4Pl6FymxOwC0EvEH/P7vrNv8mHWcQiKAs0xA36WKpwuf3i81I8WahDXMekWo6BGs1FPEWE8u4NgQZQ9mubw= 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 1608051899291447.39211660972387; Tue, 15 Dec 2020 09:04:59 -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-437-vrgHrBReNNuzup0f6cj5YQ-1; Tue, 15 Dec 2020 11:26:08 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4BD0100F353; Tue, 15 Dec 2020 16:25:52 +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 A965460C17; Tue, 15 Dec 2020 16:25:52 +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 73B41180954D; Tue, 15 Dec 2020 16:25:52 +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 0BFGPkcP025890 for ; Tue, 15 Dec 2020 11:25:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id E492B5D9F6; Tue, 15 Dec 2020 16:25:46 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C7BF5D9D7; Tue, 15 Dec 2020 16:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=L/E3RNENtg48Bwsia32GOogZ0/MgLHwnkhmNG+w0NDg=; b=NH7AZB2+cIZVJrduQkj2ZJmH9lU30+btPbGp3XU9J/rFdkFQunS75/2eW8HeLZTbOp1QSV 5OzTzksu3xYcWjlATzDyDOUDcgFEYClu4eGGSfKRTZJIsXSE1+GYiuPoxAeeSCK0/td2H6 KeEUT/Z+Ti9KJcRd9g932lHvR20B/ns= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608051051; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=L/E3RNENtg48Bwsia32GOogZ0/MgLHwnkhmNG+w0NDg=; b=Y8hOg4zRqyKg5dyp/zTRaFF7GW/e7ncDlwWHEas8X5QKfqvJvlWKJRjkrr1KgqXgLvxKzB c7KmkgcdKMxNzYdE4rzr8Nfdz/ulpNmFwBrmNEoFg4SD/ep8AXXAQQ4MkqKWtbkWwgla3y dZFz1F3dhrY8Ssf3tZ852PFSUyhGKZo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608051655; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=L/E3RNENtg48Bwsia32GOogZ0/MgLHwnkhmNG+w0NDg=; b=DmMSDv6EoOoW2/b6DCunmhgdlip5omqdhNGcrf31WEYHIDuCFIP6xdaPAtVmsLZtOSFOBm SkEfxPt/uzbrFOHNVqe5h1RfzlP/65iTXUCp52xUR2ANWp+T90Hjs3Xu/LP6TQEVlpO36u ObVab0GQj8r3kLUa3QkvvlMJ9/zEdCk= X-MC-Unique: vrgHrBReNNuzup0f6cj5YQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 26/29] cpu-gather: Parse cpuid leaves early Date: Tue, 15 Dec 2020 17:25:12 +0100 Message-Id: <20201215162515.53742-27-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.12 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) (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 48 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 49c72df320..fe660c486e 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -24,6 +24,15 @@ def gather_name(args): =20 =20 def gather_cpuid_leaves(args): + leave_pattern =3D re.compile( + "^\\s*" + "(0x[0-9a-f]+)\\s*" + "(0x[0-9a-f]+):\\s*" + "eax=3D(0x[0-9a-f]+)\\s*" + "ebx=3D(0x[0-9a-f]+)\\s*" + "ecx=3D(0x[0-9a-f]+)\\s*" + "edx=3D(0x[0-9a-f]+)\\s*$") + cpuid =3D args.path_to_cpuid or "cpuid" try: output =3D subprocess.check_output( @@ -36,11 +45,16 @@ def gather_cpuid_leaves(args): "'http://www.etallen.com/cpuid.html'.".format(e.filename)) =20 for line in output.split("\n"): - if not line: + match =3D leave_pattern.match(line) + if not match: continue - if line =3D=3D "CPU:": - continue - yield line.strip() + yield { + "eax_in": int(match.group(1), 0), + "ecx_in": int(match.group(2), 0), + "eax": int(match.group(3), 0), + "ebx": int(match.group(4), 0), + "ecx": int(match.group(5), 0), + "edx": int(match.group(6), 0)} =20 =20 def gather_msr(): @@ -214,23 +228,14 @@ def parse_filename(data): =20 =20 def output_xml(data, filename): - leave_pattern =3D re.compile( - "^\\s*" - "(0x[0-9a-f]+)\\s*" - "(0x[0-9a-f]+):\\s*" - "eax=3D(0x[0-9a-f]+)\\s*" - "ebx=3D(0x[0-9a-f]+)\\s*" - "ecx=3D(0x[0-9a-f]+)\\s*" - "edx=3D(0x[0-9a-f]+)\\s*$") - leave_template =3D \ " \n" =20 msr_template =3D " \n" @@ -239,9 +244,8 @@ def output_xml(data, filename): with open(filename, "wt") as f: f.write("\n".format(data["name"])) f.write("\n") - for line in data["leaves"]: - match =3D leave_pattern.match(line) - f.write(leave_template.format(*match.groups())) + for leave in data["leaves"]: + f.write(leave_template.format(leave)) for key, value in sorted(data["msr"].items()): f.write(msr_template.format( int(key), --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049582; cv=none; d=zohomail.com; s=zohoarc; b=npOy8ftZrTt028bNDbmPt2AG8Q/V/D4LIIR3g+/+bnxPU9ZW8poVWzyAw3SoM//yVnZPf8OXF+wBR6LFG2t4Yn79qVcQVH3Nk/dZaexEwuI58aEAOdroPHfzE7wvQ7JwrD4cT82nVdWMlbQOg/J+imTmt9LEduGMFqKgKwv6BPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049582; h=Content-Type:Content-Transfer-Encoding:Cc: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=6fh1oxxD7PEBP0gC3Eqzh38ifholsjTFIm5VQG9tz0Y=; b=Y7GlLbLBvHWuVTJ4ZN9FrrNzM79Astreh5FRwWFFZKlvc+niQrxsViPIVjalZq3ZPrztc16w6zWksMj1VB8hfgAmynVXtwHNDpe4+XLUCNHUeySCVonpmlst2AZ5vbQX05rK+eLpcmb/WOI6vpIdMtxVSb7TNrLqLAzhJ/j+2Ow= 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 1608049582844675.3761780964953; Tue, 15 Dec 2020 08:26:22 -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-335-QLcxpp2ZMw66LgJo1qLHOQ-1; Tue, 15 Dec 2020 11:26:12 -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 76A4410051A8; Tue, 15 Dec 2020 16:26:02 +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 4F6035C224; Tue, 15 Dec 2020 16:26:02 +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 12A7D1809CA0; Tue, 15 Dec 2020 16:26:02 +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 0BFGPmWx025901 for ; Tue, 15 Dec 2020 11:25:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 06FEF5D9E3; Tue, 15 Dec 2020 16:25:48 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 477E55DA34; Tue, 15 Dec 2020 16:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049579; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=6fh1oxxD7PEBP0gC3Eqzh38ifholsjTFIm5VQG9tz0Y=; b=b2lKP3hTLFjSjFFkfsSzKltxlChx25oO1abOESVK1ZxmvSdnD60bVwSRJbMCj+KhBITWNv mXDH66hrQe7Ttg97mCMk2ed3wzqTBcTLW1esHHrPTklLKKif7fO11y9YYwHk1ZGwwAbCsZ 69ww8+wwyNxlRvC9kMZagUXR/c5Iz9A= X-MC-Unique: QLcxpp2ZMw66LgJo1qLHOQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 27/29] cpu-gather: Allow gathering and parsing data in one step. Date: Tue, 15 Dec 2020 17:25:13 +0100 Message-Id: <20201215162515.53742-28-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Make ./cpu-gather.py --gather --parse an alias of ./cpu-gather.py [--gather] | ./cpu-gather.py --parse Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index fe660c486e..46997c8a48 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -282,9 +282,7 @@ def output_json(data, filename): f.write("\n") =20 =20 -def parse(args): - data =3D json.load(sys.stdin) - +def parse(data): filename =3D parse_filename(data) filename_xml =3D "{}.xml".format(filename) filename_json =3D "{}.json".format(filename) @@ -320,16 +318,16 @@ def main(): help=3D"Path to qemu. " "If unset, will try '/usr/bin/qemu-system-x86_64', " "'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.") - - mode =3D parser.add_mutually_exclusive_group() - mode.add_argument( + parser.add_argument( "--gather", action=3D"store_true", - help=3D"Acquire data on target system. This is the default.") - mode.add_argument( + help=3D"Acquire data on target system. This is the default. " + "If '--parse' is not set, outputs data on stdout.") + parser.add_argument( "--parse", action=3D"store_true", - help=3D"Parse data for libvirt use.") + help=3D"Parse data for libvirt use. " + "If '--gather' is not set, expects input on stdin.") =20 args =3D parser.parse_args() =20 @@ -348,9 +346,13 @@ def main(): =20 if args.gather: data =3D gather(args) - json.dump(data, sys.stdout, indent=3D2) - else: - parse(args) + if not args.parse: + json.dump(data, sys.stdout, indent=3D2) + + if args.parse: + if not args.gather: + data =3D json.load(sys.stdin) + parse(data) =20 =20 if __name__ =3D=3D "__main__": --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608049983; cv=none; d=zohomail.com; s=zohoarc; b=PVz/8VVJMVt1tWNtm7kgf7NiuDLZuGSb08CVuqkzS6fibnM0cCDY+OG8F5a6/xUmo1OtbK33m2EdgGNPorEaJu8Wl7T47n/29DeG49Itzgb9sPUIfI+6tlTMU8pEnKHJQKLOkFpHhcwhWouQiJhX8AtljILcwR2m9MJ8TNvAoBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608049983; h=Content-Type:Content-Transfer-Encoding:Cc: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=HnCmhciThR9w8peGnlfzB6cK2IgwG8hsAqPxYS3XntI=; b=T8u3W1Xz3jp2Qk54vitii4vEZNQYdXHNVSjLY0njWAm1OwZVnDUd+r3zLKnXtxtxQoOOzPze2SJPcgocj10Euy3RwLl/5f0ir/RTp9jU9PmxY5ydSJIOvN/4JWRiOgFT+vUMbGTVwV2UDWDj5Qw7gIAhPfA9lLeqZ9QnwIfVf90= 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 1608049981716415.4088654140969; Tue, 15 Dec 2020 08:33:01 -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-328-vprDf5w4PBuTReppTVHj8g-1; Tue, 15 Dec 2020 11:32:54 -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 6F3D4CE653; Tue, 15 Dec 2020 16:32:03 +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 4AE225C224; Tue, 15 Dec 2020 16:32:03 +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 159231809C9F; Tue, 15 Dec 2020 16:32:03 +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 0BFGPnxZ025916 for ; Tue, 15 Dec 2020 11:25:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A0BF5D9E3; Tue, 15 Dec 2020 16:25:49 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62AA95D9D7; Tue, 15 Dec 2020 16:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049978; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=HnCmhciThR9w8peGnlfzB6cK2IgwG8hsAqPxYS3XntI=; b=GZ4W1yYMWDmTFWH5Vt43+rHvIZA9T1q1lPIXrML7v4wX+88Eqvtp2ELCy/qILebpK9YC0o gl338kNOJ0Vhq2Pb8OhfrHJxTDD8Ivf7fLedAm0p6dVAvxstpmlB18t4925e6yha3m8Zsn G/R3wyGOeXGgdduRNUE9CHipRIDxJpo= X-MC-Unique: vprDf5w4PBuTReppTVHj8g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 28/29] cpu-gather: Prepare gather_msr for reading multiple msr Date: Tue, 15 Dec 2020 17:25:14 +0100 Message-Id: <20201215162515.53742-29-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 46997c8a48..9c9eec6d93 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -58,24 +58,29 @@ def gather_cpuid_leaves(args): =20 =20 def gather_msr(): - IA32_ARCH_CAPABILITIES_MSR =3D 0x10a + msrs =3D dict() + addresses =3D [ + 0x10a, # IA32_ARCH_CAPABILITIES_MSR + ] KVM_GET_MSRS =3D 0xc008ae88 =20 try: with open("/dev/cpu/0/msr", "rb") as f: - f.seek(IA32_ARCH_CAPABILITIES_MSR) - buf =3D f.read(8) - msr =3D struct.unpack("=3DQ", buf)[0] - return "", {IA32_ARCH_CAPABILITIES_MSR: msr} + for addr in addresses: + f.seek(addr) + buf =3D f.read(8) + msrs[addr] =3D struct.unpack("=3DQ", buf)[0] + return "", msrs except IOError as e: print("Warning: {}".format(e), file=3Dsys.stderr) =20 try: - bufIn =3D struct.pack("=3DLLLLQ", 1, 0, IA32_ARCH_CAPABILITIES_MSR= , 0, 0) with open("/dev/kvm", "rb") as f: - bufOut =3D fcntl.ioctl(f, KVM_GET_MSRS, bufIn) - msr =3D struct.unpack("=3DLLLLQ", bufOut)[4] - return " via KVM", {IA32_ARCH_CAPABILITIES_MSR: msr} + for addr in addresses: + bufIn =3D struct.pack("=3DLLLLQ", 1, 0, addr, 0, 0) + bufOut =3D fcntl.ioctl(f, KVM_GET_MSRS, bufIn) + msrs[addr] =3D struct.unpack("=3DLLLLQ", bufOut)[4] + return " via KVM", msrs except IOError as e: print("Warning: {}".format(e), file=3Dsys.stderr) =20 --=20 2.26.2 From nobody Wed May 15 10:47:49 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=1608050217; cv=none; d=zohomail.com; s=zohoarc; b=RJ+I3WDiYT7frkHBdRp8E4BU8VT1WGznaiRKWlJsrQKlYkAYK2uI+5NViIZRoNeOJPLxST8QaeqRGTMUtjB08v4/GyPCCiUZTHwGvdgo9UYnyPFaBIIk+5kjQpwr5JHPaEv8LzOJHAqcQpyB93Tma9r4tQBpBwZy/h3sbET+Qlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050217; h=Content-Type:Content-Transfer-Encoding:Cc: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=WlPJd+18cfyLZgDtJcMObHK21p3/GOvy4L4/OG34hzs=; b=IhM4C1LL984UqLXeuMKevx/12+lYYZ9Cga2ejgmI1M86PCi4cP7c0lrRUBTvLQrd1suU72u/kPQkFf4xtJ959yWox3ZpskEVj4fU8jC3s/T0fyd5qizWcdnj6wJlRVsDZG4Tkw5mFyDlesh3zqA9M3SI7KI/W46YzMrssb5Hmi0= 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 1608050216755677.0984032111558; Tue, 15 Dec 2020 08:36:56 -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-360-EfK5ylMvPked2By9oytfVg-1; Tue, 15 Dec 2020 11:32:51 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90493809DE9; Tue, 15 Dec 2020 16:32:06 +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 6842A60C15; Tue, 15 Dec 2020 16:32:06 +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 E7B421809CAD; Tue, 15 Dec 2020 16:32:05 +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 0BFGPoC5025925 for ; Tue, 15 Dec 2020 11:25:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 43A145D9E4; Tue, 15 Dec 2020 16:25:50 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 825725D9D7; Tue, 15 Dec 2020 16:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049973; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=WlPJd+18cfyLZgDtJcMObHK21p3/GOvy4L4/OG34hzs=; b=UooXJbeJdz8Id3RsRseI5xdmZnQxzIHgD4OY+qUw24dgmhH0fJmyYOveCq5dWrA6v2MyGP DJXVqrFlNVjVmC+eV0RgjF+WN1uRofvjgwLGa0S89uRdoqhGuotcC5VxTOYiAv73gq+qxK 5qRLc7qru1UPzPjOVicWgk/BxXN4W8I= X-MC-Unique: EfK5ylMvPked2By9oytfVg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 29/29] cpu-gather: Add IA32_CORE_CAPABILITY_MSR Date: Tue, 15 Dec 2020 17:25:15 +0100 Message-Id: <20201215162515.53742-30-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.12 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" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 9c9eec6d93..a01c615504 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -61,6 +61,7 @@ def gather_msr(): msrs =3D dict() addresses =3D [ 0x10a, # IA32_ARCH_CAPABILITIES_MSR + 0xcf, # IA32_CORE_CAPABILITY_MSR ] KVM_GET_MSRS =3D 0xc008ae88 =20 --=20 2.26.2