LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 01-18-2018, 11:19 AM   #1
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Rep: Reputation: Disabled
Hibernation takes ~10 seconds only once after a reboot; After resume, it takes about 3-4 minutes.


Hello, this issue is really weird. I got a Lenovo ThinkPad Yoga 370 and was able to successfully install Slackware64 14.2 after spending some R&D time (UEFI + NVMe SSD). Then, I realized that the WiFi card in this laptop is new and this version of Slackware (kernel 4.4.14) doesn't support it. No WiFi, but hibernation works fine even after resume.

Since I cannot live without WiFi, I downloaded and installed kernel 4.14.14 packages from Slackware64-Current. Now, WiFi works fine and hibernation sort of works... After a clean reboot, hibernation is very quick (5-10 seconds), but after resume, it takes almost 3-5 minutes. First time, I tried this, I thought that the process just hung and just force rebooted the machine. Next time, after a quick hibernation/resume, I decided to wait and hibernation worked almost after 3 minutes. I checked /var/log/messages and /var/log/syslog and found what's causing this delay.

Code:
PM: hibernation entry
...
PM: Syncing filesystems...
<---------------------------------- Almost 3-4 minutes delay here. No other processes.
PM: done
The first hibernation after a reboot doesn't have this delay. I have no idea why it takes this long to sync filesystems. I tried to hibernate right after resume and also tried to wait long. Didn't make a difference. Google returned similar symptoms, but not the same.

Not sure what I can do now. Does anyone have any idea what's causing this delay in filesystem syncing?

Summary:

Kernel 4.4.14: No WiFi support, but Hibernation works great

Kernel 4.14.14: WiFi support, but Hibernation becomes too slow from second time.

Thank you!

Last edited by geni4u; 01-18-2018 at 11:20 AM.
 
Old 01-18-2018, 11:59 AM   #2
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Gentoo, CentOS 7, Sailfish OS, Android
Posts: 167

Rep: Reputation: 31
Please list your mounts. Got any network fs mounted?
 
Old 01-18-2018, 12:30 PM   #3
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
No network mounts. I tried both swap partition and swap file. Got the same result.

FYI, memory is 8GB and SSD is 500GB:
* EFI 100mb starting from 2048 sector (aligned by gdisk)
* swap 10GB
* / 40GB
* /home rest

It's a dedicated Slackware machine.

Code:
/dev/nvme0n1p1   /boot/efi        vfat        defaults         0   1
#/dev/nvme0n1p2   swap             swap        defaults         0   0
/tmp/swapfile    none             swap        defaults         0   0
/dev/nvme0n1p3   /                ext4        defaults         1   1
/dev/nvme0n1p4   /home            ext4        defaults         1   2
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0

Last edited by geni4u; 01-18-2018 at 12:50 PM.
 
Old 01-18-2018, 02:00 PM   #4
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Gentoo, CentOS 7, Sailfish OS, Android
Posts: 167

Rep: Reputation: 31
Looks like you have a NVM Express drive. I would primarily blame the drive for that. Try to test the drive performance 1) after a boot 2) after a hibernation/resume.
Code:
hdparm -Tt --direct /dev/nvme0n1
as root. Better run the command several times in a row for more meaningful results.

Never had experience with this kind of an interface. From what I've read, some sophisticated alignment is needed. This Intel guide may be of any help. It also says about a way of more precise hdparm testing. Also you could try to play with kernel config. As long as you're a Slackware user I guess you're comfortable with kernel compilation. May be some drive specific config is missing for the new kernel.

p.s. Btw there is a forum thread about an issue that looks pretty similar to yours, but on Windows.
 
Old 01-18-2018, 06:16 PM   #5
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Ah! I never thought about that. It could be the NVMe driver.

This is result (average):
Code:
# after a fresh boot
cached reads: 1069.68 MB/sec
disk reads: 1478.48 MB/sec

# after a resume
cached reads: 1034.49 MB/sec
disk reads: 1536.72 MB/sec
No meaningful difference, I guess. This read/write test gave me the following result:
Code:
# after a fresh boot
write: 1.3 GB/sec
read: 2.8 GB/sec

# after a resume
write: 1.3 GB/sec
read: 2.8 GB/sec
Again, no difference there. I checked my alignment and since it's 2048-sector boundaries (512 bytes/sector), each starting block is all divisible by 4096 bytes. I found this article about my SSD (Samsung 960 EVO M.2 NVMe SSD 500GB). Looks like I had to use 6144 KiB (12288 sectors)? But, still its performance is consistent. Not sure if this is the culprit.

I'm looking into the kernel config now. Thanks for the hints!

Last edited by geni4u; 01-18-2018 at 06:26 PM.
 
