Skip to contentSkip to conversation

PM / EM: postpone creating the debugfs dir till fs_initcall

PATCH Applied Lukasz Luba 3 participants 5 messages Mar 23, 2021 – Mar 24, 2021

Subsystems (3)
lore
Share & tools
lore

Lukasz Luba

author maintainer
#0 lore raw

PATCH 1/1 PM / EM: postpone creating the debugfs dir till fs_initcall

The debugfs directory '/sys/kernel/debug/energy_model' is needed before the Energy Model registration can happen. With the recent change in debugfs subsystem it's not allowed to create this directory at early stage (core_initcall). Thus creating this directory would fail. Postpone the creation of the EM debug dir to later stage: fs_initcall. It should be safe since all clients: CPUFreq drivers, Devfreq drivers will be initialized in later stages.
The custom debug log below prints the time of creation the EM debug dir at fs_initcall and successful registration of EMs at later stages.

[    1.505717] energy_model: creating rootdir
[    3.698307] cpu cpu0: EM: created perf domain
[    3.709022] cpu cpu1: EM: created perf domain
Fixes 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized")

---
Hi Rafael,

Please take this patch into your PM v5.12 fixes. The change described in the patch above landed in v5.12-rc1. Some of our EAS/EM tests are failing.

Regards,
Lukasz

 kernel/power/energy_model.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/energy_model.c +1 -1
index 1358fa4abfa8..0f4530b3a8cd 100644
@@ -98,7 +98,7 @@ static int __init em_debug_init(void)
 
 	return 0;
 }
-core_initcall(em_debug_init);
+fs_initcall(em_debug_init);
 #else /* CONFIG_DEBUG_FS */
 static void em_debug_create_pd(struct device *dev) {}
 static void em_debug_remove_pd(struct device *dev) {}
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Lukasz Luba

The debugfs directory '/sys/kernel/debug/energy_model' is needed before the Energy Model registration can happen. With the recent change in debugfs subsystem it's not allowed to create this directory at early stage (core_initcall). Thus creating this directory would fail. Postpone the creation of the EM debug dir to later stage: fs_initcall. It should be safe since all clients: CPUFreq drivers, Devfreq drivers will be initialized in later stages.
The custom debug log below prints the time of creation the EM debug dir at fs_initcall and successful registration of EMs at later stages.

[    1.505717] energy_model: creating rootdir
[    3.698307] cpu cpu0: EM: created perf domain
[    3.709022] cpu cpu1: EM: created perf domain
Quoted 8 lines
Fixes 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized")

---
Hi Rafael,

Please take this patch into your PM v5.12 fixes. The change described in the patch above landed in v5.12-rc1. Some of our EAS/EM tests are failing.

author maintainer
#2 lore raw
Quoted 21 lines · Greg KH
Quoted 20 lines · Lukasz Luba

The debugfs directory '/sys/kernel/debug/energy_model' is needed before the Energy Model registration can happen. With the recent change in debugfs subsystem it's not allowed to create this directory at early stage (core_initcall). Thus creating this directory would fail. Postpone the creation of the EM debug dir to later stage: fs_initcall. It should be safe since all clients: CPUFreq drivers, Devfreq drivers will be initialized in later stages.
The custom debug log below prints the time of creation the EM debug dir at fs_initcall and successful registration of EMs at later stages.

[    1.505717] energy_model: creating rootdir
[    3.698307] cpu cpu0: EM: created perf domain
[    3.709022] cpu cpu1: EM: created perf domain
Fixes 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized")

---
Hi Rafael,

Quoted 5 lines
Quoted 2 lines

Please take this patch into your PM v5.12 fixes. The change described in the patch above landed in v5.12-rc1. Some of our EAS/EM tests are failing.

Thank you Greg!

Regards,
Lukasz

maintainer Applied
#3 lore raw
Quoted 25 lines · Lukasz Luba
Quoted 21 lines · Greg KH
Quoted 20 lines · Lukasz Luba

The debugfs directory '/sys/kernel/debug/energy_model' is needed before the Energy Model registration can happen. With the recent change in debugfs subsystem it's not allowed to create this directory at early stage (core_initcall). Thus creating this directory would fail. Postpone the creation of the EM debug dir to later stage: fs_initcall. It should be safe since all clients: CPUFreq drivers, Devfreq drivers will be initialized in later stages.
The custom debug log below prints the time of creation the EM debug dir at fs_initcall and successful registration of EMs at later stages.

[    1.505717] energy_model: creating rootdir
[    3.698307] cpu cpu0: EM: created perf domain
[    3.709022] cpu cpu1: EM: created perf domain
Fixes 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized")

---
Hi Rafael,

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Please take this patch into your PM v5.12 fixes. The change described in the patch above landed in v5.12-rc1. Some of our EAS/EM tests are failing.

Thank you Greg!

Applied as 5.12-rc material, thanks!

author maintainer
#4 lore raw
Quoted 29 lines · Rafael J. Wysocki
Quoted 28 lines · Lukasz Luba
Quoted 24 lines · Greg KH
Quoted 22 lines · Lukasz Luba

The debugfs directory '/sys/kernel/debug/energy_model' is needed before the Energy Model registration can happen. With the recent change in debugfs subsystem it's not allowed to create this directory at early stage (core_initcall). Thus creating this directory would fail. Postpone the creation of the EM debug dir to later stage: fs_initcall. It should be safe since all clients: CPUFreq drivers, Devfreq drivers will be initialized in later stages.
The custom debug log below prints the time of creation the EM debug dir at fs_initcall and successful registration of EMs at later stages.

[    1.505717] energy_model: creating rootdir
[    3.698307] cpu cpu0: EM: created perf domain
[    3.709022] cpu cpu1: EM: created perf domain
Fixes 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized")

---
Hi Rafael,

Please take this patch into your PM v5.12 fixes. The change described in the patch above landed in v5.12-rc1. Some of our EAS/EM tests are failing.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Thank you Greg!

Applied as 5.12-rc material, thanks!

Thank you Rafael!

Regards,
Lukasz