Hibernate with fwts will cause hwclock command to time out

Bug #1333569 reported by Po-Hsu Lin
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Medium
Colin Ian King

Bug Description

This issue was found in bug 1327075
If you hibernate a system with fwts, and run the hwclock command, the hwclock command will complain that it was unable to access /dev/rtc, you have to reboot the system to have it back to normal.

ubuntu@201401-14542:~$ sudo hwclock -r ; sleep 3;sudo fwts -P s4 --s4-device-check --s4-device-check-delay=45 --s4-sleep-delay=120; sleep 3 ;sudo hwclock -r
Tue 24 Jun 2014 03:31:27 AM EDT -0.875913 seconds
Running 1 tests, results appended to results.log
Test: S4 hibernate/resume test.
  S4 hibernate/resume test. 4 passed, 1 failed
hwclock: select() to /dev/rtc to wait for clock tick timed out: No such file or directory
ubuntu@201401-14542:/dev$ ll rtc
lrwxrwxrwx 1 root root 4 Jun 23 04:59 rtc -> rtc0

It can be easily reproduced.

ubuntu@201401-14542:~$ fwts -v
fwts, Version V14.05.00, 2014-05-07 01:57:17
---
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: ubuntu 1587 F.... pulseaudio
                      ubuntu 2722 F.... pulseaudio
 /dev/snd/controlC0: ubuntu 1587 F.... pulseaudio
                      ubuntu 2722 F.... pulseaudio
CRDA:
 country TW:
  (2402 - 2472 @ 40), (3, 27)
  (5270 - 5330 @ 40), (3, 17), DFS
  (5735 - 5815 @ 40), (3, 30)
