http://bugs.winehq.org/show_bug.cgi?id=18745
Summary: Wine should support MEM_LARGE_PAGES and related interfaces for large pages & variable page sizes Product: Wine Version: 1.1.22 Platform: PC OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P3 Component: kernel32 AssignedTo: wine-bugs@winehq.org ReportedBy: trisk-winehq@forkgnu.org
The ability to allocate large pages can improve the performance of applications with densely populated address spaces. The large page interfaces on Windows were introduced in Windows Server 2003. However, due to limitations in the NT VM, large pages are always pinned in memory (not pageable) and become scarce due to excessive fragmentation. Wine has the advantage of running on platforms with better support for large pages.
Because the memory is normally pinned, the process must have SeLockMemoryPrivilege on Windows.
The new interfaces are: MEM_LARGE_PAGES type for VirtualAlloc (NtAllocateVirtualMemory) (http://msdn.microsoft.com/en-us/library/aa366720%28VS.85%29.aspx) SEC_LARGE_PAGES flag for http://msdn.microsoft.com/en-us/library/aa366543%28VS.85%29.aspx GetLargePageMinimum (http://msdn.microsoft.com/en-us/library/aa366568%28VS.85%29.aspx) /*********************************************************************** * GetLargePageMinimum (KERNEL32.@) * * Get the minimum size of a large page. * * RETURNS * Size: Success * 0: Failure */ SIZE_T WINAPI GetLargePageMinimum(void)
The allocated regions must be aligned to the minimum size and MEM_COMMIT must also be set, or NtAllocateVirtualMemory should return STATUS_INVALID_PARAMETER.
I'm opening this bug to keep notes for my own implementation, although anyone should feel free to jump in.
http://bugs.winehq.org/show_bug.cgi?id=18745
Albert Lee trisk-winehq@forkgnu.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |trisk-winehq@forkgnu.org
http://bugs.winehq.org/show_bug.cgi?id=18745
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|trisk-winehq@forkgnu.org | OS/Version|All |other
--- Comment #1 from Dmitry Timoshkov dmitry@codeweavers.com 2009-06-02 05:19:31 --- Is there an application that doesn't work due to this?
http://bugs.winehq.org/show_bug.cgi?id=18745
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|kernel32 |-unknown Alias|large-pages |
http://bugs.winehq.org/show_bug.cgi?id=18745
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID
--- Comment #2 from Dmitry Timoshkov dmitry@codeweavers.com 2009-06-02 22:36:57 --- Feel free to reopen this bug once there is an app that fails to run under Wine due to missing functionality.
http://bugs.winehq.org/show_bug.cgi?id=18745
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Dmitry Timoshkov dmitry@codeweavers.com 2009-06-02 22:37:10 --- Closing.
https://bugs.winehq.org/show_bug.cgi?id=18745
Rodrigo Belem rodrigo.belem@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rodrigo.belem@gmail.com
--- Comment #4 from Rodrigo Belem rodrigo.belem@gmail.com --- Mortal Kombat X seems to use that. My machine is running Wine 1.7.38 under Ubuntu 15.04 x86_64.
WINEARCH=win64 WINEPREFIX=/home/rodrigo/.local/share/wineprefixes/steam64 wine ~/.local/share/wineprefixes/steam/drive_c/Program\ Files\ (x86)/Steam/SteamApps/common/MK10/Binaries/Retail/MK10.exe fixme:heap:RtlSetHeapInformation 0x920000 0 0x60fcf0 4 stub err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution. wine: Call from 0x7fd480cf7498 to unimplemented function KERNEL32.dll.GetLargePageMinimum, aborting wine: Unimplemented function KERNEL32.dll.GetLargePageMinimum called at address 0x7fd480cf7498 (thread 0023), starting debugger...
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #5 from Rodrigo Belem rodrigo.belem@gmail.com --- Created attachment 51317 --> https://bugs.winehq.org/attachment.cgi?id=51317 MK10.exe backtrace
https://bugs.winehq.org/show_bug.cgi?id=18745
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
--- Comment #6 from Austin English austinenglish@gmail.com --- Created attachment 51320 --> https://bugs.winehq.org/attachment.cgi?id=51320 stub
Does this help?
https://bugs.winehq.org/show_bug.cgi?id=18745
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Wine should support |Mortal Kombat X needs |MEM_LARGE_PAGES and related |KERNEL32.dll.GetLargePageMi |interfaces for large pages |nimum |& variable page sizes |
https://bugs.winehq.org/show_bug.cgi?id=18745
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CLOSED |REOPENED Component|-unknown |kernel32 Resolution|INVALID |--- Ever confirmed|0 |1 OS|other |Linux
--- Comment #7 from Austin English austinenglish@gmail.com --- Reopening.
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #8 from Rodrigo Belem rodrigo.belem@gmail.com --- (In reply to Austin English from comment #6)
Created attachment 51320 [details] stub
Does this help?
It does not break, but it does not run.
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #9 from Rodrigo Belem rodrigo.belem@gmail.com --- Created attachment 51324 --> https://bugs.winehq.org/attachment.cgi?id=51324 patched wine output
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #10 from Austin English austinenglish@gmail.com --- (In reply to Rodrigo Belem from comment #9)
Created attachment 51324 [details] patched wine output
You're missing winbind.
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #11 from Rodrigo Belem rodrigo.belem@gmail.com --- Created attachment 51328 --> https://bugs.winehq.org/attachment.cgi?id=51328 output after get winbind installed
https://bugs.winehq.org/show_bug.cgi?id=18745
Dennis Haneklaus d.haneklaus@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |d.haneklaus@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #12 from Dennis Haneklaus d.haneklaus@gmail.com --- Any updates in sight?
https://bugs.winehq.org/show_bug.cgi?id=18745
Yuri Shishenko yurishish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |yurishish@gmail.com
--- Comment #13 from Yuri Shishenko yurishish@gmail.com --- Steam Store page says that DirectX 11 is required for this game. It wont run.
https://bugs.winehq.org/show_bug.cgi?id=18745
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #51320|0 |1 is obsolete| | Attachment #51324|0 |1 is obsolete| |
--- Comment #14 from Austin English austinenglish@gmail.com --- Created attachment 51501 --> https://bugs.winehq.org/attachment.cgi?id=51501 semi-stub
Does this get further?
https://bugs.winehq.org/show_bug.cgi?id=18745
Indrek efbiaiinzinz@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |efbiaiinzinz@hotmail.com
--- Comment #15 from Indrek efbiaiinzinz@hotmail.com --- After a bit of digging I found that Win LargePage seems to the equivalent of HugePage in linux and I also found special function gethugepagesizes http://linux.die.net/man/3/gethugepagesizes that could be used to get the available values (and thus find the minimum one), but I was unable to get it to compile correctly (needs changes to configure.ac ?) :(
https://bugs.winehq.org/show_bug.cgi?id=18745
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |win64 Status|REOPENED |NEW CC| |focht@gmx.net Summary|Mortal Kombat X needs |64-bit Mortal Kombat X |KERNEL32.dll.GetLargePageMi |crashes on unimplemented |nimum |function | |KERNEL32.dll.GetLargePageMi | |nimum
--- Comment #16 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming, still present.
--- snip --- ... Unhandled exception: unimplemented function KERNEL32.dll.GetLargePageMinimum called in 64-bit code (0x00007fa7dd6bca89). Register dump: rip:00007fa7dd6bca89 rsp:00000000005ff9d0 rbp:00000000005ffab0 eflags:00000202 ( - -- I - - - ) rax:00007fa7dd707dbc rbx:0000000000000000 rcx:00000000005ffa10 rdx:0000000140b88afa rsi:0000000142d4ba4c rdi:0000000142d4bf9a r8:0000000000000000 r9:0000000000000000 r10:0000000000000008 r11:0000000000000246 r12:000000007bf00d10 r13:00007ffce41dbb00 r14:0000000000000000 r15:0000000000000000 ... Backtrace: =>0 0x00007fa7dd6bca89 stub_entry_point+0x83(dll="KERNEL32.dll", name="GetLargePageMinimum", ret_addr=0x140b88afa) [/home/focht/projects/wine/wine.repo/src/dlls/ntdll/loader.c:207] in ntdll (0x00000000005ffab0) 1 0x0000000140b88afa in mk10 (+0xb88af9) (0x00000000005ffca0) 2 0x0000000140b7f800 in mk10 (+0xb7f7ff) (0x00000000005ffca0) 3 0x0000000140392d56 in mk10 (+0x392d55) (0x00000000005ffca0) 4 0x00000001422b45be in mk10 (+0x22b45bd) (0x00000000005ffca0) 5 0x00007fa7d1a3b8f3 _initterm+0x169(start=0x142337708, end=0x1423471b8) [/home/focht/projects/wine/wine.repo/src/dlls/msvcr110/../msvcrt/data.c:604] in msvcr110 (0x00000000005ffca0) 6 0x0000000141f233e9 in mk10 (+0x1f233e8) (0x00000000005ffd20) 7 0x000000007b8c609c call_process_entry+0x1c(peb=0x7fffff7ef000, entry=0x141f2331c) [/home/focht/projects/wine/wine.repo/src/dlls/kernel32/process.c:1073] in kernel32 (0x00000000005ffd20) ... Modules: Module Address Debug info Name (128 modules) PE 600000- 67e000 Deferred fmod_event64 PE 680000- 7ed000 Deferred fmodex64 PE 7f0000- 83d000 Deferred steam_api64 ELF 7a800000- 7ac51000 Deferred opengl32<elf> -PE 7a8a0000- 7ac51000 \ opengl32 ELF 7b800000- 7bcdb000 Dwarf kernel32<elf> -PE 7b860000- 7bcdb000 \ kernel32 ELF 7be00000- 7c103000 Dwarf <wine-loader> PE 140000000- 143769000 Export mk10 PE 180000000- 18008d000 Deferred bink2w64 ELF 3691200000- 3691424000 Deferred libselinux.so.1 ... Threads: process tid prio (all id:s are in hex) ... 00000022 (D) C:\Program Files (x86)\Mortal Kombat X\Binaries\Retail\MK10.exe 00000023 0 <== --- snip ---
Disassembly of call site:
--- snip --- 0000000140B88AF0 | 48 83 EC 28 | sub rsp,28
; 142336308: KERNEL32.dll.GetLargePageMinimum
0000000140B88AF4 | FF 15 0E D8 7A 01 | call qword ptr ds:[142336308] 0000000140B88AFA | 4C 8B C0 | mov r8,rax 0000000140B88AFD | 48 89 05 64 CB 4C 02 | mov qword ptr ds:[143055668],rax 0000000140B88B04 | 48 85 C0 | test rax,rax 0000000140B88B07 | 0F 84 88 00 00 00 | je 140B88B95
; 143055660: ullTotalPhys from KERNEL32.dll.GlobalMemoryStatusEx
0000000140B88B0D | 48 8B 0D 4C CB 4C 02 | mov rcx,qword ptr ds:[143055660] 0000000140B88B14 | 48 B8 00 00 00 80 03 00 .| mov rax,380000000 0000000140B88B1E | 48 81 E1 00 00 F0 FF | and rcx,FFFFFFFFFFF00000 0000000140B88B25 | 48 3B C8 | cmp rcx,rax 0000000140B88B28 | 72 6B | jb 140B88B95 0000000140B88B2A | 4A 8D 0C 85 00 00 00 00 | lea rcx,qword ptr ds:[r8*4] 0000000140B88B32 | 48 B8 15 AE 47 E1 7A 14 .| mov rax,47AE147AE147AE15 0000000140B88B3C | C7 05 4A 22 29 02 02 00 .| mov dword ptr ds:[142E1AD90],2 0000000140B88B46 | 48 89 0D 93 22 29 02 | mov qword ptr ds:[142E1ADE0],rcx 0000000140B88B4D | 49 8B C8 | mov rcx,r8 0000000140B88B50 | 4C 89 05 71 22 29 02 | mov qword ptr ds:[142E1ADC8],r8 0000000140B88B57 | C6 05 73 C7 4C 02 01 | mov byte ptr ds:[1430552D1],1 0000000140B88B5E | 48 6B C9 19 | imul rcx,rcx,19 0000000140B88B62 | 48 F7 E1 | mul rcx 0000000140B88B65 | 48 2B CA | sub rcx,rdx 0000000140B88B68 | 48 D1 E9 | shr rcx,1 0000000140B88B6B | 48 03 CA | add rcx,rdx 0000000140B88B6E | 48 C1 E9 06 | shr rcx,6 0000000140B88B72 | 48 89 0D 57 22 29 02 | mov qword ptr ds:[142E1ADD0],rcx 0000000140B88B79 | 49 81 F8 00 00 40 00 | cmp r8,400000 0000000140B88B80 | 76 13 | jbe 140B88B95
; 1424CB350: "Please increase NRSMEMORY_LARGE_PAGE_SIZE to be larger than: %d"
0000000140B88B82 | 48 8D 0D C7 27 94 01 | lea rcx,qword ptr ds:[1424CB350] 0000000140B88B89 | 49 8B D0 | mov rdx,r8 0000000140B88B8C | 48 83 C4 28 | add rsp,28 0000000140B88B90 | E9 3B 28 8B 00 | jmp 14143B3D0 0000000140B88B95 | 48 83 C4 28 | add rsp,28 0000000140B88B99 | C3 | ret --- snip ---
$ wine --version wine-1.7.46-193-g8b566b1
Regards
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #17 from Austin English austinenglish@gmail.com --- (In reply to Indrek from comment #15)
After a bit of digging I found that Win LargePage seems to the equivalent of HugePage in linux and I also found special function gethugepagesizes http://linux.die.net/man/3/gethugepagesizes that could be used to get the available values (and thus find the minimum one), but I was unable to get it to compile correctly (needs changes to configure.ac ?) :(
I wasn't able to get that working on Fedora, using the sample code from https://stackoverflow.com/questions/17225200/how-to-get-the-value-of-huge-pa... (even after installing libhugetlbfs-devel).
Getting it from /proc/meminfo seems to work though: [austin@localhost ~]$ cat /proc/meminfo | grep Huge AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
I've put together a patch that does that, instead.
https://bugs.winehq.org/show_bug.cgi?id=18745
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #51501|0 |1 is obsolete| |
--- Comment #18 from Austin English austinenglish@gmail.com --- Created attachment 51798 --> https://bugs.winehq.org/attachment.cgi?id=51798 implement GetLargePageMinimum using /proc/meminfo
Please test.
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #19 from Austin English austinenglish@gmail.com --- (In reply to Austin English from comment #18)
Created attachment 51798 [details] implement GetLargePageMinimum using /proc/meminfo
Please test.
https://source.winehq.org/patches/data/115290
https://bugs.winehq.org/show_bug.cgi?id=18745
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=18745
Saulius K. saulius2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |saulius2@gmail.com
--- Comment #20 from Saulius K. saulius2@gmail.com --- Created attachment 53475 --> https://bugs.winehq.org/attachment.cgi?id=53475 test program for libhugetlbfs
(In reply to Austin English from comment #17)
I wasn't able to get that working on Fedora, using the sample code from https://stackoverflow.com/questions/17225200/how-to-get-the-value-of-huge- page-size (even after installing libhugetlbfs-devel).
And for me it worked . I extended source code of the test program a bit (attaching it) and got this:
huge page size = 2097152 huge page sizes [1] = 2097152 page sizes [2] = 4096 2097152 PF_LINUX_HUGETLB = 1048576
Austin, what exactly didn't work for you?
Getting it from /proc/meminfo seems to work though: [austin@localhost ~]$ cat /proc/meminfo | grep Huge AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
I've put together a patch that does that, instead.
On my system I get similar results only with an exception for AnonHugePages:
AnonHugePages: 102400 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
But /proc/mem way is probably more hassle-free than linking to libhugetlbfs and using it.
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #21 from Austin English austinenglish@gmail.com --- (In reply to Saulius K. from comment #20)
Created attachment 53475 [details] test program for libhugetlbfs
(In reply to Austin English from comment #17)
I wasn't able to get that working on Fedora, using the sample code from https://stackoverflow.com/questions/17225200/how-to-get-the-value-of-huge- page-size (even after installing libhugetlbfs-devel).
And for me it worked . I extended source code of the test program a bit (attaching it) and got this:
huge page size = 2097152 huge page sizes [1] = 2097152 page sizes [2] = 4096 2097152 PF_LINUX_HUGETLB = 1048576
Austin, what exactly didn't work for you?
I can't easily retest and won't be able to for a few weeks. IIRC, I wasn't getting any information from libhugetlbfs (i.e., returned null or 0), but /proc/meminfo worked.
Getting it from /proc/meminfo seems to work though: [austin@localhost ~]$ cat /proc/meminfo | grep Huge AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
I've put together a patch that does that, instead.
On my system I get similar results only with an exception for AnonHugePages:
AnonHugePages: 102400 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
But /proc/mem way is probably more hassle-free than linking to libhugetlbfs and using it.
I agree. As I said, I won't have time to look at this for a while, so feel free to submit your libhugetlbfs patch, or a modified version of my own if you've got time to work on this.
https://bugs.winehq.org/show_bug.cgi?id=18745
Jacob jacobwinski@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jacobwinski@gmail.com
--- Comment #22 from Jacob jacobwinski@gmail.com --- I can confirm that the patch created by Austin English in comment #18 fixes this problem.
Without the patch, I too get the same error that OP wrote about. With the patch, the game Mortal Kombat X launches without this error.
The patch applies cleanly to wine-1.9.12 and I have already build packages that include this patch for my distribution.
https://bugs.winehq.org/show_bug.cgi?id=18745
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man@post.com
--- Comment #23 from super_man@post.com --- (In reply to Jacob from comment #22)
I can confirm that the patch created by Austin English in comment #18 fixes this problem.
Without the patch, I too get the same error that OP wrote about. With the patch, the game Mortal Kombat X launches without this error.
The patch applies cleanly to wine-1.9.12 and I have already build packages that include this patch for my distribution.
Maybe staging is interested in this new release that is still unleashed. It will take at least 2 more weeks to get this fixed in upstream release (unless using git or pathing yourself).
https://bugs.winehq.org/show_bug.cgi?id=18745
--- Comment #24 from Jacob jacobwinski@gmail.com --- (In reply to super_man from comment #23)
(In reply to Jacob from comment #22)
I can confirm that the patch created by Austin English in comment #18 fixes this problem.
Without the patch, I too get the same error that OP wrote about. With the patch, the game Mortal Kombat X launches without this error.
The patch applies cleanly to wine-1.9.12 and I have already build packages that include this patch for my distribution.
Maybe staging is interested in this new release that is still unleashed. It will take at least 2 more weeks to get this fixed in upstream release (unless using git or pathing yourself).
I agree, it definitely should first go to staging because 1) it'll be out in the wild quicker and therefore can be used by those that need this fix and 2) it will get tested "just in case". Of course stable release should also implement it ASAP ;)
https://bugs.winehq.org/show_bug.cgi?id=18745
Marcus Meissner marcus@jet.franken.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |marcus@jet.franken.de Status|NEW |RESOLVED
--- Comment #25 from Marcus Meissner marcus@jet.franken.de --- patch is in git. commit 4d313e6475383e5aa1ebd8c0917f1f11f5c81f66
https://bugs.winehq.org/show_bug.cgi?id=18745
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de Fixed by SHA1| |4d313e6475383e5aa1ebd8c0917 | |f1f11f5c81f66
https://bugs.winehq.org/show_bug.cgi?id=18745
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #26 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.9.13.
https://bugs.winehq.org/show_bug.cgi?id=18745
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mstefani@redhat.com Target Milestone|--- |1.8.x
https://bugs.winehq.org/show_bug.cgi?id=18745
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.8.x |---
--- Comment #27 from Michael Stefaniuc mstefani@redhat.com --- Removing 1.8.x milestone from bugs included in 1.8.4.