Skip to content

Commit

Permalink
don't use cpuid level 4 in x86 cpu topology detection if it's not sup…
Browse files Browse the repository at this point in the history
…ported

This regression was introduced in r213323.
There are probably no Intel cpus that support amd64 mode, but do not
support cpuid level 4, but it's better to keep i386 and amd64 versions
of this code in sync.

Discovered by:	pho
Tested by:	pho
MFC after:	2 weeks
  • Loading branch information
avg-I committed Jun 6, 2011
1 parent 0aa7541 commit ecee337
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions sys/amd64/amd64/mp_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,11 @@ topo_probe_0x4(void)
* logical processors that belong to the same core
* as BSP thus deducing number of threads per core.
*/
cpuid_count(0x04, 0, p);
max_cores = ((p[0] >> 26) & 0x3f) + 1;
if (cpu_high >= 0x4) {
cpuid_count(0x04, 0, p);
max_cores = ((p[0] >> 26) & 0x3f) + 1;
} else
max_cores = 1;
core_id_bits = mask_width(max_logical/max_cores);
if (core_id_bits < 0)
return;
Expand Down
7 changes: 5 additions & 2 deletions sys/i386/i386/mp_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,11 @@ topo_probe_0x4(void)
* logical processors that belong to the same core
* as BSP thus deducing number of threads per core.
*/
cpuid_count(0x04, 0, p);
max_cores = ((p[0] >> 26) & 0x3f) + 1;
if (cpu_high >= 0x4) {
cpuid_count(0x04, 0, p);
max_cores = ((p[0] >> 26) & 0x3f) + 1;
} else
max_cores = 1;
core_id_bits = mask_width(max_logical/max_cores);
if (core_id_bits < 0)
return;
Expand Down

0 comments on commit ecee337

Please sign in to comment.