XPS9350-macOS
XPS9350-macOS copied to clipboard
HWP + Sleep => KILLL
Hey, i used the patches etc.. i have used sleep once. After restart my partition died.. is that normal?
@JackGlobetrotter I've noticed this issue long time ago, there's nothing to do with HWP enable. More like sleep + nvme patch cause the issue.
Detail discussion can be found [here] (https://github.com/darkhandz/XPS15-9550-Sierra/commit/72f63339ff088dabe2bc9281b5f1a3dbe181ad31), the content is in Chinese.
In all, this problem
- not only occurs on XPS 13 SKL, but also XPS 15 SKL
- has nothing to do with HWP enable or not
- may have nothing to do with Osxaptiofixdrv or Osxaptiofix2drv
- maybe related to nvme + sleep(very possible the case)
It's pretty tough for us to find the bug, because once data lost, how to see the log?
Suggestion till now:
- Reduce times put laptop into sleep if possible
- Do not use Safari
syscl
How about disabling write on hibernate?
@x4080 notice this piece of code in deploy.sh
_tidy_exec "sudo pmset hibernatemode ${gTarHibernateMode}" "Change hibernatemode from ${gOrgHibernateMode} to ${gTarHibernateMode}"
That disable hibernate write to disk, but I am not sure if this help prevent data corrupted.
syscl
Ah I see, what I did was :
sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
sudo touch /var/vm/sleepimage
sudo chflags uchg /var/vm/sleepimage
I didn't have that sleep problem (but maybe I rarely do sleep)
@x4080 I rarely do sleep on XPS 13 9350 too. But it's a very convince function, especially when you open the lid then all the work pop on your screen.
I posted comment for Piker already, wish he could give us some light on this problem...
syscl
@syscl do you also have "sudo pmset -a disksleep 0" set in your script or would you recommend we do that? I believe this is the same thing as if you were to go to System Preferences>Energy Savings and uncheck the put hard disks to sleep, correct?
@R1MnTnA see the piece code in deploy.sh
_tidy_exec "sudo pmset hibernatemode ${gTarHibernateMode}" "Change hibernatemode from ${gOrgHibernateMode} to ${gTarHibernateMode}"
Deploy.sh has already included what you want.
syscl
@syscl Yes I noticed that part, thank you, very smart to do that, but I was referring to- sudo pmset -a disksleep 0
@R1MnTnA What this mean? Disk never sleep?
syscl
@syscl, yes. it is to turn off/disable the sleep option for the ssd. Because if it goes to sleep it might cause data corruption and since it the ssd uses very little power, it doesn't need to sleep.
@R1MnTnA Thank you for your suggestion, I will try to add this command line in deploy.sh at this stage. Though the finally solution should be that we figure out what cause the data lose.
Thank you, syscl
@syscl Yes, that is why I think this is the problem. By not disabling disksleep you can start to have data corruption if the power is cut off to the ssd while it's trying to write
@R1MnTnA Actually we still have no clues if this will work or not. In theory, if disk sleep causes the problem, then our life will be much easier.
@R1MnTnA do you have evidence you never encounter data corrupt when you disable disk sleep? We need more information and corruption cases to figure out what's wrong.
syscl
@syscl okay. I will investigate and test it out further. I know that if power is cut off to the ssd abruptly or when the computer goes to sleep and doesn't finish writing to the ssd, then that's when you can have data corruption. Also just as a FYI: I read on the forums by @rehabman that if you have a dual boot system with Windows and have installed the Paragon HFS+ software then this will also cause data corruption in Mac OS.
@R1MnTnA I never use Paragon HFS+ which caused my data lose 7 years ago. It will also cause sleep issue as well. He just told you the stories he heard from others, but I just showed my disaster experience.
That's it, syscl
Though it will be possible to cause data lose. But from my observation, it's not that easy as you imagine. If NVMe halt abruptly, why the whole FS structure get corrupted? HFS+ has the journey to restore data in this cases. What I'm afraid is that there's bugs when macOS sleep XPS 13 such that macOS writes information in wrong block then corrupted metadata block. Because all the cases I've seen so far are quiet similar: their FS structure corrupted.
syscl
Oh, okay. Now I understand. That is crazy. I will try to help and test why or how this could happen. Also I'm wondering if possible if the TRIM in Mac os is Trimming/writing over the wrong blocks. This happened in a Linux kernel depending on the ssd. Thank you for all your work on it so far.
@R1MnTnA I want to test sleep frequently to see what's going on. But because I use XPS 13 as daily drive now, I need to test it later, because a lot of important information are now on this laptop.
syscl
@syscl also I remember we had do this on old versions of OS, but do we still need to do this command- "sudo TRIMforce enable" or is it not necessary?
@R1MnTnA I do believe if you're running what the OS thinks is a supported SSD you don't have to. I have a Samsung PM961 and TRIM is enabled by default for supported SSDs in macOS. I do believe that it's probably because of Clover's kext patching though. If you look in system profiler and go to either the SATA section if you have a regular SATA M.2 SSD or the NVM Express section if you have an NVMe M.2 SSD it'll say in there if TRIM is supported or not. If it says No in the TRIM Supported section then you'll have to run sudo TRIMForce enable
@squash- Ok, makes sense. Thank you. I have the Toshiba and it is TRIM supported in system profile.
I think to have discovered something. I think corruption is strictly related to hibernatemode 3 (active).
Background story: For one month I used my 9360 without HWP nor ssdtprgen. Pure vanilla ssdts. Power mamagement was working very well, verified with AppleIntelInfo logs. Hibernatemode set to 0. Slept the machine hundreds of times.
Then I played with HWP and I discovered that everytime you turn on/off HWP (by injecting/removing plugin-type on CPU-0) AND everytime you make changes to frequencyvectors or other plist Power management settings, hibernatemode is automatically reset to 3. Yesterday the PC slept for 12+ hours, HWP had just been disabled but I forgot to reset hibernatemode to 0. Sleep-wake continued to work good, but the first time I restarted the machine I got unrecoverable file system corruption and I had to recover from a TimeMachine backup.
What are your thoughts on this?
@bozma88 I was trying to get hibernation working on my 9350 too to test about data corruption. I did hundred of sleeps too and got no problem at all. Then I set hibernatemode to 25 to test pure hibernation. The result I got was Clover not recognising the bootable drive as "hibernated" (couldn't find sleepimage offset according to boot.log). I tried to hibernate many many times and sometimes I discovered some "data corruption". Office suite for example was not working anymore, Apps randomly crashing and Siri voice damaged. Well, strange things. Yesterday I checked with an Hex Editor the sleepimage code and found out that it was made only of zeroes. So I deleted it and put the laptop back to hibernation. At boot (clean boot as clover didn't recognised the sleepimage) I got the Hex Editor software (and the dmg file I've downloaded seconds before) both damaged. Sleepimage file was still made out of zeroes.
So, I think that for some reason while hibernating is not writing RAM things in correct sectors, and I think this is something related to NVMe drive. So, I think we can confirm sleep has no problem at all, I would like to find out how to fix this up.
I have no problem in keeping hibernation disabled. 9360 in pure sleep draws 1% of battery every 3-5 hours.
My main concern is that it seems that some actions (changing hwp or other system settings) reset hibernatemode to 3.
I did read a lot of reports, all of them say the very same things:
- I got corruption and HWP was not enabled (so they disabled it without checking whether hibernatemode had been re-enabled)
- I got corruption and HWP was enabled (so they disabled it without checking whether hibernatemode had been re-enabled)
- I got corruption after changing SMBIOS and mac model (so the PM plist changed and they didn't check whether hibernatemode had been re-enabled).
No-one told: "I got corruption after installing the OS, disabling hibernatemode and not doing any further patching or system update after that".
So, @syscl, I think the issue can be solved by proactively doing some checks, maybe writing hibernatemode 0 every time the mac prepares for sleep.
What do you guys think?
@bozma88 , is 7th gen intel working ok with mac os?
Nice discover and now the switch SMBIOS may cause data corruption make sense!
Thank you @bozma88 @ZombieTheBest @R1MnTnA @squash- ! You all are awesome, I will keep updating ASAP. Till now my assignments and exams are going crazy... I am sorry for my late reply, but I appreciate to all your work! Will be back later!
Have a great day, syscl
@syscl As i reported in issue #49, adding pmset -a hibernatemode 0
in sleepwatcher
script fixes the hibernatemode changes. Of course i don't know if this optimal solution, but at least it works and avoid data corruption while sleeping!
Good luck with your exams!! 👍
@ZombieTheBest Yes, that's what I plan to do next :)
Hibernate 0 is a super fast and better sleep method IMO. But we need to confirm if the system read hibernate mode = 0 before we set it or after we set it to 0. Just like what @bozma88 worry about as well.
@bozma88 Does the hibernate mode very easy to be reset by system? I mean if I stick to MacBookPro13,2 with HWP, will hibernate mode be reset to 3 later?
Thank you, syscl
@syscl i tested it by setting hibernatemode to 25, then I put my laptop in stop. It didn't hibernate, it just goes to sleep, proving that (if i was not lucky) pmset -a hibernatemode 0
is triggered before that the OS reads the value. I don't know if this is it for 100% cases.
@ZombieTheBest Sorry I don't get it.
So, if sleep watcher + set hibernate mode = 25, then:
- laptop should not go to sleep right?
I mean if we need to confirm sleepwatcher + set hibernate = value works, we can try to set hibernate mode = 25 then put laptop sleep. Once we wake it up, it should do a fresh boot right? I don't know what will happen when set hibernate mode = 25.
Thank you, syscl