public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Anvin" <hpa@zytor.com>, Matt Mackall <mpm@selenic.com>,
	zwane@arm.linux.org.uk
Cc: Linux-tiny@selenic.com, linux-kernel@vger.kernel.org
Subject: [PATCH] Configure out TSC support
Date: Wed, 13 Feb 2008 17:00:16 +0100	[thread overview]
Message-ID: <20080213170016.7fb3dd87@crazy> (raw)

[-- Attachment #1: Type: text/plain, Size: 2992 bytes --]

Hi,

The following patch allows to remove the code needed to support the TSC
timer on x86 32 bits. The TSC seems to be mandatory on x86 64 bits. The
patch adds a X86_TSC_TIMER option to enable/disable the support.

A X86_TSC option already exists, but it is not an option, it's simply
set to true when the processor has a TSC. However, the purpose of the
patch is to disable the TSC support even if the processor has it.

Comments welcome.

Thanks,

Thomas

---

Add a new configuration option that allows the TSC timer support code
to not be compiled, in order to make some space savings on the kernel
code size. The option depends on X86_32, because on 64 bits, the TSC
seems to be mandatory.

The results are:

   text    data     bss     dec     hex filename
1068092  126308   98304 1292704  13b9a0 vmlinux.before
1066956  126296   98304 1291556  13b524 vmlinux.after
  -1136     -12       0   -1148    -47C +/

This patch is part of the Linux Tiny project, and is based on previous
work done by Zwane Mwaikambo <zwane@arm.linux.org.uk>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

---
 arch/x86/Kconfig         |    6 ++++++
 arch/x86/kernel/Makefile |    3 ++-
 include/asm/tsc.h        |    4 ++++
 3 files changed, 12 insertions(+), 1 deletion(-)

Index: linux/arch/x86/Kconfig
===================================================================
--- linux.orig/arch/x86/Kconfig
+++ linux/arch/x86/Kconfig
@@ -395,6 +395,12 @@
 	def_bool y
 	depends on X86_32 && NUMA && (X86_SUMMIT || X86_GENERICARCH)
 
+config X86_TSC_TIMER
+	default y
+	bool "Enable TSC timer" if EMBEDDED && X86_32
+	help
+	  Enable support for the Time Stamp Counter timer.
+
 config X86_CYCLONE_TIMER
 	def_bool y
 	depends on X86_32 && X86_SUMMIT || X86_GENERICARCH
Index: linux/arch/x86/kernel/Makefile
===================================================================
--- linux.orig/arch/x86/kernel/Makefile
+++ linux/arch/x86/kernel/Makefile
@@ -19,8 +19,9 @@
 obj-y			+= quirks.o i8237.o topology.o kdebugfs.o
 obj-y			+= alternative.o i8253.o
 obj-$(CONFIG_X86_64)	+= pci-nommu_64.o bugs_64.o
-obj-y			+= tsc_$(BITS).o io_delay.o rtc.o
+obj-y			+= io_delay.o rtc.o
 
+obj-$(CONFIG_X86_TSC_TIMER)     += tsc_$(BITS).o
 obj-y				+= i387.o
 obj-y				+= ptrace.o
 obj-y				+= ds.o
Index: linux/include/asm/tsc.h
===================================================================
--- linux.orig/include/asm/tsc.h
+++ linux/include/asm/tsc.h
@@ -45,7 +45,11 @@
 	return (cycles_t) __native_read_tsc();
 }
 
+#ifdef CONFIG_X86_TSC_TIMER
 extern void tsc_init(void);
+#else
+static inline void tsc_init(void) { }
+#endif
 extern void mark_tsc_unstable(char *reason);
 extern int unsynchronized_tsc(void);
 extern void init_tsc_clocksource(void);


-- 
Thomas Petazzoni, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1500 pages!)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2008-02-13 16:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 16:00 Thomas Petazzoni [this message]
2008-02-17 17:03 ` [PATCH] Configure out TSC support Ingo Molnar
2008-02-18  2:27   ` Ingo Molnar

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=20080213170016.7fb3dd87@crazy \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=Linux-tiny@selenic.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mpm@selenic.com \
    --cc=tglx@linutronix.de \
    --cc=zwane@arm.linux.org.uk \
    /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