1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-06 15:42:38 -05:00

Compare commits

...

144 Commits

Author SHA1 Message Date
XMRig
a5aa2c9042 v6.21.1 2024-02-25 22:26:52 +07:00
XMRig
fa35a32eee Merge branch 'dev' 2024-02-25 22:25:41 +07:00
XMRig
7b6ce59821 Update CHANGELOG.md. 2024-02-22 03:26:41 +07:00
XMRig
33315ba2ef Merge branch 'Daviey-HTTPRebindSegFault' into dev 2024-02-12 14:51:34 +07:00
XMRig
2c9c40d623 Merge branch 'HTTPRebindSegFault' of https://github.com/Daviey/xmrig into Daviey-HTTPRebindSegFault 2024-02-12 14:50:48 +07:00
Dave Walker (Daviey)
daa6328418 Fix segfault in HTTP API rebind
Previously with HTTP API enabled on brenchmarking run, it is possible
to cause a segfault due to an issue handling the m_httpd pointer and
rebinding.

  - Initialize m_httpd to nullptr to indicate when it's not in use.
  - Safely delete m_httpd in Api's destructor to prevent use-after-free
    issues.
  - Add checks to ensure m_httpd is not nullptr before usage in start,
    stop, and tick methods.
  - Log errors for HTTP server start failures to aid in debugging.

Fixes MoneroOcean/xmrig#120

Signed-off-by: Dave Walker (Daviey) <email@daviey.com>
2024-02-11 17:52:36 +00:00
XMRig
8afd4d5f2f Cleanup. 2024-01-17 00:31:16 +07:00
xmrig
77e2f3a028 Merge pull request #3399 from SChernykh/dev
Fixed Zephyr mining (OpenCL)
2024-01-14 09:01:44 +07:00
SChernykh
206295c6cb Fixed Zephyr mining (OpenCL) 2024-01-13 20:14:08 +01:00
XMRig
07e1e77c4f Code style cleanup. 2023-12-29 21:17:19 +07:00
xmrig
50a98a4bb1 Merge pull request #3391 from moneromooo-monero/tf-dev
add support for townforge (monero fork using randomx)
2023-12-27 23:13:54 +07:00
moneromooo-monero
c50369d65d add support for townforge (monero fork using randomx) 2023-12-23 15:31:05 +00:00
XMRig
592b0c9c76 v6.21.1-dev 2023-11-23 21:19:36 +07:00
XMRig
89eab0eff2 Merge branch 'master' into dev 2023-11-23 21:18:21 +07:00
XMRig
8084ff37a5 v6.21.0 2023-11-23 20:40:58 +07:00
XMRig
7cf3db7750 Merge branch 'dev' 2023-11-23 20:40:34 +07:00
XMRig
4bda6e054d v6.21.0-dev 2023-11-23 19:51:41 +07:00
xmrig
64a0ed413b Merge pull request #3358 from SChernykh/dev
Zephyr solo mining: handle multiple outputs
2023-11-15 22:36:35 +07:00
SChernykh
0b59b7eb43 Zephyr solo mining: handle multiple outputs 2023-11-15 16:18:05 +01:00
xmrig
ae6b10b5a4 Merge pull request #3356 from SChernykh/dev
Updated pricing record size for Zephyr solo mining
2023-11-15 08:27:02 +07:00
SChernykh
705a7eac0c Updated pricing record size for Zephyr solo mining 2023-11-14 13:06:10 +01:00
xmrig
10bfffe033 Merge pull request #3348 from SChernykh/dev
Update to latest sse2neon.h
2023-10-31 11:52:38 +07:00
SChernykh
4131aa4754 Update sse2neon.h 2023-10-30 20:07:03 +01:00
xmrig
fee51b20fa Merge pull request #3346 from SChernykh/dev
ARM64 JIT: don't use `x18` register
2023-10-20 07:36:12 +07:00
SChernykh
5e66efabcf ARM64 JIT: don't use x18 register
From https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
> The platforms reserve register x18. Don’t use this register.

This PR fixes invalid hashes when running on Apple silicon with the latest macOS SDK.
2023-10-19 17:45:15 +02:00
XMRig
08901a9a4b Merge branch 'JacksonZ03-main' into dev 2023-10-09 15:15:32 +07:00
XMRig
a19f590ee6 Merge branch 'main' of https://github.com/JacksonZ03/xmrig into JacksonZ03-main 2023-10-09 15:14:50 +07:00
Jackson Zheng
2fa754825d Update cn_main_loop.asm
Found this line to be missing. I looked through the history and seemed like the original author of the commit missed it out.
2023-10-08 23:29:52 +01:00
Jackson Zheng
f3446c0a94 Update cn_main_loop.asm
I was scanning the code and found this line to be missing. Not sure if this was a mistake or if it was intentionally left out?
2023-10-08 23:12:58 +01:00
xmrig
71209d4cd7 Merge pull request #3339 from SChernykh/dev
Added SNI option for TLS connections
2023-09-29 19:15:29 +07:00
SChernykh
0a3313cb76 Added SNI option for TLS connections
Disabled by default, add `"sni": true,` to pool config to enable it.
2023-09-29 08:33:49 +02:00
xmrig
e855723cd9 Merge pull request #3320 from SChernykh/dev
Add "built for OS/architecture/bits" to "ABOUT"
2023-08-21 19:00:14 +07:00
SChernykh
6e294bd046 Add "built for OS/architecture/bits" to "ABOUT"
To make it more clear what binary it is on some XMRig screenshot.
2023-08-21 13:49:21 +02:00
XMRig
dfe70d9ea7 Fixed huge pages availability info on Linux. 2023-08-08 17:48:44 +07:00
XMRig
2ecf10cdcb Make Platform::hasKeepalive() constexpr where always supported and code cleanup. 2023-08-06 20:26:07 +07:00
xmrig
b55ca8e547 Merge pull request #3312 from SChernykh/dev
Disable TCP keepalive before closing socket
2023-08-06 20:14:37 +07:00
SChernykh
12577df7ba Disable TCP keepalive before closing socket 2023-08-06 14:51:25 +02:00
xmrig
64f5bb467a Merge pull request #3302 from SChernykh/dev
Enabled keepalive for Windows (>= Vista)
2023-07-17 17:17:39 +07:00
SChernykh
5717e72367 Enabled keepalive for Windows (>= Vista) 2023-07-17 09:49:10 +02: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
xmrig
02d45834e1 Merge pull request #3273 from SChernykh/dev
RandomX: fixed undefined behavior
2023-05-23 20:18:32 +07:00
SChernykh
1252a4710e RandomX: fixed undefined behavior
Using an inactive member of a `union` is an undefined behavior in C++
2023-05-23 14:40:12 +02:00
xmrig
5891f1f06b Merge pull request #3271 from SChernykh/opt_genprog
RandomX: optimized program generation
2023-05-22 05:25:32 +07:00
SChernykh
5dcbab7e3a RandomX: optimized program generation 2023-05-21 17:44:20 +02:00
xmrig
7b51e23aa0 Merge pull request #3254 from SChernykh/dev
Tweaked auto-tuning for Intel CPUs
2023-04-19 12:29:58 +07:00
SChernykh
7f7fc363e1 Tweaked auto-tuning for Intel CPUs
Alder Lake and newer CPUs have exclusive L3 cache and benefit from more threads until L3+L2 is filled.
2023-04-18 21:20:45 +02:00
XMRig
c4e1363148 #3245 Improved algorithm negotiation for donation rounds by sending extra information about current mining job. 2023-04-07 23:35:05 +07:00
XMRig
a2e9b3456d v6.19.3-dev 2023-04-04 00:34:54 +07:00
XMRig
4790318685 Merge branch 'master' into dev 2023-04-04 00:34:22 +07:00
XMRig
038c4fbe34 v6.19.2 2023-04-03 22:15:40 +07:00
XMRig
d65d34ef36 Merge branch 'dev' 2023-04-03 22:14:58 +07:00
xmrig
af6647f377 Update CHANGELOG.md 2023-04-03 20:34:35 +07:00
xmrig
8f9adc02c0 Merge pull request #3241 from SChernykh/dev
Sync with changes from proxy
2023-04-03 20:28:38 +07:00
SChernykh
5e0079f012 Sync with changes from proxy 2023-04-03 15:01:40 +02:00
xmrig
dc5e341778 Merge pull request #3240 from koitsu/dev-improve-cmd-files
Improve .cmd files when run by shortcuts on another drive
2023-04-01 12:30:33 +07:00
Jeremy Chadwick
0f81ab4c67 Improve .cmd files when run by shortcuts on another drive 2023-03-31 20:16:00 -07:00
Dmitriy Nikiforov
62a3a98e7d fix(cuda): receive CUDA loader error on linux too. 2023-03-27 18:48:13 +05:00
XMRig
d31b3b7c76 Code style cleanup. 2023-03-25 20:56:25 +07:00
xmrig
e352109431 Merge pull request #3232 from moneromooo-monero/xhd-dev
DaemonClient: new X-Hash-Difficulty HTTP header optimization
2023-03-25 20:51:09 +07:00
moneromooo-monero
88b0385bfe DaemonClient: new X-Hash-Difficulty HTTP header optimization
If the caller knows the difficulty of a PoW hash a given nonce
yields, it can tell the callee via the X-Hash-Difficulty, which
may allow the callee to skip some processing if the difficulty
does not meet some criterion.

In my case, a merge mining proxy can know it's pointless trying
to submit the nonce to a chain with higher difficulty when the
nonce only meets the difficulty for a lower difficulty chain.
2023-03-25 09:48:54 +00:00
xmrig
9508332258 Merge pull request #3230 from SChernykh/dev
Fixed parsing of TX_EXTRA_MERGE_MINING_TAG
2023-03-25 12:39:04 +07:00
SChernykh
bc5c1f7e65 Fixed parsing of TX_EXTRA_MERGE_MINING_TAG 2023-03-24 22:42:26 +01:00
XMRig
22118330e3 v6.19.2-dev 2023-03-23 20:41:00 +07:00
XMRig
240f2450af Merge branch 'master' into dev 2023-03-23 20:40:23 +07:00
XMRig
6e856ca39c v6.19.1 2023-03-23 19:03:09 +07:00
XMRig
6047786f43 Merge branch 'dev' 2023-03-23 19:02:24 +07:00
xmrig
7b8ba9ac09 Update CHANGELOG.md 2023-03-23 18:10:43 +07:00
xmrig
02259fec05 Merge pull request #3228 from SChernykh/dev
Fix build with gcc 13
2023-03-23 18:02:47 +07:00
Matthew Smith
51728b2d55 Fix build with gcc 13
Now some header files are not included transistively with new
libstdc++.

Bug: https://bugs.gentoo.org/895226
2023-03-23 12:01:15 +01:00
XMRig
ebe818a5fb Resolved deprecated methods warnings with OpenSSL 3.0. 2023-03-07 23:51:03 +07:00
xmrig
790a71b030 Merge pull request #3218 from SChernykh/dev
Fix: `--randomx-wrmsr=-1` worked only on Intel
2023-02-27 11:17:01 +07:00
SChernykh
c62622b114 Fix: --randomx-wrmsr=-1 worked only on Intel 2023-02-26 22:31:55 +01:00
xmrig
fc643e2936 Merge pull request #3213 from SChernykh/dev
Fix for 32-bit clang 15
2023-02-19 15:47:28 +07:00
SChernykh
12b9b62ef7 Fix for 32-bit clang 15
Don't define `_mm_cvtsi128_si64` and `_mm_cvtsi64_si128` because clang 15 already has them in its headers.
2023-02-19 09:42:16 +01:00
XMRig
667f636c62 Fixed DnsUvBackend storage cleanup. 2023-02-09 21:45:50 +07:00
XMRig
81e87a6931 Revert changes to fix MSVC build. 2023-02-09 21:28:39 +07:00
XMRig
540b223eab Cleanup. 2023-02-09 13:55:11 +07:00
XMRig
75474be060 Fix warning. 2023-02-03 23:46:58 +07:00
XMRig
49f34e59a6 Partially resolved deprecated methods warnings in OpenSSL 3.0. 2023-02-03 23:08:54 +07:00
XMRig
223add4e22 v6.19.1-dev 2023-02-02 12:27:33 +07:00
XMRig
435fc86120 Merge branch 'master' into dev 2023-02-02 12:27:08 +07:00
XMRig
c0143b90ce v6.19.0 2023-02-02 11:51:11 +07:00
XMRig
c3cdffe86d Merge branch 'dev' 2023-02-02 11:50:29 +07:00
XMRig
8a4da33bea Update scripts/build.*.sh. 2023-01-30 00:19:55 +07:00
XMRig
1c7a339527 v6.19.0-dev (new config options added). 2023-01-29 11:16:37 +07:00
xmrig
490acd6e55 Update CHANGELOG.md 2023-01-29 11:13:28 +07:00
xmrig
6ecf57959b Merge pull request #3202 from SChernykh/dev
Solo mining: added job timeout (default is 15 seconds)
2023-01-29 11:12:22 +07:00
SChernykh
e2c58126e9 Solo mining: added job timeout (default is 15 seconds)
It's important to update jobs frequently to get new transactions into the block template. See https://rucknium.me/posts/monero-pool-transaction-delay/ for more details.
2023-01-28 19:42:02 +01:00
XMRig
0ed4b35cd3 Update hwloc for MSVC builds to 2.9.0. 2023-01-27 01:07:58 +07:00
xmrig
afe2aa4402 Update CHANGELOG.md 2023-01-23 20:54:46 +07:00
XMRig
3f7533a645 Update to latest sse2neon.h. 2023-01-23 20:45:02 +07:00
xmrig
6ef0409086 Merge pull request #3198 from SChernykh/dev
Fixed broken RandomX light mode mining
2023-01-21 22:05:25 +07:00
SChernykh
64b0d9562e Fixed broken RandomX light mode mining
RandomX VMs didn't get updated properly in light mode.
2023-01-21 16:02:47 +01:00
XMRig
770b71c69a #3185 Fixed macOS DMI reader. 2023-01-19 22:09:59 +07:00
xmrig
44642643f8 Merge pull request #3196 from SChernykh/dev
Show IP address for failed connections
2023-01-11 17:02:15 +07:00
SChernykh
273bb84df8 Show IP address for failed connections 2023-01-11 09:28:16 +01:00
xmrig
4d0b8c9daf Merge pull request #3182 from SChernykh/dev
DragonflyBSD compilation fixes
2022-12-17 20:24:01 +07:00
SChernykh
7d4d48e83b DragonflyBSD compilation fixes 2022-12-17 13:11:14 +01:00
xmrig
2ea37cdf37 Merge pull request #3180 from SChernykh/dev
Added ifdefs for DragonflyBSD
2022-12-16 21:29:24 +07:00
SChernykh
a02afe6d4f Added ifdefs for DragonflyBSD
Possible fix for #3179
2022-12-16 15:26:37 +01:00
XMRig
6e86dddc65 Bump the minimum CMake version in other places too. 2022-12-09 16:07:42 +07:00
xmrig
0171faffe7 Merge pull request #3176 from SChernykh/dev
Update cmake required version to 3.1
2022-12-09 15:24:54 +07:00
SChernykh
25decd1b7f Update cmake required version to 3.1
`set(CMAKE_CXX_STANDARD 11)` only works properly starting from cmake 3.1, see #3174
2022-12-09 09:21:40 +01:00
xmrig
354b9ddb34 Merge pull request #3163 from SChernykh/dev
Improved Zen 3 MSR mod
2022-11-18 11:38:45 +07:00
SChernykh
3ad6ab56a5 Improved Zen 3 MSR mod
+0.5% speedup on Ryzen 5 5600X
2022-11-17 23:32:36 +01:00
xmrig
1aa0e37b54 Merge pull request #3161 from SChernykh/dev
MSVC build: enabled parallel compilation
2022-11-15 13:20:41 +06:30
SChernykh
807c64ddb1 MSVC build: enabled parallel compilation 2022-11-15 07:45:54 +01:00
XMRig
5bf90704a6 #2869 2022-10-29 23:51:42 +07:00
xmrig
912d1e362b Merge pull request #3144 from Spudz76/dev-updateSSE2NEON
Update to latest sse2neon.h from github:DLTcollab/sse2neon
2022-10-24 13:50:54 +07:00
Tony Butler
eeb459506c Update to latest sse2neon.h from github:DLTcollab/sse2neon 2022-10-23 15:27:14 -06:00
XMRig
f4ec0287c4 v6.18.2-dev 2022-10-23 23:19:50 +07:00
XMRig
483d6ada3d Merge branch 'master' into dev 2022-10-23 23:19:06 +07:00
benthetechguy
c0bce256e1 Add x86 to README 2022-05-31 21:15:37 -04:00
130 changed files with 12955 additions and 10085 deletions

View File

