Commit 02bafd96 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'docs-4.9' of git://git.lwn.net/linux

Pull documentation updates from Jonathan Corbet:
 "This is the documentation update pull for the 4.9 merge window.

  The Sphinx transition is still creating a fair amount of work. Here we
  have a number of fixes and, importantly, a proper PDF output solution,
  thanks to Jani Nikula, Mauro Carvalho Chehab and Markus Heiser.

  I've started a couple of new books: a driver API book (based on the
  old device-drivers.tmpl) and a development tools book. Both are meant
  to show how we can integrate together our existing documentation into
  a more coherent and accessible whole. It involves moving some stuff
  around and formatting changes, but, I think, the results are worth it.
  The good news is that most of our existing Documentation/*.txt files
  are *almost* in RST format already; the amount of messing around
  required is minimal.

  And, of course, there's the usual set of updates, typo fixes, and
  more"

* tag 'docs-4.9' of git://git.lwn.net/linux: (120 commits)
  URL changed for Linux Foundation TAB
  dax : Fix documentation with respect to struct pages
  iio: Documentation: Correct the path used to create triggers.
  docs: Remove space-before-label guidance from CodingStyle
  docs-rst: add inter-document cross references
  Documentation/email-clients.txt: convert it to ReST markup
  Documentation/kernel-docs.txt: reorder based on timestamp
  Documentation/kernel-docs.txt: Add dates for online docs
  Documentation/kernel-docs.txt: get rid of broken docs
  Documentation/kernel-docs.txt: move in-kernel docs
  Documentation/kernel-docs.txt: remove more legacy references
  Documentation/kernel-docs.txt: add two published books
  Documentation/kernel-docs.txt: sort books per publication date
  Documentation/kernel-docs.txt: adjust LDD references
  Documentation/kernel-docs.txt: some improvements on the ReST output
  Documentation/kernel-docs.txt: Consistent indenting: 4 spaces
  Documentation/kernel-docs.txt: Add 4 paper/book references
  Documentation/kernel-docs.txt: Improve layouting of book list
  Documentation/kernel-docs.txt: Remove offline or outdated entries
  docs: Clean up bare :: lines
  ...
parents 2105b9ff 3c76ff47
This diff is collapsed.
...@@ -19,7 +19,7 @@ please contact the Linux Foundation's Technical Advisory Board at ...@@ -19,7 +19,7 @@ please contact the Linux Foundation's Technical Advisory Board at
will work to resolve the issue to the best of their ability. For more will work to resolve the issue to the best of their ability. For more
information on who is on the Technical Advisory Board and what their information on who is on the Technical Advisory Board and what their
role is, please see: role is, please see:
http://www.linuxfoundation.org/programs/advisory-councils/tab http://www.linuxfoundation.org/projects/linux/tab
As a reviewer of code, please strive to keep things civil and focused on As a reviewer of code, please strive to keep things civil and focused on
the technical issues involved. We are all humans, and frustrations can the technical issues involved. We are all humans, and frustrations can
......
This diff is collapsed.
...@@ -699,7 +699,7 @@ to use the dma_sync_*() interfaces. ...@@ -699,7 +699,7 @@ to use the dma_sync_*() interfaces.
dma_addr_t mapping; dma_addr_t mapping;
mapping = dma_map_single(cp->dev, buffer, len, DMA_FROM_DEVICE); mapping = dma_map_single(cp->dev, buffer, len, DMA_FROM_DEVICE);
if (dma_mapping_error(cp->dev, dma_handle)) { if (dma_mapping_error(cp->dev, mapping)) {
/* /*
* reduce current DMA mapping usage, * reduce current DMA mapping usage,
* delay and try again later or * delay and try again later or
...@@ -931,10 +931,8 @@ to "Closing". ...@@ -931,10 +931,8 @@ to "Closing".
1) Struct scatterlist requirements. 1) Struct scatterlist requirements.
Don't invent the architecture specific struct scatterlist; just use You need to enable CONFIG_NEED_SG_DMA_LENGTH if the architecture
<asm-generic/scatterlist.h>. You need to enable supports IOMMUs (including software IOMMU).
CONFIG_NEED_SG_DMA_LENGTH if the architecture supports IOMMUs
(including software IOMMU).
2) ARCH_DMA_MINALIGN 2) ARCH_DMA_MINALIGN
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# To add a new book the only step required is to add the book to the # To add a new book the only step required is to add the book to the
# list of DOCBOOKS. # list of DOCBOOKS.
DOCBOOKS := z8530book.xml device-drivers.xml \ DOCBOOKS := z8530book.xml \
kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
writing_usb_driver.xml networking.xml \ writing_usb_driver.xml networking.xml \
kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
...@@ -22,9 +22,15 @@ ifeq ($(DOCBOOKS),) ...@@ -22,9 +22,15 @@ ifeq ($(DOCBOOKS),)
# Skip DocBook build if the user explicitly requested no DOCBOOKS. # Skip DocBook build if the user explicitly requested no DOCBOOKS.
.DEFAULT: .DEFAULT:
@echo " SKIP DocBook $@ target (DOCBOOKS=\"\" specified)." @echo " SKIP DocBook $@ target (DOCBOOKS=\"\" specified)."
else
ifneq ($(SPHINXDIRS),)
# Skip DocBook build if the user explicitly requested a sphinx dir
.DEFAULT:
@echo " SKIP DocBook $@ target (SPHINXDIRS specified)."
else else
### ###
# The build process is as follows (targets): # The build process is as follows (targets):
# (xmldocs) [by docproc] # (xmldocs) [by docproc]
...@@ -66,6 +72,7 @@ installmandocs: mandocs ...@@ -66,6 +72,7 @@ installmandocs: mandocs
# no-op for the DocBook toolchain # no-op for the DocBook toolchain
epubdocs: epubdocs:
latexdocs:
### ###
#External programs used #External programs used
...@@ -221,6 +228,7 @@ silent_gen_xml = : ...@@ -221,6 +228,7 @@ silent_gen_xml = :
echo "</programlisting>") > $@ echo "</programlisting>") > $@
endif # DOCBOOKS="" endif # DOCBOOKS=""
endif # SPHINDIR=...
### ###
# Help targets as used by the top-level makefile # Help targets as used by the top-level makefile
......
This diff is collapsed.
This diff is collapsed.
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
# You can set these variables from the command line. # You can set these variables from the command line.
SPHINXBUILD = sphinx-build SPHINXBUILD = sphinx-build
SPHINXOPTS = SPHINXOPTS =
SPHINXDIRS = .
_SPHINXDIRS = $(patsubst $(srctree)/Documentation/%/conf.py,%,$(wildcard $(srctree)/Documentation/*/conf.py))
SPHINX_CONF = conf.py
PAPER = PAPER =
BUILDDIR = $(obj)/output BUILDDIR = $(obj)/output
...@@ -25,38 +28,62 @@ else ifneq ($(DOCBOOKS),) ...@@ -25,38 +28,62 @@ else ifneq ($(DOCBOOKS),)
else # HAVE_SPHINX else # HAVE_SPHINX
# User-friendly check for rst2pdf # User-friendly check for pdflatex
HAVE_RST2PDF := $(shell if python -c "import rst2pdf" >/dev/null 2>&1; then echo 1; else echo 0; fi) HAVE_PDFLATEX := $(shell if which xelatex >/dev/null 2>&1; then echo 1; else echo 0; fi)
# Internal variables. # Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter PAPEROPT_letter = -D latex_paper_size=letter
KERNELDOC = $(srctree)/scripts/kernel-doc KERNELDOC = $(srctree)/scripts/kernel-doc
KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC) KERNELDOC_CONF = -D kerneldoc_srctree=$(srctree) -D kerneldoc_bin=$(KERNELDOC)
ALLSPHINXOPTS = -D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) -d $(BUILDDIR)/.doctrees $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) -c $(srctree)/$(src) $(SPHINXOPTS) $(srctree)/$(src) ALLSPHINXOPTS = $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
# the i18n builder cannot share the environment and doctrees with the others # the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
quiet_cmd_sphinx = SPHINX $@ # commands; the 'cmd' from scripts/Kbuild.include is not *loopable*
cmd_sphinx = BUILDDIR=$(BUILDDIR) $(SPHINXBUILD) -b $2 $(ALLSPHINXOPTS) $(BUILDDIR)/$2 loop_cmd = $(echo-cmd) $(cmd_$(1))
# $2 sphinx builder e.g. "html"
# $3 name of the build subfolder / e.g. "media", used as:
# * dest folder relative to $(BUILDDIR) and
# * cache folder relative to $(BUILDDIR)/.doctrees
# $4 dest subfolder e.g. "man" for man pages at media/man
# $5 reST source folder relative to $(srctree)/$(src),
# e.g. "media" for the linux-tv book-set at ./Documentation/media
quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4);
cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media all;\
BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \
$(SPHINXBUILD) \
-b $2 \
-c $(abspath $(srctree)/$(src)) \
-d $(abspath $(BUILDDIR)/.doctrees/$3) \
-D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \
$(ALLSPHINXOPTS) \
$(abspath $(srctree)/$(src)/$5) \
$(abspath $(BUILDDIR)/$3/$4);
htmldocs: htmldocs:
$(MAKE) BUILDDIR=$(BUILDDIR) -f $(srctree)/Documentation/media/Makefile $@ @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
$(call cmd,sphinx,html)
pdfdocs: latexdocs:
ifeq ($(HAVE_RST2PDF),0) ifeq ($(HAVE_PDFLATEX),0)
$(warning The Python 'rst2pdf' module was not found. Make sure you have the module installed to produce PDF output.) $(warning The 'xelatex' command was not found. Make sure you have it installed and in PATH to produce PDF output.)
@echo " SKIP Sphinx $@ target." @echo " SKIP Sphinx $@ target."
else # HAVE_RST2PDF else # HAVE_PDFLATEX
$(call cmd,sphinx,pdf) @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
endif # HAVE_RST2PDF endif # HAVE_PDFLATEX
pdfdocs: latexdocs
ifneq ($(HAVE_PDFLATEX),0)
$(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/$(var)/latex)
endif # HAVE_PDFLATEX
epubdocs: epubdocs:
$(call cmd,sphinx,epub) @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
xmldocs: xmldocs:
$(call cmd,sphinx,xml) @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
# no-ops for the Sphinx toolchain # no-ops for the Sphinx toolchain
sgmldocs: sgmldocs:
...@@ -72,7 +99,14 @@ endif # HAVE_SPHINX ...@@ -72,7 +99,14 @@ endif # HAVE_SPHINX
dochelp: dochelp:
@echo ' Linux kernel internal documentation in different formats (Sphinx):' @echo ' Linux kernel internal documentation in different formats (Sphinx):'
@echo ' htmldocs - HTML' @echo ' htmldocs - HTML'
@echo ' latexdocs - LaTeX'
@echo ' pdfdocs - PDF' @echo ' pdfdocs - PDF'
@echo ' epubdocs - EPUB' @echo ' epubdocs - EPUB'
@echo ' xmldocs - XML' @echo ' xmldocs - XML'
@echo ' cleandocs - clean all generated files' @echo ' cleandocs - clean all generated files'
@echo
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
@echo ' valid values for SPHINXDIRS are: $(_SPHINXDIRS)'
@echo
@echo ' make SPHINX_CONF={conf-file} [target] use *additional* sphinx-build'
@echo ' configuration. This is e.g. useful to build with nit-picking config.'
This diff is collapsed.
.. _securitybugs:
Security bugs
=============
Linux kernel developers take security very seriously. As such, we'd Linux kernel developers take security very seriously. As such, we'd
like to know when a security bug is found so that it can be fixed and like to know when a security bug is found so that it can be fixed and
disclosed as quickly as possible. Please report security bugs to the disclosed as quickly as possible. Please report security bugs to the
Linux kernel security team. Linux kernel security team.
1) Contact 1) Contact
----------
The Linux kernel security team can be contacted by email at The Linux kernel security team can be contacted by email at
<security@kernel.org>. This is a private list of security officers <security@kernel.org>. This is a private list of security officers
...@@ -18,6 +24,7 @@ Any exploit code is very helpful and will not be released without ...@@ -18,6 +24,7 @@ Any exploit code is very helpful and will not be released without
consent from the reporter unless it has already been made public. consent from the reporter unless it has already been made public.
2) Disclosure 2) Disclosure
-------------
The goal of the Linux kernel security team is to work with the The goal of the Linux kernel security team is to work with the
bug submitter to bug resolution as well as disclosure. We prefer bug submitter to bug resolution as well as disclosure. We prefer
...@@ -33,6 +40,7 @@ to a few weeks. As a basic default policy, we expect report date to ...@@ -33,6 +40,7 @@ to a few weeks. As a basic default policy, we expect report date to
disclosure date to be on the order of 7 days. disclosure date to be on the order of 7 days.
3) Non-disclosure agreements 3) Non-disclosure agreements
----------------------------
The Linux kernel security team is not a formal body and therefore unable The Linux kernel security team is not a formal body and therefore unable
to enter any non-disclosure agreements. to enter any non-disclosure agreements.
.. _submitchecklist:
Linux Kernel patch submission checklist Linux Kernel patch submission checklist
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here are some basic things that developers should do if they want to see their Here are some basic things that developers should do if they want to see their
kernel patch submissions accepted more quickly. kernel patch submissions accepted more quickly.
These are all above and beyond the documentation that is provided in These are all above and beyond the documentation that is provided in
Documentation/SubmittingPatches and elsewhere regarding submitting Linux :ref:`Documentation/SubmittingPatches <submittingpatches>`
kernel patches. and elsewhere regarding submitting Linux kernel patches.
1: If you use a facility then #include the file that defines/declares 1) If you use a facility then #include the file that defines/declares
that facility. Don't depend on other header files pulling in ones that facility. Don't depend on other header files pulling in ones
that you use. that you use.
2: Builds cleanly with applicable or modified CONFIG options =y, =m, and 2) Builds cleanly:
=n. No gcc warnings/errors, no linker warnings/errors.
a) with applicable or modified ``CONFIG`` options ``=y``, ``=m``, and
``=n``. No ``gcc`` warnings/errors, no linker warnings/errors.
2b: Passes allnoconfig, allmodconfig b) Passes ``allnoconfig``, ``allmodconfig``
2c: Builds successfully when using O=builddir c) Builds successfully when using ``O=builddir``
3: Builds on multiple CPU architectures by using local cross-compile tools 3) Builds on multiple CPU architectures by using local cross-compile tools
or some other build farm. or some other build farm.
4: ppc64 is a good architecture for cross-compilation checking because it 4) ppc64 is a good architecture for cross-compilation checking because it
tends to use `unsigned long' for 64-bit quantities. tends to use ``unsigned long`` for 64-bit quantities.
5: Check your patch for general style as detailed in 5) Check your patch for general style as detailed in
Documentation/CodingStyle. Check for trivial violations with the :ref:`Documentation/CodingStyle <codingstyle>`.
patch style checker prior to submission (scripts/checkpatch.pl). Check for trivial violations with the patch style checker prior to
submission (``scripts/checkpatch.pl``).
You should be able to justify all violations that remain in You should be able to justify all violations that remain in
your patch. your patch.
6: Any new or modified CONFIG options don't muck up the config menu. 6) Any new or modified ``CONFIG`` options don't muck up the config menu.
7: All new Kconfig options have help text. 7) All new ``Kconfig`` options have help text.
8: Has been carefully reviewed with respect to relevant Kconfig 8) Has been carefully reviewed with respect to relevant ``Kconfig``
combinations. This is very hard to get right with testing -- brainpower combinations. This is very hard to get right with testing -- brainpower
pays off here. pays off here.
9: Check cleanly with sparse. 9) Check cleanly with sparse.
10) Use ``make checkstack`` and ``make namespacecheck`` and fix any problems
that they find.
.. note::
10: Use 'make checkstack' and 'make namespacecheck' and fix any problems ``checkstack`` does not point out problems explicitly,
that they find. Note: checkstack does not point out problems explicitly, but any one function that uses more than 512 bytes on the stack is a
but any one function that uses more than 512 bytes on the stack is a candidate for change.
candidate for change.
11: Include kernel-doc to document global kernel APIs. (Not required for 11) Include :ref:`kernel-doc <kernel_doc>` to document global kernel APIs.
static functions, but OK there also.) Use 'make htmldocs' or 'make (Not required for static functions, but OK there also.) Use
mandocs' to check the kernel-doc and fix any issues. ``make htmldocs`` or ``make pdfdocs`` to check the
:ref:`kernel-doc <kernel_doc>` and fix any issues.
12: Has been tested with CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, 12) Has been tested with ``CONFIG_PREEMPT``, ``CONFIG_DEBUG_PREEMPT``,
CONFIG_DEBUG_SLAB, CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, ``CONFIG_DEBUG_SLAB``, ``CONFIG_DEBUG_PAGEALLOC``, ``CONFIG_DEBUG_MUTEXES``,
CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_ATOMIC_SLEEP, CONFIG_PROVE_RCU ``CONFIG_DEBUG_SPINLOCK``, ``CONFIG_DEBUG_ATOMIC_SLEEP``,
and CONFIG_DEBUG_OBJECTS_RCU_HEAD all simultaneously enabled. ``CONFIG_PROVE_RCU`` and ``CONFIG_DEBUG_OBJECTS_RCU_HEAD`` all
simultaneously enabled.
13: Has been build- and runtime tested with and without CONFIG_SMP and 13) Has been build- and runtime tested with and without ``CONFIG_SMP`` and
CONFIG_PREEMPT. ``CONFIG_PREEMPT.``
14: If the patch affects IO/Disk, etc: has been tested with and without 14) If the patch affects IO/Disk, etc: has been tested with and without
CONFIG_LBDAF. ``CONFIG_LBDAF.``
15: All codepaths have been exercised with all lockdep features enabled. 15) All codepaths have been exercised with all lockdep features enabled.
16: All new /proc entries are documented under Documentation/ 16) All new ``/proc`` entries are documented under ``Documentation/``
17: All new kernel boot parameters are documented in 17) All new kernel boot parameters are documented in
Documentation/kernel-parameters.txt. ``Documentation/kernel-parameters.txt``.
18: All new module parameters are documented with MODULE_PARM_DESC() 18) All new module parameters are documented with ``MODULE_PARM_DESC()``
19: All new userspace interfaces are documented in Documentation/ABI/. 19) All new userspace interfaces are documented in ``Documentation/ABI/``.
See Documentation/ABI/README for more information. See ``Documentation/ABI/README`` for more information.
Patches that change userspace interfaces should be CCed to Patches that change userspace interfaces should be CCed to
linux-api@vger.kernel.org. linux-api@vger.kernel.org.
20: Check that it all passes `make headers_check'. 20) Check that it all passes ``make headers_check``.
21: Has been checked with injection of at least slab and page-allocation 21) Has been checked with injection of at least slab and page-allocation
failures. See Documentation/fault-injection/. failures. See ``Documentation/fault-injection/``.
If the new code is substantial, addition of subsystem-specific fault If the new code is substantial, addition of subsystem-specific fault
injection might be appropriate. injection might be appropriate.
22: Newly-added code has been compiled with `gcc -W' (use "make 22) Newly-added code has been compiled with ``gcc -W`` (use
EXTRA_CFLAGS=-W"). This will generate lots of noise, but is good for ``make EXTRA_CFLAGS=-W``). This will generate lots of noise, but is good
finding bugs like "warning: comparison between signed and unsigned". for finding bugs like "warning: comparison between signed and unsigned".
23: Tested after it has been merged into the -mm patchset to make sure 23) Tested after it has been merged into the -mm patchset to make sure
that it still works with all of the other queued patches and various that it still works with all of the other queued patches and various
changes in the VM, VFS, and other subsystems. changes in the VM, VFS, and other subsystems.
24: All memory barriers {e.g., barrier(), rmb(), wmb()} need a comment in the 24) All memory barriers {e.g., ``barrier()``, ``rmb()``, ``wmb()``} need a
source code that explains the logic of what they are doing and why. comment in the source code that explains the logic of what they are doing
and why.
25: If any ioctl's are added by the patch, then also update 25) If any ioctl's are added by the patch, then also update
Documentation/ioctl/ioctl-number.txt. ``Documentation/ioctl/ioctl-number.txt``.
26: If your modified source code depends on or uses any of the kernel 26) If your modified source code depends on or uses any of the kernel
APIs or features that are related to the following kconfig symbols, APIs or features that are related to the following ``Kconfig`` symbols,
then test multiple builds with the related kconfig symbols disabled then test multiple builds with the related ``Kconfig`` symbols disabled
and/or =m (if that option is available) [not all of these at the and/or ``=m`` (if that option is available) [not all of these at the
same time, just various/random combinations of them]: same time, just various/random combinations of them]:
CONFIG_SMP, CONFIG_SYSFS, CONFIG_PROC_FS, CONFIG_INPUT, CONFIG_PCI, ``CONFIG_SMP``, ``CONFIG_SYSFS``, ``CONFIG_PROC_FS``, ``CONFIG_INPUT``, ``CONFIG_PCI``, ``CONFIG_BLOCK``, ``CONFIG_PM``, ``CONFIG_MAGIC_SYSRQ``,
CONFIG_BLOCK, CONFIG_PM, CONFIG_MAGIC_SYSRQ, ``CONFIG_NET``, ``CONFIG_INET=n`` (but latter with ``CONFIG_NET=y``).
CONFIG_NET, CONFIG_INET=n (but latter with CONFIG_NET=y)
.. _submittingdrivers:
Submitting Drivers For The Linux Kernel Submitting Drivers For The Linux Kernel
--------------------------------------- =======================================
This document is intended to explain how to submit device drivers to the This document is intended to explain how to submit device drivers to the
various kernel trees. Note that if you are interested in video card drivers various kernel trees. Note that if you are interested in video card drivers
...@@ -38,42 +40,48 @@ Linux 2.4: ...@@ -38,42 +40,48 @@ Linux 2.4:
maintainer does not respond or you cannot find the appropriate maintainer does not respond or you cannot find the appropriate
maintainer then please contact Willy Tarreau <w@1wt.eu>. maintainer then please contact Willy Tarreau <w@1wt.eu>.
Linux 2.6: Linux 2.6 and upper:
The same rules apply as 2.4 except that you should follow linux-kernel The same rules apply as 2.4 except that you should follow linux-kernel
to track changes in API's. The final contact point for Linux 2.6 to track changes in API's. The final contact point for Linux 2.6+
submissions is Andrew Morton. submissions is Andrew Morton.
What Criteria Determine Acceptance What Criteria Determine Acceptance
---------------------------------- ----------------------------------
Licensing: The code must be released to us under the Licensing:
The code must be released to us under the
GNU General Public License. We don't insist on any kind GNU General Public License. We don't insist on any kind
of exclusive GPL licensing, and if you wish the driver of exclusive GPL licensing, and if you wish the driver
to be useful to other communities such as BSD you may well to be useful to other communities such as BSD you may well
wish to release under multiple licenses. wish to release under multiple licenses.
See accepted licenses at include/linux/module.h See accepted licenses at include/linux/module.h
Copyright: The copyright owner must agree to use of GPL. Copyright:
The copyright owner must agree to use of GPL.
It's best if the submitter and copyright owner It's best if the submitter and copyright owner
are the same person/entity. If not, the name of are the same person/entity. If not, the name of
the person/entity authorizing use of GPL should be the person/entity authorizing use of GPL should be
listed in case it's necessary to verify the will of listed in case it's necessary to verify the will of
the copyright owner. the copyright owner.
Interfaces: If your driver uses existing interfaces and behaves like Interfaces:
If your driver uses existing interfaces and behaves like
other drivers in the same class it will be much more likely other drivers in the same class it will be much more likely
to be accepted than if it invents gratuitous new ones. to be accepted than if it invents gratuitous new ones.
If you need to implement a common API over Linux and NT If you need to implement a common API over Linux and NT
drivers do it in userspace. drivers do it in userspace.
Code: Please use the Linux style of code formatting as documented Code:
in Documentation/CodingStyle. If you have sections of code Please use the Linux style of code formatting as documented
in :ref:`Documentation/CodingStyle <codingStyle>`.
If you have sections of code
that need to be in other formats, for example because they that need to be in other formats, for example because they
are shared with a windows driver kit and you want to are shared with a windows driver kit and you want to
maintain them just once separate them out nicely and note maintain them just once separate them out nicely and note
this fact. this fact.
Portability: Pointers are not always 32bits, not all computers are little Portability:
Pointers are not always 32bits, not all computers are little
endian, people do not all have floating point and you endian, people do not all have floating point and you
shouldn't use inline x86 assembler in your driver without shouldn't use inline x86 assembler in your driver without
careful thought. Pure x86 drivers generally are not popular. careful thought. Pure x86 drivers generally are not popular.
...@@ -81,12 +89,14 @@ Portability: Pointers are not always 32bits, not all computers are little ...@@ -81,12 +89,14 @@ Portability: Pointers are not always 32bits, not all computers are little
but it is easy to make sure the code can easily be made but it is easy to make sure the code can easily be made
portable. portable.
Clarity: It helps if anyone can see how to fix the driver. It helps Clarity:
It helps if anyone can see how to fix the driver. It helps
you because you get patches not bug reports. If you submit a you because you get patches not bug reports. If you submit a
driver that intentionally obfuscates how the hardware works driver that intentionally obfuscates how the hardware works
it will go in the bitbucket. it will go in the bitbucket.
PM support: Since Linux is used on many portable and desktop systems, your PM support:
Since Linux is used on many portable and desktop systems, your
driver is likely to be used on such a system and therefore it driver is likely to be used on such a system and therefore it
should support basic power management by implementing, if should support basic power management by implementing, if
necessary, the .suspend and .resume methods used during the necessary, the .suspend and .resume methods used during the
...@@ -101,7 +111,8 @@ PM support: Since Linux is used on many portable and desktop systems, your ...@@ -101,7 +111,8 @@ PM support: Since Linux is used on many portable and desktop systems, your
complete overview of the power management issues related to complete overview of the power management issues related to
drivers see Documentation/power/devices.txt . drivers see Documentation/power/devices.txt .
Control: In general if there is active maintenance of a driver by Control:
In general if there is active maintenance of a driver by
the author then patches will be redirected to them unless the author then patches will be redirected to them unless
they are totally obvious and without need of checking. they are totally obvious and without need of checking.
If you want to be the contact and update point for the If you want to be the contact and update point for the
...@@ -111,13 +122,15 @@ Control: In general if there is active maintenance of a driver by ...@@ -111,13 +122,15 @@ Control: In general if there is active maintenance of a driver by
What Criteria Do Not Determine Acceptance What Criteria Do Not Determine Acceptance
----------------------------------------- -----------------------------------------
Vendor: Being the hardware vendor and maintaining the driver is Vendor:
Being the hardware vendor and maintaining the driver is
often a good thing. If there is a stable working driver from often a good thing. If there is a stable working driver from
other people already in the tree don't expect 'we are the other people already in the tree don't expect 'we are the
vendor' to get your driver chosen. Ideally work with the vendor' to get your driver chosen. Ideally work with the
existing driver author to build a single perfect driver. existing driver author to build a single perfect driver.
Author: It doesn't matter if a large Linux company wrote the driver, Author:
It doesn't matter if a large Linux company wrote the driver,
or you did. Nobody has any special access to the kernel or you did. Nobody has any special access to the kernel
tree. Anyone who tells you otherwise isn't telling the tree. Anyone who tells you otherwise isn't telling the
whole story. whole story.
...@@ -127,8 +140,10 @@ Resources ...@@ -127,8 +140,10 @@ Resources
--------- ---------
Linux kernel master tree: Linux kernel master tree:
ftp.??.kernel.org:/pub/linux/kernel/... ftp.\ *country_code*\ .kernel.org:/pub/linux/kernel/...
?? == your country code, such as "us", "uk", "fr", etc.
where *country_code* == your country code, such as
**us**, **uk**, **fr**, etc.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git
...@@ -141,14 +156,19 @@ Linux Device Drivers, Third Edition (covers 2.6.10): ...@@ -141,14 +156,19 @@ Linux Device Drivers, Third Edition (covers 2.6.10):
LWN.net: LWN.net:
Weekly summary of kernel development activity - http://lwn.net/ Weekly summary of kernel development activity - http://lwn.net/
2.6 API changes: 2.6 API changes:
http://lwn.net/Articles/2.6-kernel-api/ http://lwn.net/Articles/2.6-kernel-api/
Porting drivers from prior kernels to 2.6: Porting drivers from prior kernels to 2.6:
http://lwn.net/Articles/driver-porting/ http://lwn.net/Articles/driver-porting/
KernelNewbies: KernelNewbies:
Documentation and assistance for new kernel programmers Documentation and assistance for new kernel programmers
http://kernelnewbies.org/
http://kernelnewbies.org/
Linux USB project: Linux USB project:
http://www.linux-usb.org/ http://www.linux-usb.org/
......
This diff is collapsed.
This diff is collapsed.
...@@ -73,4 +73,13 @@ SunXi family ...@@ -73,4 +73,13 @@ SunXi family
* Octa ARM Cortex-A7 based SoCs * Octa ARM Cortex-A7 based SoCs
- Allwinner A83T - Allwinner A83T
+ Datasheet + Datasheet
http://dl.linux-sunxi.org/A83T/A83T_datasheet_Revision_1.1.pdf https://github.com/allwinner-zh/documents/raw/master/A83T/A83T_Datasheet_v1.3_20150510.pdf
+ User Manual
https://github.com/allwinner-zh/documents/raw/master/A83T/A83T_User_Manual_v1.5.1_20150513.pdf
* Quad ARM Cortex-A53 based SoCs
- Allwinner A64
+ Datasheet
http://dl.linux-sunxi.org/A64/A64_Datasheet_V1.1.pdf
+ User Manual
http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf
...@@ -31,24 +31,25 @@ serve as a convenient shorthand for the implementation of the ...@@ -31,24 +31,25 @@ serve as a convenient shorthand for the implementation of the
hardware-specific bits for the hypothetical "foo" hardware. hardware-specific bits for the hypothetical "foo" hardware.
Tying the two halves of this interface together is struct clk_hw, which Tying the two halves of this interface together is struct clk_hw, which
is defined in struct clk_foo and pointed to within struct clk. This is defined in struct clk_foo and pointed to within struct clk_core. This
allows for easy navigation between the two discrete halves of the common allows for easy navigation between the two discrete halves of the common
clock interface. clock interface.
Part 2 - common data structures and api Part 2 - common data structures and api
Below is the common struct clk definition from Below is the common struct clk_core definition from
include/linux/clk-private.h, modified for brevity: drivers/clk/clk.c, modified for brevity:
struct clk { struct clk_core {
const char *name; const char *name;
const struct clk_ops *ops; const struct clk_ops *ops;
struct clk_hw *hw; struct clk_hw *hw;
char **parent_names; struct module *owner;
struct clk **parents; struct clk_core *parent;
struct clk *parent; const char **parent_names;
struct hlist_head children; struct clk_core **parents;
struct hlist_node child_node; u8 num_parents;
u8 new_parent_index;
... ...
}; };
...@@ -56,16 +57,19 @@ The members above make up the core of the clk tree topology. The clk ...@@ -56,16 +57,19 @@ The members above make up the core of the clk tree topology. The clk
api itself defines several driver-facing functions which operate on api itself defines several driver-facing functions which operate on
struct clk. That api is documented in include/linux/clk.h. struct clk. That api is documented in include/linux/clk.h.
Platforms and devices utilizing the common struct clk use the struct Platforms and devices utilizing the common struct clk_core use the struct
clk_ops pointer in struct clk to perform the hardware-specific parts of clk_ops pointer in struct clk_core to perform the hardware-specific parts of
the operations defined in clk.h: the operations defined in clk-provider.h:
struct clk_ops { struct clk_ops {
int (*prepare)(struct clk_hw *hw); int (*prepare)(struct clk_hw *hw);
void (*unprepare)(struct clk_hw *hw); void (*unprepare)(struct clk_hw *hw);
int (*is_prepared)(struct clk_hw *hw);
void (*unprepare_unused)(struct clk_hw *hw);
int (*enable)(struct clk_hw *hw); int (*enable)(struct clk_hw *hw);
void (*disable)(struct clk_hw *hw); void (*disable)(struct clk_hw *hw);
int (*is_enabled)(struct clk_hw *hw); int (*is_enabled)(struct clk_hw *hw);
void (*disable_unused)(struct clk_hw *hw);
unsigned long (*recalc_rate)(struct clk_hw *hw, unsigned long (*recalc_rate)(struct clk_hw *hw,
unsigned long parent_rate); unsigned long parent_rate);
long (*round_rate)(struct clk_hw *hw, long (*round_rate)(struct clk_hw *hw,
...@@ -84,6 +88,8 @@ the operations defined in clk.h: ...@@ -84,6 +88,8 @@ the operations defined in clk.h:
u8 index); u8 index);
unsigned long (*recalc_accuracy)(struct clk_hw *hw, unsigned long (*recalc_accuracy)(struct clk_hw *hw,
unsigned long parent_accuracy); unsigned long parent_accuracy);
int (*get_phase)(struct clk_hw *hw);
int (*set_phase)(struct clk_hw *hw, int degrees);
void (*init)(struct clk_hw *hw); void (*init)(struct clk_hw *hw);
int (*debug_init)(struct clk_hw *hw, int (*debug_init)(struct clk_hw *hw,
struct dentry *dentry); struct dentry *dentry);
...@@ -91,7 +97,7 @@ the operations defined in clk.h: ...@@ -91,7 +97,7 @@ the operations defined in clk.h:
Part 3 - hardware clk implementations Part 3 - hardware clk implementations
The strength of the common struct clk comes from its .ops and .hw pointers The strength of the common struct clk_core comes from its .ops and .hw pointers
which abstract the details of struct clk from the hardware-specific bits, and which abstract the details of struct clk from the hardware-specific bits, and
vice versa. To illustrate consider the simple gateable clk implementation in vice versa. To illustrate consider the simple gateable clk implementation in
drivers/clk/clk-gate.c: drivers/clk/clk-gate.c:
...@@ -107,7 +113,7 @@ struct clk_gate contains struct clk_hw hw as well as hardware-specific ...@@ -107,7 +113,7 @@ struct clk_gate contains struct clk_hw hw as well as hardware-specific
knowledge about which register and bit controls this clk's gating. knowledge about which register and bit controls this clk's gating.
Nothing about clock topology or accounting, such as enable_count or Nothing about clock topology or accounting, such as enable_count or
notifier_count, is needed here. That is all handled by the common notifier_count, is needed here. That is all handled by the common
framework code and struct clk. framework code and struct clk_core.
Let's walk through enabling this clk from driver code: Let's walk through enabling this clk from driver code:
...@@ -139,22 +145,18 @@ static void clk_gate_set_bit(struct clk_gate *gate) ...@@ -139,22 +145,18 @@ static void clk_gate_set_bit(struct clk_gate *gate)
Note that to_clk_gate is defined as: Note that to_clk_gate is defined as:
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, clk) #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
This pattern of abstraction is used for every clock hardware This pattern of abstraction is used for every clock hardware
representation. representation.
Part 4 - supporting your own clk hardware Part 4 - supporting your own clk hardware
When implementing support for a new type of clock it only necessary to When implementing support for a new type of clock it is only necessary to
include the following header: include the following header:
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
include/linux/clk.h is included within that header and clk-private.h
must never be included from the code which implements the operations for
a clock. More on that below in Part 5.
To construct a clk hardware structure for your platform you must define To construct a clk hardware structure for your platform you must define
the following: the following:
......
...@@ -14,11 +14,17 @@ ...@@ -14,11 +14,17 @@
import sys import sys
import os import os
import sphinx
# Get Sphinx version
major, minor, patch = map(int, sphinx.__version__.split("."))
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('sphinx')) sys.path.insert(0, os.path.abspath('sphinx'))
from load_config import loadConfig
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
...@@ -28,14 +34,13 @@ sys.path.insert(0, os.path.abspath('sphinx')) ...@@ -28,14 +34,13 @@ sys.path.insert(0, os.path.abspath('sphinx'))
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include'] extensions = ['kernel-doc', 'rstFlatTable', 'kernel_include', 'cdomain']
# Gracefully handle missing rst2pdf. # The name of the math extension changed on Sphinx 1.4
try: if minor > 3:
import rst2pdf extensions.append("sphinx.ext.imgmath")
extensions += ['rst2pdf.pdfbuilder'] else:
except ImportError: extensions.append("sphinx.ext.pngmath")
pass
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
...@@ -252,23 +257,90 @@ htmlhelp_basename = 'TheLinuxKerneldoc' ...@@ -252,23 +257,90 @@ htmlhelp_basename = 'TheLinuxKerneldoc'
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper', 'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt'). # The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt', 'pointsize': '8pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment # Latex figure (float) alignment
#'figure_align': 'htbp', #'figure_align': 'htbp',
# Don't mangle with UTF-8 chars
'inputenc': '',
'utf8extra': '',
# Additional stuff for the LaTeX preamble.
'preamble': '''
% Adjust margins
\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}
% Allow generate some pages in landscape
\\usepackage{lscape}
% Put notes in color and let them be inside a table
\\definecolor{NoteColor}{RGB}{204,255,255}
\\definecolor{WarningColor}{RGB}{255,204,204}
\\definecolor{AttentionColor}{RGB}{255,255,204}
\\definecolor{OtherColor}{RGB}{204,204,204}
\\newlength{\\mynoticelength}
\\makeatletter\\newenvironment{coloredbox}[1]{%
\\setlength{\\fboxrule}{1pt}
\\setlength{\\fboxsep}{7pt}
\\setlength{\\mynoticelength}{\\linewidth}
\\addtolength{\\mynoticelength}{-2\\fboxsep}
\\addtolength{\\mynoticelength}{-2\\fboxrule}
\\begin{lrbox}{\\@tempboxa}\\begin{minipage}{\\mynoticelength}}{\\end{minipage}\\end{lrbox}%
\\ifthenelse%
{\\equal{\\py@noticetype}{note}}%
{\\colorbox{NoteColor}{\\usebox{\\@tempboxa}}}%
{%
\\ifthenelse%
{\\equal{\\py@noticetype}{warning}}%
{\\colorbox{WarningColor}{\\usebox{\\@tempboxa}}}%
{%
\\ifthenelse%
{\\equal{\\py@noticetype}{attention}}%
{\\colorbox{AttentionColor}{\\usebox{\\@tempboxa}}}%
{\\colorbox{OtherColor}{\\usebox{\\@tempboxa}}}%
}%
}%
}\\makeatother
\\makeatletter
\\renewenvironment{notice}[2]{%
\\def\\py@noticetype{#1}
\\begin{coloredbox}{#1}
\\bf\\it
\\par\\strong{#2}
\\csname py@noticestart@#1\\endcsname
}
{
\\csname py@noticeend@\\py@noticetype\\endcsname
\\end{coloredbox}
}
\\makeatother
% Use some font with UTF-8 support with XeLaTeX
\\usepackage{fontspec}
\\setsansfont{DejaVu Serif}
\\setromanfont{DejaVu Sans}
\\setmonofont{DejaVu Sans Mono}
% To allow adjusting table sizes
\\usepackage{adjustbox}
'''
} }
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'TheLinuxKernel.tex', 'The Linux Kernel Documentation', ('kernel-documentation', 'kernel-documentation.tex', 'The Linux Kernel Documentation',
'The kernel development community', 'manual'),
('development-process/index', 'development-process.tex', 'Linux Kernel Development Documentation',
'The kernel development community', 'manual'),
('gpu/index', 'gpu.tex', 'Linux GPU Driver Developer\'s Guide',
'The kernel development community', 'manual'), 'The kernel development community', 'manual'),
] ]
...@@ -419,3 +491,9 @@ pdf_documents = [ ...@@ -419,3 +491,9 @@ pdf_documents = [
# line arguments. # line arguments.
kerneldoc_bin = '../scripts/kernel-doc' kerneldoc_bin = '../scripts/kernel-doc'
kerneldoc_srctree = '..' kerneldoc_srctree = '..'
# ------------------------------------------------------------------------------
# Since loadConfig overwrites settings from the global namespace, it has to be
# the last statement in the conf.py file
# ------------------------------------------------------------------------------
loadConfig(globals())
.. highlight:: none
Debugging kernel and modules via gdb Debugging kernel and modules via gdb
==================================== ====================================
...@@ -13,54 +15,58 @@ be transferred to the other gdb stubs as well. ...@@ -13,54 +15,58 @@ be transferred to the other gdb stubs as well.
Requirements Requirements
------------ ------------
o gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true - gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true
for distributions) for distributions)
Setup Setup
----- -----
o Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and - Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and
www.qemu.org for more details). For cross-development, www.qemu.org for more details). For cross-development,
http://landley.net/aboriginal/bin keeps a pool of machine images and http://landley.net/aboriginal/bin keeps a pool of machine images and
toolchains that can be helpful to start from. toolchains that can be helpful to start from.
o Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave - Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave
CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports
CONFIG_FRAME_POINTER, keep it enabled. CONFIG_FRAME_POINTER, keep it enabled.
o Install that kernel on the guest. - Install that kernel on the guest.
Alternatively, QEMU allows to boot the kernel directly using -kernel,
-append, -initrd command line switches. This is generally only useful if
you do not depend on modules. See QEMU documentation for more details on
this mode.
Alternatively, QEMU allows to boot the kernel directly using -kernel, - Enable the gdb stub of QEMU/KVM, either
-append, -initrd command line switches. This is generally only useful if
you do not depend on modules. See QEMU documentation for more details on
this mode.
o Enable the gdb stub of QEMU/KVM, either
- at VM startup time by appending "-s" to the QEMU command line - at VM startup time by appending "-s" to the QEMU command line
or
or
- during runtime by issuing "gdbserver" from the QEMU monitor - during runtime by issuing "gdbserver" from the QEMU monitor
console console
o cd /path/to/linux-build - cd /path/to/linux-build
o Start gdb: gdb vmlinux - Start gdb: gdb vmlinux
Note: Some distros may restrict auto-loading of gdb scripts to known safe Note: Some distros may restrict auto-loading of gdb scripts to known safe
directories. In case gdb reports to refuse loading vmlinux-gdb.py, add directories. In case gdb reports to refuse loading vmlinux-gdb.py, add::
add-auto-load-safe-path /path/to/linux-build add-auto-load-safe-path /path/to/linux-build
to ~/.gdbinit. See gdb help for more details. to ~/.gdbinit. See gdb help for more details.
- Attach to the booted guest::
o Attach to the booted guest:
(gdb) target remote :1234 (gdb) target remote :1234
Examples of using the Linux-provided gdb helpers Examples of using the Linux-provided gdb helpers
------------------------------------------------ ------------------------------------------------
o Load module (and main kernel) symbols: - Load module (and main kernel) symbols::
(gdb) lx-symbols (gdb) lx-symbols
loading vmlinux loading vmlinux
scanning for modules in /home/user/linux/build scanning for modules in /home/user/linux/build
...@@ -72,17 +78,20 @@ Examples of using the Linux-provided gdb helpers ...@@ -72,17 +78,20 @@ Examples of using the Linux-provided gdb helpers
... ...
loading @0xffffffffa0000000: /home/user/linux/build/drivers/ata/ata_generic.ko loading @0xffffffffa0000000: /home/user/linux/build/drivers/ata/ata_generic.ko
o Set a breakpoint on some not yet loaded module function, e.g.: - Set a breakpoint on some not yet loaded module function, e.g.::
(gdb) b btrfs_init_sysfs (gdb) b btrfs_init_sysfs
Function "btrfs_init_sysfs" not defined. Function "btrfs_init_sysfs" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (btrfs_init_sysfs) pending. Breakpoint 1 (btrfs_init_sysfs) pending.
o Continue the target - Continue the target::
(gdb) c (gdb) c
o Load the module on the target and watch the symbols being loaded as well as - Load the module on the target and watch the symbols being loaded as well as
the breakpoint hit: the breakpoint hit::
loading @0xffffffffa0034000: /home/user/linux/build/lib/libcrc32c.ko loading @0xffffffffa0034000: /home/user/linux/build/lib/libcrc32c.ko
loading @0xffffffffa0050000: /home/user/linux/build/lib/lzo/lzo_compress.ko loading @0xffffffffa0050000: /home/user/linux/build/lib/lzo/lzo_compress.ko
loading @0xffffffffa006e000: /home/user/linux/build/lib/zlib_deflate/zlib_deflate.ko loading @0xffffffffa006e000: /home/user/linux/build/lib/zlib_deflate/zlib_deflate.ko
...@@ -91,7 +100,8 @@ Examples of using the Linux-provided gdb helpers ...@@ -91,7 +100,8 @@ Examples of using the Linux-provided gdb helpers
Breakpoint 1, btrfs_init_sysfs () at /home/user/linux/fs/btrfs/sysfs.c:36 Breakpoint 1, btrfs_init_sysfs () at /home/user/linux/fs/btrfs/sysfs.c:36
36 btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj); 36 btrfs_kset = kset_create_and_add("btrfs", NULL, fs_kobj);
o Dump the log buffer of the target kernel: - Dump the log buffer of the target kernel::
(gdb) lx-dmesg (gdb) lx-dmesg
[ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpu
...@@ -102,19 +112,22 @@ Examples of using the Linux-provided gdb helpers ...@@ -102,19 +112,22 @@ Examples of using the Linux-provided gdb helpers
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
.... ....
o Examine fields of the current task struct: - Examine fields of the current task struct::
(gdb) p $lx_current().pid (gdb) p $lx_current().pid
$1 = 4998 $1 = 4998
(gdb) p $lx_current().comm (gdb) p $lx_current().comm
$2 = "modprobe\000\000\000\000\000\000\000" $2 = "modprobe\000\000\000\000\000\000\000"
o Make use of the per-cpu function for the current or a specified CPU: - Make use of the per-cpu function for the current or a specified CPU::
(gdb) p $lx_per_cpu("runqueues").nr_running (gdb) p $lx_per_cpu("runqueues").nr_running
$3 = 1 $3 = 1
(gdb) p $lx_per_cpu("runqueues", 2).nr_running (gdb) p $lx_per_cpu("runqueues", 2).nr_running
$4 = 0 $4 = 0
o Dig into hrtimers using the container_of helper: - Dig into hrtimers using the container_of helper::
(gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next (gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
(gdb) p *$container_of($next, "struct hrtimer", "node") (gdb) p *$container_of($next, "struct hrtimer", "node")
$5 = { $5 = {
...@@ -144,7 +157,7 @@ List of commands and functions ...@@ -144,7 +157,7 @@ List of commands and functions
------------------------------ ------------------------------
The number of commands and convenience functions may evolve over the time, The number of commands and convenience functions may evolve over the time,
this is just a snapshot of the initial version: this is just a snapshot of the initial version::
(gdb) apropos lx (gdb) apropos lx
function lx_current -- Return current task function lx_current -- Return current task
......
================================
Development tools for the kernel
================================
This document is a collection of documents about development tools that can
be used to work on the kernel. For now, the documents have been pulled
together without any significant effot to integrate them into a coherent
whole; patches welcome!
.. class:: toc-title
Table of contents
.. toctree::
:maxdepth: 2
coccinelle
sparse
kcov
gcov
kasan
ubsan
kmemleak
kmemcheck
gdb-kernel-debugging
3: EARLY-STAGE PLANNING .. _development_early_stage:
Early-stage planning
====================
When contemplating a Linux kernel development project, it can be tempting When contemplating a Linux kernel development project, it can be tempting
to jump right in and start coding. As with any significant project, to jump right in and start coding. As with any significant project,
...@@ -7,7 +10,8 @@ line of code is written. Some time spent in early planning and ...@@ -7,7 +10,8 @@ line of code is written. Some time spent in early planning and
communication can save far more time later on. communication can save far more time later on.
3.1: SPECIFYING THE PROBLEM Specifying the problem
----------------------
Like any engineering project, a successful kernel enhancement starts with a Like any engineering project, a successful kernel enhancement starts with a
clear description of the problem to be solved. In some cases, this step is clear description of the problem to be solved. In some cases, this step is
...@@ -64,7 +68,8 @@ answers to a short set of questions: ...@@ -64,7 +68,8 @@ answers to a short set of questions:
Only then does it make sense to start considering possible solutions. Only then does it make sense to start considering possible solutions.
3.2: EARLY DISCUSSION Early discussion
----------------
When planning a kernel development project, it makes great sense to hold When planning a kernel development project, it makes great sense to hold
discussions with the community before launching into implementation. Early discussions with the community before launching into implementation. Early
...@@ -117,7 +122,8 @@ In each of these cases, a great deal of pain and extra work could have been ...@@ -117,7 +122,8 @@ In each of these cases, a great deal of pain and extra work could have been
avoided with some early discussion with the kernel developers. avoided with some early discussion with the kernel developers.
3.3: WHO DO YOU TALK TO? Who do you talk to?
-------------------
When developers decide to take their plans public, the next question will When developers decide to take their plans public, the next question will
be: where do we start? The answer is to find the right mailing list(s) and be: where do we start? The answer is to find the right mailing list(s) and
...@@ -141,6 +147,8 @@ development project. ...@@ -141,6 +147,8 @@ development project.
The task of finding the right maintainer is sometimes challenging enough The task of finding the right maintainer is sometimes challenging enough
that the kernel developers have added a script to ease the process: that the kernel developers have added a script to ease the process:
::
.../scripts/get_maintainer.pl .../scripts/get_maintainer.pl
This script will return the current maintainer(s) for a given file or This script will return the current maintainer(s) for a given file or
...@@ -155,7 +163,8 @@ If all else fails, talking to Andrew Morton can be an effective way to ...@@ -155,7 +163,8 @@ If all else fails, talking to Andrew Morton can be an effective way to
track down a maintainer for a specific piece of code. track down a maintainer for a specific piece of code.
3.4: WHEN TO POST? When to post?
-------------
If possible, posting your plans during the early stages can only be If possible, posting your plans during the early stages can only be
helpful. Describe the problem being solved and any plans that have been helpful. Describe the problem being solved and any plans that have been
...@@ -179,7 +188,8 @@ idea. The best thing to do in this situation is to proceed, keeping the ...@@ -179,7 +188,8 @@ idea. The best thing to do in this situation is to proceed, keeping the
community informed as you go. community informed as you go.
3.5: GETTING OFFICIAL BUY-IN Getting official buy-in
-----------------------
If your work is being done in a corporate environment - as most Linux If your work is being done in a corporate environment - as most Linux
kernel work is - you must, obviously, have permission from suitably kernel work is - you must, obviously, have permission from suitably
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment