From nobody Fri Apr 19 06:54:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1667608004; cv=none; d=zohomail.com; s=zohoarc; b=SO9e2SLMAOpOxMgVGWJwXsmBT9Rmg3NjQSVtFyFvdpYR3ywCFyJ88Xyb/n1rfi6KggnY5dd20mE6GNsaa91ypykLFt3CNQ1GwovdpTSQXqdsoyyDY9NWTAWHXcIYHlWpeJkoQJKZdXgseiO2+yq34ZRJXADoheujbMEI5fV6y30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667608004; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=EXo0S2uDNKYooHaGvj7p4u+jY0KeZ1Y7y/oqPOj8edQ=; b=nuUQLX/fZ6Zhb8+oTtU//dJUGoM0+vkWeDXFvV8xd65Gpzqd3aYKDugKs17wU5MRksveQES4qQ9g6Zaese/KU4btEcMn1aFMAGS9liOWn1zxF+R0QlvH24u071PWUi/0bacXYow8iN4F6c/yToZP79XG1RI/jGIOCCXy/ahI9+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1667608004496966.7782633405159; Fri, 4 Nov 2022 17:26:44 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-yO1jsmV0NNOZJvsbm6_KVg-1; Fri, 04 Nov 2022 20:26:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF23A811E81; Sat, 5 Nov 2022 00:26:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5918640C6F73; Sat, 5 Nov 2022 00:26:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 12C9D1946587; Sat, 5 Nov 2022 00:26:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 925C01946586 for ; Sat, 5 Nov 2022 00:26:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2E91940C835A; Sat, 5 Nov 2022 00:26:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 26E7D40C83EC for ; Sat, 5 Nov 2022 00:26:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B6C138041C9 for ; Sat, 5 Nov 2022 00:26:06 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-390-2krwAMB2OcS6f8h5lXF0qA-1; Fri, 04 Nov 2022 20:26:03 -0400 Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 17:25:54 -0700 Received: from sdp540.jf.intel.com ([10.165.9.5]) by fmsmga007.fm.intel.com with ESMTP; 04 Nov 2022 17:25:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667608003; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EXo0S2uDNKYooHaGvj7p4u+jY0KeZ1Y7y/oqPOj8edQ=; b=I5vItDJMuzF20/ICf5y+5hkA+/1TxSBqLhf6rSbRGlz8vE/Lw5L6x+M/sWBAWip/wZpgXp JM5YBeUD9fzs7yYaqhwYVUmSEMF2/E8RdcA3f8OFj5/Rw1d9cO6WBaoAIRBZ12xgRaIoYt +5x9G6frniTYiBwAavtJb3P/uDcB9FA= X-MC-Unique: yO1jsmV0NNOZJvsbm6_KVg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 2krwAMB2OcS6f8h5lXF0qA-1 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="336813309" X-IronPort-AV: E=Sophos;i="5.96,139,1665471600"; d="scan'208";a="336813309" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="637770218" X-IronPort-AV: E=Sophos;i="5.96,139,1665471600"; d="scan'208";a="637770218" From: Lin Yang To: libvir-list@redhat.com, lin.a.yang@intel.com Subject: [libvirt] conf: Allow > UINT_MAX of cache for NUMA nodes Date: Fri, 4 Nov 2022 17:20:20 -0700 Message-Id: <20221105002020.71694-1-lin.a.yang@intel.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 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1667608006649100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The high-bandwidth memory (HBM) in cache mode might be greater than UINT_MAX of cache per NUMA node, so change to unsigned long long. Signed-off-by: Lin Yang Reviewed-by: Michal Privoznik --- src/conf/capabilities.c | 70 +++++++++++++++++++++++++++-------------- src/conf/numa_conf.c | 2 +- src/conf/numa_conf.h | 2 +- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index e498c77efc..85c06f0d2b 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1549,10 +1549,10 @@ virCapabilitiesGetNUMAPagesInfo(int node, =20 =20 static int -virCapabilitiesGetNodeCacheReadFile(const char *prefix, - const char *dir, - const char *file, - unsigned int *value) +virCapabilitiesGetNodeCacheReadFileUint(const char *prefix, + const char *dir, + const char *file, + unsigned int *value) { g_autofree char *path =3D g_build_filename(prefix, dir, file, NULL); int rv =3D virFileReadValueUint(value, "%s", path); @@ -1570,6 +1570,28 @@ virCapabilitiesGetNodeCacheReadFile(const char *pref= ix, } =20 =20 +static int +virCapabilitiesGetNodeCacheReadFileUllong(const char *prefix, + const char *dir, + const char *file, + unsigned long long *value) +{ + g_autofree char *path =3D g_build_filename(prefix, dir, file, NULL); + int rv =3D virFileReadValueUllong(value, "%s", path); + + if (rv < 0) { + if (rv =3D=3D -2) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("File '%s' does not exist"), + path); + } + return -1; + } + + return 0; +} + + static int virCapsHostNUMACellCacheComparator(const void *a, const void *b) @@ -1612,18 +1634,18 @@ virCapabilitiesGetNodeCache(int node, return -1; } =20 - if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name, - "size", &cache.size) < 0) + if (virCapabilitiesGetNodeCacheReadFileUllong(path, entry->d_name, + "size", &cache.size)= < 0) return -1; =20 cache.size >>=3D 10; /* read in bytes but stored in kibibytes */ =20 - if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name, - "line_size", &cache.line) = < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, entry->d_name, + "line_size", &cache.li= ne) < 0) return -1; =20 - if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name, - "indexing", &indexing) < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, entry->d_name, + "indexing", &indexing)= < 0) return -1; =20 /* see enum cache_indexing in kernel */ @@ -1638,8 +1660,8 @@ virCapabilitiesGetNodeCache(int node, return -1; } =20 - if (virCapabilitiesGetNodeCacheReadFile(path, entry->d_name, - "write_policy", &write_pol= icy) < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, entry->d_name, + "write_policy", &write= _policy) < 0) return -1; =20 /* see enum cache_write_policy in kernel */ @@ -1793,26 +1815,26 @@ virCapabilitiesHostNUMAInitInterconnectsNode(GArray= *interconnects, if (!virFileExists(path)) return 0; =20 - if (virCapabilitiesGetNodeCacheReadFile(path, "initiators", - "read_bandwidth", - &read_bandwidth) < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators", + "read_bandwidth", + &read_bandwidth) < 0) return -1; - if (virCapabilitiesGetNodeCacheReadFile(path, "initiators", - "write_bandwidth", - &write_bandwidth) < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators", + "write_bandwidth", + &write_bandwidth) < 0) return -1; =20 /* Bandwidths are read in MiB but stored in KiB */ read_bandwidth <<=3D 10; write_bandwidth <<=3D 10; =20 - if (virCapabilitiesGetNodeCacheReadFile(path, "initiators", - "read_latency", - &read_latency) < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators", + "read_latency", + &read_latency) < 0) return -1; - if (virCapabilitiesGetNodeCacheReadFile(path, "initiators", - "write_latency", - &write_latency) < 0) + if (virCapabilitiesGetNodeCacheReadFileUint(path, "initiators", + "write_latency", + &write_latency) < 0) return -1; =20 initPath =3D g_strdup_printf("%s/initiators", path); diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 688aa7b409..b55bb3ffcb 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1765,7 +1765,7 @@ virNumaCacheFormat(virBuffer *buf, } =20 virBufferAsprintf(&childBuf, - "\n", + "\n", cache->size); =20 if (cache->line) { diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index 1d1e816870..bbb928abb2 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -263,7 +263,7 @@ void virNumaDistanceFormat(virBuffer *buf, typedef struct _virNumaCache virNumaCache; struct _virNumaCache { unsigned int level; /* cache level */ - unsigned int size; /* cache size */ + unsigned long long size; /* cache size */ unsigned int line; /* line size, !!! in bytes !!! */ virNumaCacheAssociativity associativity; /* cache associativity */ virNumaCachePolicy policy; /* cache policy */ --=20 2.25.1