Old 01-19-2018, 07:49 AM   #6
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
For our record, it was not the sys_sync() call between the "Syncing filesystems..." and "done" messages in hibernate() in kernel/power/hibernate.c. The delay was still there even after commenting out this call. I added more debug messages and found that some messages "before" creating the hibernation image were logged "after" resume in /var/log/message. And the location of delay was like random. I thought this was because of write buffering, so I added the sys_sync() call back and even added more after my debug messages to avoid buffering. Now, the delay had moved into freeze_processes() after "Syncing filesystems... done", so it was obvious that the delay was not because of the SSD. There was a loop that tries to freeze all threads in this function. Adding more debug messages with the names of threads being frozen, I found the delay right before freezing syslogd. I didn't think that syslogd was causing the delay. Instead, since this thread is responsible for logging debug messages into /var/log/message, killing this thread just happened to delay message logging after resume when the thread became alive. I tried to not kill this thread to see what would happen if syslogd was still alive. Now, the delay had moved one thread ahead, which was klogd. Hibernation worked, but the issue was still there. I skipped freezing klogd as well, but this time hibernation didn't work at all.

From these experiments, I was not able to find which thread is causing my issue because once syslogd and klogd got frozen, there is no way to see more debug messages with correct timestamps before hibernation completes (if my theory about syslogd is correct).

I even removed all modules and drivers related to network (because hibernation works fine without wifi in kernel 4.4.14), but no luck. Now, I don't have many options:
1. Live with slow hibernation
2. Just shutdown with no hibernation
3. Try Slackware64-current even if it's the same kernel 4.14.14 causing the issue "assuming" that it was a bad combination of the newer kernel and older packages (e.g., pm-utils...)

Maybe, I'll try the current branch later and report back.
 
Old 01-19-2018, 10:34 AM   #7
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Gentoo, CentOS 7, Sailfish OS, Android
Posts: 167

Rep: Reputation: 31
You also can try to use the LTS 4.9 kernel. I had some video driver glitches on gentoo with 4.14. Obviously I wasn't the only one facing issues with 4.14 so that the gentoo kernel ebuild was dowgraded to 4.9
 
Old 01-19-2018, 09:38 PM   #8
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Wow! You're awesome! I just tried kernel 4.9.77 and both wifi and hibernation work great!

1st hibernation: 5.1 seconds
2nd hibernation: 5.7 seconds
3rd hibernation: 14 seconds
4th hibernation: 12 seconds

This result is more than acceptable. I almost gave up and really appreciate your help.

Last edited by geni4u; 01-19-2018 at 09:46 PM.
 
Old 01-21-2018, 09:42 AM   #9
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
OK, I found the module that caused this hibernation issue. I was configuring screen auto-rotation and found that my 4.9.77 didn't recognize the Intel Sensor Hub at all. It worked with 4.14.14, so I compared their config files. It was the INTEL_ISH_HID module. When I compiled this module, the hibernation delay came back! Argh... so I had to choose either hibernation or auto-rotation; my pick was of course hibernation and manual rotation.

I'm going to try 4.14.14 without this module.
 
Old 01-21-2018, 11:24 AM   #10
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Gentoo, CentOS 7, Sailfish OS, Android
Posts: 167

Rep: Reputation: 31
The ISH is responsible for setting the CPU power-state, including putting the CPU into the low-power mode. Maybe somewhere there lays the root cause for the issue?
 
Old 01-21-2018, 01:07 PM   #11
geni4u
LQ Newbie
 
Registered: May 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Is ISH a must have? Isn't it a new feature so 4.9.77 without it works fine? This module was introduced in kernel 4.9. So there was no low-power CPU mode before this release? Or do we need ISH now to put the CPU in modern laptops into the low-power mode?

Found this article. "suspend and wakeup seems to be really slow now" after applying the intel-ish-hid patch.

From CONFIG_INTEL_ISH_HID: Intel Integrated Sensor Hub
Quote:
The Integrated Sensor Hub (ISH) enables the ability to offload sensor polling and algorithm processing to a dedicated low power processor in the chipset. This allows the core processor to go into low power modes more often, resulting in the increased battery life. The current processors that support ISH are: Cherrytrail, Skylake, Broxton and Kaby Lake.
So if I just completely disable the sensor hub, the core process doesn't have to do anything because there is no sensor data at all? Is it even possible to leave the sensor hub alive and deactivate this driver? I don't believe so. No driver, no hardware.. so no additional responsibilities to the core process.

Last edited by geni4u; 01-21-2018 at 03:10 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dovecot/postfix slows machine to a crawl, takes 30 minutes to reboot... ethonbridges Linux - Server 8 12-29-2017 12:41 PM
Measure the time it takes to resume after hibernation linkaran Linux - General 3 03-10-2013 08:48 AM
HELP !!! compression only takes a few seconds lukman Linux - Newbie 1 06-15-2006 01:28 AM
Mounting Reiser4 partition takes about 5 seconds DX2 Linux - General 4 05-03-2005 06:55 PM
NFS mount takes 6 seconds drspiffy Linux - Networking 5 03-16-2005 09:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 01:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration