View Single Post
 
Old 03-05-2009, 09:52 PM
Shadow3k's Avatar
Shadow3k Shadow3k is offline
Jaguar
 
Join Date: Feb 2008
Posts: 32
How to disable TLB fix in Phenom 9x00 systems under OSx86 [code+test kernel]

Hello,

If you cant disable TLB fix in BIOS there is another way to do it - modify kernel and disable TLB fix on start up.

If you dont know what TLB is here is copy&paste from wikipedia:
"Translation Lookaside Buffer (TLB) Error in Original Phenoms
Before Phenom's release, a flaw was discovered in the translation lookaside buffer that could cause a system lock-up in rare circumstances. Phenom processors up to and including stepping "B2" and "BA" are affected by this bug. BIOS and software workarounds disable the TLB, and typically incur a performance penalty of at least 10%. This penalty was not accounted for in pre-release previews of Phenom, hence the performance of early Phenoms delivered to customers is expected to be less than the preview benchmarks. "B3" stepping Phenom processors were released March 27, 2008 without the TLB bug and with "xx50" model numbers."

So what we do it just disable a workarounds and get original Phenom perfomance back. BUT IT COULD CAUSE SYSTEM LOCK-UP IN RARE CIRCUMSTANCES.

More detailed information about errdata an workarounds is available here:
AMD Phenom CPU errata and workarounds (TLB fix in detail) http://translate.google.com/translat...istory_state0=

So by disabling TLB fix we get a perfomance boost on affected by bug systems:

Voodoo kernel, without modification (TLB fix enabled - system is stable):

Xbench score is 138.41

Voodoo kernel, with few more line (below) (TLB fix disabled - full Phenom perfomance!)


Xbench score is 179.63

30% increase in perfomance according to xbench

p.s. benchmarked without HDD testing.

Code:

#define PHENOM_MSR_HWCR 0xc0010015
#define PHENOM_MSR_BU_CFG 0xc0011023

static void
phenom_tlbfix_disable(void)
{
uint32_t lo;
uint32_t hi;
/*
* Phenom 9x00:
* Disable TLB fix for perfomance.
* To workarounds for errata 254, 298 and 309 to disable
*/

if (cpuid_family() == 16 )
{
rdmsr(PHENOM_MSR_HWCR, lo, hi);
wrmsr (PHENOM_MSR_HWCR, 0x01000010,hi);
rdmsr(PHENOM_MSR_BU_CFG, lo, hi);
wrmsr (PHENOM_MSR_BU_CFG, 0x00000020, hi);
printf("TLB FIX disabled! Phenom at full speed!\n");
}
}

Currently i placed function call in mtrr_update_action procedure of mtrr.c to unfix all cores at start up. If you know a better place for patching MSR send me a message.

Voodoo kernel compiled with Phenom TLB fix disabler code: http://rapidshare.com/files/206029294/mach_kernel.tlb

-
Zephyroths OSX 10.5.1 distro upgraded to ... 10.5.6 , Voodoo kernel... downgraded to 10.5.4 to get USB working again! (with help of iPC distributive)
AMD Phenom X4 9500, MSI K9A2 CF,AMDŽ 790X (SB600), 4GB DDR2, ATI HD3850
Disable TLB fix http://www.infinitemac.com/f19/pheno...isabler-t2316/
-
Compaq Mini 311c, Windows XP SP3 and Snow Leopard 10.6.2 http://myhpmini.com/forum/viewtopic.php?f=17&t=3302

Last edited by Shadow3k; 04-05-2009 at 10:59 AM.
Reply With Quote