linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Troy Benjegerdes <hozer@drgw.net>
To: Jean-Denis Boyer <jdboyer@mediatrix.com>
Cc: trini@mvista.com, mgreer@mvista.com,
	"'Jim Thompson'" <jim@musenki.com>,
	linuxppc-embedded@lists.linuxppc.org
Subject: Re: Bogomips and loops_per_jiffy
Date: Tue, 7 May 2002 19:48:24 -0500	[thread overview]
Message-ID: <20020507194824.X6606@altus.drgw.net> (raw)
In-Reply-To: <F1BED55F35F4D3118C0F00E0295CFF4DFF9FEF@mail.mediatrix.com>; from jdboyer@mediatrix.com on Mon, May 06, 2002 at 05:17:40PM -0400


On Mon, May 06, 2002 at 05:17:40PM -0400, Jean-Denis Boyer wrote:
>
> Jim,
>
> I have found a fix for the hanging "Calibrating delay loop...".
>
> I added the following line at the beginning of
> the function "time_init" in arch/ppc/kernel/time.c
>
>   set_tb(0, 0);
>
> This resets the time base register and avoids the timer interrupt
> to set the second decrementer value to a very large one.
> It happens only when the TBL is large.
>
> This is a quick fix. Because I think it should work
> for any value of TB. It looks like that part of the code
> does not correctly support the overflow.
>
> Looking through the code, I wonder why the return value of
> the function "tb_delta" is signed.

Hrrm... that definitely seems wrong.

I think this is a signed vs unsigned overflow.

Can you try the following and see if it fixes the problem without the
'set_tb()' quick fix? This should be a more 'correct' fix.


===== time.c 1.42 vs edited =====
--- 1.42/arch/ppc/kernel/time.c	Fri Apr  5 12:39:36 2002
+++ edited/time.c	Tue May  7 19:40:39 2002
@@ -99,8 +99,8 @@
 EXPORT_SYMBOL(rtc_lock);

 /* Timer interrupt helper function */
-static inline int tb_delta(unsigned *jiffy_stamp) {
-	int delta;
+static inline unsigned tb_delta(unsigned *jiffy_stamp) {
+	unsigned delta;
 	if (__USE_RTC()) {
 		delta = get_rtcl();
 		if (delta < *jiffy_stamp) *jiffy_stamp -= 1000000000;
@@ -150,7 +150,7 @@
  */
 int timer_interrupt(struct pt_regs * regs)
 {
-	int next_dec;
+	unsigned next_dec;
 	unsigned long cpu = smp_processor_id();
 	unsigned jiffy_stamp = last_jiffy_stamp(cpu);
 	extern void do_IRQ(struct pt_regs *);
@@ -258,7 +258,7 @@
 void do_settimeofday(struct timeval *tv)
 {
 	unsigned long flags;
-	int tb_delta, new_usec, new_sec;
+	unsigned tb_delta, new_usec, new_sec;

 	write_lock_irqsave(&xtime_lock, flags);
 	/* Updating the RTC is not the job of this code. If the time is

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

  parent reply	other threads:[~2002-05-08  0:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-06 21:17 Bogomips and loops_per_jiffy Jean-Denis Boyer
2002-05-07  2:55 ` MPC823: Video non-interlace mode jari
2002-05-08  0:48 ` Troy Benjegerdes [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-05-10 14:54 Bogomips and loops_per_jiffy Jean-Denis Boyer
2002-05-10 20:15 ` Gabriel Paubert
2002-05-10 21:16   ` Benjamin Herrenschmidt
2002-05-11  2:08     ` Gabriel Paubert
2002-05-10 14:46 Jean-Denis Boyer
2002-05-10 14:15 Petersen, David (MED, GEMS-IT)
2002-05-10 14:10 Jean-Denis Boyer
2002-05-10 14:23 ` Allen Curtis
2002-05-10 15:06   ` Jerry Van Baren
2002-05-10 14:27 ` Gabriel Paubert
2002-05-10 14:29 ` Gabriel Paubert
2002-05-10 14:39   ` Allen Curtis
2002-05-08 18:30 Jean-Denis Boyer
2002-05-08 16:53 Jean-Denis Boyer
2002-05-08 17:43 ` Benjamin Herrenschmidt
2002-05-08 22:13   ` Gabriel Paubert
2002-05-09 15:08     ` Troy Benjegerdes
2002-05-09 16:16       ` Gabriel Paubert
2002-05-08 18:06 ` Troy Benjegerdes
2002-04-22 15:57 Jean-Denis Boyer
2002-04-19 11:57 Jim Thompson

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=20020507194824.X6606@altus.drgw.net \
    --to=hozer@drgw.net \
    --cc=jdboyer@mediatrix.com \
    --cc=jim@musenki.com \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    --cc=mgreer@mvista.com \
    --cc=trini@mvista.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;
as well as URLs for NNTP newsgroup(s).