public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Uhlenkott <jasonuhl@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: [PATCH] Make sched_clock() work in early boot
Date: Tue, 16 Aug 2005 19:59:16 +0000	[thread overview]
Message-ID: <20050816195916.GA753838@dragonfly.engr.sgi.com> (raw)

Turning on PRINTK_TIME causes us to die in early boot when sched_clock()
tries to access per-cpu data which isn't set up yet.

We can avoid this by doing a speculative load on the per-cpu data and
just returning zero if we fail.  This matches the way sched_clock()
appears to behave on most other arches if it gets called before we
know the cpu frequency.

Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com>

Index: linux/arch/ia64/kernel/head.S
=================================--- linux.orig/arch/ia64/kernel/head.S	2005-08-15 15:54:56.130313231 -0700
+++ linux/arch/ia64/kernel/head.S	2005-08-16 12:49:23.843747550 -0700
@@ -983,9 +983,10 @@
 	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
 	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
 	;;
-	ldf8 f8=[r8]
+	ldf8.s f8=[r8]
 	;;
 	setf.sig f9=r9		// certain to stall, so issue it _after_ ldf8...
+	chk.s r8, .recover
 	;;
 	xmpy.lu f10ù,f8	// calculate low 64 bits of 128-bit product	(4 cyc)
 	xmpy.hu f11ù,f8	// calculate high 64 bits of 128-bit product
@@ -995,6 +996,10 @@
 	;;
 	shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
 	br.ret.sptk.many rp
+.recover:			// per-cpu data isn't set up yet,
+				// so just return 0.
+	mov r8=r0
+	br.ret.sptk.many rp
 END(sched_clock)
 
 GLOBAL_ENTRY(start_kernel_thread)

             reply	other threads:[~2005-08-16 19:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16 19:59 Jason Uhlenkott [this message]
2005-08-16 20:11 ` [PATCH] Make sched_clock() work in early boot david mosberger
2005-08-16 20:17 ` Luck, Tony
2005-08-16 20:21 ` Jason Uhlenkott
2005-08-16 20:56 ` Luck, Tony
2005-08-16 21:11 ` Jason Uhlenkott
2005-08-16 21:21 ` Luck, Tony

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=20050816195916.GA753838@dragonfly.engr.sgi.com \
    --to=jasonuhl@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    /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