Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xanderx007

macrumors 6502
Nov 7, 2017
262
140
The AMDGPUWakeHandler can be placed in /Library/Extensions, but those AMD kexts you removed belong to /System/Library/Extensions.

Yeah. I figured that out earlier. I was doing the Terminal fix, and I kept clicking on /Library/Extensions, instead of /System/Library/Extensions.
 

mcbeej

macrumors member
Jun 7, 2007
76
2
Had my machine running all day, working fine, but just now started to get super hot without any notable processor activity, so I wanted to the check the wake handler driver, with:

Code:
> log show --last 24h --predicate 'senderImagePath contains "AMDGPUWakeHandler"'

But get:

-bash: log: command not found

I couldn't see anything in the Console app either, any clue as to how I can check the logs?
 

brainshutdown

macrumors regular
Original poster
Jul 16, 2012
124
110
Had my machine running all day, working fine, but just now started to get super hot without any notable processor activity, so I wanted to the check the wake handler driver, with:

Code:
> log show --last 24h --predicate 'senderImagePath contains "AMDGPUWakeHandler"'

But get:

-bash: log: command not found

I couldn't see anything in the Console app either, any clue as to how I can check the logs?

That command is new in macOS Sierra. On older versions use syslog:
Code:
> syslog | grep 'Disabling GPU'
 
  • Like
Reactions: mcbeej

diachedelic

macrumors newbie
Nov 19, 2017
1
2
Instructions in the Gist worked flawlessly just now on my Early 2011 MBP (which was either crashing during boot, crashing later or having kernel_task taking up ~1000% cpu). I have it booting without the RESCUE USB drive, and installed the AMDGPUWakeHandler kext with no issues. Will report back if problems arise.
 

nate922

macrumors newbie
Aug 2, 2010
16
1
Thanks for all your work on this issue brainshutdown.

Any chance you could extend the kext to support nvidia cars for the 2012 (GT 650m)
I tried removing the GeForce/NVDA kexts but the system won't load without them.

Cheers.
 

brainshutdown

macrumors regular
Original poster
Jul 16, 2012
124
110
@nate922
This solution should also work for you. In fact this is valid for any dual GPU MBP. The "outb" commands in the GRUB menu entry, which the kext tries to replicate when waking from sleep, are just telling the GMUX to switch GPUs and turn off the discrete graphics.

You can create the rescue thumb drive as described in guide to see if it works for you. Just be aware that the kext should only be used with the GRUB solution in place, otherwise it will kernel panic.
 
Last edited:

nate922

macrumors newbie
Aug 2, 2010
16
1
@nate922
This solution should also work for you. In fact this is valid for any dual GPU MBP. The "outb" commands in the GRUB menu entry, which the kext tries to replicate when waking from sleep, are just telling the GMUX to switch GPUs and turn off the discrete graphics.

You can create the rescue thumb drive as described in guide to see if it works for you. Just be aware that the kext should only be used with the GRUB solution in place, otherwise it will kernel panic.

Thanks for the reply.

I got the Grub solution running and it's working great. The only issue is that there is a little delay before Grub boots, I tried a couple of bless but it didn't help - are you getting the same issue?

Will the "AMDGPUWakeHandler.kext" that you created work for nvidia cards too?
Logs show that it's doing its thing but istatmenus is reporting that the "Geforce GPU Vcore" is using 0.9V

2017-11-22 22:14:50.159161+0000 0x4b0 Default 0x0 0 kernel: (AMDGPUWakeHandler) Probing

2017-11-22 22:14:50.160043+0000 0x4b0 Default 0x0 0 kernel: (AMDGPUWakeHandler) Starting

2017-11-22 22:14:50.160326+0000 0xf9 Default 0x0 0 kernel: (AMDGPUWakeHandler) Waking up

2017-11-22 22:14:50.160329+0000 0xf9 Default 0x0 0 kernel: (AMDGPUWakeHandler) Disabling GPU

Cheers.
 
Last edited:

nsgr

macrumors 6502
May 22, 2017
317
117
@nate922
This solution should also work for you. In fact this is valid for any dual GPU MBP. The "outb" commands in the GRUB menu entry, which the kext tries to replicate when waking from sleep, are just telling the GMUX to switch GPUs and turn off the discrete graphics.

You can create the rescue thumb drive as described in guide to see if it works for you. Just be aware that the kext should only be used with the GRUB solution in place, otherwise it will kernel panic.

This kernel panic happens with AMD kexts within the /System/Library/Extensions?

Or this kernel panic happens even with AMD6000Controller.kext and AMDRadeonX300.kext out /System/Library/Extensions?

The question is to see if there is a way to avoid GRUB on initialization.
 

brainshutdown

macrumors regular
Original poster
Jul 16, 2012
124
110
Thanks for the reply.

I got the Grub solution running and it's working great. The only issue is that there is a little delay before Grub boots, I tried a couple of bless but it didn't help - are you getting the same issue?
Do you have multiple SSD/HDDs? The delay is a common GRUB issue on multi HDD/SSD setups.

Will the "AMDGPUWakeHandler.kext" that you created work for nvidia cards too?
Yes, it basically does what the GRUB menu entry does to disable the GPU.
[doublepost=1511389633][/doublepost]
This kernel panic happens with AMD kexts within the /System/Library/Extensions?

Or this kernel panic happens even with AMD6000Controller.kext and AMDRadeonX300.kext out /System/Library/Extensions?

The question is to see if there is a way to avoid GRUB on initialization.
I haven't tested with the AMD kexts removed, but if you leave the kexts and don't use GRUB it will kernel panic for sure.
 

nate922

macrumors newbie
Aug 2, 2010
16
1
Thanks brainshutdown.

Strange, I'm still getting a vcore on the GPU with both the grub and your kext on a machine with nvidia (see my edited post above)

Any other pointers?

Cheers.
 

brainshutdown

macrumors regular
Original poster
Jul 16, 2012
124
110
Logs show that it's doing its thing but istatmenus is reporting that the "Geforce GPU Vcore" is using 0.9V

2017-11-22 22:14:50.159161+0000 0x4b0 Default 0x0 0 kernel: (AMDGPUWakeHandler) Probing

2017-11-22 22:14:50.160043+0000 0x4b0 Default 0x0 0 kernel: (AMDGPUWakeHandler) Starting

2017-11-22 22:14:50.160326+0000 0xf9 Default 0x0 0 kernel: (AMDGPUWakeHandler) Waking up

2017-11-22 22:14:50.160329+0000 0xf9 Default 0x0 0 kernel: (AMDGPUWakeHandler) Disabling GPU
Is it always 0.9V, even without putting it to sleep?
 

nsgr

macrumors 6502
May 22, 2017
317
117
Do you have multiple SSD/HDDs? The delay is a common GRUB issue on multi HDD/SSD setups.


Yes, it basically does what the GRUB menu entry does to disable the GPU.
[doublepost=1511389633][/doublepost]
I haven't tested with the AMD kexts removed, but if you leave the kexts and don't use GRUB it will kernel panic for sure.

I'll try later with the AMD kexts outside the /System/Library/Extensions.

I was looking at the GRUB source code and have several files for the outb command. At first I thought GRUB was looking for the outb binary command in the Linux system partition but they put everything inside the GRUB package.

I also looked at the ioport package source code for Linux which provides the binaries for the inb, inw, inl, outb, outw, and outl commands. If there was a "port" for this command on Mac OS it would make it very easy for people who have trouble installing GRUB on Macbook. GRUB would not be necessary.

http://people.redhat.com/rjones/ioport/
 

brainshutdown

macrumors regular
Original poster
Jul 16, 2012
124
110
I'll try later with the AMD kexts outside the /System/Library/Extensions.

I was looking at the GRUB source code and have several files for the outb command. At first I thought GRUB was looking for the outb binary command in the Linux system partition but they put everything inside the GRUB package.

I also looked at the ioport package source code for Linux which provides the binaries for the inb, inw, inl, outb, outw, and outl commands. If there was a "port" for this command on Mac OS it would make it very easy for people who have trouble installing GRUB on Macbook. GRUB would not be necessary.

http://people.redhat.com/rjones/ioport/

The GRUB outb command is just the outb assembly instruction. You can see it in the AMDGPUWakeHandler source code.

The thing is, the GPU needs to be disabled before the kernel loads, because macOS will gather the info about the pci devices before loading the kexts, and by that time is already too late to disable the GPU, because it already saw the GPU and will try to load the kexts for it.


If the AMDGPUWakeHandler is unloaded, does it make any difference in the voltage when waking up?
You can unload it running this form terminal:
Code:
sudo kextunload /Library/Extensions/AMDGPUWakeHandler.kext
 
Last edited:

nate922

macrumors newbie
Aug 2, 2010
16
1
I've tried unloading the AMDGPUWakeHandler.kext and it's the same.

I tried putting back the NVIDIA kexts and Voltage is now 0, strange.

The thing is, the GPU needs to be disabled before the kernel loads, because macOS will gather the info about the pci devices before loading the kexts, and by that time is already too late to disable the GPU, because it already saw the GPU and will try to load the kexts for it.

@brainshutdown - are you saying that setting the:
nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00 disables the GPU and macos can't see it? cause in my setup macOS still loads the GPU drivers.
 

xanderx007

macrumors 6502
Nov 7, 2017
262
140
@brainshutdown - are you saying that setting the:
nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00 disables the GPU and macos can't see it? cause in my setup macOS still loads the GPU drivers.

Check your System Information>Graphics/Displays. If the system can't see the dGPU, the drivers won't matter.
 

Attachments

  • Screen Shot 2017-11-23 at 07.56.04.png
    Screen Shot 2017-11-23 at 07.56.04.png
    71.4 KB · Views: 281
Last edited:

nate922

macrumors newbie
Aug 2, 2010
16
1

Check your System Information>Graphics/Displays. If the system can't see the dGPU, the drivers won't matter.[/QUOTE]

Thanks for that xanderx007.

My system still sees the nvidia card, any pointers ?
 

Attachments

  • Screen Shot 2017-11-22 at 23.59.48.png
    Screen Shot 2017-11-22 at 23.59.48.png
    125.8 KB · Views: 236

nate922

macrumors newbie
Aug 2, 2010
16
1
Cool, thanks for that

nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00

#csrutil status

System Integrity Protection status: disabled

So SIP's disabled, all is good:

After I put in the nvram parameter, gfxCardStatus can't switch to the dGPU so I thought it did it.. but I guess not cause it's still showing under system properties.

I also reran the nvram commands under Single User Recovery mode and it didn't make a difference.
 

xanderx007

macrumors 6502
Nov 7, 2017
262
140
Cool, thanks for that

nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00

#csrutil status

System Integrity Protection status: disabled

So SIP's disabled, all is good:

After I put in the nvram parameter, gfxCardStatus can't switch to the dGPU so I thought it did it.. but I guess not cause it's still showing under system properties.

I also reran the nvram commands under Single User Recovery mode and it didn't make a difference.

I'm just guessing here (and @brainshutdown can confirm it), maybe it did work somewhat, but it behaves a bit differently with NVidia (since the Ubuntu installtion is AMD specific). It can still see the card, but, if you can get your laptop to sleep, shutdown and restart properly, and it doesn't freeze all the time, it should be okay.
 

brainshutdown

macrumors regular
Original poster
Jul 16, 2012
124
110
@brainshutdown - are you saying that setting the:
nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00 disables the GPU and macos can't see it? cause in my setup macOS still loads the GPU drivers.

No. I'm saying the outb commands on the GRUB menu entry disables it. That nvram variable only defines the preference to boot using the integrated GPU, but doesn't disable the discrete GPU.

That means the fix didn't work. Let's wait for
@brainshutdown,

I did an istats check, and this is what I've got.

View attachment 737714

Thoughts?
I don't see anything wrong besides the high CPU temps which I will assume is related to high CPU load.
[doublepost=1511398402][/doublepost]
I'm just guessing here (and @brainshutdown can confirm it), maybe it did work somewhat, but it behaves a bit differently with NVidia (since the Ubuntu installtion is AMD specific). It can still see the card, but, if you can get your laptop to sleep, shutdown and restart properly, and it doesn't freeze all the time, it should be okay.
There is no Ubuntu installation. If you are referring to GRUB, then no, the outb commands in the GRUB menu entry are not AMD specific.
 

nate922

macrumors newbie
Aug 2, 2010
16
1
No. I'm saying the outb commands on the GRUB menu entry disables it. That nvram variable only defines the preference to boot using the integrated GPU, but doesn't disable the discrete GPU.

Understood.. Thanks.

Here is my config for grub, just a copy from yours, are there any other outb numbers that I should try?

bash-3.2# cat /Volumes/efi/boot/grub/grub.cfg
menuentry "macOS" {

insmod hfsplus

outb 0x728 1

outb 0x710 2

outb 0x740 2

outb 0x750 0

search --set=root --file /System/Library/CoreServices/boot.efi

chainloader /System/Library/CoreServices/boot.efi

}
 

xanderx007

macrumors 6502
Nov 7, 2017
262
140
I don't see anything wrong besides the high CPU temps which I will assume is related to high CPU load.

So it's just normal use. Thanks.

There is no Ubuntu installation. If you are referring to GRUB, then no, the outb commands in the GRUB menu entry are not AMD specific.

I was referring to the Ubuntu ISO boot drive, which has the amd64 tag.

Screen Shot 2017-11-23 at 08.56.05.png
 

xanderx007

macrumors 6502
Nov 7, 2017
262
140
There is no Ubuntu installation. If you are referring to GRUB, then no, the outb commands in the GRUB menu entry are not AMD specific.

Can I use terminal to install Grub on an external backup HDD via USB, or do I have to do it in Single User?

And how?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.