CPUTune icon indicating copy to clipboard operation
CPUTune copied to clipboard

Kernel panic on 2015 AMD 15" rMBP + Catalina 10.15.5

Open JJGadgets opened this issue 4 years ago • 23 comments

Funny how right after my last issue #11 where I said "I haven't kernel panicked", I got one just 2 hours later. Heh.

Was messing around with the turbo ratio limits (said rate in the other issue, whoops), and after a few minutes of my last setting, my rMBP rebooted. I have the log this time (previous panic had no log or dialog). I also caught ytop giving an error pointing to a memory allocation issue right before the panic froze my machine, and as the kernel log confirms it's most likely a memory leak. Looks like changing CPUTune settings on the fly won't be an option for the time being.

Log start:

panic(cpu 2 caller 0xffffff800c977801): "zalloc: zone map exhausted while allocating from zone kalloc.80, likely due to memory leak in zone kalloc.80 (5923135920 total bytes, 74039199 elements allocated)"@/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/xnu/xnu-6153.121.2/osfmk/kern/zalloc.c:3559
Backtrace (CPU 2), Frame : Return Address
0xffffff91fa572d50 : 0xffffff800c91f5cd 
0xffffff91fa572da0 : 0xffffff800ca58b05 
0xffffff91fa572de0 : 0xffffff800ca4a68e 
0xffffff91fa572e30 : 0xffffff800c8c5a40 
0xffffff91fa572e50 : 0xffffff800c91ec97 
0xffffff91fa572f50 : 0xffffff800c91f087 
0xffffff91fa572fa0 : 0xffffff800d0c27cc 
0xffffff91fa573010 : 0xffffff800c977801 
0xffffff91fa573140 : 0xffffff800c92c4b4 
0xffffff91fa5731b0 : 0xffffff800c92ce04 
0xffffff91fa5731e0 : 0xffffff7f8db8920f 
0xffffff91fa573210 : 0xffffff7f8db8abfb 
0xffffff91fa573250 : 0xffffff7f8db8da80 
0xffffff91fa5732b0 : 0xffffff7f8db8a3a8 
0xffffff91fa573360 : 0xffffff7f8db8d17a 
0xffffff91fa573440 : 0xffffff7f8db99b89 
0xffffff91fa573470 : 0xffffff7f8db5404b 
0xffffff91fa5734b0 : 0xffffff7f8db5518a 
0xffffff91fa573530 : 0xffffff7f8db43fa9 
0xffffff91fa573610 : 0xffffff800cb72b5e 
0xffffff91fa573770 : 0xffffff800cb71e41 
0xffffff91fa573970 : 0xffffff800cb7ee9a 
0xffffff91fa573b50 : 0xffffff7f8eb36eb8 
0xffffff91fa573d80 : 0xffffff7f8eb34c68 
0xffffff91fa573e20 : 0xffffff800d0333e9 
0xffffff91fa573e90 : 0xffffff800d033309 
0xffffff91fa573ec0 : 0xffffff800c961565 
0xffffff91fa573f40 : 0xffffff800c961091 
0xffffff91fa573fa0 : 0xffffff800c8c513e 
      Kernel Extensions in backtrace:
         org.syscl.driver.CPUTune(2.2.1)[CFFB4956-94A8-39C7-99E9-1257777F4EC8]@0xffffff7f8eb33000->0xffffff7f8eb38fff
         com.apple.filesystems.apfs(1412.120.2)[E8865550-525E-3E0A-8BEA-D96D9CD57917]@0xffffff7f8db08000->0xffffff7f8dc2ffff
            dependency: com.apple.kec.corecrypto(1.0)[525BC31B-E9A9-3FE6-B565-5DC6BA91D8ED]@0xffffff7f8d29f000
            dependency: com.apple.driver.AppleEffaceableStorage(1.0)[5024BA75-70AA-3554-B8EB-0A71A64479E0]@0xffffff7f8dab4000
            dependency: com.apple.iokit.IOStorageFamily(2.1)[E13E9C61-F1F5-3A81-B1EF-65669C3CBDBF]@0xffffff7f8d265000

BSD process name corresponding to current thread: kernel_task

Mac OS version:
19F101

Kernel version:
Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
Kernel UUID: 54F1A78D-6F41-32BD-BFED-4381F9F6E2EF
Kernel slide:     0x000000000c600000
Kernel text base: 0xffffff800c800000
__HIB  text base: 0xffffff800c700000
System model name: MacBookPro11,5 (Mac-06F11F11946D27C5)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 31907943014514
Zone Name              Cur Size  Free Size
vm objects             68820992   21532928
VM map entries          4802160    4539680
pv_list                49086480       3696
vm pages                3923968      10816
kalloc.16              19660800    1079152
kalloc.32               4149248     458464
kalloc.48               9253440    1591968
kalloc.64              17543168    2939328
kalloc.80            5923135920          0
kalloc.96               4610400    1620768
kalloc.128              7426048    4334464
kalloc.160              1811520     969600
kalloc.192              1953792    1287168
kalloc.256              1490944     964608
kalloc.288              1329120     543456
kalloc.368              5797104    5227808
kalloc.512              1626112    1011712
kalloc.768              2015232    1499136
kalloc.1024             1425408     724992
kalloc.4096             2019328          0
kalloc.6144             2236416     589824
kalloc.8192             1155072          0
mem_obj_control         3194880     288528
ipc ports               5776344    5273016
vnodes                 67371008          0
namecache              27695040     609120
cluster_write           2872584     758136
ubc_info zone          16155216     182160
knote zone              1249280    1096576
vnode pager structur    7344000      83520
APFS_INODES            96814912     152720
vm pages array        226492416 34360060784
Kernel Stacks           7077888
PageTables             25219072
Kalloc.Large          172699648

Backtrace suspected of leaking: (outstanding bytes: 346240)
0xffffff800c9776f3 
0xffffff800c92c4b4 
0xffffff800ce88c81 
0xffffff7f8eb36db3 
0xffffff7f8eb36feb 
0xffffff7f8eb34b4a 
0xffffff800d0333e9 
0xffffff800d033309 
0xffffff800c961565 
0xffffff800c961091 
      Kernel Extensions in backtrace:
         org.syscl.driver.CPUTune(2.2.1)[CFFB4956-94A8-39C7-99E9-1257777F4EC8]@0xffffff7f8eb33000->0xffffff7f8eb38fff

