public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
@ 2007-12-30  3:52 Yinghai Lu
  2007-12-30 14:51 ` Ingo Molnar
  0 siblings, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-30  3:52 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Andi Kleen, Andrew Morton; +Cc: LKML

please check if you can replace the one in the x86-mm

http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76

the updated one avoid one link warning.

YH

[PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2

some apic id lifting system: 4 socket quad core, 8 socket quad core will do apic id lifting for BSP.

but io-apic regs for ExtINT still use 0 as dest.

so when we enable apic error vector in BSP, we will get one APIC error.

CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 512K (64 bytes/line)
CPU 0/4 -> Node 0
CPU: Physical Processor ID: 1
CPU: Processor Core ID: 0
SMP alternatives: switching to UP code
ACPI: Core revision 20070126
enabled ExtINT on CPU#0
ESR value after enabling vector: 00000000, after 0000000c
APIC error on CPU0: 0c(08)
ENABLING IO-APIC IRQs
Synchronizing Arb IDs.

So move enable_IO_APIC from setup_IO_APIC into setup_local_APIC and call it
before enabling apic error vector.

this is the updated verison that take enable_IO_APIC as extra call for
setup_local_APIC to avoid linking warning.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/arch/x86/kernel/apic_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic_64.c
+++ linux-2.6/arch/x86/kernel/apic_64.c
@@ -418,7 +418,7 @@ void __init init_bsp_APIC(void)
 	apic_write(APIC_LVT1, value);
 }
 
-void __cpuinit setup_local_APIC (void)
+void __cpuinit setup_local_APIC (void (*extra_call)(void))
 {
 	unsigned int value, maxlvt;
 	int i, j;
@@ -517,6 +517,13 @@ void __cpuinit setup_local_APIC (void)
 		value = APIC_DM_NMI | APIC_LVT_MASKED;
 	apic_write(APIC_LVT1, value);
 
+	/*
+	 * Now enable IO-APICs, actually call clear_IO_APIC
+	 * We need clear_IO_APIC before enabling vector on BP
+	 */
+	if (extra_call)
+		(*extra_call)();
+
 	{
 		unsigned oldvalue;
 		maxlvt = get_maxlvt();
@@ -1198,6 +1205,8 @@ int disable_apic;
  */
 int __init APIC_init_uniprocessor (void)
 {
+	void (*extra_call)(void) = NULL;
+
 	if (disable_apic) {
 		printk(KERN_INFO "Apic disabled\n");
 		return -1;
@@ -1213,7 +1222,10 @@ int __init APIC_init_uniprocessor (void)
 	phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
 	apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id));
 
-	setup_local_APIC();
+	if (!skip_ioapic_setup && nr_ioapics)
+		extra_call = enable_IO_APIC;
+
+	setup_local_APIC(extra_call);
 
 	if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
 		setup_IO_APIC();
Index: linux-2.6/arch/x86/kernel/io_apic_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic_64.c
+++ linux-2.6/arch/x86/kernel/io_apic_64.c
@@ -1171,7 +1171,7 @@ void __apicdebuginit print_PIC(void)
 
 #endif  /*  0  */
 
-static void __init enable_IO_APIC(void)
+void __init enable_IO_APIC(void)
 {
 	union IO_APIC_reg_01 reg_01;
 	int i8259_apic, i8259_pin;
@@ -1790,7 +1790,10 @@ __setup("no_timer_check", notimercheck);
 
 void __init setup_IO_APIC(void)
 {
-	enable_IO_APIC();
+
+	/*
+	 * calling enable_IO_APIC() is moved to setup_local_APIC for BP
+	 */
 
 	if (acpi_ioapic)
 		io_apic_irqs = ~0;	/* all IRQs go through IOAPIC */
Index: linux-2.6/include/asm-x86/hw_irq_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/hw_irq_64.h
+++ linux-2.6/include/asm-x86/hw_irq_64.h
@@ -135,6 +135,7 @@ extern void init_8259A(int aeoi);
 extern void send_IPI_self(int vector);
 extern void init_VISWS_APIC_irqs(void);
 extern void setup_IO_APIC(void);
+extern void enable_IO_APIC(void);
 extern void disable_IO_APIC(void);
 extern void print_IO_APIC(void);
 extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
Index: linux-2.6/arch/x86/kernel/smpboot_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot_64.c
+++ linux-2.6/arch/x86/kernel/smpboot_64.c
@@ -211,7 +211,7 @@ void __cpuinit smp_callin(void)
 	 */
 
 	Dprintk("CALLIN, before setup_local_APIC().\n");
-	setup_local_APIC();
+	setup_local_APIC(NULL);
 
 	/*
 	 * Get our bogomips.
@@ -879,6 +879,8 @@ static void __init smp_cpu_index_default
  */
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
+	void (*extra_call)(void) = NULL;
+
 	nmi_watchdog_default();
 	smp_cpu_index_default();
 	current_cpu_data = boot_cpu_data;
@@ -896,7 +898,10 @@ void __init smp_prepare_cpus(unsigned in
 	/*
 	 * Switch from PIC to APIC mode.
 	 */
-	setup_local_APIC();
+        if (!skip_ioapic_setup && nr_ioapics)
+                extra_call = enable_IO_APIC;
+
+	setup_local_APIC(extra_call);
 
 	if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
 		panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
Index: linux-2.6/include/asm-x86/apic_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/apic_64.h
+++ linux-2.6/include/asm-x86/apic_64.h
@@ -74,7 +74,7 @@ extern int verify_local_APIC (void);
 extern void cache_APIC_registers (void);
 extern void sync_Arb_IDs (void);
 extern void init_bsp_APIC (void);
-extern void setup_local_APIC (void);
+extern void setup_local_APIC (void (*extra_call)(void));
 extern void init_apic_mappings (void);
 extern void smp_local_timer_interrupt (void);
 extern void setup_boot_APIC_clock (void);

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-30  3:52 [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2 Yinghai Lu
@ 2007-12-30 14:51 ` Ingo Molnar
  2007-12-30 20:48   ` Yinghai Lu
  2007-12-30 21:30   ` [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC Yinghai Lu
  0 siblings, 2 replies; 15+ messages in thread
From: Ingo Molnar @ 2007-12-30 14:51 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, Andi Kleen, Andrew Morton, LKML


* Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:

> please check if you can replace the one in the x86-mm
> 
> http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> 
> the updated one avoid one link warning.

please send delta patches instead - so that we can review the changes.

> this is the updated verison that take enable_IO_APIC as extra call for 
> setup_local_APIC to avoid linking warning.

hm, what link warning did you get? Perhaps the following __cpuinit:

> -void __cpuinit setup_local_APIC (void)

does not mix well with an __init call:

> +void __init enable_IO_APIC(void)

and you hack it around by using a function pointer. Nasty and still 
buggy. The proper solution would be to mark enable_IO_APIC as __cpuinit 
too (or something like that).

	Ingo

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-30 14:51 ` Ingo Molnar
@ 2007-12-30 20:48   ` Yinghai Lu
  2007-12-30 22:06     ` Adrian Bunk
  2007-12-30 21:30   ` [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC Yinghai Lu
  1 sibling, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-30 20:48 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
>
> > please check if you can replace the one in the x86-mm
> >
> > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> >
> > the updated one avoid one link warning.
>
> please send delta patches instead - so that we can review the changes.

will do that in another patch.

>
> > this is the updated verison that take enable_IO_APIC as extra call for
> > setup_local_APIC to avoid linking warning.
>
> hm, what link warning did you get? Perhaps the following __cpuinit:

WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
.init.text:enable_IO_APIC (between 'setup_local_APIC' and
'apic_is_clustered_box')

>
> > -void __cpuinit setup_local_APIC (void)
>
> does not mix well with an __init call:
>
> > +void __init enable_IO_APIC(void)
>
> and you hack it around by using a function pointer. Nasty and still
> buggy. The proper solution would be to mark enable_IO_APIC as __cpuinit
> too (or something like that).

after change that to __cpuinit, i got

WARNING: vmlinux.o(.text+0x17f84): Section mismatch: reference to
.init.text: (between 'enable_IO_APIC' and 'ioapic_resume')
WARNING: vmlinux.o(.text+0x17f92): Section mismatch: reference to
.init.text: (between 'enable_IO_APIC' and 'ioapic_resume')

YH

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

* Re: [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC
  2007-12-30 21:30   ` [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC Yinghai Lu
@ 2007-12-30 21:29     ` Ingo Molnar
  2007-12-30 21:53       ` Yinghai Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Ingo Molnar @ 2007-12-30 21:29 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Thomas Gleixner, Andi Kleen, Andrew Morton, LKML


* Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:

> [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC
> 
> clear IO_APIC before enabing apic error vector cause link warning
> 
> use function call in setup_local_APIC to avoid that.

as i said, this just works around the link warning - now we've traded 
the link warning for a runtime crash.

	Ingo

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

* [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC
  2007-12-30 14:51 ` Ingo Molnar
  2007-12-30 20:48   ` Yinghai Lu
@ 2007-12-30 21:30   ` Yinghai Lu
  2007-12-30 21:29     ` Ingo Molnar
  1 sibling, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-30 21:30 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton; +Cc: LKML

[PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC

clear IO_APIC before enabing apic error vector cause link warning

use function call in setup_local_APIC to avoid that.

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/arch/x86/kernel/smpboot_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot_64.c
+++ linux-2.6/arch/x86/kernel/smpboot_64.c
@@ -211,7 +211,7 @@ void __cpuinit smp_callin(void)
 	 */
 
 	Dprintk("CALLIN, before setup_local_APIC().\n");
-	setup_local_APIC();
+	setup_local_APIC(NULL);
 
 	/*
 	 * Get our bogomips.
@@ -867,6 +867,8 @@ void __init smp_set_apicids(void)
  */
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
+	void (*extra_call)(void) = NULL;
+
 	nmi_watchdog_default();
 	current_cpu_data = boot_cpu_data;
 	current_thread_info()->cpu = 0;  /* needed? */
@@ -883,7 +885,10 @@ void __init smp_prepare_cpus(unsigned in
 	/*
 	 * Switch from PIC to APIC mode.
 	 */
-	setup_local_APIC();
+	if (!skip_ioapic_setup && nr_ioapics)
+		extra_call = enable_IO_APIC;
+
+	setup_local_APIC(extra_call);
 
 	if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
 		panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
Index: linux-2.6/include/asm-x86/apic_64.h
===================================================================
--- linux-2.6.orig/include/asm-x86/apic_64.h
+++ linux-2.6/include/asm-x86/apic_64.h
@@ -74,7 +74,7 @@ extern int verify_local_APIC (void);
 extern void cache_APIC_registers (void);
 extern void sync_Arb_IDs (void);
 extern void init_bsp_APIC (void);
-extern void setup_local_APIC (void);
+extern void setup_local_APIC (void (*extra_call)(void));
 extern void init_apic_mappings (void);
 extern void smp_local_timer_interrupt (void);
 extern void setup_boot_APIC_clock (void);
Index: linux-2.6/arch/x86/kernel/apic_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic_64.c
+++ linux-2.6/arch/x86/kernel/apic_64.c
@@ -418,7 +418,7 @@ void __init init_bsp_APIC(void)
 	apic_write(APIC_LVT1, value);
 }
 
-void __cpuinit setup_local_APIC (void)
+void __cpuinit setup_local_APIC (void (*extra_call)(void))
 {
 	unsigned int value, maxlvt;
 	int i, j;
@@ -521,9 +521,8 @@ void __cpuinit setup_local_APIC (void)
 	 * Now enable IO-APICs, actually call clear_IO_APIC
 	 * We need clear_IO_APIC before enabling vector on BP
 	 */
-	if (!smp_processor_id())
-	if (!skip_ioapic_setup && nr_ioapics)
-		enable_IO_APIC();
+	if (extra_call)
+		(*extra_call)();
 
 	{
 		unsigned oldvalue;
@@ -1206,6 +1205,8 @@ int disable_apic;
  */
 int __init APIC_init_uniprocessor (void)
 {
+	void (*extra_call)(void) = NULL;
+
 	if (disable_apic) {
 		printk(KERN_INFO "Apic disabled\n");
 		return -1;
@@ -1221,7 +1222,10 @@ int __init APIC_init_uniprocessor (void)
 	phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
 	apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id));
 
-	setup_local_APIC();
+	if (!skip_ioapic_setup && nr_ioapics)
+		extra_call = enable_IO_APIC;
+
+	setup_local_APIC(extra_call);
 
 	if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
 		setup_IO_APIC();

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

* Re: [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC
  2007-12-30 21:29     ` Ingo Molnar
@ 2007-12-30 21:53       ` Yinghai Lu
  0 siblings, 0 replies; 15+ messages in thread
From: Yinghai Lu @ 2007-12-30 21:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Dec 30, 2007 1:29 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
>
> > [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC
> >
> > clear IO_APIC before enabing apic error vector cause link warning
> >
> > use function call in setup_local_APIC to avoid that.
>
> as i said, this just works around the link warning - now we've traded
> the link warning for a runtime crash.

you got one runtime crash by this fix?

YH

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-30 20:48   ` Yinghai Lu
@ 2007-12-30 22:06     ` Adrian Bunk
  2007-12-30 22:42       ` Yinghai Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Adrian Bunk @ 2007-12-30 22:06 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> >
> > > please check if you can replace the one in the x86-mm
> > >
> > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > >
> > > the updated one avoid one link warning.
> >
> > please send delta patches instead - so that we can review the changes.
> 
> will do that in another patch.
> 
> >
> > > this is the updated verison that take enable_IO_APIC as extra call for
> > > setup_local_APIC to avoid linking warning.
> >
> > hm, what link warning did you get? Perhaps the following __cpuinit:
> 
> WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> 'apic_is_clustered_box')

So you are doing complicated things for silencing the warning (there is
an easier ways for achieving it), but the real bug that you will get an 
Oops when calling enable_IO_APIC() after bootup since it already got 
freed stays?

> > > -void __cpuinit setup_local_APIC (void)
> >
> > does not mix well with an __init call:
> >
> > > +void __init enable_IO_APIC(void)
> >
> > and you hack it around by using a function pointer. Nasty and still
> > buggy. The proper solution would be to mark enable_IO_APIC as __cpuinit
> > too (or something like that).
> 
> after change that to __cpuinit, i got
> 
> WARNING: vmlinux.o(.text+0x17f84): Section mismatch: reference to
> .init.text: (between 'enable_IO_APIC' and 'ioapic_resume')
> WARNING: vmlinux.o(.text+0x17f92): Section mismatch: reference to
> .init.text: (between 'enable_IO_APIC' and 'ioapic_resume')

find_isa_irq_{apic,pin} are called by enable_IO_APIC() and therefore 
also have to be changed from __init to __cpuinit.

> YH

cu
Adrian

BTW: Is there a reason why your patch doesn't touch the 32bit code?

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-30 22:06     ` Adrian Bunk
@ 2007-12-30 22:42       ` Yinghai Lu
  2007-12-30 23:23         ` Adrian Bunk
  0 siblings, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-30 22:42 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Dec 30, 2007 2:06 PM, Adrian Bunk <bunk@kernel.org> wrote:
> On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> > On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > >
> > > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> > >
> > > > please check if you can replace the one in the x86-mm
> > > >
> > > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > > >
> > > > the updated one avoid one link warning.
> > >
> > > please send delta patches instead - so that we can review the changes.
> >
> > will do that in another patch.
> >
> > >
> > > > this is the updated verison that take enable_IO_APIC as extra call for
> > > > setup_local_APIC to avoid linking warning.
> > >
> > > hm, what link warning did you get? Perhaps the following __cpuinit:
> >
> > WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> > .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> > 'apic_is_clustered_box')
>
> So you are doing complicated things for silencing the warning (there is
> an easier ways for achieving it), but the real bug that you will get an
> Oops when calling enable_IO_APIC() after bootup since it already got
> freed stays?

the enable_IO_APIC is actually doing clear_IO_APIC. and it is only
called by BSP via setup_local_APIC
and it is not called again after bootup

YH

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-30 22:42       ` Yinghai Lu
@ 2007-12-30 23:23         ` Adrian Bunk
  2007-12-31  0:01           ` Yinghai Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Adrian Bunk @ 2007-12-30 23:23 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Sun, Dec 30, 2007 at 02:42:41PM -0800, Yinghai Lu wrote:
> On Dec 30, 2007 2:06 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> > > On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > > >
> > > > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> > > >
> > > > > please check if you can replace the one in the x86-mm
> > > > >
> > > > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > > > >
> > > > > the updated one avoid one link warning.
> > > >
> > > > please send delta patches instead - so that we can review the changes.
> > >
> > > will do that in another patch.
> > >
> > > >
> > > > > this is the updated verison that take enable_IO_APIC as extra call for
> > > > > setup_local_APIC to avoid linking warning.
> > > >
> > > > hm, what link warning did you get? Perhaps the following __cpuinit:
> > >
> > > WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> > > .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> > > 'apic_is_clustered_box')
> >
> > So you are doing complicated things for silencing the warning (there is
> > an easier ways for achieving it), but the real bug that you will get an
> > Oops when calling enable_IO_APIC() after bootup since it already got
> > freed stays?
> 
> the enable_IO_APIC is actually doing clear_IO_APIC. and it is only
> called by BSP via setup_local_APIC
> and it is not called again after bootup

OK, this was a bit hidden inside your pointer games.

Please send a patch that ignores the warning (and therefore doesn't do 
these pointer games), and I'll fix the warning in a followup patch.

> YH

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-30 23:23         ` Adrian Bunk
@ 2007-12-31  0:01           ` Yinghai Lu
  2007-12-31  0:28             ` Adrian Bunk
  0 siblings, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-31  0:01 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Dec 30, 2007 3:23 PM, Adrian Bunk <bunk@kernel.org> wrote:
>
> On Sun, Dec 30, 2007 at 02:42:41PM -0800, Yinghai Lu wrote:
> > On Dec 30, 2007 2:06 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > > On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> > > > On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > > > >
> > > > > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> > > > >
> > > > > > please check if you can replace the one in the x86-mm
> > > > > >
> > > > > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > > > > >
> > > > > > the updated one avoid one link warning.
> > > > >
> > > > > please send delta patches instead - so that we can review the changes.
> > > >
> > > > will do that in another patch.
> > > >
> > > > >
> > > > > > this is the updated verison that take enable_IO_APIC as extra call for
> > > > > > setup_local_APIC to avoid linking warning.
> > > > >
> > > > > hm, what link warning did you get? Perhaps the following __cpuinit:
> > > >
> > > > WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> > > > .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> > > > 'apic_is_clustered_box')
> > >
> > > So you are doing complicated things for silencing the warning (there is
> > > an easier ways for achieving it), but the real bug that you will get an
> > > Oops when calling enable_IO_APIC() after bootup since it already got
> > > freed stays?
> >
> > the enable_IO_APIC is actually doing clear_IO_APIC. and it is only
> > called by BSP via setup_local_APIC
> > and it is not called again after bootup
>
> OK, this was a bit hidden inside your pointer games.
>
> Please send a patch that ignores the warning (and therefore doesn't do
> these pointer games), and I'll fix the warning in a followup patch.

the old one is in x86-mm tree

http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76

function call delta
http://lkml.org/lkml/2007/12/30/211

thanks

YH

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-31  0:01           ` Yinghai Lu
@ 2007-12-31  0:28             ` Adrian Bunk
  2007-12-31  0:56               ` Yinghai Lu
  2007-12-31  1:03               ` Yinghai Lu
  0 siblings, 2 replies; 15+ messages in thread
From: Adrian Bunk @ 2007-12-31  0:28 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Sun, Dec 30, 2007 at 04:01:39PM -0800, Yinghai Lu wrote:
> On Dec 30, 2007 3:23 PM, Adrian Bunk <bunk@kernel.org> wrote:
> >
> > On Sun, Dec 30, 2007 at 02:42:41PM -0800, Yinghai Lu wrote:
> > > On Dec 30, 2007 2:06 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > > > On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> > > > > On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > > > > >
> > > > > > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> > > > > >
> > > > > > > please check if you can replace the one in the x86-mm
> > > > > > >
> > > > > > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > > > > > >
> > > > > > > the updated one avoid one link warning.
> > > > > >
> > > > > > please send delta patches instead - so that we can review the changes.
> > > > >
> > > > > will do that in another patch.
> > > > >
> > > > > >
> > > > > > > this is the updated verison that take enable_IO_APIC as extra call for
> > > > > > > setup_local_APIC to avoid linking warning.
> > > > > >
> > > > > > hm, what link warning did you get? Perhaps the following __cpuinit:
> > > > >
> > > > > WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> > > > > .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> > > > > 'apic_is_clustered_box')
> > > >
> > > > So you are doing complicated things for silencing the warning (there is
> > > > an easier ways for achieving it), but the real bug that you will get an
> > > > Oops when calling enable_IO_APIC() after bootup since it already got
> > > > freed stays?
> > >
> > > the enable_IO_APIC is actually doing clear_IO_APIC. and it is only
> > > called by BSP via setup_local_APIC
> > > and it is not called again after bootup
> >
> > OK, this was a bit hidden inside your pointer games.
> >
> > Please send a patch that ignores the warning (and therefore doesn't do
> > these pointer games), and I'll fix the warning in a followup patch.
> 
> the old one is in x86-mm tree
> 
> http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
>...

Sorry for the dumb question, but what in

+       if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics)
+               enable_IO_APIC();

guarantees that this call doesn't happen when you hotplug CPU 0 ?

> thanks
> 
> YH

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-31  0:28             ` Adrian Bunk
@ 2007-12-31  0:56               ` Yinghai Lu
  2008-01-01 23:17                 ` Adrian Bunk
  2007-12-31  1:03               ` Yinghai Lu
  1 sibling, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-31  0:56 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Dec 30, 2007 4:28 PM, Adrian Bunk <bunk@kernel.org> wrote:
>
> On Sun, Dec 30, 2007 at 04:01:39PM -0800, Yinghai Lu wrote:
> > On Dec 30, 2007 3:23 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > >
> > > On Sun, Dec 30, 2007 at 02:42:41PM -0800, Yinghai Lu wrote:
> > > > On Dec 30, 2007 2:06 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > > > > On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> > > > > > On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > > > > > >
> > > > > > > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> > > > > > >
> > > > > > > > please check if you can replace the one in the x86-mm
> > > > > > > >
> > > > > > > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > > > > > > >
> > > > > > > > the updated one avoid one link warning.
> > > > > > >
> > > > > > > please send delta patches instead - so that we can review the changes.
> > > > > >
> > > > > > will do that in another patch.
> > > > > >
> > > > > > >
> > > > > > > > this is the updated verison that take enable_IO_APIC as extra call for
> > > > > > > > setup_local_APIC to avoid linking warning.
> > > > > > >
> > > > > > > hm, what link warning did you get? Perhaps the following __cpuinit:
> > > > > >
> > > > > > WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> > > > > > .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> > > > > > 'apic_is_clustered_box')
> > > > >
> > > > > So you are doing complicated things for silencing the warning (there is
> > > > > an easier ways for achieving it), but the real bug that you will get an
> > > > > Oops when calling enable_IO_APIC() after bootup since it already got
> > > > > freed stays?
> > > >
> > > > the enable_IO_APIC is actually doing clear_IO_APIC. and it is only
> > > > called by BSP via setup_local_APIC
> > > > and it is not called again after bootup
> > >
> > > OK, this was a bit hidden inside your pointer games.
> > >
> > > Please send a patch that ignores the warning (and therefore doesn't do
> > > these pointer games), and I'll fix the warning in a followup patch.
> >
> > the old one is in x86-mm tree
> >
> > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> >...
>
> Sorry for the dumb question, but what in
>
> +       if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics)
> +               enable_IO_APIC();
>
> guarantees that this call doesn't happen when you hotplug CPU 0 ?

so we can hotplug cpu0 or the bsp?

YH

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-31  0:28             ` Adrian Bunk
  2007-12-31  0:56               ` Yinghai Lu
@ 2007-12-31  1:03               ` Yinghai Lu
  2008-01-01 23:18                 ` Adrian Bunk
  1 sibling, 1 reply; 15+ messages in thread
From: Yinghai Lu @ 2007-12-31  1:03 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Dec 30, 2007 4:28 PM, Adrian Bunk <bunk@kernel.org> wrote:
>
> On Sun, Dec 30, 2007 at 04:01:39PM -0800, Yinghai Lu wrote:
> > On Dec 30, 2007 3:23 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > >
> > > On Sun, Dec 30, 2007 at 02:42:41PM -0800, Yinghai Lu wrote:
> > > > On Dec 30, 2007 2:06 PM, Adrian Bunk <bunk@kernel.org> wrote:
> > > > > On Sun, Dec 30, 2007 at 12:48:48PM -0800, Yinghai Lu wrote:
> > > > > > On Dec 30, 2007 6:51 AM, Ingo Molnar <mingo@elte.hu> wrote:
> > > > > > >
> > > > > > > * Yinghai Lu <Yinghai.Lu@Sun.COM> wrote:
> > > > > > >
> > > > > > > > please check if you can replace the one in the x86-mm
> > > > > > > >
> > > > > > > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > > > > > > >
> > > > > > > > the updated one avoid one link warning.
> > > > > > >
> > > > > > > please send delta patches instead - so that we can review the changes.
> > > > > >
> > > > > > will do that in another patch.
> > > > > >
> > > > > > >
> > > > > > > > this is the updated verison that take enable_IO_APIC as extra call for
> > > > > > > > setup_local_APIC to avoid linking warning.
> > > > > > >
> > > > > > > hm, what link warning did you get? Perhaps the following __cpuinit:
> > > > > >
> > > > > > WARNING: vmlinux.o(.text+0x163d5): Section mismatch: reference to
> > > > > > .init.text:enable_IO_APIC (between 'setup_local_APIC' and
> > > > > > 'apic_is_clustered_box')
> > > > >
> > > > > So you are doing complicated things for silencing the warning (there is
> > > > > an easier ways for achieving it), but the real bug that you will get an
> > > > > Oops when calling enable_IO_APIC() after bootup since it already got
> > > > > freed stays?
> > > >
> > > > the enable_IO_APIC is actually doing clear_IO_APIC. and it is only
> > > > called by BSP via setup_local_APIC
> > > > and it is not called again after bootup
> > >
> > > OK, this was a bit hidden inside your pointer games.
> > >
> > > Please send a patch that ignores the warning (and therefore doesn't do
> > > these pointer games), and I'll fix the warning in a followup patch.
> >
> > the old one is in x86-mm tree
> >
> > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> >...
>
> Sorry for the dumb question, but what in
>
> +       if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics)
> +               enable_IO_APIC();
>
> guarantees that this call doesn't happen when you hotplug CPU 0 ?
>

if CPU 0 (BSP) can be hotplug, it will be restarted via smp_callin.
and the delta function call patch will use setup_local_APIC(NULL),
then it will be safe.

YH

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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-31  0:56               ` Yinghai Lu
@ 2008-01-01 23:17                 ` Adrian Bunk
  0 siblings, 0 replies; 15+ messages in thread
From: Adrian Bunk @ 2008-01-01 23:17 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Sun, Dec 30, 2007 at 04:56:35PM -0800, Yinghai Lu wrote:
> On Dec 30, 2007 4:28 PM, Adrian Bunk <bunk@kernel.org> wrote:
>...
> > Sorry for the dumb question, but what in
> >
> > +       if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics)
> > +               enable_IO_APIC();
> >
> > guarantees that this call doesn't happen when you hotplug CPU 0 ?
> 
> so we can hotplug cpu0 or the bsp?

Honestly I don't know the amd64 architecture well enough for telling 
whether the hardware allows it or not.

> YH

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2
  2007-12-31  1:03               ` Yinghai Lu
@ 2008-01-01 23:18                 ` Adrian Bunk
  0 siblings, 0 replies; 15+ messages in thread
From: Adrian Bunk @ 2008-01-01 23:18 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, Thomas Gleixner, Andi Kleen, Andrew Morton, LKML

On Sun, Dec 30, 2007 at 05:03:50PM -0800, Yinghai Lu wrote:
> On Dec 30, 2007 4:28 PM, Adrian Bunk <bunk@kernel.org> wrote:
> >
> > On Sun, Dec 30, 2007 at 04:01:39PM -0800, Yinghai Lu wrote:
>...
> > > the old one is in x86-mm tree
> > >
> > > http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-x86.git;a=commitdiff;h=ffcbdc220a1520d006a837f33589c7c19ffbeb76
> > >...
> >
> > Sorry for the dumb question, but what in
> >
> > +       if (!smp_processor_id() && !skip_ioapic_setup && nr_ioapics)
> > +               enable_IO_APIC();
> >
> > guarantees that this call doesn't happen when you hotplug CPU 0 ?
> >
> 
> if CPU 0 (BSP) can be hotplug, it will be restarted via smp_callin.
> and the delta function call patch will use setup_local_APIC(NULL),
> then it will be safe.

We are talking about the version without the pointer games.

> YH

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

end of thread, other threads:[~2008-01-01 23:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-30  3:52 [PATCH] x86_64: clear IO_APIC before enabing apic error vector. v2 Yinghai Lu
2007-12-30 14:51 ` Ingo Molnar
2007-12-30 20:48   ` Yinghai Lu
2007-12-30 22:06     ` Adrian Bunk
2007-12-30 22:42       ` Yinghai Lu
2007-12-30 23:23         ` Adrian Bunk
2007-12-31  0:01           ` Yinghai Lu
2007-12-31  0:28             ` Adrian Bunk
2007-12-31  0:56               ` Yinghai Lu
2008-01-01 23:17                 ` Adrian Bunk
2007-12-31  1:03               ` Yinghai Lu
2008-01-01 23:18                 ` Adrian Bunk
2007-12-30 21:30   ` [PATCH] x86_64: fix section warning about enable_IO_APIC and setup_local_APIC Yinghai Lu
2007-12-30 21:29     ` Ingo Molnar
2007-12-30 21:53       ` Yinghai Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox