From nobody Mon Feb 9 17:23:42 2026 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 --- 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