mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: ram.gupta5@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix potential jiffies overflow
Date: Thu, 2 Mar 2006 19:48:41 -0800	[thread overview]
Message-ID: <20060302194841.20737363.akpm@osdl.org> (raw)
In-Reply-To: <20060303.123110.32501622.nemoto@toshiba-tops.co.jp>

Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
>
> >>>>> On Thu, 2 Mar 2006 18:45:02 -0800, Andrew Morton <akpm@osdl.org> said:
> akpm> Thanks, that looks like 2.6.16 material.
> 
> akpm> What happens if the machine slept for more than 49.7 days?
> 
> Well, jiffies will lose 49.7 days...  Then, how about this?  We can
> sleep 136 years.
> 
> 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..be5d079 100644
> --- a/arch/i386/kernel/time.c
> +++ b/arch/i386/kernel/time.c
> @@ -400,7 +400,7 @@ static int timer_resume(struct sys_devic
>  {
>  	unsigned long flags;
>  	unsigned long sec;
> -	unsigned long sleep_length;
> +	u64 sleep_length;
>  
>  #ifdef CONFIG_HPET_TIMER
>  	if (is_hpet_enabled())
> @@ -408,7 +408,7 @@ static int timer_resume(struct sys_devic
>  #endif
>  	setup_pit_timer();
>  	sec = get_cmos_time() + clock_cmos_diff;
> -	sleep_length = (get_cmos_time() - sleep_start) * HZ;
> +	sleep_length = (u64)(get_cmos_time() - sleep_start) * HZ;
>  	write_seqlock_irqsave(&xtime_lock, flags);
>  	xtime.tv_sec = sec;
>  	xtime.tv_nsec = 0;

but...

	wall_jiffies += sleep_length;

wall_jiffies is 32-bit.

  reply	other threads:[~2006-03-03  3:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02 15:03 Atsushi Nemoto
2006-03-02 16:43 ` Ram Gupta
2006-03-03  2:32   ` Atsushi Nemoto
2006-03-03  2:45     ` Andrew Morton
2006-03-03  3:31       ` Atsushi Nemoto
2006-03-03  3:48         ` Andrew Morton [this message]
2006-03-03  4:39           ` Atsushi Nemoto
2006-03-05  1:10         ` Matt Mackall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060302194841.20737363.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ram.gupta5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome