Merge branch 'dev'

This commit is contained in:
XMRig 2019-12-14 13:14:09 +07:00
commit b15da20f9c
No known key found for this signature in database
GPG key ID: 446A53638BE94409
11 changed files with 65 additions and 13 deletions

View file

@ -1,3 +1,8 @@
# v5.2.1
- [#1408](https://github.com/xmrig/xmrig/pull/1408) Added RandomX boost script for Linux (if you don't like run miner with root privileges).
- Added support for [AMD Ryzen MSR registers](https://www.reddit.com/r/MoneroMining/comments/e962fu/9526_hs_on_ryzen_7_3700x_xmrig_520_1gb_pages_msr/) (Linux only).
- Fixed command line option `--randomx-wrmsr` option without parameters.
# v5.2.0 # v5.2.0
- **[#1388](https://github.com/xmrig/xmrig/pull/1388) Added [1GB huge pages support](https://xmrig.com/docs/miner/hugepages#onegb-huge-pages) for Linux.** - **[#1388](https://github.com/xmrig/xmrig/pull/1388) Added [1GB huge pages support](https://xmrig.com/docs/miner/hugepages#onegb-huge-pages) for Linux.**
- Added new option `1gb-pages` in `randomx` object with command line equivalent `--randomx-1gb-pages`. - Added new option `1gb-pages` in `randomx` object with command line equivalent `--randomx-1gb-pages`.

View file

@ -79,7 +79,7 @@ if (WITH_RANDOMX)
) )
endif() endif()
if (XMRIG_OS_LINUX) if (XMRIG_OS_LINUX AND NOT XMRIG_ARM)
list(APPEND SOURCES_CRYPTO src/crypto/rx/Rx_linux.cpp) list(APPEND SOURCES_CRYPTO src/crypto/rx/Rx_linux.cpp)
endif() endif()
else() else()

20
scripts/randomx_boost.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
modprobe msr
if cat /proc/cpuinfo | grep "AMD Ryzen" > /dev/null;
then
echo "Detected Ryzen"
wrmsr -a 0xc0011022 0x510000
wrmsr -a 0xc001102b 0x1808cc16
wrmsr -a 0xc0011020 0
wrmsr -a 0xc0011021 0x40
echo "MSR register values for Ryzen applied"
elif cat /proc/cpuinfo | grep "Intel" > /dev/null;
then
echo "Detected Intel"
wrmsr -a 0x1a4 6
echo "MSR register values for Intel applied"
else
echo "No supported CPU detected"
fi

View file

@ -99,7 +99,7 @@ public:
# endif # endif
static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); } static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); }
static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; } static inline uint64_t toDiff(uint64_t target) { return target ? (0xFFFFFFFFFFFFFFFFULL / target) : 0; }
inline bool operator!=(const Job &other) const { return !isEqual(other); } inline bool operator!=(const Job &other) const { return !isEqual(other); }
inline bool operator==(const Job &other) const { return isEqual(other); } inline bool operator==(const Job &other) const { return isEqual(other); }

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

