mbox series

[RFC/RFT,00/12] clk: samsung: Use platform_driver_probe() to avoid __refdata

Message ID 20250305-clk-samsung-ref-init-data-v1-0-a4e03a019306@linaro.org (mailing list archive)
Headers show
Series clk: samsung: Use platform_driver_probe() to avoid __refdata | expand

Message

Krzysztof Kozlowski March 5, 2025, 9:43 p.m. UTC
RFT/RFC because testing needed. I tried to do the same on exynos5-subcmu
and it caused weird oopses which even KASAN did not narrow. Probably
because of multiple exynos5-subcmu devices?

Switch registering platform driver to platform_driver_probe(), so the
'struct platform_driver' can be properly discarded after init and there
won't be need of __refdata to silence DEBUG_SECTION_MISMATCH.

The change requires using subsys_initcall instead of core_initcall,
because no device drivers would bound in the latter, as required by
platform_driver_probe().

Best regards,
Krzysztof

---
Krzysztof Kozlowski (12):
      clk: samsung: exynos2200: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos4412-isp: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos5433: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos7870: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos7885: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos850: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos8895: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynos990: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynosautov9: Use platform_driver_probe() to avoid __refdata
      clk: samsung: exynosautov920: Use platform_driver_probe() to avoid __refdata
      clk: samsung: fsd: Use platform_driver_probe() to avoid __refdata
      clk: samsung: gs101: Use platform_driver_probe() to avoid __refdata

 drivers/clk/samsung/clk-exynos2200.c     | 7 +++----
 drivers/clk/samsung/clk-exynos4412-isp.c | 7 +++----
 drivers/clk/samsung/clk-exynos5433.c     | 7 +++----
 drivers/clk/samsung/clk-exynos7870.c     | 7 +++----
 drivers/clk/samsung/clk-exynos7885.c     | 7 +++----
 drivers/clk/samsung/clk-exynos850.c      | 7 +++----
 drivers/clk/samsung/clk-exynos8895.c     | 7 +++----
 drivers/clk/samsung/clk-exynos990.c      | 7 +++----
 drivers/clk/samsung/clk-exynosautov9.c   | 5 ++---
 drivers/clk/samsung/clk-exynosautov920.c | 7 +++----
 drivers/clk/samsung/clk-fsd.c            | 7 +++----
 drivers/clk/samsung/clk-gs101.c          | 7 +++----
 12 files changed, 35 insertions(+), 47 deletions(-)
---
base-commit: 7ec162622e66a4ff886f8f28712ea1b13069e1aa
change-id: 20250305-clk-samsung-ref-init-data-6b2cd242409f

Best regards,

Comments

André Draszik March 7, 2025, 2:29 p.m. UTC | #1
Hi Krzysztof,

Nice idea!

On Wed, 2025-03-05 at 22:43 +0100, Krzysztof Kozlowski wrote:
> RFT/RFC because testing needed. I tried to do the same on exynos5-subcmu
> and it caused weird oopses which even KASAN did not narrow. Probably
> because of multiple exynos5-subcmu devices?

I've tried this on top of next-20250225, and it doesn't work on gs101
either and OOPSes several times during boot in different places, but
I can not dig deeper right now.

