Linux/Proton on an 8-core Zen 2: thread placement is a no-op under Wine, guards cost ~20 µs each, a title thread spins on SwitchToThread #2719

Open
opened 2026-11-29 16:37:53 +00:00 by github-bot · 4 comments
Owner

@⁠Aiken-Project-A on GitHub · 2026-11-29 16:33 UTC · original

Setup: RTX 2060 6 GB (Turing), NVIDIA 615.78.08, Ryzen 9 4900H (8 cores / 16 threads, two 4-core CCX with 4 MB L3 each, the same layout as the console's CPU), 64 GB, Linux 7.2, Wine 11 (Proton branch, 7b3ceaf8) with the wineserver view-tree patch, vkd3d-proton master 71cae091, main 829188e9, VICTORY_WAVE_FOLDED=0, Series S, DLSS quality. Linux only, so there is no %LOCALAPPDATA%; log lines are at the end, and full play logs (12 MB each) on request.

Two scenes per run, both from a new game:

  • The café is the opening diner cutscene, where Lucia asks for another glass of water with ice. It is CPU-bound: preparing 57–90 ms, the CPU waits 3–8 ms for the card. Its numbers are the frame lines from the first one with 1,000+ draws until the cell, about 70 s.
  • The window is the prison cell right after the cutscenes: Lucia at the window, the camera still until the player moves. Frame 85–95 ms, card ~90 % busy. Its numbers are 60 s of frame lines after 30 s to settle.

1. Thread placement does nothing under Wine; VICTORY_TITLE_AFFINITY=free helps here

SetThreadSelectedCpuSets and SetProcessDefaultCpuSets are stubs in Wine (dlls/kernelbase/memory.c: FIXME, return TRUE), so none of the placement in cores.rs happens under Proton. The title's own affinities do apply (SetThreadGroupAffinity works): 8 workers at HIGHEST on 0–7, 11 threads on 8–12, one TIME_CRITICAL thread alone on 13. VIctory's ~40 threads float over all 16 CPUs and land on the same ones. Per-thread schedstat over 20 s at the window:

default (fast) free
the 8 workers on 0–7: share of runnable time spent waiting for a CPU 47 % 35–42 %
the TIME_CRITICAL thread (alone on 13 by default) 24 % 8 %
whole process: on CPU / share waiting for a CPU 7.9 cores / 42 % 8.6 cores / 37 %
window frame, median over runs 92.9 ms (4 runs) 88.4 ms (7 runs)

The café is too noisy from run to run to show it (86–111 ms either way).

2. A guard costs ~20 µs on Linux, and the guards' lock is held across it

Making a block (64 KiB) read-only is an mprotect that has to shoot down the TLB on every CPU the process runs on, 16 here (Zen 2 has no INVLPGB). perf trace: 7,000–12,000 mprotect a second, 17–23 µs on average, worst 18 ms. Diagnostics build, per frame, all threads (the "asking about title memory" line):

64 KiB blocks made read-only waiting for the guards changing protections write-watch askings
café 640–690 80–107 ms 62–77 ms 216 (17–20 ms)
window 245–320 21–33 ms 41–65 ms 216 (9–12 ms)

As #2519 found, these waits are mostly parallel and off the critical path: the timeline chain has 1.6–5 ms of VirtualProtect and 1–1.5 ms of faults a frame. VICTORY_GUARD_HOT=200 and =1000 cut the protection changes (window: 41–65 → 32 and 8 ms) but copied up to twice as much (café: ~50 → 100 MB a frame), and the frame did not move. On an 8-core machine the cost is the cores it takes from the title's workers (item 7 of #2415).

3. A title thread spins on SwitchToThread, and Wine makes every yield three system calls

One title thread calls SwitchToThread ~68,000 times a second, in a wait loop. Wine's NtYieldExecution wraps sched_yield() in two getrusage(RUSAGE_THREAD) calls to tell whether a switch happened: 136,000 extra system calls a second. Time a title thread spends in such a loop shows on the timeline chain as "outside our spans", the same as the title's real work. A Wine build with a single sched_yield (switch told by the elapsed time) and with NtGetWriteWatch not holding virtual_mutex across the PAGEMAP_SCAN ran fine in game, but moved neither the frame nor the guard numbers.

4. No effect here

VICTORY_NARROW_BARRIERS=1: 94 against 93 ms at the window, picture intact.

Log lines

The window, default (VICTORY_TITLE_AFFINITY unset):

2026-11-29T15:03:22.186187Z  INFO victory_gpu::host: 9.7 fps, 103.5 ms/frame (61.3 preparing: copies 30.7 ms 26.6 MB, textures 4.4 ms 16.2 MB; 7.4 on the GPU; 30.6 copying back 0.7 MB), 4896 draws/frame
2026-11-29T15:03:27.463734Z  INFO victory_gpu::host: 12.1 fps, 82.6 ms/frame (36.1 preparing: copies 18.2 ms 26.3 MB, textures 1.8 ms 15.3 MB; 14.2 on the GPU; 21.9 copying back 0.7 MB), 4445 draws/frame
2026-11-29T15:03:32.788265Z  INFO victory_gpu::host: 11.3 fps, 88.5 ms/frame (43.9 preparing: copies 19.9 ms 24.9 MB, textures 2.2 ms 15.8 MB; 8.3 on the GPU; 41.5 copying back 0.6 MB), 4077 draws/frame

The window, VICTORY_TITLE_AFFINITY=free, the same binary:

2026-11-29T15:07:15.652084Z  INFO victory_gpu::host: 13.1 fps, 76.5 ms/frame (37.7 preparing: copies 19.3 ms 28.0 MB, textures 1.8 ms 15.1 MB; 5.9 on the GPU; 20.6 copying back 0.7 MB), 4406 draws/frame
2026-11-29T15:07:20.775230Z  INFO victory_gpu::host: 11.4 fps, 87.5 ms/frame (43.0 preparing: copies 23.0 ms 27.4 MB, textures 3.4 ms 22.1 MB; 11.9 on the GPU; 22.9 copying back 0.7 MB), 4858 draws/frame
2026-11-29T15:07:26.214751Z  INFO victory_gpu::host: 13.1 fps, 76.3 ms/frame (33.4 preparing: copies 17.2 ms 25.8 MB, textures 1.6 ms 14.0 MB; 8.3 on the GPU; 20.3 copying back 0.7 MB), 4160 draws/frame

The café, diagnostics build, the guards' line (cut after "changing protections"; the "holes" and "view ranges" parts left out):

2026-11-29T16:06:13.697065Z  INFO victory_gpu::host: asking about title memory per frame, all threads: 226 kernel askings over 1019 MB (36.9 ms, 1679 pages of 4 KiB found written, 270 askings refused); 843 blocks made read-only, 0 opened by ourselves; 179.8 ms waiting for the guards, 59.2 ms changing protections
2026-11-29T16:06:14.778998Z  INFO victory_gpu::host: asking about title memory per frame, all threads: 217 kernel askings over 1004 MB (35.1 ms, 1604 pages of 4 KiB found written, 252 askings refused); 957 blocks made read-only, 28 opened by ourselves; 133.6 ms waiting for the guards, 69.3 ms changing protections

Full play logs, timelines and per-thread snapshots on request.

**@⁠Aiken-Project-A** on GitHub · 2026-11-29 16:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2719) **Setup:** RTX 2060 6 GB (Turing), NVIDIA 615.78.08, Ryzen 9 4900H (8 cores / 16 threads, two 4-core CCX with 4 MB L3 each, the same layout as the console's CPU), 64 GB, Linux 7.2, Wine 11 (Proton branch, `7b3ceaf8`) with the wineserver view-tree patch, vkd3d-proton master `71cae091`, main `829188e9`, `VICTORY_WAVE_FOLDED=0`, Series S, DLSS quality. Linux only, so there is no `%LOCALAPPDATA%`; log lines are at the end, and full play logs (12 MB each) on request. Two scenes per run, both from a new game: - **The café** is the opening diner cutscene, where Lucia asks for another glass of water with ice. It is CPU-bound: preparing 57–90 ms, the CPU waits 3–8 ms for the card. Its numbers are the frame lines from the first one with 1,000+ draws until the cell, about 70 s. - **The window** is the prison cell right after the cutscenes: Lucia at the window, the camera still until the player moves. Frame 85–95 ms, card ~90 % busy. Its numbers are 60 s of frame lines after 30 s to settle. ### 1. Thread placement does nothing under Wine; `VICTORY_TITLE_AFFINITY=free` helps here `SetThreadSelectedCpuSets` and `SetProcessDefaultCpuSets` are stubs in Wine (`dlls/kernelbase/memory.c`: FIXME, return TRUE), so none of the placement in `cores.rs` happens under Proton. The title's own affinities do apply (`SetThreadGroupAffinity` works): 8 workers at HIGHEST on 0–7, 11 threads on 8–12, one TIME_CRITICAL thread alone on 13. VIctory's ~40 threads float over all 16 CPUs and land on the same ones. Per-thread schedstat over 20 s at the window: | | default (`fast`) | `free` | |---|---|---| | the 8 workers on 0–7: share of runnable time spent waiting for a CPU | 47 % | 35–42 % | | the TIME_CRITICAL thread (alone on 13 by default) | 24 % | 8 % | | whole process: on CPU / share waiting for a CPU | 7.9 cores / 42 % | 8.6 cores / 37 % | | window frame, median over runs | 92.9 ms (4 runs) | 88.4 ms (7 runs) | The café is too noisy from run to run to show it (86–111 ms either way). ### 2. A guard costs ~20 µs on Linux, and the guards' lock is held across it Making a block (64 KiB) read-only is an `mprotect` that has to shoot down the TLB on every CPU the process runs on, 16 here (Zen 2 has no INVLPGB). `perf trace`: 7,000–12,000 `mprotect` a second, 17–23 µs on average, worst 18 ms. Diagnostics build, per frame, all threads (the "asking about title memory" line): | | 64 KiB blocks made read-only | waiting for the guards | changing protections | write-watch askings | |---|---|---|---|---| | café | 640–690 | 80–107 ms | 62–77 ms | 216 (17–20 ms) | | window | 245–320 | 21–33 ms | 41–65 ms | 216 (9–12 ms) | As #2519 found, these waits are mostly parallel and off the critical path: the timeline chain has 1.6–5 ms of `VirtualProtect` and 1–1.5 ms of faults a frame. `VICTORY_GUARD_HOT=200` and `=1000` cut the protection changes (window: 41–65 → 32 and 8 ms) but copied up to twice as much (café: ~50 → 100 MB a frame), and the frame did not move. On an 8-core machine the cost is the cores it takes from the title's workers (item 7 of #2415). ### 3. A title thread spins on `SwitchToThread`, and Wine makes every yield three system calls One title thread calls `SwitchToThread` ~68,000 times a second, in a wait loop. Wine's `NtYieldExecution` wraps `sched_yield()` in two `getrusage(RUSAGE_THREAD)` calls to tell whether a switch happened: 136,000 extra system calls a second. Time a title thread spends in such a loop shows on the timeline chain as "outside our spans", the same as the title's real work. A Wine build with a single `sched_yield` (switch told by the elapsed time) and with `NtGetWriteWatch` not holding `virtual_mutex` across the `PAGEMAP_SCAN` ran fine in game, but moved neither the frame nor the guard numbers. ### 4. No effect here `VICTORY_NARROW_BARRIERS=1`: 94 against 93 ms at the window, picture intact. <details><summary>Log lines</summary> The window, default (`VICTORY_TITLE_AFFINITY` unset): ``` 2026-11-29T15:03:22.186187Z INFO victory_gpu::host: 9.7 fps, 103.5 ms/frame (61.3 preparing: copies 30.7 ms 26.6 MB, textures 4.4 ms 16.2 MB; 7.4 on the GPU; 30.6 copying back 0.7 MB), 4896 draws/frame 2026-11-29T15:03:27.463734Z INFO victory_gpu::host: 12.1 fps, 82.6 ms/frame (36.1 preparing: copies 18.2 ms 26.3 MB, textures 1.8 ms 15.3 MB; 14.2 on the GPU; 21.9 copying back 0.7 MB), 4445 draws/frame 2026-11-29T15:03:32.788265Z INFO victory_gpu::host: 11.3 fps, 88.5 ms/frame (43.9 preparing: copies 19.9 ms 24.9 MB, textures 2.2 ms 15.8 MB; 8.3 on the GPU; 41.5 copying back 0.6 MB), 4077 draws/frame ``` The window, `VICTORY_TITLE_AFFINITY=free`, the same binary: ``` 2026-11-29T15:07:15.652084Z INFO victory_gpu::host: 13.1 fps, 76.5 ms/frame (37.7 preparing: copies 19.3 ms 28.0 MB, textures 1.8 ms 15.1 MB; 5.9 on the GPU; 20.6 copying back 0.7 MB), 4406 draws/frame 2026-11-29T15:07:20.775230Z INFO victory_gpu::host: 11.4 fps, 87.5 ms/frame (43.0 preparing: copies 23.0 ms 27.4 MB, textures 3.4 ms 22.1 MB; 11.9 on the GPU; 22.9 copying back 0.7 MB), 4858 draws/frame 2026-11-29T15:07:26.214751Z INFO victory_gpu::host: 13.1 fps, 76.3 ms/frame (33.4 preparing: copies 17.2 ms 25.8 MB, textures 1.6 ms 14.0 MB; 8.3 on the GPU; 20.3 copying back 0.7 MB), 4160 draws/frame ``` The café, diagnostics build, the guards' line (cut after "changing protections"; the "holes" and "view ranges" parts left out): ``` 2026-11-29T16:06:13.697065Z INFO victory_gpu::host: asking about title memory per frame, all threads: 226 kernel askings over 1019 MB (36.9 ms, 1679 pages of 4 KiB found written, 270 askings refused); 843 blocks made read-only, 0 opened by ourselves; 179.8 ms waiting for the guards, 59.2 ms changing protections 2026-11-29T16:06:14.778998Z INFO victory_gpu::host: asking about title memory per frame, all threads: 217 kernel askings over 1004 MB (35.1 ms, 1604 pages of 4 KiB found written, 252 askings refused); 957 blocks made read-only, 28 opened by ourselves; 133.6 ms waiting for the guards, 69.3 ms changing protections ``` </details> Full play logs, timelines and per-thread snapshots on request.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 16:37:53 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-29 16:33 UTC · original

Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU, Windows version (10 or 11)

**@⁠github-actions[bot]** on GitHub · 2026-11-29 16:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2719#issuecomment-7258995523) Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU, Windows version (10 or 11)
Author
Owner

@⁠transbinaryunicorn-sys on GitHub · 2026-11-29 17:01 UTC · original · edited 2026-11-29 17:07 UTC

this was not measured with a cut scene it was ingame, but with the same scenary view going outside jason house standing on the porch looking to the sea and looking in the palms sea view around 20-23 fps palms around 16 with VICTORY_TITLE_AFFINITY=free

Data point from the other end of the scale: Xeon w7-3465X (28C/56T, Intel, single socket), RTX 5090, Linux (Nobara), driver 615.78.08, GE-Proton11-7 with view-tree wineserver, vkd3d-proton 71cae091, main 829188e9 (+ VICTORY_CODE_TABLE_AFTER=1, VICTORY_PATCH_SSE4A=0, see #1428), DLSS off. In-game after the prologue, standing still at the same spot, median of the last 2 min of ms/frame lines:

run ms/frame (median) guards (asking the write watch and the guards, median)
default 53.9 15.0 ms
VICTORY_TITLE_AFFINITY=free 49.9 (−7 %) 13.9 ms
taskset -c 0-15 (16 physical cores, no SMT) 75.8 (+41 %) 22.0 ms

So free helps here too, a bit more than on your 8-core. My guess was that fewer CPUs means cheaper TLB shootdowns per mprotect, but restricting the process to 16 cores made both the frame time and the guard time clearly worse. On this machine, contention for cores outweighs the shootdown cost; the title and VIctory's threads scale with the core count. GPU time is 0.5–1.4 ms/frame, so it's all CPU.

**@⁠transbinaryunicorn-sys** on GitHub · 2026-11-29 17:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2719#issuecomment-7259360453) · edited 2026-11-29 17:07 UTC this was not measured with a cut scene it was ingame, but with the same scenary view going outside jason house standing on the porch looking to the sea and looking in the palms sea view around 20-23 fps palms around 16 with VICTORY_TITLE_AFFINITY=free Data point from the other end of the scale: **Xeon w7-3465X (28C/56T, Intel, single socket), RTX 5090**, Linux (Nobara), driver 615.78.08, GE-Proton11-7 with view-tree wineserver, vkd3d-proton `71cae091`, main `829188e9` (+ `VICTORY_CODE_TABLE_AFTER=1`, `VICTORY_PATCH_SSE4A=0`, see #1428), DLSS off. In-game after the prologue, standing still at the same spot, median of the last 2 min of `ms/frame` lines: | run | ms/frame (median) | guards (`asking the write watch and the guards`, median) | |---|---|---| | default | 53.9 | 15.0 ms | | `VICTORY_TITLE_AFFINITY=free` | **49.9** (−7 %) | 13.9 ms | | `taskset -c 0-15` (16 physical cores, no SMT) | 75.8 (+41 %) | 22.0 ms | So `free` helps here too, a bit more than on your 8-core. My guess was that fewer CPUs means cheaper TLB shootdowns per `mprotect`, but restricting the process to 16 cores made both the frame time **and** the guard time clearly worse. On this machine, contention for cores outweighs the shootdown cost; the title and VIctory's threads scale with the core count. GPU time is 0.5–1.4 ms/frame, so it's all CPU.
Author
Owner

@⁠transbinaryunicorn-sys on GitHub · 2026-11-30 18:10 UTC · original

Follow-up from the 28-core side (Xeon w7-3465X 28C/56T, RTX 5090, Linux, current main after the 2026-11-30 merges + #4196). In-game, standing still, ~25 fps, ~40 ms/frame, GPU ~0 ms, so all CPU.

Where the frame goes (submitting thread, from the preparing per frame line): ~30 ms in submissions, of it 15–21 ms refreshes: ~10,000 a frame in ~42 flushes, ~90 % "known to copy nothing". The frame line's copies is 18–21 ms for 50–70 MB, i.e. a flat ~3 GB/s.

What I tried, and what didn't move it:

tried result
VICTORY_PATCH_SSE4A back on (with #4196, the SSE4a race fix) +~20 % (≈20 → 24–28 fps), the only real gain
VICTORY_RANGE_MEMO (on by default) "0 refreshes found to copy nothing" by the memo here
VICTORY_SOFT_VIEWS=0 no change (copies still ~3 GB/s)
VICTORY_WIDE_THREADS 8 (default cap) / 16 / 24 no change (copies 17–23 ms, ~3.0–3.2 GB/s)
VICTORY_LOG=warn logging is only ~160 lines/s in-game, not a cost
kernel/wineserver path not used (safecopy copies in-process)
PCIe / ReBAR Gen 5 x16 under load, BAR1 32 GB

So the copy throughput is flat at ~3 GB/s regardless of thread count, which points to something serial in the refresh path rather than to cores, Wine, or the bus. On this CPU more threads simply aren't the lever; the cost is in the ~10k refreshes per frame on the submitting thread, most of which end up copying nothing.

Side note: Streamline logs setDynamicMFGParams failed with status 1 about 50×/s with DLSS FG on (RTX 5090, SDK 2.14.16); harmless as far as I can tell, but it fails every frame.

Happy to run any build or switch on this machine.

**@⁠transbinaryunicorn-sys** on GitHub · 2026-11-30 18:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2719#issuecomment-7287463128) Follow-up from the 28-core side (Xeon w7-3465X 28C/56T, RTX 5090, Linux, current main after the 2026-11-30 merges + #4196). In-game, standing still, ~25 fps, ~40 ms/frame, GPU ~0 ms, so all CPU. **Where the frame goes** (submitting thread, from the `preparing per frame` line): ~30 ms in submissions, of it **15–21 ms refreshes**: ~10,000 a frame in ~42 flushes, **~90 % "known to copy nothing"**. The frame line's `copies` is 18–21 ms for 50–70 MB, i.e. a flat **~3 GB/s**. **What I tried, and what didn't move it:** | tried | result | |---|---| | `VICTORY_PATCH_SSE4A` back on (with #4196, the SSE4a race fix) | **+~20 %** (≈20 → 24–28 fps), the only real gain | | `VICTORY_RANGE_MEMO` (on by default) | "0 refreshes found to copy nothing" by the memo here | | `VICTORY_SOFT_VIEWS=0` | no change (copies still ~3 GB/s) | | `VICTORY_WIDE_THREADS` 8 (default cap) / 16 / 24 | no change (copies 17–23 ms, ~3.0–3.2 GB/s) | | `VICTORY_LOG=warn` | logging is only ~160 lines/s in-game, not a cost | | kernel/wineserver path | not used (`safecopy` copies in-process) | | PCIe / ReBAR | Gen 5 x16 under load, BAR1 32 GB | So the copy throughput is flat at ~3 GB/s **regardless of thread count**, which points to something serial in the refresh path rather than to cores, Wine, or the bus. On this CPU more threads simply aren't the lever; the cost is in the ~10k refreshes per frame on the submitting thread, most of which end up copying nothing. Side note: Streamline logs `setDynamicMFGParams failed with status 1` about 50×/s with DLSS FG on (RTX 5090, SDK 2.14.16); harmless as far as I can tell, but it fails every frame. Happy to run any build or switch on this machine.
Author
Owner

@⁠transbinaryunicorn-sys on GitHub · 2026-11-30 20:08 UTC · original

Linux/Wine: where the CPU time goes (RTX 5090, Xeon w7-3465X, GE-Proton11-7, ntsync)

TL;DR: the frame is not limited by copying bytes or by one busy thread. It waits on memory protection:
VIctory's guards on view memory (watch.rs) make hundreds of VirtualProtect calls and write faults
per frame, and Wine serializes all of them behind one process-wide lock. Windows pays part of this too.

1. perf (whole process, 30 s in play, ~25 fps)

  • No thread is saturated: the busiest title thread is at 78 %, victory-list-* at ~52 %, victory-submit at ~49 %.
    About 15 of 56 cores are busy, so threads are waiting, not computing.
  • The byte copying itself (victory_safe_copy_at) is only ~1-2 ms per frame. The "copies 20 ms" in the fps
    line is the wall time of the whole refresh phase (host.rs, "the time it took, not the threads' sum"),
    so the "~3 GB/s" derived from it is not a bandwidth limit.

2. VICTORY_TIMELINE (diagnostics build, 3 recordings × 4 frames)

per frame calls avg per call
VirtualProtect (almost all 64 KiB) 220-270 96-108 µs
write faults ("a fault looked at") 390-495 59-65 µs
GetWriteWatch 27-34 80-90 µs
  • VirtualProtect is the largest cause of our own on the frame's chain (2-3.3 ms on average, up to 8 ms in
    single frames) and the largest reason the card sits idle (~16 ms of idle time per frame).
  • About 2/3 of the VirtualProtect calls and nearly all faults run on the title's threads: guard → the title
    writes → fault → open → guarded again at the next refresh.

3. Micro-benchmark (VirtualProtect 64 KiB, and write fault + vectored handler, N threads in parallel)

threads Wine: VP Windows: VP Wine: fault Windows: fault
1 2.8 µs 0.9 µs 3.3 µs 2.6 µs
8 37.6 µs 22.0 µs 39.0 µs 9.4 µs
16 80.3 µs 40.8 µs 89.5 µs 21.0 µs

(Windows: Surface with Alder Lake, 12 threads; Wine: same Proton as the game.)

  • Under Wine the total throughput stays flat at ~200k operations/s whatever the thread count: one lock.
    8-16 threads give exactly the 60-100 µs seen in the game.
  • On Windows VirtualProtect contends as well (its throughput drops from 1.1M/s to 0.36M/s), but faults
    scale (up to 850k/s). Under Wine, faults are ~4× slower and they also slow down VirtualProtect.
  • GetWriteWatch costs the same on both.

4. VICTORY_GUARD_HOT=50 (A/B every 30 s, with VICTORY_FAULT_UNLOCKED=0)

  • Slower: 41.0-41.8 ms against 38.3-39.1 ms per frame (~104 against ~63 MB copied per frame).
  • Palms and hedges flicker or vanish in the phases with it on (and all the time when it is set fixed).
  • No crash without FAULT_UNLOCKED.
**@⁠transbinaryunicorn-sys** on GitHub · 2026-11-30 20:08 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2719#issuecomment-7290466335) ## Linux/Wine: where the CPU time goes (RTX 5090, Xeon w7-3465X, GE-Proton11-7, ntsync) TL;DR: the frame is not limited by copying bytes or by one busy thread. It waits on memory protection: VIctory's guards on view memory (`watch.rs`) make hundreds of `VirtualProtect` calls and write faults per frame, and Wine serializes all of them behind one process-wide lock. Windows pays part of this too. **1. perf (whole process, 30 s in play, ~25 fps)** - No thread is saturated: the busiest title thread is at 78 %, `victory-list-*` at ~52 %, `victory-submit` at ~49 %. About 15 of 56 cores are busy, so threads are waiting, not computing. - The byte copying itself (`victory_safe_copy_at`) is only ~1-2 ms per frame. The "copies 20 ms" in the fps line is the wall time of the whole refresh phase (`host.rs`, "the time it took, not the threads' sum"), so the "~3 GB/s" derived from it is not a bandwidth limit. **2. `VICTORY_TIMELINE` (diagnostics build, 3 recordings × 4 frames)** | per frame | calls | avg per call | |---|---|---| | `VirtualProtect` (almost all 64 KiB) | 220-270 | 96-108 µs | | write faults ("a fault looked at") | 390-495 | 59-65 µs | | `GetWriteWatch` | 27-34 | 80-90 µs | - `VirtualProtect` is the largest cause of our own on the frame's chain (2-3.3 ms on average, up to 8 ms in single frames) and the largest reason the card sits idle (~16 ms of idle time per frame). - About 2/3 of the `VirtualProtect` calls and nearly all faults run on the title's threads: guard → the title writes → fault → open → guarded again at the next refresh. **3. Micro-benchmark (`VirtualProtect` 64 KiB, and write fault + vectored handler, N threads in parallel)** | threads | Wine: VP | Windows: VP | Wine: fault | Windows: fault | |---|---|---|---|---| | 1 | 2.8 µs | 0.9 µs | 3.3 µs | 2.6 µs | | 8 | 37.6 µs | 22.0 µs | 39.0 µs | 9.4 µs | | 16 | 80.3 µs | 40.8 µs | 89.5 µs | 21.0 µs | (Windows: Surface with Alder Lake, 12 threads; Wine: same Proton as the game.) - Under Wine the total throughput stays flat at ~200k operations/s whatever the thread count: one lock. 8-16 threads give exactly the 60-100 µs seen in the game. - On Windows `VirtualProtect` contends as well (its throughput drops from 1.1M/s to 0.36M/s), but faults scale (up to 850k/s). Under Wine, faults are ~4× slower and they also slow down `VirtualProtect`. - `GetWriteWatch` costs the same on both. **4. `VICTORY_GUARD_HOT=50` (A/B every 30 s, with `VICTORY_FAULT_UNLOCKED=0`)** - Slower: 41.0-41.8 ms against 38.3-39.1 ms per frame (~104 against ~63 MB copied per frame). - Palms and hedges flicker or vanish in the phases with it on (and all the time when it is set fixed). - No crash without `FAULT_UNLOCKED`.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA#2719
No description provided.