Skip to contentSkip to conversation

gpio: xgs-iproc: Fix section mismatch on device tree match table

PATCH In review Mark Brown 5 participants 6 messages Nov 5, 2019 – Nov 7, 2019

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 gpio: xgs-iproc: Fix section mismatch on device tree match table

The table of devicetree identifiers is annotated as __initconst indicating that it can be discarded after kernel boot but it is referenced from the driver struct which has no init annotation leading to a linker warning:

WARNING: vmlinux.o(.data+0x82d58): Section mismatch in reference from the variable bcm_iproc_gpio_driver to the variable .init.rodata:bcm_iproc_gpio_of_match The variable bcm_iproc_gpio_driver references
the variable __initconst bcm_iproc_gpio_of_match

Since drivers can be probed after init the lack of annotation on the driver struct is correct so remove the annotation from the match table.

---
 drivers/gpio/gpio-xgs-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-xgs-iproc.c +1 -1
index a3fdd95cc9e6..bb183f584d92 100644
@@ -299,7 +299,7 @@ static int __exit iproc_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id bcm_iproc_gpio_of_match[] __initconst = {
+static const struct of_device_id bcm_iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,iproc-gpio-cca" },
 	{}
 };
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Mark,

Quoted 5 lines · Mark Brown

The table of devicetree identifiers is annotated as __initconst indicating that it can be discarded after kernel boot but it is referenced from the driver struct which has no init annotation leading to a linker warning:

Quoted 8 lines

WARNING: vmlinux.o(.data+0x82d58): Section mismatch in reference from the variable bcm_iproc_gpio_driver to the variable .init.rodata:bcm_iproc_gpio_of_match The variable bcm_iproc_gpio_driver references
the variable __initconst bcm_iproc_gpio_of_match

Since drivers can be probed after init the lack of annotation on the driver struct is correct so remove the annotation from the match table.

Thanks for picking this up

Is it worth including 'Fixes: 6a41b6c5fc20 ("gpio: Add xgs-iproc driver")'?

Quoted 17 lines
---
 drivers/gpio/gpio-xgs-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-xgs-iproc.c +1 -1
index a3fdd95cc9e6..bb183f584d92 100644
@@ -299,7 +299,7 @@ static int __exit iproc_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id bcm_iproc_gpio_of_match[] __initconst = {
+static const struct of_device_id bcm_iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,iproc-gpio-cca" },
 	{}
 };
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Mark Brown

Hi Mark,

Quoted 12 lines

From: Mark Brown, Sent: Tuesday, November 5, 2019 9:49 PM

The table of devicetree identifiers is annotated as __initconst indicating that it can be discarded after kernel boot but it is referenced from the driver struct which has no init annotation leading to a linker warning:

WARNING: vmlinux.o(.data+0x82d58): Section mismatch in reference from the variable bcm_iproc_gpio_driver to the variable .init.rodata:bcm_iproc_gpio_of_match
The variable bcm_iproc_gpio_driver references
the variable __initconst bcm_iproc_gpio_of_match

Quoted 4 lines

Since drivers can be probed after init the lack of annotation on the driver struct is correct so remove the annotation from the match table.

Thank you for the patch! Without this patch, I had encountered another issue which my environment caused a panic when I tried to install a usb host driver after booted [1]. But, I could resolved the issue after
I applied this patch. Also, I confirmed this patch could resolved the warning.

So,

Best regards,
Yoshihiro Shimoda

---
[1]

