public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@am.sony.com>
To: linux kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] init: support preset lpj value as config option
Date: Wed, 24 Jan 2007 16:12:18 -0800	[thread overview]
Message-ID: <45B7F5E2.4070800@am.sony.com> (raw)

Often, it is useful to preserve the preset loops_per_jiffy
value for a machine in a config option. Right now, you can
specify a preset lpj value on the kernel command line. But this
means the value is preserved in the firmware, which is less
portable between developers.

This patch provides a config option for preset lpj, which means
the value can be easily preserved, and conveyed between developers
in a config file.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>

----
diff -pruN linux-2.6.20-rc5-git2.orig/init/Kconfig linux-2.6.20-rc5-git2/init/Kconfig
--- linux-2.6.20-rc5-git2.orig/init/Kconfig	2007-01-12 10:54:26.000000000 -0800
+++ linux-2.6.20-rc5-git2/init/Kconfig	2007-01-24 16:03:30.000000000 -0800
@@ -466,6 +466,35 @@ config VM_EVENT_COUNTERS
 	  on EMBEDDED systems.  /proc/vmstat will only show page counts
 	  if VM event counters are disabled.

+config PRESET_LPJ
+	int "Preset loops_per_jiffy" if EMBEDDED
+	default 0
+	help
+	  Set this to preset the number of loops used by delay() to
+	  achieve a single jiffy of delay inside the kernel.  This is
+	  normally calculated at boot time, but that calibration can
+	  take up to 250 ms per CPU.  Specifying a constant value here
+	  eliminates the calibration, and improves bootup time.
+
+	  A value of 0 results in the normal autodetect behavior.
+
+	  To determine the correct value for your kernel, first set this
+	  option to 0, compile and boot the kernel on your target hardware,
+	  then see what value is printed during the kernel boot.  Use that
+	  value here.
+
+	  The kernel command line parameter "lpj=" can be used to override
+	  the value configured here.
+
+	  Note that on SMP systems the preset will be applied to all CPUs,
+	  which could cause problems if for some reason your CPUs need
+	  significantly divergent settings.
+
+	  If unsure, set this to 0. An incorrect value will cause delays in
+	  the kernel to be wrong, leading to unpredictable I/O errors and
+	  other breakage.  Although unlikely, in the extreme case this might
+	  damage your hardware.
+
 endmenu		# General setup

 config RT_MUTEXES
diff -pruN linux-2.6.20-rc5-git2.orig/init/calibrate.c linux-2.6.20-rc5-git2/init/calibrate.c
--- linux-2.6.20-rc5-git2.orig/init/calibrate.c	2007-01-12 10:54:26.000000000 -0800
+++ linux-2.6.20-rc5-git2/init/calibrate.c	2007-01-23 11:23:39.000000000 -0800
@@ -10,7 +10,7 @@

 #include <asm/timex.h>

-static unsigned long preset_lpj;
+static unsigned long preset_lpj = CONFIG_PRESET_LPJ;
 static int __init lpj_setup(char *str)
 {
 	preset_lpj = simple_strtoul(str,NULL,0);


             reply	other threads:[~2007-01-25  2:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-25  0:12 Tim Bird [this message]
2007-01-25  2:18 ` [PATCH] init: support preset lpj value as config option Paul Mundt
2007-01-25 18:24   ` Tim Bird
2007-01-26 10:44     ` Andrew Morton
2007-01-26 18:29       ` Tim Bird
2007-01-26 18:46         ` Matt Mackall
2007-01-26 19:02           ` H. Peter Anvin

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=45B7F5E2.4070800@am.sony.com \
    --to=tim.bird@am.sony.com \
    --cc=linux-kernel@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