diff options
author | Igor Mammedov <imammedo@redhat.com> | 2016-07-06 08:20:40 +0200 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2016-07-20 12:02:17 -0300 |
commit | 4ec60c76d5ab513e375f17b043d2b9cb849adf6c (patch) | |
tree | a4abb8eb1c43984d259757a250312f629f32c7cb /target-i386 | |
parent | 7baef5cfea3d2271442fee602eb0b0c872b54b8e (diff) |
pc: cpu: Consolidate apic-id validity checks in pc_cpu_pre_plug()
Machine code knows about all possible APIC IDs so use that
instead of hack which does O(n^2) complexity duplicate
checks, interating over global CPUs list.
As result duplicate check is done only once with O(log n) complexity.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/cpu.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 89ca3268d4..5d77c09863 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1907,8 +1907,6 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, const char *name, { X86CPU *cpu = X86_CPU(obj); DeviceState *dev = DEVICE(obj); - const int64_t min = 0; - const int64_t max = UINT32_MAX; Error *error = NULL; int64_t value; @@ -1923,17 +1921,6 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, const char *name, error_propagate(errp, error); return; } - if (value < min || value > max) { - error_setg(errp, "Property %s.%s doesn't take value %" PRId64 - " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , - object_get_typename(obj), name, value, min, max); - return; - } - - if ((value != cpu->apic_id) && cpu_exists(value)) { - error_setg(errp, "CPU with APIC ID %" PRIi64 " exists", value); - return; - } cpu->apic_id = value; } |