@@ -1,3 +1,58 @@
# v6.21.1
- [#3391](https://github.com/xmrig/xmrig/pull/3391) Added support for townforge (monero fork using randomx).
- [#3399](https://github.com/xmrig/xmrig/pull/3399) Fixed Zephyr mining (OpenCL).
- [#3420](https://github.com/xmrig/xmrig/pull/3420) Fixed segfault in HTTP API rebind.
# v6.21.0
- [#3302](https://github.com/xmrig/xmrig/pull/3302) [#3312](https://github.com/xmrig/xmrig/pull/3312) Enabled keepalive for Windows (>= Vista).
- [#3320](https://github.com/xmrig/xmrig/pull/3320) Added "built for OS/architecture/bits" to "ABOUT".
- [#3339](https://github.com/xmrig/xmrig/pull/3339) Added SNI option for TLS connections.
- [#3342](https://github.com/xmrig/xmrig/pull/3342) Update `cn_main_loop.asm`.
- [#3346](https://github.com/xmrig/xmrig/pull/3346) ARM64 JIT: don't use `x18` register.
- [#3348](https://github.com/xmrig/xmrig/pull/3348) Update to latest `sse2neon.h`.
- [#3356](https://github.com/xmrig/xmrig/pull/3356) Updated pricing record size for **Zephyr** solo mining.
- [#3358](https://github.com/xmrig/xmrig/pull/3358) **Zephyr** solo mining: handle multiple outputs.
# 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
- [#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.
- [#3240](https://github.com/xmrig/xmrig/pull/3240) Improved .cmd files when run by shortcuts on another drive.
- [#3241](https://github.com/xmrig/xmrig/pull/3241) Added view tag calculation (fixes Wownero solo mining issue).
# v6.19.1
- Resolved deprecated methods warnings with OpenSSL 3.0.
- [#3213](https://github.com/xmrig/xmrig/pull/3213) Fixed build with 32-bit clang 15.
- [#3218](https://github.com/xmrig/xmrig/pull/3218) Fixed: `--randomx-wrmsr=-1` worked only on Intel.
- [#3228](https://github.com/xmrig/xmrig/pull/3228) Fixed build with gcc 13.
# v6.19.0
- [#3144](https://github.com/xmrig/xmrig/pull/3144) Update to latest `sse2neon.h`.
- [#3161](https://github.com/xmrig/xmrig/pull/3161) MSVC build: enabled parallel compilation.
- [#3163](https://github.com/xmrig/xmrig/pull/3163) Improved Zen 3 MSR mod.
- [#3176](https://github.com/xmrig/xmrig/pull/3176) Update cmake required version to 3.1.
- [#3182](https://github.com/xmrig/xmrig/pull/3182) DragonflyBSD compilation fixes.
- [#3196](https://github.com/xmrig/xmrig/pull/3196) Show IP address for failed connections.
- [#3185](https://github.com/xmrig/xmrig/issues/3185) Fixed macOS DMI reader.
- [#3198](https://github.com/xmrig/xmrig/pull/3198) Fixed broken RandomX light mode mining.
- [#3202](https://github.com/xmrig/xmrig/pull/3202) Solo mining: added job timeout (default is 15 seconds).
# v6.18.1
- [#3129](https://github.com/xmrig/xmrig/pull/3129) Fix: protectRX flushed CPU cache only on MacOS/iOS.
- [#3126](https://github.com/xmrig/xmrig/pull/3126) Don't reset when pool sends the same job blob.

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
project(xmrig)
option(WITH_HWLOC "Enable hwloc support" ON)
@@ -34,7 +34,8 @@ option(WITH_SECURE_JIT "Enable secure access to JIT memory" OFF)
option(WITH_DMI "Enable DMI/SMBIOS reader" ON)
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)

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.
## Mining backends
- **CPU** (x64/ARMv7/ARMv8)
- **CPU** (x86/x64/ARMv7/ARMv8)
- **OpenCL** for AMD GPUs.
- **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)
endif()
if (ARM_V8)
set(ARM_TARGET 8)
elseif (ARM_V7)
set(ARM_TARGET 7)
endif()
if (NOT ARM_TARGET)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|armv8-a)$")
set(ARM_TARGET 8)

View File

@@ -10,7 +10,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
endif()
if (CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(/DNDEBUG)
add_definitions(-DNDEBUG)
endif()
include(CheckSymbolExists)
@@ -32,7 +32,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
add_definitions(/DHAVE_ROTR)
add_definitions(-DHAVE_ROTR)
endif()
if (WIN32)
@@ -49,28 +49,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()
add_definitions(/D_GNU_SOURCE)
if (${CMAKE_VERSION} VERSION_LESS "3.1.0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2")
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
add_definitions(-D_GNU_SOURCE -DHAVE_BUILTIN_CLEAR_CACHE)
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_C_FLAGS_RELEASE "/MP /MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_CXX_FLAGS_RELEASE "/MP /MT /O2 /Oi /DNDEBUG /GL")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO")
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
add_definitions(/D_CRT_NONSTDC_NO_WARNINGS)
add_definitions(/DNOMINMAX)
add_definitions(/DHAVE_ROTR)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -DNOMINMAX -DHAVE_ROTR)
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
@@ -92,7 +80,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
check_symbol_exists("_rotr" "x86intrin.h" HAVE_ROTR)
if (HAVE_ROTR)
add_definitions(/DHAVE_ROTR)
add_definitions(-DHAVE_ROTR)
endif()
endif()
@@ -105,6 +93,6 @@ endif()
if (NOT WIN32)
check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE)
if (HAVE_BUILTIN_CLEAR_CACHE)
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
add_definitions(-DHAVE_BUILTIN_CLEAR_CACHE)
endif()
endif()

View File

@@ -15,7 +15,7 @@ else()
set(XMRIG_OS_ANDROID ON)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(XMRIG_OS_LINUX ON)
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL DragonFly)
set(XMRIG_OS_FREEBSD ON)
endif()
endif()

View File

@@ -1,4 +1,4 @@
@echo off
cd %~dp0
cd /d "%~dp0"
xmrig.exe --bench=10M --submit
pause

View File

@@ -1,4 +1,4 @@
@echo off
cd %~dp0
cd /d "%~dp0"
xmrig.exe --bench=1M --submit
pause

View File

@@ -1,8 +1,8 @@
#!/bin/bash -e
HWLOC_VERSION_MAJOR="2"
HWLOC_VERSION_MINOR="7"
HWLOC_VERSION_PATCH="1"
HWLOC_VERSION_MINOR="9"
HWLOC_VERSION_PATCH="0"
HWLOC_VERSION="${HWLOC_VERSION_MAJOR}.${HWLOC_VERSION_MINOR}.${HWLOC_VERSION_PATCH}"

View File

@@ -1,6 +1,6 @@
#!/bin/bash -e
OPENSSL_VERSION="1.1.1o"
OPENSSL_VERSION="1.1.1s"
mkdir -p deps
mkdir -p deps/include

View File

@@ -1,6 +1,6 @@
#!/bin/bash -e
OPENSSL_VERSION="3.0.3"
OPENSSL_VERSION="3.0.7"
mkdir -p deps
mkdir -p deps/include

View File

@@ -1,6 +1,6 @@
#!/bin/bash -e
UV_VERSION="1.44.1"
UV_VERSION="1.44.2"
mkdir -p deps
mkdir -p deps/include

View File

@@ -15,6 +15,6 @@
:: Choose pools outside of top 5 to help Monero network be more decentralized!
:: Smaller pools also often have smaller fees/payout limits.
cd %~dp0
xmrig.exe -o pool.hashvault.pro:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x
cd /d "%~dp0"
xmrig.exe -o xmrpool.eu:3333 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD -p x
pause

View File

@@ -24,8 +24,8 @@ if grep -E 'AMD Ryzen|AMD EPYC' /proc/cpuinfo > /dev/null;
echo "Detected Zen3 CPU"
wrmsr -a 0xc0011020 0x4480000000000
wrmsr -a 0xc0011021 0x1c000200000040
wrmsr -a 0xc0011022 0xc000000401500000
wrmsr -a 0xc001102b 0x2000cc14
wrmsr -a 0xc0011022 0xc000000401570000
wrmsr -a 0xc001102b 0x2000cc10
echo "MSR register values for Zen3 applied"
fi
else

View File

@@ -15,7 +15,7 @@
:: Choose pools outside of top 5 to help Raptoreum network be more decentralized!
:: Smaller pools also often have smaller fees/payout limits.
cd %~dp0
cd /d "%~dp0"
:: Use this command line to connect to non-SSL port
xmrig.exe -a gr -o raptoreumemporium.com:3008 -u WALLET_ADDRESS -p x
:: Or use this command line to connect to an SSL port

View File

@@ -11,6 +11,6 @@
:: Mining solo is the best way to help Monero network be more decentralized!
:: 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 %~dp0
xmrig.exe -o node.xmr.to:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon
cd /d "%~dp0"
xmrig.exe -o YOUR_NODE_IP:18081 -a rx/0 -u 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD --daemon
pause

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
project(argon2 C)
set(CMAKE_C_STANDARD 99)

View File

@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
project (hwloc C)
include_directories(include)

View File

@@ -17,6 +17,50 @@ bug fixes (and other actions) for each version of hwloc since version
0.9.
Version 2.9.0
-------------
* Backends
+ Expose the memory size of CXL memory devices (Type 3) on Linux.
+ The LevelZero backend now reports the "XeLinkBandwidth" distance
matrix between L0 devices (and subdevices) when available.
+ Add support for CUDA compute capability up to 9.0.
* Tools
+ lstopo now switches to console mode when its output is redirected.
Graphical window mode may be forced back with --of window.
+ hwloc-calc now accepts "numa" in -H, and I/O subtypes such as "gpu"
in -I and -N.
Version 2.8.0
-------------
* API
+ Add HWLOC_TOPOLOGY_FLAG_NO_DISTANCES, _NO_MEMATTRS and _NO_CPUKINDS
to reduce the overhead when unneeded.
+ Add separate Read/Write Bandwidth/Latency memory attributes and
implement them on Linux.
* Backends
+ NUMA nodes may now have a subtype such as DRAM, HBM, SPM, or NVM
on heterogeneous memory platforms on Linux.
- Add DAXType and DAXParent attributes on Linux to tell where a
DAX device or its corresponding NUMA node come from (SPM for
Specific-Purpose or NVM for Non-Volatile Memory).
+ Detect heterogeneous caches in hybrid CPUs on MacOS X,
thanks to Paul Bone for the help.
+ Max frequencies are not ignored in Linux cpukinds anymore (they were
ignored in hwloc 2.7.0), but they may be slightly adjusted to avoid
reporting hybrid CPUs because Intel Turbo Boost Max 3.0.
- See the documentation of environment variable HWLOC_CPUKINDS_MAXFREQ.
+ Hardwire the PCI locality of HPE Cray EX235a nodes.
* Tools
+ lstopo and other tools may now load Linux and x86 cpuid topology files
from a tarball.
+ lstopo may now replace the P# and L# index prefixes with custom strings
thanks to --os-index-prefix and --logical-index-prefix options.
* Misc
+ Add --disable-readme to avoid regenerating the top-level hwloc README
file from the documentation.
Version 2.7.1
-------------
* Workaround crashes when virtual machines report incoherent x86 CPUID

View File

@@ -78,7 +78,7 @@ debug and report issues.
Questions may be sent to the users or developers mailing lists (https://
www.open-mpi.org/community/lists/hwloc.php).
There is also a #hwloc IRC channel on Freenode (irc.freenode.net).
There is also a #hwloc IRC channel on Libera Chat (irc.libera.chat).

View File

@@ -8,8 +8,8 @@
# Please update HWLOC_VERSION* in contrib/windows/hwloc_config.h too.
major=2
minor=7
release=1
minor=9
release=0
# greek is used for alpha or beta release tags. If it is non-empty,
# it will be appended to the version number. It does not have to be
@@ -22,7 +22,7 @@ greek=
# The date when this release was created
date="Mar 20, 2022"
date="Dec 14, 2022"
# If snapshot=1, then use the value from snapshot_version as the
# entire hwloc version (i.e., ignore major, minor, release, and
@@ -41,7 +41,7 @@ snapshot_version=${major}.${minor}.${release}${greek}-git
# 2. Version numbers are described in the Libtool current:revision:age
# format.
libhwloc_so_version=20:3:5
libhwloc_so_version=21:1:6
libnetloc_so_version=0:0:0
# Please also update the <TargetName> lines in contrib/windows/libhwloc.vcxproj

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2020 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -93,7 +93,7 @@ extern "C" {
* Two stable releases of the same series usually have the same ::HWLOC_API_VERSION
* even if their HWLOC_VERSION are different.
*/
#define HWLOC_API_VERSION 0x00020500
#define HWLOC_API_VERSION 0x00020800
/** \brief Indicate at runtime which hwloc API version was used at build time.
*
@@ -971,7 +971,7 @@ HWLOC_DECLSPEC const char * hwloc_obj_type_string (hwloc_obj_type_t type) __hwlo
*
* If \p size is 0, \p string may safely be \c NULL.
*
* \return the number of character that were actually written if not truncating,
* \return the number of characters that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
HWLOC_DECLSPEC int hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_t size,
@@ -986,7 +986,7 @@ HWLOC_DECLSPEC int hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_
*
* If \p size is 0, \p string may safely be \c NULL.
*
* \return the number of character that were actually written if not truncating,
* \return the number of characters that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
HWLOC_DECLSPEC int hwloc_obj_attr_snprintf(char * __hwloc_restrict string, size_t size,
@@ -2060,7 +2060,26 @@ enum hwloc_topology_flags_e {
* not change to due thread binding changes on Windows
* (see ::HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING).
*/
HWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING = (1UL<<6)
HWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING = (1UL<<6),
/** \brief Ignore distances.
*
* Ignore distance information from the operating systems (and from XML)
* and hence do not use distances for grouping.
*/
HWLOC_TOPOLOGY_FLAG_NO_DISTANCES = (1UL<<7),
/** \brief Ignore memory attributes.
*
* Ignore memory attribues from the operating systems (and from XML).
*/
HWLOC_TOPOLOGY_FLAG_NO_MEMATTRS = (1UL<<8),
/** \brief Ignore CPU Kinds.
*
* Ignore CPU kind information from the operating systems (and from XML).
*/
HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS = (1UL<<9)
};
/** \brief Set OR'ed flags to non-yet-loaded topology.

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -11,10 +11,10 @@
#ifndef HWLOC_CONFIG_H
#define HWLOC_CONFIG_H
#define HWLOC_VERSION "2.7.1"
#define HWLOC_VERSION "2.9.0"
#define HWLOC_VERSION_MAJOR 2
#define HWLOC_VERSION_MINOR 7
#define HWLOC_VERSION_RELEASE 1
#define HWLOC_VERSION_MINOR 9
#define HWLOC_VERSION_RELEASE 0
#define HWLOC_VERSION_GREEK ""
#define __hwloc_restrict

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -112,7 +112,7 @@ HWLOC_DECLSPEC int hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t sr
*
* If \p buflen is 0, \p buf may safely be \c NULL.
*
* \return the number of character that were actually written if not truncating,
* \return the number of characters that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
HWLOC_DECLSPEC int hwloc_bitmap_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
@@ -137,7 +137,7 @@ HWLOC_DECLSPEC int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char * __hwl
*
* If \p buflen is 0, \p buf may safely be \c NULL.
*
* \return the number of character that were actually written if not truncating,
* \return the number of characters that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
HWLOC_DECLSPEC int hwloc_bitmap_list_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
@@ -161,7 +161,7 @@ HWLOC_DECLSPEC int hwloc_bitmap_list_sscanf(hwloc_bitmap_t bitmap, const char *
*
* If \p buflen is 0, \p buf may safely be \c NULL.
*
* \return the number of character that were actually written if not truncating,
* \return the number of characters that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
HWLOC_DECLSPEC int hwloc_bitmap_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
@@ -357,11 +357,11 @@ HWLOC_DECLSPEC int hwloc_bitmap_last_unset(hwloc_const_bitmap_t bitmap) __hwloc_
* The loop must start with hwloc_bitmap_foreach_begin() and end
* with hwloc_bitmap_foreach_end() followed by a terminating ';'.
*
* \p index is the loop variable; it should be an unsigned int. The
* first iteration will set \p index to the lowest index in the bitmap.
* \p id is the loop variable; it should be an unsigned int. The
* first iteration will set \p id to the lowest index in the bitmap.
* Successive iterations will iterate through, in order, all remaining
* indexes set in the bitmap. To be specific: each iteration will return a
* value for \p index such that hwloc_bitmap_isset(bitmap, index) is true.
* value for \p id such that hwloc_bitmap_isset(bitmap, id) is true.
*
* The assert prevents the loop from being infinite if the bitmap is infinitely set.
*

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -55,7 +55,7 @@ hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj
*
* If \p size is 0, \p string may safely be \c NULL.
*
* \return the number of character that were actually written if not truncating,
* \return the number of characters that were actually written if not truncating,
* or that would have been written (not including the ending \\0).
*/
static __hwloc_inline int

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2010-2021 Inria. All rights reserved.
* Copyright © 2010-2022 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -35,8 +35,8 @@ extern "C" {
* from a core in another node.
* The corresponding kind is ::HWLOC_DISTANCES_KIND_FROM_OS | ::HWLOC_DISTANCES_KIND_FROM_USER.
* The name of this distances structure is "NUMALatency".
* Others distance structures include and "XGMIBandwidth", "XGMIHops"
* and "NVLinkBandwidth".
* Others distance structures include and "XGMIBandwidth", "XGMIHops",
* "XeLinkBandwidth" and "NVLinkBandwidth".
*
* The matrix may also contain bandwidths between random sets of objects,
* possibly provided by the user, as specified in the \p kind attribute.
@@ -160,7 +160,8 @@ hwloc_distances_get_by_type(hwloc_topology_t topology, hwloc_obj_type_t type,
* Usually only one distances structure may match a given name.
*
* The name of the most common structure is "NUMALatency".
* Others include "XGMIBandwidth", "XGMIHops" and "NVLinkBandwidth".
* Others include "XGMIBandwidth", "XGMIHops", "XeLinkBandwidth",
* and "NVLinkBandwidth".
*/
HWLOC_DECLSPEC int
hwloc_distances_get_by_name(hwloc_topology_t topology, const char *name,

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012 Université Bordeaux
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -886,9 +886,6 @@ enum hwloc_distrib_flags_e {
* \p flags should be 0 or a OR'ed set of ::hwloc_distrib_flags_e.
*
* \note This function requires the \p roots objects to have a CPU set.
*
* \note This function replaces the now deprecated hwloc_distribute()
* and hwloc_distributev() functions.
*/
static __hwloc_inline int
hwloc_distrib(hwloc_topology_t topology,

View File

@@ -1,136 +0,0 @@
/*
* Copyright © 2013-2016 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
/** \file
* \brief Macros to help interaction between hwloc and Intel Xeon Phi (MIC).
*
* Applications that use both hwloc and Intel Xeon Phi (MIC) may want to
* include this file so as to get topology information for MIC devices.
*/
#ifndef HWLOC_INTEL_MIC_H
#define HWLOC_INTEL_MIC_H
#include "hwloc.h"
#include "hwloc/autogen/config.h"
#include "hwloc/helper.h"
#ifdef HWLOC_LINUX_SYS
#include "hwloc/linux.h"
#include <dirent.h>
#include <string.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup hwlocality_intel_mic Interoperability with Intel Xeon Phi (MIC)
*
* This interface offers ways to retrieve topology information about
* Intel Xeon Phi (MIC) devices.
*
* @{
*/
/** \brief Get the CPU set of logical processors that are physically
* close to MIC device whose index is \p idx.
*
* Return the CPU set describing the locality of the MIC device whose index is \p idx.
*
* Topology \p topology and device index \p idx must match the local machine.
* I/O devices detection is not needed in the topology.
*
* The function only returns the locality of the device.
* If more information about the device is needed, OS objects should
* be used instead, see hwloc_intel_mic_get_device_osdev_by_index().
*
* This function is currently only implemented in a meaningful way for
* Linux; other systems will simply get a full cpuset.
*/
static __hwloc_inline int
hwloc_intel_mic_get_device_cpuset(hwloc_topology_t topology __hwloc_attribute_unused,
int idx __hwloc_attribute_unused,
hwloc_cpuset_t set)
{
#ifdef HWLOC_LINUX_SYS
/* If we're on Linux, use the sysfs mechanism to get the local cpus */
#define HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX 128
char path[HWLOC_INTEL_MIC_DEVICE_SYSFS_PATH_MAX];
DIR *sysdir = NULL;
struct dirent *dirent;
unsigned pcibus, pcidev, pcifunc;
if (!hwloc_topology_is_thissystem(topology)) {
errno = EINVAL;
return -1;
}
sprintf(path, "/sys/class/mic/mic%d", idx);
sysdir = opendir(path);
if (!sysdir)
return -1;
while ((dirent = readdir(sysdir)) != NULL) {
if (sscanf(dirent->d_name, "pci_%02x:%02x.%02x", &pcibus, &pcidev, &pcifunc) == 3) {
sprintf(path, "/sys/class/mic/mic%d/pci_%02x:%02x.%02x/local_cpus", idx, pcibus, pcidev, pcifunc);
if (hwloc_linux_read_path_as_cpumask(path, set) < 0
|| hwloc_bitmap_iszero(set))
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
break;
}
}
closedir(sysdir);
#else
/* Non-Linux systems simply get a full cpuset */
hwloc_bitmap_copy(set, hwloc_topology_get_complete_cpuset(topology));
#endif
return 0;
}
/** \brief Get the hwloc OS device object corresponding to the
* MIC device for the given index.
*
* Return the OS device object describing the MIC device whose index is \p idx.
* Return NULL if there is none.
*
* The topology \p topology does not necessarily have to match the current
* machine. For instance the topology may be an XML import of a remote host.
* I/O devices detection must be enabled in the topology.
*
* \note The corresponding PCI device object can be obtained by looking
* at the OS device parent object.
*/
static __hwloc_inline hwloc_obj_t
hwloc_intel_mic_get_device_osdev_by_index(hwloc_topology_t topology,
unsigned idx)
{
hwloc_obj_t osdev = NULL;
while ((osdev = hwloc_get_next_osdev(topology, osdev)) != NULL) {
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type
&& osdev->name
&& !strncmp("mic", osdev->name, 3)
&& atoi(osdev->name + 3) == (int) idx)
return osdev;
}
return NULL;
}
/** @} */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* HWLOC_INTEL_MIC_H */

View File

@@ -54,6 +54,8 @@ extern "C" {
* Attribute values for these nodes, if any, may then be obtained with
* hwloc_memattr_get_value() and manually compared with the desired criteria.
*
* \sa An example is available in doc/examples/memory-attributes.c in the source tree.
*
* \note The API also supports specific objects as initiator,
* but it is currently not used internally by hwloc.
* Users may for instance use it to provide custom performance
@@ -65,19 +67,19 @@ extern "C" {
/** \brief Memory node attributes. */
enum hwloc_memattr_id_e {
/** \brief "Capacity".
* The capacity is returned in bytes
* (local_memory attribute in objects).
/** \brief
* The \"Capacity\" is returned in bytes (local_memory attribute in objects).
*
* Best capacity nodes are nodes with <b>higher capacity</b>.
*
* No initiator is involved when looking at this attribute.
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_HIGHER_FIRST.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_CAPACITY = 0,
/** \brief "Locality".
* The locality is returned as the number of PUs in that locality
/** \brief
* The \"Locality\" is returned as the number of PUs in that locality
* (e.g. the weight of its cpuset).
*
* Best locality nodes are nodes with <b>smaller locality</b>
@@ -87,26 +89,87 @@ enum hwloc_memattr_id_e {
*
* No initiator is involved when looking at this attribute.
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_HIGHER_FIRST.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_LOCALITY = 1,
/** \brief "Bandwidth".
* The bandwidth is returned in MiB/s, as seen from the given initiator location.
/** \brief
* The \"Bandwidth\" is returned in MiB/s, as seen from the given initiator location.
*
* Best bandwidth nodes are nodes with <b>higher bandwidth</b>.
*
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_HIGHER_FIRST
* and ::HWLOC_MEMATTR_FLAG_NEED_INITIATOR.
*
* This is the average bandwidth for read and write accesses. If the platform
* provides individual read and write bandwidths but no explicit average value,
* hwloc computes and returns the average.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_BANDWIDTH = 2,
/** \brief "Latency".
* The latency is returned as nanoseconds, as seen from the given initiator location.
/** \brief
* The \"ReadBandwidth\" is returned in MiB/s, as seen from the given initiator location.
*
* Best bandwidth nodes are nodes with <b>higher bandwidth</b>.
*
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_HIGHER_FIRST
* and ::HWLOC_MEMATTR_FLAG_NEED_INITIATOR.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_READ_BANDWIDTH = 4,
/** \brief
* The \"WriteBandwidth\" is returned in MiB/s, as seen from the given initiator location.
*
* Best bandwidth nodes are nodes with <b>higher bandwidth</b>.
*
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_HIGHER_FIRST
* and ::HWLOC_MEMATTR_FLAG_NEED_INITIATOR.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_WRITE_BANDWIDTH = 5,
/** \brief
* The \"Latency\" is returned as nanoseconds, as seen from the given initiator location.
*
* Best latency nodes are nodes with <b>smaller latency</b>.
*
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_LOWER_FIRST
* and ::HWLOC_MEMATTR_FLAG_NEED_INITIATOR.
*
* This is the average latency for read and write accesses. If the platform
* provides individual read and write latencies but no explicit average value,
* hwloc computes and returns the average.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_LATENCY = 3
HWLOC_MEMATTR_ID_LATENCY = 3,
/* TODO read vs write, persistence? */
/** \brief
* The \"ReadLatency\" is returned as nanoseconds, as seen from the given initiator location.
*
* Best latency nodes are nodes with <b>smaller latency</b>.
*
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_LOWER_FIRST
* and ::HWLOC_MEMATTR_FLAG_NEED_INITIATOR.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_READ_LATENCY = 6,
/** \brief
* The \"WriteLatency\" is returned as nanoseconds, as seen from the given initiator location.
*
* Best latency nodes are nodes with <b>smaller latency</b>.
*
* The corresponding attribute flags are ::HWLOC_MEMATTR_FLAG_LOWER_FIRST
* and ::HWLOC_MEMATTR_FLAG_NEED_INITIATOR.
* \hideinitializer
*/
HWLOC_MEMATTR_ID_WRITE_LATENCY = 7,
/* TODO persistence? */
HWLOC_MEMATTR_ID_MAX /**< \private Sentinel value */
};
/** \brief A memory attribute identifier.

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2021 Inria. All rights reserved.
* Copyright © 2013-2022 Inria. All rights reserved.
* Copyright © 2016 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -338,9 +338,15 @@ struct hwloc_component {
* This function return 1 by default (show critical only),
* 0 in lstopo (show all),
* or anything set in HWLOC_HIDE_ERRORS in the environment.
*
* Use macros HWLOC_SHOW_CRITICAL_ERRORS() and HWLOC_SHOW_ALL_ERRORS()
* for clarity.
*/
HWLOC_DECLSPEC int hwloc_hide_errors(void);
#define HWLOC_SHOW_CRITICAL_ERRORS() (hwloc_hide_errors() < 2)
#define HWLOC_SHOW_ALL_ERRORS() (hwloc_hide_errors() == 0)
/** \brief Add an object to the topology.
*
* Insert new object \p obj in the topology starting under existing object \p root
@@ -501,6 +507,7 @@ hwloc_filter_check_pcidev_subtype_important(unsigned classid)
|| baseclass == 0x0b /* PCI_BASE_CLASS_PROCESSOR */
|| classid == 0x0c04 /* PCI_CLASS_SERIAL_FIBER */
|| classid == 0x0c06 /* PCI_CLASS_SERIAL_INFINIBAND */
|| classid == 0x0502 /* PCI_CLASS_MEMORY_CXL */
|| baseclass == 0x06 /* PCI_BASE_CLASS_BRIDGE with non-PCI downstream. the core will drop the useless ones later */
|| baseclass == 0x12 /* Processing Accelerators */);
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2010-2021 Inria. All rights reserved.
* Copyright © 2010-2022 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -123,6 +123,9 @@ extern "C" {
#define HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING HWLOC_NAME_CAPS(TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING)
#define HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING HWLOC_NAME_CAPS(TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING)
#define HWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING HWLOC_NAME_CAPS(TOPOLOGY_FLAG_DONT_CHANGE_BINDING)
#define HWLOC_TOPOLOGY_FLAG_NO_DISTANCES HWLOC_NAME_CAPS(TOPOLOGY_FLAG_NO_DISTANCES)
#define HWLOC_TOPOLOGY_FLAG_NO_MEMATTRS HWLOC_NAME_CAPS(TOPOLOGY_FLAG_NO_MEMATTRS)
#define HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS HWLOC_NAME_CAPS(TOPOLOGY_FLAG_NO_CPUKINDS)
#define hwloc_topology_set_pid HWLOC_NAME(topology_set_pid)
#define hwloc_topology_set_synthetic HWLOC_NAME(topology_set_synthetic)
@@ -381,6 +384,11 @@ extern "C" {
#define HWLOC_MEMATTR_ID_LOCALITY HWLOC_NAME_CAPS(MEMATTR_ID_LOCALITY)
#define HWLOC_MEMATTR_ID_BANDWIDTH HWLOC_NAME_CAPS(MEMATTR_ID_BANDWIDTH)
#define HWLOC_MEMATTR_ID_LATENCY HWLOC_NAME_CAPS(MEMATTR_ID_LATENCY)
#define HWLOC_MEMATTR_ID_READ_BANDWIDTH HWLOC_NAME_CAPS(MEMATTR_ID_READ_BANDWIDTH)
#define HWLOC_MEMATTR_ID_WRITE_BANDWIDTH HWLOC_NAME_CAPS(MEMATTR_ID_WRITE_BANDWIDTH)
#define HWLOC_MEMATTR_ID_READ_LATENCY HWLOC_NAME_CAPS(MEMATTR_ID_READ_LATENCY)
#define HWLOC_MEMATTR_ID_WRITE_LATENCY HWLOC_NAME_CAPS(MEMATTR_ID_WRITE_LATENCY)
#define HWLOC_MEMATTR_ID_MAX HWLOC_NAME_CAPS(MEMATTR_ID_MAX)
#define hwloc_memattr_id_t HWLOC_NAME(memattr_id_t)
#define hwloc_memattr_get_by_name HWLOC_NAME(memattr_get_by_name)
@@ -862,6 +870,7 @@ extern "C" {
#define hwloc_internal_memattrs_destroy HWLOC_NAME(internal_memattrs_destroy)
#define hwloc_internal_memattrs_need_refresh HWLOC_NAME(internal_memattrs_need_refresh)
#define hwloc_internal_memattrs_refresh HWLOC_NAME(internal_memattrs_refresh)
#define hwloc_internal_memattrs_guess_memory_tiers HWLOC_NAME(internal_memattrs_guess_memory_tiers)
#define hwloc_internal_cpukind_s HWLOC_NAME(internal_cpukind_s)
#define hwloc_internal_cpukinds_init HWLOC_NAME(internal_cpukinds_init)

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
*
@@ -259,6 +259,7 @@ struct hwloc_topology {
unsigned bus_first, bus_last;
hwloc_bitmap_t cpuset;
} * pci_forced_locality;
hwloc_uint64_t pci_locality_quirks;
/* component blacklisting */
unsigned nr_blacklisted_components;
@@ -419,6 +420,7 @@ extern void hwloc_internal_memattrs_need_refresh(hwloc_topology_t topology);
extern void hwloc_internal_memattrs_refresh(hwloc_topology_t topology);
extern int hwloc_internal_memattrs_dup(hwloc_topology_t new, hwloc_topology_t old);
extern int hwloc_internal_memattr_set_value(hwloc_topology_t topology, hwloc_memattr_id_t id, hwloc_obj_type_t target_type, hwloc_uint64_t target_gp_index, unsigned target_os_index, struct hwloc_internal_location_s *initiator, hwloc_uint64_t value);
extern int hwloc_internal_memattrs_guess_memory_tiers(hwloc_topology_t topology);
extern void hwloc_internal_cpukinds_init(hwloc_topology_t topology);
extern int hwloc_internal_cpukinds_rank(hwloc_topology_t topology);

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 Université Bordeaux
* Copyright © 2020 Inria. All rights reserved.
* Copyright © 2020-2022 Inria. All rights reserved.
*
* See COPYING in top-level directory.
*/
@@ -8,13 +8,22 @@
#ifndef HWLOC_PRIVATE_WINDOWS_H
#define HWLOC_PRIVATE_WINDOWS_H
#ifndef _ANONYMOUS_UNION
#ifdef __GNUC__
#define _ANONYMOUS_UNION __extension__
#define _ANONYMOUS_STRUCT __extension__
#else
#define _ANONYMOUS_UNION
#endif /* __GNUC__ */
#endif /* _ANONYMOUS_UNION */
#ifndef _ANONYMOUS_STRUCT
#ifdef __GNUC__
#define _ANONYMOUS_STRUCT __extension__
#else
#define _ANONYMOUS_STRUCT
#endif /* __GNUC__ */
#endif /* _ANONYMOUS_STRUCT */
#define DUMMYUNIONNAME
#define DUMMYSTRUCTNAME

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2012 Université Bordeaux
* See COPYING in top-level directory.
*/
@@ -386,7 +386,7 @@ hwloc_disc_component_register(struct hwloc_disc_component *component,
|HWLOC_DISC_PHASE_MISC
|HWLOC_DISC_PHASE_ANNOTATE
|HWLOC_DISC_PHASE_TWEAK))) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Cannot register discovery component `%s' with invalid phases 0x%x\n",
component->name, component->phases);
return -1;
@@ -476,7 +476,7 @@ hwloc_components_init(void)
/* hwloc_static_components is created by configure in static-components.h */
for(i=0; NULL != hwloc_static_components[i]; i++) {
if (hwloc_static_components[i]->flags) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Ignoring static component with invalid flags %lx\n",
hwloc_static_components[i]->flags);
continue;
@@ -505,7 +505,7 @@ hwloc_components_init(void)
#ifdef HWLOC_HAVE_PLUGINS
for(desc = hwloc_plugins; NULL != desc; desc = desc->next) {
if (desc->component->flags) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Ignoring plugin `%s' component with invalid flags %lx\n",
desc->name, desc->component->flags);
continue;
@@ -738,7 +738,7 @@ hwloc_disc_component_try_enable(struct hwloc_topology *topology,
backend = comp->instantiate(topology, comp, topology->backend_excluded_phases | blacklisted_phases,
NULL, NULL, NULL);
if (!backend) {
if (hwloc_components_verbose || (envvar_forced && hwloc_hide_errors() < 2))
if (hwloc_components_verbose || (envvar_forced && HWLOC_SHOW_CRITICAL_ERRORS()))
fprintf(stderr, "hwloc: Failed to instantiate discovery component `%s'\n", comp->name);
return -1;
}
@@ -835,7 +835,7 @@ hwloc_disc_components_enable_others(struct hwloc_topology *topology)
if (comp->phases & ~blacklisted_phases)
hwloc_disc_component_try_enable(topology, comp, 1 /* envvar forced */, blacklisted_phases);
} else {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Cannot find discovery component `%s'\n", name);
}
@@ -967,7 +967,7 @@ hwloc_backend_enable(struct hwloc_backend *backend)
/* check backend flags */
if (backend->flags) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Cannot enable discovery component `%s' phases 0x%x with unknown flags %lx\n",
backend->component->name, backend->component->phases, backend->flags);
return -1;

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2020-2021 Inria. All rights reserved.
* Copyright © 2020-2022 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -504,7 +504,7 @@ hwloc_internal_cpukinds_rank(struct hwloc_topology *topology)
heuristics = HWLOC_CPUKINDS_RANKING_FORCED_EFFICIENCY;
else if (!strcmp(env, "no_forced_efficiency"))
heuristics = HWLOC_CPUKINDS_RANKING_NO_FORCED_EFFICIENCY;
else if (hwloc_hide_errors() < 2)
else if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Failed to recognize HWLOC_CPUKINDS_RANKING value %s\n", env);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020 Inria. All rights reserved.
* Copyright © 2013-2022 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -218,7 +218,7 @@ hwloc_diff_trees(hwloc_topology_t topo1, hwloc_obj_t obj1,
struct hwloc_info_s *info1 = &obj1->infos[i], *info2 = &obj2->infos[i];
if (strcmp(info1->name, info2->name))
goto out_too_complex;
if (strcmp(obj1->infos[i].value, obj2->infos[i].value)) {
if (strcmp(info1->value, info2->value)) {
err = hwloc_append_diff_obj_attr_string(obj1,
HWLOC_TOPOLOGY_DIFF_OBJ_ATTR_INFO,
info1->name,

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2010-2021 Inria. All rights reserved.
* Copyright © 2010-2022 Inria. All rights reserved.
* Copyright © 2011-2012 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -860,7 +860,7 @@ struct hwloc_distances_container_s {
struct hwloc_distances_s distances;
};
#define HWLOC_DISTANCES_CONTAINER_OFFSET ((char*)&((struct hwloc_distances_container_s*)NULL)->distances - (char*)NULL)
#define HWLOC_DISTANCES_CONTAINER_OFFSET ((uintptr_t)(&((struct hwloc_distances_container_s*)NULL)->distances) - (uintptr_t)NULL)
#define HWLOC_DISTANCES_CONTAINER(_d) (struct hwloc_distances_container_s *) ( ((char*)_d) - HWLOC_DISTANCES_CONTAINER_OFFSET )
static struct hwloc_internal_distances_s *

View File

@@ -1,11 +1,12 @@
/*
* Copyright © 2020-2021 Inria. All rights reserved.
* Copyright © 2020-2022 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
#include "private/autogen/config.h"
#include "hwloc.h"
#include "private/private.h"
#include "private/debug.h"
/*****************************
@@ -49,36 +50,51 @@ hwloc__setup_memattr(struct hwloc_internal_memattr_s *imattr,
void
hwloc_internal_memattrs_prepare(struct hwloc_topology *topology)
{
#define NR_DEFAULT_MEMATTRS 4
topology->memattrs = malloc(NR_DEFAULT_MEMATTRS * sizeof(*topology->memattrs));
topology->memattrs = malloc(HWLOC_MEMATTR_ID_MAX * sizeof(*topology->memattrs));
if (!topology->memattrs)
return;
assert(HWLOC_MEMATTR_ID_CAPACITY < NR_DEFAULT_MEMATTRS);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_CAPACITY],
(char *) "Capacity",
HWLOC_MEMATTR_FLAG_HIGHER_FIRST,
HWLOC_IMATTR_FLAG_STATIC_NAME|HWLOC_IMATTR_FLAG_CONVENIENCE);
assert(HWLOC_MEMATTR_ID_LOCALITY < NR_DEFAULT_MEMATTRS);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_LOCALITY],
(char *) "Locality",
HWLOC_MEMATTR_FLAG_LOWER_FIRST,
HWLOC_IMATTR_FLAG_STATIC_NAME|HWLOC_IMATTR_FLAG_CONVENIENCE);
assert(HWLOC_MEMATTR_ID_BANDWIDTH < NR_DEFAULT_MEMATTRS);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_BANDWIDTH],
(char *) "Bandwidth",
HWLOC_MEMATTR_FLAG_HIGHER_FIRST|HWLOC_MEMATTR_FLAG_NEED_INITIATOR,
HWLOC_IMATTR_FLAG_STATIC_NAME);
assert(HWLOC_MEMATTR_ID_LATENCY < NR_DEFAULT_MEMATTRS);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_READ_BANDWIDTH],
(char *) "ReadBandwidth",
HWLOC_MEMATTR_FLAG_HIGHER_FIRST|HWLOC_MEMATTR_FLAG_NEED_INITIATOR,
HWLOC_IMATTR_FLAG_STATIC_NAME);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_WRITE_BANDWIDTH],
(char *) "WriteBandwidth",
HWLOC_MEMATTR_FLAG_HIGHER_FIRST|HWLOC_MEMATTR_FLAG_NEED_INITIATOR,
HWLOC_IMATTR_FLAG_STATIC_NAME);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_LATENCY],
(char *) "Latency",
HWLOC_MEMATTR_FLAG_LOWER_FIRST|HWLOC_MEMATTR_FLAG_NEED_INITIATOR,
HWLOC_IMATTR_FLAG_STATIC_NAME);
topology->nr_memattrs = NR_DEFAULT_MEMATTRS;
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_READ_LATENCY],
(char *) "ReadLatency",
HWLOC_MEMATTR_FLAG_LOWER_FIRST|HWLOC_MEMATTR_FLAG_NEED_INITIATOR,
HWLOC_IMATTR_FLAG_STATIC_NAME);
hwloc__setup_memattr(&topology->memattrs[HWLOC_MEMATTR_ID_WRITE_LATENCY],
(char *) "WriteLatency",
HWLOC_MEMATTR_FLAG_LOWER_FIRST|HWLOC_MEMATTR_FLAG_NEED_INITIATOR,
HWLOC_IMATTR_FLAG_STATIC_NAME);
topology->nr_memattrs = HWLOC_MEMATTR_ID_MAX;
}
static void
@@ -1197,3 +1213,214 @@ hwloc_get_local_numanode_objs(hwloc_topology_t topology,
*nrp = i;
return 0;
}
/**************************************
* Using memattrs to identify HBM/DRAM
*/
struct hwloc_memory_tier_s {
hwloc_obj_t node;
uint64_t local_bw;
enum hwloc_memory_tier_type_e {
/* warning the order is important for guess_memory_tiers() after qsort() */
HWLOC_MEMORY_TIER_UNKNOWN,
HWLOC_MEMORY_TIER_DRAM,
HWLOC_MEMORY_TIER_HBM,
HWLOC_MEMORY_TIER_SPM, /* Specific-Purpose Memory is usually HBM, we'll use BW to confirm */
HWLOC_MEMORY_TIER_NVM,
HWLOC_MEMORY_TIER_GPU,
} type;
};
static int compare_tiers(const void *_a, const void *_b)
{
const struct hwloc_memory_tier_s *a = _a, *b = _b;
/* sort by type of tier first */
if (a->type != b->type)
return a->type - b->type;
/* then by bandwidth */
if (a->local_bw > b->local_bw)
return -1;
else if (a->local_bw < b->local_bw)
return 1;
return 0;
}
int
hwloc_internal_memattrs_guess_memory_tiers(hwloc_topology_t topology)
{
struct hwloc_internal_memattr_s *imattr;
struct hwloc_memory_tier_s *tiers;
unsigned i, j, n;
const char *env;
int spm_is_hbm = -1; /* -1 will guess from BW, 0 no, 1 forced */
int mark_dram = 1;
unsigned first_spm, first_nvm;
hwloc_uint64_t max_unknown_bw, min_spm_bw;
env = getenv("HWLOC_MEMTIERS_GUESS");
if (env) {
if (!strcmp(env, "none")) {
return 0;
} else if (!strcmp(env, "default")) {
/* nothing */
} else if (!strcmp(env, "spm_is_hbm")) {
hwloc_debug("Assuming SPM-tier is HBM, ignore bandwidth\n");
spm_is_hbm = 1;
} else if (HWLOC_SHOW_CRITICAL_ERRORS()) {
fprintf(stderr, "hwloc: Failed to recognize HWLOC_MEMTIERS_GUESS value %s\n", env);
}
}
imattr = &topology->memattrs[HWLOC_MEMATTR_ID_BANDWIDTH];
if (!(imattr->iflags & HWLOC_IMATTR_FLAG_CACHE_VALID))
hwloc__imattr_refresh(topology, imattr);
n = hwloc_get_nbobjs_by_depth(topology, HWLOC_TYPE_DEPTH_NUMANODE);
assert(n);
tiers = malloc(n * sizeof(*tiers));
if (!tiers)
return -1;
for(i=0; i<n; i++) {
hwloc_obj_t node;
const char *daxtype;
struct hwloc_internal_location_s iloc;
struct hwloc_internal_memattr_target_s *imtg = NULL;
struct hwloc_internal_memattr_initiator_s *imi;
node = hwloc_get_obj_by_depth(topology, HWLOC_TYPE_DEPTH_NUMANODE, i);
assert(node);
tiers[i].node = node;
/* defaults */
tiers[i].type = HWLOC_MEMORY_TIER_UNKNOWN;
tiers[i].local_bw = 0; /* unknown */
daxtype = hwloc_obj_get_info_by_name(node, "DAXType");
/* mark NVM, SPM and GPU nodes */
if (daxtype && !strcmp(daxtype, "NVM"))
tiers[i].type = HWLOC_MEMORY_TIER_NVM;
if (daxtype && !strcmp(daxtype, "SPM"))
tiers[i].type = HWLOC_MEMORY_TIER_SPM;
if (node->subtype && !strcmp(node->subtype, "GPUMemory"))
tiers[i].type = HWLOC_MEMORY_TIER_GPU;
if (spm_is_hbm == -1) {
for(j=0; j<imattr->nr_targets; j++)
if (imattr->targets[j].obj == node) {
imtg = &imattr->targets[j];
break;
}
if (imtg && !hwloc_bitmap_iszero(node->cpuset)) {
iloc.type = HWLOC_LOCATION_TYPE_CPUSET;
iloc.location.cpuset = node->cpuset;
imi = hwloc__memattr_target_get_initiator(imtg, &iloc, 0);
if (imi)
tiers[i].local_bw = imi->value;
}
}
}
/* sort tiers */
qsort(tiers, n, sizeof(*tiers), compare_tiers);
hwloc_debug("Sorting memory tiers...\n");
for(i=0; i<n; i++)
hwloc_debug(" tier %u = node L#%u P#%u with tier type %d and local BW #%llu\n",
i,
tiers[i].node->logical_index, tiers[i].node->os_index,
tiers[i].type, (unsigned long long) tiers[i].local_bw);
/* now we have UNKNOWN tiers (sorted by BW), then SPM tiers (sorted by BW), then NVM, then GPU */
/* iterate over UNKNOWN tiers, and find their BW */
for(i=0; i<n; i++) {
if (tiers[i].type > HWLOC_MEMORY_TIER_UNKNOWN)
break;
}
first_spm = i;
/* get max BW from first */
if (first_spm > 0)
max_unknown_bw = tiers[0].local_bw;
else
max_unknown_bw = 0;
/* there are no DRAM or HBM tiers yet */
/* iterate over SPM tiers, and find their BW */
for(i=first_spm; i<n; i++) {
if (tiers[i].type > HWLOC_MEMORY_TIER_SPM)
break;
}
first_nvm = i;
/* get min BW from last */
if (first_nvm > first_spm)
min_spm_bw = tiers[first_nvm-1].local_bw;
else
min_spm_bw = 0;
/* FIXME: if there's more than 10% between some sets of nodes inside a tier, split it? */
/* FIXME: if there are cpuset-intersecting nodes in same tier, abort? */
if (spm_is_hbm == -1) {
/* if we have BW for all SPM and UNKNOWN
* and all SPM BW are 2x superior to all UNKNOWN BW
*/
hwloc_debug("UNKNOWN-memory-tier max bandwidth %llu\n", (unsigned long long) max_unknown_bw);
hwloc_debug("SPM-memory-tier min bandwidth %llu\n", (unsigned long long) min_spm_bw);
if (max_unknown_bw > 0 && min_spm_bw > 0 && max_unknown_bw*2 < min_spm_bw) {
hwloc_debug("assuming SPM means HBM and !SPM means DRAM since bandwidths are very different\n");
spm_is_hbm = 1;
} else {
hwloc_debug("cannot assume SPM means HBM\n");
spm_is_hbm = 0;
}
}
if (spm_is_hbm) {
for(i=0; i<first_spm; i++)
tiers[i].type = HWLOC_MEMORY_TIER_DRAM;
for(i=first_spm; i<first_nvm; i++)
tiers[i].type = HWLOC_MEMORY_TIER_HBM;
}
if (first_spm == n)
mark_dram = 0;
/* now apply subtypes */
for(i=0; i<n; i++) {
const char *type = NULL;
if (tiers[i].node->subtype) /* don't overwrite the existing subtype */
continue;
switch (tiers[i].type) {
case HWLOC_MEMORY_TIER_DRAM:
if (mark_dram)
type = "DRAM";
break;
case HWLOC_MEMORY_TIER_HBM:
type = "HBM";
break;
case HWLOC_MEMORY_TIER_SPM:
type = "SPM";
break;
case HWLOC_MEMORY_TIER_NVM:
type = "NVM";
break;
default:
/* GPU memory is already marked with subtype="GPUMemory",
* UNKNOWN doesn't deserve any subtype
*/
break;
}
if (type) {
hwloc_debug("Marking node L#%u P#%u as %s\n", tiers[i].node->logical_index, tiers[i].node->os_index, type);
tiers[i].node->subtype = strdup(type);
}
}
free(tiers);
return 0;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* See COPYING in top-level directory.
*/
@@ -119,6 +119,13 @@ hwloc_pci_discovery_init(struct hwloc_topology *topology)
topology->pci_forced_locality = NULL;
topology->first_pci_locality = topology->last_pci_locality = NULL;
#define HWLOC_PCI_LOCALITY_QUIRK_CRAY_EX235A (1ULL<<0)
#define HWLOC_PCI_LOCALITY_QUIRK_FAKE (1ULL<<62)
topology->pci_locality_quirks = (uint64_t) -1;
/* -1 is unknown, 0 is disabled, >0 is bitmask of enabled quirks.
* bit 63 should remain unused so that -1 is unaccessible as a bitmask.
*/
}
void
@@ -146,7 +153,7 @@ hwloc_pci_discovery_prepare(struct hwloc_topology *topology)
}
free(buffer);
} else {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc/pci: Ignoring HWLOC_PCI_LOCALITY file `%s' too large (%lu bytes)\n",
env, (unsigned long) st.st_size);
}
@@ -333,7 +340,7 @@ hwloc_pci_add_object(struct hwloc_obj *parent, struct hwloc_obj **parent_io_firs
}
case HWLOC_PCI_BUSID_EQUAL: {
static int reported = 0;
if (!reported && hwloc_hide_errors() < 2) {
if (!reported && HWLOC_SHOW_CRITICAL_ERRORS()) {
fprintf(stderr, "*********************************************************\n");
fprintf(stderr, "* hwloc %s received invalid PCI information.\n", HWLOC_VERSION);
fprintf(stderr, "*\n");
@@ -442,13 +449,90 @@ hwloc_pcidisc_add_hostbridges(struct hwloc_topology *topology,
return new;
}
static struct hwloc_obj *
hwloc_pci_fixup_busid_parent(struct hwloc_topology *topology __hwloc_attribute_unused,
struct hwloc_pcidev_attr_s *busid __hwloc_attribute_unused,
struct hwloc_obj *parent __hwloc_attribute_unused)
/* return 1 if a quirk was applied */
static int
hwloc__pci_find_busid_parent_quirk(struct hwloc_topology *topology,
struct hwloc_pcidev_attr_s *busid,
hwloc_cpuset_t cpuset)
{
/* no quirk for now */
return parent;
if (topology->pci_locality_quirks == (uint64_t)-1 /* unknown */) {
const char *dmi_board_name, *env;
/* first invokation, detect which quirks are needed */
topology->pci_locality_quirks = 0; /* no quirk yet */
dmi_board_name = hwloc_obj_get_info_by_name(hwloc_get_root_obj(topology), "DMIBoardName");
if (dmi_board_name && !strcmp(dmi_board_name, "HPE CRAY EX235A")) {
hwloc_debug("enabling for PCI locality quirk for HPE Cray EX235A\n");
topology->pci_locality_quirks |= HWLOC_PCI_LOCALITY_QUIRK_CRAY_EX235A;
}
env = getenv("HWLOC_PCI_LOCALITY_QUIRK_FAKE");
if (env && atoi(env)) {
hwloc_debug("enabling for PCI locality fake quirk (attaching everything to last PU)\n");
topology->pci_locality_quirks |= HWLOC_PCI_LOCALITY_QUIRK_FAKE;
}
}
if (topology->pci_locality_quirks & HWLOC_PCI_LOCALITY_QUIRK_FAKE) {
unsigned last = hwloc_bitmap_last(hwloc_topology_get_topology_cpuset(topology));
hwloc_bitmap_set(cpuset, last);
return 1;
}
if (topology->pci_locality_quirks & HWLOC_PCI_LOCALITY_QUIRK_CRAY_EX235A) {
/* AMD Trento has xGMI ports connected to individual CCDs (8 cores + L3)
* instead of NUMA nodes (pairs of CCDs within Trento) as is usual in AMD EPYC CPUs.
* This is not described by the ACPI tables, hence we need to manually hardwire
* the xGMI locality for the (currently single) server that currently uses that CPU.
* It's not clear if ACPI tables can/will ever be fixed (would require one initiator
* proximity domain per CCD), or if Linux can/will work around the issue.
*/
if (busid->domain == 0) {
if (busid->bus >= 0xd0 && busid->bus <= 0xd1) {
hwloc_bitmap_set_range(cpuset, 0, 7);
hwloc_bitmap_set_range(cpuset, 64, 71);
return 1;
}
if (busid->bus >= 0xd4 && busid->bus <= 0xd6) {
hwloc_bitmap_set_range(cpuset, 8, 15);
hwloc_bitmap_set_range(cpuset, 72, 79);
return 1;
}
if (busid->bus >= 0xc8 && busid->bus <= 0xc9) {
hwloc_bitmap_set_range(cpuset, 16, 23);
hwloc_bitmap_set_range(cpuset, 80, 87);
return 1;
}
if (busid->bus >= 0xcc && busid->bus <= 0xce) {
hwloc_bitmap_set_range(cpuset, 24, 31);
hwloc_bitmap_set_range(cpuset, 88, 95);
return 1;
}
if (busid->bus >= 0xd8 && busid->bus <= 0xd9) {
hwloc_bitmap_set_range(cpuset, 32, 39);
hwloc_bitmap_set_range(cpuset, 96, 103);
return 1;
}
if (busid->bus >= 0xdc && busid->bus <= 0xde) {
hwloc_bitmap_set_range(cpuset, 40, 47);
hwloc_bitmap_set_range(cpuset, 104, 111);
return 1;
}
if (busid->bus >= 0xc0 && busid->bus <= 0xc1) {
hwloc_bitmap_set_range(cpuset, 48, 55);
hwloc_bitmap_set_range(cpuset, 112, 119);
return 1;
}
if (busid->bus >= 0xc4 && busid->bus <= 0xc6) {
hwloc_bitmap_set_range(cpuset, 56, 63);
hwloc_bitmap_set_range(cpuset, 120, 127);
return 1;
}
}
}
return 0;
}
static struct hwloc_obj *
@@ -457,7 +541,7 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
hwloc_bitmap_t cpuset = hwloc_bitmap_alloc();
hwloc_obj_t parent;
int forced = 0;
int noquirks = 0;
int noquirks = 0, got_quirked = 0;
unsigned i;
int err;
@@ -490,7 +574,7 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
if (env) {
static int reported = 0;
if (!topology->pci_has_forced_locality && !reported) {
if (!hwloc_hide_errors())
if (HWLOC_SHOW_ALL_ERRORS())
fprintf(stderr, "hwloc/pci: Environment variable %s is deprecated, please use HWLOC_PCI_LOCALITY instead.\n", env);
reported = 1;
}
@@ -505,7 +589,13 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
}
}
if (!forced) {
if (!forced && !noquirks && topology->pci_locality_quirks /* either quirks are unknown yet, or some are enabled */) {
err = hwloc__pci_find_busid_parent_quirk(topology, busid, cpuset);
if (err > 0)
got_quirked = 1;
}
if (!forced && !got_quirked) {
/* get the cpuset by asking the backend that provides the relevant hook, if any. */
struct hwloc_backend *backend = topology->get_pci_busid_cpuset_backend;
if (backend)
@@ -520,11 +610,7 @@ hwloc__pci_find_busid_parent(struct hwloc_topology *topology, struct hwloc_pcide
hwloc_debug_bitmap(" will attach PCI bus to cpuset %s\n", cpuset);
parent = hwloc_find_insert_io_parent_by_complete_cpuset(topology, cpuset);
if (parent) {
if (!noquirks)
/* We found a valid parent. Check that the OS didn't report invalid locality */
parent = hwloc_pci_fixup_busid_parent(topology, busid, parent);
} else {
if (!parent) {
/* Fallback to root */
parent = hwloc_get_root_obj(topology);
}
@@ -805,19 +891,28 @@ hwloc_pcidisc_find_linkspeed(const unsigned char *config,
memcpy(&linksta, &config[offset + HWLOC_PCI_EXP_LNKSTA], 4);
speed = linksta & HWLOC_PCI_EXP_LNKSTA_SPEED; /* PCIe generation */
width = (linksta & HWLOC_PCI_EXP_LNKSTA_WIDTH) >> 4; /* how many lanes */
/* PCIe Gen1 = 2.5GT/s signal-rate per lane with 8/10 encoding = 0.25GB/s data-rate per lane
* PCIe Gen2 = 5 GT/s signal-rate per lane with 8/10 encoding = 0.5 GB/s data-rate per lane
* PCIe Gen3 = 8 GT/s signal-rate per lane with 128/130 encoding = 1 GB/s data-rate per lane
* PCIe Gen4 = 16 GT/s signal-rate per lane with 128/130 encoding = 2 GB/s data-rate per lane
* PCIe Gen5 = 32 GT/s signal-rate per lane with 128/130 encoding = 4 GB/s data-rate per lane
* PCIe Gen6 = 64 GT/s signal-rate per lane with 128/130 encoding = 8 GB/s data-rate per lane
/*
* These are single-direction bandwidths only.
*
* Gen1 used NRZ with 8/10 encoding.
* PCIe Gen1 = 2.5GT/s signal-rate per lane x 8/10 = 0.25GB/s data-rate per lane
* PCIe Gen2 = 5 GT/s signal-rate per lane x 8/10 = 0.5 GB/s data-rate per lane
* Gen3 switched to NRZ with 128/130 encoding.
* PCIe Gen3 = 8 GT/s signal-rate per lane x 128/130 = 1 GB/s data-rate per lane
* PCIe Gen4 = 16 GT/s signal-rate per lane x 128/130 = 2 GB/s data-rate per lane
* PCIe Gen5 = 32 GT/s signal-rate per lane x 128/130 = 4 GB/s data-rate per lane
* Gen6 switched to PAM with with 242/256 FLIT (242B payload protected by 8B CRC + 6B FEC).
* PCIe Gen6 = 64 GT/s signal-rate per lane x 242/256 = 8 GB/s data-rate per lane
* PCIe Gen7 = 128GT/s signal-rate per lane x 242/256 = 16 GB/s data-rate per lane
*/
/* lanespeed in Gbit/s */
if (speed <= 2)
lanespeed = 2.5f * speed * 0.8f;
else if (speed <= 5)
lanespeed = 8.0f * (1<<(speed-3)) * 128/130;
else
lanespeed = 8.0f * (1<<(speed-3)) * 128/130; /* assume Gen7 will be 128 GT/s and so on */
lanespeed = 8.0f * (1<<(speed-3)) * 242/256; /* assume Gen8 will be 256 GT/s and so on */
/* linkspeed in GB/s */
*linkspeed = lanespeed * width / 8;
@@ -944,6 +1039,7 @@ hwloc_pci_class_string(unsigned short class_id)
switch (class_id) {
case 0x0500: return "RAM";
case 0x0501: return "Flash";
case 0x0502: return "CXLMem";
}
return "Memory";
case 0x06:

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2010 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -323,17 +323,29 @@ hwloc_synthetic_parse_memory_attr(const char *attr, const char **endp)
hwloc_uint64_t size;
size = strtoull(attr, (char **) &endptr, 0);
if (!hwloc_strncasecmp(endptr, "TB", 2)) {
size *= 1000ULL*1000ULL*1000ULL*1000ULL;
endptr += 2;
} else if (!hwloc_strncasecmp(endptr, "TiB", 3)) {
size <<= 40;
endptr += 2;
endptr += 3;
} else if (!hwloc_strncasecmp(endptr, "GB", 2)) {
size *= 1000ULL*1000ULL*1000ULL;
endptr += 2;
} else if (!hwloc_strncasecmp(endptr, "GiB", 3)) {
size <<= 30;
endptr += 2;
endptr += 3;
} else if (!hwloc_strncasecmp(endptr, "MB", 2)) {
size *= 1000ULL*1000ULL;
endptr += 2;
} else if (!hwloc_strncasecmp(endptr, "MiB", 3)) {
size <<= 20;
endptr += 2;
endptr += 3;
} else if (!hwloc_strncasecmp(endptr, "kB", 2)) {
size <<= 10;
size *= 1000ULL;
endptr += 2;
} else if (!hwloc_strncasecmp(endptr, "kiB", 3)) {
size <<= 10;
endptr += 3;
}
*endp = endptr;
return size;
@@ -802,15 +814,15 @@ hwloc_backend_synthetic_init(struct hwloc_synthetic_backend_data_s *data,
} else if (hwloc__obj_type_is_cache(type)) {
if (!curlevel->attr.memorysize) {
if (1 == curlevel->attr.depth)
/* 32Kb in L1 */
/* 32KiB in L1 */
curlevel->attr.memorysize = 32*1024;
else
/* *4 at each level, starting from 1MB for L2, unified */
/* *4 at each level, starting from 1MiB for L2, unified */
curlevel->attr.memorysize = 256ULL*1024 << (2*curlevel->attr.depth);
}
} else if (type == HWLOC_OBJ_NUMANODE && !curlevel->attr.memorysize) {
/* 1GB in memory nodes. */
/* 1GiB in memory nodes. */
curlevel->attr.memorysize = 1024*1024*1024;
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -366,7 +366,7 @@ hwloc_win_get_processor_groups(void)
hwloc_debug("found %lu windows processor groups\n", nr_processor_groups);
if (nr_processor_groups > 1 && SIZEOF_VOID_P == 4) {
if (!hwloc_hide_errors())
if (HWLOC_SHOW_ALL_ERRORS())
fprintf(stderr, "hwloc: multiple processor groups found on 32bits Windows, topology may be invalid/incomplete.\n");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2010-2021 Inria. All rights reserved.
* Copyright © 2010-2022 Inria. All rights reserved.
* Copyright © 2010-2013 Université Bordeaux
* Copyright © 2010-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -1349,7 +1349,7 @@ look_procs(struct hwloc_backend *backend, struct procinfo *infos, unsigned long
if (data->apicid_unique) {
summarize(backend, infos, flags);
if (has_hybrid(features)) {
if (has_hybrid(features) && !(topology->flags & HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS)) {
/* use hybrid info for cpukinds */
hwloc_bitmap_t atomset = hwloc_bitmap_alloc();
hwloc_bitmap_t coreset = hwloc_bitmap_alloc();

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2011, 2020 Université Bordeaux
* Copyright © 2009-2018 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
@@ -123,6 +123,17 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
fprintf(stderr, "%s: unexpected zero gp_index, topology may be invalid\n", state->global->msgprefix);
if (obj->gp_index >= topology->next_gp_index)
topology->next_gp_index = obj->gp_index + 1;
} else if (!strcmp(name, "id")) { /* forward compat */
if (!strncmp(value, "obj", 3)) {
obj->gp_index = strtoull(value+3, NULL, 10);
if (!obj->gp_index && hwloc__xml_verbose())
fprintf(stderr, "%s: unexpected zero id, topology may be invalid\n", state->global->msgprefix);
if (obj->gp_index >= topology->next_gp_index)
topology->next_gp_index = obj->gp_index + 1;
} else {
if (hwloc__xml_verbose())
fprintf(stderr, "%s: unexpected id `%s' not-starting with `obj', ignoring\n", state->global->msgprefix, value);
}
} else if (!strcmp(name, "cpuset")) {
if (!obj->cpuset)
obj->cpuset = hwloc_bitmap_alloc();
@@ -263,7 +274,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
} else if (domain > 0xffff) {
static int warned = 0;
if (!warned && hwloc_hide_errors() < 2)
if (!warned && HWLOC_SHOW_ALL_ERRORS())
fprintf(stderr, "hwloc/xml: Ignoring PCI device with non-16bit domain.\nPass --enable-32bits-pci-domain to configure to support such devices\n(warning: it would break the library ABI, don't enable unless really needed).\n");
warned = 1;
*ignore = 1;
@@ -363,7 +374,7 @@ hwloc__xml_import_object_attr(struct hwloc_topology *topology,
#ifndef HWLOC_HAVE_32BITS_PCI_DOMAIN
} else if (domain > 0xffff) {
static int warned = 0;
if (!warned && hwloc_hide_errors() < 2)
if (!warned && HWLOC_SHOW_ALL_ERRORS())
fprintf(stderr, "hwloc/xml: Ignoring bridge to PCI with non-16bit domain.\nPass --enable-32bits-pci-domain to configure to support such devices\n(warning: it would break the library ABI, don't enable unless really needed).\n");
warned = 1;
*ignore = 1;
@@ -1235,7 +1246,7 @@ hwloc__xml_import_object(hwloc_topology_t topology,
/* next should be before cur */
if (!childrengotignored) {
static int reported = 0;
if (!reported && hwloc_hide_errors() < 2) {
if (!reported && HWLOC_SHOW_CRITICAL_ERRORS()) {
hwloc__xml_import_report_outoforder(topology, next, cur);
reported = 1;
}
@@ -1568,6 +1579,9 @@ hwloc__xml_v2import_distances(hwloc_topology_t topology,
}
}
if (topology->flags & HWLOC_TOPOLOGY_FLAG_NO_DISTANCES)
goto out_ignore;
hwloc_internal_distances_add_by_index(topology, name, unique_type, different_types, nbobjs, indexes, u64values, kind, 0 /* assume grouping was applied when this matrix was discovered before exporting to XML */);
/* prevent freeing below */
@@ -1722,7 +1736,8 @@ hwloc__xml_import_memattr(hwloc_topology_t topology,
}
}
if (name && flags != (unsigned long) -1) {
if (name && flags != (unsigned long) -1
&& !(topology->flags & HWLOC_TOPOLOGY_FLAG_NO_MEMATTRS)) {
hwloc_memattr_id_t _id;
ret = hwloc_memattr_get_by_name(topology, name, &_id);
@@ -1833,7 +1848,13 @@ hwloc__xml_import_cpukind(hwloc_topology_t topology,
goto error;
}
hwloc_internal_cpukinds_register(topology, cpuset, forced_efficiency, infos, nr_infos, HWLOC_CPUKINDS_REGISTER_FLAG_OVERWRITE_FORCED_EFFICIENCY);
if (topology->flags & HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS) {
hwloc__free_infos(infos, nr_infos);
hwloc_bitmap_free(cpuset);
} else {
hwloc_internal_cpukinds_register(topology, cpuset, forced_efficiency, infos, nr_infos, HWLOC_CPUKINDS_REGISTER_FLAG_OVERWRITE_FORCED_EFFICIENCY);
hwloc__free_infos(infos, nr_infos);
}
return state->global->close_tag(state);
@@ -2168,7 +2189,8 @@ done:
* but it would require to have those objects in the original XML order (like the first_numanode cousin-list).
* because the topology order can be different if some parents are ignored during load.
*/
if (nbobjs == data->nbnumanodes) {
if (nbobjs == data->nbnumanodes
&& !(topology->flags & HWLOC_TOPOLOGY_FLAG_NO_DISTANCES)) {
hwloc_obj_t *objs = malloc(nbobjs*sizeof(hwloc_obj_t));
uint64_t *values = malloc(nbobjs*nbobjs*sizeof(*values));
assert(data->nbnumanodes > 0); /* v1dist->nbobjs is >0 after import */
@@ -2650,7 +2672,7 @@ hwloc__xml_export_object_contents (hwloc__xml_export_state_t state, hwloc_topolo
logical_to_v2array = malloc(nbobjs * sizeof(*logical_to_v2array));
if (!logical_to_v2array) {
if (!hwloc_hide_errors())
if (HWLOC_SHOW_ALL_ERRORS())
fprintf(stderr, "hwloc/xml/export/v1: failed to allocated logical_to_v2array\n");
continue;
}
@@ -3124,9 +3146,11 @@ hwloc__xml_export_memattrs(hwloc__xml_export_state_t state, hwloc_topology_t top
continue;
imattr = &topology->memattrs[id];
if ((id == HWLOC_MEMATTR_ID_LATENCY || id == HWLOC_MEMATTR_ID_BANDWIDTH)
&& !imattr->nr_targets)
/* no need to export target-less attributes for initial attributes, no release support attributes without those definitions */
if (id < HWLOC_MEMATTR_ID_MAX && !imattr->nr_targets)
/* no need to export standard attributes without any target,
* their definition is now standardized,
* the old hwloc importing this XML may recreate these attributes just like it would for a non-imported topology.
*/
continue;
state->new_child(state, &mstate, "memattr");

View File

@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright © 2022 IBM Corporation. All rights reserved.
@@ -114,14 +114,25 @@ int hwloc_topology_abi_check(hwloc_topology_t topology)
return topology->topology_abi != HWLOC_TOPOLOGY_ABI ? -1 : 0;
}
/* callers should rather use wrappers HWLOC_SHOW_ALL_ERRORS() and HWLOC_SHOW_CRITICAL_ERRORS() for clarity */
int hwloc_hide_errors(void)
{
static int hide = 1; /* only show critical errors by default. lstopo will show others */
static int checked = 0;
if (!checked) {
const char *envvar = getenv("HWLOC_HIDE_ERRORS");
if (envvar)
if (envvar) {
hide = atoi(envvar);
#ifdef HWLOC_DEBUG
} else {
/* if debug is enabled and HWLOC_DEBUG_VERBOSE isn't forced to 0,
* show all errors jus like we show all debug messages.
*/
envvar = getenv("HWLOC_DEBUG_VERBOSE");
if (!envvar || atoi(envvar))
hide = 0;
#endif
}
checked = 1;
}
return hide;
@@ -158,7 +169,7 @@ static void report_insert_error(hwloc_obj_t new, hwloc_obj_t old, const char *ms
{
static int reported = 0;
if (reason && !reported && hwloc_hide_errors() < 2) {
if (reason && !reported && HWLOC_SHOW_CRITICAL_ERRORS()) {
char newstr[512];
char oldstr[512];
report_insert_error_format_obj(newstr, sizeof(newstr), new);
@@ -3178,7 +3189,7 @@ hwloc_connect_levels(hwloc_topology_t topology)
tmpnbobjs = realloc(topology->level_nbobjects,
2 * topology->nb_levels_allocated * sizeof(*topology->level_nbobjects));
if (!tmplevels || !tmpnbobjs) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: failed to realloc level arrays to %u\n", topology->nb_levels_allocated * 2);
/* if one realloc succeeded, make sure the caller will free the new buffer */
@@ -3536,6 +3547,8 @@ hwloc_discover(struct hwloc_topology *topology,
/*
* Additional discovery
*/
hwloc_pci_discovery_prepare(topology);
if (topology->backend_phases & HWLOC_DISC_PHASE_PCI) {
dstatus->phase = HWLOC_DISC_PHASE_PCI;
hwloc_discover_by_phase(topology, dstatus, "PCI");
@@ -3553,6 +3566,8 @@ hwloc_discover(struct hwloc_topology *topology,
hwloc_discover_by_phase(topology, dstatus, "ANNOTATE");
}
hwloc_pci_discovery_exit(topology); /* pci needed up to annotate */
if (getenv("HWLOC_DEBUG_SORT_CHILDREN"))
hwloc_debug_sort_children(topology->levels[0][0]);
@@ -3565,17 +3580,17 @@ hwloc_discover(struct hwloc_topology *topology,
hwloc_debug("%s", "\nRemoving empty objects\n");
remove_empty(topology, &topology->levels[0][0]);
if (!topology->levels[0][0]) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Topology became empty, aborting!\n");
return -1;
}
if (hwloc_bitmap_iszero(topology->levels[0][0]->cpuset)) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Topology does not contain any PU, aborting!\n");
return -1;
}
if (hwloc_bitmap_iszero(topology->levels[0][0]->nodeset)) {
if (hwloc_hide_errors() < 2)
if (HWLOC_SHOW_CRITICAL_ERRORS())
fprintf(stderr, "hwloc: Topology does not contain any NUMA node, aborting!\n");
return -1;
}
@@ -3811,7 +3826,16 @@ hwloc_topology_set_flags (struct hwloc_topology *topology, unsigned long flags)
return -1;
}
if (flags & ~(HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED|HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM|HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES|HWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT|HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING|HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING|HWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING)) {
if (flags & ~(HWLOC_TOPOLOGY_FLAG_INCLUDE_DISALLOWED
|HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
|HWLOC_TOPOLOGY_FLAG_THISSYSTEM_ALLOWED_RESOURCES
|HWLOC_TOPOLOGY_FLAG_IMPORT_SUPPORT
|HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_CPUBINDING
|HWLOC_TOPOLOGY_FLAG_RESTRICT_TO_MEMBINDING
|HWLOC_TOPOLOGY_FLAG_DONT_CHANGE_BINDING
|HWLOC_TOPOLOGY_FLAG_NO_DISTANCES
|HWLOC_TOPOLOGY_FLAG_NO_MEMATTRS
|HWLOC_TOPOLOGY_FLAG_NO_CPUKINDS)) {
errno = EINVAL;
return -1;
}
@@ -4076,15 +4100,11 @@ hwloc_topology_load (struct hwloc_topology *topology)
*/
hwloc_set_binding_hooks(topology);
hwloc_pci_discovery_prepare(topology);
/* actual topology discovery */
err = hwloc_discover(topology, &dstatus);
if (err < 0)
goto out;
hwloc_pci_discovery_exit(topology);
#ifndef HWLOC_DEBUG
if (getenv("HWLOC_DEBUG_CHECK"))
#endif
@@ -4106,6 +4126,7 @@ hwloc_topology_load (struct hwloc_topology *topology)
/* Same for memattrs */
hwloc_internal_memattrs_need_refresh(topology);
hwloc_internal_memattrs_refresh(topology);
hwloc_internal_memattrs_guess_memory_tiers(topology);
topology->is_loaded = 1;

View File

@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
project (ethash C)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -37,7 +37,7 @@ public:
};
} /* namespace xmrig */
} // namespace xmrig
#endif /* XMRIG_CPU_H */
#endif // XMRIG_CPU_H

View File

@@ -33,6 +33,7 @@
#include "crypto/common/Nonce.h"
#include "crypto/common/VirtualMemory.h"
#include "crypto/rx/Rx.h"
#include "crypto/rx/RxCache.h"
#include "crypto/rx/RxDataset.h"
#include "crypto/rx/RxVm.h"
#include "crypto/ghostrider/ghostrider.h"
@@ -145,6 +146,11 @@ void xmrig::CpuWorker<N>::allocateRandomX_VM()
uint8_t* scratchpad = m_memory->isHugePages() ? m_memory->scratchpad() : dataset->tryAllocateScrathpad();
m_vm = RxVm::create(dataset, scratchpad ? scratchpad : m_memory->scratchpad(), !m_hwAES, m_assembly, node());
}
else if (!dataset->get() && (m_job.currentJob().seed() != m_seed)) {
// Update RandomX light VM with the new seed
randomx_vm_set_cache(m_vm, dataset->cache()->get());
}
m_seed = m_job.currentJob().seed();
}
#endif

View File

@@ -97,6 +97,7 @@ private:
# ifdef XMRIG_ALGO_RANDOMX
randomx_vm *m_vm = nullptr;
Buffer m_seed;
# endif
# ifdef XMRIG_ALGO_GHOSTRIDER

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
*
* 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
@@ -26,6 +26,12 @@
#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 {
@@ -116,10 +122,16 @@ public:
virtual size_t threads() const = 0;
virtual Vendor vendor() 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

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
m_jccErratum =
((model == 0x4E) && (stepping == 0x3)) ||
((model == 0x55) && (stepping == 0x4)) ||
((model == 0x55) && ((stepping == 0x4) || (stepping == 0x7))) ||
((model == 0x5E) && (stepping == 0x3)) ||
((model == 0x8E) && (stepping >= 0x9) && (stepping <= 0xC)) ||
((model == 0x9E) && (stepping >= 0x9) && (stepping <= 0xD)) ||

View File

@@ -1,7 +1,7 @@
/* XMRig
* 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) 2016-2021 XMRig <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
*
* 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
@@ -72,11 +72,10 @@ protected:
# endif
}
protected:
Arch m_arch = ARCH_UNKNOWN;
bool m_jccErratum = false;
char m_brand[64 + 6]{};
size_t m_threads;
size_t m_threads = 0;
std::vector<int32_t> m_units;
Vendor m_vendor = VENDOR_UNKNOWN;
@@ -94,7 +93,7 @@ private:
};
} /* namespace xmrig */
} // namespace xmrig
#endif /* XMRIG_BASICCPUINFO_H */
#endif // XMRIG_BASICCPUINFO_H

View File

@@ -27,7 +27,7 @@
#if __ARM_FEATURE_CRYPTO && !defined(__APPLE__)
# include <sys/auxv.h>
# ifndef __FreeBSD__
# if !defined(XMRIG_OS_FREEBSD)
# include <asm/hwcap.h>
# else
# include <stdint.h>
@@ -71,7 +71,7 @@ xmrig::BasicCpuInfo::BasicCpuInfo() :
# if __ARM_FEATURE_CRYPTO
# if defined(__APPLE__)
m_flags.set(FLAG_AES, true);
# elif defined(__FreeBSD__)
# elif defined(XMRIG_OS_FREEBSD)
uint64_t isar0 = READ_SPECIALREG(id_aa64isar0_el1);
m_flags.set(FLAG_AES, ID_AA64ISAR0_AES_VAL(isar0) >= ID_AA64ISAR0_AES_BASE);
# else

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
*
* 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
@@ -36,27 +36,22 @@
#include "base/io/log/Log.h"
namespace xmrig {
uint32_t HwlocCpuInfo::m_features = 0;
static inline bool isCacheObject(hwloc_obj_t obj)
#if HWLOC_API_VERSION < 0x20000
static inline int hwloc_obj_type_is_cache(hwloc_obj_type_t type)
{
# if HWLOC_API_VERSION >= 0x20000
return hwloc_obj_type_is_cache(obj->type);
# else
return obj->type == HWLOC_OBJ_CACHE;
# endif
return type == HWLOC_OBJ_CACHE;
}
#endif
namespace xmrig {
template <typename func>
static inline void findCache(hwloc_obj_t obj, unsigned min, unsigned max, func lambda)
{
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;
if (depth < min || depth > max) {
continue;
@@ -174,10 +169,6 @@ xmrig::HwlocCpuInfo::HwlocCpuInfo()
m_packages = countByType(m_topology, HWLOC_OBJ_PACKAGE);
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);
hwloc_obj_t node = nullptr;
@@ -298,8 +289,10 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
cores.reserve(m_cores);
findByType(cache, HWLOC_OBJ_CORE, [&cores](hwloc_obj_t found) { cores.emplace_back(found); });
const bool L3_exclusive = isCacheExclusive(cache);
# ifdef XMRIG_ALGO_GHOSTRIDER
if ((algorithm == Algorithm::GHOSTRIDER_RTM) && (PUs > cores.size()) && (PUs < cores.size() * 2)) {
if ((algorithm == Algorithm::GHOSTRIDER_RTM) && L3_exclusive && (PUs > cores.size()) && (PUs < cores.size() * 2)) {
// Don't use E-cores on Alder Lake
cores.erase(std::remove_if(cores.begin(), cores.end(), [](hwloc_obj_t c) { return hwloc_bitmap_weight(c->cpuset) == 1; }), cores.end());
@@ -311,7 +304,6 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
# endif
size_t L3 = cache->attr->cache.size;
const bool L3_exclusive = isCacheExclusive(cache);
size_t L2 = 0;
int L2_associativity = 0;
size_t extra = 0;
@@ -321,7 +313,7 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
if (cache->attr->cache.depth == 3) {
for (size_t i = 0; i < cache->arity; ++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;
}
@@ -349,6 +341,10 @@ void xmrig::HwlocCpuInfo::processTopLevelCache(hwloc_obj_t cache, const Algorith
}
# ifdef XMRIG_ALGO_RANDOMX
if ((algorithm.family() == Algorithm::RANDOM_X) && L3_exclusive && (PUs > cores.size()) && (PUs < cores.size() * 2)) {
// Use all L3+L2 on latest Intel CPUs with P-cores, E-cores and exclusive L3 cache
cacheHashes = (L3 + L2) / scratchpad;
}
if (extra == 0 && algorithm.l2() > 0) {
cacheHashes = std::min<size_t>(std::max<size_t>(L2 / algorithm.l2(), cores.size()), cacheHashes);
}

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
*
* 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
@@ -21,12 +21,9 @@
#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_topology_t = struct hwloc_topology *;
using hwloc_obj_t = struct hwloc_obj *;
namespace xmrig {
@@ -37,39 +34,27 @@ class HwlocCpuInfo : public BasicCpuInfo
public:
XMRIG_DISABLE_COPY_MOVE(HwlocCpuInfo)
enum Feature : uint32_t {
SET_THISTHREAD_MEMBIND = 1
};
HwlocCpuInfo();
~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:
bool 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; }
inline size_t cores() const override { return m_cores; }
inline size_t L2() const override { return m_cache[2]; }
inline size_t L3() const override { return m_cache[3]; }
inline size_t nodes() const override { return m_nodes; }
inline size_t packages() const override { return m_packages; }
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 L2() const override { return m_cache[2]; }
inline size_t L3() const override { return m_cache[3]; }
inline size_t nodes() const override { return m_nodes; }
inline size_t packages() const override { return m_packages; }
private:
CpuThreads allThreads(const Algorithm &algorithm, uint32_t limit) const;
void processTopLevelCache(hwloc_obj_t cache, const Algorithm &algorithm, CpuThreads &threads, size_t limit) const;
void setThreads(size_t threads);
static uint32_t m_features;
char m_backend[20] = { 0 };
hwloc_topology_t m_topology = nullptr;
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
* Copyright (c) 2018 Riku Voipio <riku.voipio@iki.fi>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <support@xmrig.com>
*
* 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
@@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/tools/String.h"
#include "3rdparty/fmt/core.h"
@@ -84,6 +83,7 @@ static const id_part arm_part[] = {
{ 0xc27, "Cortex-M7" },
{ 0xc60, "Cortex-M0+" },
{ 0xd01, "Cortex-A32" },
{ 0xd02, "Cortex-A34" },
{ 0xd03, "Cortex-A53" },
{ 0xd04, "Cortex-A35" },
{ 0xd05, "Cortex-A55" },
@@ -97,40 +97,60 @@ static const id_part arm_part[] = {
{ 0xd0d, "Cortex-A77" },
{ 0xd0e, "Cortex-A76AE" },
{ 0xd13, "Cortex-R52" },
{ 0xd15, "Cortex-R82" },
{ 0xd20, "Cortex-M23" },
{ 0xd21, "Cortex-M33" },
{ 0xd40, "Neoverse-V1" },
{ 0xd41, "Cortex-A78" },
{ 0xd42, "Cortex-A78AE" },
{ 0xd43, "Cortex-A65AE" },
{ 0xd44, "Cortex-X1" },
{ 0xd46, "Cortex-A510" },
{ 0xd47, "Cortex-A710" },
{ 0xd48, "Cortex-X2" },
{ 0xd49, "Neoverse-N2" },
{ 0xd4a, "Neoverse-E1" },
{ 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[] = {
{ 0x0f, "Brahma B15" },
{ 0x100, "Brahma B53" },
{ 0x0f, "Brahma-B15" },
{ 0x100, "Brahma-B53" },
{ 0x516, "ThunderX2" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part dec_part[] = {
{ 0xa10, "SA110" },
{ 0xa11, "SA1100" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part cavium_part[] = {
{ 0x0a0, "ThunderX" },
{ 0x0a1, "ThunderX 88XX" },
{ 0x0a2, "ThunderX 81XX" },
{ 0x0a3, "ThunderX 83XX" },
{ 0x0af, "ThunderX2 99xx" },
{ -1, nullptr },
{ 0x0a1, "ThunderX-88XX" },
{ 0x0a2, "ThunderX-81XX" },
{ 0x0a3, "ThunderX-83XX" },
{ 0x0af, "ThunderX2-99xx" },
{ 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[] = {
{ 0x000, "X-Gene" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part qcom_part[] = {
@@ -141,36 +161,43 @@ static const id_part qcom_part[] = {
{ 0x201, "Kryo" },
{ 0x205, "Kryo" },
{ 0x211, "Kryo" },
{ 0x800, "Falkor V1/Kryo" },
{ 0x801, "Kryo V2" },
{ 0x800, "Falkor-V1/Kryo" },
{ 0x801, "Kryo-V2" },
{ 0x802, "Kryo-3XX-Gold" },
{ 0x803, "Kryo-3XX-Silver" },
{ 0x804, "Kryo-4XX-Gold" },
{ 0x805, "Kryo-4XX-Silver" },
{ 0xc00, "Falkor" },
{ 0xc01, "Saphira" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part samsung_part[] = {
{ 0x001, "exynos-m1" },
{ -1, nullptr },
{ 0x002, "exynos-m3" },
{ 0x003, "exynos-m4" },
{ 0x004, "exynos-m5" },
{ -1, nullptr }
};
static const id_part nvidia_part[] = {
{ 0x000, "Denver" },
{ 0x003, "Denver 2" },
{ 0x004, "Carmel" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part marvell_part[] = {
{ 0x131, "Feroceon 88FR131" },
{ 0x131, "Feroceon-88FR131" },
{ 0x581, "PJ4/PJ4b" },
{ 0x584, "PJ4B-MP" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part faraday_part[] = {
{ 0x526, "FA526" },
{ 0x626, "FA626" },
{ -1, nullptr },
{ -1, nullptr }
};
static const id_part intel_part[] = {
@@ -195,23 +222,50 @@ static const id_part intel_part[] = {
{ 0x689, "PXA31x" },
{ 0xb11, "SA1110" },
{ 0xc12, "IPX1200" },
{ -1, nullptr },
{ -1, nullptr }
};
static const struct id_part fujitsu_part[] = {
{ 0x001, "A64FX" },
{ -1, "unknown" },
{ -1, nullptr }
};
static const id_part hisi_part[] = {
{ 0xd01, "Kunpeng-920" }, /* aka tsv110 */
{ -1, nullptr },
{ 0xd01, "Kunpeng-920" }, /* aka tsv110 */
{ 0xd40, "Cortex-A76" }, /* HiSilicon uses this ID though advertises A76 */
{ -1, nullptr }
};
static const id_part apple_part[] = {
{ 0x022, "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" },
{ 0x61, apple_part, "Apple" },
{ 0x66, faraday_part, "Faraday" },
{ 0x69, intel_part, "Intel" }
{ 0x69, intel_part, "Intel" },
{ 0x70, ft_part, "Phytium" },
{ 0xc0, ampere_part, "Ampere" }
};

View File

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

View File

@@ -138,6 +138,93 @@ __kernel void blake2b_initial_hash(__global void *out, __global const void* bloc
t[7] = hash[7];
}
void blake2b_512_process_double_block_variable(ulong *out, ulong* m, __global const ulong* in, uint in_len, uint out_len)
{
ulong v[16] =
{
iv0 ^ (0x01010000u | out_len), iv1, iv2, iv3, iv4 , iv5, iv6, iv7,
iv0 , iv1, iv2, iv3, iv4 ^ 128, iv5, iv6, iv7,
};
BLAKE2B_ROUNDS();
ulong h[8];
v[0] = h[0] = v[0] ^ v[8] ^ iv0 ^ (0x01010000u | out_len);
v[1] = h[1] = v[1] ^ v[9] ^ iv1;
v[2] = h[2] = v[2] ^ v[10] ^ iv2;
v[3] = h[3] = v[3] ^ v[11] ^ iv3;
v[4] = h[4] = v[4] ^ v[12] ^ iv4;
v[5] = h[5] = v[5] ^ v[13] ^ iv5;
v[6] = h[6] = v[6] ^ v[14] ^ iv6;
v[7] = h[7] = v[7] ^ v[15] ^ iv7;
v[8] = iv0;
v[9] = iv1;
v[10] = iv2;
v[11] = iv3;
v[12] = iv4 ^ in_len;
v[13] = iv5;
v[14] = ~iv6;
v[15] = iv7;
m[ 0] = (in_len > 128) ? in[16] : 0;
m[ 1] = (in_len > 136) ? in[17] : 0;
m[ 2] = (in_len > 144) ? in[18] : 0;
m[ 3] = (in_len > 152) ? in[19] : 0;
m[ 4] = (in_len > 160) ? in[20] : 0;
m[ 5] = (in_len > 168) ? in[21] : 0;
m[ 6] = (in_len > 176) ? in[22] : 0;
m[ 7] = (in_len > 184) ? in[23] : 0;
m[ 8] = (in_len > 192) ? in[24] : 0;
m[ 9] = (in_len > 200) ? in[25] : 0;
m[10] = (in_len > 208) ? in[26] : 0;
m[11] = (in_len > 216) ? in[27] : 0;
m[12] = (in_len > 224) ? in[28] : 0;
m[13] = (in_len > 232) ? in[29] : 0;
m[14] = (in_len > 240) ? in[30] : 0;
m[15] = (in_len > 248) ? in[31] : 0;
if (in_len % sizeof(ulong))
m[(in_len - 128) / sizeof(ulong)] &= (ulong)(-1) >> (64 - (in_len % sizeof(ulong)) * 8);
BLAKE2B_ROUNDS();
if (out_len > 0) out[0] = h[0] ^ v[0] ^ v[8];
if (out_len > 8) out[1] = h[1] ^ v[1] ^ v[9];
if (out_len > 16) out[2] = h[2] ^ v[2] ^ v[10];
if (out_len > 24) out[3] = h[3] ^ v[3] ^ v[11];
if (out_len > 32) out[4] = h[4] ^ v[4] ^ v[12];
if (out_len > 40) out[5] = h[5] ^ v[5] ^ v[13];
if (out_len > 48) out[6] = h[6] ^ v[6] ^ v[14];
if (out_len > 56) out[7] = h[7] ^ v[7] ^ v[15];
}
__attribute__((reqd_work_group_size(64, 1, 1)))
__kernel void blake2b_initial_hash_double(__global void *out, __global const void* blockTemplate, uint blockTemplateSize, uint start_nonce)
{
const uint global_index = get_global_id(0);
__global const ulong* p = (__global const ulong*) blockTemplate;
ulong m[16] = { p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15] };
const ulong nonce = start_nonce + global_index;
m[4] = (m[4] & ((ulong)(-1) >> 8)) | (nonce << 56);
m[5] = (m[5] & ((ulong)(-1) << 24)) | (nonce >> 8);
ulong hash[8];
blake2b_512_process_double_block_variable(hash, m, p, blockTemplateSize, 64);
__global ulong* t = ((__global ulong*) out) + global_index * 8;
t[0] = hash[0];
t[1] = hash[1];
t[2] = hash[2];
t[3] = hash[3];
t[4] = hash[4];
t[5] = hash[5];
t[6] = hash[6];
t[7] = hash[7];
}
#define in_len 256
#define out_len 32

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backend/opencl/kernels/rx/Blake2bInitialHashDoubleKernel.h"
#include "backend/opencl/wrappers/OclLib.h"
void xmrig::Blake2bInitialHashDoubleKernel::enqueue(cl_command_queue queue, size_t threads)
{
const size_t gthreads = threads;
static const size_t lthreads = 64;
enqueueNDRange(queue, 1, nullptr, &gthreads, &lthreads);
}
// __kernel void blake2b_initial_hash_double(__global void *out, __global const void* blockTemplate, uint blockTemplateSize, uint start_nonce)
void xmrig::Blake2bInitialHashDoubleKernel::setArgs(cl_mem out, cl_mem blockTemplate)
{
setArg(0, sizeof(cl_mem), &out);
setArg(1, sizeof(cl_mem), &blockTemplate);
}
void xmrig::Blake2bInitialHashDoubleKernel::setBlobSize(size_t size)
{
const uint32_t s = size;
setArg(2, sizeof(uint32_t), &s);
}
void xmrig::Blake2bInitialHashDoubleKernel::setNonce(uint32_t nonce)
{
setArg(3, sizeof(uint32_t), &nonce);
}

View File

@@ -0,0 +1,50 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_BLAKE2BINITIALHASHDOUBLEKERNEL_H
#define XMRIG_BLAKE2BINITIALHASHDOUBLEKERNEL_H
#include "backend/opencl/wrappers/OclKernel.h"
namespace xmrig {
class Blake2bInitialHashDoubleKernel : public OclKernel
{
public:
inline Blake2bInitialHashDoubleKernel(cl_program program) : OclKernel(program, "blake2b_initial_hash_double") {}
void enqueue(cl_command_queue queue, size_t threads);
void setArgs(cl_mem out, cl_mem blockTemplate);
void setBlobSize(size_t size);
void setNonce(uint32_t nonce);
};
} // namespace xmrig
#endif /* XMRIG_BLAKE2BINITIALHASHDOUBLEKERNEL_H */

View File

@@ -80,6 +80,7 @@ if (WITH_OPENCL)
if (WITH_RANDOMX)
list(APPEND HEADERS_BACKEND_OPENCL
src/backend/opencl/kernels/rx/Blake2bHashRegistersKernel.h
src/backend/opencl/kernels/rx/Blake2bInitialHashDoubleKernel.h
src/backend/opencl/kernels/rx/Blake2bInitialHashKernel.h
src/backend/opencl/kernels/rx/ExecuteVmKernel.h
src/backend/opencl/kernels/rx/FillAesKernel.h
@@ -96,6 +97,7 @@ if (WITH_OPENCL)
list(APPEND SOURCES_BACKEND_OPENCL
src/backend/opencl/generators/ocl_generic_rx_generator.cpp
src/backend/opencl/kernels/rx/Blake2bHashRegistersKernel.cpp
src/backend/opencl/kernels/rx/Blake2bInitialHashDoubleKernel.cpp
src/backend/opencl/kernels/rx/Blake2bInitialHashKernel.cpp
src/backend/opencl/kernels/rx/ExecuteVmKernel.cpp
src/backend/opencl/kernels/rx/FillAesKernel.cpp

View File

@@ -23,6 +23,9 @@
*/
#include <stdexcept>
#include "backend/opencl/runners/OclBaseRunner.h"
#include "backend/opencl/cl/OclSource.h"
#include "backend/opencl/OclCache.h"

View File

@@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdexcept>
#include "backend/opencl/runners/OclCnRunner.h"
#include "backend/opencl/kernels/Cn0Kernel.h"
#include "backend/opencl/kernels/Cn1Kernel.h"

View File

@@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdexcept>
#include "backend/opencl/runners/OclKawPowRunner.h"
#include "backend/common/Tags.h"
#include "3rdparty/libethash/ethash_internal.h"

View File

@@ -25,6 +25,7 @@
#include "backend/opencl/runners/OclRxBaseRunner.h"
#include "backend/opencl/kernels/rx/Blake2bHashRegistersKernel.h"
#include "backend/opencl/kernels/rx/Blake2bInitialHashKernel.h"
#include "backend/opencl/kernels/rx/Blake2bInitialHashDoubleKernel.h"
#include "backend/opencl/kernels/rx/FillAesKernel.h"
#include "backend/opencl/kernels/rx/FindSharesKernel.h"
#include "backend/opencl/kernels/rx/HashAesKernel.h"
@@ -71,6 +72,7 @@ xmrig::OclRxBaseRunner::~OclRxBaseRunner()
delete m_fillAes4Rx4_entropy;
delete m_hashAes1Rx4;
delete m_blake2b_initial_hash;
delete m_blake2b_initial_hash_double;
delete m_blake2b_hash_registers_32;
delete m_blake2b_hash_registers_64;
delete m_find_shares;
@@ -87,12 +89,28 @@ void xmrig::OclRxBaseRunner::run(uint32_t nonce, uint32_t *hashOutput)
{
static const uint32_t zero = 0;
m_blake2b_initial_hash->setNonce(nonce);
if (m_jobSize <= 128) {
m_blake2b_initial_hash->setNonce(nonce);
}
else if (m_jobSize <= 256) {
m_blake2b_initial_hash_double->setNonce(nonce);
}
else {
hashOutput[0xFF] = 0;
return;
}
m_find_shares->setNonce(nonce);
enqueueWriteBuffer(m_output, CL_FALSE, sizeof(cl_uint) * 0xFF, sizeof(uint32_t), &zero);
m_blake2b_initial_hash->enqueue(m_queue, m_intensity);
if (m_jobSize <= 128) {
m_blake2b_initial_hash->enqueue(m_queue, m_intensity);
}
else {
m_blake2b_initial_hash_double->enqueue(m_queue, m_intensity);
}
m_fillAes1Rx4_scratchpad->enqueue(m_queue, m_intensity);
const uint32_t programCount = RxAlgo::programCount(m_algorithm);
@@ -134,7 +152,11 @@ void xmrig::OclRxBaseRunner::set(const Job &job, uint8_t *blob)
enqueueWriteBuffer(m_input, CL_TRUE, 0, Job::kMaxBlobSize, blob);
m_jobSize = job.size();
m_blake2b_initial_hash->setBlobSize(job.size());
m_blake2b_initial_hash_double->setBlobSize(job.size());
m_find_shares->setTarget(job.target());
}
@@ -166,6 +188,9 @@ void xmrig::OclRxBaseRunner::build()
m_blake2b_initial_hash = new Blake2bInitialHashKernel(m_program);
m_blake2b_initial_hash->setArgs(m_hashes, m_input);
m_blake2b_initial_hash_double = new Blake2bInitialHashDoubleKernel(m_program);
m_blake2b_initial_hash_double->setArgs(m_hashes, m_input);
m_blake2b_hash_registers_32 = new Blake2bHashRegistersKernel(m_program, "blake2b_hash_registers_32");
m_blake2b_hash_registers_64 = new Blake2bHashRegistersKernel(m_program, "blake2b_hash_registers_64");

View File

@@ -35,6 +35,7 @@ namespace xmrig {
class Blake2bHashRegistersKernel;
class Blake2bInitialHashKernel;
class Blake2bInitialHashDoubleKernel;
class FillAesKernel;
class FindSharesKernel;
class HashAesKernel;
@@ -58,21 +59,24 @@ protected:
protected:
virtual void execute(uint32_t iteration) = 0;
Blake2bHashRegistersKernel *m_blake2b_hash_registers_32 = nullptr;
Blake2bHashRegistersKernel *m_blake2b_hash_registers_64 = nullptr;
Blake2bInitialHashKernel *m_blake2b_initial_hash = nullptr;
Blake2bHashRegistersKernel *m_blake2b_hash_registers_32 = nullptr;
Blake2bHashRegistersKernel *m_blake2b_hash_registers_64 = nullptr;
Blake2bInitialHashKernel *m_blake2b_initial_hash = nullptr;
Blake2bInitialHashDoubleKernel *m_blake2b_initial_hash_double = nullptr;
Buffer m_seed;
cl_mem m_dataset = nullptr;
cl_mem m_entropy = nullptr;
cl_mem m_hashes = nullptr;
cl_mem m_rounding = nullptr;
cl_mem m_scratchpads = nullptr;
FillAesKernel *m_fillAes1Rx4_scratchpad = nullptr;
FillAesKernel *m_fillAes4Rx4_entropy = nullptr;
FindSharesKernel *m_find_shares = nullptr;
HashAesKernel *m_hashAes1Rx4 = nullptr;
uint32_t m_gcn_version = 12;
uint32_t m_worksize = 8;
cl_mem m_dataset = nullptr;
cl_mem m_entropy = nullptr;
cl_mem m_hashes = nullptr;
cl_mem m_rounding = nullptr;
cl_mem m_scratchpads = nullptr;
FillAesKernel *m_fillAes1Rx4_scratchpad = nullptr;
FillAesKernel *m_fillAes4Rx4_entropy = nullptr;
FindSharesKernel *m_find_shares = nullptr;
HashAesKernel *m_hashAes1Rx4 = nullptr;
uint32_t m_gcn_version = 12;
uint32_t m_worksize = 8;
size_t m_jobSize = 0;
};

View File

@@ -16,6 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdexcept>
#include "backend/opencl/runners/OclRxJitRunner.h"
#include "backend/opencl/cl/rx/randomx_run_gfx803.h"
#include "backend/opencl/cl/rx/randomx_run_gfx900.h"

View File

@@ -399,6 +399,9 @@ private:
uv_loop_t* m_loop = nullptr;
uv_thread_t m_loopThread = {};
uv_async_t m_shutdownAsync = {};
uv_async_t m_batonAsync = {};
std::vector<KawPowBaton> m_batons;
static void loop(void* data)
{
@@ -419,19 +422,37 @@ void KawPowBuilder::build_async(const IOclRunner& runner, uint64_t period, uint3
if (!m_loop) {
m_loop = new uv_loop_t{};
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);
}
KawPowBaton* baton = new KawPowBaton(runner, period, worksize);
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); }
);
m_batons.emplace_back(runner, period, worksize);
uv_async_send(&m_batonAsync);
}

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -39,6 +39,7 @@
#include <thread>
#include <iostream>
namespace xmrig {
@@ -80,7 +81,8 @@ static rapidjson::Value getResources(rapidjson::Document &doc)
xmrig::Api::Api(Base *base) :
m_base(base),
m_timestamp(Chrono::currentMSecsSinceEpoch())
m_timestamp(Chrono::currentMSecsSinceEpoch()),
m_httpd(nullptr)
{
base->addListener(this);
@@ -91,7 +93,11 @@ xmrig::Api::Api(Base *base) :
xmrig::Api::~Api()
{
# ifdef XMRIG_FEATURE_HTTP
delete m_httpd;
if (m_httpd) {
m_httpd->stop();
delete m_httpd;
m_httpd = nullptr; // Ensure the pointer is set to nullptr after deletion
}
# endif
}
@@ -109,8 +115,14 @@ void xmrig::Api::start()
genWorkerId(m_base->config()->apiWorkerId());
# ifdef XMRIG_FEATURE_HTTP
m_httpd = new Httpd(m_base);
m_httpd->start();
if (!m_httpd) {
m_httpd = new Httpd(m_base);
if (!m_httpd->start()) {
std::cerr << "HTTP server failed to start." << std::endl;
delete m_httpd; // Properly handle failure to start
m_httpd = nullptr;
}
}
# endif
}
@@ -118,7 +130,26 @@ void xmrig::Api::start()
void xmrig::Api::stop()
{
# ifdef XMRIG_FEATURE_HTTP
m_httpd->stop();
if (m_httpd) {
m_httpd->stop();
}
# endif
}
void xmrig::Api::tick()
{
# ifdef XMRIG_FEATURE_HTTP
if (!m_httpd || !m_base->config()->http().isEnabled() || m_httpd->isBound()) {
return;
}
if (++m_ticks % 10 == 0) {
m_ticks = 0;
if (m_httpd) {
m_httpd->start();
}
}
# endif
}

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -21,7 +21,6 @@
#include <vector>
#include <cstdint>
#include "base/kernel/interfaces/IBaseListener.h"
@@ -44,7 +43,7 @@ class Api : public IBaseListener
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Api)
Api(Base *base);
explicit Api(Base *base);
~Api() override;
inline const char *id() const { return m_id; }
@@ -54,6 +53,7 @@ public:
void request(const HttpData &req);
void start();
void stop();
void tick();
protected:
void onConfigChanged(Config *config, Config *previousConfig) override;
@@ -65,14 +65,15 @@ private:
Base *m_base;
char m_id[32]{};
String m_workerId;
const uint64_t m_timestamp;
Httpd *m_httpd = nullptr;
Httpd *m_httpd = nullptr;
std::vector<IApiListener *> m_listeners;
String m_workerId;
uint8_t m_ticks = 0;
};
} // namespace xmrig
#endif /* XMRIG_API_H */
#endif // XMRIG_API_H

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -22,11 +22,6 @@
#include "base/kernel/interfaces/IBaseListener.h"
#include "base/net/http/HttpListener.h"
#include "base/tools/Object.h"
#include <cstdint>
#include <memory>
namespace xmrig {
@@ -43,9 +38,11 @@ class Httpd : public IBaseListener, public IHttpListener
public:
XMRIG_DISABLE_COPY_MOVE_DEFAULT(Httpd)
Httpd(Base *base);
explicit Httpd(Base *base);
~Httpd() override;
inline bool isBound() const { return m_server != nullptr; }
bool start();
void stop();
@@ -69,7 +66,7 @@ private:
};
} /* namespace xmrig */
} // namespace xmrig
#endif /* XMRIG_HTTPD_H */
#endif // XMRIG_HTTPD_H

View File

@@ -53,6 +53,8 @@ static const CoinInfo coinInfo[] = {
{ 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::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 ") },
{ Algorithm::RX_0, "Townforge","Townforge", 30, 100000000, MAGENTA_BG_BOLD(WHITE_BOLD_S " townforge ") },
};

View File

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

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/kernel/Platform.h"
@@ -42,9 +41,12 @@ void xmrig::Platform::init(const char *userAgent)
# ifdef XMRIG_FEATURE_TLS
SSL_library_init();
SSL_load_error_strings();
# if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
ERR_load_BIO_strings();
ERR_load_crypto_strings();
SSL_load_error_strings();
# endif
OpenSSL_add_all_digests();
# endif

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -49,6 +49,12 @@ public:
static inline bool isUserActive(uint64_t ms) { return idleTime() < ms; }
static inline const String &userAgent() { return m_userAgent; }
# ifdef XMRIG_OS_WIN
static bool hasKeepalive();
# else
static constexpr bool hasKeepalive() { return true; }
# endif
static bool isOnBatteryPower();
static uint64_t idleTime();

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -16,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/kernel/Platform.h"
#include "backend/cpu/platform/HwlocCpuInfo.h"
#include "backend/cpu/Cpu.h"
@@ -29,20 +27,21 @@
#ifndef XMRIG_OS_APPLE
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{
auto cpu = static_cast<HwlocCpuInfo *>(Cpu::info());
hwloc_obj_t pu = hwloc_get_pu_obj_by_os_index(cpu->topology(), static_cast<unsigned>(cpu_id));
auto topology = Cpu::info()->topology();
auto pu = hwloc_get_pu_obj_by_os_index(topology, static_cast<unsigned>(cpu_id));
if (pu == nullptr) {
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));
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));
return result;
}
#endif

View File

@@ -16,10 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __FreeBSD__
#ifdef XMRIG_OS_FREEBSD
# include <sys/types.h>
# include <sys/param.h>
# include <sys/cpuset.h>
# ifndef __DragonFly__
# include <sys/cpuset.h>
# endif
# include <pthread_np.h>
#endif
@@ -41,11 +43,6 @@
#include "version.h"
#ifdef __FreeBSD__
typedef cpuset_t cpu_set_t;
#endif
char *xmrig::Platform::createUserAgent()
{
constexpr const size_t max = 256;
@@ -74,6 +71,19 @@ char *xmrig::Platform::createUserAgent()
#ifndef XMRIG_FEATURE_HWLOC
#ifdef __DragonFly__
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{
return true;
}
#else
#ifdef XMRIG_OS_FREEBSD
typedef cpuset_t cpu_set_t;
#endif
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{
cpu_set_t mn;
@@ -89,7 +99,9 @@ bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
std::this_thread::sleep_for(std::chrono::milliseconds(1));
return result;
}
#endif
#endif // __DragonFly__
#endif // XMRIG_FEATURE_HWLOC
void xmrig::Platform::setProcessPriority(int)

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <algorithm>
#include <winsock2.h>
#include <windows.h>
@@ -70,6 +69,12 @@ char *xmrig::Platform::createUserAgent()
}
bool xmrig::Platform::hasKeepalive()
{
return winOsVersion().dwMajorVersion >= 6;
}
#ifndef XMRIG_FEATURE_HWLOC
bool xmrig::Platform::setThreadAffinity(uint64_t cpu_id)
{

View File

@@ -142,7 +142,7 @@ void xmrig::BaseConfig::printVersions()
snprintf(buf, sizeof buf, "MSVC/%d", MSVC_VERSION);
# endif
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%s/%s") WHITE_BOLD(" %s"), "ABOUT", APP_NAME, APP_VERSION, buf);
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%s/%s") WHITE_BOLD(" %s") WHITE_BOLD(" (built for %s") WHITE_BOLD(" %s,") WHITE_BOLD(" %s)"), "ABOUT", APP_NAME, APP_VERSION, buf, APP_OS, APP_ARCH, APP_BITS);
std::string libs;

View File

@@ -247,6 +247,7 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch
case IConfig::HttpPort: /* --http-port */
case IConfig::DonateLevelKey: /* --donate-level */
case IConfig::DaemonPollKey: /* --daemon-poll-interval */
case IConfig::DaemonJobTimeoutKey: /* --daemon-job-timeout */
case IConfig::DnsTtlKey: /* --dns-ttl */
case IConfig::DaemonZMQPortKey: /* --daemon-zmq-port */
return transformUint64(doc, key, static_cast<uint64_t>(strtol(arg, nullptr, 10)));
@@ -360,6 +361,9 @@ void xmrig::BaseTransform::transformUint64(rapidjson::Document &doc, int key, ui
case IConfig::DaemonPollKey: /* --daemon-poll-interval */
return add(doc, Pools::kPools, Pool::kDaemonPollInterval, arg);
case IConfig::DaemonJobTimeoutKey: /* --daemon-job-timeout */
return add(doc, Pools::kPools, Pool::kDaemonJobTimeout, arg);
case IConfig::DaemonZMQPortKey: /* --daemon-zmq-port */
return add(doc, Pools::kPools, Pool::kDaemonZMQPort, arg);
# endif

View File

@@ -88,6 +88,7 @@ public:
DaemonZMQPortKey = 1056,
HugePagesJitKey = 1057,
RotationKey = 1058,
DaemonJobTimeoutKey = 1059,
// xmrig common
CPUPriorityKey = 1021,

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -46,11 +46,11 @@ xmrig::String xmrig::DnsRecord::ip() const
if (m_type == AAAA) {
buf = new char[45]();
uv_ip6_name(reinterpret_cast<sockaddr_in6*>(m_data), buf, 45);
uv_ip6_name(reinterpret_cast<const sockaddr_in6*>(m_data), buf, 45);
}
else {
buf = new char[16]();
uv_ip4_name(reinterpret_cast<sockaddr_in*>(m_data), buf, 16);
uv_ip4_name(reinterpret_cast<const sockaddr_in*>(m_data), buf, 16);
}
return buf;

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -28,18 +28,19 @@
namespace xmrig {
static Storage<DnsUvBackend>* storage = nullptr;
Storage<DnsUvBackend>& DnsUvBackend::getStorage()
static Storage<DnsUvBackend> *storage = nullptr;
Storage<DnsUvBackend> &DnsUvBackend::getStorage()
{
if (storage == nullptr) storage = new Storage<DnsUvBackend>();
if (storage == nullptr) {
storage = new Storage<DnsUvBackend>();
}
return *storage;
}
void DnsUvBackend::releaseStorage()
{
delete storage;
}
static addrinfo hints{};
@@ -61,8 +62,14 @@ xmrig::DnsUvBackend::DnsUvBackend()
xmrig::DnsUvBackend::~DnsUvBackend()
{
getStorage().release(m_key);
releaseStorage();
assert(storage);
storage->release(m_key);
if (storage->isEmpty()) {
delete storage;
storage = nullptr;
}
}

View File

@@ -21,6 +21,7 @@
#define XMRIG_HTTPRESPONSE_H
#include <cstdint>
#include <map>
#include <string>

View File

@@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2019 jtgrassie <https://github.com/jtgrassie>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -42,13 +42,14 @@
#include "base/io/json/JsonRequest.h"
#include "base/io/log/Log.h"
#include "base/kernel/interfaces/IClientListener.h"
#include "base/kernel/Platform.h"
#include "base/net/dns/Dns.h"
#include "base/net/dns/DnsRecords.h"
#include "base/net/stratum/Socks5.h"
#include "base/net/tools/NetBuffer.h"
#include "base/tools/Chrono.h"
#include "base/tools/Cvt.h"
#include "base/tools/cryptonote/BlobReader.h"
#include "base/tools/Cvt.h"
#include "net/JobResult.h"
@@ -343,6 +344,9 @@ bool xmrig::Client::close()
setState(ClosingState);
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_socket)) == 0) {
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_socket, 0, 60);
}
uv_close(reinterpret_cast<uv_handle_t*>(m_socket), Client::onClose);
}
@@ -567,9 +571,9 @@ void xmrig::Client::connect(const sockaddr *addr)
uv_tcp_init(uv_default_loop(), m_socket);
uv_tcp_nodelay(m_socket, 1);
# ifndef WIN32
uv_tcp_keepalive(m_socket, 1, 60);
# endif
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_socket, 1, 60);
}
uv_tcp_connect(req, m_socket, addr, onConnect);
}
@@ -585,7 +589,7 @@ void xmrig::Client::handshake()
if (isTLS()) {
m_expire = Chrono::steadyMSecs() + kResponseTimeout;
m_tls->handshake();
m_tls->handshake(m_pool.isSNI() ? m_pool.host().data() : nullptr);
}
else
# endif
@@ -1018,7 +1022,7 @@ void xmrig::Client::onConnect(uv_connect_t *req, int status)
if (status < 0) {
if (!client->isQuiet()) {
LOG_ERR("%s " RED("connect error: ") RED_BOLD("\"%s\""), client->tag(), uv_strerror(status));
LOG_ERR("%s %s " RED("connect error: ") RED_BOLD("\"%s\""), client->tag(), client->ip().data(), uv_strerror(status));
}
if (client->state() == ReconnectingState || client->state() == ClosingState) {

View File

@@ -1,13 +1,13 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2019 Howard Chu <https://github.com/hyc>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright (c) 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright (c) 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright (c) 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright (c) 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright (c) 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright (c) 2019 Howard Chu <https://github.com/hyc>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -23,7 +23,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <uv.h>
@@ -34,6 +33,7 @@
#include "base/io/json/JsonRequest.h"
#include "base/io/log/Log.h"
#include "base/kernel/interfaces/IClientListener.h"
#include "base/kernel/Platform.h"
#include "base/net/dns/Dns.h"
#include "base/net/dns/DnsRecords.h"
#include "base/net/http/Fetch.h"
@@ -42,9 +42,9 @@
#include "base/net/stratum/SubmitResult.h"
#include "base/net/tools/NetBuffer.h"
#include "base/tools/bswap_64.h"
#include "base/tools/cryptonote/Signatures.h"
#include "base/tools/Cvt.h"
#include "base/tools/Timer.h"
#include "base/tools/cryptonote/Signatures.h"
#include "net/JobResult.h"
@@ -148,6 +148,11 @@ int64_t xmrig::DaemonClient::submit(const JobResult &result)
memcpy(data + sig_offset * 2, result.sig, 64 * 2);
memcpy(data + m_blocktemplate.offset(BlockTemplate::TX_PUBKEY_OFFSET) * 2, result.sig_data, 32 * 2);
memcpy(data + m_blocktemplate.offset(BlockTemplate::EPH_PUBLIC_KEY_OFFSET) * 2, result.sig_data + 32 * 2, 32 * 2);
// Handle view tag for txout_to_tagged_key outputs
if (m_blocktemplate.outputType() == 3) {
Cvt::toHex(data + m_blocktemplate.offset(BlockTemplate::EPH_PUBLIC_KEY_OFFSET) * 2 + 32 * 2, 2, &result.view_tag, 1);
}
}
if (result.extra_nonce >= 0) {
@@ -178,7 +183,10 @@ int64_t xmrig::DaemonClient::submit(const JobResult &result)
m_results[m_sequence] = SubmitResult(m_sequence, result.diff, result.actualDiff(), 0, result.backend);
# endif
return rpcSend(doc);
std::map<std::string, std::string> headers;
headers.insert({"X-Hash-Difficulty", std::to_string(result.actualDiff())});
return rpcSend(doc, headers);
}
@@ -303,6 +311,18 @@ void xmrig::DaemonClient::onHttpData(const HttpData &data)
void xmrig::DaemonClient::onTimer(const Timer *)
{
if (m_pool.zmq_port() >= 0) {
m_prevHash = nullptr;
m_blocktemplateRequestHash = nullptr;
send(kGetHeight);
return;
}
if (Chrono::steadyMSecs() >= m_jobSteadyMs + m_pool.jobTimeout()) {
m_prevHash = nullptr;
m_blocktemplateRequestHash = nullptr;
}
if (m_state == ConnectingState) {
connect();
}
@@ -338,9 +358,9 @@ void xmrig::DaemonClient::onResolved(const DnsRecords &records, int status, cons
uv_tcp_init(uv_default_loop(), s);
uv_tcp_nodelay(s, 1);
# ifndef WIN32
uv_tcp_keepalive(s, 1, 60);
# endif
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(s, 1, 60);
}
if (m_pool.zmq_port() > 0) {
delete m_ZMQSocket;
@@ -352,7 +372,7 @@ void xmrig::DaemonClient::onResolved(const DnsRecords &records, int status, cons
bool xmrig::DaemonClient::isOutdated(uint64_t height, const char *hash) const
{
return m_job.height() != height || m_prevHash != hash;
return m_job.height() != height || m_prevHash != hash || Chrono::steadyMSecs() >= m_jobSteadyMs + m_pool.jobTimeout();
}
@@ -389,7 +409,8 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
m_blocktemplate.offset(BlockTemplate::TX_PUBKEY_OFFSET) - k,
m_blocktemplate.offset(BlockTemplate::TX_EXTRA_NONCE_OFFSET) - k,
m_blocktemplate.txExtraNonce().size(),
m_blocktemplate.minerTxMerkleTreeBranch()
m_blocktemplate.minerTxMerkleTreeBranch(),
m_blocktemplate.outputType() == 3
);
# endif
@@ -426,7 +447,7 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
}
uint8_t derivation[32];
if (!generate_key_derivation(m_blocktemplate.blob(BlockTemplate::TX_PUBKEY_OFFSET), secret_viewkey, derivation)) {
if (!generate_key_derivation(m_blocktemplate.blob(BlockTemplate::TX_PUBKEY_OFFSET), secret_viewkey, derivation, nullptr)) {
return jobError("Failed to generate key derivation for miner signature.");
}
@@ -468,6 +489,7 @@ bool xmrig::DaemonClient::parseJob(const rapidjson::Value &params, int *code)
m_job = std::move(job);
m_blocktemplateStr = std::move(blocktemplate);
m_prevHash = Json::getString(params, "prev_hash");
m_jobSteadyMs = Chrono::steadyMSecs();
if (m_state == ConnectingState) {
setState(ConnectedState);
@@ -540,9 +562,13 @@ int64_t xmrig::DaemonClient::getBlockTemplate()
}
int64_t xmrig::DaemonClient::rpcSend(const rapidjson::Document &doc)
int64_t xmrig::DaemonClient::rpcSend(const rapidjson::Document &doc, const std::map<std::string, std::string> &headers)
{
FetchRequest req(HTTP_POST, m_pool.host(), m_pool.port(), kJsonRPC, doc, m_pool.isTLS(), isQuiet());
for (const auto &header : headers) {
req.headers.insert(header);
}
fetch(tag(), std::move(req), m_httpListener);
return m_sequence++;
@@ -563,6 +589,9 @@ void xmrig::DaemonClient::retry()
}
if ((m_ZMQConnectionState != ZMQ_NOT_CONNECTED) && (m_ZMQConnectionState != ZMQ_DISCONNECTING)) {
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_ZMQSocket, 0, 60);
}
uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), onZMQClose);
}
@@ -596,6 +625,10 @@ void xmrig::DaemonClient::setState(SocketState state)
const uint64_t interval = std::max<uint64_t>(20, m_pool.pollInterval());
m_timer->start(interval, interval);
}
else {
const uint64_t t = m_pool.jobTimeout();
m_timer->start(t, t);
}
}
break;
@@ -865,7 +898,12 @@ void xmrig::DaemonClient::ZMQParse()
// Clear previous hash and check daemon height to guarantee that xmrig will call get_block_template RPC later
// We can't call get_block_template directly because daemon is not ready yet
m_prevHash = nullptr;
m_blocktemplateRequestHash = nullptr;
send(kGetHeight);
const uint64_t t = m_pool.jobTimeout();
m_timer->stop();
m_timer->start(t, t);
}
@@ -881,6 +919,9 @@ bool xmrig::DaemonClient::ZMQClose(bool shutdown)
m_ZMQConnectionState = ZMQ_DISCONNECTING;
if (uv_is_closing(reinterpret_cast<uv_handle_t*>(m_ZMQSocket)) == 0) {
if (Platform::hasKeepalive()) {
uv_tcp_keepalive(m_ZMQSocket, 0, 60);
}
uv_close(reinterpret_cast<uv_handle_t*>(m_ZMQSocket), shutdown ? onZMQShutdown : onZMQClose);
if (!shutdown) {
retry();

View File

@@ -86,7 +86,7 @@ private:
bool parseJob(const rapidjson::Value &params, int *code);
bool parseResponse(int64_t id, const rapidjson::Value &result, const rapidjson::Value &error);
int64_t getBlockTemplate();
int64_t rpcSend(const rapidjson::Document &doc);
int64_t rpcSend(const rapidjson::Document &doc, const std::map<std::string, std::string> &headers = {});
void retry();
void send(const char *path);
void setState(SocketState state);
@@ -104,6 +104,7 @@ private:
String m_blocktemplateStr;
String m_currentJobId;
String m_prevHash;
uint64_t m_jobSteadyMs = 0;
String m_tlsFingerprint;
String m_tlsVersion;
Timer *m_timer;

View File

@@ -245,6 +245,7 @@ void xmrig::Job::copy(const Job &other)
m_minerTxExtraNonceOffset = other.m_minerTxExtraNonceOffset;
m_minerTxExtraNonceSize = other.m_minerTxExtraNonceSize;
m_minerTxMerkleTreeBranch = other.m_minerTxMerkleTreeBranch;
m_hasViewTag = other.m_hasViewTag;
# else
memcpy(m_ephPublicKey, other.m_ephPublicKey, sizeof(m_ephPublicKey));
memcpy(m_ephSecretKey, other.m_ephSecretKey, sizeof(m_ephSecretKey));
@@ -300,6 +301,7 @@ void xmrig::Job::move(Job &&other)
m_minerTxExtraNonceOffset = other.m_minerTxExtraNonceOffset;
m_minerTxExtraNonceSize = other.m_minerTxExtraNonceSize;
m_minerTxMerkleTreeBranch = std::move(other.m_minerTxMerkleTreeBranch);
m_hasViewTag = other.m_hasViewTag;
# else
memcpy(m_ephPublicKey, other.m_ephPublicKey, sizeof(m_ephPublicKey));
memcpy(m_ephSecretKey, other.m_ephSecretKey, sizeof(m_ephSecretKey));
@@ -323,7 +325,7 @@ void xmrig::Job::setSpendSecretKey(const uint8_t *key)
}
void xmrig::Job::setMinerTx(const uint8_t *begin, const uint8_t *end, size_t minerTxEphPubKeyOffset, size_t minerTxPubKeyOffset, size_t minerTxExtraNonceOffset, size_t minerTxExtraNonceSize, const Buffer &minerTxMerkleTreeBranch)
void xmrig::Job::setMinerTx(const uint8_t *begin, const uint8_t *end, size_t minerTxEphPubKeyOffset, size_t minerTxPubKeyOffset, size_t minerTxExtraNonceOffset, size_t minerTxExtraNonceSize, const Buffer &minerTxMerkleTreeBranch, bool hasViewTag)
{
m_minerTxPrefix.assign(begin, end);
m_minerTxEphPubKeyOffset = minerTxEphPubKeyOffset;
@@ -331,6 +333,13 @@ void xmrig::Job::setMinerTx(const uint8_t *begin, const uint8_t *end, size_t min
m_minerTxExtraNonceOffset = minerTxExtraNonceOffset;
m_minerTxExtraNonceSize = minerTxExtraNonceSize;
m_minerTxMerkleTreeBranch = minerTxMerkleTreeBranch;
m_hasViewTag = hasViewTag;
}
void xmrig::Job::setViewTagInMinerTx(uint8_t view_tag)
{
memcpy(m_minerTxPrefix.data() + m_minerTxEphPubKeyOffset + 32, &view_tag, 1);
}
@@ -340,7 +349,7 @@ void xmrig::Job::setExtraNonceInMinerTx(uint32_t extra_nonce)
}
void xmrig::Job::generateSignatureData(String &signatureData) const
void xmrig::Job::generateSignatureData(String &signatureData, uint8_t& view_tag) const
{
uint8_t* eph_public_key = m_minerTxPrefix.data() + m_minerTxEphPubKeyOffset;
uint8_t* txkey_pub = m_minerTxPrefix.data() + m_minerTxPubKeyOffset;
@@ -351,14 +360,14 @@ void xmrig::Job::generateSignatureData(String &signatureData) const
uint8_t derivation[32];
generate_key_derivation(m_viewPublicKey, txkey_sec, derivation);
generate_key_derivation(m_viewPublicKey, txkey_sec, derivation, &view_tag);
derive_public_key(derivation, 0, m_spendPublicKey, eph_public_key);
uint8_t buf[32 * 3] = {};
memcpy(buf, txkey_pub, 32);
memcpy(buf + 32, eph_public_key, 32);
generate_key_derivation(txkey_pub, m_viewSecretKey, derivation);
generate_key_derivation(txkey_pub, m_viewSecretKey, derivation, nullptr);
derive_secret_key(derivation, 0, m_spendSecretKey, buf + 64);
signatureData = Cvt::toHex(buf, sizeof(buf));

View File

@@ -120,10 +120,13 @@ public:
# endif
# ifdef XMRIG_PROXY_PROJECT
inline bool hasViewTag() const { return m_hasViewTag; }
void setSpendSecretKey(const uint8_t* key);
void setMinerTx(const uint8_t* begin, const uint8_t* end, size_t minerTxEphPubKeyOffset, size_t minerTxPubKeyOffset, size_t minerTxExtraNonceOffset, size_t minerTxExtraNonceSize, const Buffer& minerTxMerkleTreeBranch);
void setMinerTx(const uint8_t* begin, const uint8_t* end, size_t minerTxEphPubKeyOffset, size_t minerTxPubKeyOffset, size_t minerTxExtraNonceOffset, size_t minerTxExtraNonceSize, const Buffer& minerTxMerkleTreeBranch, bool hasViewTag);
void setViewTagInMinerTx(uint8_t view_tag);
void setExtraNonceInMinerTx(uint32_t extra_nonce);
void generateSignatureData(String& signatureData) const;
void generateSignatureData(String& signatureData, uint8_t& view_tag) const;
void generateHashingBlob(String& blob) const;
# else
inline const uint8_t* ephSecretKey() const { return m_hasMinerSignature ? m_ephSecretKey : nullptr; }
@@ -178,6 +181,7 @@ private:
size_t m_minerTxExtraNonceOffset = 0;
size_t m_minerTxExtraNonceSize = 0;
Buffer m_minerTxMerkleTreeBranch;
bool m_hasViewTag = false;
# else
// Miner signatures
uint8_t m_ephPublicKey[32]{};

View File

@@ -65,6 +65,7 @@ const char *Pool::kAlgo = "algo";
const char *Pool::kCoin = "coin";
const char *Pool::kDaemon = "daemon";
const char *Pool::kDaemonPollInterval = "daemon-poll-interval";
const char *Pool::kDaemonJobTimeout = "daemon-job-timeout";
const char *Pool::kDaemonZMQPort = "daemon-zmq-port";
const char *Pool::kEnabled = "enabled";
const char *Pool::kFingerprint = "tls-fingerprint";
@@ -76,6 +77,7 @@ const char *Pool::kSelfSelect = "self-select";
const char *Pool::kSOCKS5 = "socks5";
const char *Pool::kSubmitToOrigin = "submit-to-origin";
const char *Pool::kTls = "tls";
const char *Pool::kSni = "sni";
const char *Pool::kUrl = "url";
const char *Pool::kUser = "user";
const char *Pool::kSpendSecretKey = "spend-secret-key";
@@ -88,6 +90,7 @@ const char *Pool::kNicehashHost = "nicehash.com";
xmrig::Pool::Pool(const char *url) :
m_flags(1 << FLAG_ENABLED),
m_pollInterval(kDefaultPollInterval),
m_jobTimeout(kDefaultJobTimeout),
m_url(url)
{
}
@@ -101,6 +104,7 @@ xmrig::Pool::Pool(const char *host, uint16_t port, const char *user, const char
m_user(user),
m_spendSecretKey(spendSecretKey),
m_pollInterval(kDefaultPollInterval),
m_jobTimeout(kDefaultJobTimeout),
m_url(host, port, tls)
{
m_flags.set(FLAG_NICEHASH, nicehash || strstr(host, kNicehashHost));
@@ -111,6 +115,7 @@ xmrig::Pool::Pool(const char *host, uint16_t port, const char *user, const char
xmrig::Pool::Pool(const rapidjson::Value &object) :
m_flags(1 << FLAG_ENABLED),
m_pollInterval(kDefaultPollInterval),
m_jobTimeout(kDefaultJobTimeout),
m_url(Json::getString(object, kUrl))
{
if (!m_url.isValid()) {
@@ -123,6 +128,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
m_rigId = Json::getString(object, kRigId);
m_fingerprint = Json::getString(object, kFingerprint);
m_pollInterval = Json::getUint64(object, kDaemonPollInterval, kDefaultPollInterval);
m_jobTimeout = Json::getUint64(object, kDaemonJobTimeout, kDefaultJobTimeout);
m_algorithm = Json::getString(object, kAlgo);
m_coin = Json::getString(object, kCoin);
m_daemon = Json::getString(object, kSelfSelect);
@@ -132,6 +138,7 @@ xmrig::Pool::Pool(const rapidjson::Value &object) :
m_flags.set(FLAG_ENABLED, Json::getBool(object, kEnabled, true));
m_flags.set(FLAG_NICEHASH, Json::getBool(object, kNicehash) || m_url.host().contains(kNicehashHost));
m_flags.set(FLAG_TLS, Json::getBool(object, kTls) || m_url.isTLS());
m_flags.set(FLAG_SNI, Json::getBool(object, kSni));
setKeepAlive(Json::getValue(object, kKeepalive));
@@ -207,6 +214,7 @@ bool xmrig::Pool::isEqual(const Pool &other) const
&& m_url == other.m_url
&& m_user == other.m_user
&& m_pollInterval == other.m_pollInterval
&& m_jobTimeout == other.m_jobTimeout
&& m_daemon == other.m_daemon
&& m_proxy == other.m_proxy
);
@@ -293,12 +301,14 @@ rapidjson::Value xmrig::Pool::toJSON(rapidjson::Document &doc) const
obj.AddMember(StringRef(kEnabled), m_flags.test(FLAG_ENABLED), allocator);
obj.AddMember(StringRef(kTls), isTLS(), allocator);
obj.AddMember(StringRef(kSni), isSNI(), allocator);
obj.AddMember(StringRef(kFingerprint), m_fingerprint.toJSON(), allocator);
obj.AddMember(StringRef(kDaemon), m_mode == MODE_DAEMON, allocator);
obj.AddMember(StringRef(kSOCKS5), m_proxy.toJSON(doc), allocator);
if (m_mode == MODE_DAEMON) {
obj.AddMember(StringRef(kDaemonPollInterval), m_pollInterval, allocator);
obj.AddMember(StringRef(kDaemonJobTimeout), m_jobTimeout, allocator);
obj.AddMember(StringRef(kDaemonZMQPort), m_zmqPort, allocator);
}
else {

View File

@@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2019 Howard Chu <https://github.com/hyc>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2024 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -59,6 +59,7 @@ public:
static const char *kCoin;
static const char *kDaemon;
static const char *kDaemonPollInterval;
static const char *kDaemonJobTimeout;
static const char *kEnabled;
static const char *kFingerprint;
static const char *kKeepalive;
@@ -69,15 +70,17 @@ public:
static const char *kSOCKS5;
static const char *kSubmitToOrigin;
static const char *kTls;
static const char *kSni;
static const char *kUrl;
static const char *kUser;
static const char* kSpendSecretKey;
static const char* kDaemonZMQPort;
static const char *kSpendSecretKey;
static const char *kDaemonZMQPort;
static const char *kNicehashHost;
constexpr static int kKeepAliveTimeout = 60;
constexpr static uint16_t kDefaultPort = 3333;
constexpr static uint64_t kDefaultPollInterval = 1000;
constexpr static uint64_t kDefaultJobTimeout = 15000;
Pool() = default;
Pool(const char *host, uint16_t port, const char *user, const char *password, const char* spendSecretKey, int keepAlive, bool nicehash, bool tls, Mode mode);
@@ -93,6 +96,7 @@ public:
inline bool isNicehash() const { return m_flags.test(FLAG_NICEHASH); }
inline bool isTLS() const { return m_flags.test(FLAG_TLS) || m_url.isTLS(); }
inline bool isSNI() const { return m_flags.test(FLAG_SNI); }
inline bool isValid() const { return m_url.isValid(); }
inline const Algorithm &algorithm() const { return m_algorithm; }
inline const Coin &coin() const { return m_coin; }
@@ -110,6 +114,7 @@ public:
inline uint16_t port() const { return m_url.port(); }
inline int zmq_port() const { return m_zmqPort; }
inline uint64_t pollInterval() const { return m_pollInterval; }
inline uint64_t jobTimeout() const { return m_jobTimeout; }
inline void setAlgo(const Algorithm &algorithm) { m_algorithm = algorithm; }
inline void setUrl(const char *url) { m_url = Url(url); }
inline void setPassword(const String &password) { m_password = password; }
@@ -135,6 +140,7 @@ private:
FLAG_ENABLED,
FLAG_NICEHASH,
FLAG_TLS,
FLAG_SNI,
FLAG_MAX
};
@@ -156,6 +162,7 @@ private:
String m_user;
String m_spendSecretKey;
uint64_t m_pollInterval = kDefaultPollInterval;
uint64_t m_jobTimeout = kDefaultJobTimeout;
Url m_daemon;
Url m_url;
int m_zmqPort = -1;

View File

@@ -60,7 +60,7 @@ xmrig::Client::Tls::~Tls()
}
bool xmrig::Client::Tls::handshake()
bool xmrig::Client::Tls::handshake(const char* servername)
{
m_ssl = SSL_new(m_ctx);
assert(m_ssl != nullptr);
@@ -69,6 +69,10 @@ bool xmrig::Client::Tls::handshake()
return false;
}
if (servername) {
SSL_set_tlsext_host_name(m_ssl, servername);
}
SSL_set_connect_state(m_ssl);
SSL_set_bio(m_ssl, m_read, m_write);
SSL_do_handshake(m_ssl);

View File

@@ -42,7 +42,7 @@ public:
Tls(Client *client);
~Tls();
bool handshake();
bool handshake(const char* servername);
bool send(const char *data, size_t size);
const char *fingerprint() const;
const char *version() const;

View File

@@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -45,6 +45,7 @@ namespace xmrig {
// https://wiki.openssl.org/index.php/Diffie-Hellman_parameters
#if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
static DH *get_dh2048()
{
static unsigned char dhp_2048[] = {
@@ -96,6 +97,8 @@ static DH *get_dh2048()
return dh;
}
#endif
} // namespace xmrig
@@ -191,6 +194,7 @@ bool xmrig::TlsContext::setCipherSuites(const char *ciphersuites)
bool xmrig::TlsContext::setDH(const char *dhparam)
{
# if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
DH *dh = nullptr;
if (dhparam != nullptr) {
@@ -225,6 +229,34 @@ bool xmrig::TlsContext::setDH(const char *dhparam)
return false;
}
# else
if (dhparam != nullptr) {
EVP_PKEY *dh = nullptr;
BIO *bio = BIO_new_file(Env::expand(dhparam), "r");
if (bio) {
dh = PEM_read_bio_Parameters(bio, nullptr);
BIO_free(bio);
}
if (!dh) {
LOG_ERR("PEM_read_bio_Parameters(\"%s\") failed.", dhparam);
return false;
}
if (SSL_CTX_set0_tmp_dh_pkey(m_ctx, dh) != 1) {
EVP_PKEY_free(dh);
LOG_ERR("SSL_CTX_set0_tmp_dh_pkey(\"%s\") failed.", dhparam);
return false;
}
}
else {
SSL_CTX_set_dh_auto(m_ctx, 1);
}
# endif
return true;
}

View File

@@ -1,7 +1,7 @@
/* XMRig
* Copyright (c) 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -24,9 +24,6 @@
#include "base/tools/Object.h"
#include <cstdint>
using SSL_CTX = struct ssl_ctx_st;
@@ -60,6 +57,7 @@ private:
};
} /* namespace xmrig */
} // namespace xmrig
#endif /* XMRIG_TLSCONTEXT_H */
#endif // XMRIG_TLSCONTEXT_H

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -33,6 +33,7 @@ static const char *kLocalhost = "localhost";
static EVP_PKEY *generate_pkey()
{
# if OPENSSL_VERSION_NUMBER < 0x30000000L || defined(LIBRESSL_VERSION_NUMBER)
auto pkey = EVP_PKEY_new();
if (!pkey) {
return nullptr;
@@ -53,6 +54,9 @@ static EVP_PKEY *generate_pkey()
BN_free(exponent);
return pkey;
# else
return EVP_RSA_gen(2048);
# endif
}

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -55,7 +55,7 @@ private:
};
} /* namespace xmrig */
} // namespace xmrig
#endif /* XMRIG_TLSGEN_H */
#endif // XMRIG_TLSGEN_H

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -42,7 +42,7 @@ public:
}
inline void *ptr(uintptr_t id) { return reinterpret_cast<void *>(id); }
inline TYPE *ptr(uintptr_t id) { return reinterpret_cast<TYPE *>(id); }
inline TYPE *get(const void *id) const { return get(reinterpret_cast<uintptr_t>(id)); }
@@ -56,6 +56,9 @@ public:
return m_data.at(id);
}
inline bool isEmpty() const { return m_data.empty(); }
inline size_t size() const { return m_data.size(); }
inline void remove(const void *id) { delete release(reinterpret_cast<uintptr_t>(id)); }
inline void remove(uintptr_t id) { delete release(id); }

View File

@@ -1,6 +1,6 @@
/* XMRig
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -20,7 +20,9 @@
#define XMRIG_OBJECT_H
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <memory>
namespace xmrig {
@@ -41,6 +43,7 @@ namespace xmrig {
X &operator=(X &&other) = delete;
} /* namespace xmrig */
} // namespace xmrig
#endif /* XMRIG_OBJECT_H */
#endif // XMRIG_OBJECT_H

View File

@@ -1,8 +1,8 @@
/* XMRig
* Copyright (c) 2012-2013 The Cryptonote developers
* Copyright (c) 2014-2021 The Monero Project
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2023 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2023 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* 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
@@ -197,12 +197,21 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_vote);
}
if (m_coin == Coin::ZEPHYR) {
uint8_t pricing_record[120];
ar(pricing_record);
}
// Miner transaction begin
// Prefix begin
setOffset(MINER_TX_PREFIX_OFFSET, ar.index());
ar(m_txVersion);
ar(m_unlockTime);
if (m_coin != Coin::TOWNFORGE) {
ar(m_unlockTime);
}
ar(m_numInputs);
// must be 1 input
@@ -220,8 +229,12 @@ bool xmrig::BlockTemplate::parse(bool hashes)
ar(m_height);
ar(m_numOutputs);
// must be 1 output
if (m_numOutputs != 1) {
if (m_coin == Coin::ZEPHYR) {
if (m_numOutputs < 2) {
return false;
}
}
else if (m_numOutputs != 1) {
return false;
}
@@ -237,8 +250,42 @@ bool xmrig::BlockTemplate::parse(bool hashes)
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);
for (uint64_t k = 1; k < m_numOutputs; ++k) {
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);
}
if (m_coin == Coin::TOWNFORGE) {
ar(m_unlockTime);
}
ar(m_extraSize);
@@ -248,6 +295,8 @@ bool xmrig::BlockTemplate::parse(bool hashes)
BlobReader<true> ar_extra(blob(TX_EXTRA_OFFSET), m_extraSize);
ar.skip(m_extraSize);
bool pubkey_offset_first = true;
while (ar_extra.index() < m_extraSize) {
uint64_t extra_tag = 0;
uint64_t size = 0;
@@ -256,7 +305,10 @@ bool xmrig::BlockTemplate::parse(bool hashes)
switch (extra_tag) {
case 0x01: // TX_EXTRA_TAG_PUBKEY
setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
if (pubkey_offset_first) {
pubkey_offset_first = false;
setOffset(TX_PUBKEY_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
}
ar_extra.skip(kKeySize);
break;
@@ -269,7 +321,7 @@ bool xmrig::BlockTemplate::parse(bool hashes)
case 0x03: // TX_EXTRA_MERGE_MINING_TAG
ar_extra(size);
setOffset(TX_EXTRA_MERGE_MINING_TAG_OFFSET, offset(TX_EXTRA_OFFSET) + ar_extra.index());
ar_extra(m_txMergeMiningTag, size + kKeySize);
ar_extra(m_txMergeMiningTag, size);
break;
default:
@@ -277,6 +329,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());
// Prefix end
@@ -284,6 +343,11 @@ bool xmrig::BlockTemplate::parse(bool hashes)
uint8_t vin_rct_type = 0;
ar(vin_rct_type);
// no way I'm parsing a full game update here
if (m_coin == Coin::TOWNFORGE && m_height % 720 == 0) {
return true;
}
// must be RCTTypeNull (0)
if (vin_rct_type != 0) {
return false;

Some files were not shown because too many files have changed in this diff Show More