Skip to contentSkip to conversation

nvmem: rmem: Make reserved region name unique

PATCH Superseded Ivan T. Ivanov 3 participants 7 messages Apr 11, 2023 – Apr 13, 2023 NVMEM framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: rmem: Make reserved region name unique

They could be multiple reserved memory regions,
so let's make their names unique.

This fixes following kernel error:

[    9.831285] sysfs: cannot create duplicate filename '/bus/nvmem/devices/rmem0'
[    9.831304] CPU: 3 PID: 467 Comm: (udev-worker) Not tainted 6.2.9-1-default #1 openSUSE Tumbleweed a4aeb3a90c0f23041a8a7944b12739b07585f009
[    9.831326] Hardware name: raspberrypi rpi/rpi, BIOS 2023.01 01/01/2023
[    9.831335] Call trace:
[    9.831343]  dump_backtrace+0xe4/0x140
[    9.831366]  show_stack+0x20/0x30
[    9.831379]  dump_stack_lvl+0x64/0x80
[    9.831398]  dump_stack+0x18/0x34
[    9.831410]  sysfs_warn_dup+0x6c/0x90
[    9.831424]  sysfs_do_create_link_sd+0xf8/0x100
[    9.831437]  sysfs_create_link+0x28/0x50
[    9.831449]  bus_add_device+0x70/0x190
[    9.831468]  device_add+0x3e8/0x84c
[    9.831481]  nvmem_register+0x85c/0x9f0
[    9.831500]  devm_nvmem_register+0x24/0x70
[    9.831517]  rmem_probe+0xa0/0xf4 [nvmem_rmem 649243b01e5e28ee94e4dd53bd13b6ececa836f8]
[    9.831555]  platform_probe+0x70/0xd0
[    9.831566]  really_probe+0xc8/0x3e4
[    9.831582]  __driver_probe_device+0x84/0x190
[    9.831598]  driver_probe_device+0x44/0x11c
[    9.831613]  __driver_attach+0xf8/0x200
[    9.831629]  bus_for_each_dev+0x78/0xd0
[    9.831643]  driver_attach+0x2c/0x40
[    9.831657]  bus_add_driver+0x188/0x250
[    9.831672]  driver_register+0x80/0x13c
[    9.831688]  __platform_driver_register+0x30/0x40
[    9.831699]  rmem_driver_init+0x28/0x1000 [nvmem_rmem 649243b01e5e28ee94e4dd53bd13b6ececa836f8]
[    9.831727]  do_one_initcall+0x48/0x2bc
[    9.831740]  do_init_module+0x50/0x1f0
[    9.831753]  load_module+0x1e54/0x2250
[    9.831763]  __do_sys_init_module+0x2ac/0x2f0
[    9.831774]  __arm64_sys_init_module+0x24/0x30
[    9.831785]  invoke_syscall+0x78/0x100
[    9.831803]  el0_svc_common.constprop.0+0x15c/0x180
[    9.831820]  do_el0_svc+0x40/0xb0
[    9.831836]  el0_svc+0x34/0x134
[    9.831850]  el0t_64_sync_handler+0x114/0x120
[    9.831865]  el0t_64_sync+0x1a4/0x1a8
[    9.831956] rmem: probe of 3ef62ce0.nvram failed with error -17

Some background information about the issue could be found here:
https://bugzilla.suse.com/show_bug.cgi?id=1206846

---
 drivers/nvmem/rmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/rmem.c +1 -1
index 80cb187f1481..77c70a47d519 100644
@@ -70,7 +70,7 @@ static int rmem_probe(struct platform_device *pdev)
 
 	config.dev = dev;
 	config.priv = priv;
-	config.name = "rmem";
+	config.name = dev_name(dev);
 	config.size = mem->size;
 	config.reg_read = rmem_read;
 
Signature · 1 line
2.35.3
#1 lore raw
Quoted 6 lines · Ivan T. Ivanov

They could be multiple reserved memory regions,
so let's make their names unique.

This fixes following kernel error:

