Skip to contentSkip to conversation

docs: clk: describe userspace debugging facilities

PATCH In review Yao Zi 2 participants 2 messages Nov 18, 2024 – Dec 3, 2024 Documentation

lore
Share & tools
lore

Yao Zi

author
#0 lore raw

PATCH 1/1 docs: clk: describe userspace debugging facilities

Starting from commit
03111b1088f1 ("clk: Add support for enabling/disabling clocks from debugfs"), it's possible to operate clocks from userspace through debugfs for testing purpose. This feature isn't provided as a Kconfig but rather a macro in source for security consideration, thus is hard to find.

Let's document the macro to ease everyone's life of clock debugging.

---
 Documentation/driver-api/clk.rst | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/driver-api/clk.rst +8 -0
index 93bab5336dfd..1787c07e8e19 100644
@@ -310,3 +310,11 @@ driver in that case.
 Note that locking must also be considered when code outside of the common
 clock framework needs to access resources used by the clock operations. This
 is considered out of scope of this document.
+
+Debug in Userspace
+==================
+
+The common clk framework creates read-only debugfs entries at
+``/sys/kernel/debug/clk``. For test and debug purpose, you could define
+``CLOCK_ALLOW_WRITE_DEBUGFS`` in ``drivers/clk/clk.c`` to make them writable.
+This may cause security problems and should *NEVER* be enabled on production.
Signature · 1 line
2.47.0
#1 lore raw

Quoting Yao Zi (2024-11-18 11:25:27)

Quoted 7 lines

Starting from commit
03111b1088f1 ("clk: Add support for enabling/disabling clocks from debugfs"), it's possible to operate clocks from userspace through debugfs for testing purpose. This feature isn't provided as a Kconfig but rather a macro in source for security consideration, thus is hard to find.

Let's document the macro to ease everyone's life of clock debugging.

Thanks for the patch. I don't want to advertise this anymore than it already is though so let's skip this patch.