[FE training-materials-updates] Misc minor slide updates

Michael Opdenacker michael.opdenacker at free-electrons.com
Wed Mar 9 14:39:22 CET 2016


Repository : git://git.free-electrons.com/training-materials.git
On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=545eaed464b1e517460b96227658cf06a0d6027f

>---------------------------------------------------------------

commit 545eaed464b1e517460b96227658cf06a0d6027f
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Wed Mar 9 14:38:57 2016 +0100

    Misc minor slide updates
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


>---------------------------------------------------------------

545eaed464b1e517460b96227658cf06a0d6027f
 slides/kernel-contribution/kernel-contribution.tex |  2 +-
 .../kernel-driver-development-debugging.tex        | 62 ++++++++++------------
 .../kernel-driver-development-memory.tex           | 52 +++++++++---------
 .../kernel-driver-development-sleeping.tex         | 52 +++++++++---------
 slides/kernel-frameworks2/kernel-frameworks2.tex   | 14 +++--
 slides/kernel-git-content/kernel-git-content.tex   |  2 +-
 .../kernel-power-management-content.tex            |  2 +-
 .../kernel-resources-references.tex                | 27 ++--------
 .../sysdev-linux-intro-configuration.tex           | 28 +++++-----
 slides/sysdev-references/sysdev-references.tex     |  7 ++-
 10 files changed, 112 insertions(+), 136 deletions(-)

diff --git a/slides/kernel-contribution/kernel-contribution.tex b/slides/kernel-contribution/kernel-contribution.tex
index 685dd06..542118f 100644
--- a/slides/kernel-contribution/kernel-contribution.tex
+++ b/slides/kernel-contribution/kernel-contribution.tex
@@ -61,7 +61,7 @@
       Patch} talk by Greg. K.H:
     \url{http://www.youtube.com/watch?v=LLBrBBImJt4}
   \item How to Participate in the Linux Community (by Jonathan
-    Corbet) A Guide To The Kernel Development Process
+    Corbet). A guide to the kernel development process
     \url{http://j.mp/tX2Ld6}
   \end{itemize}
 \end{frame}
diff --git a/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex b/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex
index 06bdc44..ec7ff23 100644
--- a/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex
+++ b/slides/kernel-driver-development-debugging/kernel-driver-development-debugging.tex
@@ -34,7 +34,7 @@
   \begin{itemize}
   \item When the driver is compiled with \code{DEBUG} defined, all
     these messages are compiled and printed at the debug level.
-    \code{DEBUG} can be defined by {\tt \#define DEBUG} at the
+    \code{DEBUG} can be defined by \codewithhash{\#define DEBUG} at the
     beginning of the driver, or using
     \code{ccflags-$(CONFIG_DRIVER) += -DDEBUG} in the \code{Makefile}
   \item When the kernel is compiled with \code{CONFIG_DYNAMIC_DEBUG},
@@ -129,19 +129,17 @@
 
 \begin{frame}
   \frametitle{Deprecated Debugging Mechanisms}
+  Some additional debugging mechanisms, whose usage is now
+  considered deprecated
   \begin{itemize}
-  \item Some additional debugging mechanisms, whose usage is now
-    considered deprecated
-    \begin{itemize}
-    \item Adding special \code{ioctl()} commands for debugging
-      purposes. DebugFS is preferred.
-    \item Adding special entries in the \code{proc} filesystem. DebugFS is
-      preferred.
-    \item Adding special entries in the \code{sysfs} filesystem. DebugFS is
-      preferred.
-    \item Using \kfunc{printk}. The \code{pr_*()} and \code{dev_*()}
-      functions are preferred.
-    \end{itemize}
+  \item Adding special \code{ioctl()} commands for debugging
+    purposes. DebugFS is preferred.
+  \item Adding special entries in the \code{proc} filesystem. DebugFS is
+    preferred.
+  \item Adding special entries in the \code{sysfs} filesystem. DebugFS is
+    preferred.
+  \item Using \kfunc{printk}. The \code{pr_*()} and \code{dev_*()}
+    functions are preferred.
   \end{itemize}
 \end{frame}
 
@@ -157,10 +155,11 @@
     \end{itemize}
   \item Example commands:
     \begin{itemize}
+    \item \code{s}: sync all mounted filesystems
+    \item \code{b}: reboot the system
     \item \code{n}: makes RT processes nice-able.
     \item \code{w}: shows the kernel stack of all sleeping processes
     \item \code{t}: shows the kernel stack of all running processes
-    \item \code{b}: reboot the system
     \item You can even register your own!
     \end{itemize}
   \item Detailed in \kerneldoc{sysrq.txt}
@@ -216,23 +215,21 @@
 
 \begin{frame}
   \frametitle{Debugging with a JTAG Interface}
+  Two types of JTAG dongles
   \begin{itemize}
-  \item Two types of JTAG dongles
-    \begin{itemize}
-    \item The ones offering a \code{gdb} compatible interface, over a
-      serial port or an Ethernet connection. \code{gdb} can directly
-      connect to them.
-    \item The ones not offering a gdb compatible interface are generally
-      supported by OpenOCD (Open On Chip Debugger):
-      \url{http://openocd.sourceforge.net/}
-      \begin{itemize}
-      \item OpenOCD is the bridge between the gdb debugging language
-        and the JTAG interface of the target CPU.
-      \item See the very complete documentation:
-        \url{http://openocd.org/documentation/}
-      \item For each board, you'll need an OpenOCD configuration file
-        (ask your supplier)
-      \end{itemize}
+  \item The ones offering a \code{gdb} compatible interface, over a
+    serial port or an Ethernet connection. \code{gdb} can directly
+    connect to them.
+  \item The ones not offering a gdb compatible interface are generally
+    supported by OpenOCD (Open On Chip Debugger):
+    \url{http://openocd.sourceforge.net/}
+    \begin{itemize}
+    \item OpenOCD is the bridge between the gdb debugging language
+      and the JTAG interface of the target CPU.
+    \item See the very complete documentation:
+      \url{http://openocd.org/documentation/}
+    \item For each board, you'll need an OpenOCD configuration file
+      (ask your supplier)
     \end{itemize}
   \end{itemize}
    \begin{center}
@@ -243,11 +240,10 @@
 \begin{frame}
   \frametitle{More Kernel Debugging Tips}
   \begin{itemize}
-  \item Enable \code{CONFIG_KALLSYMS_ALL}
+  \item Make sure \code{CONFIG_KALLSYMS_ALL} is enabled
     \begin{itemize}
-    \item \code{General Setup -> Configure standard kernel features}
+    \item Is turned on by default
     \item To get oops messages with symbol names instead of raw addresses
-    \item This obsoletes the \code{ksymoops} tool
     \end{itemize}
   \item On ARM, if your kernel doesn't boot or hangs without any
     message, you can activate early debugging options
diff --git a/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex b/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
index 7a2eaf7..3aed854 100644
--- a/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
+++ b/slides/kernel-driver-development-memory/kernel-driver-development-memory.tex
@@ -178,29 +178,27 @@
 
 \begin{frame}
   \frametitle{Page Allocator Flags}
+  The most common ones are:
   \begin{itemize}
-  \item The most common ones are:
+  \item \ksym{GFP_KERNEL}
     \begin{itemize}
-    \item \ksym{GFP_KERNEL}
-      \begin{itemize}
-      \item Standard kernel memory allocation. The allocation may
-        block in order to find enough available memory. Fine for most
-        needs, except in interrupt handler context.
-      \end{itemize}
-    \item \ksym{GFP_ATOMIC}
-      \begin{itemize}
-      \item RAM allocated from code which is not allowed to block
-        (interrupt handlers or critical sections). Never blocks,
-        allows to access emergency pools, but can fail if no free
-        memory is readily available.
-      \end{itemize}
-    \item \ksym{GFP_DMA}
-      \begin{itemize}
-      \item Allocates memory in an area of the physical memory usable
-        for DMA transfers. See our DMA chapter.
-      \end{itemize}
-    \item Others are defined in \kpath{include/linux/gfp.h}
+    \item Standard kernel memory allocation. The allocation may
+      block in order to find enough available memory. Fine for most
+      needs, except in interrupt handler context.
+    \end{itemize}
+  \item \ksym{GFP_ATOMIC}
+    \begin{itemize}
+    \item RAM allocated from code which is not allowed to block
+      (interrupt handlers or critical sections). Never blocks,
+      allows to access emergency pools, but can fail if no free
+      memory is readily available.
+    \end{itemize}
+  \item \ksym{GFP_DMA}
+    \begin{itemize}
+    \item Allocates memory in an area of the physical memory usable
+      for DMA transfers. See our DMA chapter.
     \end{itemize}
+  \item Others are defined in \kpath{include/linux/gfp.h}
   \end{itemize}
 \end{frame}
 
@@ -243,11 +241,11 @@
     \item SLOB: much simpler. More space efficient but doesn't scale
       well. Saves a few hundreds of KB in small systems (depends on
       \code{CONFIG_EXPERT}) \\
-      Linux 3.17 on ARM: used in 5 \code{defconfig} files
+      Linux 4.4 on ARM: used in 5 \code{defconfig} files
     \item SLUB: more recent and simpler than
       SLAB, scaling much better (in particular for huge systems) and
       creating less fragmentation.\\
-      Linux 3.17 on ARM: used in 0 \code{defconfig} files
+      Linux 4.4 on ARM: used in 0 \code{defconfig} files
     \end{itemize}
   \end{itemize}
   \begin{center}
@@ -328,14 +326,15 @@ kfree(work);
 
 \begin{frame}[fragile]
   \frametitle{devm\_ kmalloc functions}
+  \footnotesize
   \begin{itemize}
   \item Automatically free the allocated buffers when the
         corresponding device or module is unprobed.
   \item Need to have a reference to a \kstruct{device}.
-  \item {\footnotesize \mint{c}+void *devm_kmalloc(struct device *dev, size_t size, int flags);+}
-  \item {\footnotesize \mint{c}+void *devm_kzalloc(struct device *dev, size_t size, int flags);+}
-  \item {\scriptsize \mint{c}+void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_t flags);+}
-  \item {\small \mint{c}+void *devm_kfree(struct device *dev, void *p);+}
+  \item \mint{c}+void *devm_kmalloc(struct device *dev, size_t size, int flags);+
+  \item \mint{c}+void *devm_kzalloc(struct device *dev, size_t size, int flags);+
+  \item \mint{c}+void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_t flags);+
+  \item \mint{c}+void *devm_kfree(struct device *dev, void *p);+
         \begin{itemize}
         \item Useful to immediately free an allocated buffer
         \end{itemize}
@@ -357,6 +356,7 @@ kfree(work);
     since physical memory fragmentation is not an issue, but areas
     cannot be used for DMA, as DMA usually requires physically
     contiguous buffers.
+  \item Example use: to allocate kernel buffers to load module code.
   \item API in \kpath{include/linux/vmalloc.h}
     \begin{itemize}
     \item \mint{c}+void *vmalloc(unsigned long size);+
diff --git a/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex b/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex
index f6dca12..2ec20d7 100644
--- a/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex
+++ b/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex
@@ -35,25 +35,23 @@ init_waitqueue_head(&queue);
 
 \begin{frame}[fragile]
   \frametitle{How to sleep 2/3}
+  Several ways to make a kernel process sleep
   \begin{itemize}
-  \item Several ways to make a kernel process sleep
+  \item \mint{c}+void wait_event(queue, condition);+
     \begin{itemize}
-    \item \mint{c}+void wait_event(queue, condition);+
-      \begin{itemize}
-      \item Sleeps until the task is woken up and the given C
-        expression is true. Caution: can't be interrupted (can't kill
-        the user space process!)
-      \end{itemize}
-    \item \mint{c}+int wait_event_killable(queue, condition);+
-      \begin{itemize}
-      \item Can be interrupted, but only by a \emph{fatal} signal
-        (\ksym{SIGKILL}). Returns \code{-}\ksym{ERESTARSYS} if interrupted.
-      \end{itemize}
-    \item \mint{c}+int wait_event_interruptible(queue, condition);+
-      \begin{itemize}
-      \item Can be interrupted by any signal. Returns
-        \code{-}\ksym{ERESTARTSYS} if interrupted.
-      \end{itemize}
+    \item Sleeps until the task is woken up and the given C
+      expression is true. Caution: can't be interrupted (can't kill
+      the user space process!)
+    \end{itemize}
+  \item \mint{c}+int wait_event_killable(queue, condition);+
+    \begin{itemize}
+    \item Can be interrupted, but only by a \emph{fatal} signal
+      (\ksym{SIGKILL}). Returns \code{-}\ksym{ERESTARSYS} if interrupted.
+    \end{itemize}
+  \item \mint{c}+int wait_event_interruptible(queue, condition);+
+    \begin{itemize}
+    \item Can be interrupted by any signal. Returns
+      \code{-}\ksym{ERESTARTSYS} if interrupted.
     \end{itemize}
   \end{itemize}
 \end{frame}
@@ -93,19 +91,17 @@ if (ret)
 
 \begin{frame}
   \frametitle{Waking up!}
+  Typically done by interrupt handlers when data sleeping
+  processes are waiting for become available.
   \begin{itemize}
-  \item Typically done by interrupt handlers when data sleeping
-    processes are waiting for become available.
+  \item \code{wake_up(&queue);}
     \begin{itemize}
-    \item \code{wake_up(&queue);}
-      \begin{itemize}
-      \item Wakes up all processes in the wait queue
-      \end{itemize}
-    \item \code{wake_up_interruptible(&queue);}
-      \begin{itemize}
-      \item Wakes up all processes waiting in an interruptible sleep
-        on the given queue
-      \end{itemize}
+    \item Wakes up all processes in the wait queue
+    \end{itemize}
+  \item \code{wake_up_interruptible(&queue);}
+    \begin{itemize}
+    \item Wakes up all processes waiting in an interruptible sleep
+      on the given queue
     \end{itemize}
   \end{itemize}
 \end{frame}
diff --git a/slides/kernel-frameworks2/kernel-frameworks2.tex b/slides/kernel-frameworks2/kernel-frameworks2.tex
index 21a5b6c..b219584 100644
--- a/slides/kernel-frameworks2/kernel-frameworks2.tex
+++ b/slides/kernel-frameworks2/kernel-frameworks2.tex
@@ -88,7 +88,9 @@ struct file_operations {
       current position in the file \code{off}. \code{f} is a pointer
       to the same file structure that was passed in the \code{open()}
       operation
-    \item Must return the number of bytes read.
+    \item Must return the number of bytes read.\\
+	  \code{0} is usually interpreted by userspace as the end of
+          the file.
     \item On UNIX, \code{read()} operations typically block when there
       isn't enough data to read from the device
     \end{itemize}
@@ -119,10 +121,14 @@ struct file_operations {
     \item Doing so does not work on some architectures
     \item If the address passed by the application was invalid, the
       application would segfault.
+    \item {\bf Never} trust user space. A malicious application could
+      pass a kernel address which you could overwrite with device data
+      (\code{read} case), or which you could dump to the device
+      (\code{write} case). 
     \end{itemize}
-  \item To keep the kernel code portable and have proper error
-    handling, your driver must use special kernel functions to
-    exchange data with user space.
+  \item To keep the kernel code portable, secure, and have proper
+    error handling, your driver must use special kernel functions
+    to exchange data with user space.
   \end{itemize}
 \end{frame}
 
diff --git a/slides/kernel-git-content/kernel-git-content.tex b/slides/kernel-git-content/kernel-git-content.tex
index a46b750..f393998 100644
--- a/slides/kernel-git-content/kernel-git-content.tex
+++ b/slides/kernel-git-content/kernel-git-content.tex
@@ -236,7 +236,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
     by e-mail
   \item The first step is to generate the patches
     \begin{itemize}
-    \item \code{git format-patch -n master..<yourbranch>}
+    \item \code{git format-patch master..<yourbranch>}
     \item Will generate one patch for each of the commits done on
       \code{<yourbranch>}
     \item The patch files will be \code{0001-....}, \code{0002-....},
diff --git a/slides/kernel-power-management-content/kernel-power-management-content.tex b/slides/kernel-power-management-content/kernel-power-management-content.tex
index 2ebb37d..bc2b763 100644
--- a/slides/kernel-power-management-content/kernel-power-management-content.tex
+++ b/slides/kernel-power-management-content/kernel-power-management-content.tex
@@ -196,7 +196,7 @@
   \begin{itemize}
   \item Modern CPUs have several sleep states offering different
     power savings with associated wake up latencies
-  \item Since 2.6.21, the dynamic tick feature allows to remove the
+  \item The {\em dynamic tick} feature allows to remove the
     periodic tick to save power, and to know when the next event is
     scheduled, for smarter sleeps.
   \item CPUidle infrastructure to change sleep states
diff --git a/slides/kernel-resources-references/kernel-resources-references.tex b/slides/kernel-resources-references/kernel-resources-references.tex
index a29179f..00053db 100644
--- a/slides/kernel-resources-references/kernel-resources-references.tex
+++ b/slides/kernel-resources-references/kernel-resources-references.tex
@@ -37,27 +37,8 @@
   \frametitle{Useful Reading (2)}
   \begin{columns}
     \column{0.7\textwidth}
-    Writing Linux Device drivers, September 2009
-    \begin{itemize}
-    \item \url{http://www.coopj.com/}
-    \item Self published by Jerry Cooperstein
-    \item Available like any other book (Amazon and others)
-    \item Though not as thorough as the previous book on specific
-      drivers, still a good complement on multiple aspects of kernel
-      and device driver development.
-    \item Based on Linux 2.6.31
-    \item Multiple exercises. Updated solutions for 2.6.36.
-    \end{itemize}
-    \column{0.3\textwidth}
-    \includegraphics[width=\textwidth]{slides/kernel-resources-references/writing-linux-device-drivers.png}
-  \end{columns}
-\end{frame}
-
-\begin{frame}
-  \frametitle{Useful Reading (3)}
-  \begin{columns}
-    \column{0.7\textwidth}
-    Linux Device Drivers, 4th edition, December 2015 (estimated)
+    Linux Device Drivers, 4th edition, November 2017 (estimated, keeps
+    slipping!)
     \begin{itemize}
     \item \url{http://shop.oreilly.com/product/0636920030867.do}
     \item By Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman,
@@ -72,7 +53,7 @@
 \end{frame}
 
 \begin{frame}
-  \frametitle{Useful Reading (4)}
+  \frametitle{Useful Reading (3)}
   \begin{columns}
     \column{0.7\textwidth}
     \begin{itemize}
@@ -134,7 +115,7 @@
   \item Embedded Linux Conference: \url{http://embeddedlinuxconference.com/}
     \begin{itemize}
     \item Organized by the Linux Foundation:
-    \item in California (San Francisco, in the spring)
+    \item in California (in the spring)
     \item in Europe (October-November)
     \item Very interesting kernel and user space topics for embedded
       systems developers.
diff --git a/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex b/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex
index 3127bd1..1fe06c2 100644
--- a/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex
+++ b/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex
@@ -90,24 +90,22 @@
 
 \begin{frame}
   \frametitle{Kernel option types}
+  There are different types of options
   \begin{itemize}
-  \item There are different types of options
+  \item \code{bool} options, they are either
     \begin{itemize}
-    \item \code{bool} options, they are either
-      \begin{itemize}
-      \item {\em true} (to include the feature in the kernel) or
-      \item {\em false} (to exclude the feature from the kernel)
-      \end{itemize}
-    \item \code{tristate} options, they are either
-      \begin{itemize}
-      \item {\em true} (to include the feature in the kernel image) or
-      \item {\em module} (to include the feature as a kernel module) or
-      \item {\em false} (to exclude the feature)
-      \end{itemize}
-    \item \code{int} options, to specify integer values
-    \item \code{hex} options, to specify hexadecimal values
-    \item \code{string} options, to specify string values
+    \item {\em true} (to include the feature in the kernel) or
+    \item {\em false} (to exclude the feature from the kernel)
     \end{itemize}
+  \item \code{tristate} options, they are either
+    \begin{itemize}
+    \item {\em true} (to include the feature in the kernel image) or
+    \item {\em module} (to include the feature as a kernel module) or
+    \item {\em false} (to exclude the feature)
+    \end{itemize}
+  \item \code{int} options, to specify integer values
+  \item \code{hex} options, to specify hexadecimal values
+  \item \code{string} options, to specify string values
   \end{itemize}
 \end{frame}
 
diff --git a/slides/sysdev-references/sysdev-references.tex b/slides/sysdev-references/sysdev-references.tex
index 5b18705..3b9eaae 100644
--- a/slides/sysdev-references/sysdev-references.tex
+++ b/slides/sysdev-references/sysdev-references.tex
@@ -50,10 +50,9 @@
   Useful conferences featuring embedded Linux and kernel topics
   \begin{itemize}
   \item Embedded Linux Conference: \url{http://embeddedlinuxconference.com/}\\
-    Organized by the Linux Foundation: California (San Francisco,
-    Spring), in Europe (Fall).  Very interesting kernel and user space
-    topics for embedded systems developers.  Presentation slides
-    freely available
+    Organized by the Linux Foundation: California (Spring), in Europe (Fall).
+    Very interesting kernel and user space topics for embedded systems developers.
+    Presentation slides freely available
   \item Linux Plumbers, \url{http://linuxplumbersconf.org}\\
     Conference on the low-level plumbing of Linux: kernel, audio,
     power management, device management, multimedia, etc.




More information about the training-materials-updates mailing list