diff options
-rw-r--r-- | xmrstak/backend/amd/minethd.cpp | 6 | ||||
-rw-r--r-- | xmrstak/backend/amd/minethd.hpp | 1 | ||||
-rw-r--r-- | xmrstak/backend/cpu/minethd.cpp | 7 | ||||
-rw-r--r-- | xmrstak/backend/cpu/minethd.hpp | 1 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.cpp | 6 | ||||
-rw-r--r-- | xmrstak/backend/nvidia/minethd.hpp | 1 | ||||
-rw-r--r-- | xmrstak/cli/cli-miner.cpp | 8 | ||||
-rw-r--r-- | xmrstak/jconf.cpp | 9 | ||||
-rw-r--r-- | xmrstak/misc/executor.cpp | 11 | ||||
-rw-r--r-- | xmrstak/misc/executor.hpp | 2 | ||||
-rw-r--r-- | xmrstak/net/msgstruct.hpp | 11 |
11 files changed, 50 insertions, 13 deletions
diff --git a/xmrstak/backend/amd/minethd.cpp b/xmrstak/backend/amd/minethd.cpp index 912587b..94fc088 100644 --- a/xmrstak/backend/amd/minethd.cpp +++ b/xmrstak/backend/amd/minethd.cpp @@ -59,6 +59,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, GpuContext* ctx, const jconf::th pGpuCtx = ctx; this->affinity = cfg.cpu_aff; + std::unique_lock<std::mutex> lck(thd_aff_set); std::future<void> order_guard = order_fix.get_future(); oWorkThd = std::thread(&minethd::work_main, this); @@ -180,6 +181,9 @@ void minethd::work_main() bindMemoryToNUMANode(affinity); order_fix.set_value(); + std::unique_lock<std::mutex> lck(thd_aff_set); + lck.release(); + std::this_thread::yield(); uint64_t iCount = 0; cryptonight_ctx* cpu_ctx; @@ -239,7 +243,7 @@ void minethd::work_main() if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget) executor::inst()->push_event(ex_event(job_result(oWork.sJobID, results[i], bResult), oWork.iPoolId)); else - executor::inst()->log_result_error("AMD Invalid Result"); + executor::inst()->push_event(ex_event("AMD Invalid Result", oWork.iPoolId)); } iCount += pGpuCtx->rawIntensity; diff --git a/xmrstak/backend/amd/minethd.hpp b/xmrstak/backend/amd/minethd.hpp index c4c2ce6..c808192 100644 --- a/xmrstak/backend/amd/minethd.hpp +++ b/xmrstak/backend/amd/minethd.hpp @@ -38,6 +38,7 @@ private: miner_work oWork; std::promise<void> order_fix; + std::mutex thd_aff_set; std::thread oWorkThd; int64_t affinity; diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index 8b913cf..8183adf 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -102,6 +102,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefet bNoPrefetch = no_prefetch; this->affinity = affinity; + std::unique_lock<std::mutex> lck(thd_aff_set); std::future<void> order_guard = order_fix.get_future(); if(double_work) @@ -340,6 +341,9 @@ void minethd::work_main() bindMemoryToNUMANode(affinity); order_fix.set_value(); + std::unique_lock<std::mutex> lck(thd_aff_set); + lck.release(); + std::this_thread::yield(); cn_hash_fun hash_fun; cryptonight_ctx* ctx; @@ -467,6 +471,9 @@ void minethd::double_work_main() bindMemoryToNUMANode(affinity); order_fix.set_value(); + std::unique_lock<std::mutex> lck(thd_aff_set); + lck.release(); + std::this_thread::yield(); cn_hash_fun_dbl hash_fun; cryptonight_ctx* ctx0; diff --git a/xmrstak/backend/cpu/minethd.hpp b/xmrstak/backend/cpu/minethd.hpp index 670ec8d..5520d9e 100644 --- a/xmrstak/backend/cpu/minethd.hpp +++ b/xmrstak/backend/cpu/minethd.hpp @@ -46,6 +46,7 @@ private: miner_work oWork; std::promise<void> order_fix; + std::mutex thd_aff_set; std::thread oWorkThd; int64_t affinity; diff --git a/xmrstak/backend/nvidia/minethd.cpp b/xmrstak/backend/nvidia/minethd.cpp index a1cafa7..5170305 100644 --- a/xmrstak/backend/nvidia/minethd.cpp +++ b/xmrstak/backend/nvidia/minethd.cpp @@ -79,6 +79,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, const jconf::thd_cfg& cfg) ctx.device_bsleep = (int)cfg.bsleep; this->affinity = cfg.cpu_aff; + std::unique_lock<std::mutex> lck(thd_aff_set); std::future<void> order_guard = order_fix.get_future(); oWorkThd = std::thread(&minethd::work_main, this); @@ -207,6 +208,9 @@ void minethd::work_main() bindMemoryToNUMANode(affinity); order_fix.set_value(); + std::unique_lock<std::mutex> lck(thd_aff_set); + lck.release(); + std::this_thread::yield(); uint64_t iCount = 0; cryptonight_ctx* cpu_ctx; @@ -281,7 +285,7 @@ void minethd::work_main() if ( (*((uint64_t*)(bResult + 24))) < oWork.iTarget) executor::inst()->push_event(ex_event(job_result(oWork.sJobID, foundNonce[i], bResult), oWork.iPoolId)); else - executor::inst()->log_result_error("NVIDIA Invalid Result"); + executor::inst()->push_event(ex_event("NVIDIA Invalid Result", oWork.iPoolId)); } iCount += h_per_round; diff --git a/xmrstak/backend/nvidia/minethd.hpp b/xmrstak/backend/nvidia/minethd.hpp index f6d989c..ffcdab1 100644 --- a/xmrstak/backend/nvidia/minethd.hpp +++ b/xmrstak/backend/nvidia/minethd.hpp @@ -45,6 +45,7 @@ private: miner_work oWork; std::promise<void> order_fix; + std::mutex thd_aff_set; std::thread oWorkThd; int64_t affinity; diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 284cf4a..f0f3c3a 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -130,7 +130,11 @@ std::string get_multipool_entry(bool& final) std::cout<<"- Password (mostly empty or x):"<<std::endl; getline(std::cin, passwd); +#ifdef CONF_NO_TLS + bool tls = false; +#else bool tls = read_yes_no("- Does this pool port support TLS/SSL? Use no if unknown. (y/N)"); +#endif bool nicehash = read_yes_no("- Do you want to use nicehash on this pool? (y/n)"); int64_t pool_weight; @@ -207,7 +211,11 @@ void do_guided_config(bool userSetPasswd) getline(std::cin, passwd); } +#ifdef CONF_NO_TLS + bool tls = false; +#else bool tls = read_yes_no("- Does this pool port support TLS/SSL? Use no if unknown. (y/N)"); +#endif bool nicehash = read_yes_no("- Do you want to use nicehash on this pool? (y/n)"); bool multipool; diff --git a/xmrstak/jconf.cpp b/xmrstak/jconf.cpp index 0418842..6d0f8ae 100644 --- a/xmrstak/jconf.cpp +++ b/xmrstak/jconf.cpp @@ -484,15 +484,6 @@ bool jconf::parse_config(const char* sFilename) return false; } -#ifdef CONF_NO_TLS - if(prv->configValues[bTlsMode]->GetBool()) - { - printer::inst()->print_msg(L0, - "Invalid config file. TLS enabled while the application has been compiled without TLS support."); - return false; - } -#endif // CONF_NO_TLS - if(prv->configValues[bAesOverride]->IsBool()) bHaveAes = prv->configValues[bAesOverride]->GetBool(); diff --git a/xmrstak/misc/executor.cpp b/xmrstak/misc/executor.cpp index 454d1cf..4a3a77b 100644 --- a/xmrstak/misc/executor.cpp +++ b/xmrstak/misc/executor.cpp @@ -494,6 +494,13 @@ void executor::ex_main() { jconf::pool_cfg cfg; jconf::inst()->GetPoolConfig(i, cfg); +#ifdef CONF_NO_TLS + if(cfg.tls) + { + printer::inst()->print_msg(L1, "ERROR: No miner was compiled without TLS support."); + win_exit(); + } +#endif if(!cfg.tls) tls = false; pools.emplace_back(i+1, cfg.sPoolAddr, cfg.sWalletAddr, cfg.sPasswd, cfg.weight, false, cfg.tls, cfg.tls_fingerprint, cfg.nicehash); } @@ -552,6 +559,10 @@ void executor::ex_main() eval_pool_choice(); break; + case EV_GPU_RES_ERROR: + log_result_error(ev.oGpuError.error_str); + break; + case EV_PERF_TICK: for (i = 0; i < pvThreads->size(); i++) telem->push_perf_value(i, pvThreads->at(i)->iHashCount.load(std::memory_order_relaxed), diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index 11c8206..9ff0323 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -42,7 +42,6 @@ public: inline void push_event(ex_event&& ev) { oEventQ.push(std::move(ev)); } void push_timed_event(ex_event&& ev, size_t sec); - void log_result_error(std::string&& sError); private: struct timed_event @@ -180,6 +179,7 @@ private: double fHighestHps = 0.0; void log_socket_error(jpsock* pool, std::string&& sError); + void log_result_error(std::string&& sError); void log_result_ok(uint64_t iActualDiff); void on_sock_ready(size_t pool_id); diff --git a/xmrstak/net/msgstruct.hpp b/xmrstak/net/msgstruct.hpp index 01aa76c..4d8d845 100644 --- a/xmrstak/net/msgstruct.hpp +++ b/xmrstak/net/msgstruct.hpp @@ -62,7 +62,14 @@ struct sock_err sock_err& operator=(sock_err const&) = delete; }; -enum ex_event_name { EV_INVALID_VAL, EV_SOCK_READY, EV_SOCK_ERROR, +// Unlike socket errors, GPU errors are read-only strings +struct gpu_res_err +{ + const char* error_str; + gpu_res_err(const char* error_str) : error_str(error_str) {} +}; + +enum ex_event_name { EV_INVALID_VAL, EV_SOCK_READY, EV_SOCK_ERROR, EV_GPU_RES_ERROR, EV_POOL_HAVE_JOB, EV_MINER_HAVE_RESULT, EV_PERF_TICK, EV_EVAL_POOL_CHOICE, EV_USR_HASHRATE, EV_USR_RESULTS, EV_USR_CONNSTAT, EV_HASHRATE_LOOP, EV_HTML_HASHRATE, EV_HTML_RESULTS, EV_HTML_CONNSTAT, EV_HTML_JSON }; @@ -87,9 +94,11 @@ struct ex_event pool_job oPoolJob; job_result oJobResult; sock_err oSocketError; + gpu_res_err oGpuError; }; ex_event() { iName = EV_INVALID_VAL; iPoolId = 0;} + ex_event(const char* gpu_err, size_t id) : iName(EV_GPU_RES_ERROR), iPoolId(id), oGpuError(gpu_err) {} ex_event(std::string&& err, bool silent, size_t id) : iName(EV_SOCK_ERROR), iPoolId(id), oSocketError(std::move(err), silent) { } ex_event(job_result dat, size_t id) : iName(EV_MINER_HAVE_RESULT), iPoolId(id), oJobResult(dat) {} ex_event(pool_job dat, size_t id) : iName(EV_POOL_HAVE_JOB), iPoolId(id), oPoolJob(dat) {} |