From nobody Mon Apr 29 19:33:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1584117999; cv=none; d=zohomail.com; s=zohoarc; b=LcwxB9jX8u0FP2F8rf1d0MmW4cLWtHnNpGnwSy5obtg/FVbDS6WS0O1g9Un2KY6uqAIKqZ9BeIljxLMxQDJwdkTuDMk29vEn88hUQZzbfuLlE4xBoQhsqNdO+fDRHCErG+EJJYvvZKu+LW4BT9sJ89qkxVdwhCFjDcZ9ttkOUyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584117999; 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=uzp7xji/7FriMkecTL/39osrqHJenxIBUukcQEa0LiQ=; b=co3qJB8iO4qqNvY5BIaL//xo3AJT1zvvj+fPHZwehmH/fAcMgH6SynyZZ96TFV02+fCM/+OTWbEkNxMcHdPyPovNVA9dYfKrH8wJwCUrOdhagphIFW7Tdwa8Rq31nQlDW+o5Tv74jrZHkopZKPS/CmVWZDhXVnqDJ/aTKbJMxLw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1584117999546457.14883314050724; Fri, 13 Mar 2020 09:46:39 -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-44-l38MQApWM4-WUg756sybbA-1; Fri, 13 Mar 2020 12:46:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 54138800D54; Fri, 13 Mar 2020 16:46:28 +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 A4FE45DA60; Fri, 13 Mar 2020 16:46:27 +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 8A8CB18089C8; Fri, 13 Mar 2020 16:46:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02DGkOHM011536 for ; Fri, 13 Mar 2020 12:46:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 160EF5DA76; Fri, 13 Mar 2020 16:46:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-40.ams2.redhat.com [10.36.112.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01BE15D9CA; Fri, 13 Mar 2020 16:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584117998; 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=uzp7xji/7FriMkecTL/39osrqHJenxIBUukcQEa0LiQ=; b=RTh3s6mXtkVvnRBJ9ymhzz1UZzwYrpx6XFYwJtTLkXKkOI/CzsKqWK1h+P0ls0EV1lGHNW xR2kLQlfek+KhpEoP9PGs6RPXiJj2hxV5sRqPXLlk9NlpsZrPQ3harYAuByXZufiM/PTMH cKsk4QnnukmtkqLb/vTA5aqGg4JfDSU= X-MC-Unique: l38MQApWM4-WUg756sybbA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: fix detection of vCPU pids when multiple dies are present Date: Fri, 13 Mar 2020 16:46:16 +0000 Message-Id: <20200313164616.1417745-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.79 on 10.5.11.14 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 logic for querying hotpluggable CPUs needs to sort the list of CPUs returned by QEMU. Unfortunately our sorting method failed to use the die_id field, so CPUs were not correctly sorted. This is seen when configuring a guest with partially populated CPUs 16 Then trying to start it would fail: # virsh -c qemu:///system start demo error: Failed to start domain demo error: internal error: qemu didn't report thread id for vcpu '0' Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 10 ++++++++-- src/qemu/qemu_monitor.c | 2 ++ src/qemu/qemu_monitor.h | 2 ++ src/qemu/qemu_monitor_json.c | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4b467afa81..acb93d24ae 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13537,8 +13537,14 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, } =20 if (validTIDs) - VIR_DEBUG("vCPU[%zu] PID %llu is valid", - i, (unsigned long long)info[i].tid); + VIR_DEBUG("vCPU[%zu] PID %llu is valid " + "(node=3D%d socket=3D%d die=3D%d core=3D%d thread=3D= %d)", + i, (unsigned long long)info[i].tid, + info[i].node_id, + info[i].socket_id, + info[i].die_id, + info[i].core_id, + info[i].thread_id); } =20 VIR_DEBUG("Extracting vCPU information validTIDs=3D%d", validTIDs); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index e3d621f038..017b818f73 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1615,6 +1615,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus, cpus[i].id =3D 0; cpus[i].qemu_id =3D -1; cpus[i].socket_id =3D -1; + cpus[i].die_id =3D -1; cpus[i].core_id =3D -1; cpus[i].thread_id =3D -1; cpus[i].node_id =3D -1; @@ -1770,6 +1771,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryH= otpluggableCpusEntry *hotpl vcpus[mastervcpu].hotpluggable =3D !!hotplugvcpus[i].alias || !vcpus[mastervcpu].online; vcpus[mastervcpu].socket_id =3D hotplugvcpus[i].socket_id; + vcpus[mastervcpu].die_id =3D hotplugvcpus[i].die_id; vcpus[mastervcpu].core_id =3D hotplugvcpus[i].core_id; vcpus[mastervcpu].thread_id =3D hotplugvcpus[i].thread_id; vcpus[mastervcpu].node_id =3D hotplugvcpus[i].node_id; diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6ccea909e9..be4195e734 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -561,6 +561,7 @@ struct qemuMonitorQueryHotpluggableCpusEntry { /* topology information -1 if qemu didn't report given parameter */ int node_id; int socket_id; + int die_id; int core_id; int thread_id; =20 @@ -583,6 +584,7 @@ struct _qemuMonitorCPUInfo { /* topology info for hotplug purposes. Hotplug of given vcpu impossibl= e if * all entries are -1 */ int socket_id; + int die_id; int core_id; int thread_id; int node_id; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3eac80c060..04affb851f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8565,6 +8565,7 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONVa= luePtr vcpu, =20 ignore_value(virJSONValueObjectGetNumberInt(props, "node-id", &entry->= node_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "socket-id", &entry= ->socket_id)); + ignore_value(virJSONValueObjectGetNumberInt(props, "die-id", &entry->d= ie_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "core-id", &entry->= core_id)); ignore_value(virJSONValueObjectGetNumberInt(props, "thread-id", &entry= ->thread_id)); =20 @@ -8599,6 +8600,9 @@ qemuMonitorQueryHotpluggableCpusEntrySort(const void = *p1, if (a->socket_id !=3D b->socket_id) return a->socket_id - b->socket_id; =20 + if (a->die_id !=3D b->die_id) + return a->die_id - b->die_id; + if (a->core_id !=3D b->core_id) return a->core_id - b->core_id; =20 --=20 2.24.1