Fixed MSR.

This commit is contained in:
XMRig 2019-12-11 20:09:25 +07:00
parent de7ed2b968
commit 96ee721d21
No known key found for this signature in database
GPG key ID: 446A53638BE94409
2 changed files with 17 additions and 8 deletions

View file

@ -17,7 +17,7 @@
"init": -1, "init": -1,
"mode": "auto", "mode": "auto",
"1gb-pages": false, "1gb-pages": false,
"wrmsr": 6, "wrmsr": true,
"numa": true "numa": true
}, },
"cpu": { "cpu": {

View file

@ -95,6 +95,18 @@ static bool wrmsr_on_all_cpus(uint32_t reg, uint64_t value)
} }
static bool wrmsr_modprobe()
{
if (system("/sbin/modprobe msr > /dev/null 2>&1") != 0) {
LOG_WARN(CLEAR "%s" YELLOW_BOLD_S "msr kernel module is not available", rx_tag());
return false;
}
return true;
}
} // namespace xmrig } // namespace xmrig
@ -104,17 +116,14 @@ void xmrig::Rx::osInit(const RxConfig &config)
return; return;
} }
if (system("/sbin/modprobe msr > /dev/null 2>&1") != 0) { if (Cpu::info()->assembly() == Assembly::RYZEN && wrmsr_modprobe()) {
LOG_WARN(CLEAR "%s" YELLOW_BOLD_S "msr kernel module is not available", rx_tag()); wrmsr_on_all_cpus(0xC0011022, 0x510000);
wrmsr_on_all_cpus(0xC001102b, 0x1808cc16);
return; return;
} }
if (Cpu::info()->vendor() == ICpuInfo::VENDOR_AMD) { if (Cpu::info()->vendor() == ICpuInfo::VENDOR_INTEL && wrmsr_modprobe()) {
wrmsr_on_all_cpus(0xC0011022, 0x510000);
wrmsr_on_all_cpus(0xC001102b, 0x1808cc16);
}
else if (Cpu::info()->vendor() == ICpuInfo::VENDOR_INTEL) {
wrmsr_on_all_cpus(0x1a4, config.wrmsr()); wrmsr_on_all_cpus(0x1a4, config.wrmsr());
} }
} }