1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-09 08:42:40 -05:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Tony Butler
52afe89b4e Merge 14128cbdb4 into e8bbd134f9 2024-11-03 18:25:44 +01:00
XMRig
e8bbd134f9 v6.22.3-dev 2024-11-03 15:06:54 +07:00
XMRig
cf86a1e05c Merge branch 'master' into dev 2024-11-03 15:06:22 +07:00
XMRig
f9e990d0f0 v6.22.2 2024-11-03 14:38:44 +07:00
XMRig
200f23bba7 Merge branch 'dev' 2024-11-03 14:38:00 +07:00
xmrig
4234b20e21 Update CHANGELOG.md 2024-11-03 14:31:17 +07:00
Tony Butler
14128cbdb4 hwloc: Clarify reason for failed binding ("can't bind memory") 2024-05-30 08:20:56 -06:00
7 changed files with 51 additions and 18 deletions

View File

@@ -1,3 +1,7 @@
# v6.22.2
- [#3569](https://github.com/xmrig/xmrig/pull/3569) Fixed corrupted API output in some rare conditions.
- [#3571](https://github.com/xmrig/xmrig/pull/3571) Fixed number of threads on the new Intel Core Ultra CPUs.
# v6.22.1
- [#3531](https://github.com/xmrig/xmrig/pull/3531) Always reset nonce on RandomX dataset change.
- [#3534](https://github.com/xmrig/xmrig/pull/3534) Fixed threads auto-config on Zen5.

View File

@@ -29,6 +29,10 @@
#ifdef XMRIG_FEATURE_HWLOC
using hwloc_const_bitmap_t = const struct hwloc_bitmap_s *;
using hwloc_topology_t = struct hwloc_topology *;
#define MEMBIND_SUCCESS 1
#define MEMBIND_FAIL_SUPP -1
#define MEMBIND_FAIL_NODE -2
#define MEMBIND_FAIL_BIND -3
#endif
@@ -126,7 +130,7 @@ public:
virtual uint32_t model() const = 0;
# ifdef XMRIG_FEATURE_HWLOC
virtual bool membind(hwloc_const_bitmap_t nodeset) = 0;
virtual int8_t membind(hwloc_const_bitmap_t nodeset) = 0;
virtual const std::vector<uint32_t> &nodeset() const = 0;
virtual hwloc_topology_t topology() const = 0;
# endif

View File

@@ -23,6 +23,7 @@
#include <algorithm>
#include <cmath>
#include <errno.h>
#include <hwloc.h>
@@ -191,16 +192,25 @@ xmrig::HwlocCpuInfo::~HwlocCpuInfo()
}
bool xmrig::HwlocCpuInfo::membind(hwloc_const_bitmap_t nodeset)
int8_t xmrig::HwlocCpuInfo::membind(hwloc_const_bitmap_t nodeset)
{
if (!hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
return false;
return MEMBIND_FAIL_SUPP;
}
# if HWLOC_API_VERSION >= 0x20000
return hwloc_set_membind(m_topology, nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD | HWLOC_MEMBIND_BYNODESET) >= 0;
int rv = hwloc_set_membind(m_topology, nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD | HWLOC_MEMBIND_BYNODESET);
int error = errno;
if (rv < 0) {
LOG_WARN("hwloc_set_membind() error: \"%s\"\n", strerror(error));
return MEMBIND_FAIL_BIND;
}
return MEMBIND_SUCCESS;
# else
return hwloc_set_membind_nodeset(m_topology, nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD) >= 0;
return (hwloc_set_membind_nodeset(m_topology, nodeset, HWLOC_MEMBIND_BIND, HWLOC_MEMBIND_THREAD) >= 0)
? MEMBIND_SUCCESS : MEMBIND_FAIL_BIND;
# endif
}

View File

@@ -38,7 +38,7 @@ public:
~HwlocCpuInfo() override;
protected:
bool membind(hwloc_const_bitmap_t nodeset) override;
int8_t membind(hwloc_const_bitmap_t nodeset) override;
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
inline const char *backend() const override { return m_backend; }

View File

@@ -34,8 +34,13 @@ uint32_t xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
auto pu = hwloc_get_pu_obj_by_os_index(Cpu::info()->topology(), static_cast<unsigned>(affinity));
if (pu == nullptr || !Cpu::info()->membind(pu->nodeset)) {
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity);
if (pu == nullptr) {
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory: hwloc_get_pu_obj_by_os_index() failed\"", affinity);
return 0;
}
if (Cpu::info()->membind(pu->nodeset) < 0) {
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory: Cpu::info()->membind() failed\"", affinity);
return 0;
}

View File

@@ -42,20 +42,20 @@ constexpr size_t oneMiB = 1024 * 1024;
static std::mutex mutex;
static bool bindToNUMANode(uint32_t nodeId)
static int8_t bindToNUMANode(uint32_t nodeId)
{
auto node = hwloc_get_numanode_obj_by_os_index(Cpu::info()->topology(), nodeId);
if (!node) {
return false;
return MEMBIND_FAIL_NODE;
}
if (Cpu::info()->membind(node->nodeset)) {
if (Cpu::info()->membind(node->nodeset) > 0) {
Platform::setThreadAffinity(static_cast<uint64_t>(hwloc_bitmap_first(node->cpuset)));
return true;
return MEMBIND_SUCCESS;
}
return false;
return MEMBIND_FAIL_BIND;
}
@@ -210,10 +210,20 @@ private:
static void allocate(RxNUMAStoragePrivate *d_ptr, uint32_t nodeId, bool hugePages, bool oneGbPages)
{
const uint64_t ts = Chrono::steadyMSecs();
const int8_t br = bindToNUMANode(nodeId);
if (!bindToNUMANode(nodeId)) {
printSkipped(nodeId, "can't bind memory");
if (br < 0) {
switch (br) {
case MEMBIND_FAIL_SUPP:
printSkipped(nodeId, "can't bind memory: hwloc_topology_get_support() failed");
break;
case MEMBIND_FAIL_NODE:
printSkipped(nodeId, "can't bind memory: hwloc_get_numanode_obj_by_os_index() failed");
break;
case MEMBIND_FAIL_BIND:
printSkipped(nodeId, "can't bind memory: Cpu::info()->membind() failed");
break;
}
return;
}

View File

@@ -22,7 +22,7 @@
#define APP_ID "xmrig"
#define APP_NAME "XMRig"
#define APP_DESC "XMRig miner"
#define APP_VERSION "6.22.2-dev"
#define APP_VERSION "6.22.3-dev"
#define APP_DOMAIN "xmrig.com"
#define APP_SITE "www.xmrig.com"
#define APP_COPYRIGHT "Copyright (C) 2016-2024 xmrig.com"
@@ -30,7 +30,7 @@
#define APP_VER_MAJOR 6
#define APP_VER_MINOR 22
#define APP_VER_PATCH 2
#define APP_VER_PATCH 3
#ifdef _MSC_VER
# if (_MSC_VER >= 1930)