* [PATCH] x86: don't map io_apic two times.
@ 2009-05-20 5:23 Yinghai Lu
2009-05-20 7:45 ` [PATCH] x86: don't allocate dummy page for wrong madt/mptable Yinghai Lu
2009-05-20 7:58 ` [PATCH] x86: don't map io_apic two times Ingo Molnar
0 siblings, 2 replies; 5+ messages in thread
From: Yinghai Lu @ 2009-05-20 5:23 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org
mp_register_ioapic() already map it.
[ Impact: don't map io apic address again ]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -4162,7 +4162,12 @@ fake_ioapic_page:
alloc_bootmem_pages(PAGE_SIZE);
ioapic_phys = __pa(ioapic_phys);
}
- set_fixmap_nocache(idx, ioapic_phys);
+ /*
+ * when acpi ioapic is used, mp_register_ioapic() map
+ * ioapic_phys already
+ */
+ if (!acpi_ioapic)
+ set_fixmap_nocache(idx, ioapic_phys);
apic_printk(APIC_VERBOSE,
"mapped IOAPIC to %08lx (%08lx)\n",
__fix_to_virt(idx), ioapic_phys);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] x86: don't allocate dummy page for wrong madt/mptable
2009-05-20 5:23 [PATCH] x86: don't map io_apic two times Yinghai Lu
@ 2009-05-20 7:45 ` Yinghai Lu
2009-05-20 18:34 ` [PATCH, v2] " Yinghai Lu
2009-05-20 7:58 ` [PATCH] x86: don't map io_apic two times Ingo Molnar
1 sibling, 1 reply; 5+ messages in thread
From: Yinghai Lu @ 2009-05-20 7:45 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
in io_apic_init_mapping, if nr_ioapics > 0, we don't need to check
smp_found_config further.
also don't need to allocate dummy pages if we got wrong mptable/madt.
like bad ioapic address. because skip_ioapic_setup already guard that
later.
[ Impact: save 4k when bad mptable/madt or skip_ioapic_setup ]
Sign-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 48 +++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 23 deletions(-)
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -1887,7 +1887,9 @@ __apicdebuginit(int) print_all_ICs(void)
return 0;
print_all_local_APICs();
- print_IO_APIC();
+
+ if (!skip_ioapic_setup && nr_ioapics)
+ print_IO_APIC();
return 0;
}
@@ -3828,6 +3830,9 @@ void __init probe_nr_irqs_gsi(void)
{
int nr = 0;
+ if (skip_ioapic_setup)
+ return;
+
nr = acpi_probe_gsi();
if (nr > nr_irqs_gsi) {
nr_irqs_gsi = nr;
@@ -4139,29 +4144,26 @@ void __init ioapic_init_mappings(void)
struct resource *ioapic_res;
int i;
- ioapic_res = ioapic_setup_resources();
+ if (nr_ioapics < 1 || skip_ioapic_setup)
+ return;
+
for (i = 0; i < nr_ioapics; i++) {
- if (smp_found_config) {
- ioapic_phys = mp_ioapics[i].apicaddr;
-#ifdef CONFIG_X86_32
- if (!ioapic_phys) {
- printk(KERN_ERR
- "WARNING: bogus zero IO-APIC "
- "address found in MPTABLE, "
- "disabling IO/APIC support!\n");
- smp_found_config = 0;
- skip_ioapic_setup = 1;
- goto fake_ioapic_page;
- }
-#endif
- } else {
-#ifdef CONFIG_X86_32
-fake_ioapic_page:
-#endif
- ioapic_phys = (unsigned long)
- alloc_bootmem_pages(PAGE_SIZE);
- ioapic_phys = __pa(ioapic_phys);
+ ioapic_phys = mp_ioapics[i].apicaddr;
+ if (!ioapic_phys) {
+ printk(KERN_ERR
+ "WARNING: bogus zero IO-APIC "
+ "address found in MPTABLE or MADT, "
+ "disabling IO/APIC support!\n");
+ smp_found_config = 0;
+ skip_ioapic_setup = 1;
+ return;
}
+ }
+
+ ioapic_res = ioapic_setup_resources();
+ for (i = 0; i < nr_ioapics; i++) {
+ ioapic_phys = mp_ioapics[i].apicaddr;
+
/*
* when acpi ioapic is used, mp_register_ioapic() map
* ioapic_phys already
@@ -4187,7 +4189,7 @@ static int __init ioapic_insert_resource
struct resource *r = ioapic_resources;
if (!r) {
- if (nr_ioapics > 0) {
+ if (nr_ioapics > 0 && !skip_ioapic_setup) {
printk(KERN_ERR
"IO APIC resources couldn't be allocated.\n");
return -1;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: don't map io_apic two times.
2009-05-20 5:23 [PATCH] x86: don't map io_apic two times Yinghai Lu
2009-05-20 7:45 ` [PATCH] x86: don't allocate dummy page for wrong madt/mptable Yinghai Lu
@ 2009-05-20 7:58 ` Ingo Molnar
2009-05-20 8:03 ` Yinghai Lu
1 sibling, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-05-20 7:58 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel@vger.kernel.org
* Yinghai Lu <yinghai@kernel.org> wrote:
> mp_register_ioapic() already map it.
>
> [ Impact: don't map io apic address again ]
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/kernel/apic/io_apic.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
> +++ linux-2.6/arch/x86/kernel/apic/io_apic.c
> @@ -4162,7 +4162,12 @@ fake_ioapic_page:
> alloc_bootmem_pages(PAGE_SIZE);
> ioapic_phys = __pa(ioapic_phys);
> }
> - set_fixmap_nocache(idx, ioapic_phys);
> + /*
> + * when acpi ioapic is used, mp_register_ioapic() map
> + * ioapic_phys already
> + */
> + if (!acpi_ioapic)
> + set_fixmap_nocache(idx, ioapic_phys);
The change is correct, but i'm not sure we want to do this - the
acpi_ioapic flag might change its meaning (and then break this code
subtly) and this is bootup code so doing the mapping twice should be
no issue.
If it were some expensive initialization i'd agree, but here it's
really just a couple of instructions and an INVLPG.
Hm?
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: don't map io_apic two times.
2009-05-20 7:58 ` [PATCH] x86: don't map io_apic two times Ingo Molnar
@ 2009-05-20 8:03 ` Yinghai Lu
0 siblings, 0 replies; 5+ messages in thread
From: Yinghai Lu @ 2009-05-20 8:03 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel@vger.kernel.org
On Wed, May 20, 2009 at 12:58 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yinghai@kernel.org> wrote:
>
>> mp_register_ioapic() already map it.
>>
>> [ Impact: don't map io apic address again ]
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>
>> ---
>> arch/x86/kernel/apic/io_apic.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
>> +++ linux-2.6/arch/x86/kernel/apic/io_apic.c
>> @@ -4162,7 +4162,12 @@ fake_ioapic_page:
>> alloc_bootmem_pages(PAGE_SIZE);
>> ioapic_phys = __pa(ioapic_phys);
>> }
>> - set_fixmap_nocache(idx, ioapic_phys);
>> + /*
>> + * when acpi ioapic is used, mp_register_ioapic() map
>> + * ioapic_phys already
>> + */
>> + if (!acpi_ioapic)
>> + set_fixmap_nocache(idx, ioapic_phys);
>
> The change is correct, but i'm not sure we want to do this - the
> acpi_ioapic flag might change its meaning (and then break this code
> subtly) and this is bootup code so doing the mapping twice should be
> no issue.
>
> If it were some expensive initialization i'd agree, but here it's
> really just a couple of instructions and an INVLPG.
>
> Hm?
ok, please drop it.
YH
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH, v2] x86: don't allocate dummy page for wrong madt/mptable
2009-05-20 7:45 ` [PATCH] x86: don't allocate dummy page for wrong madt/mptable Yinghai Lu
@ 2009-05-20 18:34 ` Yinghai Lu
0 siblings, 0 replies; 5+ messages in thread
From: Yinghai Lu @ 2009-05-20 18:34 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton
Cc: linux-kernel@vger.kernel.org
in io_apic_init_mapping, if nr_ioapics > 0, we don't need to check
smp_found_config further.
also don't need to allocate dummy pages if we got wrong mptable/madt.
like bad ioapic address. because skip_ioapic_setup already guard that
later.
[ Impact: save 4k when bad mptable/madt or skip_ioapic_setup ]
Sign-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/kernel/apic/io_apic.c | 48 +++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 23 deletions(-)
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -1887,7 +1887,9 @@ __apicdebuginit(int) print_all_ICs(void)
return 0;
print_all_local_APICs();
- print_IO_APIC();
+
+ if (!skip_ioapic_setup && nr_ioapics)
+ print_IO_APIC();
return 0;
}
@@ -3828,6 +3830,9 @@ void __init probe_nr_irqs_gsi(void)
{
int nr = 0;
+ if (skip_ioapic_setup)
+ return;
+
nr = acpi_probe_gsi();
if (nr > nr_irqs_gsi) {
nr_irqs_gsi = nr;
@@ -4139,29 +4144,26 @@ void __init ioapic_init_mappings(void)
struct resource *ioapic_res;
int i;
- ioapic_res = ioapic_setup_resources();
+ if (nr_ioapics < 1 || skip_ioapic_setup)
+ return;
+
for (i = 0; i < nr_ioapics; i++) {
- if (smp_found_config) {
- ioapic_phys = mp_ioapics[i].apicaddr;
-#ifdef CONFIG_X86_32
- if (!ioapic_phys) {
- printk(KERN_ERR
- "WARNING: bogus zero IO-APIC "
- "address found in MPTABLE, "
- "disabling IO/APIC support!\n");
- smp_found_config = 0;
- skip_ioapic_setup = 1;
- goto fake_ioapic_page;
- }
-#endif
- } else {
-#ifdef CONFIG_X86_32
-fake_ioapic_page:
-#endif
- ioapic_phys = (unsigned long)
- alloc_bootmem_pages(PAGE_SIZE);
- ioapic_phys = __pa(ioapic_phys);
+ ioapic_phys = mp_ioapics[i].apicaddr;
+ if (!ioapic_phys) {
+ printk(KERN_ERR
+ "WARNING: bogus zero IO-APIC "
+ "address found in MPTABLE or MADT, "
+ "disabling IO/APIC support!\n");
+ smp_found_config = 0;
+ skip_ioapic_setup = 1;
+ return;
}
+ }
+
+ ioapic_res = ioapic_setup_resources();
+ for (i = 0; i < nr_ioapics; i++) {
+ ioapic_phys = mp_ioapics[i].apicaddr;
+
set_fixmap_nocache(idx, ioapic_phys);
apic_printk(APIC_VERBOSE,
"mapped IOAPIC to %08lx (%08lx)\n",
@@ -4182,7 +4184,7 @@ static int __init ioapic_insert_resource
struct resource *r = ioapic_resources;
if (!r) {
- if (nr_ioapics > 0) {
+ if (nr_ioapics > 0 && !skip_ioapic_setup) {
printk(KERN_ERR
"IO APIC resources couldn't be allocated.\n");
return -1;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-20 18:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-20 5:23 [PATCH] x86: don't map io_apic two times Yinghai Lu
2009-05-20 7:45 ` [PATCH] x86: don't allocate dummy page for wrong madt/mptable Yinghai Lu
2009-05-20 18:34 ` [PATCH, v2] " Yinghai Lu
2009-05-20 7:58 ` [PATCH] x86: don't map io_apic two times Ingo Molnar
2009-05-20 8:03 ` 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).