Commit 2626eb2b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar

x86, apic: Limit apic dumping, introduce new show_lapic= setup option

In case if a system has a large number of cpus printing apics
contents may consume a long time period.

We limit such an output by 1 apic by default. But to have an
ability to see all apics or some part of them we introduce
"show_lapic" setup option which allow us to limit/unlimit the
number of APICs being dumped.

Example: apic=debug show_lapic=5, or apic=debug show_lapic=all

Also move apic_verbosity checking upper that way so helper routines
do not need to inspect it at all.
Suggested-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Cc: yinghai@kernel.org
Cc: macro@linux-mips.org
LKML-Reference: <20091013201022.926793122@openvz.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a933c618
...@@ -1599,9 +1599,6 @@ __apicdebuginit(void) print_IO_APIC(void) ...@@ -1599,9 +1599,6 @@ __apicdebuginit(void) print_IO_APIC(void)
struct irq_desc *desc; struct irq_desc *desc;
unsigned int irq; unsigned int irq;
if (apic_verbosity == APIC_QUIET)
return;
printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
for (i = 0; i < nr_ioapics; i++) for (i = 0; i < nr_ioapics; i++)
printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
...@@ -1708,9 +1705,6 @@ __apicdebuginit(void) print_APIC_field(int base) ...@@ -1708,9 +1705,6 @@ __apicdebuginit(void) print_APIC_field(int base)
{ {
int i; int i;
if (apic_verbosity == APIC_QUIET)
return;
printk(KERN_DEBUG); printk(KERN_DEBUG);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
...@@ -1724,9 +1718,6 @@ __apicdebuginit(void) print_local_APIC(void *dummy) ...@@ -1724,9 +1718,6 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
unsigned int i, v, ver, maxlvt; unsigned int i, v, ver, maxlvt;
u64 icr; u64 icr;
if (apic_verbosity == APIC_QUIET)
return;
printk(KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", printk(KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
smp_processor_id(), hard_smp_processor_id()); smp_processor_id(), hard_smp_processor_id());
v = apic_read(APIC_ID); v = apic_read(APIC_ID);
...@@ -1824,13 +1815,19 @@ __apicdebuginit(void) print_local_APIC(void *dummy) ...@@ -1824,13 +1815,19 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
printk("\n"); printk("\n");
} }
__apicdebuginit(void) print_all_local_APICs(void) __apicdebuginit(void) print_local_APICs(int maxcpu)
{ {
int cpu; int cpu;
if (!maxcpu)
return;
preempt_disable(); preempt_disable();
for_each_online_cpu(cpu) for_each_online_cpu(cpu) {
if (cpu >= maxcpu)
break;
smp_call_function_single(cpu, print_local_APIC, NULL, 1); smp_call_function_single(cpu, print_local_APIC, NULL, 1);
}
preempt_enable(); preempt_enable();
} }
...@@ -1839,7 +1836,7 @@ __apicdebuginit(void) print_PIC(void) ...@@ -1839,7 +1836,7 @@ __apicdebuginit(void) print_PIC(void)
unsigned int v; unsigned int v;
unsigned long flags; unsigned long flags;
if (apic_verbosity == APIC_QUIET || !nr_legacy_irqs) if (!nr_legacy_irqs)
return; return;
printk(KERN_DEBUG "\nprinting PIC contents\n"); printk(KERN_DEBUG "\nprinting PIC contents\n");
...@@ -1866,21 +1863,41 @@ __apicdebuginit(void) print_PIC(void) ...@@ -1866,21 +1863,41 @@ __apicdebuginit(void) print_PIC(void)
printk(KERN_DEBUG "... PIC ELCR: %04x\n", v); printk(KERN_DEBUG "... PIC ELCR: %04x\n", v);
} }
__apicdebuginit(int) print_all_ICs(void) static int __initdata show_lapic = 1;
static __init int setup_show_lapic(char *arg)
{
int num = -1;
if (strcmp(arg, "all") == 0) {
show_lapic = CONFIG_NR_CPUS;
} else {
get_option(&arg, &num);
if (num >= 0)
show_lapic = num;
}
return 1;
}
__setup("show_lapic=", setup_show_lapic);
__apicdebuginit(int) print_ICs(void)
{ {
if (apic_verbosity == APIC_QUIET)
return 0;
print_PIC(); print_PIC();
/* don't print out if apic is not there */ /* don't print out if apic is not there */
if (!cpu_has_apic && !apic_from_smp_config()) if (!cpu_has_apic && !apic_from_smp_config())
return 0; return 0;
print_all_local_APICs(); print_local_APICs(show_lapic);
print_IO_APIC(); print_IO_APIC();
return 0; return 0;
} }
fs_initcall(print_all_ICs); fs_initcall(print_ICs);
/* Where if anywhere is the i8259 connect in external int mode */ /* Where if anywhere is the i8259 connect in external int mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment