linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
@ 2008-09-17  8:27 Yinghai Lu
  2008-09-17  8:27 ` [PATCH 1/6] add DEFINE_LOGLEVEL_SETUP v7 Yinghai Lu
                   ` (6 more replies)
  0 siblings, 7 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

    KERN_PCI
    KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default with DEFINE_LOGLEVE_SETUP_DEF
    KERN_APIC
v6: set the default only one time

usage:
	in .h to have
		#define KERN_PCI "<pci>"
	in .c to have
		DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
	then could use
		printk(KERN_DEBUG KERN_PCI fmt, ...);
	and command line
		loglevel=3,pci:8

you can add different printk to different files of one subsys if you like
not just one susbsys one tag, and don't need to update kernel.h to add more tags

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 1/6] add DEFINE_LOGLEVEL_SETUP v7
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
@ 2008-09-17  8:27 ` Yinghai Lu
  2008-09-17  8:27 ` [PATCH 2/6] pci: add KERN_PCI Yinghai Lu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

so could make subsys easy to add loglevel and xxx_printk
v2: make it more genric, so subsys user only need to two line macro
v3: add back nameStr, so could find out iommu: and iommu_gart: and etc
v4: use printk intead of pci_printk
v5: fix checkpatch error and warning
v6: add DEFINE_LOGLEVEL_SETUP_DEF to take default
v7: call tag_loglevel_setup only one time, so could take several loglevel like
   loglevel=4 loglevel=acpi:8 loglevel=pci:8 loglevel=apic:8 is the same as
   loglevel=4,acpi:8,pci:8,apic:8

usage:
	in .h to have
		#define KERN_PCI "<pci>"
	in .c to have
		DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
	then could use
		printk(KERN_DEBUG KERN_PCI fmt, ...);
	and command line
		loglevel=pci:8

you can add different printk to different files of one subsys if you like

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
 arch/x86/kernel/vmlinux_32.lds.S  |    1 
 arch/x86/kernel/vmlinux_64.lds.S  |    2 
 include/asm-generic/vmlinux.lds.h |    8 +++
 include/linux/init.h              |   22 ++++++++++
 include/linux/kernel.h            |    9 ++++
 init/main.c                       |   77 +++++++++++++++++++++++++++++++++++++-
 kernel/printk.c                   |   28 +++++++++++--
 7 files changed, 142 insertions(+), 5 deletions(-)

Index: linux-2.6/arch/x86/kernel/vmlinux_32.lds.S
===================================================================
--- linux-2.6.orig/arch/x86/kernel/vmlinux_32.lds.S
+++ linux-2.6/arch/x86/kernel/vmlinux_32.lds.S
@@ -145,6 +145,7 @@ SECTIONS
 	*(.x86_cpu_dev.init)
 	__x86_cpu_dev_end = .;
   }
+  LOGLEVEL_SETUP_INIT(8)
   DYN_ARRAY_INIT(8)
   SECURITY_INIT
   . = ALIGN(4);
Index: linux-2.6/arch/x86/kernel/vmlinux_64.lds.S
===================================================================
--- linux-2.6.orig/arch/x86/kernel/vmlinux_64.lds.S
+++ linux-2.6/arch/x86/kernel/vmlinux_64.lds.S
@@ -174,6 +174,8 @@ SECTIONS
   }
   __x86_cpu_dev_end = .;
 
+  LOGLEVEL_SETUP_INIT(8)
+
   DYN_ARRAY_INIT(8)
 
   SECURITY_INIT
Index: linux-2.6/include/asm-generic/vmlinux.lds.h
===================================================================
--- linux-2.6.orig/include/asm-generic/vmlinux.lds.h
+++ linux-2.6/include/asm-generic/vmlinux.lds.h
@@ -222,6 +222,14 @@
  * All archs are supposed to use RO_DATA() */
 #define RODATA RO_DATA(4096)
 
