Merge of xmrig v6.5.0
This commit is contained in:
commit
a57d1bbbda
86 changed files with 15293 additions and 490 deletions
|
@ -42,6 +42,7 @@ class RxPrivate;
|
|||
|
||||
static bool osInitialized = false;
|
||||
static bool msrInitialized = false;
|
||||
static bool msrEnabled = false;
|
||||
static RxPrivate *d_ptr = nullptr;
|
||||
|
||||
|
||||
|
@ -93,7 +94,8 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu
|
|||
if (seed.algorithm().family() != Algorithm::RANDOM_X) {
|
||||
if (msrInitialized) {
|
||||
msrDestroy();
|
||||
msrInitialized = false;
|
||||
msrInitialized = false;
|
||||
msrEnabled = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -107,8 +109,8 @@ bool xmrig::Rx::init(const T &seed, const RxConfig &config, const CpuConfig &cpu
|
|||
}
|
||||
|
||||
if (!msrInitialized) {
|
||||
msrInit(config, cpu.threads().get(seed.algorithm()).data());
|
||||
msrInitialized = true;
|
||||
msrEnabled = msrInit(config, cpu.threads().get(seed.algorithm()).data());
|
||||
msrInitialized = true;
|
||||
}
|
||||
|
||||
if (!osInitialized) {
|
||||
|
@ -132,9 +134,15 @@ bool xmrig::Rx::isReady(const T &seed)
|
|||
}
|
||||
|
||||
|
||||
#ifndef XMRIG_FEATURE_MSR
|
||||
void xmrig::Rx::msrInit(const RxConfig &, const std::vector<CpuThread> &)
|
||||
#ifdef XMRIG_FEATURE_MSR
|
||||
bool xmrig::Rx::isMSR()
|
||||
{
|
||||
return msrEnabled;
|
||||
}
|
||||
#else
|
||||
bool xmrig::Rx::msrInit(const RxConfig &, const std::vector<CpuThread> &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,8 +63,14 @@ public:
|
|||
static void setMainLoopBounds(const std::pair<const void*, const void*>& bounds);
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_MSR
|
||||
static bool isMSR();
|
||||
# else
|
||||
static constexpr bool isMSR() { return false; }
|
||||
# endif
|
||||
|
||||
private:
|
||||
static void msrInit(const RxConfig &config, const std::vector<CpuThread>& threads);
|
||||
static bool msrInit(const RxConfig &config, const std::vector<CpuThread>& threads);
|
||||
static void msrDestroy();
|
||||
static void setupMainLoopExceptionFrame();
|
||||
};
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
#include "crypto/rx/RxQueue.h"
|
||||
#include "backend/common/interfaces/IRxListener.h"
|
||||
#include "base/io/Async.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/tools/Handle.h"
|
||||
#include "crypto/rx/RxBasicStorage.h"
|
||||
|
||||
|
||||
|
@ -41,11 +41,7 @@
|
|||
xmrig::RxQueue::RxQueue(IRxListener *listener) :
|
||||
m_listener(listener)
|
||||
{
|
||||
m_async = new uv_async_t;
|
||||
m_async->data = this;
|
||||
|
||||
uv_async_init(uv_default_loop(), m_async, [](uv_async_t *handle) { static_cast<RxQueue *>(handle->data)->onReady(); });
|
||||
|
||||
m_async = std::make_shared<Async>(this);
|
||||
m_thread = std::thread(&RxQueue::backgroundInit, this);
|
||||
}
|
||||
|
||||
|
@ -61,8 +57,6 @@ xmrig::RxQueue::~RxQueue()
|
|||
m_thread.join();
|
||||
|
||||
delete m_storage;
|
||||
|
||||
Handle::close(m_async);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +161,7 @@ void xmrig::RxQueue::backgroundInit()
|
|||
}
|
||||
|
||||
m_state = STATE_IDLE;
|
||||
uv_async_send(m_async);
|
||||
m_async->send();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define XMRIG_RX_QUEUE_H
|
||||
|
||||
|
||||
#include "base/io/Async.h"
|
||||
#include "base/kernel/interfaces/IAsyncListener.h"
|
||||
#include "base/tools/Object.h"
|
||||
#include "crypto/common/HugePagesInfo.h"
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
|
@ -40,9 +40,6 @@
|
|||
#include <thread>
|
||||
|
||||
|
||||
using uv_async_t = struct uv_async_s;
|
||||
|
||||
|
||||
namespace xmrig
|
||||
{
|
||||
|
||||
|
@ -75,19 +72,22 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class RxQueue
|
||||
class RxQueue : public IAsyncListener
|
||||
{
|
||||
public:
|
||||
XMRIG_DISABLE_COPY_MOVE(RxQueue);
|
||||
|
||||
RxQueue(IRxListener *listener);
|
||||
~RxQueue();
|
||||
~RxQueue() override;
|
||||
|
||||
HugePagesInfo hugePages();
|
||||
RxDataset *dataset(const Job &job, uint32_t nodeId);
|
||||
template<typename T> bool isReady(const T &seed);
|
||||
void enqueue(const RxSeed &seed, const std::vector<uint32_t> &nodeset, uint32_t threads, bool hugePages, bool oneGbPages, RxConfig::Mode mode, int priority);
|
||||
|
||||
protected:
|
||||
inline void onAsync() override { onReady(); }
|
||||
|
||||
private:
|
||||
enum State {
|
||||
STATE_IDLE,
|
||||
|
@ -105,9 +105,9 @@ private:
|
|||
State m_state = STATE_IDLE;
|
||||
std::condition_variable m_cv;
|
||||
std::mutex m_mutex;
|
||||
std::shared_ptr<Async> m_async;
|
||||
std::thread m_thread;
|
||||
std::vector<RxQueueItem> m_queue;
|
||||
uv_async_t *m_async = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static bool wrmsr_on_all_cpus(uint32_t reg, uint64_t value, uint64_t mask, T&& c
|
|||
|
||||
static bool wrmsr_modprobe()
|
||||
{
|
||||
if (system("/sbin/modprobe msr > /dev/null 2>&1") != 0) {
|
||||
if (system("/sbin/modprobe msr allow_writes=on > /dev/null 2>&1") != 0) {
|
||||
LOG_WARN(CLEAR "%s" YELLOW_BOLD_S "msr kernel module is not available", tag);
|
||||
|
||||
return false;
|
||||
|
@ -272,21 +272,25 @@ void Rx::setMainLoopBounds(const std::pair<const void*, const void*>& bounds)
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
void xmrig::Rx::msrInit(const RxConfig &config, const std::vector<CpuThread>& threads)
|
||||
bool xmrig::Rx::msrInit(const RxConfig &config, const std::vector<CpuThread> &threads)
|
||||
{
|
||||
const auto &preset = config.msrPreset();
|
||||
if (preset.empty()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint64_t ts = Chrono::steadyMSecs();
|
||||
|
||||
if (wrmsr(preset, threads, config.cacheQoS(), config.rdmsr())) {
|
||||
LOG_NOTICE(CLEAR "%s" GREEN_BOLD_S "register values for \"%s\" preset has been set successfully" BLACK_BOLD(" (%" PRIu64 " ms)"), tag, config.msrPresetName(), Chrono::steadyMSecs() - ts);
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
LOG_ERR(CLEAR "%s" RED_BOLD_S "FAILED TO APPLY MSR MOD, HASHRATE WILL BE LOW", tag);
|
||||
}
|
||||
|
||||
|
||||
LOG_ERR(CLEAR "%s" RED_BOLD_S "FAILED TO APPLY MSR MOD, HASHRATE WILL BE LOW", tag);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ static HANDLE wrmsr_install_driver()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto it = dir.end(); it != dir.begin(); --it) {
|
||||
for (auto it = dir.end() - 1; it != dir.begin(); --it) {
|
||||
if ((*it == L'\\') || (*it == L'/')) {
|
||||
++it;
|
||||
*it = L'\0';
|
||||
|
@ -395,21 +395,24 @@ void Rx::setMainLoopBounds(const std::pair<const void*, const void*>& bounds)
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
void xmrig::Rx::msrInit(const RxConfig &config, const std::vector<CpuThread>& threads)
|
||||
bool xmrig::Rx::msrInit(const RxConfig &config, const std::vector<CpuThread>& threads)
|
||||
{
|
||||
const auto &preset = config.msrPreset();
|
||||
if (preset.empty()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint64_t ts = Chrono::steadyMSecs();
|
||||
|
||||
if (wrmsr(preset, threads, config.cacheQoS(), config.rdmsr())) {
|
||||
LOG_NOTICE(CLEAR "%s" GREEN_BOLD_S "register values for \"%s\" preset has been set successfully" BLACK_BOLD(" (%" PRIu64 " ms)"), tag, config.msrPresetName(), Chrono::steadyMSecs() - ts);
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
LOG_ERR(CLEAR "%s" RED_BOLD_S "FAILED TO APPLY MSR MOD, HASHRATE WILL BE LOW", tag);
|
||||
}
|
||||
|
||||
LOG_ERR(CLEAR "%s" RED_BOLD_S "FAILED TO APPLY MSR MOD, HASHRATE WILL BE LOW", tag);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue