← Back to team overview

kernel-packages team mailing list archive

[Bug 1349028] [NEW] getitimer returns it_value=0 erroneously

 

Public bug reported:

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

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "lspci -vnvn"
   https://bugs.launchpad.net/bugs/1349028/+attachment/4163585/+files/lspci-vnvn.log

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1349028

Title:
  getitimer returns it_value=0 erroneously

Status in “linux” package in Ubuntu:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1349028/+subscriptions


Follow ups

References