+#define LOGLEVEL_SETUP_INIT(align)					\
+	. = ALIGN((align));						\
+	.loglevel_setup.init : AT(ADDR(.loglevel_setup.init) - LOAD_OFFSET) { \
+		VMLINUX_SYMBOL(__loglevel_setup_start) = .;		\
+		*(.loglevel_setup.init)					\
+		VMLINUX_SYMBOL(__loglevel_setup_end) = .;		\
+	}
+
 #define DYN_ARRAY_INIT(align)							\
 	. = ALIGN((align));						\
 	.dyn_array.init : AT(ADDR(.dyn_array.init) - LOAD_OFFSET) {	\
Index: linux-2.6/include/linux/init.h
===================================================================
--- linux-2.6.orig/include/linux/init.h
+++ linux-2.6/include/linux/init.h
@@ -251,6 +251,28 @@ struct obs_kernel_param {
 /* Relies on boot_command_line being set */
 void __init parse_early_param(void);
 
+struct loglevel_setup {
+	char *name;
+	char *tag;
+	int level;
+};
+
+extern struct loglevel_setup *__loglevel_setup_start[], *__loglevel_setup_end[];
+
+#define DEFINE_LOGLEVEL_SETUP_DEF(nameX, tagX, nameStr, levelX)		\
+	static struct loglevel_setup __loglevel_setup_##nameX __initdata = \
+	{							\
+		.tag = tagX,					\
+		.name = nameStr,				\
+		.level = levelX,				\
+	};							\
+	static struct loglevel_setup *__loglevel_setup_ptr_##nameX __used \
+	__attribute__((__section__(".loglevel_setup.init"))) =	\
+		&__loglevel_setup_##nameX
+
+#define DEFINE_LOGLEVEL_SETUP(nameX, tagX, nameStr)		\
+	DEFINE_LOGLEVEL_SETUP_DEF(nameX, tagX, nameStr, 0)		\
+
 struct dyn_array {
 	void **name;
 	unsigned long size;
Index: linux-2.6/include/linux/kernel.h
===================================================================
--- linux-2.6.orig/include/linux/kernel.h
+++ linux-2.6/include/linux/kernel.h
@@ -104,6 +104,15 @@ extern int console_printk[];
 #define minimum_console_loglevel (console_printk[2])
 #define default_console_loglevel (console_printk[3])
 
+struct tag_console_loglevel {
+	char tag[32];
+	char name[32];
+	int level;
+};
+
+extern struct tag_console_loglevel tag_level[];
+extern int tag_level_nr;
+
 struct completion;
 struct pt_regs;
 struct user;
Index: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c
+++ linux-2.6/init/main.c
@@ -248,9 +248,79 @@ static int __init quiet_kernel(char *str
 early_param("debug", debug_kernel);
 early_param("quiet", quiet_kernel);
 
+struct tag_console_loglevel tag_level[32];
+int tag_level_nr;
+
+static int __init save_tag_name_level(const char *tag, const char *name,
+					int level)
+{
+	int len;
+
+	if (tag_level_nr > 32)
+		return -1;
+
+	len = sizeof(tag_level[tag_level_nr].tag);
+	strncpy(tag_level[tag_level_nr].tag, tag, len - 1);
+	len = sizeof(tag_level[tag_level_nr].name);
+	strncpy(tag_level[tag_level_nr].name, name, len - 1);
+	tag_level[tag_level_nr].level = level;
+
+	tag_level_nr++;
+
+	return 0;
+}
+
+static void __init tag_loglevel_setup(void)
+{
+	struct loglevel_setup **la;
+	int level = default_console_loglevel;
+
+	for (la = __loglevel_setup_start ; la < __loglevel_setup_end; la++) {
+		struct loglevel_setup *l = *la;
+
+		save_tag_name_level(l->tag, l->name, l->level ? : level);
+	}
+}
+
+static char __init *real_loglevel_setup(char *str)
+{
+	int i;
+
+	for (i = 0; i < tag_level_nr; i++) {
+		struct tag_console_loglevel *tl;
+		int len;
+
+		tl = &tag_level[i];
+		len = strlen(tl->name);
+		if (!strncmp(str, tl->name, len)) {
+			int level;
+
+			str += len;
+			get_option(&str, &level);
+			tl->level = level;
+			str = NULL;
+			break;
+		}
+	}
+
+	return str;
+}
+
 static int __init loglevel(char *str)
 {
-	get_option(&str, &console_loglevel);
+	while (str) {
+		char *k = strchr(str, ',');
+
+		if (k)
+			*k++ = 0;
+		if (*str) {
+			str = real_loglevel_setup(str);
+			if (str && *str)
+				get_option(&str, &console_loglevel);
+		}
+		str = k;
+	}
+
 	return 0;
 }
 
@@ -581,6 +651,7 @@ asmlinkage void __init start_kernel(void
 	page_address_init();
 	printk(KERN_NOTICE);
 	printk(linux_banner);
+	tag_loglevel_setup();
 	setup_arch(&command_line);
 	pre_alloc_dyn_array();
 	mm_init_owner(&init_mm, &init_task);
Index: linux-2.6/kernel/printk.c
===================================================================
--- linux-2.6.orig/kernel/printk.c
+++ linux-2.6/kernel/printk.c
@@ -457,9 +457,9 @@ early_param("ignore_loglevel", ignore_lo
  * Write out chars from start to end - 1 inclusive
  */
 static void _call_console_drivers(unsigned start,
-				unsigned end, int msg_log_level)
+				unsigned end, int msg_log_level, int level)
 {
-	if ((msg_log_level < console_loglevel || ignore_loglevel) &&
+	if ((msg_log_level < level || ignore_loglevel) &&
 			console_drivers && start != end) {
 		if ((start & LOG_BUF_MASK) > (end & LOG_BUF_MASK)) {
 			/* wrapped write */
@@ -481,21 +481,40 @@ static void call_console_drivers(unsigne
 {
 	unsigned cur_index, start_print;
 	static int msg_level = -1;
+	int level = console_loglevel;
 
 	BUG_ON(((int)(start - end)) > 0);
 
 	cur_index = start;
 	start_print = start;
 	while (cur_index != end) {
+		int i;
+
 		if (msg_level < 0 && ((end - cur_index) > 2) &&
 				LOG_BUF(cur_index + 0) == '<' &&
 				LOG_BUF(cur_index + 1) >= '0' &&
 				LOG_BUF(cur_index + 1) <= '7' &&
 				LOG_BUF(cur_index + 2) == '>') {
 			msg_level = LOG_BUF(cur_index + 1) - '0';
+			level = console_loglevel;
 			cur_index += 3;
 			start_print = cur_index;
 		}
+		/* handle tag here */
+		for (i = 0; i < tag_level_nr; i++) {
+			struct tag_console_loglevel *tl;
+			int len;
+
+			tl = &tag_level[i];
+			len = strlen(tl->tag);
+			if ((end - cur_index) > (len - 1) &&
+			    !strncmp(&LOG_BUF(cur_index), tl->tag, len)) {
+				level = tl->level;
+				cur_index += len;
+				start_print = cur_index;
+				break;
+			}
+		}
 		while (cur_index != end) {
 			char c = LOG_BUF(cur_index);
 
@@ -510,14 +529,15 @@ static void call_console_drivers(unsigne
 					 */
 					msg_level = default_message_loglevel;
 				}
-				_call_console_drivers(start_print, cur_index, msg_level);
+				_call_console_drivers(start_print, cur_index,
+							msg_level, level);
 				msg_level = -1;
 				start_print = cur_index;
 				break;
 			}
 		}
 	}
-	_call_console_drivers(start_print, end, msg_level);
+	_call_console_drivers(start_print, end, msg_level, level);
 }
 
 static void emit_log_char(char c)

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 2/6] pci: add KERN_PCI
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
  2008-09-17  8:27 ` [PATCH 1/6] add DEFINE_LOGLEVEL_SETUP v7 Yinghai Lu
@ 2008-09-17  8:27 ` Yinghai Lu
  2008-09-17  8:27 ` [PATCH 3/6] pci: using printk(KERN_PCI v3 Yinghai Lu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

use DEFINE_LOGLEVEL_SETUP to set loglevel for pci

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
 drivers/pci/pci.c   |    2 ++
 include/linux/pci.h |    2 ++
 2 files changed, 4 insertions(+)

Index: linux-2.6/drivers/pci/pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -1953,6 +1953,8 @@ static int __devinit pci_setup(char *str
 }
 early_param("pci", pci_setup);
 
+DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
+
 device_initcall_sync(pci_init);
 
 EXPORT_SYMBOL(pci_reenable_device);
Index: linux-2.6/include/linux/pci.h
===================================================================
--- linux-2.6.orig/include/linux/pci.h
+++ linux-2.6/include/linux/pci.h
@@ -55,6 +55,8 @@
 /* Include the ID list */
 #include <linux/pci_ids.h>
 
+#define KERN_PCI "<pci>"
+
 /* pci_slot represents a physical slot */
 struct pci_slot {
 	struct pci_bus *bus;		/* The bus this slot is on */

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
  2008-09-17  8:27 ` [PATCH 1/6] add DEFINE_LOGLEVEL_SETUP v7 Yinghai Lu
  2008-09-17  8:27 ` [PATCH 2/6] pci: add KERN_PCI Yinghai Lu
@ 2008-09-17  8:27 ` Yinghai Lu
  2008-09-17  8:35   ` Ingo Molnar
  2008-09-17 22:28   ` Bjorn Helgaas
  2008-09-17  8:27 ` [PATCH 4/6] acpi: add KERN_ACPI v3 Yinghai Lu
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

v2: use printk(KERN_DEBUG KERN_PCI ...
v3: fix checkpatch error and warning

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 drivers/pci/probe.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Index: linux-2.6/drivers/pci/probe.c
===================================================================
--- linux-2.6.orig/drivers/pci/probe.c
+++ linux-2.6/drivers/pci/probe.c
@@ -304,7 +304,8 @@ static int __pci_read_base(struct pci_de
 		} else {
 			res->start = l64;
 			res->end = l64 + sz64;
-			printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
+			printk(KERN_DEBUG KERN_PCI
+				 "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
 				 pci_name(dev), pos, res->start, res->end);
 		}
 	} else {
@@ -315,9 +316,10 @@ static int __pci_read_base(struct pci_de
 
 		res->start = l;
 		res->end = l + sz;
-		printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev),
-			 pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio",
-			 res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI "PCI: %s reg %x %s: [%llx, %llx]\n",
+			pci_name(dev), pos,
+			(res->flags & IORESOURCE_IO) ? "io port" : "32bit mmio",
+			res->start, res->end);
 	}
 
  out:
@@ -388,8 +390,9 @@ void __devinit pci_read_bridge_bases(str
 			res->start = base;
 		if (!res->end)
 			res->end = limit + 0xfff;
-		printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n",
-				 pci_name(dev), res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI
+			 "PCI: bridge %s io port: [%llx, %llx]\n",
+			 pci_name(dev), res->start, res->end);
 	}
 
 	res = child->resource[1];
@@ -401,8 +404,9 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
 		res->start = base;
 		res->end = limit + 0xfffff;
-		printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n",
-				 pci_name(dev), res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI
+			 "PCI: bridge %s 32bit mmio: [%llx, %llx]\n",
+			 pci_name(dev), res->start, res->end);
 	}
 
 	res = child->resource[2];
@@ -438,9 +442,11 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
 		res->start = base;
 		res->end = limit + 0xfffff;
-		printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n",
-				 pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",
-				 res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI
+			 "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n",
+			 pci_name(dev),
+			 (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32",
+			 res->start, res->end);
 	}
 }
 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 4/6] acpi: add KERN_ACPI v3
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
                   ` (2 preceding siblings ...)
  2008-09-17  8:27 ` [PATCH 3/6] pci: using printk(KERN_PCI v3 Yinghai Lu
@ 2008-09-17  8:27 ` Yinghai Lu
  2008-09-17  8:27 ` [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...) Yinghai Lu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

use DEFINE_LOGLEVEL_SETUP to set loglevel for acpi
v2: use <acpi, "acpi:"> instead
v3: use KERN_ACPI

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 drivers/acpi/osl.c   |    2 ++
 include/linux/acpi.h |    1 +
 2 files changed, 3 insertions(+)

Index: linux-2.6/drivers/acpi/osl.c
===================================================================
--- linux-2.6.orig/drivers/acpi/osl.c
+++ linux-2.6/drivers/acpi/osl.c
@@ -75,6 +75,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif				/*ENABLE_DEBUGGER */
 
+DEFINE_LOGLEVEL_SETUP(acpi, KERN_ACPI, "acpi:");
+
 static unsigned int acpi_irq_irq;
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
Index: linux-2.6/include/linux/acpi.h
===================================================================
--- linux-2.6.orig/include/linux/acpi.h
+++ linux-2.6/include/linux/acpi.h
@@ -43,6 +43,7 @@
 #include <asm/acpi.h>
 #include <linux/dmi.h>
 
+#define KERN_ACPI "<acpi>"
 
 enum acpi_irq_model_id {
 	ACPI_IRQ_MODEL_PIC = 0,

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...)
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
                   ` (3 preceding siblings ...)
  2008-09-17  8:27 ` [PATCH 4/6] acpi: add KERN_ACPI v3 Yinghai Lu
@ 2008-09-17  8:27 ` Yinghai Lu
  2008-09-17 18:19   ` Marcin Slusarz
  2008-09-17  8:27 ` [PATCH 6/6] x86: add KERN_APIC Yinghai Lu
  2008-09-17  8:55 ` [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Andrew Morton
  6 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 drivers/acpi/numa.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux-2.6/drivers/acpi/numa.c
===================================================================
--- linux-2.6.orig/drivers/acpi/numa.c
+++ linux-2.6/drivers/acpi/numa.c
@@ -150,6 +150,15 @@ static __init int slit_valid(struct acpi
 {
 	int i, j;
 	int d = slit->locality_count;
+	printk(KERN_DEBUG KERN_ACPI "ACPI: SLIT: nodes = %d\n", d);
+	for (i = 0; i < d; i++) {
+		printk(KERN_DEBUG KERN_ACPI "  ");
+		for (j = 0; j < d; j++)  {
+			u8 val = slit->entry[d*i + j];
+			printk(KERN_CONT KERN_ACPI " %d", val);
+		}
+		printk(KERN_CONT KERN_ACPI "\n");
+	}
 	for (i = 0; i < d; i++) {
 		for (j = 0; j < d; j++)  {
 			u8 val = slit->entry[d*i + j];

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 6/6] x86: add KERN_APIC
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
                   ` (4 preceding siblings ...)
  2008-09-17  8:27 ` [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...) Yinghai Lu
@ 2008-09-17  8:27 ` Yinghai Lu
  2008-09-17  8:38   ` Ingo Molnar
  2008-09-17  8:55 ` [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Andrew Morton
  6 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:27 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

and kill apic_printk
using loglevel=apic:8 intead

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 Documentation/kernel-parameters.txt         |    6 
 arch/x86/kernel/apic.c                      |  108 +++++-------
 arch/x86/kernel/io_apic.c                   |  235 +++++++++++++---------------
 arch/x86/kernel/mpparse.c                   |   10 -
 arch/x86/kernel/smpboot.c                   |   11 -
 include/asm-x86/apic.h                      |   20 --
 include/asm-x86/es7000/wakecpu.h            |    6 
 include/asm-x86/mach-default/mach_wakecpu.h |    6 
 8 files changed, 178 insertions(+), 224 deletions(-)

Index: linux-2.6/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.orig/Documentation/kernel-parameters.txt
+++ linux-2.6/Documentation/kernel-parameters.txt
@@ -306,12 +306,6 @@ and is between 256 and 4096 characters.
 			not play well with APC CPU idle - disable it if you have
 			APC and your system crashes randomly.
 
-	apic=		[APIC,i386] Advanced Programmable Interrupt Controller
-			Change the output verbosity whilst booting
-			Format: { quiet (default) | verbose | debug }
-			Change the amount of debugging information output
-			when initialising the APIC and IO-APIC components.
-
 	apm=		[APM] Advanced Power Management
 			See header of arch/x86/kernel/apm_32.c.
 
Index: linux-2.6/arch/x86/kernel/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic.c
+++ linux-2.6/arch/x86/kernel/apic.c
@@ -58,6 +58,8 @@
 # error SPURIOUS_APIC_VECTOR definition error
 #endif
 
+DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);
+
 #ifdef CONFIG_X86_32
 /*
  * Knob to control our willingness to enable the local APIC.
@@ -123,8 +125,6 @@ char system_vectors[NR_VECTORS] = { [0 .
 /*
  * Debug level, exported for io_apic.c
  */
-unsigned int apic_verbosity;
-
 int pic_mode;
 
 /* Have we found an MP table */
@@ -549,7 +549,7 @@ static int __init calibrate_by_pmtimer(l
 	return -1;
 #endif
 
-	apic_printk(APIC_VERBOSE, "... PM timer delta = %ld\n", deltapm);
+	printk(APIC_VERBOSE "... PM timer delta = %ld\n", deltapm);
 
 	/* Check, if the PM timer is available */
 	if (!deltapm)
@@ -559,17 +559,17 @@ static int __init calibrate_by_pmtimer(l
 
 	if (deltapm > (pm_100ms - pm_thresh) &&
 	    deltapm < (pm_100ms + pm_thresh)) {
-		apic_printk(APIC_VERBOSE, "... PM timer result ok\n");
+		printk(APIC_VERBOSE "... PM timer result ok\n");
 	} else {
 		res = (((u64)deltapm) *  mult) >> 22;
 		do_div(res, 1000000);
-		printk(KERN_WARNING "APIC calibration not consistent "
+		printk(KERN_WARNING KERN_APIC "APIC calibration not consistent "
 			"with PM Timer: %ldms instead of 100ms\n",
 			(long)res);
 		/* Correct the lapic counter value */
 		res = (((u64)(*delta)) * pm_100ms);
 		do_div(res, deltapm);
-		printk(KERN_INFO "APIC delta adjusted to PM-Timer: "
+		printk(KERN_INFO KERN_APIC "APIC delta adjusted to PM-Timer: "
 			"%lu (%ld)\n", (unsigned long)res, *delta);
 		*delta = (long)res;
 	}
@@ -610,7 +610,7 @@ static int __init calibrate_APIC_clock(v
 
 	/* Build delta t1-t2 as apic timer counts down */
 	delta = lapic_cal_t1 - lapic_cal_t2;
-	apic_printk(APIC_VERBOSE, "... lapic delta = %ld\n", delta);
+	printk(APIC_VERBOSE "... lapic delta = %ld\n", delta);
 
 	/* we trust the PM based calibration if possible */
 	pm_referenced = !calibrate_by_pmtimer(lapic_cal_pm2 - lapic_cal_pm1,
@@ -626,20 +626,20 @@ static int __init calibrate_APIC_clock(v
 
 	calibration_result = (delta * APIC_DIVISOR) / LAPIC_CAL_LOOPS;
 
-	apic_printk(APIC_VERBOSE, "..... delta %ld\n", delta);
-	apic_printk(APIC_VERBOSE, "..... mult: %ld\n", lapic_clockevent.mult);
-	apic_printk(APIC_VERBOSE, "..... calibration result: %u\n",
+	printk(APIC_VERBOSE "..... delta %ld\n", delta);
+	printk(APIC_VERBOSE "..... mult: %ld\n", lapic_clockevent.mult);
+	printk(APIC_VERBOSE "..... calibration result: %u\n",
 		    calibration_result);
 
 	if (cpu_has_tsc) {
 		delta = (long)(lapic_cal_tsc2 - lapic_cal_tsc1);
-		apic_printk(APIC_VERBOSE, "..... CPU clock speed is "
+		printk(APIC_VERBOSE "..... CPU clock speed is "
 			    "%ld.%04ld MHz.\n",
 			    (delta / LAPIC_CAL_LOOPS) / (1000000 / HZ),
 			    (delta / LAPIC_CAL_LOOPS) % (1000000 / HZ));
 	}
 
-	apic_printk(APIC_VERBOSE, "..... host bus clock speed is "
+	printk(APIC_VERBOSE "..... host bus clock speed is "
 		    "%u.%04u MHz.\n",
 		    calibration_result / (1000000 / HZ),
 		    calibration_result % (1000000 / HZ));
@@ -649,7 +649,7 @@ static int __init calibrate_APIC_clock(v
 	 */
 	if (calibration_result < (1000000 / HZ)) {
 		local_irq_enable();
-		printk(KERN_WARNING
+		printk(KERN_WARNING KERN_APIC
 		       "APIC frequency too slow, disabling apic timer\n");
 		return -1;
 	}
@@ -661,7 +661,7 @@ static int __init calibrate_APIC_clock(v
 	 * so lets try APIC timer based calibration
 	 */
 	if (!pm_referenced) {
-		apic_printk(APIC_VERBOSE, "... verify APIC timer\n");
+		printk(APIC_VERBOSE "... verify APIC timer\n");
 
 		/*
 		 * Setup the apic timer manually
@@ -685,18 +685,18 @@ static int __init calibrate_APIC_clock(v
 
 		/* Jiffies delta */
 		deltaj = lapic_cal_j2 - lapic_cal_j1;
-		apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj);
+		printk(APIC_VERBOSE "... jiffies delta = %lu\n", deltaj);
 
 		/* Check, if the jiffies result is consistent */
 		if (deltaj >= LAPIC_CAL_LOOPS-2 && deltaj <= LAPIC_CAL_LOOPS+2)
-			apic_printk(APIC_VERBOSE, "... jiffies result ok\n");
+			printk(APIC_VERBOSE "... jiffies result ok\n");
 		else
 			levt->features |= CLOCK_EVT_FEAT_DUMMY;
 	} else
 		local_irq_enable();
 
 	if (levt->features & CLOCK_EVT_FEAT_DUMMY) {
-		printk(KERN_WARNING
+		printk(KERN_WARNING KERN_APIC
 		       "APIC timer disabled due to verification failure.\n");
 			return -1;
 	}
@@ -718,7 +718,7 @@ void __init setup_boot_APIC_clock(void)
 	 * broadcast mechanism is used. On UP systems simply ignore it.
 	 */
 	if (disable_apic_timer) {
-		printk(KERN_INFO "Disabling APIC timer\n");
+		printk(KERN_INFO KERN_APIC "Disabling APIC timer\n");
 		/* No broadcast on UP ! */
 		if (num_possible_cpus() > 1) {
 			lapic_clockevent.mult = 1;
@@ -727,7 +727,7 @@ void __init setup_boot_APIC_clock(void)
 		return;
 	}
 
-	apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
+	printk(APIC_VERBOSE "Using local APIC timer interrupts.\n"
 		    "calibrating APIC timer ...\n");
 
 	if (calibrate_APIC_clock()) {
@@ -745,7 +745,7 @@ void __init setup_boot_APIC_clock(void)
 	if (nmi_watchdog != NMI_IO_APIC)
 		lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
 	else
-		printk(KERN_WARNING "APIC timer registered as dummy,"
+		printk(KERN_WARNING KERN_APIC "APIC timer registered as dummy,"
 			" due to nmi_watchdog=%d!\n", nmi_watchdog);
 
 	/* Setup the lapic or request the broadcast */
@@ -777,7 +777,7 @@ static void local_apic_timer_interrupt(v
 	 * spurious.
 	 */
 	if (!evt->event_handler) {
-		printk(KERN_WARNING
+		printk(KERN_WARNING KERN_APIC
 		       "Spurious LAPIC timer interrupt on cpu %d\n", cpu);
 		/* Switch it off */
 		lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, evt);
@@ -975,10 +975,10 @@ int __init verify_local_APIC(void)
 	 * The version register is read-only in a real APIC.
 	 */
 	reg0 = apic_read(APIC_LVR);
-	apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg0);
+	printk(APIC_DEBUG "Getting VERSION: %x\n", reg0);
 	apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK);
 	reg1 = apic_read(APIC_LVR);
-	apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg1);
+	printk(APIC_DEBUG "Getting VERSION: %x\n", reg1);
 
 	/*
 	 * The two version reads above should print the same
@@ -1002,10 +1002,10 @@ int __init verify_local_APIC(void)
 	 * The ID register is read/write in a real APIC.
 	 */
 	reg0 = apic_read(APIC_ID);
-	apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0);
+	printk(APIC_DEBUG "Getting ID: %x\n", reg0);
 	apic_write(APIC_ID, reg0 ^ APIC_ID_MASK);
 	reg1 = apic_read(APIC_ID);
-	apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1);
+	printk(APIC_DEBUG "Getting ID: %x\n", reg1);
 	apic_write(APIC_ID, reg0);
 	if (reg1 != (reg0 ^ APIC_ID_MASK))
 		return 0;
@@ -1016,9 +1016,9 @@ int __init verify_local_APIC(void)
 	 * compatibility mode, but most boxes are anymore.
 	 */
 	reg0 = apic_read(APIC_LVT0);
-	apic_printk(APIC_DEBUG, "Getting LVT0: %x\n", reg0);
+	printk(APIC_DEBUG "Getting LVT0: %x\n", reg0);
 	reg1 = apic_read(APIC_LVT1);
-	apic_printk(APIC_DEBUG, "Getting LVT1: %x\n", reg1);
+	printk(APIC_DEBUG "Getting LVT1: %x\n", reg1);
 
 	return 1;
 }
@@ -1040,7 +1040,7 @@ void __init sync_Arb_IDs(void)
 	 */
 	apic_wait_icr_idle();
 
-	apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
+	printk(APIC_DEBUG "Synchronizing Arb IDs.\n");
 	apic_write(APIC_ICR, APIC_DEST_ALLINC |
 			APIC_INT_LEVELTRIG | APIC_DM_INIT);
 }
@@ -1097,7 +1097,7 @@ static void __cpuinit lapic_setup_esr(vo
 	unsigned int oldvalue, value, maxlvt;
 
 	if (!lapic_is_integrated()) {
-		printk(KERN_INFO "No ESR for 82489DX.\n");
+		printk(KERN_INFO KERN_APIC "No ESR for 82489DX.\n");
 		return;
 	}
 
@@ -1108,7 +1108,7 @@ static void __cpuinit lapic_setup_esr(vo
 		 * ESR disabled - we can't do anything useful with the
 		 * errors anyway - mbligh
 		 */
-		printk(KERN_INFO "Leaving ESR disabled.\n");
+		printk(KERN_INFO KERN_APIC "Leaving ESR disabled.\n");
 		return;
 	}
 
@@ -1128,7 +1128,7 @@ static void __cpuinit lapic_setup_esr(vo
 		apic_write(APIC_ESR, 0);
 	value = apic_read(APIC_ESR);
 	if (value != oldvalue)
-		apic_printk(APIC_VERBOSE, "ESR value before enabling "
+		printk(APIC_VERBOSE "ESR value before enabling "
 			"vector: 0x%08x  after: 0x%08x\n",
 			oldvalue, value);
 }
@@ -1253,11 +1253,11 @@ void __cpuinit setup_local_APIC(void)
 	value = apic_read(APIC_LVT0) & APIC_LVT_MASKED;
 	if (!smp_processor_id() && (pic_mode || !value)) {
 		value = APIC_DM_EXTINT;
-		apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n",
+		printk(APIC_VERBOSE "enabled ExtINT on CPU#%d\n",
 				smp_processor_id());
 	} else {
 		value = APIC_DM_EXTINT | APIC_LVT_MASKED;
-		apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n",
+		printk(APIC_VERBOSE "masked ExtINT on CPU#%d\n",
 				smp_processor_id());
 	}
 	apic_write(APIC_LVT0, value);
@@ -1425,7 +1425,7 @@ end:
 static int __init detect_init_APIC(void)
 {
 	if (!cpu_has_apic) {
-		printk(KERN_INFO "No local APIC present\n");
+		printk(KERN_INFO KERN_APIC "No local APIC present\n");
 		return -1;
 	}
 
@@ -1466,7 +1466,7 @@ static int __init detect_init_APIC(void)
 		 * "lapic" specified.
 		 */
 		if (!force_enable_local_apic) {
-			printk(KERN_INFO "Local APIC disabled by BIOS -- "
+			printk(KERN_INFO KERN_APIC "Local APIC disabled by BIOS -- "
 			       "you can enable it with \"lapic\"\n");
 			return -1;
 		}
@@ -1477,7 +1477,7 @@ static int __init detect_init_APIC(void)
 		 */
 		rdmsr(MSR_IA32_APICBASE, l, h);
 		if (!(l & MSR_IA32_APICBASE_ENABLE)) {
-			printk(KERN_INFO
+			printk(KERN_INFO KERN_APIC
 			       "Local APIC disabled by BIOS -- reenabling.\n");
 			l &= ~MSR_IA32_APICBASE_BASE;
 			l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
@@ -1491,7 +1491,7 @@ static int __init detect_init_APIC(void)
 	 */
 	features = cpuid_edx(1);
 	if (!(features & (1 << X86_FEATURE_APIC))) {
-		printk(KERN_WARNING "Could not enable APIC!\n");
+		printk(KERN_WARNING KERN_APIC "Could not enable APIC!\n");
 		return -1;
 	}
 	set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
@@ -1502,14 +1502,14 @@ static int __init detect_init_APIC(void)
 	if (l & MSR_IA32_APICBASE_ENABLE)
 		mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
 
-	printk(KERN_INFO "Found and enabled local APIC!\n");
+	printk(KERN_INFO KERN_APIC "Found and enabled local APIC!\n");
 
 	apic_pm_activate();
 
 	return 0;
 
 no_apic:
-	printk(KERN_INFO "No local APIC present or hardware disabled\n");
+	printk(KERN_INFO KERN_APIC "No local APIC present or hardware disabled\n");
 	return -1;
 }
 #endif
@@ -1529,7 +1529,7 @@ void __init early_init_lapic_mapping(voi
 	phys_addr = mp_lapic_addr;
 
 	set_fixmap_nocache(FIX_APIC_BASE, phys_addr);
-	apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n",
+	printk(APIC_VERBOSE "mapped APIC to %16lx (%16lx)\n",
 		    APIC_BASE, phys_addr);
 
 	/*
@@ -1564,7 +1564,7 @@ void __init init_apic_mappings(void)
 		apic_phys = mp_lapic_addr;
 
 	set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
-	apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n",
+	printk(APIC_VERBOSE "mapped APIC to %08lx (%08lx)\n",
 				APIC_BASE, apic_phys);
 
 	/*
@@ -1585,12 +1585,12 @@ int __init APIC_init_uniprocessor(void)
 {
 #ifdef CONFIG_X86_64
 	if (disable_apic) {
-		printk(KERN_INFO "Apic disabled\n");
+		printk(KERN_INFO KERN_APIC "Apic disabled\n");
 		return -1;
 	}
 	if (!cpu_has_apic) {
 		disable_apic = 1;
-		printk(KERN_INFO "Apic disabled by BIOS\n");
+		printk(KERN_INFO KERN_APIC "Apic disabled by BIOS\n");
 		return -1;
 	}
 #else
@@ -1602,7 +1602,7 @@ int __init APIC_init_uniprocessor(void)
 	 */
 	if (!cpu_has_apic &&
 	    APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
-		printk(KERN_ERR "BIOS bug, local APIC 0x%x not detected!...\n",
+		printk(KERN_ERR KERN_APIC "BIOS bug, local APIC 0x%x not detected!...\n",
 		       boot_cpu_physical_apicid);
 		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
 		return -1;
@@ -1696,7 +1696,7 @@ void smp_spurious_interrupt(struct pt_re
 	add_pda(irq_spurious_count, 1);
 #else
 	/* see sw-dev-man vol 3, chapter 7.4.13.5 */
-	printk(KERN_INFO "spurious APIC interrupt on CPU#%d, "
+	printk(KERN_INFO KERN_APIC "spurious APIC interrupt on CPU#%d, "
 	       "should never happen.\n", smp_processor_id());
 	__get_cpu_var(irq_stat).irq_spurious_count++;
 #endif
@@ -1731,7 +1731,7 @@ void smp_error_interrupt(struct pt_regs
 	   6: Received illegal vector
 	   7: Illegal register address
 	*/
-	printk(KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
+	printk(KERN_DEBUG KERN_APIC "APIC error on CPU%d: %02x(%02x)\n",
 		smp_processor_id(), v , v1);
 	irq_exit();
 }
@@ -1751,7 +1751,7 @@ void __init connect_bsp_APIC(void)
 		 * PIC mode, enable APIC mode in the IMCR, i.e.  connect BSP's
 		 * local APIC to INT and NMI lines.
 		 */
-		apic_printk(APIC_VERBOSE, "leaving PIC mode, "
+		printk(APIC_VERBOSE "leaving PIC mode, "
 				"enabling APIC mode.\n");
 		outb(0x70, 0x22);
 		outb(0x01, 0x23);
@@ -1779,7 +1779,7 @@ void disconnect_bsp_APIC(int virt_wire_s
 		 * IPIs, won't work beyond this point!  The only exception are
 		 * INIT IPIs.
 		 */
-		apic_printk(APIC_VERBOSE, "disabling APIC mode, "
+		printk(APIC_VERBOSE "disabling APIC mode, "
 				"entering PIC mode.\n");
 		outb(0x70, 0x22);
 		outb(0x00, 0x23);
@@ -1835,7 +1835,7 @@ void __cpuinit generic_processor_info(in
 	 * Validate version
 	 */
 	if (version == 0x0) {
-		printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
+		printk(KERN_WARNING KERN_APIC "BIOS bug, APIC version is 0 for CPU#%d! "
 				"fixing up to 0x10. (tell your hw vendor)\n",
 				version);
 		version = 0x10;
@@ -2201,16 +2201,6 @@ static int __init apic_set_verbosity(cha
 		return -EINVAL;
 	}
 
-	if (strcmp("debug", arg) == 0)
-		apic_verbosity = APIC_DEBUG;
-	else if (strcmp("verbose", arg) == 0)
-		apic_verbosity = APIC_VERBOSE;
-	else {
-		printk(KERN_WARNING "APIC Verbosity level %s not recognised"
-			" use apic=verbose or apic=debug\n", arg);
-		return -EINVAL;
-	}
-
 	return 0;
 }
 early_param("apic", apic_set_verbosity);
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -783,14 +783,14 @@ static int __init ioapic_pirq_setup(char
 		pirq_entries[i] = -1;
 
 	pirqs_enabled = 1;
-	apic_printk(APIC_VERBOSE, KERN_INFO
+	printk(APIC_VERBOSE
 			"PIRQ redirection, working around broken MP-BIOS.\n");
 	max = MAX_PIRQS;
 	if (ints[0] < MAX_PIRQS)
 		max = ints[0];
 
 	for (i = 0; i < max; i++) {
-		apic_printk(APIC_VERBOSE, KERN_DEBUG
+		printk(APIC_VERBOSE
 				"... PIRQ%d -> IRQ %d\n", i, ints[i+1]);
 		/*
 		 * PIRQs are mapped upside down, usually.
@@ -940,10 +940,10 @@ int IO_APIC_get_PCI_irq_vector(int bus,
 {
 	int apic, i, best_guess = -1;
 
-	apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
+	printk(APIC_DEBUG "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
 		bus, slot, pin);
 	if (test_bit(bus, mp_bus_not_pci)) {
-		apic_printk(APIC_VERBOSE, "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
+		printk(APIC_VERBOSE "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
 		return -1;
 	}
 	for (i = 0; i < mp_irq_entries; i++) {
@@ -988,7 +988,7 @@ static int EISA_ELCR(unsigned int irq)
 		unsigned int port = 0x4d0 + (irq >> 3);
 		return (inb(port) >> (irq & 7)) & 1;
 	}
-	apic_printk(APIC_VERBOSE, KERN_INFO
+	printk(APIC_VERBOSE
 			"Broken MPtable reports ISA irq %d\n", irq);
 	return 0;
 }
@@ -1044,7 +1044,7 @@ static int MPBIOS_polarity(int idx)
 		}
 		case 2: /* reserved */
 		{
-			printk(KERN_WARNING "broken BIOS!!\n");
+			printk(KERN_WARNING KERN_APIC "broken BIOS!!\n");
 			polarity = 1;
 			break;
 		}
@@ -1055,7 +1055,7 @@ static int MPBIOS_polarity(int idx)
 		}
 		default: /* invalid */
 		{
-			printk(KERN_WARNING "broken BIOS!!\n");
+			printk(KERN_WARNING KERN_APIC "broken BIOS!!\n");
 			polarity = 1;
 			break;
 		}
@@ -1102,7 +1102,7 @@ static int MPBIOS_trigger(int idx)
 				}
 				default:
 				{
-					printk(KERN_WARNING "broken BIOS!!\n");
+					printk(KERN_WARNING KERN_APIC "broken BIOS!!\n");
 					trigger = 1;
 					break;
 				}
@@ -1116,7 +1116,7 @@ static int MPBIOS_trigger(int idx)
 		}
 		case 2: /* reserved */
 		{
-			printk(KERN_WARNING "broken BIOS!!\n");
+			printk(KERN_WARNING KERN_APIC "broken BIOS!!\n");
 			trigger = 1;
 			break;
 		}
@@ -1127,7 +1127,7 @@ static int MPBIOS_trigger(int idx)
 		}
 		default: /* invalid */
 		{
-			printk(KERN_WARNING "broken BIOS!!\n");
+			printk(KERN_WARNING KERN_APIC "broken BIOS!!\n");
 			trigger = 0;
 			break;
 		}
@@ -1155,7 +1155,7 @@ static int pin_2_irq(int idx, int apic,
 	 * Debugging check, we are in big trouble if this message pops up!
 	 */
 	if (mp_irqs[idx].mp_dstirq != pin)
-		printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
+		printk(KERN_ERR KERN_APIC "broken BIOS or MPTABLE parser, ayiee!!\n");
 
 	if (test_bit(bus, mp_bus_not_pci)) {
 		irq = mp_irqs[idx].mp_srcbusirq;
@@ -1181,11 +1181,11 @@ static int pin_2_irq(int idx, int apic,
 	if ((pin >= 16) && (pin <= 23)) {
 		if (pirq_entries[pin-16] != -1) {
 			if (!pirq_entries[pin-16]) {
-				apic_printk(APIC_VERBOSE, KERN_DEBUG
+				printk(APIC_VERBOSE
 						"disabling PIRQ%d\n", pin-16);
 			} else {
 				irq = pirq_entries[pin-16];
-				apic_printk(APIC_VERBOSE, KERN_DEBUG
+				printk(APIC_VERBOSE
 						"using PIRQ%d -> IRQ %d\n",
 						pin-16, irq);
 			}
@@ -1494,7 +1494,7 @@ static void setup_IO_APIC_irq(int apic,
 
 	cpus_and(mask, cfg->domain, mask);
 
-	apic_printk(APIC_VERBOSE,KERN_DEBUG
+	printk(APIC_VERBOSE
 		    "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
 		    "IRQ %d Mode:%i Active:%i)\n",
 		    apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector,
@@ -1504,7 +1504,7 @@ static void setup_IO_APIC_irq(int apic,
 	if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry,
 			       cpu_mask_to_apicid(mask), trigger, polarity,
 			       cfg->vector)) {
-		printk("Failed to setup ioapic entry for ioapic  %d, pin %d\n",
+		printk(APIC_DEBUG "Failed to setup ioapic entry for ioapic  %d, pin %d\n",
 		       mp_ioapics[apic].mp_apicid, pin);
 		__clear_irq_vector(irq);
 		return;
@@ -1522,7 +1522,7 @@ static void __init setup_IO_APIC_irqs(vo
 	int apic, pin, idx, irq;
 	int notcon = 0;
 
-	apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
+	printk(APIC_VERBOSE "init IO_APIC IRQs\n");
 
 	for (apic = 0; apic < nr_ioapics; apic++) {
 		for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
@@ -1531,19 +1531,17 @@ static void __init setup_IO_APIC_irqs(vo
 			if (idx == -1) {
 				if (!notcon) {
 					notcon = 1;
-					apic_printk(APIC_VERBOSE,
-						KERN_DEBUG " %d-%d",
+					printk(APIC_VERBOSE " %d-%d",
 						mp_ioapics[apic].mp_apicid,
 						pin);
 				} else
-					apic_printk(APIC_VERBOSE, " %d-%d",
+					printk(KERN_CONT KERN_APIC " %d-%d",
 						mp_ioapics[apic].mp_apicid,
 						pin);
 				continue;
 			}
 			if (notcon) {
-				apic_printk(APIC_VERBOSE,
-					" (apicid-pin) not connected\n");
+				printk(KERN_CONT KERN_APIC " (apicid-pin) not connected\n");
 				notcon = 0;
 			}
 
@@ -1560,8 +1558,7 @@ static void __init setup_IO_APIC_irqs(vo
 	}
 
 	if (notcon)
-		apic_printk(APIC_VERBOSE,
-			" (apicid-pin) not connected\n");
+		printk(KERN_CONT KERN_APIC " (apicid-pin) not connected\n");
 }
 
 /*
@@ -1615,19 +1612,16 @@ __apicdebuginit(void) print_IO_APIC(void
 	struct irq_cfg *cfg;
 	unsigned int irq;
 
-	if (apic_verbosity == APIC_QUIET)
-		return;
-
-	printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
+	printk(APIC_VERBOSE "number of MP IRQ sources: %d.\n", mp_irq_entries);
 	for (i = 0; i < nr_ioapics; i++)
-		printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
+		printk(APIC_VERBOSE "number of IO-APIC #%d registers: %d.\n",
 		       mp_ioapics[i].mp_apicid, nr_ioapic_registers[i]);
 
 	/*
 	 * We are a bit conservative about what we expect.  We have to
 	 * know about every hardware change ASAP.
 	 */
-	printk(KERN_INFO "testing the IO APIC.......................\n");
+	printk(APIC_VERBOSE "testing the IO APIC.......................\n");
 
 	for (apic = 0; apic < nr_ioapics; apic++) {
 
@@ -1640,18 +1634,18 @@ __apicdebuginit(void) print_IO_APIC(void
                 reg_03.raw = io_apic_read(apic, 3);
 	spin_unlock_irqrestore(&ioapic_lock, flags);
 
-	printk("\n");
-	printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid);
-	printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
-	printk(KERN_DEBUG ".......    : physical APIC id: %02X\n", reg_00.bits.ID);
-	printk(KERN_DEBUG ".......    : Delivery Type: %X\n", reg_00.bits.delivery_type);
-	printk(KERN_DEBUG ".......    : LTS          : %X\n", reg_00.bits.LTS);
+	printk(APIC_VERBOSE "\n");
+	printk(APIC_VERBOSE "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid);
+	printk(APIC_VERBOSE ".... register #00: %08X\n", reg_00.raw);
+	printk(APIC_VERBOSE ".......    : physical APIC id: %02X\n", reg_00.bits.ID);
+	printk(APIC_VERBOSE ".......    : Delivery Type: %X\n", reg_00.bits.delivery_type);
+	printk(APIC_VERBOSE ".......    : LTS          : %X\n", reg_00.bits.LTS);
 
-	printk(KERN_DEBUG ".... register #01: %08X\n", *(int *)&reg_01);
-	printk(KERN_DEBUG ".......     : max redirection entries: %04X\n", reg_01.bits.entries);
+	printk(APIC_VERBOSE ".... register #01: %08X\n", *(int *)&reg_01);
+	printk(APIC_VERBOSE ".......     : max redirection entries: %04X\n", reg_01.bits.entries);
 
-	printk(KERN_DEBUG ".......     : PRQ implemented: %X\n", reg_01.bits.PRQ);
-	printk(KERN_DEBUG ".......     : IO APIC version: %04X\n", reg_01.bits.version);
+	printk(APIC_VERBOSE ".......     : PRQ implemented: %X\n", reg_01.bits.PRQ);
+	printk(APIC_VERBOSE ".......     : IO APIC version: %04X\n", reg_01.bits.version);
 
 	/*
 	 * Some Intel chipsets with IO APIC VERSION of 0x1? don't have reg_02,
@@ -1659,8 +1653,8 @@ __apicdebuginit(void) print_IO_APIC(void
 	 * value, so ignore it if reg_02 == reg_01.
 	 */
 	if (reg_01.bits.version >= 0x10 && reg_02.raw != reg_01.raw) {
-		printk(KERN_DEBUG ".... register #02: %08X\n", reg_02.raw);
-		printk(KERN_DEBUG ".......     : arbitration: %02X\n", reg_02.bits.arbitration);
+		printk(APIC_VERBOSE ".... register #02: %08X\n", reg_02.raw);
+		printk(APIC_VERBOSE ".......     : arbitration: %02X\n", reg_02.bits.arbitration);
 	}
 
 	/*
@@ -1670,13 +1664,13 @@ __apicdebuginit(void) print_IO_APIC(void
 	 */
 	if (reg_01.bits.version >= 0x20 && reg_03.raw != reg_02.raw &&
 	    reg_03.raw != reg_01.raw) {
-		printk(KERN_DEBUG ".... register #03: %08X\n", reg_03.raw);
-		printk(KERN_DEBUG ".......     : Boot DT    : %X\n", reg_03.bits.boot_DT);
+		printk(APIC_VERBOSE ".... register #03: %08X\n", reg_03.raw);
+		printk(APIC_VERBOSE ".......     : Boot DT    : %X\n", reg_03.bits.boot_DT);
 	}
 
-	printk(KERN_DEBUG ".... IRQ redirection table:\n");
+	printk(APIC_VERBOSE ".... IRQ redirection table:\n");
 
-	printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
+	printk(APIC_VERBOSE " NR Dst Mask Trig IRR Pol"
 			  " Stat Dmod Deli Vect:   \n");
 
 	for (i = 0; i <= reg_01.bits.entries; i++) {
@@ -1684,12 +1678,12 @@ __apicdebuginit(void) print_IO_APIC(void
 
 		entry = ioapic_read_entry(apic, i);
 
-		printk(KERN_DEBUG " %02x %03X ",
+		printk(KERN_CONT KERN_APIC " %02x %03X ",
 			i,
 			entry.dest
 		);
 
-		printk("%1d    %1d    %1d   %1d   %1d    %1d    %1d    %02X\n",
+		printk(KERN_CONT KERN_APIC "%1d    %1d    %1d   %1d   %1d    %1d    %1d    %02X\n",
 			entry.mask,
 			entry.trigger,
 			entry.irr,
@@ -1701,22 +1695,22 @@ __apicdebuginit(void) print_IO_APIC(void
 		);
 	}
 	}
-	printk(KERN_DEBUG "IRQ to pin mappings:\n");
+	printk(APIC_VERBOSE "IRQ to pin mappings:\n");
 	for_each_irq_cfg(irq, cfg) {
 		struct irq_pin_list *entry = cfg->irq_2_pin;
 		if (!entry)
 			continue;
-		printk(KERN_DEBUG "IRQ%d ", irq);
+		printk(APIC_VERBOSE "IRQ%d ", irq);
 		for (;;) {
-			printk("-> %d:%d", entry->apic, entry->pin);
+			printk(KERN_CONT KERN_APIC "-> %d:%d", entry->apic, entry->pin);
 			if (!entry->next)
 				break;
 			entry = entry->next;
 		}
-		printk("\n");
+		printk(KERN_CONT KERN_APIC "\n");
 	}
 
-	printk(KERN_INFO ".................................... done.\n");
+	printk(APIC_VERBOSE ".................................... done.\n");
 
 	return;
 }
@@ -1726,19 +1720,17 @@ __apicdebuginit(void) print_APIC_bitfiel
 	unsigned int v;
 	int i, j;
 
-	if (apic_verbosity == APIC_QUIET)
-		return;
-
-	printk(KERN_DEBUG "0123456789abcdef0123456789abcdef\n" KERN_DEBUG);
+	printk(APIC_VERBOSE "    0123456789abcdef0123456789abcdef\n");
 	for (i = 0; i < 8; i++) {
+		printk(APIC_VERBOSE "    ");
 		v = apic_read(base + i*0x10);
 		for (j = 0; j < 32; j++) {
 			if (v & (1<<j))
-				printk("1");
+				printk(KERN_CONT KERN_APIC "1");
 			else
-				printk("0");
+				printk(KERN_CONT KERN_APIC "0");
 		}
-		printk("\n");
+		printk(KERN_CONT KERN_APIC "\n");
 	}
 }
 
@@ -1747,29 +1739,27 @@ __apicdebuginit(void) print_local_APIC(v
 	unsigned int v, ver, maxlvt;
 	u64 icr;
 
-	if (apic_verbosity == APIC_QUIET)
-		return;
-
-	printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
+	printk(APIC_VERBOSE "\n");
+	printk(APIC_VERBOSE "printing local APIC contents on CPU#%d/%d:\n",
 		smp_processor_id(), hard_smp_processor_id());
 	v = apic_read(APIC_ID);
-	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, read_apic_id());
+	printk(APIC_VERBOSE "... APIC ID:      %08x (%01x)\n", v, read_apic_id());
 	v = apic_read(APIC_LVR);
-	printk(KERN_INFO "... APIC VERSION: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC VERSION: %08x\n", v);
 	ver = GET_APIC_VERSION(v);
 	maxlvt = lapic_get_maxlvt();
 
 	v = apic_read(APIC_TASKPRI);
-	printk(KERN_DEBUG "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK);
+	printk(APIC_VERBOSE "... APIC TASKPRI: %08x (%02x)\n", v, v & APIC_TPRI_MASK);
 
 	if (APIC_INTEGRATED(ver)) {                     /* !82489DX */
 		if (!APIC_XAPIC(ver)) {
 			v = apic_read(APIC_ARBPRI);
-			printk(KERN_DEBUG "... APIC ARBPRI: %08x (%02x)\n", v,
+			printk(APIC_VERBOSE "... APIC ARBPRI: %08x (%02x)\n", v,
 			       v & APIC_ARBPRI_MASK);
 		}
 		v = apic_read(APIC_PROCPRI);
-		printk(KERN_DEBUG "... APIC PROCPRI: %08x\n", v);
+		printk(APIC_VERBOSE "... APIC PROCPRI: %08x\n", v);
 	}
 
 	/*
@@ -1778,23 +1768,23 @@ __apicdebuginit(void) print_local_APIC(v
 	 */
 	if (!APIC_INTEGRATED(ver) || maxlvt == 3) {
 		v = apic_read(APIC_RRR);
-		printk(KERN_DEBUG "... APIC RRR: %08x\n", v);
+		printk(APIC_VERBOSE "... APIC RRR: %08x\n", v);
 	}
 
 	v = apic_read(APIC_LDR);
-	printk(KERN_DEBUG "... APIC LDR: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC LDR: %08x\n", v);
 	if (!x2apic_enabled()) {
 		v = apic_read(APIC_DFR);
-		printk(KERN_DEBUG "... APIC DFR: %08x\n", v);
+		printk(APIC_VERBOSE "... APIC DFR: %08x\n", v);
 	}
 	v = apic_read(APIC_SPIV);
-	printk(KERN_DEBUG "... APIC SPIV: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC SPIV: %08x\n", v);
 
-	printk(KERN_DEBUG "... APIC ISR field:\n");
+	printk(APIC_VERBOSE "... APIC ISR field:\n");
 	print_APIC_bitfield(APIC_ISR);
-	printk(KERN_DEBUG "... APIC TMR field:\n");
+	printk(APIC_VERBOSE "... APIC TMR field:\n");
 	print_APIC_bitfield(APIC_TMR);
-	printk(KERN_DEBUG "... APIC IRR field:\n");
+	printk(APIC_VERBOSE "... APIC IRR field:\n");
 	print_APIC_bitfield(APIC_IRR);
 
 	if (APIC_INTEGRATED(ver)) {             /* !82489DX */
@@ -1802,37 +1792,37 @@ __apicdebuginit(void) print_local_APIC(v
 			apic_write(APIC_ESR, 0);
 
 		v = apic_read(APIC_ESR);
-		printk(KERN_DEBUG "... APIC ESR: %08x\n", v);
+		printk(APIC_VERBOSE "... APIC ESR: %08x\n", v);
 	}
 
 	icr = apic_icr_read();
-	printk(KERN_DEBUG "... APIC ICR: %08x\n", (u32)icr);
-	printk(KERN_DEBUG "... APIC ICR2: %08x\n", (u32)(icr >> 32));
+	printk(APIC_VERBOSE "... APIC ICR: %08x\n", (u32)icr);
+	printk(APIC_VERBOSE "... APIC ICR2: %08x\n", (u32)(icr >> 32));
 
 	v = apic_read(APIC_LVTT);
-	printk(KERN_DEBUG "... APIC LVTT: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC LVTT: %08x\n", v);
 
 	if (maxlvt > 3) {                       /* PC is LVT#4. */
 		v = apic_read(APIC_LVTPC);
-		printk(KERN_DEBUG "... APIC LVTPC: %08x\n", v);
+		printk(APIC_VERBOSE "... APIC LVTPC: %08x\n", v);
 	}
 	v = apic_read(APIC_LVT0);
-	printk(KERN_DEBUG "... APIC LVT0: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC LVT0: %08x\n", v);
 	v = apic_read(APIC_LVT1);
-	printk(KERN_DEBUG "... APIC LVT1: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC LVT1: %08x\n", v);
 
 	if (maxlvt > 2) {			/* ERR is LVT#3. */
 		v = apic_read(APIC_LVTERR);
-		printk(KERN_DEBUG "... APIC LVTERR: %08x\n", v);
+		printk(APIC_VERBOSE "... APIC LVTERR: %08x\n", v);
 	}
 
 	v = apic_read(APIC_TMICT);
-	printk(KERN_DEBUG "... APIC TMICT: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC TMICT: %08x\n", v);
 	v = apic_read(APIC_TMCCT);
-	printk(KERN_DEBUG "... APIC TMCCT: %08x\n", v);
+	printk(APIC_VERBOSE "... APIC TMCCT: %08x\n", v);
 	v = apic_read(APIC_TDCR);
-	printk(KERN_DEBUG "... APIC TDCR: %08x\n", v);
-	printk("\n");
+	printk(APIC_VERBOSE "... APIC TDCR: %08x\n", v);
+	printk(APIC_VERBOSE "\n");
 }
 
 __apicdebuginit(void) print_all_local_APICs(void)
@@ -1850,18 +1840,15 @@ __apicdebuginit(void) print_PIC(void)
 	unsigned int v;
 	unsigned long flags;
 
-	if (apic_verbosity == APIC_QUIET)
-		return;
-
-	printk(KERN_DEBUG "\nprinting PIC contents\n");
+	printk(APIC_VERBOSE "\nprinting PIC contents\n");
 
 	spin_lock_irqsave(&i8259A_lock, flags);
 
 	v = inb(0xa1) << 8 | inb(0x21);
-	printk(KERN_DEBUG "... PIC  IMR: %04x\n", v);
+	printk(APIC_VERBOSE "... PIC  IMR: %04x\n", v);
 
 	v = inb(0xa0) << 8 | inb(0x20);
-	printk(KERN_DEBUG "... PIC  IRR: %04x\n", v);
+	printk(APIC_VERBOSE "... PIC  IRR: %04x\n", v);
 
 	outb(0x0b,0xa0);
 	outb(0x0b,0x20);
@@ -1871,10 +1858,10 @@ __apicdebuginit(void) print_PIC(void)
 
 	spin_unlock_irqrestore(&i8259A_lock, flags);
 
-	printk(KERN_DEBUG "... PIC  ISR: %04x\n", v);
+	printk(APIC_VERBOSE "... PIC  ISR: %04x\n", v);
 
 	v = inb(0x4d1) << 8 | inb(0x4d0);
-	printk(KERN_DEBUG "... PIC ELCR: %04x\n", v);
+	printk(APIC_VERBOSE "... PIC ELCR: %04x\n", v);
 }
 
 __apicdebuginit(int) print_all_ICs(void)
@@ -1942,7 +1929,7 @@ void __init enable_IO_APIC(void)
 	i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
 	/* Trust the MP table if nothing is setup in the hardware */
 	if ((ioapic_i8259.pin == -1) && (i8259_pin >= 0)) {
-		printk(KERN_WARNING "ExtINT not setup in hardware but reported by MP table\n");
+		printk(KERN_WARNING KERN_APIC "ExtINT not setup in hardware but reported by MP table\n");
 		ioapic_i8259.pin  = i8259_pin;
 		ioapic_i8259.apic = i8259_apic;
 	}
@@ -1950,7 +1937,7 @@ void __init enable_IO_APIC(void)
 	if (((ioapic_i8259.apic != i8259_apic) || (ioapic_i8259.pin != i8259_pin)) &&
 		(i8259_pin >= 0) && (ioapic_i8259.pin >= 0))
 	{
-		printk(KERN_WARNING "ExtINT in hardware and MP table differ\n");
+		printk(KERN_WARNING KERN_APIC "ExtINT in hardware and MP table differ\n");
 	}
 
 	/*
@@ -2043,9 +2030,9 @@ static void __init setup_ioapic_ids_from
 		old_id = mp_ioapics[apic].mp_apicid;
 
 		if (mp_ioapics[apic].mp_apicid >= get_physical_broadcast()) {
-			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
+			printk(KERN_ERR KERN_APIC "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
 				apic, mp_ioapics[apic].mp_apicid);
-			printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
+			printk(KERN_ERR KERN_APIC "... fixing up to %d. (tell your hw vendor)\n",
 				reg_00.bits.ID);
 			mp_ioapics[apic].mp_apicid = reg_00.bits.ID;
 		}
@@ -2057,21 +2044,21 @@ static void __init setup_ioapic_ids_from
 		 */
 		if (check_apicid_used(phys_id_present_map,
 					mp_ioapics[apic].mp_apicid)) {
-			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
+			printk(KERN_ERR KERN_APIC "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
 				apic, mp_ioapics[apic].mp_apicid);
 			for (i = 0; i < get_physical_broadcast(); i++)
 				if (!physid_isset(i, phys_id_present_map))
 					break;
 			if (i >= get_physical_broadcast())
 				panic("Max APIC ID exceeded!\n");
-			printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
+			printk(KERN_ERR KERN_APIC "... fixing up to %d. (tell your hw vendor)\n",
 				i);
 			physid_set(i, phys_id_present_map);
 			mp_ioapics[apic].mp_apicid = i;
 		} else {
 			physid_mask_t tmp;
 			tmp = apicid_to_cpu_present(mp_ioapics[apic].mp_apicid);
-			apic_printk(APIC_VERBOSE, "Setting %d in the "
+			printk(APIC_VERBOSE "Setting %d in the "
 					"phys_id_present_map\n",
 					mp_ioapics[apic].mp_apicid);
 			physids_or(phys_id_present_map, phys_id_present_map, tmp);
@@ -2092,7 +2079,7 @@ static void __init setup_ioapic_ids_from
 		 * Read the right value from the MPC table and
 		 * write it into the ID register.
 		 */
-		apic_printk(APIC_VERBOSE, KERN_INFO
+		printk(APIC_VERBOSE
 			"...changing IO-APIC physical APIC ID to %d ...",
 			mp_ioapics[apic].mp_apicid);
 
@@ -2108,9 +2095,9 @@ static void __init setup_ioapic_ids_from
 		reg_00.raw = io_apic_read(apic, 0);
 		spin_unlock_irqrestore(&ioapic_lock, flags);
 		if (reg_00.bits.ID != mp_ioapics[apic].mp_apicid)
-			printk("could not set ID!\n");
+			printk(KERN_CONT KERN_APIC "could not set ID!\n");
 		else
-			apic_printk(APIC_VERBOSE, " ok.\n");
+			printk(KERN_CONT KERN_APIC " ok.\n");
 	}
 }
 #endif
@@ -2668,11 +2655,11 @@ static void __init setup_nmi(void)
 	 * is from Maciej W. Rozycki - so we do not have to EOI from
 	 * the NMI handler or the timer interrupt.
 	 */
-	apic_printk(APIC_VERBOSE, KERN_INFO "activating NMI Watchdog ...");
+	printk(APIC_VERBOSE "activating NMI Watchdog ...");
 
 	enable_NMI_through_LVT0();
 
-	apic_printk(APIC_VERBOSE, " done.\n");
+	printk(KERN_CONT KERN_APIC " done.\n");
 }
 
 /*
@@ -2792,7 +2779,7 @@ static inline void __init check_timer(vo
 	pin2  = ioapic_i8259.pin;
 	apic2 = ioapic_i8259.apic;
 
-	apic_printk(APIC_QUIET, KERN_INFO "..TIMER: vector=0x%02X "
+	printk(APIC_QUIET "..TIMER: vector=0x%02X "
 		    "apic1=%d pin1=%d apic2=%d pin2=%d\n",
 		    cfg->vector, apic1, pin1, apic2, pin2);
 
@@ -2840,12 +2827,12 @@ static inline void __init check_timer(vo
 #endif
 		clear_IO_APIC_pin(apic1, pin1);
 		if (!no_pin1)
-			apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: "
+			printk(APIC_QUIET "..MP-BIOS bug: "
 				    "8254 timer not connected to IO-APIC\n");
 
-		apic_printk(APIC_QUIET, KERN_INFO "...trying to set up timer "
+		printk(APIC_QUIET "...trying to set up timer "
 			    "(IRQ0) through the 8259A ...\n");
-		apic_printk(APIC_QUIET, KERN_INFO
+		printk(APIC_QUIET
 			    "..... (found apic %d pin %d) ...\n", apic2, pin2);
 		/*
 		 * legacy devices should be connected to IO APIC #0
@@ -2855,7 +2842,7 @@ static inline void __init check_timer(vo
 		unmask_IO_APIC_irq(0);
 		enable_8259A_irq(0);
 		if (timer_irq_works()) {
-			apic_printk(APIC_QUIET, KERN_INFO "....... works.\n");
+			printk(APIC_QUIET "....... works.\n");
 			timer_through_8259 = 1;
 			if (nmi_watchdog == NMI_IO_APIC) {
 				disable_8259A_irq(0);
@@ -2869,11 +2856,11 @@ static inline void __init check_timer(vo
 		 */
 		disable_8259A_irq(0);
 		clear_IO_APIC_pin(apic2, pin2);
-		apic_printk(APIC_QUIET, KERN_INFO "....... failed.\n");
+		printk(APIC_QUIET "....... failed.\n");
 	}
 
 	if (nmi_watchdog == NMI_IO_APIC) {
-		apic_printk(APIC_QUIET, KERN_WARNING "timer doesn't work "
+		printk(APIC_QUIET "timer doesn't work "
 			    "through the IO-APIC - disabling NMI Watchdog!\n");
 		nmi_watchdog = NMI_NONE;
 	}
@@ -2881,7 +2868,7 @@ static inline void __init check_timer(vo
 	timer_ack = 0;
 #endif
 
-	apic_printk(APIC_QUIET, KERN_INFO
+	printk(APIC_QUIET
 		    "...trying to set up timer as Virtual Wire IRQ...\n");
 
 	lapic_register_intr(0);
@@ -2889,14 +2876,14 @@ static inline void __init check_timer(vo
 	enable_8259A_irq(0);
 
 	if (timer_irq_works()) {
-		apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
+		printk(APIC_QUIET "..... works.\n");
 		goto out;
 	}
 	disable_8259A_irq(0);
 	apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
-	apic_printk(APIC_QUIET, KERN_INFO "..... failed.\n");
+	printk(APIC_QUIET "..... failed.\n");
 
-	apic_printk(APIC_QUIET, KERN_INFO
+	printk(APIC_QUIET
 		    "...trying to set up timer as ExtINT IRQ...\n");
 
 	init_8259A(0);
@@ -2906,10 +2893,10 @@ static inline void __init check_timer(vo
 	unlock_ExtINT_logic();
 
 	if (timer_irq_works()) {
-		apic_printk(APIC_QUIET, KERN_INFO "..... works.\n");
+		printk(APIC_QUIET "..... works.\n");
 		goto out;
 	}
-	apic_printk(APIC_QUIET, KERN_INFO "..... failed :(.\n");
+	printk(APIC_QUIET "..... failed :(.\n");
 	panic("IO-APIC + timer doesn't work!  Boot with apic=debug and send a "
 		"report.  Then try booting with the 'noapic' option.\n");
 out:
@@ -2948,7 +2935,7 @@ void __init setup_IO_APIC(void)
 
 	io_apic_irqs = ~PIC_IRQS;
 
-	apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
+	printk(APIC_VERBOSE "ENABLING IO-APIC IRQs\n");
         /*
          * Set up IO-APIC IRQ routing.
          */
@@ -3802,7 +3789,7 @@ int __init io_apic_get_unique_id(int ioa
 		}
 	}
 
-	apic_printk(APIC_VERBOSE, KERN_INFO
+	printk(APIC_VERBOSE
 			"IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
 
 	return apic_id;
@@ -3824,7 +3811,7 @@ int __init io_apic_get_version(int ioapi
 int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
 {
 	if (!IO_APIC_IRQ(irq)) {
-		apic_printk(APIC_QUIET,KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
+		printk(APIC_QUIET "IOAPIC[%d]: Invalid reference to IRQ 0\n",
 			ioapic);
 		return -EINVAL;
 	}
@@ -3970,7 +3957,7 @@ fake_ioapic_page:
 			ioapic_phys = __pa(ioapic_phys);
 		}
 		set_fixmap_nocache(idx, ioapic_phys);
-		apic_printk(APIC_VERBOSE,
+		printk(APIC_VERBOSE
 			    "mapped IOAPIC to %08lx (%08lx)\n",
 			    __fix_to_virt(idx), ioapic_phys);
 		idx++;
Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -83,7 +83,7 @@ static void __init MP_bus_info(struct mp
 	if (x86_quirks->mpc_oem_bus_info)
 		x86_quirks->mpc_oem_bus_info(m, str);
 	else
-		apic_printk(APIC_VERBOSE, "Bus #%d is %s\n", m->mpc_busid, str);
+		printk(APIC_VERBOSE "Bus #%d is %s\n", m->mpc_busid, str);
 
 #if MAX_MP_BUSSES < 256
 	if (m->mpc_busid >= MAX_MP_BUSSES) {
@@ -154,7 +154,7 @@ static void __init MP_ioapic_info(struct
 
 static void print_MP_intsrc_info(struct mpc_config_intsrc *m)
 {
-	apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x,"
+	printk(APIC_VERBOSE "Int: type %d, pol %d, trig %d, bus %02x,"
 		" IRQ %02x, APIC ID %x, APIC INT %02x\n",
 		m->mpc_irqtype, m->mpc_irqflag & 3,
 		(m->mpc_irqflag >> 2) & 3, m->mpc_srcbus,
@@ -163,7 +163,7 @@ static void print_MP_intsrc_info(struct
 
 static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq)
 {
-	apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x,"
+	printk(APIC_VERBOSE "Int: type %d, pol %d, trig %d, bus %02x,"
 		" IRQ %02x, APIC ID %x, APIC INT %02x\n",
 		mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3,
 		(mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus,
@@ -235,7 +235,7 @@ static void __init MP_intsrc_info(struct
 
 static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m)
 {
-	apic_printk(APIC_VERBOSE, "Lint: type %d, pol %d, trig %d, bus %02x,"
+	printk(APIC_VERBOSE "Lint: type %d, pol %d, trig %d, bus %02x,"
 		" IRQ %02x, APIC ID %x, APIC LINT %02x\n",
 		m->mpc_irqtype, m->mpc_irqflag & 3,
 		(m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid,
@@ -697,7 +697,7 @@ static int __init smp_scan_config(unsign
 	unsigned int *bp = phys_to_virt(base);
 	struct intel_mp_floating *mpf;
 
-	apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n",
+	printk(APIC_VERBOSE "Scan SMP from %p for %ld bytes.\n",
 			bp, length);
 	BUILD_BUG_ON(sizeof(*mpf) != 16);
 
Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot.c
+++ linux-2.6/arch/x86/kernel/smpboot.c
@@ -542,17 +542,18 @@ static inline void __inquire_remote_apic
 	int timeout;
 	u32 status;
 
-	printk(KERN_INFO "Inquiring remote APIC 0x%x...\n", apicid);
+	printk(APIC_DEBUG "Inquiring remote APIC 0x%x...\n", apicid);
 
 	for (i = 0; i < ARRAY_SIZE(regs); i++) {
-		printk(KERN_INFO "... APIC 0x%x %s: ", apicid, names[i]);
+		printk(APIC_DEBUG "... APIC 0x%x %s: ",
+			 apicid, names[i]);
 
 		/*
 		 * Wait for idle.
 		 */
 		status = safe_apic_wait_icr_idle();
 		if (status)
-			printk(KERN_CONT
+			printk(KERN_CONT KERN_APIC
 			       "a previous APIC delivery may have failed\n");
 
 		apic_icr_write(APIC_DM_REMRD | regs[i], apicid);
@@ -566,10 +567,10 @@ static inline void __inquire_remote_apic
 		switch (status) {
 		case APIC_ICR_RR_VALID:
 			status = apic_read(APIC_RRR);
-			printk(KERN_CONT "%08x\n", status);
+			printk(KERN_CONT KERN_APIC "%08x\n", status);
 			break;
 		default:
-			printk(KERN_CONT "failed\n");
+			printk(KERN_CONT KERN_APIC "failed\n");
 		}
 	}
 }
Index: linux-2.6/include/asm-x86/apic.h
===================================================================
--- linux-2.6.orig/include/asm-x86/apic.h
+++ linux-2.6/include/asm-x86/apic.h
@@ -14,24 +14,14 @@
 
 #define ARCH_APICTIMER_STOPS_ON_C3	1
 
-/*
- * Debugging macros
- */
-#define APIC_QUIET   0
-#define APIC_VERBOSE 1
-#define APIC_DEBUG   2
+#define KERN_APIC "<apic>"
 
 /*
- * Define the default level of output to be very little
- * This can be turned up by using apic=verbose for more
- * information and apic=debug for _lots_ of information.
- * apic_verbosity is defined in apic.c
+ * Debugging macros
  */
-#define apic_printk(v, s, a...) do {       \
-		if ((v) <= apic_verbosity) \
-			printk(s, ##a);    \
-	} while (0)
-
+#define APIC_QUIET   KERN_WARNING KERN_APIC
+#define APIC_VERBOSE KERN_INFO KERN_APIC
+#define APIC_DEBUG   KERN_DEBUG KERN_APIC
 
 extern void generic_apic_probe(void);
 
Index: linux-2.6/include/asm-x86/es7000/wakecpu.h
===================================================================
--- linux-2.6.orig/include/asm-x86/es7000/wakecpu.h
+++ linux-2.6/include/asm-x86/es7000/wakecpu.h
@@ -50,10 +50,6 @@ static inline void restore_NMI_vector(un
 {
 }
 
-#if APIC_DEBUG
- #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
-#else
- #define inquire_remote_apic(apicid) {}
-#endif
+#define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
 
 #endif /* __ASM_MACH_WAKECPU_H */
Index: linux-2.6/include/asm-x86/mach-default/mach_wakecpu.h
===================================================================
--- linux-2.6.orig/include/asm-x86/mach-default/mach_wakecpu.h
+++ linux-2.6/include/asm-x86/mach-default/mach_wakecpu.h
@@ -33,10 +33,6 @@ static inline void restore_NMI_vector(un
 {
 }
 
-#if APIC_DEBUG
- #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
-#else
- #define inquire_remote_apic(apicid) {}
-#endif
+#define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
 
 #endif /* ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H */

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17  8:27 ` [PATCH 3/6] pci: using printk(KERN_PCI v3 Yinghai Lu
@ 2008-09-17  8:35   ` Ingo Molnar
  2008-09-17  8:41     ` Yinghai Lu
  2008-09-17 22:28   ` Bjorn Helgaas
  1 sibling, 1 reply; 33+ messages in thread
From: Ingo Molnar @ 2008-09-17  8:35 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> -			printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
> +			printk(KERN_DEBUG KERN_PCI
> +				 "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",

i think we should aim to make the common usage of this facility as easy 
and short as possible. That means that i think the right line is:

+			printk(KERN_PCI
+				 "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",

as that is the shortest form. KERN_PCI should imply whatever 
common-sense default. It should still make sense to specify KERN_FOO 
KERN_PCI, to override that default.

	Ingo

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 6/6] x86: add KERN_APIC
  2008-09-17  8:27 ` [PATCH 6/6] x86: add KERN_APIC Yinghai Lu
@ 2008-09-17  8:38   ` Ingo Molnar
  2008-09-17  8:45     ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: Ingo Molnar @ 2008-09-17  8:38 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> and kill apic_printk
> using loglevel=apic:8 instead

yes, that aspect is very nice.

> +DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);

> -		printk(KERN_WARNING "APIC calibration not consistent "
> +		printk(KERN_WARNING KERN_APIC "APIC calibration not consistent "

here too the question arises: what should the semantics of the 'mixing' 
of such subsystem printk tags with the classic priority tags be. I think 
in this particular case we dont want the KERN_APIC tag, as that would 
prevent this failure message to be printed by default. I.e. this line 
should remain:

> -		printk(KERN_WARNING "APIC calibration not consistent "

to make sure this warning always shows up in the logs. Agreed?

	Ingo

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17  8:35   ` Ingo Molnar
@ 2008-09-17  8:41     ` Yinghai Lu
  2008-09-17 10:11       ` Robert Richter
  0 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:41 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel

On Wed, Sep 17, 2008 at 1:35 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
>> -                     printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>> +                     printk(KERN_DEBUG KERN_PCI
>> +                              "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>
> i think we should aim to make the common usage of this facility as easy
> and short as possible. That means that i think the right line is:
>
> +                       printk(KERN_PCI
> +                                "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>
> as that is the shortest form. KERN_PCI should imply whatever
> common-sense default. It should still make sense to specify KERN_FOO
> KERN_PCI, to override that default.

vprintk will add default before that like
like print(KERN_INFO KERN_PCI ....)

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 6/6] x86: add KERN_APIC
  2008-09-17  8:38   ` Ingo Molnar
@ 2008-09-17  8:45     ` Yinghai Lu
  2008-09-17  8:52       ` Ingo Molnar
  2008-09-17 12:08       ` Frans Pop
  0 siblings, 2 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  8:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel

On Wed, Sep 17, 2008 at 1:38 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
>> and kill apic_printk
>> using loglevel=apic:8 instead
>
> yes, that aspect is very nice.
>
>> +DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);
>
>> -             printk(KERN_WARNING "APIC calibration not consistent "
>> +             printk(KERN_WARNING KERN_APIC "APIC calibration not consistent "
>
> here too the question arises: what should the semantics of the 'mixing'
> of such subsystem printk tags with the classic priority tags be. I think
> in this particular case we dont want the KERN_APIC tag, as that would
> prevent this failure message to be printed by default. I.e. this line
> should remain:
>
>> -             printk(KERN_WARNING "APIC calibration not consistent "
>
> to make sure this warning always shows up in the logs. Agreed?

with

DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);

the KERN_WARNING <5> will be showing up that warning, even without
loglevl=apic:8

or change that  to
DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 7);
?

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 6/6] x86: add KERN_APIC
  2008-09-17  8:45     ` Yinghai Lu
@ 2008-09-17  8:52       ` Ingo Molnar
  2008-09-17 12:08       ` Frans Pop
  1 sibling, 0 replies; 33+ messages in thread
From: Ingo Molnar @ 2008-09-17  8:52 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, Andrew Morton, linux-kernel


* Yinghai Lu <yhlu.kernel@gmail.com> wrote:

> On Wed, Sep 17, 2008 at 1:38 AM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> >
> >> and kill apic_printk
> >> using loglevel=apic:8 instead
> >
> > yes, that aspect is very nice.
> >
> >> +DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);
> >
> >> -             printk(KERN_WARNING "APIC calibration not consistent "
> >> +             printk(KERN_WARNING KERN_APIC "APIC calibration not consistent "
> >
> > here too the question arises: what should the semantics of the 'mixing'
> > of such subsystem printk tags with the classic priority tags be. I think
> > in this particular case we dont want the KERN_APIC tag, as that would
> > prevent this failure message to be printed by default. I.e. this line
> > should remain:
> >
> >> -             printk(KERN_WARNING "APIC calibration not consistent "
> >
> > to make sure this warning always shows up in the logs. Agreed?
> 
> with
> 
> DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);
> 
> the KERN_WARNING <5> will be showing up that warning, even without
> loglevl=apic:8

ok, but if that printk will show up no matter what, why is there any 
need to add an extra tag?

my main worry is the duplication of the tag. People have a hard enough 
time adding a _single_ printk tag - adding multiple ones is clearly too 
much.

	Ingo

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
                   ` (5 preceding siblings ...)
  2008-09-17  8:27 ` [PATCH 6/6] x86: add KERN_APIC Yinghai Lu
@ 2008-09-17  8:55 ` Andrew Morton
  2008-09-17  9:27   ` Ingo Molnar
  6 siblings, 1 reply; 33+ messages in thread
From: Andrew Morton @ 2008-09-17  8:55 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-kernel

On Wed, 17 Sep 2008 01:27:41 -0700 Yinghai Lu <yhlu.kernel@gmail.com> wrote:

>     KERN_PCI
>     KERN_ACPI
> v4: fix some checkpatch error and warning
> v5: add default with DEFINE_LOGLEVE_SETUP_DEF
>     KERN_APIC
> v6: set the default only one time
> 
> usage:
> 	in .h to have
> 		#define KERN_PCI "<pci>"
> 	in .c to have
> 		DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
> 	then could use
> 		printk(KERN_DEBUG KERN_PCI fmt, ...);
> 	and command line
> 		loglevel=3,pci:8
> 
> you can add different printk to different files of one subsys if you like
> not just one susbsys one tag, and don't need to update kernel.h to add more tags

This all looks dreadfully similar to Jason Baron's "dynamic debug v2".

Similar enough that we couldn't justify merging both.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-17  8:55 ` [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Andrew Morton
@ 2008-09-17  9:27   ` Ingo Molnar
  2008-09-17 18:46     ` Jason Baron
  0 siblings, 1 reply; 33+ messages in thread
From: Ingo Molnar @ 2008-09-17  9:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Yinghai Lu, Thomas Gleixner, H. Peter Anvin, linux-kernel, Jason Baron


(Jason Cc:-ed)

* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 17 Sep 2008 01:27:41 -0700 Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> 
> >     KERN_PCI
> >     KERN_ACPI
> > v4: fix some checkpatch error and warning
> > v5: add default with DEFINE_LOGLEVE_SETUP_DEF
> >     KERN_APIC
> > v6: set the default only one time
> > 
> > usage:
> > 	in .h to have
> > 		#define KERN_PCI "<pci>"
> > 	in .c to have
> > 		DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
> > 	then could use
> > 		printk(KERN_DEBUG KERN_PCI fmt, ...);
> > 	and command line
> > 		loglevel=3,pci:8
> > 
> > you can add different printk to different files of one subsys if you like
> > not just one susbsys one tag, and don't need to update kernel.h to add more tags
> 
> This all looks dreadfully similar to Jason Baron's "dynamic debug v2".

yeah, but s/dreadfully/luckily

> Similar enough that we couldn't justify merging both.

agreed.

Here's the summary as i see it: Jason's "dynamic debug" mainly relies on 
automatically creating a section of tags associated with each pr_debug() 
callsite. The unit of filtering is the .c file - which lends itself well 
to things like individual drivers but is not quite good for more generic 
entities like full subsystems.

I think a better model is what hpa suggested: add string tags at the 
call site and make it all a sub-case of printk, via ASCII space tags. 
OTOH, a pr_debug() variant could be offered that just inserts a __FILE__ 
tag into the output - this would enable most of the "dynamic debug" 
functionality that Jason's patch series implements IMO.

There's also a wider robustness argument why this is better: we want to 
keep printk simple by default, hence doing these things via the ASCII 
space is good design. "dynamic debug" does it all programmatically via 
extra sections, etc., which is eventually a source of bugs and 
unrobustness.

	Ingo

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17  8:41     ` Yinghai Lu
@ 2008-09-17 10:11       ` Robert Richter
  2008-09-17 16:25         ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: Robert Richter @ 2008-09-17 10:11 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On 17.09.08 01:41:03, Yinghai Lu wrote:
> On Wed, Sep 17, 2008 at 1:35 AM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> >
> >> -                     printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
> >> +                     printk(KERN_DEBUG KERN_PCI
> >> +                              "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
> >
> > i think we should aim to make the common usage of this facility as easy
> > and short as possible. That means that i think the right line is:
> >
> > +                       printk(KERN_PCI
> > +                                "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
> >
> > as that is the shortest form. KERN_PCI should imply whatever
> > common-sense default. It should still make sense to specify KERN_FOO
> > KERN_PCI, to override that default.
> 
> vprintk will add default before that like
> like print(KERN_INFO KERN_PCI ....)

What about a pci_dbg() macro similiar to dev_dbg()? Same could be used
for ACPI, acpi_dbg().

-Robert

> 
> YH
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 6/6] x86: add KERN_APIC
  2008-09-17  8:45     ` Yinghai Lu
  2008-09-17  8:52       ` Ingo Molnar
@ 2008-09-17 12:08       ` Frans Pop
  2008-09-17 16:30         ` Yinghai Lu
  1 sibling, 1 reply; 33+ messages in thread
From: Frans Pop @ 2008-09-17 12:08 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: mingo, tglx, hpa, akpm, linux-kernel

Yinghai Lu wrote:
> On Wed, Sep 17, 2008 at 1:38 AM, Ingo Molnar <mingo@elte.hu> wrote:
>>> -             printk(KERN_WARNING "APIC calibration not consistent "
>>> +             printk(KERN_WARNING KERN_APIC "APIC calibration not
>>> consistent "
>>
>> here too the question arises: what should the semantics of the 'mixing'
>> of such subsystem printk tags with the classic priority tags be. I
>> think in this particular case we dont want the KERN_APIC tag, as that
>> would prevent this failure message to be printed by default. I.e. this
>> line should remain:
>>
>>> -             printk(KERN_WARNING "APIC calibration not consistent "
>>
>> to make sure this warning always shows up in the logs. Agreed?
>
> with
> DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6); 
> the KERN_WARNING <5> will be showing up that warning, even without
> loglevl=apic:8
> 
> or change that  to
> DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 7);

Are you suggesting that each subsystem define its own default log level? 
That sounds truly horrible. It would mean that when reading code or 
adding new messages you'd always have to check what the default loglevel 
is for a particular subsystem.

I really like the idea of being able to easily increase the verbosity for 
a particular subsystem, but please make sure that by default all messages 
with the same level are treated the same, irrespective of which subsystem 
they belong to.

So IMO
       printk(KERN_WARNING "APIC calibration not consistent "
and
       printk(KERN_WARNING KERN_APIC "APIC calibration not consistent "
should do exactly the same thing if no 'loglevel=apic:X' is used and that 
should be guaranteed for all subsystems.

Cheers,
FJP

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17 10:11       ` Robert Richter
@ 2008-09-17 16:25         ` Yinghai Lu
  0 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17 16:25 UTC (permalink / raw)
  To: Robert Richter
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wed, Sep 17, 2008 at 3:11 AM, Robert Richter <robert.richter@amd.com> wrote:
> On 17.09.08 01:41:03, Yinghai Lu wrote:
>> On Wed, Sep 17, 2008 at 1:35 AM, Ingo Molnar <mingo@elte.hu> wrote:
>> >
>> > * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>> >
>> >> -                     printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>> >> +                     printk(KERN_DEBUG KERN_PCI
>> >> +                              "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>> >
>> > i think we should aim to make the common usage of this facility as easy
>> > and short as possible. That means that i think the right line is:
>> >
>> > +                       printk(KERN_PCI
>> > +                                "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>> >
>> > as that is the shortest form. KERN_PCI should imply whatever
>> > common-sense default. It should still make sense to specify KERN_FOO
>> > KERN_PCI, to override that default.
>>
>> vprintk will add default before that like
>> like print(KERN_INFO KERN_PCI ....)
>
> What about a pci_dbg() macro similiar to dev_dbg()? Same could be used
> for ACPI, acpi_dbg().
>

according to different users ...

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 6/6] x86: add KERN_APIC
  2008-09-17 12:08       ` Frans Pop
@ 2008-09-17 16:30         ` Yinghai Lu
  0 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17 16:30 UTC (permalink / raw)
  To: Frans Pop; +Cc: mingo, tglx, hpa, akpm, linux-kernel

On Wed, Sep 17, 2008 at 5:08 AM, Frans Pop <elendil@planet.nl> wrote:
> Yinghai Lu wrote:
>> On Wed, Sep 17, 2008 at 1:38 AM, Ingo Molnar <mingo@elte.hu> wrote:
>>>> -             printk(KERN_WARNING "APIC calibration not consistent "
>>>> +             printk(KERN_WARNING KERN_APIC "APIC calibration not
>>>> consistent "
>>>
>>> here too the question arises: what should the semantics of the 'mixing'
>>> of such subsystem printk tags with the classic priority tags be. I
>>> think in this particular case we dont want the KERN_APIC tag, as that
>>> would prevent this failure message to be printed by default. I.e. this
>>> line should remain:
>>>
>>>> -             printk(KERN_WARNING "APIC calibration not consistent "
>>>
>>> to make sure this warning always shows up in the logs. Agreed?
>>
>> with
>> DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 6);
>> the KERN_WARNING <5> will be showing up that warning, even without
>> loglevl=apic:8
>>
>> or change that  to
>> DEFINE_LOGLEVEL_SETUP_DEF(apic, KERN_APIC, "apic:", 7);
>
> Are you suggesting that each subsystem define its own default log level?
> That sounds truly horrible. It would mean that when reading code or
> adding new messages you'd always have to check what the default loglevel
> is for a particular subsystem.

could be done.
SPEW: 8
???:9

current msg_loglevel is limted to one digital

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...)
  2008-09-17  8:27 ` [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...) Yinghai Lu
@ 2008-09-17 18:19   ` Marcin Slusarz
  2008-09-17 18:28     ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: Marcin Slusarz @ 2008-09-17 18:19 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wed, Sep 17, 2008 at 01:27:46AM -0700, Yinghai Lu wrote:
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> 
> ---
>  drivers/acpi/numa.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> Index: linux-2.6/drivers/acpi/numa.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/numa.c
> +++ linux-2.6/drivers/acpi/numa.c
> @@ -150,6 +150,15 @@ static __init int slit_valid(struct acpi
>  {
>  	int i, j;
>  	int d = slit->locality_count;
> +	printk(KERN_DEBUG KERN_ACPI "ACPI: SLIT: nodes = %d\n", d);
> +	for (i = 0; i < d; i++) {
> +		printk(KERN_DEBUG KERN_ACPI "  ");
> +		for (j = 0; j < d; j++)  {
> +			u8 val = slit->entry[d*i + j];
> +			printk(KERN_CONT KERN_ACPI " %d", val);
> +		}
> +		printk(KERN_CONT KERN_ACPI "\n");
> +	}

It will produce something like this:
<7><acpi>ACPI: SLIT: nodes = %d\n
<7><acpi>  <acpi> %d<acpi> %d<acpi> %d<acpi> %d<acpi>\n

bit wrong... ;)

Marcin

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...)
  2008-09-17 18:19   ` Marcin Slusarz
@ 2008-09-17 18:28     ` Yinghai Lu
  2008-09-17 18:56       ` Marcin Slusarz
  0 siblings, 1 reply; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17 18:28 UTC (permalink / raw)
  To: Marcin Slusarz
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wed, Sep 17, 2008 at 11:19 AM, Marcin Slusarz
<marcin.slusarz@gmail.com> wrote:
> On Wed, Sep 17, 2008 at 01:27:46AM -0700, Yinghai Lu wrote:
>> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>>
>> ---
>>  drivers/acpi/numa.c |    9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> Index: linux-2.6/drivers/acpi/numa.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/acpi/numa.c
>> +++ linux-2.6/drivers/acpi/numa.c
>> @@ -150,6 +150,15 @@ static __init int slit_valid(struct acpi
>>  {
>>       int i, j;
>>       int d = slit->locality_count;
>> +     printk(KERN_DEBUG KERN_ACPI "ACPI: SLIT: nodes = %d\n", d);
>> +     for (i = 0; i < d; i++) {
>> +             printk(KERN_DEBUG KERN_ACPI "  ");
>> +             for (j = 0; j < d; j++)  {
>> +                     u8 val = slit->entry[d*i + j];
>> +                     printk(KERN_CONT KERN_ACPI " %d", val);
>> +             }
>> +             printk(KERN_CONT KERN_ACPI "\n");
>> +     }
>
> It will produce something like this:
> <7><acpi>ACPI: SLIT: nodes = %d\n
> <7><acpi>  <acpi> %d<acpi> %d<acpi> %d<acpi> %d<acpi>\n
>
> bit wrong... ;)

did you check v6...?

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-17  9:27   ` Ingo Molnar
@ 2008-09-17 18:46     ` Jason Baron
  2008-09-17 19:25       ` H. Peter Anvin
  0 siblings, 1 reply; 33+ messages in thread
From: Jason Baron @ 2008-09-17 18:46 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Andrew Morton, Yinghai Lu, Thomas Gleixner, H. Peter Anvin, linux-kernel

On Wed, Sep 17, 2008 at 11:27:32AM +0200, Ingo Molnar wrote:
> (Jason Cc:-ed)
> 
> * Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > On Wed, 17 Sep 2008 01:27:41 -0700 Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> > 
> > >     KERN_PCI
> > >     KERN_ACPI
> > > v4: fix some checkpatch error and warning
> > > v5: add default with DEFINE_LOGLEVE_SETUP_DEF
> > >     KERN_APIC
> > > v6: set the default only one time
> > > 
> > > usage:
> > > 	in .h to have
> > > 		#define KERN_PCI "<pci>"
> > > 	in .c to have
> > > 		DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
> > > 	then could use
> > > 		printk(KERN_DEBUG KERN_PCI fmt, ...);
> > > 	and command line
> > > 		loglevel=3,pci:8
> > > 
> > > you can add different printk to different files of one subsys if you like
> > > not just one susbsys one tag, and don't need to update kernel.h to add more tags
> > 
> > This all looks dreadfully similar to Jason Baron's "dynamic debug v2".
> 
> yeah, but s/dreadfully/luckily
> 
> > Similar enough that we couldn't justify merging both.
> 
> agreed.
> 
> Here's the summary as i see it: Jason's "dynamic debug" mainly relies on 
> automatically creating a section of tags associated with each pr_debug() 
> callsite. The unit of filtering is the .c file - which lends itself well 
> to things like individual drivers but is not quite good for more generic 
> entities like full subsystems.
> 
> I think a better model is what hpa suggested: add string tags at the 
> call site and make it all a sub-case of printk, via ASCII space tags. 
> OTOH, a pr_debug() variant could be offered that just inserts a __FILE__ 
> tag into the output - this would enable most of the "dynamic debug" 
> functionality that Jason's patch series implements IMO.
> 
> There's also a wider robustness argument why this is better: we want to 
> keep printk simple by default, hence doing these things via the ASCII 
> space is good design. "dynamic debug" does it all programmatically via 
> extra sections, etc., which is eventually a source of bugs and 
> unrobustness.
> 
> 	Ingo


hi,

indeed both proposals seem to be addressing a similar core issue - being
able to dynamically (as opposed to re-compiling) change the amount of
verbosity that the kernel spews. I would liken it to adding a -verbose
flag to the kernel.

Beyond that the 2 approaches differ in a number of ways as I see:

1)

Filtering Unit. 'Boot printk', or Yinghai's approach explicitly defines
filtering units via tags. 'dynamic debug' is implicitly based
around "KBUILD_MODNAME", not .c files, which seems to be a good unit for
most parts of the kernel. For full subsystems, it is not appropriate.
There, i have introduced the conecpt, of 'logical modname', which is very
roughly similar to the 'boot printk' tag concept. Basically, subsystems
could be grouped together using this 'logical modname'.

2)

kernel impact. Part of the design of 'dynamic debug' was to be very low
impact. in fact, when its disabled, we basically jump around the printk
with a test and a jump. So, there is only a 2 instruction overhead per
call-site. I believe (and please correct me if i'm wrong) that 'boot
printk' is filtering after printk has been called...So you have at least
the overhead of a fucntion call plus the overhead of the printk()
function.

3)

usefullness beyond just doing 'printk'. The basic building block of
dynamic debug is simply: 'dynamic_debug_enabled()'. So blocks of code are built
up as:

if (dynamic_debug_enabled()) {
        do debugging work
}

printk is then simply:

if (dynamic_debug_enabled()) {
        printk();
}

or:

define pr_debug()
        (dynamic_debug_enabled()) {
                printk();
        }

The intent here was to dynamically be able to turn 'printk' or other
debugging code dynamically off and on.


4)

ability to compile out the code. 'dynamic debug' has 3 modes of
compilation. If 'DEBUG' is set then then dynamic_debug_enabled() simply
is defined to 1. If 'DYNAMIC_DEBUG' is set dynamic_debug_enabled()
becomes the test and jump i desscribe in #2. If neither 'DEBUG' is set
nor 'DYNAMIC_DEBUG' then the code is compiled out (no impact). So to
enable 'dynamic debug' for the entire kernel, 'DYNAMIC_DEBUG' is
defined for all compilation units. Additionally subsystems, can define
there own: CONFIG_SUBSYSTEM_DEBUG, and CONFIG_SUBSYSTEM_DEBUG_DYNAMIC,
which sets either 'DEBUG' or 'DYNAMIC_DEBUG' for their particular
subsystem. I believe this approach provides a good level of flexibility.

5)

debug filtering. In my survey of subsystems, not only were levels used,
but also 'flags' ie a set of debug flags can be set for a particular
subsystem. In 'dynamic debug' this is implemented in
dynamic_debug_enabled() before printk is called. In 'boot printk' this
is implemented in printk() itself. 'dynamic printk' defines 3 types of
filtering: TYPE_BOOLEAN , TYPE_LEVEL, and TYPE_FLAG. Seems like 'boot
printk' at least at the moment has type level.

6)

compatibility with existing code. In 'dynamic debug' I tried to reduce
code churn as much as possible. Thus, pr_debug() and dev_dbg() calls
don't need to be changed at all. Further, subsystem specfic printing,
for example, subsystem_dprintk(), can be implemented in 'dynamic debug'
by simply just changing the definition of ubsystem_dprintk(). The callers
do not need to be modified.

7) 'robustness'. Dynamic debug does add extra kernel sections. But if
they are designed carefully I don't think they are very risky. Further,
'boot printk' also defines extra sections. So unless i'm missing
something i don't see how that makes 'boot printk' more or less robust.

thanks,

-Jason




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...)
  2008-09-17 18:28     ` Yinghai Lu
@ 2008-09-17 18:56       ` Marcin Slusarz
  0 siblings, 0 replies; 33+ messages in thread
From: Marcin Slusarz @ 2008-09-17 18:56 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wed, Sep 17, 2008 at 11:28:48AM -0700, Yinghai Lu wrote:
> On Wed, Sep 17, 2008 at 11:19 AM, Marcin Slusarz
> <marcin.slusarz@gmail.com> wrote:
> > On Wed, Sep 17, 2008 at 01:27:46AM -0700, Yinghai Lu wrote:
> >> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> >>
> >> ---
> >>  drivers/acpi/numa.c |    9 +++++++++
> >>  1 file changed, 9 insertions(+)
> >>
> >> Index: linux-2.6/drivers/acpi/numa.c
> >> ===================================================================
> >> --- linux-2.6.orig/drivers/acpi/numa.c
> >> +++ linux-2.6/drivers/acpi/numa.c
> >> @@ -150,6 +150,15 @@ static __init int slit_valid(struct acpi
> >>  {
> >>       int i, j;
> >>       int d = slit->locality_count;
> >> +     printk(KERN_DEBUG KERN_ACPI "ACPI: SLIT: nodes = %d\n", d);
> >> +     for (i = 0; i < d; i++) {
> >> +             printk(KERN_DEBUG KERN_ACPI "  ");
> >> +             for (j = 0; j < d; j++)  {
> >> +                     u8 val = slit->entry[d*i + j];
> >> +                     printk(KERN_CONT KERN_ACPI " %d", val);
> >> +             }
> >> +             printk(KERN_CONT KERN_ACPI "\n");
> >> +     }
> >
> > It will produce something like this:
> > <7><acpi>ACPI: SLIT: nodes = %d\n
> > <7><acpi>  <acpi> %d<acpi> %d<acpi> %d<acpi> %d<acpi>\n
> >
> > bit wrong... ;)
> 
> did you check v6...?

No, I didn't test it.
Sorry for the noise.

Marcin

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-17 18:46     ` Jason Baron
@ 2008-09-17 19:25       ` H. Peter Anvin
  2008-09-18 10:57         ` Ingo Molnar
  0 siblings, 1 reply; 33+ messages in thread
From: H. Peter Anvin @ 2008-09-17 19:25 UTC (permalink / raw)
  To: Jason Baron
  Cc: Ingo Molnar, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel

Jason Baron wrote:
> 
> hi,
> 
> indeed both proposals seem to be addressing a similar core issue - being
> able to dynamically (as opposed to re-compiling) change the amount of
> verbosity that the kernel spews. I would liken it to adding a -verbose
> flag to the kernel.
> 
> Beyond that the 2 approaches differ in a number of ways as I see:
> 

8) The ability to accessed filtered messages a posteori (via dmesg), 
which is something we currently take for granted.

This *is* the fundamental difference between what Yinghai has now and 
both your stuff and Yinghai's original proposal.  Not producing the 
additional messages at all is inherently cheaper, sometimes *much* 
cheaper, but it obviously means the information is not accessible at all.

At the moment, I would argue that the fact that dmesg is, in effect, 
more verbose than the kernel itself is a good thing; it makes dmesg 
dumps more useful.

	-hpa

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17  8:27 ` [PATCH 3/6] pci: using printk(KERN_PCI v3 Yinghai Lu
  2008-09-17  8:35   ` Ingo Molnar
@ 2008-09-17 22:28   ` Bjorn Helgaas
  2008-09-17 23:03     ` Yinghai Lu
  1 sibling, 1 reply; 33+ messages in thread
From: Bjorn Helgaas @ 2008-09-17 22:28 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wednesday 17 September 2008 02:27:44 am Yinghai Lu wrote:
> v2: use printk(KERN_DEBUG KERN_PCI ...
> v3: fix checkpatch error and warning
> 
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> 
> ---
>  drivers/pci/probe.c |   28 +++++++++++++++++-----------
>  1 file changed, 17 insertions(+), 11 deletions(-)
> 
> Index: linux-2.6/drivers/pci/probe.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/probe.c
> +++ linux-2.6/drivers/pci/probe.c
> @@ -304,7 +304,8 @@ static int __pci_read_base(struct pci_de
>  		} else {
>  			res->start = l64;
>  			res->end = l64 + sz64;
> -			printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
> +			printk(KERN_DEBUG KERN_PCI
> +				 "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>  				 pci_name(dev), pos, res->start, res->end);

I really don't understand the point of this series.  I think
the user experience is too confusing.

But if you're going to change printks like the one above,
please at least make it use dev_printk() like most of the
rest of the PCI core.


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17 22:28   ` Bjorn Helgaas
@ 2008-09-17 23:03     ` Yinghai Lu
  0 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17 23:03 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton,
	linux-kernel

On Wed, Sep 17, 2008 at 3:28 PM, Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
> On Wednesday 17 September 2008 02:27:44 am Yinghai Lu wrote:
>> v2: use printk(KERN_DEBUG KERN_PCI ...
>> v3: fix checkpatch error and warning
>>
>> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>>
>> ---
>>  drivers/pci/probe.c |   28 +++++++++++++++++-----------
>>  1 file changed, 17 insertions(+), 11 deletions(-)
>>
>> Index: linux-2.6/drivers/pci/probe.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/pci/probe.c
>> +++ linux-2.6/drivers/pci/probe.c
>> @@ -304,7 +304,8 @@ static int __pci_read_base(struct pci_de
>>               } else {
>>                       res->start = l64;
>>                       res->end = l64 + sz64;
>> -                     printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>> +                     printk(KERN_DEBUG KERN_PCI
>> +                              "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
>>                                pci_name(dev), pos, res->start, res->end);
>
> I really don't understand the point of this series.  I think
> the user experience is too confusing.
>
> But if you're going to change printks like the one above,
> please at least make it use dev_printk() like most of the
> rest of the PCI core.

will look at dev_printk...

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-17 19:25       ` H. Peter Anvin
@ 2008-09-18 10:57         ` Ingo Molnar
  2008-09-18 15:36           ` H. Peter Anvin
  0 siblings, 1 reply; 33+ messages in thread
From: Ingo Molnar @ 2008-09-18 10:57 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Jason Baron, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel


* H. Peter Anvin <hpa@zytor.com> wrote:

> 8) The ability to accessed filtered messages a posteori (via dmesg), 
> which is something we currently take for granted.
>
> This *is* the fundamental difference between what Yinghai has now and 
> both your stuff and Yinghai's original proposal.  Not producing the 
> additional messages at all is inherently cheaper, sometimes *much* 
> cheaper, but it obviously means the information is not accessible at 
> all.

which is what we really want. If a bootup fails, the user has to repeat 
the bootup at least once with a verbosity level increased and with 
(hopefully) some sort of log capture facility attached.

So the point would be, if the user specified loglevel=all, we would get 
really comprehensive, one-stop-shop output.

> At the moment, I would argue that the fact that dmesg is, in effect, 
> more verbose than the kernel itself is a good thing; it makes dmesg 
> dumps more useful.

yes - but log messages not showing up on the physical console is already 
a task that is solved via regular loglevels. printks are being removed 
because even printing to the dmesg can be expensive (vsprintf is not the 
cheapest of functions, and most of dmesg shows up in the syslog and 
people want a clear, default, not too verbose output for that).

so the main feature of these patches is that we can cut out too verbose 
information by default, and we can reactivate it with a single central 
switch (and a repeated bootup - which has to be done anyway). Everything 
else is already solved via either traditional loglevels or pr_debug() 
based, build-time facilities.

	Ingo

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-18 10:57         ` Ingo Molnar
@ 2008-09-18 15:36           ` H. Peter Anvin
  2008-09-18 15:50             ` Jason Baron
  0 siblings, 1 reply; 33+ messages in thread
From: H. Peter Anvin @ 2008-09-18 15:36 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jason Baron, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel

Ingo Molnar wrote:
> 
> which is what we really want. If a bootup fails, the user has to repeat 
> the bootup at least once with a verbosity level increased and with 
> (hopefully) some sort of log capture facility attached.
> 
> So the point would be, if the user specified loglevel=all, we would get 
> really comprehensive, one-stop-shop output.
> 

That is true if the bootup fails, but it's fairly common that we get the 
machine up (at least to the point when we can dmesg), but the user wants 
to report a problem.  For that case, it's very nice if the dmesg log 
contains as much information as possible.

So I don't think it's clear that pre-filtering is what we want, at all.

	-hpa


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-18 15:36           ` H. Peter Anvin
@ 2008-09-18 15:50             ` Jason Baron
  2008-09-18 15:57               ` H. Peter Anvin
  0 siblings, 1 reply; 33+ messages in thread
From: Jason Baron @ 2008-09-18 15:50 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel

On Thu, Sep 18, 2008 at 08:36:43AM -0700, H. Peter Anvin wrote:
> Ingo Molnar wrote:
>>
>> which is what we really want. If a bootup fails, the user has to repeat 
>> the bootup at least once with a verbosity level increased and with  
>> (hopefully) some sort of log capture facility attached.
>>
>> So the point would be, if the user specified loglevel=all, we would get 
>> really comprehensive, one-stop-shop output.
>>
>
> That is true if the bootup fails, but it's fairly common that we get the  
> machine up (at least to the point when we can dmesg), but the user wants  
> to report a problem.  For that case, it's very nice if the dmesg log  
> contains as much information as possible.
>
> So I don't think it's clear that pre-filtering is what we want, at all.
>
> 	-hpa
>

hi,

if we take this argument to its extreme, then we end up spending all of
our time verifying that the kernel is working correctly and no time
actually doing work. I think 'printk_ratelimit' captures this. Thus, the line 
has to be drawn somewhere. If you want the messages in 'dmesg' use,
printk(KERN_DEBUG), and 'grep'. For the rest, I propose pre-filtering, which is
what 'dynamic debug' uses.

thanks,

-Jason

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-18 15:50             ` Jason Baron
@ 2008-09-18 15:57               ` H. Peter Anvin
  2008-09-18 16:19                 ` Jason Baron
  0 siblings, 1 reply; 33+ messages in thread
From: H. Peter Anvin @ 2008-09-18 15:57 UTC (permalink / raw)
  To: Jason Baron
  Cc: Ingo Molnar, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel

Jason Baron wrote:
> 
> if we take this argument to its extreme, then we end up spending all of
> our time verifying that the kernel is working correctly and no time
> actually doing work. I think 'printk_ratelimit' captures this. Thus, the line 
> has to be drawn somewhere. If you want the messages in 'dmesg' use,
> printk(KERN_DEBUG), and 'grep'. For the rest, I propose pre-filtering, which is
> what 'dynamic debug' uses.
> 

Taking any argument to its extreme and you come up with something 
ridiculous.

One could equally argue that if you have so many debugging messages that 
you have to prefilter for performance, you're so bloating your kernel 
that you need to stop.

I find it highly questionable that it makes sense to put even skipped 
messages into hot paths in the production kernel.  Skipped prints are 
NOT free, even if they are lot cheaper than actually rendering the string.

	-hpa

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-18 15:57               ` H. Peter Anvin
@ 2008-09-18 16:19                 ` Jason Baron
  2008-09-18 18:39                   ` H. Peter Anvin
  0 siblings, 1 reply; 33+ messages in thread
From: Jason Baron @ 2008-09-18 16:19 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel

On Thu, Sep 18, 2008 at 08:57:50AM -0700, H. Peter Anvin wrote:
> Jason Baron wrote:
>>
>> if we take this argument to its extreme, then we end up spending all of
>> our time verifying that the kernel is working correctly and no time
>> actually doing work. I think 'printk_ratelimit' captures this. Thus, 
>> the line has to be drawn somewhere. If you want the messages in 'dmesg' 
>> use,
>> printk(KERN_DEBUG), and 'grep'. For the rest, I propose pre-filtering, which is
>> what 'dynamic debug' uses.
>>
>
> Taking any argument to its extreme and you come up with something  
> ridiculous.
>
> One could equally argue that if you have so many debugging messages that  
> you have to prefilter for performance, you're so bloating your kernel  
> that you need to stop.

in my testing there was no significant difference between pre-filtering
vs. not built in. However, there was a measureable affect of having them
built in vs. not built in.

>
> I find it highly questionable that it makes sense to put even skipped  
> messages into hot paths in the production kernel.  Skipped prints are  
> NOT free, even if they are lot cheaper than actually rendering the 
> string.
>

If you feel that way, you simply don't have to turn the single CONFIG_ on.
Futher, the patchset allows fine-grained control over the modules that
you would want to enable/disable.

thanks,

-Jason


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-18 16:19                 ` Jason Baron
@ 2008-09-18 18:39                   ` H. Peter Anvin
  2008-09-18 19:06                     ` Yinghai Lu
  0 siblings, 1 reply; 33+ messages in thread
From: H. Peter Anvin @ 2008-09-18 18:39 UTC (permalink / raw)
  To: Jason Baron
  Cc: Ingo Molnar, Andrew Morton, Yinghai Lu, Thomas Gleixner, linux-kernel

Jason Baron wrote:
> 
> in my testing there was no significant difference between pre-filtering
> vs. not built in. However, there was a measureable affect of having them
> built in vs. not built in.
> 

<somewhat irrelevant rant>

Okay, I'm so bloody sick of hearing people justifying bloat by saying 
"no measurable difference."  That only means that you don't have GROSS 
bloat.  Unless you have real statistics to the contrary, most people's 
performance testing is at the very best accurate to 5-10%.  This is 
hardly "no bloat".

</somewhat irrelevant rant>

	-hpa

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6
  2008-09-18 18:39                   ` H. Peter Anvin
@ 2008-09-18 19:06                     ` Yinghai Lu
  0 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-18 19:06 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Jason Baron, Ingo Molnar, Andrew Morton, Thomas Gleixner, linux-kernel

On Thu, Sep 18, 2008 at 11:39 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> Jason Baron wrote:
>>
>> in my testing there was no significant difference between pre-filtering
>> vs. not built in. However, there was a measureable affect of having them
>> built in vs. not built in.
>>
>
> <somewhat irrelevant rant>
>
> Okay, I'm so bloody sick of hearing people justifying bloat by saying "no
> measurable difference."  That only means that you don't have GROSS bloat.
>  Unless you have real statistics to the contrary, most people's performance
> testing is at the very best accurate to 5-10%.  This is hardly "no bloat".
>
> </somewhat irrelevant rant>

about performance difference:
1. will have printk(KERN_level KERN_tag "...\n");
2. will have tag_printk like
    #define dev_printk(level, dev, format, arg...)  \
           printk(level KERN_DEV "%s %s: " format , dev_driver_string(dev) , \
                   dev_name(dev) , ## arg)
3. still can use MACRO for compiling time
    #ifdef DEBUG
    #define dev_dbg(dev, format, arg...)            \
           dev_printk(KERN_DEBUG , dev , format , ## arg)
    #else
    #define dev_dbg(dev, format, arg...)            \
           ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
    #endif
4. with /proc/sys/kernel/printk_tag/dev could modify run-time level.
5. for big chunk dump or spew, caller could use
       level = get_tag_level(KERN_DEV, &len) and compare level to
KERN_SPEW_LEVEL or etc
   to decide if need to dump it.
6. other overhead to put tag like <dev> should be ok just like
loglevel aready in the buffer

current only have one struct  {
   char *tag;
   char *name;  /* with extra : */
   int level;
}
the level is some kind of console_loglevel for that tag.

if want to go further, let every dev_printk check that. then will not
have them in log buffer

YH

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH 3/6] pci: using printk(KERN_PCI v3
  2008-09-17  7:10 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v5 Yinghai Lu
@ 2008-09-17  7:10 ` Yinghai Lu
  0 siblings, 0 replies; 33+ messages in thread
From: Yinghai Lu @ 2008-09-17  7:10 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
  Cc: linux-kernel, Yinghai Lu

v2: use printk(KERN_DEBUG KERN_PCI ...
v3: fix checkpatch error and warning

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 drivers/pci/probe.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Index: linux-2.6/drivers/pci/probe.c
===================================================================
--- linux-2.6.orig/drivers/pci/probe.c
+++ linux-2.6/drivers/pci/probe.c
@@ -304,7 +304,8 @@ static int __pci_read_base(struct pci_de
 		} else {
 			res->start = l64;
 			res->end = l64 + sz64;
-			printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
+			printk(KERN_DEBUG KERN_PCI
+				 "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
 				 pci_name(dev), pos, res->start, res->end);
 		}
 	} else {
@@ -315,9 +316,10 @@ static int __pci_read_base(struct pci_de
 
 		res->start = l;
 		res->end = l + sz;
-		printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev),
-			 pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio",
-			 res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI "PCI: %s reg %x %s: [%llx, %llx]\n",
+			pci_name(dev), pos,
+			(res->flags & IORESOURCE_IO) ? "io port" : "32bit mmio",
+			res->start, res->end);
 	}
 
  out:
@@ -388,8 +390,9 @@ void __devinit pci_read_bridge_bases(str
 			res->start = base;
 		if (!res->end)
 			res->end = limit + 0xfff;
-		printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n",
-				 pci_name(dev), res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI
+			 "PCI: bridge %s io port: [%llx, %llx]\n",
+			 pci_name(dev), res->start, res->end);
 	}
 
 	res = child->resource[1];
@@ -401,8 +404,9 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
 		res->start = base;
 		res->end = limit + 0xfffff;
-		printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n",
-				 pci_name(dev), res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI
+			 "PCI: bridge %s 32bit mmio: [%llx, %llx]\n",
+			 pci_name(dev), res->start, res->end);
 	}
 
 	res = child->resource[2];
@@ -438,9 +442,11 @@ void __devinit pci_read_bridge_bases(str
 		res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
 		res->start = base;
 		res->end = limit + 0xfffff;
-		printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n",
-				 pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",
-				 res->start, res->end);
+		printk(KERN_DEBUG KERN_PCI
+			 "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n",
+			 pci_name(dev),
+			 (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32",
+			 res->start, res->end);
 	}
 }
 

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2008-09-18 19:06 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-17  8:27 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Yinghai Lu
2008-09-17  8:27 ` [PATCH 1/6] add DEFINE_LOGLEVEL_SETUP v7 Yinghai Lu
2008-09-17  8:27 ` [PATCH 2/6] pci: add KERN_PCI Yinghai Lu
2008-09-17  8:27 ` [PATCH 3/6] pci: using printk(KERN_PCI v3 Yinghai Lu
2008-09-17  8:35   ` Ingo Molnar
2008-09-17  8:41     ` Yinghai Lu
2008-09-17 10:11       ` Robert Richter
2008-09-17 16:25         ` Yinghai Lu
2008-09-17 22:28   ` Bjorn Helgaas
2008-09-17 23:03     ` Yinghai Lu
2008-09-17  8:27 ` [PATCH 4/6] acpi: add KERN_ACPI v3 Yinghai Lu
2008-09-17  8:27 ` [PATCH 5/6] apci: dump slit with printk(KERN_ACPI...) Yinghai Lu
2008-09-17 18:19   ` Marcin Slusarz
2008-09-17 18:28     ` Yinghai Lu
2008-09-17 18:56       ` Marcin Slusarz
2008-09-17  8:27 ` [PATCH 6/6] x86: add KERN_APIC Yinghai Lu
2008-09-17  8:38   ` Ingo Molnar
2008-09-17  8:45     ` Yinghai Lu
2008-09-17  8:52       ` Ingo Molnar
2008-09-17 12:08       ` Frans Pop
2008-09-17 16:30         ` Yinghai Lu
2008-09-17  8:55 ` [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v6 Andrew Morton
2008-09-17  9:27   ` Ingo Molnar
2008-09-17 18:46     ` Jason Baron
2008-09-17 19:25       ` H. Peter Anvin
2008-09-18 10:57         ` Ingo Molnar
2008-09-18 15:36           ` H. Peter Anvin
2008-09-18 15:50             ` Jason Baron
2008-09-18 15:57               ` H. Peter Anvin
2008-09-18 16:19                 ` Jason Baron
2008-09-18 18:39                   ` H. Peter Anvin
2008-09-18 19:06                     ` Yinghai Lu
  -- strict thread matches above, loose matches on Subject: below --
2008-09-17  7:10 [PATCH 0/6] loglevel=pci:8,acpi:8,apic=8 support v5 Yinghai Lu
2008-09-17  7:10 ` [PATCH 3/6] pci: using printk(KERN_PCI v3 Yinghai Lu

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).