linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: linux-kernel@vger.kernel.org,
	Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	john stultz <johnstul@us.ibm.com>
Subject: get_cycles() on i386
Date: Tue, 4 Nov 2003 15:22:53 -0800	[thread overview]
Message-ID: <20031104232252.GG5792@ca-server1.us.oracle.com> (raw)

Folks,
	Certain distributions are building all of their SMP kernels
NUMA-aware.  This is great, as the kernels support boxes like the x440
with no trouble.  However, this implicitly disables CONFIG_X86_TSC.
While that is good for NUMA systems, and fine from a kernel timing
standpoint, it also eliminates any generic access to the TSC via
get_cycles().  With CONFIG_X86_TSC not defined, get_cycles() always
returns 0.
	Given that >95% of machines will not be x440s, this means that a
user of that kernel cannot access a high resolution timer via
get_cycles().  I don't want to have to litter my code with rdtscll()
when I managed to remove it!
	The proposed patch is trivial.  If the system has a TSC, it is
available get_cycles().  This makes no change to the other parts of the
kernel protected by CONFIG_X86_TSC.

Joel

diff -uNr ../kernel-2.4.21-4.0.1.EL/linux-2.4.21/include/asm-i386/timex.h linux-2.4.21/include/asm-i386/timex.h
--- ../kernel-2.4.21-4.0.1.EL/linux-2.4.21/include/asm-i386/timex.h	2002-11-28 15:53:15.000000000 -0800
+++ linux-2.4.21/include/asm-i386/timex.h	2003-11-04 11:33:08.000000000 -0800
@@ -40,7 +40,7 @@
 
 static inline cycles_t get_cycles (void)
 {
-#ifndef CONFIG_X86_TSC
+#ifndef CONFIG_X86_HAS_TSC
 	return 0;
 #else
 	unsigned long long ret;


-- 

"Hey mister if you're gonna walk on water,
 Could you drop a line my way?"

Joel Becker
Senior Member of Technical Staff
Oracle Corporation
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

             reply	other threads:[~2003-11-04 23:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-04 23:22 Joel Becker [this message]
2003-11-04 23:27 ` get_cycles() on i386 john stultz
2003-11-04 23:54   ` Linus Torvalds
2003-11-05  2:53     ` Nick Piggin
2003-11-05  3:02       ` Nick Piggin
2003-11-05 13:35     ` Marcelo Tosatti
2003-12-05 15:55   ` Marcelo Tosatti

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=20031104232252.GG5792@ca-server1.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.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).