|
|
9ae3a8 |
From 1f9218a32773bb616f65f581f3a6b22699b2f6be Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 27 Dec 2016 20:43:20 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 2/4] vl: Don't silently change topology when all -smp options
|
|
|
9ae3a8 |
were set
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1482871400-24971-1-git-send-email-ehabkost@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 73103
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.4 qemu-kvm PATCH] vl: Don't silently change topology when all -smp options were set
|
|
|
9ae3a8 |
Bugzilla: 1375507
|
|
|
9ae3a8 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Andrew Jones <drjones@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1375507
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
QEMU tries to change the "threads" option even if it was explicitly set
|
|
|
9ae3a8 |
in the command-line, and it shouldn't do that.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The right thing to do when all options (cpus, sockets, cores, threds)
|
|
|
9ae3a8 |
are explicitly set is to sanity check them and abort in case they don't
|
|
|
9ae3a8 |
make sense (i.e. when sockets*cores*threads < cpus).
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Andrew Jones <drjones@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit ec2cbbdd80463efd4bc81a9d1362a2acb3097a21)
|
|
|
9ae3a8 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
vl.c | 8 +++++++-
|
|
|
9ae3a8 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/vl.c b/vl.c
|
|
|
9ae3a8 |
index 9756361..7c34b7c 100644
|
|
|
9ae3a8 |
--- a/vl.c
|
|
|
9ae3a8 |
+++ b/vl.c
|
|
|
9ae3a8 |
@@ -1393,8 +1393,14 @@ static void smp_parse(const char *optarg)
|
|
|
9ae3a8 |
if (cores == 0) {
|
|
|
9ae3a8 |
threads = threads > 0 ? threads : 1;
|
|
|
9ae3a8 |
cores = smp / (sockets * threads);
|
|
|
9ae3a8 |
- } else {
|
|
|
9ae3a8 |
+ } else if (threads == 0) {
|
|
|
9ae3a8 |
threads = smp / (cores * sockets);
|
|
|
9ae3a8 |
+ } else if (sockets * cores * threads < smp) {
|
|
|
9ae3a8 |
+ fprintf(stderr, "cpu topology: error: "
|
|
|
9ae3a8 |
+ "sockets (%u) * cores (%u) * threads (%u) < "
|
|
|
9ae3a8 |
+ "smp_cpus (%u)\n",
|
|
|
9ae3a8 |
+ sockets, cores, threads, smp);
|
|
|
9ae3a8 |
+ exit(1);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
smp_cpus = smp;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|