getitimer returns it_value=0 erroneously

Bug #1349028 reported by George Greer on 2014-07-27
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Medium
Colin Ian King
Trusty
Undecided
Colin Ian King
Utopic
Medium
Colin Ian King

Bug Description

According to the 'getitimer()' man page: "The element it_value is set to the amount of time remaining on the timer, or zero if the timer is disabled. Similarly, it_interval is set to the reset value."

As such the following Perl program should never exit:

    use Time::HiRes;
    $SIG{VTALRM} = sub { };
    Time::HiRes::setitimer(&Time::HiRes::ITIMER_VIRTUAL, 0.5, 0.4);
    while (1) {
        my @t = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
        exit 0 if $t[0] == 0;
    }

and on linux-image 3.11.0-18-generic (and all other systems tested) it loops forever but 3.13.0-32-generic it exits. Have not bisected between those kernels, nor am I likely to be able to do so soon.

This Perl program shows the timer countdown:

use Time::HiRes;
my $r = [Time::HiRes::gettimeofday()];
sub display {
    my ($desc) = @_;
    my @t = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
    my $i = Time::HiRes::tv_interval($r);
    printf "%s: elasped=%.8f; time left=%.6f reset time=%.6f\n", $desc,
    $i,@t;
}
$SIG{VTALRM} = sub {
    display('VTALRM');
    exit;
};
Time::HiRes::setitimer(&Time::HiRes::ITIMER_VIRTUAL, 0.5, 0.4);
while (1) {
    display('inloop');
}

on other (working) systems it gives:

inloop: elasped=1.65178400; time left=0.001000 reset time=0.401000
inloop: elasped=1.65184200; time left=0.001000 reset time=0.401000
inloop: elasped=1.65186800; time left=0.001000 reset time=0.401000
inloop: elasped=1.65192300; time left=0.001000 reset time=0.401000
inloop: elasped=1.65198100; time left=0.001000 reset time=0.401000
VTALRM: elasped=1.65209800; time left=0.400000 reset time=0.401000
(end of file)

but on the 3.13.0-32-generic or later kernel I get:

inloop: elasped=0.54692100; time left=0.000033 reset time=0.400000
inloop: elasped=0.54692800; time left=0.000026 reset time=0.400000
inloop: elasped=0.54693500; time left=0.000020 reset time=0.400000
inloop: elasped=0.54694100; time left=0.000013 reset time=0.400000
inloop: elasped=0.54694800; time left=0.000007 reset time=0.400000
inloop: elasped=0.54695500; time left=0.000000 reset time=0.400000
inloop: elasped=0.54696200; time left=0.004000 reset time=0.400000
[...]
VTALRM: elasped=0.55013600; time left=0.397062 reset time=0.400000
(end of file)

The reset time also looks dodgy.

Hardware is an Intel Core i7-920 on Asus P6T Deluxe v2 (X58) motherboard and hasn't changed.

Requested information:

Ubuntu 3.13.0-32.57-generic 3.13.11.4

Description: Ubuntu 14.04.1 LTS
Release: 14.04

# apt-cache policy linux-image-generic
linux-image-generic:
  Installed: 3.13.0.32.38
  Candidate: 3.13.0.32.38
  Version table:
 *** 3.13.0.32.38 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu/ trusty-proposed/main amd64 Packages
        500 http://ppa.launchpad.net/canonical-kernel-team/ppa/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     3.13.0.24.28 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
---
ApportVersion: 2.14.1-0ubuntu3.2
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: tivrusky 3009 F.... pulseaudio
 /dev/snd/controlC0: tivrusky 3009 F.... pulseaudio
DistroRelease: Ubuntu 14.04
HibernationDevice: RESUME=UUID=c026abdc-9fee-425c-b5ae-020bf6ea2ad6
IwConfig:
 eth0 no wireless extensions.

 eth1 no wireless extensions.

 lo no wireless extensions.
MachineType: System manufacturer System Product Name
Package: linux (not installed)
ProcFB: 0 radeondrmfb
ProcKernelCmdLine: root=UUID=3ea7a4cb-eade-4906-b545-5133d8c14080 ro quiet splash
ProcVersionSignature: Ubuntu 3.13.0-32.57-generic 3.13.11.4
RelatedPackageVersions:
 linux-restricted-modules-3.13.0-32-generic N/A
 linux-backports-modules-3.13.0-32-generic N/A
 linux-firmware 1.127.5
