Open bozma88 opened 4 years ago
Hi @bozma88,
Thank you for the feedback. Sleep/wakeup functionality for this kext is in a very rough state. In fact, I do not use sleep (I keep it disabled because of disk corruption issues), and the only changes I made regarding PM were to have the chip work again after wake (before it just died after wake and did not respond to commands). The only thing my PM code does (Sinetek_rtsx::setPowerState() method) is to save the state on sleep and re-initalize the chip on wake (restoring the state was not enough to get the chip working again after wake, so I do a full re-initialization after each wake).
If I understand correctly, you are getting random wakes AND a crash on wake? When I tested, I did not have any issues, but like I said, I decided to just give up on sleep because of the disk corruption issues, so I no longer use it.
Regarding ASPM, I think the OpenBSD driver (of which this kext is a port) does not support it, and if there's anything related to ASPM, it must be from some initialization code I moved from the Linux driver to make the initialization more stable (it seemed like the OpenBSD code was not fully initializing the chip). In any case, ASPM is not meant to be enabled.
I am not sure it will help, but I just issued a new beta release which uses the MSI interrupt (the current code is using INTx, maybe the wake are caused by a spurious interrupt, I don't know...) and ADMA. Maybe you can test that kext and see if this new release is better. Please check the kext thread here.
Thanks for the fast reply. No, I'm not getting sudden wakes. In Catalina, to disable every kind of sudden wakes you must set TCPKeepAlive=disabled in pmset, otherwise the OS will call home every 2 or 12 hours, even with lid closed.
What I'm getting with 2.2 release of your kext is a strange behaviour upon wake from sleep, and it happens ~10% o the times: laptop goes to sleep regularly, but when woken up (either by power button or lid open or trackpad tickle) the screen stays black and the OS freezes. Just before freezing, pmset logs a "sleep enter" event which is abnormal, because it lacks "sleep reason" and because it happens just when the laptop is indeed expected to wake up.
I will try your new release and report back. I still think it's something related to ASPM, as the card reader is reported to have L1 ASPM enabled (despite not showing any kind of power saving during idle).
PS: SSD corruption is not an issue anymore since long time, especially with SSDs that are SATA or NVME with 4k sectors. I can confirm total corruption safety with both a SATA Samsung SSD 850evo and NVME Sabrent Rocket formatted to 4K. Disk corruption was, in my opinion, due to a combination of the hack to run 512b sectors SSDs and undesired darkwakes, which enabled a different section of code of the NVME kext to control the SSD, which was left unpatched and communicated with the SSD in 4K. By either avoiding darkwakes or using a SATA SSD (which uses another Kext to talk with the disk) or a native 4K NVME SSD, sleep is no longer a issue.
I am reopening this because I still have the freeze issue after wake and I am now 100% sure it is caused by this kext. Recap: running on XPS 9360, card reader 525A, 10.15.7, kext version 9.0. Once every ~5 wakeups, my laptop freezes with black screen. Removing the kext OR disabling the card reader in BIOS always fixed the issue. This is a daily driver machine used 10h/day and I never experience any other wakeup issues.
NOW, the new discovery: I tried adding the boot argument rtsx_sleep_wake_delay_ms=1000
(even if not meant for the 525A) and now the freeze occurs one second later, givin time to MacOS to wake and paint the screen, and than it freezes.
If I put rtsx_sleep_wake_delay_ms=3000
, the laptop freezes after 3 seconds.
As before, it does not happen at every wake, but it seems that the longer the sleep time, the more it happens.
All other features of my hackintosh work perfectly. It's a real pity because it would be really useful to have SD reader functionality, but the fact that it breaks sleep (a feature that I use 20 times a day) it's a total deal-breaker for me.
Do you need any help to debug this?
Thank you
I have the same chip on a 9350, so pretty similar configuration, but I do not use sleep because of a different problem (disk corruption). I'll leave the issue open in case somebody with similar hw can help with this, but I don't think I can work on troubleshooting this in the near future because my free time at this moment is null (using sleep in my laptop means having to reinstall every 2 or 3 days).
By the way, some test you could do is trying sleep/wake from Linux and see if you get the same problem (no need to install it, any recent live USB should be good enough). If you do get the same issue you are totally out of luck (maybe hw issue?). If you don't, one of my long-term todo-projects is to migrate the Linux driver to macOS (right now this kext is based on the BSD one). That would provide full speed, support for all chips, better (maybe full) sleep/wake support... but like I said, I have zero free time now, that would have to wait at least for a year from now :(
Hi! I fought for 2 weeks with intermittend wake-from-sleep problems. Then I tried the only thing I didn't try: removing this kext. Wake from sleep problems 100% gone.
A few more info:
The card reader is 100% functional, it just makes the laptop hang after a wake from sleep, let's say 10% of the times, no matter if the card is inserted, if the laptop is on battery power or not, if the laptop had been kept sleeping for long or short time. 10% of the times, it fails to wake up (black screen, completely frozen).
There's something that makes me think it's a PM issue.
In Catalina, the card reader seems to have ASPM L1 supported and enabled. When the laptop crashes on wake up, there's actually a "Entering sleep" log line, as if the laptop tries to re-enter sleep just moments after waking up. This is what gets logged just moments before crashing:
2020-06-11 09:00:21 +0200 Sleep Entering Sleep state due to '':TCPKeepAlive=active Using Batt (Charge:18%)
Again: that's the exact time when I wake up the laptop. It logs that line and it crashes with black screen. If you look carefully, there are two oddities:
TCPKeepAlive=active
despite being disabled inpmset
. When entering sleep as normal behaviour, it's correctly stated asTCPKeepAlive=disabled
.This means that something is forcefuly putting the laptop to sleep. And it seems to be the card reader, for some strange reason.
Is there a way to give you more useful information regarding this issue?
Maybe you do not have ASPM enabled on the readers' PCIe lane?
Let me know, thank you!