You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lkmpg.tex
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1575,7 +1575,7 @@ \section{System Calls}
1575
1575
In this case, thanks to Kprobes, a hook can be used instead on the system call entry to intercept the system call.
1576
1576
1577
1577
Note that all the related problems make syscall stealing unfeasible for production use.
1578
-
In order to keep people from doing potential harmful things \cpp|sys_call_table| is no longer exported.
1578
+
In order to keep people from doing potentially harmful things \cpp|sys_call_table| is no longer exported.
1579
1579
This means, if you want to do something more than a mere dry run of this example, you will have to patch your current kernel in order to have \cpp|sys_call_table| exported.
1580
1580
1581
1581
\samplec{examples/syscall-steal.c}
@@ -1745,7 +1745,7 @@ \subsection{Spinlocks}
1745
1745
Sometimes you may find comments in kernel source code stating that a function ``may sleep'', ``might sleep'', or more explicitly ``the caller should not hold a spinlock''.
1746
1746
Those comments are hints that a function may implicitly sleep and must not be called in atomic contexts.
1747
1747
1748
-
Now, let's differentiate between a few types of spinlock functions in Linux kernel: \cpp|spin_lock()|, \cpp|spin_lock_irq()|, \cpp|spin_lock_irqsave()|, and \cpp|spin_lock_bh()|.
1748
+
Now, let's differentiate between a few types of spinlock functions in the Linux kernel: \cpp|spin_lock()|, \cpp|spin_lock_irq()|, \cpp|spin_lock_irqsave()|, and \cpp|spin_lock_bh()|.
1749
1749
1750
1750
\cpp|spin_lock()| does not allow the CPU to sleep while waiting for the lock, which makes it suitable for most use cases where the critical section is short.
1751
1751
However, this is problematic for real-time Linux because spinlocks in this configuration behave as sleeping locks.
Before the C11 standard adopts the built-in atomic types, the kernel already provided a small set of atomic types by using a bunch of tricky architecture-specific codes.
1787
-
Implementing the atomic types by C11 atomics may allow the kernel to throw away the architecture-specific codes and letting the kernel code be more friendly to the people who understand the standard.
1786
+
Before the C11 standard adopted the built-in atomic types, the kernel already provided a small set of atomic types by using a bunch of tricky architecture-specific codes.
1787
+
Implementing the atomic types by C11 atomics may allow the kernel to throw away the architecture-specific codes and make the kernel code be more friendly to the people who understand the standard.
1788
1788
But there are some problems, such as the memory model of the kernel doesn't match the model formed by the C11 atomics.
1789
1789
For further details, see:
1790
1790
\begin{itemize}
@@ -2252,7 +2252,8 @@ \subsection{Likely and Unlikely conditions}
2252
2252
2253
2253
\subsection{Static keys}
2254
2254
\label{sec:static_keys}
2255
-
Static keys allow us to enable or disable kernel code paths based on the runtime state of key. Its APIs have been available since 2010 (most architectures are already supported), use self-modifying code to eliminate the overhead of cache and branch prediction.
2255
+
Static keys allow us to enable or disable kernel code paths based on the runtime state of a key.
2256
+
Their APIs have been available since 2010 (most architectures are already supported) and use self-modifying code to eliminate the overhead of cache and branch prediction.
2256
2257
The most typical use case of static keys is for performance-sensitive kernel code, such as tracepoints, context switching, networking, etc. These hot paths of the kernel often contain branches and can be optimized easily using this technique.
2257
2258
Before we can use static keys in the kernel, we need to make sure that gcc supports \cpp|asm goto| inline assembly, and the following kernel configurations are set:
2258
2259
@@ -2305,7 +2306,7 @@ \subsection{Static keys}
2305
2306
For more information, see \href{https://www.kernel.org/doc/Documentation/static-keys.txt}{Static keys}
0 commit comments