From nobody Sun Feb 8 12:37:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598275731; cv=none; d=zohomail.com; s=zohoarc; b=Zs35VMMqnTHniuaNBy4lA7VrnHyQWFWXbIMcxpCbLVFgNJAYpEUjaBnsnjNJUH7SufJystsCN/t8wlKncTdhB5eHsXiELDx/2CpeugHnw1L+X3kc75oXCmJAqtVhfn885BUAgzPX4Zty0h+dCzDjrbS1Ep/feiPF1kXafQ0Sius= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598275731; 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=26kVfsAK465ErgG917131GI/n7HlumMtQXSiLZYyNQ8=; b=nPAiUhi2pJ2TLcDbtJJT+FfJDuFSIVL0epqdIROy0U3XpLyBUA8ft4aK2KEtr++GHXsPP3yWjxTC/FuQa19KuEm/KHo160JdRzDPT62kLlJReGM+PiCSng85wvWV6f5OOewEqcY3LY8LGiC4z9eqk3D4D1IH1svIm89eMWLaVns= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1598275731862512.6125283668819; Mon, 24 Aug 2020 06:28:51 -0700 (PDT) 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-336-DL5706U4NRG3jziWzCSVgQ-1; Mon, 24 Aug 2020 09:28:48 -0400 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 CA93D89A07D; Mon, 24 Aug 2020 13:28:16 +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 4BB4E1001B2B; Mon, 24 Aug 2020 13:28:16 +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 E236118A0B64; Mon, 24 Aug 2020 13:28:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07ODSBkb010574 for ; Mon, 24 Aug 2020 09:28:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83AA62166B44; Mon, 24 Aug 2020 13:28:11 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F7DB2166BA3 for ; Mon, 24 Aug 2020 13:28:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 661F4811E8E for ; Mon, 24 Aug 2020 13:28:11 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-i0aG_4YQMZqmuKxnKaa1dA-1; Mon, 24 Aug 2020 09:28:06 -0400 Received: by mail-qk1-f195.google.com with SMTP id z3so3016053qkz.7 for ; Mon, 24 Aug 2020 06:28:06 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:c152:8180:e1dd:d6ac:1152]) by smtp.gmail.com with ESMTPSA id v2sm11122860qte.25.2020.08.24.06.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 06:28:05 -0700 (PDT) X-MC-Unique: DL5706U4NRG3jziWzCSVgQ-1 X-MC-Unique: i0aG_4YQMZqmuKxnKaa1dA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=26kVfsAK465ErgG917131GI/n7HlumMtQXSiLZYyNQ8=; b=uAaa3+P1hHbt+EIjLvnfaqscCKsEW9tSOY+hNzk3AahFs9iYpsKGvL1HOA79MS197F 3TvrrkyHKIQeTzSE12qK33VUylCBBFO9EIYAkb2cHlRYyLhH5Kygg0wPPU0dmZU2UFTj gMA38gWKm9JD67bRoUF30lM8b3vj7ABogjZzhlV48UR55yck1r94FeIaAxqrMcuBbV56 GVdGSg+cjksl1ZL9xGd8sLAM0l2oo1VIfCBZTGV3WgCKnfWi49NwzMkRXgYVKaJ7u30U Qpmy0rLFtA03nKX1z8M9FgtpRsUAjJHR5zcoOCVyGqea1BLSjhyAU1pMXOrxH0P9mzYt 50EA== X-Gm-Message-State: AOAM533ewyd9wxF9z1Lgq9PqXtz3viN++sFjYZjZjLPHG+MO9FU8cR8Y tq6cSpX629PD6vNozRlSKvW9oaJblOI= X-Google-Smtp-Source: ABdhPJyuVIJ8E0pDiwtuL8Ns2jukx/W34tABiFhBpuazmnkhMMgT5nl3sNWWLd/r48UuO1hwbYI6FA== X-Received: by 2002:a05:620a:13f7:: with SMTP id h23mr4758029qkl.396.1598275685718; Mon, 24 Aug 2020 06:28:05 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/3] domaincapsmoc.c: mock virHostCPUGetMicrocodeVersion() Date: Mon, 24 Aug 2020 10:27:54 -0300 Message-Id: <20200824132754.130453-4-danielhb413@gmail.com> In-Reply-To: <20200824132754.130453-1-danielhb413@gmail.com> References: <20200824132754.130453-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Previous patch handled the runtime case where a non-x86 host is fetching /proc/cpuinfo data for a microcode info that we know it doesn't exist. This change alone speeded everything by a bit for non-x86, but there is at least one major culprit left. qemuxml2argvtest does several arch-specific tests, and a good chunk of them are x86 exclusive. This means that 'hostArch' will be seen as x86 for these tests, even when running in non-x86 hosts. In a Power 9 server with 128 CPUs, qemuxmlargvtest takes 298 seconds to complete in average, and 'perf record' indicates that 95% of the time is spent in virHostCPUGetMicrocodeVersion(). This patch mocks virHostCPUGetMicrocodeVersion() to always return 0 in the tests, avoiding /proc/cpuinfo reads. This will make all tests behave arch-agnostic, and the microcode value being 0 has no impact on any existing test. This is a CI speed across the board for all archs, including x86, given that we're not reading /proc/cpuinfo in the tests. For a Thinkpad T480 laptop with 8 Intel i7 CPUs, qemuxml2argvtest went from 15.50 sec to 12.50 seconds. The performance gain is even more noticeable for huge servers with lots of CPUs. For the Power 9 server mentioned above, this patch speeds qemuxml2argvtest to 9 seconds, down from 298 sec. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/util/virhostcpu.h | 3 ++- tests/domaincapsmock.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/util/virhostcpu.h b/src/util/virhostcpu.h index 11cbcd72a3..6148f9e66f 100644 --- a/src/util/virhostcpu.h +++ b/src/util/virhostcpu.h @@ -75,7 +75,8 @@ virBitmapPtr virHostCPUGetSiblingsList(unsigned int cpu); =20 int virHostCPUGetOnline(unsigned int cpu, bool *online); =20 -unsigned int virHostCPUGetMicrocodeVersion(virArch hostArch); +unsigned int +virHostCPUGetMicrocodeVersion(virArch hostArch) G_GNUC_NO_INLINE; =20 int virHostCPUGetMSR(unsigned long index, uint64_t *msr); diff --git a/tests/domaincapsmock.c b/tests/domaincapsmock.c index 90e17c19f0..d81a898dc0 100644 --- a/tests/domaincapsmock.c +++ b/tests/domaincapsmock.c @@ -34,3 +34,9 @@ virHostCPUGetKVMMaxVCPUs(void) { return INT_MAX; } + +unsigned int +virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED) +{ + return 0; +} --=20 2.26.2