1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-08 00:15:04 -05:00

Compare commits

...

36 Commits

Author SHA1 Message Date
Tony Butler
753e63cd96 Update/Improve API docs 2023-07-12 02:06:53 -06:00
Tony Butler
f42b3e83a7 Cleanup API code 2023-07-12 02:06:53 -06:00
XMRig
e7de104d88 v6.20.1-dev 2023-07-03 18:47:55 +07:00
XMRig
3b5e04b1b7 Merge branch 'master' into dev 2023-07-03 18:47:22 +07:00
XMRig
2e77faa80c v6.20.0 2023-07-03 12:42:00 +07:00
XMRig
6e63a246bf Merge branch 'dev' 2023-07-03 12:41:35 +07:00
XMRig
09abc81255 v6.20.0-dev 2023-07-03 12:37:36 +07:00
xmrig
fc698f7bcf Merge pull request #3291 from SChernykh/dev
Zephyr solo mining: fix for blocks with transactions
2023-06-24 20:22:53 +07:00
SChernykh
cb2f8fd453 Zephyr solo mining: fix for blocks with transactions 2023-06-24 15:15:37 +02:00
xmrig
59c6c42ceb Merge pull request #3290 from SChernykh/dev
Zephyr coin support
2023-06-24 19:53:54 +07:00
SChernykh
6c10cc5a4b Zephyr coin support
Solo mining will require `--coin Zephyr` in command line, or `"coin": "Zephyr",` in `pools` section of config.json
2023-06-24 14:37:20 +02:00
xmrig
d5a8f8a5ae Merge pull request #3288 from SChernykh/dev
KawPow: fixed data race when building programs
2023-06-19 17:40:24 +07:00
SChernykh
d94d052e6c KawPow: fixed data race when building programs
`uv_queue_work` can't be called from other threads, only `uv_async_send` is thread-safe.
2023-06-19 12:32:28 +02:00
XMRig
ae2b7e3348 Merge branch 'Spudz76-dev-addApiRebind' into dev 2023-06-07 20:49:34 +07:00
XMRig
7d7f30701f Code cleanup. 2023-06-07 20:48:56 +07:00
XMRig
e80fc25789 Merge branch 'dev-addApiRebind' of https://github.com/Spudz76/xmrig into Spudz76-dev-addApiRebind 2023-06-07 20:12:58 +07:00
XMRig
ff53be5f3b Merge branch 'benthetechguy-readme' into dev 2023-06-07 00:52:37 +07:00
XMRig
6981e68ae3 Merge branch 'readme' of https://github.com/benthetechguy/xmrig into benthetechguy-readme 2023-06-07 00:52:03 +07:00
XMRig
c7e541d84f Disallow direct use of HwlocCpuInfo class. 2023-06-07 00:32:09 +07:00
XMRig
a2ae17b4c4 Code cleanup. 2023-06-06 23:15:58 +07:00
XMRig
554b60966b Fixed compatibility with hwloc 1.11. 2023-06-06 02:30:10 +07:00
xmrig
0378aa8df4 Merge pull request #3236 from MrFoxPro/dev
fix(cuda): receive CUDA loader error on linux too.
2023-06-05 23:07:38 +07:00
XMRig
6dbd46a891 Added new CMake options ARM_V8 and ARM_V7. 2023-06-04 20:32:05 +07:00
XMRig
055db83142 Added new ARM CPU names. 2023-06-04 19:36:53 +07:00
XMRig
cdd5dff337 v6.19.4-dev 2023-06-03 21:14:26 +07:00
XMRig
bc5fe8f456 Merge branch 'master' into dev 2023-06-03 21:13:51 +07:00
XMRig
0bc87345c4 v6.19.3 2023-06-03 19:59:18 +07:00
XMRig
f17d31e61a Merge branch 'dev' 2023-06-03 19:57:36 +07:00
xmrig
e6bf4c0077 Update CHANGELOG.md 2023-06-02 22:12:18 +07:00
xmrig
ff79b8fce4 Merge pull request #3280 from SChernykh/dev
Updated example scripts
2023-06-02 17:47:13 +07:00
SChernykh
af87369e4f Updated example scripts
- Hashvault is top 1 pool now, so changed it to a smaller pool
- node.xmr.to doesn't exist anymore
2023-06-02 09:34:26 +02:00
xmrig
65fc16d5ac Merge pull request #3275 from SChernykh/dev
RandomX: fixed `jccErratum` list
2023-05-26 18:25:57 +07:00
SChernykh
826e23b4c4 Fixed jccErratum list 2023-05-26 12:46:59 +02:00
Tony Butler
548fbb9f71 Add API rebind polling 2023-05-23 16:49:43 -06:00
Dmitriy Nikiforov
62a3a98e7d fix(cuda): receive CUDA loader error on linux too. 2023-03-27 18:48:13 +05:00
benthetechguy
c0bce256e1 Add x86 to README 2022-05-31 21:15:37 -04:00
38 changed files with 733 additions and 219 deletions

View File

@@ -1,3 +1,20 @@
# v6.20.0
- Added new ARM CPU names.
- [#2394](https://github.com/xmrig/xmrig/pull/2394) Added new CMake options `ARM_V8` and `ARM_V7`.
- [#2830](https://github.com/xmrig/xmrig/pull/2830) Added API rebind polling.
- [#2927](https://github.com/xmrig/xmrig/pull/2927) Fixed compatibility with hwloc 1.11.x.
- [#3060](https://github.com/xmrig/xmrig/pull/3060) Added x86 to `README.md`.
- [#3236](https://github.com/xmrig/xmrig/pull/3236) Fixed: receive CUDA loader error on Linux too.
- [#3290](https://github.com/xmrig/xmrig/pull/3290) Added [Zephyr](https://www.zephyrprotocol.com/) coin support for solo mining.
# v6.19.3
- [#3245](https://github.com/xmrig/xmrig/issues/3245) Improved algorithm negotiation for donation rounds by sending extra information about current mining job.
- [#3254](https://github.com/xmrig/xmrig/pull/3254) Tweaked auto-tuning for Intel CPUs.
- [#3271](https://github.com/xmrig/xmrig/pull/3271) RandomX: optimized program generation.
- [#3273](https://github.com/xmrig/xmrig/pull/3273) RandomX: fixed undefined behavior.
- [#3275](https://github.com/xmrig/xmrig/pull/3275) RandomX: fixed `jccErratum` list.
- [#3280](https://github.com/xmrig/xmrig/pull/3280) Updated example scripts.
# v6.19.2 # v6.19.2
- [#3230](https://github.com/xmrig/xmrig/pull/3230) Fixed parsing of `TX_EXTRA_MERGE_MINING_TAG`. - [#3230](https://github.com/xmrig/xmrig/pull/3230) Fixed parsing of `TX_EXTRA_MERGE_MINING_TAG`.
- [#3232](https://github.com/xmrig/xmrig/pull/3232) Added new `X-Hash-Difficulty` HTTP header. - [#3232](https://github.com/xmrig/xmrig/pull/3232) Added new `X-Hash-Difficulty` HTTP header.

View File

@@ -34,7 +34,8 @@ option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
option(WITH_DMI "Enable DMI/SMBIOS reader" ON) option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
option(BUILD_STATIC "Build static binary" OFF) option(BUILD_STATIC "Build static binary" OFF)
option(ARM_TARGET "Force use specific ARM target 8 or 7" 0) option(ARM_V8 "Force ARMv8 (64 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
option(ARM_V7 "Force ARMv7 (32 bit) architecture, use with caution if automatic detection fails, but you sure it may work" OFF)
option(HWLOC_DEBUG "Enable hwloc debug helpers and log" OFF) option(HWLOC_DEBUG "Enable hwloc debug helpers and log" OFF)

View File

@@ -10,7 +10,7 @@
XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD. XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and [GhostRider](https://github.com/xmrig/xmrig/tree/master/src/crypto/ghostrider#readme) unified CPU/GPU miner and [RandomX benchmark](https://xmrig.com/benchmark). Official binaries are available for Windows, Linux, macOS and FreeBSD.
## Mining backends ## Mining backends
- **CPU** (x64/ARMv7/ARMv8) - **CPU** (x86/x64/ARMv7/ARMv8)
- **OpenCL** for AMD GPUs. - **OpenCL** for AMD GPUs.
- **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda). - **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda).

View File

@@ -29,6 +29,12 @@ else()
set(WITH_VAES OFF) set(WITH_VAES OFF)
endif() endif()
if (ARM_V8)
set(ARM_TARGET 8)
elseif (ARM_V7)
set(ARM_TARGET 7)
endif()
if (NOT ARM_TARGET) if (NOT ARM_TARGET)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv8-a)$") if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv8-a)$")
set(ARM_TARGET 8) set(ARM_TARGET 8)

View File

@@ -4,7 +4,7 @@ If you want use HTTP API you need enable it (`"enabled": true,`) then choice `po
Offical HTTP client for API: http://workers.xmrig.info/ Offical HTTP client for API: http://workers.xmrig.info/
Example configuration: Example configuration, used in Curl examples below:
```json ```json
"api": { "api": {
@@ -12,11 +12,11 @@ Example configuration:
"worker-id": null, "worker-id": null,
}, },
"http": { "http": {
"enabled": false, "enabled": true,
"host": "127.0.0.1", "host": "127.0.0.1",
"port": 0, "port": 44444,
"access-token": null, "access-token": "SECRET",
"restricted": true "restricted": false
} }
``` ```
@@ -37,30 +37,78 @@ Versions before 2.15 was use another options for API https://github.com/xmrig/xm
## Endpoints ## Endpoints
### GET /1/summary ### APIVersion 2
Get miner summary information. [Example](api/1/summary.json). #### GET /2/summary
### GET /1/threads Get miner summary information. [Example](api/2/summary.json).
Get detailed information about miner threads. [Example](api/1/threads.json). #### GET /2/backends
Get detailed information about miner backends. [Example](api/2/backends.json).
### APIVersion 1 (deprecated)
#### GET /1/summary
Get miner summary information. Currently identical to `GET /2/summary`
#### GET /1/threads
**REMOVED** Get detailed information about miner threads. [Example](api/1/threads.json).
Functionally replaced by `GET /2/backends` which contains a `threads` item per backend.
### APIVersion 0 (deprecated)
#### GET /api.json
Get miner summary information. Currently identical to `GET /2/summary`
## Restricted endpoints ## Restricted endpoints
All API endpoints below allow access to sensitive information and remote configure miner. You should set `access-token` and allow unrestricted access (`"restricted": false`). All API endpoints below allow access to sensitive information and remote configure miner. You should set `access-token` and allow unrestricted access (`"restricted": false`).
### GET /1/config ### JSON-RPC Interface
Get current miner configuration. [Example](api/1/config.json). #### POST /json_rpc
Control miner with JSON-RPC. Methods: `pause`, `resume`, `stop`, `start`
### PUT /1/config Curl example:
```
curl -v --data "{\"method\":\"pause\",\"id\":1}" -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/json_rpc
```
### APIVersion 2
#### GET /2/config
Get current miner configuration. [Example](api/2/config.json).
#### PUT /2/config
Update current miner configuration. Common use case, get current configuration, make changes, and upload it to miner. Update current miner configuration. Common use case, get current configuration, make changes, and upload it to miner.
Curl example: Curl example:
``` ```
curl -v --data-binary @config.json -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/1/config ...GET current config...
curl -v -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/2/config > config.json
...make changes...
vim config.json
...PUT changed config...
curl -v --data-binary @config.json -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer SECRET" http://127.0.0.1:44444/2/config
``` ```
### APIVersion 1 (deprecated)
#### GET /1/config
Get current miner configuration. Currently identical to `GET /2/config`
#### PUT /1/config
Update current miner configuration. Currently identical to `PUT /2/config`

78
doc/api/2/backends.json Normal file
View File

@@ -0,0 +1,78 @@
[
{
"type": "cpu",
"enabled": true,
"algo": "rx/0",
"profile": "rx",
"hw-aes": true,
"priority": -1,
"msr": true,
"asm": "intel",
"argon2-impl": "AVX2",
"hugepages": [6, 6],
"memory": 6291456,
"hashrate": [1235.78, 1228.89, null],
"threads": [
{
"intensity": 1,
"affinity": 0,
"av": 1,
"hashrate": [409.75, 406.58, null]
},
{
"intensity": 1,
"affinity": 2,
"av": 1,
"hashrate": [412.9, 411.33, null]
},
{
"intensity": 1,
"affinity": 4,
"av": 1,
"hashrate": [413.11, 410.98, null]
}
]
},
{
"type": "cuda",
"enabled": true,
"algo": "cn-heavy/xhv",
"profile": "cn-heavy/xhv",
"versions": {
"cuda-runtime": "11.6",
"cuda-driver": "11.6",
"plugin": "6.17.1-dev",
"nvml": "11.512.15",
"driver": "512.15"
},
"hashrate": [247.02, 247.34, null],
"threads": [
{
"index": 0,
"threads": 32,
"blocks": 38,
"bfactor": 6,
"bsleep": 25,
"affinity": -1,
"cclock": 0,
"mclock": 0,
"dataset_host": false,
"hashrate": [246.77, 247.26, null],
"name": "NVIDIA GeForce GTX 970",
"bus_id": "01:00.0",
"smx": 13,
"arch": 52,
"global_mem": 4294836224,
"clock": 1177,
"memory_clock": 3666,
"health": {
"temperature": 69,
"power": 161,
"clock": 1328,
"mem_clock": 3662,
"fan_speed": [100]
}
}
]
}
]

136
doc/api/2/config.json Normal file
View File

@@ -0,0 +1,136 @@
{
"api": {
"id": null,
"worker-id": null
},
"http": {
"enabled": true,
"host": "127.0.0.1",
"port": 44444,
"access-token": "SECRET",
"restricted": false
},
"autosave": true,
"background": false,
"colors": true,
"title": true,
"randomx": {
"init": -1,
"init-avx2": -1,
"mode": "auto",
"1gb-pages": true,
"rdmsr": true,
"wrmsr": true,
"cache_qos": false,
"numa": true,
"scratchpad_prefetch_mode": 1
},
"cpu": {
"enabled": true,
"huge-pages": true,
"huge-pages-jit": true,
"hw-aes": null,
"priority": null,
"memory-pool": true,
"yield": true,
"asm": true,
"argon2-impl": null,
"argon2": [0, 2, 4, 6, 5, 7],
"astrobwt/v2": [1, 2, 3, 4, 5, 6, 7],
"cn": [
[1, 0],
[1, 2],
[1, 4]
],
"cn-heavy": [
[1, 0],
[1, 2]
],
"cn-lite": [
[1, 0],
[1, 2],
[1, 4],
[1, 6],
[1, 5],
[1, 7]
],
"cn-pico": [
[2, 1],
[2, 2],
[2, 3],
[2, 4],
[2, 5],
[2, 6],
[2, 7]
],
"cn/2": [
[1, 0],
[1, 2],
[1, 4]
],
"cn/upx2": [
[2, 1],
[2, 2],
[2, 3],
[2, 4],
[2, 5],
[2, 6],
[2, 7]
],
"ghostrider": [
[8, 0],
[8, 2],
[8, 4]
],
"rx": [0, 2, 4],
"rx/arq": [1, 2, 3, 4, 5, 6, 7],
"rx/keva": [0, 2, 4, 6, 5, 7],
"rx/wow": [0, 2, 4, 6, 5, 7],
"cn-lite/0": false,
"cn/0": "cn"
},
"log-file": null,
"donate-level": 0,
"donate-over-proxy": 0,
"pools": [
{
"algo": null,
"coin": null,
"url": "some.pool:10064",
"user": "4blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahbl",
"pass": "x",
"rig-id": null,
"nicehash": false,
"keepalive": true,
"enabled": true,
"tls": false,
"wss": false,
"daemon": false,
"socks5": null,
"self-select": null,
"submit-to-origin": false
}
],
"retries": 5,
"retry-pause": 5,
"print-time": 64,
"syslog": false,
"tls": {
"enabled": false,
"protocols": null,
"cert": null,
"cert_key": null,
"ciphers": null,
"ciphersuites": null,
"dhparam": null
},
"dns": {
"ipv6": false,
"ttl": 30
},
"user-agent": null,
"verbose": 1,
"watch": true,
"pause-on-battery": false,
"pause-on-active": false
}

76
doc/api/2/summary.json Normal file
View File

@@ -0,0 +1,76 @@
{
"id": "51aca77da137cb62",
"worker_id": "tpad",
"uptime": 106,
"restricted": false,
"resources": {
"memory": {
"free": 4977348608,
"total": 16659546112,
"resident_set_memory": 16441344
},
"load_average": [3.4, 2.7, 2.44],
"hardware_concurrency": 8
},
"features": ["api", "asm", "http", "hwloc", "tls"],
"results": {
"diff_current": 37638,
"shares_good": 3,
"shares_total": 3,
"avg_time": 35,
"avg_time_ms": 35603,
"hashes_total": 165638,
"best": [358821, 344438, 73371, 0, 0, 0, 0, 0, 0, 0]
},
"algo": "rx/0",
"connection": {
"pool": "some.pool:20064",
"ip": "127.1.2.3",
"uptime": 106,
"uptime_ms": 106811,
"ping": 405,
"failures": 0,
"tls": "TLSv1.3",
"tls-fingerprint": null,
"algo": "rx/0",
"diff": 37638,
"accepted": 3,
"rejected": 0,
"avg_time": 35,
"avg_time_ms": 35603,
"hashes_total": 165638
},
"version": "6.17.1-dev",
"kind": "miner",
"ua": "XMRig/6.17.1-dev (Linux x86_64) libuv/1.43.0 gcc/9.4.0",
"cpu": {
"brand": "Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz",
"family": 6,
"model": 60,
"stepping": 3,
"proc_info": 198339,
"aes": true,
"avx2": true,
"x64": true,
"64_bit": true,
"l2": 1048576,
"l3": 6291456,
"cores": 4,
"threads": 8,
"packages": 1,
"nodes": 1,
"backend": "hwloc/2.7.0",
"msr": "intel",
"assembly": "intel",
"arch": "x86_64",
"flags": ["aes", "avx", "avx2", "bmi2", "osxsave", "pdpe1gb", "sse2", "ssse3", "sse4.1", "popcnt"]
},
"donate_level": 0,
"paused": false,
"algorithms": ["cn/0", "cn/1", "cn/2", "cn/r", "cn/fast", "cn/half", "cn/xao", "cn/rto", "cn/rwz", "cn/zls", "cn/double", "cn/ccx", "cn-lite/1", "cn-heavy/0", "cn-heavy/tube", "cn-heavy/xhv", "cn-pico", "cn-pico/tlo", "cn/upx2", "rx/0", "rx/wow", "rx/arq", "rx/graft", "rx/sfx", "rx/keva", "argon2/chukwa", "argon2/chukwav2", "argon2/ninja", "astrobwt/v2", "ghostrider"],
"hashrate": {
"total": [1207.19, 1210.82, null],
"highest": 1316.85
},
"hugepages": [6, 6]
}

View File

@@ -16,5 +16,5 @@
:: Smaller pools also often have smaller fees/payout limits. :: Smaller pools also often have smaller fees/payout limits.
cd /d "%~dp0" cd /d "%~dp0"
xmrig.exe -o pool.hashvault.pro:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x xmrig.exe -o xmrpool.eu:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x
pause pause

View File

@@ -12,5 +12,5 @@
:: But you will only get a payout when you find a block which can take more than a year for a single low-end PC. :: But you will only get a payout when you find a block which can take more than a year for a single low-end PC.
cd /d "%~dp0" cd /d "%~dp0"
xmrig.exe -o node.xmr.to:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon xmrig.exe -o YOUR_NODE_IP:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon
pause pause

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ public:
}; };
} /* namespace xmrig */ } // namespace xmrig
#endif /* XMRIG_CPU_H */ #endif // XMRIG_CPU_H

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -26,6 +26,12 @@
#include "crypto/common/Assembly.h" #include "crypto/common/Assembly.h"
#ifdef XMRIG_FEATURE_HWLOC
using hwloc_const_bitmap_t = const struct hwloc_bitmap_s *;
using hwloc_topology_t = struct hwloc_topology *;
#endif
namespace xmrig { namespace xmrig {
@@ -116,10 +122,16 @@ public:
virtual size_t threads() const = 0; virtual size_t threads() const = 0;
virtual Vendor vendor() const = 0; virtual Vendor vendor() const = 0;
virtual uint32_t model() const = 0; virtual uint32_t model() const = 0;
# ifdef XMRIG_FEATURE_HWLOC
virtual bool membind(hwloc_const_bitmap_t nodeset) = 0;
virtual const std::vector<uint32_t> &nodeset() const = 0;
virtual hwloc_topology_t topology() const = 0;
# endif
}; };
} /* namespace xmrig */ } // namespace xmrig
#endif // XMRIG_CPUINFO_H #endif // XMRIG_CPUINFO_H

View File

@@ -296,7 +296,7 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
// Affected CPU models and stepping numbers are taken from https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf // Affected CPU models and stepping numbers are taken from https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf
m_jccErratum = m_jccErratum =
((model == 0x4E) && (stepping == 0x3)) || ((model == 0x4E) && (stepping == 0x3)) ||
((model == 0x55) && (stepping == 0x4)) || ((model == 0x55) && ((stepping == 0x4) || (stepping == 0x7))) ||
((model == 0x5E) && (stepping == 0x3)) || ((model == 0x5E) && (stepping == 0x3)) ||
((model == 0x8E) && (stepping >= 0x9) && (stepping <= 0xC)) || ((model == 0x8E) && (stepping >= 0x9) && (stepping <= 0xC)) ||
((model == 0x9E) && (stepping >= 0x9) && (stepping <= 0xD)) || ((model == 0x9E) && (stepping >= 0x9) && (stepping <= 0xD)) ||

View File

@@ -1,7 +1,7 @@
/* XMRig /* XMRig
* Copyright (c) 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright (c) 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -72,11 +72,10 @@ protected:
# endif # endif
} }
protected:
Arch m_arch = ARCH_UNKNOWN; Arch m_arch = ARCH_UNKNOWN;
bool m_jccErratum = false; bool m_jccErratum = false;
char m_brand[64 + 6]{}; char m_brand[64 + 6]{};
size_t m_threads; size_t m_threads = 0;
std::vector<int32_t> m_units; std::vector<int32_t> m_units;
Vendor m_vendor = VENDOR_UNKNOWN; Vendor m_vendor = VENDOR_UNKNOWN;
@@ -94,7 +93,7 @@ private:
}; };
} /* namespace xmrig */ } // namespace xmrig
#endif /* XMRIG_BASICCPUINFO_H */ #endif // XMRIG_BASICCPUINFO_H

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -36,27 +36,22 @@
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
namespace xmrig { #if HWLOC_API_VERSION < 0x20000
static inline int hwloc_obj_type_is_cache(hwloc_obj_type_t type)
uint32_t HwlocCpuInfo::m_features = 0;
static inline bool isCacheObject(hwloc_obj_t obj)
{ {
# if HWLOC_API_VERSION >= 0x20000 return type == HWLOC_OBJ_CACHE;
return hwloc_obj_type_is_cache(obj->type);
# else
return obj->type == HWLOC_OBJ_CACHE;
# endif
} }
#endif
namespace xmrig {
template <typename func> template <typename func>
static inline void findCache(hwloc_obj_t obj, unsigned min, unsigned max, func lambda) static inline void findCache(hwloc_obj_t obj, unsigned min, unsigned max, func lambda)
{ {
for (size_t i = 0; i < obj->arity; i++) { for (size_t i = 0; i < obj->arity; i++) {
if (isCacheObject(obj->children[i])) { if (hwloc_obj_type_is_cache(obj->children[i]->type)) {
const unsigned depth = obj->children[i]->attr->cache.depth; const unsigned depth = obj->children[i]->attr->cache.depth;
if (depth < min || depth > max) { if (depth < min || depth > max) {
continue; continue;
@@ -174,10 +169,6 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo()
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE); m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
if (m_nodes > 1) { if (m_nodes > 1) {
if (hwloc_topology_get_support(m_topology)->membind->set_thisthread_membind) {
m_features |= SET_THISTHREAD_MEMBIND;
}
m_nodeset.reserve(m_nodes); m_nodeset.reserve(m_nodes);
hwloc_obj_t node = nullptr; hwloc_obj_t node = nullptr;
@@ -322,7 +313,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
if (cache->attr->cache.depth == 3) { if (cache->attr->cache.depth == 3) {
for (size_t i = 0; i < cache->arity; ++i) { for (size_t i = 0; i < cache->arity; ++i) {
hwloc_obj_t l2 = cache->children[i]; hwloc_obj_t l2 = cache->children[i];
if (!isCacheObject(l2) || l2->attr == nullptr) { if (!hwloc_obj_type_is_cache(l2->type) || l2->attr == nullptr) {
continue; continue;
} }

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -21,12 +21,9 @@
#include "backend/cpu/platform/BasicCpuInfo.h" #include "backend/cpu/platform/BasicCpuInfo.h"
#include "base/tools/Object.h"
using hwloc_const_bitmap_t = const struct hwloc_bitmap_s *;
using hwloc_obj_t = struct hwloc_obj *; using hwloc_obj_t = struct hwloc_obj *;
using hwloc_topology_t = struct hwloc_topology *;
namespace xmrig { namespace xmrig {
@@ -37,26 +34,16 @@ class HwlocCpuInfo : public BasicCpuInfo
public: public:
XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo) XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo)
enum Feature : uint32_t {
SET_THISTHREAD_MEMBIND = 1
};
HwlocCpuInfo(); HwlocCpuInfo();
~HwlocCpuInfo() override; ~HwlocCpuInfo() override;
static inline bool hasFeature(Feature feature) { return m_features & feature; }
inline const std::vector<uint32_t> &nodeset() const { return m_nodeset; }
inline hwloc_topology_t topology() const { return m_topology; }
bool membind(hwloc_const_bitmap_t nodeset);
protected: protected:
bool membind(hwloc_const_bitmap_t nodeset) override;
CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override; CpuThreads threads(const Algorithm &algorithm, uint32_t limit) const override;
inline const char *backend() const override { return m_backend; } inline const char *backend() const override { return m_backend; }
inline const std::vector<uint32_t> &nodeset() const override { return m_nodeset; }
inline hwloc_topology_t topology() const override { return m_topology; }
inline size_t cores() const override { return m_cores; } inline size_t cores() const override { return m_cores; }
inline size_t L2() const override { return m_cache[2]; } inline size_t L2() const override { return m_cache[2]; }
inline size_t L3() const override { return m_cache[3]; } inline size_t L3() const override { return m_cache[3]; }
@@ -68,8 +55,6 @@ private:
void processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const; void processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;
void setThreads(size_t threads); void setThreads(size_t threads);
static uint32_t m_features;
char m_backend[20] = { 0 }; char m_backend[20] = { 0 };
hwloc_topology_t m_topology = nullptr; hwloc_topology_t m_topology = nullptr;
size_t m_cache[5] = { 0 }; size_t m_cache[5] = { 0 };
@@ -80,7 +65,7 @@ private:
}; };
} /* namespace xmrig */ } // namespace xmrig
#endif /* XMRIG_HWLOCCPUINFO_H */ #endif // XMRIG_HWLOCCPUINFO_H

View File

@@ -1,7 +1,7 @@
/* XMRig /* XMRig
* Copyright (c) 2018 Riku Voipio <riku.voipio@iki.fi> * Copyright (c) 2018 Riku Voipio <riku.voipio@iki.fi>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "base/tools/String.h" #include "base/tools/String.h"
#include "3rdparty/fmt/core.h" #include "3rdparty/fmt/core.h"
@@ -84,6 +83,7 @@ static const id_part arm_part[] = {
{ 0xc27, "Cortex-M7" }, { 0xc27, "Cortex-M7" },
{ 0xc60, "Cortex-M0+" }, { 0xc60, "Cortex-M0+" },
{ 0xd01, "Cortex-A32" }, { 0xd01, "Cortex-A32" },
{ 0xd02, "Cortex-A34" },
{ 0xd03, "Cortex-A53" }, { 0xd03, "Cortex-A53" },
{ 0xd04, "Cortex-A35" }, { 0xd04, "Cortex-A35" },
{ 0xd05, "Cortex-A55" }, { 0xd05, "Cortex-A55" },
@@ -97,40 +97,60 @@ static const id_part arm_part[] = {
{ 0xd0d, "Cortex-A77" }, { 0xd0d, "Cortex-A77" },
{ 0xd0e, "Cortex-A76AE" }, { 0xd0e, "Cortex-A76AE" },
{ 0xd13, "Cortex-R52" }, { 0xd13, "Cortex-R52" },
{ 0xd15, "Cortex-R82" },
{ 0xd20, "Cortex-M23" }, { 0xd20, "Cortex-M23" },
{ 0xd21, "Cortex-M33" }, { 0xd21, "Cortex-M33" },
{ 0xd40, "Neoverse-V1" },
{ 0xd41, "Cortex-A78" }, { 0xd41, "Cortex-A78" },
{ 0xd42, "Cortex-A78AE" }, { 0xd42, "Cortex-A78AE" },
{ 0xd43, "Cortex-A65AE" },
{ 0xd44, "Cortex-X1" },
{ 0xd46, "Cortex-A510" },
{ 0xd47, "Cortex-A710" },
{ 0xd48, "Cortex-X2" },
{ 0xd49, "Neoverse-N2" },
{ 0xd4a, "Neoverse-E1" }, { 0xd4a, "Neoverse-E1" },
{ 0xd4b, "Cortex-A78C" }, { 0xd4b, "Cortex-A78C" },
{ -1, nullptr }, { 0xd4c, "Cortex-X1C" },
{ 0xd4d, "Cortex-A715" },
{ 0xd4e, "Cortex-X3" },
{ 0xd4f, "Neoverse-V2" },
{ -1, nullptr }
}; };
static const id_part brcm_part[] = { static const id_part brcm_part[] = {
{ 0x0f, "Brahma B15" }, { 0x0f, "Brahma-B15" },
{ 0x100, "Brahma B53" }, { 0x100, "Brahma-B53" },
{ 0x516, "ThunderX2" }, { 0x516, "ThunderX2" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part dec_part[] = { static const id_part dec_part[] = {
{ 0xa10, "SA110" }, { 0xa10, "SA110" },
{ 0xa11, "SA1100" }, { 0xa11, "SA1100" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part cavium_part[] = { static const id_part cavium_part[] = {
{ 0x0a0, "ThunderX" }, { 0x0a0, "ThunderX" },
{ 0x0a1, "ThunderX 88XX" }, { 0x0a1, "ThunderX-88XX" },
{ 0x0a2, "ThunderX 81XX" }, { 0x0a2, "ThunderX-81XX" },
{ 0x0a3, "ThunderX 83XX" }, { 0x0a3, "ThunderX-83XX" },
{ 0x0af, "ThunderX2 99xx" }, { 0x0af, "ThunderX2-99xx" },
{ -1, nullptr }, { 0x0b0, "OcteonTX2" },
{ 0x0b1, "OcteonTX2-98XX" },
{ 0x0b2, "OcteonTX2-96XX" },
{ 0x0b3, "OcteonTX2-95XX" },
{ 0x0b4, "OcteonTX2-95XXN" },
{ 0x0b5, "OcteonTX2-95XXMM" },
{ 0x0b6, "OcteonTX2-95XXO" },
{ 0x0b8, "ThunderX3-T110" },
{ -1, nullptr }
}; };
static const id_part apm_part[] = { static const id_part apm_part[] = {
{ 0x000, "X-Gene" }, { 0x000, "X-Gene" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part qcom_part[] = { static const id_part qcom_part[] = {
@@ -141,36 +161,43 @@ static const id_part qcom_part[] = {
{ 0x201, "Kryo" }, { 0x201, "Kryo" },
{ 0x205, "Kryo" }, { 0x205, "Kryo" },
{ 0x211, "Kryo" }, { 0x211, "Kryo" },
{ 0x800, "Falkor V1/Kryo" }, { 0x800, "Falkor-V1/Kryo" },
{ 0x801, "Kryo V2" }, { 0x801, "Kryo-V2" },
{ 0x802, "Kryo-3XX-Gold" },
{ 0x803, "Kryo-3XX-Silver" },
{ 0x804, "Kryo-4XX-Gold" },
{ 0x805, "Kryo-4XX-Silver" },
{ 0xc00, "Falkor" }, { 0xc00, "Falkor" },
{ 0xc01, "Saphira" }, { 0xc01, "Saphira" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part samsung_part[] = { static const id_part samsung_part[] = {
{ 0x001, "exynos-m1" }, { 0x001, "exynos-m1" },
{ -1, nullptr }, { 0x002, "exynos-m3" },
{ 0x003, "exynos-m4" },
{ 0x004, "exynos-m5" },
{ -1, nullptr }
}; };
static const id_part nvidia_part[] = { static const id_part nvidia_part[] = {
{ 0x000, "Denver" }, { 0x000, "Denver" },
{ 0x003, "Denver 2" }, { 0x003, "Denver 2" },
{ 0x004, "Carmel" }, { 0x004, "Carmel" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part marvell_part[] = { static const id_part marvell_part[] = {
{ 0x131, "Feroceon 88FR131" }, { 0x131, "Feroceon-88FR131" },
{ 0x581, "PJ4/PJ4b" }, { 0x581, "PJ4/PJ4b" },
{ 0x584, "PJ4B-MP" }, { 0x584, "PJ4B-MP" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part faraday_part[] = { static const id_part faraday_part[] = {
{ 0x526, "FA526" }, { 0x526, "FA526" },
{ 0x626, "FA626" }, { 0x626, "FA626" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const id_part intel_part[] = { static const id_part intel_part[] = {
@@ -195,23 +222,50 @@ static const id_part intel_part[] = {
{ 0x689, "PXA31x" }, { 0x689, "PXA31x" },
{ 0xb11, "SA1110" }, { 0xb11, "SA1110" },
{ 0xc12, "IPX1200" }, { 0xc12, "IPX1200" },
{ -1, nullptr }, { -1, nullptr }
}; };
static const struct id_part fujitsu_part[] = { static const struct id_part fujitsu_part[] = {
{ 0x001, "A64FX" }, { 0x001, "A64FX" },
{ -1, "unknown" }, { -1, nullptr }
}; };
static const id_part hisi_part[] = { static const id_part hisi_part[] = {
{ 0xd01, "Kunpeng-920" }, /* aka tsv110 */ { 0xd01, "Kunpeng-920" }, /* aka tsv110 */
{ -1, nullptr }, { 0xd40, "Cortex-A76" }, /* HiSilicon uses this ID though advertises A76 */
{ -1, nullptr }
}; };
static const id_part apple_part[] = { static const id_part apple_part[] = {
{ 0x022, "M1" }, { 0x022, "M1" },
{ 0x023, "M1" }, { 0x023, "M1" },
{ -1, nullptr }, { 0x024, "M1-Pro" },
{ 0x025, "M1-Pro" },
{ 0x028, "M1-Max" },
{ 0x029, "M1-Max" },
{ 0x032, "M2" },
{ 0x033, "M2" },
{ 0x034, "M2-Pro" },
{ 0x035, "M2-Pro" },
{ 0x038, "M2-Max" },
{ 0x039, "M2-Max" },
{ -1, nullptr }
};
static const struct id_part ft_part[] = {
{ 0x660, "FTC660" },
{ 0x661, "FTC661" },
{ 0x662, "FTC662" },
{ 0x663, "FTC663" },
{ -1, nullptr }
};
static const struct id_part ampere_part[] = {
{ 0xac3, "Ampere-1" },
{ 0xac4, "Ampere-1a" },
{ -1, nullptr }
}; };
@@ -229,7 +283,9 @@ static const hw_impl hw_implementer[] = {
{ 0x56, marvell_part, "Marvell" }, { 0x56, marvell_part, "Marvell" },
{ 0x61, apple_part, "Apple" }, { 0x61, apple_part, "Apple" },
{ 0x66, faraday_part, "Faraday" }, { 0x66, faraday_part, "Faraday" },
{ 0x69, intel_part, "Intel" } { 0x69, intel_part, "Intel" },
{ 0x70, ft_part, "Phytium" },
{ 0xc0, ampere_part, "Ampere" }
}; };

View File

@@ -353,14 +353,10 @@ bool xmrig::CudaLib::open()
# ifdef XMRIG_OS_LINUX # ifdef XMRIG_OS_LINUX
if (m_loader == defaultLoader) { if (m_loader == defaultLoader) {
m_loader = Process::location(Process::ExeLocation, m_loader); m_loader = Process::location(Process::ExeLocation, m_loader);
}
else {
return false;
}
if (uv_dlopen(m_loader, &cudaLib) == 0) { if (uv_dlopen(m_loader, &cudaLib) == 0) {
return true; return true;
} }
}
# endif # endif
m_error = uv_dlerror(&cudaLib); m_error = uv_dlerror(&cudaLib);

View File

@@ -399,6 +399,9 @@ private:
uv_loop_t* m_loop = nullptr; uv_loop_t* m_loop = nullptr;
uv_thread_t m_loopThread = {}; uv_thread_t m_loopThread = {};
uv_async_t m_shutdownAsync = {}; uv_async_t m_shutdownAsync = {};
uv_async_t m_batonAsync = {};
std::vector<KawPowBaton> m_batons;
static void loop(void* data) static void loop(void* data)
{ {
@@ -419,19 +422,37 @@ void KawPowBuilder::build_async(const IOclRunner& runner, uint64_t period, uint3
if (!m_loop) { if (!m_loop) {
m_loop = new uv_loop_t{}; m_loop = new uv_loop_t{};
uv_loop_init(m_loop); uv_loop_init(m_loop);
uv_async_init(m_loop, &m_shutdownAsync, [](uv_async_t* handle) { uv_close(reinterpret_cast<uv_handle_t*>(handle), nullptr); });
uv_async_init(m_loop, &m_shutdownAsync, [](uv_async_t* handle)
{
KawPowBuilder* builder = reinterpret_cast<KawPowBuilder*>(handle->data);
uv_close(reinterpret_cast<uv_handle_t*>(&builder->m_shutdownAsync), nullptr);
uv_close(reinterpret_cast<uv_handle_t*>(&builder->m_batonAsync), nullptr);
});
uv_async_init(m_loop, &m_batonAsync, [](uv_async_t* handle)
{
std::vector<KawPowBaton> batons;
{
KawPowBuilder* b = reinterpret_cast<KawPowBuilder*>(handle->data);
std::lock_guard<std::mutex> lock(b->m_mutex);
batons = std::move(b->m_batons);
}
for (const KawPowBaton& baton : batons) {
builder.build(baton.runner, baton.period, baton.worksize);
}
});
m_shutdownAsync.data = this;
m_batonAsync.data = this;
uv_thread_create(&m_loopThread, loop, this); uv_thread_create(&m_loopThread, loop, this);
} }
KawPowBaton* baton = new KawPowBaton(runner, period, worksize); m_batons.emplace_back(runner, period, worksize);
uv_async_send(&m_batonAsync);
uv_queue_work(m_loop, &baton->req,
[](uv_work_t* req) {
KawPowBaton* baton = static_cast<KawPowBaton*>(req->data);
builder.build(baton->runner, baton->period, baton->worksize);
},
[](uv_work_t* req, int) { delete static_cast<KawPowBaton*>(req->data); }
);
} }

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -123,6 +123,21 @@ void xmrig::Api::stop()
} }
void xmrig::Api::tick()
{
# ifdef XMRIG_FEATURE_HTTP
if (m_httpd->isBound() || !m_base->config()->http().isEnabled()) {
return;
}
if (++m_ticks % 10 == 0) {
m_ticks = 0;
m_httpd->start();
}
# endif
}
void xmrig::Api::onConfigChanged(Config *config, Config *previousConfig) void xmrig::Api::onConfigChanged(Config *config, Config *previousConfig)
{ {
if (config->apiId() != previousConfig->apiId()) { if (config->apiId() != previousConfig->apiId()) {

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@
#include <vector> #include <vector>
#include <cstdint>
#include "base/kernel/interfaces/IBaseListener.h" #include "base/kernel/interfaces/IBaseListener.h"
@@ -44,7 +43,7 @@ class Api : public IBaseListener
public: public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Api) XMRIG_DISABLE_COPY_MOVE_DEFAULT(Api)
Api(Base *base); explicit Api(Base *base);
~Api() override; ~Api() override;
inline const char *id() const { return m_id; } inline const char *id() const { return m_id; }
@@ -54,6 +53,7 @@ public:
void request(const HttpData &req); void request(const HttpData &req);
void start(); void start();
void stop(); void stop();
void tick();
protected: protected:
void onConfigChanged(Config *config, Config *previousConfig) override; void onConfigChanged(Config *config, Config *previousConfig) override;
@@ -65,14 +65,15 @@ private:
Base *m_base; Base *m_base;
char m_id[32]{}; char m_id[32]{};
String m_workerId;
const uint64_t m_timestamp; const uint64_t m_timestamp;
Httpd *m_httpd = nullptr; Httpd *m_httpd = nullptr;
std::vector<IApiListener *> m_listeners; std::vector<IApiListener *> m_listeners;
String m_workerId;
uint8_t m_ticks = 0;
}; };
} // namespace xmrig } // namespace xmrig
#endif /* XMRIG_API_H */ #endif // XMRIG_API_H

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -22,11 +22,6 @@
#include "base/kernel/interfaces/IBaseListener.h" #include "base/kernel/interfaces/IBaseListener.h"
#include "base/net/http/HttpListener.h" #include "base/net/http/HttpListener.h"
#include "base/tools/Object.h"
#include <cstdint>
#include <memory>
namespace xmrig { namespace xmrig {
@@ -43,9 +38,11 @@ class Httpd : public IBaseListener, public IHttpListener
public: public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Httpd) XMRIG_DISABLE_COPY_MOVE_DEFAULT(Httpd)
Httpd(Base *base); explicit Httpd(Base *base);
~Httpd() override; ~Httpd() override;
inline bool isBound() const { return m_server != nullptr; }
bool start(); bool start();
void stop(); void stop();
@@ -69,7 +66,7 @@ private:
}; };
} /* namespace xmrig */ } // namespace xmrig
#endif /* XMRIG_HTTPD_H */ #endif // XMRIG_HTTPD_H

View File

@@ -52,6 +52,8 @@ public:
enum RequestType { enum RequestType {
REQ_UNKNOWN, REQ_UNKNOWN,
REQ_SUMMARY, REQ_SUMMARY,
REQ_BACKENDS,
REQ_CONFIG,
REQ_JSON_RPC REQ_JSON_RPC
}; };

View File

@@ -60,7 +60,7 @@ protected:
inline Source source() const override { return m_source; } inline Source source() const override { return m_source; }
inline void done(int) override { m_state = STATE_DONE; } inline void done(int) override { m_state = STATE_DONE; }
int m_version = 1; int m_version = 0;
RequestType m_type = REQ_UNKNOWN; RequestType m_type = REQ_UNKNOWN;
State m_state = STATE_NEW; State m_state = STATE_NEW;
String m_rpcMethod; String m_rpcMethod;

View File

@@ -67,10 +67,33 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
m_res(req.id()), m_res(req.id()),
m_url(req.url.c_str()) m_url(req.url.c_str())
{ {
if (method() == METHOD_GET) { if (url().size() > 4 && memcmp(url().data(), "/", 1) == 0 && memcmp(url().data()+2, "/", 1) == 0) {
if (url() == "/1/summary" || url() == "/2/summary" || url() == "/api.json") { if (memcmp(url().data(), "/2/", 3) == 0) {
m_version = 2;
} else if (memcmp(url().data(), "/1/", 3) == 0) {
m_version = 1;
}
switch (url().size()) {
case 9:
if (memcmp(url().data()+3, "config", 6) == 0) {
m_type = REQ_CONFIG;
}
break;
case 10:
if (memcmp(url().data()+3, "summary", 7) == 0) {
m_type = REQ_SUMMARY; m_type = REQ_SUMMARY;
} }
break;
case 11:
if (memcmp(url().data()+3, "backends", 8) == 0) {
m_type = REQ_BACKENDS;
}
break;
}
}
if (url() == "/api.json") {
m_type = REQ_SUMMARY;
} }
if (method() == METHOD_POST && url() == "/json_rpc") { if (method() == METHOD_POST && url() == "/json_rpc") {
@@ -94,12 +117,6 @@ xmrig::HttpApiRequest::HttpApiRequest(const HttpData &req, bool restricted) :
return; return;
} }
if (url().size() > 4) {
if (memcmp(url().data(), "/2/", 3) == 0) {
m_version = 2;
}
}
} }

View File

@@ -53,6 +53,7 @@ static const CoinInfo coinInfo[] = {
{ Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") }, { Algorithm::RX_KEVA, "KVA", "Kevacoin", 0, 0, MAGENTA_BG_BOLD(WHITE_BOLD_S " keva ") },
{ Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") }, { Algorithm::KAWPOW_RVN, "RVN", "Ravencoin", 0, 0, BLUE_BG_BOLD( WHITE_BOLD_S " raven ") },
{ Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") }, { Algorithm::RX_WOW, "WOW", "Wownero", 300, 100000000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " wownero ") },
{ Algorithm::RX_0, "ZEPH", "Zephyr", 120, 1000000000000, BLUE_BG_BOLD( WHITE_BOLD_S " zephyr ") },
}; };

View File

@@ -39,6 +39,7 @@ public:
KEVA, KEVA,
RAVEN, RAVEN,
WOWNERO, WOWNERO,
ZEPHYR,
MAX MAX
}; };

View File

@@ -45,13 +45,6 @@
#ifdef XMRIG_FEATURE_API #ifdef XMRIG_FEATURE_API
# include "base/api/Api.h" # include "base/api/Api.h"
# include "base/api/interfaces/IApiRequest.h" # include "base/api/interfaces/IApiRequest.h"
namespace xmrig {
static const char *kConfigPathV1 = "/1/config";
static const char *kConfigPathV2 = "/2/config";
} // namespace xmrig
#endif #endif
@@ -317,7 +310,7 @@ void xmrig::Base::onFileChanged(const String &fileName)
void xmrig::Base::onRequest(IApiRequest &request) void xmrig::Base::onRequest(IApiRequest &request)
{ {
if (request.method() == IApiRequest::METHOD_GET) { if (request.method() == IApiRequest::METHOD_GET) {
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) { if (request.type() == IApiRequest::REQ_CONFIG) {
if (request.isRestricted()) { if (request.isRestricted()) {
return request.done(403); return request.done(403);
} }
@@ -327,7 +320,7 @@ void xmrig::Base::onRequest(IApiRequest &request)
} }
} }
else if (request.method() == IApiRequest::METHOD_PUT || request.method() == IApiRequest::METHOD_POST) { else if (request.method() == IApiRequest::METHOD_PUT || request.method() == IApiRequest::METHOD_POST) {
if (request.url() == kConfigPathV1 || request.url() == kConfigPathV2) { if (request.type() == IApiRequest::REQ_CONFIG) {
request.accept(); request.accept();
if (!reload(request.json())) { if (!reload(request.json())) {

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -16,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "base/kernel/Platform.h" #include "base/kernel/Platform.h"
#include "backend/cpu/platform/HwlocCpuInfo.h"
#include "backend/cpu/Cpu.h" #include "backend/cpu/Cpu.h"
@@ -29,20 +27,21 @@
#ifndef XMRIG_OS_APPLE #ifndef XMRIG_OS_APPLE
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id) bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{ {
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info()); auto topology = Cpu::info()->topology();
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(cpu_id)); auto pu = hwloc_get_pu_obj_by_os_index(topology, static_cast<unsigned>(cpu_id));
if (pu == nullptr) { if (pu == nullptr) {
return false; return false;
} }
if (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) { if (hwloc_set_cpubind(topology, pu->cpuset, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) >= 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
return true; return true;
} }
const bool result = (hwloc_set_cpubind(cpu->topology(), pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0); const bool result = (hwloc_set_cpubind(topology, pu->cpuset, HWLOC_CPUBIND_THREAD) >= 0);
std::this_thread::sleep_for(std::chrono::milliseconds(1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
return result; return result;
} }
#endif #endif

View File

@@ -197,6 +197,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_vote); ar(m_vote);
} }
if (m_coin == Coin::ZEPHYR) {
uint8_t pricing_record[24];
ar(pricing_record);
}
// Miner transaction begin // Miner transaction begin
// Prefix begin // Prefix begin
setOffset(MINER_TX_PREFIX_OFFSET, ar.index()); setOffset(MINER_TX_PREFIX_OFFSET, ar.index());
@@ -220,8 +225,8 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_height); ar(m_height);
ar(m_numOutputs); ar(m_numOutputs);
// must be 1 output const uint64_t expected_outputs = (m_coin == Coin::ZEPHYR) ? 2 : 1;
if (m_numOutputs != 1) { if (m_numOutputs != expected_outputs) {
return false; return false;
} }
@@ -237,7 +242,35 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_ephPublicKey, kKeySize); ar(m_ephPublicKey, kKeySize);
if (m_outputType == 3) { if (m_coin == Coin::ZEPHYR) {
if (m_outputType != 2) {
return false;
}
uint64_t asset_type_len;
ar(asset_type_len);
ar.skip(asset_type_len);
ar(m_viewTag);
uint64_t amount2;
ar(amount2);
uint8_t output_type2;
ar(output_type2);
if (output_type2 != 2) {
return false;
}
Span key2;
ar(key2, kKeySize);
ar(asset_type_len);
ar.skip(asset_type_len);
uint8_t view_tag2;
ar(view_tag2);
}
else if (m_outputType == 3) {
ar(m_viewTag); ar(m_viewTag);
} }
@@ -248,6 +281,8 @@ bool xmrig::BlockTemplate::parse(bool hashes)
BlobReader<true> ar_extra(blob(TX_EXTRA_OFFSET), m_extraSize); BlobReader<true> ar_extra(blob(TX_EXTRA_OFFSET), m_extraSize);
ar.skip(m_extraSize); ar.skip(m_extraSize);
bool pubkey_offset_first = true;
while (ar_extra.index() < m_extraSize) { while (ar_extra.index() < m_extraSize) {
uint64_t extra_tag = 0; uint64_t extra_tag = 0;
uint64_t size = 0; uint64_t size = 0;
@@ -256,7 +291,10 @@ bool xmrig::BlockTemplate::parse(bool hashes)
switch (extra_tag) { switch (extra_tag) {
case 0x01: // TX_EXTRA_TAG_PUBKEY case 0x01: // TX_EXTRA_TAG_PUBKEY
if (pubkey_offset_first) {
pubkey_offset_first = false;
setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index()); setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
}
ar_extra.skip(kKeySize); ar_extra.skip(kKeySize);
break; break;
@@ -277,6 +315,13 @@ bool xmrig::BlockTemplate::parse(bool hashes)
} }
} }
if (m_coin == Coin::ZEPHYR) {
uint64_t pricing_record_height, amount_burnt, amount_minted;
ar(pricing_record_height);
ar(amount_burnt);
ar(amount_minted);
}
setOffset(MINER_TX_PREFIX_END_OFFSET, ar.index()); setOffset(MINER_TX_PREFIX_END_OFFSET, ar.index());
// Prefix end // Prefix end

View File

@@ -689,7 +689,7 @@ void xmrig::Miner::onRequest(IApiRequest &request)
d_ptr->getMiner(request.reply(), request.doc(), request.version()); d_ptr->getMiner(request.reply(), request.doc(), request.version());
d_ptr->getHashrate(request.reply(), request.doc(), request.version()); d_ptr->getHashrate(request.reply(), request.doc(), request.version());
} }
else if (request.url() == "/2/backends") { else if (request.type() == IApiRequest::REQ_BACKENDS && request.version() == 2) {
request.accept(); request.accept();
d_ptr->getBackends(request.reply(), request.doc()); d_ptr->getBackends(request.reply(), request.doc());
@@ -711,6 +711,12 @@ void xmrig::Miner::onRequest(IApiRequest &request)
stop(); stop();
} }
else if (request.rpcMethod() == "start") {
request.accept();
const auto config = d_ptr->controller->config();
onConfigChanged(config, config);
}
} }
for (IBackend *backend : d_ptr->backends) { for (IBackend *backend : d_ptr->backends) {

View File

@@ -1,8 +1,8 @@
/* XMRig /* XMRig
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd> * Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2019 tevador <tevador@gmail.com> * Copyright (c) 2018-2019 tevador <tevador@gmail.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -18,10 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "crypto/common/VirtualMemory.h" #include "crypto/common/VirtualMemory.h"
#include "backend/cpu/Cpu.h" #include "backend/cpu/Cpu.h"
#include "backend/cpu/platform/HwlocCpuInfo.h"
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
@@ -34,10 +32,9 @@ uint32_t xmrig::VirtualMemory::bindToNUMANode(int64_t affinity)
return 0; return 0;
} }
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info()); auto pu = hwloc_get_pu_obj_by_os_index(Cpu::info()->topology(), static_cast<unsigned>(affinity));
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(affinity));
if (pu == nullptr || !cpu->membind(pu->nodeset)) { if (pu == nullptr || !Cpu::info()->membind(pu->nodeset)) {
LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity); LOG_WARN("CPU #%02" PRId64 " warning: \"can't bind memory\"", affinity);
return 0; return 0;

View File

@@ -48,8 +48,11 @@
#ifdef XMRIG_FEATURE_HWLOC #ifdef XMRIG_FEATURE_HWLOC
# include "base/kernel/Platform.h" # include "base/kernel/Platform.h"
#include "backend/cpu/platform/HwlocCpuInfo.h"
# include <hwloc.h> # include <hwloc.h>
# if HWLOC_API_VERSION < 0x20000
# define HWLOC_OBJ_L3CACHE HWLOC_OBJ_CACHE
# endif
#endif #endif
#if defined(XMRIG_ARM) #if defined(XMRIG_ARM)
@@ -86,7 +89,7 @@ CORE_HASH(14, whirlpool );
#undef CORE_HASH #undef CORE_HASH
typedef void (*core_hash_func)(const uint8_t* data, size_t size, uint8_t* output); using core_hash_func = void (*)(const uint8_t* data, size_t size, uint8_t* output);
static const core_hash_func core_hash[15] = { h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14 }; static const core_hash_func core_hash[15] = { h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14 };
namespace xmrig namespace xmrig
@@ -165,6 +168,8 @@ static struct AlgoTune
struct HelperThread struct HelperThread
{ {
XMRIG_DISABLE_COPY_MOVE_DEFAULT(HelperThread)
HelperThread(hwloc_bitmap_t cpu_set, int priority, bool is8MB) : m_cpuSet(cpu_set), m_priority(priority), m_is8MB(is8MB) HelperThread(hwloc_bitmap_t cpu_set, int priority, bool is8MB) : m_cpuSet(cpu_set), m_priority(priority), m_is8MB(is8MB)
{ {
uv_mutex_init(&m_mutex); uv_mutex_init(&m_mutex);
@@ -194,14 +199,17 @@ struct HelperThread
struct TaskBase struct TaskBase
{ {
virtual ~TaskBase() {} XMRIG_DISABLE_COPY_MOVE(TaskBase)
TaskBase() = default;
virtual ~TaskBase() = default;
virtual void run() = 0; virtual void run() = 0;
}; };
template<typename T> template<typename T>
struct Task : TaskBase struct Task : TaskBase
{ {
inline Task(T&& task) : m_task(std::move(task)) explicit inline Task(T&& task) : m_task(std::move(task))
{ {
static_assert(sizeof(Task) <= 128, "Task struct is too large"); static_assert(sizeof(Task) <= 128, "Task struct is too large");
} }
@@ -219,7 +227,7 @@ struct HelperThread
inline void launch_task(T&& task) inline void launch_task(T&& task)
{ {
uv_mutex_lock(&m_mutex); uv_mutex_lock(&m_mutex);
new (&m_tasks[m_numTasks++]) Task<T>(std::move(task)); new (&m_tasks[m_numTasks++]) Task<T>(std::forward<T>(task));
uv_cond_signal(&m_cond); uv_cond_signal(&m_cond);
uv_mutex_unlock(&m_mutex); uv_mutex_unlock(&m_mutex);
} }
@@ -234,7 +242,7 @@ struct HelperThread
void run() void run()
{ {
if (hwloc_bitmap_weight(m_cpuSet) > 0) { if (hwloc_bitmap_weight(m_cpuSet) > 0) {
hwloc_topology_t topology = reinterpret_cast<HwlocCpuInfo*>(Cpu::info())->topology(); hwloc_topology_t topology = Cpu::info()->topology();
if (hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) < 0) { if (hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT) < 0) {
hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD); hwloc_set_cpubind(topology, m_cpuSet, HWLOC_CPUBIND_THREAD);
} }
@@ -288,9 +296,9 @@ void benchmark()
// Try to avoid CPU core 0 because many system threads use it and can interfere // Try to avoid CPU core 0 because many system threads use it and can interfere
uint32_t thread_index1 = (Cpu::info()->threads() > 2) ? 2 : 0; uint32_t thread_index1 = (Cpu::info()->threads() > 2) ? 2 : 0;
hwloc_topology_t topology = reinterpret_cast<HwlocCpuInfo*>(Cpu::info())->topology(); hwloc_topology_t topology = Cpu::info()->topology();
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1); hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(topology, thread_index1);
hwloc_obj_t pu2; hwloc_obj_t pu2 = nullptr;
hwloc_get_closest_objs(topology, pu, &pu2, 1); hwloc_get_closest_objs(topology, pu, &pu2, 1);
uint32_t thread_index2 = pu2 ? pu2->os_index : thread_index1; uint32_t thread_index2 = pu2 ? pu2->os_index : thread_index1;
@@ -481,12 +489,17 @@ HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::v
} }
if (cpu_index >= 0) { if (cpu_index >= 0) {
hwloc_topology_t topology = reinterpret_cast<HwlocCpuInfo*>(Cpu::info())->topology(); hwloc_obj_t root = hwloc_get_root_obj(Cpu::info()->topology());
hwloc_obj_t root = hwloc_get_root_obj(topology);
bool is8MB = false; bool is8MB = false;
findByType(root, HWLOC_OBJ_L3CACHE, [cpu_index, &is8MB](hwloc_obj_t obj) { findByType(root, HWLOC_OBJ_L3CACHE, [cpu_index, &is8MB](hwloc_obj_t obj) {
# if HWLOC_API_VERSION < 0x20000
if (obj->attr->cache.depth != 3) {
return false;
}
# endif
if (!hwloc_bitmap_isset(obj->cpuset, cpu_index)) { if (!hwloc_bitmap_isset(obj->cpuset, cpu_index)) {
return false; return false;
} }
@@ -510,7 +523,11 @@ HelperThread* create_helper_thread(int64_t cpu_index, int priority, const std::v
return true; return true;
}); });
# if HWLOC_API_VERSION >= 0x20000
for (auto obj_type : { HWLOC_OBJ_CORE, HWLOC_OBJ_L1CACHE, HWLOC_OBJ_L2CACHE, HWLOC_OBJ_L3CACHE }) { for (auto obj_type : { HWLOC_OBJ_CORE, HWLOC_OBJ_L1CACHE, HWLOC_OBJ_L2CACHE, HWLOC_OBJ_L3CACHE }) {
# else
for (auto obj_type : { HWLOC_OBJ_CORE, HWLOC_OBJ_CACHE }) {
# endif
findByType(root, obj_type, [cpu_index, helper_cpu_set, main_threads_set](hwloc_obj_t obj) { findByType(root, obj_type, [cpu_index, helper_cpu_set, main_threads_set](hwloc_obj_t obj) {
const hwloc_cpuset_t& s = obj->cpuset; const hwloc_cpuset_t& s = obj->cpuset;
if (hwloc_bitmap_isset(s, cpu_index)) { if (hwloc_bitmap_isset(s, cpu_index)) {
@@ -571,9 +588,13 @@ void hash_octa(const uint8_t* data, size_t size, uint8_t* output, cryptonight_ct
uint8_t tmp[64 * N]; uint8_t tmp[64 * N];
if (helper && (tune[cn_indices[0]].threads == 2) && (tune[cn_indices[1]].threads == 2) && (tune[cn_indices[2]].threads == 2)) { if (helper && (tune[cn_indices[0]].threads == 2) && (tune[cn_indices[1]].threads == 2) && (tune[cn_indices[2]].threads == 2)) {
const size_t n = N / 2; constexpr size_t n = N / 2;
helper->launch_task([av, data, size, &ctx_memory, ctx, &cn_indices, &core_indices, &tmp, output, tune]() {
# ifdef _MSC_VER
constexpr size_t n = N / 2;
# endif
helper->launch_task([n, av, data, size, &ctx_memory, ctx, &cn_indices, &core_indices, &tmp, output, tune]() {
const uint8_t* input = data; const uint8_t* input = data;
size_t input_size = size; size_t input_size = size;

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -22,11 +22,6 @@
#include "base/io/json/Json.h" #include "base/io/json/Json.h"
#ifdef XMRIG_FEATURE_HWLOC
# include "backend/cpu/platform/HwlocCpuInfo.h"
#endif
#include <array> #include <array>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
@@ -190,7 +185,7 @@ std::vector<uint32_t> xmrig::RxConfig::nodeset() const
return m_nodeset; return m_nodeset;
} }
return (m_numa && Cpu::info()->nodes() > 1) ? static_cast<HwlocCpuInfo *>(Cpu::info())->nodeset() : std::vector<uint32_t>(); return (m_numa && Cpu::info()->nodes() > 1) ? Cpu::info()->nodeset() : std::vector<uint32_t>();
} }
#endif #endif

View File

@@ -1,6 +1,6 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -123,7 +123,7 @@ private:
}; };
} /* namespace xmrig */ } // namespace xmrig
#endif /* XMRIG_RXCONFIG_H */ #endif // XMRIG_RXCONFIG_H

View File

@@ -1,7 +1,7 @@
/* XMRig /* XMRig
* Copyright (c) 2018-2019 tevador <tevador@gmail.com> * Copyright (c) 2018-2019 tevador <tevador@gmail.com>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh> * Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com> * Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
#include "crypto/rx/RxNUMAStorage.h" #include "crypto/rx/RxNUMAStorage.h"
#include "backend/cpu/Cpu.h" #include "backend/cpu/Cpu.h"
#include "backend/cpu/platform/HwlocCpuInfo.h"
#include "base/io/log/Log.h" #include "base/io/log/Log.h"
#include "base/io/log/Tags.h" #include "base/io/log/Tags.h"
#include "base/kernel/Platform.h" #include "base/kernel/Platform.h"
@@ -45,13 +44,12 @@ static std::mutex mutex;
static bool bindToNUMANode(uint32_t nodeId) static bool bindToNUMANode(uint32_t nodeId)
{ {
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info()); auto node = hwloc_get_numanode_obj_by_os_index(Cpu::info()->topology(), nodeId);
hwloc_obj_t node = hwloc_get_numanode_obj_by_os_index(cpu->topology(), nodeId);
if (!node) { if (!node) {
return false; return false;
} }
if (cpu->membind(node->nodeset)) { if (Cpu::info()->membind(node->nodeset)) {
Platform::setThreadAffinity(static_cast<uint64_t>(hwloc_bitmap_first(node->cpuset))); Platform::setThreadAffinity(static_cast<uint64_t>(hwloc_bitmap_first(node->cpuset)));
return true; return true;

View File

@@ -308,6 +308,10 @@ void xmrig::Network::tick()
if (m_donate) { if (m_donate) {
m_donate->tick(now); m_donate->tick(now);
} }
# ifdef XMRIG_FEATURE_API
m_controller->api()->tick();
# endif
} }

View File

@@ -22,15 +22,15 @@
#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 "6.19.3-dev" #define APP_VERSION "6.20.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-2023 xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2023 xmrig.com"
#define APP_KIND "miner" #define APP_KIND "miner"
#define APP_VER_MAJOR 6 #define APP_VER_MAJOR 6
#define APP_VER_MINOR 19 #define APP_VER_MINOR 20
#define APP_VER_PATCH 3 #define APP_VER_PATCH 1
#ifdef _MSC_VER #ifdef _MSC_VER
# if (_MSC_VER >= 1930) # if (_MSC_VER >= 1930)