http://bugs.winehq.org/show_bug.cgi?id=35587
--- Comment #24 from Riccardo c10ud.dev@gmail.com --- (In reply to Riccardo from comment #23)
(In reply to Riccardo from comment #22)
(In reply to Dmitry Timoshkov from comment #21)
(In reply to Riccardo from comment #20)
sample run:
- windows xp sp3:
Large read: 15 for 11128460 bytes - overlapped: 0 Small reads: 14500 for 11128460 bytes - overlapped (total: 2782115): 2782115
- wine 1.7.16 ubuntu 14.04 x64 kernel 3.13.0-24-generic:
Large read: 15 for 11128460 bytes - overlapped: 0 Small reads: 44849 for 11128460 bytes - overlapped (total: 2782115): 0
It would be interesting to compare this to a not overlapped case, which I suspect will show the same results.
Hello Dmitry, you're right, without FLAG_FILE_OVERLAPPED the results are more or less the same for both Windows and wine.
It looks like this issue is actually two different issues:
- Commenting out (or, actually, disabling for type=FD_TYPE_FILE)
send_completion in ntdll/file.c NtReadFile brings down my test case execution time from 55s to 5s in wine. See relevant line: if (send_completion) NTDLL_AddCompletion( hFile, cvalue, status, total );
- The fact that we're not doing overlapped IO locks the game UI for a while
during load
game load time:
- with send_completion: ~120s to load
- without send_completion: ~105s to load
I think the game issue is a mixture of those two: the game may crash for slow systems because it might remain "locked" for a while (no overlapped IO)..and it's even a bit slower than it should because of the NTDLL_AddCompletion call.
I tricked the game, in dlls/kernel32/file.c NtReadFile add:
if (status != STATUS_PENDING && bytesRead) { *bytesRead = io_status->Information; + if (cvalue) { + // http://support.microsoft.com/kb/156932?ln=en-us + // even if we did a sync read tell the client we didn't so it can process its events + SetLastError( RtlNtStatusToDosError(STATUS_PENDING) ); + return FALSE; + } }
this will cause the user to call GetOverlappedResult in order to get the data (and theoretically execute something in background meanwhile).
25532.065:trace:file:ReadFile 0xe4 0x33c5e8 4 0x33c440 0x3e11650 25532.065:trace:file:GetOverlappedResult (0xe4 0x3e11650 0x33c444 0)
as you can see from this snippet of a new trace the trick works.
However loading time or UI responsivity are not improved at all and I think the conclusion here is that this is not a bug in wine.
The game should really read more than 4 bytes per call...
As for the NTDLL_AddCompletion slowness, since I doubt anything is doing 2M calls for a single file, I wouldn't just mind about it.