diff options
author | netchild <netchild@FreeBSD.org> | 2005-12-31 14:39:20 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2005-12-31 14:39:20 +0000 |
commit | 507a9b3e936156202e89c42d2265863c3903254f (patch) | |
tree | c13a8d302e0337dbf08ab02516a66627814ead6b /sys/amd64 | |
parent | cd697cab850aef4c7941ebff10521fc87dbf7aee (diff) | |
download | FreeBSD-src-507a9b3e936156202e89c42d2265863c3903254f.zip FreeBSD-src-507a9b3e936156202e89c42d2265863c3903254f.tar.gz |
MI changes:
- provide an interface (macros) to the page coloring part of the VM system,
this allows to try different coloring algorithms without the need to
touch every file [1]
- make the page queue tuning values readable: sysctl vm.stats.pagequeue
- autotuning of the page coloring values based upon the cache size instead
of options in the kernel config (disabling of the page coloring as a
kernel option is still possible)
MD changes:
- detection of the cache size: only IA32 and AMD64 (untested) contains
cache size detection code, every other arch just comes with a dummy
function (this results in the use of default values like it was the
case without the autotuning of the page coloring)
- print some more info on Intel CPU's (like we do on AMD and Transmeta
CPU's)
Note to AMD owners (IA32 and AMD64): please run "sysctl vm.stats.pagequeue"
and report if the cache* values are zero (= bug in the cache detection code)
or not.
Based upon work by: Chad David <davidc@acns.ab.ca> [1]
Reviewed by: alc, arch (in 2004)
Discussed with: alc, Chad David, arch (in 2004)
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/identcpu.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index ff56c16..53467bd 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -69,6 +69,8 @@ void panicifcpuunsupported(void); static void print_AMD_info(void); static void print_AMD_assoc(int i); +void setPQL2(int *const size, int *const ways); +static void setPQL2_AMD(void); int cpu_class; char machine[] = "amd64"; @@ -93,6 +95,9 @@ static struct { { "Sledgehammer", CPUCLASS_K8 }, /* CPU_SLEDGEHAMMER */ }; +extern int pq_l2size; +extern int pq_l2nways; + void printcpuinfo(void) { @@ -526,3 +531,30 @@ print_AMD_info(void) print_AMD_l2_assoc((regs[2] >> 12) & 0x0f); } } + +static void +setPQL2_AMD(void) +{ + if (cpu_exthigh >= 0x80000006) { + u_int regs[4]; + + do_cpuid(0x80000006, regs); + *size = regs[2] >> 16; + *ways = (regs[2] >> 12) & 0x0f; + switch (*ways) { + case 0: /* disabled/not present */ + case 15: /* fully associative */ + default: *ways = 1; break; /* reserved configuration */ + case 4: *ways = 4; break; + case 6: *ways = 8; break; + case 8: *ways = 16; break; + } + } +} + +void +setPQL2(int *const size, int *const ways); +{ + if (strcmp(cpu_vendor, "AuthenticAMD") == 0) + setPQL2_AMD(size, ways); +} |