From nobody Mon Feb 9 07:08:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1679312418; cv=none; d=zohomail.com; s=zohoarc; b=iTvaf0vW8WNEIyZnvJY8amupzk83kkULcFHBR2VAZ+VdYXNC/OYkrI0Pg85mpPzEr7om0BJrCXul3HH7B4okJ8AIZ784oLfKomvWUibTN8W+iwuDhIfQC/eLtgUJDmonJFbXnJ1QS/F0MN4Fa6c10hhgAz2EJ6y4Zsv44Mmr4aQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679312418; h=Content-Type:Content-Transfer-Encoding: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=m8RhDJcuW4jjz75bHhcRURIdXofaKd5+e1O7+Kae5is=; b=mR9TiFOTG6LLqM5XJ1StPlW/qWa7lVCxMVsp1Sb5KNuwKROOTrqiyZ5cfUqxUaRkRyxBSXjwkitN+wWAqiZ7REijtQPGl3+Xj7T+CStkAHbYuU9f/LF4Pq/KaKlvRIuHi/wslT6NB5hEVZ3V0Oz/m/lT5OEZKHJSecaHZ4ExS90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 167931241807820.665641624443992; Mon, 20 Mar 2023 04:40:18 -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-534-Q3uKiv3yPbyuCHiIeDt5fg-1; Mon, 20 Mar 2023 07:40:15 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F58F96DC83; Mon, 20 Mar 2023 11:40:13 +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 B4E0E40C83AC; Mon, 20 Mar 2023 11:40:10 +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 93AE319465A2; Mon, 20 Mar 2023 11:40:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 27D811946594 for ; Mon, 20 Mar 2023 11:40:10 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 18BB62166B29; Mon, 20 Mar 2023 11:40:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FD322166B2A for ; Mon, 20 Mar 2023 11:40:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 DA234185A7A3 for ; Mon, 20 Mar 2023 11:40:09 +0000 (UTC) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-cvvehjc2O4qSAzYHHyq4aw-1; Mon, 20 Mar 2023 07:40:08 -0400 Received: by mail-ed1-f69.google.com with SMTP id y24-20020aa7ccd8000000b004be3955a42eso17281204edt.22 for ; Mon, 20 Mar 2023 04:40:08 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id gu12-20020a170906f28c00b008b17de9d1f2sm4405075ejb.15.2023.03.20.04.40.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 04:40:06 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 380EAE94C428 for ; Mon, 20 Mar 2023 12:40:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679312417; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=m8RhDJcuW4jjz75bHhcRURIdXofaKd5+e1O7+Kae5is=; b=Ho5fgfIbdeRKRqNtLnFOCI3EzMvf9NL08USkVMTq6MSeU4ajvQCZGtKQXSC0/htLasYCVF E6R6kolTwtXFfgfjziw46eLeZMFpznK3CqkQQDXvxqhrThZMviLeKPZj+o5fmn4qKbnDcu 0OCfbXD3/cFz8hHa2gUQj6l5L2GF8ws= X-MC-Unique: Q3uKiv3yPbyuCHiIeDt5fg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: cvvehjc2O4qSAzYHHyq4aw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679312407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m8RhDJcuW4jjz75bHhcRURIdXofaKd5+e1O7+Kae5is=; b=aFTDkeGYfyVADEN8jEat/EVXeS1hj0NFjloigqqD+y+4iv+PMyXr/ZzgPZVxQVUCml my8qKuGjTRt80f9kiLPEIJ61kpWVhvqD+bkEYtu8nqkBKCwsxiBbsh+w4BA9ojcB7j62 kgLbprmyl8/wotdG/hqP9/8sW/ziB/xS58TuWbcaR6q7K+69FUtSwFUJ766CDcZYkCa3 JwJ3h7hMHe8UcqYhtLduAYN0v+bmlCdH4rfxdUVSpDxLyY8NxCVy2JHdWwrhAXeZB8gT pUbOEqTmvOP3Wk2zZ9QXWHFQVWI9phXw5xtKGwBtuwQQguJAKWIugF+MC+OKZF5Ze0d6 ke7g== X-Gm-Message-State: AO0yUKXxjA+Ifmq78xM8H0PAozkFYs1onSjokraJBEF+zYYTOmmfNgKZ l6/legErx96fLITk6wgUdNInLEr0ZctBRtlSKY9p8vht2IC312dskiPNaQaKYJKFNcKYZcrr8On gPzXLk52N2PtLXSwIZrWRRYlIOA9CeQ8lBSHxHv8Jcyc/vai5IUvpdjQHypwFPYc7FsRC/pPtzx UsCFso6g== X-Received: by 2002:a05:6402:1397:b0:500:2a9d:1870 with SMTP id b23-20020a056402139700b005002a9d1870mr12483781edv.13.1679312407259; Mon, 20 Mar 2023 04:40:07 -0700 (PDT) X-Google-Smtp-Source: AK7set8Zc5YpxT718LV+TfLXJiVBrs4UbvPgJENKMqFGqM8IWG/euwO3riYWr41I+tyTL7tCtXMb8A== X-Received: by 2002:a05:6402:1397:b0:500:2a9d:1870 with SMTP id b23-20020a056402139700b005002a9d1870mr12483760edv.13.1679312406837; Mon, 20 Mar 2023 04:40:06 -0700 (PDT) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 1/2] util: Separate numactl and stubs into different source files Date: Mon, 20 Mar 2023 12:39:55 +0100 Message-Id: <2b9ff4bfa8a35a0a7c6ed0c5246c63a1b9277d59.1679312019.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.1 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: 1679312418774100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Fix the build, mainly with clang's optimizations and demonstrate a separation of function implementations. This patch does it only for functions that differ in implementation based on WITH_NUMACTL but ideally this would be done for the WITH_NUMAD and __linux__ parts as well. Signed-off-by: Martin Kletzander --- po/POTFILES | 2 + src/util/meson.build | 10 + src/util/virnuma.c | 427 +------------------------------------ src/util/virnuma_common.h | 57 +++++ src/util/virnuma_numactl.c | 357 +++++++++++++++++++++++++++++++ src/util/virnuma_stubs.c | 124 +++++++++++ 6 files changed, 551 insertions(+), 426 deletions(-) create mode 100644 src/util/virnuma_common.h create mode 100644 src/util/virnuma_numactl.c create mode 100644 src/util/virnuma_stubs.c diff --git a/po/POTFILES b/po/POTFILES index fa769a8a954f..da81806c86ac 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -304,6 +304,8 @@ src/util/virnetdevvportprofile.c src/util/virnetlink.c src/util/virnodesuspend.c src/util/virnuma.c +src/util/virnuma_numactl.c +src/util/virnuma_stubs.c src/util/virnvme.c src/util/virobject.c src/util/virpci.c diff --git a/src/util/meson.build b/src/util/meson.build index c81500ea04af..c80237cf8f50 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -111,6 +111,16 @@ util_sources =3D [ 'virxml.c', ] =20 +if conf.has('WITH_NUMACTL') + util_sources +=3D [ + 'virnuma_numactl.c', + ] +else + util_sources +=3D [ + 'virnuma_stubs.c', + ] +endif + util_public_sources =3D files( 'virerror.c', 'virevent.c', diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 4a15bf32c83f..3abe15b16880 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -21,23 +21,11 @@ =20 #include =20 -#define NUMA_MAX_N_CPUS 4096 - -#if WITH_NUMACTL -# define NUMA_VERSION1_COMPATIBILITY 1 -# include - -# if LIBNUMA_API_VERSION > 1 -# undef NUMA_MAX_N_CPUS -# define NUMA_MAX_N_CPUS (numa_all_cpus_ptr->size) -# endif - -#endif /* WITH_NUMACTL */ - #include #include =20 #include "virnuma.h" +#include "virnuma_common.h" #include "vircommand.h" #include "virerror.h" #include "virlog.h" @@ -87,419 +75,6 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus G_GN= UC_UNUSED, } #endif /* !WITH_NUMAD */ =20 -#if WITH_NUMACTL -int -virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode, - virBitmap *nodeset) -{ - nodemask_t mask; - int bit =3D 0; - size_t i; - int maxnode =3D 0; - - if (!nodeset) - return 0; - - if (!virNumaNodesetIsAvailable(nodeset)) - return -1; - - maxnode =3D numa_max_node(); - maxnode =3D maxnode < NUMA_NUM_NODES ? maxnode : NUMA_NUM_NODES; - - /* Convert nodemask to NUMA bitmask. */ - nodemask_zero(&mask); - bit =3D -1; - while ((bit =3D virBitmapNextSetBit(nodeset, bit)) >=3D 0) { - if (bit > maxnode) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("NUMA node %d is out of range"), bit); - return -1; - } - nodemask_set(&mask, bit); - } - - switch (mode) { - case VIR_DOMAIN_NUMATUNE_MEM_STRICT: - numa_set_bind_policy(1); - numa_set_membind(&mask); - numa_set_bind_policy(0); - break; - - case VIR_DOMAIN_NUMATUNE_MEM_PREFERRED: - { -# ifdef WITH_NUMACTL_SET_PREFERRED_MANY - struct bitmask *bitmask =3D NULL; -# endif - int G_GNUC_UNUSED node =3D -1; - int nnodes =3D 0; - bool has_preferred_many =3D false; - -# ifdef WITH_NUMACTL_SET_PREFERRED_MANY - if (numa_has_preferred_many() > 0) { - has_preferred_many =3D true; - } -# endif - - for (i =3D 0; i < NUMA_NUM_NODES; i++) { - if (nodemask_isset(&mask, i)) { - node =3D i; - nnodes++; - } - } - - if (!has_preferred_many && nnodes !=3D 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("NUMA memory tuning in 'preferred' mode= " - "only supports single node")); - return -1; - } - - /* The following automatically sets MPOL_PREFERRED_MANY - * whenever possible, so no need to special case it. */ - numa_set_bind_policy(0); - -# ifdef WITH_NUMACTL_SET_PREFERRED_MANY - bitmask =3D numa_bitmask_alloc(maxnode + 1); - copy_nodemask_to_bitmask(&mask, bitmask); - numa_set_preferred_many(bitmask); - numa_bitmask_free(bitmask); -# else - numa_set_preferred(node); -# endif - } - break; - - case VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE: - numa_set_interleave_mask(&mask); - break; - - case VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE: - break; - - case VIR_DOMAIN_NUMATUNE_MEM_LAST: - break; - } - - return 0; -} - -bool -virNumaIsAvailable(void) -{ - return numa_available() !=3D -1; -} - - -/** - * virNumaGetMaxNode: - * Get the highest node number available on the current system. - * (See the node numbers in /sys/devices/system/node/ ). - * - * Returns the highest NUMA node id on success, -1 on error. - */ -int -virNumaGetMaxNode(void) -{ - int ret; - - if (!virNumaIsAvailable()) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("NUMA isn't available on this host")); - return -1; - } - - if ((ret =3D numa_max_node()) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to request maximum NUMA node id")); - return -1; - } - - return ret; -} - - -/** - * virNumaGetNodeMemory: - * @node: identifier of the requested NUMA node - * @memsize: returns the total size of memory in the NUMA node - * @memfree: returns the total free memory in a NUMA node - * - * Returns the size of the memory in one NUMA node in bytes via the @size - * argument and free memory of a node in the @free argument. The caller h= as to - * guarantee that @node is in range (see virNumaGetMaxNode). - * - * Returns 0 on success, -1 on error. Does not report errors. - */ -int -virNumaGetNodeMemory(int node, - unsigned long long *memsize, - unsigned long long *memfree) -{ - long long node_size; - long long node_free; - - if (memsize) - *memsize =3D 0; - - if (memfree) - *memfree =3D 0; - - if ((node_size =3D numa_node_size64(node, &node_free)) < 0) - return -1; - - if (memsize) - *memsize =3D node_size; - - if (memfree) - *memfree =3D node_free; - - return 0; -} - - -/** - * virNumaGetNodeCPUs: - * @node: identifier of the requested NUMA node - * @cpus: returns a bitmap of CPUs in @node - * - * Returns count of CPUs in the selected node and sets the map of the cpus= to - * @cpus. On error if the @node doesn't exist in the system this function - * returns -2 and sets @cpus to NULL. On other errors -1 is returned, @cpus - * is set to NULL and an error is reported. - */ - -# define n_bits(var) (8 * sizeof(var)) -# define MASK_CPU_ISSET(mask, cpu) \ - (((mask)[((cpu) / n_bits(*(mask)))] >> ((cpu) % n_bits(*(mask)))) & 1) -int -virNumaGetNodeCPUs(int node, - virBitmap **cpus) -{ - int ncpus =3D 0; - int max_n_cpus =3D virNumaGetMaxCPUs(); - int mask_n_bytes =3D max_n_cpus / 8; - size_t i; - g_autofree unsigned long *mask =3D NULL; - g_autoptr(virBitmap) cpumap =3D NULL; - - *cpus =3D NULL; - - if (!virNumaNodeIsAvailable(node)) { - VIR_DEBUG("NUMA topology for cell %d is not available, ignoring", = node); - return -2; - } - - mask =3D g_new0(unsigned long, mask_n_bytes / sizeof(*mask)); - - if (numa_node_to_cpus(node, mask, mask_n_bytes) < 0) { - VIR_WARN("NUMA topology for cell %d is not available, ignoring", n= ode); - return -2; - } - - cpumap =3D virBitmapNew(max_n_cpus); - - for (i =3D 0; i < max_n_cpus; i++) { - if (MASK_CPU_ISSET(mask, i)) { - ignore_value(virBitmapSetBit(cpumap, i)); - ncpus++; - } - } - - *cpus =3D g_steal_pointer(&cpumap); - return ncpus; -} -# undef MASK_CPU_ISSET -# undef n_bits - - -/** - * virNumaGetNodeOfCPU: - * @cpu: CPU ID - * - * For given @cpu, return NUMA node which it belongs to. - * - * Returns: NUMA node # on success, - * -1 on failure (with errno set). - */ -int -virNumaGetNodeOfCPU(int cpu) -{ - return numa_node_of_cpu(cpu); -} - -#else /* !WITH_NUMACTL */ - -int -virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode G_GNUC_UNUSED, - virBitmap *nodeset) -{ - if (!virNumaNodesetIsAvailable(nodeset)) - return -1; - - return 0; -} - -bool -virNumaIsAvailable(void) -{ - return false; -} - - -int -virNumaGetMaxNode(void) -{ - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("NUMA isn't available on this host")); - return -1; -} - - -int -virNumaGetNodeMemory(int node G_GNUC_UNUSED, - unsigned long long *memsize, - unsigned long long *memfree) -{ - if (memsize) - *memsize =3D 0; - - if (memfree) - *memfree =3D 0; - - VIR_DEBUG("NUMA isn't available on this host"); - return -1; -} - - -int -virNumaGetNodeCPUs(int node G_GNUC_UNUSED, - virBitmap **cpus) -{ - *cpus =3D NULL; - - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("NUMA isn't available on this host")); - return -1; -} - -int -virNumaGetNodeOfCPU(int cpu G_GNUC_UNUSED) -{ - errno =3D ENOSYS; - return -1; -} - - -#endif /* !WITH_NUMACTL */ - -/** - * virNumaGetMaxCPUs: - * - * Get the maximum count of CPUs supportable in the host. - * - * Returns the count of CPUs supported. - */ -unsigned int -virNumaGetMaxCPUs(void) -{ - return NUMA_MAX_N_CPUS; -} - - -#if WITH_NUMACTL -/** - * virNumaNodeIsAvailable: - * @node: node to check - * - * On some hosts the set of NUMA nodes isn't continuous. - * Use this function to test if the @node is available. - * - * Returns: true if @node is available, - * false if @node doesn't exist - */ -bool -virNumaNodeIsAvailable(int node) -{ - return numa_bitmask_isbitset(numa_nodes_ptr, node); -} - - -/** - * virNumaGetDistances: - * @node: identifier of the requested NUMA node - * @distances: array of distances to sibling nodes - * @ndistances: size of @distances - * - * Get array of distances to sibling nodes from @node. If a - * distances[x] equals to zero, the node x is not enabled or - * doesn't exist. As a special case, if @node itself refers to - * disabled or nonexistent NUMA node, then @distances and - * @ndistances are set to NULL and zero respectively. - * - * The distances are a bit of magic. For a local node the value - * is 10, for remote it's typically 20 meaning that time penalty - * for accessing a remote node is two time bigger than when - * accessing a local node. - * - * Returns 0 on success, -1 otherwise. - */ -int -virNumaGetDistances(int node, - int **distances, - int *ndistances) -{ - int max_node; - size_t i; - - if (!virNumaNodeIsAvailable(node)) { - VIR_DEBUG("Node %d does not exist", node); - *distances =3D NULL; - *ndistances =3D 0; - return 0; - } - - if ((max_node =3D virNumaGetMaxNode()) < 0) - return -1; - - *distances =3D g_new0(int, max_node + 1); - *ndistances =3D max_node + 1; - - for (i =3D 0; i <=3D max_node; i++) { - if (!virNumaNodeIsAvailable(node)) - continue; - - (*distances)[i] =3D numa_distance(node, i); - } - - return 0; -} - -#else /* !WITH_NUMACTL */ - -bool -virNumaNodeIsAvailable(int node) -{ - int max_node =3D virNumaGetMaxNode(); - - if (max_node < 0) - return false; - - /* Do we have anything better? */ - return (node >=3D 0) && (node <=3D max_node); -} - - -int -virNumaGetDistances(int node G_GNUC_UNUSED, - int **distances, - int *ndistances) -{ - *distances =3D NULL; - *ndistances =3D 0; - VIR_DEBUG("NUMA distance information isn't available on this host"); - return 0; -} -#endif /* !WITH_NUMACTL */ =20 =20 /* currently all the huge page stuff below is linux only */ diff --git a/src/util/virnuma_common.h b/src/util/virnuma_common.h new file mode 100644 index 000000000000..2ba1a9344ca4 --- /dev/null +++ b/src/util/virnuma_common.h @@ -0,0 +1,57 @@ +/* + * virnuma_common.h: helper APIs for managing NUMA with varying backends + * + * Copyright (C) 2011-2014 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + */ + +#pragma once + +#include "internal.h" +#include "virbitmap.h" + +#define NUMA_MAX_N_CPUS 4096 + +int +virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode, + virBitmap *nodeset); + +bool +virNumaIsAvailable(void); + +int +virNumaGetMaxNode(void); + +int +virNumaGetNodeMemory(int node, + unsigned long long *memsize, + unsigned long long *memfree); + +int +virNumaGetNodeCPUs(int node, + virBitmap **cpus); + +int +virNumaGetNodeOfCPU(int cpu); + +bool +virNumaNodeIsAvailable(int node); + +int +virNumaGetDistances(int node, + int **distances, + int *ndistances); diff --git a/src/util/virnuma_numactl.c b/src/util/virnuma_numactl.c new file mode 100644 index 000000000000..223c2e3e56db --- /dev/null +++ b/src/util/virnuma_numactl.c @@ -0,0 +1,357 @@ +/* + * virnuma_numactl.c: NUMA functions for builds with numactl + * + * Copyright (C) 2011-2014 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + */ + +#include + +#define NUMA_VERSION1_COMPATIBILITY 1 +#include + +#include "virnuma_common.h" +#include "virnuma.h" +#include "virerror.h" +#include "virlog.h" + +#define VIR_FROM_THIS VIR_FROM_NONE + +VIR_LOG_INIT("util.numa"); + + +int +virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode, + virBitmap *nodeset) +{ + nodemask_t mask; + int bit =3D 0; + size_t i; + int maxnode =3D 0; + + if (!nodeset) + return 0; + + if (!virNumaNodesetIsAvailable(nodeset)) + return -1; + + maxnode =3D numa_max_node(); + maxnode =3D maxnode < NUMA_NUM_NODES ? maxnode : NUMA_NUM_NODES; + + /* Convert nodemask to NUMA bitmask. */ + nodemask_zero(&mask); + bit =3D -1; + while ((bit =3D virBitmapNextSetBit(nodeset, bit)) >=3D 0) { + if (bit > maxnode) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("NUMA node %d is out of range"), bit); + return -1; + } + nodemask_set(&mask, bit); + } + + switch (mode) { + case VIR_DOMAIN_NUMATUNE_MEM_STRICT: + numa_set_bind_policy(1); + numa_set_membind(&mask); + numa_set_bind_policy(0); + break; + + case VIR_DOMAIN_NUMATUNE_MEM_PREFERRED: + { +#ifdef WITH_NUMACTL_SET_PREFERRED_MANY + struct bitmask *bitmask =3D NULL; +#endif + int G_GNUC_UNUSED node =3D -1; + int nnodes =3D 0; + bool has_preferred_many =3D false; + +#ifdef WITH_NUMACTL_SET_PREFERRED_MANY + if (numa_has_preferred_many() > 0) { + has_preferred_many =3D true; + } +#endif + + for (i =3D 0; i < NUMA_NUM_NODES; i++) { + if (nodemask_isset(&mask, i)) { + node =3D i; + nnodes++; + } + } + + if (!has_preferred_many && nnodes !=3D 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("NUMA memory tuning in 'preferred' mode= " + "only supports single node")); + return -1; + } + + /* The following automatically sets MPOL_PREFERRED_MANY + * whenever possible, so no need to special case it. */ + numa_set_bind_policy(0); + +#ifdef WITH_NUMACTL_SET_PREFERRED_MANY + bitmask =3D numa_bitmask_alloc(maxnode + 1); + copy_nodemask_to_bitmask(&mask, bitmask); + numa_set_preferred_many(bitmask); + numa_bitmask_free(bitmask); +#else + numa_set_preferred(node); +#endif + } + break; + + case VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE: + numa_set_interleave_mask(&mask); + break; + + case VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE: + break; + + case VIR_DOMAIN_NUMATUNE_MEM_LAST: + break; + } + + return 0; +} + +bool +virNumaIsAvailable(void) +{ + return numa_available() !=3D -1; +} + + +/** + * virNumaGetMaxNode: + * Get the highest node number available on the current system. + * (See the node numbers in /sys/devices/system/node/ ). + * + * Returns the highest NUMA node id on success, -1 on error. + */ +int +virNumaGetMaxNode(void) +{ + int ret; + + if (!virNumaIsAvailable()) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("NUMA isn't available on this host")); + return -1; + } + + if ((ret =3D numa_max_node()) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to request maximum NUMA node id")); + return -1; + } + + return ret; +} + + +/** + * virNumaGetNodeMemory: + * @node: identifier of the requested NUMA node + * @memsize: returns the total size of memory in the NUMA node + * @memfree: returns the total free memory in a NUMA node + * + * Returns the size of the memory in one NUMA node in bytes via the @size + * argument and free memory of a node in the @free argument. The caller h= as to + * guarantee that @node is in range (see virNumaGetMaxNode). + * + * Returns 0 on success, -1 on error. Does not report errors. + */ +int +virNumaGetNodeMemory(int node, + unsigned long long *memsize, + unsigned long long *memfree) +{ + long long node_size; + long long node_free; + + if (memsize) + *memsize =3D 0; + + if (memfree) + *memfree =3D 0; + + if ((node_size =3D numa_node_size64(node, &node_free)) < 0) + return -1; + + if (memsize) + *memsize =3D node_size; + + if (memfree) + *memfree =3D node_free; + + return 0; +} + + +/** + * virNumaGetNodeCPUs: + * @node: identifier of the requested NUMA node + * @cpus: returns a bitmap of CPUs in @node + * + * Returns count of CPUs in the selected node and sets the map of the cpus= to + * @cpus. On error if the @node doesn't exist in the system this function + * returns -2 and sets @cpus to NULL. On other errors -1 is returned, @cpus + * is set to NULL and an error is reported. + */ + +#define n_bits(var) (8 * sizeof(var)) +#define MASK_CPU_ISSET(mask, cpu) \ + (((mask)[((cpu) / n_bits(*(mask)))] >> ((cpu) % n_bits(*(mask)))) & 1) +int +virNumaGetNodeCPUs(int node, + virBitmap **cpus) +{ + int ncpus =3D 0; + int max_n_cpus =3D virNumaGetMaxCPUs(); + int mask_n_bytes =3D max_n_cpus / 8; + size_t i; + g_autofree unsigned long *mask =3D NULL; + g_autoptr(virBitmap) cpumap =3D NULL; + + *cpus =3D NULL; + + if (!virNumaNodeIsAvailable(node)) { + VIR_DEBUG("NUMA topology for cell %d is not available, ignoring", = node); + return -2; + } + + mask =3D g_new0(unsigned long, mask_n_bytes / sizeof(*mask)); + + if (numa_node_to_cpus(node, mask, mask_n_bytes) < 0) { + VIR_WARN("NUMA topology for cell %d is not available, ignoring", n= ode); + return -2; + } + + cpumap =3D virBitmapNew(max_n_cpus); + + for (i =3D 0; i < max_n_cpus; i++) { + if (MASK_CPU_ISSET(mask, i)) { + ignore_value(virBitmapSetBit(cpumap, i)); + ncpus++; + } + } + + *cpus =3D g_steal_pointer(&cpumap); + return ncpus; +} +#undef MASK_CPU_ISSET +#undef n_bits + + +/** + * virNumaGetNodeOfCPU: + * @cpu: CPU ID + * + * For given @cpu, return NUMA node which it belongs to. + * + * Returns: NUMA node # on success, + * -1 on failure (with errno set). + */ +int +virNumaGetNodeOfCPU(int cpu) +{ + return numa_node_of_cpu(cpu); +} + +/** + * virNumaGetMaxCPUs: + * + * Get the maximum count of CPUs supportable in the host. + * + * Returns the count of CPUs supported. + */ +unsigned int +virNumaGetMaxCPUs(void) +{ +#if LIBNUMA_API_VERSION > 1 + return numa_all_cpus_ptr->size; +#else + return NUMA_MAX_N_CPUS; +#endif +} + +/** + * virNumaNodeIsAvailable: + * @node: node to check + * + * On some hosts the set of NUMA nodes isn't continuous. + * Use this function to test if the @node is available. + * + * Returns: true if @node is available, + * false if @node doesn't exist + */ +bool +virNumaNodeIsAvailable(int node) +{ + return numa_bitmask_isbitset(numa_nodes_ptr, node); +} + +/** + * virNumaGetDistances: + * @node: identifier of the requested NUMA node + * @distances: array of distances to sibling nodes + * @ndistances: size of @distances + * + * Get array of distances to sibling nodes from @node. If a + * distances[x] equals to zero, the node x is not enabled or + * doesn't exist. As a special case, if @node itself refers to + * disabled or nonexistent NUMA node, then @distances and + * @ndistances are set to NULL and zero respectively. + * + * The distances are a bit of magic. For a local node the value + * is 10, for remote it's typically 20 meaning that time penalty + * for accessing a remote node is two time bigger than when + * accessing a local node. + * + * Returns 0 on success, -1 otherwise. + */ +int +virNumaGetDistances(int node, + int **distances, + int *ndistances) +{ + int max_node; + size_t i; + + if (!virNumaNodeIsAvailable(node)) { + VIR_DEBUG("Node %d does not exist", node); + *distances =3D NULL; + *ndistances =3D 0; + return 0; + } + + if ((max_node =3D virNumaGetMaxNode()) < 0) + return -1; + + *distances =3D g_new0(int, max_node + 1); + *ndistances =3D max_node + 1; + + for (i =3D 0; i <=3D max_node; i++) { + if (!virNumaNodeIsAvailable(node)) + continue; + + (*distances)[i] =3D numa_distance(node, i); + } + + return 0; +} diff --git a/src/util/virnuma_stubs.c b/src/util/virnuma_stubs.c new file mode 100644 index 000000000000..384216bb6bf9 --- /dev/null +++ b/src/util/virnuma_stubs.c @@ -0,0 +1,124 @@ +/* + * virnuma_stubs.c: NUMA stub functions for builds without numactl + * + * Copyright (C) 2011-2014 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + */ + +#include + +#include "virnuma_common.h" +#include "virnuma.h" +#include "virerror.h" +#include "virlog.h" + +#define VIR_FROM_THIS VIR_FROM_NONE + +VIR_LOG_INIT("util.numa"); + + +int +virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode G_GNUC_UNUSED, + virBitmap *nodeset) +{ + if (!virNumaNodesetIsAvailable(nodeset)) + return -1; + + return 0; +} + +bool +virNumaIsAvailable(void) +{ + return false; +} + + +int +virNumaGetMaxNode(void) +{ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("NUMA isn't available on this host")); + return -1; +} + + +int +virNumaGetNodeMemory(int node G_GNUC_UNUSED, + unsigned long long *memsize, + unsigned long long *memfree) +{ + if (memsize) + *memsize =3D 0; + + if (memfree) + *memfree =3D 0; + + VIR_DEBUG("NUMA isn't available on this host"); + return -1; +} + + +int +virNumaGetNodeCPUs(int node G_GNUC_UNUSED, + virBitmap **cpus) +{ + *cpus =3D NULL; + + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("NUMA isn't available on this host")); + return -1; +} + +int +virNumaGetNodeOfCPU(int cpu G_GNUC_UNUSED) +{ + errno =3D ENOSYS; + return -1; +} + + +bool +virNumaNodeIsAvailable(int node G_GNUC_UNUSED) +{ + return false; +} + + +int +virNumaGetDistances(int node G_GNUC_UNUSED, + int **distances, + int *ndistances) +{ + *distances =3D NULL; + *ndistances =3D 0; + VIR_DEBUG("NUMA distance information isn't available on this host"); + return 0; +} + +/** + * virNumaGetMaxCPUs: + * + * Get the maximum count of CPUs supportable in the host. + * + * Returns the count of CPUs supported. + */ +unsigned int +virNumaGetMaxCPUs(void) +{ + return NUMA_MAX_N_CPUS; +} --=20 2.40.0 From nobody Mon Feb 9 07:08:55 2026 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679312469; cv=none; d=zohomail.com; s=zohoarc; b=Eb77dH52DoTFIMe/unoHts8y8T5r+XUyLi9L3A8tAM3axIlAZhGKXbY8fCVbauE5ZAdfZaE1pV8E3t8ZxSnC8YisM91ycRKjvV1GClo/fJhABlNr8EbhdLSraCAS4rjdr0ruUNSEHBdutgM/n0ERPmk4vZrsa9htiw7xgDR/YEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679312469; h=Content-Type:Content-Transfer-Encoding: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=Ae5enRT2EIhXzu6tQBLMIztFMbhCX/AIJN32WWWDmWg=; b=R1XcvRAUzMa76t9itb7KgBw7Mkny6eDFMWJ/5a2V9V3RMANMBg+GnvQWsm1npNsyduNY72SYSX/RXkvNG9tc3SL/ycmcwl8XB0u5mfx+gRADsxzayWYs5L6MUnhOrtMbW62hfekGjt8Cx76Eh5IH6S5jVnasAVMcJ0WwCwAv9Ek= 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=pass 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 1679312469479767.8853223180811; Mon, 20 Mar 2023 04:41:09 -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-533-hD06JH7WNkKhTosMv2nFzQ-1; Mon, 20 Mar 2023 07:40:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 105E7100DEC1; Mon, 20 Mar 2023 11:40:13 +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 96246140EBF4; Mon, 20 Mar 2023 11:40:12 +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 7DC2D1946A6A; Mon, 20 Mar 2023 11:40:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CC92F1946594 for ; Mon, 20 Mar 2023 11:40:09 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AFBE9492C14; Mon, 20 Mar 2023 11:40:09 +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 A83E0492C13 for ; Mon, 20 Mar 2023 11:40:09 +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 8CA0E3822DE2 for ; Mon, 20 Mar 2023 11:40:09 +0000 (UTC) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-56-v0N65SuiOP-5wtPxqRgVcQ-1; Mon, 20 Mar 2023 07:40:08 -0400 Received: by mail-ed1-f69.google.com with SMTP id c1-20020a0564021f8100b004acbe232c03so16785590edc.9 for ; Mon, 20 Mar 2023 04:40:08 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id yj8-20020a170907708800b00930170bc292sm4284563ejb.22.2023.03.20.04.40.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 04:40:06 -0700 (PDT) Received: from wheatley.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 42F2EE94C429 for ; Mon, 20 Mar 2023 12:40:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679312468; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ae5enRT2EIhXzu6tQBLMIztFMbhCX/AIJN32WWWDmWg=; b=FwzZ0M7TDUusR9WqayTWRoz0+73yvmUjDQc2h6TZGY1MHetG5CB9/TodhTG8l1g2EgRud6 E4uEa0h4m+JO5tiTg5PJWCUje7kr4U/RAu732pRaudR0AyjFeA2MTLeVN1idZ3+SK3Zi6O DNpFRdL+HxJeu8vF0OzYX41se8muh+c= X-MC-Unique: hD06JH7WNkKhTosMv2nFzQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: v0N65SuiOP-5wtPxqRgVcQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679312407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ae5enRT2EIhXzu6tQBLMIztFMbhCX/AIJN32WWWDmWg=; b=fDZjgrDQmmvhPJ6gl6DATt63h9emgDaEf5ONJyLrJpTOh4ShWU3Sr8ki4p1GUXAwxk ZCiR9ZjO/gpsOVTbWMGKo8I1OMFtLLJX/8Chm5ApTHABw86h54ux2yZM/YOIKpuePWmo cBrDxI2n98oDVM5FhXm7qvZUcII0L5CUR7gSc2wn7Mel5tEtvwCNev3bdkqc7ISRTU1t MA1EKTc+YBFQcV5IEd3BzUV4BFUXQhPCDw32lSjtIq2iJ7u5Wo80g4qUcB0d7bhNdwPe 2+oibleBYoZLxifmcZZ8JJUTyhD6W0QK4Bb1tPv/r+l1Q+nCAyN/DLioJoRX2cp4prw+ V3oQ== X-Gm-Message-State: AO0yUKWPurDp+ghhj5pE86QJZKlQFyJll0+b7ImgL4INkoiTT3Ys6qrd LGnoryi+xSc0oAT5eLqdResOdcnfHy7T9KHHFGffODO7VkAuWthxcqLyMoa6EAfteL58pNChgZo kMLpjy479FjX9lj7KrcXy7kMSTjv4GTJddI7YTuThx1Ndq05k+VZdRgXLJDg4PdsqJi5GMYOSo+ /7pKbQWQ== X-Received: by 2002:a17:906:4e8e:b0:933:9b39:8efa with SMTP id v14-20020a1709064e8e00b009339b398efamr4468642eju.20.1679312407219; Mon, 20 Mar 2023 04:40:07 -0700 (PDT) X-Google-Smtp-Source: AK7set/2r5tIrDNamfx9XNIdgtBH7cv2RGTnjO0VFmvHdyAPeZZDEgOrNple7zsT0tSAtLhmg6Jg0g== X-Received: by 2002:a17:906:4e8e:b0:933:9b39:8efa with SMTP id v14-20020a1709064e8e00b009339b398efamr4468624eju.20.1679312406944; Mon, 20 Mar 2023 04:40:06 -0700 (PDT) From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH 2/2] Revert "meson: stop CLang doing inter-procedural analysis" Date: Mon, 20 Mar 2023 12:39:56 +0100 Message-Id: <6418a0077caf2ef6a5dde0a78576fe71baa910b8.1679312019.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.7 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: 1679312471058100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This reverts commit f9f5ab57189b9c378d1893cf302865ac9b88bbbc. This should not be needed any more thanks to previous commit (util: Separate numactl and stubs into different source files) and future issue should be fixed the same way as in that commit. Signed-off-by: Martin Kletzander --- meson.build | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/meson.build b/meson.build index c35823a79aa8..319ed790f941 100644 --- a/meson.build +++ b/meson.build @@ -404,26 +404,6 @@ cc_flags +=3D [ '-Wwrite-strings', ] =20 -if cc.get_id() =3D=3D 'clang' - # Stop CLang from doing inter-procedural analysis of calls - # between functions in the same compilation unit. Such an - # optimization has been know to break the test suite by - # making assumptions that a return value is a constant. - # This makes it impossible to mock certain functions with - # replacement definitions via LD_PRELOAD that have different - # semantics. - # - # This is a bit of a big hammer, but alternatives don't work: - # - # - 'weak' attribute - weak symbols get dropped from - # when the .a libs are combined into the .so - # see commit 407a281a8e2b6c5078ba1148535663ea64fd9314 - # - # - 'noipa' attribute - only available with GCC currently - # https://reviews.llvm.org/D101011 - cc_flags +=3D [ '-fsemantic-interposition' ] -endif - supported_cc_flags =3D [] if get_option('warning_level') =3D=3D '2' supported_cc_flags =3D cc.get_supported_arguments(cc_flags) --=20 2.40.0