last loaded kext at 31447142337167: com.sicreative.VoltageShift	1.21 (addr 0xffffff7f8eebf000, size 28672)
last unloaded kext at 31447182390998: com.sicreative.VoltageShift	1.21 (addr 0xffffff7f8eebf000, size 16384)
loaded kexts:
org.virtualbox.kext.VBoxNetAdp	6.1.0
com.splashtop.driver.SRXFrameBufferConnector	1.6
com.avatron.AVExFramebuffer	3.4.1
org.virtualbox.kext.VBoxNetFlt	6.1.0
com.Sonarworks.driver.Sonarworks	1.8.11
com.splashtop.driver.SRXDisplayCard	1.6
com.avatron.AVExVideo	3.4.1
org.virtualbox.kext.VBoxUSB	6.1.0
ch.tripmode.TripModeNKE	2.0.2
org.virtualbox.kext.VBoxDrv	6.1.0
com.intel.driver.EnergyDriver	3.7.0
org.syscl.driver.CPUTune	2.2.1
@kext.AMDFramebuffer	3.0.9
@kext.AMDRadeonX4000	3.0.9
@kext.AMDRadeonServiceManager	3.0.9
>!AGraphicsDevicePolicy	5.2.4
@AGDCPluginDisplayMetrics	5.2.4
>!AHV	1
>AudioAUUC	1.70
|IOUserEthernet	1.0.1
@fileutil	20.036.15
@filesystems.exfat	1.4
@filesystems.autofs	3.0
|IO!BSerialManager	7.0.5f6
>pmtelemetry	1
>!AUpstreamUserClient	3.6.8
@Dont_Steal_Mac_OS_X	7.0.0
>!A!IHD5000Graphics	14.0.6
>AGDCBacklightControl	5.2.4
>!AHDA	283.15
>eficheck	1
>!AThunderboltIP	3.1.4
|Broadcom!B20703USBTransport	7.0.5f6
>!A!IFramebufferAzul	14.0.6
>!ASMCLMU	212
>!AMuxControl	5.2.4
>AirPort.BrcmNIC	1400.1.1
>!ACameraInterface	7.6.0
@kext.AMD7000!C	3.0.9
>!A!ISlowAdaptiveClocking	4.0.0
>!AMCCSControl	1.14
@filesystems.ntfs	3.14.3
>!ATopCaseHIDEventDriver	3430.1
>!UTopCaseDriver	3430.1
>!UCardReader	489.120.1
@filesystems.apfs	1412.120.2
>!AAHCIPort	341.0.2
>!AVirtIO	1.0
@filesystems.hfs.kext	522.100.5
@!AFSCompression.!AFSCompressionTypeDataless	1.0.0d1
@BootCache	40
@!AFSCompression.!AFSCompressionTypeZlib	1.0.0
@private.KextAudit	1.0
>!ASmartBatteryManager	161.0.0
>!AACPIButtons	6.1
>!ARTC	2.0
>!AHPET	1.8
>!ASMBIOS	2.1
>!AACPIEC	6.1
>!AAPIC	1.7
$!AImage4	1
@nke.applicationfirewall	303
$TMSafetyNet	8
@!ASystemPolicy	2.0.0
|EndpointSecurity	1
@kext.AMDRadeonX4030HWLibs	1.0
@kext.AMDRadeonX4000HWServices	3.0.9
|IOAVB!F	850.1
|IOUSBUserClient	900.4.2
@kext.triggers	1.0
>!ASSE	1.0
@!AGPUWrangler	5.2.4
@plugin.IOgPTPPlugin	840.3
|IOEthernetAVB!C	1.1.0
>DspFuncLib	283.15
@kext.OSvKernDSPLib	529
>!ABacklightExpert	1.1.0
|IONDRVSupport	576.1
|Broadcom!BHost!CUSBTransport	7.0.5f6
|IO!BHost!CUSBTransport	7.0.5f6
|IO!BHost!CTransport	7.0.5f6
|IOAccelerator!F2	438.5.4
>!AHDA!C	283.15
|IOHDA!F	283.15
>!AGraphicsControl	5.2.4
|IO80211!F	1200.12.2b1
>mDNSOffloadUserClient	1.0.1b8
>corecapture	1.0.4
|IOSkywalk!F	1
@kext.AMDSupport	3.0.9
@!AGraphicsDeviceControl	5.2.4
|IOSlowAdaptiveClocking!F	1.0.0
>!ASMBus!C	1.0.18d1
|IOGraphics!F	576.1
>!AHS!BDriver	3430.1
>IO!BHIDDriver	7.0.5f6
|IO!B!F	7.0.5f6
|IO!BPacketLogger	7.0.5f6
>!AActuatorDriver	3440.1
>!AMultitouchDriver	3440.1
>!AInputDeviceSupport	3440.8
>!AHIDKeyboard	209
>usb.IOUSBHostHIDDevice	1.2
>usb.networking	5.0.0
>usb.!UHostCompositeDevice	1.2
|IOAHCIBlock!S	316.100.5
|IOAHCI!F	290.0.1
>usb.!UXHCIPCI	1.2
>usb.!UXHCI	1.2
|IOAudio!F	300.2
@vecLib.kext	1.2.0
|IOSerial!F	11
|IOSurface	269.11
@filesystems.hfs.encodings.kext	1
>!AThunderboltDPInAdapter	6.2.6
>!AThunderboltDPAdapter!F	6.2.6
>!AThunderboltPCIDownAdapter	2.5.4
>!AThunderboltNHI	5.8.6
|IOThunderbolt!F	7.6.1
>usb.!UHostPacketFilter	1.0
|IOUSB!F	900.4.2
>!AEFINVRAM	2.1
>!AEFIRuntime	2.1
|IOSMBus!F	1.1
|IOHID!F	2.0.0
$quarantine	4
$sandbox	300.0
@kext.!AMatch	1.0.0d1
>DiskImages	493.0.0
>!AFDEKeyStore	28.30
>!AEffaceable!S	1.0
>!AKeyStore	2
>!UTDM	489.120.1
|IOSCSIBlockCommandsDevice	422.120.3
>!ACredentialManager	1.0
>KernelRelayHost	1
>!ASEPManager	1.0.1
>IOSlaveProcessor	1
|IOTimeSync!F	840.3
|IONetworking!F	3.4
|IOUSBMass!SDriver	157.121.1
|IOSCSIArchitectureModel!F	422.120.3
|IO!S!F	2.1
|IOUSBHost!F	1.2
>!UHostMergeProperties	1.2
>usb.!UCommon	1.0
>!ABusPower!C	1.0
|CoreAnalytics!F	1
>!AMobileFileIntegrity	1.0.5
@kext.CoreTrust	1
|IOReport!F	47
>!AACPIPlatform	6.1
>!ASMC	3.1.9
>watchdog	1
|IOPCI!F	2.9
|IOACPI!F	1.4
@kec.pthread	1
@kec.Libm	1
@kec.corecrypto	1.0



JJGadgets avatar Jul 20 '20 22:07 JJGadgets

Thanks for the detailed backframe. I will take a look.

syscl avatar Jul 30 '20 02:07 syscl

No problem. Do you have any idea which feature could be causing this issue and if I can disable it for now to try and continue using CPUTune without the panics?

JJGadgets avatar Aug 01 '20 07:08 JJGadgets

@JJGadgets how about commented out some code path in the readConfigAtRuntime then compile it and give it a try?

syscl avatar Aug 04 '20 05:08 syscl

Hi @syscl ,

I am encountering the exact same crash/memory leak as the original poster.

I tried deleting all of the code for non-turboboost features, (lines 175-234 in CPUTune.cpp) but it still causes kernel panic after about an hour.

So it seems like the memory leak is in readFileAsBytes().

Thank you!

jamesmurdza avatar Aug 05 '20 15:08 jamesmurdza

@jamesmurdza would you mind try the latest version? and also commented out readConfigAtRuntime?

syscl avatar Aug 05 '20 21:08 syscl

When I comment out everything in readConfigAtRuntime the leak does not happen. This is in the latest version (2.2.5).

I recently upgraded from 1.9.0 to 2.2.1 which is when I first noticed the leak (zalloc). The leak also happens with the old readFileNBytes function and when commenting out all the readConfig code except for turbo boost.

jamesmurdza avatar Aug 06 '20 12:08 jamesmurdza

@jamesmurdza would you mind try the latest version? and also commented out readConfigAtRuntime?

I will do this over the weekend hopefully, been a bit behind in a couple projects at school. I've been disabling BD PROCHOT and assigning max turbo ratios using VoltageShift's manual MSR overwrite function (so that I don't get weird short but noticeable bursts of throttling even at ~65C while doing project research), but of course if I could do it from CPUTune that'd be great.

JJGadgets avatar Aug 06 '20 22:08 JJGadgets

Side note, is there any way for the CPU to still throttle despite disabling BD PROCHOT apart from T-Junction shutdown (100C for a 4870HQ)? Seems like unless I force the frequency like I did on Windows + ThrottleStop, there's still some other throttling that occurs rarely (can't pinpoint cause).

JJGadgets avatar Aug 06 '20 22:08 JJGadgets

Thanks @jamesmurdza! Which old version also has the leak you've mentioned?

syscl avatar Aug 08 '20 07:08 syscl