RfKill:
 0: hci0: Bluetooth
  Soft blocked: no
  Hard blocked: no
Tags: trusty
Uname: Linux 3.13.0-32-generic x86_64
UpgradeStatus: Upgraded to trusty on 2014-06-10 (46 days ago)
UserGroups: adm admin cdrom dialout lpadmin mythtv plugdev sambashare vboxusers
WifiSyslog: Jul 26 20:23:08 zwei NetworkManager[1174]: <info> Policy set 'Wired connection 2' (eth1) as default for IPv6 routing and DNS.
WpaSupplicantLog:

_MarkForUpload: True
dmi.bios.date: 02/04/2009
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 0203
dmi.board.asset.tag: To Be Filled By O.E.M.
dmi.board.name: P6T DELUXE V2
dmi.board.vendor: ASUSTeK Computer INC.
dmi.board.version: Rev 1.xx
dmi.chassis.asset.tag: Asset-1234567890
dmi.chassis.type: 3
dmi.chassis.vendor: Chassis Manufacture
dmi.chassis.version: Chassis Version
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr0203:bd02/04/2009:svnSystemmanufacturer:pnSystemProductName:pvrSystemVersion:rvnASUSTeKComputerINC.:rnP6TDELUXEV2:rvrRev1.xx:cvnChassisManufacture:ct3:cvrChassisVersion:
dmi.product.name: System Product Name
dmi.product.version: System Version
dmi.sys.vendor: System manufacturer

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

apport-collect 1349028

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
tags: added: saucy

apport information