CurrentDesktop: Unity
DistroRelease: Ubuntu 14.04
HibernationDevice: RESUME=UUID=c009324a-f03b-4149-a917-82aa1d9d2631
InstallationDate: Installed on 2014-07-25 (6 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
MachineType: Dell Inc. Inspiron 5547
Package: linux (not installed)
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.13.0-24-generic.efi.signed root=UUID=71694704-97cb-4de1-ae78-cea0afb095b7 ro quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
RelatedPackageVersions:
 linux-restricted-modules-3.13.0-24-generic N/A
 linux-backports-modules-3.13.0-24-generic N/A
 linux-firmware 1.127
StagingDrivers: rts5139
Tags: trusty staging
Uname: Linux 3.13.0-24-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 02/12/2014
dmi.bios.vendor: Dell Inc.
dmi.bios.version: X18
dmi.board.name: 08KNCD
dmi.board.vendor: Dell Inc.
dmi.board.version: X01
dmi.chassis.type: 8
dmi.chassis.vendor: Dell Inc.
dmi.chassis.version: X18
dmi.modalias: dmi:bvnDellInc.:bvrX18:bd02/12/2014:svnDellInc.:pnInspiron5547:pvrX18:rvnDellInc.:rn08KNCD:rvrX01:cvnDellInc.:ct8:cvrX18:
dmi.product.name: Inspiron 5547
dmi.product.version: X18
dmi.sys.vendor: Dell Inc.

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :
Revision history for this message
Colin Ian King (colin-king) wrote :

Can you see if the following does the same:

sudo hwclock -r ; sleep 3; sudo pm-hibernate ; sleep 3 ;sudo hwclock -r

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Hello Colin,
sudo hwclock -r ; sleep 3; sudo pm-hibernate (for approx. 2min) ; sleep 3 ;sudo hwclock -r
Works fine

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Also, if I wake it up before it wake itself up automatically with fwts, this issue won't happen

ubuntu@201401-14542:~$ sudo hwclock -r ; sleep 3;sudo fwts -P s4 --s4-device-check --s4-device-check-delay=45 --s4-sleep-delay=120; sleep 3 ;sudo hwclock -r
Tue 24 Jun 2014 05:17:01 AM EDT -0.234698 seconds
Running 1 tests, results appended to results.log
Test: S4 hibernate/resume test.
(Wake it up manually after 1 minute)
  S4 hibernate/resume test. 4 passed, 1 failed
Tue 24 Jun 2014 05:19:45 AM EDT -0.437938 seconds
ubuntu@201401-14542:~$ sudo hwclock -r ; sleep 3;sudo fwts -P s4 --s4-device-check --s4-device-check-delay=45 --s4-sleep-delay=120; sleep 3 ;sudo hwclock -r
Tue 24 Jun 2014 05:20:33 AM EDT -0.812936 seconds
Running 1 tests, results appended to results.log
Test: S4 hibernate/resume test.
(Let it wake itself up)
  S4 hibernate/resume test. 4 passed, 1 failed
hwclock: select() to /dev/rtc to wait for clock tick timed out: No such file or directory

Revision history for this message
Colin Ian King (colin-king) wrote :

I can repoduce this with a 3.15 kernel, strace is showing that hwlock is timing out on the RTC:

open("/dev/rtc", O_RDONLY) = 3
stat("/etc/adjtime", 0x7fff75509770) = -1 ENOENT (No such file or directory)
ioctl(3, PHN_SET_REGS or RTC_UIE_ON, 0) = 0
select(4, [3], NULL, NULL, {5, 0}) = 0 (Timeout)

I'm currently thinking that fwts has tickled a RTC bug in the kernel rather than this being a fwts fault.

Revision history for this message
Colin Ian King (colin-king) wrote :

I've observed that before hibernate the rtc is not firing:

watch -n 1 "cat /proc/interrupts | grep rtc"

however, after the resume from hibernate it is firing off at ~60Hz, so it maybe that the RTC is in a broken state after resume from hibernate for some reason.

Revision history for this message
Colin Ian King (colin-king) wrote :

And this *only* happens if the machine resumes from hibernate using the RTC wakealarm. So it smells like a kernel bug and not an issue in fwts per se.

Revision history for this message
Colin Ian King (colin-king) wrote :

Which kernel was being used?

Changed in fwts:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Colin Ian King (colin-king) wrote :

Ah, 3.13.0-29-generic, I'll see if this bug has been around in previous upstream versions now I've got an easy reproducer.

Changed in fwts:
assignee: nobody → Colin King (colin-king)
Changed in linux (Ubuntu):
assignee: nobody → Colin King (colin-king)
Revision history for this message
Brad Figg (brad-figg) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1333569

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Po-Hsu Lin (cypressyew) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected staging trusty
description: updated
Revision history for this message
Po-Hsu Lin (cypressyew) wrote : BootDmesg.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : IwConfig.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : Lspci.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : Lsusb.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : ProcEnviron.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : ProcModules.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : PulseList.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : RfKill.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : UdevDb.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : UdevLog.txt

apport information

Revision history for this message
Po-Hsu Lin (cypressyew) wrote : WifiSyslog.txt

apport information

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Colin Ian King (colin-king) wrote :

I can't reproduce this with the latest version of fwts 14.09.00 and the 3.13.0-37 kernel. Can you re-test this for me with the latest fwts and kernel?

Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Changed in fwts:
status: Confirmed → Incomplete
Revision history for this message
Colin Ian King (colin-king) wrote :

Correction, I can see the failure now, I didn't observe the final hwclock was timing out after 10 seconds since I was using utopic userspace and not trusty userspace hwclock.

Revision history for this message
Colin Ian King (colin-king) wrote :

Just a note:

1. The utopic version of hwclock has a 10 second timeout but does not report a timeout error (which is misleading)
2. The trusty version reports the timeout, but prints the errno from the previous system call, so the error message is misleading
3. When I get hwclock time-out the following kernel message appears:

   hpet1: lost 20 rtc interrupts

4. I've tested this back to 3.12 and we see the same issue there too.

Changed in linux (Ubuntu):
status: Incomplete → In Progress
Changed in fwts:
status: Incomplete → In Progress
Revision history for this message
Colin Ian King (colin-king) wrote :

Fix sent upstream for review. https://lkml.org/lkml/2014/9/26/701

Changed in linux (Ubuntu):
importance: Undecided → Medium
no longer affects: fwts
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 3.18.0-9.10

---------------
linux (3.18.0-9.10) vivid; urgency=low

  [ Colin Ian King ]

  * SAUCE: drivers/rtc/interface.c: ignore exprired times when enqueing new
    timers
    - LP: #1333569

  [ Joseph Salisbury ]

  * [Config] Enable CONFIG_N_GSM as module.
    - LP: #1404670

  [ K. Y. Srinivasan ]

  * SAUCE: storvsc: force SPC-3 compliance on win8 and win8 r2 hosts
    - LP: #1406867

  [ Leann Ogasawara ]

  * rebase to v3.18.2
  * Release Tracking Bug
    - LP: #1409794

  [ Upstream Kernel Changes ]

  * Drivers: hv: util: make struct hv_do_fcopy match Hyper-V host messages
    - LP: #1401903
  * rebase to v3.18.2
 -- Leann Ogasawara <email address hidden> Mon, 12 Jan 2015 08:53:12 -0800

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.