@JJGadgets currently you may need to do the code change. I think the problems happened at the readConfigAtRuntime function .

syscl avatar Aug 08 '20 07:08 syscl

Thanks @jamesmurdza! Which old version also has the leak you've mentioned?

Hi @syscl — That's what I would like to know as well! I will do some tests and get back to you.

jamesmurdza avatar Aug 09 '20 10:08 jamesmurdza

Hi @syscl, the problem seems to be related to the timer. This new code causes a memory leak:

    if (timerSource && !this->isInactive()) {
        // Don't use sender here which will cause MBP8,2(SANDYBRIDGE) KP
        timerSource->setTimeout(updateInterval);
    }

Whereas this does not:

    sender->setTimeoutMS(updateInterval);

Do you have an idea what the reason could be?

jamesmurdza avatar Aug 19 '20 08:08 jamesmurdza

@jamesmurdza nice catch! timerSource was used due to sender will cause MBP8,2(SANDYBRIDGE) kernel panic. I also a little bit confused about what's the difference between sender->setTimeoutMS(updateInterval); and timerSource->setTimeout(updateInterval).

But as you pointed out, could you try to use sender->setTimeoutMS(updateInterval); to see if there's no more memory leak?

Thanks in advance!

syscl avatar Aug 19 '20 21:08 syscl

@syscl yay I think it just fixed my kp on MBP2017 non-touchbar which due to memory leak; now I can run smoothly with HWP tweak without battery on catalina;

What I did notice is timerSource making my CPU always 100%

sooxt98 avatar Aug 30 '20 10:08 sooxt98

although memory leak doesn't happen anymore, but the cpu somehow still capped at 1.5 Ghz, BD_PROCHOT option does not effect on my bad battery @christophe-duc plz help me

image

sooxt98 avatar Aug 30 '20 11:08 sooxt98

@syscl the difference between sender->setTimeoutMS(updateInterval); and timerSource->setTimeout(updateInterval). is MS :3 It should be timerSource->setTimeoutMS(updateInterval)

sooxt98 avatar Aug 30 '20 13:08 sooxt98

@syscl the difference between sender->setTimeoutMS(updateInterval); and timerSource->setTimeout(updateInterval). is MS :3 It should be timerSource->setTimeoutMS(updateInterval)

@sooxt98 Good catch. It looks like setTimeout() defaults to nanoseconds instead of milliseconds. Default UpdateInterval is 1000, so instead of pausing for one second it would be pausing for one microsecond. The lack of any delay could be contributing to the memory leak. Does that seem logical?

jamesmurdza avatar Aug 30 '20 13:08 jamesmurdza

@jamesmurdza if you read the link, the setTimeout default timeout is in nanoseconds which makes the read config going crazy. https://developer.apple.com/documentation/kernel/iotimereventsource/1809617-settimeout

sooxt98 avatar Aug 30 '20 13:08 sooxt98

@sooxt98 Thanks for point it out, I corrected the setTimeout to setTimeoutMS. Let me know if this fix the issue! cc also @jamesmurdza

In the meantime, I don't know if it is my laptop's issue, I cannot generate CPUTuneCore.kext on my laptop, any idea? Sorry for the late reply since I'm on call this week.

syscl avatar Aug 31 '20 06:08 syscl

@syscl i does fix the issue; try to delete your build folder manually at ~/Library/Developer/Xcode/DerivedData

sooxt98 avatar Aug 31 '20 06:08 sooxt98

Thanks @sooxt98 , I removed ~/Library/Developer/Xcode/DerivedData and compiled but still cannot see CPUTuneCore.kext. Can you see the latest CPUTuneCore.kext?

syscl avatar Aug 31 '20 06:08 syscl

@syscl the build kext should appears inside the ~/Library/Developer/Xcode/DerivedData

sooxt98 avatar Aug 31 '20 07:08 sooxt98

@sooxt98 Thanks! I only have CPUTuneApp and CPUTuneApp.swiftmodule. :(

syscl avatar Aug 31 '20 07:08 syscl