All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: Roman Zippel <zippel@linux-m68k.org>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Dave Jones <davej@redhat.com>
Subject: Re: Conditionals for development tests and output
Date: Sun, 3 Jun 2007 10:17:48 +0200	[thread overview]
Message-ID: <20070603081748.GA4871@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0706021627360.15441@schroedinger.engr.sgi.com>

On Sat, Jun 02, 2007 at 04:29:27PM -0700, Christoph Lameter wrote:
> On Sat, 2 Jun 2007, Sam Ravnborg wrote:
> 
> > The below patch suffers from the problem that changing the
> > value of DEVELKERNEL in the Makefile are not automatically
> > reflected in autoconf.h.
> 
> Well you are restating what is in the description. See below.

This turned out to be a simple dependency issue.
Added Makefile as prerequisite solved it as far as my testing showed.
Updated patch below.

The naming I do not like.
What about: KERNELHACKING (to make association with the Kernel hacking menu)?

Thats a claer signal that if you hack on the kernel you better set this.

	Sam

diff --git a/Makefile b/Makefile
index 562a909..d1e1e6e 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ PATCHLEVEL = 6
 SUBLEVEL = 22
 EXTRAVERSION = -rc3
 NAME = Jeff Thinks I Should Change This, But To What?
+DEVELKERNEL = 1
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
@@ -320,7 +321,7 @@ AFLAGS          := -D__ASSEMBLY__
 KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
-export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
+export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION DEVELKERNEL
 export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
@@ -453,7 +454,8 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 # with it and forgot to run make oldconfig.
 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
 # we execute the config step to be sure to catch updated Kconfig files
-include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
+include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd Makefile
+	$(Q)echo "  Kconfig - silentoldconfig"
 	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
 else
 # external modules needs include/linux/autoconf.h and include/config/auto.conf
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 45353d7..cb98841 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -375,4 +375,18 @@ struct sysinfo {
 #define NUMA_BUILD 0
 #endif
 
+#ifdef CONFIG_DEVELKERNEL
+#define DEVELKERNEL 1
+#else
+#define DEVELKERNEL 0
+#endif
+
+#define DEVEL_WARN_ON(x)	WARN_ON(DEVELKERNEL && (x))
+#define DEVEL_WARN_ON_ONCE(x)	WARN_ON_ONCE(DEVELKERNEL && (x))
+
+#define devel_printk(fmt,arg...) 	({					\
+	if (DEVELKERNEL)						\
+			printk(fmt, ##arg);				\
+})
+
 #endif
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 0764c82..8c58d44 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -74,7 +74,7 @@ static inline int kmalloc_index(size_t size)
 	 * We should return 0 if size == 0 but we use the smallest object
 	 * here for SLAB legacy reasons.
 	 */
-	WARN_ON_ONCE(size == 0);
+	DEVEL_WARN_ON_ONCE(size == 0);
 
 	if (size > KMALLOC_MAX_SIZE)
 		return -1;
diff --git a/mm/slab.c b/mm/slab.c
index 2e71a32..0b7aca9 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -774,7 +774,7 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
 	 */
 	BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
 #endif
-	WARN_ON_ONCE(size == 0);
+	DEVEL_WARN_ON_ONCE(size == 0);
 	while (size > csizep->cs_size)
 		csizep++;
 
diff --git a/mm/slub.c b/mm/slub.c
index 3e5aefc..4de2b24 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2464,8 +2464,8 @@ void __init kmem_cache_init(void)
 	kmem_size = offsetof(struct kmem_cache, cpu_slab) +
 				nr_cpu_ids * sizeof(struct page *);
 
-	printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
-		" Processors=%d, Nodes=%d\n",
+	devel_printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, "
+		"MinObjects=%d, Processors=%d, Nodes=%d\n",
 		KMALLOC_SHIFT_HIGH, cache_line_size(),
 		slub_min_order, slub_max_order, slub_min_objects,
 		nr_cpu_ids, nr_node_ids);
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index c35dcc5..bf788ad 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -72,6 +72,15 @@ void sym_init(void)
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
 	sym_add_default(sym, uts.release);
+
+	sym = sym_lookup("DEVELKERNEL", 0);
+	sym->type = S_BOOLEAN;
+	sym->flags |= SYMBOL_VALID|SYMBOL_AUTO;
+	p = getenv("DEVELKERNEL");
+	if (p && atoi(p))
+		sym_add_default(sym, "y");
+	else
+		sym_add_default(sym, "n");
 }
 
 enum symbol_type sym_get_type(struct symbol *sym)

      reply	other threads:[~2007-06-03  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-02  4:17 Conditionals for development tests and output Christoph Lameter
2007-06-02 14:43 ` Adrian Bunk
2007-06-02 17:48   ` Andrew Morton
2007-06-03 16:27     ` Matt Mackall
2007-06-02 19:02 ` Sam Ravnborg
2007-06-02 23:29   ` Christoph Lameter
2007-06-03  8:17     ` Sam Ravnborg [this message]

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=20070603081748.GA4871@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.