Jump to content
vit9696

AptioMemoryFix

495 posts in this topic

Recommended Posts

Hm, what is quite funny: The corruption seems to go away over time. Also Safari obviously uses both GPUs for site rendering, and the speed even increased now, since the HD4600 is available as OpenCL processor!  No crashes so far.

 

 

Strange, I have never had to disable VT-d or drop my DMAR, but it causes others many issues. So strange. I have to image that the corruption in graphics is related to the same sort of corruptions the HD3000/4000 have, maybe all the intel integrateds do. I think that the graphics reserves a bunch of memory that is discarded as not needed by the kernel because the apple firmware does not set them up in the same way and that memory needs preserved properly.

 

 

I start to believe Apple actually uses both GPUs as OpenCL at once in regular models. Since the FCPX timeline is rendered by IGPU and the rest by nvidia/amd, that cannot be a coincidence, but done by purpose? I have no clue though :)

 

The corruption now is only visible in the FCPX timeline, and not for every frame preview, only some oO So weird.

Share this post


Link to post
Share on other sites
Advertisement

vpac are you booting up on your RX480 ?

niknod

 

yes, my RX 480 is in my system when I boot

@vpac,

 

The problem is that your runtime is being relocated, so something is not functioning correctly by the time the kernel is started, you need to use either AptioMemoryFix or AptioFix3 drivers. Also since you have an X99, you may not have very much luck getting a working system if your memory is too fragmented to place the kernel. Check your memory map from the EFI shell from the clover GUI and see if you have any regions below 0x100000000, with like more than 0x10000 pages...

 

Thanks apianti. I can use all the help I can get.  I am currently using AptioMemoryFix and that does not work. I will try and chase down AptioFix3 and try that if I can find it.

 

I haven't looked for the memory map option. I will look for it. Should I look at the memory with the Thunderbolt board active, or without. Might be interesting to compare the two.

 

So if I have more than 0x10000 pages there, does that mean that I won't be able to make it work, or does that mean it's possible but it will take someone that knows what they are doing?

Share this post


Link to post
Share on other sites

You are fine using AptioMemoryFix.efi (I do not mean AptioFixDrv-64.efi). You usually need about 0x10000 pages for the kernel, if you read the first post of this topic and look at KASLR, it shows you all the positions the kernel can be loaded you need to have an available memory region at one of those with around that much space. To get the memory map, enter the EFI shell from clover GUI and goto a filesystem by enter FS#: and then memmap > memmap.txt. That will save the memory map to the root of that volume, which needs to be FAT because that's the only writeable filesystem at boot time.

 

EDIT: If you want to use your thunderbolt, you probably want it in, lol.

Share this post


Link to post
Share on other sites

You are fine using AptioMemoryFix.efi (I do not mean AptioFixDrv-64.efi). You usually need about 0x10000 pages for the kernel, if you read the first post of this topic and look at KASLR, it shows you all the positions the kernel can be loaded you need to have an available memory region at one of those with around that much space. To get the memory map, enter the EFI shell from clover GUI and goto a filesystem by enter FS#: and then memmap > memmap.txt. That will save the memory map to the root of that volume, which needs to be FAT because that's the only writeable filesystem at boot time.

 

EDIT: If you want to use your thunderbolt, you probably want it in, lol.

Thanks apianti. I'll try that!

Share this post


Link to post
Share on other sites

Um, api… really, stop this nonsense about slide calculation, it is a little misleading :)

 

If anything AptioMemoryFix does it much better. Not just because it does it automatically, where humans will likely miscalculate or just mess up, but also because it does it later when some allocations have already happened. Other than that, 256 MB is not enough, and several boards (in particular X299) will fail with that, because they allocate allocate pool memory at the same place unfortunately, and that's about 100 MB (prelinked kernel and stuff). See: https://github.com/vit9696/AptioFixPkg/blob/master/Platform/AptioMemoryFix/Config.h#L62

 

Furthermore, AptioMemoryFix prints all the valid slides you can use, if at least one of the slides cannot be used. If one is insistent to try a specific slide, he can just use the one from the printed list.

 

Also, it is by far better to use -aptiodump boot argument for dumping memory maps than memmap, because it continuously dumps the memory map as it changes and even prints the virtual addresses in a shrinked memory map before it is passed to the kernel. For that one needs to enable it in Config.h and recompile of course (https://github.com/vit9696/AptioFixPkg/blob/master/Platform/AptioMemoryFix/Config.h#L76).

 

Also, no runtime is relocated in AptioMemoryFix (or V3), that's how it was in V2 and earlier.

 

———

 

VT-d is broken in all AMI bioses. Leaving it enabled is equal to giving a grenade to a child. So far no software benefits from VT-d in macOS, yet a number of programs could break. It is absolute nonsense that it helps VMs, because so far no VM software on macOS supports PCI pass-through and VT-d. Preference recommendations are not a graffity on your fence in the country, they have some thoughts behind. Seriously.

 

———

 

As for thunderbolt, it might be the case that it is like VT-d, and you can hardly make it work on your own in this case. So far I have never seen a person with a working thunderbolt in macOS, though maybe I am just dated. From the top of my head I could recommend two things:

1. making sure that your IGPU is configured with a frame without connectors (important to reduce memory consumption).

2. trying to enable a custom pool allocator (https://github.com/vit9696/AptioFixPkg/blob/master/Platform/AptioMemoryFix/Config.h#L89) in case there exists a memory corruption.

But if neither helped, and you followed all the other recommendations, I am afraid nobody will be able to help you for the time being. Hardware and more importantly time is needed to debug such an issue.

Share this post


Link to post
Share on other sites

Thanks for that detailed infom vit9696. But my "problem" was about enabling HD4600 WITH enabled connectors. It already works fine without connector... But since without a connector also the OpenCL HD4600 device is gone, the with-connector seems to be much more interesting and here obviously increases performance.

 

 

 

2. trying to enable a custom pool allocator

 

How do I do that, simply adding "-aptiodump" to boot flags? Couldn't find the source file where those boot flag strings actually are written down :)

Share this post


Link to post
Share on other sites

Lower end consumer Intel GPUs starting from Haswell (e.g. 4400, 4600, 5xx, 6xx) are not used with connectors in real macs and unfortunately are very broken in macOS. We try to do our best with lvs1974 in IntelGraphicsFixup to let them at least somehow function, but it is really really bad. The drivers simply do not support them, especially HDMI and DVI ports (hello wake issues on SkyLake+), but in most cases it is not important whether you connect anything at all. I am afraid you are up to yourself with such a configuration. Currently it is cheaper to use an older NVIDIA or a newer AMD.

 

Enabling/disabling options in AptioMemoryFix requires recompilation and setting defines to 1 (enabled) or 0 (disabled).

 

 

2All: While the default AptioMemoryFix configuration is most likely the best one for all the existing motherboards, some special usage cases may require tuning. However, you better do not do it unless you know what you actually do.

Share this post


Link to post
Share on other sites

Um, api… really, stop this nonsense about slide calculation, it is a little misleading :)

 

If anything AptioMemoryFix does it much better. Not just because it does it automatically, where humans will likely miscalculate or just mess up, but also because it does it later when some allocations have already happened. Other than that, 256 MB is not enough, and several boards (in particular X299) will fail with that, because they allocate allocate pool memory at the same place unfortunately, and that's about 100 MB (prelinked kernel and stuff). See: https://github.com/vit9696/AptioFixPkg/blob/master/Platform/AptioMemoryFix/Config.h#L62

 

Furthermore, AptioMemoryFix prints all the valid slides you can use, if at least one of the slides cannot be used. If one is insistent to try a specific slide, he can just use the one from the printed list.

 

Also, it is by far better to use -aptiodump boot argument for dumping memory maps than memmap, because it continuously dumps the memory map as it changes and even prints the virtual addresses in a shrinked memory map before it is passed to the kernel. For that one needs to enable it in Config.h and recompile of course (https://github.com/vit9696/AptioFixPkg/blob/master/Platform/AptioMemoryFix/Config.h#L76).

 

Also, no runtime is relocated in AptioMemoryFix (or V3), that's how it was in V2 and earlier.

 

Where did I say anything about calculating slide? I was telling him that he can check if he has even enough available space for the kernel because there are several X99 systems' memory maps I've seen that don't have more than a few hundred consecutive available pages anywhere below 4GB straight from the firmware to EFI shell memory map. I was just giving a large enough amount that the prelinked kernel from the installer will fit. If you notice, I did suggest he use AptioMemoryFix.... But while it may print all the slides, it also uses the console, and the memory map writes to a file that you can share. The only reason why I suggested that. He also noted before that he used AptioFixDrv-64.efi which does move memory which is why I said that. Of course I know that AptioMemoryFix or AptioFix3 don't move the runtime, I am literally the one who had been saying not to relocate it.... ?

 

VT-d is broken in all AMI bioses. Leaving it enabled is equal to giving a grenade to a child. So far no software benefits from VT-d in macOS, yet a number of programs could break. It is absolute nonsense that it helps VMs, because so far no VM software on macOS supports PCI pass-through and VT-d. Preference recommendations are not a graffity on your fence in the country, they have some thoughts behind. Seriously.

 

Hmmmmmm... weird because I literally said in my post that I have VT-d enabled and DMAR table, never dropped and do not have an issue.

 

EDIT: Maybe because my CPU doesn't actually have VT-d only VT-x, it's fine to leave enabled?

 

As for thunderbolt, it might be the case that it is like VT-d, and you can hardly make it work on your own in this case. So far I have never seen a person with a working thunderbolt in macOS, though maybe I am just dated. From the top of my head I could recommend two things:

1. making sure that your IGPU is configured with a frame without connectors (important to reduce memory consumption).

2. trying to enable a custom pool allocator (https://github.com/vit9696/AptioFixPkg/blob/master/Platform/AptioMemoryFix/Config.h#L89) in case there exists a memory corruption.

But if neither helped, and you followed all the other recommendations, I am afraid nobody will be able to help you for the time being. Hardware and more importantly time is needed to debug such an issue.

 

Neither have I, lol.

 

Lower end consumer Intel GPUs starting from Haswell (e.g. 4400, 4600, 5xx, 6xx) are not used with connectors in real macs and unfortunately are very broken in macOS. We try to do our best with lvs1974 in IntelGraphicsFixup to let them at least somehow function, but it is really really bad. The drivers simply do not support them, especially HDMI and DVI ports (hello wake issues on SkyLake+), but in most cases it is not important whether you connect anything at all. I am afraid you are up to yourself with such a configuration. Currently it is cheaper to use an older NVIDIA or a newer AMD.

 

Enabling/disabling options in AptioMemoryFix requires recompilation and setting defines to 1 (enabled) or 0 (disabled).

 

I believe his problem is actually to do with rendering, I don't think he actually has the card connected and is using an NVIDIA as well.

Share this post


Link to post
Share on other sites

Perhaps I misread something after getting up, ok.
 

Hmmmmmm... weird because I literally said in my post that I have VT-d enabled and DMAR table, never dropped and do not have an issue.

Well, for a proof you could install a NVMe SSD and enjoy random kernel panics. Would that suffice? :D

It does not always show itself explicitly, but the issue is hidden in the details. Believe, you do not want to have it enabled even if you observe no issues.

The offsets are not usable by macOS, whenever it tries to use them disasters could happen.

 

 

I believe his problem is actually to do with rendering, I don't think he actually has the card connected and is using an NVIDIA as well.

From what I suspect the issue is in initialisation. It is done differently for connector-less and connector-full frames. But to be sure it will require me to revise my reverse-engineering projects on IGPU kexts and test a lot of stuff, which I do not want to do now.

Share this post


Link to post
Share on other sites

Well, for a proof you could install a NVMe SSD and enjoy random kernel panics. Would that suffice? :D

It does not always show itself explicitly, but the issue is hidden in the details. Believe, you do not want to have it enabled even if you observe no issues.

The offsets are not usable by macOS, whenever it tries to use them disasters could happen.

 

Don't have NVMe support in this firmware, and the update for it disables XMP, lol.

 

From what I suspect the issue is in initialisation. It is done differently for connector-less and connector-full frames. But to be sure it will require me to revise my reverse-engineering projects on IGPU kexts and test a lot of stuff, which I do not want to do now.

 

You and everyone else..... Ugh.

Share this post


Link to post
Share on other sites

Ok thanks a lot for all the background info. Ok, I see it is very complicated to debug and not worth the effort. I use the nvidia card as output only, the HD4600 was acting as secondary opencl processor, with connector enabled but nothing connected.

Share this post


Link to post
Share on other sites

If I knew how to reverse engineer, I would reverse engineer the {censored} out it. :P

 

Get a disassembler, then patch and debug the {censored} out of stuff.

 

EDIT: Also try to locate as many technical documents as you can relating to whatever so you can get an idea of how it works and can then target specifics.

 

EDIT2: Oh, the most important part: lose lots of sleep, become obsessed with solving some problem forever then in the end you made some stupid mistake and had the answer like twenty seven seconds into what you started but spent four years on it. HAHA!

Share this post


Link to post
Share on other sites

lol...

 

well,I am more than out of my element. I will get that memmap, but after reading this, I am not sure it will suffice. I had to reset BIOS and I think I forgot to turn off VT-d so I'll make sure I do that first, but it failed previously when I had it turned off.

 

Thanks guys. I really appreciate this. Seems like even you guys that know what you are doing think it's hard, so not much hope for me getting it working I guess. I'll still keep plodding though. I'll get that memory dump and go from there.

 

VT-d was turned off by default, so that was not causing a problem. oh well... was hoping that turning it off might help.

Share this post


Link to post
Share on other sites

A real man cooks for himself.

 

 

?

 

Joking, my friend. But I should fix that firmware but hopefully they will release a newer version because it said "Beta", HA.

Share this post


Link to post
Share on other sites

You are fine using AptioMemoryFix.efi (I do not mean AptioFixDrv-64.efi). You usually need about 0x10000 pages for the kernel, if you read the first post of this topic and look at KASLR, it shows you all the positions the kernel can be loaded you need to have an available memory region at one of those with around that much space. To get the memory map, enter the EFI shell from clover GUI and goto a filesystem by enter FS#: and then memmap > memmap.txt. That will save the memory map to the root of that volume, which needs to be FAT because that's the only writeable filesystem at boot time.

 

EDIT: If you want to use your thunderbolt, you probably want it in, lol.

 

apianti

 

two files. one without TB enabled and one with. It doesn't look like I have much free memory down there. 

 

Does that mean I'm officially screwed?

memmap.txt

memmapTB.txt

Share this post


Link to post
Share on other sites

apianti

 

two files. one without TB enabled and one with. It doesn't look like I have much free memory down there. 

 

Does that mean I'm officially screwed?

 

Nah, I see the same area appears open in both:

Available  000000001000B000-00000000A66C5FFF 00000000000966BB 000000000000000F

With TB:

Available  000000001000B000-00000000266C5FFF 00000000000166BB 000000000000000F

AptioMemoryFix should be finding a spot for you either way if you don't have a SB or IB, at slide=128+.  You might have enough space without TB if you have SB or IB at slide=128. Other than that, it's close with TB, without you have plenty of space.

 

EDIT: @vit, Do you need to not provide a slide in order for it to select a slide automatically?

Share this post


Link to post
Share on other sites

From what I suspect the issue is in initialisation. It is done differently for connector-less and connector-full frames. But to be sure it will require me to revise my reverse-engineering projects on IGPU kexts and test a lot of stuff, which I do not want to do now.

 

 

You and everyone else..... Ugh.

 

 

 

Ok I now broke it down to video decoding!:  Only video decoding is corrupted with HD4600-connector-rich + nvidia (with display). Everything works now. So you still have a lot of work to do, gogogo!

 

If I set

defaults write com.apple.AppleGVA forceNV -boolean yes

VDADecoderChecker will throw that error, but all video graphics elements in safari (developer preview) will work fine (I guess software decoder then). So currently it seems you have to choose from either IGPU video decoding or additional IGPU opencl processing, but not both at once. Also Final Cut then works - without hardware video decoder/encoder it seems. Also tried IntelGraphicsFixUp additionally, but no change. 

 

So you would just have to fix video encoding/decoding on IGPU.

 

EDIT: On youtube, first I see corrupted video graphics, just like encrypted video. then i switch resolution an dswitch back to original quality: Now it works! So it even is actually working, just seems to be a DRM issue or similar, falsely activating DRM?

 

 

EDIT: For real, I think you guys are 1m away from goal. 

Share this post


Link to post
Share on other sites

Heh, it is so funny that the video starts to work after some time, like 15 seconds and switching quality forth and back on youtube fixes it. It even works almost 100% if you reload your project in final cut.

 

What memory area is reserved for iGPU and why the problem goes away then?

Share this post


Link to post
Share on other sites

Heh, it is so funny that the video starts to work after some time, like 15 seconds and switching quality forth and back on youtube fixes it. It even works almost 100% if you reload your project in final cut.

 

What memory area is reserved for iGPU and why the problem goes away then?

Is this text (https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/) relevant for the problem?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×