lkml.org 
[lkml]   [2006]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fix potential jiffies overflow
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
>
> >>>>> On Thu, 2 Mar 2006 10:43:12 -0600, "Ram Gupta" <ram.gupta5@gmail.com> said:
> >> I found i386 timer_resume is updating jiffies, not jiffies_64. It
> >> looks there is a potential overflow problem. Is this a correct
> >> fix?
>
> ram> The 64-bit jiffies value is not atomic. You need to hold
> ram> xtime_lock to read it.
>
> OK, and I guess wall_jiffies also needs xtime_lock.
>
>
> I found i386 timer_resume is updating jiffies, not jiffies_64. It
> looks there is a potential overflow problem. And jiffies_64 and
> wall_jiffies should be protected by xtime_lock.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
>
> diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
> index a14d594..9d30747 100644
> --- a/arch/i386/kernel/time.c
> +++ b/arch/i386/kernel/time.c
> @@ -412,9 +412,9 @@ static int timer_resume(struct sys_devic
> write_seqlock_irqsave(&xtime_lock, flags);
> xtime.tv_sec = sec;
> xtime.tv_nsec = 0;
> - write_sequnlock_irqrestore(&xtime_lock, flags);
> - jiffies += sleep_length;
> + jiffies_64 += sleep_length;
> wall_jiffies += sleep_length;
> + write_sequnlock_irqrestore(&xtime_lock, flags);
> if (last_timer->resume)
> last_timer->resume();
> cur_timer = last_timer;

Thanks, that looks like 2.6.16 material.

What happens if the machine slept for more than 49.7 days?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-03 03:48    [W:0.054 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site