From nobody Sun Feb 8 13:26:17 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=1610117005; cv=none; d=zohomail.com; s=zohoarc; b=k4TWCnCFQGo3r4r723vSD2A3A1fEVLGDO4d4P5ZqZQ+UlQdfksXNXIcD00PQpVD7kAp4Iga5UADKNGk7lIqCh1n16T20XJ1BhPi+dbwH+pdAGIXHQwvPOIORutlaTRw9O0IG2hRZvIM78a+a3wSCFcOgC2KssfMl6dRXXVoW1m8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610117005; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=jB5wfiD04aGQ5Ig+4jpSjHfgW2mrAhmVsC+zEbLdOvI=; b=BHx+NHP6w4AKsWcoC9BgqstiQ2Egmx34zwcqiu5tXuqbcFTvPgCOKxsfpq5Gtt0wMKWHShSqzaYUGmh1pqD+gSG0jJlIPdwycpfzjcMhrVda1K5VNARoLMM9fTnZlOhh5fix+H5/IonF3VeVtOOq6jN/TEqD2sAWuZ3Xq+7wGsw= 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 1610117005483897.0110224761617; Fri, 8 Jan 2021 06:43:25 -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-450-DiAArkIjMkeD-D4croQugA-1; Fri, 08 Jan 2021 09:43:22 -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 96F581005513; Fri, 8 Jan 2021 14:43:15 +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 187FB5D760; Fri, 8 Jan 2021 14:43:14 +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 95F5D4BB7B; Fri, 8 Jan 2021 14:43:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 108Eh7P6007516 for ; Fri, 8 Jan 2021 09:43:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1036E10016FB; Fri, 8 Jan 2021 14:43:07 +0000 (UTC) Received: from work.redhat.com (ovpn-113-61.ams2.redhat.com [10.36.113.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53A1D10016FA; Fri, 8 Jan 2021 14:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610117004; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jB5wfiD04aGQ5Ig+4jpSjHfgW2mrAhmVsC+zEbLdOvI=; b=KCTcAIZ6fKS6F+XI3K/A7A5x3xcwn059K2OogJGCABbTg5ewT16C5n8n/u6OVbnRYrzEZd W9ZhiHIiIcPKM+SazaPhqxHy7fuIDkU4qLRv90SBtjiwBFlIOqh3IMh351KNjwR+FhEYk5 8UZFpwAF25GvdkFhvhxfu+ZshAJ9ZYQ= X-MC-Unique: DiAArkIjMkeD-D4croQugA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH] cpu-data: Pretend to always run on logical processor #0 Date: Fri, 8 Jan 2021 15:43:02 +0100 Message-Id: <20210108144302.145275-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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" The output of cpuid depends on the logical processor id the process runs on, as reflected by the "local apic id" present in cpuid leaves (eax=3D1,ebx=3D0), (eax=3D11,ebx=3D0), and (eax=3D11,ebx=3D1). This produces arbitrary changes in the output files that complicate comparisons. This patch masks the occurences of the local apic id with 0x00, so that two consecutive runs of "./cpu-data.py gather" produce identical results. Signed-off-by: Tim Wiederhake --- tests/cputestdata/cpu-data.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/cputestdata/cpu-data.py b/tests/cputestdata/cpu-data.py index a41f1d025c..df71132c25 100755 --- a/tests/cputestdata/cpu-data.py +++ b/tests/cputestdata/cpu-data.py @@ -36,6 +36,13 @@ def gather_name(args): =20 =20 def gather_cpuid_leaves(args): + def mask(regs, eax_in, ecx_in, eax_mask, ebx_mask, ecx_mask, edx_mask): + if regs["eax_in"] =3D=3D eax_in and regs["ecx_in"] =3D=3D ecx_in: + regs["eax"] &=3D eax_mask + regs["ebx"] &=3D ebx_mask + regs["ecx"] &=3D ecx_mask + regs["edx"] &=3D edx_mask + leave_pattern =3D re.compile( "^\\s*" "(0x[0-9a-f]+)\\s*" @@ -60,7 +67,7 @@ def gather_cpuid_leaves(args): match =3D leave_pattern.match(line) if not match: continue - yield { + regs =3D { "eax_in": int(match.group(1), 0), "ecx_in": int(match.group(2), 0), "eax": int(match.group(3), 0), @@ -68,6 +75,13 @@ def gather_cpuid_leaves(args): "ecx": int(match.group(5), 0), "edx": int(match.group(6), 0)} =20 + # local apic id. Pretend to always run on logical processor #0. + mask(regs, 0x01, 0x00, 0xffffffff, 0x00ffffff, 0xffffffff, 0xfffff= fff) + mask(regs, 0x0b, 0x00, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff= f00) + mask(regs, 0x0b, 0x01, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffff= f00) + + yield regs + =20 def gather_msr(): msrs =3D dict() --=20 2.26.2