From nobody Sun Apr 28 00:03:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601460179; cv=none; d=zohomail.com; s=zohoarc; b=XowgIgndTmcizy+/917OYjGOnBtnUvyiQmVnpGpEiMvlkXPGDcE0RmzIUpDD2ceUTkcZksBp051+3rIOHtm6ZXCjunOSCRxqR8rX5tVx5bSTombpcEeh4geKP3PUmRZ/lChKm36ZFz6fVc6YQlZJPAmzdQsW+MOaOKDJSJFLeZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601460179; 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=PlZI2R74bXJybCXUh9C/HcfHFEW6wmwMKjPXmsG08Ss=; b=DZEOEBmlaSlfnRkGQRmY4AYEOt8pnUwO5q/LwuZnJ3/sygSr9IrUNI7/d69dVho4mjo51W0vIj8OQAd4iKbSwQiK8UQrVuETAToBOwIw6OpLJjSW3r5WbTFQkpLo0TKMFI6gl8NhPUKSPCxzTcNvrFk/NDUrHPAywiW7Mh3dA9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 160146017994847.067405612392236; Wed, 30 Sep 2020 03:02:59 -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-389-nQ5a0K72N6qOBsH0bO4DdA-1; Wed, 30 Sep 2020 06:01:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B15F1007465; Wed, 30 Sep 2020 10:01:43 +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 E901D19D61; Wed, 30 Sep 2020 10:01:41 +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 9270944A4A; Wed, 30 Sep 2020 10:01:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08U9shTo008257 for ; Wed, 30 Sep 2020 05:54:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E8755C1D0; Wed, 30 Sep 2020 09:54:43 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id C39495C1CF for ; Wed, 30 Sep 2020 09:54:39 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601460112; 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=PlZI2R74bXJybCXUh9C/HcfHFEW6wmwMKjPXmsG08Ss=; b=AIlU5r40jrZ0yf/guIqmvnwrHYntM6JaZotIKcZEroyMSs4Bf9pqf4BptPvrnX8S9O/JQM razN/qjgUC8/cqCXBo39BrF3W2OW4JAa7+cVCWrp613/0QzScKWwUYDJ1M0NzIaHWMhxKd KaQO0IzvCzAYso85s40zYY2qDvA/0+4= Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601460178; 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=PlZI2R74bXJybCXUh9C/HcfHFEW6wmwMKjPXmsG08Ss=; b=dsNdrJuIW+RjrtSu0aUO3Sg7kxUVPDv/tqXTOAmukRmQtTfm50LCH6HEFc2WDKIudkqNAb L81oP6t2RfTECO650UycRdWXRtmXDLwp2HO+fmqp2wQaJhQIJ+I+XOFzdt773d1Gg53wHD eApGntkMVgKzxdrq5cSbLlWNC1/Dbiw= X-MC-Unique: nQ5a0K72N6qOBsH0bO4DdA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virDomainNumaFillCPUsInNode: Skip over NUMA nodes without vCPUs Date: Wed, 30 Sep 2020 11:54:33 +0200 Message-Id: <71f8732774b135c67496a4d2baf8441813bfd03c.1601459673.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.23 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) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" After v6.5.0-rc1~148 we started to rectify vCPU to guest NUMA assignment - if there is a vCPU not assigned to any guest NUMA node it is automatically assigned to node #0. A month later I've made it possible to define guest NUMA nodes without vCPUs (v6.6.0-rc1~250) - this is needed because of HMAT. As a part of that I fixed all callers of virDomainNumaGetNodeCpumask() (which returns a bitmap of vCPUs for given node) to handle case when NULL is returned (i.e. no vCPUs assigned to given node). But of course my patch was written before aforementioned vCPU rectify patch but merged afterwards and hence I missed the virDomainNumaFillCPUsInNode() caller. And because we are dealing with a NULL pointer, of course this leads to a crash. Just try to define a domain with at least two NUMA nodes and no vCPU assignment to any of the nodes. Fixes: a26f61ee0cffa421b87ef568002b684dd8025432 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1880289 Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza --- src/conf/numa_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index bfa312215c..cc6c77f105 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1816,7 +1816,7 @@ virDomainNumaFillCPUsInNode(virDomainNumaPtr numa, for (i =3D 0; i < numa->nmem_nodes; i++) { virBitmapPtr nodeCpus =3D virDomainNumaGetNodeCpumask(numa, i); =20 - if (i =3D=3D node) + if (i =3D=3D node || !nodeCpus) continue; =20 virBitmapSubtract(maxCPUsBitmap, nodeCpus); --=20 2.26.2