\relax \providecommand\hyper@newdestlabel[2]{} \providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} \HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined \global\let\oldcontentsline\contentsline \gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} \global\let\oldnewlabel\newlabel \gdef\newlabel#1#2{\newlabelxx{#1}#2} \gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} \AtEndDocument{\ifx\hyper@anchor\@undefined \let\contentsline\oldcontentsline \let\newlabel\oldnewlabel \fi} \fi} \global\let\hyper@last\relax \gdef\HyperFirstAtBeginDocument#1{#1} \providecommand*\HyPL@Entry[1]{} \HyPL@Entry{0<>} \select@language{english} \@writefile{toc}{\select@language{english}} \@writefile{lof}{\select@language{english}} \@writefile{lot}{\select@language{english}} \HyPL@Entry{2<>} \HyPL@Entry{4<>} \newlabel{kernel-hacking/index::doc}{{}{1}{}{section*.2}{}} \@writefile{toc}{\contentsline {chapter}{\numberline {1}Unreliable Guide To Hacking The Linux Kernel}{1}{chapter.1}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \@writefile{loliteral-block}{\addvspace {10\p@ }} \newlabel{kernel-hacking/hacking:kernel-hacking-guides}{{1}{1}{Unreliable Guide To Hacking The Linux Kernel}{chapter.1}{}} \newlabel{kernel-hacking/hacking::doc}{{1}{1}{Unreliable Guide To Hacking The Linux Kernel}{chapter.1}{}} \newlabel{kernel-hacking/hacking:unreliable-guide-to-hacking-the-linux-kernel}{{1}{1}{Unreliable Guide To Hacking The Linux Kernel}{chapter.1}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.1}Introduction}{1}{section.1.1}} \newlabel{kernel-hacking/hacking:introduction}{{1.1}{1}{Introduction}{section.1.1}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.2}The Players}{1}{section.1.2}} \newlabel{kernel-hacking/hacking:the-players}{{1.2}{1}{The Players}{section.1.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.2.1}User Context}{1}{subsection.1.2.1}} \newlabel{kernel-hacking/hacking:user-context}{{1.2.1}{1}{User Context}{subsection.1.2.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.2.2}Hardware Interrupts (Hard IRQs)}{2}{subsection.1.2.2}} \newlabel{kernel-hacking/hacking:hardware-interrupts-hard-irqs}{{1.2.2}{2}{Hardware Interrupts (Hard IRQs)}{subsection.1.2.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.2.3}Software Interrupt Context: Softirqs and Tasklets}{2}{subsection.1.2.3}} \newlabel{kernel-hacking/hacking:software-interrupt-context-softirqs-and-tasklets}{{1.2.3}{2}{Software Interrupt Context: Softirqs and Tasklets}{subsection.1.2.3}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.3}Some Basic Rules}{3}{section.1.3}} \newlabel{kernel-hacking/hacking:some-basic-rules}{{1.3}{3}{Some Basic Rules}{section.1.3}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.4}ioctls: Not writing a new system call}{3}{section.1.4}} \newlabel{kernel-hacking/hacking:ioctls-not-writing-a-new-system-call}{{1.4}{3}{ioctls: Not writing a new system call}{section.1.4}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.5}Recipes for Deadlock}{4}{section.1.5}} \newlabel{kernel-hacking/hacking:recipes-for-deadlock}{{1.5}{4}{Recipes for Deadlock}{section.1.5}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.6}Common Routines}{4}{section.1.6}} \newlabel{kernel-hacking/hacking:common-routines}{{1.6}{4}{Common Routines}{section.1.6}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.1}\texttt {printk()}}{4}{subsection.1.6.1}} \newlabel{kernel-hacking/hacking:printk}{{1.6.1}{4}{\texttt {printk()}}{subsection.1.6.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.2}\texttt {copy\_to\_user()} / \texttt {copy\_from\_user()} / \texttt {get\_user()} / \texttt {put\_user()}}{4}{subsection.1.6.2}} \newlabel{kernel-hacking/hacking:copy-to-user-copy-from-user-get-user-put-user}{{1.6.2}{4}{\texttt {copy\_to\_user()} / \texttt {copy\_from\_user()} / \texttt {get\_user()} / \texttt {put\_user()}}{subsection.1.6.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.3}\texttt {kmalloc()}/\texttt {kfree()}}{5}{subsection.1.6.3}} \newlabel{kernel-hacking/hacking:kmalloc-kfree}{{1.6.3}{5}{\texttt {kmalloc()}/\texttt {kfree()}}{subsection.1.6.3}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.4}\texttt {current()}}{5}{subsection.1.6.4}} \newlabel{kernel-hacking/hacking:current}{{1.6.4}{5}{\texttt {current()}}{subsection.1.6.4}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.5}\texttt {mdelay()}/\texttt {udelay()}}{6}{subsection.1.6.5}} \newlabel{kernel-hacking/hacking:mdelay-udelay}{{1.6.5}{6}{\texttt {mdelay()}/\texttt {udelay()}}{subsection.1.6.5}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.6}\texttt {cpu\_to\_be32()}/\texttt {be32\_to\_cpu()}/\texttt {cpu\_to\_le32()}/\texttt {le32\_to\_cpu()}}{6}{subsection.1.6.6}} \newlabel{kernel-hacking/hacking:cpu-to-be32-be32-to-cpu-cpu-to-le32-le32-to-cpu}{{1.6.6}{6}{\texttt {cpu\_to\_be32()}/\texttt {be32\_to\_cpu()}/\texttt {cpu\_to\_le32()}/\texttt {le32\_to\_cpu()}}{subsection.1.6.6}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.7}\texttt {local\_irq\_save()}/\texttt {local\_irq\_restore()}}{6}{subsection.1.6.7}} \newlabel{kernel-hacking/hacking:local-irq-save-local-irq-restore}{{1.6.7}{6}{\texttt {local\_irq\_save()}/\texttt {local\_irq\_restore()}}{subsection.1.6.7}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.8}\texttt {local\_bh\_disable()}/\texttt {local\_bh\_enable()}}{6}{subsection.1.6.8}} \newlabel{kernel-hacking/hacking:local-bh-disable}{{1.6.8}{6}{\texttt {local\_bh\_disable()}/\texttt {local\_bh\_enable()}}{subsection.1.6.8}{}} \newlabel{kernel-hacking/hacking:local-bh-disable-local-bh-enable}{{1.6.8}{6}{\texttt {local\_bh\_disable()}/\texttt {local\_bh\_enable()}}{subsection.1.6.8}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.9}\texttt {smp\_processor\_id()}}{6}{subsection.1.6.9}} \newlabel{kernel-hacking/hacking:smp-processor-id}{{1.6.9}{6}{\texttt {smp\_processor\_id()}}{subsection.1.6.9}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.10}\texttt {\_\_init}/\texttt {\_\_exit}/\texttt {\_\_initdata}}{6}{subsection.1.6.10}} \newlabel{kernel-hacking/hacking:init-exit-initdata}{{1.6.10}{6}{\texttt {\_\_init}/\texttt {\_\_exit}/\texttt {\_\_initdata}}{subsection.1.6.10}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.11}\texttt {\_\_initcall()}/\texttt {module\_init()}}{7}{subsection.1.6.11}} \newlabel{kernel-hacking/hacking:initcall-module-init}{{1.6.11}{7}{\texttt {\_\_initcall()}/\texttt {module\_init()}}{subsection.1.6.11}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.12}\texttt {module\_exit()}}{7}{subsection.1.6.12}} \newlabel{kernel-hacking/hacking:module-exit}{{1.6.12}{7}{\texttt {module\_exit()}}{subsection.1.6.12}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.6.13}\texttt {try\_module\_get()}/\texttt {module\_put()}}{7}{subsection.1.6.13}} \newlabel{kernel-hacking/hacking:try-module-get-module-put}{{1.6.13}{7}{\texttt {try\_module\_get()}/\texttt {module\_put()}}{subsection.1.6.13}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.7}Wait Queues \texttt {include/linux/wait.h}}{7}{section.1.7}} \newlabel{kernel-hacking/hacking:wait-queues-include-linux-wait-h}{{1.7}{7}{Wait Queues \texttt {include/linux/wait.h}}{section.1.7}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.7.1}Declaring}{7}{subsection.1.7.1}} \newlabel{kernel-hacking/hacking:declaring}{{1.7.1}{7}{Declaring}{subsection.1.7.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.7.2}Queuing}{8}{subsection.1.7.2}} \newlabel{kernel-hacking/hacking:queuing}{{1.7.2}{8}{Queuing}{subsection.1.7.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.7.3}Waking Up Queued Tasks}{8}{subsection.1.7.3}} \newlabel{kernel-hacking/hacking:waking-up-queued-tasks}{{1.7.3}{8}{Waking Up Queued Tasks}{subsection.1.7.3}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.8}Atomic Operations}{8}{section.1.8}} \newlabel{kernel-hacking/hacking:atomic-operations}{{1.8}{8}{Atomic Operations}{section.1.8}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.9}Symbols}{8}{section.1.9}} \newlabel{kernel-hacking/hacking:symbols}{{1.9}{8}{Symbols}{section.1.9}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.9.1}\texttt {EXPORT\_SYMBOL()}}{8}{subsection.1.9.1}} \newlabel{kernel-hacking/hacking:export-symbol}{{1.9.1}{8}{\texttt {EXPORT\_SYMBOL()}}{subsection.1.9.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.9.2}\texttt {EXPORT\_SYMBOL\_GPL()}}{8}{subsection.1.9.2}} \newlabel{kernel-hacking/hacking:export-symbol-gpl}{{1.9.2}{8}{\texttt {EXPORT\_SYMBOL\_GPL()}}{subsection.1.9.2}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.10}Routines and Conventions}{9}{section.1.10}} \newlabel{kernel-hacking/hacking:routines-and-conventions}{{1.10}{9}{Routines and Conventions}{section.1.10}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.1}Double-linked lists \texttt {include/linux/list.h}}{9}{subsection.1.10.1}} \newlabel{kernel-hacking/hacking:double-linked-lists-include-linux-list-h}{{1.10.1}{9}{Double-linked lists \texttt {include/linux/list.h}}{subsection.1.10.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.2}Return Conventions}{9}{subsection.1.10.2}} \newlabel{kernel-hacking/hacking:return-conventions}{{1.10.2}{9}{Return Conventions}{subsection.1.10.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.3}Breaking Compilation}{9}{subsection.1.10.3}} \newlabel{kernel-hacking/hacking:breaking-compilation}{{1.10.3}{9}{Breaking Compilation}{subsection.1.10.3}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.4}Initializing structure members}{9}{subsection.1.10.4}} \newlabel{kernel-hacking/hacking:initializing-structure-members}{{1.10.4}{9}{Initializing structure members}{subsection.1.10.4}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.5}GNU Extensions}{9}{subsection.1.10.5}} \newlabel{kernel-hacking/hacking:gnu-extensions}{{1.10.5}{9}{GNU Extensions}{subsection.1.10.5}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.6}C++}{10}{subsection.1.10.6}} \newlabel{kernel-hacking/hacking:c}{{1.10.6}{10}{C++}{subsection.1.10.6}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.10.7}NUMif}{10}{subsection.1.10.7}} \newlabel{kernel-hacking/hacking:numif}{{1.10.7}{10}{NUMif}{subsection.1.10.7}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.11}Putting Your Stuff in the Kernel}{10}{section.1.11}} \newlabel{kernel-hacking/hacking:putting-your-stuff-in-the-kernel}{{1.11}{10}{Putting Your Stuff in the Kernel}{section.1.11}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.12}Kernel Cantrips}{11}{section.1.12}} \newlabel{kernel-hacking/hacking:kernel-cantrips}{{1.12}{11}{Kernel Cantrips}{section.1.12}{}} \@writefile{toc}{\contentsline {section}{\numberline {1.13}Thanks}{12}{section.1.13}} \newlabel{kernel-hacking/hacking:thanks}{{1.13}{12}{Thanks}{section.1.13}{}} \@writefile{toc}{\contentsline {chapter}{\numberline {2}Unreliable Guide To Locking}{13}{chapter.2}} \@writefile{lof}{\addvspace {10\p@ }} \@writefile{lot}{\addvspace {10\p@ }} \@writefile{loliteral-block}{\addvspace {10\p@ }} \newlabel{kernel-hacking/locking::doc}{{2}{13}{Unreliable Guide To Locking}{chapter.2}{}} \newlabel{kernel-hacking/locking:unreliable-guide-to-locking}{{2}{13}{Unreliable Guide To Locking}{chapter.2}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.1}Introduction}{13}{section.2.1}} \newlabel{kernel-hacking/locking:introduction}{{2.1}{13}{Introduction}{section.2.1}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.2}The Problem With Concurrency}{13}{section.2.2}} \newlabel{kernel-hacking/locking:the-problem-with-concurrency}{{2.2}{13}{The Problem With Concurrency}{section.2.2}{}} \@writefile{lot}{\contentsline {table}{\numberline {2.1}{\ignorespaces Expected Results}}{13}{table.2.1}} \newlabel{kernel-hacking/locking:id1}{{2.1}{13}{Expected Results}{table.2.1}{}} \@writefile{lot}{\contentsline {table}{\numberline {2.2}{\ignorespaces Possible Results}}{13}{table.2.2}} \newlabel{kernel-hacking/locking:id2}{{2.2}{13}{Possible Results}{table.2.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Race Conditions and Critical Regions}{14}{subsection.2.2.1}} \newlabel{kernel-hacking/locking:race-conditions-and-critical-regions}{{2.2.1}{14}{Race Conditions and Critical Regions}{subsection.2.2.1}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.3}Locking in the Linux Kernel}{14}{section.2.3}} \newlabel{kernel-hacking/locking:locking-in-the-linux-kernel}{{2.3}{14}{Locking in the Linux Kernel}{section.2.3}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.1}Two Main Types of Kernel Locks: Spinlocks and Mutexes}{14}{subsection.2.3.1}} \newlabel{kernel-hacking/locking:two-main-types-of-kernel-locks-spinlocks-and-mutexes}{{2.3.1}{14}{Two Main Types of Kernel Locks: Spinlocks and Mutexes}{subsection.2.3.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.2}Locks and Uniprocessor Kernels}{14}{subsection.2.3.2}} \newlabel{kernel-hacking/locking:locks-and-uniprocessor-kernels}{{2.3.2}{14}{Locks and Uniprocessor Kernels}{subsection.2.3.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.3}Locking Only In User Context}{15}{subsection.2.3.3}} \newlabel{kernel-hacking/locking:locking-only-in-user-context}{{2.3.3}{15}{Locking Only In User Context}{subsection.2.3.3}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.4}Locking Between User Context and Softirqs}{15}{subsection.2.3.4}} \newlabel{kernel-hacking/locking:locking-between-user-context-and-softirqs}{{2.3.4}{15}{Locking Between User Context and Softirqs}{subsection.2.3.4}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.5}Locking Between User Context and Tasklets}{15}{subsection.2.3.5}} \newlabel{kernel-hacking/locking:locking-between-user-context-and-tasklets}{{2.3.5}{15}{Locking Between User Context and Tasklets}{subsection.2.3.5}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.6}Locking Between User Context and Timers}{15}{subsection.2.3.6}} \newlabel{kernel-hacking/locking:locking-between-user-context-and-timers}{{2.3.6}{15}{Locking Between User Context and Timers}{subsection.2.3.6}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.7}Locking Between Tasklets/Timers}{15}{subsection.2.3.7}} \newlabel{kernel-hacking/locking:locking-between-tasklets-timers}{{2.3.7}{15}{Locking Between Tasklets/Timers}{subsection.2.3.7}{}} \@writefile{toc}{\contentsline {subsubsection}{The Same Tasklet/Timer}{15}{subsubsection*.3}} \newlabel{kernel-hacking/locking:the-same-tasklet-timer}{{2.3.7}{15}{The Same Tasklet/Timer}{subsubsection*.3}{}} \@writefile{toc}{\contentsline {subsubsection}{Different Tasklets/Timers}{15}{subsubsection*.4}} \newlabel{kernel-hacking/locking:different-tasklets-timers}{{2.3.7}{15}{Different Tasklets/Timers}{subsubsection*.4}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.3.8}Locking Between Softirqs}{15}{subsection.2.3.8}} \newlabel{kernel-hacking/locking:locking-between-softirqs}{{2.3.8}{15}{Locking Between Softirqs}{subsection.2.3.8}{}} \@writefile{toc}{\contentsline {subsubsection}{The Same Softirq}{16}{subsubsection*.5}} \newlabel{kernel-hacking/locking:the-same-softirq}{{2.3.8}{16}{The Same Softirq}{subsubsection*.5}{}} \@writefile{toc}{\contentsline {subsubsection}{Different Softirqs}{16}{subsubsection*.6}} \newlabel{kernel-hacking/locking:different-softirqs}{{2.3.8}{16}{Different Softirqs}{subsubsection*.6}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.4}Hard IRQ Context}{16}{section.2.4}} \newlabel{kernel-hacking/locking:hard-irq-context}{{2.4}{16}{Hard IRQ Context}{section.2.4}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.4.1}Locking Between Hard IRQ and Softirqs/Tasklets}{16}{subsection.2.4.1}} \newlabel{kernel-hacking/locking:locking-between-hard-irq-and-softirqs-tasklets}{{2.4.1}{16}{Locking Between Hard IRQ and Softirqs/Tasklets}{subsection.2.4.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.4.2}Locking Between Two Hard IRQ Handlers}{16}{subsection.2.4.2}} \newlabel{kernel-hacking/locking:locking-between-two-hard-irq-handlers}{{2.4.2}{16}{Locking Between Two Hard IRQ Handlers}{subsection.2.4.2}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.5}Cheat Sheet For Locking}{16}{section.2.5}} \newlabel{kernel-hacking/locking:cheat-sheet-for-locking}{{2.5}{16}{Cheat Sheet For Locking}{section.2.5}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.5.1}Table of Minimum Requirements}{17}{subsection.2.5.1}} \newlabel{kernel-hacking/locking:table-of-minimum-requirements}{{2.5.1}{17}{Table of Minimum Requirements}{subsection.2.5.1}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.6}The trylock Functions}{17}{section.2.6}} \newlabel{kernel-hacking/locking:the-trylock-functions}{{2.6}{17}{The trylock Functions}{section.2.6}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.7}Common Examples}{18}{section.2.7}} \newlabel{kernel-hacking/locking:common-examples}{{2.7}{18}{Common Examples}{section.2.7}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.7.1}All In User Context}{18}{subsection.2.7.1}} \newlabel{kernel-hacking/locking:all-in-user-context}{{2.7.1}{18}{All In User Context}{subsection.2.7.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.7.2}Accessing From Interrupt Context}{19}{subsection.2.7.2}} \newlabel{kernel-hacking/locking:accessing-from-interrupt-context}{{2.7.2}{19}{Accessing From Interrupt Context}{subsection.2.7.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.7.3}Exposing Objects Outside This File}{21}{subsection.2.7.3}} \newlabel{kernel-hacking/locking:exposing-objects-outside-this-file}{{2.7.3}{21}{Exposing Objects Outside This File}{subsection.2.7.3}{}} \@writefile{toc}{\contentsline {subsubsection}{Using Atomic Operations For The Reference Count}{22}{subsubsection*.7}} \newlabel{kernel-hacking/locking:using-atomic-operations-for-the-reference-count}{{2.7.3}{22}{Using Atomic Operations For The Reference Count}{subsubsection*.7}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.7.4}Protecting The Objects Themselves}{24}{subsection.2.7.4}} \newlabel{kernel-hacking/locking:protecting-the-objects-themselves}{{2.7.4}{24}{Protecting The Objects Themselves}{subsection.2.7.4}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.8}Common Problems}{25}{section.2.8}} \newlabel{kernel-hacking/locking:common-problems}{{2.8}{25}{Common Problems}{section.2.8}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.8.1}Deadlock: Simple and Advanced}{25}{subsection.2.8.1}} \newlabel{kernel-hacking/locking:deadlock-simple-and-advanced}{{2.8.1}{25}{Deadlock: Simple and Advanced}{subsection.2.8.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.8.2}Preventing Deadlock}{26}{subsection.2.8.2}} \newlabel{kernel-hacking/locking:preventing-deadlock}{{2.8.2}{26}{Preventing Deadlock}{subsection.2.8.2}{}} \@writefile{toc}{\contentsline {subsubsection}{Overzealous Prevention Of Deadlocks}{26}{subsubsection*.8}} \newlabel{kernel-hacking/locking:overzealous-prevention-of-deadlocks}{{2.8.2}{26}{Overzealous Prevention Of Deadlocks}{subsubsection*.8}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.8.3}Racing Timers: A Kernel Pastime}{26}{subsection.2.8.3}} \newlabel{kernel-hacking/locking:racing-timers-a-kernel-pastime}{{2.8.3}{26}{Racing Timers: A Kernel Pastime}{subsection.2.8.3}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.9}Locking Speed}{27}{section.2.9}} \newlabel{kernel-hacking/locking:locking-speed}{{2.9}{27}{Locking Speed}{section.2.9}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.9.1}Read/Write Lock Variants}{27}{subsection.2.9.1}} \newlabel{kernel-hacking/locking:read-write-lock-variants}{{2.9.1}{27}{Read/Write Lock Variants}{subsection.2.9.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.9.2}Avoiding Locks: Read Copy Update}{27}{subsection.2.9.2}} \newlabel{kernel-hacking/locking:avoiding-locks-read-copy-update}{{2.9.2}{27}{Avoiding Locks: Read Copy Update}{subsection.2.9.2}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.9.3}Per-CPU Data}{30}{subsection.2.9.3}} \newlabel{kernel-hacking/locking:per-cpu-data}{{2.9.3}{30}{Per-CPU Data}{subsection.2.9.3}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.9.4}Data Which Mostly Used By An IRQ Handler}{30}{subsection.2.9.4}} \newlabel{kernel-hacking/locking:data-which-mostly-used-by-an-irq-handler}{{2.9.4}{30}{Data Which Mostly Used By An IRQ Handler}{subsection.2.9.4}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.10}What Functions Are Safe To Call From Interrupts?}{30}{section.2.10}} \newlabel{kernel-hacking/locking:what-functions-are-safe-to-call-from-interrupts}{{2.10}{30}{What Functions Are Safe To Call From Interrupts?}{section.2.10}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.10.1}Some Functions Which Sleep}{30}{subsection.2.10.1}} \newlabel{kernel-hacking/locking:some-functions-which-sleep}{{2.10.1}{30}{Some Functions Which Sleep}{subsection.2.10.1}{}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.10.2}Some Functions Which Don't Sleep}{31}{subsection.2.10.2}} \newlabel{kernel-hacking/locking:some-functions-which-don-t-sleep}{{2.10.2}{31}{Some Functions Which Don't Sleep}{subsection.2.10.2}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.11}Mutex API reference}{31}{section.2.11}} \newlabel{kernel-hacking/locking:mutex-api-reference}{{2.11}{31}{Mutex API reference}{section.2.11}{}} \newlabel{kernel-hacking/locking:c.mutex_init}{{2.11}{31}{Mutex API reference}{section*.9}{}} \newlabel{kernel-hacking/locking:c.mutex_is_locked}{{2.11}{31}{Mutex API reference}{section*.10}{}} \newlabel{kernel-hacking/locking:c.mutex_trylock_recursive}{{2.11}{31}{Mutex API reference}{section*.11}{}} \newlabel{kernel-hacking/locking:c.mutex_lock}{{2.11}{32}{Mutex API reference}{section*.12}{}} \newlabel{kernel-hacking/locking:c.mutex_unlock}{{2.11}{32}{Mutex API reference}{section*.13}{}} \newlabel{kernel-hacking/locking:c.ww_mutex_unlock}{{2.11}{32}{Mutex API reference}{section*.14}{}} \newlabel{kernel-hacking/locking:c.mutex_lock_interruptible}{{2.11}{32}{Mutex API reference}{section*.15}{}} \newlabel{kernel-hacking/locking:c.mutex_trylock}{{2.11}{32}{Mutex API reference}{section*.16}{}} \newlabel{kernel-hacking/locking:c.atomic_dec_and_mutex_lock}{{2.11}{33}{Mutex API reference}{section*.17}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.12}Futex API reference}{33}{section.2.12}} \newlabel{kernel-hacking/locking:futex-api-reference}{{2.12}{33}{Futex API reference}{section.2.12}{}} \newlabel{kernel-hacking/locking:c.futex_q}{{2.12}{33}{Futex API reference}{section*.18}{}} \newlabel{kernel-hacking/locking:c.hash_futex}{{2.12}{34}{Futex API reference}{section*.19}{}} \newlabel{kernel-hacking/locking:c.match_futex}{{2.12}{34}{Futex API reference}{section*.20}{}} \newlabel{kernel-hacking/locking:c.get_futex_key}{{2.12}{34}{Futex API reference}{section*.21}{}} \newlabel{kernel-hacking/locking:c.fault_in_user_writeable}{{2.12}{34}{Futex API reference}{section*.22}{}} \newlabel{kernel-hacking/locking:c.futex_top_waiter}{{2.12}{34}{Futex API reference}{section*.23}{}} \newlabel{kernel-hacking/locking:c.futex_lock_pi_atomic}{{2.12}{35}{Futex API reference}{section*.24}{}} \newlabel{kernel-hacking/locking:c.__unqueue_futex}{{2.12}{35}{Futex API reference}{section*.25}{}} \newlabel{kernel-hacking/locking:c.requeue_futex}{{2.12}{35}{Futex API reference}{section*.26}{}} \newlabel{kernel-hacking/locking:c.requeue_pi_wake_futex}{{2.12}{35}{Futex API reference}{section*.27}{}} \newlabel{kernel-hacking/locking:c.futex_proxy_trylock_atomic}{{2.12}{36}{Futex API reference}{section*.28}{}} \newlabel{kernel-hacking/locking:c.futex_requeue}{{2.12}{36}{Futex API reference}{section*.29}{}} \newlabel{kernel-hacking/locking:c.queue_me}{{2.12}{37}{Futex API reference}{section*.30}{}} \newlabel{kernel-hacking/locking:c.unqueue_me}{{2.12}{37}{Futex API reference}{section*.31}{}} \newlabel{kernel-hacking/locking:c.fixup_owner}{{2.12}{37}{Futex API reference}{section*.32}{}} \newlabel{kernel-hacking/locking:c.futex_wait_queue_me}{{2.12}{37}{Futex API reference}{section*.33}{}} \newlabel{kernel-hacking/locking:c.futex_wait_setup}{{2.12}{37}{Futex API reference}{section*.34}{}} \newlabel{kernel-hacking/locking:c.handle_early_requeue_pi_wakeup}{{2.12}{38}{Futex API reference}{section*.35}{}} \newlabel{kernel-hacking/locking:c.futex_wait_requeue_pi}{{2.12}{38}{Futex API reference}{section*.36}{}} \newlabel{kernel-hacking/locking:c.sys_set_robust_list}{{2.12}{39}{Futex API reference}{section*.37}{}} \newlabel{kernel-hacking/locking:c.sys_get_robust_list}{{2.12}{39}{Futex API reference}{section*.38}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.13}Further reading}{39}{section.2.13}} \newlabel{kernel-hacking/locking:further-reading}{{2.13}{39}{Further reading}{section.2.13}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.14}Thanks}{39}{section.2.14}} \newlabel{kernel-hacking/locking:thanks}{{2.14}{39}{Thanks}{section.2.14}{}} \@writefile{toc}{\contentsline {section}{\numberline {2.15}Glossary}{40}{section.2.15}} \newlabel{kernel-hacking/locking:glossary}{{2.15}{40}{Glossary}{section.2.15}{}} \@writefile{toc}{\contentsline {chapter}{Index}{41}{section*.39}}