tags: added: apport-collected trusty
description: updated

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
tags: added: needs-bisect regression-update
tags: added: bios-outdated-1202
Changed in linux (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
Colin Ian King (colin-king) wrote :

I believe I have found a solution to this problem and I've got some kernel packages containing the fix for you to try out at:

http://kernel.ubuntu.com/~cking/lp-1349028/

Please give these a test and let me know if it resolves the issue for you.

Changed in linux (Ubuntu):
status: Confirmed → Incomplete
Colin Ian King (colin-king) wrote :

SRU Justification:

Impact:

The CONFIG_CONTEXT_TRACKING_FORCE should be disabled for
various reasons:

1. As described in the Kconfig "this option brings an
overhead that you don't want in production" and also
"Say Y only if you're working on the development of an
architecture backend for the context tracking."

Clearly for production kernel we should disable this.

2. Disabling this option also fixes bug LP:#1349028.

Testcase:

According to the getitimer() man page: "The element
it_value is set to the amount of time remaining on
the timer, or zero if the timer is disabled. Similarly,
it_interval is set to the reset value."

The following perl script should never exit:

    use Time::HiRes;
    $SIG{VTALRM} = sub { };
    Time::HiRes::setitimer(&Time::HiRes::ITIMER_VIRTUAL, 0.5, 0.4);
    while (1) {
        my @t = Time::HiRes::getitimer(&Time::HiRes::ITIMER_VIRTUAL);
        exit 0 if $t[0] == 0;
    }

With this config change the correct behaviour occurs.

Tim Gardner (timg-tpi) on 2014-07-31
Changed in linux (Ubuntu Trusty):
assignee: nobody → Colin Ian King (colin-king)
status: New → Fix Committed
Changed in linux (Ubuntu Utopic):
status: Incomplete → Fix Committed
George Greer (z-ubentu-6) wrote :

I can confirm that the linked kernels fix the bug. The test program never ends and the timer countdown is a lot less granular, never hitting exactly 0.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 3.16.0-7.12

---------------
linux (3.16.0-7.12) utopic; urgency=low

  [ Andy Whitcroft ]

  * rebase to v3.16 final
  * [Config] d-i -- add virtio_scsi to virtio-modules
    - LP: #1342000

  [ dann frazier ]

  * [Packaging] Fix 'printchanges' to work with versions containing '+'

  [ Tim Gardner ]

  * [Config] CONFIG_MICROCODE=y
    - LP: #1084373
  * [Config] CONFIG_CONTEXT_TRACKING_FORCE=n
    - LP: #1349028
  * [Config] Add hv_balloon to d-i virtio-modules
    - LP: #1292216
  * Release Tracking Bug
    - LP: #1354530

  [ Upstream Kernel Changes ]

  * rebase to v3.16
 -- Tim Gardner <email address hidden> Tue, 29 Jul 2014 09:55:15 -0400

Changed in linux (Ubuntu Utopic):
status: Fix Committed → Fix Released
Brad Figg (brad-figg) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-trusty' to 'verification-done-trusty'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-trusty
Colin Ian King (colin-king) wrote :

Tested on:

Linux ubuntu 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux, the perl script now does not exit and works as expected.

tags: added: verification-done-trusty
removed: verification-needed-trusty
Launchpad Janitor (janitor) wrote :
Download full text (38.9 KiB)

This bug was fixed in the package linux - 3.13.0-35.62

---------------
linux (3.13.0-35.62) trusty; urgency=low

  [ Joseph Salisbury ]

  * Release Tracking Bug
    - LP: #1357148

  [ Brad Figg ]

  * Start new release

  [ dann frazier ]

  * SAUCE: (no-up) Fix build failure on arm64
    - LP: #1353657
  * [debian] Allow for package revisions condusive for branching

  [ David Henningsson ]

  * SAUCE: Call broadwell specific functions from the hda driver
    - LP: #1317865

  [ Edward Lin ]

  * SAUCE: (no-up) Add use native backlight quirk for Dell Inspiron
    5547/5447
    - LP: #1332437

  [ Imre Deak ]

  * SAUCE: drm/i915: move power domain init earlier during system resume
    - LP: #1353405

  [ Jani Nikula ]

  * SAUCE: drm/i915: use lane count and link rate from VBT as minimums for
    eDP
    - LP: #1338582
  * SAUCE: drm/i915/dp: force eDP lane count to max available lanes on BDW
    - LP: #1338582
  * SAUCE: drm/i915: provide interface for audio driver to query cdclk
    - LP: #1188091
  * SAUCE: drm/i915: demote opregion excessive timeout WARN_ONCE to
    DRM_INFO_ONCE
    - LP: #1351014

  [ Joseph Salisbury ]

  * [Config] updateconfigs after Linux 3.13.11.6 updates

  [ Luis Henriques ]

  * Revert "[Packaging] linux-udeb-flavour -- standardise on linux prefix"

  [ Ming Lei ]

  * Revert "SAUCE: (no-up) ata: Fix the dma state machine lockup for the
    IDENTIFY DEVICE PIO mode command."
    - LP: #1335645

  [ Paulo Zanoni ]

  * SAUCE: drm/i915: consider the source max DP lane count too
    - LP: #1338582

  [ Tim Gardner ]

  * [Config] CONFIG_GPIO_SYSFS=y
    - LP: #1342153
  * [Config] CONFIG_KEYS_DEBUG_PROC_KEYS=y
    - LP: #1344405
  * [Config] updateconfigs
  * [Config] CONFIG_SCSI_IPR_TRACE=y, CONFIG_SCSI_IPR_DUMP=y
    - LP: #1343109
  * [Config] CONFIG_CONTEXT_TRACKING_FORCE=n
    - LP: #1349028

  [ Timo Aaltonen ]

  * SAUCE: Fix a typo in hda i915_bdw support.
    - LP: #1343140

  [ Upstream Kernel Changes ]

  * Revert "net/mlx4_en: Fix bad use of dev_id"
    - LP: #1347012
  * Revert "ACPI / AC: Remove AC's proc directory."
    - LP: #1356913
  * Revert "mac80211: move "bufferable MMPDU" check to fix AP mode scan"
    - LP: #1356913
  * mm, pcp: allow restoring percpu_pagelist_fraction default
    - LP: #1347088
  * net: Fix permission check in netlink_connect()
    - LP: #1312989
  * netlink: Rename netlink_capable netlink_allowed
    - LP: #1312989
  * net: Move the permission check in sock_diag_put_filterinfo to
    packet_diag_dump
    - LP: #1312989
  * net: Add variants of capable for use on on sockets
    - LP: #1312989
  * net: Add variants of capable for use on netlink messages
    - LP: #1312989
  * net: Use netlink_ns_capable to verify the permisions of netlink
    messages
    - LP: #1312989
  * netlink: Only check file credentials for implicit destinations
    - LP: #1312989
  * igb: fix stats for i210 rx_fifo_errors
    - LP: #1338893
  * HID: use multi input quirk for 22b9:2968
    - LP: #1339567
  * crypto/nx: disable NX on little endian builds
    - LP: #1338666
  * ACPI / video: Add Dell Inspiron 5737 to the blacklist
    - LP: #1250401
  * Input: elantech - deal with clickpads reportin...

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

Other bug subscribers