[bootlin/training-materials updates] master: printk: add some comment about behavior of format specifiers (5c33224a)
Clément Léger
clement.leger at bootlin.com
Mon Jun 6 17:44:08 CEST 2022
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/5c33224af9fb53c171ce80ef19e8e336f5b013fb
>---------------------------------------------------------------
commit 5c33224af9fb53c171ce80ef19e8e336f5b013fb
Author: Clément Léger <clement.leger at bootlin.com>
Date: Mon Jun 6 17:40:09 2022 +0200
printk: add some comment about behavior of format specifiers
New behavior can be a bit missleading, add more infiormations on
pointers display.
Signed-off-by: Clément Léger <clement.leger at bootlin.com>
>---------------------------------------------------------------
5c33224af9fb53c171ce80ef19e8e336f5b013fb
common/beamerthemeBootlin.sty | 5 +++--
common/printk.tex | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/common/beamerthemeBootlin.sty b/common/beamerthemeBootlin.sty
index 7f2c0bb4..a0df6e5a 100644
--- a/common/beamerthemeBootlin.sty
+++ b/common/beamerthemeBootlin.sty
@@ -44,9 +44,10 @@
\setbeamercolor{enumerate item}{fg=blorange}
% Custom Bootlin commands
-\newcommand{\code}[1]{{\usebeamercolor[fg]{code} \path{#1}}}
+\newcommand{\codecolor}{\usebeamercolor[fg]{code}}
+\newcommand{\code}[1]{{\codecolor \path{#1}}}
\newcommand{\codelink}[1]{{\usebeamercolor[fg]{darkblue} \path{#1}}}
-\newcommand{\codewithhash}[1]{{\usebeamercolor[fg]{code} \tt{#1}}}
+\newcommand{\codewithhash}[1]{{\codecolor \tt{#1}}}
\usepackage{listings}
\usepackage{environ}
diff --git a/common/printk.tex b/common/printk.tex
index 92c29c0b..3fd66b97 100644
--- a/common/printk.tex
+++ b/common/printk.tex
@@ -29,6 +29,29 @@ pr_info("Booting CPU %d\n", cpu);
\begin{frame}[fragile]
\frametitle{Debugging using messages (2)}
\begin{itemize}
+ \item The kernel defines much more format specifiers than the standard
+ \code{printf()} existing ones.
+ \begin{itemize}
+ % \path of package url directly supports percent characters, unless it is
+ % used inside arguments of other macros which is the case of the \code macro
+ \item {\codecolor \path{%p}}: Display the hashed value of pointer by default.
+ \item {\codecolor \path{%px}}: Always display the address of a pointer (use
+ carefully on non-sensitive addresses).
+ \item {\codecolor \path{%pK}}: Display hashed pointer value, zeros or the
+ pointer address depending on \code{kptr_restrict} sysctl value.
+ \item {\codecolor \path{%pOF}}: Device-tree node format specifier.
+ \item {\codecolor \path{%pr}}: Resource structure format specifier.
+ \item {\codecolor \path{%pa}}: Physical address display (work on all architectures 32/64
+ bits)
+ \end{itemize}
+ \item See \kdochtml{core-api/printk-formats} for an exhaustive list of supported format
+ specifiers
+ \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{Debugging using messages (3)}
+ \begin{itemize}
\item The \code{dev_*()} family of functions: \kfunc{dev_emerg},
\kfunc{dev_alert}, \kfunc{dev_crit}, \kfunc{dev_err},
\kfunc{dev_warn}, \kfunc{dev_notice}, \kfunc{dev_info} \\
More information about the training-materials-updates
mailing list