Skip to contentSkip to conversation

x86: fix compile warning in io_apic_{32,64}.c

PATCH Applied Andreas Herrmann 3 participants 4 messages Jun 5, 2008 – Jun 10, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix compile warning in io_apic_{32,64}.c

Commit 05f2d12c3563dea8c81b301f9f3cf7919af23b13
(x86: change GET_APIC_ID() from an inline function to an out-of-line function)

introduced a compile warning

arch/x86/kernel/io_apic_64.c: In function 'print_local_APIC':
arch/x86/kernel/io_apic_64.c:1152: warning: 'v' is used uninitialized in this function

in some debug code -- which is not enabled by default. This patch reverts the code changes in print_local_APIC.

--

arch/x86/kernel/io_apic_32.c +2 -2
index a40d54f..9a3446f 100644
@@ -1489,8 +1489,8 @@ void /*__init*/ print_local_APIC(void * dummy)
 
 	printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
 		smp_processor_id(), hard_smp_processor_id());
-	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v,
-			GET_APIC_ID(read_apic_id()));
+	v = apic_read(APIC_ID);
+	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, GET_APIC_ID(v));
 	v = apic_read(APIC_LVR);
 	printk(KERN_INFO "... APIC VERSION: %08x\n", v);
 	ver = GET_APIC_VERSION(v);
arch/x86/kernel/io_apic_64.c +2 -1
index ef1a8df..59ed52c 100644
@@ -1077,7 +1077,8 @@ void __apicdebuginit print_local_APIC(void * dummy)
 
 	printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
 		smp_processor_id(), hard_smp_processor_id());
-	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, GET_APIC_ID(read_apic_id()));
+	v = apic_read(APIC_ID);
+	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, GET_APIC_ID(v));
 	v = apic_read(APIC_LVR);
 	printk(KERN_INFO "... APIC VERSION: %08x\n", v);
 	ver = GET_APIC_VERSION(v);
#1 lore raw
Quoted 34 lines · Andreas Herrmann

Commit 05f2d12c3563dea8c81b301f9f3cf7919af23b13
(x86: change GET_APIC_ID() from an inline function to an out-of-line function)

introduced a compile warning

arch/x86/kernel/io_apic_64.c: In function 'print_local_APIC':
arch/x86/kernel/io_apic_64.c:1152: warning: 'v' is used uninitialized in this function

in some debug code -- which is not enabled by default. This patch reverts the code changes in print_local_APIC.

--

arch/x86/kernel/io_apic_32.c +2 -2
index a40d54f..9a3446f 100644
@@ -1489,8 +1489,8 @@ void /*__init*/ print_local_APIC(void * dummy)
 
 	printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
 		smp_processor_id(), hard_smp_processor_id());
-	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v,
-			GET_APIC_ID(read_apic_id()));
+	v = apic_read(APIC_ID);
+	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, GET_APIC_ID(v));
 	v = apic_read(APIC_LVR);
 	printk(KERN_INFO "... APIC VERSION: %08x\n", v);
 	ver = GET_APIC_VERSION(v);
arch/x86/kernel/io_apic_64.c +0 -0
index ef1a8df..59ed52c 100644

arch/x86/kernel/io_apic_64.c void __apicdebuginit print_local_APIC(void * dummy) · line 1080

Quoted 5 lines
arch/x86/kernel/io_apic_64.c +1 -1
@@ -1077,7 +1077,8 @@ void __apicdebuginit print_local_APIC(void * dummy)
 
 	printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
 		smp_processor_id(), hard_smp_processor_id());
-	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, GET_APIC_ID(read_apic_id()));
+	v = apic_read(APIC_ID);

I don't think this work on UV systems. Because of processor limitations, not all of the APICID bits are contained in the hardware APIC_ID register. See read_apic_id() in arch/x86/kernel/genapic_64.c.

I have not seen the compiler warning. What tree/options cause the error???

arch/x86/kernel/io_apic_64.c void __apicdebuginit print_local_APIC(void * dummy) · line 1084

Quoted 7 lines
arch/x86/kernel/io_apic_64.c +1 -0
+	printk(KERN_INFO "... APIC ID:      %08x (%01x)\n", v, GET_APIC_ID(v));
 	v = apic_read(APIC_LVR);
 	printk(KERN_INFO "... APIC VERSION: %08x\n", v);
 	ver = GET_APIC_VERSION(v);

--- jack

#2 lore raw
Quoted 1 line · Jack Steiner

I have not seen the compiler warning. What tree/options cause the error???

Sure. It's currently dead code. I use it from time to time for debugging. At least you have to do something like

arch/x86/kernel/io_apic_64.c +0 -2
index ef1a8df..ddfdabd 100644
@@ -1045,7 +1045,6 @@ void __apicdebuginit print_IO_APIC(void)
        return;
 }
 
-#if 0
 
 static __apicdebuginit void print_APIC_bitfield (int base)
 {
@@ -1181,7 +1180,6 @@ void __apicdebuginit print_PIC(void)
        printk(KERN_DEBUG "... PIC ELCR: %04x\n", v);
 }
 
-#endif  /*  0  */
 
 void __init enable_IO_APIC(void)
 {

to compile it.

Quoted 3 lines

I don't think this work on UV systems. Because of processor limitations, not all of the APICID bits are contained in the hardware APIC_ID register. See read_apic_id() in arch/x86/kernel/genapic_64.c.

I am not that familar with UV. So can't really comment on that.
But then it seems that the proper adaption for print_local_APIC to avoid the warning is
---
[PATCH] x86: fix compile warning in io_apic_{32,64}.c

Commit 05f2d12c3563dea8c81b301f9f3cf7919af23b13
(x86: change GET_APIC_ID() from an inline function to an out-of-line function) introduced a compile warning:

arch/x86/kernel/io_apic_64.c: In function 'print_local_APIC':
arch/x86/kernel/io_apic_64.c:1152: warning: 'v' is used uninitialized in this function

in some debug code -- which is disabled by default.

--

arch/x86/kernel/io_apic_32.c +1 -0
index a40d54f..4fbf656 100644
@@ -1489,6 +1489,7 @@ void /*__init*/ print_local_APIC(void * dummy)
 
 	printk("\n" KERN_DEBUG "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,
 			GET_APIC_ID(read_apic_id()));
 	v = apic_read(APIC_LVR);
arch/x86/kernel/io_apic_64.c +1 -0
index ef1a8df..c7c6b00 100644
@@ -1077,6 +1077,7 @@ void __apicdebuginit print_local_APIC(void * dummy)
 
 	printk("\n" KERN_DEBUG "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, GET_APIC_ID(read_apic_id()));
 	v = apic_read(APIC_LVR);
 	printk(KERN_INFO "... APIC VERSION: %08x\n", v);
Applied
#3 lore raw
In reply to Andreas Herrmann
Quoted 10 lines · Andreas Herrmann

Commit 05f2d12c3563dea8c81b301f9f3cf7919af23b13
(x86: change GET_APIC_ID() from an inline function to an out-of-line function)

introduced a compile warning

arch/x86/kernel/io_apic_64.c: In function 'print_local_APIC':
arch/x86/kernel/io_apic_64.c:1152: warning: 'v' is used uninitialized in this function

in some debug code -- which is not enabled by default. This patch reverts the code changes in print_local_APIC.

applied to tip/x86/cleanups - thanks Andreas.

Ingo