[  146.541188] Unable to handle kernel paging request at virtual address ffff800011f73540
[  146.549099] Mem abort info:
[  146.551885]   ESR = 0x96000007
[  146.554934]   EC = 0x25: DABT (current EL), IL = 32 bits
[  146.560238]   SET = 0, FnV = 0
[  146.563284]   EA = 0, S1PTW = 0
[  146.566416] Data abort info:
[  146.569289]   ISV = 0, ISS = 0x00000007
[  146.573117]   CM = 0, WnR = 0
[  146.576078] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000049e4a000
[  146.582770] [ffff800011f73540] pgd=000000077ffff003, pud=000000077fffe003, pmd=000000077fffb003, pte=0000000000000000
[  146.593375] Internal error: Oops: 96000007 [#1] PREEMPT SMP
[  146.598944] CPU: 0 PID: 106 Comm: kworker/0:1 Not tainted 5.4.0-rc6-next-20191105 #87
[  146.606766] Hardware name: Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+ (DT)
[  146.615209] Workqueue: events deferred_probe_work_func
[  146.620341] pstate: a0000085 (NzCv daIf -PAN -UAO)
[  146.625132] pc : __of_match_node.part.4+0x3c/0x78
[  146.629830] lr : of_match_node+0x3c/0x70

...
---

So,

Best regards,
Yoshihiro Shimoda

Quoted 19 lines
---
 drivers/gpio/gpio-xgs-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-xgs-iproc.c +1 -2
index a3fdd95cc9e6..bb183f584d92 100644
@@ -299,7 +299,7 @@ static int __exit iproc_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id bcm_iproc_gpio_of_match[] __initconst = {
+static const struct of_device_id bcm_iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,iproc-gpio-cca" },
 	{}
 };
--

2.20.1

#3 lore raw

(adding Guillamume),

Quoted 51 lines · Yoshihiro Shimoda

Hi Mark,

Quoted 12 lines

From: Mark Brown, Sent: Tuesday, November 5, 2019 9:49 PM

The table of devicetree identifiers is annotated as __initconst indicating that it can be discarded after kernel boot but it is referenced from the driver struct which has no init annotation leading to a linker warning:

WARNING: vmlinux.o(.data+0x82d58): Section mismatch in reference from the variable bcm_iproc_gpio_driver to the variable .init.rodata:bcm_iproc_gpio_of_match
The variable bcm_iproc_gpio_driver references
the variable __initconst bcm_iproc_gpio_of_match

Quoted 4 lines

Since drivers can be probed after init the lack of annotation on the driver struct is correct so remove the annotation from the match table.

Thank you for the patch! Without this patch, I had encountered another issue which my environment caused a panic when I tried to install a usb host driver after booted [1]. But, I could resolved the issue after
I applied this patch. Also, I confirmed this patch could resolved the warning.

So,

Best regards,
Yoshihiro Shimoda

---
[1]

[  146.541188] Unable to handle kernel paging request at virtual address ffff800011f73540
[  146.549099] Mem abort info:
[  146.551885]   ESR = 0x96000007
[  146.554934]   EC = 0x25: DABT (current EL), IL = 32 bits
[  146.560238]   SET = 0, FnV = 0
[  146.563284]   EA = 0, S1PTW = 0
[  146.566416] Data abort info:
[  146.569289]   ISV = 0, ISS = 0x00000007
[  146.573117]   CM = 0, WnR = 0
[  146.576078] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000049e4a000
[  146.582770] [ffff800011f73540] pgd=000000077ffff003, pud=000000077fffe003, pmd=000000077fffb003, pte=0000000000000000
[  146.593375] Internal error: Oops: 96000007 [#1] PREEMPT SMP
[  146.598944] CPU: 0 PID: 106 Comm: kworker/0:1 Not tainted 5.4.0-rc6-next-20191105 #87
[  146.606766] Hardware name: Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+ (DT)
[  146.615209] Workqueue: events deferred_probe_work_func
[  146.620341] pstate: a0000085 (NzCv daIf -PAN -UAO)
[  146.625132] pc : __of_match_node.part.4+0x3c/0x78
[  146.629830] lr : of_match_node+0x3c/0x70
Quoted 5 lines

...
---

So,

I guess that kernelci failure[1] wasn't bogus after all. Sorry again for the hassle. And Mark, Yoshihiro thanks for the fix and test.

[1] -
https://lore.kernel.org/lkml/[email protected]/

Quoted 27 lines

Best regards,
Yoshihiro Shimoda

Quoted 19 lines
---
 drivers/gpio/gpio-xgs-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-xgs-iproc.c +1 -2
index a3fdd95cc9e6..bb183f584d92 100644
@@ -299,7 +299,7 @@ static int __exit iproc_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id bcm_iproc_gpio_of_match[] __initconst = {
+static const struct of_device_id bcm_iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,iproc-gpio-cca" },
 	{}
 };
--

2.20.1

#4 lore raw
Quoted 58 lines · Chris Packham

(adding Guillamume),

Quoted 55 lines · Yoshihiro Shimoda

Hi Mark,

Quoted 12 lines

From: Mark Brown, Sent: Tuesday, November 5, 2019 9:49 PM

The table of devicetree identifiers is annotated as __initconst indicating that it can be discarded after kernel boot but it is referenced from the driver struct which has no init annotation leading to a linker warning:

WARNING: vmlinux.o(.data+0x82d58): Section mismatch in reference from the variable bcm_iproc_gpio_driver to the variable .init.rodata:bcm_iproc_gpio_of_match
The variable bcm_iproc_gpio_driver references
the variable __initconst bcm_iproc_gpio_of_match

Quoted 4 lines

Since drivers can be probed after init the lack of annotation on the driver struct is correct so remove the annotation from the match table.

Thank you for the patch! Without this patch, I had encountered another issue which my environment caused a panic when I tried to install a usb host driver after booted [1]. But, I could resolved the issue after
I applied this patch. Also, I confirmed this patch could resolved the warning.

So,

Best regards,
Yoshihiro Shimoda

---
[1]

[  146.541188] Unable to handle kernel paging request at virtual address ffff800011f73540
[  146.549099] Mem abort info:
[  146.551885]   ESR = 0x96000007
[  146.554934]   EC = 0x25: DABT (current EL), IL = 32 bits
[  146.560238]   SET = 0, FnV = 0
[  146.563284]   EA = 0, S1PTW = 0
[  146.566416] Data abort info:
[  146.569289]   ISV = 0, ISS = 0x00000007
[  146.573117]   CM = 0, WnR = 0
[  146.576078] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000049e4a000
[  146.582770] [ffff800011f73540] pgd=000000077ffff003, pud=000000077fffe003, pmd=000000077fffb003, pte=0000000000000000
[  146.593375] Internal error: Oops: 96000007 [#1] PREEMPT SMP
[  146.598944] CPU: 0 PID: 106 Comm: kworker/0:1 Not tainted 5.4.0-rc6-next-20191105 #87
[  146.606766] Hardware name: Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+ (DT)
[  146.615209] Workqueue: events deferred_probe_work_func
[  146.620341] pstate: a0000085 (NzCv daIf -PAN -UAO)
[  146.625132] pc : __of_match_node.part.4+0x3c/0x78
[  146.629830] lr : of_match_node+0x3c/0x70

...
---

Quoted 4 lines
Quoted 1 line

So,

I guess that kernelci failure[1] wasn't bogus after all. Sorry again for the hassle. And Mark, Yoshihiro thanks for the fix and test.

Thanks for the follow-up, I'll re-enable bisections in lab-theobroma-systems then.

It's actually pretty hard to get false positives from this automated bisection thanks to some checks run on the commit found, to verify it does cause a boot failure and also verify that when reverted the problem goes away. This was a good example :)

Guillaume

Quoted 35 lines

[1] -
https://lore.kernel.org/lkml/[email protected]/

Quoted 18 lines

Best regards,
Yoshihiro Shimoda

Quoted 12 lines
---
 drivers/gpio/gpio-xgs-iproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-xgs-iproc.c +0 -0
index a3fdd95cc9e6..bb183f584d92 100644
@@ -299,7 +299,7 @@ static int __exit iproc_gpio_remove(struct platform_device *pdev)
 	return 0;
 }
 
Quoted 9 lines
Quoted 7 lines
drivers/gpio/gpio-xgs-iproc.c +1 -2
-static const struct of_device_id bcm_iproc_gpio_of_match[] __initconst = {
+static const struct of_device_id bcm_iproc_gpio_of_match[] = {
 	{ .compatible = "brcm,iproc-gpio-cca" },
 	{}
 };
--

2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw
In reply to Mark Brown
Quoted 5 lines · Mark Brown

The table of devicetree identifiers is annotated as __initconst indicating that it can be discarded after kernel boot but it is referenced from the driver struct which has no init annotation leading to a linker warning:

Quoted 8 lines

WARNING: vmlinux.o(.data+0x82d58): Section mismatch in reference from the variable bcm_iproc_gpio_driver to the variable .init.rodata:bcm_iproc_gpio_of_match The variable bcm_iproc_gpio_driver references
the variable __initconst bcm_iproc_gpio_of_match

Since drivers can be probed after init the lack of annotation on the driver struct is correct so remove the annotation from the match table.

Oh thanks a LOT Mark!

Hurriedly applied this with the ACKs and pushed out so linux-next starts working.

Quite interesting bug, I guess I'll comment on it in the other thread.

Yours,
Linus Walleij