Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ps-max-latency-us set to 0, but APST is still On #830

Closed
zacharysalvatore opened this issue Apr 10, 2020 · 6 comments
Closed

ps-max-latency-us set to 0, but APST is still On #830

zacharysalvatore opened this issue Apr 10, 2020 · 6 comments

Comments

@zacharysalvatore
Copy link

zacharysalvatore commented Apr 10, 2020

with -nvmefdbg flag. apst status is 1
IMG_8519

Python 2020-04-10 at 16 23 25@2x
IORegistryExplorer 2020-04-10 at 16 12 02@2x

IORegistryExplorer 2020-04-10 at 13 34 26@2x

Your README states that if ps-max-latency-us set to 0 then APST is disabled. So i think maybe this is a bug. By the way, I'm running macOS 10.15.4 with opencore on PM981 now.

@zacharysalvatore zacharysalvatore changed the title ps-max-latency-us set to 0, but ASPT is still On ps-max-latency-us set to 0, but APST is still On Apr 10, 2020
@07151129
Copy link

It looks like the controller has it already enabled for some reason, so NVMeFix detects this and leaves it as is. Would you be interested in force disable behaviour?

@sinag
Copy link

sinag commented Apr 17, 2020

@zacharysalvatore can you tell me how to set ps-max-latency-us to 0

@vit9696
Copy link
Contributor

vit9696 commented Apr 17, 2020

I guess I will close this as by design. Currently NVMeFix does not disable APST when it is already enabled. This can be considered a feature request, but we do not have plans to work on it in the nearest future. Feel free to contribute a patch if you want.

@vit9696 vit9696 closed this as completed Apr 17, 2020
@keatliang2005
Copy link

keatliang2005 commented Jul 6, 2021

Sorry for dug up some old thread, recently i have issue with SSD ASPM related kernel panic.

Kingston KC2500 latest firmware seems like having issue in ASPM in macOS
for workaround, currently i use Device Property disable ASPM pci-aspm-default with <00 00>, that seems resolved the issue.

i try load just the NVMEFix, seems like it does nothing., cold boot would crash with panic, after that i would work, but put into sleep and wake it would panic again.

then i go thu the readme i am not sure how actually use it,

here is my puzzle part

puzzle part 1: readme suggest we had to inject property to target PCI SSD path inject with pci-aspm-default with <02 00 00 00> (hex) which is AgAAAA== (data)

does it all i need to do ? and let the kext do it's autonomous fix ?

puzzle part 2: then i see the following to inject the PCI path with this property ps-max-latency-us , i am not sure how is the little-endian 8-byte like in 100000 microseconds, is it <31 30 30 30 30 30 00 00> hex / base64 MTAwMDAwAAA= is my conversion correct ?

do i need to inject ps-max-latency-us in order to work ? or is it something it will take care by the kext itself ?

puzzle part 3: or is my nvme ssd drive , is not supported by NVMEFix ?

@vit9696
Copy link
Contributor

vit9696 commented Jul 6, 2021

Well, if the drive does not support ASPM, why do you bring NVMeFix and try to enable it?

@keatliang2005
Copy link

keatliang2005 commented Jul 7, 2021

emmm... previously it works out of box with intel nuc hades canyon, the SSD from Kingston KC2500 is on NVME 1.3 and the controller is Silicon Motion SM2262EN, it suppose can support ASPM
https://www.thessdreview.com/our-reviews/silicon-motion-sm2262en-controller-preview-2tb/5/
https://www.flashmemorysummit.com/English/Collaterals/Proceedings/2017/20170810_FA31_Huang.pdf

Until i updated the SSD firmware to latest version. (S7780102),
https://www.kingston.com/us/support/technical/ksm-firmware-update
https://media.kingston.com/support/downloads/SKC2500_S7780102_RN.pdf
Panic scenario 1: cold boot will result in panic within minutes once it is idle
Panic scenario 2: put into sleep and wake

these are vanilla
default L1 state

panic(cpu 0 caller 0xffffff8013cce860): nvme: "Fatal error occurred. CSTS=0xffffffff US[1]=0x0 US[0]=0xef VID=0xffff DID=0xffff
. FW Revision=S7780102\n"@/System/Volumes/Data/SWE/macOS/BuildRoots/e90674e518/Library/Caches/com.apple.xbs/Sources/IONVMeFamily/IONVMeFamily-557.120.1/Common/IONVMeController.cpp:5499
Backtrace (CPU 0), Frame : Return Address
0xffffffa0afdfb9c0 : 0xffffff801148e0dd mach_kernel : _handle_debugger_trap + 0x3fd
0xffffffa0afdfba10 : 0xffffff80115d4f33 mach_kernel : _kdp_i386_trap + 0x143
0xffffffa0afdfba50 : 0xffffff80115c552a mach_kernel : _kernel_trap + 0x55a
0xffffffa0afdfbaa0 : 0xffffff8011432a2f mach_kernel : _return_from_trap + 0xff
0xffffffa0afdfbac0 : 0xffffff801148d8fd mach_kernel : _DebuggerTrapWithState + 0xad
0xffffffa0afdfbbe0 : 0xffffff801148dbf3 mach_kernel : _panic_trap_to_debugger + 0x273
0xffffffa0afdfbc50 : 0xffffff8011c9d81a mach_kernel : _panic + 0x54
0xffffffa0afdfbcc0 : 0xffffff8013cce860 com.apple.iokit.IONVMeFamily : __ZN16IONVMeController14CommandTimeoutEP16AppleNVMeRequest.cold.1
0xffffffa0afdfbce0 : 0xffffff8013cb345b com.apple.iokit.IONVMeFamily : __ZN16IONVMeController13FatalHandlingEv + 0x1af
0xffffffa0afdfbe40 : 0xffffff8013cb3285 com.apple.iokit.IONVMeFamily : __ZN16IONVMeController11ThreadEntryEv + 0x313
0xffffffa0afdfbe80 : 0xffffff80114d46c5 mach_kernel : _thread_call_delayed_timer + 0x4a5
0xffffffa0afdfbef0 : 0xffffff80114d5634 mach_kernel : _thread_call_delayed_timer + 0x1414
0xffffffa0afdfbfa0 : 0xffffff801143213e mach_kernel : _call_continuation + 0x2e
      Kernel Extensions in backtrace:
         com.apple.iokit.IONVMeFamily(2.1)[38BC0D0C-B305-30F6-8A8D-6804830F891A]@0xffffff8013cac000->0xffffff8013cd5fff
            dependency: com.apple.driver.AppleEFINVRAM(2.1)[423BF733-A622-3BC9-8F0F-920A2927CD35]@0xffffff80128fe000->0xffffff8012907fff
            dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[366C7BD4-9502-3D1C-ABBE-DE9749913D0C]@0xffffff8012ac0000->0xffffff8012ad5fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[99A70889-A31C-3B25-8E88-ADD3F317E4E4]@0xffffff8013f6a000->0xffffff8013f92fff
            dependency: com.apple.iokit.IOReportFamily(47)[367CCAE7-DAB4-3424-B191-44044619D5CB]@0xffffff8013fa1000->0xffffff8013fa3fff
            dependency: com.apple.iokit.IOStorageFamily(2.1)[A0D72FE9-649B-316A-8B5C-934E295FF0B5]@0xffffff801406d000->0xffffff801407efff

Process name corresponding to current thread: kernel_task
Boot args: alcid=11 agdpmod=ignore -disablegfxfirmware shikigva=32 shiki-id=Mac-BE088AF8C5EB4FA2 igfxmetal=1 keepsyms=1 debug=0x146 watchdog=0 -liludbgall -v

Mac OS version:
20F71

Kernel version:
Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64
Kernel UUID: 52A1E876-863E-38E3-AC80-09BBAB13B752
KernelCache slide: 0x0000000011200000
KernelCache base:  0xffffff8011400000
Kernel slide:      0x0000000011210000
Kernel text base:  0xffffff8011410000
__HIB  text base: 0xffffff8011300000
System model name: Macmini8,1 (Mac-7BA5B2DFE22DDD8C)
System shutdown begun: NO
Panic diags file available: YES (0x0)
Hibernation exit count: 0

System uptime in nanoseconds: 469062874965
Last Sleep:           absolute           base_tsc          base_nano
  Uptime  : 0x0000006d36537fc9
  Sleep   : 0x0000006cf536d5c6 0x0000000f32f31b58 0x0000000000000000
  Wake    : 0x0000006cf77f79e8 0x00000002ffeb8126 0x0000006cf567da07

later i found out that, kingston tool only provide update, and no way to downgrade to older firmware with their tools. 🥲

The only stable workaround is either disable ASPM from bios, or Property Inject pci-aspm-default <00 00> to the PCI path of SSD

Then i started to thinker with nvmefix, maybe can bring back some power management feature
As soon i started to load the kext with SSD default L1, i have random panic as soon i boot, more frequent without the kexts

I even try to inject device property pci-aspm-default <02 00 00 00>, the result seem similar

these are with nvmefix
L1 with nvme FIX
L1 with nvme FIX 2
L1 with nvme FIX 3

panic(cpu 0 caller 0xffffff801a4ce860): nvme: "Fatal error occurred. CSTS=0x1 US[1]=0x0 US[0]=0xf3 VID=0x2646 DID=0x2262
. FW Revision=S7780102\n"@/System/Volumes/Data/SWE/macOS/BuildRoots/e90674e518/Library/Caches/com.apple.xbs/Sources/IONVMeFamily/IONVMeFamily-557.120.1/Common/IONVMeController.cpp:5499
Backtrace (CPU 0), Frame : Return Address
0xffffffb0c2083960 : 0xffffff8017c8e0dd mach_kernel : _handle_debugger_trap + 0x3fd
0xffffffb0c20839b0 : 0xffffff8017dd4f33 mach_kernel : _kdp_i386_trap + 0x143
0xffffffb0c20839f0 : 0xffffff8017dc552a mach_kernel : _kernel_trap + 0x55a
0xffffffb0c2083a40 : 0xffffff8017c32a2f mach_kernel : _return_from_trap + 0xff
0xffffffb0c2083a60 : 0xffffff8017c8d8fd mach_kernel : _DebuggerTrapWithState + 0xad
0xffffffb0c2083b80 : 0xffffff8017c8dbf3 mach_kernel : _panic_trap_to_debugger + 0x273
0xffffffb0c2083bf0 : 0xffffff801849d81a mach_kernel : _panic + 0x54
0xffffffb0c2083c60 : 0xffffff801a4ce860 com.apple.iokit.IONVMeFamily : __ZN16IONVMeController14CommandTimeoutEP16AppleNVMeRequest.cold.1
0xffffffb0c2083c80 : 0xffffff801a4b345b com.apple.iokit.IONVMeFamily : __ZN16IONVMeController13FatalHandlingEv + 0x1af
0xffffffb0c2083de0 : 0xffffff80183f4465 mach_kernel : __ZN18IOTimerEventSource15timeoutSignaledEPvS0_ + 0xa5
0xffffffb0c2083e50 : 0xffffff80183f4366 mach_kernel : __ZN18IOTimerEventSource17timeoutAndReleaseEPvS0_ + 0xc6
0xffffffb0c2083e80 : 0xffffff8017cd46c5 mach_kernel : _thread_call_delayed_timer + 0x4a5
0xffffffb0c2083ef0 : 0xffffff8017cd5634 mach_kernel : _thread_call_delayed_timer + 0x1414
0xffffffb0c2083fa0 : 0xffffff8017c3213e mach_kernel : _call_continuation + 0x2e
      Kernel Extensions in backtrace:
         com.apple.iokit.IONVMeFamily(2.1)[38BC0D0C-B305-30F6-8A8D-6804830F891A]@0xffffff801a4ac000->0xffffff801a4d5fff
            dependency: com.apple.driver.AppleEFINVRAM(2.1)[423BF733-A622-3BC9-8F0F-920A2927CD35]@0xffffff80190fe000->0xffffff8019107fff
            dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[366C7BD4-9502-3D1C-ABBE-DE9749913D0C]@0xffffff80192c0000->0xffffff80192d5fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[99A70889-A31C-3B25-8E88-ADD3F317E4E4]@0xffffff801a76a000->0xffffff801a792fff
            dependency: com.apple.iokit.IOReportFamily(47)[367CCAE7-DAB4-3424-B191-44044619D5CB]@0xffffff801a7a1000->0xffffff801a7a3fff
            dependency: com.apple.iokit.IOStorageFamily(2.1)[A0D72FE9-649B-316A-8B5C-934E295FF0B5]@0xffffff801a86d000->0xffffff801a87efff

Process name corresponding to current thread: kernel_task
Boot args: alcid=11 agdpmod=ignore -disablegfxfirmware shikigva=32 shiki-id=Mac-BE088AF8C5EB4FA2 igfxmetal=1 keepsyms=1 debug=0x146 watchdog=0 -liludbgall -v

Mac OS version:
20F71

Kernel version:
Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64
Kernel UUID: 52A1E876-863E-38E3-AC80-09BBAB13B752
KernelCache slide: 0x0000000017a00000
KernelCache base:  0xffffff8017c00000
Kernel slide:      0x0000000017a10000
Kernel text base:  0xffffff8017c10000
__HIB  text base: 0xffffff8017b00000
System model name: Macmini8,1 (Mac-7BA5B2DFE22DDD8C)
System shutdown begun: NO
Panic diags file available: YES (0x0)
Hibernation exit count: 0

System uptime in nanoseconds: 321245689834
Last Sleep:           absolute           base_tsc          base_nano
  Uptime  : 0x0000004acbbc3f89
  Sleep   : 0x0000000000000000 0x0000000000000000 0x0000000000000000
  Wake    : 0x0000000000000000 0x0000000f621a764f 0x0000000000000000



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants