PERFORCE change 124215 for review

Peter Wemm peter at FreeBSD.org
Fri Jul 27 21:25:23 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=124215

Change 124215 by peter at peter_overcee on 2007/07/27 21:25:19

	Try out jhb's fix instead.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/local_apic.c#75 edit
.. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#127 edit
.. //depot/projects/hammer/sys/i386/i386/local_apic.c#32 edit
.. //depot/projects/hammer/sys/i386/i386/mp_machdep.c#63 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/local_apic.c#75 (text+ko) ====

@@ -1060,10 +1060,6 @@
 	if (retval != 0)
 		printf("%s: Failed to setup the local APIC: returned %d\n",
 		    best_enum->apic_name, retval);
-#ifdef SMP
-	/* Last, setup the cpu topology now that we have probed CPUs */
-	mp_topology();
-#endif
 }
 SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_FIRST, apic_setup_local, NULL)
 

==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#127 (text+ko) ====

@@ -194,18 +194,8 @@
 
 	/* Build the smp_topology map. */
 	/* Nothing to do if there is no HTT support. */
-	if ((cpu_feature & CPUID_HTT) == 0)
-		return;
-	logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-	if (logical_cpus <= 1)
+	if (hyperthreading_cpus <= 1)
 		return;
-	/* Nothing to do if reported cores are physical cores. */
-	if (strcmp(cpu_vendor, "GenuineIntel") == 0 && cpu_high >= 4) {
-		cpuid_count(4, 0, regs);
-		if ((regs[0] & 0x1f) != 0 &&
-		    logical_cpus <= ((regs[0] >> 26) & 0x3f) + 1)
-			return;
-	}
 	group = &mp_groups[0];
 	groups = 1;
 	for (cpu = 0, apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) {
@@ -215,7 +205,8 @@
 		 * If the current group has members and we're not a logical
 		 * cpu, create a new group.
 		 */
-		if (group->cg_count != 0 && (apic_id % logical_cpus) == 0) {
+		if (group->cg_count != 0 &&
+		    (apic_id % hyperthreading_cpus) == 0) {
 			group++;
 			groups++;
 		}
@@ -420,6 +411,9 @@
 	}
 
 	set_interrupt_apic_ids();
+
+	/* Last, setup the cpu topology now that we have probed CPUs */
+	mp_topology();
 }
 
 

==== //depot/projects/hammer/sys/i386/i386/local_apic.c#32 (text+ko) ====

@@ -1064,10 +1064,6 @@
 	if (retval != 0)
 		printf("%s: Failed to setup the local APIC: returned %d\n",
 		    best_enum->apic_name, retval);
-#ifdef SMP
-	/* Last, setup the cpu topology now that we have probed CPUs */
-	mp_topology();
-#endif
 }
 SYSINIT(apic_init, SI_SUB_CPU, SI_ORDER_FIRST, apic_init, NULL)
 

==== //depot/projects/hammer/sys/i386/i386/mp_machdep.c#63 (text+ko) ====

@@ -249,18 +249,8 @@
 
 	/* Build the smp_topology map. */
 	/* Nothing to do if there is no HTT support. */
-	if ((cpu_feature & CPUID_HTT) == 0)
-		return;
-	logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-	if (logical_cpus <= 1)
+	if (hyperthreading_cpus <= 1)
 		return;
-	/* Nothing to do if reported cores are physical cores. */
-	if (strcmp(cpu_vendor, "GenuineIntel") == 0 && cpu_high >= 4) {
-		cpuid_count(4, 0, regs);
-		if ((regs[0] & 0x1f) != 0 &&
-		    logical_cpus <= ((regs[0] >> 26) & 0x3f) + 1)
-			return;
-	}
 	group = &mp_groups[0];
 	groups = 1;
 	for (cpu = 0, apic_id = 0; apic_id <= MAX_APIC_ID; apic_id++) {
@@ -270,7 +260,8 @@
 		 * If the current group has members and we're not a logical
 		 * cpu, create a new group.
 		 */
-		if (group->cg_count != 0 && (apic_id % logical_cpus) == 0) {
+		if (group->cg_count != 0 &&
+		    (apic_id % hyperthreading_cpus) == 0) {
 			group++;
 			groups++;
 		}
@@ -469,6 +460,9 @@
 	}
 
 	set_interrupt_apic_ids();
+
+	/* Last, setup the cpu topology now that we have probed CPUs */
+	mp_topology();
 }
 
 


More information about the p4-projects mailing list