From nobody Fri Nov 21 10:11:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1762445046; cv=none; d=zohomail.com; s=zohoarc; b=mUWkeQgmifJeNc08HiB6YcQXdPY7DL9+Gtd+L1R0cIjOjNZPuhYFNyW98Yn+fIy3Hir7xgyuNrhXODwuDIUGuRpfnSkFlxG5aiaWiKfmmtvsrlw8Jo1THTlB1NgICO0wd1rJa5P1BT1sobNDLV3y4ghRW4fkr/uYjI0qVrsqi1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762445046; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Cc8mjfyh4+JY3kqn3siwYOvh2Bsq0fa0xxuVoaLazsI=; b=X03YnivakycqwhBrJjaH67YMNRu1vuMSacZ6p0kRzRIGuyYa+oSpCsoooosP+ko4lfsjljnZicttxP47auUSI6xKjkK7kVrTEbK+V0Nzs8GlKyGXQYByIs14Tm49cypzp1rmMBwfB8NBWqUV42Tatfbd31bk6oe9RUpLnRNMCLs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1762445046564593.4862808020664; Thu, 6 Nov 2025 08:04:06 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id AE04D43F43; Thu, 6 Nov 2025 11:04:05 -0500 (EST) Received: from [172.19.199.29] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 1EA4543E60; Thu, 6 Nov 2025 10:55:42 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 675B841B52; Thu, 6 Nov 2025 10:52:08 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B8DB744141 for ; Thu, 6 Nov 2025 10:49:10 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-qbxdttR5Owe6pL33g50n2g-1; Thu, 06 Nov 2025 10:49:09 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7041A1955F68 for ; Thu, 6 Nov 2025 15:49:08 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 09EC2180049F for ; Thu, 6 Nov 2025 15:49:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762444150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cc8mjfyh4+JY3kqn3siwYOvh2Bsq0fa0xxuVoaLazsI=; b=h61hfVWhLLvQlD957nLrb+bobK/vbCoWEepZT4EdVDGJMcpA2oUyGVBpKUqhqw5h0E1dwc bLF5ipK4tSDNkYGQ0cbGkhDQbd4xAoxyIuAz9yvkNIt0OH1+LtLZCq8UShlxKf5LMU9lgM jzTBz715PJsk9c3jih8/InxPS8rHeEg= X-MC-Unique: qbxdttR5Owe6pL33g50n2g-1 X-Mimecast-MFC-AGG-ID: qbxdttR5Owe6pL33g50n2g_1762444148 To: devel@lists.libvirt.org Subject: [PATCH 11/29] cputest: Ignore missing MSRs in cpu-data.py Date: Thu, 6 Nov 2025 16:48:28 +0100 Message-ID: <7b055e4aee54712b949014b084b43230a5acef33.1762444082.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 8e_hpkXQ5i9bRoYAQusXOZ_WS5NzA3OjTFOx9Us5sPk_1762444148 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WEWNGPZSYRANYRY4MVIP25BB2IW67QRU X-Message-ID-Hash: WEWNGPZSYRANYRY4MVIP25BB2IW67QRU X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1762445048735158500 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark The current code made sense when we were reading only one MSR, but since we started reading more MSRs, the host CPU would have to support all of them otherwise the function would just return an empty dict. Signed-off-by: Jiri Denemark --- tests/cputestdata/cpu-data.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/cputestdata/cpu-data.py b/tests/cputestdata/cpu-data.py index b280eed436..4d89cd6d5c 100755 --- a/tests/cputestdata/cpu-data.py +++ b/tests/cputestdata/cpu-data.py @@ -151,20 +151,28 @@ def gather_msr(): try: with open("/dev/cpu/0/msr", "rb") as f: for addr in addresses: - f.seek(addr) - buf =3D f.read(8) - msrs[addr] =3D struct.unpack("=3DQ", buf)[0] - return "", msrs + try: + f.seek(addr) + buf =3D f.read(8) + msrs[addr] =3D struct.unpack("=3DQ", buf)[0] + except IOError: + pass + if msrs: + return "", msrs except IOError as e: print("Warning: {}".format(e), file=3Dsys.stderr) =20 try: with open("/dev/kvm", "rb") as f: 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 + try: + 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] + except IOError: + pass + if msrs: + return " via KVM", msrs except IOError as e: print("Warning: {}".format(e), file=3Dsys.stderr) =20 --=20 2.51.0