27 Mar, 2006

2 commits

  • The nanosleep cleanup allows to remove the data field of hrtimer. The
    callback function can use container_of() to get it's own data. Since the
    hrtimer structure is anyway embedded in other structures, this adds no
    overhead.

    Signed-off-by: Roman Zippel
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roman Zippel
     
  • Pass current time to hrtimer_forward(). This allows to use the softirq time
    in the timer base when the forward function is called from the timer callback.
    Other places pass current time with a call to timer->base->get_time().

    Signed-off-by: Roman Zippel
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roman Zippel
     

26 Mar, 2006

2 commits

  • According to the specification the timevals must be validated and an
    errorcode -EINVAL returned in case the timevals are not in canonical form.
    This check was never done in Linux.

    The pre 2.6.16 code converted invalid timevals silently. Negative timeouts
    were converted by the timeval_to_jiffies conversion to the maximum timeout.

    hrtimers and the ktime_t operations expect timevals in canonical form.
    Otherwise random results might happen on 32 bits machines due to the
    optimized ktime_add/sub operations. Negative timeouts are treated as
    already expired. This might break applications which work on pre 2.6.16.

    To prevent random behaviour and API breakage the timevals are checked and
    invalid timevals sanitized in a simliar way as the pre 2.6.16 code did.

    Invalid timevals are reported with a per boot limited number of kernel
    messages so applications which use this misfeature can be corrected.

    After a grace period of one year the sanitizing should be replaced by a
    correct validation check. This is also documented in
    Documentation/feature-removal-schedule.txt

    The validation and sanitizing is done inside do_setitimer so all callers
    (sys_setitimer, compat_sys_setitimer, osf_setitimer) are catched.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     
  • alarm() calls the kernel with an unsigend int timeout in seconds. The
    value is stored in the tv_sec field of a struct timeval to setup the
    itimer. The tv_sec field of struct timeval is of type long, which causes
    the tv_sec value to be negative on 32 bit machines if seconds > INT_MAX.

    Before the hrtimer merge (pre 2.6.16) such a negative value was converted
    to the maximum jiffies timeout by the timeval_to_jiffies conversion. It's
    not clear whether this was intended or just happened to be done by the
    timeval_to_jiffies code.

    hrtimers expect a timeval in canonical form and treat a negative timeout as
    already expired. This breaks the legitimate usage of alarm() with a
    timeout value > INT_MAX seconds.

    For 32 bit machines it is therefor necessary to limit the internal seconds
    value to avoid API breakage. Instead of doing this in all implementations
    of sys_alarm the duplicated sys_alarm code is moved into a common function
    in itimer.c

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

02 Feb, 2006

2 commits


11 Jan, 2006

1 commit


28 Jul, 2005

1 commit

  • Fix the recent off-by-one fix in the itimer code:

    1. The repeating timer is figured using the requested time
    (not +1 as we know where we are in the jiffie).

    2. The tests for interval too large are left to the time_val to jiffie code.

    Signed-off-by: George Anzinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    George Anzinger
     

29 Jun, 2005

1 commit

  • As Steven Rostedt pointed out, there are 2 problems with ITIMER_REAL
    timers.

    1. do_setitimer() does not call del_timer_sync() in case
    when the timer is not pending (it_real_value() returns 0).
    This is wrong, the timer may still be running, and it can
    rearm itself.

    2. It calls del_timer_sync() with tsk->sighand->siglock held.
    This is deadlockable, because timer's handler needs this
    lock too.

    Signed-off-by: Oleg Nesterov
    Acked-by: Steven Rostedt
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

06 May, 2005

1 commit

  • It seems that the code responsible for this is in kernel/itimer.c:126:

    p->signal->real_timer.expires = jiffies + interval;
    add_timer(&p->signal->real_timer);

    If you request an interval of, lets say 900 usecs, the interval given by
    timeval_to_jiffies will be 1.

    If you request this when we are half-way between two timer ticks, the
    interval will only give 400 usecs.

    If we want to guarantee that we never ever give intervals less than
    requested, the simple solution would be to change that to:

    p->signal->real_timer.expires = jiffies + interval + 1;

    This however will produce pathological cases, like having a idle system
    being requested 1 ms timeouts will give systematically 2 ms timeouts,
    whereas currently it simply gives a few usecs less than 1 ms.

    The complex (and more computationally expensive) solution would be to
    check the gettimeofday time, and compute the correct number of jiffies.
    This way, if we request a 300 usecs timer 200 usecs inside the timer
    tick, we can wait just one tick, but not if we are 800 usecs inside the
    tick. This would also mean that we would have to lock preemption during
    these computations to avoid races, etc.

    I've searched the archives but couldn't find this particular issue being
    discussed before.

    Attached is a patch to do the simple solution, in case anybody thinks
    that it should be used.

    Signed-Off-By: Paulo Marques
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paulo Marques
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds