https://bugs.winehq.org/show_bug.cgi?id=57224
Bug ID: 57224 Summary: Strange Behavior with >64 Processing Cores Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: atericparker@gmail.com Distribution: ---
Created attachment 77143 --> https://bugs.winehq.org/attachment.cgi?id=77143 Compiled Microsoft Sample code to test API
I've been spending the last few weeks trying to figre out why Photoshop crashes with >64 threads, unless one disables multithreading outright by deleting MultiProcessor Support.pbx (which is actually a dll).
After disassembling the pbx file, and debugging Photoshop with x64dbg (under wine) I determine that the crash occurs briefly after calling GetLogicalProcessorInformation from Kernel32.dll. The crash occurs after the return of the number of logical processors, so it's not the actual function crashing, just that it is returning a value that causes an issue.
I then proceeded to test the API with this sampel code (I attached a compiled version) https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi... , and compare the output across systems. On Windows (& wine <64 CPUs), the number of logical processors works as expected, as does cores.
When we cross the 64 CPU barrier, something strange happens (which I assume causes the crash). We get 65 cores and 64 threads, which is impossible, from stepping through the debugger, I confirm that Photoshop also gets a 65 count.
GetLogicalProcessorInformation results: Number of NUMA nodes: 1 Number of physical processor packages: 1 Number of processor cores: 65 Number of logical processors: 64 Number of processor L1/L2/L3 caches: 130/65/9
Any ideas what's going wrong here? I understand that wine doesn't support >64 threads, but it seems like an off by 1 error.
https://bugs.winehq.org/show_bug.cgi?id=57224
--- Comment #1 from EricParker atericparker@gmail.com --- From testing (have tested on my test script, but not on photoshop yet), adding this to prevent the 65th core from getting a relationprocessorcore fixes the 65 issue. This is probably suboptimal as the fact that it only goes to 65 implies there is a check somewhere higher up.
if (phys_core < 64) {
// by adding this if statement, the output now behaves identically to windows
if (!logical_proc_info_add_by_id( RelationProcessorCore, phys_core, thread_mask )) { fclose(fcpu_list); return STATUS_NO_MEMORY; } }
https://bugs.winehq.org/show_bug.cgi?id=57224
--- Comment #2 from EricParker atericparker@gmail.com --- Created attachment 77159 --> https://bugs.winehq.org/attachment.cgi?id=77159 Patch to fix Wine with >64 cores
Attached diffs for that patch.