[   11.502919][   T58] Unable to handle kernel paging request at virtual address ffffbfe2ab25cc30
[   11.503128][   T58] Mem abort info:
[   11.503202][   T58]   ESR = 0x0000000096000007
[   11.503295][   T58]   EC = 0x25: DABT (current EL), IL = 32 bits
[   11.503419][   T58]   SET = 0, FnV = 0
[   11.503498][   T58]   EA = 0, S1PTW = 0
[   11.503579][   T58]   FSC = 0x07: level 3 translation fault
[   11.503695][   T58] Data abort info:
[   11.503769][   T58]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[   11.503896][   T58]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   11.504058][   T58]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[   11.504288][   T58] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000008208c000
[   11.504570][   T58] [ffffbfe2ab25cc30] pgd=0000000000000000, p4d=1000000082a58003, pud=1000000082a59003, pmd=1000000082a5d003,
pte=0000000000000000
[   11.505079][   T58] Internal error: Oops: 0000000096000007 [#1] PREEMPT SMP
[   11.505346][   T58] Modules linked in:
[   11.505495][   T58] CPU: 6 UID: 0 PID: 58 Comm: kworker/u32:1 Tainted: G                T  6.14.0-rc4-next-20250225+ #12
[   11.505902][   T58] Tainted: [T]=RANDSTRUCT
[   11.506061][   T58] Hardware name: Raven (DT)
[   11.506230][   T58] Workqueue: events_unbound deferred_probe_work_func
[   11.506477][   T58] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   11.506768][   T58] pc : __device_attach_driver+0x18/0x254
[   11.506978][   T58] lr : bus_for_each_drv+0xfc/0x154
[   11.507168][   T58] sp : ffff8000803abc00
[   11.507321][   T58] x29: ffff8000803abc10 x28: ffff00ed403363d0 x27: ffff00ed40336400
[   11.507620][   T58] x26: 0000000000000000 x25: ffff00ed4002380d x24: ffff00ed40028000
[   11.507919][   T58] x23: ffffbfe2aba26000 x22: 0000000000000000 x21: ffff00ed409f8400
[   11.508219][   T58] x20: ffff8000803abca8 x19: ffffbfe2a9a4cf4c x18: 0000000000000040
[   11.508518][   T58] x17: 0000000000000001 x16: 0000000000000001 x15: 0000000000000010
[   11.508817][   T58] x14: 0000000000000010 x13: 0000000000000093 x12: 0000000000000002
[   11.509117][   T58] x11: ffffffffff6070d2 x10: 0000bef56a420260 x9 : 0000000100000000
[   11.509416][   T58] x8 : 0000000100000000 x7 : ff7f7f7f7f7f7f7f x6 : 455242436f53531d
[   11.509715][   T58] x5 : 1d53536f43425245 x4 : 0000000000000000 x3 : e8c6e6e4bec6c65a
[   11.510015][   T58] x2 : 0000000000000062 x1 : ffff8000803abca8 x0 : ffffbfe2ab25cc28
[   11.510315][   T58] Call trace:
[   11.510436][   T58]  __device_attach_driver+0x18/0x254 (P)
[   11.510644][   T58]  bus_for_each_drv+0xfc/0x154
[   11.510819][   T58]  __device_attach+0x100/0x1cc
[   11.510996][   T58]  device_initial_probe+0x14/0x20
[   11.511182][   T58]  bus_probe_device+0x94/0x100
[   11.511359][   T58]  deferred_probe_work_func+0xa0/0xfc
[   11.511558][   T58]  process_scheduled_works+0x194/0x2c4
[   11.511761][   T58]  worker_thread+0x28c/0x394
[   11.511930][   T58]  kthread+0x1c0/0x204
[   11.512081][   T58]  ret_from_fork+0x10/0x20
[   11.512248][   T58] Code: a9017bfd f90013f5 a9034ff4 910043fd (f9400408) 
[   11.512506][   T58] ---[ end trace 0000000000000000 ]---

and

+ udevadm trigger '--action=add'
[  390.387986][  T394] Unable to handle kernel paging request at virtual address ffffbfe2ab25cc28
[  390.388207][  T394] Mem abort info:
[  390.388282][  T394]   ESR = 0x0000000096000007
[  390.388378][  T394]   EC = 0x25: DABT (current EL), IL = 32 bits
[  390.388506][  T394]   SET = 0, FnV = 0
[  390.388586][  T394]   EA = 0, S1PTW = 0
[  390.388669][  T394]   FSC = 0x07: level 3 translation fault
[  390.388787][  T394] Data abort info:
[  390.388862][  T394]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[  390.388990][  T394]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[  390.389137][  T394]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[  390.389367][  T394] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000008208c000
[  390.389650][  T394] [ffffbfe2ab25cc28] pgd=0000000000000000, p4d=1000000082a58003, pud=1000000082a59003, pmd=1000000082a5d003,
pte=0000000000000000
[  390.390173][  T394] Internal error: Oops: 0000000096000007 [#2] PREEMPT SMP
[  390.390426][  T394] Modules linked in:
[  390.390580][  T394] CPU: 7 UID: 0 PID: 394 Comm: udevadm Tainted: G      D         T  6.14.0-rc4-next-20250225+ #12
[  390.390969][  T394] Tainted: [D]=DIE, [T]=RANDSTRUCT
[  390.391153][  T394] Hardware name: Raven (DT)
[  390.391322][  T394] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  390.391612][  T394] pc : dev_uevent+0x144/0x2d8
[  390.391785][  T394] lr : kobject_uevent_env+0x1e0/0x3a8
[  390.391985][  T394] sp : ffff8000810fbb40
[  390.392137][  T394] x29: ffff8000810fbb60 x28: 0000000000000002 x27: ffffbfe2aa859240
[  390.392437][  T394] x26: ffffbfe2aae1ca12 x25: 0000000000000000 x24: ffff00ed41167540
[  390.392736][  T394] x23: ffff00ed41070000 x22: ffff8000810fbbf8 x21: 0000000000000000
[  390.393035][  T394] x20: ffff00ed41070000 x19: ffff00ed41083010 x18: 0000000000000000
[  390.393335][  T394] x17: 0000000000000000 x16: 0000000000000000 x15: 0000ffffc7e40360
[  390.393634][  T394] x14: 00000000ffffffd0 x13: aaaaaaaaaaaaaaaa x12: aaaaaaaaaaaa0000
[  390.393933][  T394] x11: 0000000000000000 x10: 0000000000000004 x9 : 3bc04d1231e6a100
[  390.394233][  T394] x8 : ffffbfe2ab25cc28 x7 : 3d4d455453595342 x6 : 4554535953425553
[  390.394532][  T394] x5 : ffff00ed4107026b x4 : ffffbfe2aae64508 x3 : ffffffffffff0a00
[  390.394831][  T394] x2 : 0000000000000000 x1 : ffff00ed41070000 x0 : ffff00ed41083010
[  390.395132][  T394] Call trace:
[  390.395252][  T394]  dev_uevent+0x144/0x2d8 (P)
[  390.395425][  T394]  kobject_uevent_env+0x1e0/0x3a8
[  390.395610][  T394]  kobject_synth_uevent+0x3ec/0x440
[  390.395802][  T394]  uevent_store+0x28/0x64
[  390.395962][  T394]  dev_attr_store+0x18/0x2c
[  390.396128][  T394]  sysfs_kf_write+0x80/0xa0
[  390.396295][  T394]  kernfs_fop_write_iter+0xdc/0x178
[  390.396488][  T394]  vfs_write+0x344/0x3a0
[  390.396644][  T394]  ksys_write+0x7c/0xe8
[  390.396797][  T394]  __arm64_sys_write+0x1c/0x28
[  390.396973][  T394]  invoke_syscall+0x40/0xf8
[  390.397139][  T394]  el0_svc_common+0xac/0xdc
[  390.397306][  T394]  do_el0_svc+0x1c/0x28
[  390.397459][  T394]  el0_svc+0x34/0x9c
[  390.397602][  T394]  el0t_64_sync_handler+0x84/0x108
[  390.397791][  T394]  el0t_64_sync+0x1a4/0x1a8
[  390.397963][  T394] Code: aa1403e0 94232d4d f9403668 b40000c8 (f9400102) 
[  390.398221][  T394] ---[ end trace 0000000000000000 ]---


Cheers,
Andre'
Krzysztof Kozlowski March 7, 2025, 3 p.m. UTC | #2
On 07/03/2025 15:29, André Draszik wrote:
> Hi Krzysztof,
> 
> Nice idea!
> 
> On Wed, 2025-03-05 at 22:43 +0100, Krzysztof Kozlowski wrote:
>> RFT/RFC because testing needed. I tried to do the same on exynos5-subcmu
>> and it caused weird oopses which even KASAN did not narrow. Probably
>> because of multiple exynos5-subcmu devices?
> 
> I've tried this on top of next-20250225, and it doesn't work on gs101
> either and OOPSes several times during boot in different places, but
> I can not dig deeper right now.
> 
> [   11.502919][   T58] Unable to handle kernel paging request at virtual address ffffbfe2ab25cc30

Thanks. I'll dig more once have a bit more time. The calltrace is
exactly what I saw with exynos5-subcmu and it puzzles me.

Best regards,
Krzysztof
Stephen Boyd March 7, 2025, 7:04 p.m. UTC | #3
Quoting André Draszik (2025-03-07 06:29:18)
> 
> I've tried this on top of next-20250225, and it doesn't work on gs101
> either and OOPSes several times during boot in different places, but
> I can not dig deeper right now.
> 
> [   11.502919][   T58] Unable to handle kernel paging request at virtual address ffffbfe2ab25cc30
> [   11.503128][   T58] Mem abort info:
> [   11.503202][   T58]   ESR = 0x0000000096000007
> [   11.503295][   T58]   EC = 0x25: DABT (current EL), IL = 32 bits
> [   11.503419][   T58]   SET = 0, FnV = 0
> [   11.503498][   T58]   EA = 0, S1PTW = 0
> [   11.503579][   T58]   FSC = 0x07: level 3 translation fault
> [   11.503695][   T58] Data abort info:
> [   11.503769][   T58]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
> [   11.503896][   T58]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> [   11.504058][   T58]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> [   11.504288][   T58] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000008208c000
> [   11.504570][   T58] [ffffbfe2ab25cc30] pgd=0000000000000000, p4d=1000000082a58003, pud=1000000082a59003, pmd=1000000082a5d003,
> pte=0000000000000000
> [   11.505079][   T58] Internal error: Oops: 0000000096000007 [#1] PREEMPT SMP
> [   11.505346][   T58] Modules linked in:
> [   11.505495][   T58] CPU: 6 UID: 0 PID: 58 Comm: kworker/u32:1 Tainted: G                T  6.14.0-rc4-next-20250225+ #12
> [   11.505902][   T58] Tainted: [T]=RANDSTRUCT
> [   11.506061][   T58] Hardware name: Raven (DT)
> [   11.506230][   T58] Workqueue: events_unbound deferred_probe_work_func
> [   11.506477][   T58] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [   11.506768][   T58] pc : __device_attach_driver+0x18/0x254
> [   11.506978][   T58] lr : bus_for_each_drv+0xfc/0x154
> [   11.507168][   T58] sp : ffff8000803abc00
> [   11.507321][   T58] x29: ffff8000803abc10 x28: ffff00ed403363d0 x27: ffff00ed40336400
> [   11.507620][   T58] x26: 0000000000000000 x25: ffff00ed4002380d x24: ffff00ed40028000
> [   11.507919][   T58] x23: ffffbfe2aba26000 x22: 0000000000000000 x21: ffff00ed409f8400
> [   11.508219][   T58] x20: ffff8000803abca8 x19: ffffbfe2a9a4cf4c x18: 0000000000000040
> [   11.508518][   T58] x17: 0000000000000001 x16: 0000000000000001 x15: 0000000000000010
> [   11.508817][   T58] x14: 0000000000000010 x13: 0000000000000093 x12: 0000000000000002
> [   11.509117][   T58] x11: ffffffffff6070d2 x10: 0000bef56a420260 x9 : 0000000100000000
> [   11.509416][   T58] x8 : 0000000100000000 x7 : ff7f7f7f7f7f7f7f x6 : 455242436f53531d
> [   11.509715][   T58] x5 : 1d53536f43425245 x4 : 0000000000000000 x3 : e8c6e6e4bec6c65a
> [   11.510015][   T58] x2 : 0000000000000062 x1 : ffff8000803abca8 x0 : ffffbfe2ab25cc28
> [   11.510315][   T58] Call trace:
> [   11.510436][   T58]  __device_attach_driver+0x18/0x254 (P)
> [   11.510644][   T58]  bus_for_each_drv+0xfc/0x154
> [   11.510819][   T58]  __device_attach+0x100/0x1cc
> [   11.510996][   T58]  device_initial_probe+0x14/0x20
> [   11.511182][   T58]  bus_probe_device+0x94/0x100
> [   11.511359][   T58]  deferred_probe_work_func+0xa0/0xfc

platform_driver_probe() is incompatible with deferred probe. It
should have set drv->prevent_deferred_probe to true so the driver must
have gotten onto the deferred probe list somehow when it shouldn't have.