@ -170,6 +170,10 @@ void xmrig::ConfigTransform::transform(rapidjson::Document &doc, int key, const
return set(doc, kRandomX, "1gb-pages", true); return set(doc, kRandomX, "1gb-pages", true);
case IConfig::RandomXWrmsrKey: /* --randomx-wrmsr */ case IConfig::RandomXWrmsrKey: /* --randomx-wrmsr */
if (arg == nullptr) {
return set(doc, kRandomX, "wrmsr", true);
}
return set(doc, kRandomX, "wrmsr", static_cast<int64_t>(strtol(arg, nullptr, 10))); return set(doc, kRandomX, "wrmsr", static_cast<int64_t>(strtol(arg, nullptr, 10)));
# endif # endif

View file

@ -100,7 +100,7 @@ static const option options[] = {
{ "randomx-mode", 1, nullptr, IConfig::RandomXModeKey }, { "randomx-mode", 1, nullptr, IConfig::RandomXModeKey },
{ "randomx-1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey }, { "randomx-1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey },
{ "1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey }, { "1gb-pages", 0, nullptr, IConfig::RandomX1GbPagesKey },
{ "randomx-wrmsr", 1, nullptr, IConfig::RandomXWrmsrKey }, { "randomx-wrmsr", 2, nullptr, IConfig::RandomXWrmsrKey },
# endif # endif
# ifdef XMRIG_FEATURE_OPENCL # ifdef XMRIG_FEATURE_OPENCL
{ "opencl", 0, nullptr, IConfig::OclKey }, { "opencl", 0, nullptr, IConfig::OclKey },

View file

@ -115,7 +115,7 @@ void xmrig::Rx::init(IRxListener *listener)
} }
#ifndef XMRIG_OS_LINUX #if !defined(XMRIG_OS_LINUX) || defined(XMRIG_ARM)
void xmrig::Rx::osInit(const RxConfig &) void xmrig::Rx::osInit(const RxConfig &)
{ {
} }

View file

@ -109,7 +109,13 @@ rapidjson::Value xmrig::RxConfig::toJSON(rapidjson::Document &doc) const
obj.AddMember(StringRef(kInit), m_threads, allocator); obj.AddMember(StringRef(kInit), m_threads, allocator);
obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator); obj.AddMember(StringRef(kMode), StringRef(modeName()), allocator);
obj.AddMember(StringRef(kOneGbPages), m_oneGbPages, allocator); obj.AddMember(StringRef(kOneGbPages), m_oneGbPages, allocator);
obj.AddMember(StringRef(kWrmsr), m_wrmsr < 0 ? Value(kFalseType) : Value(m_wrmsr), allocator);
if (m_wrmsr < 0 || m_wrmsr == 6) {
obj.AddMember(StringRef(kWrmsr), m_wrmsr == 6, allocator);
}
else {
obj.AddMember(StringRef(kWrmsr), m_wrmsr, allocator);
}
# ifdef XMRIG_FEATURE_HWLOC # ifdef XMRIG_FEATURE_HWLOC
if (!m_nodeset.empty()) { if (!m_nodeset.empty()) {

View file

@ -88,27 +88,44 @@ static bool wrmsr_on_all_cpus(uint32_t reg, uint64_t value)
free(namelist); free(namelist);
if (errors) { if (errors) {
LOG_WARN(CLEAR "%s" YELLOW_BOLD_S "cannot set MSR 0x%04" PRIx32 " to 0x%04" PRIx64, rx_tag(), reg, value); LOG_WARN(CLEAR "%s" YELLOW_BOLD_S "cannot set MSR 0x%08" PRIx32 " to 0x%08" PRIx64, rx_tag(), reg, value);
} }
return errors == 0; return errors == 0;
} }
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
void xmrig::Rx::osInit(const RxConfig &config) void xmrig::Rx::osInit(const RxConfig &config)
{ {
if (config.wrmsr() < 0 || Cpu::info()->vendor() != ICpuInfo::VENDOR_INTEL) { if (config.wrmsr() < 0) {
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);
wrmsr_on_all_cpus(0xC0011020, 0);
wrmsr_on_all_cpus(0xC0011021, 0x40);
return; return;
} }
if (Cpu::info()->vendor() == ICpuInfo::VENDOR_INTEL && wrmsr_modprobe()) {
wrmsr_on_all_cpus(0x1a4, config.wrmsr()); wrmsr_on_all_cpus(0x1a4, config.wrmsr());
} }
}

View file

@ -28,7 +28,7 @@
#define APP_ID "xmrig" #define APP_ID "xmrig"
#define APP_NAME "XMRig" #define APP_NAME "XMRig"
#define APP_DESC "XMRig miner" #define APP_DESC "XMRig miner"
#define APP_VERSION "5.2.0" #define APP_VERSION "5.2.1-dev"
#define APP_DOMAIN "xmrig.com" #define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com" #define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2019 xmrig.com"
@ -36,7 +36,7 @@
#define APP_VER_MAJOR 5 #define APP_VER_MAJOR 5
#define APP_VER_MINOR 2 #define APP_VER_MINOR 2
#define APP_VER_PATCH 0 #define APP_VER_PATCH 1
#ifdef _MSC_VER #ifdef _MSC_VER
# if (_MSC_VER >= 1920) # if (_MSC_VER >= 1920)