[    9.831285] sysfs: cannot create duplicate filename '/bus/nvmem/devices/rmem0'

Have you considered using NVMEM_DEVID_AUTO?

--srini

Quoted 60 lines
[    9.831304] CPU: 3 PID: 467 Comm: (udev-worker) Not tainted 6.2.9-1-default #1 openSUSE Tumbleweed a4aeb3a90c0f23041a8a7944b12739b07585f009
[    9.831326] Hardware name: raspberrypi rpi/rpi, BIOS 2023.01 01/01/2023
[    9.831335] Call trace:
[    9.831343]  dump_backtrace+0xe4/0x140
[    9.831366]  show_stack+0x20/0x30
[    9.831379]  dump_stack_lvl+0x64/0x80
[    9.831398]  dump_stack+0x18/0x34
[    9.831410]  sysfs_warn_dup+0x6c/0x90
[    9.831424]  sysfs_do_create_link_sd+0xf8/0x100
[    9.831437]  sysfs_create_link+0x28/0x50
[    9.831449]  bus_add_device+0x70/0x190
[    9.831468]  device_add+0x3e8/0x84c
[    9.831481]  nvmem_register+0x85c/0x9f0
[    9.831500]  devm_nvmem_register+0x24/0x70
[    9.831517]  rmem_probe+0xa0/0xf4 [nvmem_rmem 649243b01e5e28ee94e4dd53bd13b6ececa836f8]
[    9.831555]  platform_probe+0x70/0xd0
[    9.831566]  really_probe+0xc8/0x3e4
[    9.831582]  __driver_probe_device+0x84/0x190
[    9.831598]  driver_probe_device+0x44/0x11c
[    9.831613]  __driver_attach+0xf8/0x200
[    9.831629]  bus_for_each_dev+0x78/0xd0
[    9.831643]  driver_attach+0x2c/0x40
[    9.831657]  bus_add_driver+0x188/0x250
[    9.831672]  driver_register+0x80/0x13c
[    9.831688]  __platform_driver_register+0x30/0x40
[    9.831699]  rmem_driver_init+0x28/0x1000 [nvmem_rmem 649243b01e5e28ee94e4dd53bd13b6ececa836f8]
[    9.831727]  do_one_initcall+0x48/0x2bc
[    9.831740]  do_init_module+0x50/0x1f0
[    9.831753]  load_module+0x1e54/0x2250
[    9.831763]  __do_sys_init_module+0x2ac/0x2f0
[    9.831774]  __arm64_sys_init_module+0x24/0x30
[    9.831785]  invoke_syscall+0x78/0x100
[    9.831803]  el0_svc_common.constprop.0+0x15c/0x180
[    9.831820]  do_el0_svc+0x40/0xb0
[    9.831836]  el0_svc+0x34/0x134
[    9.831850]  el0t_64_sync_handler+0x114/0x120
[    9.831865]  el0t_64_sync+0x1a4/0x1a8
[    9.831956] rmem: probe of 3ef62ce0.nvram failed with error -17

Some background information about the issue could be found here:
https://bugzilla.suse.com/show_bug.cgi?id=1206846

---
  drivers/nvmem/rmem.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/rmem.c +1 -1
index 80cb187f1481..77c70a47d519 100644
@@ -70,7 +70,7 @@ static int rmem_probe(struct platform_device *pdev)
 
  	config.dev = dev;
  	config.priv = priv;
-	config.name = "rmem";
+	config.name = dev_name(dev);
  	config.size = mem->size;
  	config.reg_read = rmem_read;
 
#2 lore raw

Hi Srini,

Quoted 10 lines · Srinivas Kandagatla
Quoted 6 lines · Ivan T. Ivanov

They could be multiple reserved memory regions,
so let's make their names unique.

This fixes following kernel error:

[    9.831285] sysfs: cannot create duplicate filename '/bus/nvmem/devices/rmem0'

Have you considered using NVMEM_DEVID_AUTO?

Thanks, I missed this one. I will rework it and resend.

Regards,
Ivan

#3 lore raw
In reply to Ivan T. Ivanov

Hi Ivan,

Am 11.04.23 um 15:50 schrieb Ivan T. Ivanov:

Quoted 6 lines

They could be multiple reserved memory regions,
so let's make their names unique.

This fixes following kernel error:

[    9.831285] sysfs: cannot create duplicate filename '/bus/nvmem/devices/rmem0'

could you please provide more background information:

- are two instances of rmem trying to create this file?
- which exact platform is affect (Raspberry Pi 4), because the Hardware name from the trace is useless?
- could you provide some reliable scenario/config to reproduce this issue?

Quoted 52 lines
[    9.831304] CPU: 3 PID: 467 Comm: (udev-worker) Not tainted 6.2.9-1-default #1 openSUSE Tumbleweed a4aeb3a90c0f23041a8a7944b12739b07585f009
[    9.831326] Hardware name: raspberrypi rpi/rpi, BIOS 2023.01 01/01/2023
[    9.831335] Call trace:
[    9.831343]  dump_backtrace+0xe4/0x140
[    9.831366]  show_stack+0x20/0x30
[    9.831379]  dump_stack_lvl+0x64/0x80
[    9.831398]  dump_stack+0x18/0x34
[    9.831410]  sysfs_warn_dup+0x6c/0x90
[    9.831424]  sysfs_do_create_link_sd+0xf8/0x100
[    9.831437]  sysfs_create_link+0x28/0x50
[    9.831449]  bus_add_device+0x70/0x190
[    9.831468]  device_add+0x3e8/0x84c
[    9.831481]  nvmem_register+0x85c/0x9f0
[    9.831500]  devm_nvmem_register+0x24/0x70
[    9.831517]  rmem_probe+0xa0/0xf4 [nvmem_rmem 649243b01e5e28ee94e4dd53bd13b6ececa836f8]
[    9.831555]  platform_probe+0x70/0xd0
[    9.831566]  really_probe+0xc8/0x3e4
[    9.831582]  __driver_probe_device+0x84/0x190
[    9.831598]  driver_probe_device+0x44/0x11c
[    9.831613]  __driver_attach+0xf8/0x200
[    9.831629]  bus_for_each_dev+0x78/0xd0
[    9.831643]  driver_attach+0x2c/0x40
[    9.831657]  bus_add_driver+0x188/0x250
[    9.831672]  driver_register+0x80/0x13c
[    9.831688]  __platform_driver_register+0x30/0x40
[    9.831699]  rmem_driver_init+0x28/0x1000 [nvmem_rmem 649243b01e5e28ee94e4dd53bd13b6ececa836f8]
[    9.831727]  do_one_initcall+0x48/0x2bc
[    9.831740]  do_init_module+0x50/0x1f0
[    9.831753]  load_module+0x1e54/0x2250
[    9.831763]  __do_sys_init_module+0x2ac/0x2f0
[    9.831774]  __arm64_sys_init_module+0x24/0x30
[    9.831785]  invoke_syscall+0x78/0x100
[    9.831803]  el0_svc_common.constprop.0+0x15c/0x180
[    9.831820]  do_el0_svc+0x40/0xb0
[    9.831836]  el0_svc+0x34/0x134
[    9.831850]  el0t_64_sync_handler+0x114/0x120
[    9.831865]  el0t_64_sync+0x1a4/0x1a8
[    9.831956] rmem: probe of 3ef62ce0.nvram failed with error -17

Some background information about the issue could be found here:
https://bugzilla.suse.com/show_bug.cgi?id=1206846

---
  drivers/nvmem/rmem.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/rmem.c +0 -0
index 80cb187f1481..77c70a47d519 100644

drivers/nvmem/rmem.c static int rmem_probe(struct platform_device *pdev) · line 73

Quoted 5 lines
drivers/nvmem/rmem.c +1 -1
@@ -70,7 +70,7 @@ static int rmem_probe(struct platform_device *pdev)
 
  	config.dev = dev;
  	config.priv = priv;
-	config.name = "rmem";
+	config.name = dev_name(dev);

AFAIR changing userspace isn't great because application could rely on the filename prefix.

What is the result after applying this patch:

ls bus/nvmem/devices/rmem*

Quoted 3 lines
drivers/nvmem/rmem.c +0 -0
  	config.size = mem->size;
  	config.reg_read = rmem_read;
 
#4 lore raw

Hi Stefan,

Quoted 7 lines · Stefan Wahren

Am 11.04.23 um 15:50 schrieb Ivan T. Ivanov:

Quoted 5 lines

They could be multiple reserved memory regions,
so let's make their names unique.

This fixes following kernel error:

Quoted 8 lines
Quoted 1 line
[    9.831285] sysfs: cannot create duplicate filename '/bus/nvmem/devices/rmem0'

could you please provide more background information:

- are two instances of rmem trying to create this file?
- which exact platform is affect (Raspberry Pi 4), because the Hardware name from the trace is useless?
- could you provide some reliable scenario/config to reproduce this issue?

I was sure your will be asking. :-)

I am using RPi4[0] for testing this. Device tree is based on sources from here [1]. From this devicetree it is obvious what is happening.

Unfortunately right now SUSE Bugzilla is under maintenance, so perhaps you can't see the bug report [2]. In brief I am using latest Tumbleweed on this device and you can imagine that error is happening always.

Regards,
Ivan

[0] Raspberry Pi 4 Model B Rev 1.1
[1] https://github.com/raspberrypi/linux/blob/rpi-6.2.y/arch/arm/boot/dts/bcm2711-rpi.dtsi#L57
[2] https://bugzilla.suse.com/show_bug.cgi?id=1206846

#5 lore raw

Am 12.04.23 um 09:26 schrieb Ivan T. Ivanov:

Quoted 19 lines

Hi Stefan,

Quoted 7 lines · Stefan Wahren

Am 11.04.23 um 15:50 schrieb Ivan T. Ivanov:

Quoted 5 lines

They could be multiple reserved memory regions,
so let's make their names unique.

This fixes following kernel error:

Quoted 8 lines
Quoted 1 line
[    9.831285] sysfs: cannot create duplicate filename '/bus/nvmem/devices/rmem0'

could you please provide more background information:

- are two instances of rmem trying to create this file?
- which exact platform is affect (Raspberry Pi 4), because the Hardware name from the trace is useless?
- could you provide some reliable scenario/config to reproduce this issue?

Quoted 4 lines

I was sure your will be asking. :-)

I am using RPi4[0] for testing this. Device tree is based on sources from here [1]. From this devicetree it is obvious what is happening.

Thanks for clarifying. Unfortunately this file is not identical to the mainline file, so the issue can only be triggered with the vendor DTB?

Quoted 11 lines

Unfortunately right now SUSE Bugzilla is under maintenance, so perhaps you can't see the bug report [2]. In brief I am using latest Tumbleweed on this device and you can imagine that error is happening always.

Regards,
Ivan

[0] Raspberry Pi 4 Model B Rev 1.1
[1] https://github.com/raspberrypi/linux/blob/rpi-6.2.y/arch/arm/boot/dts/bcm2711-rpi.dtsi#L57
[2] https://bugzilla.suse.com/show_bug.cgi?id=1206846

#6 lore raw

Hi,

Quoted 7 lines · Stefan Wahren
Quoted 3 lines

I am using RPi4[0] for testing this. Device tree is based on sources from here [1]. From this devicetree it is obvious what is happening.

Thanks for clarifying. Unfortunately this file is not identical to the mainline file, so the issue can only be triggered with the vendor DTB?

Patch which adds this here [4] is coming ...

Regards,
Ivan

Quoted 3 lines
Quoted 3 lines

[0] Raspberry Pi 4 Model B Rev 1.1
[1] https://github.com/raspberrypi/linux/blob/rpi-6.2.y/arch/arm/boot/dts/bcm2711-rpi.dtsi#L57
[2] https://bugzilla.suse.com/show_bug.cgi?id=1206846

[4] https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/bcm2711-rpi.dtsi#L56