public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: linux-ia64@vger.kernel.org
Subject: Re: ia64 printk_clock()
Date: Mon, 06 Feb 2006 18:14:14 +0000	[thread overview]
Message-ID: <20060206181414.GA27657@agluck-lia64.sc.intel.com> (raw)
In-Reply-To: <20060202204422.GA27082@sgi.com>

On Fri, Feb 03, 2006 at 09:43:29AM -0800, Chen, Kenneth W wrote:
> Why don't we look at ar.k3, it contains per_cpu base address.
> If it has a none zero value, then it is initialized by
> per_cpu_init and is safe to call sched_clock.

We also need to check whether ar.itc is synchronized on different
cpus ... if it isn't, then sched_clock() is useless.  Here's a
simple extension of your patch that does this, falling back to using
a jiffie based clock (which means you'd only have HZ resolution on
systems where there is drift).

If that isn't good enough, then I'd be happy to see a patch that
does a lockless interpolation.

-Tony


diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index fbc7ea3..99cfef8 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -352,6 +352,7 @@ start_ap:
 	mov ar.rsc=0		// place RSE in enforced lazy mode
 	;;
 	loadrs			// clear the dirty partition
+	mov ar.k3=r0		// clear physical per-CPU base
 	;;
 	mov ar.bspstore=r2	// establish the new RSE stack
 	;;
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 028a2b9..648c116 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -278,3 +278,13 @@ udelay (unsigned long usecs)
 	}
 }
 EXPORT_SYMBOL(udelay);
+
+unsigned long long printk_clock(void)
+{
+	if (sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT) {
+		return (unsigned long long)(jiffies_64 - INITIAL_JIFFIES) *
+			(1000000000/HZ);
+	} else if (ia64_get_kr(IA64_KR_PER_CPU_DATA))
+		return sched_clock();
+	return 0;
+}

  parent reply	other threads:[~2006-02-06 18:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02 20:44 ia64 printk_clock() Jack Steiner
2006-02-02 21:22 ` Dean Roe
2006-02-02 21:46 ` Luck, Tony
2006-02-02 21:50 ` Jack Steiner
2006-02-02 22:29 ` Luck, Tony
2006-02-02 22:52 ` Chen, Kenneth W
2006-02-03 17:43 ` Chen, Kenneth W
2006-02-03 18:04 ` Luck, Tony
2006-02-03 18:30 ` Chen, Kenneth W
2006-02-03 18:43 ` Luck, Tony
2006-02-03 18:55 ` Chen, Kenneth W
2006-02-04  0:16 ` Keith Owens
2006-02-04  0:28 ` Chen, Kenneth W
2006-02-04  0:32 ` Luck, Tony
2006-02-04  0:36 ` Keith Owens
2006-02-06 18:14 ` Luck, Tony [this message]
2006-02-06 18:34 ` Chen, Kenneth W
2006-02-06 20:40 ` Magenheimer, Dan (HP Labs Fort Collins)
2006-02-06 21:37 ` Chen, Kenneth W
2006-02-07 11:11 ` Jes Sorensen
2006-02-08  0:05 ` Luck, Tony
2006-02-08  6:29 ` Jes Sorensen
2006-02-08 18:18 ` 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=20060206181414.GA27657@agluck-lia64.sc.intel.com \
    --to=tony.luck@intel.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