From ff9da5b2e532cf136c49f97b5f3dfbd4e768fba3 Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Thu, 21 Oct 2004 17:11:30 +0000 Subject: [PATCH] bitkeeper revision 1.1159.127.1 (4177edc2yMpJyLOU9Q_EQYFZXYJiIw) Fix option ``noht'' for machines which report HT logical cpus in their MP tables. --- xen/arch/x86/setup.c | 15 ++++++--------- xen/arch/x86/smpboot.c | 9 +++++++++ xen/common/dom0_ops.c | 9 +-------- xen/include/xen/smp.h | 2 ++ 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 975f8a4724..b565bbd083 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -23,7 +23,7 @@ extern void time_init(void); extern void ac_timer_init(void); extern void initialize_keytable(); extern int opt_nosmp, opt_watchdog, opt_noacpi; -extern int opt_ignorebiostables, opt_noht; +extern int opt_ignorebiostables; extern int do_timer_lists_from_pit; char ignore_irq13; /* set if exception 16 works */ @@ -116,12 +116,6 @@ static void __init init_intel(struct cpuinfo_x86 *c) if ( c->x86 == 6 && c->x86_model < 3 && c->x86_mask < 3 ) clear_bit(X86_FEATURE_SEP, &c->x86_capability); - if ( opt_noht ) - { - opt_noacpi = 1; /* Virtual CPUs only appear in ACPI tables. */ - clear_bit(X86_FEATURE_HT, &c->x86_capability[0]); - } - #ifdef CONFIG_SMP if ( test_bit(X86_FEATURE_HT, &c->x86_capability) ) { @@ -129,8 +123,11 @@ static void __init init_intel(struct cpuinfo_x86 *c) int initial_apic_id, siblings, cpu = smp_processor_id(); cpuid(1, &eax, &ebx, &ecx, &edx); - siblings = (ebx & 0xff0000) >> 16; - + ht_per_core = siblings = (ebx & 0xff0000) >> 16; + + if ( opt_noht ) + clear_bit(X86_FEATURE_HT, &c->x86_capability[0]); + if ( siblings <= 1 ) { printk(KERN_INFO "CPU#%d: Hyper-Threading is disabled\n", cpu); diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index bd9c0951ec..a8017a4a65 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -57,6 +57,9 @@ static int max_cpus = -1; /* Total count of live CPUs */ int smp_num_cpus = 1; +/* Number of hyperthreads per core */ +int ht_per_core = 1; + /* Bitmask of currently online CPUs */ unsigned long cpu_online_map; @@ -868,6 +871,12 @@ void __init smp_boot_cpus(void) if (apicid == boot_cpu_apicid) continue; + /* + * Don't start hyperthreads if option noht requested. + */ + if (opt_noht && (apicid & (ht_per_core - 1))) + continue; + if (!(phys_cpu_present_map & (1 << bit))) continue; if ((max_cpus >= 0) && (max_cpus <= cpucount+1)) diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 12762d1af9..ed2785a0ea 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -498,16 +498,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op) case DOM0_PHYSINFO: { - extern int phys_proc_id[]; - dom0_physinfo_t *pi = &op->u.physinfo; - int old_id = phys_proc_id[0]; - int ht = 0; - - while( ( ht < smp_num_cpus ) && ( phys_proc_id[ht] == old_id ) ) ht++; - - pi->ht_per_core = ht; + pi->ht_per_core = opt_noht ? 1 : ht_per_core; pi->cores = smp_num_cpus / pi->ht_per_core; pi->total_pages = max_page; pi->free_pages = avail_domheap_pages(); diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h index 12885a5037..13e370cdca 100644 --- a/xen/include/xen/smp.h +++ b/xen/include/xen/smp.h @@ -52,6 +52,8 @@ extern int smp_call_function (void (*func) (void *info), void *info, extern int smp_threads_ready; extern int smp_num_cpus; +extern int ht_per_core; +extern int opt_noht; extern volatile unsigned long smp_msg_data; extern volatile int smp_src_cpu; -- 2.39.5