Kernel development
Building, testing, debugging, and contributing to the kernel.
Single-page view · as markdown
Developing the kernel
Peios Kernel / Kernel development / Start here
Use this section when changing the kernel or investigating its behaviour.
- Build and program: start with Building Peios, then the Build system, Kernel programming and Rust guidance.
- Test the change: the Development tools collection includes KUnit, selftests, sanitizers and static analysis. Fault injection exercises error paths.
- Observe the result: use Tracing for runtime behaviour and Livepatch for live code changes.
- Prepare and maintain the work: consult the Development process, Maintainer guidance and Documentation workflow.
The inherited process material describes Linux upstream contribution practices. For work in the Peios repositories, also follow Peios Standards and Conventions and the instructions in the repository you are changing.
Peios build and tooling guides #
- Building Peios: pinned tools, controlled builds, incremental builds and output artifacts.
- Style tooling: formatter and linter setup, scope and CI checks.
- Data generators: event tables, registry seeds, Unicode tables and signing fixtures.
- Shared Rust core tests and ABI regeneration.
- KUnit and guest qualification: kernel execution, logs, signed inputs and result interpretation.
Building Peios
Peios Kernel / Kernel development / Start here
The repository builds the directly maintained kernel source. pekit builds it with Kbuild in a sandbox, from a toolchain it builds from pinned sources, and keeps every result. Run commands from the kernel repository root. The inherited Kbuild reference explains the underlying machinery.
Host requirements #
The host is x86_64 Linux with pekit installed. pekit fetches and builds everything else, pinned by digest:
- LLVM 18.1.8's release, which compiles the kernel.
- Rust 1.83.0 with its source and rustfmt, and bindgen 0.65.1.
- The host tools Kbuild runs, each built from its signed release: bison,
flex, bc, perl, OpenSSL, elfutils, pahole, GNU's core utilities, and
others.
tools.gcsllists them. - The Bootlin GCC toolchain, which builds those tools and Kbuild's own host programs.
The build reads nothing from the host but the kernel it runs on. A kernel build needs about 25 GB of RAM and 70 GB of free disk at its peak, because the object tree holds full debug information.
Build and test #
peios/check first checks that each tracked top-level entry is in the
kernel's source or left out of it on purpose, then runs pekit test --strict.
pekit run kunit and the qualification scripts boot QEMU, so they aren't
tests: run them by hand.
The kernel step is given the kernel's top-level directories and files, and
of peios/ only the build recipe: build.sh, build-settings.json,
generate-keys.py, runner.py, stage-tree.py, verify-config.sh,
config/, and keys/. A change to another Peios script builds no kernel. kernel.gcsl lists the
entries.
The step copies the source into its sandbox and runs peios/build.sh with
a separate O= directory. It has no network, receives no private signing
keys, and uses a fixed build identity, timestamp, and debug paths. No
generated header or .config is written into your source tree. The
configuration invariant checker is retained from PKM, including the ML-DSA,
lockdown, LSM, and firmware policy checks.
The kernel is one step, because Kbuild's own dependency graph is what makes
a kernel build incremental. pekit finds an unchanged kernel in its store.
After a change, the step rebuilds only what the change reaches. It keeps
the source copy and Kbuild's object tree in its scratch directory between
builds, one for each profile. It copies in only the files whose content
changed, so Kbuild sees only those as new. The object tree is wiped first
if the toolchain, peios/build.sh, its settings, the configuration, or the
keys changed. A build that fails keeps the object tree, so fixing the error
rebuilds only what's left. A build that's killed loses it, because a killed
compiler can leave a half-written object, and the next build starts from
nothing.
pekit build --strict builds with nothing of the host's, from an empty
scratch directory, so from nothing. Both kinds of build use the same paths,
so they give the same outputs. --check-reproducible builds each step
twice and compares the outputs. bash peios/test-incremental.sh proves
the incremental build. In a temporary worktree, it breaks a file and requires
the build to fail. It then changes the file, rebuilds incrementally, and
compares every output with a strict build of the same tree.
The kept source and object tree take about 24 GB for each profile, and
pekit counts them in its store's size. Its default limit of 100 GiB leaves
room for both profiles. If they're evicted, give the store more, with
PEKIT_CACHE_LIMIT=150G say. pekit clean --cache removes them with the
store.
peios/build-settings.json gives the build its settings. source_date_epoch
and localversion are explicit inputs; no current clock or Git state is
stamped into the kernel. The initial suffix is -peios-dev, not a release.
peios/config/pkm.fragment defines the Peios configuration. The build runs
peios/verify-config.sh against the resolved configuration. A generic Linux
defconfig doesn't establish the same Peios policy.
Outputs and release limits #
pekit prints where each build's outputs are, under pekit-out/. The kernel's
are bzImage, vmlinux, System.map, resolved config, Module.symvers,
kernel.release, modules.tar, kbuild-support.tar, and build.json. The
support archive retains generated headers, public trust inputs, and Kbuild
helper programs, for building modules against the kernel. The module archive contains raw
unsigned modules and module lists, preserving their Kbuild paths. It
isn't an installable package. build.json records the settings, the profile,
and a digest of the source's contents and modes.
The checked-in peios/keys/dev-modsig.pem certificate and
peios/keys/dev-tcb.hex public key preserve the old PKM development keyring
for production-configuration development builds. KUnit uses the public
certificate in peios/keys/kunit-modsig.pem and an empty built-in TCB table,
matching that existing test path. These are development trust roots, not
release credentials. Substituting release public inputs and choosing release
versions belong to release setup. Module signature enforcement remains
enabled even though this build stage doesn't sign the modules it produces.
Next steps #
- KUnit execution explains logs, filters, and completion checks.
- Guest qualification exercises native syscalls, mounted filesystems, and signed inputs.
- Style tooling and shared Rust core tests cover host checks.
- Data generators covers event tables, registry seed data, Unicode tables, and test fixtures.
Data Generators
Peios Kernel / Kernel development / Peios build tools
Run commands from the kernel repository root. Generated outputs are reviewed alongside their source inputs; a check command should not replace them.
KMES event tables #
Edit the kernel event catalog in peios/packages/data/evman/*.evman, then
run:
The generator writes security/pkm/kmes/event_types.h and event_types.rs.
Commit the catalog and generated tables together. It preserves matching C/Rust
IDs, event names, tiers, default enablement, and the registry-policy lookup
tree.
IDs are kernel-internal; event records carry names. The current enabled mask
supports at most 64 event types, and generation rejects a larger catalog.
The test checks for stale tables without rewriting them and exercises
generator
validation. CI runs it alongside the style, Cargo, and ABI checks. Python 3.11
or
newer can also run python3 peios/gen-kmes-event-table.py directly; add
--check
for read-only drift detection. No old PKM checkout is required.
Port-reservation seed #
peios/gen-port-reservations-seed.py regenerates the security descriptors in
peios/packages/data/regim/port-reservations.reg. It derives the
bindLowPorts
capability SID and emits the PORT_BIND | READ_CONTROL grants for the
existing
seed entries. The registry file must already exist; this updates its
descriptors
and capability comment rather than creating a registry tree from nothing.
The Python entry point also accepts --output PATH for an existing seed file.
--check reports drift and exits unsuccessfully without rewriting it.
Unicode case-folding tables #
peios/generate-casefold-table.py reads a supplied Unicode CaseFolding.txt.
It requires --input and at least one of --out (Rust) or --go-out (Go).
The maintained input version is Unicode 16.0.0, with SHA-256
6f1f9c588eb4a5c718d9e8f93b782685e5c7fec872cf05e8e6878053599e09bb.
The generator records the input hash; it does not fetch or enforce that pin.
Only common and simple mappings, statuses C and S, define registry identity.
Full and Turkic mappings are excluded.
Choose the Go destination in the maintained loregd checkout and update both
consumers from the same input. There is no --check mode: generate into
temporary
files for comparison when reviewing drift. The Go path is an explicit output,
not an implicit dependency on a sibling repository.
ML-DSA KUnit vectors #
peios/generate-kacs-kunit-mldsa-vectors.py requires OpenSSL 3.5 or later
with
ML-DSA support. It creates a fresh ML-DSA-65 test key on each invocation and
writes public key, message, and signature fixtures for KACS. The temporary
private
key is discarded. These are test vectors, not release signing credentials.
Regeneration deliberately replaces randomized fixtures; it is not a reproducible drift check. Review the generated header and run the affected KUnit tests.
Build-generated trust table and configuration checks #
Despite its name, peios/generate-keys.py does not generate a signing
keypair.
It converts a supplied ML-DSA-65 public key into the built-in KACS header.
--pubkey-hex accepts a 1,952-byte public key encoded as hexadecimal;
--out selects the header. --allow-empty permits a terminator-only table
for
test builds. The production build supplies peios/keys/dev-tcb.hex; the KUnit
profile explicitly selects an empty table. peios/build.sh performs this step
inside the build container, without modifying the checkout.
peios/verify-config.sh PATH_TO_CONFIG checks the resolved configuration's
security invariants, including ML-DSA, lockdown, LSM, and firmware policy. The
build runs it after resolving the configuration. See
Building Peios for the public
trust inputs and the distinction between development and release outputs.
Other generators #
ABI regeneration covers compiled Rust bindings. Documentation maintenance covers generated reference tables. These have different outputs and checks.
Companion source and binary inputs #
A companion project must distinguish the kernel source used for ABI headers
from the built image used for a guest run. Use that project's maintained
header-selection interface and record the selected source revision. Expose
include/uapi/pkm to host compilation rather than replacing the host libc's
Linux headers with the entire raw kernel header tree.
Keep the image hash, resolved configuration, and build.json with guest logs.
A matching source path alone does not prove that the supplied image was built
from it. The consolidated C SDK owns its current ABI-check instructions;
retired libpeios and librsi checkout paths are not required by this guide.
Host checks and guest qualification #
The host-side checks leave maintained source inputs unchanged:
The KUnit runner checks use a controlled emulator substitute to exercise verdict handling. The qualification build check compiles the guest programs. Neither result establishes that a real kernel passed those guest tests. Guest Qualification covers image inputs, signing fixtures, timeouts, and retained runtime evidence.
Style tooling
Peios Kernel / Kernel development / Peios build tools
Run commands from the kernel repository root. Follow peios/CODING_STYLE.md
and Peios Standards and Conventions for the underlying rules.
The kernel carries the subset of the central Peios style tooling that it needs.
It works from this checkout alone. peios/style/ORIGIN.json records central configuration
hashes and adaptations; update the snapshot deliberately when policy changes.
Setup and use #
Use x86_64 Linux. Setup needs Python 3.14.4 with venv/pip, network access, and rustfmt installed for Rust 1.83.0 and 1.98.1. The existing build wrappers still support Python 3.11; the newer Python version belongs to the style tools.
Select Python 3.14.8 for the setup command. It installs exact, hash-locked wheels
and binaries in ~/.cache/peios/kernel-style/<lock-identity>. Set
PEIOS_STYLE_CACHE to relocate that cache. Setup does not install Rust or change
the default toolchain. Checks verify tools and fail if setup is missing; checks
never download dependencies or repair source. A check can be run directly with
python3 peios/style.py check; formatting with python3 peios/style.py format.
pekit test style style_tool runs the same checks in a sandbox, with the
tools pekit installs from the same locks (style.gcsl), so nothing of the
host's is used: Python 3.14.8, the locked wheels, shfmt, shellcheck, and
rustfmt for both pinned Rust toolchains.
Scope and gates #
peios/style/scope.json lists owned roots, individual integration headers, and exclusions
with reasons. Run python3 peios/style.py inventory to inspect the selected
files. New supported source files under an owned root are discovered automatically.
When adding an independently owned root, update this scope.
Included: Peios subsystems under security/pkm, fs/stratafs, and net/ntfe;
their owned integration/UAPI headers; Peios build wrappers; this tooling;
and the Cargo workspace and tests. Generated constants, event tables, test
vectors, Unicode tables and ABI types stay generated. The separate, active documentation
migration is temporarily excluded; its style integration is still outstanding.
Blocking checks are formatter stability, Ruff, mypy, ShellCheck and the selected
buildifier checks. C uses clang-format 18.1.8 and the inherited .clang-format.
Kernel Rust uses rustfmt 1.83.0 and .rustfmt.toml, preserving module/import order
as approved for Peios source. Host Rust uses rustfmt 1.98.1 and each Cargo crate's
edition. Formatters receive one file at a time; Rust formatting does not traverse
into excluded child modules. Python uses the common 3.11 syntax profile and
package-local import roots. Mypy does not reuse incremental results.
style-review runs the checked-out kernel's checkpatch against a chosen Git base.
It reports findings without imposing checkpatch's whole policy as a merge gate.
Git/tool failures still fail the command. Untracked additions are not in a Git
diff; the owned-file style check covers their formatting. The command does not
modify code. Review inheritance changes in their surrounding upstream context.
Soft width/function-size/nesting guidance, names, ownership, interfaces and performance remain review responsibilities. Compiler checks and KUnit retain their normal build commands. No full-kernel clang-tidy policy is introduced.
CI #
.github/workflows/style.yml installs the same pins and runs the same style,
command regression, Cargo, C ABI, KMES event-table, data-generator, KUnit
runner, and qualification-build checks directly on pushes and pull requests.
PRs also receive advisory checkpatch output against the merge commit's first
parent. Actions are pinned to reviewed release commit IDs, credentials are not
persisted, and the workflow has read-only repository permission.
Making the workflow job a required merge check is a separate repository-settings action; the workflow file does not establish branch protection. The workflow does not claim a kernel build or VM test.
Kernel Build System
Peios Kernel / Kernel development / Build system
Peios: Use Building Peios for the repository build, toolchain, configuration and test entry points. This article describes the underlying Linux machinery or upstream workflow. Its standalone build/install commands do not establish a qualified Peios kernel or signed release modules.
- Kconfig Language
- Kconfig macro language
- Kbuild
- Configuration targets and editors
- Linux Kernel Makefiles
- Building External Modules
- Exporting kernel headers for use by userspace
- issues
- Reproducible builds
- GCC plugin infrastructure
- Building Linux with Clang/LLVM
- DWARF module versioning
- Bash completion for Kbuild
Bash completion for Kbuild
Peios Kernel / Kernel development / Build system
The kernel build system is written using Makefiles, and Bash completion for the make command is available through the bash-completion project.
However, the Makefiles for the kernel build are complex. The generic completion rules for the make command do not provide meaningful suggestions for the kernel build system, except for the options of the make command itself.
To enhance completion for various variables and targets, the kernel source includes its own completion script at scripts/bash-completion/make.
This script provides additional completions when working within the kernel tree. Outside the kernel tree, it defaults to the generic completion rules for the make command.
Prerequisites #
The script relies on helper functions provided by bash-completion project. Please ensure it is installed on your system. On most distributions, you can install the bash-completion package through the standard package manager.
How to use #
You can source the script directly:
$ source scripts/bash-completion/make
Or, you can copy it into the search path for Bash completion scripts. For example:
$ mkdir -p ~/.local/share/bash-completion/completions
$ cp scripts/bash-completion/make ~/.local/share/bash-completion/completions/
Details #
The additional completion for Kbuild is enabled in the following cases:
You are in the root directory of the kernel source.
You are in the top-level build directory created by the O= option (checked via the
sourcesymlink pointing to the kernel source).The -C make option specifies the kernel source or build directory.
The -f make option specifies a file in the kernel source or build directory.
If none of the above are met, it falls back to the generic completion rules.
The completion supports:
Commonly used targets, such as
all,menuconfig,dtbs, etc.Make (or environment) variables, such as
ARCH,LLVM, etc.Single-target builds (
foo/bar/baz.o)Configuration files (
*_defconfigand*.config)
Some variables offer intelligent behavior. For instance, CROSS_COMPILE= followed by a TAB displays installed toolchains. The list of defconfig files shown depends on the value of the ARCH= variable.
GCC plugin infrastructure
Peios Kernel / Kernel development / Build system
Introduction #
GCC plugins are loadable modules that provide extra features to the compiler 1. They are useful for runtime instrumentation and static analysis. We can analyse, change and add further code during compilation via callbacks 2, GIMPLE 3, IPA 4 and RTL passes 5.
The GCC plugin infrastructure of the kernel supports building out-of-tree modules, cross-compilation and building in a separate directory. Plugin source files have to be compilable by a C++ compiler.
Currently the GCC plugin infrastructure supports only some architectures. Grep "select HAVE_GCC_PLUGINS" to find out which architectures support GCC plugins.
This infrastructure was ported from grsecurity 6 and PaX 7.
--
[1] https://gcc.gnu.org/onlinedocs/gccint/Plugins.html
[2] https://gcc.gnu.org/onlinedocs/gccint/Plugin-API.html#Plugin-API
[3] https://gcc.gnu.org/onlinedocs/gccint/GIMPLE.html
[4] https://gcc.gnu.org/onlinedocs/gccint/IPA.html
[5] https://gcc.gnu.org/onlinedocs/gccint/RTL.html
[7] https://pax.grsecurity.net/
Purpose #
GCC plugins are designed to provide a place to experiment with potential compiler features that are neither in GCC nor Clang upstream. Once their utility is proven, the goal is to upstream the feature into GCC (and Clang), and then to finally remove them from the kernel once the feature is available in all supported versions of GCC.
Specifically, new plugins should implement only features that have no upstream compiler support (in either GCC or Clang).
When a feature exists in Clang but not GCC, effort should be made to bring the feature to upstream GCC (rather than just as a kernel-specific GCC plugin), so the entire ecosystem can benefit from it.
Similarly, even if a feature provided by a GCC plugin does not exist in Clang, but the feature is proven to be useful, effort should be spent to upstream the feature to GCC (and Clang).
After a feature is available in upstream GCC, the plugin will be made unbuildable for the corresponding GCC version (and later). Once all kernel-supported versions of GCC provide the feature, the plugin will be removed from the kernel.
Files #
$(src)/scripts/gcc-plugins
This is the directory of the GCC plugins.
$(src)/scripts/gcc-plugins/gcc-common.h
This is a compatibility header for GCC plugins. It should be always included instead of individual gcc headers.
$(src)/scripts/gcc-plugins/gcc-generate-gimple-pass.h, $(src)/scripts/gcc-plugins/gcc-generate-ipa-pass.h, $(src)/scripts/gcc-plugins/gcc-generate-simple_ipa-pass.h, $(src)/scripts/gcc-plugins/gcc-generate-rtl-pass.h
These headers automatically generate the registration structures for GIMPLE, SIMPLE_IPA, IPA and RTL passes. They should be preferred to creating the structures by hand.
Usage #
You must install the gcc plugin headers for your gcc version, e.g., on Ubuntu for gcc-10:
apt-get install gcc-10-plugin-dev
Or on Fedora:
dnf install gcc-plugin-devel libmpc-devel
Or on Fedora when using cross-compilers that include plugins:
dnf install libmpc-devel
Enable the GCC plugin infrastructure and some plugin(s) you want to use in the kernel config:
CONFIG_GCC_PLUGINS=y
CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
...
Run gcc (native or cross-compiler) to ensure plugin headers are detected:
gcc -print-file-name=plugin
CROSS_COMPILE=arm-linux-gnu- ${CROSS_COMPILE}gcc -print-file-name=plugin
The word "plugin" means they are not detected:
plugin
A full path means they are detected:
/usr/lib/gcc/x86_64-redhat-linux/12/plugin
To compile the minimum tool set including the plugin(s):
make scripts
or just run the kernel make and compile the whole kernel with the cyclomatic complexity GCC plugin.
4. How to add a new GCC plugin #
The GCC plugins are in scripts/gcc-plugins/. You need to put plugin source files right under scripts/gcc-plugins/. Creating subdirectories is not supported. It must be added to scripts/gcc-plugins/Makefile, scripts/Makefile.gcc-plugins and a relevant Kconfig file.
DWARF module versioning
Peios Kernel / Kernel development / Build system
Introduction #
When CONFIG_MODVERSIONS is enabled, symbol versions for modules are typically calculated from preprocessed source code using the genksyms tool. However, this is incompatible with languages such as Rust, where the source code has insufficient information about the resulting ABI. With CONFIG_GENDWARFKSYMS (and CONFIG_DEBUG_INFO) selected, gendwarfksyms is used instead to calculate symbol versions from the DWARF debugging information, which contains the necessary details about the final module ABI.
Dependencies #
gendwarfksyms depends on the libelf, libdw, and zlib libraries.
Here are a few examples of how to install these dependencies:
-
Arch Linux and derivatives:
sudo pacman --needed -S libelf zlib -
Debian, Ubuntu, and derivatives:
sudo apt install libelf-dev libdw-dev zlib1g-dev -
Fedora and derivatives:
sudo dnf install elfutils-libelf-devel elfutils-devel zlib-devel -
openSUSE and derivatives:
sudo zypper install libelf-devel libdw-devel zlib-devel
Usage #
gendwarfksyms accepts a list of object files on the command line, and a list of symbol names (one per line) in standard input:
Usage: gendwarfksyms [options] elf-object-file ... < symbol-list
Options:
-d, --debug Print debugging information
--dump-dies Dump DWARF DIE contents
--dump-die-map Print debugging information about die_map changes
--dump-types Dump type strings
--dump-versions Dump expanded type strings used for symbol versions
-s, --stable Support kABI stability features
-T, --symtypes file Write a symtypes file
-h, --help Print this message
Type information availability #
While symbols are typically exported in the same translation unit (TU) where they're defined, it's also perfectly fine for a TU to export external symbols. For example, this is done when calculating symbol versions for exports in stand-alone assembly code.
To ensure the compiler emits the necessary DWARF type information in the TU where symbols are actually exported, gendwarfksyms adds a pointer to exported symbols in the EXPORT_SYMBOL() macro using the following macro:
#define __GENDWARFKSYMS_EXPORT(sym) \
static typeof(sym) *__gendwarfksyms_ptr_##sym __used \
__section(".discard.gendwarfksyms") = &sym;
When a symbol pointer is found in DWARF, gendwarfksyms can use its type for calculating symbol versions even if the symbol is defined elsewhere. The name of the symbol pointer is expected to start with __gendwarfksyms_ptr_, followed by the name of the exported symbol.
Symtypes output format #
Similarly to genksyms, gendwarfksyms supports writing a symtypes file for each processed object that contain types for exported symbols and each referenced type that was used in calculating symbol versions. These files can be useful when trying to determine what exactly caused symbol versions to change between builds. To generate symtypes files during a kernel build, set KBUILD_SYMTYPES=1.
Matching the existing format, the first column of each line contains either a type reference or a symbol name. Type references have a one-letter prefix followed by "#" and the name of the type. Four reference types are supported:
e#<type> = enum
s#<type> = struct
t#<type> = typedef
u#<type> = union
Type names with spaces in them are wrapped in single quotes, e.g.:
s#'core::result::Result<u8, core::num::error::ParseIntError>'
The rest of the line contains a type string. Unlike with genksyms that produces C-style type strings, gendwarfksyms uses the same simple parsed DWARF format produced by --dump-dies, but with type references instead of fully expanded strings.
Maintaining a stable kABI #
Distribution maintainers often need the ability to make ABI compatible changes to kernel data structures due to LTS updates or backports. Using the traditional #ifndef __GENKSYMS__ to hide these changes from symbol versioning won't work when processing object files. To support this use case, gendwarfksyms provides kABI stability features designed to hide changes that won't affect the ABI when calculating versions. These features are all gated behind the --stable command line flag and are not used in the mainline kernel. To use stable features during a kernel build, set KBUILD_GENDWARFKSYMS_STABLE=1.
Examples for using these features are provided in the scripts/gendwarfksyms/examples directory, including helper macros for source code annotation. Note that as these features are only used to transform the inputs for symbol versioning, the user is responsible for ensuring that their changes actually won't break the ABI.
kABI rules #
kABI rules allow distributions to fine-tune certain parts of gendwarfksyms output and thus control how symbol versions are calculated. These rules are defined in the .discard.gendwarfksyms.kabi_rules section of the object file and consist of simple null-terminated strings with the following structure:
version\0type\0target\0value\0
This string sequence is repeated as many times as needed to express all the rules. The fields are as follows:
-
version: Ensures backward compatibility for future changes to the structure. Currently expected to be "1". -
type: Indicates the type of rule being applied. -
target: Specifies the target of the rule, typically the fully qualified name of the DWARF Debugging Information Entry (DIE). -
value: Provides rule-specific data.
The following helper macros, for example, can be used to specify rules in the source code:
#define ___KABI_RULE(hint, target, value) \
static const char __PASTE(__gendwarfksyms_rule_, \
__COUNTER__)[] __used __aligned(1) \
__section(".discard.gendwarfksyms.kabi_rules") = \
"1\0" #hint "\0" target "\0" value
#define __KABI_RULE(hint, target, value) \
___KABI_RULE(hint, #target, #value)
Currently, only the rules discussed in this section are supported, but the format is extensible enough to allow further rules to be added as need arises.
Managing definition visibility #
A declaration can change into a full definition when additional includes are pulled into the translation unit. This changes the versions of any symbol that references the type even if the ABI remains unchanged. As it may not be possible to drop includes without breaking the build, the declonly rule can be used to specify a type as declaration-only, even if the debugging information contains the full definition.
The rule fields are expected to be as follows:
-
type: "declonly" -
target: The fully qualified name of the target data structure (as shown in --dump-dies output). -
value: This field is ignored.
Using the __KABI_RULE macro, this rule can be defined as:
#define KABI_DECLONLY(fqn) __KABI_RULE(declonly, fqn, )
Example usage:
struct s {
/* definition */
};
KABI_DECLONLY(s);
Adding enumerators #
For enums, all enumerators and their values are included in calculating symbol versions, which becomes a problem if we later need to add more enumerators without changing symbol versions. The enumerator_ignore rule allows us to hide named enumerators from the input.
The rule fields are expected to be as follows:
-
type: "enumerator_ignore" -
target: The fully qualified name of the target enum (as shown in --dump-dies output) and the name of the enumerator field separated by a space. -
value: This field is ignored.
Using the __KABI_RULE macro, this rule can be defined as:
#define KABI_ENUMERATOR_IGNORE(fqn, field) \
__KABI_RULE(enumerator_ignore, fqn field, )
Example usage:
enum e {
A, B, C, D,
};
KABI_ENUMERATOR_IGNORE(e, B);
KABI_ENUMERATOR_IGNORE(e, C);
If the enum additionally includes an end marker and new values must be added in the middle, we may need to use the old value for the last enumerator when calculating versions. The enumerator_value rule allows us to override the value of an enumerator for version calculation:
-
type: "enumerator_value" -
target: The fully qualified name of the target enum (as shown in --dump-dies output) and the name of the enumerator field separated by a space. -
value: Integer value used for the field.
Using the __KABI_RULE macro, this rule can be defined as:
#define KABI_ENUMERATOR_VALUE(fqn, field, value) \
__KABI_RULE(enumerator_value, fqn field, value)
Example usage:
enum e {
A, B, C, LAST,
};
KABI_ENUMERATOR_IGNORE(e, C);
KABI_ENUMERATOR_VALUE(e, LAST, 2);
Managing structure size changes #
A data structure can be partially opaque to modules if its allocation is handled by the core kernel, and modules only need to access some of its members. In this situation, it's possible to append new members to the structure without breaking the ABI, as long as the layout for the original members remains unchanged.
To append new members, we can hide them from symbol versioning as described in section Hiding members, but we can't hide the increase in structure size. The byte_size rule allows us to override the structure size used for symbol versioning.
The rule fields are expected to be as follows:
-
type: "byte_size" -
target: The fully qualified name of the target data structure (as shown in --dump-dies output). -
value: A positive decimal number indicating the structure size in bytes.
Using the __KABI_RULE macro, this rule can be defined as:
#define KABI_BYTE_SIZE(fqn, value) \
__KABI_RULE(byte_size, fqn, value)
Example usage:
struct s {
/* Unchanged original members */
unsigned long a;
void *p;
/* Appended new members */
KABI_IGNORE(0, unsigned long n);
};
KABI_BYTE_SIZE(s, 16);
Overriding type strings #
In rare situations where distributions must make significant changes to otherwise opaque data structures that have inadvertently been included in the published ABI, keeping symbol versions stable using the more targeted kABI rules can become tedious. The type_string rule allows us to override the full type string for a type or a symbol, and even add types for versioning that no longer exist in the kernel.
The rule fields are expected to be as follows:
-
type: "type_string" -
target: The fully qualified name of the target data structure (as shown in --dump-dies output) or symbol. -
value: A valid type string (as shown in --symtypes) output) to use instead of the real type.
Using the __KABI_RULE macro, this rule can be defined as:
#define KABI_TYPE_STRING(type, str) \
___KABI_RULE("type_string", type, str)
Example usage:
/* Override type for a structure */
KABI_TYPE_STRING("s#s",
"structure_type s { "
"member base_type int byte_size(4) "
"encoding(5) n "
"data_member_location(0) "
"} byte_size(8)");
/* Override type for a symbol */
KABI_TYPE_STRING("my_symbol", "variable s#s");
The type_string rule should be used only as a last resort if maintaining a stable symbol versions cannot be reasonably achieved using other means. Overriding a type string increases the risk of actual ABI breakages going unnoticed as it hides all changes to the type.
Adding structure members #
Perhaps the most common ABI compatible change is adding a member to a kernel data structure. When changes to a structure are anticipated, distribution maintainers can pre-emptively reserve space in the structure and take it into use later without breaking the ABI. If changes are needed to data structures without reserved space, existing alignment holes can potentially be used instead. While kABI rules could be added for these type of changes, using unions is typically a more natural method. This section describes gendwarfksyms support for using reserved space in data structures and hiding members that don't change the ABI when calculating symbol versions.
Reserving space and replacing members #
Space is typically reserved for later use by appending integer types, or arrays, to the end of the data structure, but any type can be used. Each reserved member needs a unique name, but as the actual purpose is usually not known at the time the space is reserved, for convenience, names that start with __kabi_ are left out when calculating symbol versions:
struct s {
long a;
long __kabi_reserved_0; /* reserved for future use */
};
The reserved space can be taken into use by wrapping the member in a union, which includes the original type and the replacement member:
struct s {
long a;
union {
long __kabi_reserved_0; /* original type */
struct b b; /* replaced field */
};
};
If the __kabi_ naming scheme was used when reserving space, the name of the first member of the union must start with __kabi_reserved. This ensures the original type is used when calculating versions, but the name is again left out. The rest of the union is ignored.
If we're replacing a member that doesn't follow this naming convention, we also need to preserve the original name to avoid changing versions, which we can do by changing the first union member's name to start with __kabi_renamed followed by the original name.
The examples include KABI_(RESERVE|USE|REPLACE)* macros that help simplify the process and also ensure the replacement member is correctly aligned and its size won't exceed the reserved space.
Hiding members #
Predicting which structures will require changes during the support timeframe isn't always possible, in which case one might have to resort to placing new members into existing alignment holes:
struct s {
int a;
/* a 4-byte alignment hole */
unsigned long b;
};
While this won't change the size of the data structure, one needs to be able to hide the added members from symbol versioning. Similarly to reserved fields, this can be accomplished by wrapping the added member to a union where one of the fields has a name starting with __kabi_ignored:
struct s {
int a;
union {
char __kabi_ignored_0;
int n;
};
unsigned long b;
};
With --stable, both versions produce the same symbol version. The examples include a KABI_IGNORE macro to simplify the code.
Exporting kernel headers for use by userspace
Peios Kernel / Kernel development / Build system
The "make headers_install" command exports the kernel's header files in a form suitable for use by userspace programs.
The linux kernel's exported header files describe the API for user space programs attempting to use kernel services. These kernel header files are used by the system's C library (such as glibc or uClibc) to define available system calls, as well as constants and structures to be used with these system calls. The C library's header files include the kernel header files from the "linux" subdirectory. The system's libc headers are usually installed at the default location /usr/include and the kernel headers in subdirectories under that (most notably /usr/include/linux and /usr/include/asm).
Kernel headers are backwards compatible, but not forwards compatible. This means that a program built against a C library using older kernel headers should run on a newer kernel (although it may not have access to new features), but a program built against newer kernel headers may not work on an older kernel.
The "make headers_install" command can be run in the top level directory of the kernel source code (or using a standard out-of-tree build). It takes two optional arguments:
make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
ARCH indicates which architecture to produce headers for, and defaults to the current architecture. The linux/asm directory of the exported kernel headers is platform-specific, to see a complete list of supported architectures use the command:
ls -d include/asm-* | sed 's/.*-//'
INSTALL_HDR_PATH indicates where to install the headers. It defaults to "./usr".
An 'include' directory is automatically created inside INSTALL_HDR_PATH and headers are installed in 'INSTALL_HDR_PATH/include'.
The kernel header export infrastructure is maintained by David Woodhouse <dwmw2@infradead.org>.
Recursion issues
Peios Kernel / Kernel development / Build system
issue #1 #
# Simple Kconfig recursive issue
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Test with:
#
# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
#
# This Kconfig file has a simple recursive dependency issue. In order to
# understand why this recursive dependency issue occurs lets consider what
# Kconfig needs to address. We iterate over what Kconfig needs to address
# by stepping through the questions it needs to address sequentially.
#
# * What values are possible for CORE?
#
# CORE_BELL_A_ADVANCED selects CORE, which means that it influences the values
# that are possible for CORE. So for example if CORE_BELL_A_ADVANCED is 'y',
# CORE must be 'y' too.
#
# * What influences CORE_BELL_A_ADVANCED?
#
# As the name implies CORE_BELL_A_ADVANCED is an advanced feature of
# CORE_BELL_A so naturally it depends on CORE_BELL_A. So if CORE_BELL_A is 'y'
# we know CORE_BELL_A_ADVANCED can be 'y' too.
#
# * What influences CORE_BELL_A?
#
# CORE_BELL_A depends on CORE, so CORE influences CORE_BELL_A.
#
# But that is a problem, because this means that in order to determine
# what values are possible for CORE we ended up needing to address questions
# regarding possible values of CORE itself again. Answering the original
# question of what are the possible values of CORE would make the kconfig
# tools run in a loop. When this happens Kconfig exits and complains about
# the "recursive dependency detected" error.
#
# Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be
# obvious that an easy solution to this problem should just be the removal
# of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already
# since CORE_BELL_A depends on CORE. Recursive dependency issues are not always
# so trivial to resolve, we provide another example below of practical
# implications of this recursive issue where the solution is perhaps not so
# easy to understand. Note that matching semantics on the dependency on
# CORE also consist of a solution to this recursive problem.
mainmenu "Simple example to demo kconfig recursive dependency issue"
config CORE
tristate
config CORE_BELL_A
tristate
depends on CORE
config CORE_BELL_A_ADVANCED
tristate
depends on CORE_BELL_A
select CORE
issue #2 #
# Cumulative Kconfig recursive issue
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Test with:
#
# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
#
# The recursive limitations with Kconfig has some non intuitive implications on
# kconfig semantics which are documented here. One known practical implication
# of the recursive limitation is that drivers cannot negate features from other
# drivers if they share a common core requirement and use disjoint semantics to
# annotate those requirements, ie, some drivers use "depends on" while others
# use "select". For instance it means if a driver A and driver B share the same
# core requirement, and one uses "select" while the other uses "depends on" to
# annotate this, all features that driver A selects cannot now be negated by
# driver B.
#
# A perhaps not so obvious implication of this is that, if semantics on these
# core requirements are not carefully synced, as drivers evolve features
# they select or depend on end up becoming shared requirements which cannot be
# negated by other drivers.
#
# The example provided in Documentation/kbuild/Kconfig.recursion-issue-02
# describes a simple driver core layout of example features a kernel might
# have. Let's assume we have some CORE functionality, then the kernel has a
# series of bells and whistles it desires to implement, its not so advanced so
# it only supports bells at this time: CORE_BELL_A and CORE_BELL_B. If
# CORE_BELL_A has some advanced feature CORE_BELL_A_ADVANCED which selects
# CORE_BELL_A then CORE_BELL_A ends up becoming a common BELL feature which
# other bells in the system cannot negate. The reason for this issue is
# due to the disjoint use of semantics on expressing each bell's relationship
# with CORE, one uses "depends on" while the other uses "select". Another
# more important reason is that kconfig does not check for dependencies listed
# under 'select' for a symbol, when such symbols are selected kconfig them
# as mandatory required symbols. For more details on the heavy handed nature
# of select refer to Documentation/kbuild/Kconfig.select-break
#
# To fix this the "depends on CORE" must be changed to "select CORE", or the
# "select CORE" must be changed to "depends on CORE".
#
# For an example real world scenario issue refer to the attempt to remove
# "select FW_LOADER" [0], in the end the simple alternative solution to this
# problem consisted on matching semantics with newly introduced features.
#
# [0] https://lore.kernel.org/r/1432241149-8762-1-git-send-email-mcgrof@do-not-panic.com
mainmenu "Simple example to demo cumulative kconfig recursive dependency implication"
config CORE
tristate
config CORE_BELL_A
tristate
depends on CORE
config CORE_BELL_A_ADVANCED
tristate
select CORE_BELL_A
config CORE_BELL_B
tristate
depends on !CORE_BELL_A
select CORE
Kbuild
Peios Kernel / Kernel development / Build system
Output files #
modules.order #
This file records the order in which modules appear in Makefiles. This is used by modprobe to deterministically resolve aliases that match multiple modules.
modules.builtin #
This file lists all modules that are built into the kernel. This is used by modprobe to not fail when trying to load something builtin.
modules.builtin.modinfo #
This file contains modinfo from all modules that are built into the kernel. Unlike modinfo of a separate module, all fields are prefixed with module name.
modules.builtin.ranges #
This file contains address offset ranges (per ELF section) for all modules that are built into the kernel. Together with System.map, it can be used to associate module names with symbols.
Environment variables #
KCPPFLAGS #
Additional options to pass when preprocessing. The preprocessing options will be used in all cases where kbuild does preprocessing including building C files and assembler files.
KAFLAGS #
Additional options to the assembler (for built-in and modules).
AFLAGS_MODULE #
Additional assembler options for modules.
AFLAGS_KERNEL #
Additional assembler options for built-in.
KCFLAGS #
Additional options to the C compiler (for built-in and modules).
KRUSTFLAGS #
Additional options to the Rust compiler (for built-in and modules).
CFLAGS_KERNEL #
Additional options for $(CC) when used to compile code that is compiled as built-in.
CFLAGS_MODULE #
Additional module specific options to use for $(CC).
RUSTFLAGS_KERNEL #
Additional options for $(RUSTC) when used to compile code that is compiled as built-in.
RUSTFLAGS_MODULE #
Additional module specific options to use for $(RUSTC).
LDFLAGS_MODULE #
Additional options used for $(LD) when linking modules.
HOSTCFLAGS #
Additional flags to be passed to $(HOSTCC) when building host programs.
HOSTCXXFLAGS #
Additional flags to be passed to $(HOSTCXX) when building host programs.
HOSTRUSTFLAGS #
Additional flags to be passed to $(HOSTRUSTC) when building host programs.
PROCMACROLDFLAGS #
Flags to be passed when linking Rust proc macros. Since proc macros are loaded by rustc at build time, they must be linked in a way that is compatible with the rustc toolchain being used.
For instance, it can be useful when rustc uses a different C library than the one the user wants to use for host programs.
If unset, it defaults to the flags passed when linking host programs.
HOSTLDFLAGS #
Additional flags to be passed when linking host programs.
HOSTLDLIBS #
Additional libraries to link against when building host programs.
USERCFLAGS #
Additional options used for $(CC) when compiling userprogs.
USERLDFLAGS #
Additional options used for $(LD) when linking userprogs. userprogs are linked with CC, so $(USERLDFLAGS) should include "-Wl," prefix as applicable.
KBUILD_KCONFIG #
Set the top-level Kconfig file to the value of this environment variable. The default name is "Kconfig".
KBUILD_VERBOSE #
Set the kbuild verbosity. Can be assigned same values as "V=...".
See make help for the full list.
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD #
Set the directory to look for the kernel source when building external modules.
Setting "M=..." takes precedence over KBUILD_EXTMOD.
KBUILD_OUTPUT #
Specify the output directory when building the kernel.
This variable can also be used to point to the kernel output directory when building external modules against a pre-built kernel in a separate build directory. Please note that this does NOT specify the output directory for the external modules themselves. (Use KBUILD_EXTMOD_OUTPUT for that purpose.)
The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT.
KBUILD_EXTMOD_OUTPUT #
Specify the output directory for external modules.
Setting "MO=..." takes precedence over KBUILD_EXTMOD_OUTPUT.
KBUILD_EXTRA_WARN #
Specify the extra build checks. The same value can be assigned by passing W=... from the command line.
See make help for the list of the supported values.
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
KBUILD_DEBARCH #
For the deb-pkg target, allows overriding the normal heuristics deployed by deb-pkg. Normally deb-pkg attempts to guess the right architecture based on the UTS_MACHINE variable, and on some architectures also the kernel config. The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian architecture.
KDOCFLAGS #
Specify extra (warning/error) flags for kernel-doc checks during the build, see tools/docs/kernel-doc for which flags are supported. Note that this doesn't (currently) apply to documentation builds.
ARCH #
Set ARCH to the architecture to be built.
In most cases the name of the architecture is the same as the directory name found in the arch/ directory.
But some architectures such as x86 and sparc have aliases.
-
x86: i386 for 32 bit, x86_64 for 64 bit
-
parisc: parisc64 for 64 bit
-
sparc: sparc32 for 32 bit, sparc64 for 64 bit
CROSS_COMPILE #
Specify an optional fixed part of the binutils filename. CROSS_COMPILE can be a part of the filename or the full path.
CROSS_COMPILE is also used for ccache in some setups.
CF #
Additional options for sparse.
CF is often used on the command-line like this:
make CF=-Wbitwise C=2
INSTALL_PATH #
INSTALL_PATH specifies where to place the updated kernel and system map images. Default is /boot, but you can set it to other values.
INSTALLKERNEL #
Install script called when using "make install". The default name is "installkernel".
The script will be called with the following arguments:
$1 - kernel version
$2 - kernel image file
$3 - kernel map file
$4 - default install path (use root directory if blank)
The implementation of "make install" is architecture specific and it may differ from the above.
INSTALLKERNEL is provided to enable the possibility to specify a custom installer when cross compiling a kernel.
MODLIB #
Specify where to install modules. The default value is:
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
INSTALL_MOD_PATH #
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory relocations required by build roots. This is not defined in the makefile but the argument can be passed to make if needed.
INSTALL_MOD_STRIP #
INSTALL_MOD_STRIP, if defined, will cause modules to be stripped after they are installed. If INSTALL_MOD_STRIP is '1', then the default option --strip-debug will be used. Otherwise, INSTALL_MOD_STRIP value will be used as the options to the strip command.
INSTALL_HDR_PATH #
INSTALL_HDR_PATH specifies where to install user space headers when executing "make headers_*".
The default value is:
$(objtree)/usr
$(objtree) is the directory where output files are saved. The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
INSTALL_DTBS_PATH #
INSTALL_DTBS_PATH specifies where to install device tree blobs for relocations required by build roots. This is not defined in the makefile but the argument can be passed to make if needed.
KBUILD_ABS_SRCTREE #
Kbuild uses a relative path to point to the tree when possible. For instance, when building in the source tree, the source tree path is '.'
Setting this flag requests Kbuild to use absolute path to the source tree. There are some useful cases to do so, like when generating tag files with absolute path entries etc.
KBUILD_SIGN_PIN #
This variable allows a passphrase or PIN to be passed to the sign-file utility when signing kernel modules, if the private key requires such.
KBUILD_MODPOST_WARN #
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined symbols in the final module linking stage. It changes such errors into warnings.
KBUILD_MODPOST_NOFINAL #
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. This is solely useful to speed up test compiles.
KBUILD_EXTRA_SYMBOLS #
For modules that use symbols from other modules. See more details in modules.rst.
ALLSOURCE_ARCHS #
For tags/TAGS/cscope targets, you can specify more than one arch to be included in the databases, separated by blank space. E.g.:
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
To get all available archs you can also specify all. E.g.:
$ make ALLSOURCE_ARCHS=all tags
IGNORE_DIRS #
For tags/TAGS/cscope targets, you can choose which directories won't be included in the databases, separated by blank space. E.g.:
$ make IGNORE_DIRS="drivers/gpu/drm/radeon tools" cscope
KBUILD_BUILD_TIMESTAMP #
Setting this to a date string overrides the timestamp used in the UTS_VERSION definition (uname -v in the running kernel). The value has to be a string that can be passed to date -d. E.g.:
$ KBUILD_BUILD_TIMESTAMP="Mon Oct 13 00:00:00 UTC 2025" make
The default value is the output of the date command at one point during build. If provided, this timestamp will also be used for mtime fields within any initramfs archive. Initramfs mtimes are 32-bit, so dates before the 1970 Unix epoch, or after 2106-02-07 06:28:15 UTC will fail.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST #
These two variables allow to override the user@host string displayed during boot and in /proc/version. The default value is the output of the commands whoami and host, respectively.
LLVM #
If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead of GCC and GNU binutils to build the kernel.
Kconfig Language
Peios Kernel / Kernel development / Build system
Introduction #
The configuration database is a collection of configuration options organized in a tree structure:
+- Code maturity level options
| +- Prompt for development and/or incomplete code/drivers
+- General setup
| +- Networking support
| +- System V IPC
| +- BSD Process Accounting
| +- Sysctl support
+- Loadable module support
| +- Enable loadable module support
| +- Set version information on all module symbols
| +- Kernel module loader
+- ...
Every entry has its own dependencies. These dependencies are used to determine the visibility of an entry. Any child entry is only visible if its parent entry is also visible.
Menu entries #
Most entries define a config option; all other entries help to organize them. A single configuration option is defined like this:
config MODVERSIONS
bool "Set version information on all module symbols"
depends on MODULES
help
Usually, modules have to be recompiled whenever you switch to a new
kernel. ...
Every line starts with a key word and can be followed by multiple arguments. "config" starts a new config entry. The following lines define attributes for this config option. Attributes can be the type of the config option, input prompt, dependencies, help text and default values. A config option can be defined multiple times with the same name, but every definition can have only a single input prompt and the type must not conflict.
Menu attributes #
A menu entry can have a number of attributes. Not all of them are applicable everywhere (see syntax).
-
type definition: "bool"/"tristate"/"string"/"hex"/"int"
Every config option must have a type. There are only two basic types: tristate and string; the other types are based on these two. The type definition optionally accepts an input prompt, so these two examples are equivalent:
bool "Networking support"and:
bool prompt "Networking support" -
input prompt: "prompt" <prompt> ["if" <expr>]
Every menu entry can have at most one prompt, which is used to display to the user. Optionally dependencies only for this prompt can be added with "if". If a prompt is not present, the config option is a non-visible symbol, meaning its value cannot be directly changed by the user (such as altering the value in
.config) and the option will not appear in any config menus. Its value can only be set via "default" and "select" (see below). -
default value: "default" <expr> ["if" <expr>]
A config option can have any number of default values. If multiple default values are visible, only the first defined one is active. Default values are not limited to the menu entry where they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition. The default value is only assigned to the config symbol if no other value was set by the user (via the input prompt above). If an input prompt is visible the default value is presented to the user and can be overridden by him. Optionally, dependencies only for this default value can be added with "if".
The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this. The intent is for "make oldconfig" to add as little as possible to the config from release to release.
Note:
Things that merit "default y/m" include:
a) A new Kconfig option for something that used to always be built should be "default y".
b) A new gatekeeping Kconfig option that hides/shows other Kconfig options (but does not generate any code of its own), should be "default y" so people will see those other options.
c) Sub-driver behavior or similar options for a driver that is "default n". This allows you to provide sane defaults.
d) Hardware or infrastructure that everybody expects, such as CONFIG_NET or CONFIG_BLOCK. These are rare exceptions.
-
type definition + default value:
"def_bool"/"def_tristate" <expr> ["if" <expr>]This is a shorthand notation for a type definition plus a value. Optionally dependencies for this default value can be added with "if".
-
dependencies: "depends on" <expr> ["if" <expr>]
This defines a dependency for this menu entry. If multiple dependencies are defined, they are connected with '&&'. Dependencies are applied to all other options within this menu entry (which also accept an "if" expression), so these two examples are equivalent:
bool "foo" if BAR default y if BARand:
depends on BAR bool "foo" default yThe dependency definition itself may be conditional by appending "if" followed by an expression. For example:
config FOO tristate depends on BAR if BAZmeaning that FOO is constrained by the value of BAR only if BAZ is also set.
-
reverse dependencies: "select" <symbol> ["if" <expr>]
While normal dependencies reduce the upper limit of a symbol (see below), reverse dependencies can be used to force a lower limit of another symbol. The value of the current menu symbol is used as the minimal value <symbol> can be set to. If <symbol> is selected multiple times, the limit is set to the largest selection. Reverse dependencies can only be used with boolean or tristate symbols.
-
Note:
select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set. In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.
If "select" <symbol> is followed by "if" <expr>, <symbol> will be selected by the logical AND of the value of the current menu symbol and <expr>. This means, the lower limit can be downgraded due to the presence of "if" <expr>. This behavior may seem weird, but we rely on it. (The future of this behavior is undecided.)
-
-
weak reverse dependencies: "imply" <symbol> ["if" <expr>]
This is similar to "select" as it enforces a lower limit on another symbol except that the "implied" symbol's value may still be set to n from a direct dependency or with a visible prompt.
Given the following example:
config FOO tristate "foo" imply BAZ config BAZ tristate "baz" depends on BARThe following values are possible:
FOO
BAR
BAZ's default
choice for BAZ
n
y
n
N/m/y
m
y
m
M/y/n
y
y
y
Y/m/n
n
m
n
N/m
m
m
m
M/n
y
m
m
M/n
y
n
N
This is useful e.g. with multiple drivers that want to indicate their ability to hook into a secondary subsystem while allowing the user to configure that subsystem out without also having to unset these drivers.
Note: If the feature provided by BAZ is highly desirable for FOO, FOO should imply not only BAZ, but also its dependency BAR:
config FOO tristate "foo" imply BAR imply BAZNote: If "imply" <symbol> is followed by "if" <expr>, the default of <symbol> will be the logical AND of the value of the current menu symbol and <expr>. (The future of this behavior is undecided.)
-
limiting menu display: "visible if" <expr>
This attribute is only applicable to menu blocks, if the condition is false, the menu block is not displayed to the user (the symbols contained there can still be selected by other symbols, though). It is similar to a conditional "prompt" attribute for individual menu entries. Default value of "visible" is true.
-
numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
This allows limiting the range of possible input values for int and hex symbols. The user can only input a value which is larger than or equal to the first symbol and smaller than or equal to the second symbol.
-
help text: "help"
This defines a help text. The end of the help text is determined by the indentation level, this means it ends at the first line which has a smaller indentation than the first line of the help text.
-
module attribute: "modules" This declares the symbol to be used as the MODULES symbol, which enables the third modular state for all config symbols. At most one symbol may have the "modules" option set.
-
transitional attribute: "transitional" This declares the symbol as transitional, meaning it should be processed during configuration but omitted from newly written .config files. Transitional symbols are useful for backward compatibility during config option migrations - they allow olddefconfig to process existing .config files while ensuring the old option doesn't appear in new configurations.
A transitional symbol: - Has no prompt (is not visible to users in menus) - Is processed normally during configuration (values are read and used) - Can be referenced in default expressions of other symbols - Is not written to new .config files - Cannot have any other properties (it is a pass-through option)
Example migration from OLD_NAME to NEW_NAME:
config NEW_NAME bool "New option name" default OLD_NAME help This replaces the old CONFIG_OLD_NAME option. config OLD_NAME bool transitional help Transitional config for OLD_NAME to NEW_NAME migration.With this setup, existing .config files with "CONFIG_OLD_NAME=y" will result in "CONFIG_NEW_NAME=y" being set, while CONFIG_OLD_NAME will be omitted from newly written .config files.
Menu dependencies #
Dependencies define the visibility of a menu entry and can also reduce the input range of tristate symbols. The tristate logic used in the expressions uses one more state than normal boolean logic to express the module state. Dependency expressions have the following syntax:
<expr> ::= <symbol> (1)
<symbol> '=' <symbol> (2)
<symbol> '!=' <symbol> (3)
<symbol1> '<' <symbol2> (4)
<symbol1> '>' <symbol2> (4)
<symbol1> '<=' <symbol2> (4)
<symbol1> '>=' <symbol2> (4)
'(' <expr> ')' (5)
'!' <expr> (6)
<expr> '&&' <expr> (7)
<expr> '||' <expr> (8)
Expressions are listed in decreasing order of precedence.
-
Convert the symbol into an expression. Boolean and tristate symbols are simply converted into the respective expression values. All other symbol types result in 'n'.
-
If the values of both symbols are equal, it returns 'y', otherwise 'n'.
-
If the values of both symbols are equal, it returns 'n', otherwise 'y'.
-
If value of <symbol1> is respectively lower, greater, lower-or-equal, or greater-or-equal than value of <symbol2>, it returns 'y', otherwise 'n'.
-
Returns the value of the expression. Used to override precedence.
-
Returns the result of (2-/expr/).
-
Returns the result of min(/expr/, /expr/).
-
Returns the result of max(/expr/, /expr/).
An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 respectively for calculations). A menu entry becomes visible when its expression evaluates to 'm' or 'y'.
There are two types of symbols: constant and non-constant symbols. Non-constant symbols are the most common ones and are defined with the 'config' statement. Non-constant symbols consist entirely of alphanumeric characters or underscores. Constant symbols are only part of expressions. Constant symbols are always surrounded by single or double quotes. Within the quote, any other character is allowed and the quotes can be escaped using ''.
Menu structure #
The position of a menu entry in the tree is determined in two ways. First it can be specified explicitly:
menu "Network device support"
depends on NET
config NETDEVICES
...
endmenu
All entries within the "menu" ... "endmenu" block become a submenu of "Network device support". All subentries inherit the dependencies from the menu entry, e.g. this means the dependency "NET" is added to the dependency list of the config option NETDEVICES.
The other way to generate the menu structure is done by analyzing the dependencies. If a menu entry somehow depends on the previous entry, it can be made a submenu of it. First, the previous (parent) symbol must be part of the dependency list and then one of these two conditions must be true:
-
the child entry must become invisible, if the parent is set to 'n'
-
the child entry must only be visible, if the parent is visible:
config MODULES bool "Enable loadable module support" config MODVERSIONS bool "Set version information on all module symbols" depends on MODULES comment "module support disabled" depends on !MODULES
MODVERSIONS directly depends on MODULES, this means it's only visible if MODULES is different from 'n'. The comment on the other hand is only visible when MODULES is set to 'n'.
Kconfig syntax #
The configuration file describes a series of menu entries, where every line starts with a keyword (except help texts). The following keywords end a menu entry:
-
config
-
menuconfig
-
choice/endchoice
-
comment
-
menu/endmenu
-
if/endif
-
source
The first five also start the definition of a menu entry.
config:
"config" <symbol>
<config options>
This defines a config symbol <symbol> and accepts any of above attributes as options.
menuconfig:
"menuconfig" <symbol>
<config options>
This is similar to the simple config entry above, but it also gives a hint to front ends, that all suboptions should be displayed as a separate list of options. To make sure all the suboptions will really show up under the menuconfig entry and not outside of it, every item from the <config options> list must depend on the menuconfig symbol. In practice, this is achieved by using one of the next two constructs:
(1):
menuconfig M
if M
config C1
config C2
endif
(2):
menuconfig M
config C1
depends on M
config C2
depends on M
In the following examples (3) and (4), C1 and C2 still have the M dependency, but will not appear under menuconfig M anymore, because of C0, which doesn't depend on M:
(3):
menuconfig M
config C0
if M
config C1
config C2
endif
(4):
menuconfig M
config C0
config C1
depends on M
config C2
depends on M
choices:
"choice"
<choice options>
<choice block>
"endchoice"
This defines a choice group and accepts "prompt", "default", "depends on", and "help" attributes as options.
A choice only allows a single config entry to be selected.
comment:
"comment" <prompt>
<comment options>
This defines a comment which is displayed to the user during the configuration process and is also echoed to the output files. The only possible options are dependencies.
menu:
"menu" <prompt>
<menu options>
<menu block>
"endmenu"
This defines a menu block, see "Menu structure" above for more information. The only possible options are dependencies and "visible" attributes.
if:
"if" <expr>
<if block>
"endif"
This defines an if block. The dependency expression <expr> is appended to all enclosed menu entries.
source:
"source" <prompt>
This reads the specified configuration file. This file is always parsed.
mainmenu:
"mainmenu" <prompt>
This sets the config program's title bar if the config program chooses to use it. It should be placed at the top of the configuration, before any other statement.
'#' Kconfig source file comment:
An unquoted '#' character anywhere in a source file line indicates the beginning of a source file comment. The remainder of that line is a comment.
Kconfig hints #
This is a collection of Kconfig tips, most of which aren't obvious at first glance and most of which have become idioms in several Kconfig files.
Adding common features and make the usage configurable #
It is a common idiom to implement a feature/functionality that are relevant for some architectures but not all. The recommended way to do so is to use a config variable named HAVE_* that is defined in a common Kconfig file and selected by the relevant architectures. An example is the generic IOMAP functionality.
We would in lib/Kconfig see:
# Generic IOMAP is used to ...
config HAVE_GENERIC_IOMAP
config GENERIC_IOMAP
depends on HAVE_GENERIC_IOMAP && FOO
And in lib/Makefile we would see:
obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
For each architecture using the generic IOMAP functionality we would see:
config X86
select ...
select HAVE_GENERIC_IOMAP
select ...
Note: we use the existing config option and avoid creating a new config variable to select HAVE_GENERIC_IOMAP.
Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is introduced to overcome the limitation of select which will force a config option to 'y' no matter the dependencies. The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the situation where select forces a symbol equals to 'y'.
Adding features that need compiler support #
There are several features that need compiler support. The recommended way to describe the dependency on the compiler feature is to use "depends on" followed by a test macro:
config STACKPROTECTOR
bool "Stack Protector buffer overflow detection"
depends on $(cc-option,-fstack-protector)
...
If you need to expose a compiler capability to makefiles and/or C source files, CC_HAS_ is the recommended prefix for the config option:
config CC_HAS_FOO
def_bool $(success,$(srctree)/scripts/cc-check-foo.sh $(CC))
Build as module only #
To restrict a component build to module-only, qualify its config symbol with "depends on m". E.g.:
config FOO
depends on BAR && m
limits FOO to module (=m) or disabled (=n).
Compile-testing #
If a config symbol has a dependency, but the code controlled by the config symbol can still be compiled if the dependency is not met, it is encouraged to increase build coverage by adding an "|| COMPILE_TEST" clause to the dependency. This is especially useful for drivers for more exotic hardware, as it allows continuous-integration systems to compile-test the code on a more common system, and detect bugs that way. Note that compile-tested code should avoid crashing when run on a system where the dependency is not met.
Architecture and platform dependencies #
Due to the presence of stubs, most drivers can now be compiled on most architectures. However, this does not mean it makes sense to have all drivers available everywhere, as the actual hardware may only exist on specific architectures and platforms. This is especially true for on-SoC IP cores, which may be limited to a specific vendor or SoC family.
To prevent asking the user about drivers that cannot be used on the system(s) the user is compiling a kernel for, and if it makes sense, config symbols controlling the compilation of a driver should contain proper dependencies, limiting the visibility of the symbol to (a superset of) the platform(s) the driver can be used on. The dependency can be an architecture (e.g. ARM) or platform (e.g. ARCH_OMAP4) dependency. This makes life simpler not only for distro config owners, but also for every single developer or user who configures a kernel.
Such a dependency can be relaxed by combining it with the compile-testing rule above, leading to:
config FOO
bool "Support for foo hardware" depends on ARCH_FOO_VENDOR || COMPILE_TEST
Optional dependencies #
Some drivers are able to optionally use a feature from another module or build cleanly with that module disabled, but cause a link failure when trying to use that loadable module from a built-in driver.
The recommended way to express this optional dependency in Kconfig logic uses the conditional form:
config FOO
tristate "Support for foo hardware"
depends on BAR if BAR
This slightly counterintuitive style is also widely used:
config FOO
tristate "Support for foo hardware"
depends on BAR || !BAR
This means that there is either a dependency on BAR that disallows the combination of FOO=y with BAR=m, or BAR is completely disabled. The BAR module must provide all the stubs for !BAR case.
For a more formalized approach if there are multiple drivers that have the same dependency, a helper symbol can be used, like:
config FOO
tristate "Support for foo hardware"
depends on BAR_OPTIONAL
config BAR_OPTIONAL
def_tristate BAR || !BAR
Much less favorable way to express optional dependency is IS_REACHABLE() within the module code, useful for example when the module BAR does not provide !BAR stubs:
foo_init()
{
if (IS_REACHABLE(CONFIG_BAR))
bar_register(&foo);
...
}
IS_REACHABLE() is generally discouraged, because the code will be silently discarded, when CONFIG_BAR=m and this code is built-in. This is not what users usually expect when enabling BAR as module.
Kconfig recursive dependency limitations #
If you've hit the Kconfig error: "recursive dependency detected" you've run into a recursive dependency issue with Kconfig, a recursive dependency can be summarized as a circular dependency. The kconfig tools need to ensure that Kconfig files comply with specified configuration requirements. In order to do that kconfig must determine the values that are possible for all Kconfig symbols, this is currently not possible if there is a circular relation between two or more Kconfig symbols. For more details refer to the "Simple Kconfig recursive issue" subsection below. Kconfig does not do recursive dependency resolution; this has a few implications for Kconfig file writers. We'll first explain why this issues exists and then provide an example technical limitation which this brings upon Kconfig developers. Eager developers wishing to try to address this limitation should read the next subsections.
Simple Kconfig recursive issue #
Read: Documentation/kbuild/Kconfig.recursion-issue-01
Test with:
make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
Cumulative Kconfig recursive issue #
Read: Documentation/kbuild/Kconfig.recursion-issue-02
Test with:
make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
Practical solutions to kconfig recursive issue #
Developers who run into the recursive Kconfig issue have two options at their disposal. We document them below and also provide a list of historical issues resolved through these different solutions.
a) Remove any superfluous "select FOO" or "depends on FOO"
b) Match dependency semantics:
b1) Swap all "select FOO" to "depends on FOO" or,
b2) Swap all "depends on FOO" to "select FOO"
The resolution to a) can be tested with the sample Kconfig file Documentation/kbuild/Kconfig.recursion-issue-01 through the removal of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already since CORE_BELL_A depends on CORE. At times it may not be possible to remove some dependency criteria, for such cases you can work with solution b).
The two different resolutions for b) can be tested in the sample Kconfig file Documentation/kbuild/Kconfig.recursion-issue-02.
Below is a list of examples of prior fixes for these types of recursive issues; all errors appear to involve one or more "select" statements and one or more "depends on".
|
commit |
fix |
|---|---|
|
06b718c01208 |
select A -> depends on A |
|
c22eacfe82f9 |
depends on A -> depends on B |
|
6a91e854442c |
select A -> depends on A |
|
118c565a8f2e |
select A -> select B |
|
f004e5594705 |
select A -> depends on A |
|
c7861f37b4c6 |
depends on A -> (null) |
|
80c69915e5fb |
select A -> (null) (1) |
|
c2218e26c0d0 |
select A -> depends on A (1) |
|
d6ae99d04e1c |
select A -> depends on A |
|
95ca19cf8cbf |
select A -> depends on A |
|
8f057d7bca54 |
depends on A -> (null) |
|
8f057d7bca54 |
depends on A -> select A |
|
a0701f04846e |
select A -> depends on A |
|
0c8b92f7f259 |
depends on A -> (null) |
|
e4e9e0540928 |
select A -> depends on A (2) |
|
7453ea886e87 |
depends on A > (null) (1) |
|
7b1fff7e4fdf |
select A -> depends on A |
|
86c747d2a4f0 |
select A -> depends on A |
|
d9f9ab51e55e |
select A -> depends on A |
|
0c51a4d8abd6 |
depends on A -> select A (3) |
|
e98062ed6dc4 |
select A -> depends on A (3) |
|
91e5d284a7f1 |
select A -> (null) |
-
Partial (or no) quote of error.
-
That seems to be the gist of that fix.
-
Same error.
Future kconfig work #
Work on kconfig is welcomed on both areas of clarifying semantics and on evaluating the use of a full SAT solver for it. A full SAT solver can be desirable to enable more complex dependency mappings and / or queries, for instance one possible use case for a SAT solver could be that of handling the current known recursive dependency issues. It is not known if this would address such issues but such evaluation is desirable. If support for a full SAT solver proves too complex or that it cannot address recursive dependency issues Kconfig should have at least clear and well defined semantics which also addresses and documents limitations or requirements such as the ones dealing with recursive dependencies.
Further work on both of these areas is welcomed on Kconfig. We elaborate on both of these in the next two subsections.
Semantics of Kconfig #
The use of Kconfig is broad, Linux is now only one of Kconfig's users: one study has completed a broad analysis of Kconfig use in 12 projects 0. Despite its widespread use, and although this document does a reasonable job in documenting basic Kconfig syntax a more precise definition of Kconfig semantics is welcomed. One project deduced Kconfig semantics through the use of the xconfig configurator 1. Work should be done to confirm if the deduced semantics matches our intended Kconfig design goals. Another project formalized a denotational semantics of a core subset of the Kconfig language 10.
Having well defined semantics can be useful for tools for practical evaluation of dependencies, for instance one such case was work to express in boolean abstraction of the inferred semantics of Kconfig to translate Kconfig logic into boolean formulas and run a SAT solver on this to find dead code / features (always inactive), 114 dead features were found in Linux using this methodology 1 (Section 8: Threats to validity). The kismet tool, based on the semantics in 10, finds abuses of reverse dependencies and has led to dozens of committed fixes to Linux Kconfig files 11.
Confirming this could prove useful as Kconfig stands as one of the leading industrial variability modeling languages 1 2. Its study would help evaluate practical uses of such languages, their use was only theoretical and real world requirements were not well understood. As it stands though only reverse engineering techniques have been used to deduce semantics from variability modeling languages such as Kconfig 3.
[0] https://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
[1] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
[2] https://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
[3] https://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
Full SAT solver for Kconfig #
Although SAT solvers 4 haven't yet been used by Kconfig directly, as noted in the previous subsection, work has been done however to express in boolean abstraction the inferred semantics of Kconfig to translate Kconfig logic into boolean formulas and run a SAT solver on it 5. Another known related project is CADOS 6 (former VAMOS 7) and the tools, mainly undertaker 8, which has been introduced first with 9. The basic concept of undertaker is to extract variability models from Kconfig and put them together with a propositional formula extracted from CPP #ifdefs and build-rules into a SAT solver in order to find dead code, dead files, and dead symbols. If using a SAT solver is desirable on Kconfig one approach would be to evaluate repurposing such efforts somehow on Kconfig. There is enough interest from mentors of existing projects to not only help advise how to integrate this work upstream but also help maintain it long term. Interested developers should visit:
https://kernelnewbies.org/KernelProjects/kconfig-sat
[4] https://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
[5] https://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
[8] https://undertaker.cs.fau.de
[9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
Kconfig macro language
Peios Kernel / Kernel development / Build system
Concept #
The basic idea was inspired by Make. When we look at Make, we notice sort of two languages in one. One language describes dependency graphs consisting of targets and prerequisites. The other is a macro language for performing textual substitution.
There is clear distinction between the two language stages. For example, you can write a makefile like follows:
APP := foo
SRC := foo.c
CC := gcc
$(APP): $(SRC)
$(CC) -o $(APP) $(SRC)
The macro language replaces the variable references with their expanded form, and handles as if the source file were input like follows:
foo: foo.c
gcc -o foo foo.c
Then, Make analyzes the dependency graph and determines the targets to be updated.
The idea is quite similar in Kconfig - it is possible to describe a Kconfig file like this:
CC := gcc
config CC_HAS_FOO
def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))
The macro language in Kconfig processes the source file into the following intermediate:
config CC_HAS_FOO
def_bool y
Then, Kconfig moves onto the evaluation stage to resolve inter-symbol dependency as explained in kconfig-language.rst.
Variables #
Like in Make, a variable in Kconfig works as a macro variable. A macro variable is expanded "in place" to yield a text string that may then be expanded further. To get the value of a variable, enclose the variable name in $( ). The parentheses are required even for single-letter variable names; $X is a syntax error. The curly brace form as in ${CC} is not supported either.
There are two types of variables: simply expanded variables and recursively expanded variables.
A simply expanded variable is defined using the := assignment operator. Its righthand side is expanded immediately upon reading the line from the Kconfig file.
A recursively expanded variable is defined using the = assignment operator. Its righthand side is simply stored as the value of the variable without expanding it in any way. Instead, the expansion is performed when the variable is used.
There is another type of assignment operator; += is used to append text to a variable. The righthand side of += is expanded immediately if the lefthand side was originally defined as a simple variable. Otherwise, its evaluation is deferred.
The variable reference can take parameters, in the following form:
$(name,arg1,arg2,arg3)
You can consider the parameterized reference as a function. (more precisely, "user-defined function" in contrast to "built-in function" listed below).
Useful functions must be expanded when they are used since the same function is expanded differently if different parameters are passed. Hence, a user-defined function is defined using the = assignment operator. The parameters are referenced within the body definition with $(1), $(2), etc.
In fact, recursively expanded variables and user-defined functions are the same internally. (In other words, "variable" is "function with zero argument".) When we say "variable" in a broad sense, it includes "user-defined function".
Built-in functions #
Like Make, Kconfig provides several built-in functions. Every function takes a particular number of arguments.
In Make, every built-in function takes at least one argument. Kconfig allows zero argument for built-in functions, such as $(filename), $(lineno). You could consider those as "built-in variable", but it is just a matter of how we call it after all. Let's say "built-in function" here to refer to natively supported functionality.
Kconfig currently supports the following built-in functions.
- $(shell,command)
The "shell" function accepts a single argument that is expanded and passed to a subshell for execution. The standard output of the command is then read and returned as the value of the function. Every newline in the output is replaced with a space. Any trailing newlines are deleted. The standard error is not returned, nor is any program exit status.
- $(info,text)
The "info" function takes a single argument and prints it to stdout. It evaluates to an empty string.
- $(warning-if,condition,text)
The "warning-if" function takes two arguments. If the condition part is "y", the text part is sent to stderr. The text is prefixed with the name of the current Kconfig file and the current line number.
- $(error-if,condition,text)
The "error-if" function is similar to "warning-if", but it terminates the parsing immediately if the condition part is "y".
- $(filename)
The 'filename' takes no argument, and $(filename) is expanded to the file name being parsed.
- $(lineno)
The 'lineno' takes no argument, and $(lineno) is expanded to the line number being parsed.
Make vs Kconfig #
Kconfig adopts Make-like macro language, but the function call syntax is slightly different.
A function call in Make looks like this:
$(func-name arg1,arg2,arg3)
The function name and the first argument are separated by at least one whitespace. Then, leading whitespaces are trimmed from the first argument, while whitespaces in the other arguments are kept. You need to use a kind of trick to start the first parameter with spaces. For example, if you want to make "info" function print " hello", you can write like follows:
empty :=
space := $(empty) $(empty)
$(info $(space)$(space)hello)
Kconfig uses only commas for delimiters, and keeps all whitespaces in the function call. Some people prefer putting a space after each comma delimiter:
$(func-name, arg1, arg2, arg3)
In this case, "func-name" will receive " arg1", " arg2", " arg3". The presence of leading spaces may matter depending on the function. The same applies to Make - for example, $(subst .c, .o, $(sources)) is a typical mistake; it replaces ".c" with " .o".
In Make, a user-defined function is referenced by using a built-in function, 'call', like this:
$(call my-func,arg1,arg2,arg3)
Kconfig invokes user-defined functions and built-in functions in the same way. The omission of 'call' makes the syntax shorter.
In Make, some functions treat commas verbatim instead of argument separators. For example, $(shell echo hello, world) runs the command "echo hello, world". Likewise, $(info hello, world) prints "hello, world" to stdout. You could say this is _useful_ inconsistency.
In Kconfig, for simpler implementation and grammatical consistency, commas that appear in the $( ) context are always delimiters. It means:
$(shell, echo hello, world)
is an error because it is passing two parameters where the 'shell' function accepts only one. To pass commas in arguments, you can use the following trick:
comma := ,
$(shell, echo hello$(comma) world)
Caveats #
A variable (or function) cannot be expanded across tokens. So, you cannot use a variable as a shorthand for an expression that consists of multiple tokens. The following works:
RANGE_MIN := 1
RANGE_MAX := 3
config FOO
int "foo"
range $(RANGE_MIN) $(RANGE_MAX)
But, the following does not work:
RANGES := 1 3
config FOO
int "foo"
range $(RANGES)
A variable cannot be expanded to any keyword in Kconfig. The following does not work:
MY_TYPE := tristate
config FOO
$(MY_TYPE) "foo"
default y
Obviously from the design, $(shell command) is expanded in the textual substitution phase. You cannot pass symbols to the 'shell' function.
The following does not work as expected:
config ENDIAN_FLAG
string
default "-mbig-endian" if CPU_BIG_ENDIAN
default "-mlittle-endian" if CPU_LITTLE_ENDIAN
config CC_HAS_ENDIAN_FLAG
def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
Instead, you can do like follows so that any function call is statically expanded:
config CC_HAS_ENDIAN_FLAG
bool
default $(shell $(srctree)/scripts/gcc-check-flag -mbig-endian) if CPU_BIG_ENDIAN
default $(shell $(srctree)/scripts/gcc-check-flag -mlittle-endian) if CPU_LITTLE_ENDIAN
Configuration targets and editors
Peios Kernel / Kernel development / Build system
This file contains some assistance for using make *config.
Use make help to list all of the possible configuration targets.
The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf') programs also have embedded help text. Be sure to check that for navigation, search, and other general help text.
The gconfig ('gconf') program has limited help text.
General #
New kernel releases often introduce new config symbols. Often more important, new kernel releases may rename config symbols. When this happens, using a previously working .config file and running "make oldconfig" won't necessarily produce a working new kernel for you, so you may find that you need to see what NEW kernel symbols have been introduced.
To see a list of new config symbols, use:
cp user/some/old.config .config
make listnewconfig
and the config program will list any new symbols, one per line.
Alternatively, you can use the brute force method:
make oldconfig
scripts/diffconfig .config.old .config | less
Environment variables #
Environment variables for *config:
-
KCONFIG_CONFIGThis environment variable can be used to specify a default kernel config file name to override the default name of ".config".
-
KCONFIG_DEFCONFIG_LISTThis environment variable specifies a list of config files which can be used as a base configuration in case the .config does not exist yet. Entries in the list are separated with whitespaces to each other, and the first one that exists is used.
-
KCONFIG_OVERWRITECONFIGIf you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not break symlinks when .config is a symlink to somewhere else.
-
KCONFIG_WARN_UNKNOWN_SYMBOLSThis environment variable makes Kconfig warn about all unrecognized symbols in the config input.
-
KCONFIG_WERRORIf set, Kconfig treats warnings as errors.
-
CONFIG_If you set
CONFIG_in the environment, Kconfig will prefix all symbols with its value when saving the configuration, instead of using the default,CONFIG_.
Environment variables for {allyes/allmod/allno/alldef/rand}config:
-
KCONFIG_ALLCONFIGThe allyesconfig/allmodconfig/alldefconfig/allnoconfig/randconfig variants can also use the environment variable KCONFIG_ALLCONFIG as a flag or a filename that contains config symbols that the user requires to be set to a specific value. If KCONFIG_ALLCONFIG is used without a filename where KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1",
make *configchecks for a file named "all{yes/mod/no/def/random}.config" (corresponding to the*configcommand that was used) for symbol values that are to be forced. If this file is not found, it checks for a file named "all.config" to contain forced values.This enables you to create "miniature" config (miniconfig) or custom config files containing just the config symbols that you are interested in. Then the kernel config system generates the full .config file, including symbols of your miniconfig file.
This
KCONFIG_ALLCONFIGfile is a config file which contains (usually a subset of all) preset config symbols. These variable settings are still subject to normal dependency checks.Examples:
KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfigor:
KCONFIG_ALLCONFIG=mini.config make allnoconfigor:
make KCONFIG_ALLCONFIG=mini.config allnoconfigThese examples will disable most options (allnoconfig) but enable or disable the options that are explicitly listed in the specified mini-config files.
Environment variables for randconfig:
-
KCONFIG_SEEDYou can set this to the integer value used to seed the RNG, if you want to somehow debug the behaviour of the kconfig parser/frontends. If not set, the current time will be used.
-
KCONFIG_PROBABILITYThis variable can be used to skew the probabilities. This variable can be unset or empty, or set to three different formats:
KCONFIG_PROBABILITY
y:n split
y:m:n split
unset or empty
50 : 50
33 : 33 : 34
N
N : 100-N
N/2 : N/2 : 100-N
[1] N:M
N+M : 100-(N+M)
N : M : 100-(N+M)
[2] N:M:L
N : 100-N
M : L : 100-(M+L)
where N, M and L are integers (in base 10) in the range [0,100], and so that:
[1] N+M is in the range [0,100]
[2] M+L is in the range [0,100]
Examples:
KCONFIG_PROBABILITY=10
10% of booleans will be set to 'y', 90% to 'n'
5% of tristates will be set to 'y', 5% to 'm', 90% to 'n'
KCONFIG_PROBABILITY=15:25
40% of booleans will be set to 'y', 60% to 'n'
15% of tristates will be set to 'y', 25% to 'm', 60% to 'n'
KCONFIG_PROBABILITY=10:15:15
10% of booleans will be set to 'y', 90% to 'n'
15% of tristates will be set to 'y', 15% to 'm', 70% to 'n'
Environment variables for syncconfig:
-
KCONFIG_NOSILENTUPDATEIf this variable has a non-blank value, it prevents silent kernel config updates (requires explicit updates).
-
KCONFIG_AUTOCONFIGThis environment variable can be set to specify the path & name of the "auto.conf" file. Its default value is "include/config/auto.conf".
-
KCONFIG_AUTOHEADERThis environment variable can be set to specify the path & name of the "autoconf.h" (header) file. Its default value is "include/generated/autoconf.h".
menuconfig #
Searching in menuconfig:
The Search function searches for kernel configuration symbol names, so you have to know something close to what you are looking for.
Example:
/hotplug This lists all config symbols that contain "hotplug", e.g., HOTPLUG_CPU, MEMORY_HOTPLUG.For search help, enter / followed by TAB-TAB (to highlight <Help>) and Enter. This will tell you that you can also use regular expressions (regexes) in the search string, so if you are not interested in MEMORY_HOTPLUG, you could try:
/^hotplugWhen searching, symbols are sorted thus:
first, exact matches, sorted alphabetically (an exact match is when the search matches the complete symbol name);
then, other matches, sorted alphabetically.
For example, ^ATH.K matches:
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
of which only ATH5K and ATH9K match exactly and so are sorted first (and in alphabetical order), then come all other symbols, sorted in alphabetical order.
In this menu, pressing the key in the (#) prefix will jump directly to that location. You will be returned to the current search results after exiting this new menu.
User interface options for 'menuconfig':
-
MENUCONFIG_COLORIt is possible to select different color themes using the variable MENUCONFIG_COLOR. To select a theme use:
make MENUCONFIG_COLOR=<theme> menuconfigAvailable themes are:
- mono => selects colors suitable for monochrome displays - blackbg => selects a color scheme with black background - classic => theme with blue background. The classic look - bluetitle => a LCD friendly version of classic. (default) -
MENUCONFIG_MODEThis mode shows all sub-menus in one large tree.
Example:
make MENUCONFIG_MODE=single_menu menuconfig
nconfig #
nconfig is an alternate text-based configurator. It lists function keys across the bottom of the terminal (window) that execute commands. You can also just use the corresponding numeric key to execute the commands unless you are in a data entry window. E.g., instead of F6 for Save, you can just press 6.
Use F1 for Global help or F3 for the Short help menu.
Searching in nconfig:
You can search either in the menu entry "prompt" strings or in the configuration symbols.
Use / to begin a search through the menu entries. This does not support regular expressions. Use <Down> or <Up> for Next hit and Previous hit, respectively. Use <Esc> to terminate the search mode.
F8 (SymSearch) searches the configuration symbols for the given string or regular expression (regex).
In the SymSearch, pressing the key in the (#) prefix will jump directly to that location. You will be returned to the current search results after exiting this new menu.
Environment variables:
-
NCONFIG_MODEThis mode shows all sub-menus in one large tree.
Example:
make NCONFIG_MODE=single_menu nconfig
xconfig #
Searching in xconfig:
The Search function searches for kernel configuration symbol names, so you have to know something close to what you are looking for.
Example:
Ctrl-F hotplugor:
Menu: File, Search, hotpluglists all config symbol entries that contain "hotplug" in the symbol name. In this Search dialog, you may change the config setting for any of the entries that are not grayed out. You can also enter a different search string without having to return to the main menu.
gconfig #
Searching in gconfig:
There is no search command in gconfig. However, gconfig does have several different viewing choices, modes, and options.
Building Linux with Clang/LLVM
Peios Kernel / Kernel development / Build system
This document covers how to build the Linux kernel with Clang and LLVM utilities.
About #
The Linux kernel has always traditionally been compiled with GNU toolchains such as GCC and binutils. Ongoing work has allowed for Clang and LLVM utilities to be used as viable substitutes. Distributions such as Android, ChromeOS, OpenMandriva, and Chimera Linux use Clang built kernels. Google's and Meta's datacenter fleets also run kernels built with Clang.
LLVM is a collection of toolchain components implemented in terms of C++ objects. Clang is a front-end to LLVM that supports C and the GNU C extensions required by the kernel, and is pronounced "klang," not "see-lang."
Building with LLVM #
Invoke make via:
make LLVM=1
to compile for the host target. For cross compiling:
make LLVM=1 ARCH=arm64
The LLVM= argument #
LLVM has substitutes for GNU binutils utilities. They can be enabled individually. The full list of supported make variables:
make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \
HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar HOSTLD=ld.lld
LLVM=1 expands to the above.
If your LLVM tools are not available in your PATH, you can supply their location using the LLVM variable with a trailing slash:
make LLVM=/path/to/llvm/
which will use /path/to/llvm/clang, /path/to/llvm/ld.lld, etc. The following may also be used:
PATH=/path/to/llvm:$PATH make LLVM=1
If your LLVM tools have a version suffix and you want to test with that explicit version rather than the unsuffixed executables like LLVM=1, you can pass the suffix using the LLVM variable:
make LLVM=-14
which will use clang-14, ld.lld-14, etc.
To support combinations of out of tree paths with version suffixes, we recommend:
PATH=/path/to/llvm/:$PATH make LLVM=-14
LLVM=0 is not the same as omitting LLVM altogether, it will behave like LLVM=1. If you only wish to use certain LLVM utilities, use their respective make variables.
The same value used for LLVM= should be set for each invocation of make if configuring and building via distinct commands. LLVM= should also be set as an environment variable when running scripts that will eventually run make.
Cross Compiling #
A single Clang compiler binary (and corresponding LLVM utilities) will typically contain all supported back ends, which can help simplify cross compiling especially when LLVM=1 is used. If you use only LLVM tools, CROSS_COMPILE or target-triple-prefixes become unnecessary. Example:
make LLVM=1 ARCH=arm64
As an example of mixing LLVM and GNU utilities, for a target like ARCH=s390 which does not yet have ld.lld or llvm-objcopy support, you could invoke make via:
make LLVM=1 ARCH=s390 LD=s390x-linux-gnu-ld.bfd \
OBJCOPY=s390x-linux-gnu-objcopy
This example will invoke s390x-linux-gnu-ld.bfd as the linker and s390x-linux-gnu-objcopy, so ensure those are reachable in your $PATH.
CROSS_COMPILE is not used to prefix the Clang compiler binary (or corresponding LLVM utilities) as is the case for GNU utilities when LLVM=1 is not set.
The LLVM_IAS= argument #
Clang can assemble assembler code. You can pass LLVM_IAS=0 to disable this behavior and have Clang invoke the corresponding non-integrated assembler instead. Example:
make LLVM=1 LLVM_IAS=0
CROSS_COMPILE is necessary when cross compiling and LLVM_IAS=0 is used in order to set --prefix= for the compiler to find the corresponding non-integrated assembler (typically, you don't want to use the system assembler when targeting another architecture). Example:
make LLVM=1 ARCH=arm LLVM_IAS=0 CROSS_COMPILE=arm-linux-gnueabi-
Ccache #
ccache can be used with clang to improve subsequent builds, (though KBUILD_BUILD_TIMESTAMP should be set to a deterministic value between builds in order to avoid 100% cache misses, see Reproducible_builds for more info):
KBUILD_BUILD_TIMESTAMP='' make LLVM=1 CC="ccache clang"
Supported Architectures #
LLVM does not target all of the architectures that Linux supports and just because a target is supported in LLVM does not mean that the kernel will build or work without any issues. Below is a general summary of architectures that currently work with CC=clang or LLVM=1. Level of support corresponds to "S" values in the MAINTAINERS files. If an architecture is not present, it either means that LLVM does not target it or there are known issues. Using the latest stable version of LLVM or even the development tree will generally yield the best results. An architecture's defconfig is generally expected to work well, certain configurations may have problems that have not been uncovered yet. Bug reports are always welcome at the issue tracker below!
|
Architecture |
Level of support |
|
|---|---|---|
|
arm |
Supported |
|
|
arm64 |
Supported |
|
|
hexagon |
Maintained |
|
|
loongarch |
Maintained |
|
|
mips |
Maintained |
|
|
powerpc |
Maintained |
|
|
riscv |
Supported |
|
|
s390 |
Maintained |
|
|
sparc (sparc64 only) |
Maintained |
|
|
um (User Mode) |
Maintained |
|
|
x86 |
Supported |
|
Getting Help #
-
IRC: #clangbuiltlinux on irc.libera.chat
-
Telegram: @ClangBuiltLinux
Getting LLVM #
We provide prebuilt stable versions of LLVM on kernel.org. These have been optimized with profile data for building Linux kernels, which should improve kernel build times relative to other distributions of LLVM.
Below are links that may be useful for building LLVM from source or procuring it through a distribution's package manager.
Linux Kernel Makefiles
Peios Kernel / Kernel development / Build system
This document describes the Linux kernel Makefiles.
Overview #
The Makefiles have five parts:
Makefile the top Makefile.
.config the kernel configuration file.
arch/$(SRCARCH)/Makefile the arch Makefile.
scripts/Makefile.* common rules etc. for all kbuild Makefiles.
kbuild Makefiles exist in every subdirectory
The top Makefile reads the .config file, which comes from the kernel configuration process.
The top Makefile is responsible for building two major products: vmlinux (the resident kernel image) and modules (any module files). It builds these goals by recursively descending into the subdirectories of the kernel source tree.
The list of subdirectories which are visited depends upon the kernel configuration. The top Makefile textually includes an arch Makefile with the name arch/$(SRCARCH)/Makefile. The arch Makefile supplies architecture-specific information to the top Makefile.
Each subdirectory has a kbuild Makefile which carries out the commands passed down from above. The kbuild Makefile uses information from the .config file to construct various file lists used by kbuild to build any built-in or modular targets.
scripts/Makefile.* contains all the definitions/rules etc. that are used to build the kernel based on the kbuild makefiles.
Who does what #
People have four different relationships with the kernel Makefiles.
Users are people who build kernels. These people type commands such as make menuconfig or make. They usually do not read or edit any kernel Makefiles (or any other source files).
Normal developers are people who work on features such as device drivers, file systems, and network protocols. These people need to maintain the kbuild Makefiles for the subsystem they are working on. In order to do this effectively, they need some overall knowledge about the kernel Makefiles, plus detailed knowledge about the public interface for kbuild.
Arch developers are people who work on an entire architecture, such as sparc or x86. Arch developers need to know about the arch Makefile as well as kbuild Makefiles.
Kbuild developers are people who work on the kernel build system itself. These people need to know about all aspects of the kernel Makefiles.
This document is aimed towards normal developers and arch developers.
The kbuild files #
Most Makefiles within the kernel are kbuild Makefiles that use the kbuild infrastructure. This chapter introduces the syntax used in the kbuild makefiles.
The preferred name for the kbuild files are Makefile but Kbuild can be used and if both a Makefile and a Kbuild file exists, then the Kbuild file will be used.
Section Goal definitions is a quick intro; further chapters provide more details, with real examples.
Goal definitions #
Goal definitions are the main part (heart) of the kbuild Makefile. These lines define the files to be built, any special compilation options, and any subdirectories to be entered recursively.
The most simple kbuild makefile contains one line:
Example:
obj-y += foo.o
This tells kbuild that there is one object in that directory, named foo.o. foo.o will be built from foo.c or foo.S.
If foo.o shall be built as a module, the variable obj-m is used. Therefore the following pattern is often used:
Example:
obj-$(CONFIG_FOO) += foo.o
$(CONFIG_FOO) evaluates to either y (for built-in) or m (for module). If CONFIG_FOO is neither y nor m, then the file will not be compiled nor linked.
Built-in object goals - obj-y #
The kbuild Makefile specifies object files for vmlinux in the $(obj-y) lists. These lists depend on the kernel configuration.
Kbuild compiles all the $(obj-y) files. It then calls $(AR) rcSTP to merge these files into one built-in.a file. This is a thin archive without a symbol table. It will be later linked into vmlinux by scripts/link-vmlinux.sh
The order of files in $(obj-y) is significant. Duplicates in the lists are allowed: the first instance will be linked into built-in.a and succeeding instances will be ignored.
Link order is significant, because certain functions (module_init() / __initcall) will be called during boot in the order they appear. So keep in mind that changing the link order may e.g. change the order in which your SCSI controllers are detected, and thus your disks are renumbered.
Example:
#drivers/isdn/i4l/Makefile
# Makefile for the kernel ISDN subsystem and device drivers.
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_I4L) += isdn.o
obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
Loadable module goals - obj-m #
$(obj-m) specifies object files which are built as loadable kernel modules.
A module may be built from one source file or several source files. In the case of one source file, the kbuild makefile simply adds the file to $(obj-m).
Example:
#drivers/isdn/i4l/Makefile
obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
Note: In this example $(CONFIG_ISDN_PPP_BSDCOMP) evaluates to "m"
If a kernel module is built from several source files, you specify that you want to build a module in the same way as above; however, kbuild needs to know which object files you want to build your module from, so you have to tell it by setting a $(<module_name>-y) variable.
Example:
#drivers/isdn/i4l/Makefile
obj-$(CONFIG_ISDN_I4L) += isdn.o
isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o
In this example, the module name will be isdn.o. Kbuild will compile the objects listed in $(isdn-y) and then run $(LD) -r on the list of these files to generate isdn.o.
Due to kbuild recognizing $(<module_name>-y) for composite objects, you can use the value of a CONFIG_ symbol to optionally include an object file as part of a composite object.
Example:
#fs/ext2/Makefile
obj-$(CONFIG_EXT2_FS) += ext2.o
ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \
namei.o super.o symlink.o
ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o xattr_user.o \
xattr_trusted.o
In this example, xattr.o, xattr_user.o and xattr_trusted.o are only part of the composite object ext2.o if $(CONFIG_EXT2_FS_XATTR) evaluates to "y".
Note: Of course, when you are building objects into the kernel, the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, kbuild will build an ext2.o file for you out of the individual parts and then link this into built-in.a, as you would expect.
Library file goals - lib-y #
Objects listed with obj-* are used for modules, or combined in a built-in.a for that specific directory. There is also the possibility to list objects that will be included in a library, lib.a. All objects listed with lib-y are combined in a single library for that directory. Objects that are listed in obj-y and additionally listed in lib-y will not be included in the library, since they will be accessible anyway. For consistency, objects listed in lib-m will be included in lib.a.
Note that the same kbuild makefile may list files to be built-in and to be part of a library. Therefore the same directory may contain both a built-in.a and a lib.a file.
Example:
#arch/x86/lib/Makefile
lib-y := delay.o
This will create a library lib.a based on delay.o. For kbuild to actually recognize that there is a lib.a being built, the directory shall be listed in libs-y.
See also List directories to visit when descending.
Use of lib-y is normally restricted to lib/ and arch/*/lib.
Descending down in directories #
A Makefile is only responsible for building objects in its own directory. Files in subdirectories should be taken care of by Makefiles in these subdirs. The build system will automatically invoke make recursively in subdirectories, provided you let it know of them.
To do so, obj-y and obj-m are used. ext2 lives in a separate directory, and the Makefile present in fs/ tells kbuild to descend down using the following assignment.
Example:
#fs/Makefile
obj-$(CONFIG_EXT2_FS) += ext2/
If CONFIG_EXT2_FS is set to either "y" (built-in) or "m" (modular) the corresponding obj- variable will be set, and kbuild will descend down in the ext2 directory.
Kbuild uses this information not only to decide that it needs to visit the directory, but also to decide whether or not to link objects from the directory into vmlinux.
When Kbuild descends into the directory with "y", all built-in objects from that directory are combined into the built-in.a, which will be eventually linked into vmlinux.
When Kbuild descends into the directory with "m", in contrast, nothing from that directory will be linked into vmlinux. If the Makefile in that directory specifies obj-y, those objects will be left orphan. It is very likely a bug of the Makefile or of dependencies in Kconfig.
Kbuild also supports dedicated syntax, subdir-y and subdir-m, for descending into subdirectories. It is a good fit when you know they do not contain kernel-space objects at all. A typical usage is to let Kbuild descend into subdirectories to build tools.
Examples:
# scripts/Makefile
subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-$(CONFIG_SECURITY_SELINUX) += selinux
Unlike obj-y/m, subdir-y/m does not need the trailing slash since this syntax is always used for directories.
It is good practice to use a CONFIG_ variable when assigning directory names. This allows kbuild to totally skip the directory if the corresponding CONFIG_ option is neither "y" nor "m".
Non-builtin vmlinux targets - extra-y #
extra-y specifies targets which are needed for building vmlinux, but not combined into built-in.a.
Examples are:
-
vmlinux linker script
The linker script for vmlinux is located at arch/$(SRCARCH)/kernel/vmlinux.lds
Example:
# arch/x86/kernel/Makefile
extra-y += vmlinux.lds
extra-y is now deprecated because this is equivalent to:
always-$(KBUILD_BUILTIN) += vmlinux.lds
$(extra-y) should only contain targets needed for vmlinux.
Kbuild skips extra-y when vmlinux is apparently not a final goal. (e.g. make modules, or building external modules)
If you intend to build targets unconditionally, always-y (explained in the next section) is the correct syntax to use.
Always built goals - always-y #
always-y specifies targets which are literally always built when Kbuild visits the Makefile.
Example:
# ./Kbuild
offsets-file := include/generated/asm-offsets.h
always-y += $(offsets-file)
Compilation flags #
-
ccflags-y, asflags-y and ldflags-y
These three flags apply only to the kbuild makefile in which they are assigned. They are used for all the normal cc, as and ld invocations happening during a recursive build.
ccflags-y specifies options for compiling with $(CC).
Example:
# drivers/acpi/acpica/Makefile ccflags-y := -Os -D_LINUX -DBUILDING_ACPICA ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUTThis variable is necessary because the top Makefile owns the variable $(KBUILD_CFLAGS) and uses it for compilation flags for the entire tree.
asflags-y specifies assembler options.
Example:
#arch/sparc/kernel/Makefile asflags-y := -ansildflags-y specifies options for linking with $(LD).
Example:
#arch/cris/boot/compressed/Makefile ldflags-y += -T $(src)/decompress_$(arch-y).lds -
subdir-ccflags-y, subdir-asflags-y
The two flags listed above are similar to ccflags-y and asflags-y. The difference is that the subdir- variants have effect for the kbuild file where they are present and all subdirectories. Options specified using subdir-* are added to the commandline before the options specified using the non-subdir variants.
Example:
subdir-ccflags-y := -Werror -
ccflags-remove-y, asflags-remove-y
These flags are used to remove particular flags for the compiler, assembler invocations.
Example:
ccflags-remove-$(CONFIG_MCOUNT) += -pg -
CFLAGS_$@, AFLAGS_$@
CFLAGS_$@ and AFLAGS_$@ only apply to commands in current kbuild makefile.
$(CFLAGS_$@) specifies per-file options for $(CC). The $@ part has a literal value which specifies the file that it is for.
CFLAGS_$@ has the higher priority than ccflags-remove-y; CFLAGS_$@ can re-add compiler flags that were removed by ccflags-remove-y.
Example:
# drivers/scsi/Makefile CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONFThis line specify compilation flags for aha152x.o.
$(AFLAGS_$@) is a similar feature for source files in assembly languages.
AFLAGS_$@ has the higher priority than asflags-remove-y; AFLAGS_$@ can re-add assembler flags that were removed by asflags-remove-y.
Example:
# arch/arm/kernel/Makefile AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
Dependency tracking #
Kbuild tracks dependencies on the following:
-
All prerequisite files (both
*.cand*.h) -
CONFIG_options used in all prerequisite files -
Command-line used to compile target
Thus, if you change an option to $(CC) all affected files will be re-compiled.
Custom Rules #
Custom rules are used when the kbuild infrastructure does not provide the required support. A typical example is header files generated during the build process. Another example are the architecture-specific Makefiles which need custom rules to prepare boot images etc.
Custom rules are written as normal Make rules. Kbuild is not executing in the directory where the Makefile is located, so all custom rules shall use a relative path to prerequisite files and target files.
Two variables are used when defining custom rules:
-
$(src)
$(src) is the directory where the Makefile is located. Always use $(src) when referring to files located in the src tree.
-
$(obj)
$(obj) is the directory where the target is saved. Always use $(obj) when referring to generated files. Use $(obj) for pattern rules that need to work for both generated files and real sources (VPATH will help to find the prerequisites not only in the object tree but also in the source tree).
Example:
#drivers/scsi/Makefile $(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl $(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.plThis is a custom rule, following the normal syntax required by make.
The target file depends on two prerequisite files. References to the target file are prefixed with $(obj), references to prerequisites are referenced with $(src) (because they are not generated files).
-
$(srcroot)
$(srcroot) refers to the root of the source you are building, which can be either the kernel source or the external modules source, depending on whether KBUILD_EXTMOD is set. This can be either a relative or an absolute path, but if KBUILD_ABS_SRCTREE=1 is set, it is always an absolute path.
-
$(srctree)
$(srctree) refers to the root of the kernel source tree. When building the kernel, this is the same as $(srcroot).
-
$(objtree)
$(objtree) refers to the root of the kernel object tree. It is
.when building the kernel, but it is different when building external modules. -
$(kecho)
echoing information to user in a rule is often a good practice but when execution
make -sone does not expect to see any output except for warnings/errors. To support this kbuild defines $(kecho) which will echo out the text following $(kecho) to stdout except ifmake -sis used.Example:
# arch/arm/Makefile $(BOOT_TARGETS): vmlinux $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ @$(kecho) ' Kernel: $(boot)/$@ is ready'When kbuild is executing with KBUILD_VERBOSE unset, then only a shorthand of a command is normally displayed. To enable this behaviour for custom commands kbuild requires two variables to be set:
quiet_cmd_<command> - what shall be echoed cmd_<command> - the command to executeExample:
# lib/Makefile quiet_cmd_crc32 = GEN $@ cmd_crc32 = $< > $@ $(obj)/crc32table.h: $(obj)/gen_crc32table $(call cmd,crc32)When updating the $(obj)/crc32table.h target, the line:
GEN lib/crc32table.hwill be displayed with
make KBUILD_VERBOSE=.
Command change detection #
When the rule is evaluated, timestamps are compared between the target and its prerequisite files. GNU Make updates the target when any of the prerequisites is newer than that.
The target should be rebuilt also when the command line has changed since the last invocation. This is not supported by Make itself, so Kbuild achieves this by a kind of meta-programming.
if_changed is the macro used for this purpose, in the following form:
quiet_cmd_<command> = ...
cmd_<command> = ...
<target>: <source(s)> FORCE
$(call if_changed,<command>)
Any target that utilizes if_changed must be listed in $(targets), otherwise the command line check will fail, and the target will always be built.
If the target is already listed in the recognized syntax such as obj-y/m, lib-y/m, extra-y/m, always-y/m, hostprogs, userprogs, Kbuild automatically adds it to $(targets). Otherwise, the target must be explicitly added to $(targets).
Assignments to $(targets) are without $(obj)/ prefix. if_changed may be used in conjunction with custom rules as defined in Custom Rules.
Note: It is a typical mistake to forget the FORCE prerequisite. Another common pitfall is that whitespace is sometimes significant; for instance, the below will fail (note the extra space after the comma):
target: source(s) FORCE
WRONG! $(call if_changed, objcopy)
-
Note:
if_changed should not be used more than once per target. It stores the executed command in a corresponding .cmd file and multiple calls would result in overwrites and unwanted results when the target is up to date and only the tests on changed commands trigger execution of commands.
$(CC) support functions #
The kernel may be built with several different versions of $(CC), each supporting a unique set of features and options. kbuild provides basic support to check for valid options for $(CC). $(CC) is usually the gcc compiler, but other alternatives are available.
-
as-option
as-option is used to check if $(CC) -- when used to compile assembler (
*.S) files -- supports the given option. An optional second option may be specified if the first option is not supported.Example:
#arch/sh/Makefile cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),)In the above example, cflags-y will be assigned the option -Wa$(comma)-isa=$(isa-y) if it is supported by $(CC). The second argument is optional, and if supplied will be used if first argument is not supported.
-
as-instr
as-instr checks if the assembler reports a specific instruction and then outputs either option1 or option2 C escapes are supported in the test instruction Note: as-instr-option uses KBUILD_AFLAGS for assembler options
-
cc-option
cc-option is used to check if $(CC) supports a given option, and if not supported to use an optional second option.
Example:
#arch/x86/Makefile cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586)In the above example, cflags-y will be assigned the option -march=pentium-mmx if supported by $(CC), otherwise -march=i586. The second argument to cc-option is optional, and if omitted, cflags-y will be assigned no value if first option is not supported. Note: cc-option uses KBUILD_CFLAGS for $(CC) options
-
cc-option-yn
cc-option-yn is used to check if $(CC) supports a given option and return "y" if supported, otherwise "n".
Example:
#arch/ppc/Makefile biarch := $(call cc-option-yn, -m32) aflags-$(biarch) += -a32 cflags-$(biarch) += -m32In the above example, $(biarch) is set to y if $(CC) supports the -m32 option. When $(biarch) equals "y", the expanded variables $(aflags-y) and $(cflags-y) will be assigned the values -a32 and -m32, respectively.
Note: cc-option-yn uses KBUILD_CFLAGS for $(CC) options
-
cc-disable-warning
cc-disable-warning checks if $(CC) supports a given warning and returns the commandline switch to disable it. This special function is needed, because gcc 4.4 and later accept any unknown -Wno-* option and only warn about it if there is another warning in the source file.
Example:
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)In the above example, -Wno-unused-but-set-variable will be added to KBUILD_CFLAGS only if $(CC) really accepts it.
-
gcc-min-version
gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than or equal to the provided value and evaluates to y if so.
Example:
cflags-$(call gcc-min-version, 110100) := -fooIn this example, cflags-y will be assigned the value -foo if $(CC) is gcc and $(CONFIG_GCC_VERSION) is >= 11.1.
-
clang-min-version
clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater than or equal to the provided value and evaluates to y if so.
Example:
cflags-$(call clang-min-version, 110000) := -fooIn this example, cflags-y will be assigned the value -foo if $(CC) is clang and $(CONFIG_CLANG_VERSION) is >= 11.0.0.
-
cc-cross-prefix
cc-cross-prefix is used to check if there exists a $(CC) in path with one of the listed prefixes. The first prefix where there exist a prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found then nothing is returned.
Additional prefixes are separated by a single space in the call of cc-cross-prefix.
This functionality is useful for architecture Makefiles that try to set CROSS_COMPILE to well-known values but may have several values to select between.
It is recommended only to try to set CROSS_COMPILE if it is a cross build (host arch is different from target arch). And if CROSS_COMPILE is already set then leave it with the old value.
Example:
#arch/m68k/Makefile ifneq ($(SUBARCH),$(ARCH)) ifeq ($(CROSS_COMPILE),) CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-) endif endif
$(RUSTC) support functions #
-
rustc-min-version
rustc-min-version tests if the value of $(CONFIG_RUSTC_VERSION) is greater than or equal to the provided value and evaluates to y if so.
Example:
rustflags-$(call rustc-min-version, 108500) := -CfooIn this example, rustflags-y will be assigned the value -Cfoo if $(CONFIG_RUSTC_VERSION) is >= 1.85.0.
$(LD) support functions #
-
ld-option
ld-option is used to check if $(LD) supports the supplied option. ld-option takes two options as arguments.
The second argument is an optional option that can be used if the first option is not supported by $(LD).
Example:
#Makefile LDFLAGS_vmlinux += $(call ld-option, -X)
Script invocation #
Make rules may invoke scripts to build the kernel. The rules shall always provide the appropriate interpreter to execute the script. They shall not rely on the execute bits being set, and shall not invoke the script directly. For the convenience of manual script invocation, such as invoking ./scripts/checkpatch.pl, it is recommended to set execute bits on the scripts nonetheless.
Kbuild provides variables $(CONFIG_SHELL), $(AWK), $(PERL), and $(PYTHON3) to refer to interpreters for the respective scripts.
Example:
#Makefile
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
$(KERNELRELEASE)
Host Program support #
Kbuild supports building executables on the host for use during the compilation stage.
Two steps are required in order to use a host executable.
The first step is to tell kbuild that a host program exists. This is done utilising the variable hostprogs.
The second step is to add an explicit dependency to the executable. This can be done in two ways. Either add the dependency in a rule, or utilise the variable always-y. Both possibilities are described in the following.
Simple Host Program #
In some cases there is a need to compile and run a program on the computer where the build is running.
The following line tells kbuild that the program bin2hex shall be built on the build host.
Example:
hostprogs := bin2hex
Kbuild assumes in the above example that bin2hex is made from a single c-source file named bin2hex.c located in the same directory as the Makefile.
Composite Host Programs #
Host programs can be made up based on composite objects. The syntax used to define composite objects for host programs is similar to the syntax used for kernel objects. $(<executable>-objs) lists all objects used to link the final executable.
Example:
#scripts/lxdialog/Makefile
hostprogs := lxdialog
lxdialog-objs := checklist.o lxdialog.o
Objects with extension .o are compiled from the corresponding .c files. In the above example, checklist.c is compiled to checklist.o and lxdialog.c is compiled to lxdialog.o.
Finally, the two .o files are linked to the executable, lxdialog. Note: The syntax <executable>-y is not permitted for host-programs.
Using C++ for host programs #
kbuild offers support for host programs written in C++. This was introduced solely to support kconfig, and is not recommended for general use.
Example:
#scripts/kconfig/Makefile
hostprogs := qconf
qconf-cxxobjs := qconf.o
In the example above the executable is composed of the C++ file qconf.cc - identified by $(qconf-cxxobjs).
If qconf is composed of a mixture of .c and .cc files, then an additional line can be used to identify this.
Example:
#scripts/kconfig/Makefile
hostprogs := qconf
qconf-cxxobjs := qconf.o
qconf-objs := check.o
Using Rust for host programs #
Kbuild offers support for host programs written in Rust. However, since a Rust toolchain is not mandatory for kernel compilation, it may only be used in scenarios where Rust is required to be available (e.g. when CONFIG_RUST is enabled).
Example:
hostprogs := target
target-rust := y
Kbuild will compile target using target.rs as the crate root, located in the same directory as the Makefile. The crate may consist of several source files (see samples/rust/hostprogs).
Controlling compiler options for host programs #
When compiling host programs, it is possible to set specific flags. The programs will always be compiled utilising $(HOSTCC) passed the options specified in $(KBUILD_HOSTCFLAGS).
To set flags that will take effect for all host programs created in that Makefile, use the variable HOST_EXTRACFLAGS.
Example:
#scripts/lxdialog/Makefile
HOST_EXTRACFLAGS += -I/usr/include/ncurses
To set specific flags for a single file the following construction is used:
Example:
#arch/ppc64/boot/Makefile
HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE)
It is also possible to specify additional options to the linker.
Example:
#scripts/kconfig/Makefile
HOSTLDLIBS_qconf := -L$(QTDIR)/lib
When linking qconf, it will be passed the extra option -L$(QTDIR)/lib.
When host programs are actually built #
Kbuild will only build host-programs when they are referenced as a prerequisite.
This is possible in two ways:
-
List the prerequisite explicitly in a custom rule.
Example:
#drivers/pci/Makefile hostprogs := gen-devlist $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist ( cd $(obj); ./gen-devlist ) < $<The target $(obj)/devlist.h will not be built before $(obj)/gen-devlist is updated. Note that references to the host programs in custom rules must be prefixed with $(obj).
-
Use always-y
When there is no suitable custom rule, and the host program shall be built when a makefile is entered, the always-y variable shall be used.
Example:
#scripts/lxdialog/Makefile hostprogs := lxdialog always-y := $(hostprogs)Kbuild provides the following shorthand for this:
hostprogs-always-y := lxdialogThis will tell kbuild to build lxdialog even if not referenced in any rule.
Userspace Program support #
Just like host programs, Kbuild also supports building userspace executables for the target architecture (i.e. the same architecture as you are building the kernel for).
The syntax is quite similar. The difference is to use userprogs instead of hostprogs.
Simple Userspace Program #
The following line tells kbuild that the program bpf-direct shall be built for the target architecture.
Example:
userprogs := bpf-direct
Kbuild assumes in the above example that bpf-direct is made from a single C source file named bpf-direct.c located in the same directory as the Makefile.
Composite Userspace Programs #
Userspace programs can be made up based on composite objects. The syntax used to define composite objects for userspace programs is similar to the syntax used for kernel objects. $(<executable>-objs) lists all objects used to link the final executable.
Example:
#samples/seccomp/Makefile
userprogs := bpf-fancy
bpf-fancy-objs := bpf-fancy.o bpf-helper.o
Objects with extension .o are compiled from the corresponding .c files. In the above example, bpf-fancy.c is compiled to bpf-fancy.o and bpf-helper.c is compiled to bpf-helper.o.
Finally, the two .o files are linked to the executable, bpf-fancy. Note: The syntax <executable>-y is not permitted for userspace programs.
Controlling compiler options for userspace programs #
When compiling userspace programs, it is possible to set specific flags. The programs will always be compiled utilising $(CC) passed the options specified in $(KBUILD_USERCFLAGS).
To set flags that will take effect for all userspace programs created in that Makefile, use the variable userccflags.
Example:
# samples/seccomp/Makefile
userccflags += -I usr/include
To set specific flags for a single file the following construction is used:
Example:
bpf-helper-userccflags += -I user/include
It is also possible to specify additional options to the linker.
Example:
# net/bpfilter/Makefile
bpfilter_umh-userldflags += -static
To specify libraries linked to a userspace program, you can use <executable>-userldlibs. The userldlibs syntax specifies libraries linked to all userspace programs created in the current Makefile.
When linking bpfilter_umh, it will be passed the extra option -static.
From command line, USERCFLAGS and USERLDFLAGS will also be used.
When userspace programs are actually built #
Kbuild builds userspace programs only when told to do so. There are two ways to do this.
-
Add it as the prerequisite of another file
Example:
#net/bpfilter/Makefile userprogs := bpfilter_umh $(obj)/bpfilter_umh_blob.o: $(obj)/bpfilter_umh$(obj)/bpfilter_umh is built before $(obj)/bpfilter_umh_blob.o
-
Use always-y
Example:
userprogs := binderfs_example always-y := $(userprogs)Kbuild provides the following shorthand for this:
userprogs-always-y := binderfs_exampleThis will tell Kbuild to build binderfs_example when it visits this Makefile.
Kbuild clean infrastructure #
make clean deletes most generated files in the obj tree where the kernel is compiled. This includes generated files such as host programs. Kbuild knows targets listed in $(hostprogs), $(always-y), $(always-m), $(always-), $(extra-y), $(extra-) and $(targets). They are all deleted during make clean. Files matching the patterns *.[oas], *.ko, plus some additional files generated by kbuild are deleted all over the kernel source tree when make clean is executed.
Additional files or directories can be specified in kbuild makefiles by use of $(clean-files).
Example:
#lib/Makefile
clean-files := crc32table.h
When executing make clean, the file crc32table.h will be deleted. Kbuild will assume files to be in the same relative directory as the Makefile.
To exclude certain files or directories from make clean, use the $(no-clean-files) variable.
Usually kbuild descends down in subdirectories due to obj-* := dir/, but in the architecture makefiles where the kbuild infrastructure is not sufficient this sometimes needs to be explicit.
Example:
#arch/x86/boot/Makefile
subdir- := compressed
The above assignment instructs kbuild to descend down in the directory compressed/ when make clean is executed.
Note 1: arch/$(SRCARCH)/Makefile cannot use subdir-, because that file is included in the top level makefile. Instead, arch/$(SRCARCH)/Kbuild can use subdir-.
Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will be visited during make clean.
Architecture Makefiles #
The top level Makefile sets up the environment and does the preparation, before starting to descend down in the individual directories.
The top level makefile contains the generic part, whereas arch/$(SRCARCH)/Makefile contains what is required to set up kbuild for said architecture.
To do so, arch/$(SRCARCH)/Makefile sets up a number of variables and defines a few targets.
When kbuild executes, the following steps are followed (roughly):
-
Configuration of the kernel => produce .config
-
Store kernel version in include/linux/version.h
-
Updating all other prerequisites to the target prepare:
- Additional prerequisites are specified in arch/$(SRCARCH)/Makefile
-
Recursively descend down in all directories listed in init-* core* drivers-* net-* libs-* and build all targets.
- The values of the above variables are expanded in arch/$(SRCARCH)/Makefile.
-
All object files are then linked and the resulting file vmlinux is located at the root of the obj tree. The very first objects linked are listed in scripts/head-object-list.txt.
-
Finally, the architecture-specific part does any required post processing and builds the final bootimage.
-
This includes building boot records
-
Preparing initrd images and the like
-
Set variables to tweak the build to the architecture #
-
KBUILD_LDFLAGS
Generic $(LD) options
Flags used for all invocations of the linker. Often specifying the emulation is sufficient.
Example:
#arch/s390/Makefile KBUILD_LDFLAGS := -m elf_s390Note: ldflags-y can be used to further customise the flags used. See Non-builtin vmlinux targets - extra-y.
-
LDFLAGS_vmlinux
Options for $(LD) when linking vmlinux
LDFLAGS_vmlinux is used to specify additional flags to pass to the linker when linking the final vmlinux image.
LDFLAGS_vmlinux uses the LDFLAGS_$@ support.
Example:
#arch/x86/Makefile LDFLAGS_vmlinux := -e stext -
OBJCOPYFLAGS
objcopy flags
When $(call if_changed,objcopy) is used to translate a .o file, the flags specified in OBJCOPYFLAGS will be used.
$(call if_changed,objcopy) is often used to generate raw binaries on vmlinux.
Example:
#arch/s390/Makefile OBJCOPYFLAGS := -O binary #arch/s390/boot/Makefile $(obj)/image: vmlinux FORCE $(call if_changed,objcopy)In this example, the binary $(obj)/image is a binary version of vmlinux. The usage of $(call if_changed,xxx) will be described later.
-
KBUILD_AFLAGS
Assembler flags
Default value - see top level Makefile.
Append or modify as required per architecture.
Example:
#arch/sparc64/Makefile KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -
KBUILD_CFLAGS
$(CC) compiler flags
Default value - see top level Makefile.
Append or modify as required per architecture.
Often, the KBUILD_CFLAGS variable depends on the configuration.
Example:
#arch/x86/boot/compressed/Makefile cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small KBUILD_CFLAGS += $(cflags-y)Many arch Makefiles dynamically run the target C compiler to probe supported options:
#arch/x86/Makefile ... cflags-$(CONFIG_MPENTIUMII) += $(call cc-option,\ -march=pentium2,-march=i686) ... # Disable unit-at-a-time mode ... KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time) ...The first example utilises the trick that a config option expands to "y" when selected.
-
KBUILD_RUSTFLAGS
$(RUSTC) compiler flags
Default value - see top level Makefile.
Append or modify as required per architecture.
Often, the KBUILD_RUSTFLAGS variable depends on the configuration.
Note that target specification file generation (for
--target) is handled inscripts/generate_rust_target.rs. -
KBUILD_AFLAGS_KERNEL
Assembler options specific for built-in
$(KBUILD_AFLAGS_KERNEL) contains extra C compiler flags used to compile resident kernel code.
-
KBUILD_AFLAGS_MODULE
Assembler options specific for modules
$(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that are used for assembler.
From commandline AFLAGS_MODULE shall be used (see kbuild.rst).
-
KBUILD_CFLAGS_KERNEL
$(CC) options specific for built-in
$(KBUILD_CFLAGS_KERNEL) contains extra C compiler flags used to compile resident kernel code.
-
KBUILD_CFLAGS_MODULE
Options for $(CC) when building modules
$(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that are used for $(CC).
From commandline CFLAGS_MODULE shall be used (see kbuild.rst).
-
KBUILD_RUSTFLAGS_KERNEL
$(RUSTC) options specific for built-in
$(KBUILD_RUSTFLAGS_KERNEL) contains extra Rust compiler flags used to compile resident kernel code.
-
KBUILD_RUSTFLAGS_MODULE
Options for $(RUSTC) when building modules
$(KBUILD_RUSTFLAGS_MODULE) is used to add arch-specific options that are used for $(RUSTC).
From commandline RUSTFLAGS_MODULE shall be used (see kbuild.rst).
-
KBUILD_LDFLAGS_MODULE
Options for $(LD) when linking modules
$(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options used when linking modules. This is often a linker script.
From commandline LDFLAGS_MODULE shall be used (see kbuild.rst).
-
KBUILD_LDS
The linker script with full path. Assigned by the top-level Makefile.
-
KBUILD_VMLINUX_OBJS
All object files for vmlinux. They are linked to vmlinux in the same order as listed in KBUILD_VMLINUX_OBJS.
The objects listed in scripts/head-object-list.txt are exceptions; they are placed before the other objects.
-
KBUILD_VMLINUX_LIBS
All .a
libfiles for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS together specify all the object files used to link vmlinux.
Add prerequisites to archheaders #
The archheaders: rule is used to generate header files that may be installed into user space by make headers_install.
It is run before make archprepare when run on the architecture itself.
Add prerequisites to archprepare #
The archprepare: rule is used to list prerequisites that need to be built before starting to descend down in the subdirectories.
This is usually used for header files containing assembler constants.
Example:
#arch/arm/Makefile
archprepare: maketools
In this example, the file target maketools will be processed before descending down in the subdirectories.
See also chapter XXX-TODO that describes how kbuild supports generating offset header files.
List directories to visit when descending #
An arch Makefile cooperates with the top Makefile to define variables which specify how to build the vmlinux file. Note that there is no corresponding arch-specific section for modules; the module-building machinery is all architecture-independent.
-
core-y, libs-y, drivers-y
$(libs-y) lists directories where a lib.a archive can be located.
The rest list directories where a built-in.a object file can be located.
Then the rest follows in this order:
$(core-y), $(libs-y), $(drivers-y)
The top level Makefile defines values for all generic directories, and arch/$(SRCARCH)/Makefile only adds architecture-specific directories.
Example:
# arch/sparc/Makefile core-y += arch/sparc/ libs-y += arch/sparc/prom/ libs-y += arch/sparc/lib/ drivers-$(CONFIG_PM) += arch/sparc/power/
Architecture-specific boot images #
An arch Makefile specifies goals that take the vmlinux file, compress it, wrap it in bootstrapping code, and copy the resulting files somewhere. This includes various kinds of installation commands. The actual goals are not standardized across architectures.
It is common to locate any additional processing in a boot/ directory below arch/$(SRCARCH)/.
Kbuild does not provide any smart way to support building a target specified in boot/. Therefore arch/$(SRCARCH)/Makefile shall call make manually to build a target in boot/.
The recommended approach is to include shortcuts in arch/$(SRCARCH)/Makefile, and use the full path when calling down into the arch/$(SRCARCH)/boot/Makefile.
Example:
#arch/x86/Makefile
boot := arch/x86/boot
bzImage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
$(Q)$(MAKE) $(build)=<dir> is the recommended way to invoke make in a subdirectory.
There are no rules for naming architecture-specific targets, but executing make help will list all relevant targets. To support this, $(archhelp) must be defined.
Example:
#arch/x86/Makefile
define archhelp
echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
endif
When make is executed without arguments, the first goal encountered will be built. In the top level Makefile the first goal present is all:.
An architecture shall always, per default, build a bootable image. In make help, the default goal is highlighted with a *.
Add a new prerequisite to all: to select a default goal different from vmlinux.
Example:
#arch/x86/Makefile
all: bzImage
When make is executed without arguments, bzImage will be built.
Commands useful for building a boot image #
Kbuild provides a few macros that are useful when building a boot image.
-
ld
Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
Example:
#arch/x86/boot/Makefile LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext targets += setup setup.o bootsect bootsect.o $(obj)/setup $(obj)/bootsect: %: %.o FORCE $(call if_changed,ld)In this example, there are two possible targets, requiring different options to the linker. The linker options are specified using the LDFLAGS_$@ syntax - one for each potential target.
$(targets) are assigned all potential targets, by which kbuild knows the targets and will:
-
check for commandline changes
-
delete target during make clean
The
: %: %.opart of the prerequisite is a shorthand that frees us from listing the setup.o and bootsect.o files.Note: It is a common mistake to forget the
targets :=assignment, resulting in the target file being recompiled for no obvious reason. -
-
objcopy
Copy binary. Uses OBJCOPYFLAGS usually specified in arch/$(SRCARCH)/Makefile.
OBJCOPYFLAGS_$@ may be used to set additional options.
-
gzip
Compress target. Use maximum compression to compress target.
Example:
#arch/x86/boot/compressed/Makefile $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE $(call if_changed,gzip) -
dtc
Create flattened device tree blob object suitable for linking into vmlinux. Device tree blobs linked into vmlinux are placed in an init section in the image. Platform code must copy the blob to non-init memory prior to calling unflatten_device_tree().
To use this command, simply add
*.dtbinto obj-y or targets, or make some other target depend on%.dtbA central rule exists to create
$(obj)/%.dtbfrom$(src)/%.dts; architecture Makefiles do no need to explicitly write out that rule.Example:
targets += $(dtb-y) DTC_FLAGS ?= -p 1024
Preprocessing linker scripts #
When the vmlinux image is built, the linker script arch/$(SRCARCH)/kernel/vmlinux.lds is used.
The script is a preprocessed variant of the file vmlinux.lds.S located in the same directory.
kbuild knows .lds files and includes a rule *lds.S -> *lds.
Example:
#arch/x86/kernel/Makefile
extra-y := vmlinux.lds
The assignment to extra-y is used to tell kbuild to build the target vmlinux.lds.
The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the specified options when building the target vmlinux.lds.
When building the *.lds target, kbuild uses the variables:
KBUILD_CPPFLAGS : Set in top-level Makefile
cppflags-y : May be set in the kbuild makefile
CPPFLAGS_$(@F) : Target-specific flags.
Note that the full filename is used in this
assignment.
The kbuild infrastructure for *lds files is used in several architecture-specific files.
Generic header files #
The directory include/asm-generic contains the header files that may be shared between individual architectures.
The recommended approach how to use a generic header file is to list the file in the Kbuild file.
See generic-y for further info on syntax etc.
Post-link pass #
If the file arch/xxx/Makefile.postlink exists, this makefile will be invoked for post-link objects (vmlinux and modules.ko) for architectures to run post-link passes on. Must also handle the clean target.
This pass runs after kallsyms generation. If the architecture needs to modify symbol locations, rather than manipulate the kallsyms, it may be easier to add another postlink target for .tmp_vmlinux? targets to be called from link-vmlinux.sh.
For example, powerpc uses this to check relocation sanity of the linked vmlinux file.
Kbuild syntax for exported headers #
The kernel includes a set of headers that is exported to userspace. Many headers can be exported as-is but other headers require a minimal pre-processing before they are ready for user-space.
The pre-processing does:
-
drop kernel-specific annotations
-
drop include of compiler.h
-
drop all sections that are kernel internal (guarded by
ifdef __KERNEL__)
All headers under include/uapi/, include/generated/uapi/, arch/<arch>/include/uapi/ and arch/<arch>/include/generated/uapi/ are exported.
A Kbuild file may be defined under arch/<arch>/include/uapi/asm/ and arch/<arch>/include/asm/ to list asm files coming from asm-generic.
See subsequent chapter for the syntax of the Kbuild file.
no-export-headers #
no-export-headers is essentially used by include/uapi/linux/Kbuild to avoid exporting specific headers (e.g. kvm.h) on architectures that do not support it. It should be avoided as much as possible.
generic-y #
If an architecture uses a verbatim copy of a header from include/asm-generic then this is listed in the file arch/$(SRCARCH)/include/asm/Kbuild like this:
Example:
#arch/x86/include/asm/Kbuild
generic-y += termios.h
generic-y += rtc.h
During the prepare phase of the build a wrapper include file is generated in the directory:
arch/$(SRCARCH)/include/generated/asm
When a header is exported where the architecture uses the generic header a similar wrapper is generated as part of the set of exported headers in the directory:
usr/include/asm
The generated wrapper will in both cases look like the following:
Example: termios.h:
#include <asm-generic/termios.h>
generated-y #
If an architecture generates other header files alongside generic-y wrappers, generated-y specifies them.
This prevents them being treated as stale asm-generic wrappers and removed.
Example:
#arch/x86/include/asm/Kbuild
generated-y += syscalls_32.h
mandatory-y #
mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild to define the minimum set of ASM headers that all architectures must have.
This works like optional generic-y. If a mandatory header is missing in arch/$(SRCARCH)/include/(uapi/)/asm, Kbuild will automatically generate a wrapper of the asm-generic one.
Kbuild Variables #
The top Makefile exports the following variables:
-
VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
These variables define the current kernel version. A few arch Makefiles actually use these values directly; they should use $(KERNELRELEASE) instead.
$(VERSION), $(PATCHLEVEL), and $(SUBLEVEL) define the basic three-part version number, such as "2", "4", and "0". These three values are always numeric.
$(EXTRAVERSION) defines an even tinier sublevel for pre-patches or additional patches. It is usually some non-numeric string such as "-pre4", and is often blank.
-
KERNELRELEASE
$(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable for constructing installation directory names or showing in version strings. Some arch Makefiles use it for this purpose.
-
ARCH
This variable defines the target architecture, such as "i386", "arm", or "sparc". Some kbuild Makefiles test $(ARCH) to determine which files to compile.
By default, the top Makefile sets $(ARCH) to be the same as the host system architecture. For a cross build, a user may override the value of $(ARCH) on the command line:
make ARCH=m68k ... -
SRCARCH
This variable specifies the directory in arch/ to build.
ARCH and SRCARCH may not necessarily match. A couple of arch directories are biarch, that is, a single
arch/*/directory supports both 32-bit and 64-bit.For example, you can pass in ARCH=i386, ARCH=x86_64, or ARCH=x86. For all of them, SRCARCH=x86 because arch/x86/ supports both i386 and x86_64.
-
INSTALL_PATH
This variable defines a place for the arch Makefiles to install the resident kernel image and System.map file. Use this for architecture-specific install targets.
-
INSTALL_MOD_PATH, MODLIB
$(INSTALL_MOD_PATH) specifies a prefix to $(MODLIB) for module installation. This variable is not defined in the Makefile but may be passed in by the user if desired.
$(MODLIB) specifies the directory for module installation. The top Makefile defines $(MODLIB) to $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE). The user may override this value on the command line if desired.
-
INSTALL_MOD_STRIP
If this variable is specified, it will cause modules to be stripped after they are installed. If INSTALL_MOD_STRIP is "1", then the default option --strip-debug will be used. Otherwise, the INSTALL_MOD_STRIP value will be used as the option(s) to the strip command.
-
INSTALL_DTBS_PATH
This variable specifies a prefix for relocations required by build roots. It defines a place for installing the device tree blobs. Like INSTALL_MOD_PATH, it isn't defined in the Makefile, but can be passed by the user if desired. Otherwise it defaults to the kernel install path.
Makefile language #
The kernel Makefiles are designed to be run with GNU Make. The Makefiles use only the documented features of GNU Make, but they do use many GNU extensions.
GNU Make supports elementary list-processing functions. The kernel Makefiles use a novel style of list building and manipulation with few if statements.
GNU Make has two assignment operators, := and =. := performs immediate evaluation of the right-hand side and stores an actual string into the left-hand side. = is like a formula definition; it stores the right-hand side in an unevaluated form and then evaluates this form each time the left-hand side is used.
There are some cases where = is appropriate. Usually, though, := is the right choice.
Credits #
-
Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
-
Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
-
Updates by Sam Ravnborg <sam@ravnborg.org>
-
Language QA by Jan Engelhardt <jengelh@gmx.de>
TODO #
-
Generating offset header files.
-
Add more variables to chapters 7 or 9?
Building External Modules
Peios Kernel / Kernel development / Build system
Peios: Use Building Peios for the repository build, toolchain, configuration and test entry points. This article describes the underlying Linux machinery or upstream workflow. Its standalone build/install commands do not establish a qualified Peios kernel or signed release modules.
This document describes how to build an out-of-tree kernel module.
Introduction #
"kbuild" is the build system used by the Linux kernel. Modules must use kbuild to stay compatible with changes in the build infrastructure and to pick up the right flags to the compiler. Functionality for building modules both in-tree and out-of-tree is provided. The method for building either is similar, and all modules are initially developed and built out-of-tree.
Covered in this document is information aimed at developers interested in building out-of-tree (or "external") modules. The author of an external module should supply a makefile that hides most of the complexity, so one only has to type "make" to build the module. This is easily accomplished, and a complete example will be presented in section Creating a Kbuild File for an External Module.
How to Build External Modules #
To build external modules, you must have a prebuilt kernel available that contains the configuration and header files used in the build. Also, the kernel must have been built with modules enabled. If you are using a distribution kernel, there will be a package for the kernel you are running provided by your distribution.
An alternative is to use the "make" target "modules_prepare." This will make sure the kernel contains the information required. The target exists solely as a simple way to prepare a kernel source tree for building external modules.
NOTE: "modules_prepare" will not build Module.symvers even if CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be executed to make module versioning work.
Command Syntax #
The command to build an external module is:
$ make -C <path_to_kernel_dir> M=$PWDThe kbuild system knows that an external module is being built due to the "M=<dir>" option given in the command.
To build against the running kernel use:
$ make -C /lib/modules/`uname -r`/build M=$PWDThen to install the module(s) just built, add the target "modules_install" to the command:
$ make -C /lib/modules/`uname -r`/build M=$PWD modules_installStarting from Linux 6.13, you can use the -f option instead of -C. This will avoid unnecessary change of the working directory. The external module will be output to the directory where you invoke make.
$ make -f /lib/modules/
uname -r/build/Makefile M=$PWD
Options #
($KDIR refers to the path of the kernel source directory, or the path of the kernel output directory if the kernel was built in a separate build directory.)
You can optionally pass MO= option if you want to build the modules in a separate directory.
make -C $KDIR M=$PWD [MO=$BUILD_DIR]
-C $KDIR
The directory that contains the kernel and relevant build artifacts used for building an external module. "make" will actually change to the specified directory when executing and will change back when finished.
M=$PWD
Informs kbuild that an external module is being built. The value given to "M" is the absolute path of the directory where the external module (kbuild file) is located.
MO=$BUILD_DIR
Specifies a separate output directory for the external module.
Targets #
When building an external module, only a subset of the "make" targets are available.
make -C $KDIR M=$PWD [target]
The default will build the module(s) located in the current directory, so a target does not need to be specified. All output files will also be generated in this directory. No attempts are made to update the kernel source, and it is a precondition that a successful "make" has been executed for the kernel.
modules
The default target for external modules. It has the same functionality as if no target was specified. See description above.
modules_install
Install the external module(s). The default location is /lib/modules/<kernel_release>/updates/, but a prefix may be added with INSTALL_MOD_PATH (discussed in section Module Installation).
clean
Remove all generated files in the module directory only.
help
List the available targets for external modules.
Building Separate Files #
It is possible to build single files that are part of a module. This works equally well for the kernel, a module, and even for external modules.
Example (The module foo.ko, consist of bar.o and baz.o):
make -C $KDIR M=$PWD bar.lst make -C $KDIR M=$PWD baz.o make -C $KDIR M=$PWD foo.ko make -C $KDIR M=$PWD ./
Creating a Kbuild File for an External Module #
In the last section we saw the command to build a module for the running kernel. The module is not actually built, however, because a build file is required. Contained in this file will be the name of the module(s) being built, along with the list of requisite source files. The file may be as simple as a single line:
obj-m := <module_name>.o
The kbuild system will build <module_name>.o from <module_name>.c, and, after linking, will result in the kernel module <module_name>.ko. The above line can be put in either a "Kbuild" file or a "Makefile." When the module is built from multiple sources, an additional line is needed listing the files:
<module_name>-y := <src1>.o <src2>.o ...
NOTE: Further documentation describing the syntax used by kbuild is located in Documentation/kbuild/makefiles.rst.
The examples below demonstrate how to create a build file for the module 8123.ko, which is built from the following files:
8123_if.c
8123_if.h
8123_pci.c
Shared Makefile #
An external module always includes a wrapper makefile that supports building the module using "make" with no arguments. This target is not used by kbuild; it is only for convenience. Additional functionality, such as test targets, can be included but should be filtered out from kbuild due to possible name clashes.
Example 1:
--> filename: Makefile ifneq ($(KERNELRELEASE),) # kbuild part of makefile obj-m := 8123.o 8123-y := 8123_if.o 8123_pci.o else # normal makefile KDIR ?= /lib/modules/`uname -r`/build default: $(MAKE) -C $(KDIR) M=$$PWD endifThe check for KERNELRELEASE is used to separate the two parts of the makefile. In the example, kbuild will only see the two assignments, whereas "make" will see everything except these two assignments. This is due to two passes made on the file: the first pass is by the "make" instance run on the command line; the second pass is by the kbuild system, which is initiated by the parameterized "make" in the default target.
Separate Kbuild File and Makefile #
Kbuild will first look for a file named "Kbuild", and if it is not found, it will then look for "Makefile". Utilizing a "Kbuild" file allows us to split up the "Makefile" from example 1 into two files:
Example 2:
--> filename: Kbuild obj-m := 8123.o 8123-y := 8123_if.o 8123_pci.o --> filename: Makefile KDIR ?= /lib/modules/`uname -r`/build default: $(MAKE) -C $(KDIR) M=$$PWDThe split in example 2 is questionable due to the simplicity of each file; however, some external modules use makefiles consisting of several hundred lines, and here it really pays off to separate the kbuild part from the rest.
Linux 6.13 and later support another way. The external module Makefile can include the kernel Makefile directly, rather than invoking sub Make.
Example 3:
--> filename: Kbuild obj-m := 8123.o 8123-y := 8123_if.o 8123_pci.o --> filename: Makefile KDIR ?= /lib/modules/$(shell uname -r)/build export KBUILD_EXTMOD := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) include $(KDIR)/Makefile
Building Multiple Modules #
kbuild supports building multiple modules with a single build file. For example, if you wanted to build two modules, foo.ko and bar.ko, the kbuild lines would be:
obj-m := foo.o bar.o foo-y := <foo_srcs> bar-y := <bar_srcs>It is that simple!
Include Files #
Within the kernel, header files are kept in standard locations according to the following rule:
If the header file only describes the internal interface of a module, then the file is placed in the same directory as the source files.
If the header file describes an interface used by other parts of the kernel that are located in different directories, then the file is placed in include/linux/.
NOTE:
There are two notable exceptions to this rule: larger subsystems have their own directory under include/, such as include/scsi; and architecture specific headers are located under arch/$(SRCARCH)/include/.
Kernel Includes #
To include a header file located under include/linux/, simply use:
#include <linux/module.h>kbuild will add options to the compiler so the relevant directories are searched.
Single Subdirectory #
External modules tend to place header files in a separate include/ directory where their source is located, although this is not the usual kernel style. To inform kbuild of the directory, use either ccflags-y or CFLAGS_<filename>.o.
Using the example from section 3, if we moved 8123_if.h to a subdirectory named include, the resulting kbuild file would look like:
--> filename: Kbuild obj-m := 8123.o ccflags-y := -I $(src)/include 8123-y := 8123_if.o 8123_pci.o
Several Subdirectories #
kbuild can handle files that are spread over several directories. Consider the following example:
. |__ src | |__ complex_main.c | |__ hal | |__ hardwareif.c | |__ include | |__ hardwareif.h |__ include |__ complex.hTo build the module complex.ko, we then need the following kbuild file:
--> filename: Kbuild obj-m := complex.o complex-y := src/complex_main.o complex-y += src/hal/hardwareif.o ccflags-y := -I$(src)/include ccflags-y += -I$(src)/src/hal/includeAs you can see, kbuild knows how to handle object files located in other directories. The trick is to specify the directory relative to the kbuild file's location. That being said, this is NOT recommended practice.
For the header files, kbuild must be explicitly told where to look. When kbuild executes, the current directory is always the root of the kernel tree (the argument to "-C") and therefore an absolute path is needed. $(src) provides the absolute path by pointing to the directory where the currently executing kbuild file is located.
Module Installation #
Modules which are included in the kernel are installed in the directory:
/lib/modules/$(KERNELRELEASE)/kernel/
And external modules are installed in:
/lib/modules/$(KERNELRELEASE)/updates/
INSTALL_MOD_PATH #
Above are the default directories but as always some level of customization is possible. A prefix can be added to the installation path using the variable INSTALL_MOD_PATH:
$ make INSTALL_MOD_PATH=/frodo modules_install => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel/INSTALL_MOD_PATH may be set as an ordinary shell variable or, as shown above, can be specified on the command line when calling "make." This has effect when installing both in-tree and out-of-tree modules.
INSTALL_MOD_DIR #
External modules are by default installed to a directory under /lib/modules/$(KERNELRELEASE)/updates/, but you may wish to locate modules for a specific functionality in a separate directory. For this purpose, use INSTALL_MOD_DIR to specify an alternative name to "updates.":
$ make INSTALL_MOD_DIR=gandalf -C $KDIR \ M=$PWD modules_install => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf/
Module Versioning #
Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used as a simple ABI consistency check. A CRC value of the full prototype for an exported symbol is created. When a module is loaded/used, the CRC values contained in the kernel are compared with similar values in the module; if they are not equal, the kernel refuses to load the module.
Module.symvers contains a list of all exported symbols from a kernel build.
Symbols From the Kernel (vmlinux + modules) #
During a kernel build, a file named Module.symvers will be generated. Module.symvers contains all exported symbols from the kernel and compiled modules. For each symbol, the corresponding CRC value is also stored.
The syntax of the Module.symvers file is:
<CRC> <Symbol> <Module> <Export Type> <Namespace> 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGEThe fields are separated by tabs and values may be empty (e.g. if no namespace is defined for an exported symbol).
For a kernel build without CONFIG_MODVERSIONS enabled, the CRC would read 0x00000000.
Module.symvers serves two purposes:
It lists all exported symbols from vmlinux and all modules.
It lists the CRC if CONFIG_MODVERSIONS is enabled.
Version Information Formats #
Exported symbols have information stored in __ksymtab or __ksymtab_gpl sections. Symbol names and namespaces are stored in __ksymtab_strings, using a format similar to the string table used for ELF. If CONFIG_MODVERSIONS is enabled, the CRCs corresponding to exported symbols will be added to the __kcrctab or __kcrctab_gpl.
If CONFIG_BASIC_MODVERSIONS is enabled (default with CONFIG_MODVERSIONS), imported symbols will have their symbol name and CRC stored in the __versions section of the importing module. This mode only supports symbols of length up to 64 bytes.
If CONFIG_EXTENDED_MODVERSIONS is enabled (required to enable both CONFIG_MODVERSIONS and CONFIG_RUST at the same time), imported symbols will have their symbol name recorded in the __version_ext_names section as a series of concatenated, null-terminated strings. CRCs for these symbols will be recorded in the __version_ext_crcs section.
Symbols and External Modules #
When building an external module, the build system needs access to the symbols from the kernel to check if all external symbols are defined. This is done in the MODPOST step. modpost obtains the symbols by reading Module.symvers from the kernel source tree. During the MODPOST step, a new Module.symvers file will be written containing all exported symbols from that external module.
Symbols From Another External Module #
Sometimes, an external module uses exported symbols from another external module. Kbuild needs to have full knowledge of all symbols to avoid spitting out warnings about undefined symbols. Two solutions exist for this situation.
NOTE: The method with a top-level kbuild file is recommended but may be impractical in certain situations.
Use a top-level kbuild file
If you have two modules, foo.ko and bar.ko, where foo.ko needs symbols from bar.ko, you can use a common top-level kbuild file so both modules are compiled in the same build. Consider the following directory layout:
./foo/ <= contains foo.ko ./bar/ <= contains bar.koThe top-level kbuild file would then look like:
#./Kbuild (or ./Makefile): obj-m := foo/ bar/And executing:
$ make -C $KDIR M=$PWDwill then do the expected and compile both modules with full knowledge of symbols from either module.
Use "make" variable KBUILD_EXTRA_SYMBOLS
If it is impractical to add a top-level kbuild file, you can assign a space separated list of files to KBUILD_EXTRA_SYMBOLS in your build file. These files will be loaded by modpost during the initialization of its symbol tables.
Tips & Tricks #
Testing for CONFIG_FOO_BAR #
Modules often need to check for certain
CONFIG_options to decide if a specific feature is included in the module. In kbuild this is done by referencing theCONFIG_variable directly:#fs/ext2/Makefile obj-$(CONFIG_EXT2_FS) += ext2.o ext2-y := balloc.o bitmap.o dir.o ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o
Reproducible builds
Peios Kernel / Kernel development / Build system
It is generally desirable that building the same source code with the same set of tools is reproducible, i.e. the output is always exactly the same. This makes it possible to verify that the build infrastructure for a binary distribution or embedded system has not been subverted. This can also make it easier to verify that a source or tool change does not make any difference to the resulting binaries.
The Reproducible Builds project has more information about this general topic. This document covers the various reasons why building the kernel may be unreproducible, and how to avoid them.
Timestamps #
The kernel embeds timestamps in three places:
-
The version string exposed by
uname()and included in/proc/version -
File timestamps in the embedded initramfs
-
If enabled via
CONFIG_IKHEADERS, file timestamps of kernel headers embedded in the kernel or respective module, exposed via/sys/kernel/kheaders.tar.xz
By default the timestamp is the current time and in the case of kheaders the various files' modification times. This must be overridden using the KBUILD_BUILD_TIMESTAMP variable. If you are building from a git commit, you could use its commit date.
The kernel does not use the __DATE__ and __TIME__ macros, and enables warnings if they are used. If you incorporate external code that does use these, you must override the timestamp they correspond to by setting the SOURCE_DATE_EPOCH environment variable.
User, host #
The kernel embeds the building user and host names in /proc/version. These must be overridden using the KBUILD_BUILD_USER and KBUILD_BUILD_HOST variables. If you are building from a git commit, you could use its committer address.
Absolute filenames #
When the kernel is built out-of-tree, debug information may include absolute filenames for the source files. This must be overridden by including the -fdebug-prefix-map option in the KCFLAGS variable.
Depending on the compiler used, the __FILE__ macro may also expand to an absolute filename in an out-of-tree build. Kbuild automatically uses the -fmacro-prefix-map option to prevent this, if it is supported.
The Reproducible Builds web site has more information about these prefix-map options.
Some CONFIG options such as CONFIG_DEBUG_EFI embed absolute paths in object files. Such options should be disabled.
Generated files in source packages #
The build processes for some programs under the tools/ subdirectory do not completely support out-of-tree builds. This may cause a later source package build using e.g. make rpm-pkg to include generated files. You should ensure the source tree is pristine by running make mrproper or git clean -d -f -x before building a source package.
Module signing #
If you enable CONFIG_MODULE_SIG_ALL, the default behaviour is to generate a different temporary key for each build, resulting in the modules being unreproducible. However, including a signing key with your source would presumably defeat the purpose of signing modules.
One approach to this is to divide up the build process so that the unreproducible parts can be treated as sources:
-
Generate a persistent signing key. Add the certificate for the key to the kernel source.
-
Set the
CONFIG_SYSTEM_TRUSTED_KEYSsymbol to include the signing key's certificate, setCONFIG_MODULE_SIG_KEYto an empty string, and disableCONFIG_MODULE_SIG_ALL. Build the kernel and modules. -
Create detached signatures for the modules, and publish them as sources.
-
Perform a second build that attaches the module signatures. It can either rebuild the modules or use the output of step 2.
Structure randomisation #
If you enable CONFIG_RANDSTRUCT, you will need to pre-generate the random seed in scripts/basic/randstruct.seed so the same value is used by each build. See scripts/gen-randstruct-seed.sh for details.
Debug info conflicts #
This is not a problem of unreproducibility, but of generated files being too reproducible.
Once you set all the necessary variables for a reproducible build, a vDSO's debug information may be identical even for different kernel versions. This can result in file conflicts between debug information packages for the different kernel versions.
To avoid this, you can make the vDSO different for different kernel versions by including an arbitrary string of "salt" in it. This is specified by the Kconfig symbol CONFIG_BUILD_SALT.
Git #
Uncommitted changes or different commit ids in git can also lead to different compilation results. For example, after executing git reset HEAD^, even if the code is the same, the include/config/kernel.release generated during compilation will be different, which will eventually lead to binary differences. See scripts/setlocalversion for details.
Kconfig select dependency example
Peios Kernel / Kernel development / Build system
Minimal Kconfig example illustrating how select can enable a symbol despite its dependencies.
# Select broken dependency issue
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Test with:
#
# make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.select-break menuconfig
#
# kconfig will not complain and enable this layout for configuration. This is
# currently a feature of kconfig, given select was designed to be heavy handed.
# Kconfig currently does not check the list of symbols listed on a symbol's
# "select" list, this is done on purpose to help load a set of known required
# symbols. Because of this use of select should be used with caution. An
# example of this issue is below.
#
# The option B and C are clearly contradicting with respect to A.
# However, when A is set, C can be set as well because Kconfig does not
# visit the dependencies of the select target (in this case B). And since
# Kconfig does not visit the dependencies, it breaks the dependencies of B
# (!A).
mainmenu "Simple example to demo kconfig select broken dependency issue"
config A
bool "CONFIG A"
config B
bool "CONFIG B"
depends on !A
config C
bool "CONFIG C"
depends on A
select B
Kernel Hacking Guides
Peios Kernel / Kernel development / Kernel programming
False Sharing
Peios Kernel / Kernel development / Kernel programming
What is False Sharing #
False sharing is related with cache mechanism of maintaining the data coherence of one cache line stored in multiple CPU's caches; then academic definition for it is in 1. Consider a struct with a refcount and a string:
struct foo {
refcount_t refcount;
...
char name[16];
} ____cacheline_internodealigned_in_smp;
Member 'refcount'(A) and 'name'(B) _share_ one cache line like below:
+-----------+ +-----------+
| CPU 0 | | CPU 1 |
+-----------+ +-----------+
/ |
/ |
V V
+----------------------+ +----------------------+
| A B | Cache 0 | A B | Cache 1
+----------------------+ +----------------------+
| |
---------------------------+------------------+-----------------------------
| |
+----------------------+
| |
+----------------------+
Main Memory | A B |
+----------------------+
'refcount' is modified frequently, but 'name' is set once at object creation time and is never modified. When many CPUs access 'foo' at the same time, with 'refcount' being only bumped by one CPU frequently and 'name' being read by other CPUs, all those reading CPUs have to reload the whole cache line over and over due to the 'sharing', even though 'name' is never changed.
There are many real-world cases of performance regressions caused by false sharing. One of these is a rw_semaphore 'mmap_lock' inside mm_struct struct, whose cache line layout change triggered a regression and Linus analyzed in 2.
There are two key factors for a harmful false sharing:
-
A global datum accessed (shared) by many CPUs
-
In the concurrent accesses to the data, there is at least one write operation: write/write or write/read cases.
The sharing could be from totally unrelated kernel components, or different code paths of the same kernel component.
False Sharing Pitfalls #
Back in time when one platform had only one or a few CPUs, hot data members could be purposely put in the same cache line to make them cache hot and save cacheline/TLB, like a lock and the data protected by it. But for recent large system with hundreds of CPUs, this may not work when the lock is heavily contended, as the lock owner CPU could write to the data, while other CPUs are busy spinning the lock.
Looking at past cases, there are several frequently occurring patterns for false sharing:
-
lock (spinlock/mutex/semaphore) and data protected by it are purposely put in one cache line.
-
global data being put together in one cache line. Some kernel subsystems have many global parameters of small size (4 bytes), which can easily be grouped together and put into one cache line.
-
data members of a big data structure randomly sitting together without being noticed (cache line is usually 64 bytes or more), like 'mem_cgroup' struct.
Following 'mitigation' section provides real-world examples.
False sharing could easily happen unless they are intentionally checked, and it is valuable to run specific tools for performance critical workloads to detect false sharing affecting performance case and optimize accordingly.
How to detect and analyze False Sharing #
perf record/report/stat are widely used for performance tuning, and once hotspots are detected, tools like 'perf-c2c' and 'pahole' can be further used to detect and pinpoint the possible false sharing data structures. 'addr2line' is also good at decoding instruction pointer when there are multiple layers of inline functions.
perf-c2c can capture the cache lines with most false sharing hits, decoded functions (line number of file) accessing that cache line, and in-line offset of the data. Simple commands are:
$ perf c2c record -ag sleep 3
$ perf c2c report --call-graph none -k vmlinux
When running above during testing will-it-scale's tlb_flush1 case, perf reports something like:
Total records : 1658231
Locked Load/Store Operations : 89439
Load Operations : 623219
Load Local HITM : 92117
Load Remote HITM : 139
#----------------------------------------------------------------------
4 0 2374 0 0 0 0xff1100088366d880
#----------------------------------------------------------------------
0.00% 42.29% 0.00% 0.00% 0.00% 0x8 1 1 0xffffffff81373b7b 0 231 129 5312 64 [k] __mod_lruvec_page_state [kernel.vmlinux] memcontrol.h:752 1
0.00% 13.10% 0.00% 0.00% 0.00% 0x8 1 1 0xffffffff81374718 0 226 97 3551 64 [k] folio_lruvec_lock_irqsave [kernel.vmlinux] memcontrol.h:752 1
0.00% 11.20% 0.00% 0.00% 0.00% 0x8 1 1 0xffffffff812c29bf 0 170 136 555 64 [k] lru_add_fn [kernel.vmlinux] mm_inline.h:41 1
0.00% 7.62% 0.00% 0.00% 0.00% 0x8 1 1 0xffffffff812c3ec5 0 175 108 632 64 [k] release_pages [kernel.vmlinux] mm_inline.h:41 1
0.00% 23.29% 0.00% 0.00% 0.00% 0x10 1 1 0xffffffff81372d0a 0 234 279 1051 64 [k] __mod_memcg_lruvec_state [kernel.vmlinux] memcontrol.c:736 1
A nice introduction for perf-c2c is 3.
'pahole' decodes data structure layouts delimited in cache line granularity. Users can match the offset in perf-c2c output with pahole's decoding to locate the exact data members. For global data, users can search the data address in System.map.
Possible Mitigations #
False sharing does not always need to be mitigated. False sharing mitigations should balance performance gains with complexity and space consumption. Sometimes, lower performance is OK, and it's unnecessary to hyper-optimize every rarely used data structure or a cold data path.
False sharing hurting performance cases are seen more frequently with core count increasing. Because of these detrimental effects, many patches have been proposed across variety of subsystems (like networking and memory management) and merged. Some common mitigations (with examples) are:
-
Separate hot global data in its own dedicated cache line, even if it is just a 'short' type. The downside is more consumption of memory, cache line and TLB entries.
- Commit 91b6d3256356 ("net: cache align tcp_memory_allocated, tcp_sockets_allocated")
-
Reorganize the data structure, separate the interfering members to different cache lines. One downside is it may introduce new false sharing of other members.
- Commit 802f1d522d5f ("mm: page_counter: re-layout structure to reduce false sharing")
-
Replace 'write' with 'read' when possible, especially in loops. Like for some global variable, use compare(read)-then-write instead of unconditional write. For example, use:
if (!test_bit(XXX)) set_bit(XXX);instead of directly "set_bit(XXX);", similarly for atomic_t data:
if (atomic_read(XXX) == AAA) atomic_set(XXX, BBB);-
Commit 7b1002f7cfe5 ("bcache: fixup bcache_dev_sectors_dirty_add() multithreaded CPU false sharing")
-
Commit 292648ac5cf1 ("mm: gup: allow FOLL_PIN to scale in SMP")
-
-
Turn hot global data to 'per-cpu data + global data' when possible, or reasonably increase the threshold for syncing per-cpu data to global data, to reduce or postpone the 'write' to that global data.
-
Commit 520f897a3554 ("ext4: use percpu_counters for extent_status cache hits/misses")
-
Commit 56f3547bfa4d ("mm: adjust vm_committed_as_batch according to vm overcommit policy")
-
Surely, all mitigations should be carefully verified to not cause side effects. To avoid introducing false sharing when coding, it's better to:
-
Be aware of cache line boundaries
-
Group mostly read-only fields together
-
Group things that are written at the same time together
-
Separate frequently read and frequently written fields on different cache lines.
and better add a comment stating the false sharing consideration.
One note is, sometimes even after a severe false sharing is detected and solved, the performance may still have no obvious improvement as the hotspot switches to a new place.
Miscellaneous #
One open issue is that the kernel has an optional data structure randomization mechanism, which also randomizes the situation of cache line sharing among data members.
[1] https://en.wikipedia.org/wiki/False_sharing
[2] https://lore.kernel.org/lkml/CAHk-=whoqV=cX5VC80mmR9rr+Z+yQ6fiQZm36Fb-izsanHg23w@mail.gmail.com/
Unreliable Guide To Hacking The Linux Kernel
Peios Kernel / Kernel development / Kernel programming
Author: Rusty Russell
Introduction #
Welcome, gentle reader, to Rusty's Remarkably Unreliable Guide to Linux Kernel Hacking. This document describes the common routines and general requirements for kernel code: its goal is to serve as a primer for Linux kernel development for experienced C programmers. I avoid implementation details: that's what the code is for, and I ignore whole tracts of useful routines.
Before you read this, please understand that I never wanted to write this document, being grossly under-qualified, but I always wanted to read it, and this was the only way. I hope it will grow into a compendium of best practice, common starting points and random information.
The Players #
At any time each of the CPUs in a system can be:
-
not associated with any process, serving a hardware interrupt;
-
not associated with any process, serving a softirq or tasklet;
-
running in kernel space, associated with a process (user context);
-
running a process in user space.
There is an ordering between these. The bottom two can preempt each other, but above that is a strict hierarchy: each can only be preempted by the ones above it. For example, while a softirq is running on a CPU, no other softirq will preempt it, but a hardware interrupt can. However, any other CPUs in the system execute independently.
We'll see a number of ways that the user context can block interrupts, to become truly non-preemptable.
User Context #
User context is when you are coming in from a system call or other trap: like userspace, you can be preempted by more important tasks and by interrupts. You can sleep by calling schedule().
In user context, the current pointer (indicating the task we are currently executing) is valid, and in_interrupt() (include/linux/preempt.h) is false.
Hardware Interrupts (Hard IRQs) #
Timer ticks, network cards and keyboard are examples of real hardware which produce interrupts at any time. The kernel runs interrupt handlers, which services the hardware. The kernel guarantees that this handler is never re-entered: if the same interrupt arrives, it is queued (or dropped). Because it disables interrupts, this handler has to be fast: frequently it simply acknowledges the interrupt, marks a 'software interrupt' for execution and exits.
You can tell you are in a hardware interrupt, because in_hardirq() returns true.
Software Interrupt Context: Softirqs and Tasklets #
Whenever a system call is about to return to userspace, or a hardware interrupt handler exits, any 'software interrupts' which are marked pending (usually by hardware interrupts) are run (kernel/softirq.c).
Much of the real interrupt handling work is done here. Early in the transition to SMP, there were only 'bottom halves' (BHs), which didn't take advantage of multiple CPUs. Shortly after we switched from wind-up computers made of match-sticks and snot, we abandoned this limitation and switched to 'softirqs'.
include/linux/interrupt.h lists the different softirqs. A very important softirq is the timer softirq (include/linux/timer.h): you can register to have it call functions for you in a given length of time.
Softirqs are often a pain to deal with, since the same softirq will run simultaneously on more than one CPU. For this reason, tasklets (include/linux/interrupt.h) are more often used: they are dynamically-registrable (meaning you can have as many as you want), and they also guarantee that any tasklet will only run on one CPU at any time, although different tasklets can run simultaneously.
You can tell you are in a softirq (or tasklet) using the in_softirq() macro (include/linux/preempt.h).
Some Basic Rules #
-
No memory protection
If you corrupt memory, whether in user context or interrupt context, the whole machine will crash. Are you sure you can't do what you want in userspace?
-
No floating point or MMX
The FPU context is not saved; even in user context the FPU state probably won't correspond with the current process: you would mess with some user process' FPU state. If you really want to do this, you would have to explicitly save/restore the full FPU state (and avoid context switches). It is generally a bad idea; use fixed point arithmetic first.
-
A rigid stack limit
Depending on configuration options the kernel stack is about 3K to 6K for most 32-bit architectures: it's about 14K on most 64-bit archs, and often shared with interrupts so you can't use it all. Avoid deep recursion and huge local arrays on the stack (allocate them dynamically instead).
-
The Linux kernel is portable
Let's keep it that way. Your code should be 64-bit clean, and endian-independent. You should also minimize CPU specific stuff, e.g. inline assembly should be cleanly encapsulated and minimized to ease porting. Generally it should be restricted to the architecture-dependent part of the kernel tree.
ioctls: Not writing a new system call #
A system call generally looks like this:
asmlinkage long sys_mycall(int arg)
{
return 0;
}
First, in most cases you don't want to create a new system call. You create a character device and implement an appropriate ioctl for it. This is much more flexible than system calls, doesn't have to be entered in every architecture's include/asm/unistd.h and arch/kernel/entry.S file, and is much more likely to be accepted by Linus.
If all your routine does is read or write some parameter, consider implementing a sysfs() interface instead.
Inside the ioctl you're in user context to a process. When a error occurs you return a negated errno (see include/uapi/asm-generic/errno-base.h, include/uapi/asm-generic/errno.h and include/linux/errno.h), otherwise you return 0.
After you slept you should check if a signal occurred: the Unix/Linux way of handling signals is to temporarily exit the system call with the -ERESTARTSYS error. The system call entry code will switch back to user context, process the signal handler and then your system call will be restarted (unless the user disabled that). So you should be prepared to process the restart, e.g. if you're in the middle of manipulating some data structure.
if (signal_pending(current))
return -ERESTARTSYS;
If you're doing longer computations: first think userspace. If you really want to do it in kernel you should regularly check if you need to give up the CPU (remember there is cooperative multitasking per CPU). Idiom:
cond_resched(); /* Will sleep */
A short note on interface design: the UNIX system call motto is "Provide mechanism not policy".
Recipes for Deadlock #
You cannot call any routines which may sleep, unless:
-
You are in user context.
-
You do not own any spinlocks.
-
You have interrupts enabled (actually, Andi Kleen says that the scheduling code will enable them for you, but that's probably not what you wanted).
Note that some functions may sleep implicitly: common ones are the user space access functions (*_user) and memory allocation functions without GFP_ATOMIC.
You should always compile your kernel CONFIG_DEBUG_ATOMIC_SLEEP on, and it will warn you if you break these rules. If you do break the rules, you will eventually lock up your box.
Really.
Common Routines #
printk() #
Defined in include/linux/printk.h
printk() feeds kernel messages to the console, dmesg, and the syslog daemon. It is useful for debugging and reporting errors, and can be used inside interrupt context, but use with caution: a machine which has its console flooded with printk messages is unusable. It uses a format string mostly compatible with ANSI C printf, and C string concatenation to give it a first "priority" argument:
printk(KERN_INFO "i = %u\n", i);
See include/linux/kern_levels.h; for other KERN_ values; these are interpreted by syslog as the level. Special case: for printing an IP address use:
__be32 ipaddress;
printk(KERN_INFO "my ip: %pI4\n", &ipaddress);
printk() internally uses a 1K buffer and does not catch overruns. Make sure that will be enough.
copy_to_user() / copy_from_user() / get_user() / put_user() #
Defined in include/linux/uaccess.h / asm/uaccess.h
[SLEEPS]
put_user() and get_user() are used to get and put single values (such as an int, char, or long) from and to userspace. A pointer into userspace should never be simply dereferenced: data should be copied using these routines. Both return -EFAULT or 0.
copy_to_user() and copy_from_user() are more general: they copy an arbitrary amount of data to and from userspace.
[Yes, this objectionable interface makes me cringe. The flamewar comes up every year or so. --RR.]
The functions may sleep implicitly. This should never be called outside user context (it makes no sense), with interrupts disabled, or a spinlock held.
kmalloc()/kfree() #
Defined in include/linux/slab.h
[MAY SLEEP: SEE BELOW]
These routines are used to dynamically request pointer-aligned chunks of memory, like malloc and free do in userspace, but kmalloc() takes an extra flag word. Important values:
-
GFP_KERNELMay sleep and swap to free memory. Only allowed in user context, but is the most reliable way to allocate memory.
-
GFP_ATOMICDon't sleep. Less reliable than
GFP_KERNEL, but may be called from interrupt context. You should really have a good out-of-memory error-handling strategy. -
GFP_DMAAllocate ISA DMA lower than 16MB. If you don't know what that is you don't need it. Very unreliable.
If you see a sleeping function called from invalid context warning message, then maybe you called a sleeping allocation function from interrupt context without GFP_ATOMIC. You should really fix that. Run, don't walk.
If you are allocating at least PAGE_SIZE (asm/page.h or asm/page_types.h) bytes, consider using __get_free_pages() (include/linux/gfp.h). It takes an order argument (0 for page sized, 1 for double page, 2 for four pages etc.) and the same memory priority flag word as above.
If you are allocating more than a page worth of bytes you can use vmalloc(). It'll allocate virtual memory in the kernel map. This block is not contiguous in physical memory, but the MMU makes it look like it is for you (so it'll only look contiguous to the CPUs, not to external device drivers). If you really need large physically contiguous memory for some weird device, you have a problem: it is poorly supported in Linux because after some time memory fragmentation in a running kernel makes it hard. The best way is to allocate the block early in the boot process via the alloc_bootmem() routine.
Before inventing your own cache of often-used objects consider using a slab cache in include/linux/slab.h
current #
Defined in include/asm/current.h
This global variable (really a macro) contains a pointer to the current task structure, so is only valid in user context. For example, when a process makes a system call, this will point to the task structure of the calling process. It is not NULL in interrupt context.
mdelay()/udelay() #
Defined in include/asm/delay.h / include/linux/delay.h
The udelay() and ndelay() functions can be used for small pauses. Do not use large values with them as you risk overflow - the helper function mdelay() is useful here, or consider msleep().
cpu_to_be32()/be32_to_cpu()/cpu_to_le32()/le32_to_cpu() #
Defined in include/asm/byteorder.h
The cpu_to_be32() family (where the "32" can be replaced by 64 or 16, and the "be" can be replaced by "le") are the general way to do endian conversions in the kernel: they return the converted value. All variations supply the reverse as well: be32_to_cpu(), etc.
There are two major variations of these functions: the pointer variation, such as cpu_to_be32p(), which take a pointer to the given type, and return the converted value. The other variation is the "in-situ" family, such as cpu_to_be32s(), which convert value referred to by the pointer, and return void.
local_irq_save()/local_irq_restore() #
Defined in include/linux/irqflags.h
These routines disable hard interrupts on the local CPU, and restore them. They are reentrant; saving the previous state in their one unsigned long flags argument. If you know that interrupts are enabled, you can simply use local_irq_disable() and local_irq_enable().
local_bh_disable()/local_bh_enable() #
Defined in include/linux/bottom_half.h
These routines disable soft interrupts on the local CPU, and restore them. They are reentrant; if soft interrupts were disabled before, they will still be disabled after this pair of functions has been called. They prevent softirqs and tasklets from running on the current CPU.
smp_processor_id() #
Defined in include/linux/smp.h
get_cpu() disables preemption (so you won't suddenly get moved to another CPU) and returns the current processor number, between 0 and NR_CPUS. Note that the CPU numbers are not necessarily continuous. You return it again with put_cpu() when you are done.
If you know you cannot be preempted by another task (ie. you are in interrupt context, or have preemption disabled) you can use smp_processor_id().
__init/__exit/__initdata #
Defined in include/linux/init.h
After boot, the kernel frees up a special section; functions marked with __init and data structures marked with __initdata are dropped after boot is complete: similarly modules discard this memory after initialization. __exit is used to declare a function which is only required on exit: the function will be dropped if this file is not compiled as a module. See the header file for use. Note that it makes no sense for a function marked with __init to be exported to modules with EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL()- this will break.
__initcall()/module_init() #
Defined in include/linux/init.h / include/linux/module.h
Many parts of the kernel are well served as a module (dynamically-loadable parts of the kernel). Using the module_init() and module_exit() macros it is easy to write code without #ifdefs which can operate both as a module or built into the kernel.
The module_init() macro defines which function is to be called at module insertion time (if the file is compiled as a module), or at boot time: if the file is not compiled as a module the module_init() macro becomes equivalent to __initcall(), which through linker magic ensures that the function is called on boot.
The function can return a negative error number to cause module loading to fail (unfortunately, this has no effect if the module is compiled into the kernel). This function is called in user context with interrupts enabled, so it can sleep.
module_exit() #
Defined in include/linux/module.h
This macro defines the function to be called at module removal time (or never, in the case of the file compiled into the kernel). It will only be called if the module usage count has reached zero. This function can also sleep, but cannot fail: everything must be cleaned up by the time it returns.
Note that this macro is optional: if it is not present, your module will not be removable (except for 'rmmod -f').
try_module_get()/module_put() #
Defined in include/linux/module.h
These manipulate the module usage count, to protect against removal (a module also can't be removed if another module uses one of its exported symbols: see below). Before calling into module code, you should call try_module_get() on that module: if it fails, then the module is being removed and you should act as if it wasn't there. Otherwise, you can safely enter the module, and call module_put() when you're finished.
Most registerable structures have an owner field, such as in the struct file_operations <file_operations> structure. Set this field to the macro THIS_MODULE.
Wait Queues include/linux/wait.h #
[SLEEPS]
A wait queue is used to wait for someone to wake you up when a certain condition is true. They must be used carefully to ensure there is no race condition. You declare a wait_queue_head_t, and then processes which want to wait for that condition declare a wait_queue_entry_t referring to themselves, and place that in the queue.
Declaring #
You declare a wait_queue_head_t using the DECLARE_WAIT_QUEUE_HEAD() macro, or using the init_waitqueue_head() routine in your initialization code.
Queuing #
Placing yourself in the waitqueue is fairly complex, because you must put yourself in the queue before checking the condition. There is a macro to do this: wait_event_interruptible() (include/linux/wait.h) The first argument is the wait queue head, and the second is an expression which is evaluated; the macro returns 0 when this expression is true, or -ERESTARTSYS if a signal is received. The wait_event() version ignores signals.
Waking Up Queued Tasks #
Call wake_up() (include/linux/wait.h), which will wake up every process in the queue. The exception is if one has TASK_EXCLUSIVE set, in which case the remainder of the queue will not be woken. There are other variants of this basic function available in the same header.
Atomic Operations #
Certain operations are guaranteed atomic on all platforms. The first class of operations work on atomic_t (include/asm/atomic.h); this contains a signed integer (at least 32 bits long), and you must use these functions to manipulate or read atomic_t variables. atomic_read() and atomic_set() get and set the counter, atomic_add(), atomic_sub(), atomic_inc(), atomic_dec(), and atomic_dec_and_test() (returns true if it was decremented to zero).
Yes. It returns true (i.e. != 0) if the atomic variable is zero.
Note that these functions are slower than normal arithmetic, and so should not be used unnecessarily.
The second class of atomic operations is atomic bit operations on an unsigned long, defined in include/linux/bitops.h. These operations generally take a pointer to the bit pattern, and a bit number: 0 is the least significant bit. set_bit(), clear_bit() and change_bit() set, clear, and flip the given bit. test_and_set_bit(), test_and_clear_bit() and test_and_change_bit() do the same thing, except return true if the bit was previously set; these are particularly useful for atomically setting flags.
It is possible to call these operations with bit indices greater than BITS_PER_LONG. The resulting behavior is strange on big-endian platforms though so it is a good idea not to do this.
Symbols #
Within the kernel proper, the normal linking rules apply (ie. unless a symbol is declared to be file scope with the static keyword, it can be used anywhere in the kernel). However, for modules, a special exported symbol table is kept which limits the entry points to the kernel proper. Modules can also export symbols.
EXPORT_SYMBOL() #
Defined in include/linux/export.h
This is the classic method of exporting a symbol: dynamically loaded modules will be able to use the symbol as normal.
EXPORT_SYMBOL_GPL() #
Defined in include/linux/export.h
Similar to EXPORT_SYMBOL() except that the symbols exported by EXPORT_SYMBOL_GPL() can only be seen by modules with a MODULE_LICENSE() that specifies a GPLv2 compatible license. It implies that the function is considered an internal implementation issue, and not really an interface. Some maintainers and developers may however require EXPORT_SYMBOL_GPL() when adding any new APIs or functionality.
EXPORT_SYMBOL_NS() #
Defined in include/linux/export.h
This is the variant of EXPORT_SYMBOL() that allows specifying a symbol namespace. Symbol Namespaces are documented in Documentation/core-api/symbol-namespaces.rst
EXPORT_SYMBOL_NS_GPL() #
Defined in include/linux/export.h
This is the variant of EXPORT_SYMBOL_GPL() that allows specifying a symbol namespace. Symbol Namespaces are documented in Documentation/core-api/symbol-namespaces.rst
Routines and Conventions #
Double-linked lists include/linux/list.h #
There used to be three sets of linked-list routines in the kernel headers, but this one is the winner. If you don't have some particular pressing need for a single list, it's a good choice.
In particular, list_for_each_entry() is useful.
Return Conventions #
For code called in user context, it's very common to defy C convention, and return 0 for success, and a negative error number (eg. -EFAULT) for failure. This can be unintuitive at first, but it's fairly widespread in the kernel.
Using ERR_PTR() (include/linux/err.h) to encode a negative error number into a pointer, and IS_ERR() and PTR_ERR() to get it back out again: avoids a separate pointer parameter for the error number. Icky, but in a good way.
Breaking Compilation #
Linus and the other developers sometimes change function or structure names in development kernels; this is not done just to keep everyone on their toes: it reflects a fundamental change (eg. can no longer be called with interrupts on, or does extra checks, or doesn't do checks which were caught before). Usually this is accompanied by a fairly complete note to the appropriate kernel development mailing list; search the archives. Simply doing a global replace on the file usually makes things worse.
Initializing structure members #
The preferred method of initializing structures is to use designated initialisers, as defined by ISO C99, eg:
static struct block_device_operations opt_fops = {
.open = opt_open,
.release = opt_release,
.ioctl = opt_ioctl,
.check_media_change = opt_media_change,
};
This makes it easy to grep for, and makes it clear which structure fields are set. You should do this because it looks cool.
GNU Extensions #
GNU Extensions are explicitly allowed in the Linux kernel. Note that some of the more complex ones are not very well supported, due to lack of general use, but the following are considered standard (see the GCC info page section "C Extensions" for more details - Yes, really the info page, the man page is only a short summary of the stuff in info).
-
Inline functions
-
Statement expressions (ie. the ({ and }) constructs).
-
Declaring attributes of a function / variable / type (__attribute__)
-
typeof
-
Zero length arrays
-
Macro varargs
-
Arithmetic on void pointers
-
Non-Constant initializers
-
Assembler Instructions (not outside arch/ and include/asm/)
-
Function names as strings (__func__).
-
__builtin_constant_p()
Be wary when using long long in the kernel, the code gcc generates for it is horrible and worse: division and multiplication does not work on i386 because the GCC runtime functions for it are missing from the kernel environment.
C++ #
Using C++ in the kernel is usually a bad idea, because the kernel does not provide the necessary runtime environment and the include files are not tested for it. It is still possible, but not recommended. If you really want to do this, forget about exceptions at least.
#if #
It is generally considered cleaner to use macros in header files (or at the top of .c files) to abstract away functions rather than using `#if' pre-processor statements throughout the source code.
Putting Your Stuff in the Kernel #
In order to get your stuff into shape for official inclusion, or even to make a neat patch, there's administrative work to be done:
-
Figure out who are the owners of the code you've been modifying. Look at the top of the source files, inside the
MAINTAINERSfile, and last of all in theCREDITSfile. You should coordinate with these people to make sure you're not duplicating effort, or trying something that's already been rejected.Make sure you put your name and email address at the top of any files you create or modify significantly. This is the first place people will look when they find a bug, or when they want to make a change.
-
Usually you want a configuration option for your kernel hack. Edit
Kconfigin the appropriate directory. The Config language is simple to use by cut and paste, and there's complete documentation in Documentation/kbuild/kconfig-language.rst.In your description of the option, make sure you address both the expert user and the user who knows nothing about your feature. Mention incompatibilities and issues here. Definitely end your description with “if in doubt, say N” (or, occasionally, `Y'); this is for people who have no idea what you are talking about.
-
Edit the
Makefile: the CONFIG variables are exported here so you can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax is documented in Documentation/kbuild/makefiles.rst. -
Put yourself in
CREDITSif you consider what you've done noteworthy, usually beyond a single file (your name should be at the top of the source files anyway).MAINTAINERSmeans you want to be consulted when changes are made to a subsystem, and hear about bugs; it implies a more-than-passing commitment to some part of the code. -
Finally, don't forget to read Documentation/process/submitting-patches.rst.
Kernel Cantrips #
Some favorites from browsing the source. Feel free to add to this list.
arch/x86/include/asm/delay.h:
#define ndelay(n) (__builtin_constant_p(n) ? \
((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
__ndelay(n))
include/linux/fs.h:
/*
* Kernel pointers have redundant information, so we can use a
* scheme where we can return either an error code or a dentry
* pointer with the same return value.
*
* This should be a per-architecture thing, to allow different
* error and pointer decisions.
*/
#define ERR_PTR(err) ((void *)((long)(err)))
#define PTR_ERR(ptr) ((long)(ptr))
#define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)(-1000))
arch/x86/include/asm/uaccess_32.h::
#define copy_to_user(to,from,n) \
(__builtin_constant_p(n) ? \
__constant_copy_to_user((to),(from),(n)) : \
__generic_copy_to_user((to),(from),(n)))
arch/sparc/kernel/head.S::
/*
* Sun people can't spell worth damn. "compatability" indeed.
* At least we *know* we can't spell, and use a spell-checker.
*/
/* Uh, actually Linus it is I who cannot spell. Too much murky
* Sparc assembly will do this to ya.
*/
C_LABEL(cputypvar):
.asciz "compatibility"
/* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */
.align 4
C_LABEL(cputypvar_sun4m):
.asciz "compatible"
arch/sparc/lib/checksum.S::
/* Sun, you just can't beat me, you just can't. Stop trying,
* give up. I'm serious, I am going to kick the living shit
* out of you, game over, lights out.
*/
Thanks #
Thanks to Andi Kleen for the idea, answering my questions, fixing my mistakes, filling content, etc. Philipp Rumpf for more spelling and clarity fixes, and some excellent non-obvious points. Werner Almesberger for giving me a great summary of disable_irq(), and Jes Sorensen and Andrea Arcangeli added caveats. Michael Elizabeth Chastain for checking and adding to the Configure section. Telsa Gwynne for teaching me DocBook.
Unreliable Guide To Locking
Peios Kernel / Kernel development / Kernel programming
Author: Rusty Russell
Introduction #
Welcome, to Rusty's Remarkably Unreliable Guide to Kernel Locking issues. This document describes the locking systems in the Linux Kernel in 2.6.
With the wide availability of HyperThreading, and preemption in the Linux Kernel, everyone hacking on the kernel needs to know the fundamentals of concurrency and locking for SMP.
The Problem With Concurrency #
(Skip this if you know what a Race Condition is).
In a normal program, you can increment a counter like so:
very_important_count++;
This is what they would expect to happen:
|
Instance 1 |
Instance 2 |
|---|---|
|
read very_important_count (5) |
|
|
add 1 (6) |
|
|
write very_important_count (6) |
|
|
read very_important_count (6) |
|
|
add 1 (7) |
|
|
write very_important_count (7) |
This is what might happen:
|
Instance 1 |
Instance 2 |
|---|---|
|
read very_important_count (5) |
|
|
read very_important_count (5) |
|
|
add 1 (6) |
|
|
add 1 (6) |
|
|
write very_important_count (6) |
|
|
write very_important_count (6) |
Race Conditions and Critical Regions #
This overlap, where the result depends on the relative timing of multiple tasks, is called a race condition. The piece of code containing the concurrency issue is called a critical region. And especially since Linux starting running on SMP machines, they became one of the major issues in kernel design and implementation.
Preemption can have the same effect, even if there is only one CPU: by preempting one task during the critical region, we have exactly the same race condition. In this case the thread which preempts might run the critical region itself.
The solution is to recognize when these simultaneous accesses occur, and use locks to make sure that only one instance can enter the critical region at any time. There are many friendly primitives in the Linux kernel to help you do this. And then there are the unfriendly primitives, but I'll pretend they don't exist.
Locking in the Linux Kernel #
If I could give you one piece of advice on locking: keep it simple.
Be reluctant to introduce new locks.
Two Main Types of Kernel Locks: Spinlocks and Mutexes #
There are two main types of kernel locks. The fundamental type is the spinlock (include/asm/spinlock.h), which is a very simple single-holder lock: if you can't get the spinlock, you keep trying (spinning) until you can. Spinlocks are very small and fast, and can be used anywhere.
The second type is a mutex (include/linux/mutex.h): it is like a spinlock, but you may block holding a mutex. If you can't lock a mutex, your task will suspend itself, and be woken up when the mutex is released. This means the CPU can do something else while you are waiting. There are many cases when you simply can't sleep (see What Functions Are Safe To Call From Interrupts?), and so have to use a spinlock instead.
Neither type of lock is recursive: see Deadlock: Simple and Advanced.
Locks and Uniprocessor Kernels #
For kernels compiled without CONFIG_SMP, and without CONFIG_PREEMPT spinlocks do not exist at all. This is an excellent design decision: when no-one else can run at the same time, there is no reason to have a lock.
If the kernel is compiled without CONFIG_SMP, but CONFIG_PREEMPT is set, then spinlocks simply disable preemption, which is sufficient to prevent any races. For most purposes, we can think of preemption as equivalent to SMP, and not worry about it separately.
You should always test your locking code with CONFIG_SMP and CONFIG_PREEMPT enabled, even if you don't have an SMP test box, because it will still catch some kinds of locking bugs.
Mutexes still exist, because they are required for synchronization between user contexts, as we will see below.
Locking Only In User Context #
If you have a data structure which is only ever accessed from user context, then you can use a simple mutex (include/linux/mutex.h) to protect it. This is the most trivial case: you initialize the mutex. Then you can call mutex_lock_interruptible() to grab the mutex, and mutex_unlock() to release it. There is also a mutex_lock(), which should be avoided, because it will not return if a signal is received.
Example: net/netfilter/nf_sockopt.c allows registration of new setsockopt() and getsockopt() calls, with nf_register_sockopt(). Registration and de-registration are only done on module load and unload (and boot time, where there is no concurrency), and the list of registrations is only consulted for an unknown setsockopt() or getsockopt() system call. The nf_sockopt_mutex is perfect to protect this, especially since the setsockopt and getsockopt calls may well sleep.
Locking Between User Context and Softirqs #
If a softirq shares data with user context, you have two problems. Firstly, the current user context can be interrupted by a softirq, and secondly, the critical region could be entered from another CPU. This is where spin_lock_bh() (include/linux/spinlock.h) is used. It disables softirqs on that CPU, then grabs the lock. spin_unlock_bh() does the reverse. (The '_bh' suffix is a historical reference to "Bottom Halves", the old name for software interrupts. It should really be called spin_lock_softirq()' in a perfect world).
Note that you can also use spin_lock_irq() or spin_lock_irqsave() here, which stop hardware interrupts as well: see Hard IRQ Context.
This works perfectly for UP as well: the spin lock vanishes, and this macro simply becomes local_bh_disable() (include/linux/interrupt.h), which protects you from the softirq being run.
Locking Between User Context and Tasklets #
This is exactly the same as above, because tasklets are actually run from a softirq.
Locking Between User Context and Timers #
This, too, is exactly the same as above, because timers are actually run from a softirq. From a locking point of view, tasklets and timers are identical.
Locking Between Tasklets/Timers #
Sometimes a tasklet or timer might want to share data with another tasklet or timer.
The Same Tasklet/Timer #
Since a tasklet is never run on two CPUs at once, you don't need to worry about your tasklet being reentrant (running twice at once), even on SMP.
Different Tasklets/Timers #
If another tasklet/timer wants to share data with your tasklet or timer , you will both need to use spin_lock() and spin_unlock() calls. spin_lock_bh() is unnecessary here, as you are already in a tasklet, and none will be run on the same CPU.
Locking Between Softirqs #
Often a softirq might want to share data with itself or a tasklet/timer.
The Same Softirq #
The same softirq can run on the other CPUs: you can use a per-CPU array (see Per-CPU Data) for better performance. If you're going so far as to use a softirq, you probably care about scalable performance enough to justify the extra complexity.
You'll need to use spin_lock() and spin_unlock() for shared data.
Different Softirqs #
You'll need to use spin_lock() and spin_unlock() for shared data, whether it be a timer, tasklet, different softirq or the same or another softirq: any of them could be running on a different CPU.
Hard IRQ Context #
Hardware interrupts usually communicate with a tasklet or softirq. Frequently this involves putting work in a queue, which the softirq will take out.
Locking Between Hard IRQ and Softirqs/Tasklets #
If a hardware irq handler shares data with a softirq, you have two concerns. Firstly, the softirq processing can be interrupted by a hardware interrupt, and secondly, the critical region could be entered by a hardware interrupt on another CPU. This is where spin_lock_irq() is used. It is defined to disable interrupts on that cpu, then grab the lock. spin_unlock_irq() does the reverse.
The irq handler does not need to use spin_lock_irq(), because the softirq cannot run while the irq handler is running: it can use spin_lock(), which is slightly faster. The only exception would be if a different hardware irq handler uses the same lock: spin_lock_irq() will stop that from interrupting us.
This works perfectly for UP as well: the spin lock vanishes, and this macro simply becomes local_irq_disable() (include/asm/smp.h), which protects you from the softirq/tasklet/BH being run.
spin_lock_irqsave() (include/linux/spinlock.h) is a variant which saves whether interrupts were on or off in a flags word, which is passed to spin_unlock_irqrestore(). This means that the same code can be used inside an hard irq handler (where interrupts are already off) and in softirqs (where the irq disabling is required).
Note that softirqs (and hence tasklets and timers) are run on return from hardware interrupts, so spin_lock_irq() also stops these. In that sense, spin_lock_irqsave() is the most general and powerful locking function.
Locking Between Two Hard IRQ Handlers #
It is rare to have to share data between two IRQ handlers, but if you do, spin_lock_irqsave() should be used: it is architecture-specific whether all interrupts are disabled inside irq handlers themselves.
Cheat Sheet For Locking #
Pete Zaitcev gives the following summary:
-
If you are in a process context (any syscall) and want to lock other process out, use a mutex. You can take a mutex and sleep (
copy_from_user()orkmalloc(x,GFP_KERNEL)). -
Otherwise (== data can be touched in an interrupt), use spin_lock_irqsave() and spin_unlock_irqrestore().
-
Avoid holding spinlock for more than 5 lines of code and across any function call (except accessors like readb()).
Table of Minimum Requirements #
The following table lists the minimum locking requirements between various contexts. In some cases, the same context can only be running on one CPU at a time, so no locking is required for that context (eg. a particular thread can only run on one CPU at a time, but if it needs shares data with another thread, locking is required).
Remember the advice above: you can always use spin_lock_irqsave(), which is a superset of all other spinlock primitives.
|
. |
IRQ Handler A |
IRQ Handler B |
Softirq A |
Softirq B |
Tasklet A |
Tasklet B |
Timer A |
Timer B |
User Context A |
User Context B |
|---|---|---|---|---|---|---|---|---|---|---|
|
IRQ Handler A |
None |
|||||||||
|
IRQ Handler B |
SLIS |
None |
||||||||
|
Softirq A |
SLI |
SLI |
SL |
|||||||
|
Softirq B |
SLI |
SLI |
SL |
SL |
||||||
|
Tasklet A |
SLI |
SLI |
SL |
SL |
None |
|||||
|
Tasklet B |
SLI |
SLI |
SL |
SL |
SL |
None |
||||
|
Timer A |
SLI |
SLI |
SL |
SL |
SL |
SL |
None |
|||
|
Timer B |
SLI |
SLI |
SL |
SL |
SL |
SL |
SL |
None |
||
|
User Context A |
SLI |
SLI |
SLBH |
SLBH |
SLBH |
SLBH |
SLBH |
SLBH |
None |
|
|
User Context B |
SLI |
SLI |
SLBH |
SLBH |
SLBH |
SLBH |
SLBH |
SLBH |
MLI |
None |
Table: Table of Locking Requirements
|
SLIS |
spin_lock_irqsave |
|
SLI |
spin_lock_irq |
|
SL |
spin_lock |
|
SLBH |
spin_lock_bh |
|
MLI |
mutex_lock_interruptible |
Table: Legend for Locking Requirements Table
The trylock Functions #
There are functions that try to acquire a lock only once and immediately return a value telling about success or failure to acquire the lock. They can be used if you need no access to the data protected with the lock when some other thread is holding the lock. You should acquire the lock later if you then need access to the data protected with the lock.
spin_trylock() does not spin but returns non-zero if it acquires the spinlock on the first try or 0 if not. This function can be used in all contexts like spin_lock(): you must have disabled the contexts that might interrupt you and acquire the spin lock.
mutex_trylock() does not suspend your task but returns non-zero if it could lock the mutex on the first try or 0 if not. This function cannot be safely used in hardware or software interrupt contexts despite not sleeping.
Common Examples #
Let's step through a simple example: a cache of number to name mappings. The cache keeps a count of how often each of the objects is used, and when it gets full, throws out the least used one.
All In User Context #
For our first example, we assume that all operations are in user context (ie. from system calls), so we can sleep. This means we can use a mutex to protect the cache and all the objects within it. Here's the code:
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/mutex.h>
#include <asm/errno.h>
struct object
{
struct list_head list;
int id;
char name[32];
int popularity;
};
/* Protects the cache, cache_num, and the objects within it */
static DEFINE_MUTEX(cache_lock);
static LIST_HEAD(cache);
static unsigned int cache_num = 0;
#define MAX_CACHE_SIZE 10
/* Must be holding cache_lock */
static struct object *__cache_find(int id)
{
struct object *i;
list_for_each_entry(i, &cache, list)
if (i->id == id) {
i->popularity++;
return i;
}
return NULL;
}
/* Must be holding cache_lock */
static void __cache_delete(struct object *obj)
{
BUG_ON(!obj);
list_del(&obj->list);
kfree(obj);
cache_num--;
}
/* Must be holding cache_lock */
static void __cache_add(struct object *obj)
{
list_add(&obj->list, &cache);
if (++cache_num > MAX_CACHE_SIZE) {
struct object *i, *outcast = NULL;
list_for_each_entry(i, &cache, list) {
if (!outcast || i->popularity < outcast->popularity)
outcast = i;
}
__cache_delete(outcast);
}
}
int cache_add(int id, const char *name)
{
struct object *obj;
if ((obj = kmalloc(sizeof(*obj), GFP_KERNEL)) == NULL)
return -ENOMEM;
strscpy(obj->name, name, sizeof(obj->name));
obj->id = id;
obj->popularity = 0;
mutex_lock(&cache_lock);
__cache_add(obj);
mutex_unlock(&cache_lock);
return 0;
}
void cache_delete(int id)
{
mutex_lock(&cache_lock);
__cache_delete(__cache_find(id));
mutex_unlock(&cache_lock);
}
int cache_find(int id, char *name)
{
struct object *obj;
int ret = -ENOENT;
mutex_lock(&cache_lock);
obj = __cache_find(id);
if (obj) {
ret = 0;
strcpy(name, obj->name);
}
mutex_unlock(&cache_lock);
return ret;
}
Note that we always make sure we have the cache_lock when we add, delete, or look up the cache: both the cache infrastructure itself and the contents of the objects are protected by the lock. In this case it's easy, since we copy the data for the user, and never let them access the objects directly.
There is a slight (and common) optimization here: in cache_add() we set up the fields of the object before grabbing the lock. This is safe, as no-one else can access it until we put it in cache.
Accessing From Interrupt Context #
Now consider the case where cache_find() can be called from interrupt context: either a hardware interrupt or a softirq. An example would be a timer which deletes object from the cache.
The change is shown below, in standard patch format: the - are lines which are taken away, and the + are lines which are added.
--- cache.c.usercontext 2003-12-09 13:58:54.000000000 +1100
+++ cache.c.interrupt 2003-12-09 14:07:49.000000000 +1100
@@ -12,7 +12,7 @@
int popularity;
};
-static DEFINE_MUTEX(cache_lock);
+static DEFINE_SPINLOCK(cache_lock);
static LIST_HEAD(cache);
static unsigned int cache_num = 0;
#define MAX_CACHE_SIZE 10
@@ -55,6 +55,7 @@
int cache_add(int id, const char *name)
{
struct object *obj;
+ unsigned long flags;
if ((obj = kmalloc(sizeof(*obj), GFP_KERNEL)) == NULL)
return -ENOMEM;
@@ -63,30 +64,33 @@
obj->id = id;
obj->popularity = 0;
- mutex_lock(&cache_lock);
+ spin_lock_irqsave(&cache_lock, flags);
__cache_add(obj);
- mutex_unlock(&cache_lock);
+ spin_unlock_irqrestore(&cache_lock, flags);
return 0;
}
void cache_delete(int id)
{
- mutex_lock(&cache_lock);
+ unsigned long flags;
+
+ spin_lock_irqsave(&cache_lock, flags);
__cache_delete(__cache_find(id));
- mutex_unlock(&cache_lock);
+ spin_unlock_irqrestore(&cache_lock, flags);
}
int cache_find(int id, char *name)
{
struct object *obj;
int ret = -ENOENT;
+ unsigned long flags;
- mutex_lock(&cache_lock);
+ spin_lock_irqsave(&cache_lock, flags);
obj = __cache_find(id);
if (obj) {
ret = 0;
strcpy(name, obj->name);
}
- mutex_unlock(&cache_lock);
+ spin_unlock_irqrestore(&cache_lock, flags);
return ret;
}
Note that the spin_lock_irqsave() will turn off interrupts if they are on, otherwise does nothing (if we are already in an interrupt handler), hence these functions are safe to call from any context.
Unfortunately, cache_add() calls kmalloc() with the GFP_KERNEL flag, which is only legal in user context. I have assumed that cache_add() is still only called in user context, otherwise this should become a parameter to cache_add().
Exposing Objects Outside This File #
If our objects contained more information, it might not be sufficient to copy the information in and out: other parts of the code might want to keep pointers to these objects, for example, rather than looking up the id every time. This produces two problems.
The first problem is that we use the cache_lock to protect objects: we'd need to make this non-static so the rest of the code can use it. This makes locking trickier, as it is no longer all in one place.
The second problem is the lifetime problem: if another structure keeps a pointer to an object, it presumably expects that pointer to remain valid. Unfortunately, this is only guaranteed while you hold the lock, otherwise someone might call cache_delete() and even worse, add another object, re-using the same address.
As there is only one lock, you can't hold it forever: no-one else would get any work done.
The solution to this problem is to use a reference count: everyone who has a pointer to the object increases it when they first get the object, and drops the reference count when they're finished with it. Whoever drops it to zero knows it is unused, and can actually delete it.
Here is the code:
--- cache.c.interrupt 2003-12-09 14:25:43.000000000 +1100
+++ cache.c.refcnt 2003-12-09 14:33:05.000000000 +1100
@@ -7,6 +7,7 @@
struct object
{
struct list_head list;
+ unsigned int refcnt;
int id;
char name[32];
int popularity;
@@ -17,6 +18,35 @@
static unsigned int cache_num = 0;
#define MAX_CACHE_SIZE 10
+static void __object_put(struct object *obj)
+{
+ if (--obj->refcnt == 0)
+ kfree(obj);
+}
+
+static void __object_get(struct object *obj)
+{
+ obj->refcnt++;
+}
+
+void object_put(struct object *obj)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&cache_lock, flags);
+ __object_put(obj);
+ spin_unlock_irqrestore(&cache_lock, flags);
+}
+
+void object_get(struct object *obj)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&cache_lock, flags);
+ __object_get(obj);
+ spin_unlock_irqrestore(&cache_lock, flags);
+}
+
/* Must be holding cache_lock */
static struct object *__cache_find(int id)
{
@@ -35,6 +65,7 @@
{
BUG_ON(!obj);
list_del(&obj->list);
+ __object_put(obj);
cache_num--;
}
@@ -63,6 +94,7 @@
strscpy(obj->name, name, sizeof(obj->name));
obj->id = id;
obj->popularity = 0;
+ obj->refcnt = 1; /* The cache holds a reference */
spin_lock_irqsave(&cache_lock, flags);
__cache_add(obj);
@@ -79,18 +111,15 @@
spin_unlock_irqrestore(&cache_lock, flags);
}
-int cache_find(int id, char *name)
+struct object *cache_find(int id)
{
struct object *obj;
- int ret = -ENOENT;
unsigned long flags;
spin_lock_irqsave(&cache_lock, flags);
obj = __cache_find(id);
- if (obj) {
- ret = 0;
- strcpy(name, obj->name);
- }
+ if (obj)
+ __object_get(obj);
spin_unlock_irqrestore(&cache_lock, flags);
- return ret;
+ return obj;
}
We encapsulate the reference counting in the standard 'get' and 'put' functions. Now we can return the object itself from cache_find() which has the advantage that the user can now sleep holding the object (eg. to copy_to_user() to name to userspace).
The other point to note is that I said a reference should be held for every pointer to the object: thus the reference count is 1 when first inserted into the cache. In some versions the framework does not hold a reference count, but they are more complicated.
Using Atomic Operations For The Reference Count #
In practice, atomic_t would usually be used for refcnt. There are a number of atomic operations defined in include/asm/atomic.h: these are guaranteed to be seen atomically from all CPUs in the system, so no lock is required. In this case, it is simpler than using spinlocks, although for anything non-trivial using spinlocks is clearer. The atomic_inc() and atomic_dec_and_test() are used instead of the standard increment and decrement operators, and the lock is no longer used to protect the reference count itself.
--- cache.c.refcnt 2003-12-09 15:00:35.000000000 +1100
+++ cache.c.refcnt-atomic 2003-12-11 15:49:42.000000000 +1100
@@ -7,7 +7,7 @@
struct object
{
struct list_head list;
- unsigned int refcnt;
+ atomic_t refcnt;
int id;
char name[32];
int popularity;
@@ -18,33 +18,15 @@
static unsigned int cache_num = 0;
#define MAX_CACHE_SIZE 10
-static void __object_put(struct object *obj)
-{
- if (--obj->refcnt == 0)
- kfree(obj);
-}
-
-static void __object_get(struct object *obj)
-{
- obj->refcnt++;
-}
-
void object_put(struct object *obj)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cache_lock, flags);
- __object_put(obj);
- spin_unlock_irqrestore(&cache_lock, flags);
+ if (atomic_dec_and_test(&obj->refcnt))
+ kfree(obj);
}
void object_get(struct object *obj)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cache_lock, flags);
- __object_get(obj);
- spin_unlock_irqrestore(&cache_lock, flags);
+ atomic_inc(&obj->refcnt);
}
/* Must be holding cache_lock */
@@ -65,7 +47,7 @@
{
BUG_ON(!obj);
list_del(&obj->list);
- __object_put(obj);
+ object_put(obj);
cache_num--;
}
@@ -94,7 +76,7 @@
strscpy(obj->name, name, sizeof(obj->name));
obj->id = id;
obj->popularity = 0;
- obj->refcnt = 1; /* The cache holds a reference */
+ atomic_set(&obj->refcnt, 1); /* The cache holds a reference */
spin_lock_irqsave(&cache_lock, flags);
__cache_add(obj);
@@ -119,7 +101,7 @@
spin_lock_irqsave(&cache_lock, flags);
obj = __cache_find(id);
if (obj)
- __object_get(obj);
+ object_get(obj);
spin_unlock_irqrestore(&cache_lock, flags);
return obj;
}
Protecting The Objects Themselves #
In these examples, we assumed that the objects (except the reference counts) never changed once they are created. If we wanted to allow the name to change, there are three possibilities:
-
You can make
cache_locknon-static, and tell people to grab that lock before changing the name in any object. -
You can provide a cache_obj_rename() which grabs this lock and changes the name for the caller, and tell everyone to use that function.
-
You can make the
cache_lockprotect only the cache itself, and use another lock to protect the name.
Theoretically, you can make the locks as fine-grained as one lock for every field, for every object. In practice, the most common variants are:
-
One lock which protects the infrastructure (the
cachelist in this example) and all the objects. This is what we have done so far. -
One lock which protects the infrastructure (including the list pointers inside the objects), and one lock inside the object which protects the rest of that object.
-
Multiple locks to protect the infrastructure (eg. one lock per hash chain), possibly with a separate per-object lock.
Here is the "lock-per-object" implementation:
--- cache.c.refcnt-atomic 2003-12-11 15:50:54.000000000 +1100
+++ cache.c.perobjectlock 2003-12-11 17:15:03.000000000 +1100
@@ -6,11 +6,17 @@
struct object
{
+ /* These two protected by cache_lock. */
struct list_head list;
+ int popularity;
+
atomic_t refcnt;
+
+ /* Doesn't change once created. */
int id;
+
+ spinlock_t lock; /* Protects the name */
char name[32];
- int popularity;
};
static DEFINE_SPINLOCK(cache_lock);
@@ -77,6 +84,7 @@
obj->id = id;
obj->popularity = 0;
atomic_set(&obj->refcnt, 1); /* The cache holds a reference */
+ spin_lock_init(&obj->lock);
spin_lock_irqsave(&cache_lock, flags);
__cache_add(obj);
Note that I decide that the popularity count should be protected by the cache_lock rather than the per-object lock: this is because it (like the struct list_head <list_head> inside the object) is logically part of the infrastructure. This way, I don't need to grab the lock of every object in __cache_add() when seeking the least popular.
I also decided that the id member is unchangeable, so I don't need to grab each object lock in __cache_find() to examine the id: the object lock is only used by a caller who wants to read or write the name field.
Note also that I added a comment describing what data was protected by which locks. This is extremely important, as it describes the runtime behavior of the code, and can be hard to gain from just reading. And as Alan Cox says, “Lock data, not code”.
Common Problems #
Deadlock: Simple and Advanced #
There is a coding bug where a piece of code tries to grab a spinlock twice: it will spin forever, waiting for the lock to be released (spinlocks, rwlocks and mutexes are not recursive in Linux). This is trivial to diagnose: not a stay-up-five-nights-talk-to-fluffy-code-bunnies kind of problem.
For a slightly more complex case, imagine you have a region shared by a softirq and user context. If you use a spin_lock() call to protect it, it is possible that the user context will be interrupted by the softirq while it holds the lock, and the softirq will then spin forever trying to get the same lock.
Both of these are called deadlock, and as shown above, it can occur even with a single CPU (although not on UP compiles, since spinlocks vanish on kernel compiles with CONFIG_SMP=n. You'll still get data corruption in the second example).
This complete lockup is easy to diagnose: on SMP boxes the watchdog timer or compiling with DEBUG_SPINLOCK set (include/linux/spinlock.h) will show this up immediately when it happens.
A more complex problem is the so-called 'deadly embrace', involving two or more locks. Say you have a hash table: each entry in the table is a spinlock, and a chain of hashed objects. Inside a softirq handler, you sometimes want to alter an object from one place in the hash to another: you grab the spinlock of the old hash chain and the spinlock of the new hash chain, and delete the object from the old one, and insert it in the new one.
There are two problems here. First, if your code ever tries to move the object to the same chain, it will deadlock with itself as it tries to lock it twice. Secondly, if the same softirq on another CPU is trying to move another object in the reverse direction, the following could happen:
|
CPU 1 |
CPU 2 |
|---|---|
|
Grab lock A -> OK |
Grab lock B -> OK |
|
Grab lock B -> spin |
Grab lock A -> spin |
Table: Consequences
The two CPUs will spin forever, waiting for the other to give up their lock. It will look, smell, and feel like a crash.
Preventing Deadlock #
Textbooks will tell you that if you always lock in the same order, you will never get this kind of deadlock. Practice will tell you that this approach doesn't scale: when I create a new lock, I don't understand enough of the kernel to figure out where in the 5000 lock hierarchy it will fit.
The best locks are encapsulated: they never get exposed in headers, and are never held around calls to non-trivial functions outside the same file. You can read through this code and see that it will never deadlock, because it never tries to grab another lock while it has that one. People using your code don't even need to know you are using a lock.
A classic problem here is when you provide callbacks or hooks: if you call these with the lock held, you risk simple deadlock, or a deadly embrace (who knows what the callback will do?).
Overzealous Prevention Of Deadlocks #
Deadlocks are problematic, but not as bad as data corruption. Code which grabs a read lock, searches a list, fails to find what it wants, drops the read lock, grabs a write lock and inserts the object has a race condition.
Racing Timers: A Kernel Pastime #
Timers can produce their own special problems with races. Consider a collection of objects (list, hash, etc) where each object has a timer which is due to destroy it.
If you want to destroy the entire collection (say on module removal), you might do the following:
/* THIS CODE BAD BAD BAD BAD: IF IT WAS ANY WORSE IT WOULD USE
HUNGARIAN NOTATION */
spin_lock_bh(&list_lock);
while (list) {
struct foo *next = list->next;
timer_delete(&list->timer);
kfree(list);
list = next;
}
spin_unlock_bh(&list_lock);
Sooner or later, this will crash on SMP, because a timer can have just gone off before the spin_lock_bh(), and it will only get the lock after we spin_unlock_bh(), and then try to free the element (which has already been freed!).
This can be avoided by checking the result of timer_delete(): if it returns 1, the timer has been deleted. If 0, it means (in this case) that it is currently running, so we can do:
retry:
spin_lock_bh(&list_lock);
while (list) {
struct foo *next = list->next;
if (!timer_delete(&list->timer)) {
/* Give timer a chance to delete this */
spin_unlock_bh(&list_lock);
goto retry;
}
kfree(list);
list = next;
}
spin_unlock_bh(&list_lock);
Another common problem is deleting timers which restart themselves (by calling add_timer() at the end of their timer function). Because this is a fairly common case which is prone to races, you should use timer_delete_sync() (include/linux/timer.h) to handle this case.
Before freeing a timer, timer_shutdown() or timer_shutdown_sync() should be called which will keep it from being rearmed. Any subsequent attempt to rearm the timer will be silently ignored by the core code.
Locking Speed #
There are three main things to worry about when considering speed of some code which does locking. First is concurrency: how many things are going to be waiting while someone else is holding a lock. Second is the time taken to actually acquire and release an uncontended lock. Third is using fewer, or smarter locks. I'm assuming that the lock is used fairly often: otherwise, you wouldn't be concerned about efficiency.
Concurrency depends on how long the lock is usually held: you should hold the lock for as long as needed, but no longer. In the cache example, we always create the object without the lock held, and then grab the lock only when we are ready to insert it in the list.
Acquisition times depend on how much damage the lock operations do to the pipeline (pipeline stalls) and how likely it is that this CPU was the last one to grab the lock (ie. is the lock cache-hot for this CPU): on a machine with more CPUs, this likelihood drops fast. Consider a 700MHz Intel Pentium III: an instruction takes about 0.7ns, an atomic increment takes about 58ns, a lock which is cache-hot on this CPU takes 160ns, and a cacheline transfer from another CPU takes an additional 170 to 360ns. (These figures from Paul McKenney's Linux Journal RCU article).
These two aims conflict: holding a lock for a short time might be done by splitting locks into parts (such as in our final per-object-lock example), but this increases the number of lock acquisitions, and the results are often slower than having a single lock. This is another reason to advocate locking simplicity.
The third concern is addressed below: there are some methods to reduce the amount of locking which needs to be done.
Read/Write Lock Variants #
Both spinlocks and mutexes have read/write variants: rwlock_t and struct rw_semaphore <rw_semaphore>. These divide users into two classes: the readers and the writers. If you are only reading the data, you can get a read lock, but to write to the data you need the write lock. Many people can hold a read lock, but a writer must be sole holder.
If your code divides neatly along reader/writer lines (as our cache code does), and the lock is held by readers for significant lengths of time, using these locks can help. They are slightly slower than the normal locks though, so in practice rwlock_t is not usually worthwhile.
Avoiding Locks: Read Copy Update #
There is a special method of read/write locking called Read Copy Update. Using RCU, the readers can avoid taking a lock altogether: as we expect our cache to be read more often than updated (otherwise the cache is a waste of time), it is a candidate for this optimization.
How do we get rid of read locks? Getting rid of read locks means that writers may be changing the list underneath the readers. That is actually quite simple: we can read a linked list while an element is being added if the writer adds the element very carefully. For example, adding new to a single linked list called list:
new->next = list->next;
wmb();
list->next = new;
The wmb() is a write memory barrier. It ensures that the first operation (setting the new element's next pointer) is complete and will be seen by all CPUs, before the second operation is (putting the new element into the list). This is important, since modern compilers and modern CPUs can both reorder instructions unless told otherwise: we want a reader to either not see the new element at all, or see the new element with the next pointer correctly pointing at the rest of the list.
Fortunately, there is a function to do this for standard struct list_head <list_head> lists: list_add_rcu() (include/linux/list.h).
Removing an element from the list is even simpler: we replace the pointer to the old element with a pointer to its successor, and readers will either see it, or skip over it.
list->next = old->next;
There is list_del_rcu() (include/linux/list.h) which does this (the normal version poisons the old object, which we don't want).
The reader must also be careful: some CPUs can look through the next pointer to start reading the contents of the next element early, but don't realize that the pre-fetched contents is wrong when the next pointer changes underneath them. Once again, there is a list_for_each_entry_rcu() (include/linux/list.h) to help you. Of course, writers can just use list_for_each_entry(), since there cannot be two simultaneous writers.
Our final dilemma is this: when can we actually destroy the removed element? Remember, a reader might be stepping through this element in the list right now: if we free this element and the next pointer changes, the reader will jump off into garbage and crash. We need to wait until we know that all the readers who were traversing the list when we deleted the element are finished. We use call_rcu() to register a callback which will actually destroy the object once all pre-existing readers are finished. Alternatively, synchronize_rcu() may be used to block until all pre-existing are finished.
But how does Read Copy Update know when the readers are finished? The method is this: firstly, the readers always traverse the list inside rcu_read_lock()/rcu_read_unlock() pairs: these simply disable preemption so the reader won't go to sleep while reading the list.
RCU then waits until every other CPU has slept at least once: since readers cannot sleep, we know that any readers which were traversing the list during the deletion are finished, and the callback is triggered. The real Read Copy Update code is a little more optimized than this, but this is the fundamental idea.
--- cache.c.perobjectlock 2003-12-11 17:15:03.000000000 +1100
+++ cache.c.rcupdate 2003-12-11 17:55:14.000000000 +1100
@@ -1,15 +1,18 @@
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include <linux/rcupdate.h>
#include <linux/mutex.h>
#include <asm/errno.h>
struct object
{
- /* These two protected by cache_lock. */
+ /* This is protected by RCU */
struct list_head list;
int popularity;
+ struct rcu_head rcu;
+
atomic_t refcnt;
/* Doesn't change once created. */
@@ -40,7 +43,7 @@
{
struct object *i;
- list_for_each_entry(i, &cache, list) {
+ list_for_each_entry_rcu(i, &cache, list) {
if (i->id == id) {
i->popularity++;
return i;
@@ -49,19 +52,25 @@
return NULL;
}
+/* Final discard done once we know no readers are looking. */
+static void cache_delete_rcu(void *arg)
+{
+ object_put(arg);
+}
+
/* Must be holding cache_lock */
static void __cache_delete(struct object *obj)
{
BUG_ON(!obj);
- list_del(&obj->list);
- object_put(obj);
+ list_del_rcu(&obj->list);
cache_num--;
+ call_rcu(&obj->rcu, cache_delete_rcu);
}
/* Must be holding cache_lock */
static void __cache_add(struct object *obj)
{
- list_add(&obj->list, &cache);
+ list_add_rcu(&obj->list, &cache);
if (++cache_num > MAX_CACHE_SIZE) {
struct object *i, *outcast = NULL;
list_for_each_entry(i, &cache, list) {
@@ -104,12 +114,11 @@
struct object *cache_find(int id)
{
struct object *obj;
- unsigned long flags;
- spin_lock_irqsave(&cache_lock, flags);
+ rcu_read_lock();
obj = __cache_find(id);
if (obj)
object_get(obj);
- spin_unlock_irqrestore(&cache_lock, flags);
+ rcu_read_unlock();
return obj;
}
Note that the reader will alter the popularity member in __cache_find(), and now it doesn't hold a lock. One solution would be to make it an atomic_t, but for this usage, we don't really care about races: an approximate result is good enough, so I didn't change it.
The result is that cache_find() requires no synchronization with any other functions, so is almost as fast on SMP as it would be on UP.
There is a further optimization possible here: remember our original cache code, where there were no reference counts and the caller simply held the lock whenever using the object? This is still possible: if you hold the lock, no one can delete the object, so you don't need to get and put the reference count.
Now, because the 'read lock' in RCU is simply disabling preemption, a caller which always has preemption disabled between calling cache_find() and object_put() does not need to actually get and put the reference count: we could expose __cache_find() by making it non-static, and such callers could simply call that.
The benefit here is that the reference count is not written to: the object is not altered in any way, which is much faster on SMP machines due to caching.
Per-CPU Data #
Another technique for avoiding locking which is used fairly widely is to duplicate information for each CPU. For example, if you wanted to keep a count of a common condition, you could use a spin lock and a single counter. Nice and simple.
If that was too slow (it's usually not, but if you've got a really big machine to test on and can show that it is), you could instead use a counter for each CPU, then none of them need an exclusive lock. See DEFINE_PER_CPU(), get_cpu_var() and put_cpu_var() (include/linux/percpu.h).
Of particular use for simple per-cpu counters is the local_t type, and the cpu_local_inc() and related functions, which are more efficient than simple code on some architectures (include/asm/local.h).
Note that there is no simple, reliable way of getting an exact value of such a counter, without introducing more locks. This is not a problem for some uses.
Data Which Mostly Used By An IRQ Handler #
If data is always accessed from within the same IRQ handler, you don't need a lock at all: the kernel already guarantees that the irq handler will not run simultaneously on multiple CPUs.
Manfred Spraul points out that you can still do this, even if the data is very occasionally accessed in user context or softirqs/tasklets. The irq handler doesn't use a lock, and all other accesses are done as so:
mutex_lock(&lock);
disable_irq(irq);
...
enable_irq(irq);
mutex_unlock(&lock);
The disable_irq() prevents the irq handler from running (and waits for it to finish if it's currently running on other CPUs). The spinlock prevents any other accesses happening at the same time. Naturally, this is slower than just a spin_lock_irq() call, so it only makes sense if this type of access happens extremely rarely.
What Functions Are Safe To Call From Interrupts? #
Many functions in the kernel sleep (ie. call schedule()) directly or indirectly: you can never call them while holding a spinlock, or with preemption disabled. This also means you need to be in user context: calling them from an interrupt is illegal.
Some Functions Which Sleep #
The most common ones are listed below, but you usually have to read the code to find out if other calls are safe. If everyone else who calls it can sleep, you probably need to be able to sleep, too. In particular, registration and deregistration functions usually expect to be called from user context, and can sleep.
-
Accesses to userspace:
-
copy_from_user()
-
copy_to_user()
-
get_user()
-
put_user()
-
-
kmalloc(GP_KERNEL) <kmalloc>`
-
mutex_lock_interruptible() and mutex_lock()
There is a mutex_trylock() which does not sleep. Still, it must not be used inside interrupt context since its implementation is not safe for that. mutex_unlock() will also never sleep. It cannot be used in interrupt context either since a mutex must be released by the same task that acquired it.
Some Functions Which Don't Sleep #
Some functions are safe to call from any context, or holding almost any lock.
-
printk()
-
kfree()
-
add_timer() and timer_delete()
Mutex API reference #
mutex_init() #
initialize the mutex
Parameters
mutex: the mutex to be initialized
Description
Initialize the mutex to unlocked state.
It is not allowed to initialize an already locked mutex.
mutex_init_with_key() #
initialize a mutex with a given lockdep key
Parameters
mutex: the mutex to be initializedkey: the lockdep key to be associated with the mutex
Description
Initialize the mutex to the unlocked state.
It is not allowed to initialize an already locked mutex.
mutex_is_locked() #
bool is the mutex locked
Parameters
struct mutex *lock: the mutex to be queried
Description
Returns true if the mutex is locked, false if unlocked.
mutex_lock() #
void acquire the mutex
Parameters
struct mutex *lock: the mutex to be acquired
Description
Lock the mutex exclusively for this task. If the mutex is not available right now, it will sleep until it can get it.
The mutex must later on be released by the same task that
acquired it. Recursive locking is not allowed. The task
may not exit without first unlocking the mutex. Also, kernel
memory where the mutex resides must not be freed with
the mutex still locked. The mutex must first be initialized
(or statically defined) before it can be locked. memset()-ing
the mutex to 0 is not allowed.
(The CONFIG_DEBUG_MUTEXES .config option turns on debugging checks that will enforce the restrictions and will also do deadlock debugging)
This function is similar to (but not equivalent to) down().
mutex_unlock() #
void release the mutex
Parameters
struct mutex *lock: the mutex to be released
Description
Unlock a mutex that has been locked by this task previously.
This function must not be used in interrupt context. Unlocking of a not locked mutex is not allowed.
The caller must ensure that the mutex stays alive until this function has
returned - mutex_unlock() can NOT directly be used to release an object such
that another concurrent task can free it.
Mutexes are different from spinlocks & refcounts in this aspect.
This function is similar to (but not equivalent to) up().
ww_mutex_unlock() #
void release the w/w mutex
Parameters
struct ww_mutex *lock: the mutex to be released
Description
Unlock a mutex that has been locked by this task previously with any of the ww_mutex_lock* functions (with or without an acquire context). It is forbidden to release the locks after releasing the acquire context.
This function must not be used in interrupt context. Unlocking of a unlocked mutex is not allowed.
ww_mutex_trylock() #
int tries to acquire the w/w mutex with optional acquire context
Parameters
struct ww_mutex *ww: mutex to lockstruct ww_acquire_ctx *ww_ctx: optional w/w acquire context
Description
Trylocks a mutex with the optional acquire context; no deadlock detection is possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
Unlike ww_mutex_lock, no deadlock handling is performed. However, if a ctx is specified, -EALREADY handling may happen in calls to ww_mutex_trylock.
A mutex acquired with this function must be released with ww_mutex_unlock.
mutex_lock_interruptible() #
int Acquire the mutex, interruptible by signals.
Parameters
struct mutex *lock: The mutex to be acquired.
Description
Lock the mutex like mutex_lock(). If a signal is delivered while the
process is sleeping, this function will return without acquiring the
mutex.
Context
Process context.
Return
0 if the lock was successfully acquired or -EINTR if a
signal arrived.
mutex_lock_killable() #
int Acquire the mutex, interruptible by fatal signals.
Parameters
struct mutex *lock: The mutex to be acquired.
Description
Lock the mutex like mutex_lock(). If a signal which will be fatal to
the current process is delivered while the process is sleeping, this
function will return without acquiring the mutex.
Context
Process context.
Return
0 if the lock was successfully acquired or -EINTR if a
fatal signal arrived.
mutex_lock_io() #
void Acquire the mutex and mark the process as waiting for I/O
Parameters
struct mutex *lock: The mutex to be acquired.
Description
Lock the mutex like mutex_lock(). While the task is waiting for this
mutex, it will be accounted as being in the IO wait state by the
scheduler.
Context
Process context.
mutex_trylock() #
int try to acquire the mutex, without waiting
Parameters
struct mutex *lock: the mutex to be acquired
Description
Try to acquire the mutex atomically. Returns 1 if the mutex has been acquired successfully, and 0 on contention.
NOTE
this function follows the spin_trylock() convention, so
it is negated from the down_trylock() return values! Be careful
about this when converting semaphore users to mutexes.
This function must not be used in interrupt context. The mutex must be released by the same task that acquired it.
atomic_dec_and_mutex_lock() #
int return holding mutex if we dec to 0
Parameters
atomic_t *cnt: the atomic which we are to decstruct mutex *lock: the mutex to return holding if we dec to 0
Description
return true and hold lock if we dec to 0, return false otherwise
Futex API reference #
futex_hash_get() #
void Get an additional reference for the local hash.
Parameters
struct futex_hash_bucket *hb: ptr to the private local hash.
Description
Obtain an additional reference for the already obtained hash bucket. The caller must already own an reference.
__futex_hash() #
struct futex_hash_bucket * Return the hash bucket
Parameters
union futex_key *key: Pointer to the futex key for which the hash is calculatedstruct futex_private_hash *fph: Pointer to private hash if known
Description
We hash on the keys returned from get_futex_key (see below) and return the corresponding hash bucket. If the FUTEX is PROCESS_PRIVATE then a per-process hash bucket (from the private hash) is returned if existing. Otherwise a hash bucket from the global hash is returned.
futex_setup_timer() #
struct hrtimer_sleeper * set up the sleeping hrtimer.
Parameters
ktime_t *time: ptr to the given timeout valuestruct hrtimer_sleeper *timeout: the hrtimer_sleeper structure to be set upint flags: futex flagsu64 range_ns: optional range in ns
Return
Initialized hrtimer_sleeper structure or NULL if no timeout value given
get_futex_key() #
int Get parameters which are the keys for a futex
Parameters
u32 __user *uaddr: virtual address of the futexunsigned int flags: FLAGS_*union futex_key *key: address where result is stored.enum futex_access rw: mapping needs to be read/write (values: FUTEX_READ, FUTEX_WRITE)
Return
a negative error code or 0
Description
The key words are stored in key on success.
For shared mappings (when fshared), the key is:
( inode->i_sequence, page offset within mapping, offset_within_page )
[ also see get_inode_sequence_number() ]
For private mappings (or when !fshared), the key is:
( current->mm, address, 0 )
This allows (cross process, where applicable) identification of the futex without keeping the page pinned for the duration of the FUTEX_WAIT.
lock_page() might sleep, the caller should not hold a spinlock.
fault_in_user_writeable() #
int Fault in user address and verify RW access
Parameters
u32 __user *uaddr: pointer to faulting user space address
Description
Slow path to fixup the fault we just took in the atomic write access to uaddr.
We have no generic implementation of a non-destructive write to the
user address. We know that we faulted in the atomic pagefault
disabled section so we can as well avoid the #PF overhead by
calling get_user_pages() right away.
futex_top_waiter() #
struct futex_q * Return the highest priority waiter on a futex
Parameters
struct futex_hash_bucket *hb: the hash bucket the futex_q's reside inunion futex_key *key: the futex key (to distinguish it from other futex futex_q's)
Description
Must be called with the hb lock held.
wait_for_owner_exiting() #
void Block until the owner has exited
Parameters
int ret: owner's current futex lock statusstruct task_struct *exiting: Pointer to the exiting task
Description
Caller must hold a refcount on exiting.
__futex_unqueue() #
void Remove the futex_q from its futex_hash_bucket
Parameters
struct futex_q *q: The futex_q to unqueue
Description
The q->lock_ptr must not be NULL and must be held by the caller.
futex_unqueue() #
int Remove the futex_q from its futex_hash_bucket
Parameters
struct futex_q *q: The futex_q to unqueue
Description
The q->lock_ptr must not be held by the caller. A call to futex_unqueue() must
be paired with exactly one earlier call to futex_queue().
Return
- 1 - if the futex_q was still queued (and we removed unqueued it);
- 0 - if the futex_q was already removed by the waking thread
futex_exit_recursive() #
void Set the tasks futex state to FUTEX_STATE_DEAD
Parameters
struct task_struct *tsk: task to set the state on
Description
Set the futex exit state of the task lockless. The futex waiter code observes that state when a task is exiting and loops until the task has actually finished the futex cleanup. The worst case for this is that the waiter runs through the wait loop until the state becomes visible.
This is called from the recursive fault handling path in make_task_dead().
This is best effort. Either the futex exit code has run already or not. If the OWNER_DIED bit has been set on the futex then the waiter can take it over. If not, the problem is pushed back to user space. If the futex exit code did not run yet, then an already queued waiter might block forever, but there is nothing which can be done about that.
struct futex_q #
The hashed futex queue entry, one per waiting task
Definition
;
Members
list: priority-sorted list of tasks waiting on this futextask: the task waiting on the futexlock_ptr: the hash bucket lockwake: the wake handler for this queuewake_data: data associated with the wake handlerkey: the key the futex is hashed onpi_state: optional priority inheritance statert_waiter: rt_waiter storage for use with requeue_pirequeue_pi_key: the requeue_pi target futex keybitset: bitset for the optional bitmasked wakeuprequeue_state: State field forfutex_requeue_pi()drop_hb_ref: Waiter should drop the extra hash bucket reference if truerequeue_wait: RCU wait forfutex_requeue_pi()(RT only)
Description
We use this hashed waitqueue, instead of a normal wait_queue_entry_t, so we can wake only the relevant ones (hashed queues may be shared).
A futex_q has a woken state, just like tasks have TASK_RUNNING.
It is considered woken when plist_node_empty(q->list) || q->lock_ptr == 0.
The order of wakeup is always to make the first condition true, then
the second.
PI futexes are typically woken before they are removed from the hash list via
the rt_mutex code. See futex_unqueue_pi().
futex_match() #
int Check whether two futex keys are equal
Parameters
union futex_key *key1: Pointer to key1union futex_key *key2: Pointer to key2
Description
Return 1 if two futex_keys are equal, 0 otherwise.
futex_queue() #
void Enqueue the futex_q on the futex_hash_bucket
Parameters
struct futex_q *q: The futex_q to enqueuestruct futex_hash_bucket *hb: The destination hash bucketstruct task_struct *task: Task queueing this futex
Description
The hb->lock must be held by the caller, and is released here. A call to
futex_queue() is typically paired with exactly one call to futex_unqueue(). The
exceptions involve the PI related operations, which may use futex_unqueue_pi()
or nothing if the unqueue is done as part of the wake process and the unqueue
state is implicit in the state of woken task (see futex_wait_requeue_pi() for
an example).
Note that task may be NULL, for async usage of futexes.
struct futex_vector #
Auxiliary struct for futex_waitv()
Definition
;
Members
w: Userspace provided dataq: Kernel side data
Description
Struct used to build an array with all data need for futex_waitv()
futex_lock_pi_atomic() #
int Atomic work required to acquire a pi aware futex
Parameters
u32 __user *uaddr: the pi futex user addressstruct futex_hash_bucket *hb: the pi futex hash bucketunion futex_key *key: the futex key associated with uaddr and hbstruct futex_pi_state **ps: the pi_state pointer where we store the result of the lookupstruct task_struct *task: the task to perform the atomic lock work for. This will be "current" except in the case of requeue pi.struct task_struct **exiting: Pointer to store the task pointer of the owner task which is in the middle of exitingint set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0)
Return
- 0 - ready to wait;
- 1 - acquired the lock;
- <0 - error
Description
The hb->lock must be held by the caller.
exiting is only set when the return value is -EBUSY. If so, this holds a refcount on the exiting task on return and the caller needs to drop it after waiting for the exit to complete.
fixup_pi_owner() #
int Post lock pi_state and corner case management
Parameters
u32 __user *uaddr: user address of the futexstruct futex_q *q: futex_q (contains pi_state and access to the rt_mutex)int locked: if the attempt to take the rt_mutex succeeded (1) or not (0)
Description
After attempting to lock an rt_mutex, this function is called to cleanup the pi_state owner as well as handle race conditions that may allow us to acquire the lock. Must be called with the hb lock held.
Return
- 1 - success, lock taken;
- 0 - success, lock not taken;
- <0 - on error (-EFAULT)
requeue_futex() #
void Requeue a futex_q from one hb to another
Parameters
struct futex_q *q: the futex_q to requeuestruct futex_hash_bucket *hb1: the source hash_bucketstruct futex_hash_bucket *hb2: the target hash_bucketunion futex_key *key2: the new key for the requeued futex_q
requeue_pi_wake_futex() #
void Wake a task that acquired the lock during requeue
Parameters
struct futex_q *q: the futex_qunion futex_key *key: the key of the requeue target futexstruct futex_hash_bucket *hb: the hash_bucket of the requeue target futex
Description
During futex_requeue, with requeue_pi=1, it is possible to acquire the target futex if it is uncontended or via a lock steal.
-
Set q::key to the requeue target futex key so the waiter can detect the wakeup on the right futex.
-
Dequeue q from the hash bucket.
-
Set q::rt_waiter to NULL so the woken up task can detect atomic lock acquisition.
-
Set the q->lock_ptr to the requeue target hb->lock for the case that the waiter has to fixup the pi state.
-
Complete the requeue state so the waiter can make progress. After this point the waiter task can return from the syscall immediately in case that the pi state does not have to be fixed up.
-
Wake the waiter task.
Must be called with both q->lock_ptr and hb->lock held.
futex_proxy_trylock_atomic() #
int Attempt an atomic lock for the top waiter
Parameters
u32 __user *pifutex: the user address of the to futexstruct futex_hash_bucket *hb1: the from futex hash bucket, must be locked by the callerstruct futex_hash_bucket *hb2: the to futex hash bucket, must be locked by the callerunion futex_key *key1: the from futex keyunion futex_key *key2: the to futex keystruct futex_pi_state **ps: address to store the pi_state pointerstruct task_struct **exiting: Pointer to store the task pointer of the owner task which is in the middle of exitingint set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0)
Description
Try and get the lock on behalf of the top waiter if we can do it atomically.
Wake the top waiter if we succeed. If the caller specified set_waiters,
then direct futex_lock_pi_atomic() to force setting the FUTEX_WAITERS bit.
hb1 and hb2 must be held by the caller.
exiting is only set when the return value is -EBUSY. If so, this holds a refcount on the exiting task on return and the caller needs to drop it after waiting for the exit to complete.
Return
- 0 - failed to acquire the lock atomically;
-
0 - acquired the lock, return value is vpid of the top_waiter
- <0 - error
futex_requeue() #
int Requeue waiters from uaddr1 to uaddr2
Parameters
-
u32 __user *uaddr1: source futex user address -
unsigned int flags1: futex flags (FLAGS_SHARED, etc.) -
u32 __user *uaddr2: target futex user address -
unsigned int flags2: futex flags (FLAGS_SHARED, etc.) -
int nr_wake: number of waiters to wake (must be 1 for requeue_pi) -
int nr_requeue: number of waiters to requeue (0-INT_MAX) -
u32 *cmpval:uaddr1 expected value (or
NULL) -
int requeue_pi: if we are attempting to requeue from a non-pi futex to a pi futex (pi to pi requeue is not supported)
Description
Requeue waiters on uaddr1 to uaddr2. In the requeue_pi case, try to acquire uaddr2 atomically on behalf of the top waiter.
Return
-
=0 - on success, the number of tasks requeued or woken;
- <0 - on error
handle_early_requeue_pi_wakeup() #
int Handle early wakeup on the initial futex
Parameters
struct futex_hash_bucket *hb: the hash_bucket futex_q was original enqueued onstruct futex_q *q: the futex_q woken while waiting to be requeuedstruct hrtimer_sleeper *timeout: the timeout associated with the wait (NULL if none)
Description
Determine the cause for the early wakeup.
Return
-EWOULDBLOCK or -ETIMEDOUT or -ERESTARTNOINTR
futex_wait_requeue_pi() #
int Wait on uaddr and take uaddr2
Parameters
u32 __user *uaddr: the futex we initially wait on (non-pi)unsigned int flags: futex flags (FLAGS_SHARED, FLAGS_CLOCKRT, etc.), they must be the same type, no requeueing from private to shared, etc.u32 val: the expected value of uaddrktime_t *abs_time: absolute timeoutu32 bitset: 32 bit wakeup bitset set by userspace, defaults to allu32 __user *uaddr2: the pi futex we will take prior to returning to user-space
Description
The caller will wait on uaddr and will be requeued by futex_requeue() to
uaddr2 which must be PI aware and unique from uaddr. Normal wakeup will wake
on uaddr2 and complete the acquisition of the rt_mutex prior to returning to
userspace. This ensures the rt_mutex maintains an owner when it has waiters;
without one, the pi logic would not know which task to boost/deboost, if
there was a need to.
We call schedule in futex_wait_queue() when we enqueue and return there
via the following--
- wakeup on uaddr2 after an atomic lock acquisition by
futex_requeue() - wakeup on uaddr2 after a requeue
- signal
- timeout
If 3, cleanup and return -ERESTARTNOINTR.
If 2, we may then block on trying to take the rt_mutex and return via: 5) successful lock 6) signal 7) timeout 8) other lock acquisition failure
If 6, return -EWOULDBLOCK (restarting the syscall would do the same).
If 4 or 7, we cleanup and return with -ETIMEDOUT.
Return
- 0 - On success;
- <0 - On error
futex_do_wait() #
void wait for wakeup, timeout, or signal
Parameters
struct futex_q *q: the futex_q to queue up onstruct hrtimer_sleeper *timeout: the prepared hrtimer_sleeper, or null for no timeout
futex_unqueue_multiple() #
int Remove various futexes from their hash bucket
Parameters
struct futex_vector *v: The list of futexes to unqueueint count: Number of futexes in the list
Description
Helper to unqueue a list of futexes. This can't fail.
Return
-
=0 - Index of the last futex that was awoken;
- -1 - No futex was awoken
futex_wait_multiple_setup() #
int Prepare to wait and enqueue multiple futexes
Parameters
struct futex_vector *vs: The futex list to wait onint count: The size of the listint *woken: Index of the last woken futex, if any. Used to notify the caller that it can return this index to userspace (return parameter)
Description
Prepare multiple futexes in a single step and enqueue them. This may fail if the futex list is invalid or if any futex was already awoken. On success the task is ready to interruptible sleep.
Return
- 1 - One of the futexes was woken by another thread
- 0 - Success
- <0 - -EFAULT, -EWOULDBLOCK or -EINVAL
futex_sleep_multiple() #
void Check sleeping conditions and sleep
Parameters
struct futex_vector *vs: List of futexes to wait forunsigned int count: Length of vsstruct hrtimer_sleeper *to: Timeout
Description
Sleep if and only if the timeout hasn't expired and no futex on the list has been woken up.
futex_wait_multiple() #
int Prepare to wait on and enqueue several futexes
Parameters
struct futex_vector *vs: The list of futexes to wait onunsigned int count: The number of objectsstruct hrtimer_sleeper *to: Timeout before giving up and returning to userspace
Description
Entry point for the FUTEX_WAIT_MULTIPLE futex operation, this function sleeps on a group of futexes and returns on the first futex that is wake, or after the timeout has elapsed.
Return
-
=0 - Hint to the futex that was awoken
- <0 - On error
futex_wait_setup() #
int Prepare to wait on a futex
Parameters
u32 __user *uaddr: the futex userspace addressu32 val: the expected valueunsigned int flags: futex flags (FLAGS_SHARED, etc.)struct futex_q *q: the associated futex_qunion futex_key *key2: the second futex_key if used for requeue PIstruct task_struct *task: Task queueing this futex
Description
Setup the futex_q and locate the hash_bucket. Get the futex value and compare it with the expected value. Handle atomic faults internally. Return with the hb lock held on success, and unlocked on failure.
Return
- 0 - uaddr contains val and hb has been locked;
- <0 - On error and the hb is unlocked. A possible reason: the uaddr can not be read, does not contain the expected value or is not properly aligned.
Further reading #
-
Documentation/locking/spinlocks.rst: Linus Torvalds' spinlocking tutorial in the kernel sources. -
Unix Systems for Modern Architectures: Symmetric Multiprocessing and Caching for Kernel Programmers:
Curt Schimmel's very good introduction to kernel level locking (not written for Linux, but nearly everything applies). The book is expensive, but really worth every penny to understand SMP locking. [ISBN: 0201633388]
Thanks #
Thanks to Telsa Gwynne for DocBooking, neatening and adding style.
Thanks to Martin Pool, Philipp Rumpf, Stephen Rothwell, Paul Mackerras, Ruedi Aschwanden, Alan Cox, Manfred Spraul, Tim Waugh, Pete Zaitcev, James Morris, Robert Love, Paul McKenney, John Ashby for proofreading, correcting, flaming, commenting.
Thanks to the cabal for having no influence on this document.
Glossary #
-
preemption
Prior to 2.5, or when
CONFIG_PREEMPTis unset, processes in user context inside the kernel would not preempt each other (ie. you had that CPU until you gave it up, except for interrupts). With the addition ofCONFIG_PREEMPTin 2.5.4, this changed: when in user context, higher priority tasks can "cut in": spinlocks were changed to disable preemption, even on UP. -
bh
Bottom Half: for historical reasons, functions with '_bh' in them often now refer to any software interrupt, e.g. spin_lock_bh() blocks any software interrupt on the current CPU. Bottom halves are deprecated, and will eventually be replaced by tasklets. Only one bottom half will be running at any time.
-
Hardware Interrupt / Hardware IRQ
Hardware interrupt request. in_hardirq() returns true in a hardware interrupt handler.
-
Interrupt Context
Not user context: processing a hardware irq or software irq. Indicated by the in_interrupt() macro returning true.
-
SMP
Symmetric Multi-Processor: kernels compiled for multiple-CPU machines. (
CONFIG_SMP=y). -
Software Interrupt / softirq
Software interrupt handler. in_hardirq() returns false; in_softirq() returns true. Tasklets and softirqs both fall into the category of 'software interrupts'.
Strictly speaking a softirq is one of up to 32 enumerated software interrupts which can run on multiple CPUs at once. Sometimes used to refer to tasklets as well (ie. all software interrupts).
-
tasklet
A dynamically-registrable software interrupt, which is guaranteed to only run on one CPU at a time.
-
timer
A dynamically-registrable software interrupt, which is run at (or close to) a given time. When running, it is just like a tasklet (in fact, they are called from the
TIMER_SOFTIRQ). -
UP
Uni-Processor: Non-SMP. (
CONFIG_SMP=n). -
User Context
The kernel executing on behalf of a particular process (ie. a system call or trap) or kernel thread. You can tell which process with the
currentmacro.) Not to be confused with userspace. Can be interrupted by software or hardware interrupts. -
Userspace
A process executing its own code outside the kernel.
Rust
Peios Kernel / Kernel development / Rust
Documentation related to Rust within the kernel. To start using Rust in the kernel, please read the quick-start.rst guide.
Code documentation #
Given a kernel configuration, the kernel may generate Rust code documentation, i.e. HTML rendered by the rustdoc tool.
This kernel documentation was not built with Rust code documentation.
A pregenerated version is provided at:
Please see the Code documentation section for more details.
You can also find learning materials for Rust in its section in Index of Further Kernel Documentation.
Arch Support
Peios Kernel / Kernel development / Rust
Currently, the Rust compiler (rustc) uses LLVM for code generation, which limits the supported architectures that can be targeted. In addition, support for building the kernel with LLVM/Clang varies (please see Documentation/kbuild/llvm.rst). This support is needed for bindgen which uses libclang.
Below is a general summary of architectures that currently work. Level of support corresponds to S values in the MAINTAINERS file.
|
Architecture |
Level of support |
Constraints |
|---|---|---|
|
|
Maintained |
ARMv7 Little Endian only. |
|
|
Maintained |
Little Endian only. |
|
|
Maintained |
- |
|
|
Maintained |
|
|
|
Maintained |
- |
|
|
Maintained |
|
Coding Guidelines
Peios Kernel / Kernel development / Rust
This document describes how to write Rust code in the kernel.
Style & formatting #
The code should be formatted using rustfmt. In this way, a person contributing from time to time to the kernel does not need to learn and remember one more style guide. More importantly, reviewers and maintainers do not need to spend time pointing out style issues anymore, and thus less patch roundtrips may be needed to land a change.
The default settings of rustfmt are used. This means the idiomatic Rust style is followed. For instance, 4 spaces are used for indentation rather than tabs.
It is convenient to instruct editors/IDEs to format while typing, when saving or at commit time. However, if for some reason reformatting the entire kernel Rust sources is needed at some point, the following can be run:
make LLVM=1 rustfmt
It is also possible to check if everything is formatted (printing a diff otherwise), for instance for a CI, with:
make LLVM=1 rustfmtcheck
Like clang-format for the rest of the kernel, rustfmt works on individual files, and does not require a kernel configuration. Sometimes it may even work with broken code.
Imports #
rustfmt, by default, formats imports in a way that is prone to conflicts while merging and rebasing, since in some cases it condenses several items into the same line. For instance:
// Do not use this style.
use crate::;
Instead, the kernel uses a vertical layout that looks like this:
use crate::;
That is, each item goes into its own line, and braces are used as soon as there is more than one item in a list.
The trailing empty comment allows to preserve this formatting. Not only that, rustfmt will actually reformat imports vertically when the empty comment is added. That is, it is possible to easily reformat the original example into the expected style by running rustfmt on an input like:
// Do not use this style.
use crate::;
The trailing empty comment works for nested imports, as shown above, as well as for single item imports -- this can be useful to minimize diffs within patch series:
use crate::;
The trailing empty comment works in any of the lines within the braces, but it is preferred to keep it in the last item, since it is reminiscent of the trailing comma in other formatters. Sometimes it may be simpler to avoid moving the comment several times within a patch series due to changes in the list.
There may be cases where exceptions may need to be made, i.e. none of this is a hard rule. There is also code that is not migrated to this style yet, but please do not introduce code in other styles.
Eventually, the goal is to get rustfmt to support this formatting style (or a similar one) automatically in a stable release without requiring the trailing empty comment. Thus, at some point, the goal is to remove those comments.
Comments #
"Normal" comments (i.e. //, rather than code documentation which starts with /// or //!) are written in Markdown the same way as documentation comments are, even though they will not be rendered. This improves consistency, simplifies the rules and allows to move content between the two kinds of comments more easily. For instance:
// `object` is ready to be handled now.
f;
Furthermore, just like documentation, comments are capitalized at the beginning of a sentence and ended with a period (even if it is a single sentence). This includes // SAFETY:, // TODO: and other "tagged" comments, e.g.:
// FIXME: The error should be handled properly.
Comments should not be used for documentation purposes: comments are intended for implementation details, not users. This distinction is useful even if the reader of the source file is both an implementor and a user of an API. In fact, sometimes it is useful to use both comments and documentation at the same time. For instance, for a TODO list or to comment on the documentation itself. For the latter case, comments can be inserted in the middle; that is, closer to the line of documentation to be commented. For any other case, comments are written after the documentation, e.g.:
/// Returns a new [`Foo`].
///
/// # Examples
///
// TODO: Find a better example.
/// ```
/// let foo = f(42);
/// ```
// FIXME: Use fallible approach.
This applies to both public and private items. This increases consistency with public items, allows changes to visibility with less changes involved and will allow us to potentially generate the documentation for private items as well. In other words, if documentation is written for a private item, then /// should still be used. For instance:
/// My private function.
// TODO: ...
One special kind of comments are the // SAFETY: comments. These must appear before every unsafe block, and they explain why the code inside the block is correct/sound, i.e. why it cannot trigger undefined behavior in any case, e.g.:
// SAFETY: `p` is valid by the safety requirements.
unsafe
// SAFETY: comments are not to be confused with the # Safety sections in code documentation. # Safety sections specify the contract that callers (for functions) or implementors (for traits) need to abide by. // SAFETY: comments show why a call (for functions) or implementation (for traits) actually respects the preconditions stated in a # Safety section or the language reference.
Code documentation #
Rust kernel code is not documented like C kernel code (i.e. via kernel-doc). Instead, the usual system for documenting Rust code is used: the rustdoc tool, which uses Markdown (a lightweight markup language).
To learn Markdown, there are many guides available out there. For instance, the one at:
This is how a well-documented Rust function may look like:
/// Returns the contained [`Some`] value, consuming the `self` value,
/// without checking that the value is not [`None`].
///
/// # Safety
///
/// Calling this method on [`None`] is *[undefined behavior]*.
///
/// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
///
/// # Examples
///
/// ```
/// let x = Some("air");
/// assert_eq!(unsafe { x.unwrap_unchecked() }, "air");
/// ```
pub unsafe
This example showcases a few rustdoc features and some conventions followed in the kernel:
-
The first paragraph must be a single sentence briefly describing what the documented item does. Further explanations must go in extra paragraphs.
-
Unsafe functions must document their safety preconditions under a
# Safetysection. -
While not shown here, if a function may panic, the conditions under which that happens must be described under a
# Panicssection.Please note that panicking should be very rare and used only with a good reason. In almost all cases, a fallible approach should be used, typically returning a
Result. -
If providing examples of usage would help readers, they must be written in a section called
# Examples. -
Rust items (functions, types, constants...) must be linked appropriately (
rustdocwill create a link automatically). -
Any
unsafeblock must be preceded by a// SAFETY:comment describing why the code inside is sound.While sometimes the reason might look trivial and therefore unneeded, writing these comments is not just a good way of documenting what has been taken into account, but most importantly, it provides a way to know that there are no extra implicit constraints.
To learn more about how to write documentation for Rust and extra features, please take a look at the rustdoc book at:
https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html
In addition, the kernel supports creating links relative to the source tree by prefixing the link destination with srctree/. For instance:
//! C header: [`include/linux/printk.h`](srctree/include/linux/printk.h)
or:
/// [`struct mutex`]: srctree/include/linux/mutex.h
C FFI types #
Rust kernel code refers to C types, such as int, using type aliases such as c_int, which are readily available from the kernel prelude. Please do not use the aliases from core::ffi -- they may not map to the correct types.
These aliases should generally be referred directly by their identifier, i.e. as a single segment path. For instance:
Naming #
Rust kernel code follows the usual Rust naming conventions:
When existing C concepts (e.g. macros, functions, objects...) are wrapped into a Rust abstraction, a name as close as reasonably possible to the C side should be used in order to avoid confusion and to improve readability when switching back and forth between the C and Rust sides. For instance, macros such as pr_info from C are named the same in the Rust side.
Having said that, casing should be adjusted to follow the Rust naming conventions, and namespacing introduced by modules and types should not be repeated in the item names. For instance, when wrapping constants like:
The equivalent in Rust may look like (ignoring documentation):
That is, the equivalent of GPIO_LINE_DIRECTION_IN would be referred to as gpio::LineDirection::In. In particular, it should not be named gpio::gpio_line_direction::GPIO_LINE_DIRECTION_IN.
Lints #
In Rust, it is possible to allow particular warnings (diagnostics, lints) locally, making the compiler ignore instances of a given warning within a given function, module, block, etc.
It is similar to #pragma GCC diagnostic push + ignored + pop in C 1:
static void
[1] In this particular case, the kernel's __{always,maybe}_unused attributes (C23's [[maybe_unused]]) may be used; however, the example is meant to reflect the equivalent lint in Rust discussed afterwards.
But way less verbose:
By that virtue, it makes it possible to comfortably enable more diagnostics by default (i.e. outside W= levels). In particular, those that may have some false positives but that are otherwise quite useful to keep enabled to catch potential mistakes.
On top of that, Rust provides the expect attribute which takes this further. It makes the compiler warn if the warning was not produced. For instance, the following will ensure that, when f() is called somewhere, we will have to remove the attribute:
If we do not, we get a warning from the compiler:
warning: this lint expectation is unfulfilled
--> x.rs:3:10
|
3 | #[expect(dead_code)]
| ^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
This means that expects do not get forgotten when they are not needed, which may happen in several situations, e.g.:
-
Temporary attributes added while developing.
-
Improvements in lints in the compiler, Clippy or custom tools which may remove a false positive.
-
When the lint is not needed anymore because it was expected that it would be removed at some point, such as the
dead_codeexample above.
It also increases the visibility of the remaining allows and reduces the chance of misapplying one.
Thus prefer expect over allow unless:
-
Conditional compilation triggers the warning in some cases but not others.
If there are only a few cases where the warning triggers (or does not trigger) compared to the total number of cases, then one may consider using a conditional
expect(i.e.cfg_attr(..., expect(...))). Otherwise, it is likely simpler to just useallow. -
Inside macros, when the different invocations may create expanded code that triggers the warning in some cases but not in others.
-
When code may trigger a warning for some architectures but not others, such as an
ascast to a C FFI type.
As a more developed example, consider for instance this program:
Here, function g() is dead code if CONFIG_X is not set. Can we use expect here?
This would emit a lint if CONFIG_X is set, since it is not dead code in that configuration. Therefore, in cases like this, we cannot use expect as-is.
A simple possibility is using allow:
An alternative would be using a conditional expect:
This would ensure that, if someone introduces another call to g() somewhere (e.g. unconditionally), then it would be spotted that it is not dead code anymore. However, the cfg_attr is more complex than a simple allow.
Therefore, it is likely that it is not worth using conditional expects when more than one or two configurations are involved or when the lint may be triggered due to non-local changes (such as dead_code).
For more information about diagnostics in Rust, please see:
https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html
Error handling #
For some background and guidelines about Rust for Linux specific error handling, please see:
https://rust.docs.kernel.org/kernel/error/type.Result.html#error-codes-in-c-and-rust
General Information
Peios Kernel / Kernel development / Rust
This document contains useful information to know when working with the Rust support in the kernel.
no_std #
The Rust support in the kernel can link only core, but not std. Crates for use in the kernel must opt into this behavior using the #![no_std] attribute.
Code documentation #
Rust kernel code is documented using rustdoc, its built-in documentation generator.
The generated HTML docs include integrated search, linked items (e.g. types, functions, constants), source code, etc. They may be read at:
For linux-next, please see:
There are also tags for each main release, e.g.:
The docs can also be easily generated and read locally. This is quite fast (same order as compiling the code itself) and no special tools or environment are needed. This has the added advantage that they will be tailored to the particular kernel configuration used. To generate them, use the rustdoc target with the same invocation used for compilation, e.g.:
make LLVM=1 rustdoc
To read the docs locally in your web browser, run e.g.:
xdg-open Documentation/output/rust/rustdoc/kernel/index.html
To learn about how to write the documentation, please see coding-guidelines.rst.
Extra lints #
While rustc is a very helpful compiler, some extra lints and analyses are available via clippy, a Rust linter. To enable it, pass CLIPPY=1 to the same invocation used for compilation, e.g.:
make LLVM=1 CLIPPY=1
Please note that Clippy may change code generation, thus it should not be enabled while building a production kernel.
Abstractions vs. bindings #
Abstractions are Rust code wrapping kernel functionality from the C side.
In order to use functions and types from the C side, bindings are created. Bindings are the declarations for Rust of those functions and types from the C side.
For instance, one may write a Mutex abstraction in Rust which wraps a struct mutex from the C side and calls its functions through the bindings.
Abstractions are not available for all the kernel internal APIs and concepts, but it is intended that coverage is expanded as time goes on. "Leaf" modules (e.g. drivers) should not use the C bindings directly. Instead, subsystems should provide as-safe-as-possible abstractions as needed.
rust/bindings/
(rust/helpers/)
include/ -----+ <-+
| |
drivers/ rust/kernel/ +----------+ <-+ |
fs/ | bindgen | |
.../ +-------------------+ +----------+ --+ |
| Abstractions | | |
+---------+ | +------+ +------+ | +----------+ | |
| my_foo | -----> | | foo | | bar | | -------> | Bindings | <-+ |
| driver | Safe | | sub- | | sub- | | Unsafe | | |
+---------+ | |system| |system| | | bindings | <-----+
| | +------+ +------+ | | crate | |
| | kernel crate | +----------+ |
| +-------------------+ |
| |
+------------------# FORBIDDEN #--------------------------------+
The main idea is to encapsulate all direct interaction with the kernel's C APIs into carefully reviewed and documented abstractions. Then users of these abstractions cannot introduce undefined behavior (UB) as long as:
-
The abstractions are correct ("sound").
-
Any
unsafeblocks respect the safety contract necessary to call the operations inside the block. Similarly, anyunsafe impls respect the safety contract necessary to implement the trait.
Bindings #
By including a C header from include/ into rust/bindings/bindings_helper.h, the bindgen tool will auto-generate the bindings for the included subsystem. After building, see the *_generated.rs output files in the rust/bindings/ directory.
For parts of the C header that bindgen does not auto generate, e.g. C inline functions or non-trivial macros, it is acceptable to add a small wrapper function to rust/helpers/ to make it available for the Rust side as well.
Abstractions #
Abstractions are the layer between the bindings and the in-kernel users. They are located in rust/kernel/ and their role is to encapsulate the unsafe access to the bindings into an as-safe-as-possible API that they expose to their users. Users of the abstractions include things like drivers or file systems written in Rust.
Besides the safety aspect, the abstractions are supposed to be "ergonomic", in the sense that they turn the C interfaces into "idiomatic" Rust code. Basic examples are to turn the C resource acquisition and release into Rust constructors and destructors or C integer error codes into Rust's Results.
Conditional compilation #
Rust code has access to conditional compilation based on the kernel configuration:
// Enabled (`y` or `m`)
// Enabled as a built-in (`y`)
// Enabled as a module (`m`)
// Disabled
For other predicates that Rust's cfg does not support, e.g. expressions with numerical comparisons, one may define a new Kconfig symbol:
config RUSTC_VERSION_MIN_107900
def_bool y if RUSTC_VERSION >= 107900
Quick Start
Peios Kernel / Kernel development / Rust
Peios: Use Building Peios for the repository build, toolchain, configuration and test entry points. This article describes the underlying Linux machinery or upstream workflow. Its standalone build/install commands do not establish a qualified Peios kernel or signed release modules.
This document describes how to get started with kernel development in Rust.
There are a few ways to install a Rust toolchain needed for kernel development. A simple way is to use the packages from your Linux distribution if they are suitable -- the first section below explains this approach. An advantage of this approach is that, typically, the distribution will match the LLVM used by Rust and Clang.
Another way is using the prebuilt stable versions of LLVM+Rust provided on kernel.org. These are the same slim and fast LLVM toolchains from Getting LLVM with versions of Rust added to them that Rust for Linux supports. Two sets are provided: the "latest LLVM" and "matching LLVM" (please see the link for more information).
Alternatively, the next two "Requirements" sections explain each component and how to install them through rustup, the standalone installers from Rust and/or building them.
The rest of the document explains other aspects on how to get started.
Distributions #
Arch Linux #
Arch Linux provides recent Rust releases and thus it should generally work out of the box, e.g.:
pacman -S rust rust-src rust-bindgen
Debian #
Debian 13 (Trixie), as well as Testing and Debian Unstable (Sid) provide recent Rust releases and thus they should generally work out of the box, e.g.:
apt install rustc rust-src bindgen rustfmt rust-clippy
Fedora Linux #
Fedora Linux provides recent Rust releases and thus it should generally work out of the box, e.g.:
dnf install rust rust-src bindgen-cli rustfmt clippy
Gentoo Linux #
Gentoo Linux (and especially the testing branch) provides recent Rust releases and thus it should generally work out of the box, e.g.:
USE='rust-src rustfmt clippy' emerge dev-lang/rust dev-util/bindgen
LIBCLANG_PATH may need to be set.
Nix #
Nix (unstable channel) provides recent Rust releases and thus it should generally work out of the box, e.g.:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc rust-bindgen rustfmt clippy ];
RUST_LIB_SRC = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}
openSUSE #
openSUSE Slowroll and openSUSE Tumbleweed provide recent Rust releases and thus they should generally work out of the box, e.g.:
zypper install rust rust1.79-src rust-bindgen clang
Ubuntu #
25.04 #
The latest Ubuntu releases provide recent Rust releases and thus they should generally work out of the box, e.g.:
apt install rustc rust-src bindgen rustfmt rust-clippy
In addition, RUST_LIB_SRC needs to be set, e.g.:
RUST_LIB_SRC=/usr/src/rustc-$(rustc --version | cut -d' ' -f2)/library
For convenience, RUST_LIB_SRC can be exported to the global environment.
24.04 LTS and older #
Though Ubuntu 24.04 LTS and older versions still provide recent Rust releases, they require some additional configuration to be set, using the versioned packages, e.g.:
apt install rustc-1.80 rust-1.80-src bindgen-0.65 rustfmt-1.80 \
rust-1.80-clippy
ln -s /usr/lib/rust-1.80/bin/rustfmt /usr/bin/rustfmt-1.80
ln -s /usr/lib/rust-1.80/bin/clippy-driver /usr/bin/clippy-driver-1.80
None of these packages set their tools as defaults; therefore they should be specified explicitly, e.g.:
make LLVM=1 RUSTC=rustc-1.80 RUSTDOC=rustdoc-1.80 RUSTFMT=rustfmt-1.80 \
CLIPPY_DRIVER=clippy-driver-1.80 BINDGEN=bindgen-0.65
Alternatively, modify the PATH variable to place the Rust 1.80 binaries first and set bindgen as the default, e.g.:
PATH=/usr/lib/rust-1.80/bin:$PATH
update-alternatives --install /usr/bin/bindgen bindgen \
/usr/bin/bindgen-0.65 100
update-alternatives --set bindgen /usr/bin/bindgen-0.65
RUST_LIB_SRC needs to be set when using the versioned packages, e.g.:
RUST_LIB_SRC=/usr/src/rustc-$(rustc-1.80 --version | cut -d' ' -f2)/library
For convenience, RUST_LIB_SRC can be exported to the global environment.
In addition, bindgen-0.65 is available in newer releases (24.04 LTS and 24.10), but it may not be available in older ones (20.04 LTS and 22.04 LTS), thus bindgen may need to be built manually (please see below).
Requirements: Building #
This section explains how to fetch the tools needed for building.
To easily check whether the requirements are met, the following target can be used:
make LLVM=1 rustavailable
This triggers the same logic used by Kconfig to determine whether RUST_IS_AVAILABLE should be enabled; but it also explains why not if that is the case.
rustc #
A recent version of the Rust compiler is required.
If rustup is being used, enter the kernel build directory (or use --path=<build-dir> argument to the set sub-command) and run, for instance:
rustup override set stable
This will configure your working directory to use the given version of rustc without affecting your default toolchain.
Note that the override applies to the current working directory (and its sub-directories).
If you are not using rustup, fetch a standalone installer from:
https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
Rust standard library source #
The Rust standard library source is required because the build system will cross-compile core.
If rustup is being used, run:
rustup component add rust-src
The components are installed per toolchain, thus upgrading the Rust compiler version later on requires re-adding the component.
Otherwise, if a standalone installer is used, the Rust source tree may be downloaded into the toolchain's installation folder:
curl -L "https://static.rust-lang.org/dist/rust-src-$(rustc --version | cut -d' ' -f2).tar.gz" |
tar -xzf - -C "$(rustc --print sysroot)/lib" \
"rust-src-$(rustc --version | cut -d' ' -f2)/rust-src/lib/" \
--strip-components=3
In this case, upgrading the Rust compiler version later on requires manually updating the source tree (this can be done by removing $(rustc --print sysroot)/lib/rustlib/src/rust then rerunning the above command).
libclang #
libclang (part of LLVM) is used by bindgen to understand the C code in the kernel, which means LLVM needs to be installed; like when the kernel is compiled with LLVM=1.
Linux distributions are likely to have a suitable one available, so it is best to check that first.
There are also some binaries for several systems and architectures uploaded at:
Otherwise, building LLVM takes quite a while, but it is not a complex process:
https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm
Please see Documentation/kbuild/llvm.rst for more information and further ways to fetch pre-built releases and distribution packages.
bindgen #
The bindings to the C side of the kernel are generated at build time using the bindgen tool.
Install it, for instance, via (note that this will download and build the tool from source):
cargo install --locked bindgen-cli
bindgen uses the clang-sys crate to find a suitable libclang (which may be linked statically, dynamically or loaded at runtime). By default, the cargo command above will produce a bindgen binary that will load libclang at runtime. If it is not found (or a different libclang than the one found should be used), the process can be tweaked, e.g. by using the LIBCLANG_PATH environment variable. For details, please see clang-sys's documentation at:
https://github.com/KyleMayes/clang-sys#linking
https://github.com/KyleMayes/clang-sys#environment-variables
Requirements: Developing #
This section explains how to fetch the tools needed for developing. That is, they are not needed when just building the kernel.
rustfmt #
The rustfmt tool is used to automatically format all the Rust kernel code, including the generated C bindings (for details, please see coding-guidelines.rst).
If rustup is being used, its default profile already installs the tool, thus nothing needs to be done. If another profile is being used, the component can be installed manually:
rustup component add rustfmt
The standalone installers also come with rustfmt.
clippy #
clippy is a Rust linter. Running it provides extra warnings for Rust code. It can be run by passing CLIPPY=1 to make (for details, please see general-information.rst).
If rustup is being used, its default profile already installs the tool, thus nothing needs to be done. If another profile is being used, the component can be installed manually:
rustup component add clippy
The standalone installers also come with clippy.
rustdoc #
rustdoc is the documentation tool for Rust. It generates pretty HTML documentation for Rust code (for details, please see general-information.rst).
rustdoc is also used to test the examples provided in documented Rust code (called doctests or documentation tests). The rusttest Make target uses this feature.
If rustup is being used, all the profiles already install the tool, thus nothing needs to be done.
The standalone installers also come with rustdoc.
rust-analyzer #
The rust-analyzer language server can be used with many editors to enable syntax highlighting, completion, go to definition, and other features.
rust-analyzer needs a configuration file, rust-project.json, which can be generated by the rust-analyzer Make target:
make LLVM=1 rust-analyzer
Configuration #
Rust support (CONFIG_RUST) needs to be enabled in the General setup menu. The option is only shown if a suitable Rust toolchain is found (see above), as long as the other requirements are met. In turn, this will make visible the rest of options that depend on Rust.
Afterwards, go to:
Kernel hacking
-> Sample kernel code
-> Rust samples
And enable some sample modules either as built-in or as loadable.
Building #
Building a kernel with a complete LLVM toolchain is the best supported setup at the moment. That is:
make LLVM=1
Using GCC also works for some configurations, but it is very experimental at the moment.
Hacking #
To dive deeper, take a look at the source code of the samples at samples/rust/, the Rust support code under rust/ and the Rust hacking menu under Kernel hacking.
If GDB/Binutils is used and Rust symbols are not getting demangled, the reason is the toolchain does not support Rust's new v0 mangling scheme yet. There are a few ways out:
-
Install a newer release (GDB >= 10.2, Binutils >= 2.36).
-
Some versions of GDB (e.g. vanilla GDB 10.1) are able to use the pre-demangled names embedded in the debug info (
CONFIG_DEBUG_INFO).
Testing
Peios Kernel / Kernel development / Rust
This document contains useful information how to test the Rust code in the kernel.
There are three sorts of tests:
-
The KUnit tests.
-
The
#[test]tests. -
The Kselftests.
The KUnit tests #
These are the tests that come from the examples in the Rust documentation. They get transformed into KUnit tests.
Usage #
These tests can be run via KUnit. For example via kunit_tool (kunit.py) on the command line:
./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch x86_64 --kconfig_add CONFIG_RUST=y
Alternatively, KUnit can run them as kernel built-in at boot. Refer to Documentation/dev-tools/kunit/index.rst for the general KUnit documentation and Documentation/dev-tools/kunit/architecture.rst for the details of kernel built-in vs. command line testing.
To use these KUnit doctests, the following must be enabled:
CONFIG_KUNIT
Kernel hacking -> Kernel Testing and Coverage -> KUnit - Enable support for unit tests
CONFIG_RUST_KERNEL_DOCTESTS
Kernel hacking -> Rust hacking -> Doctests for the `kernel` crate
in the kernel config system.
KUnit tests are documentation tests #
These documentation tests are typically examples of usage of any item (e.g. function, struct, module...).
They are very convenient because they are just written alongside the documentation. For instance:
/// Sums two numbers.
///
/// ```
/// assert_eq!(mymod::f(10, 20), 30);
/// ```
In userspace, the tests are collected and run via rustdoc. Using the tool as-is would be useful already, since it allows verifying that examples compile (thus enforcing they are kept in sync with the code they document) and as well as running those that do not depend on in-kernel APIs.
For the kernel, however, these tests get transformed into KUnit test suites. This means that doctests get compiled as Rust kernel objects, allowing them to run against a built kernel.
A benefit of this KUnit integration is that Rust doctests get to reuse existing testing facilities. For instance, the kernel log would look like:
KTAP version 1
1..1
KTAP version 1
# Subtest: rust_doctests_kernel
1..59
# rust_doctest_kernel_build_assert_rs_0.location: rust/kernel/build_assert.rs:13
ok 1 rust_doctest_kernel_build_assert_rs_0
# rust_doctest_kernel_build_assert_rs_1.location: rust/kernel/build_assert.rs:56
ok 2 rust_doctest_kernel_build_assert_rs_1
# rust_doctest_kernel_init_rs_0.location: rust/kernel/init.rs:122
ok 3 rust_doctest_kernel_init_rs_0
...
# rust_doctest_kernel_types_rs_2.location: rust/kernel/types.rs:150
ok 59 rust_doctest_kernel_types_rs_2
# rust_doctests_kernel: pass:59 fail:0 skip:0 total:59
# Totals: pass:59 fail:0 skip:0 total:59
ok 1 rust_doctests_kernel
Tests using the ? operator are also supported as usual, e.g.:
/// ```
/// # use kernel::{spawn_work_item, workqueue};
/// spawn_work_item!(workqueue::system(), || pr_info!("x\n"))?;
/// # Ok::<(), Error>(())
/// ```
The tests are also compiled with Clippy under CLIPPY=1, just like normal code, thus also benefitting from extra linting.
In order for developers to easily see which line of doctest code caused a failure, a KTAP diagnostic line is printed to the log. This contains the location (file and line) of the original test (i.e. instead of the location in the generated Rust file):
# rust_doctest_kernel_types_rs_2.location: rust/kernel/types.rs:150
Rust tests appear to assert using the usual assert! and assert_eq! macros from the Rust standard library (core). We provide a custom version that forwards the call to KUnit instead. Importantly, these macros do not require passing context, unlike those for KUnit testing (i.e. struct kunit *). This makes them easier to use, and readers of the documentation do not need to care about which testing framework is used. In addition, it may allow us to test third-party code more easily in the future.
A current limitation is that KUnit does not support assertions in other tasks. Thus, we presently simply print an error to the kernel log if an assertion actually failed. Additionally, doctests are not run for nonpublic functions.
Since these tests are examples, i.e. they are part of the documentation, they should generally be written like "real code". Thus, for example, instead of using unwrap() or expect(), use the ? operator. For more background, please see:
https://rust.docs.kernel.org/kernel/error/type.Result.html#error-codes-in-c-and-rust
The #[test] tests #
Additionally, there are the #[test] tests. Like for documentation tests, these are also fairly similar to what you would expect from userspace, and they are also mapped to KUnit.
These tests are introduced by the kunit_tests procedural macro, which takes the name of the test suite as an argument.
For instance, assume we want to test the function f from the documentation tests section. We could write, in the same file where we have our function:
And if we run it, the kernel log would look like:
KTAP version 1
# Subtest: rust_kernel_mymod
# speed: normal
1..1
# test_f.speed: normal
ok 1 test_f
ok 1 rust_kernel_mymod
Like documentation tests, the assert! and assert_eq! macros are mapped back to KUnit and do not panic. Similarly, the ? operator is supported, i.e. the test functions may return either nothing (i.e. the unit type ()) or Result (i.e. any Result<T, E>). For instance:
If we run the test and the call to g fails, then the kernel log would show:
KTAP version 1
# Subtest: rust_kernel_mymod
# speed: normal
1..1
# test_g: ASSERTION FAILED at rust/kernel/lib.rs:335
Expected is_test_result_ok(test_g()) to be true, but is false
# test_g.speed: normal
not ok 1 test_g
not ok 1 rust_kernel_mymod
If a #[test] test could be useful as an example for the user, then please use a documentation test instead. Even edge cases of an API, e.g. error or boundary cases, can be interesting to show in examples.
The rusttest host tests #
These are userspace tests that can be built and run in the host (i.e. the one that performs the kernel build) using the rusttest Make target:
make LLVM=1 rusttest
This requires the kernel .config.
Currently, they are mostly used for testing the macros crate's examples.
The Kselftests #
Kselftests are also available in the tools/testing/selftests/rust folder.
The kernel config options required for the tests are listed in the tools/testing/selftests/rust/config file and can be included with the aid of the merge_config.sh script:
./scripts/kconfig/merge_config.sh .config tools/testing/selftests/rust/config
The kselftests are built within the kernel source tree and are intended to be executed on a system that is running the same kernel.
Once a kernel matching the source tree has been installed and booted, the tests can be compiled and executed using the following command:
make TARGETS="rust" kselftest
Refer to Documentation/dev-tools/kselftest.rst for the general Kselftest documentation.
Developing native kernel subsystems
Peios Kernel / Kernel development / Subsystem testing
The kernel repository owns the native subsystem code. Make implementation
changes in security/pkm/, fs/stratafs/ and net/ntfe/, with public declarations
in include/uapi/pkm/.
Shared Rust cores #
The Cargo workspace in peios/rust/ compiles the semantic sources used by
Kbuild through small wrapper crates. It does not maintain a second copy of
the implementation. From the kernel root:
For a direct host run:
The host workspace's toolchain is pinned in peios/rust/rust-toolchain.toml;
the kernel build has its own toolchain requirements. Host tests exercise the
userspace allocation/runtime path. Do not use Cargo --all-features as a
substitute for Kbuild, KUnit or VM integration tests.
Kernel integration #
Use Building Peios for the supported build entry points. Select the subsystem's KUnit configuration and inspect the resulting KTAP and kernel log when exercising kernel glue. Runtime qualification and a passing host suite are separate evidence.
StrataFS test hooks documents its gated securityfs fault-injection interface.
Maintaining the reference #
The kernel owns both the native interface reference and its generators. Regenerate the ABI and constants pages from the kernel root:
Edit handwritten explanations directly in docs/; do not put them in generated
pages. See Maintaining native subsystem documentation
for provenance, claim anchors and the retained TRM.
Detailed test workflows #
Maintaining native subsystem documentation
Peios Kernel / Kernel development / Subsystem testing
Native kernel documentation lives with the kernel. Internals explain the implementation; Userspace interfaces describe caller contracts; Administration covers operation; Development covers changing and testing the code. The combined learn site presents these collections alongside the rest of Peios documentation.
Authored and generated sources #
Edit ordinary articles directly. tools/docs/peios-reference/generate.py
regenerates the native ABI tables and StrataFS constants from this source tree.
It uses a C compiler to measure ABI layouts and values; StrataFS's private
constants are extracted from the C and Rust definitions. The generator does
not need a sibling pkm or learn checkout.
Run it with --check to detect drift without editing pages. It refuses changes
to the expected section layout or named claims until the migration mapping is
reviewed, so a new table cannot silently disappear into an old split layout.
Handwritten interface notes are outside the generated output and are never
overwritten by regeneration.
Provenance and claim anchors #
peios/docs-migration/trm-source-map.json records the old book paths and hashes,
section destinations, named claims, and the pages assembled from each source.
It is separate from the upstream Linux source map. The old TRM is retained in
learn/ during review; changes here do not regenerate or remove it.
Trail's named citation syntax is currently book-scoped. In the new topic pages,
the same claim identifiers are preserved as explicit cite-NAME HTML anchors.
The mapping records their new article addresses. Existing test citations still
resolve through the retained original book; these topic anchors do not silently
replace Trail's exported book citation catalogue.
Keep anchors when editing or splitting articles. Update the TRM mapping when an article or claim moves, and update its incoming links. Numbered book references have been converted to explicit links to their target explanation. Cross-system specifications retain links to their own pages on learn.peios.org.
Validation #
Keep the retained TRM unchanged until the replacement has been reviewed and its external consumers have a deliberate migration path. Generated tables establish header values and layouts; they do not prove the correctness of every prose claim or qualify kernel runtime behaviour.
Shared Rust core tests
Peios Kernel / Kernel development / Subsystem testing
The kernel repository owns these crates. Kbuild and Cargo compile the same
semantic files under security/pkm; nothing is copied or rewritten at build
time. Small lib.rs entry points adapt their module layout to the existing
Cargo crate APIs. Change core behaviour in security/pkm, and its tests in peios/rust/.
The workspace contains kacs-core, lcs-core, pnp-core, stratafs-core,
the ntfe userspace library and raw peios-uapi bindings. peios/rust/ORIGIN.json records
the PKM revision used for the migration. No PKM checkout is needed.
# From the kernel root: all tests, then selected Clippy correctness checks.
# Or work on one crate directly.
The host test toolchain is pinned to Rust 1.98.1 in peios/rust/rust-toolchain.toml.
Install it with rustfmt and Clippy first. This does not change the kernel's
Rust 1.83.0 build toolchain. The workspace has only local path dependencies;
Cargo tests are offline after toolchain installation. pekit builds the crates
in its sandbox, with its own pinned Rust 1.98.1, each crate given
security/pkm where its #[path] reaches. Direct Cargo uses the ignored
peios/rust/target/ directory.
The Cargo workspace tests the userspace allocation implementation. The kernel
configuration is supplied by Kbuild, which has the kernel allocation/runtime
dependencies. Do not use Cargo --all-features to simulate a kernel build.
Run the normal kernel build and KUnit commands to exercise that integration.
For header changes, follow ABI regeneration. For kernel execution, use KUnit and guest qualification.
ABI regeneration
Peios Kernel / Kernel development / Subsystem testing
The source ABI headers live in include/uapi/pkm. The generated constants at
security/pkm/kacs/peios_uapi.rs are shared directly by Cargo and Kbuild.
Generated types and their layout tests live at peios/rust/peios-uapi/ztypes.rs.
LIBCLANG_PATH=/path/to/libclang BINDGEN=/path/to/bindgen-0.65.1 \
Run these from the kernel root. Omit --check to regenerate. The generator
requires bindgen 0.65.1 (also supplied by the kernel build image), libclang, a C
compiler with userspace Linux headers, and rustfmt 1.98.1. It targets Rust 1.64
syntax for generated layouts, preserving the existing runtime layout tests.
The initial migration's drift check was verified with libclang 21 on x86_64.
Generator/sysroot provisioning is not part of the hosted style workflow yet;
CI does run the committed Rust layout tests and C header/ABI checks.
Core logic, public names, ABI layout and package manifests must remain stable during style-only work. The migrated Cargo suite retained all 1,864 tests with no ignored or failed tests at integration. Kernel and VM qualification are separate from this host test result.
The ABI generator updates compiled bindings and tests. It is separate from
tools/docs/peios-reference/generate.py, which updates the documentation's
ABI tables. When changing an interface, review the caller contract and both
generated representations; see Maintaining native subsystem documentation.
Running KUnit
Peios Kernel / Kernel development / Subsystem testing
From the kernel repository root:
pekit run kunit builds the KUnit configuration's kernel with the pinned
toolchain, then boots it with the existing PKM runner and the host's QEMU,
qemu-system-x86_64. It's a script you run by hand, not a test, because it
needs QEMU and wants KVM. It uses KVM when /dev/kvm is available, otherwise
TCG. The run requires complete KTAP accounting, passing PKM suites, clean
power-down and no kernel warning/oops/lockdep failure signatures. The serial
log is kunit-qemu.log beside the image, as the direct runner writes it, or
where PKM_KUNIT_LOG says. Native integration and hardware qualification
remain additional checks.
The migrated configs, verifier, key generator and KUnit runner come from PKM
commit ac4c6eb57ff94821f1eaea2b3bde460777d48f5b. No dependency on the old PKM
checkout is needed to run these commands.
Run an existing kernel directly #
The direct runner accepts either a bzImage or a Kbuild output tree containing
arch/x86/boot/bzImage. It uses host QEMU and timeout, as pekit run kunit does.
The direct runner supports these environment variables:
| Variable | Meaning | Default |
|---|---|---|
QEMU_BIN | QEMU executable | qemu-system-x86_64 |
PKM_KUNIT_TIMEOUT | Boot timeout in seconds | 420 |
PKM_KUNIT_LOG | Serial log path | kunit-qemu.log beside the image, or in the supplied tree |
PKM_KUNIT_INITRD | Optional initramfs | None |
PKM_KUNIT_FILTER | KUnit filter glob | Full configured run |
Set overrides in the environment of either command.
What a pass means #
The runner requires successful QEMU exit, the clean power-down marker, a top-level KTAP plan, exactly the planned number of results and the final successful result. It rejects failure, warning, oops and lockdep signatures. An unfiltered run additionally requires the PKM smoke marker and a passing PKM suite summary. A filtered run instead requires actual selected case results.
A selected passing suite is evidence for that selection, not a full suite run. Retain the serial log with the kernel revision and configuration used.
The host-side parser and runner regression tests can be run without booting:
Guest qualification
Peios Kernel / Kernel development / Subsystem testing
The harnesses in peios/qualification/ build small initramfs guests and boot
a supplied kernel. They do not build that kernel or qualify an entire OS release.
Use an x86_64 Linux host with gcc, static libc development files, cpio,
timeout and qemu-system-x86_64; firmware fixture preparation also needs zstd.
QEMU uses KVM when available, with TCG fallback. The harnesses run on the host,
outside pekit's sandbox, with the host's tools.
Run the pekit commands below from the kernel repository. Their underlying scripts locate the guest C sources relative to themselves and can also be called directly from another working directory with absolute input paths.
Compile the guest programs #
This compiles all guest C programs with static linking and warnings as errors. It does not boot a VM or require signing keys. A passing compilation is separate from a passing guest run.
Mount namespaces and StrataFS #
Each accepts a direct image, including the bzImage that pekit build kernel gives, or a Kbuild
output tree containing arch/x86/boot/bzImage. Supply a kernel with the relevant
Peios subsystem and the guest's required filesystem support enabled. A script
finding the image does not establish that the configuration meets its needs.
The mount-namespace harness exercises KACS objects through syscalls and checks both child and parent results. The StrataFS smoke harness exercises a mounted filesystem. The directory benchmark validates its expected result rows and completion marker; retain those rows when comparing performance. These harnesses reject their failure markers, kernel warnings, and fatal diagnostics, and require successful QEMU exit.
The FUSE passthrough harness also needs CONFIG_FUSE_FS=y and
CONFIG_FUSE_PASSTHROUGH=y. It checks lazy opens, shared mappings,
read-only and private controls, copy publication, and mapping lifetime.
It requires a clean guest poweroff. Its direct entry point is
peios/qualification/test-stratafs-fuse.sh, with the same image or
output-tree argument.
Module signatures #
The first directory must contain arch/x86/boot/bzImage. The second must contain
one matching release under lib/modules/, with modules.dep and signed,
zstd-compressed modules trusted by the kernel. The harness selects a
dependency-free module, boots with a copy of it and a corrupted copy, and
requires the valid module to load and the corrupted one to be rejected.
The flat directory pekit build kernel gives is not the required Kbuild layout, and its
modules.tar contains unsigned modules. Prepare the output layout and separately
signed module tree before invoking this harness. Confirm signature enforcement
in the supplied kernel configuration; a load alone is not evidence of enforcement
when testing a differently configured kernel.
Firmware signatures #
The kernel needs its firmware verification policy and CONFIG_TEST_FIRMWARE=m.
The matching module tree must contain a trusted, signed test_firmware.ko.zst.
Prepare fixtures in a new, existing output directory:
Preparation compiles root/init, copies the firmware test module, and creates
good, unsigned, tampered and compressed firmware payloads under root/lib/firmware/.
It does not sign anything. Have the signing coordinator provide detached Peios
signatures trusted by this kernel at:
root/lib/firmware/fwsig-good.bin.peios.sigroot/lib/firmware/fwsig-goodz.bin.zst.peios.sig
Preserve the prepared directory as a whole, including its signed test module. The guest reuses the good signature when testing tampered bytes. No private signing key is passed to the harness. Once the fixtures are signed:
The harness boots once with kacs_fwsig=enforce and once with kacs_fwsig=log.
It requires four guest checks per mode, the appropriate refusal or log verdict,
no listed fatal diagnostics, and successful QEMU exit. The expected policy
warnings are part of the test, so this harness does not reject every warning.
Logs and timeouts #
Set QEMU_BIN to choose another QEMU executable. The retained PKM_* names are
the current script interfaces. Timeout values are in seconds.
| Harness | Default log | Log override | Timeout override (default) |
|---|---|---|---|
| Mount namespaces | mntns-qemu.log | PKM_MNTNS_LOG | PKM_MNTNS_TIMEOUT (120) |
| StrataFS smoke | stratafs-qemu.log | PKM_STRATAFS_LOG | PKM_STRATAFS_TIMEOUT (120) |
| StrataFS FUSE passthrough | stratafs-fuse-qemu.log | PKM_STRATAFS_FUSE_LOG | PKM_STRATAFS_FUSE_TIMEOUT (120) |
| Directory benchmark | stratafs-dir-bench-qemu.log | PKM_STRATAFS_DIR_BENCH_LOG | PKM_STRATAFS_DIR_BENCH_TIMEOUT (1200) |
| Module signatures | modsig-qemu.log | PKM_MODSIG_LOG | PKM_MODSIG_TIMEOUT (120) |
| Firmware signatures | fwsig-enforce-qemu.log, fwsig-log-qemu.log | PKM_FWSIG_LOGDIR | PKM_FWSIG_TIMEOUT (120 per boot) |
Logs default to the supplied tree, or beside the direct image where that input form is supported. Ensure the chosen log directory exists and is writable. Use distinct log paths for concurrent runs. Temporary initramfs trees are removed on exit; retain serial logs, kernel revision/configuration, module provenance and fixture identity as the evidence for a qualification run.
StrataFS test hooks
Peios Kernel / Kernel development / Subsystem testing
Several of this chapter's promises are about windows that no
arrangement of real filesystems can hold open. A copy-up is never
observable in a partial state (Copy-Up) — but a real copy-up publishes
within microseconds. A failed install rolls the lower link back
(Links) — but the install fails only under allocation pressure between
two steps of one syscall. A dentry whose provider identity no longer
matches yields ESTALE (Rename) — but every walk rebuilds the dentry
moments before the operation, so the mismatch needs the provider to
change inside a single syscall.
The test hooks exist so conformance tests can steer exactly those windows and nothing else. They are not conformance surface: no behaviour in this chapter depends on them, and they carry no named citations.
Gating #
The hooks are doubly gated:
CONFIG_STRATAFS_FS_TEST_HOOKScompiles them in. Without it every hook site is an inline constant zero.stratafs.test_hooks=1on the kernel command line registers them. Without it nothing appears in securityfs and each hook site reduces to reading one never-true flag.
Production images build the option but never pass the parameter; only the provium test profiles do. Arming a hook additionally requires reaching a mounted securityfs, which on a managed system means a caller able to establish the mount and satisfy its policy class.
Interface #
Each hook point is one securityfs file under stratafs/hooks/,
alongside KACS's own security/pkm/kacs/ endpoints. securityfs rather than debugfs
is forced by kernel lockdown: the Peios kernel builds
LOCK_DOWN_KERNEL_FORCE_INTEGRITY, and the integrity set refuses every
debugfs open that is not a read of a mode-0444 file — a debugfs hook
would be visible and permanently untouchable. Lockdown does not gate
securityfs. Writing a hook's file arms or disarms it; reading reports
its state:
| Write | Effect |
|---|---|
hold | Tasks reaching the point block until the hook is cleared |
fail N | The next task to reach the point fails with errno N, once |
clear | Disarm; every held task is released |
A read returns <mode> waiting=<W> hits=<H>, where <mode> is none,
hold or fail, W is the number of tasks currently blocked — poll
it to know the victim has arrived — and H is the number of arrivals
the hook has affected. A held task waits killably, so a fatal signal
always removes it. A fail arms exactly one failure and disarms
itself; hold persists until cleared.
Points #
| File | Moment |
|---|---|
copy-up-begin | Before the copy-up context is created — before any staging exists. A failure here is a source descriptor that could not be read (Descriptors on Copy-Up). |
copy-up-publish | After the staged object is complete — content, attributes, metadata — and before publication. A hold here is an in-flight copy-up, staged but unpublished (Copy-Up). |
rename-provider | In rename, after the walk-time provider is captured and before the locked re-lookup that verifies it (Rename). |
link-install | In link, between the lower link succeeding and the outer inode installing. A failure here exercises the rollback of Links. |
supersede-publish | After the staged source and destination are checked, immediately before the backing rename publishes a supersede replacement. Failure leaves the original provider untouched. |
supersede-remove | For a supersede across distinct strata, after publication and release of the create-stratum directory lock and write hold, before reacquiring write access to the original provider and re-looking-up its name. Failure exercises cleanup of the published replacement. |
staging-recover | After a staging marker is validated as an orphan, before acquiring backing-mount write access for its removal. A hold lets a test remount the provider read-only while rename is scanning an overwritten directory; failure leaves the orphan in place. |
copy-up-begin and copy-up-publish sit on both copy-up shapes — the
anonymous regular-file stage and the named directory/symlink stage —
so a hold at copy-up-publish pins whichever kind is in flight.
Development tools for the kernel
Peios Kernel / Kernel development / Development tools
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 effort to integrate them into a coherent whole; patches welcome!
A brief overview of testing-specific tools can be found in Documentation/dev-tools/testing-overview.rst
Tools that are specific to debugging can be found in Documentation/process/debugging/index.rst
Table of contents
- Kernel Testing Guide
- Checkpatch
- clang-format
- Coccinelle
- Compiler-Based Context Analysis
- Sparse
- KCOV: code coverage for fuzzing
- Using gcov with the Linux kernel
- Kernel Address Sanitizer (KASAN)
- Kernel Memory Sanitizer (KMSAN)
- Undefined Behavior Sanitizer - UBSAN
- Kernel Memory Leak Detector
- Kernel Concurrency Sanitizer (KCSAN)
- Linux Kernel Memory Consistency Model (LKMM)
- Kernel Electric-Fence (KFENCE)
- Linux Kernel Selftests
- KUnit - Linux Kernel Unit Testing
- The Kernel Test Anything Protocol (KTAP), version 1
- UAPI Checker
- Linux Kernel GPIO based sloppy logic analyzer
- Using AutoFDO with the Linux kernel
- Using Propeller with the Linux kernel
- Containerized Builds
Using AutoFDO with the Linux kernel
Peios Kernel / Kernel development / Development tools
This enables AutoFDO build support for the kernel when using the Clang compiler. AutoFDO (Auto-Feedback-Directed Optimization) is a type of profile-guided optimization (PGO) used to enhance the performance of binary executables. It gathers information about the frequency of execution of various code paths within a binary using hardware sampling. This data is then used to guide the compiler's optimization decisions, resulting in a more efficient binary. AutoFDO is a powerful optimization technique, and data indicates that it can significantly improve kernel performance. It's especially beneficial for workloads affected by front-end stalls.
For AutoFDO builds, unlike non-FDO builds, the user must supply a profile. Acquiring an AutoFDO profile can be done in several ways. AutoFDO profiles are created by converting hardware sampling using the "perf" tool. It is crucial that the workload used to create these perf files is representative; they must exhibit runtime characteristics similar to the workloads that are intended to be optimized. Failure to do so will result in the compiler optimizing for the wrong objective.
The AutoFDO profile often encapsulates the program's behavior. If the performance-critical codes are architecture-independent, the profile can be applied across platforms to achieve performance gains. For instance, using the profile generated on Intel architecture to build a kernel for AMD architecture can also yield performance improvements.
There are two methods for acquiring a representative profile: (1) Sample real workloads using a production environment. (2) Generate the profile using a representative load test. When enabling the AutoFDO build configuration without providing an AutoFDO profile, the compiler only modifies the dwarf information in the kernel without impacting runtime performance. It's advisable to use a kernel binary built with the same AutoFDO configuration to collect the perf profile. While it's possible to use a kernel built with different options, it may result in inferior performance.
One can collect profiles using AutoFDO build for the previous kernel. AutoFDO employs relative line numbers to match the profiles, offering some tolerance for source changes. This mode is commonly used in a production environment for profile collection.
In a profile collection based on a load test, the AutoFDO collection process consists of the following steps:
-
Initial build: The kernel is built with AutoFDO options without a profile.
-
Profiling: The above kernel is then run with a representative workload to gather execution frequency data. This data is collected using hardware sampling, via perf. AutoFDO is most effective on platforms supporting advanced PMU features like LBR on Intel machines.
-
AutoFDO profile generation: Perf output file is converted to the AutoFDO profile via offline tools.
The support requires a Clang compiler LLVM 17 or later.
Preparation #
Configure the kernel with:
CONFIG_AUTOFDO_CLANG=y
Customization #
The default CONFIG_AUTOFDO_CLANG setting covers kernel space objects for AutoFDO builds. One can, however, enable or disable AutoFDO build for individual files and directories by adding a line similar to the following to the respective kernel Makefile:
-
For enabling a single file (e.g. foo.o)
AUTOFDO_PROFILE_foo.o := y -
For enabling all files in one directory
AUTOFDO_PROFILE := y -
For disabling one file
AUTOFDO_PROFILE_foo.o := n -
For disabling all files in one directory
AUTOFDO_PROFILE := n
Workflow #
Here is an example workflow for AutoFDO kernel:
-
Build the kernel on the host machine with LLVM enabled, for example,
$ make menuconfig LLVM=1Turn on AutoFDO build config:
CONFIG_AUTOFDO_CLANG=yWith a configuration that with LLVM enabled, use the following command:
$ scripts/config -e AUTOFDO_CLANGAfter getting the config, build with
$ make LLVM=1 -
Install the kernel on the test machine.
-
Run the load tests. The '-c' option in perf specifies the sample event period. We suggest using a suitable prime number, like 500009, for this purpose.
-
For Intel platforms:
$ perf record -e BR_INST_RETIRED.NEAR_TAKEN:k -a -N -b -c <count> -o <perf_file> -- <loadtest> -
For AMD platforms:
The supported systems are: Zen3 with BRS, or Zen4 with amd_lbr_v2. To check,
For Zen3:
$ cat /proc/cpuinfo | grep " brs"For Zen4:
$ cat /proc/cpuinfo | grep amd_lbr_v2The following command generated the perf data file:
$ perf record --pfm-events RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a -N -b -c <count> -o <perf_file> -- <loadtest>
-
-
(Optional) Download the raw perf file to the host machine.
-
To generate an AutoFDO profile, two offline tools are available: create_llvm_prof and llvm_profgen. The create_llvm_prof tool is part of the AutoFDO project and can be found on GitHub (https://github.com/google/autofdo), version v0.30.1 or later. The llvm_profgen tool is included in the LLVM compiler itself. It's important to note that the version of llvm_profgen doesn't need to match the version of Clang. It needs to be the LLVM 19 release of Clang or later, or just from the LLVM trunk.
$ llvm-profgen --kernel --binary=<vmlinux> --perfdata=<perf_file> -o <profile_file>or
$ create_llvm_prof --binary=<vmlinux> --profile=<perf_file> --format=extbinary --out=<profile_file>Note that multiple AutoFDO profile files can be merged into one via:
$ llvm-profdata merge -o <profile_file> <profile_1> <profile_2> ... <profile_n> -
Rebuild the kernel using the AutoFDO profile file with the same config as step 1, (Note CONFIG_AUTOFDO_CLANG needs to be enabled):
$ make LLVM=1 CLANG_AUTOFDO_PROFILE=<profile_file>
Checkpatch
Peios Kernel / Kernel development / Development tools
Checkpatch (scripts/checkpatch.pl) is a perl script which checks for trivial style violations in patches and optionally corrects them. Checkpatch can also be run on file contexts and without the kernel tree.
Checkpatch is not always right. Your judgement takes precedence over checkpatch messages. If your code looks better with the violations, then its probably best left alone.
Options #
This section will describe the options checkpatch can be run with.
Usage:
./scripts/checkpatch.pl [OPTION]... [FILE]...
Available options:
-q, --quiet
Enable quiet mode.
-v, --verbose Enable verbose mode. Additional verbose test descriptions are output so as to provide information on why that particular message is shown.
--no-tree
Run checkpatch without the kernel tree.
--no-signoff
Disable the 'Signed-off-by' line check. The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch.
Example:
Signed-off-by: Random J Developer <random@developer.example.org>Setting this flag effectively stops a message for a missing signed-off-by line in a patch context.
--patch
Treat FILE as a patch. This is the default option and need not be explicitly specified.
--emacs
Set output to emacs compile window format. This allows emacs users to jump from the error in the compile window directly to the offending line in the patch.
--terse
Output only one line per report.
--showfile
Show the diffed file position instead of the input file position.
-g, --git
Treat FILE as a single commit or a git revision range.
Single commit with:
<rev>
<rev>^
<rev>~n
Multiple commits with:
<rev1>..<rev2>
<rev1>...<rev2>
<rev>-<count>
-f, --file
Treat FILE as a regular source file. This option must be used when running checkpatch on source files in the kernel.
--subjective, --strict
Enable stricter tests in checkpatch. By default the tests emitted as CHECK do not activate by default. Use this flag to activate the CHECK tests.
--list-types
Every message emitted by checkpatch has an associated TYPE. Add this flag to display all the types in checkpatch.
Note that when this flag is active, checkpatch does not read the input FILE, and no message is emitted. Only a list of types in checkpatch is output.
--types TYPE(,TYPE2...)
Only display messages with the given types.
Example:
./scripts/checkpatch.pl mypatch.patch --types EMAIL_SUBJECT,BRACES--ignore TYPE(,TYPE2...)
Checkpatch will not emit messages for the specified types.
Example:
./scripts/checkpatch.pl mypatch.patch --ignore EMAIL_SUBJECT,BRACES--show-types
By default checkpatch doesn't display the type associated with the messages. Set this flag to show the message type in the output.
--max-line-length=n
Set the max line length (default 100). If a line exceeds the specified length, a LONG_LINE message is emitted.
The message level is different for patch and file contexts. For patches, a WARNING is emitted. While a milder CHECK is emitted for files. So for file contexts, the --strict flag must also be enabled.
--min-conf-desc-length=n
Set the Kconfig entry minimum description length, if shorter, warn.
--tab-size=n
Set the number of spaces for tab (default 8).
--root=PATH
PATH to the kernel tree root.
This option must be specified when invoking checkpatch from outside the kernel root.
--no-summary
Suppress the per file summary.
--mailback
Only produce a report in case of Warnings or Errors. Milder Checks are excluded from this.
--summary-file
Include the filename in summary.
--debug KEY=[0|1]
Turn on/off debugging of KEY, where KEY is one of 'values', 'possible', 'type', and 'attr' (default is all off).
--fix
This is an EXPERIMENTAL feature. If correctable errors exist, a file <inputfile>.EXPERIMENTAL-checkpatch-fixes is created which has the automatically fixable errors corrected.
--fix-inplace
EXPERIMENTAL - Similar to --fix but input file is overwritten with fixes.
DO NOT USE this flag unless you are absolutely sure and you have a backup in place.
--ignore-perl-version
Override checking of perl version. Runtime errors may be encountered after enabling this flag if the perl version does not meet the minimum specified.
--codespell
Use the codespell dictionary for checking spelling errors.
--codespellfile
Use the specified codespell file. Default is '/usr/share/codespell/dictionary.txt'.
--typedefsfile
Read additional types from this file.
--color[=WHEN]
Use colors 'always', 'never', or only when output is a terminal ('auto'). Default is 'auto'.
--kconfig-prefix=WORD
Use WORD as a prefix for Kconfig symbols (default is
CONFIG_).-h, --help, --version
Display the help text.
Message Levels #
Messages in checkpatch are divided into three levels. The levels of messages in checkpatch denote the severity of the error. They are:
ERROR
This is the most strict level. Messages of type ERROR must be taken seriously as they denote things that are very likely to be wrong.
WARNING
This is the next stricter level. Messages of type WARNING requires a more careful review. But it is milder than an ERROR.
CHECK
This is the mildest level. These are things which may require some thought.
Type Descriptions #
This section contains a description of all the message types in checkpatch.
Allocation style #
ALLOC_ARRAY_ARGS
The first argument for kcalloc or kmalloc_array should be the number of elements. sizeof() as the first argument is generally wrong.
See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html
ALLOC_SIZEOF_STRUCT
The allocation style is bad. In general for family of allocation functions using sizeof() to get memory size, constructs like:
p = alloc(sizeof(struct foo), ...)should be:
p = alloc(sizeof(*p), ...)See: https://www.kernel.org/doc/html/latest/process/coding-style.html#allocating-memory
ALLOC_WITH_MULTIPLY
Prefer kmalloc_array/kcalloc over kmalloc/kzalloc with a sizeof multiply.
See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html
API usage #
ARCH_DEFINES
Architecture specific defines should be avoided wherever possible.
ARCH_INCLUDE_LINUX
Whenever asm/file.h is included and linux/file.h exists, a conversion can be made when linux/file.h includes asm/file.h. However this is not always the case (See signal.h). This message type is emitted only for includes from arch/.
AVOID_BUG
BUG() or BUG_ON() should be avoided totally. Use WARN() and WARN_ON() instead, and handle the "impossible" error condition as gracefully as possible.
See: https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on
CONSIDER_KSTRTO
The simple_strtol(), simple_strtoll(), simple_strtoul(), and simple_strtoull() functions explicitly ignore overflows, which may lead to unexpected results in callers. The respective kstrtol(), kstrtoll(), kstrtoul(), and kstrtoull() functions tend to be the correct replacements.
CONSTANT_CONVERSION
Use of __constant_<foo> form is discouraged for the following functions:
__constant_cpu_to_be[x] __constant_cpu_to_le[x] __constant_be[x]_to_cpu __constant_le[x]_to_cpu __constant_htons __constant_ntohsUsing any of these outside of include/uapi/ is not preferred as using the function without __constant_ is identical when the argument is a constant.
In big endian systems, the macros like __constant_cpu_to_be32(x) and cpu_to_be32(x) expand to the same expression:
#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))In little endian systems, the macros __constant_cpu_to_be32(x) and cpu_to_be32(x) expand to __constant_swab32 and __swab32. __swab32 has a __builtin_constant_p check:
#define __swab32(x) \ (__builtin_constant_p((__u32)(x)) ? \ ___constant_swab32(x) : \ __fswab32(x))So ultimately they have a special case for constants. Similar is the case with all of the macros in the list. Thus using the __constant_... forms are unnecessarily verbose and not preferred outside of include/uapi.
See: https://lore.kernel.org/lkml/1400106425.12666.6.camel@joe-AO725/
DEPRECATED_API
Usage of a deprecated RCU API is detected. It is recommended to replace old flavourful RCU APIs by their new vanilla-RCU counterparts.
The full list of available RCU APIs can be viewed from the kernel docs.
See: https://www.kernel.org/doc/html/latest/RCU/whatisRCU.html#full-list-of-rcu-apis
DEVICE_ATTR_FUNCTIONS
The function names used in DEVICE_ATTR is unusual. Typically, the store and show functions are used with <attr>_store and <attr>_show, where <attr> is a named attribute variable of the device.
Consider the following examples:
static DEVICE_ATTR(type, 0444, type_show, NULL); static DEVICE_ATTR(power, 0644, power_show, power_store);The function names should preferably follow the above pattern.
See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
DEVICE_ATTR_RO
The DEVICE_ATTR_RO(name) helper macro can be used instead of DEVICE_ATTR(name, 0444, name_show, NULL);
Note that the macro automatically appends _show to the named attribute variable of the device for the show method.
See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
DEVICE_ATTR_RW
The DEVICE_ATTR_RW(name) helper macro can be used instead of DEVICE_ATTR(name, 0644, name_show, name_store);
Note that the macro automatically appends _show and _store to the named attribute variable of the device for the show and store methods.
See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
DEVICE_ATTR_WO
The DEVICE_AATR_WO(name) helper macro can be used instead of DEVICE_ATTR(name, 0200, NULL, name_store);
Note that the macro automatically appends _store to the named attribute variable of the device for the store method.
See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
DUPLICATED_SYSCTL_CONST
Commit d91bff3011cf ("proc/sysctl: add shared variables for range check") added some shared const variables to be used instead of a local copy in each source file.
Consider replacing the sysctl range checking value with the shared one in include/linux/sysctl.h. The following conversion scheme may be used:
&zero -> SYSCTL_ZERO &one -> SYSCTL_ONE &int_max -> SYSCTL_INT_MAXSee:
ENOSYS
ENOSYS means that a nonexistent system call was called. Earlier, it was wrongly used for things like invalid operations on otherwise valid syscalls. This should be avoided in new code.
ENOTSUPP
ENOTSUPP is not a standard error code and should be avoided in new patches. EOPNOTSUPP should be used instead.
See: https://lore.kernel.org/netdev/20200510182252.GA411829@lunn.ch/
EXPORT_SYMBOL
EXPORT_SYMBOL should immediately follow the symbol to be exported.
IN_ATOMIC
in_atomic() is not for driver use so any such use is reported as an ERROR. Also in_atomic() is often used to determine if sleeping is permitted, but it is not reliable in this use model. Therefore its use is strongly discouraged.
However, in_atomic() is ok for core kernel use.
See: https://lore.kernel.org/lkml/20080320201723.b87b3732.akpm@linux-foundation.org/
LOCKDEP
The lockdep_no_validate class was added as a temporary measure to prevent warnings on conversion of device->sem to device->mutex. It should not be used for any other purpose.
See: https://lore.kernel.org/lkml/1268959062.9440.467.camel@laptop/
MALFORMED_INCLUDE
The #include statement has a malformed path. This has happened because the author has included a double slash "//" in the pathname accidentally.
USE_LOCKDEP
lockdep_assert_held() annotations should be preferred over assertions based on spin_is_locked()
See: https://www.kernel.org/doc/html/latest/locking/lockdep-design.html#annotations
UAPI_INCLUDE
No #include statements in include/uapi should use a uapi/ path.
USLEEP_RANGE
usleep_range() should be preferred over udelay(). The proper way of using usleep_range() is mentioned in the kernel docs.
Comments #
BLOCK_COMMENT_STYLE
The comment style is incorrect. The preferred style for multi- line comments is:
/* * This is the preferred style * for multi line comments. */See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting
C99_COMMENTS
C99 style single line comments (//) should not be used. Prefer the block comment style instead.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting
DATA_RACE
Applications of data_race() should have a comment so as to document the reasoning behind why it was deemed safe.
See: https://lore.kernel.org/lkml/20200401101714.44781-1-elver@google.com/
FSF_MAILING_ADDRESS
Kernel maintainers reject new instances of the GPL boilerplate paragraph directing people to write to the FSF for a copy of the GPL, since the FSF has moved in the past and may do so again. So do not write paragraphs about writing to the Free Software Foundation's mailing address.
See: https://lore.kernel.org/lkml/20131006222342.GT19510@leaf/
UNCOMMENTED_RGMII_MODE
Historically, the RGMII PHY modes specified in Device Trees have been used inconsistently, often referring to the usage of delays on the PHY side rather than describing the board.
PHY modes "rgmii", "rgmii-rxid" and "rgmii-txid" modes require the clock signal to be delayed on the PCB; this unusual configuration should be described in a comment. If they are not (meaning that the delay is realized internally in the MAC or PHY), "rgmii-id" is the correct PHY mode.
Commit message #
BAD_SIGN_OFF
The signed-off-by line does not fall in line with the standards specified by the community.
BAD_STABLE_ADDRESS_STYLE
The email format for stable is incorrect. Some valid options for stable address are:
1. stable@vger.kernel.org 2. stable@kernel.orgFor adding version info, the following comment style should be used:
stable@vger.kernel.org # version infoCOMMIT_COMMENT_SYMBOL
Commit log lines starting with a '#' are ignored by git as comments. To solve this problem addition of a single space infront of the log line is enough.
COMMIT_MESSAGE
The patch is missing a commit description. A brief description of the changes made by the patch should be added.
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
EMAIL_SUBJECT
Naming the tool that found the issue is not very useful in the subject line. A good subject line summarizes the change that the patch brings.
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
FROM_SIGN_OFF_MISMATCH
The author's email does not match with that in the Signed-off-by: line(s). This can be sometimes caused due to an improperly configured email client.
This message is emitted due to any of the following reasons:
- The email names do not match. - The email addresses do not match. - The email subaddresses do not match. - The email comments do not match.MISSING_SIGN_OFF
The patch is missing a Signed-off-by line. A signed-off-by line should be added according to Developer's certificate of Origin.
NO_AUTHOR_SIGN_OFF
The author of the patch has not signed off the patch. It is required that a simple sign off line should be present at the end of explanation of the patch to denote that the author has written it or otherwise has the rights to pass it on as an open source patch.
DIFF_IN_COMMIT_MSG
Avoid having diff content in commit message. This causes problems when one tries to apply a file containing both the changelog and the diff because patch(1) tries to apply the diff which it found in the changelog.
See: https://lore.kernel.org/lkml/20150611134006.9df79a893e3636019ad2759e@linux-foundation.org/
GERRIT_CHANGE_ID
To be picked up by gerrit, the footer of the commit message might have a Change-Id like:
Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b Signed-off-by: A. U. Thor <author@example.com>The Change-Id line must be removed before submitting.
GIT_COMMIT_ID
The proper way to reference a commit id is: commit <12+ chars of sha1> ("<title line>")
An example may be:
Commit e21d2170f36602ae2708 ("video: remove unnecessary platform_set_drvdata()") removed the unnecessary platform_set_drvdata(), but left the variable "dev" unused, delete it.See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
BAD_FIXES_TAG
The Fixes: tag is malformed or does not follow the community conventions. This can occur if the tag have been split into multiple lines (e.g., when pasted in an email program with word wrapping enabled).
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
BAD_COMMIT_SEPARATOR
The commit separator is a single line with 3 dashes. The regex match is '^---$' Lines that start with 3 dashes and have more content on the same line may confuse tools that apply patches.
Comparison style #
ASSIGN_IN_IF
Do not use assignments in if condition. Example:
if ((foo = bar(...)) < BAZ) {should be written as:
foo = bar(...); if (foo < BAZ) {BOOL_COMPARISON
Comparisons of A to true and false are better written as A and !A.
See: https://lore.kernel.org/lkml/1365563834.27174.12.camel@joe-AO722/
COMPARISON_TO_NULL
Comparisons to NULL in the form (foo == NULL) or (foo != NULL) are better written as (!foo) and (foo).
CONSTANT_COMPARISON
Comparisons with a constant or upper case identifier on the left side of the test should be avoided.
Indentation and Line Breaks #
CODE_INDENT
Code indent should use tabs instead of spaces. Outside of comments, documentation and Kconfig, spaces are never used for indentation.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation
DEEP_INDENTATION
Indentation with 6 or more tabs usually indicate overly indented code.
It is suggested to refactor excessive indentation of if/else/for/do/while/switch statements.
See: https://lore.kernel.org/lkml/1328311239.21255.24.camel@joe2Laptop/
SWITCH_CASE_INDENT_LEVEL
switch should be at the same indent as case. Example:
switch (suffix) { case 'G': case 'g': mem <<= 30; break; case 'M': case 'm': mem <<= 20; break; case 'K': case 'k': mem <<= 10; fallthrough; default: break; }See: https://www.kernel.org/doc/html/latest/process/coding-style.html#indentation
LONG_LINE
The line has exceeded the specified maximum length. To use a different maximum line length, the --max-line-length=n option may be added while invoking checkpatch.
Earlier, the default line length was 80 columns. Commit bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning") increased the limit to 100 columns. This is not a hard limit either and it's preferable to stay within 80 columns whenever possible.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings
LONG_LINE_STRING
A string starts before but extends beyond the maximum line length. To use a different maximum line length, the --max-line-length=n option may be added while invoking checkpatch.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings
LONG_LINE_COMMENT
A comment starts before but extends beyond the maximum line length. To use a different maximum line length, the --max-line-length=n option may be added while invoking checkpatch.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#breaking-long-lines-and-strings
SPLIT_STRING
Quoted strings that appear as messages in userspace and can be grepped, should not be split across multiple lines.
See: https://lore.kernel.org/lkml/20120203052727.GA15035@leaf/
MULTILINE_DEREFERENCE
A single dereferencing identifier spanned on multiple lines like:
struct_identifier->member[index]. member = <foo>;is generally hard to follow. It can easily lead to typos and so makes the code vulnerable to bugs.
If fixing the multiple line dereferencing leads to an 80 column violation, then either rewrite the code in a more simple way or if the starting part of the dereferencing identifier is the same and used at multiple places then store it in a temporary variable, and use that temporary variable only at all the places. For example, if there are two dereferencing identifiers:
member1->member2->member3.foo1; member1->member2->member3.foo2;then store the member1->member2->member3 part in a temporary variable. It not only helps to avoid the 80 column violation but also reduces the program size by removing the unnecessary dereferences.
But if none of the above methods work then ignore the 80 column violation because it is much easier to read a dereferencing identifier on a single line.
TRAILING_STATEMENTS
Trailing statements (for example after any conditional) should be on the next line. Statements, such as:
if (x == y) break;should be:
if (x == y) break;
Macros, Attributes and Symbols #
ARRAY_SIZE
The ARRAY_SIZE(foo) macro should be preferred over sizeof(foo)/sizeof(foo[0]) for finding number of elements in an array.
The macro is defined in include/linux/array_size.h:
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))AVOID_EXTERNS
Function prototypes don't need to be declared extern in .h files. It's assumed by the compiler and is unnecessary.
AVOID_L_PREFIX
Local symbol names that are prefixed with
.Lshould be avoided, as this has special meaning for the assembler; a symbol entry will not be emitted into the symbol table. This can preventobjtoolfrom generating correct unwind info.Symbols with STB_LOCAL binding may still be used, and
.Lprefixed local symbol names are still generally usable within a function, but.Lprefixed local symbol names should not be used to denote the beginning or end of code regions viaSYM_CODE_START_LOCAL/SYM_CODE_ENDBIT_MACRO
Defines like: 1 << <digit> could be BIT(digit). The BIT() macro is defined via include/linux/bits.h:
#define BIT(nr) (1UL << (nr))CONST_READ_MOSTLY
When a variable is tagged with the __read_mostly annotation, it is a signal to the compiler that accesses to the variable will be mostly reads and rarely(but NOT never) a write.
const __read_mostly does not make any sense as const data is already read-only. The __read_mostly annotation thus should be removed.
DATE_TIME
It is generally desirable that building the same source code with the same set of tools is reproducible, i.e. the output is always exactly the same.
The kernel does not use the
__DATE__and__TIME__macros, and enables warnings if they are used as they can lead to non-deterministic builds.See: https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html#timestamps
DEFINE_ARCH_HAS
The ARCH_HAS_xyz and ARCH_HAVE_xyz patterns are wrong.
For big conceptual features use Kconfig symbols instead. And for smaller things where we have compatibility fallback functions but want architectures able to override them with optimized ones, we should either use weak functions (appropriate for some cases), or the symbol that protects them should be the same symbol we use.
See: https://lore.kernel.org/lkml/CA+55aFycQ9XJvEOsiM3txHL5bjUc8CeKWJNR_H+MiicaddB42Q@mail.gmail.com/
DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON
do {} while(0) macros should not have a trailing semicolon.
INIT_ATTRIBUTE
Const init definitions should use __initconst instead of __initdata.
Similarly init definitions without const require a separate use of const.
INLINE_LOCATION
The inline keyword should sit between storage class and type.
For example, the following segment:
inline static int example_function(void) { ... }should be:
static inline int example_function(void) { ... }MISPLACED_INIT
It is possible to use section markers on variables in a way which gcc doesn't understand (or at least not the way the developer intended):
static struct __initdata samsung_pll_clock exynos4_plls[nr_plls] = {does not put exynos4_plls in the .initdata section. The __initdata marker can be virtually anywhere on the line, except right after "struct". The preferred location is before the "=" sign if there is one, or before the trailing ";" otherwise.
See: https://lore.kernel.org/lkml/1377655732.3619.19.camel@joe-AO722/
MULTISTATEMENT_MACRO_USE_DO_WHILE
Macros with multiple statements should be enclosed in a do - while block. Same should also be the case for macros starting with
ifto avoid logic defects:#define macrofun(a, b, c) \ do { \ if (a == 5) \ do_this(b, c); \ } while (0)See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl
PREFER_FALLTHROUGH
Use the
fallthrough;pseudo keyword instead of/* fallthrough */like comments.TRAILING_SEMICOLON
Macro definition should not end with a semicolon. The macro invocation style should be consistent with function calls. This can prevent any unexpected code paths:
#define MAC do_something;If this macro is used within a if else statement, like:
if (some_condition) MAC; else do_something;Then there would be a compilation error, because when the macro is expanded there are two trailing semicolons, so the else branch gets orphaned.
See: https://lore.kernel.org/lkml/1399671106.2912.21.camel@joe-AO725/
MACRO_ARG_UNUSED
If function-like macros do not utilize a parameter, it might result in a build warning. We advocate for utilizing static inline functions to replace such macros. For example, for a macro such as the one below:
#define test(a) do { } while (0)there would be a warning like below:
WARNING: Argument 'a' is not used in function-like macro.See: https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl
SINGLE_STATEMENT_DO_WHILE_MACRO
For the multi-statement macros, it is necessary to use the do-while loop to avoid unpredictable code paths. The do-while loop helps to group the multiple statements into a single one so that a function-like macro can be used as a function only.
But for the single statement macros, it is unnecessary to use the do-while loop. Although the code is syntactically correct but using the do-while loop is redundant. So remove the do-while loop for single statement macros.
WEAK_DECLARATION
Using weak declarations like __attribute__((weak)) or __weak can have unintended link defects. Avoid using them.
Functions and Variables #
CAMELCASE
Avoid CamelCase Identifiers.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#naming
CONST_CONST
Using
const <type> const *is generally meant to be writtenconst <type> * const.CONST_STRUCT
Using const is generally a good idea. Checkpatch reads a list of frequently used structs that are always or almost always constant.
The existing structs list can be viewed from
scripts/const_structs.checkpatch.See: https://lore.kernel.org/lkml/alpine.DEB.2.10.1608281509480.3321@hadrien/
EMBEDDED_FUNCTION_NAME
Embedded function names are less appropriate to use as refactoring can cause function renaming. Prefer the use of "%s", __func__ to embedded function names.
Note that this does not work with -f (--file) checkpatch option as it depends on patch context providing the function name.
FUNCTION_ARGUMENTS
This warning is emitted due to any of the following reasons:
Arguments for the function declaration do not follow the identifier name. Example:
void foo (int bar, int baz)This should be corrected to:
void foo(int bar, int baz)Some arguments for the function definition do not have an identifier name. Example:
void foo(int)All arguments should have identifier names.
FUNCTION_WITHOUT_ARGS
Function declarations without arguments like:
int foo()should be:
int foo(void)GLOBAL_INITIALISERS
Global variables should not be initialized explicitly to 0 (or NULL, false, etc.). Your compiler (or rather your loader, which is responsible for zeroing out the relevant sections) automatically does it for you.
INITIALISED_STATIC
Static variables should not be initialized explicitly to zero. Your compiler (or rather your loader) automatically does it for you.
MULTIPLE_ASSIGNMENTS
Multiple assignments on a single line makes the code unnecessarily complicated. So on a single line assign value to a single variable only, this makes the code more readable and helps avoid typos.
RETURN_PARENTHESES
return is not a function and as such doesn't need parentheses:
return (bar);can simply be:
return bar;UNINITIALIZED_PTR_WITH_FREE
Pointers with __free attribute should be declared at the place of use and initialized (see include/linux/cleanup.h). In this case declarations at the top of the function rule can be relaxed. Not doing so may lead to undefined behavior as the memory assigned (garbage, in case not initialized) to the pointer is freed automatically when the pointer goes out of scope.
Also see: https://lore.kernel.org/lkml/58fd478f408a34b578ee8d949c5c4b4da4d4f41d.camel@HansenPartnership.com/
Example:
type var __free(free_func); ... // var not used, but, in future someone might add a return here var = malloc(var_size); ...should be initialized as:
... type var __free(free_func) = malloc(var_size); ...
Permissions #
DEVICE_ATTR_PERMS
The permissions used in DEVICE_ATTR are unusual. Typically only three permissions are used - 0644 (RW), 0444 (RO) and 0200 (WO).
See: https://www.kernel.org/doc/html/latest/filesystems/sysfs.html#attributes
EXECUTE_PERMISSIONS
There is no reason for source files to be executable. The executable bit can be removed safely.
EXPORTED_WORLD_WRITABLE
Exporting world writable sysfs/debugfs files is usually a bad thing. When done arbitrarily they can introduce serious security bugs. In the past, some of the debugfs vulnerabilities would seemingly allow any local user to write arbitrary values into device registers - a situation from which little good can be expected to emerge.
See: https://lore.kernel.org/linux-arm-kernel/cover.1296818921.git.segoon@openwall.com/
NON_OCTAL_PERMISSIONS
Permission bits should use 4 digit octal permissions (like 0700 or 0444). Avoid using any other base like decimal.
SYMBOLIC_PERMS
Permission bits in the octal form are more readable and easier to understand than their symbolic counterparts because many command-line tools use this notation. Experienced kernel developers have been using these traditional Unix permission bits for decades and so they find it easier to understand the octal notation than the symbolic macros. For example, it is harder to read S_IWUSR|S_IRUGO than 0644, which obscures the developer's intent rather than clarifying it.
See: https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/
Spacing and Brackets #
ASSIGNMENT_CONTINUATIONS
Assignment operators should not be written at the start of a line but should follow the operand at the previous line.
BRACES
The placement of braces is stylistically incorrect. The preferred way is to put the opening brace last on the line, and put the closing brace first:
if (x is true) { we do y }This applies for all non-functional blocks. However, there is one special case, namely functions: they have the opening brace at the beginning of the next line, thus:
int function(int x) { body of function }See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
BRACKET_SPACE
Whitespace before opening bracket '[' is prohibited. There are some exceptions:
With a type on the left:
int [] a;At the beginning of a line for slice initialisers:
[0...10] = 5,Inside a curly brace:
= { [0...10] = 5 }CONCATENATED_STRING
Concatenated elements should have a space in between. Example:
printk(KERN_INFO"bar");should be:
printk(KERN_INFO "bar");ELSE_AFTER_BRACE
else {should follow the closing block}on the same line.See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
LINE_SPACING
Vertical space is wasted given the limited number of lines an editor window can display when multiple blank lines are used.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
OPEN_BRACE
The opening brace should be following the function definitions on the next line. For any non-functional block it should be on the same line as the last construct.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
POINTER_LOCATION
When using pointer data or a function that returns a pointer type, the preferred use of * is adjacent to the data name or function name and not adjacent to the type name. Examples:
char *linux_banner; unsigned long long memparse(char *ptr, char **retptr); char *match_strdup(substring_t *s);See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
SPACING
Whitespace style used in the kernel sources is described in kernel docs.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
TRAILING_WHITESPACE
Trailing whitespace should always be removed. Some editors highlight the trailing whitespace and cause visual distractions when editing files.
See: https://www.kernel.org/doc/html/latest/process/coding-style.html#spaces
UNNECESSARY_PARENTHESES
Parentheses are not required in the following cases:
Function pointer uses:
(foo->bar)();could be:
foo->bar();
Comparisons in if:
if ((foo->bar) && (foo->baz)) if ((foo == bar))could be:
if (foo->bar && foo->baz) if (foo == bar)
addressof/dereference single Lvalues:
&(foo->bar) *(foo->bar)could be:
&foo->bar *foo->barWHILE_AFTER_BRACE
while should follow the closing bracket on the same line:
do { ... } while(something);See: https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
Others #
CONFIG_DESCRIPTION
Kconfig symbols should have a help text which fully describes it.
CORRUPTED_PATCH
The patch seems to be corrupted or lines are wrapped. Please regenerate the patch file before sending it to the maintainer.
CVS_KEYWORD
Since linux moved to git, the CVS markers are no longer used. So, CVS style keywords ($Id$, $Revision$, $Log$) should not be added.
DEFAULT_NO_BREAK
switch default case is sometimes written as "default:;". This can cause new cases added below default to be defective.
A "break;" should be added after empty default statement to avoid unwanted fallthrough.
DOS_LINE_ENDINGS
For DOS-formatted patches, there are extra ^M symbols at the end of the line. These should be removed.
DT_SCHEMA_BINDING_PATCH
DT bindings moved to a json-schema based format instead of freeform text.
See: https://www.kernel.org/doc/html/latest/devicetree/bindings/writing-schema.html
DT_SPLIT_BINDING_PATCH
Devicetree bindings should be their own patch. This is because bindings are logically independent from a driver implementation, they have a different maintainer (even though they often are applied via the same tree), and it makes for a cleaner history in the DT only tree created with git-filter-branch.
EMBEDDED_FILENAME
Embedding the complete filename path inside the file isn't particularly useful as often the path is moved around and becomes incorrect.
FILE_PATH_CHANGES
Whenever files are added, moved, or deleted, the MAINTAINERS file patterns can be out of sync or outdated.
So MAINTAINERS might need updating in these cases.
MEMSET
The memset use appears to be incorrect. This may be caused due to badly ordered parameters. Please recheck the usage.
NOT_UNIFIED_DIFF
The patch file does not appear to be in unified-diff format. Please regenerate the patch file before sending it to the maintainer.
PLACEHOLDER_USE
Detects unhandled placeholder text left in cover letters or commit headers/logs. Common placeholders include lines like:
*** SUBJECT HERE *** *** BLURB HERE ***These typically come from autogenerated templates. Replace them with a proper subject and description before sending.
PRINTF_0XDECIMAL
Prefixing 0x with decimal output is defective and should be corrected.
SPDX_LICENSE_TAG
The source file is missing or has an improper SPDX identifier tag. The Linux kernel requires the precise SPDX identifier in all source files, and it is thoroughly documented in the kernel docs.
See: https://www.kernel.org/doc/html/latest/process/license-rules.html
TYPO_SPELLING
Some words may have been misspelled. Consider reviewing them.
UAPI Checker
Peios Kernel / Kernel development / Development tools
The UAPI checker (scripts/check-uapi.sh) is a shell script which checks UAPI header files for userspace backwards-compatibility across the git tree.
Options #
This section will describe the options with which check-uapi.sh can be run.
Usage:
check-uapi.sh [-b BASE_REF] [-p PAST_REF] [-j N] [-l ERROR_LOG] [-i] [-q] [-v]
Available options:
-b BASE_REF Base git reference to use for comparison. If unspecified or empty,
will use any dirty changes in tree to UAPI files. If there are no
dirty changes, HEAD will be used.
-p PAST_REF Compare BASE_REF to PAST_REF (e.g. -p v6.1). If unspecified or empty,
will use BASE_REF^1. Must be an ancestor of BASE_REF. Only headers
that exist on PAST_REF will be checked for compatibility.
-j JOBS Number of checks to run in parallel (default: number of CPU cores).
-l ERROR_LOG Write error log to file (default: no error log is generated).
-i Ignore ambiguous changes that may or may not break UAPI compatibility.
-q Quiet operation.
-v Verbose operation (print more information about each header being checked).
Environmental args:
ABIDIFF Custom path to abidiff binary
CC C compiler (default is "gcc")
ARCH Target architecture of C compiler (default is host arch)
Exit codes:
0) Success
1) ABI difference detected
2) Prerequisite not met
Examples #
Basic Usage #
First, let's try making a change to a UAPI header file that obviously won't break userspace:
cat << 'EOF' | patch -l -p1
--- a/include/uapi/linux/acct.h
+++ b/include/uapi/linux/acct.h
@@ -21,7 +21,9 @@
#include <asm/param.h>
#include <asm/byteorder.h>
-/*
+#define FOO
+
+/*
* comp_t is a 16-bit "floating" point number with a 3-bit base 8
* exponent and a 13-bit fraction.
* comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
EOF
Now, let's use the script to validate:
% ./scripts/check-uapi.sh
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
All 912 UAPI headers compatible with x86 appear to be backwards compatible
Let's add another change that might break userspace:
cat << 'EOF' | patch -l -p1
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -74,7 +74,7 @@ struct bpf_insn {
__u8 dst_reg:4; /* dest register */
__u8 src_reg:4; /* source register */
__s16 off; /* signed offset */
- __s32 imm; /* signed immediate constant */
+ __u32 imm; /* unsigned immediate constant */
};
/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
EOF
The script will catch this:
% ./scripts/check-uapi.sh
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
==== ABI differences detected in include/linux/bpf.h from HEAD -> dirty tree ====
[C] 'struct bpf_insn' changed:
type size hasn't changed
1 data member change:
type of '__s32 imm' changed:
typedef name changed from __s32 to __u32 at int-ll64.h:27:1
underlying type 'int' changed:
type name changed from 'int' to 'unsigned int'
type size hasn't changed
==================================================================================
error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible
In this case, the script is reporting the type change because it could break a userspace program that passes in a negative number. Now, let's say you know that no userspace program could possibly be using a negative value in imm, so changing to an unsigned type there shouldn't hurt anything. You can pass the -i flag to the script to ignore changes in which the userspace backwards compatibility is ambiguous:
% ./scripts/check-uapi.sh -i
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
All 912 UAPI headers compatible with x86 appear to be backwards compatible
Now, let's make a similar change that will break userspace:
cat << 'EOF' | patch -l -p1
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -71,8 +71,8 @@ enum {
struct bpf_insn {
__u8 code; /* opcode */
- __u8 dst_reg:4; /* dest register */
__u8 src_reg:4; /* source register */
+ __u8 dst_reg:4; /* dest register */
__s16 off; /* signed offset */
__s32 imm; /* signed immediate constant */
};
EOF
Since we're re-ordering an existing struct member, there's no ambiguity, and the script will report the breakage even if you pass -i:
% ./scripts/check-uapi.sh -i
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
==== ABI differences detected in include/linux/bpf.h from HEAD -> dirty tree ====
[C] 'struct bpf_insn' changed:
type size hasn't changed
2 data member changes:
'__u8 dst_reg' offset changed from 8 to 12 (in bits) (by +4 bits)
'__u8 src_reg' offset changed from 12 to 8 (in bits) (by -4 bits)
==================================================================================
error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible
Let's commit the breaking change, then commit the innocuous change:
% git commit -m 'Breaking UAPI change' include/uapi/linux/bpf.h
[detached HEAD f758e574663a] Breaking UAPI change
1 file changed, 1 insertion(+), 1 deletion(-)
% git commit -m 'Innocuous UAPI change' include/uapi/linux/acct.h
[detached HEAD 2e87df769081] Innocuous UAPI change
1 file changed, 3 insertions(+), 1 deletion(-)
Now, let's run the script again with no arguments:
% ./scripts/check-uapi.sh
Installing user-facing UAPI headers from HEAD... OK
Installing user-facing UAPI headers from HEAD^1... OK
Checking changes to UAPI headers between HEAD^1 and HEAD...
All 912 UAPI headers compatible with x86 appear to be backwards compatible
It doesn't catch any breaking change because, by default, it only compares HEAD to HEAD^1. The breaking change was committed on HEAD~2. If we wanted the search scope to go back further, we'd have to use the -p option to pass a different past reference. In this case, let's pass -p HEAD~2 to the script so it checks UAPI changes between HEAD~2 and HEAD:
% ./scripts/check-uapi.sh -p HEAD~2
Installing user-facing UAPI headers from HEAD... OK
Installing user-facing UAPI headers from HEAD~2... OK
Checking changes to UAPI headers between HEAD~2 and HEAD...
==== ABI differences detected in include/linux/bpf.h from HEAD~2 -> HEAD ====
[C] 'struct bpf_insn' changed:
type size hasn't changed
2 data member changes:
'__u8 dst_reg' offset changed from 8 to 12 (in bits) (by +4 bits)
'__u8 src_reg' offset changed from 12 to 8 (in bits) (by -4 bits)
==============================================================================
error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible
Alternatively, we could have also run with -b HEAD~. This would set the base reference to HEAD~ so then the script would compare it to HEAD~^1.
Architecture-specific Headers #
Consider this change:
cat << 'EOF' | patch -l -p1
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -70,6 +70,7 @@ struct sigcontext {
struct _aarch64_ctx {
__u32 magic;
__u32 size;
+ __u32 new_var;
};
#define FPSIMD_MAGIC 0x46508001
EOF
This is a change to an arm64-specific UAPI header file. In this example, I'm running the script from an x86 machine with an x86 compiler, so, by default, the script only checks x86-compatible UAPI header files:
% ./scripts/check-uapi.sh
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
No changes to UAPI headers were applied between HEAD and dirty tree
With an x86 compiler, we can't check header files in arch/arm64, so the script doesn't even try.
If we want to check the header file, we'll have to use an arm64 compiler and set ARCH accordingly:
% CC=aarch64-linux-gnu-gcc ARCH=arm64 ./scripts/check-uapi.sh
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
==== ABI differences detected in include/asm/sigcontext.h from HEAD -> dirty tree ====
[C] 'struct _aarch64_ctx' changed:
type size changed from 64 to 96 (in bits)
1 data member insertion:
'__u32 new_var', at offset 64 (in bits) at sigcontext.h:73:1
-- snip --
[C] 'struct zt_context' changed:
type size changed from 128 to 160 (in bits)
2 data member changes (1 filtered):
'__u16 nregs' offset changed from 64 to 96 (in bits) (by +32 bits)
'__u16 __reserved[3]' offset changed from 80 to 112 (in bits) (by +32 bits)
=======================================================================================
error - 1/884 UAPI headers compatible with arm64 appear _not_ to be backwards compatible
We can see with ARCH and CC set properly for the file, the ABI change is reported properly. Also notice that the total number of UAPI header files checked by the script changes. This is because the number of headers installed for arm64 platforms is different than x86.
Cross-Dependency Breakages #
Consider this change:
cat << 'EOF' | patch -l -p1
--- a/include/uapi/linux/types.h
+++ b/include/uapi/linux/types.h
@@ -52,7 +52,7 @@ typedef __u32 __bitwise __wsum;
#define __aligned_be64 __be64 __attribute__((aligned(8)))
#define __aligned_le64 __le64 __attribute__((aligned(8)))
-typedef unsigned __bitwise __poll_t;
+typedef unsigned short __bitwise __poll_t;
#endif /* __ASSEMBLY__ */
#endif /* _UAPI_LINUX_TYPES_H */
EOF
Here, we're changing a typedef in types.h. This doesn't break a UAPI in types.h, but other UAPIs in the tree may break due to this change:
% ./scripts/check-uapi.sh
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
==== ABI differences detected in include/linux/eventpoll.h from HEAD -> dirty tree ====
[C] 'struct epoll_event' changed:
type size changed from 96 to 80 (in bits)
2 data member changes:
type of '__poll_t events' changed:
underlying type 'unsigned int' changed:
type name changed from 'unsigned int' to 'unsigned short int'
type size changed from 32 to 16 (in bits)
'__u64 data' offset changed from 32 to 16 (in bits) (by -16 bits)
========================================================================================
include/linux/eventpoll.h did not change between HEAD and dirty tree...
It's possible a change to one of the headers it includes caused this error:
#include <linux/fcntl.h>
#include <linux/types.h>
Note that the script noticed the failing header file did not change, so it assumes one of its includes must have caused the breakage. Indeed, we can see linux/types.h is used from eventpoll.h.
UAPI Header Removals #
Consider this change:
cat << 'EOF' | patch -l -p1
diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild
index ebb180aac74e..a9c88b0a8b3b 100644
--- a/include/uapi/asm-generic/Kbuild
+++ b/include/uapi/asm-generic/Kbuild
@@ -31,6 +31,6 @@ mandatory-y += stat.h
mandatory-y += statfs.h
mandatory-y += swab.h
mandatory-y += termbits.h
-mandatory-y += termios.h
+#mandatory-y += termios.h
mandatory-y += types.h
mandatory-y += unistd.h
EOF
This script removes a UAPI header file from the install list. Let's run the script:
% ./scripts/check-uapi.sh
Installing user-facing UAPI headers from dirty tree... OK
Installing user-facing UAPI headers from HEAD... OK
Checking changes to UAPI headers between HEAD and dirty tree...
==== UAPI header include/asm/termios.h was removed between HEAD and dirty tree ====
error - 1/912 UAPI headers compatible with x86 appear _not_ to be backwards compatible
Removing a UAPI header is considered a breaking change, and the script will flag it as such.
Checking Historic UAPI Compatibility #
You can use the -b and -p options to examine different chunks of your git tree. For example, to check all changed UAPI header files between tags v6.0 and v6.1, you'd run:
% ./scripts/check-uapi.sh -b v6.1 -p v6.0
Installing user-facing UAPI headers from v6.1... OK
Installing user-facing UAPI headers from v6.0... OK
Checking changes to UAPI headers between v6.0 and v6.1...
--- snip ---
error - 37/907 UAPI headers compatible with x86 appear _not_ to be backwards compatible
Note: Before v5.3, a header file needed by the script is not present, so the script is unable to check changes before then.
You'll notice that the script detected many UAPI changes that are not backwards compatible. Knowing that kernel UAPIs are supposed to be stable forever, this is an alarming result. This brings us to the next section: caveats.
Caveats #
The UAPI checker makes no assumptions about the author's intention, so some types of changes may be flagged even though they intentionally break UAPI.
Removals For Refactoring or Deprecation #
Sometimes drivers for very old hardware are removed, such as in this example:
% ./scripts/check-uapi.sh -b ba47652ba655
Installing user-facing UAPI headers from ba47652ba655... OK
Installing user-facing UAPI headers from ba47652ba655^1... OK
Checking changes to UAPI headers between ba47652ba655^1 and ba47652ba655...
==== UAPI header include/linux/meye.h was removed between ba47652ba655^1 and ba47652ba655 ====
error - 1/910 UAPI headers compatible with x86 appear _not_ to be backwards compatible
The script will always flag removals (even if they're intentional).
Struct Expansions #
Depending on how a structure is handled in kernelspace, a change which expands a struct could be non-breaking.
If a struct is used as the argument to an ioctl, then the kernel driver must be able to handle ioctl commands of any size. Beyond that, you need to be careful when copying data from the user. Say, for example, that struct foo is changed like this:
struct foo {
__u64 a; /* added in version 1 */
+ __u32 b; /* added in version 2 */
+ __u32 c; /* added in version 2 */
}
By default, the script will flag this kind of change for further review:
[C] 'struct foo' changed:
type size changed from 64 to 128 (in bits)
2 data member insertions:
'__u32 b', at offset 64 (in bits)
'__u32 c', at offset 96 (in bits)
However, it is possible that this change was made safely.
If a userspace program was built with version 1, it will think sizeof(struct foo) is 8. That size will be encoded in the ioctl value that gets sent to the kernel. If the kernel is built with version 2, it will think the sizeof(struct foo) is 16.
The kernel can use the _IOC_SIZE macro to get the size encoded in the ioctl code that the user passed in and then use copy_struct_from_user() to safely copy the value:
int handle_ioctl(unsigned long cmd, unsigned long arg)
{
switch _IOC_NR(cmd) {
0x01: {
struct foo my_cmd; /* size 16 in the kernel */
ret = copy_struct_from_user(&my_cmd, arg, sizeof(struct foo), _IOC_SIZE(cmd));
...
copy_struct_from_user will zero the struct in the kernel and then copy only the bytes passed in from the user (leaving new members zeroized). If the user passed in a larger struct, the extra members are ignored.
If you know this situation is accounted for in the kernel code, you can pass -i to the script, and struct expansions like this will be ignored.
Flex Array Migration #
While the script handles expansion into an existing flex array, it does still flag initial migration to flex arrays from 1-element fake flex arrays. For example:
struct foo {
__u32 x;
- __u32 flex[1]; /* fake flex */
+ __u32 flex[]; /* real flex */
};
This change would be flagged by the script:
[C] 'struct foo' changed:
type size changed from 64 to 32 (in bits)
1 data member change:
type of '__u32 flex[1]' changed:
type name changed from '__u32[1]' to '__u32[]'
array type size changed from 32 to 'unknown'
array type subrange 1 changed length from 1 to 'unknown'
At this time, there's no way to filter these types of changes, so be aware of this possible false positive.
Summary #
While many types of false positives are filtered out by the script, it's possible there are some cases where the script flags a change which does not break UAPI. It's also possible a change which does break userspace would not be flagged by this script. While the script has been run on much of the kernel history, there could still be corner cases that are not accounted for.
The intention is for this script to be used as a quick check for maintainers or automated tooling, not as the end-all authority on patch compatibility. It's best to remember: use your best judgment (and ideally a unit test in userspace) to make sure your UAPI changes are backwards-compatible!
clang-format
Peios Kernel / Kernel development / Development tools
clang-format is a tool to format C/C++/... code according to a set of rules and heuristics. Like most tools, it is not perfect nor covers every single case, but it is good enough to be helpful.
clang-format can be used for several purposes:
Quickly reformat a block of code to the kernel style. Specially useful when moving code around and aligning/sorting. See clangformatreformat.
Spot style mistakes, typos and possible improvements in files you maintain, patches you review, diffs, etc. See clangformatreview.
Help you follow the coding style rules, specially useful for those new to kernel development or working at the same time in several projects with different coding styles.
Its configuration file is .clang-format in the root of the kernel tree. The rules contained there try to approximate the most common kernel coding style. They also try to follow Documentation/process/coding-style.rst as much as possible. Since not all the kernel follows the same style, it is possible that you may want to tweak the defaults for a particular subsystem or folder. To do so, you can override the defaults by writing another .clang-format file in a subfolder.
The tool itself has already been included in the repositories of popular Linux distributions for a long time. Search for clang-format in your repositories. Otherwise, you can either download pre-built LLVM/clang binaries or build the source code from:
See more information about the tool at:
Review files and patches for coding style #
By running the tool in its inline mode, you can review full subsystems, folders or individual files for code style mistakes, typos or improvements.
To do so, you can run something like:
# Make sure your working directory is clean!
clang-format -i kernel/*.[ch]
And then take a look at the git diff.
Counting the lines of such a diff is also useful for improving/tweaking the style options in the configuration file; as well as testing new clang-format features/versions.
clang-format also supports reading unified diffs, so you can review patches and git diffs easily. See the documentation at:
https://clang.llvm.org/docs/ClangFormat.html#script-for-patch-reformatting
To avoid clang-format formatting some portion of a file, you can do:
int formatted_code;
// clang-format off
void unformatted_code ;
// clang-format on
void formatted_code_again;
While it might be tempting to use this to keep a file always in sync with clang-format, specially if you are writing new files or if you are a maintainer, please note that people might be running different clang-format versions or not have it available at all. Therefore, you should probably refrain yourself from using this in kernel sources; at least until we see if clang-format becomes commonplace.
Reformatting blocks of code #
By using an integration with your text editor, you can reformat arbitrary blocks (selections) of code with a single keystroke. This is specially useful when moving code around, for complex code that is deeply indented, for multi-line macros (and aligning their backslashes), etc.
Remember that you can always tweak the changes afterwards in those cases where the tool did not do an optimal job. But as a first approximation, it can be very useful.
There are integrations for many popular text editors. For some of them, like vim, emacs, BBEdit and Visual Studio you can find support built-in. For instructions, read the appropriate section at:
For Atom, Eclipse, Sublime Text, Visual Studio Code, XCode and other editors and IDEs you should be able to find ready-to-use plugins.
For this use case, consider using a secondary .clang-format so that you can tweak a few options. See clangformatextra.
Missing support #
clang-format is missing support for some things that are common in kernel code. They are easy to remember, so if you use the tool regularly, you will quickly learn to avoid/ignore those.
In particular, some very common ones you will notice are:
Aligned blocks of one-line
#defines, e.g.:#define TRACING_MAP_BITS_DEFAULT 11 #define TRACING_MAP_BITS_MAX 17 #define TRACING_MAP_BITS_MIN 7vs.:
#define TRACING_MAP_BITS_DEFAULT 11 #define TRACING_MAP_BITS_MAX 17 #define TRACING_MAP_BITS_MIN 7Aligned designated initializers, e.g.:
static const struct file_operations uprobe_events_ops = { .owner = THIS_MODULE, .open = probes_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, .write = probes_write, };vs.:
static const struct file_operations uprobe_events_ops = { .owner = THIS_MODULE, .open = probes_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, .write = probes_write, };
Extra features/options #
Some features/style options are not enabled by default in the configuration file in order to minimize the differences between the output and the current code. In other words, to make the difference as small as possible, which makes reviewing full-file style, as well diffs and patches as easy as possible.
In other cases (e.g. particular subsystems/folders/files), the kernel style might be different and enabling some of these options may approximate better the style there.
For instance:
Aligning assignments (
AlignConsecutiveAssignments).Aligning declarations (
AlignConsecutiveDeclarations).Reflowing text in comments (
ReflowComments).Sorting
#includes(SortIncludes).
They are typically useful for block re-formatting, rather than full-file. You might want to create another .clang-format file and use that one from your editor/IDE instead.
Coccinelle
Peios Kernel / Kernel development / Development tools
Coccinelle is a tool for pattern matching and text transformation that has many uses in kernel development, including the application of complex, tree-wide patches and detection of problematic programming patterns.
Getting Coccinelle #
The semantic patches included in the kernel use features and options which are provided by Coccinelle version 1.0.0-rc11 and above. Using earlier versions will fail as the option names used by the Coccinelle files and coccicheck have been updated.
Coccinelle is available through the package manager of many distributions, e.g. :
Debian
Fedora
Ubuntu
OpenSUSE
Arch Linux
NetBSD
FreeBSD
Some distribution packages are obsolete and it is recommended to use the latest version released from the Coccinelle homepage at http://coccinelle.lip6.fr/
Or from Github at:
https://github.com/coccinelle/coccinelle
Once you have it, run the following commands:
./autogen
./configure
make
as a regular user, and install it with:
sudo make install
More detailed installation instructions to build from source can be found at:
https://github.com/coccinelle/coccinelle/blob/master/install.txt
Supplemental documentation #
For supplemental documentation refer to the wiki:
https://bottest.wiki.kernel.org/coccicheck
The wiki documentation always refers to the linux-next version of the script.
For Semantic Patch Language(SmPL) grammar documentation refer to:
https://coccinelle.gitlabpages.inria.fr/website/docs/main_grammar.html
Using Coccinelle on the Linux kernel #
A Coccinelle-specific target is defined in the top level Makefile. This target is named coccicheck and calls the coccicheck front-end in the scripts directory.
Four basic modes are defined: patch, report, context, and org. The mode to use is specified by setting the MODE variable with MODE=<mode>.
-
patchproposes a fix, when possible. -
reportgenerates a list in the following format: file:line:column-column: message -
contexthighlights lines of interest and their context in a diff-like style. Lines of interest are indicated with-. -
orggenerates a report in the Org mode format of Emacs.
Note that not all semantic patches implement all modes. For easy use of Coccinelle, the default mode is "report".
Two other modes provide some common combinations of these modes.
-
chaintries the previous modes in the order above until one succeeds. -
rep+ctxtruns successively the report mode and the context mode. It should be used with the C option (described later) which checks the code on a file basis.
Examples #
To make a report for every semantic patch, run the following command:
make coccicheck MODE=report
To produce patches, run:
make coccicheck MODE=patch
The coccicheck target applies every semantic patch available in the sub-directories of scripts/coccinelle to the entire Linux kernel.
For each semantic patch, a commit message is proposed. It gives a description of the problem being checked by the semantic patch, and includes a reference to Coccinelle.
As with any static code analyzer, Coccinelle produces false positives. Thus, reports must be carefully checked, and patches reviewed.
To enable verbose messages set the V= variable, for example:
make coccicheck MODE=report V=1
By default, coccicheck will print debug logs to stdout and redirect stderr to /dev/null. This can make coccicheck output difficult to read and understand. Debug and error messages can instead be written to a debug file instead by setting the DEBUG_FILE variable:
make coccicheck MODE=report DEBUG_FILE="cocci.log"
Coccinelle cannot overwrite a debug file. Instead of repeatedly deleting a log file, you could include the datetime in the debug file name:
make coccicheck MODE=report DEBUG_FILE="cocci-$(date -Iseconds).log"
Coccinelle parallelization #
By default, coccicheck tries to run as parallel as possible. To change the parallelism, set the J= variable. For example, to run across 4 CPUs:
make coccicheck MODE=report J=4
As of Coccinelle 1.0.2 Coccinelle uses Ocaml parmap for parallelization; if support for this is detected you will benefit from parmap parallelization.
When parmap is enabled coccicheck will enable dynamic load balancing by using --chunksize 1 argument. This ensures we keep feeding threads with work one by one, so that we avoid the situation where most work gets done by only a few threads. With dynamic load balancing, if a thread finishes early we keep feeding it more work.
When parmap is enabled, if an error occurs in Coccinelle, this error value is propagated back, and the return value of the make coccicheck command captures this return value.
Using Coccinelle with a single semantic patch #
The optional make variable COCCI can be used to check a single semantic patch. In that case, the variable must be initialized with the name of the semantic patch to apply.
For instance:
make coccicheck COCCI=<my_SP.cocci> MODE=patch
or:
make coccicheck COCCI=<my_SP.cocci> MODE=report
Controlling Which Files are Processed by Coccinelle #
By default the entire kernel source tree is checked.
To apply Coccinelle to a specific directory, M= can be used. For example, to check drivers/net/wireless/ one may write:
make coccicheck M=drivers/net/wireless/
To apply Coccinelle on a file basis, instead of a directory basis, the C variable is used by the makefile to select which files to work with. This variable can be used to run scripts for the entire kernel, a specific directory, or for a single file.
For example, to check drivers/bluetooth/bfusb.c, the value 1 is passed to the C variable to check files that make considers need to be compiled.:
make C=1 CHECK=scripts/coccicheck drivers/bluetooth/bfusb.o
The value 2 is passed to the C variable to check files regardless of whether they need to be compiled or not.:
make C=2 CHECK=scripts/coccicheck drivers/bluetooth/bfusb.o
In these modes, which work on a file basis, there is no information about semantic patches displayed, and no commit message proposed.
This runs every semantic patch in scripts/coccinelle by default. The COCCI variable may additionally be used to only apply a single semantic patch as shown in the previous section.
The "report" mode is the default. You can select another one with the MODE variable explained above.
Debugging Coccinelle SmPL patches #
Using coccicheck is best as it provides in the spatch command line include options matching the options used when we compile the kernel. You can learn what these options are by using V=1; you could then manually run Coccinelle with debug options added.
An easier approach to debug running Coccinelle against SmPL patches is to ask coccicheck to redirect stderr to a debug file. As mentioned in the examples, by default stderr is redirected to /dev/null; if you'd like to capture stderr you can specify the DEBUG_FILE="file.txt" option to coccicheck. For instance:
rm -f cocci.err
make coccicheck COCCI=scripts/coccinelle/free/kfree.cocci MODE=report DEBUG_FILE=cocci.err
cat cocci.err
You can use SPFLAGS to add debugging flags; for instance you may want to add both --profile --show-trying to SPFLAGS when debugging. For example you may want to use:
rm -f err.log
export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
make coccicheck DEBUG_FILE="err.log" MODE=report SPFLAGS="--profile --show-trying" M=./drivers/mfd
err.log will now have the profiling information, while stdout will provide some progress information as Coccinelle moves forward with work.
NOTE:
DEBUG_FILE support is only supported when using coccinelle >= 1.0.2.
Currently, DEBUG_FILE support is only available to check folders, and not single files. This is because checking a single file requires spatch to be called twice leading to DEBUG_FILE being set both times to the same value, giving rise to an error.
.cocciconfig support #
Coccinelle supports reading .cocciconfig for default Coccinelle options that should be used every time spatch is spawned. The order of precedence for variables for .cocciconfig is as follows:
-
Your current user's home directory is processed first
-
Your directory from which spatch is called is processed next
-
The directory provided with the
--diroption is processed last, if used
make coccicheck also supports using M= targets. If you do not supply any M= target, it is assumed you want to target the entire kernel. The kernel coccicheck script has:
OPTIONS="--dir $srcroot $COCCIINCLUDE"
Here, $srcroot refers to the source directory of the target: it points to the external module's source directory when M= used, and otherwise, to the kernel source directory. The third rule ensures the spatch reads the .cocciconfig from the target directory, allowing external modules to have their own .cocciconfig file.
If not using the kernel's coccicheck target, keep the above precedence order logic of .cocciconfig reading. If using the kernel's coccicheck target, override any of the kernel's .coccicheck's settings using SPFLAGS.
We help Coccinelle when used against Linux with a set of sensible default options for Linux with our own Linux .cocciconfig. This hints to coccinelle that git can be used for git grep queries over coccigrep. A timeout of 200 seconds should suffice for now.
The options picked up by coccinelle when reading a .cocciconfig do not appear as arguments to spatch processes running on your system. To confirm what options will be used by Coccinelle run:
spatch --print-options-only
You can override with your own preferred index option by using SPFLAGS. Take note that when there are conflicting options Coccinelle takes precedence for the last options passed. Using .cocciconfig is possible to use idutils, however given the order of precedence followed by Coccinelle, since the kernel now carries its own .cocciconfig, you will need to use SPFLAGS to use idutils if desired. See below section "Additional flags" for more details on how to use idutils.
Additional flags #
Additional flags can be passed to spatch through the SPFLAGS variable. This works as Coccinelle respects the last flags given to it when options are in conflict.
make SPFLAGS=--use-glimpse coccicheck
Coccinelle supports idutils as well but requires coccinelle >= 1.0.6. When no ID file is specified coccinelle assumes your ID database file is in the file .id-utils.index on the top level of the kernel. Coccinelle carries a script scripts/idutils_index.sh which creates the database with:
mkid -i C --output .id-utils.index
If you have another database filename you can also just symlink with this name.
make SPFLAGS=--use-idutils coccicheck
Alternatively you can specify the database filename explicitly, for instance:
make SPFLAGS="--use-idutils /full-path/to/ID" coccicheck
See spatch --help to learn more about spatch options.
Note that the --use-glimpse and --use-idutils options require external tools for indexing the code. None of them is thus active by default. However, by indexing the code with one of these tools, and according to the cocci file used, spatch could proceed the entire code base more quickly.
SmPL patch specific options #
SmPL patches can have their own requirements for options passed to Coccinelle. SmPL patch-specific options can be provided by providing them at the top of the SmPL patch, for instance:
// Options: --no-includes --include-headers
SmPL patch Coccinelle requirements #
As Coccinelle features get added some more advanced SmPL patches may require newer versions of Coccinelle. If an SmPL patch requires a minimum version of Coccinelle, this can be specified as follows, as an example if requiring at least Coccinelle >= 1.0.5:
// Requires: 1.0.5
Proposing new semantic patches #
New semantic patches can be proposed and submitted by kernel developers. For sake of clarity, they should be organized in the sub-directories of scripts/coccinelle/.
Detailed description of the report mode #
report generates a list in the following format:
file:line:column-column: message
Example #
Running:
make coccicheck MODE=report COCCI=scripts/coccinelle/api/err_cast.cocci
will execute the following part of the SmPL script:
<smpl>
@r depends on !context && !patch && (org || report)@
expression x;
position p;
@@
ERR_PTR@p(PTR_ERR(x))
@script:python depends on report@
p << r.p;
x << r.x;
@@
msg="ERR_CAST can be used with %s" % (x)
coccilib.report.print_report(p[0], msg)
</smpl>
This SmPL excerpt generates entries on the standard output, as illustrated below:
/home/user/linux/crypto/ctr.c:188:9-16: ERR_CAST can be used with alg
/home/user/linux/crypto/authenc.c:619:9-16: ERR_CAST can be used with auth
/home/user/linux/crypto/xts.c:227:9-16: ERR_CAST can be used with alg
Detailed description of the patch mode #
When the patch mode is available, it proposes a fix for each problem identified.
Example #
Running:
make coccicheck MODE=patch COCCI=scripts/coccinelle/api/err_cast.cocci
will execute the following part of the SmPL script:
<smpl>
@ depends on !context && patch && !org && !report @
expression x;
@@
- ERR_PTR(PTR_ERR(x))
+ ERR_CAST(x)
</smpl>
This SmPL excerpt generates patch hunks on the standard output, as illustrated below:
diff -u -p a/crypto/ctr.c b/crypto/ctr.c
--- a/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200
+++ b/crypto/ctr.c 2010-06-03 23:44:49.000000000 +0200
@@ -185,7 +185,7 @@ static struct crypto_instance *crypto_ct
alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER,
CRYPTO_ALG_TYPE_MASK);
if (IS_ERR(alg))
- return ERR_PTR(PTR_ERR(alg));
+ return ERR_CAST(alg);
/* Block size must be >= 4 bytes. */
err = -EINVAL;
Detailed description of the context mode #
context highlights lines of interest and their context in a diff-like style.
NOTE: The diff-like output generated is NOT an applicable patch. The intent of the
contextmode is to highlight the important lines (annotated with minus,-) and gives some surrounding context lines around. This output can be used with the diff mode of Emacs to review the code.
Example #
Running:
make coccicheck MODE=context COCCI=scripts/coccinelle/api/err_cast.cocci
will execute the following part of the SmPL script:
<smpl>
@ depends on context && !patch && !org && !report@
expression x;
@@
* ERR_PTR(PTR_ERR(x))
</smpl>
This SmPL excerpt generates diff hunks on the standard output, as illustrated below:
diff -u -p /home/user/linux/crypto/ctr.c /tmp/nothing
--- /home/user/linux/crypto/ctr.c 2010-05-26 10:49:38.000000000 +0200
+++ /tmp/nothing
@@ -185,7 +185,6 @@ static struct crypto_instance *crypto_ct
alg = crypto_attr_alg(tb[1], CRYPTO_ALG_TYPE_CIPHER,
CRYPTO_ALG_TYPE_MASK);
if (IS_ERR(alg))
- return ERR_PTR(PTR_ERR(alg));
/* Block size must be >= 4 bytes. */
err = -EINVAL;
Detailed description of the org mode #
org generates a report in the Org mode format of Emacs.
Example #
Running:
make coccicheck MODE=org COCCI=scripts/coccinelle/api/err_cast.cocci
will execute the following part of the SmPL script:
<smpl>
@r depends on !context && !patch && (org || report)@
expression x;
position p;
@@
ERR_PTR@p(PTR_ERR(x))
@script:python depends on org@
p << r.p;
x << r.x;
@@
msg="ERR_CAST can be used with %s" % (x)
msg_safe=msg.replace("[","@(").replace("]",")")
coccilib.org.print_todo(p[0], msg_safe)
</smpl>
This SmPL excerpt generates Org entries on the standard output, as illustrated below:
* TODO [[view:/home/user/linux/crypto/ctr.c::face=ovl-face1::linb=188::colb=9::cole=16][ERR_CAST can be used with alg]]
* TODO [[view:/home/user/linux/crypto/authenc.c::face=ovl-face1::linb=619::colb=9::cole=16][ERR_CAST can be used with auth]]
* TODO [[view:/home/user/linux/crypto/xts.c::face=ovl-face1::linb=227::colb=9::cole=16][ERR_CAST can be used with alg]]
Containerized Builds
Peios Kernel / Kernel development / Development tools
The container tool can be used to run any command in the kernel source tree from within a container. Doing so facilitates reproducing builds across various platforms, for example when a test bot has reported an issue which requires a specific version of a compiler or an external test suite. While this can already be done by users who are familiar with containers, having a dedicated tool in the kernel tree lowers the barrier to entry by solving common problems once and for all (e.g. user id management). It also makes it easier to share an exact command line leading to a particular result. The main use case is likely to be kernel builds but virtually anything can be run: KUnit, checkpatch etc. provided a suitable image is available.
Options #
Command line syntax:
scripts/container -i IMAGE [OPTION]... CMD...
Available options:
-e, --env-file ENV_FILE
Path to an environment file to load in the container.
-g, --gid GID
Group id to use inside the container.
-i, --image IMAGE
Container image name (required).
-r, --runtime RUNTIME
Container runtime name. Supported runtimes:
docker,podman.If not specified, the first one found on the system will be used i.e. Podman if present, otherwise Docker.
-s, --shell
Run the container in an interactive shell.
-u, --uid UID
User id to use inside the container.
If the
-goption is not specified, the user id will also be used for the group id.
-v, --verbose
Enable verbose output.
-h, --help
Show the help message and exit.
Usage #
It's entirely up to the user to choose which image to use and the CMD arguments are passed directly as an arbitrary command line to run in the container. The tool will take care of mounting the source tree as the current working directory and adjust the user and group id as needed.
The container image which would typically include a compiler toolchain is provided by the user and selected via the -i option. The container runtime can be selected with the -r option, which can be either docker or podman. If none is specified, the first one found on the system will be used while giving priority to Podman. Support for other runtimes may be added later depending on their popularity among users.
By default, commands are run non-interactively. The user can abort a running container with SIGINT (Ctrl-C). To run commands interactively with a TTY, the --shell or -s option can be used. Signals will then be received by the shell directly rather than the parent container process. To exit an interactive shell, use Ctrl-D or exit.
Environment Variables #
Environment variables are not propagated to the container so they have to be either defined in the image itself or via the -e option using an environment file. In some cases it makes more sense to have them defined in the Containerfile used to create the image. For example, a Clang-only compiler toolchain image may have LLVM=1 defined.
The local environment file is more useful for user-specific variables added during development. It is passed as-is to the container runtime so its format may vary. Typically, it will look like the output of env. For example:
INSTALL_MOD_STRIP=1
SOME_RANDOM_TEXT=One upon a time
Please also note that make options can still be passed on the command line, so while this can't be done since the first argument needs to be the executable:
scripts/container -i docker.io/tuxmake/korg-clang LLVM=1 make # won't work
this will work:
scripts/container -i docker.io/tuxmake/korg-clang make LLVM=1
User IDs #
This is an area where the behaviour will vary slightly depending on the container runtime. The goal is to run commands as the user invoking the tool. With Podman, a namespace is created to map the current user id to a different one in the container (1000 by default). With Docker, while this is also possible with recent versions it requires a special feature to be enabled in the daemon so it's not used here for simplicity. Instead, the container is run with the current user id directly. In both cases, this will provide the same file permissions for the kernel source tree mounted as a volume. The only difference is that when using Docker without a namespace, the user id may not be the same as the default one set in the image.
Say, we're using an image which sets up a default user with id 1000 and the current user calling the container tool has id 1234. The kernel source tree was checked out by this same user so the files belong to user 1234. With Podman, the container will be running as user id 1000 with a mapping to id 1234 so that the files from the mounted volume appear to belong to id 1000 inside the container. With Docker and no namespace, the container will be running with user id 1234 which can access the files in the volume but not in the user 1000 home directory. This shouldn't be an issue when running commands only in the kernel tree but it is worth highlighting here as it might matter for special corner cases.
Examples #
The TuxMake project provides a variety of prebuilt container images available on Docker Hub. Here's the shortest example to build a kernel using a TuxMake Clang image:
scripts/container -i docker.io/tuxmake/korg-clang -- make LLVM=1 defconfig
scripts/container -i docker.io/tuxmake/korg-clang -- make LLVM=1 -j$(nproc)
To run checkpatch.pl in a patches directory with a generic Perl image:
scripts/container -i perl:slim-trixie scripts/checkpatch.pl patches/*
As an alternative to the TuxMake images, the examples below refer to kernel.org images which are based on the kernel.org compiler toolchains. These aren't (yet) officially available in any public registry but users can build their own locally instead using this experimental repository by running make PREFIX=kernel.org/.
To build just bzImage using Clang:
scripts/container -i kernel.org/clang -- make bzImage -j$(nproc)
Same with GCC 15 as a particular version tag:
scripts/container -i kernel.org/gcc:15 -- make bzImage -j$(nproc)
For an out-of-tree build, a trick is to bind-mount the destination directory to a relative path inside the source tree:
mkdir -p $HOME/tmp/my-kernel-build
mkdir -p build
sudo mount --bind $HOME/tmp/my-kernel-build build
scripts/container -i kernel.org/gcc -- make mrproper
scripts/container -i kernel.org/gcc -- make O=build defconfig
scripts/container -i kernel.org/gcc -- make O=build -j$(nproc)
To run KUnit in an interactive shell and get the full output:
scripts/container -s -i kernel.org/gcc:kunit -- \
tools/testing/kunit/kunit.py \
run \
--arch=x86_64 \
--cross_compile=x86_64-linux-
To just start an interactive shell:
scripts/container -si kernel.org/gcc bash
To build the HTML documentation, which requires the kdocs image built with make PREFIX=kernel.org/ extra as it's not a compiler toolchain:
scripts/container -i kernel.org/kdocs make htmldocs
Compiler-Based Context Analysis
Peios Kernel / Kernel development / Development tools
Context Analysis is a language extension, which enables statically checking that required contexts are active (or inactive) by acquiring and releasing user-definable "context locks". An obvious application is lock-safety checking for the kernel's various synchronization primitives (each of which represents a "context lock"), and checking that locking rules are not violated.
The Clang compiler currently supports the full set of context analysis features. To enable for Clang, configure the kernel with:
CONFIG_WARN_CONTEXT_ANALYSIS=y
The feature requires Clang 22 or later.
The analysis is opt-in by default, and requires declaring which modules and subsystems should be analyzed in the respective Makefile:
CONTEXT_ANALYSIS_mymodule.o := y
Or for all translation units in the directory:
CONTEXT_ANALYSIS := y
It is possible to enable the analysis tree-wide, however, which will result in numerous false positive warnings currently and is not generally recommended:
CONFIG_WARN_CONTEXT_ANALYSIS_ALL=y
Programming Model #
The below describes the programming model around using context lock types.
Context analysis is a way to specify permissibility of operations to depend on context locks being held (or not held). Typically we are interested in protecting data and code in a critical section by requiring a specific context to be active, for example by holding a specific lock. The analysis ensures that callers cannot perform an operation without the required context being active.
Context locks are associated with named structs, along with functions that operate on struct instances to acquire and release the associated context lock.
Context locks can be held either exclusively or shared. This mechanism allows assigning more precise privileges when a context is active, typically to distinguish where a thread may only read (shared) or also write (exclusive) to data guarded within a context.
The set of contexts that are actually active in a given thread at a given point in program execution is a run-time concept. The static analysis works by calculating an approximation of that set, called the context environment. The context environment is calculated for every program point, and describes the set of contexts that are statically known to be active, or inactive, at that particular point. This environment is a conservative approximation of the full set of contexts that will actually be active in a thread at run-time.
More details are also documented here.
Supported Kernel Primitives #
Currently the following synchronization primitives are supported: raw_spinlock_t, spinlock_t, rwlock_t, mutex, seqlock_t, bit_spinlock, RCU, SRCU (srcu_struct), rw_semaphore, local_lock_t, ww_mutex.
To initialize variables guarded by a context lock with an initialization function (type_init(&lock)), prefer using guard(type_init)(&lock) or scoped_guard(type_init, &lock) { ... } to initialize such guarded members or globals in the enclosing scope. This initializes the context lock and treats the context as active within the initialization scope (initialization implies exclusive access to the underlying object).
For example:
struct my_data {
spinlock_t lock;
int counter __guarded_by(&lock);
};
void init_my_data(struct my_data *d)
{
...
guard(spinlock_init)(&d->lock);
d->counter = 0;
...
}
Alternatively, initializing guarded variables can be done with context analysis disabled, preferably in the smallest possible scope (due to lack of any other checking): either with a context_unsafe(var = init) expression, or by marking small initialization functions with the __context_unsafe(init) attribute.
Lockdep assertions, such as lockdep_assert_held(), inform the compiler's context analysis that the associated synchronization primitive is held after the assertion. This avoids false positives in complex control-flow scenarios and encourages the use of Lockdep where static analysis is limited. For example, this is useful when a function doesn't always require a lock, making __must_hold() inappropriate.
Keywords #
__guarded_by() #
struct member and globals attribute, declares variable only accessible within active context
Parameters
...: variable arguments
Description
Declares that the struct member or global variable is only accessible within the context entered by the given context lock. Read operations on the data require shared access, while write operations require exclusive access.
;
__pt_guarded_by() #
struct member and globals attribute, declares pointed-to data only accessible within active context
Parameters
...: variable arguments
Description
Declares that the data pointed to by the struct member pointer or global pointer is only accessible within the context entered by the given context lock. Read operations on the data require shared access, while write operations require exclusive access.
;
context_lock_struct() #
declare or define a context lock struct
Parameters
name: struct name...: variable arguments
Description
Helper to declare or define a struct type that is also a context lock.
;
;
// ... declared elsewhere ...
;
Note
The implementation defines several helper functions that can acquire and release the context lock.
disable_context_analysis() #
disables context analysis
Description
Disables context analysis. Must be paired with a later
enable_context_analysis().
enable_context_analysis() #
re-enables context analysis
Description
Re-enables context analysis. Must be paired with a prior
disable_context_analysis().
context_unsafe() #
disable context checking for contained code
Parameters
...: variable arguments
Description
Disables context checking for contained statements or expression.
;
int
__context_unsafe() #
function attribute, disable context checking
Parameters
comment: comment explaining why opt-out is safe
Description
Function attribute denoting that context analysis is disabled for the whole function. Forces adding an inline comment as argument.
token_context_lock() #
declare an abstract global context lock instance
Parameters
name: token context lock name...: variable arguments
Description
Helper that declares an abstract global context lock instance name, but not
backed by a real data structure (linker error if accidentally referenced).
The type name is __ctx_lock_@name.
token_context_lock_instance() #
declare another instance of a global context lock
Parameters
ctx: token context lock previously declared withtoken_context_lock()name: name of additional global context lock instance
Description
Helper that declares an additional instance name of the same token context
lock class ctx. This is helpful where multiple related token contexts are
declared, to allow using the same underlying type (__ctx_lock_@ctx) as
function arguments.
__must_hold() #
function attribute, caller must hold exclusive context lock
Parameters
...: variable arguments
Description
Function attribute declaring that the caller must hold the given context lock instance(s) exclusively.
__must_not_hold() #
function attribute, caller must not hold context lock
Parameters
...: variable arguments
Description
Function attribute declaring that the caller must not hold the given context lock instance(s).
__acquires() #
function attribute, function acquires context lock exclusively
Parameters
...: variable arguments
Description
Function attribute declaring that the function acquires the given context lock instance(s) exclusively, but does not release them.
__cond_acquires() #
function attribute, function conditionally acquires a context lock exclusively
Parameters
ret: abstract value returned by function if context lock acquiredx: context lock instance pointer
Description
Function attribute declaring that the function conditionally acquires the given context lock instance x exclusively, but does not release it. The function return value ret denotes when the context lock is acquired.
ret may be one of: true, false, nonzero, 0, nonnull, NULL.
__releases() #
function attribute, function releases a context lock exclusively
Parameters
...: variable arguments
Description
Function attribute declaring that the function releases the given context lock instance(s) exclusively. The associated context(s) must be active on entry.
__acquire() #
function to acquire context lock exclusively
Parameters
x: context lock instance pointer
Description
No-op function that acquires the given context lock instance x exclusively.
__release() #
function to release context lock exclusively
Parameters
x: context lock instance pointer
Description
No-op function that releases the given context lock instance x.
__must_hold_shared() #
function attribute, caller must hold shared context lock
Parameters
...: variable arguments
Description
Function attribute declaring that the caller must hold the given context lock instance(s) with shared access.
__acquires_shared() #
function attribute, function acquires context lock shared
Parameters
...: variable arguments
Description
Function attribute declaring that the function acquires the given context lock instance(s) with shared access, but does not release them.
__cond_acquires_shared() #
function attribute, function conditionally acquires a context lock shared
Parameters
ret: abstract value returned by function if context lock acquiredx: context lock instance pointer
Description
Function attribute declaring that the function conditionally acquires the given context lock instance x with shared access, but does not release it. The function return value ret denotes when the context lock is acquired.
ret may be one of: true, false, nonzero, 0, nonnull, NULL.
__releases_shared() #
function attribute, function releases a context lock shared
Parameters
...: variable arguments
Description
Function attribute declaring that the function releases the given context lock instance(s) with shared access. The associated context(s) must be active on entry.
__acquire_shared() #
function to acquire context lock shared
Parameters
x: context lock instance pointer
Description
No-op function that acquires the given context lock instance x with shared access.
__release_shared() #
function to release context lock shared
Parameters
x: context lock instance pointer
Description
No-op function that releases the given context lock instance x with shared access.
__acquire_ret() #
helper to acquire context lock of return value
Parameters
call: call expressionret_expr: acquire expression that uses __ret
__acquire_shared_ret() #
helper to acquire context lock shared of return value
Parameters
call: call expressionret_expr: acquire shared expression that uses __ret
Background #
Clang originally called the feature Thread Safety Analysis, with some keywords and documentation still using the thread-safety-analysis-only terminology. This was later changed and the feature became more flexible, gaining the ability to define custom "capabilities". Its foundations can be found in Capability Systems, used to specify the permissibility of operations to depend on some "capability" being held (or not held).
Because the feature is not just able to express capabilities related to synchronization primitives, and "capability" is already overloaded in the kernel, the naming chosen for the kernel departs from Clang's initial "Thread Safety" and "capability" nomenclature; we refer to the feature as "Context Analysis" to avoid confusion. The internal implementation still makes references to Clang's terminology in a few places, such as -Wthread-safety being the warning option that also still appears in diagnostic messages.
Using gcov with the Linux kernel
Peios Kernel / Kernel development / Development tools
Peios: Integrity lockdown restricts debugfs access. Read-only files passing its safety checks can remain accessible, but writable or ioctl/mmap-capable debugfs interfaces can fail with
EPERM. Native authority does not bypass lockdown. These upstream diagnostic recipes therefore depend on interface availability in the configured kernel. See Peios kernel behaviour.
Peios: Linux capability names in this interface retain their API meaning, but KACS evaluates them through native token privileges or compatibility rules. UID 0,
setcapand Unix mode bits do not independently grant native authority. Object access and PIP checks remain additional constraints where applicable. See Peios kernel behaviour for the mapping and exceptions.
gcov profiling kernel support enables the use of GCC's coverage testing tool gcov with the Linux kernel. Coverage data of a running kernel is exported in gcov-compatible format via the "gcov" debugfs directory. To get coverage data for a specific file, change to the kernel build directory and use gcov with the -o option as follows (requires root):
# cd /tmp/linux-out
# gcov -o /sys/kernel/debug/gcov/tmp/linux-out/kernel spinlock.c
This will create source code files annotated with execution counts in the current directory. In addition, graphical gcov front-ends such as lcov can be used to automate the process of collecting data for the entire kernel and provide coverage overviews in HTML format.
Possible uses:
-
debugging (has this line been reached at all?)
-
test improvement (how do I change my test to cover these lines?)
-
minimizing kernel configurations (do I need this option if the associated code is never run?)
Preparation #
Configure the kernel with:
CONFIG_DEBUG_FS=y
CONFIG_GCOV_KERNEL=y
and to get coverage data for the entire kernel:
CONFIG_GCOV_PROFILE_ALL=y
Note that kernels compiled with profiling flags will be significantly larger and run slower. Also CONFIG_GCOV_PROFILE_ALL may not be supported on all architectures.
Profiling data will only become accessible once debugfs has been mounted:
mount -t debugfs none /sys/kernel/debug
Customization #
To enable profiling for specific files or directories, add a line similar to the following to the respective kernel Makefile:
-
For a single file (e.g. main.o):
GCOV_PROFILE_main.o := y -
For all files in one directory:
GCOV_PROFILE := y
To exclude files from being profiled even when CONFIG_GCOV_PROFILE_ALL is specified, use:
GCOV_PROFILE_main.o := n
and:
GCOV_PROFILE := n
Only files which are linked to the main kernel image or are compiled as kernel modules are supported by this mechanism.
Module specific configs #
Gcov kernel configs for specific modules are described below:
-
CONFIG_GCOV_PROFILE_RDS:
Enables GCOV profiling on RDS for checking which functions or lines are executed. This config is used by the rds selftest to generate coverage reports. If left unset the report is omitted.
Files #
The gcov kernel support creates the following files in debugfs:
-
/sys/kernel/debug/gcovParent directory for all gcov-related files.
-
/sys/kernel/debug/gcov/resetGlobal reset file: resets all coverage data to zero when written to.
-
/sys/kernel/debug/gcov/path/to/compile/dir/file.gcdaThe actual gcov data file as understood by the gcov tool. Resets file coverage data to zero when written to.
-
/sys/kernel/debug/gcov/path/to/compile/dir/file.gcnoSymbolic link to a static data file required by the gcov tool. This file is generated by gcc when compiling with option
-ftest-coverage.
Modules #
Kernel modules may contain cleanup code which is only run during module unload time. The gcov mechanism provides a means to collect coverage data for such code by keeping a copy of the data associated with the unloaded module. This data remains available through debugfs. Once the module is loaded again, the associated coverage counters are initialized with the data from its previous instantiation.
This behavior can be deactivated by specifying the gcov_persist kernel parameter:
gcov_persist=0
At run-time, a user can also choose to discard data for an unloaded module by writing to its data file or the global reset file.
Separated build and test machines #
The gcov kernel profiling infrastructure is designed to work out-of-the box for setups where kernels are built and run on the same machine. In cases where the kernel runs on a separate machine, special preparations must be made, depending on where the gcov tool is used:
-
a) gcov is run on the TEST machine
The gcov tool version on the test machine must be compatible with the gcc version used for kernel build. Also the following files need to be copied from build to test machine:
-
from the source tree:
- all C source files + headers
-
from the build tree:
-
all C source files + headers
-
all .gcda and .gcno files
-
all links to directories
-
It is important to note that these files need to be placed into the exact same file system location on the test machine as on the build machine. If any of the path components is symbolic link, the actual directory needs to be used instead (due to make's CURDIR handling).
-
-
b) gcov is run on the BUILD machine
The following files need to be copied after each test case from test to build machine:
-
from the gcov directory in sysfs:
-
all .gcda files
-
all links to .gcno files
-
These files can be copied to any location on the build machine. gcov must then be called with the -o option pointing to that directory.
Example directory setup on the build machine:
/tmp/linux: kernel source tree /tmp/out: kernel build directory as specified by make O= /tmp/coverage: location of the files copied from the test machine [user@build] cd /tmp/out [user@build] gcov -o /tmp/coverage/tmp/out/init main.c -
Note on compilers #
GCC and LLVM gcov tools are not necessarily compatible. Use gcov to work with GCC-generated .gcno and .gcda files, and use llvm-cov for Clang.
Build differences between GCC and Clang gcov are handled by Kconfig. It automatically selects the appropriate gcov format depending on the detected toolchain.
Troubleshooting #
-
Problem
Compilation aborts during linker step.
-
Cause
Profiling flags are specified for source files which are not linked to the main kernel or which are linked by a custom linker procedure.
-
Solution
Exclude affected source files from profiling by specifying
GCOV_PROFILE := norGCOV_PROFILE_basename.o := nin the corresponding Makefile. -
Problem
Files copied from sysfs appear empty or incomplete.
-
Cause
Due to the way seq_file works, some tools such as cp or tar may not correctly copy files from sysfs.
-
Solution
Use
catto read.gcdafiles andcp -dto copy links. Alternatively use the mechanism shown in Appendix B.
Appendix A: gather_on_build.sh #
Sample script to gather coverage meta files on the build machine (see Separated build and test machines a.):
#!/bin/bash
KSRC=
KOBJ=
DEST=
if [ || [ || [; then
fi
KSRC=
KOBJ=
|
if [ ; then
else
fi
Appendix B: gather_on_test.sh #
Sample script to gather coverage data files on the test machine (see Separated build and test machines b.):
#!/bin/bash -e
DEST=
GCDA=/sys/kernel/debug/gcov
if [ ; then
fi
TEMPDIR=
Linux Kernel GPIO based sloppy logic analyzer
Peios Kernel / Kernel development / Development tools
Author: Wolfram Sang
Introduction #
This document briefly describes how to run the GPIO based in-kernel sloppy logic analyzer running on an isolated CPU.
The sloppy logic analyzer will utilize a few GPIO lines in input mode on a system to rapidly sample these digital lines, which will, if the Nyquist criteria is met, result in a time series log with approximate waveforms as they appeared on these lines. One way to use it is to analyze external traffic connected to these GPIO lines with wires (i.e. digital probes), acting as a common logic analyzer.
Another feature is to snoop on on-chip peripherals if the I/O cells of these peripherals can be used in GPIO input mode at the same time as they are being used as inputs or outputs for the peripheral. That means you could e.g. snoop I2C traffic without any wiring (if your hardware supports it). In the pin control subsystem such pin controllers are called "non-strict": a certain pin can be used with a certain peripheral and as a GPIO input line at the same time.
Note that this is a last resort analyzer which can be affected by latencies, non-deterministic code paths and non-maskable interrupts. It is called 'sloppy' for a reason. However, for e.g. remote development, it may be useful to get a first view and aid further debugging.
Setup #
Your kernel must have CONFIG_DEBUG_FS and CONFIG_CPUSETS enabled. Ideally, your runtime environment does not utilize cpusets otherwise, then isolation of a CPU core is easiest. If you do need cpusets, check that helper script for the sloppy logic analyzer does not interfere with your other settings.
Tell the kernel which GPIOs are used as probes. For a Device Tree based system, you need to use the following bindings. Because these bindings are only for debugging, there is no official schema:
i2c-analyzer {
compatible = "gpio-sloppy-logic-analyzer";
probe-gpios = <&gpio6 21 GPIO_OPEN_DRAIN>, <&gpio6 4 GPIO_OPEN_DRAIN>;
probe-names = "SCL", "SDA";
};
Note that you must provide a name for every GPIO specified. Currently a maximum of 8 probes are supported. 32 are likely possible but are not implemented yet.
Usage #
The logic analyzer is configurable via files in debugfs. However, it is strongly recommended to not use them directly, but to use the script tools/gpio/gpio-sloppy-logic-analyzer. Besides checking parameters more extensively, it will isolate the CPU core so you will have the least disturbance while measuring.
The script has a help option explaining the parameters. For the above DT snippet which analyzes an I2C bus at 400kHz on a Renesas Salvator-XS board, the following settings are used: The isolated CPU shall be CPU1 because it is a big core in a big.LITTLE setup. Because CPU1 is the default, we don't need a parameter. The bus speed is 400kHz. So, the sampling theorem says we need to sample at least at 800kHz. However, falling edges of both signals in an I2C start condition happen faster, so we need a higher sampling frequency, e.g. -s 1500000 for 1.5MHz. Also, we don't want to sample right away but wait for a start condition on an idle bus. So, we need to set a trigger to a falling edge on SDA while SCL stays high, i.e. -t 1H+2F. Last is the duration, let us assume 15ms here which results in the parameter -d 15000. So, altogether:
gpio-sloppy-logic-analyzer -s 1500000 -t 1H+2F -d 15000
Note that the process will return you back to the prompt but a sub-process is still sampling in the background. Unless this has finished, you will not find a result file in the current or specified directory. For the above example, we will then need to trigger I2C communication:
i2cdetect -y -r <your bus number>
Result is a .sr file to be consumed with PulseView or sigrok-cli from the free sigrok project. It is a zip file which also contains the binary sample data which may be consumed by other software. The filename is the logic analyzer instance name plus a since-epoch timestamp.
Kernel Address Sanitizer (KASAN)
Peios Kernel / Kernel development / Development tools
Overview #
Kernel Address Sanitizer (KASAN) is a dynamic memory safety error detector designed to find out-of-bounds and use-after-free bugs.
KASAN has three modes:
-
Generic KASAN
-
Software Tag-Based KASAN
-
Hardware Tag-Based KASAN
Generic KASAN, enabled with CONFIG_KASAN_GENERIC, is the mode intended for debugging, similar to userspace ASan. This mode is supported on many CPU architectures, but it has significant performance and memory overheads.
Software Tag-Based KASAN or SW_TAGS KASAN, enabled with CONFIG_KASAN_SW_TAGS, can be used for both debugging and dogfood testing, similar to userspace HWASan. This mode is only supported for arm64, but its moderate memory overhead allows using it for testing on memory-restricted devices with real workloads.
Hardware Tag-Based KASAN or HW_TAGS KASAN, enabled with CONFIG_KASAN_HW_TAGS, is the mode intended to be used as an in-field memory bug detector or as a security mitigation. This mode only works on arm64 CPUs that support MTE (Memory Tagging Extension), but it has low memory and performance overheads and thus can be used in production.
For details about the memory and performance impact of each KASAN mode, see the descriptions of the corresponding Kconfig options.
The Generic and the Software Tag-Based modes are commonly referred to as the software modes. The Software Tag-Based and the Hardware Tag-Based modes are referred to as the tag-based modes.
Support #
Architectures #
Generic KASAN is supported on x86_64, arm, arm64, powerpc, riscv, s390, xtensa, and loongarch, and the tag-based KASAN modes are supported only on arm64.
Compilers #
Software KASAN modes use compile-time instrumentation to insert validity checks before every memory access and thus require a compiler version that provides support for that. The Hardware Tag-Based mode relies on hardware to perform these checks but still requires a compiler version that supports the memory tagging instructions.
Generic KASAN requires GCC version 8.3.0 or later or any Clang version supported by the kernel.
Software Tag-Based KASAN requires GCC 11+ or any Clang version supported by the kernel.
Hardware Tag-Based KASAN requires GCC 10+ or Clang 12+.
Memory types #
Generic KASAN supports finding bugs in all of slab, page_alloc, vmap, vmalloc, stack, and global memory.
Software Tag-Based KASAN supports slab, page_alloc, vmalloc, and stack memory.
Hardware Tag-Based KASAN supports slab, page_alloc, and non-executable vmalloc memory.
For slab, both software KASAN modes support SLUB and SLAB allocators, while Hardware Tag-Based KASAN only supports SLUB.
Usage #
To enable KASAN, configure the kernel with:
CONFIG_KASAN=y
and choose between CONFIG_KASAN_GENERIC (to enable Generic KASAN), CONFIG_KASAN_SW_TAGS (to enable Software Tag-Based KASAN), and CONFIG_KASAN_HW_TAGS (to enable Hardware Tag-Based KASAN).
For the software modes, also choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline and inline are compiler instrumentation types. The former produces a smaller binary while the latter is up to 2 times faster.
To include alloc and free stack traces of affected slab objects into reports, enable CONFIG_STACKTRACE. To include alloc and free stack traces of affected physical pages, enable CONFIG_PAGE_OWNER and boot with page_owner=on.
Boot parameters #
KASAN is affected by the generic panic_on_warn command line parameter. When it is enabled, KASAN panics the kernel after printing a bug report.
By default, KASAN prints a bug report only for the first invalid memory access. With kasan_multi_shot, KASAN prints a report on every invalid access. This effectively disables panic_on_warn for KASAN reports.
Alternatively, independent of panic_on_warn, the kasan.fault= boot parameter can be used to control panic and reporting behaviour:
kasan.fault=report,=panic, or=panic_on_writecontrols whether to only print a KASAN report, panic the kernel, or panic the kernel on invalid writes only (default:report). The panic happens even ifkasan_multi_shotis enabled. Note that when using asynchronous mode of Hardware Tag-Based KASAN,kasan.fault=panic_on_writealways panics on asynchronously checked accesses (including reads).
Software and Hardware Tag-Based KASAN modes (see the section about various modes below) support altering stack trace collection behavior:
-
kasan.stacktrace=offor=ondisables or enables alloc and free stack traces collection (default:on). -
kasan.stack_ring_size=<number of entries>specifies the number of entries in the stack ring (default:32768).
Hardware Tag-Based KASAN mode is intended for use in production as a security mitigation. Therefore, it supports additional boot parameters that allow disabling KASAN altogether or controlling its features:
-
kasan=offor=oncontrols whether KASAN is enabled (default:on). -
kasan.mode=sync,=asyncor=asymmcontrols whether KASAN is configured in synchronous, asynchronous or asymmetric mode of execution (default:sync). Synchronous mode: a bad access is detected immediately when a tag check fault occurs. Asynchronous mode: a bad access detection is delayed. When a tag check fault occurs, the information is stored in hardware (in the TFSR_EL1 register for arm64). The kernel periodically checks the hardware and only reports tag faults during these checks. Asymmetric mode: a bad access is detected synchronously on reads and asynchronously on writes. -
kasan.write_only=offorkasan.write_only=oncontrols whether KASAN checks the write (store) accesses only or all accesses (default:off). -
kasan.vmalloc=offor=ondisables or enables tagging of vmalloc allocations (default:on). -
kasan.page_alloc.sample=<sampling interval>makes KASAN tag only every Nth page_alloc allocation with the order equal or greater thankasan.page_alloc.sample.order, where N is the value of thesampleparameter (default:1, or tag every such allocation). This parameter is intended to mitigate the performance overhead introduced by KASAN. Note that enabling this parameter makes Hardware Tag-Based KASAN skip checks of allocations chosen by sampling and thus miss bad accesses to these allocations. Use the default value for accurate bug detection. -
kasan.page_alloc.sample.order=<minimum page order>specifies the minimum order of allocations that are affected by sampling (default:3). Only applies whenkasan.page_alloc.sampleis set to a value greater than1. This parameter is intended to allow sampling only large page_alloc allocations, which is the biggest source of the performance overhead.
Error reports #
A typical KASAN report looks like this:
==================================================================
BUG: KASAN: slab-out-of-bounds in kmalloc_oob_right+0xa8/0xbc [kasan_test]
Write of size 1 at addr ffff8801f44ec37b by task insmod/2760
CPU: 1 PID: 2760 Comm: insmod Not tainted 4.19.0-rc3+ #698
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
Call Trace:
dump_stack+0x94/0xd8
print_address_description+0x73/0x280
kasan_report+0x144/0x187
__asan_report_store1_noabort+0x17/0x20
kmalloc_oob_right+0xa8/0xbc [kasan_test]
kmalloc_tests_init+0x16/0x700 [kasan_test]
do_one_initcall+0xa5/0x3ae
do_init_module+0x1b6/0x547
load_module+0x75df/0x8070
__do_sys_init_module+0x1c6/0x200
__x64_sys_init_module+0x6e/0xb0
do_syscall_64+0x9f/0x2c0
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f96443109da
RSP: 002b:00007ffcf0b51b08 EFLAGS: 00000202 ORIG_RAX: 00000000000000af
RAX: ffffffffffffffda RBX: 000055dc3ee521a0 RCX: 00007f96443109da
RDX: 00007f96445cff88 RSI: 0000000000057a50 RDI: 00007f9644992000
RBP: 000055dc3ee510b0 R08: 0000000000000003 R09: 0000000000000000
R10: 00007f964430cd0a R11: 0000000000000202 R12: 00007f96445cff88
R13: 000055dc3ee51090 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 2760:
save_stack+0x43/0xd0
kasan_kmalloc+0xa7/0xd0
kmem_cache_alloc_trace+0xe1/0x1b0
kmalloc_oob_right+0x56/0xbc [kasan_test]
kmalloc_tests_init+0x16/0x700 [kasan_test]
do_one_initcall+0xa5/0x3ae
do_init_module+0x1b6/0x547
load_module+0x75df/0x8070
__do_sys_init_module+0x1c6/0x200
__x64_sys_init_module+0x6e/0xb0
do_syscall_64+0x9f/0x2c0
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Freed by task 815:
save_stack+0x43/0xd0
__kasan_slab_free+0x135/0x190
kasan_slab_free+0xe/0x10
kfree+0x93/0x1a0
umh_complete+0x6a/0xa0
call_usermodehelper_exec_async+0x4c3/0x640
ret_from_fork+0x35/0x40
The buggy address belongs to the object at ffff8801f44ec300
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 123 bytes inside of
128-byte region [ffff8801f44ec300, ffff8801f44ec380)
The buggy address belongs to the page:
page:ffffea0007d13b00 count:1 mapcount:0 mapping:ffff8801f7001640 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffffea0007d11dc0 0000001a0000001a ffff8801f7001640
raw: 0000000000000000 0000000080150015 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8801f44ec200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8801f44ec280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8801f44ec300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
^
ffff8801f44ec380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8801f44ec400: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
The report header summarizes what kind of bug happened and what kind of access caused it. It is followed by a stack trace of the bad access, a stack trace of where the accessed memory was allocated (in case a slab object was accessed), and a stack trace of where the object was freed (in case of a use-after-free bug report). Next comes a description of the accessed slab object and the information about the accessed memory page.
In the end, the report shows the memory state around the accessed address. Internally, KASAN tracks memory state separately for each memory granule, which is either 8 or 16 aligned bytes depending on KASAN mode. Each number in the memory state section of the report shows the state of one of the memory granules that surround the accessed address.
For Generic KASAN, the size of each memory granule is 8. The state of each granule is encoded in one shadow byte. Those 8 bytes can be accessible, partially accessible, freed, or be a part of a redzone. KASAN uses the following encoding for each shadow byte: 00 means that all 8 bytes of the corresponding memory region are accessible; number N (1 <= N <= 7) means that the first N bytes are accessible, and other (8 - N) bytes are not; any negative value indicates that the entire 8-byte word is inaccessible. KASAN uses different negative values to distinguish between different kinds of inaccessible memory like redzones or freed memory (see mm/kasan/kasan.h).
In the report above, the arrow points to the shadow byte 03, which means that the accessed address is partially accessible.
For tag-based KASAN modes, this last report section shows the memory tags around the accessed address (see the Implementation details section).
Note that KASAN bug titles (like slab-out-of-bounds or use-after-free) are best-effort: KASAN prints the most probable bug type based on the limited information it has. The actual type of the bug might be different.
Generic KASAN also reports up to two auxiliary call stack traces. These stack traces point to places in code that interacted with the object but that are not directly present in the bad access stack trace. Currently, this includes call_rcu() and workqueue queuing.
CONFIG_KASAN_EXTRA_INFO #
Enabling CONFIG_KASAN_EXTRA_INFO allows KASAN to record and report more information. The extra information currently supported is the CPU number and timestamp at allocation and free. More information can help find the cause of the bug and correlate the error with other system events, at the cost of using extra memory to record more information (more cost details in the help text of CONFIG_KASAN_EXTRA_INFO).
Here is the report with CONFIG_KASAN_EXTRA_INFO enabled (only the different parts are shown):
==================================================================
...
Allocated by task 134 on cpu 5 at 229.133855s:
...
Freed by task 136 on cpu 3 at 230.199335s:
...
==================================================================
Implementation details #
Generic KASAN #
Software KASAN modes use shadow memory to record whether each byte of memory is safe to access and use compile-time instrumentation to insert shadow memory checks before each memory access.
Generic KASAN dedicates 1/8th of kernel memory to its shadow memory (16TB to cover 128TB on x86_64) and uses direct mapping with a scale and offset to translate a memory address to its corresponding shadow address.
Here is the function which translates an address to its corresponding shadow address:
static inline void *kasan_mem_to_shadow(const void *addr)
{
return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
+ KASAN_SHADOW_OFFSET;
}
where KASAN_SHADOW_SCALE_SHIFT = 3.
Compile-time instrumentation is used to insert memory access checks. Compiler inserts function calls (__asan_load*(addr), __asan_store*(addr)) before each memory access of size 1, 2, 4, 8, or 16. These functions check whether memory accesses are valid or not by checking corresponding shadow memory.
With inline instrumentation, instead of making function calls, the compiler directly inserts the code to check shadow memory. This option significantly enlarges the kernel, but it gives an x1.1-x2 performance boost over the outline-instrumented kernel.
Generic KASAN is the only mode that delays the reuse of freed objects via quarantine (see mm/kasan/quarantine.c for implementation).
Software Tag-Based KASAN #
Software Tag-Based KASAN uses a software memory tagging approach to checking access validity. It is currently only implemented for the arm64 architecture.
Software Tag-Based KASAN uses the Top Byte Ignore (TBI) feature of arm64 CPUs to store a pointer tag in the top byte of kernel pointers. It uses shadow memory to store memory tags associated with each 16-byte memory cell (therefore, it dedicates 1/16th of the kernel memory for shadow memory).
On each memory allocation, Software Tag-Based KASAN generates a random tag, tags the allocated memory with this tag, and embeds the same tag into the returned pointer.
Software Tag-Based KASAN uses compile-time instrumentation to insert checks before each memory access. These checks make sure that the tag of the memory that is being accessed is equal to the tag of the pointer that is used to access this memory. In case of a tag mismatch, Software Tag-Based KASAN prints a bug report.
Software Tag-Based KASAN also has two instrumentation modes (outline, which emits callbacks to check memory accesses; and inline, which performs the shadow memory checks inline). With outline instrumentation mode, a bug report is printed from the function that performs the access check. With inline instrumentation, a brk instruction is emitted by the compiler, and a dedicated brk handler is used to print bug reports.
Software Tag-Based KASAN uses 0xFF as a match-all pointer tag (accesses through pointers with the 0xFF pointer tag are not checked). The value 0xFE is currently reserved to tag freed memory regions.
Hardware Tag-Based KASAN #
Hardware Tag-Based KASAN is similar to the software mode in concept but uses hardware memory tagging support instead of compiler instrumentation and shadow memory.
Hardware Tag-Based KASAN is currently only implemented for arm64 architecture and based on both arm64 Memory Tagging Extension (MTE) introduced in ARMv8.5 Instruction Set Architecture and Top Byte Ignore (TBI).
Special arm64 instructions are used to assign memory tags for each allocation. Same tags are assigned to pointers to those allocations. On every memory access, hardware makes sure that the tag of the memory that is being accessed is equal to the tag of the pointer that is used to access this memory. In case of a tag mismatch, a fault is generated, and a report is printed.
Hardware Tag-Based KASAN uses 0xFF as a match-all pointer tag (accesses through pointers with the 0xFF pointer tag are not checked). The value 0xFE is currently reserved to tag freed memory regions.
If the hardware does not support MTE (pre ARMv8.5), Hardware Tag-Based KASAN will not be enabled. In this case, all KASAN boot parameters are ignored.
Note that enabling CONFIG_KASAN_HW_TAGS always results in in-kernel TBI being enabled. Even when kasan.mode=off is provided or when the hardware does not support MTE (but supports TBI).
Hardware Tag-Based KASAN only reports the first found bug. After that, MTE tag checking gets disabled.
Shadow memory #
The contents of this section are only applicable to software KASAN modes.
The kernel maps memory in several different parts of the address space. The range of kernel virtual addresses is large: there is not enough real memory to support a real shadow region for every address that could be accessed by the kernel. Therefore, KASAN only maps real shadow for certain parts of the address space.
Default behaviour #
By default, architectures only map real memory over the shadow region for the linear mapping (and potentially other small areas). For all other areas - such as vmalloc and vmemmap space - a single read-only page is mapped over the shadow area. This read-only shadow page declares all memory accesses as permitted.
This presents a problem for modules: they do not live in the linear mapping but in a dedicated module space. By hooking into the module allocator, KASAN temporarily maps real shadow memory to cover them. This allows detection of invalid accesses to module globals, for example.
This also creates an incompatibility with VMAP_STACK: if the stack lives in vmalloc space, it will be shadowed by the read-only page, and the kernel will fault when trying to set up the shadow data for stack variables.
CONFIG_KASAN_VMALLOC #
With CONFIG_KASAN_VMALLOC, KASAN can cover vmalloc space at the cost of greater memory usage. Currently, this is supported on x86, arm64, riscv, s390, and powerpc.
This works by hooking into vmalloc and vmap and dynamically allocating real shadow memory to back the mappings.
Most mappings in vmalloc space are small, requiring less than a full page of shadow space. Allocating a full shadow page per mapping would therefore be wasteful. Furthermore, to ensure that different mappings use different shadow pages, mappings would have to be aligned to KASAN_GRANULE_SIZE * PAGE_SIZE.
Instead, KASAN shares backing space across multiple mappings. It allocates a backing page when a mapping in vmalloc space uses a particular page of the shadow region. This page can be shared by other vmalloc mappings later on.
KASAN hooks into the vmap infrastructure to lazily clean up unused shadow memory.
To avoid the difficulties around swapping mappings around, KASAN expects that the part of the shadow region that covers the vmalloc space will not be covered by the early shadow page but will be left unmapped. This will require changes in arch-specific code.
This allows VMAP_STACK support on x86 and can simplify support of architectures that do not have a fixed module region.
For developers #
Ignoring accesses #
Software KASAN modes use compiler instrumentation to insert validity checks. Such instrumentation might be incompatible with some parts of the kernel, and therefore needs to be disabled.
Other parts of the kernel might access metadata for allocated objects. Normally, KASAN detects and reports such accesses, but in some cases (e.g., in memory allocators), these accesses are valid.
For software KASAN modes, to disable instrumentation for a specific file or directory, add a KASAN_SANITIZE annotation to the respective kernel Makefile:
-
For a single file (e.g., main.o):
KASAN_SANITIZE_main.o := n -
For all files in one directory:
KASAN_SANITIZE := n
For software KASAN modes, to disable instrumentation on a per-function basis, use the KASAN-specific __no_sanitize_address function attribute or the generic noinstr one.
Note that disabling compiler instrumentation (either on a per-file or a per-function basis) makes KASAN ignore the accesses that happen directly in that code for software KASAN modes. It does not help when the accesses happen indirectly (through calls to instrumented functions) or with Hardware Tag-Based KASAN, which does not use compiler instrumentation.
For software KASAN modes, to disable KASAN reports in a part of the kernel code for the current task, annotate this part of the code with a kasan_disable_current()/kasan_enable_current() section. This also disables the reports for indirect accesses that happen through function calls.
For tag-based KASAN modes, to disable access checking, use kasan_reset_tag() or page_kasan_tag_reset(). Note that temporarily disabling access checking via page_kasan_tag_reset() requires saving and restoring the per-page KASAN tag via page_kasan_tag/page_kasan_tag_set.
Tests #
There are KASAN tests that allow verifying that KASAN works and can detect certain types of memory corruptions.
All KASAN tests are integrated with the KUnit Test Framework and can be enabled via CONFIG_KASAN_KUNIT_TEST. The tests can be run and partially verified automatically in a few different ways; see the instructions below.
Each KASAN test prints one of multiple KASAN reports if an error is detected. Then the test prints its number and status.
When a test passes:
ok 28 - kmalloc_double_kzfree
When a test fails due to a failed kmalloc:
# kmalloc_large_oob_right: ASSERTION FAILED at mm/kasan/kasan_test.c:245
Expected ptr is not null, but is
not ok 5 - kmalloc_large_oob_right
When a test fails due to a missing KASAN report:
# kmalloc_double_kzfree: EXPECTATION FAILED at mm/kasan/kasan_test.c:709
KASAN failure expected in "kfree_sensitive(ptr)", but none occurred
not ok 28 - kmalloc_double_kzfree
At the end the cumulative status of all KASAN tests is printed. On success:
ok 1 - kasan
Or, if one of the tests failed:
not ok 1 - kasan
There are a few ways to run the KASAN tests.
-
Loadable module
With
CONFIG_KUNITenabled, the tests can be built as a loadable module and run by loadingkasan_test.kowithinsmodormodprobe. -
Built-In
With
CONFIG_KUNITbuilt-in, the tests can be built-in as well. In this case, the tests will run at boot as a late-init call. -
Using kunit_tool
With
CONFIG_KUNITandCONFIG_KASAN_KUNIT_TESTbuilt-in, it is also possible to usekunit_toolto see the results of KUnit tests in a more readable way. This will not print the KASAN reports of the tests that passed. See KUnit documentation for more up-to-date information onkunit_tool.
KCOV: code coverage for fuzzing
Peios Kernel / Kernel development / Development tools
KCOV collects and exposes kernel code coverage information in a form suitable for coverage-guided fuzzing. Coverage data of a running kernel is exported via the kcov debugfs file. Coverage collection is enabled on a task basis, and thus KCOV can capture precise coverage of a single system call.
Note that KCOV does not aim to collect as much coverage as possible. It aims to collect more or less stable coverage that is a function of syscall inputs. To achieve this goal, it does not collect coverage in soft/hard interrupts (unless remove coverage collection is enabled, see below) and from some inherently non-deterministic parts of the kernel (e.g. scheduler, locking).
Besides collecting code coverage, KCOV can also collect comparison operands. See the "Comparison operands collection" section for details.
Besides collecting coverage data from syscall handlers, KCOV can also collect coverage for annotated parts of the kernel executing in background kernel tasks or soft interrupts. See the "Remote coverage collection" section for details.
Prerequisites #
KCOV relies on compiler instrumentation and requires GCC 6.1.0 or later or any Clang version supported by the kernel.
Collecting comparison operands is supported with GCC 8+ or with Clang.
To enable KCOV, configure the kernel with:
CONFIG_KCOV=y
To enable comparison operands collection, set:
CONFIG_KCOV_ENABLE_COMPARISONS=y
Coverage data only becomes accessible once debugfs has been mounted:
mount -t debugfs none /sys/kernel/debug
Coverage collection #
The following program demonstrates how to use KCOV to collect coverage for a single syscall from within a test program:
int
After piping through addr2line the output of the program looks as follows:
SyS_read
fs/read_write.c:562
__fdget_pos
fs/file.c:774
__fget_light
fs/file.c:746
__fget_light
fs/file.c:750
__fget_light
fs/file.c:760
__fdget_pos
fs/file.c:784
SyS_read
fs/read_write.c:562
If a program needs to collect coverage from several threads (independently), it needs to open /sys/kernel/debug/kcov in each thread separately.
The interface is fine-grained to allow efficient forking of test processes. That is, a parent process opens /sys/kernel/debug/kcov, enables trace mode, mmaps coverage buffer, and then forks child processes in a loop. The child processes only need to enable coverage (it gets disabled automatically when a thread exits).
Comparison operands collection #
Comparison operands collection is similar to coverage collection:
/* Same includes and defines as above. */
/* Number of 64-bit words per record. */
/*
* The format for the types of collected comparisons.
*
* Bit 0 shows whether one of the arguments is a compile-time constant.
* Bits 1 & 2 contain log2 of the argument size, up to 8 bytes.
*/
int
Note that the KCOV modes (collection of code coverage or comparison operands) are mutually exclusive.
Remote coverage collection #
Besides collecting coverage data from handlers of syscalls issued from a userspace process, KCOV can also collect coverage for parts of the kernel executing in other contexts - so-called "remote" coverage.
Using KCOV to collect remote coverage requires:
-
Modifying kernel code to annotate the code section from where coverage should be collected with
kcov_remote_startandkcov_remote_stop. -
Using
KCOV_REMOTE_ENABLEinstead ofKCOV_ENABLEin the userspace process that collects coverage.
Both kcov_remote_start and kcov_remote_stop annotations and the KCOV_REMOTE_ENABLE ioctl accept handles that identify particular coverage collection sections. The way a handle is used depends on the context where the matching code section executes.
KCOV supports collecting remote coverage from the following contexts:
-
Global kernel background tasks. These are the tasks that are spawned during kernel boot in a limited number of instances (e.g. one USB
hub_eventworker is spawned per one USB HCD). -
Local kernel background tasks. These are spawned when a userspace process interacts with some kernel interface and are usually killed when the process exits (e.g. vhost workers).
-
Soft interrupts.
For #1 and #3, a unique global handle must be chosen and passed to the corresponding kcov_remote_start call. Then a userspace process must pass this handle to KCOV_REMOTE_ENABLE in the handles array field of the kcov_remote_arg struct. This will attach the used KCOV device to the code section referenced by this handle. Multiple global handles identifying different code sections can be passed at once.
For #2, the userspace process instead must pass a non-zero handle through the common_handle field of the kcov_remote_arg struct. This common handle gets saved to the kcov_handle field in the current task_struct and needs to be passed to the newly spawned local tasks via custom kernel code modifications. Those tasks should in turn use the passed handle in their kcov_remote_start and kcov_remote_stop annotations.
KCOV follows a predefined format for both global and common handles. Each handle is a u64 integer. Currently, only the one top and the lower 4 bytes are used. Bytes 4-7 are reserved and must be zero.
For global handles, the top byte of the handle denotes the id of a subsystem this handle belongs to. For example, KCOV uses 1 as the USB subsystem id. The lower 4 bytes of a global handle denote the id of a task instance within that subsystem. For example, each hub_event worker uses the USB bus number as the task instance id.
For common handles, a reserved value 0 is used as a subsystem id, as such handles don't belong to a particular subsystem. The lower 4 bytes of a common handle identify a collective instance of all local tasks spawned by the userspace process that passed a common handle to KCOV_REMOTE_ENABLE.
In practice, any value can be used for common handle instance id if coverage is only collected from a single userspace process on the system. However, if common handles are used by multiple processes, unique instance ids must be used for each process. One option is to use the process id as the common handle instance id.
The following program demonstrates using KCOV to collect coverage from both local tasks spawned by the process and the global task that handles USB bus #1:
/* Same includes and defines as above. */
;
static inline __u64
int
Kernel Concurrency Sanitizer (KCSAN)
Peios Kernel / Kernel development / Development tools
The Kernel Concurrency Sanitizer (KCSAN) is a dynamic race detector, which relies on compile-time instrumentation, and uses a watchpoint-based sampling approach to detect races. KCSAN's primary purpose is to detect data races.
Usage #
KCSAN is supported by both GCC and Clang. With GCC we require version 11 or later, and with Clang also require version 11 or later.
To enable KCSAN configure the kernel with:
CONFIG_KCSAN = y
KCSAN provides several other configuration options to customize behaviour (see the respective help text in lib/Kconfig.kcsan for more info).
Error reports #
A typical data race report looks like this:
==================================================================
BUG: KCSAN: data-race in test_kernel_read / test_kernel_write
write to 0xffffffffc009a628 of 8 bytes by task 487 on cpu 0:
test_kernel_write+0x1d/0x30
access_thread+0x89/0xd0
kthread+0x23e/0x260
ret_from_fork+0x22/0x30
read to 0xffffffffc009a628 of 8 bytes by task 488 on cpu 6:
test_kernel_read+0x10/0x20
access_thread+0x89/0xd0
kthread+0x23e/0x260
ret_from_fork+0x22/0x30
value changed: 0x00000000000009a6 -> 0x00000000000009b2
Reported by Kernel Concurrency Sanitizer on:
CPU: 6 PID: 488 Comm: access_thread Not tainted 5.12.0-rc2+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
==================================================================
The header of the report provides a short summary of the functions involved in the race. It is followed by the access types and stack traces of the 2 threads involved in the data race. If KCSAN also observed a value change, the observed old value and new value are shown on the "value changed" line respectively.
The other less common type of data race report looks like this:
==================================================================
BUG: KCSAN: data-race in test_kernel_rmw_array+0x71/0xd0
race at unknown origin, with read to 0xffffffffc009bdb0 of 8 bytes by task 515 on cpu 2:
test_kernel_rmw_array+0x71/0xd0
access_thread+0x89/0xd0
kthread+0x23e/0x260
ret_from_fork+0x22/0x30
value changed: 0x0000000000002328 -> 0x0000000000002329
Reported by Kernel Concurrency Sanitizer on:
CPU: 2 PID: 515 Comm: access_thread Not tainted 5.12.0-rc2+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
==================================================================
This report is generated where it was not possible to determine the other racing thread, but a race was inferred due to the data value of the watched memory location having changed. These reports always show a "value changed" line. A common reason for reports of this type are missing instrumentation in the racing thread, but could also occur due to e.g. DMA accesses. Such reports are shown only if CONFIG_KCSAN_REPORT_RACE_UNKNOWN_ORIGIN=y, which is enabled by default.
Selective analysis #
It may be desirable to disable data race detection for specific accesses, functions, compilation units, or entire subsystems. For static blacklisting, the below options are available:
-
KCSAN understands the
data_race(expr)annotation, which tells KCSAN that any data races due to accesses inexprshould be ignored and resulting behaviour when encountering a data race is deemed safe. Please see "Marking Shared-Memory Accesses" in the LKMM for more information. -
Similar to
data_race(...), the type qualifier__data_racycan be used to document that all data races due to accesses to a variable are intended and should be ignored by KCSAN:struct foo { ... int __data_racy stats_counter; ... }; -
Disabling data race detection for entire functions can be accomplished by using the function attribute
__no_kcsan:__no_kcsan void foo(void) { ...To dynamically limit for which functions to generate reports, see the DebugFS interface blacklist/whitelist feature.
-
To disable data race detection for a particular compilation unit, add to the
Makefile:KCSAN_SANITIZE_file.o := n -
To disable data race detection for all compilation units listed in a
Makefile, add to the respectiveMakefile:KCSAN_SANITIZE := n
Furthermore, it is possible to tell KCSAN to show or hide entire classes of data races, depending on preferences. These can be changed via the following Kconfig options:
-
CONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY: If enabled and a conflicting write is observed via a watchpoint, but the data value of the memory location was observed to remain unchanged, do not report the data race. -
CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC: Assume that plain aligned writes up to word size are atomic by default. Assumes that such writes are not subject to unsafe compiler optimizations resulting in data races. The option causes KCSAN to not report data races due to conflicts where the only plain accesses are aligned writes up to word size. -
CONFIG_KCSAN_PERMISSIVE: Enable additional permissive rules to ignore certain classes of common data races. Unlike the above, the rules are more complex involving value-change patterns, access type, and address. This option depends onCONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY=y. For details please see thekernel/kcsan/permissive.h. Testers and maintainers that only focus on reports from specific subsystems and not the whole kernel are recommended to disable this option.
To use the strictest possible rules, select CONFIG_KCSAN_STRICT=y, which configures KCSAN to follow the Linux-kernel memory consistency model (LKMM) as closely as possible.
DebugFS interface #
The file /sys/kernel/debug/kcsan provides the following interface:
-
Reading
/sys/kernel/debug/kcsanreturns various runtime statistics. -
Writing
onoroffto/sys/kernel/debug/kcsanallows turning KCSAN on or off, respectively. -
Writing
!some_func_nameto/sys/kernel/debug/kcsanaddssome_func_nameto the report filter list, which (by default) blacklists reporting data races where either one of the top stackframes are a function in the list. -
Writing either
blacklistorwhitelistto/sys/kernel/debug/kcsanchanges the report filtering behaviour. For example, the blacklist feature can be used to silence frequently occurring data races; the whitelist feature can help with reproduction and testing of fixes.
Tuning performance #
Core parameters that affect KCSAN's overall performance and bug detection ability are exposed as kernel command-line arguments whose defaults can also be changed via the corresponding Kconfig options.
-
kcsan.skip_watch(CONFIG_KCSAN_SKIP_WATCH): Number of per-CPU memory operations to skip, before another watchpoint is set up. Setting up watchpoints more frequently will result in the likelihood of races to be observed to increase. This parameter has the most significant impact on overall system performance and race detection ability. -
kcsan.udelay_task(CONFIG_KCSAN_UDELAY_TASK): For tasks, the microsecond delay to stall execution after a watchpoint has been set up. Larger values result in the window in which we may observe a race to increase. -
kcsan.udelay_interrupt(CONFIG_KCSAN_UDELAY_INTERRUPT): For interrupts, the microsecond delay to stall execution after a watchpoint has been set up. Interrupts have tighter latency requirements, and their delay should generally be smaller than the one chosen for tasks.
They may be tweaked at runtime via /sys/module/kcsan/parameters/.
Data Races #
In an execution, two memory accesses form a data race if they conflict, they happen concurrently in different threads, and at least one of them is a plain access; they conflict if both access the same memory location, and at least one is a write. For a more thorough discussion and definition, see "Plain Accesses and Data Races" in the LKMM.
Relationship with the Linux-Kernel Memory Consistency Model (LKMM) #
The LKMM defines the propagation and ordering rules of various memory operations, which gives developers the ability to reason about concurrent code. Ultimately this allows to determine the possible executions of concurrent code, and if that code is free from data races.
KCSAN is aware of marked atomic operations (READ_ONCE, WRITE_ONCE, atomic_*, etc.), and a subset of ordering guarantees implied by memory barriers. With CONFIG_KCSAN_WEAK_MEMORY=y, KCSAN models load or store buffering, and can detect missing smp_mb(), smp_wmb(), smp_rmb(), smp_store_release(), and all atomic_* operations with equivalent implied barriers.
Note, KCSAN will not report all data races due to missing memory ordering, specifically where a memory barrier would be required to prohibit subsequent memory operation from reordering before the barrier. Developers should therefore carefully consider the required memory ordering requirements that remain unchecked.
Race Detection Beyond Data Races #
For code with complex concurrency design, race-condition bugs may not always manifest as data races. Race conditions occur if concurrently executing operations result in unexpected system behaviour. On the other hand, data races are defined at the C-language level. The following macros can be used to check properties of concurrent code where bugs would not manifest as data races.
ASSERT_EXCLUSIVE_WRITER() #
assert no concurrent writes to var
Parameters
var: variable to assert on
Description
Assert that there are no concurrent writes to var; other readers are allowed. This assertion can be used to specify properties of concurrent code, where violation cannot be detected as a normal data race.
For example, if we only have a single writer, but multiple concurrent readers, to avoid data races, all these accesses must be marked; even concurrent marked writes racing with the single writer are bugs. Unfortunately, due to being marked, they are no longer data races. For cases like these, we can use the macro as follows:
void
void
Note
ASSERT_EXCLUSIVE_WRITER_SCOPED(), if applicable, performs more thorough
checking if a clear scope where no concurrent writes are expected exists.
ASSERT_EXCLUSIVE_WRITER_SCOPED() #
assert no concurrent writes to var in scope
Parameters
var: variable to assert on
Description
Scoped variant of ASSERT_EXCLUSIVE_WRITER().
Assert that there are no concurrent writes to var for the duration of the
scope in which it is introduced. This provides a better way to fully cover
the enclosing scope, compared to multiple ASSERT_EXCLUSIVE_WRITER(), and
increases the likelihood for KCSAN to detect racing accesses.
For example, it allows finding race-condition bugs that only occur due to state changes within the scope itself:
void
void
ASSERT_EXCLUSIVE_ACCESS() #
assert no concurrent accesses to var
Parameters
var: variable to assert on
Description
Assert that there are no concurrent accesses to var (no readers nor writers). This assertion can be used to specify properties of concurrent code, where violation cannot be detected as a normal data race.
For example, where exclusive access is expected after determining no other users of an object are left, but the object is not actually freed. We can check that this property actually holds as follows:
if
Note
-
ASSERT_EXCLUSIVE_ACCESS_SCOPED(), if applicable, performs more thorough checking if a clear scope where no concurrent accesses are expected exists. -
For cases where the object is freed, KASAN is a better fit to detect use-after-free bugs.
ASSERT_EXCLUSIVE_ACCESS_SCOPED() #
assert no concurrent accesses to var in scope
Parameters
var: variable to assert on
Description
Scoped variant of ASSERT_EXCLUSIVE_ACCESS().
Assert that there are no concurrent accesses to var (no readers nor writers)
for the entire duration of the scope in which it is introduced. This provides
a better way to fully cover the enclosing scope, compared to multiple
ASSERT_EXCLUSIVE_ACCESS(), and increases the likelihood for KCSAN to detect
racing accesses.
ASSERT_EXCLUSIVE_BITS() #
assert no concurrent writes to subset of bits in var
Parameters
var: variable to assert onmask: only check for modifications to bits set in mask
Description
Bit-granular variant of ASSERT_EXCLUSIVE_WRITER().
Assert that there are no concurrent writes to a subset of bits in var; concurrent readers are permitted. This assertion captures more detailed bit-level properties, compared to the other (word granularity) assertions. Only the bits set in mask are checked for concurrent modifications, while ignoring the remaining bits, i.e. concurrent writes (or reads) to ~mask bits are ignored.
Use this for variables, where some bits must not be modified concurrently, yet other bits are expected to be modified concurrently.
For example, variables where, after initialization, some bits are read-only, but other bits may still be modified concurrently. A reader may wish to assert that this is true as follows:
;
foo = >> READ_ONLY_SHIFT;
Note
The access that immediately follows ASSERT_EXCLUSIVE_BITS() is assumed
to access the masked bits only, and KCSAN optimistically assumes it is
therefore safe, even in the presence of data races, and marking it with
READ_ONCE() is optional from KCSAN's point-of-view. We caution, however, that
it may still be advisable to do so, since we cannot reason about all compiler
optimizations when it comes to bit manipulations (on the reader and writer
side). If you are sure nothing can go wrong, we can write the above simply
as:
;
foo = >> READ_ONLY_SHIFT;
Another example, where this may be used, is when certain bits of var may only be modified when holding the appropriate lock, but other bits may still be modified concurrently. Writers, where other bits may change concurrently, could use the assertion as follows:
;
;
old_flags = flags;
new_flags = | ;
if
;
Implementation Details #
KCSAN relies on observing that two accesses happen concurrently. Crucially, we want to (a) increase the chances of observing races (especially for races that manifest rarely), and (b) be able to actually observe them. We can accomplish (a) by injecting various delays, and (b) by using address watchpoints (or breakpoints).
If we deliberately stall a memory access, while we have a watchpoint for its address set up, and then observe the watchpoint to fire, two accesses to the same address just raced. Using hardware watchpoints, this is the approach taken in DataCollider. Unlike DataCollider, KCSAN does not use hardware watchpoints, but instead relies on compiler instrumentation and "soft watchpoints".
In KCSAN, watchpoints are implemented using an efficient encoding that stores access type, size, and address in a long; the benefits of using "soft watchpoints" are portability and greater flexibility. KCSAN then relies on the compiler instrumenting plain accesses. For each instrumented plain access:
-
Check if a matching watchpoint exists; if yes, and at least one access is a write, then we encountered a racing access.
-
Periodically, if no matching watchpoint exists, set up a watchpoint and stall for a small randomized delay.
-
Also check the data value before the delay, and re-check the data value after delay; if the values mismatch, we infer a race of unknown origin.
To detect data races between plain and marked accesses, KCSAN also annotates marked accesses, but only to check if a watchpoint exists; i.e. KCSAN never sets up a watchpoint on marked accesses. By never setting up watchpoints for marked operations, if all accesses to a variable that is accessed concurrently are properly marked, KCSAN will never trigger a watchpoint and therefore never report the accesses.
Modeling Weak Memory #
KCSAN's approach to detecting data races due to missing memory barriers is based on modeling access reordering (with CONFIG_KCSAN_WEAK_MEMORY=y). Each plain memory access for which a watchpoint is set up, is also selected for simulated reordering within the scope of its function (at most 1 in-flight access).
Once an access has been selected for reordering, it is checked along every other access until the end of the function scope. If an appropriate memory barrier is encountered, the access will no longer be considered for simulated reordering.
When the result of a memory operation should be ordered by a barrier, KCSAN can then detect data races where the conflict only occurs as a result of a missing barrier. Consider the example:
int x, flag;
void T1(void)
{
x = 1; // data race!
WRITE_ONCE(flag, 1); // correct: smp_store_release(&flag, 1)
}
void T2(void)
{
while (!READ_ONCE(flag)); // correct: smp_load_acquire(&flag)
... = x; // data race!
}
When weak memory modeling is enabled, KCSAN can consider x in T1 for simulated reordering. After the write of flag, x is again checked for concurrent accesses: because T2 is able to proceed after the write of flag, a data race is detected. With the correct barriers in place, x would not be considered for reordering after the proper release of flag, and no data race would be detected.
Deliberate trade-offs in complexity but also practical limitations mean only a subset of data races due to missing memory barriers can be detected. With currently available compiler support, the implementation is limited to modeling the effects of "buffering" (delaying accesses), since the runtime cannot "prefetch" accesses. Also recall that watchpoints are only set up for plain accesses, and the only access type for which KCSAN simulates reordering. This means reordering of marked accesses is not modeled.
A consequence of the above is that acquire operations do not require barrier instrumentation (no prefetching). Furthermore, marked accesses introducing address or control dependencies do not require special handling (the marked access cannot be reordered, later dependent accesses cannot be prefetched).
Key Properties #
-
Memory Overhead: The overall memory overhead is only a few MiB depending on configuration. The current implementation uses a small array of longs to encode watchpoint information, which is negligible.
-
Performance Overhead: KCSAN's runtime aims to be minimal, using an efficient watchpoint encoding that does not require acquiring any shared locks in the fast-path. For kernel boot on a system with 8 CPUs:
-
5.0x slow-down with the default KCSAN config;
-
2.8x slow-down from runtime fast-path overhead only (set very large
KCSAN_SKIP_WATCHand unsetKCSAN_SKIP_WATCH_RANDOMIZE).
-
-
Annotation Overheads: Minimal annotations are required outside the KCSAN runtime. As a result, maintenance overheads are minimal as the kernel evolves.
-
Detects Racy Writes from Devices: Due to checking data values upon setting up watchpoints, racy writes from devices can also be detected.
-
Memory Ordering: KCSAN is aware of only a subset of LKMM ordering rules; this may result in missed data races (false negatives).
-
Analysis Accuracy: For observed executions, due to using a sampling strategy, the analysis is unsound (false negatives possible), but aims to be complete (no false positives).
Alternatives Considered #
An alternative data race detection approach for the kernel can be found in the Kernel Thread Sanitizer (KTSAN). KTSAN is a happens-before data race detector, which explicitly establishes the happens-before order between memory operations, which can then be used to determine data races as defined in Data Races.
To build a correct happens-before relation, KTSAN must be aware of all ordering rules of the LKMM and synchronization primitives. Unfortunately, any omission leads to large numbers of false positives, which is especially detrimental in the context of the kernel which includes numerous custom synchronization mechanisms. To track the happens-before relation, KTSAN's implementation requires metadata for each memory location (shadow memory), which for each page corresponds to 4 pages of shadow memory, and can translate into overhead of tens of GiB on a large system.
Kernel Electric-Fence (KFENCE)
Peios Kernel / Kernel development / Development tools
Kernel Electric-Fence (KFENCE) is a low-overhead sampling-based memory safety error detector. KFENCE detects heap out-of-bounds access, use-after-free, and invalid-free errors.
KFENCE is designed to be enabled in production kernels, and has near zero performance overhead. Compared to KASAN, KFENCE trades performance for precision. The main motivation behind KFENCE's design, is that with enough total uptime KFENCE will detect bugs in code paths not typically exercised by non-production test workloads. One way to quickly achieve a large enough total uptime is when the tool is deployed across a large fleet of machines.
Usage #
To enable KFENCE, configure the kernel with:
CONFIG_KFENCE=y
To build a kernel with KFENCE support, but disabled by default (to enable, set kfence.sample_interval to non-zero value), configure the kernel with:
CONFIG_KFENCE=y
CONFIG_KFENCE_SAMPLE_INTERVAL=0
KFENCE provides several other configuration options to customize behaviour (see the respective help text in lib/Kconfig.kfence for more info).
Tuning performance #
The most important parameter is KFENCE's sample interval, which can be set via the kernel boot parameter kfence.sample_interval in milliseconds. The sample interval determines the frequency with which heap allocations will be guarded by KFENCE. The default is configurable via the Kconfig option CONFIG_KFENCE_SAMPLE_INTERVAL. Setting kfence.sample_interval=0 disables KFENCE.
The sample interval controls a timer that sets up KFENCE allocations. By default, to keep the real sample interval predictable, the normal timer also causes CPU wake-ups when the system is completely idle. This may be undesirable on power-constrained systems. The boot parameter kfence.deferrable=1 instead switches to a "deferrable" timer which does not force CPU wake-ups on idle systems, at the risk of unpredictable sample intervals. The default is configurable via the Kconfig option CONFIG_KFENCE_DEFERRABLE.
By default KFENCE will only sample 1 heap allocation within each sample interval. Burst mode allows to sample successive heap allocations, where the kernel boot parameter kfence.burst can be set to a non-zero value which denotes the additional successive allocations within a sample interval; setting kfence.burst=N means that 1 + N successive allocations are attempted through KFENCE for each sample interval.
The KFENCE memory pool is of fixed size, and if the pool is exhausted, no further KFENCE allocations occur. With CONFIG_KFENCE_NUM_OBJECTS (default 255), the number of available guarded objects can be controlled. Each object requires 2 pages, one for the object itself and the other one used as a guard page; object pages are interleaved with guard pages, and every object page is therefore surrounded by two guard pages.
The total memory dedicated to the KFENCE memory pool can be computed as:
( #objects + 1 ) * 2 * PAGE_SIZE
Using the default config, and assuming a page size of 4 KiB, results in dedicating 2 MiB to the KFENCE memory pool.
Note: On architectures that support huge pages, KFENCE will ensure that the pool is using pages of size PAGE_SIZE. This will result in additional page tables being allocated.
Error reports #
A typical out-of-bounds access looks like this:
==================================================================
BUG: KFENCE: out-of-bounds read in test_out_of_bounds_read+0xa6/0x234
Out-of-bounds read at 0xffff8c3f2e291fff (1B left of kfence-#72):
test_out_of_bounds_read+0xa6/0x234
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
kfence-#72: 0xffff8c3f2e292000-0xffff8c3f2e29201f, size=32, cache=kmalloc-32
allocated by task 484 on cpu 0 at 32.919330s:
test_alloc+0xfe/0x738
test_out_of_bounds_read+0x9b/0x234
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
CPU: 0 PID: 484 Comm: kunit_try_catch Not tainted 5.13.0-rc3+ #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
==================================================================
The header of the report provides a short summary of the function involved in the access. It is followed by more detailed information about the access and its origin. Note that, real kernel addresses are only shown when using the kernel command line option no_hash_pointers.
Use-after-free accesses are reported as:
==================================================================
BUG: KFENCE: use-after-free read in test_use_after_free_read+0xb3/0x143
Use-after-free read at 0xffff8c3f2e2a0000 (in kfence-#79):
test_use_after_free_read+0xb3/0x143
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
kfence-#79: 0xffff8c3f2e2a0000-0xffff8c3f2e2a001f, size=32, cache=kmalloc-32
allocated by task 488 on cpu 2 at 33.871326s:
test_alloc+0xfe/0x738
test_use_after_free_read+0x76/0x143
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
freed by task 488 on cpu 2 at 33.871358s:
test_use_after_free_read+0xa8/0x143
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
CPU: 2 PID: 488 Comm: kunit_try_catch Tainted: G B 5.13.0-rc3+ #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
==================================================================
KFENCE also reports on invalid frees, such as double-frees:
==================================================================
BUG: KFENCE: invalid free in test_double_free+0xdc/0x171
Invalid free of 0xffff8c3f2e2a4000 (in kfence-#81):
test_double_free+0xdc/0x171
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
kfence-#81: 0xffff8c3f2e2a4000-0xffff8c3f2e2a401f, size=32, cache=kmalloc-32
allocated by task 490 on cpu 1 at 34.175321s:
test_alloc+0xfe/0x738
test_double_free+0x76/0x171
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
freed by task 490 on cpu 1 at 34.175348s:
test_double_free+0xa8/0x171
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
CPU: 1 PID: 490 Comm: kunit_try_catch Tainted: G B 5.13.0-rc3+ #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
==================================================================
KFENCE also uses pattern-based redzones on the other side of an object's guard page, to detect out-of-bounds writes on the unprotected side of the object. These are reported on frees:
==================================================================
BUG: KFENCE: memory corruption in test_kmalloc_aligned_oob_write+0xef/0x184
Corrupted memory at 0xffff8c3f2e33aff9 [ 0xac . . . . . . ] (in kfence-#156):
test_kmalloc_aligned_oob_write+0xef/0x184
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
kfence-#156: 0xffff8c3f2e33afb0-0xffff8c3f2e33aff8, size=73, cache=kmalloc-96
allocated by task 502 on cpu 7 at 42.159302s:
test_alloc+0xfe/0x738
test_kmalloc_aligned_oob_write+0x57/0x184
kunit_try_run_case+0x61/0xa0
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x176/0x1b0
ret_from_fork+0x22/0x30
CPU: 7 PID: 502 Comm: kunit_try_catch Tainted: G B 5.13.0-rc3+ #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
==================================================================
For such errors, the address where the corruption occurred as well as the invalidly written bytes (offset from the address) are shown; in this representation, '.' denote untouched bytes. In the example above 0xac is the value written to the invalid address at offset 0, and the remaining '.' denote that no following bytes have been touched. Note that, real values are only shown if the kernel was booted with no_hash_pointers; to avoid information disclosure otherwise, '!' is used instead to denote invalidly written bytes.
And finally, KFENCE may also report on invalid accesses to any protected page where it was not possible to determine an associated object, e.g. if adjacent object pages had not yet been allocated:
==================================================================
BUG: KFENCE: invalid read in test_invalid_access+0x26/0xe0
Invalid read at 0xffffffffb670b00a:
test_invalid_access+0x26/0xe0
kunit_try_run_case+0x51/0x85
kunit_generic_run_threadfn_adapter+0x16/0x30
kthread+0x137/0x160
ret_from_fork+0x22/0x30
CPU: 4 PID: 124 Comm: kunit_try_catch Tainted: G W 5.8.0-rc6+ #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014
==================================================================
DebugFS interface #
Some debugging information is exposed via debugfs:
-
The file
/sys/kernel/debug/kfence/statsprovides runtime statistics. -
The file
/sys/kernel/debug/kfence/objectsprovides a list of objects allocated via KFENCE, including those already freed but protected.
Implementation Details #
Guarded allocations are set up based on the sample interval. After expiration of the sample interval, the next allocation through the main allocator (SLAB or SLUB) returns a guarded allocation from the KFENCE object pool (allocation sizes up to PAGE_SIZE are supported). At this point, the timer is reset, and the next allocation is set up after the expiration of the interval.
When using CONFIG_KFENCE_STATIC_KEYS=y, KFENCE allocations are "gated" through the main allocator's fast-path by relying on static branches via the static keys infrastructure. The static branch is toggled to redirect the allocation to KFENCE. Depending on sample interval, target workloads, and system architecture, this may perform better than the simple dynamic branch. Careful benchmarking is recommended.
KFENCE objects each reside on a dedicated page, at either the left or right page boundaries selected at random. The pages to the left and right of the object page are "guard pages", whose attributes are changed to a protected state, and cause page faults on any attempted access. Such page faults are then intercepted by KFENCE, which handles the fault gracefully by reporting an out-of-bounds access, and marking the page as accessible so that the faulting code can (wrongly) continue executing (set panic_on_warn to panic instead).
To detect out-of-bounds writes to memory within the object's page itself, KFENCE also uses pattern-based redzones. For each object page, a redzone is set up for all non-object memory. For typical alignments, the redzone is only required on the unguarded side of an object. Because KFENCE must honor the cache's requested alignment, special alignments may result in unprotected gaps on either side of an object, all of which are redzoned.
The following figure illustrates the page layout:
---+-----------+-----------+-----------+-----------+-----------+---
| xxxxxxxxx | O : | xxxxxxxxx | : O | xxxxxxxxx |
| xxxxxxxxx | B : | xxxxxxxxx | : B | xxxxxxxxx |
| x GUARD x | J : RED- | x GUARD x | RED- : J | x GUARD x |
| xxxxxxxxx | E : ZONE | xxxxxxxxx | ZONE : E | xxxxxxxxx |
| xxxxxxxxx | C : | xxxxxxxxx | : C | xxxxxxxxx |
| xxxxxxxxx | T : | xxxxxxxxx | : T | xxxxxxxxx |
---+-----------+-----------+-----------+-----------+-----------+---
Upon deallocation of a KFENCE object, the object's page is again protected and the object is marked as freed. Any further access to the object causes a fault and KFENCE reports a use-after-free access. Freed objects are inserted at the tail of KFENCE's freelist, so that the least recently freed objects are reused first, and the chances of detecting use-after-frees of recently freed objects is increased.
If pool utilization reaches 75% (default) or above, to reduce the risk of the pool eventually being fully occupied by allocated objects yet ensure diverse coverage of allocations, KFENCE limits currently covered allocations of the same source from further filling up the pool. The "source" of an allocation is based on its partial allocation stack trace. A side-effect is that this also limits frequent long-lived allocations (e.g. pagecache) of the same source filling up the pool permanently, which is the most common risk for the pool becoming full and the sampled allocation rate dropping to zero. The threshold at which to start limiting currently covered allocations can be configured via the boot parameter kfence.skip_covered_thresh (pool usage%).
Interface #
The following describes the functions which are used by allocators as well as page handling code to set up and deal with KFENCE allocations.
is_kfence_address() #
bool check if an address belongs to KFENCE pool
Parameters
const void *addr: address to check
Return
true or false depending on whether the address is within the KFENCE object range.
Description
KFENCE objects live in a separate page range and are not to be intermixed
with regular heap objects (e.g. KFENCE objects must never be added to the
allocator freelists). Failing to do so may and will result in heap
corruptions, therefore is_kfence_address() must be used to check whether
an object requires specific handling.
Note
This function may be used in fast-paths, and is performance critical. Future changes should take this into account; for instance, we want to avoid introducing another load and therefore need to keep KFENCE_POOL_SIZE a constant (until immediate patching support is added to the kernel).
kfence_shutdown_cache() #
void handle shutdown_cache() for KFENCE objects
Parameters
struct kmem_cache *s: cache being shut down
Description
Before shutting down a cache, one must ensure there are no remaining objects allocated from it. Because KFENCE objects are not referenced from the cache directly, we need to check them here.
Note that shutdown_cache() is internal to SL*B, and kmem_cache_destroy() does
not return if allocated objects still exist: it prints an error message and
simply aborts destruction of a cache, leaking memory.
If the only such objects are KFENCE objects, we will not leak the entire
cache, but instead try to provide more useful debug info by making allocated
objects "zombie allocations". Objects may then still be used or freed (which
is handled gracefully), but usage will result in showing KFENCE error reports
which include stack traces to the user of the object, the original allocation
site, and caller to shutdown_cache().
kfence_alloc() #
void * allocate a KFENCE object with a low probability
Parameters
struct kmem_cache *s: struct kmem_cache with object requirementssize_t size: exact size of the object to allocate (can be less than s->size e.g. for kmalloc caches)gfp_t flags: GFP flags
Return
- NULL - must proceed with allocating as usual,
- non-NULL - pointer to a KFENCE object.
Description
kfence_alloc() should be inserted into the heap allocation fast path,
allowing it to transparently return KFENCE-allocated objects with a low
probability using a static branch (the probability is controlled by the
kfence.sample_interval boot parameter).
kfence_ksize() #
size_t get actual amount of memory allocated for a KFENCE object
Parameters
const void *addr: pointer to a heap object
Return
- 0 - not a KFENCE object, must call
__ksize()instead, - non-0 - this many bytes can be accessed without causing a memory error.
Description
kfence_ksize() returns the number of bytes requested for a KFENCE object at
allocation time. This number may be less than the object size of the
corresponding struct kmem_cache.
kfence_object_start() #
void * find the beginning of a KFENCE object
Parameters
const void *addr: address within a KFENCE-allocated object
Return
address of the beginning of the object.
Description
SL[AU]B-allocated objects are laid out within a page one by one, so it is easy to calculate the beginning of an object given a pointer inside it and the object size. The same is not true for KFENCE, which places a single object at either end of the page. This helper function is used to find the beginning of a KFENCE-allocated object.
__kfence_free() #
void release a KFENCE heap object to KFENCE pool
Parameters
void *addr: object to be freed
Description
Requires: is_kfence_address(addr)
Release a KFENCE object and mark it as freed.
kfence_free() #
bool try to release an arbitrary heap object to KFENCE pool
Parameters
void *addr: object to be freed
Return
- false - object doesn't belong to KFENCE pool and was ignored,
- true - object was released to KFENCE pool.
Description
Release a KFENCE object and mark it as freed. May be called on any object, even non-KFENCE objects, to simplify integration of the hooks into the allocator's free codepath. The allocator must check the return value to determine if it was a KFENCE object or not.
kfence_handle_page_fault() #
bool perform page fault handling for KFENCE pages
Parameters
unsigned long addr: faulting addressbool is_write: is access a writestruct pt_regs *regs: current struct pt_regs (can be NULL, but shows full stack trace)
Return
- false - address outside KFENCE pool,
- true - page fault handled by KFENCE, no additional handling required.
Description
A page fault inside KFENCE pool indicates a memory error, such as an out-of-bounds access, a use-after-free or an invalid memory access. In these cases KFENCE prints an error message and marks the offending page as present, so that the kernel can proceed.
Related Tools #
In userspace, a similar approach is taken by GWP-ASan. GWP-ASan also relies on guard pages and a sampling strategy to detect memory unsafety bugs at scale. KFENCE's design is directly influenced by GWP-ASan, and can be seen as its kernel sibling. Another similar but non-sampling approach, that also inspired the name "KFENCE", can be found in the userspace Electric Fence Malloc Debugger.
In the kernel, several tools exist to debug memory access errors, and in particular KASAN can detect all bug classes that KFENCE can detect. While KASAN is more precise, relying on compiler instrumentation, this comes at a performance cost.
It is worth highlighting that KASAN and KFENCE are complementary, with different target environments. For instance, KASAN is the better debugging-aid, where test cases or reproducers exists: due to the lower chance to detect the error, it would require more effort using KFENCE to debug. Deployments at scale that cannot afford to enable KASAN, however, would benefit from using KFENCE to discover bugs due to code paths not exercised by test cases or fuzzers.
Kernel Memory Leak Detector
Peios Kernel / Kernel development / Development tools
Kmemleak provides a way of detecting possible kernel memory leaks in a way similar to a tracing garbage collector, with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak. A similar method is used by the Valgrind tool (memcheck --leak-check) to detect the memory leaks in user-space applications.
Usage #
CONFIG_DEBUG_KMEMLEAK in "Kernel hacking" has to be enabled. A kernel thread scans the memory every 10 minutes (by default) and prints the number of new unreferenced objects found. If the debugfs isn't already mounted, mount with:
# mount -t debugfs nodev /sys/kernel/debug/
To display the details of all the possible scanned memory leaks:
# cat /sys/kernel/debug/kmemleak
To trigger an intermediate memory scan:
# echo scan > /sys/kernel/debug/kmemleak
To clear the list of all current possible memory leaks:
# echo clear > /sys/kernel/debug/kmemleak
New leaks will then come up upon reading /sys/kernel/debug/kmemleak again.
Note that the orphan objects are listed in the order they were allocated and one object at the beginning of the list may cause other subsequent objects to be reported as orphan.
Memory scanning parameters can be modified at run-time by writing to the /sys/kernel/debug/kmemleak file. The following parameters are supported:
-
-
off
disable kmemleak (irreversible)
-
-
-
stack=on
enable the task stacks scanning (default)
-
-
-
stack=off
disable the tasks stacks scanning
-
-
-
scan=on
start the automatic memory scanning thread (default)
-
-
-
scan=off
stop the automatic memory scanning thread
-
-
-
scan=<secs>
set the automatic memory scanning period in seconds (default 600, 0 to stop the automatic scanning)
-
-
-
scan
trigger a memory scan
-
-
-
clear
clear list of current memory leak suspects, done by marking all current reported unreferenced objects grey, or free all kmemleak objects if kmemleak has been disabled.
-
-
-
dump=<addr>
dump information about the object found at <addr>
-
Kmemleak can also be disabled at boot-time by passing kmemleak=off on the kernel command line.
Memory may be allocated or freed before kmemleak is initialised and these actions are stored in an early log buffer. The size of this buffer is configured via the CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE option.
If CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF are enabled, the kmemleak is disabled by default. Passing kmemleak=on on the kernel command line enables the function.
If you are getting errors like "Error while writing to stdout" or "write_loop: Invalid argument", make sure kmemleak is properly enabled.
Basic Algorithm #
The memory allocations via kmalloc(), vmalloc(), kmem_cache_alloc() and friends are traced and the pointers, together with additional information like size and stack trace, are stored in a rbtree. The corresponding freeing function calls are tracked and the pointers removed from the kmemleak data structures.
An allocated block of memory is considered orphan if no pointer to its start address or to any location inside the block can be found by scanning the memory (including saved registers). This means that there might be no way for the kernel to pass the address of the allocated block to a freeing function and therefore the block is considered a memory leak.
The scanning algorithm steps:
mark all objects as white (remaining white objects will later be considered orphan)
scan the memory starting with the data section and stacks, checking the values against the addresses stored in the rbtree. If a pointer to a white object is found, the object is added to the gray list
scan the gray objects for matching addresses (some white objects can become gray and added at the end of the gray list) until the gray set is finished
the remaining white objects are considered orphan and reported via /sys/kernel/debug/kmemleak
Some allocated memory blocks have pointers stored in the kernel's internal data structures and they cannot be detected as orphans. To avoid this, kmemleak can also store the number of values pointing to an address inside the block address range that need to be found so that the block is not considered a leak. One example is __vmalloc().
Testing specific sections with kmemleak #
Upon initial bootup your /sys/kernel/debug/kmemleak output page may be quite extensive. This can also be the case if you have very buggy code when doing development. To work around these situations you can use the 'clear' command to clear all reported unreferenced objects from the /sys/kernel/debug/kmemleak output. By issuing a 'scan' after a 'clear' you can find new unreferenced objects; this should help with testing specific sections of code.
To test a critical section on demand with a clean kmemleak do:
# echo clear > /sys/kernel/debug/kmemleak
... test your kernel or modules ...
# echo scan > /sys/kernel/debug/kmemleak
Then as usual to get your report with:
# cat /sys/kernel/debug/kmemleak
Freeing kmemleak internal objects #
To allow access to previously found memory leaks after kmemleak has been disabled by the user or due to an fatal error, internal kmemleak objects won't be freed when kmemleak is disabled, and those objects may occupy a large part of physical memory.
In this situation, you may reclaim memory with:
# echo clear > /sys/kernel/debug/kmemleak
Kmemleak API #
See the include/linux/kmemleak.h header for the functions prototype.
-
kmemleak_init- initialize kmemleak -
kmemleak_alloc- notify of a memory block allocation -
kmemleak_alloc_percpu- notify of a percpu memory block allocation -
kmemleak_vmalloc- notify of a vmalloc() memory allocation -
kmemleak_free- notify of a memory block freeing -
kmemleak_free_part- notify of a partial memory block freeing -
kmemleak_free_percpu- notify of a percpu memory block freeing -
kmemleak_update_trace- update object allocation stack trace -
kmemleak_not_leak- mark an object as not a leak -
kmemleak_transient_leak- mark an object as a transient leak -
kmemleak_ignore- do not scan or report an object as leak -
kmemleak_scan_area- add scan areas inside a memory block -
kmemleak_no_scan- do not scan a memory block -
kmemleak_erase- erase an old value in a pointer variable -
kmemleak_alloc_recursive- as kmemleak_alloc but checks the recursiveness -
kmemleak_free_recursive- as kmemleak_free but checks the recursiveness
The following functions take a physical address as the object pointer and only perform the corresponding action if the address has a lowmem mapping:
-
kmemleak_alloc_phys -
kmemleak_free_part_phys -
kmemleak_ignore_phys
Dealing with false positives/negatives #
The false negatives are real memory leaks (orphan objects) but not reported by kmemleak because values found during the memory scanning point to such objects. To reduce the number of false negatives, kmemleak provides the kmemleak_ignore, kmemleak_scan_area, kmemleak_no_scan and kmemleak_erase functions (see above). The task stacks also increase the amount of false negatives and their scanning is not enabled by default.
The false positives are objects wrongly reported as being memory leaks (orphan). For objects known not to be leaks, kmemleak provides the kmemleak_not_leak function. The kmemleak_ignore could also be used if the memory block is known not to contain other pointers and it will no longer be scanned.
Some of the reported leaks are only transient, especially on SMP systems, because of pointers temporarily stored in CPU registers or stacks. Kmemleak defines MSECS_MIN_AGE (defaulting to 1000) representing the minimum age of an object to be reported as a memory leak.
Limitations and Drawbacks #
The main drawback is the reduced performance of memory allocation and freeing. To avoid other penalties, the memory scanning is only performed when the /sys/kernel/debug/kmemleak file is read. Anyway, this tool is intended for debugging purposes where the performance might not be the most important requirement.
To keep the algorithm simple, kmemleak scans for values pointing to any address inside a block's address range. This may lead to an increased number of false negatives. However, it is likely that a real memory leak will eventually become visible.
Another source of false negatives is the data stored in non-pointer values. In a future version, kmemleak could only scan the pointer members in the allocated structures. This feature would solve many of the false negative cases described above.
The tool can report false positives. These are cases where an allocated block doesn't need to be freed (some cases in the init_call functions), the pointer is calculated by other methods than the usual container_of macro or the pointer is stored in a location not scanned by kmemleak.
Page allocations and ioremap are not tracked.
Testing with kmemleak-test #
To check if you have all set up to use kmemleak, you can use the kmemleak-test module, a module that deliberately leaks memory. Set CONFIG_SAMPLE_KMEMLEAK as module (it can't be used as built-in) and boot the kernel with kmemleak enabled. Load the module and perform a scan with:
# modprobe kmemleak-test
# echo scan > /sys/kernel/debug/kmemleak
Note that the you may not get results instantly or on the first scanning. When kmemleak gets results, it'll log kmemleak: <count of leaks> new suspected memory leaks. Then read the file to see then:
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff89862ca702e8 (size 32):
comm "modprobe", pid 2088, jiffies 4294680594 (age 375.486s)
hex dump (first 32 bytes):
6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk.
backtrace:
[<00000000e0a73ec7>] 0xffffffffc01d2036
[<000000000c5d2a46>] do_one_initcall+0x41/0x1df
[<0000000046db7e0a>] do_init_module+0x55/0x200
[<00000000542b9814>] load_module+0x203c/0x2480
[<00000000c2850256>] __do_sys_finit_module+0xba/0xe0
[<000000006564e7ef>] do_syscall_64+0x43/0x110
[<000000007c873fa6>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
...
Removing the module with rmmod kmemleak_test should also trigger some kmemleak results.
Kernel Memory Sanitizer (KMSAN)
Peios Kernel / Kernel development / Development tools
KMSAN is a dynamic error detector aimed at finding uses of uninitialized values. It is based on compiler instrumentation, and is quite similar to the userspace MemorySanitizer tool.
An important note is that KMSAN is not intended for production use, because it drastically increases kernel memory footprint and slows the whole system down.
Usage #
Building the kernel #
In order to build a kernel with KMSAN you will need a fresh Clang (14.0.6+). Please refer to LLVM documentation for the instructions on how to build Clang.
Now configure and build the kernel with CONFIG_KMSAN enabled.
Example report #
Here is an example of a KMSAN report:
=====================================================
BUG: KMSAN: uninit-value in test_uninit_kmsan_check_memory+0x1be/0x380 [kmsan_test]
test_uninit_kmsan_check_memory+0x1be/0x380 mm/kmsan/kmsan_test.c:273
kunit_run_case_internal lib/kunit/test.c:333
kunit_try_run_case+0x206/0x420 lib/kunit/test.c:374
kunit_generic_run_threadfn_adapter+0x6d/0xc0 lib/kunit/try-catch.c:28
kthread+0x721/0x850 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 ??:?
Uninit was stored to memory at:
do_uninit_local_array+0xfa/0x110 mm/kmsan/kmsan_test.c:260
test_uninit_kmsan_check_memory+0x1a2/0x380 mm/kmsan/kmsan_test.c:271
kunit_run_case_internal lib/kunit/test.c:333
kunit_try_run_case+0x206/0x420 lib/kunit/test.c:374
kunit_generic_run_threadfn_adapter+0x6d/0xc0 lib/kunit/try-catch.c:28
kthread+0x721/0x850 kernel/kthread.c:327
ret_from_fork+0x1f/0x30 ??:?
Local variable uninit created at:
do_uninit_local_array+0x4a/0x110 mm/kmsan/kmsan_test.c:256
test_uninit_kmsan_check_memory+0x1a2/0x380 mm/kmsan/kmsan_test.c:271
Bytes 4-7 of 8 are uninitialized
Memory access of size 8 starts at ffff888083fe3da0
CPU: 0 PID: 6731 Comm: kunit_try_catch Tainted: G B E 5.16.0-rc3+ #104
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
=====================================================
The report says that the local variable uninit was created uninitialized in do_uninit_local_array(). The third stack trace corresponds to the place where this variable was created.
The first stack trace shows where the uninit value was used (in test_uninit_kmsan_check_memory()). The tool shows the bytes which were left uninitialized in the local variable, as well as the stack where the value was copied to another memory location before use.
A use of uninitialized value v is reported by KMSAN in the following cases:
in a condition, e.g.
if (v) { ... };in an indexing or pointer dereferencing, e.g.
array[v]or*v;when it is copied to userspace or hardware, e.g.
copy_to_user(..., &v, ...);when it is passed as an argument to a function, and
CONFIG_KMSAN_CHECK_PARAM_RETVALis enabled (see below).
The mentioned cases (apart from copying data to userspace or hardware, which is a security issue) are considered undefined behavior from the C11 Standard point of view.
Disabling the instrumentation #
A function can be marked with __no_kmsan_checks. Doing so makes KMSAN ignore uninitialized values in that function and mark its output as initialized. As a result, the user will not get KMSAN reports related to that function.
Another function attribute supported by KMSAN is __no_sanitize_memory. Applying this attribute to a function will result in KMSAN not instrumenting it, which can be helpful if we do not want the compiler to interfere with some low-level code (e.g. that marked with noinstr which implicitly adds __no_sanitize_memory).
This however comes at a cost: stack allocations from such functions will have incorrect shadow/origin values, likely leading to false positives. Functions called from non-instrumented code may also receive incorrect metadata for their parameters.
As a rule of thumb, avoid using __no_sanitize_memory explicitly.
It is also possible to disable KMSAN for a single file (e.g. main.o):
KMSAN_SANITIZE_main.o := n
or for the whole directory:
KMSAN_SANITIZE := n
in the Makefile. Think of this as applying __no_sanitize_memory to every function in the file or directory. Most users won't need KMSAN_SANITIZE, unless their code gets broken by KMSAN (e.g. runs at early boot time).
KMSAN checks can also be temporarily disabled for the current task using kmsan_disable_current() and kmsan_enable_current() calls. Each kmsan_enable_current() call must be preceded by a kmsan_disable_current() call; these call pairs may be nested. One needs to be careful with these calls, keeping the regions short and preferring other ways to disable instrumentation, where possible.
Support #
In order for KMSAN to work the kernel must be built with Clang, which so far is the only compiler that has KMSAN support. The kernel instrumentation pass is based on the userspace MemorySanitizer tool.
The runtime library only supports x86_64 at the moment.
How KMSAN works #
KMSAN shadow memory #
KMSAN associates a metadata byte (also called shadow byte) with every byte of kernel memory. A bit in the shadow byte is set if the corresponding bit of the kernel memory byte is uninitialized. Marking the memory uninitialized (i.e. setting its shadow bytes to 0xff) is called poisoning, marking it initialized (setting the shadow bytes to 0x00) is called unpoisoning.
When a new variable is allocated on the stack, it is poisoned by default by instrumentation code inserted by the compiler (unless it is a stack variable that is immediately initialized). Any new heap allocation done without __GFP_ZERO is also poisoned.
Compiler instrumentation also tracks the shadow values as they are used along the code. When needed, instrumentation code invokes the runtime library in mm/kmsan/ to persist shadow values.
The shadow value of a basic or compound type is an array of bytes of the same length. When a constant value is written into memory, that memory is unpoisoned. When a value is read from memory, its shadow memory is also obtained and propagated into all the operations which use that value. For every instruction that takes one or more values the compiler generates code that calculates the shadow of the result depending on those values and their shadows.
Example:
int a = 0xff; // i.e. 0x000000ff
int b;
int c = a | b;
In this case the shadow of a is 0, shadow of b is 0xffffffff, shadow of c is 0xffffff00. This means that the upper three bytes of c are uninitialized, while the lower byte is initialized.
Origin tracking #
Every four bytes of kernel memory also have a so-called origin mapped to them. This origin describes the point in program execution at which the uninitialized value was created. Every origin is associated with either the full allocation stack (for heap-allocated memory), or the function containing the uninitialized variable (for locals).
When an uninitialized variable is allocated on stack or heap, a new origin value is created, and that variable's origin is filled with that value. When a value is read from memory, its origin is also read and kept together with the shadow. For every instruction that takes one or more values, the origin of the result is one of the origins corresponding to any of the uninitialized inputs. If a poisoned value is written into memory, its origin is written to the corresponding storage as well.
Example 1:
int a = 42;
int b;
int c = a + b;
In this case the origin of b is generated upon function entry, and is stored to the origin of c right before the addition result is written into memory.
Several variables may share the same origin address, if they are stored in the same four-byte chunk. In this case every write to either variable updates the origin for all of them. We have to sacrifice precision in this case, because storing origins for individual bits (and even bytes) would be too costly.
Example 2:
int combine(short a, short b) {
union ret_t {
int i;
short s[2];
} ret;
ret.s[0] = a;
ret.s[1] = b;
return ret.i;
}
If a is initialized and b is not, the shadow of the result would be 0xffff0000, and the origin of the result would be the origin of b. ret.s[0] would have the same origin, but it will never be used, because that variable is initialized.
If both function arguments are uninitialized, only the origin of the second argument is preserved.
Origin chaining #
To ease debugging, KMSAN creates a new origin for every store of an uninitialized value to memory. The new origin references both its creation stack and the previous origin the value had. This may cause increased memory consumption, so we limit the length of origin chains in the runtime.
Clang instrumentation API #
Clang instrumentation pass inserts calls to functions defined in mm/kmsan/nstrumentation.c into the kernel code.
Shadow manipulation #
For every memory access the compiler emits a call to a function that returns a pair of pointers to the shadow and origin addresses of the given memory:
typedef struct {
void *shadow, *origin;
} shadow_origin_ptr_t
shadow_origin_ptr_t __msan_metadata_ptr_for_load_{1,2,4,8}(void *addr)
shadow_origin_ptr_t __msan_metadata_ptr_for_store_{1,2,4,8}(void *addr)
shadow_origin_ptr_t __msan_metadata_ptr_for_load_n(void *addr, uintptr_t size)
shadow_origin_ptr_t __msan_metadata_ptr_for_store_n(void *addr, uintptr_t size)
The function name depends on the memory access size.
The compiler makes sure that for every loaded value its shadow and origin values are read from memory. When a value is stored to memory, its shadow and origin are also stored using the metadata pointers.
Handling locals #
A special function is used to create a new origin value for a local variable and set the origin of that variable to that value:
void __msan_poison_alloca(void *addr, uintptr_t size, char *descr)
Access to per-task data #
At the beginning of every instrumented function KMSAN inserts a call to __msan_get_context_state():
kmsan_context_state *__msan_get_context_state(void)
kmsan_context_state is declared in include/linux/kmsan.h:
struct kmsan_context_state {
char param_tls[KMSAN_PARAM_SIZE];
char retval_tls[KMSAN_RETVAL_SIZE];
char va_arg_tls[KMSAN_PARAM_SIZE];
char va_arg_origin_tls[KMSAN_PARAM_SIZE];
u64 va_arg_overflow_size_tls;
char param_origin_tls[KMSAN_PARAM_SIZE];
depot_stack_handle_t retval_origin_tls;
};
This structure is used by KMSAN to pass parameter shadows and origins between instrumented functions (unless the parameters are checked immediately by CONFIG_KMSAN_CHECK_PARAM_RETVAL).
Passing uninitialized values to functions #
Clang's MemorySanitizer instrumentation has an option, -fsanitize-memory-param-retval, which makes the compiler check function parameters passed by value, as well as function return values.
The option is controlled by CONFIG_KMSAN_CHECK_PARAM_RETVAL, which is enabled by default to let KMSAN report uninitialized values earlier. Please refer to the LKML discussion for more details.
Because of the way the checks are implemented in LLVM (they are only applied to parameters marked as noundef), not all parameters are guaranteed to be checked, so we cannot give up the metadata storage in kmsan_context_state.
String functions #
The compiler replaces calls to memcpy()/memmove()/memset() with the following functions. These functions are also called when data structures are initialized or copied, making sure shadow and origin values are copied alongside with the data:
void *__msan_memcpy(void *dst, void *src, uintptr_t n)
void *__msan_memmove(void *dst, void *src, uintptr_t n)
void *__msan_memset(void *dst, int c, uintptr_t n)
Error reporting #
For each use of a value the compiler emits a shadow check that calls __msan_warning() in the case that value is poisoned:
void __msan_warning(u32 origin)
__msan_warning() causes KMSAN runtime to print an error report.
Inline assembly instrumentation #
KMSAN instruments every inline assembly output with a call to:
void __msan_instrument_asm_store(void *addr, uintptr_t size)
, which unpoisons the memory region.
This approach may mask certain errors, but it also helps to avoid a lot of false positives in bitwise operations, atomics etc.
Sometimes the pointers passed into inline assembly do not point to valid memory. In such cases they are ignored at runtime.
Runtime library #
The code is located in mm/kmsan/.
Per-task KMSAN state #
Every task_struct has an associated KMSAN task state that holds the KMSAN context (see above) and a per-task counter disallowing KMSAN reports:
struct kmsan_context {
...
unsigned int depth;
struct kmsan_context_state cstate;
...
}
struct task_struct {
...
struct kmsan_context kmsan;
...
}
KMSAN contexts #
When running in a kernel task context, KMSAN uses current->kmsan.cstate to hold the metadata for function parameters and return values.
But in the case the kernel is running in the interrupt, softirq or NMI context, where current is unavailable, KMSAN switches to per-cpu interrupt state:
DEFINE_PER_CPU(struct kmsan_ctx, kmsan_percpu_ctx);
Metadata allocation #
There are several places in the kernel for which the metadata is stored.
1. Each struct page instance contains two pointers to its shadow and origin pages:
struct page {
...
struct page *shadow, *origin;
...
};
At boot-time, the kernel allocates shadow and origin pages for every available kernel page. This is done quite late, when the kernel address space is already fragmented, so normal data pages may arbitrarily interleave with the metadata pages.
This means that in general for two contiguous memory pages their shadow/origin pages may not be contiguous. Consequently, if a memory access crosses the boundary of a memory block, accesses to shadow/origin memory may potentially corrupt other pages or read incorrect values from them.
In practice, contiguous memory pages returned by the same alloc_pages() call will have contiguous metadata, whereas if these pages belong to two different allocations their metadata pages can be fragmented.
For the kernel data (.data, .bss etc.) and percpu memory regions there also are no guarantees on metadata contiguity.
In the case __msan_metadata_ptr_for_XXX_YYY() hits the border between two pages with non-contiguous metadata, it returns pointers to fake shadow/origin regions:
char dummy_load_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
char dummy_store_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
dummy_load_page is zero-initialized, so reads from it always yield zeroes. All stores to dummy_store_page are ignored.
2. For vmalloc memory and modules, there is a direct mapping between the memory range, its shadow and origin. KMSAN reduces the vmalloc area by 3/4, making only the first quarter available to vmalloc(). The second quarter of the vmalloc area contains shadow memory for the first quarter, the third one holds the origins. A small part of the fourth quarter contains shadow and origins for the kernel modules. Please refer to arch/x86/include/asm/pgtable_64_types.h for more details.
When an array of pages is mapped into a contiguous virtual memory space, their shadow and origin pages are similarly mapped into contiguous regions.
References #
E. Stepanov, K. Serebryany. MemorySanitizer: fast detector of uninitialized memory use in C++. In Proceedings of CGO 2015.
Linux Kernel Selftests
Peios Kernel / Kernel development / Development tools
Peios: Linux capability names in this interface retain their API meaning, but KACS evaluates them through native token privileges or compatibility rules. UID 0,
setcapand Unix mode bits do not independently grant native authority. Object access and PIP checks remain additional constraints where applicable. See Peios kernel behaviour for the mapping and exceptions.
The kernel contains a set of "self tests" under the tools/testing/selftests/ directory. These are intended to be small tests to exercise individual code paths in the kernel. Tests are intended to be run after building, installing and booting a kernel.
Kselftest from mainline can be run on older stable kernels. Running tests from mainline offers the best coverage. Several test rings run mainline kselftest suite on stable releases. The reason is that when a new test gets added to test existing code to regression test a bug, we should be able to run that test on an older kernel. Hence, it is important to keep code that can still test an older kernel and make sure it skips the test gracefully on newer releases.
You can find additional information on Kselftest framework, how to write new tests using the framework on Kselftest wiki:
https://kselftest.wiki.kernel.org/
On some systems, hot-plug tests could hang forever waiting for cpu and memory to be ready to be offlined. A special hot-plug target is created to run the full range of hot-plug tests. In default mode, hot-plug tests run in safe mode with a limited scope. In limited mode, cpu-hotplug test is run on a single cpu as opposed to all hotplug capable cpus, and memory hotplug test is run on 2% of hotplug capable memory instead of 10%.
kselftest runs as a userspace process. Tests that can be written/run in userspace may wish to use the Test Harness. Tests that need to be run in kernel space may wish to use a Test Module.
Documentation on the tests #
For documentation on the kselftests themselves, see:
Running the selftests (hotplug tests are run in limited mode) #
To build the tests:
$ make headers
$ make -C tools/testing/selftests
To run the tests:
$ make -C tools/testing/selftests run_tests
To build and run the tests with a single command, use:
$ make kselftest
Note that some tests will require root privileges.
Kselftest supports saving output files in a separate directory and then running tests. To locate output files in a separate directory two syntaxes are supported. In both cases the working directory must be the root of the kernel src. This is applicable to "Running a subset of selftests" section below.
To build, save output files in a separate directory with O=
$ make O=/tmp/kselftest kselftest
To build, save output files in a separate directory with KBUILD_OUTPUT
$ export KBUILD_OUTPUT=/tmp/kselftest; make kselftest
The O= assignment takes precedence over the KBUILD_OUTPUT environment variable.
The above commands by default run the tests and print full pass/fail report. Kselftest supports "summary" option to make it easier to understand the test results. Please find the detailed individual test results for each test in /tmp/testname file(s) when summary option is specified. This is applicable to "Running a subset of selftests" section below.
To run kselftest with summary option enabled
$ make summary=1 kselftest
Running a subset of selftests #
You can use the "TARGETS" variable on the make command line to specify single test to run, or a list of tests to run.
To run only tests targeted for a single subsystem:
$ make -C tools/testing/selftests TARGETS=ptrace run_tests
You can specify multiple tests to build and run:
$ make TARGETS="size timers" kselftest
To build, save output files in a separate directory with O=
$ make O=/tmp/kselftest TARGETS="size timers" kselftest
To build, save output files in a separate directory with KBUILD_OUTPUT
$ export KBUILD_OUTPUT=/tmp/kselftest; make TARGETS="size timers" kselftest
Additionally you can use the "SKIP_TARGETS" variable on the make command line to specify one or more targets to exclude from the TARGETS list.
To run all tests but a single subsystem:
$ make -C tools/testing/selftests SKIP_TARGETS=ptrace run_tests
You can specify multiple tests to skip:
$ make SKIP_TARGETS="size timers" kselftest
You can also specify a restricted list of tests to run together with a dedicated skiplist:
$ make TARGETS="breakpoints size timers" SKIP_TARGETS=size kselftest
See the top-level tools/testing/selftests/Makefile for the list of all possible targets.
Running the full range hotplug selftests #
To build the hotplug tests:
$ make -C tools/testing/selftests hotplug
To run the hotplug tests:
$ make -C tools/testing/selftests run_hotplug
Note that some tests will require root privileges.
Install selftests #
You can use the "install" target of "make" (which calls the kselftest_install.sh tool) to install selftests in the default location (tools/testing/selftests/kselftest_install), or in a user specified location via the INSTALL_PATH "make" variable.
To install selftests in default location:
$ make -C tools/testing/selftests install
To install selftests in a user specified location:
$ make -C tools/testing/selftests install INSTALL_PATH=/some/other/path
Running installed selftests #
Found in the install directory, as well as in the Kselftest tarball, is a script named run_kselftest.sh to run the tests.
You can simply do the following to run the installed Kselftests. Please note some tests will require root privileges:
$ cd kselftest_install
$ ./run_kselftest.sh
To see the list of available tests, the -l option can be used:
$ ./run_kselftest.sh -l
The -c option can be used to run all the tests from a test collection, or the -t option for specific single tests. Either can be used multiple times:
$ ./run_kselftest.sh -c size -c seccomp -t timers:posix_timers -t timer:nanosleep
For other features see the script usage output, seen with the -h option.
Timeout for selftests #
Selftests are designed to be quick and so a default timeout is used of 45 seconds for each test. Tests can override the default timeout by adding a settings file in their directory and set a timeout variable there to the configured a desired upper timeout for the test. Only a few tests override the timeout with a value higher than 45 seconds, selftests strives to keep it that way. Timeouts in selftests are not considered fatal because the system under which a test runs may change and this can also modify the expected time it takes to run a test. If you have control over the systems which will run the tests you can configure a test runner on those systems to use a greater or lower timeout on the command line as with the -o or the --override-timeout argument. For example to use 165 seconds instead one would use:
$ ./run_kselftest.sh --override-timeout 165
You can look at the TAP output to see if you ran into the timeout. Test runners which know a test must run under a specific time can then optionally treat these timeouts then as fatal.
Packaging selftests #
In some cases packaging is desired, such as when tests need to run on a different system. To package selftests, run:
$ make -C tools/testing/selftests gen_tar
This generates a tarball in the INSTALL_PATH/kselftest-packages directory. By default, .gz format is used. The tar compression format can be overridden by specifying a FORMAT make variable. Any value recognized by tar's auto-compress option is supported, such as:
$ make -C tools/testing/selftests gen_tar FORMAT=.xz
make gen_tar invokes make install so you can use it to package a subset of tests by using variables specified in Running a subset of selftests section:
$ make -C tools/testing/selftests gen_tar TARGETS="size" FORMAT=.xz
Contributing new tests #
In general, the rules for selftests are
Do as much as you can if you're not root;
Don't take too long;
Don't break the build on any architecture, and
Don't cause the top-level "make run_tests" to fail if your feature is unconfigured.
The output of tests must conform to the TAP standard to ensure high testing quality and to capture failures/errors with specific details. The kselftest.h and kselftest_harness.h headers provide wrappers for outputting test results. These wrappers should be used for pass, fail, exit, and skip messages. CI systems can easily parse TAP output messages to detect test results.
Contributing new tests (details) #
In your Makefile, use facilities from lib.mk by including it instead of reinventing the wheel. Specify flags and binaries generation flags on need basis before including lib.mk.
CFLAGS = $(KHDR_INCLUDES) TEST_GEN_PROGS := close_range_test include ../lib.mkUse TEST_GEN_XXX if such binaries or files are generated during compiling.
TEST_PROGS, TEST_GEN_PROGS mean it is the executable tested by default.
TEST_GEN_MODS_DIR should be used by tests that require modules to be built before the test starts. The variable will contain the name of the directory containing the modules.
TEST_CUSTOM_PROGS should be used by tests that require custom build rules and prevent common build rule use.
TEST_PROGS are for test shell scripts. Please ensure shell script has its exec bit set. Otherwise, lib.mk run_tests will generate a warning.
TEST_CUSTOM_PROGS and TEST_PROGS will be run by common run_tests.
TEST_PROGS_EXTENDED, TEST_GEN_PROGS_EXTENDED mean it is the executable which is not tested by default.
TEST_FILES, TEST_GEN_FILES mean it is the file which is used by test.
TEST_INCLUDES is similar to TEST_FILES, it lists files which should be included when exporting or installing the tests, with the following differences:
symlinks to files in other directories are preserved
the part of paths below tools/testing/selftests/ is preserved when copying the files to the output directory
TEST_INCLUDES is meant to list dependencies located in other directories of the selftests hierarchy.
First use the headers inside the kernel source and/or git repo, and then the system headers. Headers for the kernel release as opposed to headers installed by the distro on the system should be the primary focus to be able to find regressions. Use KHDR_INCLUDES in Makefile to include headers from the kernel source.
If a test needs specific kernel config options enabled, add a config file in the test directory to enable them.
e.g: tools/testing/selftests/android/config
Create a .gitignore file inside test directory and add all generated objects in it.
Add new test name in TARGETS in selftests/Makefile:
TARGETS += androidAll changes should pass:
kselftest-{all,install,clean,gen_tar} kselftest-{all,install,clean,gen_tar} O=abo_path kselftest-{all,install,clean,gen_tar} O=rel_path make -C tools/testing/selftests {all,install,clean,gen_tar} make -C tools/testing/selftests {all,install,clean,gen_tar} O=abs_path make -C tools/testing/selftests {all,install,clean,gen_tar} O=rel_path
Test Module #
Kselftest tests the kernel from userspace. Sometimes things need testing from within the kernel, one method of doing this is to create a test module. We can tie the module into the kselftest framework by using a shell script test runner. kselftest/module.sh is designed to facilitate this process. There is also a header file provided to assist writing kernel modules that are for use with kselftest:
-
tools/testing/selftests/kselftest_module.h -
tools/testing/selftests/kselftest/module.sh
Note that test modules should taint the kernel with TAINT_TEST. This will happen automatically for modules which are in the tools/testing/ directory, or for modules which use the kselftest_module.h header above. Otherwise, you'll need to add MODULE_INFO(test, "Y") to your module source. selftests which do not load modules typically should not taint the kernel, but in cases where a non-test module is loaded, TEST_TAINT can be applied from userspace by writing to /proc/sys/kernel/tainted.
How to use #
Here we show the typical steps to create a test module and tie it into kselftest. We use kselftests for lib/ as an example.
-
Create the test module
-
Create the test script that will run (load/unload) the module e.g.
tools/testing/selftests/lib/bitmap.sh -
Add line to config file e.g.
tools/testing/selftests/lib/config -
Add test script to makefile e.g.
tools/testing/selftests/lib/Makefile -
Verify it works:
# Assumes you have booted a fresh build of this kernel tree
Example Module #
A bare bones test module might look like this:
// SPDX-License-Identifier: GPL-2.0+
;
/*
* Kernel module for testing the foobinator
*/
static int __init
static void __init
;
;
;
;
Example test script #
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0+
Test Harness #
The kselftest_harness.h file contains useful helpers to build tests. The test harness is for userspace testing, for kernel space testing see Test Module above.
The tests from tools/testing/selftests/seccomp/seccomp_bpf.c can be used as example.
Example #
;
Helpers #
TH_LOG() #
Parameters
fmt: format string...: optional arguments
Description
Optional debug logging function available for use in tests. Logging may be enabled or disabled by defining TH_LOG_ENABLED. E.g., #define TH_LOG_ENABLED 1
If no definition is provided, logging is enabled by default.
TEST() #
Defines the test function and creates the registration stub
Parameters
test_name: test name
Description
Defines a test by name. Names must be unique and tests must not be run in parallel. The implementation containing block is a function and scoping should be treated as such. Returning early may be performed with a bare "return;" statement.
EXPECT_* and ASSERT_* are valid in a TEST() { } context.
TEST_SIGNAL() #
Parameters
test_name: test namesignal: signal number
Description
Defines a test by name and the expected term signal. Names must be unique and tests must not be run in parallel. The implementation containing block is a function and scoping should be treated as such. Returning early may be performed with a bare "return;" statement.
EXPECT_* and ASSERT_* are valid in a TEST() { } context.
FIXTURE_DATA() #
Wraps the struct name so we have one less argument to pass around
Parameters
datatype_name: datatype name
Description
Almost always, you want just FIXTURE() instead (see below).
This call may be used when the type of the fixture data
is needed. In general, this should not be needed unless
the self is being passed to a helper directly.
FIXTURE() #
Called once per fixture to setup the data and register
Parameters
fixture_name: fixture name
Description
;
Defines the data provided to TEST_F()-defined tests as self. It should be
populated and cleaned up using FIXTURE_SETUP() and FIXTURE_TEARDOWN().
FIXTURE_SETUP() #
Prepares the setup function for the fixture. _metadata is included so that EXPECT_, ASSERT_ etc. work correctly.
Parameters
fixture_name: fixture name
Description
Populates the required "setup" function for a fixture. An instance of the
datatype defined with FIXTURE_DATA() will be exposed as self for the
implementation.
ASSERT_* are valid for use in this context and will prempt the execution of any dependent fixture tests.
A bare "return;" statement may be used to return early.
FIXTURE_TEARDOWN() #
Parameters
fixture_name: fixture name
Description
_metadata is included so that EXPECT_, ASSERT_ etc. work correctly.
Populates the required "teardown" function for a fixture. An instance of the
datatype defined with FIXTURE_DATA() will be exposed as self for the
implementation to clean up.
A bare "return;" statement may be used to return early.
FIXTURE_VARIANT() #
Optionally called once per fixture to declare fixture variant
Parameters
fixture_name: fixture name
Description
;
Defines type of constant parameters provided to FIXTURE_SETUP(), TEST_F() and
FIXTURE_TEARDOWN as variant. Variants allow the same tests to be run with
different arguments.
FIXTURE_VARIANT_ADD() #
Called once per fixture variant to setup and register the data
Parameters
fixture_name: fixture namevariant_name: name of the parameter set
Description
;
Defines a variant of the test fixture, provided to FIXTURE_SETUP() and
TEST_F() as variant. Tests of each fixture will be run once for each
variant.
TEST_F() #
Emits test registration and helpers for fixture-based test cases
Parameters
fixture_name: fixture nametest_name: test name
Description
Defines a test that depends on a fixture (e.g., is part of a test case).
Very similar to TEST() except that self is the setup instance of fixture's
datatype exposed for use by the implementation.
The metadata object is shared (MAP_SHARED) with all the potential forked processes, which enables them to use EXCEPT() and ASSERT_().
The self object is only shared with the potential forked processes if
FIXTURE_TEARDOWN_PARENT() is used instead of FIXTURE_TEARDOWN().
TEST_HARNESS_MAIN #
Simple wrapper to run the test harness
Description
Use once to append a main() to the test file.
Operators #
Operators for use in TEST() and TEST_F().
ASSERT_* calls will stop test execution immediately.
EXPECT_* calls will emit a failure warning, note it, and continue.
ASSERT_EQ() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_EQ(expected, measured): expected == measured
ASSERT_NE() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_NE(expected, measured): expected != measured
ASSERT_LT() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_LT(expected, measured): expected < measured
ASSERT_LE() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_LE(expected, measured): expected <= measured
ASSERT_GT() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_GT(expected, measured): expected > measured
ASSERT_GE() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_GE(expected, measured): expected >= measured
ASSERT_NULL() #
Parameters
seen: measured value
Description
ASSERT_NULL(measured): NULL == measured
ASSERT_TRUE() #
Parameters
seen: measured value
Description
ASSERT_TRUE(measured): measured != 0
ASSERT_FALSE() #
Parameters
seen: measured value
Description
ASSERT_FALSE(measured): measured == 0
ASSERT_STREQ() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_STREQ(expected, measured): !strcmp(expected, measured)
ASSERT_STRNE() #
Parameters
expected: expected valueseen: measured value
Description
ASSERT_STRNE(expected, measured): strcmp(expected, measured)
EXPECT_EQ() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_EQ(expected, measured): expected == measured
EXPECT_NE() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_NE(expected, measured): expected != measured
EXPECT_LT() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_LT(expected, measured): expected < measured
EXPECT_LE() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_LE(expected, measured): expected <= measured
EXPECT_GT() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_GT(expected, measured): expected > measured
EXPECT_GE() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_GE(expected, measured): expected >= measured
EXPECT_NULL() #
Parameters
seen: measured value
Description
EXPECT_NULL(measured): NULL == measured
EXPECT_TRUE() #
Parameters
seen: measured value
Description
EXPECT_TRUE(measured): 0 != measured
EXPECT_FALSE() #
Parameters
seen: measured value
Description
EXPECT_FALSE(measured): 0 == measured
EXPECT_STREQ() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_STREQ(expected, measured): !strcmp(expected, measured)
EXPECT_STRNE() #
Parameters
expected: expected valueseen: measured value
Description
EXPECT_STRNE(expected, measured): strcmp(expected, measured)
The Kernel Test Anything Protocol (KTAP), version 1
Peios Kernel / Kernel development / Development tools
TAP, or the Test Anything Protocol is a format for specifying test results used by a number of projects. Its website and specification are found at this link. The Linux Kernel largely uses TAP output for test results. However, Kernel testing frameworks have special needs for test results which don't align with the original TAP specification. Thus, a "Kernel TAP" (KTAP) format is specified to extend and alter TAP to support these use-cases. This specification describes the generally accepted format of KTAP as it is currently used in the kernel.
KTAP test results describe a series of tests (which may be nested: i.e., test can have subtests), each of which can contain both diagnostic data -- e.g., log lines -- and a final result. The test structure and results are machine-readable, whereas the diagnostic data is unstructured and is there to aid human debugging.
KTAP output is built from four different types of lines:
-
Version lines
-
Plan lines
-
Test case result lines
-
Diagnostic lines
In general, valid KTAP output should also form valid TAP output, but some information, in particular nested test results, may be lost. Also note that there is a stagnant draft specification for TAP14, KTAP diverges from this in a couple of places (notably the "Subtest" header), which are described where relevant later in this document.
Version lines #
All KTAP-formatted results begin with a "version line" which specifies which version of the (K)TAP standard the result is compliant with.
For example:
-
"KTAP version 1"
-
"TAP version 13"
-
"TAP version 14"
Note that, in KTAP, subtests also begin with a version line, which denotes the start of the nested test results. This differs from TAP14, which uses a separate "Subtest" line.
While, going forward, "KTAP version 1" should be used by compliant tests, it is expected that most parsers and other tooling will accept the other versions listed here for compatibility with existing tests and frameworks.
Plan lines #
A test plan provides the number of tests (or subtests) in the KTAP output.
Plan lines must follow the format of "1..N" where N is the number of tests or subtests. Plan lines follow version lines to indicate the number of nested tests.
While there are cases where the number of tests is not known in advance -- in which case the test plan may be omitted -- it is strongly recommended one is present where possible.
Test case result lines #
Test case result lines indicate the final status of a test. They are required and must have the format:
<result> <number> [<description>][ # [<directive>] [<diagnostic data>]]
The result can be either "ok", which indicates the test case passed, or "not ok", which indicates that the test case failed.
<number> represents the number of the test being performed. The first test must have the number 1 and the number then must increase by 1 for each additional subtest within the same test at the same nesting level.
The description is a description of the test, generally the name of the test, and can be any string of characters other than # or a newline. The description is optional, but recommended.
The directive and any diagnostic data is optional. If either are present, they must follow a hash sign, "#".
A directive is a keyword that indicates a different outcome for a test other than passed and failed. The directive is optional, and consists of a single keyword preceding the diagnostic data. In the event that a parser encounters a directive it doesn't support, it should fall back to the "ok" / "not ok" result.
Currently accepted directives are:
-
"SKIP", which indicates a test was skipped (note the result of the test case result line can be either "ok" or "not ok" if the SKIP directive is used)
-
"TODO", which indicates that a test is not expected to pass at the moment, e.g. because the feature it is testing is known to be broken. While this directive is inherited from TAP, its use in the kernel is discouraged.
-
"XFAIL", which indicates that a test is expected to fail. This is similar to "TODO", above, and is used by some kselftest tests.
-
“TIMEOUT”, which indicates a test has timed out (note the result of the test case result line should be “not ok” if the TIMEOUT directive is used)
-
“ERROR”, which indicates that the execution of a test has failed due to a specific error that is included in the diagnostic data. (note the result of the test case result line should be “not ok” if the ERROR directive is used)
The diagnostic data is a plain-text field which contains any additional details about why this result was produced. This is typically an error message for ERROR or failed tests, or a description of missing dependencies for a SKIP result.
The diagnostic data field is optional, and results which have neither a directive nor any diagnostic data do not need to include the "#" field separator.
Example result lines include:
ok 1 test_case_name
The test "test_case_name" passed.
not ok 1 test_case_name
The test "test_case_name" failed.
ok 1 test # SKIP necessary dependency unavailable
The test "test" was SKIPPED with the diagnostic message "necessary dependency unavailable".
not ok 1 test # TIMEOUT 30 seconds
The test "test" timed out, with diagnostic data "30 seconds".
ok 5 check return code # rcode=0
The test "check return code" passed, with additional diagnostic data “rcode=0”
Diagnostic lines #
If tests wish to output any further information, they should do so using "diagnostic lines". Diagnostic lines are optional, freeform text, and are often used to describe what is being tested and any intermediate results in more detail than the final result and diagnostic data line provides.
Diagnostic lines are formatted as "# <diagnostic_description>", where the description can be any string. Diagnostic lines can be anywhere in the test output. As a rule, diagnostic lines regarding a test are directly before the test result line for that test.
Note that most tools will treat unknown lines (see below) as diagnostic lines, even if they do not start with a "#": this is to capture any other useful kernel output which may help debug the test. It is nevertheless recommended that tests always prefix any diagnostic output they have with a "#" character.
Unknown lines #
There may be lines within KTAP output that do not follow the format of one of the four formats for lines described above. This is allowed, however, they will not influence the status of the tests.
This is an important difference from TAP. Kernel tests may print messages to the system console or a log file. Both of these destinations may contain messages either from unrelated kernel or userspace activity, or kernel messages from non-test code that is invoked by the test. The kernel code invoked by the test likely is not aware that a test is in progress and thus can not print the message as a diagnostic message.
Nested tests #
In KTAP, tests can be nested. This is done by having a test include within its output an entire set of KTAP-formatted results. This can be used to categorize and group related tests, or to split out different results from the same test.
The "parent" test's result should consist of all of its subtests' results, starting with another KTAP version line and test plan, and end with the overall result. If one of the subtests fail, for example, the parent test should also fail.
Additionally, all lines in a subtest should be indented. One level of indentation is two spaces: " ". The indentation should begin at the version line and should end before the parent test's result line.
"Unknown lines" are not considered to be lines in a subtest and thus are allowed to be either indented or not indented.
An example of a test with two nested subtests:
KTAP version 1
1..1
KTAP version 1
1..2
ok 1 test_1
not ok 2 test_2
# example failed
not ok 1 example
An example format with multiple levels of nested testing:
KTAP version 1
1..2
KTAP version 1
1..2
KTAP version 1
1..2
not ok 1 test_1
ok 2 test_2
not ok 1 test_3
ok 2 test_4 # SKIP
not ok 1 example_test_1
ok 2 example_test_2
Major differences between TAP and KTAP #
|
Feature |
TAP |
KTAP |
|---|---|---|
|
yaml and json in diagnosic message |
ok |
not recommended |
|
TODO directive |
ok |
not recognized |
|
allows an arbitrary number of tests to be nested |
no |
yes |
|
"Unknown lines" are in category of "Anything else" |
yes |
no |
|
"Unknown lines" are |
incorrect |
allowed |
The TAP14 specification does permit nested tests, but instead of using another nested version line, uses a line of the form "Subtest: <name>" where <name> is the name of the parent test.
Example KTAP output #
KTAP version 1
1..1
KTAP version 1
1..3
KTAP version 1
1..1
# test_1: initializing test_1
ok 1 test_1
ok 1 example_test_1
KTAP version 1
1..2
ok 1 test_1 # SKIP test_1 skipped
ok 2 test_2
ok 2 example_test_2
KTAP version 1
1..3
ok 1 test_1
# test_2: FAIL
not ok 2 test_2
ok 3 test_3 # SKIP test_3 skipped
not ok 3 example_test_3
not ok 1 main_test
This output defines the following hierarchy:
A single test called "main_test", which fails, and has three subtests:
-
"example_test_1", which passes, and has one subtest:
- "test_1", which passes, and outputs the diagnostic message "test_1: initializing test_1"
-
"example_test_2", which passes, and has two subtests:
-
"test_1", which is skipped, with the explanation "test_1 skipped"
-
"test_2", which passes
-
-
"example_test_3", which fails, and has three subtests
-
"test_1", which passes
-
"test_2", which outputs the diagnostic line "test_2: FAIL", and fails.
-
"test_3", which is skipped with the explanation "test_3 skipped"
-
Note that the individual subtests with the same names do not conflict, as they are found in different parent tests. This output also exhibits some sensible rules for "bubbling up" test results: a test fails if any of its subtests fail. Skipped tests do not affect the result of the parent test (though it often makes sense for a test to be marked skipped if _all_ of its subtests have been skipped).
See also: #
-
The TAP specification: https://testanything.org/tap-version-13-specification.html
-
The (stagnant) TAP version 14 specification: https://github.com/TestAnything/Specification/blob/tap-14-specification/specification.md
-
The kselftest documentation: Documentation/dev-tools/kselftest.rst
-
The KUnit documentation: Documentation/dev-tools/kunit/index.rst
Using Propeller with the Linux kernel
Peios Kernel / Kernel development / Development tools
This enables Propeller build support for the kernel when using Clang compiler. Propeller is a profile-guided optimization (PGO) method used to optimize binary executables. Like AutoFDO, it utilizes hardware sampling to gather information about the frequency of execution of different code paths within a binary. Unlike AutoFDO, this information is then used right before linking phase to optimize (among others) block layout within and across functions.
A few important notes about adopting Propeller optimization:
-
Although it can be used as a standalone optimization step, it is strongly recommended to apply Propeller on top of AutoFDO, AutoFDO+ThinLTO or Instrument FDO. The rest of this document assumes this paradigm.
-
Propeller uses another round of profiling on top of AutoFDO/AutoFDO+ThinLTO/iFDO. The whole build process involves "build-afdo - train-afdo - build-propeller - train-propeller - build-optimized".
-
Propeller requires LLVM 19 release or later for Clang/Clang++ and the linker(ld.lld).
-
In addition to LLVM toolchain, Propeller requires a profiling conversion tool: https://github.com/google/autofdo with a release after v0.30.1: https://github.com/google/autofdo/releases/tag/v0.30.1.
The Propeller optimization process involves the following steps:
-
Initial building: Build the AutoFDO or AutoFDO+ThinLTO binary as you would normally do, but with a set of compile-time / link-time flags, so that a special metadata section is created within the kernel binary. The special section is only intend to be used by the profiling tool, it is not part of the runtime image, nor does it change kernel run time text sections.
-
Profiling: The above kernel is then run with a representative workload to gather execution frequency data. This data is collected using hardware sampling, via perf. Propeller is most effective on platforms supporting advanced PMU features like LBR on Intel machines. This step is the same as profiling the kernel for AutoFDO (the exact perf parameters can be different).
-
Propeller profile generation: Perf output file is converted to a pair of Propeller profiles via an offline tool.
-
Optimized build: Build the AutoFDO or AutoFDO+ThinLTO optimized binary as you would normally do, but with a compile-time / link-time flag to pick up the Propeller compile time and link time profiles. This build step uses 3 profiles - the AutoFDO profile, the Propeller compile-time profile and the Propeller link-time profile.
-
Deployment: The optimized kernel binary is deployed and used in production environments, providing improved performance and reduced latency.
Preparation #
Configure the kernel with:
CONFIG_AUTOFDO_CLANG=y
CONFIG_PROPELLER_CLANG=y
Customization #
The default CONFIG_PROPELLER_CLANG setting covers kernel space objects for Propeller builds. One can, however, enable or disable Propeller build for individual files and directories by adding a line similar to the following to the respective kernel Makefile:
-
For enabling a single file (e.g. foo.o):
PROPELLER_PROFILE_foo.o := y -
For enabling all files in one directory:
PROPELLER_PROFILE := y -
For disabling one file:
PROPELLER_PROFILE_foo.o := n -
For disabling all files in one directory:
PROPELLER__PROFILE := n
Workflow #
Here is an example workflow for building an AutoFDO+Propeller kernel:
-
Assuming an AutoFDO profile is already collected following instructions in the AutoFDO document, build the kernel on the host machine, with AutoFDO and Propeller build configs
CONFIG_AUTOFDO_CLANG=y CONFIG_PROPELLER_CLANG=yand
$ make LLVM=1 CLANG_AUTOFDO_PROFILE=<autofdo-profile-name> -
Install the kernel on the test machine.
-
Run the load tests. The '-c' option in perf specifies the sample event period. We suggest using a suitable prime number, like 500009, for this purpose.
-
For Intel platforms:
$ perf record -e BR_INST_RETIRED.NEAR_TAKEN:k -a -N -b -c <count> -o <perf_file> -- <loadtest> -
For AMD platforms:
$ perf record --pfm-event RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a -N -b -c <count> -o <perf_file> -- <loadtest>
Note you can repeat the above steps to collect multiple <perf_file>s.
-
-
(Optional) Download the raw perf file(s) to the host machine.
-
Use the create_llvm_prof tool (https://github.com/google/autofdo) to generate Propeller profile.
$ create_llvm_prof --binary=<vmlinux> --profile=<perf_file> --format=propeller --propeller_output_module_name --out=<propeller_profile_prefix>_cc_profile.txt --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt"<propeller_profile_prefix>" can be something like "/home/user/dir/any_string".
This command generates a pair of Propeller profiles: "<propeller_profile_prefix>_cc_profile.txt" and "<propeller_profile_prefix>_ld_profile.txt".
If there are more than 1 perf_file collected in the previous step, you can create a temp list file "<perf_file_list>" with each line containing one perf file name and run:
$ create_llvm_prof --binary=<vmlinux> --profile=@<perf_file_list> --format=propeller --propeller_output_module_name --out=<propeller_profile_prefix>_cc_profile.txt --propeller_symorder=<propeller_profile_prefix>_ld_profile.txt -
Rebuild the kernel using the AutoFDO and Propeller profiles.
CONFIG_AUTOFDO_CLANG=y CONFIG_PROPELLER_CLANG=yand
$ make LLVM=1 CLANG_AUTOFDO_PROFILE=<profile_file> CLANG_PROPELLER_PROFILE_PREFIX=<propeller_profile_prefix>
Sparse
Peios Kernel / Kernel development / Development tools
Sparse is a semantic checker for C programs; it can be used to find a number of potential problems with kernel code. See https://lwn.net/Articles/689907/ for an overview of sparse; this document contains some kernel-specific sparse information. More information on sparse, mainly about its internals, can be found in its official pages at https://sparse.docs.kernel.org.
Using sparse for typechecking #
"__bitwise" is a type attribute, so you have to do something like this:
typedef int __bitwise pm_request_t;
enum pm_request {
PM_SUSPEND = (__force pm_request_t) 1,
PM_RESUME = (__force pm_request_t) 2
};
which makes PM_SUSPEND and PM_RESUME "bitwise" integers (the "__force" is there because sparse will complain about casting to/from a bitwise type, but in this case we really _do_ want to force the conversion). And because the enum values are all the same type, now "enum pm_request" will be that type too.
And with gcc, all the "__bitwise"/"__force stuff" goes away, and it all ends up looking just like integers to gcc.
Quite frankly, you don't need the enum there. The above all really just boils down to one special "int __bitwise" type.
So the simpler way is to just do:
typedef int __bitwise pm_request_t;
#define PM_SUSPEND ((__force pm_request_t) 1)
#define PM_RESUME ((__force pm_request_t) 2)
and you now have all the infrastructure needed for strict typechecking.
One small note: the constant integer "0" is special. You can use a constant zero as a bitwise integer type without sparse ever complaining. This is because "bitwise" (as the name implies) was designed for making sure that bitwise types don't get mixed up (little-endian vs big-endian vs cpu-endian vs whatever), and there the constant "0" really _is_ special.
Getting sparse #
You can get tarballs of the latest released versions from: https://www.kernel.org/pub/software/devel/sparse/dist/
Alternatively, you can get snapshots of the latest development version of sparse using git to clone:
git://git.kernel.org/pub/scm/devel/sparse/sparse.git
Once you have it, just do:
make
make install
as a regular user, and it will install sparse in your ~/bin directory.
Using sparse #
Do a kernel make with "make C=1" to run sparse on all the C files that get recompiled, or use "make C=2" to run sparse on the files whether they need to be recompiled or not. The latter is a fast way to check the whole tree if you have already built it.
The optional make variable CF can be used to pass arguments to sparse. The build system passes -Wbitwise to sparse automatically.
Note that sparse defines the __CHECKER__ preprocessor symbol.
Device testing with kselftest
Peios Kernel / Kernel development / Development tools
There are a few different kselftests available for testing devices generically, with some overlap in coverage and different requirements. This document aims to give an overview of each one.
Note: Paths in this document are relative to the kselftest folder (tools/testing/selftests).
Device oriented kselftests:
-
Devicetree (
dt)-
Coverage: Probe status for devices described in Devicetree
-
Requirements: None
-
-
Error logs (
devices/error_logs)-
Coverage: Error (or more critical) log messages presence coming from any device
-
Requirements: None
-
-
Discoverable bus (
devices/probe)-
Coverage: Presence and probe status of USB or PCI devices that have been described in the reference file
-
Requirements: Manually describe the devices that should be tested in a YAML reference file (see
devices/probe/boards/google,spherion.yamlfor an example)
-
-
Exist (
devices/exist)-
Coverage: Presence of all devices
-
Requirements: Generate the reference (see
devices/exist/README.rstfor details) on a known-good kernel
-
Therefore, the suggestion is to enable the error log and devicetree tests on all (DT-based) platforms, since they don't have any requirements. Then to greatly improve coverage, generate the reference for each platform and enable the exist test. The discoverable bus test can be used to verify the probe status of specific USB or PCI devices, but is probably not worth it for most cases.
Kernel Testing Guide
Peios Kernel / Kernel development / Development tools
There are a number of different tools for testing the Linux kernel, so knowing when to use each of them can be a challenge. This document provides a rough overview of their differences, and how they fit together.
Writing and Running Tests #
The bulk of kernel tests are written using either the kselftest or KUnit frameworks. These both provide infrastructure to help make running tests and groups of tests easier, as well as providing helpers to aid in writing new tests.
If you're looking to verify the behaviour of the Kernel — particularly specific parts of the kernel — then you'll want to use KUnit or kselftest.
The Difference Between KUnit and kselftest #
KUnit (Documentation/dev-tools/kunit/index.rst) is an entirely in-kernel system for "white box" testing: because test code is part of the kernel, it can access internal structures and functions which aren't exposed to userspace.
KUnit tests therefore are best written against small, self-contained parts of the kernel, which can be tested in isolation. This aligns well with the concept of 'unit' testing.
For example, a KUnit test might test an individual kernel function (or even a single codepath through a function, such as an error handling case), rather than a feature as a whole.
This also makes KUnit tests very fast to build and run, allowing them to be run frequently as part of the development process.
There is a KUnit test style guide which may give further pointers in Documentation/dev-tools/kunit/style.rst
kselftest (Documentation/dev-tools/kselftest.rst), on the other hand, is largely implemented in userspace, and tests are normal userspace scripts or programs.
This makes it easier to write more complicated tests, or tests which need to manipulate the overall system state more (e.g., spawning processes, etc.). However, it's not possible to call kernel functions directly from kselftest. This means that only kernel functionality which is exposed to userspace somehow (e.g. by a syscall, device, filesystem, etc.) can be tested with kselftest. To work around this, some tests include a companion kernel module which exposes more information or functionality. If a test runs mostly or entirely within the kernel, however, KUnit may be the more appropriate tool.
kselftest is therefore suited well to tests of whole features, as these will expose an interface to userspace, which can be tested, but not implementation details. This aligns well with 'system' or 'end-to-end' testing.
For example, all new system calls should be accompanied by kselftest tests.
Code Coverage Tools #
The Linux Kernel supports two different code coverage measurement tools. These can be used to verify that a test is executing particular functions or lines of code. This is useful for determining how much of the kernel is being tested, and for finding corner-cases which are not covered by the appropriate test.
Documentation/dev-tools/gcov.rst is GCC's coverage testing tool, which can be used with the kernel to get global or per-module coverage. Unlike KCOV, it does not record per-task coverage. Coverage data can be read from debugfs, and interpreted using the usual gcov tooling.
Documentation/dev-tools/kcov.rst is a feature which can be built in to the kernel to allow capturing coverage on a per-task level. It's therefore useful for fuzzing and other situations where information about code executed during, for example, a single syscall is useful.
Dynamic Analysis Tools #
The kernel also supports a number of dynamic analysis tools, which attempt to detect classes of issues when they occur in a running kernel. These typically each look for a different class of bugs, such as invalid memory accesses, concurrency issues such as data races, or other undefined behaviour like integer overflows.
Some of these tools are listed below:
-
kmemleak detects possible memory leaks. See Documentation/dev-tools/kmemleak.rst
-
KASAN detects invalid memory accesses such as out-of-bounds and use-after-free errors. See Documentation/dev-tools/kasan.rst
-
UBSAN detects behaviour that is undefined by the C standard, like integer overflows. See Documentation/dev-tools/ubsan.rst
-
KCSAN detects data races. See Documentation/dev-tools/kcsan.rst
-
KFENCE is a low-overhead detector of memory issues, which is much faster than KASAN and can be used in production. See Documentation/dev-tools/kfence.rst
-
lockdep is a locking correctness validator. See Documentation/locking/lockdep-design.rst
-
Runtime Verification (RV) supports checking specific behaviours for a given subsystem. See Documentation/trace/rv/runtime-verification.rst
-
There are several other pieces of debug instrumentation in the kernel, many of which can be found in lib/Kconfig.debug
These tools tend to test the kernel as a whole, and do not "pass" like kselftest or KUnit tests. They can be combined with KUnit or kselftest by running tests on a kernel with these tools enabled: you can then be sure that none of these errors are occurring during the test.
Some of these tools integrate with KUnit or kselftest and will automatically fail tests if an issue is detected.
Static Analysis Tools #
In addition to testing a running kernel, one can also analyze kernel source code directly (at compile time) using static analysis tools. The tools commonly used in the kernel allow one to inspect the whole source tree or just specific files within it. They make it easier to detect and fix problems during the development process.
Sparse can help test the kernel by performing type-checking, lock checking, value range checking, in addition to reporting various errors and warnings while examining the code. See the Documentation/dev-tools/sparse.rst documentation page for details on how to use it.
Smatch extends Sparse and provides additional checks for programming logic mistakes such as missing breaks in switch statements, unused return values on error checking, forgetting to set an error code in the return of an error path, etc. Smatch also has tests against more serious issues such as integer overflows, null pointer dereferences, and memory leaks. See the project page at http://smatch.sourceforge.net/.
Coccinelle is another static analyzer at our disposal. Coccinelle is often used to aid refactoring and collateral evolution of source code, but it can also help to avoid certain bugs that occur in common code patterns. The types of tests available include API tests, tests for correct usage of kernel iterators, checks for the soundness of free operations, analysis of locking behavior, and further tests known to help keep consistent kernel usage. See the Documentation/dev-tools/coccinelle.rst documentation page for details.
Beware, though, that static analysis tools suffer from false positives. Errors and warns need to be evaluated carefully before attempting to fix them.
When to use Sparse and Smatch #
Sparse does type checking, such as verifying that annotated variables do not cause endianness bugs, detecting places that use __user pointers improperly, and analyzing the compatibility of symbol initializers.
Smatch does flow analysis and, if allowed to build the function database, it also does cross function analysis. Smatch tries to answer questions like where is this buffer allocated? How big is it? Can this index be controlled by the user? Is this variable larger than that variable?
It's generally easier to write checks in Smatch than it is to write checks in Sparse. Nevertheless, there are some overlaps between Sparse and Smatch checks.
Strong points of Smatch and Coccinelle #
Coccinelle is probably the easiest for writing checks. It works before the pre-processor so it's easier to check for bugs in macros using Coccinelle. Coccinelle also creates patches for you, which no other tool does.
For example, with Coccinelle you can do a mass conversion from kmalloc(x * size, GFP_KERNEL) to kmalloc_array(x, size, GFP_KERNEL), and that's really useful. If you just created a Smatch warning and try to push the work of converting on to the maintainers they would be annoyed. You'd have to argue about each warning if can really overflow or not.
Coccinelle does no analysis of variable values, which is the strong point of Smatch. On the other hand, Coccinelle allows you to do simple things in a simple way.
Undefined Behavior Sanitizer - UBSAN
Peios Kernel / Kernel development / Development tools
UBSAN is a runtime undefined behaviour checker.
UBSAN uses compile-time instrumentation to catch undefined behavior (UB). Compiler inserts code that perform certain kinds of checks before operations that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_* function called to print error message.
GCC has that feature since 4.9.x [1] (see -fsanitize=undefined option and its suboptions). GCC 5.x has more checkers implemented [2].
Report example #
================================================================================
UBSAN: Undefined behaviour in ../include/linux/bitops.h:110:33
shift exponent 32 is to large for 32-bit type 'unsigned int'
CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc1+ #26
0000000000000000 ffffffff82403cc8 ffffffff815e6cd6 0000000000000001
ffffffff82403cf8 ffffffff82403ce0 ffffffff8163a5ed 0000000000000020
ffffffff82403d78 ffffffff8163ac2b ffffffff815f0001 0000000000000002
Call Trace:
[<ffffffff815e6cd6>] dump_stack+0x45/0x5f
[<ffffffff8163a5ed>] ubsan_epilogue+0xd/0x40
[<ffffffff8163ac2b>] __ubsan_handle_shift_out_of_bounds+0xeb/0x130
[<ffffffff815f0001>] ? radix_tree_gang_lookup_slot+0x51/0x150
[<ffffffff8173c586>] _mix_pool_bytes+0x1e6/0x480
[<ffffffff83105653>] ? dmi_walk_early+0x48/0x5c
[<ffffffff8173c881>] add_device_randomness+0x61/0x130
[<ffffffff83105b35>] ? dmi_save_one_device+0xaa/0xaa
[<ffffffff83105653>] dmi_walk_early+0x48/0x5c
[<ffffffff831066ae>] dmi_scan_machine+0x278/0x4b4
[<ffffffff8111d58a>] ? vprintk_default+0x1a/0x20
[<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
[<ffffffff830b2240>] setup_arch+0x405/0xc2c
[<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
[<ffffffff830ae053>] start_kernel+0x83/0x49a
[<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
[<ffffffff830ad386>] x86_64_start_reservations+0x2a/0x2c
[<ffffffff830ad4f3>] x86_64_start_kernel+0x16b/0x17a
================================================================================
Usage #
To enable UBSAN, configure the kernel with:
CONFIG_UBSAN=y
To exclude files from being instrumented use:
UBSAN_SANITIZE_main.o := n
and to exclude all targets in one directory use:
UBSAN_SANITIZE := n
When disabled for all targets, specific files can be enabled using:
UBSAN_SANITIZE_main.o := y
Detection of unaligned accesses controlled through the separate option - CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support unaligned accesses (CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y). One could still enable it in config, just note that it will produce a lot of UBSAN reports.
References #
KUnit - Linux Kernel Unit Testing
Peios Kernel / Kernel development / Development tools / kunit
Contents:
- Getting Started
- KUnit Architecture
- Running tests with kunit_tool
- Run Tests without kunit_tool
- Writing Tests
- API Reference
- Test Style and Nomenclature
- Frequently Asked Questions
- Tips For Running KUnit Tests
This section details the kernel unit testing framework.
Introduction #
KUnit (Kernel unit testing framework) provides a common framework for unit tests within the Linux kernel. Using KUnit, you can define groups of test cases called test suites. The tests either run on kernel boot if built-in, or load as a module. KUnit automatically flags and reports failed test cases in the kernel log. The test results appear in KTAP (Kernel - Test Anything Protocol) format. It is inspired by JUnit, Python’s unittest.mock, and GoogleTest/GoogleMock (C++ unit testing framework).
KUnit tests are part of the kernel, written in the C (programming) language, and test parts of the Kernel implementation (example: a C language function). Excluding build time, from invocation to completion, KUnit can run around 100 tests in less than 10 seconds. KUnit can test any kernel component, for example: file system, system calls, memory management, device drivers and so on.
KUnit follows the white-box testing approach. The test has access to internal system functionality. KUnit runs in kernel space and is not restricted to things exposed to user-space.
In addition, KUnit has kunit_tool, a script (tools/testing/kunit/kunit.py) that configures the Linux kernel, runs KUnit tests under QEMU or UML (User Mode Linux), parses the test results and displays them in a user friendly manner.
Features #
-
Provides a framework for writing unit tests.
-
Runs tests on any kernel architecture.
-
Runs a test in milliseconds.
Prerequisites #
-
Any Linux kernel compatible hardware.
-
For Kernel under test, Linux kernel version 5.5 or greater.
Unit Testing #
A unit test tests a single unit of code in isolation. A unit test is the finest granularity of testing and allows all possible code paths to be tested in the code under test. This is possible if the code under test is small and does not have any external dependencies outside of the test's control like hardware.
Write Unit Tests #
To write good unit tests, there is a simple but powerful pattern: Arrange-Act-Assert. This is a great way to structure test cases and defines an order of operations.
-
Arrange inputs and targets: At the start of the test, arrange the data that allows a function to work. Example: initialize a statement or object.
-
Act on the target behavior: Call your function/code under test.
-
Assert expected outcome: Verify that the result (or resulting state) is as expected.
Unit Testing Advantages #
-
Increases testing speed and development in the long run.
-
Detects bugs at initial stage and therefore decreases bug fix cost compared to acceptance testing.
-
Improves code quality.
-
Encourages writing testable code.
Read also What is the difference between a unit test and other kinds of tests?.
How do I use it? #
You can find a step-by-step guide to writing and running KUnit tests in Documentation/dev-tools/kunit/start.rst
Alternatively, feel free to look through the rest of the KUnit documentation, or to experiment with tools/testing/kunit/kunit.py and the example test under lib/kunit/kunit-example-test.c
Happy testing!
KUnit Architecture
Peios Kernel / Kernel development / Development tools / kunit
The KUnit architecture is divided into two parts:
In-Kernel Testing Framework #
The kernel testing library supports KUnit tests written in C using KUnit. These KUnit tests are kernel code. KUnit performs the following tasks:
-
Organizes tests
-
Reports test results
-
Provides test utilities
Test Cases #
The test case is the fundamental unit in KUnit. KUnit test cases are organised into suites. A KUnit test case is a function with type signature void (*)(struct kunit *test). These test case functions are wrapped in a struct called struct kunit_case.
Each KUnit test case receives a struct kunit context object that tracks a running test. The KUnit assertion macros and other KUnit utilities use the struct kunit context object. As an exception, there are two fields:
-
->priv: The setup functions can use it to store arbitrary test user data. -
->param_value: It contains the parameter value which can be retrieved in the parameterized tests.
Test Suites #
A KUnit suite includes a collection of test cases. The KUnit suites are represented by the struct kunit_suite. For example:
static struct kunit_case example_test_cases = ;
static struct kunit_suite example_test_suite = ;
;
In the above example, the test suite example_test_suite, runs the test cases example_test_foo, example_test_bar, and example_test_baz. Before running the test, the example_test_init is called and after running the test, example_test_exit is called. The kunit_test_suite(example_test_suite) registers the test suite with the KUnit test framework.
Executor #
The KUnit executor can list and run built-in KUnit tests on boot. The Test suites are stored in a linker section called .kunit_test_suites. For the code, see KUNIT_TABLE() macro definition in include/asm-generic/vmlinux.lds.h. The linker section consists of an array of pointers to struct kunit_suite, and is populated by the kunit_test_suites() macro. The KUnit executor iterates over the linker section array in order to run all the tests that are compiled into the kernel.
KUnit Suite Memory Diagram
On the kernel boot, the KUnit executor uses the start and end addresses of this section to iterate over and run all tests. For the implementation of the executor, see lib/kunit/executor.c. When built as a module, the kunit_test_suites() macro defines a module_init() function, which runs all the tests in the compilation unit instead of utilizing the executor.
In KUnit tests, some error classes do not affect other tests or parts of the kernel, each KUnit case executes in a separate thread context. See the kunit_try_catch_run() function in lib/kunit/try-catch.c.
Assertion Macros #
KUnit tests verify state using expectations/assertions. All expectations/assertions are formatted as: KUNIT_{EXPECT|ASSERT}_<op>[_MSG](kunit, property[, message])
-
{EXPECT|ASSERT}determines whether the check is an assertion or an expectation. In the event of a failure, the testing flow differs as follows:-
For expectations, the test is marked as failed and the failure is logged.
-
Failing assertions, on the other hand, result in the test case being terminated immediately.
-
Assertions call the function:
void __noreturn __kunit_abort(struct kunit *). -
__kunit_abortcalls the function:void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch). -
kunit_try_catch_throwcalls the function:void kthread_complete_and_exit(struct completion *, long) __noreturn;and terminates the special thread context.
-
-
-
<op>denotes a check with options:TRUE(supplied property has the boolean value "true"),EQ(two supplied properties are equal),NOT_ERR_OR_NULL(supplied pointer is not null and does not contain an "err" value). -
[_MSG]prints a custom message on failure.
Test Result Reporting #
KUnit prints the test results in KTAP format. KTAP is based on TAP14, see Documentation/dev-tools/ktap.rst. KTAP works with KUnit and Kselftest. The KUnit executor prints KTAP results to dmesg, and debugfs (if configured).
Parameterized Tests #
Each KUnit parameterized test is associated with a collection of parameters. The test is invoked multiple times, once for each parameter value and the parameter is stored in the param_value field. The test case includes a KUNIT_CASE_PARAM() macro that accepts a generator function. The generator function is passed the previous parameter and returns the next parameter. It also includes a macro for generating array-based common-case generators.
kunit_tool (Command-line Test Harness) #
kunit_tool is a Python script, found in tools/testing/kunit/kunit.py. It is used to configure, build, execute, parse test results and run all of the previous commands in correct order (i.e., configure, build, execute and parse). You have two options for running KUnit tests: either build the kernel with KUnit enabled and manually parse the results (see Documentation/dev-tools/kunit/run_manual.rst) or use kunit_tool (see Documentation/dev-tools/kunit/run_wrapper.rst).
-
configurecommand generates the kernel.configfrom a.kunitconfigfile (and any architecture-specific options). The Python scripts available inqemu_configsfolder (for example,tools/testing/kunit/qemu configs/powerpc.py) contains additional configuration options for specific architectures. It parses both the existing.configand the.kunitconfigfiles to ensure that.configis a superset of.kunitconfig. If not, it will combine the two and runmake olddefconfigto regenerate the.configfile. It then checks to see if.confighas become a superset. This verifies that all the Kconfig dependencies are correctly specified in the file.kunitconfig. Thekunit_config.pyscript contains the code for parsing Kconfigs. The code which runsmake olddefconfigis part of thekunit_kernel.pyscript. You can invoke this command through:./tools/testing/kunit/kunit.py configand generate a.configfile. -
buildrunsmakeon the kernel tree with required options (depends on the architecture and some options, for example: build_dir) and reports any errors. To build a KUnit kernel from the current.config, you can use thebuildargument:./tools/testing/kunit/kunit.py build. -
execcommand executes kernel results either directly (using User-mode Linux configuration), or through an emulator such as QEMU. It reads results from the log using standard output (stdout), and passes them toparseto be parsed. If you already have built a kernel with built-in KUnit tests, you can run the kernel and display the test results with theexecargument:./tools/testing/kunit/kunit.py exec. -
parseextracts the KTAP output from a kernel log, parses the test results, and prints a summary. For failed tests, any diagnostic output will be included.
Frequently Asked Questions
Peios Kernel / Kernel development / Development tools / kunit
How is this different from Autotest, kselftest, and so on? #
KUnit is a unit testing framework. Autotest, kselftest (and some others) are not.
A unit test is supposed to test a single unit of code in isolation and hence the name unit test. A unit test should be the finest granularity of testing and should allow all possible code paths to be tested in the code under test. This is only possible if the code under test is small and does not have any external dependencies outside of the test's control like hardware.
There are no testing frameworks currently available for the kernel that do not require installing the kernel on a test machine or in a virtual machine. All testing frameworks require tests to be written in userspace and run on the kernel under test. This is true for Autotest, kselftest, and some others, disqualifying any of them from being considered unit testing frameworks.
Does KUnit support running on architectures other than UML? #
Yes, mostly.
For the most part, the KUnit core framework (what we use to write the tests) can compile to any architecture. It compiles like just another part of the kernel and runs when the kernel boots, or when built as a module, when the module is loaded. However, there is infrastructure, like the KUnit Wrapper (tools/testing/kunit/kunit.py) that might not support some architectures (see Running tests on QEMU).
In short, yes, you can run KUnit on other architectures, but it might require more work than using KUnit on UML.
For more information, see Writing Tests For Other Architectures.
What is the difference between a unit test and other kinds of tests? #
Most existing tests for the Linux kernel would be categorized as an integration test, or an end-to-end test.
-
A unit test is supposed to test a single unit of code in isolation. A unit test should be the finest granularity of testing and, as such, allows all possible code paths to be tested in the code under test. This is only possible if the code under test is small and does not have any external dependencies outside of the test's control like hardware.
-
An integration test tests the interaction between a minimal set of components, usually just two or three. For example, someone might write an integration test to test the interaction between a driver and a piece of hardware, or to test the interaction between the userspace libraries the kernel provides and the kernel itself. However, one of these tests would probably not test the entire kernel along with hardware interactions and interactions with the userspace.
-
An end-to-end test usually tests the entire system from the perspective of the code under test. For example, someone might write an end-to-end test for the kernel by installing a production configuration of the kernel on production hardware with a production userspace and then trying to exercise some behavior that depends on interactions between the hardware, the kernel, and userspace.
KUnit is not working, what should I do? #
Unfortunately, there are a number of things which can break, but here are some things to try.
-
Run
./tools/testing/kunit/kunit.py runwith the--raw_outputparameter. This might show details or error messages hidden by the kunit_tool parser. -
Instead of running
kunit.py run, try runningkunit.py config,kunit.py build, andkunit.py execindependently. This can help track down where an issue is occurring. (If you think the parser is at fault, you can run it manually againststdinor a file withkunit.py parse.) -
Running the UML kernel directly can often reveal issues or error messages,
kunit_toolignores. This should be as simple as running./vmlinuxafter building the UML kernel (for example, by usingkunit.py build). Note that UML has some unusual requirements (such as the host having a tmpfs filesystem mounted), and has had issues in the past when built statically and the host has KASLR enabled. (On older host kernels, you may need to runsetarch `uname -m` -R ./vmlinuxto disable KASLR.) -
Make sure the kernel .config has
CONFIG_KUNIT=yand at least one test (e.g.CONFIG_KUNIT_EXAMPLE_TEST=y). kunit_tool will keep its .config around, so you can see what config was used after runningkunit.py run. It also preserves any config changes you might make, so you can enable/disable things withmake ARCH=um menuconfigor similar, and then re-run kunit_tool. -
Try to run
make ARCH=um defconfigbefore runningkunit.py run. This may help clean up any residual config items which could be causing problems. -
Finally, try running KUnit outside UML. KUnit and KUnit tests can be built into any kernel, or can be built as a module and loaded at runtime. Doing so should allow you to determine if UML is causing the issue you're seeing. When tests are built-in, they will execute when the kernel boots, and modules will automatically execute associated tests when loaded. Test results can be collected from
/sys/kernel/debug/kunit/<test suite>/results, and can be parsed withkunit.py parse. For more details, see Running tests on QEMU.
If none of the above tricks help, you are always welcome to email any issues to kunit-dev@googlegroups.com.
Run Tests without kunit_tool
Peios Kernel / Kernel development / Development tools / kunit
If we do not want to use kunit_tool (For example: we want to integrate with other systems, or run tests on real hardware), we can include KUnit in any kernel, read out results, and parse manually.
Configure the Kernel #
KUnit tests can run without kunit_tool. This can be useful, if:
-
We have an existing kernel configuration to test.
-
Need to run on real hardware (or using an emulator/VM kunit_tool does not support).
-
Wish to integrate with some existing testing systems.
KUnit is configured with the CONFIG_KUNIT option, and individual tests can also be built by enabling their config options in our .config. KUnit tests usually (but don't always) have config options ending in _KUNIT_TEST. Most tests can either be built as a module, or be built into the kernel.
Once we have built our kernel (and/or modules), it is simple to run the tests. If the tests are built-in, they will run automatically on the kernel boot. The results will be written to the kernel log (dmesg) in TAP format.
If the tests are built as modules, they will run when the module is loaded.
# modprobe example-test
The results will appear in TAP format in dmesg.
debugfs #
KUnit can be accessed from userspace via the debugfs filesystem (See more information about debugfs at Documentation/filesystems/debugfs.rst).
If CONFIG_KUNIT_DEBUGFS is enabled, the KUnit debugfs filesystem is mounted at /sys/kernel/debug/kunit. You can use this filesystem to perform the following actions.
Retrieve Test Results #
You can use debugfs to retrieve KUnit test results. The test results are accessible from the debugfs filesystem in the following read-only file:
The test results are printed in a KTAP document. Note this document is separate to the kernel log and thus, may have different test suite numbering.
Run Tests After Kernel Has Booted #
You can use the debugfs filesystem to trigger built-in tests to run after boot. To run the test suite, you can use the following command to write to the /sys/kernel/debug/kunit/<test_suite>/run file:
As a result, the test suite runs and the results are printed to the kernel log.
However, this feature is not available with KUnit suites that use init data, because init data may have been discarded after the kernel boots. KUnit suites that use init data should be defined using the kunit_test_init_section_suites() macro.
Also, you cannot use this feature to run tests concurrently. Instead a test will wait to run until other tests have completed or failed.
Running tests with kunit_tool
Peios Kernel / Kernel development / Development tools / kunit
We can either run KUnit tests using kunit_tool or can run tests manually, and then use kunit_tool to parse the results. To run tests manually, see: Documentation/dev-tools/kunit/run_manual.rst. As long as we can build the kernel, we can run KUnit.
kunit_tool is a Python script which configures and builds a kernel, runs tests, and formats the test results.
Run command:
./tools/testing/kunit/kunit.py run
We should see the following:
Configuring KUnit Kernel ...
Building KUnit kernel...
Starting KUnit kernel...
We may want to use the following options:
./tools/testing/kunit/kunit.py run --timeout=30 --jobs=`nproc --all`
-
--timeoutsets a maximum amount of time for tests to run. -
--jobssets the number of threads to build the kernel.
kunit_tool will generate a .kunitconfig with a default configuration, if no other .kunitconfig file exists (in the build directory). In addition, it verifies that the generated .config file contains the CONFIG options in the .kunitconfig. It is also possible to pass a separate .kunitconfig fragment to kunit_tool. This is useful if we have several different groups of tests we want to run independently, or if we want to use pre-defined test configs for certain subsystems.
To use a different .kunitconfig file (such as one provided to test a particular subsystem), pass it as an option:
./tools/testing/kunit/kunit.py run --kunitconfig=fs/ext4/.kunitconfig
To view kunit_tool flags (optional command-line arguments), run:
./tools/testing/kunit/kunit.py run --help
Creating a .kunitconfig file #
If we want to run a specific set of tests (rather than those listed in the KUnit defconfig), we can provide Kconfig options in the .kunitconfig file. For default .kunitconfig, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/kunit/configs/default.config. A .kunitconfig is a minconfig (a .config generated by running make savedefconfig), used for running a specific set of tests. This file contains the regular Kernel configs with specific test targets. The .kunitconfig also contains any other config options required by the tests (For example: dependencies for features under tests, configs that enable/disable certain code blocks, arch configs and so on).
To create a .kunitconfig, using the KUnit defconfig:
cd $PATH_TO_LINUX_REPO
cp tools/testing/kunit/configs/default.config .kunit/.kunitconfig
We can then add any other Kconfig options. For example:
CONFIG_LIST_KUNIT_TEST=y
kunit_tool ensures that all config options in .kunitconfig are set in the kernel .config before running the tests. It warns if we have not included the options dependencies.
Configuring, building, and running tests #
If we want to make manual changes to the KUnit build process, we can run part of the KUnit build process independently. When running kunit_tool, from a .kunitconfig, we can generate a .config by using the config argument:
./tools/testing/kunit/kunit.py config
To build a KUnit kernel from the current .config, we can use the build argument:
./tools/testing/kunit/kunit.py build
If we already have built UML kernel with built-in KUnit tests, we can run the kernel, and display the test results with the exec argument:
./tools/testing/kunit/kunit.py exec
The run command discussed in section: Running tests with kunit_tool, is equivalent to running the above three commands in sequence.
Parsing test results #
KUnit tests output displays results in TAP (Test Anything Protocol) format. When running tests, kunit_tool parses this output and prints a summary. To see the raw test results in TAP format, we can pass the --raw_output argument:
./tools/testing/kunit/kunit.py run --raw_output
If we have KUnit results in the raw TAP format, we can parse them and print the human-readable summary with the parse command for kunit_tool. This accepts a filename for an argument, or will read from standard input.
# Reading from a file
# Reading from stdin
|
Filtering tests #
By passing a bash style glob filter to the exec or run commands, we can run a subset of the tests built into a kernel . For example: if we only want to run KUnit resource tests, use:
./tools/testing/kunit/kunit.py run 'kunit-resource*'
This uses the standard glob format with wildcard characters.
Running tests on QEMU #
kunit_tool supports running tests on qemu as well as via UML. To run tests on qemu, by default it requires two flags:
-
--arch: Selects a configs collection (Kconfig, qemu config options and so on), that allow KUnit tests to be run on the specified architecture in a minimal way. The architecture argument is same as the option name passed to theARCHvariable used by Kbuild. Not all architectures currently support this flag, but we can use--qemu_configto handle it. Ifumis passed (or this flag is ignored), the tests will run via UML. Non-UML architectures, for example: i386, x86_64, arm and so on; run on qemu.--arch helplists all valid--archvalues. -
--cross_compile: Specifies the Kbuild toolchain. It passes the same argument as passed to theCROSS_COMPILEvariable used by Kbuild. As a reminder, this will be the prefix for the toolchain binaries such as GCC. For example:-
sparc64-linux-gnuif we have the sparc toolchain installed on our system. -
$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linuxif we have downloaded the microblaze toolchain from the 0-day website to a directory in our home directory called toolchains.
-
This means that for most architectures, running under qemu is as simple as:
When cross-compiling, we'll likely need to specify a different toolchain, for example:
If we want to run KUnit tests on an architecture not supported by the --arch flag, or want to run KUnit tests on qemu using a non-default configuration; then we can write our own``QemuConfig``. These QemuConfigs are written in Python. They have an import line from..qemu_config import QemuArchParams at the top of the file. The file must contain a variable called QEMU_ARCH that has an instance of QemuArchParams assigned to it. See example in: tools/testing/kunit/qemu_configs/x86_64.py.
Once we have a QemuConfig, we can pass it into kunit_tool, using the --qemu_config flag. When used, this flag replaces the --arch flag. For example: using tools/testing/kunit/qemu_configs/x86_64.py, the invocation appear as
Running command-line arguments #
kunit_tool has a number of other command-line arguments which can be useful for our test environment. Below are the most commonly used command line arguments:
-
--help: Lists all available options. To list common options, place--helpbefore the command. To list options specific to that command, place--helpafter the command. -
--build_dir: Specifies kunit_tool build directory. It includes the.kunitconfig,.configfiles and compiled kernel. -
--make_options: Specifies additional options to pass to make, when compiling a kernel (usingbuildorruncommands). For example: to enable compiler warnings, we can pass--make_options W=1. -
--alltests: Enable a predefined set of options in order to build as many tests as possible. -
--kunitconfig: Specifies the path or the directory of the.kunitconfigfile. For example:-
lib/kunit/.kunitconfigcan be the path of the file. -
lib/kunitcan be the directory in which the file is located.
This file is used to build and run with a predefined set of tests and their dependencies. For example, to run tests for a given subsystem.
-
-
--kconfig_add: Specifies additional configuration options to be appended to the.kunitconfigfile. For example:./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_KASAN=y -
--arch: Runs tests on the specified architecture. The architecture argument is same as the Kbuild ARCH environment variable. For example, i386, x86_64, arm, um, etc. Non-UML architectures run on qemu. Default isum. -
--cross_compile: Specifies the Kbuild toolchain. It passes the same argument as passed to theCROSS_COMPILEvariable used by Kbuild. This will be the prefix for the toolchain binaries such as GCC. For example:-
sparc64-linux-gnu-if we have the sparc toolchain installed on our system. -
$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linuxif we have downloaded the microblaze toolchain from the 0-day website to a specified path in our home directory called toolchains.
-
-
--qemu_config: Specifies the path to a file containing a custom qemu architecture definition. This should be a python file containing aQemuArchParamsobject. -
--qemu_args: Specifies additional qemu arguments, for example,-smp 8. -
--jobs: Specifies the number of jobs (commands) to run simultaneously. By default, this is set to the number of cores on your system. -
--timeout: Specifies the maximum number of seconds allowed for all tests to run. This does not include the time taken to build the tests. -
--kernel_args: Specifies additional kernel command-line arguments. May be repeated. -
--run_isolated: If set, boots the kernel for each individual suite/test. This is useful for debugging a non-hermetic test, one that might pass/fail based on what ran before it. -
--raw_output: If set, generates unformatted output from kernel. Possible options are:-
all: To view the full kernel output, use--raw_output=all. -
kunit: This is the default option and filters to KUnit output. Use--raw_outputor--raw_output=kunit.
-
-
--json: If set, stores the test results in a JSON format and prints tostdoutor saves to a file if a filename is specified. -
--filter: Specifies filters on test attributes, for example,speed!=slow. Multiple filters can be used by wrapping input in quotes and separating filters by commas. Example:--filter "speed>slow, module=example". -
--filter_action: If set toskip, filtered tests will be shown as skipped in the output rather than showing no output. -
--list_tests: If set, lists all tests that will be run. -
--list_tests_attr: If set, lists all tests that will be run and all of their attributes. -
--list_suites: If set, lists all suites that will be run.
Command-line completion #
The kunit_tool comes with a bash completion script:
Tips For Running KUnit Tests
Peios Kernel / Kernel development / Development tools / kunit
Using kunit.py run ("kunit tool") #
Running from any directory #
It can be handy to create a bash function like:
Running a subset of tests #
kunit.py run accepts an optional glob argument to filter tests. The format is "<suite_glob>[.test_glob]".
Say that we wanted to run the sysctl tests, we could do so via:
We can filter down to just the "write" tests via:
We're paying the cost of building more tests than we need this way, but it's easier than fiddling with .kunitconfig files or commenting out kunit_suite's.
However, if we wanted to define a set of tests in a less ad hoc way, the next tip is useful.
Defining a set of tests #
kunit.py run (along with build, and config) supports a --kunitconfig flag. So if you have a set of tests that you want to run on a regular basis (especially if they have other dependencies), you can create a specific .kunitconfig for them.
E.g. kunit has one for its tests:
Alternatively, if you're following the convention of naming your file .kunitconfig, you can just pass in the dir, e.g.
Setting kernel commandline parameters #
You can use --kernel_args to pass arbitrary kernel arguments, e.g.
Generating code coverage reports under UML #
This is different from the "normal" way of getting coverage information that is documented in Documentation/dev-tools/gcov.rst.
Instead of enabling CONFIG_GCOV_KERNEL=y, we can set these options:
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_GCOV=y
Putting it together into a copy-pastable sequence of commands:
# Append coverage options to the current config
# Extract the coverage information from the build dir (.kunit/)
# From here on, it's the same process as with CONFIG_GCOV_KERNEL=y
# E.g. can generate an HTML report in a tmp dir like so:
If your installed version of gcc doesn't work, you can tweak the steps:
Alternatively, LLVM-based toolchains can also be used:
# Build with LLVM and append coverage options to the current config
# The coverage.info file is in lcov-compatible format and it can be used to e.g. generate HTML report
Running tests manually #
Running tests without using kunit.py run is also an important use case. Currently it's your only option if you want to test on architectures other than UML.
As running the tests under UML is fairly straightforward (configure and compile the kernel, run the ./linux binary), this section will focus on testing non-UML architectures.
Running built-in tests #
When setting tests to =y, the tests will run as part of boot and print results to dmesg in TAP format. So you just need to add your tests to your .config, build and boot your kernel as normal.
So if we compiled our kernel with:
CONFIG_KUNIT=y
CONFIG_KUNIT_EXAMPLE_TEST=y
Then we'd see output like this in dmesg signaling the test ran and passed:
TAP version 14
1..1
# Subtest: example
1..1
# example_simple_test: initializing
ok 1 - example_simple_test
ok 1 - example
Running tests as modules #
Depending on the tests, you can build them as loadable modules.
For example, we'd change the config options from before to
CONFIG_KUNIT=y
CONFIG_KUNIT_EXAMPLE_TEST=m
Then after booting into our kernel, we can run the test via
$ modprobe kunit-example-test
This will then cause it to print TAP output to stdout.
Pretty-printing results #
You can use kunit.py parse to parse dmesg for test output and print out results in the same familiar format that kunit.py run does.
Retrieving per suite results #
Regardless of how you're running your tests, you can enable CONFIG_KUNIT_DEBUGFS to expose per-suite TAP-formatted results:
CONFIG_KUNIT=y
CONFIG_KUNIT_EXAMPLE_TEST=m
CONFIG_KUNIT_DEBUGFS=y
The results for each suite will be exposed under /sys/kernel/debug/kunit/<suite>/results. So using our example config:
# After removing the module, the corresponding files will go away
Generating code coverage reports #
See Documentation/dev-tools/gcov.rst for details on how to do this.
The only vaguely KUnit-specific advice here is that you probably want to build your tests as modules. That way you can isolate the coverage from tests from other code executed during boot, e.g.
# Reset coverage counters before running the test.
Test Attributes and Filtering #
Test suites and cases can be marked with test attributes, such as speed of test. These attributes will later be printed in test output and can be used to filter test execution.
Marking Test Attributes #
Tests are marked with an attribute by including a kunit_attributes object in the test definition.
Test cases can be marked using the KUNIT_CASE_ATTR(test_name, attributes) macro to define the test case instead of KUNIT_CASE(test_name).
static const struct kunit_attributes example_attr = ;
static struct kunit_case example_test_cases = ;
Test suites can be marked with an attribute by setting the "attr" field in the suite definition.
static const struct kunit_attributes example_attr = ;
static struct kunit_suite example_test_suite = ;
Reporting Attributes #
When a user runs tests, attributes will be present in the raw kernel output (in KTAP format). Note that attributes will be hidden by default in kunit.py output for all passing tests but the raw kernel output can be accessed using the --raw_output flag. This is an example of how test attributes for test cases will be formatted in kernel output:
# example_test.speed: slow
ok 1 example_test
This is an example of how test attributes for test suites will be formatted in kernel output:
KTAP version 2
# Subtest: example_suite
# module: kunit_example_test
1..3
...
ok 1 example_suite
Additionally, users can output a full attribute report of tests with their attributes, using the command line flag --list_tests_attr:
Filtering #
Users can filter tests using the --filter command line flag when running tests. As an example:
You can also use the following operations on filters: "<", ">", "<=", ">=", "!=", and "=". Example:
This example will run all tests with speeds faster than slow. Note that the characters < and > are often interpreted by the shell, so they may need to be quoted or escaped, as above.
Additionally, you can use multiple filters at once. Simply separate filters using commas. Example:
Filtered tests will not run or show up in the test output. You can use the --filter_action=skip flag to skip filtered tests instead. These tests will be shown in the test output in the test but will not run. To use this feature when running KUnit manually, use the module param kunit.filter_action=skip.
Rules of Filtering Procedure #
Since both suites and test cases can have attributes, there may be conflicts between attributes during filtering. The process of filtering follows these rules:
-
Filtering always operates at a per-test level.
-
If a test has an attribute set, then the test's value is filtered on.
-
Otherwise, the value falls back to the suite's value.
-
If neither are set, the attribute has a global "default" value, which is used.
List of Current Attributes #
speed
This attribute indicates the speed of a test's execution (how slow or fast the test is).
This attribute is saved as an enum with the following categories: "normal", "slow", or "very_slow". The assumed default speed for tests is "normal". This indicates that the test takes a relatively trivial amount of time (less than 1 second), regardless of the machine it is running on. Any test slower than this could be marked as "slow" or "very_slow".
The macro KUNIT_CASE_SLOW(test_name) can be easily used to set the speed of a test case to "slow".
module
This attribute indicates the name of the module associated with the test.
This attribute is automatically saved as a string and is printed for each suite. Tests can also be filtered using this attribute.
is_init
This attribute indicates whether the test uses init data or functions.
This attribute is automatically saved as a boolean and tests can also be filtered using this attribute.
Getting Started
Peios Kernel / Kernel development / Development tools / kunit
Peios: Use Building Peios for the repository build, toolchain, configuration and test entry points. This article describes the underlying Linux machinery or upstream workflow. Its standalone build/install commands do not establish a qualified Peios kernel or signed release modules.
This page contains an overview of the kunit_tool and KUnit framework, teaching how to run existing tests and then how to write a simple test case, and covers common problems users face when using KUnit for the first time.
Installing Dependencies #
KUnit has the same dependencies as the Linux kernel. As long as you can build the kernel, you can run KUnit.
Running tests with kunit_tool #
kunit_tool is a Python script, which configures and builds a kernel, runs tests, and formats the test results. From the kernel repository, you can run kunit_tool:
If everything worked correctly, you should see the following:
Configuring KUnit Kernel ...
Building KUnit Kernel ...
Starting KUnit Kernel ...
The tests will pass or fail.
For detailed information on this wrapper, see: Documentation/dev-tools/kunit/run_wrapper.rst.
Selecting which tests to run #
By default, kunit_tool runs all tests reachable with minimal configuration, that is, using default values for most of the kconfig options. However, you can select which tests to run by:
-
Customizing Kconfig used to compile the kernel, or
-
Filtering tests by name to select specifically which compiled tests to run.
Customizing Kconfig #
A good starting point for the .kunitconfig is the KUnit default config. If you didn't run kunit.py run yet, you can generate it by running:
Before running the tests, kunit_tool ensures that all config options set in .kunitconfig are set in the kernel .config. It will warn you if you have not included dependencies for the options used.
There are many ways to customize the configurations:
-
a. Edit
.kunit/.kunitconfig. The file should contain the list of kconfig options required to run the desired tests, including their dependencies. You may want to remove CONFIG_KUNIT_ALL_TESTS from the.kunitconfigas it will enable a number of additional tests that you may not want. If you need to run on an architecture other than UML see Running tests on QEMU. -
b. Enable additional kconfig options on top of
.kunit/.kunitconfig. For example, to include the kernel's linked-list test you can run:./tools/testing/kunit/kunit.py run \ --kconfig_add CONFIG_LIST_KUNIT_TEST=y -
c. Provide the path of one or more .kunitconfig files from the tree. For example, to run only
FAT_FSandEXT4tests you can run:./tools/testing/kunit/kunit.py run \ --kunitconfig ./fs/fat/.kunitconfig \ --kunitconfig ./fs/ext4/.kunitconfig -
d. If you change the
.kunitconfig, kunit.py will trigger a rebuild of the.configfile. But you can edit the.configfile directly or with tools likemake menuconfig O=.kunit. As long as its a superset of.kunitconfig, kunit.py won't overwrite your changes.
Filtering tests by name #
If you want to be more specific than Kconfig can provide, it is also possible to select which tests to execute at boot-time by passing a glob filter (read instructions regarding the pattern in the manpage glob(7)). If there is a "." (period) in the filter, it will be interpreted as a separator between the name of the test suite and the test case, otherwise, it will be interpreted as the name of the test suite. For example, let's assume we are using the default config:
-
a. inform the name of a test suite, like
"kunit_executor_test", to run every test case it contains:./tools/testing/kunit/kunit.py run "kunit_executor_test" -
b. inform the name of a test case prefixed by its test suite, like
"example.example_simple_test", to run specifically that test case:./tools/testing/kunit/kunit.py run "example.example_simple_test" -
c. use wildcard characters (
*?[) to run any test case that matches the pattern, like"*.*64*"to run test cases containing"64"in the name inside any test suite:./tools/testing/kunit/kunit.py run "*.*64*"
Running Tests without the KUnit Wrapper #
If you do not want to use the KUnit Wrapper (for example: you want code under test to integrate with other systems, or use a different/ unsupported architecture or configuration), KUnit can be included in any kernel, and the results are read out and parsed manually.
Configuring the Kernel #
To enable KUnit itself, you need to enable the CONFIG_KUNIT Kconfig option (under Kernel Hacking/Kernel Testing and Coverage in menuconfig). From there, you can enable any KUnit tests. They usually have config options ending in _KUNIT_TEST.
KUnit and KUnit tests can be compiled as modules. The tests in a module will run when the module is loaded.
Running Tests (without KUnit Wrapper) #
Build and run your kernel. In the kernel log, the test output is printed out in the TAP format. This will only happen by default if KUnit/tests are built-in. Otherwise the module will need to be loaded.
Writing Your First Test #
In your kernel repository, let's add some code that we can test.
- Create a file
drivers/misc/example.h, which includes:
int ;
- Create a file
drivers/misc/example.c, which includes:
int
- Add the following lines to
drivers/misc/Kconfig:
config MISC_EXAMPLE
bool "My example"
- Add the following lines to
drivers/misc/Makefile:
obj-$(CONFIG_MISC_EXAMPLE) +=
Now we are ready to write the test cases.
- Add the below test case in
drivers/misc/example_test.c:
/* Define the test cases. */
static void
static void
static struct kunit_case misc_example_test_cases = ;
static struct kunit_suite misc_example_test_suite = ;
;
;
- Add the following lines to
drivers/misc/Kconfig:
config MISC_EXAMPLE_TEST
tristate "Test for my example" if !KUNIT_ALL_TESTS
depends on MISC_EXAMPLE && KUNIT
default KUNIT_ALL_TESTS
Note: If your test does not support being built as a loadable module (which is discouraged), replace tristate by bool, and depend on KUNIT=y instead of KUNIT.
- Add the following lines to
drivers/misc/Makefile:
obj-$(CONFIG_MISC_EXAMPLE_TEST) +=
- Add the following lines to
.kunit/.kunitconfig:
CONFIG_MISC_EXAMPLE=y
CONFIG_MISC_EXAMPLE_TEST=y
- Run the test:
You should see the following failure:
...
[16:08:57] [PASSED] misc-example:misc_example_add_test_basic
[16:08:57] [FAILED] misc-example:misc_example_test_failure
[16:08:57] EXPECTATION FAILED at drivers/misc/example-test.c:17
[16:08:57] This test never passes.
...
Congrats! You just wrote your first KUnit test.
Next Steps #
If you're interested in using some of the more advanced features of kunit.py, take a look at Documentation/dev-tools/kunit/run_wrapper.rst
If you'd like to run tests without using kunit.py, check out Documentation/dev-tools/kunit/run_manual.rst
For more information on writing KUnit tests (including some common techniques for testing different things), see Documentation/dev-tools/kunit/usage.rst
Test Style and Nomenclature
Peios Kernel / Kernel development / Development tools / kunit
To make finding, writing, and using KUnit tests as simple as possible, it is strongly encouraged that they are named and written according to the guidelines below. While it is possible to write KUnit tests which do not follow these rules, they may break some tooling, may conflict with other tests, and may not be run automatically by testing systems.
It is recommended that you only deviate from these guidelines when:
-
Porting tests to KUnit which are already known with an existing name.
-
Writing tests which would cause serious problems if automatically run. For example, non-deterministically producing false positives or negatives, or taking a long time to run.
Subsystems, Suites, and Tests #
To make tests easy to find, they are grouped into suites and subsystems. A test suite is a group of tests which test a related area of the kernel. A subsystem is a set of test suites which test different parts of a kernel subsystem or a driver.
Subsystems #
Every test suite must belong to a subsystem. A subsystem is a collection of one or more KUnit test suites which test the same driver or part of the kernel. A test subsystem should match a single kernel module. If the code being tested cannot be compiled as a module, in many cases the subsystem should correspond to a directory in the source tree or an entry in the MAINTAINERS file. If unsure, follow the conventions set by tests in similar areas.
Test subsystems should be named after the code being tested, either after the module (wherever possible), or after the directory or files being tested. Test subsystems should be named to avoid ambiguity where necessary.
If a test subsystem name has multiple components, they should be separated by underscores. Do not include "test" or "kunit" directly in the subsystem name unless we are actually testing other tests or the kunit framework itself. For example, subsystems could be called:
-
ext4Matches the module and filesystem name.
-
apparmorMatches the module name and LSM name.
-
kasanCommon name for the tool, prominent part of the path
mm/kasan -
snd_hda_codec_hdmiHas several components (
snd,hda,codec,hdmi) separated by underscores. Matches the module name.
Avoid names as shown in examples below:
-
linear-rangesNames should use underscores, not dashes, to separate words. Prefer
linear_ranges. -
qos-kunit-testThis name should use underscores, and not have "kunit-test" as a suffix.
qosis also ambiguous as a subsystem name, because several parts of the kernel have aqossubsystem.power_qoswould be a better name. -
pc_parallel_portThe corresponding module name is
parport_pc, so this subsystem should also be namedparport_pc.
Suites #
KUnit tests are grouped into test suites, which cover a specific area of functionality being tested. Test suites can have shared initialization and shutdown code which is run for all tests in the suite. Not all subsystems need to be split into multiple test suites (for example, simple drivers).
Test suites are named after the subsystem they are part of. If a subsystem contains several suites, the specific area under test should be appended to the subsystem name, separated by an underscore.
In the event that there are multiple types of test using KUnit within a subsystem (for example, both unit tests and integration tests), they should be put into separate suites, with the type of test as the last element in the suite name. Unless these tests are actually present, avoid using _test, _unittest or similar in the suite name.
The full test suite name (including the subsystem name) should be specified as the .name member of the kunit_suite struct, and forms the base for the module name. For example, test suites could include:
-
ext4_inodePart of the
ext4subsystem, testing theinodearea. -
kunit_try_catchPart of the
kunitimplementation itself, testing thetry_catcharea. -
apparmor_property_entryPart of the
apparmorsubsystem, testing theproperty_entryarea. -
kasanThe
kasansubsystem has only one suite, so the suite name is the same as the subsystem name.
Avoid names, for example:
-
ext4_ext4_inodeThere is no reason to state the subsystem twice.
-
property_entryThe suite name is ambiguous without the subsystem name.
-
kasan_integration_testBecause there is only one suite in the
kasansubsystem, the suite should just be called askasan. Do not redundantly addintegration_test. It should be a separate test suite. For example, if the unit tests are added, then that suite could be named askasan_unittestor similar.
Test Cases #
Individual tests consist of a single function which tests a constrained codepath, property, or function. In the test output, an individual test's results will show up as subtests of the suite's results.
Tests should be named after what they are testing. This is often the name of the function being tested, with a description of the input or codepath being tested. As tests are C functions, they should be named and written in accordance with the kernel coding style.
Example test names include:
-
unpack_u32_with_null_nameTests the
unpack_u32function when a NULL name is passed in. -
test_list_spliceTests the
list_splicemacro. It has the prefixtest_to avoid a name conflict with the macro itself.
Should it be necessary to refer to a test outside the context of its test suite, the fully-qualified name of a test should be the suite name followed by the test name, separated by a colon (i.e. suite:test).
Test Kconfig Entries #
Every test suite should be tied to a Kconfig entry.
This Kconfig entry must:
-
be named
CONFIG_<name>_KUNIT_TEST: where <name> is the name of the test suite. -
be listed either alongside the config entries for the driver/subsystem being tested, or be under [Kernel Hacking]->[Kernel Testing and Coverage]
-
depend on
CONFIG_KUNIT. -
be visible only if
CONFIG_KUNIT_ALL_TESTSis not enabled. -
have a default value of
CONFIG_KUNIT_ALL_TESTS. -
have a brief description of KUnit in the help text.
If we are not able to meet above conditions (for example, the test is unable to be built as a module), Kconfig entries for tests should be tristate.
For example, a Kconfig entry might look like:
config FOO_KUNIT_TEST
tristate "KUnit test for foo" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
help
This builds unit tests for foo.
For more information on KUnit and unit tests in general,
please refer to the KUnit documentation in Documentation/dev-tools/kunit/.
If unsure, say N.
Test File and Module Names #
KUnit tests are often compiled as a separate module. To avoid conflicting with regular modules, KUnit modules should be named after the test suite, followed by _kunit (e.g. if "foobar" is the core module, then "foobar_kunit" is the KUnit test module).
Test source files, whether compiled as a separate module or an #include in another source file, are best kept in a tests/ subdirectory to not conflict with other source files (e.g. for tab-completion).
Note that the _test suffix has also been used in some existing tests. The _kunit suffix is preferred, as it makes the distinction between KUnit and non-KUnit tests clearer.
So for the common case, name the file containing the test suite tests/<suite>_kunit.c. The tests directory should be placed at the same level as the code under test. For example, tests for lib/string.c live in lib/tests/string_kunit.c.
If the suite name contains some or all of the name of the test's parent directory, it may make sense to modify the source filename to reduce redundancy. For example, a foo_firmware suite could be in the foo/tests/firmware_kunit.c file.
Writing Tests
Peios Kernel / Kernel development / Development tools / kunit
Writing Tests #
Test Cases #
The fundamental unit in KUnit is the test case. A test case is a function with the signature void (*)(struct kunit *test). It calls the function under test and then sets expectations for what should happen. For example:
void
void
In the above example, example_test_success always passes because it does nothing; no expectations are set, and therefore all expectations pass. On the other hand example_test_failure always fails because it calls KUNIT_FAIL, which is a special expectation that logs a message and causes the test case to fail.
Expectations #
An expectation specifies that we expect a piece of code to do something in a test. An expectation is called like a function. A test is made by setting expectations about the behavior of a piece of code under test. When one or more expectations fail, the test case fails and information about the failure is logged. For example:
void
In the above example, add_test_basic makes a number of assertions about the behavior of a function called add. The first parameter is always of type struct kunit *, which contains information about the current test context. The second parameter, in this case, is what the value is expected to be. The last value is what the value actually is. If add passes all of these expectations, the test case, add_test_basic will pass; if any one of these expectations fails, the test case will fail.
A test case fails when any expectation is violated; however, the test will continue to run, and try other expectations until the test case ends or is otherwise terminated. This is as opposed to assertions which are discussed later.
To learn about more KUnit expectations, see Documentation/dev-tools/kunit/api/test.rst.
For example, if we want to rigorously test the add function above, create additional tests cases which would test each property that an add function should have as shown below:
void
void
void
void
Assertions #
An assertion is like an expectation, except that the assertion immediately terminates the test case if the condition is not satisfied. For example:
static void
In this example, we need to be able to allocate an array to test the sort() function. So we use KUNIT_ASSERT_NOT_ERR_OR_NULL() to abort the test if there's an allocation error.
Customizing error messages #
Each of the KUNIT_EXPECT and KUNIT_ASSERT macros have a _MSG variant. These take a format string and arguments to provide additional context to the automatically generated error messages.
char some_str;
;
/* Before. Not easy to tell why the test failed. */
;
/* After. Now we see the offending string. */
;
Alternatively, one can take full control over the error message by using KUNIT_FAIL(), e.g.
/* Before */
;
/* After: full control over the failure message. */
if
;
Test Suites #
We need many test cases covering all the unit's behaviors. It is common to have many similar tests. In order to reduce duplication in these closely related tests, most unit testing frameworks (including KUnit) provide the concept of a test suite. A test suite is a collection of test cases for a unit of code with optional setup and teardown functions that run before/after the whole suite and/or every test case.
For example:
static struct kunit_case example_test_cases = ;
static struct kunit_suite example_test_suite = ;
;
In the above example, the test suite example_test_suite would first run example_suite_init, then run the test cases example_test_foo, example_test_bar, and example_test_baz. Each would have example_test_init called immediately before it and example_test_exit called immediately after it. Finally, example_suite_exit would be called after everything else. kunit_test_suite(example_test_suite) registers the test suite with the KUnit test framework.
kunit_test_suite(...) is a macro which tells the linker to put the specified test suite in a special linker section so that it can be run by KUnit either after late_init, or when the test module is loaded (if the test was built as a module).
For more information, see Documentation/dev-tools/kunit/api/test.rst.
Writing Tests For Other Architectures #
It is better to write tests that run on UML to tests that only run under a particular architecture. It is better to write tests that run under QEMU or another easy to obtain (and monetarily free) software environment to a specific piece of hardware.
Nevertheless, there are still valid reasons to write a test that is architecture or hardware specific. For example, we might want to test code that really belongs in arch/some-arch/*. Even so, try to write the test so that it does not depend on physical hardware. Some of our test cases may not need hardware, only few tests actually require the hardware to test it. When hardware is not available, instead of disabling tests, we can skip them.
Now that we have narrowed down exactly what bits are hardware specific, the actual procedure for writing and running the tests is same as writing normal KUnit tests.
Common Patterns #
Isolating Behavior #
Unit testing limits the amount of code under test to a single unit. It controls what code gets run when the unit under test calls a function. Where a function is exposed as part of an API such that the definition of that function can be changed without affecting the rest of the code base. In the kernel, this comes from two constructs: classes, which are structs that contain function pointers provided by the implementer, and architecture-specific functions, which have definitions selected at compile time.
Classes #
Classes are not a construct that is built into the C programming language; however, it is an easily derived concept. Accordingly, in most cases, every project that does not use a standardized object oriented library (like GNOME's GObject) has their own slightly different way of doing object oriented programming; the Linux kernel is no exception.
The central concept in kernel object oriented programming is the class. In the kernel, a class is a struct that contains function pointers. This creates a contract between implementers and users since it forces them to use the same function signature without having to call the function directly. To be a class, the function pointers must specify that a pointer to the class, known as a class handle, be one of the parameters. Thus the member functions (also known as methods) have access to member variables (also known as fields) allowing the same implementation to have multiple instances.
A class can be overridden by child classes by embedding the parent class in the child class. Then when the child class method is called, the child implementation knows that the pointer passed to it is of a parent contained within the child. Thus, the child can compute the pointer to itself because the pointer to the parent is always a fixed offset from the pointer to the child. This offset is the offset of the parent contained in the child struct. For example:
;
;
int ;
void
In this example, computing the pointer to the child from the pointer to the parent is done by container_of.
Faking Classes #
In order to unit test a piece of code that calls a method in a class, the behavior of the method must be controllable, otherwise the test ceases to be a unit test and becomes an integration test.
A fake class implements a piece of code that is different than what runs in a production instance, but behaves identical from the standpoint of the callers. This is done to replace a dependency that is hard to deal with, or is slow. For example, implementing a fake EEPROM that stores the "contents" in an internal buffer. Assume we have a class that represents an EEPROM:
;
And we want to test code that buffers writes to the EEPROM:
;
struct eeprom_buffer *;
void ;
We can test this code by faking out the underlying EEPROM:
;
ssize_t
ssize_t
void
We can now use it to test struct eeprom_buffer:
;
static void
static void
static void
static int
static void
Testing Against Multiple Inputs #
Testing just a few inputs is not enough to ensure that the code works correctly, for example: testing a hash function.
We can write a helper macro or function. The function is called for each input. For example, to test sha1sum(1), we can write:
char out;
;
;
Note the use of the _MSG version of KUNIT_EXPECT_STREQ to print a more detailed error and make the assertions clearer within the helper macros.
The _MSG variants are useful when the same expectation is called multiple times (in a loop or helper function) and thus the line number is not enough to identify what failed, as shown below.
In complicated cases, we recommend using a table-driven test compared to the helper macro variation, for example:
int i;
char out;
;
struct sha1_test_case cases = ;
for
There is more boilerplate code involved, but it can:
-
be more readable when there are multiple inputs/outputs (due to field names).
- For example, see
fs/ext4/inode-test.c.
- For example, see
-
reduce duplication if test cases are shared across multiple tests.
- For example: if we want to test
sha256sum, we could add asha256field and reusecases.
- For example: if we want to test
-
be converted to a "parameterized test".
Parameterized Testing #
To run a test case against multiple inputs, KUnit provides a parameterized testing framework. This feature formalizes and extends the concept of table-driven tests discussed previously.
A KUnit test is determined to be parameterized if a parameter generator function is provided when registering the test case. A test user can either write their own generator function or use one that is provided by KUnit. The generator function is stored in kunit_case->generate_params and can be set using the macros described in the section below.
To establish the terminology, a "parameterized test" is a test which is run multiple times (once per "parameter" or "parameter run"). Each parameter run has both its own independent struct kunit (the "parameter run context") and access to a shared parent struct kunit (the "parameterized test context").
Passing Parameters to a Test #
There are three ways to provide the parameters to a test:
Array Parameter Macros:
KUnit provides special support for the common table-driven testing pattern. By applying either
KUNIT_ARRAY_PARAMorKUNIT_ARRAY_PARAM_DESCto thecasesarray from the previous section, we can create a parameterized test as shown below:
// This is copy-pasted from above.
;
static const struct sha1_test_case cases = ;
// Creates `sha1_gen_params()` to iterate over `cases` while using
// the struct member `str` for the case description.
;
// Looks no different from a normal test.
static void
// Instead of KUNIT_CASE, we use KUNIT_CASE_PARAM and pass in the
// function declared by KUNIT_ARRAY_PARAM or KUNIT_ARRAY_PARAM_DESC.
static struct kunit_case sha1_test_cases = ;
Custom Parameter Generator Function:
The generator function is responsible for generating parameters one-by-one and has the following signature:
const void* (*)(struct kunit *test, const void *prev, char *desc). You can pass the generator function to theKUNIT_CASE_PARAMorKUNIT_CASE_PARAM_WITH_INITmacros.The function receives the previously generated parameter as the
prevargument (which isNULLon the first call) and can also access the parameterized test context passed as thetestargument. KUnit calls this function repeatedly until it returnsNULL, which signifies that a parameterized test ended.Below is an example of how it works:
// Example generator function. It produces a sequence of buffer sizes that
// are powers of two, starting at 1 (e.g., 1, 2, 4, 8).
static const void *
// Simple test to validate that kunit_kzalloc provides zeroed memory.
static void
static struct kunit_case buffer_test_cases = ;
Runtime Parameter Array Registration in the Init Function:
For scenarios where you might need to initialize a parameterized test, you can directly register a parameter array to the parameterized test context.
To do this, you must pass the parameterized test context, the array itself, the array size, and a
get_description()function to thekunit_register_params_array()macro. This macro populatesstruct kunit_paramswithin the parameterized test context, effectively storing a parameter array object. Theget_description()function will be used for populating parameter descriptions and has the following signature:void (*)(struct kunit *test, const void *param, char *desc). Note that it also has access to the parameterized test context.The
kunit_register_params_array()macro should be called within aparam_init()function that initializes the parameterized test and has the following signatureint (*)(struct kunit *test). For a detailed explanation of this mechanism please refer to the "Adding Shared Resources" section that is after this one. This method supports registering both dynamically built and static parameter arrays.The code snippet below shows the
example_param_init_dynamic_arrtest that utilizesmake_fibonacci_params()to create a dynamic array, which is then registered usingkunit_register_params_array(). To see the full code please refer to lib/kunit/kunit-example-test.c.
/*
* Example of a parameterized test param_init() function that registers a dynamic
* array of parameters.
*/
static int
static struct kunit_case example_test_cases = ;
Adding Shared Resources #
All parameter runs in this framework hold a reference to the parameterized test context, which can be accessed using the parent struct kunit pointer. The parameterized test context is not used to execute any test logic itself; instead, it serves as a container for shared resources.
It's possible to add resources to share between parameter runs within a parameterized test by using KUNIT_CASE_PARAM_WITH_INIT, to which you pass custom param_init() and param_exit() functions. These functions run once before and once after the parameterized test, respectively.
The param_init() function, with the signature int (*)(struct kunit *test), can be used for adding resources to the resources or priv fields of the parameterized test context, registering the parameter array, and any other initialization logic.
The param_exit() function, with the signature void (*)(struct kunit *test), can be used to release any resources that were not parameterized test managed (i.e. not automatically cleaned up after the parameterized test ends) and for any other exit logic.
Both param_init() and param_exit() are passed the parameterized test context behind the scenes. However, the test case function receives the parameter run context. Therefore, to manage and access shared resources from within a test case function, you must use test->parent.
For instance, finding a shared resource allocated by the Resource API requires passing test->parent to kunit_find_resource(). This principle extends to all other APIs that might be used in the test case function, including kunit_kzalloc(), kunit_kmalloc_array(), and others (see Documentation/dev-tools/kunit/api/test.rst and the Documentation/dev-tools/kunit/api/resource.rst).
The code below shows how you can add the shared resources. Note that this code utilizes the Resource API, which you can read more about here: Documentation/dev-tools/kunit/api/resource.rst. To see the full version of this code please refer to lib/kunit/kunit-example-test.c.
static int
/* This function deallocates memory for the kunit_resource->data field. */
static void
/* This match function locates a test resource based on defined criteria. */
static bool
/* Function to initialize the parameterized test. */
static int
/* Example test that uses shared resources in test->resources. */
static void
static struct kunit_case example_test_cases = ;
As an alternative to using the KUnit Resource API for sharing resources, you can place them in test->parent->priv. This serves as a more lightweight method for resource storage, best for scenarios where complex resource management is not required.
As stated previously param_init() and param_exit() get the parameterized test context. So, you can directly use test->priv within param_init/exit to manage shared resources. However, from within the test case function, you must navigate up to the parent struct kunit i.e. the parameterized test context. Therefore, you need to use test->parent->priv to access those same resources.
The resources placed in test->parent->priv will need to be allocated in memory to persist across the parameter runs. If memory is allocated using the KUnit memory allocation APIs (described more in the "Allocating Memory" section below), you won't need to worry about deallocation. The APIs will make the memory parameterized test 'managed', ensuring that it will automatically get cleaned up after the parameterized test concludes.
The code below demonstrates example usage of the priv field for shared resources:
static const example_params_array = ;
/* Initialize the parameterized test context. */
static int
static void
static struct kunit_case example_tests = ;
Allocating Memory #
Where you might use kzalloc, you can instead use kunit_kzalloc as KUnit will then ensure that the memory is freed once the test completes.
This is useful because it lets us use the KUNIT_ASSERT_EQ macros to exit early from a test without having to worry about remembering to call kfree. For example:
void
Registering Cleanup Actions #
If you need to perform some cleanup beyond simple use of kunit_kzalloc, you can register a custom "deferred action", which is a cleanup function run when the test exits (whether cleanly, or via a failed assertion).
Actions are simple functions with no return value, and a single void* context argument, and fulfill the same role as "cleanup" functions in Python and Go tests, "defer" statements in languages which support them, and (in some cases) destructors in RAII languages.
These are very useful for unregistering things from global lists, closing files or other resources, or freeing resources.
For example:
static void
void
Note that, for functions like device_unregister which only accept a single pointer-sized argument, it's possible to automatically generate a wrapper with the KUNIT_DEFINE_ACTION_WRAPPER() macro, for example:
;
;
You should do this in preference to manually casting to the kunit_action_t type, as casting function pointers will break Control Flow Integrity (CFI).
kunit_add_action can fail if, for example, the system is out of memory. You can use kunit_add_action_or_reset instead which runs the action immediately if it cannot be deferred.
If you need more control over when the cleanup function is called, you can trigger it early using kunit_release_action, or cancel it entirely with kunit_remove_action.
Testing Static Functions #
If you want to test static functions without exposing those functions outside of testing, one option is conditionally export the symbol. When KUnit is enabled, the symbol is exposed but remains static otherwise. To use this method, follow the template below.
/* In the file containing functions to test "my_file.c" */
...
VISIBLE_IF_KUNIT int
;
/* In the header file "my_file.h" */
int ;
/* In the KUnit test file "my_file_test.c" */
...
;
...
// Use do_interesting_thing() in tests
For a full example, see this patch where a test is modified to conditionally expose static functions for testing using the macros above.
As an alternative to the method above, you could conditionally #include the test file at the end of your .c file. This is not recommended but works if needed. For example:
/* In "my_file.c" */
static int ;
Injecting Test-Only Code #
Similar to as shown above, we can add test-specific logic. For example:
/* In my_file.h */
/* Defined in my_kunit_test.c */
void ;
void
This test-only code can be made more useful by accessing the current kunit_test as shown in next section: Accessing The Current Test.
Accessing The Current Test #
In some cases, we need to call test-only code from outside the test file. This is helpful, for example, when providing a fake implementation of a function, or to fail any current test from within an error handler. We can do this via the kunit_test field in task_struct, which we can access using the kunit_get_current_test() function in kunit/test-bug.h.
kunit_get_current_test() is safe to call even if KUnit is not enabled. If KUnit is not enabled, or if no test is running in the current task, it will return NULL. This compiles down to either a no-op or a static key check, so will have a negligible performance impact when no test is running.
The example below uses this to implement a "mock" implementation of a function, foo:
;
static int
static void
In this example, we are using the priv member of struct kunit as a way of passing data to the test from the init function. In general priv is pointer that can be used for any user data. This is preferred over static variables, as it avoids concurrency issues.
Had we wanted something more flexible, we could have used a named kunit_resource. Each test can have multiple resources which have string names providing the same flexibility as a priv member, but also, for example, allowing helper functions to create resources without conflicting with each other. It is also possible to define a clean up function for each resource, making it easy to avoid resource leaks. For more information, see Documentation/dev-tools/kunit/api/resource.rst.
Failing The Current Test #
If we want to fail the current test, we can use kunit_fail_current_test(fmt, args...) which is defined in <kunit/test-bug.h> and does not require pulling in <kunit/test.h>. For example, we have an option to enable some extra debug checks on some data structures as shown below:
static void
static void
kunit_fail_current_test() is safe to call even if KUnit is not enabled. If KUnit is not enabled, or if no test is running in the current task, it will do nothing. This compiles down to either a no-op or a static key check, so will have a negligible performance impact when no test is running.
Managing Fake Devices and Drivers #
When testing drivers or code which interacts with drivers, many functions will require a struct device or struct device_driver. In many cases, setting up a real device is not required to test any given function, so a fake device can be used instead.
KUnit provides helper functions to create and manage these fake devices, which are internally of type struct kunit_device, and are attached to a special kunit_bus. These devices support managed device resources (devres), as described in Documentation/driver-api/driver-model/devres.rst
To create a KUnit-managed struct device_driver, use kunit_driver_create(), which will create a driver with the given name, on the kunit_bus. This driver will automatically be destroyed when the corresponding test finishes, but can also be manually destroyed with driver_unregister().
To create a fake device, use the kunit_device_register(), which will create and register a device, using a new KUnit-managed driver created with kunit_driver_create(). To provide a specific, non-KUnit-managed driver, use kunit_device_register_with_driver() instead. Like with managed drivers, KUnit-managed fake devices are automatically cleaned up when the test finishes, but can be manually cleaned up early with kunit_device_unregister().
The KUnit devices should be used in preference to root_device_register(), and instead of platform_device_register() in cases where the device is not otherwise a platform device.
For example:
static void
API Reference
Peios Kernel / Kernel development / Development tools / kunit / api
This page documents the KUnit kernel testing API. It is divided into the following sections:
Core KUnit API #
Documentation/dev-tools/kunit/api/test.rst
- Documents all of the standard testing API
Documentation/dev-tools/kunit/api/resource.rst
- Documents the KUnit resource API
Documentation/dev-tools/kunit/api/functionredirection.rst
- Documents the KUnit Function Redirection API
Driver KUnit API #
Documentation/dev-tools/kunit/api/clk.rst
- Documents the KUnit clk API
Documentation/dev-tools/kunit/api/of.rst
- Documents the KUnit device tree (OF) API
Documentation/dev-tools/kunit/api/platformdevice.rst
- Documents the KUnit platform device API
Clk API
Peios Kernel / Kernel development / Development tools / kunit / api
The KUnit clk API is used to test clk providers and clk consumers.
clk_prepare_enable_kunit() #
int Test managed clk_prepare_enable()
Parameters
struct kunit *test: The test contextstruct clk *clk: clk to prepare and enable
Return
0 on success, or negative errno on failure.
clk_get_kunit() #
struct clk * Test managed clk_get()
Parameters
struct kunit *test: The test contextstruct device *dev: device for clock "consumer"const char *con_id: clock consumer ID
Description
Just like clk_get(), except the clk is managed by the test case and is
automatically put with clk_put() after the test case concludes.
Return
new clk consumer or ERR_PTR on failure.
of_clk_get_kunit() #
struct clk * Test managed of_clk_get()
Parameters
struct kunit *test: The test contextstruct device_node *np: device_node for clock "consumer"int index: index in 'clocks' property of np
Description
Just like of_clk_get(), except the clk is managed by the test case and is
automatically put with clk_put() after the test case concludes.
Return
new clk consumer or ERR_PTR on failure.
clk_hw_get_clk_kunit() #
struct clk * Test managed clk_hw_get_clk()
Parameters
struct kunit *test: The test contextstruct clk_hw *hw: clk_hw associated with the clk being consumedconst char *con_id: connection ID string on device
Description
Just like clk_hw_get_clk(), except the clk is managed by the test case and
is automatically put with clk_put() after the test case concludes.
Return
new clk consumer or ERR_PTR on failure.
clk_hw_get_clk_prepared_enabled_kunit() #
struct clk * Test managed clk_hw_get_clk() + clk_prepare_enable()
Parameters
struct kunit *test: The test contextstruct clk_hw *hw: clk_hw associated with the clk being consumedconst char *con_id: connection ID string on device
Description
Just like
struct clk *clk = ;
;
except the clk is managed by the test case and is automatically disabled and
unprepared with clk_disable_unprepare() and put with clk_put() after the
test case concludes.
Return
new clk consumer that is prepared and enabled or ERR_PTR on failure.
clk_hw_register_kunit() #
int Test managed clk_hw_register()
Parameters
struct kunit *test: The test contextstruct device *dev: device that is registering this clockstruct clk_hw *hw: link to hardware-specific clock data
Description
Just like clk_hw_register(), except the clk registration is managed by the
test case and is automatically unregistered after the test case concludes.
Return
0 on success or a negative errno value on failure.
of_clk_hw_register_kunit() #
int Test managed of_clk_hw_register()
Parameters
struct kunit *test: The test contextstruct device_node *node: device_node of device that is registering this clockstruct clk_hw *hw: link to hardware-specific clock data
Description
Just like of_clk_hw_register(), except the clk registration is managed by
the test case and is automatically unregistered after the test case
concludes.
Return
0 on success or a negative errno value on failure.
of_clk_add_hw_provider_kunit() #
int Test managed of_clk_add_hw_provider()
Parameters
struct kunit *test: The test contextstruct device_node *np: Device node pointer associated with clock providerstruct clk_hw *(*get)(struct of_phandle_args *clkspec, void *data): Callback for decoding clk_hwvoid *data: Context pointer for get callback.
Description
Just like of_clk_add_hw_provider(), except the clk_hw provider is managed by
the test case and is automatically unregistered after the test case
concludes.
Return
0 on success or a negative errno value on failure.
Function Redirection API
Peios Kernel / Kernel development / Development tools / kunit / api
Overview #
When writing unit tests, it's important to be able to isolate the code being tested from other parts of the kernel. This ensures the reliability of the test (it won't be affected by external factors), reduces dependencies on specific hardware or config options (making the test easier to run), and protects the stability of the rest of the system (making it less likely for test-specific state to interfere with the rest of the system).
While for some code (typically generic data structures, helpers, and other "pure functions") this is trivial, for others (like device drivers, filesystems, core subsystems) the code is heavily coupled with other parts of the kernel.
This coupling is often due to global state in some way: be it a global list of devices, the filesystem, or some hardware state. Tests need to either carefully manage, isolate, and restore state, or they can avoid it altogether by replacing access to and mutation of this state with a "fake" or "mock" variant.
By refactoring access to such state, such as by introducing a layer of indirection which can use or emulate a separate set of test state. However, such refactoring comes with its own costs (and undertaking significant refactoring before being able to write tests is suboptimal).
A simpler way to intercept and replace some of the function calls is to use function redirection via static stubs.
Static Stubs #
Static stubs are a way of redirecting calls to one function (the "real" function) to another function (the "replacement" function).
It works by adding a macro to the "real" function which checks to see if a test is running, and if a replacement function is available. If so, that function is called in place of the original.
Using static stubs is pretty straightforward:
-
Add the KUNIT_STATIC_STUB_REDIRECT() macro to the start of the "real" function.
This should be the first statement in the function, after any variable declarations. KUNIT_STATIC_STUB_REDIRECT() takes the name of the function, followed by all of the arguments passed to the real function.
For example:
void -
Write one or more replacement functions.
These functions should have the same function signature as the real function. In the event they need to access or modify test-specific state, they can use kunit_get_current_test() to get a struct kunit pointer. This can then be passed to the expectation/assertion macros, or used to look up KUnit resources.
For example:
void -
Activate the static stub from your test.
From within a test, the redirection can be enabled with kunit_activate_static_stub(), which accepts a struct kunit pointer, the real function, and the replacement function. You can call this several times with different replacement functions to swap out implementations of the function.
In our example, this would be
; -
Call (perhaps indirectly) the real function.
Once the redirection is activated, any call to the real function will call the replacement function instead. Such calls may be buried deep in the implementation of another function, but must occur from the test's kthread.
For example:
; /* Succeeds */ ; /* Fails the test. */ -
(Optionally) disable the stub.
When you no longer need it, disable the redirection (and hence resume the original behaviour of the 'real' function) using kunit_deactivate_static_stub(). Otherwise, it will be automatically disabled when the test exits.
For example:
;
It's also possible to use these replacement functions to test to see if a function is called at all, for example:
void
/* In test file */
int times_called = 0;
void
...
/* In the test case, redirect calls for the duration of the test */
;
;
;
/* Can also deactivate the stub early, if wanted */
;
;
;
API Reference #
KUNIT_STATIC_STUB_REDIRECT() #
call a replacement 'static stub' if one exists
Parameters
real_fn_name: The name of this function (as an identifier, not a string)args...: All of the arguments passed to this function
Description
This is a function prologue which is used to allow calls to the current
function to be redirected by a KUnit test. KUnit tests can call
kunit_activate_static_stub() to pass a replacement function in. The
replacement function will be called by KUNIT_STATIC_STUB_REDIRECT(), which
will then return from the function. If the caller is not in a KUnit context,
the function will continue execution as normal.
Example
int
int
void
kunit_activate_static_stub() #
replace a function using static stubs.
Parameters
test: A pointer to the 'struct kunit' test context for the current test.real_fn_addr: The address of the function to replace.replacement_addr: The address of the function to replace it with.
Description
When activated, calls to real_fn_addr from within this test (even if called
indirectly) will instead call replacement_addr. The function pointed to by
real_fn_addr must begin with the static stub prologue in
KUNIT_STATIC_STUB_REDIRECT() for this to work. real_fn_addr and
replacement_addr must have the same type.
The redirection can be disabled again with kunit_deactivate_static_stub().
kunit_deactivate_static_stub() #
void disable a function redirection
Parameters
struct kunit *test: A pointer to the 'struct kunit' test context for the current test.void *real_fn_addr: The address of the function to no-longer redirect
Description
Deactivates a redirection configured with kunit_activate_static_stub(). After
this function returns, calls to real_fn_addr() will execute the original
real_fn, not any previously-configured replacement.
Device Tree (OF) API
Peios Kernel / Kernel development / Development tools / kunit / api
The KUnit device tree API is used to test device tree (of_*) dependent code.
__of_overlay_apply_kunit() #
int Test managed of_overlay_fdt_apply() variant
Parameters
struct kunit *test: test contextu8 *overlay_begin: start address of overlay to applyconst u8 *overlay_end: end address of overlay to apply
Description
This is mostly internal API. See of_overlay_apply_kunit() for the wrapper
that makes this easier to use.
Similar to of_overlay_fdt_apply(), except the overlay is managed by the test
case and is automatically removed with of_overlay_remove() after the test
case concludes.
Return
0 on success, negative errno on failure
of_overlay_apply_kunit() #
Test managed of_overlay_fdt_apply() for built-in overlays
Parameters
test: test contextoverlay_name: name of overlay to apply
Description
This macro is used to apply a device tree overlay built with the cmd_dt_S_dtbo rule in scripts/Makefile.lib that has been compiled into the kernel image or KUnit test module. The overlay is automatically removed when the test is finished.
Unit tests that need device tree nodes should compile an overlay file with overlay_name.dtbo.o in their Makefile along with their unit test and then load the overlay during their test. The overlay_name matches the filename of the overlay without the dtbo filename extension. If CONFIG_OF_OVERLAY is not enabled, the test will be skipped.
In the Makefile
obj-$(CONFIG_OF_OVERLAY_KUNIT_TEST) += overlay_test.o kunit_overlay_test.dtbo.o
In the test
static void
Return
0 on success, negative errno on failure.
of_root_kunit_skip() #
void Skip test if the root node isn't populated
Parameters
struct kunit *test: test to skip if the root node isn't populated
of_overlay_fdt_apply_kunit() #
int Test managed of_overlay_fdt_apply()
Parameters
struct kunit *test: test contextvoid *overlay_fdt: device tree overlay to applyu32 overlay_fdt_size: size in bytes of overlay_fdtint *ovcs_id: identifier of overlay, used to remove the overlay
Description
Just like of_overlay_fdt_apply(), except the overlay is managed by the test
case and is automatically removed with of_overlay_remove() after the test
case concludes.
Return
0 on success, negative errno on failure
of_node_put_kunit() #
void Test managed of_node_put()
Parameters
struct kunit *test: test contextstruct device_node *node: node to pass toof_node_put()
Description
Just like of_node_put(), except the node is managed by the test case and is
automatically put with of_node_put() after the test case concludes.
Platform Device API
Peios Kernel / Kernel development / Development tools / kunit / api
The KUnit platform device API is used to test platform devices.
kunit_platform_device_alloc() #
struct platform_device * Allocate a KUnit test managed platform device
Parameters
struct kunit *test: test contextconst char *name: device name of platform device to allocint id: identifier of platform device to alloc.
Description
Allocate a test managed platform device. The device is put when the test completes.
Return
Allocated platform device on success, NULL on failure.
kunit_platform_device_add() #
int Register a KUnit test managed platform device
Parameters
struct kunit *test: test contextstruct platform_device *pdev: platform device to add
Description
Register a test managed platform device. The device is unregistered when the test completes.
Return
0 on success, negative errno on failure.
kunit_platform_device_prepare_wait_for_probe() #
int Prepare a completion variable to wait for a platform device to probe
Parameters
struct kunit *test: test contextstruct platform_device *pdev: platform device to prepare to wait for probe ofstruct completion *x: completion variable completed when dev has probed
Description
Prepare a completion variable x to wait for pdev to probe. Waiting on the completion forces a preemption, allowing the platform driver to probe.
Example
static int
static void
Return
0 on success, negative errno on failure.
kunit_platform_driver_register() #
int Register a KUnit test managed platform driver
Parameters
struct kunit *test: test contextstruct platform_driver *drv: platform driver to register
Description
Register a test managed platform driver. This allows callers to embed the
drv in a container structure and use container_of() in the probe function
to pass information to KUnit tests.
Example
;
static inline struct kunit_test_context *
static int
static void
Return
0 on success, negative errno on failure.
Resource API
Peios Kernel / Kernel development / Development tools / kunit / api
This file documents the KUnit resource API.
Most users won't need to use this API directly, power users can use it to store state on a per-test basis, register custom cleanup actions, and more.
struct kunit_resource #
represents a test managed resource
Definition
;
Members
data: for the user to store arbitrary data.name: optional namefree: a user supplied function to free the resource.
Description
Represents a test managed resource, a resource which will automatically be
cleaned up at the end of a test case. This cleanup is performed by the 'free'
function. The struct kunit_resource itself is freed automatically with
kfree() if it was allocated by KUnit (e.g., by kunit_alloc_resource()), but
must be freed by the user otherwise.
Resources are reference counted so if a resource is retrieved via
kunit_alloc_and_get_resource() or kunit_find_resource(), we need
to call kunit_put_resource() to reduce the resource reference count
when finished with it. Note that kunit_alloc_resource() does not require a
kunit_resource_put() because it does not retrieve the resource itself.
Example
;
static int
static void
void *
Resources can also be named, with lookup/removal done on a name
basis also. kunit_add_named_resource(), kunit_find_named_resource()
and kunit_destroy_named_resource(). Resource names must be
unique within the test instance.
kunit_get_resource() #
void Hold resource for use. Should not need to be used by most users as we automatically get resources retrieved by kunit_find_resource*().
Parameters
struct kunit_resource *res: resource
kunit_put_resource() #
void When caller is done with retrieved resource, kunit_put_resource() should be called to drop reference count. The resource list maintains a reference count on resources, so if no users are utilizing a resource and it is removed from the resource list, it will be freed via the associated free function (if any). Only needs to be used if we alloc_and_get() or find() resource.
Parameters
struct kunit_resource *res: resource
__kunit_add_resource() #
int Internal helper to add a resource.
Parameters
struct kunit *test: The test context object.kunit_resource_init_t init: a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to data. If an init function is supplied, data is passed to it instead.kunit_resource_free_t free: a user-supplied function to free the resource (if needed).struct kunit_resource *res: The resource.void *data: value to pass to init function or set in resource data field.
Description
res->should_kfree is not initialised.
kunit_add_resource() #
int Add a test managed resource.
Parameters
struct kunit *test: The test context object.kunit_resource_init_t init: a user-supplied function to initialize the result (if needed). If none is supplied, the resource data value is simply set to data. If an init function is supplied, data is passed to it instead.kunit_resource_free_t free: a user-supplied function to free the resource (if needed).struct kunit_resource *res: The resource.void *data: value to pass to init function or set in resource data field.
kunit_add_named_resource() #
int Add a named test managed resource.
Parameters
struct kunit *test: The test context object.kunit_resource_init_t init: a user-supplied function to initialize the resource data, if needed.kunit_resource_free_t free: a user-supplied function to free the resource data, if needed.struct kunit_resource *res: The resource.const char *name: name to be set for resource.void *data: value to pass to init function or set in resource data field.
kunit_alloc_and_get_resource() #
struct kunit_resource * Allocates and returns a test managed resource.
Parameters
struct kunit *test: The test context object.kunit_resource_init_t init: a user supplied function to initialize the resource.kunit_resource_free_t free: a user supplied function to free the resource (if needed).gfp_t internal_gfp: gfp to use for internal allocations, if unsure, use GFP_KERNELvoid *context: for the user to pass in arbitrary data to the init function.
Description
Allocates a test managed resource, a resource which will automatically be
cleaned up at the end of a test case. See struct kunit_resource for an
example.
This is effectively identical to kunit_alloc_resource, but returns the
struct kunit_resource pointer, not just the 'data' pointer. It therefore
also increments the resource's refcount, so kunit_put_resource() should be
called when you've finished with it.
Note
KUnit needs to allocate memory for a kunit_resource object. You must specify an internal_gfp that is compatible with the use context of your resource.
kunit_alloc_resource() #
void * Allocates a test managed resource.
Parameters
struct kunit *test: The test context object.kunit_resource_init_t init: a user supplied function to initialize the resource.kunit_resource_free_t free: a user supplied function to free the resource (if needed).gfp_t internal_gfp: gfp to use for internal allocations, if unsure, use GFP_KERNELvoid *context: for the user to pass in arbitrary data to the init function.
Description
Allocates a test managed resource, a resource which will automatically be
cleaned up at the end of a test case. See struct kunit_resource for an
example.
Note
KUnit needs to allocate memory for a kunit_resource object. You must specify an internal_gfp that is compatible with the use context of your resource.
kunit_resource_name_match() #
bool Match a resource with the same name.
Parameters
struct kunit *test: Test case to which the resource belongs.struct kunit_resource *res: The resource.void *match_name: The name to match against.
kunit_find_resource() #
struct kunit_resource * Find a resource using match function/data.
Parameters
struct kunit *test: Test case to which the resource belongs.kunit_resource_match_t match: match function to be applied to resources/match data.void *match_data: data to be used in matching.
kunit_find_named_resource() #
struct kunit_resource * Find a resource using match name.
Parameters
struct kunit *test: Test case to which the resource belongs.const char *name: match name.
kunit_destroy_resource() #
int Find a kunit_resource and destroy it.
Parameters
struct kunit *test: Test case to which the resource belongs.kunit_resource_match_t match: Match function. Returns whether a given resource matches match_data.void *match_data: Data passed into match.
Return
0 if kunit_resource is found and freed, -ENOENT if not found.
kunit_remove_resource() #
void remove resource from resource list associated with test.
Parameters
struct kunit *test: The test context object.struct kunit_resource *res: The resource to be removed.
Description
Note that the resource will not be immediately freed since it is likely
the caller has a reference to it via alloc_and_get() or find();
in this case a final call to kunit_put_resource() is required.
KUNIT_DEFINE_ACTION_WRAPPER() #
Wrap a function for use as a deferred action.
Parameters
wrapper: The name of the new wrapper function define.orig: The original function to wrap.arg_type: The type of the argument accepted by orig.
Description
Defines a wrapper for a function which accepts a single, pointer-sized
argument. This wrapper can then be passed to kunit_add_action() and
similar. This should be used in preference to casting a function
directly to kunit_action_t, as casting function pointers will break
control flow integrity (CFI), leading to crashes.
kunit_add_action() #
int Call a function when the test ends.
Parameters
struct kunit *test: Test case to associate the action with.kunit_action_t *action: The function to run on test exitvoid *ctx: Data passed into func
Description
Defer the execution of a function until the test exits, either normally or
due to a failure. ctx is passed as additional context. All functions
registered with kunit_add_action() will execute in the opposite order to that
they were registered in.
This is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion.
See also: devm_add_action() for the devres equivalent.
Return
0 on success, an error if the action could not be deferred.
kunit_add_action_or_reset() #
int Call a function when the test ends.
Parameters
struct kunit *test: Test case to associate the action with.kunit_action_t *action: The function to run on test exitvoid *ctx: Data passed into func
Description
Defer the execution of a function until the test exits, either normally or
due to a failure. ctx is passed as additional context. All functions
registered with kunit_add_action() will execute in the opposite order to that
they were registered in.
This is useful for cleaning up allocated memory and resources, as these functions are called even if the test aborts early due to, e.g., a failed assertion.
If the action cannot be created (e.g., due to the system being out of memory), then action(ctx) will be called immediately, and an error will be returned.
See also: devm_add_action_or_reset() for the devres equivalent.
Return
0 on success, an error if the action could not be deferred.
kunit_remove_action() #
void Cancel a matching deferred action.
Parameters
struct kunit *test: Test case the action is associated with.kunit_action_t *action: The deferred function to cancel.void *ctx: The context passed to the deferred function to trigger.
Description
Prevent an action deferred via kunit_add_action() from executing when the
test terminates.
If the function/context pair was deferred multiple times, only the most recent one will be cancelled.
See also: devm_remove_action() for the devres equivalent.
kunit_release_action() #
void Run a matching action call immediately.
Parameters
struct kunit *test: Test case the action is associated with.kunit_action_t *action: The deferred function to trigger.void *ctx: The context passed to the deferred function to trigger.
Description
Execute a function deferred via kunit_add_action()) immediately, rather than
when the test ends.
If the function/context pair was deferred multiple times, it will only be executed once here. The most recent deferral will no longer execute when the test ends.
kunit_release_action(test, func, ctx); is equivalent to func(ctx); kunit_remove_action(test, func, ctx);
See also: devm_release_action() for the devres equivalent.
Managed Devices #
Functions for using KUnit-managed struct device and struct device_driver. Include kunit/device.h to use these.
kunit_driver_create() #
struct device_driver * Create a struct device_driver attached to the kunit_bus
Parameters
struct kunit *test: The test context object.const char *name: The name to give the created driver.
Description
Creates a struct device_driver attached to the kunit_bus, with the name name. This driver will automatically be cleaned up on test exit.
Return
a stub struct device_driver, managed by KUnit, with the name name.
kunit_device_register() #
struct device * Create a struct device for use in KUnit tests
Parameters
struct kunit *test: The test context object.const char *name: The name to give the created device.
Description
Creates a struct kunit_device (which is a struct device) with the given name, and a corresponding driver. The device and driver will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register_with_driver, if you wish to provide your own struct device_driver.
Return
a pointer to a struct device which will be cleaned up when the test exits, or an error pointer if the device could not be allocated or registered.
kunit_device_register_with_driver() #
struct device * Create a struct device for use in KUnit tests
Parameters
struct kunit *test: The test context object.const char *name: The name to give the created device.const struct device_driver *drv: The struct device_driver to associate with the device.
Description
Creates a struct kunit_device (which is a struct device) with the given name, and driver. The device will be cleaned up on test exit, or when kunit_device_unregister is called. See also kunit_device_register, if you wish KUnit to create and manage a driver for you.
Return
a pointer to a struct device which will be cleaned up when the test exits, or an error pointer if the device could not be allocated or registered.
kunit_device_unregister() #
void Unregister a KUnit-managed device
Parameters
struct kunit *test: The test context object which created the devicestruct device *dev: The device.
Description
Unregisters and destroys a struct device which was created with kunit_device_register or kunit_device_register_with_driver. If KUnit created a driver, cleans it up as well.
Test API
Peios Kernel / Kernel development / Development tools / kunit / api
This file documents all of the standard testing API.
enum kunit_status #
Type of result for a test or test suite
Constants
KUNIT_SUCCESS: Denotes the test suite has not failed nor been skippedKUNIT_FAILURE: Denotes the test has failed.KUNIT_SKIPPED: Denotes the test has been skipped.
struct kunit_case #
represents an individual test case.
Definition
;
Members
run_case: the function representing the actual test case.name: the name of the test case.generate_params: the generator function for parameterized tests.attr: the attributes associated with the testparam_init: The init function to run before a parameterized test.param_exit: The exit function to run after a parameterized test.
Description
A test case is a function with the signature,
void (*)(struct kunit *)
that makes expectations and assertions (see KUNIT_EXPECT_TRUE() and
KUNIT_ASSERT_TRUE()) about code under test. Each test case is associated
with a struct kunit_suite and will be run after the suite's init
function and followed by the suite's exit function.
A test case should be static and should only be created with the
KUNIT_CASE() macro; additionally, every array of test cases should be
terminated with an empty test case.
Example
void
static struct kunit_case example_test_cases = ;
KUNIT_CASE() #
A helper for creating a struct kunit_case
Parameters
test_name: a reference to a test case function.
Description
Takes a symbol for a function representing a test case and creates a
struct kunit_case object from it. See the documentation for
struct kunit_case for an example on how to use it.
KUNIT_CASE_ATTR() #
A helper for creating a struct kunit_case with attributes
Parameters
test_name: a reference to a test case function.attributes: a reference to a struct kunit_attributes object containing test attributes
KUNIT_CASE_SLOW() #
A helper for creating a struct kunit_case with the slow attribute
Parameters
test_name: a reference to a test case function.
KUNIT_CASE_PARAM() #
A helper for creation a parameterized struct kunit_case
Parameters
test_name: a reference to a test case function.gen_params: a reference to a parameter generator function.
Description
The generator function:
const void* gen_params(const void *prev, char *desc)
is used to lazily generate a series of arbitrarily typed values that fit into a void*. The argument prev is the previously returned value, which should be used to derive the next value; prev is set to NULL on the initial generator call. When no more values are available, the generator must return NULL. Optionally write a string into desc (size of KUNIT_PARAM_DESC_SIZE) describing the parameter.
KUNIT_CASE_PARAM_ATTR() #
A helper for creating a parameterized struct kunit_case with attributes
Parameters
test_name: a reference to a test case function.gen_params: a reference to a parameter generator function.attributes: a reference to a struct kunit_attributes object containing test attributes
KUNIT_CASE_PARAM_WITH_INIT() #
Define a parameterized KUnit test case with custom param_init() and param_exit() functions.
Parameters
test_name: The function implementing the test case.gen_params: The function to generate parameters for the test case.init: A reference to theparam_init()function to run before a parameterized test.exit: A reference to theparam_exit()function to run after a parameterized test.
Description
Provides the option to register param_init() and param_exit() functions.
param_init/exit will be passed the parameterized test context and run once
before and once after the parameterized test. The init function can be used
to add resources to share between parameter runs, pass parameter arrays,
and any other setup logic. The exit function can be used to clean up resources
that were not managed by the parameterized test, and any other teardown logic.
Note
If you are registering a parameter array in param_init() with
kunit_register_param_array() then you need to pass kunit_array_gen_params()
to this as the generator function.
struct kunit_suite #
describes a related collection of struct kunit_case
Definition
;
Members
name: the name of the test. Purely informational.suite_init: called once per test suite before the test cases.suite_exit: called once per test suite after all test cases.init: called before every test case.exit: called after every test case.test_cases: a null terminated array of test cases.attr: the attributes associated with the test suite
Description
A kunit_suite is a collection of related struct kunit_case s, such that
init is called before every test case and exit is called after every
test case, similar to the notion of a test fixture or a test class
in other unit testing frameworks like JUnit or Googletest.
Note that exit and suite_exit will run even if init or suite_init fail: make sure they can handle any inconsistent state which may result.
Every struct kunit_case must be associated with a kunit_suite for KUnit
to run it.
struct kunit #
represents a running instance of a test.
Definition
;
Members
priv: for user to store arbitrary data. Commonly used to pass data created in the init function (seestruct kunit_suite).parent: reference to the parent context of type struct kunit that can be used for storing shared resources.params_array: for storing the parameter array.
Description
Used to store information about the current context under which the test is running. Most of this data is private and should only be accessed indirectly via public functions; the exceptions are priv, parent and params_array which can be used by the test writer to store arbitrary data, access the parent context, and to store the parameter array, respectively.
kunit_test_suites() #
used to register one or more struct kunit_suite with KUnit.
Parameters
__suites...: a statically allocated list ofstruct kunit_suite.
Description
Registers suites with the test framework. This is done by placing the array of struct kunit_suite * in the .kunit_test_suites ELF section.
When builtin, KUnit tests are all run via the executor at boot, and when built as a module, they run on module load.
kunit_test_init_section_suites() #
used to register one or more struct kunit_suite containing init functions or init data.
Parameters
__suites...: a statically allocated list ofstruct kunit_suite.
Description
This functions similar to kunit_test_suites() except that it compiles the
list of suites during init phase.
This macro also suffixes the array and suite declarations it makes with _probe; so that modpost suppresses warnings about referencing init data for symbols named in this manner.
Note
these init tests are not able to be run after boot so there is no "run" debugfs file generated for these tests.
Also, do not mark the suite or test case structs with __initdata because they will be used after the init phase with debugfs.
kunit_kmalloc_array() #
void * Like kmalloc_array() except the allocation is test managed.
Parameters
struct kunit *test: The test context object.size_t n: number of elements.size_t size: The size in bytes of the desired memory.gfp_t gfp: flags passed to underlyingkmalloc().
Description
Just like kmalloc_array(...), except the allocation is managed by the test case
and is automatically cleaned up after the test case concludes. See kunit_add_action()
for more information.
Note that some internal context data is also allocated with GFP_KERNEL, regardless of the gfp passed in.
kunit_kmalloc() #
void * Like kmalloc() except the allocation is test managed.
Parameters
struct kunit *test: The test context object.size_t size: The size in bytes of the desired memory.gfp_t gfp: flags passed to underlyingkmalloc().
Description
See kmalloc() and kunit_kmalloc_array() for more information.
Note that some internal context data is also allocated with GFP_KERNEL, regardless of the gfp passed in.
kunit_kfree() #
void Like kfree except for allocations managed by KUnit.
Parameters
struct kunit *test: The test case to which the resource belongs.const void *ptr: The memory allocation to free.
kunit_kzalloc() #
void * Just like kunit_kmalloc(), but zeroes the allocation.
Parameters
struct kunit *test: The test context object.size_t size: The size in bytes of the desired memory.gfp_t gfp: flags passed to underlyingkmalloc().
Description
See kzalloc() and kunit_kmalloc_array() for more information.
kunit_kcalloc() #
void * Just like kunit_kmalloc_array(), but zeroes the allocation.
Parameters
struct kunit *test: The test context object.size_t n: number of elements.size_t size: The size in bytes of the desired memory.gfp_t gfp: flags passed to underlyingkmalloc().
Description
See kcalloc() and kunit_kmalloc_array() for more information.
kunit_kfree_const() #
void conditionally free test managed memory
Parameters
struct kunit *test: The test context object.const void *x: pointer to the memory
Description
Calls kunit_kfree() only if x is not in .rodata section.
See kunit_kstrdup_const() for more information.
kunit_kstrdup() #
char * Duplicates a string into a test managed allocation.
Parameters
struct kunit *test: The test context object.const char *str: The NULL-terminated string to duplicate.gfp_t gfp: flags passed to underlyingkmalloc().
Description
See kstrdup() and kunit_kmalloc_array() for more information.
kunit_kstrdup_const() #
const char * Conditionally duplicates a string into a test managed allocation.
Parameters
struct kunit *test: The test context object.const char *str: The NULL-terminated string to duplicate.gfp_t gfp: flags passed to underlyingkmalloc().
Description
Calls kunit_kstrdup() only if str is not in the rodata section. Must be freed with
kunit_kfree_const() -- not kunit_kfree().
See kstrdup_const() and kunit_kmalloc_array() for more information.
kunit_attach_mm() #
int Create and attach a new mm if it doesn't already exist.
Parameters
void: no arguments
Description
Allocates a struct mm_struct and attaches it to current. In most cases, call
kunit_vm_mmap() without calling kunit_attach_mm() directly. Only necessary when
code under test accesses the mm before executing the mmap (e.g., to perform
additional initialization beforehand).
Return
0 on success, -errno on failure.
kunit_vm_mmap() #
unsigned long Allocate KUnit-tracked vm_mmap() area
Parameters
struct kunit *test: The test context object.struct file *file: struct file pointer to map from, if anyunsigned long addr: desired address, if anyunsigned long len: how many bytes to allocateunsigned long prot: mmap PROT_* bitsunsigned long flag: mmap flagsunsigned long offset: offset into file to start mapping from.
Description
See vm_mmap() for more information.
kunit_mark_skipped() #
Marks test as skipped
Parameters
test: The test context object.fmt: Aprintk()style format string....: variable arguments
Description
Marks the test as skipped. fmt is given output as the test status comment, typically the reason the test was skipped.
Test execution continues after kunit_mark_skipped() is called.
kunit_skip() #
Marks test as skipped
Parameters
test: The test context object.fmt: Aprintk()style format string....: variable arguments
Description
Skips the test. fmt is given output as the test status comment, typically the reason the test was skipped.
Test execution is halted after kunit_skip() is called.
kunit_info() #
Prints an INFO level message associated with test.
Parameters
test: The test context object.fmt: Aprintk()style format string....: variable arguments
Description
Prints an info level message associated with the test suite being run.
Takes a variable number of format parameters just like printk().
kunit_warn() #
Prints a WARN level message associated with test.
Parameters
test: The test context object.fmt: Aprintk()style format string....: variable arguments
Description
Prints a warning level message.
kunit_err() #
Prints an ERROR level message associated with test.
Parameters
test: The test context object.fmt: Aprintk()style format string....: variable arguments
Description
Prints an error level message.
KUNIT_SUCCEED() #
A no-op expectation. Only exists for code clarity.
Parameters
test: The test context object.
Description
The opposite of KUNIT_FAIL(), it is an expectation that cannot fail. In other
words, it does nothing and only exists for code clarity. See
KUNIT_EXPECT_TRUE() for more information.
KUNIT_FAIL() #
Always causes a test to fail when evaluated.
Parameters
test: The test context object.fmt: an informational message to be printed when the assertion is made....: string format arguments.
Description
The opposite of KUNIT_SUCCEED(), it is an expectation that always fails. In
other words, it always results in a failed expectation, and consequently
always causes the test case to fail when evaluated. See KUNIT_EXPECT_TRUE()
for more information.
KUNIT_EXPECT_TRUE() #
Causes a test failure when the expression is not true.
Parameters
test: The test context object.condition: an arbitrary boolean expression. The test fails when this does not evaluate to true.
Description
This and expectations of the form KUNIT_EXPECT_* will cause the test case
to fail when the specified condition is not met; however, it will not prevent
the test case from continuing to run; this is otherwise known as an
expectation failure.
KUNIT_EXPECT_FALSE() #
Makes a test failure when the expression is not false.
Parameters
test: The test context object.condition: an arbitrary boolean expression. The test fails when this does not evaluate to false.
Description
Sets an expectation that condition evaluates to false. See
KUNIT_EXPECT_TRUE() for more information.
KUNIT_EXPECT_EQ() #
Sets an expectation that left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an expectation that the values that left and right evaluate to are
equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) == (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_PTR_EQ() #
Expects that pointers left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a pointer.right: an arbitrary expression that evaluates to a pointer.
Description
Sets an expectation that the values that left and right evaluate to are
equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) == (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_NE() #
An expectation that left and right are not equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an expectation that the values that left and right evaluate to are not
equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) != (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_PTR_NE() #
Expects that pointers left and right are not equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a pointer.right: an arbitrary expression that evaluates to a pointer.
Description
Sets an expectation that the values that left and right evaluate to are not
equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) != (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_LT() #
An expectation that left is less than right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an expectation that the value that left evaluates to is less than the
value that right evaluates to. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) < (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_LE() #
Expects that left is less than or equal to right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an expectation that the value that left evaluates to is less than or
equal to the value that right evaluates to. Semantically this is equivalent
to KUNIT_EXPECT_TRUE(test, (left) <= (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_GT() #
An expectation that left is greater than right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an expectation that the value that left evaluates to is greater than
the value that right evaluates to. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) > (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_GE() #
Expects that left is greater than or equal to right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an expectation that the value that left evaluates to is greater than
the value that right evaluates to. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, (left) >= (right)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_EXPECT_STREQ() #
Expects that strings left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a null terminated string.right: an arbitrary expression that evaluates to a null terminated string.
Description
Sets an expectation that the values that left and right evaluate to are
equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, !strcmp((left), (right))). See KUNIT_EXPECT_TRUE()
for more information.
KUNIT_EXPECT_STRNEQ() #
Expects that strings left and right are not equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a null terminated string.right: an arbitrary expression that evaluates to a null terminated string.
Description
Sets an expectation that the values that left and right evaluate to are
not equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, strcmp((left), (right))). See KUNIT_EXPECT_TRUE()
for more information.
KUNIT_EXPECT_MEMEQ() #
Expects that the first size bytes of left and right are equal.
Parameters
test: The test context object.left: An arbitrary expression that evaluates to the specified size.right: An arbitrary expression that evaluates to the specified size.size: Number of bytes compared.
Description
Sets an expectation that the values that left and right evaluate to are
equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, !memcmp((left), (right), (size))). See
KUNIT_EXPECT_TRUE() for more information.
Although this expectation works for any memory block, it is not recommended for comparing more structured data, such as structs. This expectation is recommended for comparing, for example, data arrays.
KUNIT_EXPECT_MEMNEQ() #
Expects that the first size bytes of left and right are not equal.
Parameters
test: The test context object.left: An arbitrary expression that evaluates to the specified size.right: An arbitrary expression that evaluates to the specified size.size: Number of bytes compared.
Description
Sets an expectation that the values that left and right evaluate to are
not equal. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, memcmp((left), (right), (size))). See
KUNIT_EXPECT_TRUE() for more information.
Although this expectation works for any memory block, it is not recommended for comparing more structured data, such as structs. This expectation is recommended for comparing, for example, data arrays.
KUNIT_EXPECT_NULL() #
Expects that ptr is null.
Parameters
test: The test context object.ptr: an arbitrary pointer.
Description
Sets an expectation that the value that ptr evaluates to is null. This is
semantically equivalent to KUNIT_EXPECT_PTR_EQ(test, ptr, NULL).
See KUNIT_EXPECT_TRUE() for more information.
KUNIT_EXPECT_NOT_NULL() #
Expects that ptr is not null.
Parameters
test: The test context object.ptr: an arbitrary pointer.
Description
Sets an expectation that the value that ptr evaluates to is not null. This
is semantically equivalent to KUNIT_EXPECT_PTR_NE(test, ptr, NULL).
See KUNIT_EXPECT_TRUE() for more information.
KUNIT_EXPECT_NOT_ERR_OR_NULL() #
Expects that ptr is not null and not err.
Parameters
test: The test context object.ptr: an arbitrary pointer.
Description
Sets an expectation that the value that ptr evaluates to is not null and not
an errno stored in a pointer. This is semantically equivalent to
KUNIT_EXPECT_TRUE(test, !IS_ERR_OR_NULL(ptr)). See KUNIT_EXPECT_TRUE() for
more information.
KUNIT_FAIL_AND_ABORT() #
Always causes a test to fail and abort when evaluated.
Parameters
test: The test context object.fmt: an informational message to be printed when the assertion is made....: string format arguments.
Description
The opposite of KUNIT_SUCCEED(), it is an assertion that always fails. In
other words, it always results in a failed assertion, and consequently
always causes the test case to fail and abort when evaluated.
See KUNIT_ASSERT_TRUE() for more information.
KUNIT_ASSERT_TRUE() #
Sets an assertion that condition is true.
Parameters
test: The test context object.condition: an arbitrary boolean expression. The test fails and aborts when this does not evaluate to true.
Description
This and assertions of the form KUNIT_ASSERT_* will cause the test case to
fail and immediately abort when the specified condition is not met. Unlike
an expectation failure, it will prevent the test case from continuing to run;
this is otherwise known as an assertion failure.
KUNIT_ASSERT_FALSE() #
Sets an assertion that condition is false.
Parameters
test: The test context object.condition: an arbitrary boolean expression.
Description
Sets an assertion that the value that condition evaluates to is false. This
is the same as KUNIT_EXPECT_FALSE(), except it causes an assertion failure
(see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_EQ() #
Sets an assertion that left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an assertion that the values that left and right evaluate to are
equal. This is the same as KUNIT_EXPECT_EQ(), except it causes an assertion
failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_PTR_EQ() #
Asserts that pointers left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a pointer.right: an arbitrary expression that evaluates to a pointer.
Description
Sets an assertion that the values that left and right evaluate to are
equal. This is the same as KUNIT_EXPECT_EQ(), except it causes an assertion
failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_NE() #
An assertion that left and right are not equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an assertion that the values that left and right evaluate to are not
equal. This is the same as KUNIT_EXPECT_NE(), except it causes an assertion
failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_PTR_NE() #
Asserts that pointers left and right are not equal. KUNIT_ASSERT_PTR_EQ() - Asserts that pointers left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a pointer.right: an arbitrary expression that evaluates to a pointer.
Description
Sets an assertion that the values that left and right evaluate to are not
equal. This is the same as KUNIT_EXPECT_NE(), except it causes an assertion
failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_LT() #
An assertion that left is less than right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an assertion that the value that left evaluates to is less than the
value that right evaluates to. This is the same as KUNIT_EXPECT_LT(), except
it causes an assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion
is not met.
KUNIT_ASSERT_LE() #
An assertion that left is less than or equal to right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an assertion that the value that left evaluates to is less than or
equal to the value that right evaluates to. This is the same as
KUNIT_EXPECT_LE(), except it causes an assertion failure (see
KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_GT() #
An assertion that left is greater than right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an assertion that the value that left evaluates to is greater than the
value that right evaluates to. This is the same as KUNIT_EXPECT_GT(), except
it causes an assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion
is not met.
KUNIT_ASSERT_GE() #
Assertion that left is greater than or equal to right.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a primitive C type.right: an arbitrary expression that evaluates to a primitive C type.
Description
Sets an assertion that the value that left evaluates to is greater than the
value that right evaluates to. This is the same as KUNIT_EXPECT_GE(), except
it causes an assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion
is not met.
KUNIT_ASSERT_STREQ() #
An assertion that strings left and right are equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a null terminated string.right: an arbitrary expression that evaluates to a null terminated string.
Description
Sets an assertion that the values that left and right evaluate to are
equal. This is the same as KUNIT_EXPECT_STREQ(), except it causes an
assertion failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_STRNEQ() #
An assertion that strings left and right are not equal.
Parameters
test: The test context object.left: an arbitrary expression that evaluates to a null terminated string.right: an arbitrary expression that evaluates to a null terminated string.
Description
Sets an assertion that the values that left and right evaluate to are
not equal. This is semantically equivalent to
KUNIT_ASSERT_TRUE(test, strcmp((left), (right))). See KUNIT_ASSERT_TRUE()
for more information.
KUNIT_ASSERT_MEMEQ() #
Asserts that the first size bytes of left and right are equal.
Parameters
test: The test context object.left: An arbitrary expression that evaluates to the specified size.right: An arbitrary expression that evaluates to the specified size.size: Number of bytes compared.
Description
Sets an assertion that the values that left and right evaluate to are
equal. This is semantically equivalent to
KUNIT_ASSERT_TRUE(test, !memcmp((left), (right), (size))). See
KUNIT_ASSERT_TRUE() for more information.
Although this assertion works for any memory block, it is not recommended for comparing more structured data, such as structs. This assertion is recommended for comparing, for example, data arrays.
KUNIT_ASSERT_MEMNEQ() #
Asserts that the first size bytes of left and right are not equal.
Parameters
test: The test context object.left: An arbitrary expression that evaluates to the specified size.right: An arbitrary expression that evaluates to the specified size.size: Number of bytes compared.
Description
Sets an assertion that the values that left and right evaluate to are
not equal. This is semantically equivalent to
KUNIT_ASSERT_TRUE(test, memcmp((left), (right), (size))). See
KUNIT_ASSERT_TRUE() for more information.
Although this assertion works for any memory block, it is not recommended for comparing more structured data, such as structs. This assertion is recommended for comparing, for example, data arrays.
KUNIT_ASSERT_NULL() #
Asserts that pointers ptr is null.
Parameters
test: The test context object.ptr: an arbitrary pointer.
Description
Sets an assertion that the values that ptr evaluates to is null. This is
the same as KUNIT_EXPECT_NULL(), except it causes an assertion
failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_NOT_NULL() #
Asserts that pointers ptr is not null.
Parameters
test: The test context object.ptr: an arbitrary pointer.
Description
Sets an assertion that the values that ptr evaluates to is not null. This
is the same as KUNIT_EXPECT_NOT_NULL(), except it causes an assertion
failure (see KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ASSERT_NOT_ERR_OR_NULL() #
Assertion that ptr is not null and not err.
Parameters
test: The test context object.ptr: an arbitrary pointer.
Description
Sets an assertion that the value that ptr evaluates to is not null and not
an errno stored in a pointer. This is the same as
KUNIT_EXPECT_NOT_ERR_OR_NULL(), except it causes an assertion failure (see
KUNIT_ASSERT_TRUE()) when the assertion is not met.
KUNIT_ARRAY_PARAM() #
Define test parameter generator from an array.
Parameters
name: prefix for the test parameter generator function.array: array of test parameters.get_desc: function to convert param to description; NULL to use default
Description
Define function name_gen_params which uses array to generate parameters.
KUNIT_ARRAY_PARAM_DESC() #
Define test parameter generator from an array.
Parameters
name: prefix for the test parameter generator function.array: array of test parameters.desc_member: structure member from array element to use as description
Description
Define function name_gen_params which uses array to generate parameters.
kunit_register_params_array() #
Register parameter array for a KUnit test.
Parameters
test: The KUnit test structure to which parameters will be added.array: An array of test parameters.param_count: Number of parameters.get_desc: Function that generates a string description for a given parameter element.
Description
This macro initializes the test's parameter array data, storing information
including the parameter array, its count, the element size, and the parameter
description function within test->params_array.
Note
If using this macro in param_init(), kunit_array_gen_params()
will then need to be manually provided as the parameter generator function to
KUNIT_CASE_PARAM_WITH_INIT(). kunit_array_gen_params() is a KUnit
function that uses the registered array to generate parameters
Linux Kernel Memory Consistency Model (LKMM)
Peios Kernel / Kernel development / Development tools / lkmm
This section literally renders documents under tools/memory-model/ and tools/memory-model/Documentation/, which are maintained in the pure plain text form.
README (for LKMM)
Peios Kernel / Kernel development / Development tools / lkmm
Literal include of tools/memory-model/README.
=====================================
LINUX KERNEL MEMORY CONSISTENCY MODEL
=====================================
============
INTRODUCTION
============
This directory contains the memory consistency model (memory model, for
short) of the Linux kernel, written in the "cat" language and executable
by the externally provided "herd7" simulator, which exhaustively explores
the state space of small litmus tests.
In addition, the "klitmus7" tool (also externally provided) may be used
to convert a litmus test to a Linux kernel module, which in turn allows
that litmus test to be exercised within the Linux kernel.
============
REQUIREMENTS
============
Version 7.58 or higher of the "herd7" and "klitmus7" tools must be
downloaded separately:
https://github.com/herd/herdtools7
See "herdtools7/INSTALL.md" for installation instructions.
Note that although these tools usually provide backwards compatibility,
this is not absolutely guaranteed.
For example, a future version of herd7 might not work with the model
in this release. A compatible model will likely be made available in
a later release of Linux kernel.
If you absolutely need to run the model in this particular release,
please try using the exact version called out above.
klitmus7 is independent of the model provided here. It has its own
dependency on a target kernel release where converted code is built
and executed. Any change in kernel APIs essential to klitmus7 will
necessitate an upgrade of klitmus7.
If you find any compatibility issues in klitmus7, please inform the
memory model maintainers.
klitmus7 Compatibility Table
----------------------------
============ ==========
target Linux herdtools7
------------ ----------
-- 4.14 7.48 --
4.15 -- 4.19 7.49 --
4.20 -- 5.5 7.54 --
5.6 -- 5.16 7.56 --
5.17 -- 7.56.1 --
============ ==========
==================
BASIC USAGE: HERD7
==================
The memory model is used, in conjunction with "herd7", to exhaustively
explore the state space of small litmus tests. Documentation describing
the format, features, capabilities and limitations of these litmus
tests is available in tools/memory-model/Documentation/litmus-tests.txt.
Example litmus tests may be found in the Linux-kernel source tree:
tools/memory-model/litmus-tests/
Documentation/litmus-tests/
Several thousand more example litmus tests are available here:
https://github.com/paulmckrcu/litmus
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/perfbook.git/tree/CodeSamples/formal/herd
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/perfbook.git/tree/CodeSamples/formal/litmus
Documentation describing litmus tests and how to use them may be found
here:
tools/memory-model/Documentation/litmus-tests.txt
The remainder of this section uses the SB+fencembonceonces.litmus test
located in the tools/memory-model directory.
To run SB+fencembonceonces.litmus against the memory model:
$ cd $LINUX_SOURCE_TREE/tools/memory-model
$ herd7 -conf linux-kernel.cfg litmus-tests/SB+fencembonceonces.litmus
Here is the corresponding output:
Test SB+fencembonceonces Allowed
States 3
0:r0=0; 1:r0=1;
0:r0=1; 1:r0=0;
0:r0=1; 1:r0=1;
No
Witnesses
Positive: 0 Negative: 3
Condition exists (0:r0=0 /\ 1:r0=0)
Observation SB+fencembonceonces Never 0 3
Time SB+fencembonceonces 0.01
Hash=d66d99523e2cac6b06e66f4c995ebb48
The "Positive: 0 Negative: 3" and the "Never 0 3" each indicate that
this litmus test's "exists" clause can not be satisfied.
See "herd7 -help" or "herdtools7/doc/" for more information on running the
tool itself, but please be aware that this documentation is intended for
people who work on the memory model itself, that is, people making changes
to the tools/memory-model/linux-kernel.* files. It is not intended for
people focusing on writing, understanding, and running LKMM litmus tests.
=====================
BASIC USAGE: KLITMUS7
=====================
The "klitmus7" tool converts a litmus test into a Linux kernel module,
which may then be loaded and run.
For example, to run SB+fencembonceonces.litmus against hardware:
$ mkdir mymodules
$ klitmus7 -o mymodules litmus-tests/SB+fencembonceonces.litmus
$ cd mymodules ; make
$ sudo sh run.sh
The corresponding output includes:
Test SB+fencembonceonces Allowed
Histogram (3 states)
644580 :>0:r0=1; 1:r0=0;
644328 :>0:r0=0; 1:r0=1;
711092 :>0:r0=1; 1:r0=1;
No
Witnesses
Positive: 0, Negative: 2000000
Condition exists (0:r0=0 /\ 1:r0=0) is NOT validated
Hash=d66d99523e2cac6b06e66f4c995ebb48
Observation SB+fencembonceonces Never 0 2000000
Time SB+fencembonceonces 0.16
The "Positive: 0 Negative: 2000000" and the "Never 0 2000000" indicate
that during two million trials, the state specified in this litmus
test's "exists" clause was not reached.
And, as with "herd7", please see "klitmus7 -help" or "herdtools7/doc/"
for more information. And again, please be aware that this documentation
is intended for people who work on the memory model itself, that is,
people making changes to the tools/memory-model/linux-kernel.* files.
It is not intended for people focusing on writing, understanding, and
running LKMM litmus tests.
====================
DESCRIPTION OF FILES
====================
Documentation/README
Guide to the other documents in the Documentation/ directory.
linux-kernel.bell
Categorizes the relevant instructions, including memory
references, memory barriers, atomic read-modify-write operations,
lock acquisition/release, and RCU operations.
More formally, this file (1) lists the subtypes of the various
event types used by the memory model and (2) performs RCU
read-side critical section nesting analysis.
linux-kernel.cat
Specifies what reorderings are forbidden by memory references,
memory barriers, atomic read-modify-write operations, and RCU.
More formally, this file specifies what executions are forbidden
by the memory model. Allowed executions are those which
satisfy the model's "coherence", "atomic", "happens-before",
"propagation", and "rcu" axioms, which are defined in the file.
linux-kernel.cfg
Convenience file that gathers the common-case herd7 command-line
arguments.
linux-kernel.def
Maps from C-like syntax to herd7's internal litmus-test
instruction-set architecture.
litmus-tests
Directory containing a few representative litmus tests, which
are listed in litmus-tests/README. A great deal more litmus
tests are available at https://github.com/paulmckrcu/litmus.
By "representative", it means the one in the litmus-tests
directory is:
1) simple, the number of threads should be relatively
small and each thread function should be relatively
simple.
2) orthogonal, there should be no two litmus tests
describing the same aspect of the memory model.
3) textbook, developers can easily copy-paste-modify
the litmus tests to use the patterns on their own
code.
lock.cat
Provides a front-end analysis of lock acquisition and release,
for example, associating a lock acquisition with the preceding
and following releases and checking for self-deadlock.
More formally, this file defines a performance-enhanced scheme
for generation of the possible reads-from and coherence order
relations on the locking primitives.
README
This file.
scripts Various scripts, see scripts/README.
Documentation
Peios Kernel / Kernel development / Development tools / lkmm / docs
Access Marking
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/access-marking.txt.
MARKING SHARED-MEMORY ACCESSES
==============================
This document provides guidelines for marking intentionally concurrent
normal accesses to shared memory, that is "normal" as in accesses that do
not use read-modify-write atomic operations. It also describes how to
document these accesses, both with comments and with special assertions
processed by the Kernel Concurrency Sanitizer (KCSAN). This discussion
builds on an earlier LWN article [1] and Linux Foundation mentorship
session [2].
ACCESS-MARKING OPTIONS
======================
The Linux kernel provides the following access-marking options:
1. Plain C-language accesses (unmarked), for example, "a = b;"
2. Data-race marking, for example, "data_race(a = b);"
3. READ_ONCE(), for example, "a = READ_ONCE(b);"
The various forms of atomic_read() also fit in here.
4. WRITE_ONCE(), for example, "WRITE_ONCE(a, b);"
The various forms of atomic_set() also fit in here.
5. __data_racy, for example "int __data_racy a;"
6. KCSAN's negative-marking assertions, ASSERT_EXCLUSIVE_ACCESS()
and ASSERT_EXCLUSIVE_WRITER(), are described in the
"ACCESS-DOCUMENTATION OPTIONS" section below.
These may be used in combination, as shown in this admittedly improbable
example:
WRITE_ONCE(a, b + data_race(c + d) + READ_ONCE(e));
Neither plain C-language accesses nor data_race() (#1 and #2 above) place
any sort of constraint on the compiler's choice of optimizations [3].
In contrast, READ_ONCE() and WRITE_ONCE() (#3 and #4 above) restrict the
compiler's use of code-motion and common-subexpression optimizations.
Therefore, if a given access is involved in an intentional data race,
using READ_ONCE() for loads and WRITE_ONCE() for stores is usually
preferable to data_race(), which in turn is usually preferable to plain
C-language accesses. It is permissible to combine #2 and #3, for example,
data_race(READ_ONCE(a)), which will both restrict compiler optimizations
and disable KCSAN diagnostics.
KCSAN will complain about many types of data races involving plain
C-language accesses, but marking all accesses involved in a given data
race with one of data_race(), READ_ONCE(), or WRITE_ONCE(), will prevent
KCSAN from complaining. Of course, lack of KCSAN complaints does not
imply correct code. Therefore, please take a thoughtful approach
when responding to KCSAN complaints. Churning the code base with
ill-considered additions of data_race(), READ_ONCE(), and WRITE_ONCE()
is unhelpful.
In fact, the following sections describe situations where use of
data_race() and even plain C-language accesses is preferable to
READ_ONCE() and WRITE_ONCE().
Use of the data_race() Macro
----------------------------
Here are some situations where data_race() should be used instead of
READ_ONCE() and WRITE_ONCE():
1. Data-racy loads from shared variables whose values are used only
for diagnostic purposes.
2. Data-racy reads whose values are checked against marked reload.
3. Reads whose values feed into error-tolerant heuristics.
4. Writes setting values that feed into error-tolerant heuristics.
Data-Racy Reads for Approximate Diagnostics
Approximate diagnostics include lockdep reports, monitoring/statistics
(including /proc and /sys output), WARN*()/BUG*() checks whose return
values are ignored, and other situations where reads from shared variables
are not an integral part of the core concurrency design.
In fact, use of data_race() instead READ_ONCE() for these diagnostic
reads can enable better checking of the remaining accesses implementing
the core concurrency design. For example, suppose that the core design
prevents any non-diagnostic reads from shared variable x from running
concurrently with updates to x. Then using plain C-language writes
to x allows KCSAN to detect reads from x from within regions of code
that fail to exclude the updates. In this case, it is important to use
data_race() for the diagnostic reads because otherwise KCSAN would give
false-positive warnings about these diagnostic reads.
If it is necessary to both restrict compiler optimizations and disable
KCSAN diagnostics, use both data_race() and READ_ONCE(), for example,
data_race(READ_ONCE(a)).
In theory, plain C-language loads can also be used for this use case.
However, in practice this will have the disadvantage of causing KCSAN
to generate false positives because KCSAN will have no way of knowing
that the resulting data race was intentional.
Data-Racy Reads That Are Checked Against Marked Reload
The values from some reads are not implicitly trusted. They are instead
fed into some operation that checks the full value against a later marked
load from memory, which means that the occasional arbitrarily bogus value
is not a problem. For example, if a bogus value is fed into cmpxchg(),
all that happens is that this cmpxchg() fails, which normally results
in a retry. Unless the race condition that resulted in the bogus value
recurs, this retry will with high probability succeed, so no harm done.
However, please keep in mind that a data_race() load feeding into
a cmpxchg_relaxed() might still be subject to load fusing on some
architectures. Therefore, it is best to capture the return value from
the failing cmpxchg() for the next iteration of the loop, an approach
that provides the compiler much less scope for mischievous optimizations.
Capturing the return value from cmpxchg() also saves a memory reference
in many cases.
In theory, plain C-language loads can also be used for this use case.
However, in practice this will have the disadvantage of causing KCSAN
to generate false positives because KCSAN will have no way of knowing
that the resulting data race was intentional.
Reads Feeding Into Error-Tolerant Heuristics
Values from some reads feed into heuristics that can tolerate occasional
errors. Such reads can use data_race(), thus allowing KCSAN to focus on
the other accesses to the relevant shared variables. But please note
that data_race() loads are subject to load fusing, which can result in
consistent errors, which in turn are quite capable of breaking heuristics.
Therefore use of data_race() should be limited to cases where some other
code (such as a barrier() call) will force the occasional reload.
Note that this use case requires that the heuristic be able to handle
any possible error. In contrast, if the heuristics might be fatally
confused by one or more of the possible erroneous values, use READ_ONCE()
instead of data_race().
In theory, plain C-language loads can also be used for this use case.
However, in practice this will have the disadvantage of causing KCSAN
to generate false positives because KCSAN will have no way of knowing
that the resulting data race was intentional.
Writes Setting Values Feeding Into Error-Tolerant Heuristics
The values read into error-tolerant heuristics come from somewhere,
for example, from sysfs. This means that some code in sysfs writes
to this same variable, and these writes can also use data_race().
After all, if the heuristic can tolerate the occasional bogus value
due to compiler-mangled reads, it can also tolerate the occasional
compiler-mangled write, at least assuming that the proper value is in
place once the write completes.
Plain C-language stores can also be used for this use case. However,
in kernels built with CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=n, this
will have the disadvantage of causing KCSAN to generate false positives
because KCSAN will have no way of knowing that the resulting data race
was intentional.
Use of Plain C-Language Accesses
--------------------------------
Here are some example situations where plain C-language accesses should
used instead of READ_ONCE(), WRITE_ONCE(), and data_race():
1. Accesses protected by mutual exclusion, including strict locking
and sequence locking.
2. Initialization-time and cleanup-time accesses. This covers a
wide variety of situations, including the uniprocessor phase of
system boot, variables to be used by not-yet-spawned kthreads,
structures not yet published to reference-counted or RCU-protected
data structures, and the cleanup side of any of these situations.
3. Per-CPU variables that are not accessed from other CPUs.
4. Private per-task variables, including on-stack variables, some
fields in the task_struct structure, and task-private heap data.
5. Any other loads for which there is not supposed to be a concurrent
store to that same variable.
6. Any other stores for which there should be neither concurrent
loads nor concurrent stores to that same variable.
But note that KCSAN makes two explicit exceptions to this rule
by default, refraining from flagging plain C-language stores:
a. No matter what. You can override this default by building
with CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=n.
b. When the store writes the value already contained in
that variable. You can override this default by building
with CONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY=n.
c. When one of the stores is in an interrupt handler and
the other in the interrupted code. You can override this
default by building with CONFIG_KCSAN_INTERRUPT_WATCHER=y.
Note that it is important to use plain C-language accesses in these cases,
because doing otherwise prevents KCSAN from detecting violations of your
code's synchronization rules.
Use of __data_racy
------------------
Adding the __data_racy type qualifier to the declaration of a variable
causes KCSAN to treat all accesses to that variable as if they were
enclosed by data_race(). However, __data_racy does not affect the
compiler, though one could imagine hardened kernel builds treating the
__data_racy type qualifier as if it was the volatile keyword.
Note well that __data_racy is subject to the same pointer-declaration
rules as are other type qualifiers such as const and volatile.
For example:
int __data_racy *p; // Pointer to data-racy data.
int *__data_racy p; // Data-racy pointer to non-data-racy data.
ACCESS-DOCUMENTATION OPTIONS
============================
It is important to comment marked accesses so that people reading your
code, yourself included, are reminded of the synchronization design.
However, it is even more important to comment plain C-language accesses
that are intentionally involved in data races. Such comments are
needed to remind people reading your code, again, yourself included,
of how the compiler has been prevented from optimizing those accesses
into concurrency bugs.
It is also possible to tell KCSAN about your synchronization design.
For example, ASSERT_EXCLUSIVE_ACCESS(foo) tells KCSAN that any
concurrent access to variable foo by any other CPU is an error, even
if that concurrent access is marked with READ_ONCE(). In addition,
ASSERT_EXCLUSIVE_WRITER(foo) tells KCSAN that although it is OK for there
to be concurrent reads from foo from other CPUs, it is an error for some
other CPU to be concurrently writing to foo, even if that concurrent
write is marked with data_race() or WRITE_ONCE().
Note that although KCSAN will call out data races involving either
ASSERT_EXCLUSIVE_ACCESS() or ASSERT_EXCLUSIVE_WRITER() on the one hand
and data_race() writes on the other, KCSAN will not report the location
of these data_race() writes.
EXAMPLES
========
As noted earlier, the goal is to prevent the compiler from destroying
your concurrent algorithm, to help the human reader, and to inform
KCSAN of aspects of your concurrency design. This section looks at a
few examples showing how this can be done.
Lock Protection With Lockless Diagnostic Access
-----------------------------------------------
For example, suppose a shared variable "foo" is read only while a
reader-writer spinlock is read-held, written only while that same
spinlock is write-held, except that it is also read locklessly for
diagnostic purposes. The code might look as follows:
int foo;
DEFINE_RWLOCK(foo_rwlock);
void update_foo(int newval)
{
write_lock(&foo_rwlock);
foo = newval;
do_something(newval);
write_unlock(&foo_rwlock);
}
int read_foo(void)
{
int ret;
read_lock(&foo_rwlock);
do_something_else();
ret = foo;
read_unlock(&foo_rwlock);
return ret;
}
void read_foo_diagnostic(void)
{
pr_info("Current value of foo: %d\n", data_race(foo));
}
The reader-writer lock prevents the compiler from introducing concurrency
bugs into any part of the main algorithm using foo, which means that
the accesses to foo within both update_foo() and read_foo() can (and
should) be plain C-language accesses. One benefit of making them be
plain C-language accesses is that KCSAN can detect any erroneous lockless
reads from or updates to foo. The data_race() in read_foo_diagnostic()
tells KCSAN that data races are expected, and should be silently
ignored. This data_race() also tells the human reading the code that
read_foo_diagnostic() might sometimes return a bogus value.
If it is necessary to suppress compiler optimization and also detect
buggy lockless writes, read_foo_diagnostic() can be updated as follows:
void read_foo_diagnostic(void)
{
pr_info("Current value of foo: %d\n", data_race(READ_ONCE(foo)));
}
Alternatively, given that KCSAN is to ignore all accesses in this function,
this function can be marked __no_kcsan and the data_race() can be dropped:
void __no_kcsan read_foo_diagnostic(void)
{
pr_info("Current value of foo: %d\n", READ_ONCE(foo));
}
However, in order for KCSAN to detect buggy lockless writes, your kernel
must be built with CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=n. If you
need KCSAN to detect such a write even if that write did not change
the value of foo, you also need CONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY=n.
If you need KCSAN to detect such a write happening in an interrupt handler
running on the same CPU doing the legitimate lock-protected write, you
also need CONFIG_KCSAN_INTERRUPT_WATCHER=y. With some or all of these
Kconfig options set properly, KCSAN can be quite helpful, although
it is not necessarily a full replacement for hardware watchpoints.
On the other hand, neither are hardware watchpoints a full replacement
for KCSAN because it is not always easy to tell hardware watchpoint to
conditionally trap on accesses.
Lock-Protected Writes With Lockless Reads
-----------------------------------------
For another example, suppose a shared variable "foo" is updated only
while holding a spinlock, but is read locklessly. The code might look
as follows:
int foo;
DEFINE_SPINLOCK(foo_lock);
void update_foo(int newval)
{
spin_lock(&foo_lock);
WRITE_ONCE(foo, newval);
ASSERT_EXCLUSIVE_WRITER(foo);
do_something(newval);
spin_unlock(&foo_wlock);
}
int read_foo(void)
{
do_something_else();
return READ_ONCE(foo);
}
Because foo is read locklessly, all accesses are marked. The purpose
of the ASSERT_EXCLUSIVE_WRITER() is to allow KCSAN to check for a buggy
concurrent write, whether marked or not.
Lock-Protected Writes With Heuristic Lockless Reads
---------------------------------------------------
For another example, suppose that the code can normally make use of
a per-data-structure lock, but there are times when a global lock
is required. These times are indicated via a global flag. The code
might look as follows, and is based loosely on nf_conntrack_lock(),
nf_conntrack_all_lock(), and nf_conntrack_all_unlock():
bool global_flag;
DEFINE_SPINLOCK(global_lock);
struct foo {
spinlock_t f_lock;
int f_data;
};
/* All foo structures are in the following array. */
int nfoo;
struct foo *foo_array;
void do_something_locked(struct foo *fp)
{
/* This works even if data_race() returns nonsense. */
if (!data_race(global_flag)) {
spin_lock(&fp->f_lock);
if (!smp_load_acquire(&global_flag)) {
do_something(fp);
spin_unlock(&fp->f_lock);
return;
}
spin_unlock(&fp->f_lock);
}
spin_lock(&global_lock);
/* global_lock held, thus global flag cannot be set. */
spin_lock(&fp->f_lock);
spin_unlock(&global_lock);
/*
* global_flag might be set here, but begin_global()
* will wait for ->f_lock to be released.
*/
do_something(fp);
spin_unlock(&fp->f_lock);
}
void begin_global(void)
{
int i;
spin_lock(&global_lock);
WRITE_ONCE(global_flag, true);
for (i = 0; i < nfoo; i++) {
/*
* Wait for pre-existing local locks. One at
* a time to avoid lockdep limitations.
*/
spin_lock(&fp->f_lock);
spin_unlock(&fp->f_lock);
}
}
void end_global(void)
{
smp_store_release(&global_flag, false);
spin_unlock(&global_lock);
}
All code paths leading from the do_something_locked() function's first
read from global_flag acquire a lock, so endless load fusing cannot
happen.
If the value read from global_flag is true, then global_flag is
rechecked while holding ->f_lock, which, if global_flag is now false,
prevents begin_global() from completing. It is therefore safe to invoke
do_something().
Otherwise, if either value read from global_flag is true, then after
global_lock is acquired global_flag must be false. The acquisition of
->f_lock will prevent any call to begin_global() from returning, which
means that it is safe to release global_lock and invoke do_something().
For this to work, only those foo structures in foo_array[] may be passed
to do_something_locked(). The reason for this is that the synchronization
with begin_global() relies on momentarily holding the lock of each and
every foo structure.
The smp_load_acquire() and smp_store_release() are required because
changes to a foo structure between calls to begin_global() and
end_global() are carried out without holding that structure's ->f_lock.
The smp_load_acquire() and smp_store_release() ensure that the next
invocation of do_something() from do_something_locked() will see those
changes.
Lockless Reads and Writes
-------------------------
For another example, suppose a shared variable "foo" is both read and
updated locklessly. The code might look as follows:
int foo;
int update_foo(int newval)
{
int ret;
ret = xchg(&foo, newval);
do_something(newval);
return ret;
}
int read_foo(void)
{
do_something_else();
return READ_ONCE(foo);
}
Because foo is accessed locklessly, all accesses are marked. It does
not make sense to use ASSERT_EXCLUSIVE_WRITER() in this case because
there really can be concurrent lockless writers. KCSAN would
flag any concurrent plain C-language reads from foo, and given
CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=n, also any concurrent plain
C-language writes to foo.
Lockless Reads and Writes, But With Single-Threaded Initialization
------------------------------------------------------------------
For yet another example, suppose that foo is initialized in a
single-threaded manner, but that a number of kthreads are then created
that locklessly and concurrently access foo. Some snippets of this code
might look as follows:
int foo;
void initialize_foo(int initval, int nkthreads)
{
int i;
foo = initval;
ASSERT_EXCLUSIVE_ACCESS(foo);
for (i = 0; i < nkthreads; i++)
kthread_run(access_foo_concurrently, ...);
}
/* Called from access_foo_concurrently(). */
int update_foo(int newval)
{
int ret;
ret = xchg(&foo, newval);
do_something(newval);
return ret;
}
/* Also called from access_foo_concurrently(). */
int read_foo(void)
{
do_something_else();
return READ_ONCE(foo);
}
The initialize_foo() uses a plain C-language write to foo because there
are not supposed to be concurrent accesses during initialization. The
ASSERT_EXCLUSIVE_ACCESS() allows KCSAN to flag buggy concurrent unmarked
reads, and the ASSERT_EXCLUSIVE_ACCESS() call further allows KCSAN to
flag buggy concurrent writes, even if: (1) Those writes are marked or
(2) The kernel was built with CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=y.
Checking Stress-Test Race Coverage
----------------------------------
When designing stress tests it is important to ensure that race conditions
of interest really do occur. For example, consider the following code
fragment:
int foo;
int update_foo(int newval)
{
return xchg(&foo, newval);
}
int xor_shift_foo(int shift, int mask)
{
int old, new, newold;
newold = data_race(foo); /* Checked by cmpxchg(). */
do {
old = newold;
new = (old << shift) ^ mask;
newold = cmpxchg(&foo, old, new);
} while (newold != old);
return old;
}
int read_foo(void)
{
return READ_ONCE(foo);
}
If it is possible for update_foo(), xor_shift_foo(), and read_foo() to be
invoked concurrently, the stress test should force this concurrency to
actually happen. KCSAN can evaluate the stress test when the above code
is modified to read as follows:
int foo;
int update_foo(int newval)
{
ASSERT_EXCLUSIVE_ACCESS(foo);
return xchg(&foo, newval);
}
int xor_shift_foo(int shift, int mask)
{
int old, new, newold;
newold = data_race(foo); /* Checked by cmpxchg(). */
do {
old = newold;
new = (old << shift) ^ mask;
ASSERT_EXCLUSIVE_ACCESS(foo);
newold = cmpxchg(&foo, old, new);
} while (newold != old);
return old;
}
int read_foo(void)
{
ASSERT_EXCLUSIVE_ACCESS(foo);
return READ_ONCE(foo);
}
If a given stress-test run does not result in KCSAN complaints from
each possible pair of ASSERT_EXCLUSIVE_ACCESS() invocations, the
stress test needs improvement. If the stress test was to be evaluated
on a regular basis, it would be wise to place the above instances of
ASSERT_EXCLUSIVE_ACCESS() under #ifdef so that they did not result in
false positives when not evaluating the stress test.
REFERENCES
==========
[1] "Concurrency bugs should fear the big bad data-race detector (part 2)"
https://lwn.net/Articles/816854/
[2] "The Kernel Concurrency Sanitizer"
https://www.linuxfoundation.org/webinars/the-kernel-concurrency-sanitizer
[3] "Who's afraid of a big bad optimizing compiler?"
https://lwn.net/Articles/793253/
Cheatsheet
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/cheatsheet.txt.
Prior Operation Subsequent Operation
--------------- ---------------------------
C Self R W RMW Self R W DR DW RMW SV
-- ---- - - --- ---- - - -- -- --- --
Relaxed store Y Y
Relaxed load Y Y Y Y
Relaxed RMW operation Y Y Y Y
rcu_dereference() Y Y Y Y
Successful *_acquire() R Y Y Y Y Y Y
Successful *_release() C Y Y Y W Y
smp_rmb() Y R Y Y R
smp_wmb() Y W Y Y W
smp_mb() & synchronize_rcu() CP Y Y Y Y Y Y Y Y
Successful full non-void RMW CP Y Y Y Y Y Y Y Y Y Y Y
smp_mb__before_atomic() CP Y Y Y a a a a Y
smp_mb__after_atomic() CP a a Y Y Y Y Y Y
Key: Relaxed: A relaxed operation is either READ_ONCE(), WRITE_ONCE(),
a *_relaxed() RMW operation, an unsuccessful RMW
operation, a non-value-returning RMW operation such
as atomic_inc(), or one of the atomic*_read() and
atomic*_set() family of operations.
C: Ordering is cumulative
P: Ordering propagates
R: Read, for example, READ_ONCE(), or read portion of RMW
W: Write, for example, WRITE_ONCE(), or write portion of RMW
Y: Provides ordering
a: Provides ordering given intervening RMW atomic operation
DR: Dependent read (address dependency)
DW: Dependent write (address, data, or control dependency)
RMW: Atomic read-modify-write operation
SELF: Orders self, as opposed to accesses before and/or after
SV: Orders later accesses to the same variable
Control Dependencies
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/control-dependencies.txt.
CONTROL DEPENDENCIES
====================
A major difficulty with control dependencies is that current compilers
do not support them. One purpose of this document is therefore to
help you prevent your compiler from breaking your code. However,
control dependencies also pose other challenges, which leads to the
second purpose of this document, namely to help you to avoid breaking
your own code, even in the absence of help from your compiler.
One such challenge is that control dependencies order only later stores.
Therefore, a load-load control dependency will not preserve ordering
unless a read memory barrier is provided. Consider the following code:
q = READ_ONCE(a);
if (q)
p = READ_ONCE(b);
This is not guaranteed to provide any ordering because some types of CPUs
are permitted to predict the result of the load from "b". This prediction
can cause other CPUs to see this load as having happened before the load
from "a". This means that an explicit read barrier is required, for example
as follows:
q = READ_ONCE(a);
if (q) {
smp_rmb();
p = READ_ONCE(b);
}
However, stores are not speculated. This means that ordering is
(usually) guaranteed for load-store control dependencies, as in the
following example:
q = READ_ONCE(a);
if (q)
WRITE_ONCE(b, 1);
Control dependencies can pair with each other and with other types
of ordering. But please note that neither the READ_ONCE() nor the
WRITE_ONCE() are optional. Without the READ_ONCE(), the compiler might
fuse the load from "a" with other loads. Without the WRITE_ONCE(),
the compiler might fuse the store to "b" with other stores. Worse yet,
the compiler might convert the store into a load and a check followed
by a store, and this compiler-generated load would not be ordered by
the control dependency.
Furthermore, if the compiler is able to prove that the value of variable
"a" is always non-zero, it would be well within its rights to optimize
the original example by eliminating the "if" statement as follows:
q = a;
b = 1; /* BUG: Compiler and CPU can both reorder!!! */
So don't leave out either the READ_ONCE() or the WRITE_ONCE().
In particular, although READ_ONCE() does force the compiler to emit a
load, it does *not* force the compiler to actually use the loaded value.
It is tempting to try use control dependencies to enforce ordering on
identical stores on both branches of the "if" statement as follows:
q = READ_ONCE(a);
if (q) {
barrier();
WRITE_ONCE(b, 1);
do_something();
} else {
barrier();
WRITE_ONCE(b, 1);
do_something_else();
}
Unfortunately, current compilers will transform this as follows at high
optimization levels:
q = READ_ONCE(a);
barrier();
WRITE_ONCE(b, 1); /* BUG: No ordering vs. load from a!!! */
if (q) {
/* WRITE_ONCE(b, 1); -- moved up, BUG!!! */
do_something();
} else {
/* WRITE_ONCE(b, 1); -- moved up, BUG!!! */
do_something_else();
}
Now there is no conditional between the load from "a" and the store to
"b", which means that the CPU is within its rights to reorder them: The
conditional is absolutely required, and must be present in the final
assembly code, after all of the compiler and link-time optimizations
have been applied. Therefore, if you need ordering in this example,
you must use explicit memory ordering, for example, smp_store_release():
q = READ_ONCE(a);
if (q) {
smp_store_release(&b, 1);
do_something();
} else {
smp_store_release(&b, 1);
do_something_else();
}
Without explicit memory ordering, control-dependency-based ordering is
guaranteed only when the stores differ, for example:
q = READ_ONCE(a);
if (q) {
WRITE_ONCE(b, 1);
do_something();
} else {
WRITE_ONCE(b, 2);
do_something_else();
}
The initial READ_ONCE() is still required to prevent the compiler from
knowing too much about the value of "a".
But please note that you need to be careful what you do with the local
variable "q", otherwise the compiler might be able to guess the value
and again remove the conditional branch that is absolutely required to
preserve ordering. For example:
q = READ_ONCE(a);
if (q % MAX) {
WRITE_ONCE(b, 1);
do_something();
} else {
WRITE_ONCE(b, 2);
do_something_else();
}
If MAX is compile-time defined to be 1, then the compiler knows that
(q % MAX) must be equal to zero, regardless of the value of "q".
The compiler is therefore within its rights to transform the above code
into the following:
q = READ_ONCE(a);
WRITE_ONCE(b, 2);
do_something_else();
Given this transformation, the CPU is not required to respect the ordering
between the load from variable "a" and the store to variable "b". It is
tempting to add a barrier(), but this does not help. The conditional
is gone, and the barrier won't bring it back. Therefore, if you need
to relying on control dependencies to produce this ordering, you should
make sure that MAX is greater than one, perhaps as follows:
q = READ_ONCE(a);
BUILD_BUG_ON(MAX <= 1); /* Order load from a with store to b. */
if (q % MAX) {
WRITE_ONCE(b, 1);
do_something();
} else {
WRITE_ONCE(b, 2);
do_something_else();
}
Please note once again that each leg of the "if" statement absolutely
must store different values to "b". As in previous examples, if the two
values were identical, the compiler could pull this store outside of the
"if" statement, destroying the control dependency's ordering properties.
You must also be careful avoid relying too much on boolean short-circuit
evaluation. Consider this example:
q = READ_ONCE(a);
if (q || 1 > 0)
WRITE_ONCE(b, 1);
Because the first condition cannot fault and the second condition is
always true, the compiler can transform this example as follows, again
destroying the control dependency's ordering:
q = READ_ONCE(a);
WRITE_ONCE(b, 1);
This is yet another example showing the importance of preventing the
compiler from out-guessing your code. Again, although READ_ONCE() really
does force the compiler to emit code for a given load, the compiler is
within its rights to discard the loaded value.
In addition, control dependencies apply only to the then-clause and
else-clause of the "if" statement in question. In particular, they do
not necessarily order the code following the entire "if" statement:
q = READ_ONCE(a);
if (q) {
WRITE_ONCE(b, 1);
} else {
WRITE_ONCE(b, 2);
}
WRITE_ONCE(c, 1); /* BUG: No ordering against the read from "a". */
It is tempting to argue that there in fact is ordering because the
compiler cannot reorder volatile accesses and also cannot reorder
the writes to "b" with the condition. Unfortunately for this line
of reasoning, the compiler might compile the two writes to "b" as
conditional-move instructions, as in this fanciful pseudo-assembly
language:
ld r1,a
cmp r1,$0
cmov,ne r4,$1
cmov,eq r4,$2
st r4,b
st $1,c
The control dependencies would then extend only to the pair of cmov
instructions and the store depending on them. This means that a weakly
ordered CPU would have no dependency of any sort between the load from
"a" and the store to "c". In short, control dependencies provide ordering
only to the stores in the then-clause and else-clause of the "if" statement
in question (including functions invoked by those two clauses), and not
to code following that "if" statement.
In summary:
(*) Control dependencies can order prior loads against later stores.
However, they do *not* guarantee any other sort of ordering:
Not prior loads against later loads, nor prior stores against
later anything. If you need these other forms of ordering, use
smp_load_acquire(), smp_store_release(), or, in the case of prior
stores and later loads, smp_mb().
(*) If both legs of the "if" statement contain identical stores to
the same variable, then you must explicitly order those stores,
either by preceding both of them with smp_mb() or by using
smp_store_release(). Please note that it is *not* sufficient to use
barrier() at beginning and end of each leg of the "if" statement
because, as shown by the example above, optimizing compilers can
destroy the control dependency while respecting the letter of the
barrier() law.
(*) Control dependencies require at least one run-time conditional
between the prior load and the subsequent store, and this
conditional must involve the prior load. If the compiler is able
to optimize the conditional away, it will have also optimized
away the ordering. Careful use of READ_ONCE() and WRITE_ONCE()
can help to preserve the needed conditional.
(*) Control dependencies require that the compiler avoid reordering the
dependency into nonexistence. Careful use of READ_ONCE() or
atomic{,64}_read() can help to preserve your control dependency.
(*) Control dependencies apply only to the then-clause and else-clause
of the "if" statement containing the control dependency, including
any functions that these two clauses call. Control dependencies
do *not* apply to code beyond the end of that "if" statement.
(*) Control dependencies pair normally with other types of barriers.
(*) Control dependencies do *not* provide multicopy atomicity. If you
need all the CPUs to agree on the ordering of a given store against
all other accesses, use smp_mb().
(*) Compilers do not understand control dependencies. It is therefore
your job to ensure that they do not break your code.
Explanation
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/explanation.txt.
Explanation of the Linux-Kernel Memory Consistency Model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Author: Alan Stern <stern@rowland.harvard.edu>
:Created: October 2017
.. Contents
1. INTRODUCTION
2. BACKGROUND
3. A SIMPLE EXAMPLE
4. A SELECTION OF MEMORY MODELS
5. ORDERING AND CYCLES
6. EVENTS
7. THE PROGRAM ORDER RELATION: po AND po-loc
8. A WARNING
9. DEPENDENCY RELATIONS: data, addr, and ctrl
10. THE READS-FROM RELATION: rf, rfi, and rfe
11. CACHE COHERENCE AND THE COHERENCE ORDER RELATION: co, coi, and coe
12. THE FROM-READS RELATION: fr, fri, and fre
13. AN OPERATIONAL MODEL
14. PROPAGATION ORDER RELATION: cumul-fence
15. DERIVATION OF THE LKMM FROM THE OPERATIONAL MODEL
16. SEQUENTIAL CONSISTENCY PER VARIABLE
17. ATOMIC UPDATES: rmw
18. THE PRESERVED PROGRAM ORDER RELATION: ppo
19. AND THEN THERE WAS ALPHA
20. THE HAPPENS-BEFORE RELATION: hb
21. THE PROPAGATES-BEFORE RELATION: pb
22. RCU RELATIONS: rcu-link, rcu-gp, rcu-rscsi, rcu-order, rcu-fence, and rb
23. SRCU READ-SIDE CRITICAL SECTIONS
24. LOCKING
25. PLAIN ACCESSES AND DATA RACES
26. ODDS AND ENDS
INTRODUCTION
------------
The Linux-kernel memory consistency model (LKMM) is rather complex and
obscure. This is particularly evident if you read through the
linux-kernel.bell and linux-kernel.cat files that make up the formal
version of the model; they are extremely terse and their meanings are
far from clear.
This document describes the ideas underlying the LKMM. It is meant
for people who want to understand how the model was designed. It does
not go into the details of the code in the .bell and .cat files;
rather, it explains in English what the code expresses symbolically.
Sections 2 (BACKGROUND) through 5 (ORDERING AND CYCLES) are aimed
toward beginners; they explain what memory consistency models are and
the basic notions shared by all such models. People already familiar
with these concepts can skim or skip over them. Sections 6 (EVENTS)
through 12 (THE FROM_READS RELATION) describe the fundamental
relations used in many models. Starting in Section 13 (AN OPERATIONAL
MODEL), the workings of the LKMM itself are covered.
Warning: The code examples in this document are not written in the
proper format for litmus tests. They don't include a header line, the
initializations are not enclosed in braces, the global variables are
not passed by pointers, and they don't have an "exists" clause at the
end. Converting them to the right format is left as an exercise for
the reader.
BACKGROUND
----------
A memory consistency model (or just memory model, for short) is
something which predicts, given a piece of computer code running on a
particular kind of system, what values may be obtained by the code's
load instructions. The LKMM makes these predictions for code running
as part of the Linux kernel.
In practice, people tend to use memory models the other way around.
That is, given a piece of code and a collection of values specified
for the loads, the model will predict whether it is possible for the
code to run in such a way that the loads will indeed obtain the
specified values. Of course, this is just another way of expressing
the same idea.
For code running on a uniprocessor system, the predictions are easy:
Each load instruction must obtain the value written by the most recent
store instruction accessing the same location (we ignore complicating
factors such as DMA and mixed-size accesses.) But on multiprocessor
systems, with multiple CPUs making concurrent accesses to shared
memory locations, things aren't so simple.
Different architectures have differing memory models, and the Linux
kernel supports a variety of architectures. The LKMM has to be fairly
permissive, in the sense that any behavior allowed by one of these
architectures also has to be allowed by the LKMM.
A SIMPLE EXAMPLE
----------------
Here is a simple example to illustrate the basic concepts. Consider
some code running as part of a device driver for an input device. The
driver might contain an interrupt handler which collects data from the
device, stores it in a buffer, and sets a flag to indicate the buffer
is full. Running concurrently on a different CPU might be a part of
the driver code being executed by a process in the midst of a read(2)
system call. This code tests the flag to see whether the buffer is
ready, and if it is, copies the data back to userspace. The buffer
and the flag are memory locations shared between the two CPUs.
We can abstract out the important pieces of the driver code as follows
(the reason for using WRITE_ONCE() and READ_ONCE() instead of simple
assignment statements is discussed later):
int buf = 0, flag = 0;
P0()
{
WRITE_ONCE(buf, 1);
WRITE_ONCE(flag, 1);
}
P1()
{
int r1;
int r2 = 0;
r1 = READ_ONCE(flag);
if (r1)
r2 = READ_ONCE(buf);
}
Here the P0() function represents the interrupt handler running on one
CPU and P1() represents the read() routine running on another. The
value 1 stored in buf represents input data collected from the device.
Thus, P0 stores the data in buf and then sets flag. Meanwhile, P1
reads flag into the private variable r1, and if it is set, reads the
data from buf into a second private variable r2 for copying to
userspace. (Presumably if flag is not set then the driver will wait a
while and try again.)
This pattern of memory accesses, where one CPU stores values to two
shared memory locations and another CPU loads from those locations in
the opposite order, is widely known as the "Message Passing" or MP
pattern. It is typical of memory access patterns in the kernel.
Please note that this example code is a simplified abstraction. Real
buffers are usually larger than a single integer, real device drivers
usually use sleep and wakeup mechanisms rather than polling for I/O
completion, and real code generally doesn't bother to copy values into
private variables before using them. All that is beside the point;
the idea here is simply to illustrate the overall pattern of memory
accesses by the CPUs.
A memory model will predict what values P1 might obtain for its loads
from flag and buf, or equivalently, what values r1 and r2 might end up
with after the code has finished running.
Some predictions are trivial. For instance, no sane memory model would
predict that r1 = 42 or r2 = -7, because neither of those values ever
gets stored in flag or buf.
Some nontrivial predictions are nonetheless quite simple. For
instance, P1 might run entirely before P0 begins, in which case r1 and
r2 will both be 0 at the end. Or P0 might run entirely before P1
begins, in which case r1 and r2 will both be 1.
The interesting predictions concern what might happen when the two
routines run concurrently. One possibility is that P1 runs after P0's
store to buf but before the store to flag. In this case, r1 and r2
will again both be 0. (If P1 had been designed to read buf
unconditionally then we would instead have r1 = 0 and r2 = 1.)
However, the most interesting possibility is where r1 = 1 and r2 = 0.
If this were to occur it would mean the driver contains a bug, because
incorrect data would get sent to the user: 0 instead of 1. As it
happens, the LKMM does predict this outcome can occur, and the example
driver code shown above is indeed buggy.
A SELECTION OF MEMORY MODELS
----------------------------
The first widely cited memory model, and the simplest to understand,
is Sequential Consistency. According to this model, systems behave as
if each CPU executed its instructions in order but with unspecified
timing. In other words, the instructions from the various CPUs get
interleaved in a nondeterministic way, always according to some single
global order that agrees with the order of the instructions in the
program source for each CPU. The model says that the value obtained
by each load is simply the value written by the most recently executed
store to the same memory location, from any CPU.
For the MP example code shown above, Sequential Consistency predicts
that the undesired result r1 = 1, r2 = 0 cannot occur. The reasoning
goes like this:
Since r1 = 1, P0 must store 1 to flag before P1 loads 1 from
it, as loads can obtain values only from earlier stores.
P1 loads from flag before loading from buf, since CPUs execute
their instructions in order.
P1 must load 0 from buf before P0 stores 1 to it; otherwise r2
would be 1 since a load obtains its value from the most recent
store to the same address.
P0 stores 1 to buf before storing 1 to flag, since it executes
its instructions in order.
Since an instruction (in this case, P0's store to flag) cannot
execute before itself, the specified outcome is impossible.
However, real computer hardware almost never follows the Sequential
Consistency memory model; doing so would rule out too many valuable
performance optimizations. On ARM and PowerPC architectures, for
instance, the MP example code really does sometimes yield r1 = 1 and
r2 = 0.
x86 and SPARC follow yet a different memory model: TSO (Total Store
Ordering). This model predicts that the undesired outcome for the MP
pattern cannot occur, but in other respects it differs from Sequential
Consistency. One example is the Store Buffer (SB) pattern, in which
each CPU stores to its own shared location and then loads from the
other CPU's location:
int x = 0, y = 0;
P0()
{
int r0;
WRITE_ONCE(x, 1);
r0 = READ_ONCE(y);
}
P1()
{
int r1;
WRITE_ONCE(y, 1);
r1 = READ_ONCE(x);
}
Sequential Consistency predicts that the outcome r0 = 0, r1 = 0 is
impossible. (Exercise: Figure out the reasoning.) But TSO allows
this outcome to occur, and in fact it does sometimes occur on x86 and
SPARC systems.
The LKMM was inspired by the memory models followed by PowerPC, ARM,
x86, Alpha, and other architectures. However, it is different in
detail from each of them.
ORDERING AND CYCLES
-------------------
Memory models are all about ordering. Often this is temporal ordering
(i.e., the order in which certain events occur) but it doesn't have to
be; consider for example the order of instructions in a program's
source code. We saw above that Sequential Consistency makes an
important assumption that CPUs execute instructions in the same order
as those instructions occur in the code, and there are many other
instances of ordering playing central roles in memory models.
The counterpart to ordering is a cycle. Ordering rules out cycles:
It's not possible to have X ordered before Y, Y ordered before Z, and
Z ordered before X, because this would mean that X is ordered before
itself. The analysis of the MP example under Sequential Consistency
involved just such an impossible cycle:
W: P0 stores 1 to flag executes before
X: P1 loads 1 from flag executes before
Y: P1 loads 0 from buf executes before
Z: P0 stores 1 to buf executes before
W: P0 stores 1 to flag.
In short, if a memory model requires certain accesses to be ordered,
and a certain outcome for the loads in a piece of code can happen only
if those accesses would form a cycle, then the memory model predicts
that outcome cannot occur.
The LKMM is defined largely in terms of cycles, as we will see.
EVENTS
------
The LKMM does not work directly with the C statements that make up
kernel source code. Instead it considers the effects of those
statements in a more abstract form, namely, events. The model
includes three types of events:
Read events correspond to loads from shared memory, such as
calls to READ_ONCE(), smp_load_acquire(), or
rcu_dereference().
Write events correspond to stores to shared memory, such as
calls to WRITE_ONCE(), smp_store_release(), or atomic_set().
Fence events correspond to memory barriers (also known as
fences), such as calls to smp_rmb() or rcu_read_lock().
These categories are not exclusive; a read or write event can also be
a fence. This happens with functions like smp_load_acquire() or
spin_lock(). However, no single event can be both a read and a write.
Atomic read-modify-write accesses, such as atomic_inc() or xchg(),
correspond to a pair of events: a read followed by a write. (The
write event is omitted for executions where it doesn't occur, such as
a cmpxchg() where the comparison fails.)
Other parts of the code, those which do not involve interaction with
shared memory, do not give rise to events. Thus, arithmetic and
logical computations, control-flow instructions, or accesses to
private memory or CPU registers are not of central interest to the
memory model. They only affect the model's predictions indirectly.
For example, an arithmetic computation might determine the value that
gets stored to a shared memory location (or in the case of an array
index, the address where the value gets stored), but the memory model
is concerned only with the store itself -- its value and its address
-- not the computation leading up to it.
Events in the LKMM can be linked by various relations, which we will
describe in the following sections. The memory model requires certain
of these relations to be orderings, that is, it requires them not to
have any cycles.
THE PROGRAM ORDER RELATION: po AND po-loc
-----------------------------------------
The most important relation between events is program order (po). You
can think of it as the order in which statements occur in the source
code after branches are taken into account and loops have been
unrolled. A better description might be the order in which
instructions are presented to a CPU's execution unit. Thus, we say
that X is po-before Y (written as "X ->po Y" in formulas) if X occurs
before Y in the instruction stream.
This is inherently a single-CPU relation; two instructions executing
on different CPUs are never linked by po. Also, it is by definition
an ordering so it cannot have any cycles.
po-loc is a sub-relation of po. It links two memory accesses when the
first comes before the second in program order and they access the
same memory location (the "-loc" suffix).
Although this may seem straightforward, there is one subtle aspect to
program order we need to explain. The LKMM was inspired by low-level
architectural memory models which describe the behavior of machine
code, and it retains their outlook to a considerable extent. The
read, write, and fence events used by the model are close in spirit to
individual machine instructions. Nevertheless, the LKMM describes
kernel code written in C, and the mapping from C to machine code can
be extremely complex.
Optimizing compilers have great freedom in the way they translate
source code to object code. They are allowed to apply transformations
that add memory accesses, eliminate accesses, combine them, split them
into pieces, or move them around. The use of READ_ONCE(), WRITE_ONCE(),
or one of the other atomic or synchronization primitives prevents a
large number of compiler optimizations. In particular, it is guaranteed
that the compiler will not remove such accesses from the generated code
(unless it can prove the accesses will never be executed), it will not
change the order in which they occur in the code (within limits imposed
by the C standard), and it will not introduce extraneous accesses.
The MP and SB examples above used READ_ONCE() and WRITE_ONCE() rather
than ordinary memory accesses. Thanks to this usage, we can be certain
that in the MP example, the compiler won't reorder P0's write event to
buf and P0's write event to flag, and similarly for the other shared
memory accesses in the examples.
Since private variables are not shared between CPUs, they can be
accessed normally without READ_ONCE() or WRITE_ONCE(). In fact, they
need not even be stored in normal memory at all -- in principle a
private variable could be stored in a CPU register (hence the convention
that these variables have names starting with the letter 'r').
A WARNING
---------
The protections provided by READ_ONCE(), WRITE_ONCE(), and others are
not perfect; and under some circumstances it is possible for the
compiler to undermine the memory model. Here is an example. Suppose
both branches of an "if" statement store the same value to the same
location:
r1 = READ_ONCE(x);
if (r1) {
WRITE_ONCE(y, 2);
... /* do something */
} else {
WRITE_ONCE(y, 2);
... /* do something else */
}
For this code, the LKMM predicts that the load from x will always be
executed before either of the stores to y. However, a compiler could
lift the stores out of the conditional, transforming the code into
something resembling:
r1 = READ_ONCE(x);
WRITE_ONCE(y, 2);
if (r1) {
... /* do something */
} else {
... /* do something else */
}
Given this version of the code, the LKMM would predict that the load
from x could be executed after the store to y. Thus, the memory
model's original prediction could be invalidated by the compiler.
Another issue arises from the fact that in C, arguments to many
operators and function calls can be evaluated in any order. For
example:
r1 = f(5) + g(6);
The object code might call f(5) either before or after g(6); the
memory model cannot assume there is a fixed program order relation
between them. (In fact, if the function calls are inlined then the
compiler might even interleave their object code.)
DEPENDENCY RELATIONS: data, addr, and ctrl
------------------------------------------
We say that two events are linked by a dependency relation when the
execution of the second event depends in some way on a value obtained
from memory by the first. The first event must be a read, and the
value it obtains must somehow affect what the second event does.
There are three kinds of dependencies: data, address (addr), and
control (ctrl).
A read and a write event are linked by a data dependency if the value
obtained by the read affects the value stored by the write. As a very
simple example:
int x, y;
r1 = READ_ONCE(x);
WRITE_ONCE(y, r1 + 5);
The value stored by the WRITE_ONCE obviously depends on the value
loaded by the READ_ONCE. Such dependencies can wind through
arbitrarily complicated computations, and a write can depend on the
values of multiple reads.
A read event and another memory access event are linked by an address
dependency if the value obtained by the read affects the location
accessed by the other event. The second event can be either a read or
a write. Here's another simple example:
int a[20];
int i;
r1 = READ_ONCE(i);
r2 = READ_ONCE(a[r1]);
Here the location accessed by the second READ_ONCE() depends on the
index value loaded by the first. Pointer indirection also gives rise
to address dependencies, since the address of a location accessed
through a pointer will depend on the value read earlier from that
pointer.
Finally, a read event X and a write event Y are linked by a control
dependency if Y syntactically lies within an arm of an if statement and
X affects the evaluation of the if condition via a data or address
dependency (or similarly for a switch statement). Simple example:
int x, y;
r1 = READ_ONCE(x);
if (r1)
WRITE_ONCE(y, 1984);
Execution of the WRITE_ONCE() is controlled by a conditional expression
which depends on the value obtained by the READ_ONCE(); hence there is
a control dependency from the load to the store.
It should be pretty obvious that events can only depend on reads that
come earlier in program order. Symbolically, if we have R ->data X,
R ->addr X, or R ->ctrl X (where R is a read event), then we must also
have R ->po X. It wouldn't make sense for a computation to depend
somehow on a value that doesn't get loaded from shared memory until
later in the code!
Here's a trick question: When is a dependency not a dependency? Answer:
When it is purely syntactic rather than semantic. We say a dependency
between two accesses is purely syntactic if the second access doesn't
actually depend on the result of the first. Here is a trivial example:
r1 = READ_ONCE(x);
WRITE_ONCE(y, r1 * 0);
There appears to be a data dependency from the load of x to the store
of y, since the value to be stored is computed from the value that was
loaded. But in fact, the value stored does not really depend on
anything since it will always be 0. Thus the data dependency is only
syntactic (it appears to exist in the code) but not semantic (the
second access will always be the same, regardless of the value of the
first access). Given code like this, a compiler could simply discard
the value returned by the load from x, which would certainly destroy
any dependency. (The compiler is not permitted to eliminate entirely
the load generated for a READ_ONCE() -- that's one of the nice
properties of READ_ONCE() -- but it is allowed to ignore the load's
value.)
It's natural to object that no one in their right mind would write
code like the above. However, macro expansions can easily give rise
to this sort of thing, in ways that often are not apparent to the
programmer.
Another mechanism that can lead to purely syntactic dependencies is
related to the notion of "undefined behavior". Certain program
behaviors are called "undefined" in the C language specification,
which means that when they occur there are no guarantees at all about
the outcome. Consider the following example:
int a[1];
int i;
r1 = READ_ONCE(i);
r2 = READ_ONCE(a[r1]);
Access beyond the end or before the beginning of an array is one kind
of undefined behavior. Therefore the compiler doesn't have to worry
about what will happen if r1 is nonzero, and it can assume that r1
will always be zero regardless of the value actually loaded from i.
(If the assumption turns out to be wrong the resulting behavior will
be undefined anyway, so the compiler doesn't care!) Thus the value
from the load can be discarded, breaking the address dependency.
The LKMM is unaware that purely syntactic dependencies are different
from semantic dependencies and therefore mistakenly predicts that the
accesses in the two examples above will be ordered. This is another
example of how the compiler can undermine the memory model. Be warned.
THE READS-FROM RELATION: rf, rfi, and rfe
-----------------------------------------
The reads-from relation (rf) links a write event to a read event when
the value loaded by the read is the value that was stored by the
write. In colloquial terms, the load "reads from" the store. We
write W ->rf R to indicate that the load R reads from the store W. We
further distinguish the cases where the load and the store occur on
the same CPU (internal reads-from, or rfi) and where they occur on
different CPUs (external reads-from, or rfe).
For our purposes, a memory location's initial value is treated as
though it had been written there by an imaginary initial store that
executes on a separate CPU before the main program runs.
Usage of the rf relation implicitly assumes that loads will always
read from a single store. It doesn't apply properly in the presence
of load-tearing, where a load obtains some of its bits from one store
and some of them from another store. Fortunately, use of READ_ONCE()
and WRITE_ONCE() will prevent load-tearing; it's not possible to have:
int x = 0;
P0()
{
WRITE_ONCE(x, 0x1234);
}
P1()
{
int r1;
r1 = READ_ONCE(x);
}
and end up with r1 = 0x1200 (partly from x's initial value and partly
from the value stored by P0).
On the other hand, load-tearing is unavoidable when mixed-size
accesses are used. Consider this example:
union {
u32 w;
u16 h[2];
} x;
P0()
{
WRITE_ONCE(x.h[0], 0x1234);
WRITE_ONCE(x.h[1], 0x5678);
}
P1()
{
int r1;
r1 = READ_ONCE(x.w);
}
If r1 = 0x56781234 (little-endian!) at the end, then P1 must have read
from both of P0's stores. It is possible to handle mixed-size and
unaligned accesses in a memory model, but the LKMM currently does not
attempt to do so. It requires all accesses to be properly aligned and
of the location's actual size.
CACHE COHERENCE AND THE COHERENCE ORDER RELATION: co, coi, and coe
------------------------------------------------------------------
Cache coherence is a general principle requiring that in a
multi-processor system, the CPUs must share a consistent view of the
memory contents. Specifically, it requires that for each location in
shared memory, the stores to that location must form a single global
ordering which all the CPUs agree on (the coherence order), and this
ordering must be consistent with the program order for accesses to
that location.
To put it another way, for any variable x, the coherence order (co) of
the stores to x is simply the order in which the stores overwrite one
another. The imaginary store which establishes x's initial value
comes first in the coherence order; the store which directly
overwrites the initial value comes second; the store which overwrites
that value comes third, and so on.
You can think of the coherence order as being the order in which the
stores reach x's location in memory (or if you prefer a more
hardware-centric view, the order in which the stores get written to
x's cache line). We write W ->co W' if W comes before W' in the
coherence order, that is, if the value stored by W gets overwritten,
directly or indirectly, by the value stored by W'.
Coherence order is required to be consistent with program order. This
requirement takes the form of four coherency rules:
Write-write coherence: If W ->po-loc W' (i.e., W comes before
W' in program order and they access the same location), where W
and W' are two stores, then W ->co W'.
Write-read coherence: If W ->po-loc R, where W is a store and R
is a load, then R must read from W or from some other store
which comes after W in the coherence order.
Read-write coherence: If R ->po-loc W, where R is a load and W
is a store, then the store which R reads from must come before
W in the coherence order.
Read-read coherence: If R ->po-loc R', where R and R' are two
loads, then either they read from the same store or else the
store read by R comes before the store read by R' in the
coherence order.
This is sometimes referred to as sequential consistency per variable,
because it means that the accesses to any single memory location obey
the rules of the Sequential Consistency memory model. (According to
Wikipedia, sequential consistency per variable and cache coherence
mean the same thing except that cache coherence includes an extra
requirement that every store eventually becomes visible to every CPU.)
Any reasonable memory model will include cache coherence. Indeed, our
expectation of cache coherence is so deeply ingrained that violations
of its requirements look more like hardware bugs than programming
errors:
int x;
P0()
{
WRITE_ONCE(x, 17);
WRITE_ONCE(x, 23);
}
If the final value stored in x after this code ran was 17, you would
think your computer was broken. It would be a violation of the
write-write coherence rule: Since the store of 23 comes later in
program order, it must also come later in x's coherence order and
thus must overwrite the store of 17.
int x = 0;
P0()
{
int r1;
r1 = READ_ONCE(x);
WRITE_ONCE(x, 666);
}
If r1 = 666 at the end, this would violate the read-write coherence
rule: The READ_ONCE() load comes before the WRITE_ONCE() store in
program order, so it must not read from that store but rather from one
coming earlier in the coherence order (in this case, x's initial
value).
int x = 0;
P0()
{
WRITE_ONCE(x, 5);
}
P1()
{
int r1, r2;
r1 = READ_ONCE(x);
r2 = READ_ONCE(x);
}
If r1 = 5 (reading from P0's store) and r2 = 0 (reading from the
imaginary store which establishes x's initial value) at the end, this
would violate the read-read coherence rule: The r1 load comes before
the r2 load in program order, so it must not read from a store that
comes later in the coherence order.
(As a minor curiosity, if this code had used normal loads instead of
READ_ONCE() in P1, on Itanium it sometimes could end up with r1 = 5
and r2 = 0! This results from parallel execution of the operations
encoded in Itanium's Very-Long-Instruction-Word format, and it is yet
another motivation for using READ_ONCE() when accessing shared memory
locations.)
Just like the po relation, co is inherently an ordering -- it is not
possible for a store to directly or indirectly overwrite itself! And
just like with the rf relation, we distinguish between stores that
occur on the same CPU (internal coherence order, or coi) and stores
that occur on different CPUs (external coherence order, or coe).
On the other hand, stores to different memory locations are never
related by co, just as instructions on different CPUs are never
related by po. Coherence order is strictly per-location, or if you
prefer, each location has its own independent coherence order.
THE FROM-READS RELATION: fr, fri, and fre
-----------------------------------------
The from-reads relation (fr) can be a little difficult for people to
grok. It describes the situation where a load reads a value that gets
overwritten by a store. In other words, we have R ->fr W when the
value that R reads is overwritten (directly or indirectly) by W, or
equivalently, when R reads from a store which comes earlier than W in
the coherence order.
For example:
int x = 0;
P0()
{
int r1;
r1 = READ_ONCE(x);
WRITE_ONCE(x, 2);
}
The value loaded from x will be 0 (assuming cache coherence!), and it
gets overwritten by the value 2. Thus there is an fr link from the
READ_ONCE() to the WRITE_ONCE(). If the code contained any later
stores to x, there would also be fr links from the READ_ONCE() to
them.
As with rf, rfi, and rfe, we subdivide the fr relation into fri (when
the load and the store are on the same CPU) and fre (when they are on
different CPUs).
Note that the fr relation is determined entirely by the rf and co
relations; it is not independent. Given a read event R and a write
event W for the same location, we will have R ->fr W if and only if
the write which R reads from is co-before W. In symbols,
(R ->fr W) := (there exists W' with W' ->rf R and W' ->co W).
AN OPERATIONAL MODEL
--------------------
The LKMM is based on various operational memory models, meaning that
the models arise from an abstract view of how a computer system
operates. Here are the main ideas, as incorporated into the LKMM.
The system as a whole is divided into the CPUs and a memory subsystem.
The CPUs are responsible for executing instructions (not necessarily
in program order), and they communicate with the memory subsystem.
For the most part, executing an instruction requires a CPU to perform
only internal operations. However, loads, stores, and fences involve
more.
When CPU C executes a store instruction, it tells the memory subsystem
to store a certain value at a certain location. The memory subsystem
propagates the store to all the other CPUs as well as to RAM. (As a
special case, we say that the store propagates to its own CPU at the
time it is executed.) The memory subsystem also determines where the
store falls in the location's coherence order. In particular, it must
arrange for the store to be co-later than (i.e., to overwrite) any
other store to the same location which has already propagated to CPU C.
When a CPU executes a load instruction R, it first checks to see
whether there are any as-yet unexecuted store instructions, for the
same location, that come before R in program order. If there are, it
uses the value of the po-latest such store as the value obtained by R,
and we say that the store's value is forwarded to R. Otherwise, the
CPU asks the memory subsystem for the value to load and we say that R
is satisfied from memory. The memory subsystem hands back the value
of the co-latest store to the location in question which has already
propagated to that CPU.
(In fact, the picture needs to be a little more complicated than this.
CPUs have local caches, and propagating a store to a CPU really means
propagating it to the CPU's local cache. A local cache can take some
time to process the stores that it receives, and a store can't be used
to satisfy one of the CPU's loads until it has been processed. On
most architectures, the local caches process stores in
First-In-First-Out order, and consequently the processing delay
doesn't matter for the memory model. But on Alpha, the local caches
have a partitioned design that results in non-FIFO behavior. We will
discuss this in more detail later.)
Note that load instructions may be executed speculatively and may be
restarted under certain circumstances. The memory model ignores these
premature executions; we simply say that the load executes at the
final time it is forwarded or satisfied.
Executing a fence (or memory barrier) instruction doesn't require a
CPU to do anything special other than informing the memory subsystem
about the fence. However, fences do constrain the way CPUs and the
memory subsystem handle other instructions, in two respects.
First, a fence forces the CPU to execute various instructions in
program order. Exactly which instructions are ordered depends on the
type of fence:
Strong fences, including smp_mb() and synchronize_rcu(), force
the CPU to execute all po-earlier instructions before any
po-later instructions;
smp_rmb() forces the CPU to execute all po-earlier loads
before any po-later loads;
smp_wmb() forces the CPU to execute all po-earlier stores
before any po-later stores;
Acquire fences, such as smp_load_acquire(), force the CPU to
execute the load associated with the fence (e.g., the load
part of an smp_load_acquire()) before any po-later
instructions;
Release fences, such as smp_store_release(), force the CPU to
execute all po-earlier instructions before the store
associated with the fence (e.g., the store part of an
smp_store_release()).
Second, some types of fence affect the way the memory subsystem
propagates stores. When a fence instruction is executed on CPU C:
For each other CPU C', smp_wmb() forces all po-earlier stores
on C to propagate to C' before any po-later stores do.
For each other CPU C', any store which propagates to C before
a release fence is executed (including all po-earlier
stores executed on C) is forced to propagate to C' before the
store associated with the release fence does.
Any store which propagates to C before a strong fence is
executed (including all po-earlier stores on C) is forced to
propagate to all other CPUs before any instructions po-after
the strong fence are executed on C.
The propagation ordering enforced by release fences and strong fences
affects stores from other CPUs that propagate to CPU C before the
fence is executed, as well as stores that are executed on C before the
fence. We describe this property by saying that release fences and
strong fences are A-cumulative. By contrast, smp_wmb() fences are not
A-cumulative; they only affect the propagation of stores that are
executed on C before the fence (i.e., those which precede the fence in
program order).
rcu_read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have
other properties which we discuss later.
PROPAGATION ORDER RELATION: cumul-fence
---------------------------------------
The fences which affect propagation order (i.e., strong, release, and
smp_wmb() fences) are collectively referred to as cumul-fences, even
though smp_wmb() isn't A-cumulative. The cumul-fence relation is
defined to link memory access events E and F whenever:
E and F are both stores on the same CPU and an smp_wmb() fence
event occurs between them in program order; or
F is a release fence and some X comes before F in program order,
where either X = E or else E ->rf X; or
A strong fence event occurs between some X and F in program
order, where either X = E or else E ->rf X.
The operational model requires that whenever W and W' are both stores
and W ->cumul-fence W', then W must propagate to any given CPU
before W' does. However, for different CPUs C and C', it does not
require W to propagate to C before W' propagates to C'.
DERIVATION OF THE LKMM FROM THE OPERATIONAL MODEL
-------------------------------------------------
The LKMM is derived from the restrictions imposed by the design
outlined above. These restrictions involve the necessity of
maintaining cache coherence and the fact that a CPU can't operate on a
value before it knows what that value is, among other things.
The formal version of the LKMM is defined by six requirements, or
axioms:
Sequential consistency per variable: This requires that the
system obey the four coherency rules.
Atomicity: This requires that atomic read-modify-write
operations really are atomic, that is, no other stores can
sneak into the middle of such an update.
Happens-before: This requires that certain instructions are
executed in a specific order.
Propagation: This requires that certain stores propagate to
CPUs and to RAM in a specific order.
Rcu: This requires that RCU read-side critical sections and
grace periods obey the rules of RCU, in particular, the
Grace-Period Guarantee.
Plain-coherence: This requires that plain memory accesses
(those not using READ_ONCE(), WRITE_ONCE(), etc.) must obey
the operational model's rules regarding cache coherence.
The first and second are quite common; they can be found in many
memory models (such as those for C11/C++11). The "happens-before" and
"propagation" axioms have analogs in other memory models as well. The
"rcu" and "plain-coherence" axioms are specific to the LKMM.
Each of these axioms is discussed below.
SEQUENTIAL CONSISTENCY PER VARIABLE
-----------------------------------
According to the principle of cache coherence, the stores to any fixed
shared location in memory form a global ordering. We can imagine
inserting the loads from that location into this ordering, by placing
each load between the store that it reads from and the following
store. This leaves the relative positions of loads that read from the
same store unspecified; let's say they are inserted in program order,
first for CPU 0, then CPU 1, etc.
You can check that the four coherency rules imply that the rf, co, fr,
and po-loc relations agree with this global ordering; in other words,
whenever we have X ->rf Y or X ->co Y or X ->fr Y or X ->po-loc Y, the
X event comes before the Y event in the global ordering. The LKMM's
"coherence" axiom expresses this by requiring the union of these
relations not to have any cycles. This means it must not be possible
to find events
X0 -> X1 -> X2 -> ... -> Xn -> X0,
where each of the links is either rf, co, fr, or po-loc. This has to
hold if the accesses to the fixed memory location can be ordered as
cache coherence demands.
Although it is not obvious, it can be shown that the converse is also
true: This LKMM axiom implies that the four coherency rules are
obeyed.
ATOMIC UPDATES: rmw
-------------------
What does it mean to say that a read-modify-write (rmw) update, such
as atomic_inc(&x), is atomic? It means that the memory location (x in
this case) does not get altered between the read and the write events
making up the atomic operation. In particular, if two CPUs perform
atomic_inc(&x) concurrently, it must be guaranteed that the final
value of x will be the initial value plus two. We should never have
the following sequence of events:
CPU 0 loads x obtaining 13;
CPU 1 loads x obtaining 13;
CPU 0 stores 14 to x;
CPU 1 stores 14 to x;
where the final value of x is wrong (14 rather than 15).
In this example, CPU 0's increment effectively gets lost because it
occurs in between CPU 1's load and store. To put it another way, the
problem is that the position of CPU 0's store in x's coherence order
is between the store that CPU 1 reads from and the store that CPU 1
performs.
The same analysis applies to all atomic update operations. Therefore,
to enforce atomicity the LKMM requires that atomic updates follow this
rule: Whenever R and W are the read and write events composing an
atomic read-modify-write and W' is the write event which R reads from,
there must not be any stores coming between W' and W in the coherence
order. Equivalently,
(R ->rmw W) implies (there is no X with R ->fr X and X ->co W),
where the rmw relation links the read and write events making up each
atomic update. This is what the LKMM's "atomic" axiom says.
Atomic rmw updates play one more role in the LKMM: They can form "rmw
sequences". An rmw sequence is simply a bunch of atomic updates where
each update reads from the previous one. Written using events, it
looks like this:
Z0 ->rf Y1 ->rmw Z1 ->rf ... ->rf Yn ->rmw Zn,
where Z0 is some store event and n can be any number (even 0, in the
degenerate case). We write this relation as: Z0 ->rmw-sequence Zn.
Note that this implies Z0 and Zn are stores to the same variable.
Rmw sequences have a special property in the LKMM: They can extend the
cumul-fence relation. That is, if we have:
U ->cumul-fence X -> rmw-sequence Y
then also U ->cumul-fence Y. Thinking about this in terms of the
operational model, U ->cumul-fence X says that the store U propagates
to each CPU before the store X does. Then the fact that X and Y are
linked by an rmw sequence means that U also propagates to each CPU
before Y does. In an analogous way, rmw sequences can also extend
the w-post-bounded relation defined below in the PLAIN ACCESSES AND
DATA RACES section.
(The notion of rmw sequences in the LKMM is similar to, but not quite
the same as, that of release sequences in the C11 memory model. They
were added to the LKMM to fix an obscure bug; without them, atomic
updates with full-barrier semantics did not always guarantee ordering
at least as strong as atomic updates with release-barrier semantics.)
THE PRESERVED PROGRAM ORDER RELATION: ppo
-----------------------------------------
There are many situations where a CPU is obliged to execute two
instructions in program order. We amalgamate them into the ppo (for
"preserved program order") relation, which links the po-earlier
instruction to the po-later instruction and is thus a sub-relation of
po.
The operational model already includes a description of one such
situation: Fences are a source of ppo links. Suppose X and Y are
memory accesses with X ->po Y; then the CPU must execute X before Y if
any of the following hold:
A strong (smp_mb() or synchronize_rcu()) fence occurs between
X and Y;
X and Y are both stores and an smp_wmb() fence occurs between
them;
X and Y are both loads and an smp_rmb() fence occurs between
them;
X is also an acquire fence, such as smp_load_acquire();
Y is also a release fence, such as smp_store_release().
Another possibility, not mentioned earlier but discussed in the next
section, is:
X and Y are both loads, X ->addr Y (i.e., there is an address
dependency from X to Y), and X is a READ_ONCE() or an atomic
access.
Dependencies can also cause instructions to be executed in program
order. This is uncontroversial when the second instruction is a
store; either a data, address, or control dependency from a load R to
a store W will force the CPU to execute R before W. This is very
simply because the CPU cannot tell the memory subsystem about W's
store before it knows what value should be stored (in the case of a
data dependency), what location it should be stored into (in the case
of an address dependency), or whether the store should actually take
place (in the case of a control dependency).
Dependencies to load instructions are more problematic. To begin with,
there is no such thing as a data dependency to a load. Next, a CPU
has no reason to respect a control dependency to a load, because it
can always satisfy the second load speculatively before the first, and
then ignore the result if it turns out that the second load shouldn't
be executed after all. And lastly, the real difficulties begin when
we consider address dependencies to loads.
To be fair about it, all Linux-supported architectures do execute
loads in program order if there is an address dependency between them.
After all, a CPU cannot ask the memory subsystem to load a value from
a particular location before it knows what that location is. However,
the split-cache design used by Alpha can cause it to behave in a way
that looks as if the loads were executed out of order (see the next
section for more details). The kernel includes a workaround for this
problem when the loads come from READ_ONCE(), and therefore the LKMM
includes address dependencies to loads in the ppo relation.
On the other hand, dependencies can indirectly affect the ordering of
two loads. This happens when there is a dependency from a load to a
store and a second, po-later load reads from that store:
R ->dep W ->rfi R',
where the dep link can be either an address or a data dependency. In
this situation we know it is possible for the CPU to execute R' before
W, because it can forward the value that W will store to R'. But it
cannot execute R' before R, because it cannot forward the value before
it knows what that value is, or that W and R' do access the same
location. However, if there is merely a control dependency between R
and W then the CPU can speculatively forward W to R' before executing
R; if the speculation turns out to be wrong then the CPU merely has to
restart or abandon R'.
(In theory, a CPU might forward a store to a load when it runs across
an address dependency like this:
r1 = READ_ONCE(ptr);
WRITE_ONCE(*r1, 17);
r2 = READ_ONCE(*r1);
because it could tell that the store and the second load access the
same location even before it knows what the location's address is.
However, none of the architectures supported by the Linux kernel do
this.)
Two memory accesses of the same location must always be executed in
program order if the second access is a store. Thus, if we have
R ->po-loc W
(the po-loc link says that R comes before W in program order and they
access the same location), the CPU is obliged to execute W after R.
If it executed W first then the memory subsystem would respond to R's
read request with the value stored by W (or an even later store), in
violation of the read-write coherence rule. Similarly, if we had
W ->po-loc W'
and the CPU executed W' before W, then the memory subsystem would put
W' before W in the coherence order. It would effectively cause W to
overwrite W', in violation of the write-write coherence rule.
(Interestingly, an early ARMv8 memory model, now obsolete, proposed
allowing out-of-order writes like this to occur. The model avoided
violating the write-write coherence rule by requiring the CPU not to
send the W write to the memory subsystem at all!)
AND THEN THERE WAS ALPHA
------------------------
As mentioned above, the Alpha architecture is unique in that it does
not appear to respect address dependencies to loads. This means that
code such as the following:
int x = 0;
int y = -1;
int *ptr = &y;
P0()
{
WRITE_ONCE(x, 1);
smp_wmb();
WRITE_ONCE(ptr, &x);
}
P1()
{
int *r1;
int r2;
r1 = ptr;
r2 = READ_ONCE(*r1);
}
can malfunction on Alpha systems (notice that P1 uses an ordinary load
to read ptr instead of READ_ONCE()). It is quite possible that r1 = &x
and r2 = 0 at the end, in spite of the address dependency.
At first glance this doesn't seem to make sense. We know that the
smp_wmb() forces P0's store to x to propagate to P1 before the store
to ptr does. And since P1 can't execute its second load
until it knows what location to load from, i.e., after executing its
first load, the value x = 1 must have propagated to P1 before the
second load executed. So why doesn't r2 end up equal to 1?
The answer lies in the Alpha's split local caches. Although the two
stores do reach P1's local cache in the proper order, it can happen
that the first store is processed by a busy part of the cache while
the second store is processed by an idle part. As a result, the x = 1
value may not become available for P1's CPU to read until after the
ptr = &x value does, leading to the undesirable result above. The
final effect is that even though the two loads really are executed in
program order, it appears that they aren't.
This could not have happened if the local cache had processed the
incoming stores in FIFO order. By contrast, other architectures
maintain at least the appearance of FIFO order.
In practice, this difficulty is solved by inserting a special fence
between P1's two loads when the kernel is compiled for the Alpha
architecture. In fact, as of version 4.15, the kernel automatically
adds this fence after every READ_ONCE() and atomic load on Alpha. The
effect of the fence is to cause the CPU not to execute any po-later
instructions until after the local cache has finished processing all
the stores it has already received. Thus, if the code was changed to:
P1()
{
int *r1;
int r2;
r1 = READ_ONCE(ptr);
r2 = READ_ONCE(*r1);
}
then we would never get r1 = &x and r2 = 0. By the time P1 executed
its second load, the x = 1 store would already be fully processed by
the local cache and available for satisfying the read request. Thus
we have yet another reason why shared data should always be read with
READ_ONCE() or another synchronization primitive rather than accessed
directly.
The LKMM requires that smp_rmb(), acquire fences, and strong fences
share this property: They do not allow the CPU to execute any po-later
instructions (or po-later loads in the case of smp_rmb()) until all
outstanding stores have been processed by the local cache. In the
case of a strong fence, the CPU first has to wait for all of its
po-earlier stores to propagate to every other CPU in the system; then
it has to wait for the local cache to process all the stores received
as of that time -- not just the stores received when the strong fence
began.
And of course, none of this matters for any architecture other than
Alpha.
THE HAPPENS-BEFORE RELATION: hb
-------------------------------
The happens-before relation (hb) links memory accesses that have to
execute in a certain order. hb includes the ppo relation and two
others, one of which is rfe.
W ->rfe R implies that W and R are on different CPUs. It also means
that W's store must have propagated to R's CPU before R executed;
otherwise R could not have read the value stored by W. Therefore W
must have executed before R, and so we have W ->hb R.
The equivalent fact need not hold if W ->rfi R (i.e., W and R are on
the same CPU). As we have already seen, the operational model allows
W's value to be forwarded to R in such cases, meaning that R may well
execute before W does.
It's important to understand that neither coe nor fre is included in
hb, despite their similarities to rfe. For example, suppose we have
W ->coe W'. This means that W and W' are stores to the same location,
they execute on different CPUs, and W comes before W' in the coherence
order (i.e., W' overwrites W). Nevertheless, it is possible for W' to
execute before W, because the decision as to which store overwrites
the other is made later by the memory subsystem. When the stores are
nearly simultaneous, either one can come out on top. Similarly,
R ->fre W means that W overwrites the value which R reads, but it
doesn't mean that W has to execute after R. All that's necessary is
for the memory subsystem not to propagate W to R's CPU until after R
has executed, which is possible if W executes shortly before R.
The third relation included in hb is like ppo, in that it only links
events that are on the same CPU. However it is more difficult to
explain, because it arises only indirectly from the requirement of
cache coherence. The relation is called prop, and it links two events
on CPU C in situations where a store from some other CPU comes after
the first event in the coherence order and propagates to C before the
second event executes.
This is best explained with some examples. The simplest case looks
like this:
int x;
P0()
{
int r1;
WRITE_ONCE(x, 1);
r1 = READ_ONCE(x);
}
P1()
{
WRITE_ONCE(x, 8);
}
If r1 = 8 at the end then P0's accesses must have executed in program
order. We can deduce this from the operational model; if P0's load
had executed before its store then the value of the store would have
been forwarded to the load, so r1 would have ended up equal to 1, not
8. In this case there is a prop link from P0's write event to its read
event, because P1's store came after P0's store in x's coherence
order, and P1's store propagated to P0 before P0's load executed.
An equally simple case involves two loads of the same location that
read from different stores:
int x = 0;
P0()
{
int r1, r2;
r1 = READ_ONCE(x);
r2 = READ_ONCE(x);
}
P1()
{
WRITE_ONCE(x, 9);
}
If r1 = 0 and r2 = 9 at the end then P0's accesses must have executed
in program order. If the second load had executed before the first
then the x = 9 store must have been propagated to P0 before the first
load executed, and so r1 would have been 9 rather than 0. In this
case there is a prop link from P0's first read event to its second,
because P1's store overwrote the value read by P0's first load, and
P1's store propagated to P0 before P0's second load executed.
Less trivial examples of prop all involve fences. Unlike the simple
examples above, they can require that some instructions are executed
out of program order. This next one should look familiar:
int buf = 0, flag = 0;
P0()
{
WRITE_ONCE(buf, 1);
smp_wmb();
WRITE_ONCE(flag, 1);
}
P1()
{
int r1;
int r2;
r1 = READ_ONCE(flag);
r2 = READ_ONCE(buf);
}
This is the MP pattern again, with an smp_wmb() fence between the two
stores. If r1 = 1 and r2 = 0 at the end then there is a prop link
from P1's second load to its first (backwards!). The reason is
similar to the previous examples: The value P1 loads from buf gets
overwritten by P0's store to buf, the fence guarantees that the store
to buf will propagate to P1 before the store to flag does, and the
store to flag propagates to P1 before P1 reads flag.
The prop link says that in order to obtain the r1 = 1, r2 = 0 result,
P1 must execute its second load before the first. Indeed, if the load
from flag were executed first, then the buf = 1 store would already
have propagated to P1 by the time P1's load from buf executed, so r2
would have been 1 at the end, not 0. (The reasoning holds even for
Alpha, although the details are more complicated and we will not go
into them.)
But what if we put an smp_rmb() fence between P1's loads? The fence
would force the two loads to be executed in program order, and it
would generate a cycle in the hb relation: The fence would create a ppo
link (hence an hb link) from the first load to the second, and the
prop relation would give an hb link from the second load to the first.
Since an instruction can't execute before itself, we are forced to
conclude that if an smp_rmb() fence is added, the r1 = 1, r2 = 0
outcome is impossible -- as it should be.
The formal definition of the prop relation involves a coe or fre link,
followed by an arbitrary number of cumul-fence links, ending with an
rfe link. You can concoct more exotic examples, containing more than
one fence, although this quickly leads to diminishing returns in terms
of complexity. For instance, here's an example containing a coe link
followed by two cumul-fences and an rfe link, utilizing the fact that
release fences are A-cumulative:
int x, y, z;
P0()
{
int r0;
WRITE_ONCE(x, 1);
r0 = READ_ONCE(z);
}
P1()
{
WRITE_ONCE(x, 2);
smp_wmb();
WRITE_ONCE(y, 1);
}
P2()
{
int r2;
r2 = READ_ONCE(y);
smp_store_release(&z, 1);
}
If x = 2, r0 = 1, and r2 = 1 after this code runs then there is a prop
link from P0's store to its load. This is because P0's store gets
overwritten by P1's store since x = 2 at the end (a coe link), the
smp_wmb() ensures that P1's store to x propagates to P2 before the
store to y does (the first cumul-fence), the store to y propagates to P2
before P2's load and store execute, P2's smp_store_release()
guarantees that the stores to x and y both propagate to P0 before the
store to z does (the second cumul-fence), and P0's load executes after the
store to z has propagated to P0 (an rfe link).
In summary, the fact that the hb relation links memory access events
in the order they execute means that it must not have cycles. This
requirement is the content of the LKMM's "happens-before" axiom.
The LKMM defines yet another relation connected to times of
instruction execution, but it is not included in hb. It relies on the
particular properties of strong fences, which we cover in the next
section.
THE PROPAGATES-BEFORE RELATION: pb
----------------------------------
The propagates-before (pb) relation capitalizes on the special
features of strong fences. It links two events E and F whenever some
store is coherence-later than E and propagates to every CPU and to RAM
before F executes. The formal definition requires that E be linked to
F via a coe or fre link, an arbitrary number of cumul-fences, an
optional rfe link, a strong fence, and an arbitrary number of hb
links. Let's see how this definition works out.
Consider first the case where E is a store (implying that the sequence
of links begins with coe). Then there are events W, X, Y, and Z such
that:
E ->coe W ->cumul-fence* X ->rfe? Y ->strong-fence Z ->hb* F,
where the * suffix indicates an arbitrary number of links of the
specified type, and the ? suffix indicates the link is optional (Y may
be equal to X). Because of the cumul-fence links, we know that W will
propagate to Y's CPU before X does, hence before Y executes and hence
before the strong fence executes. Because this fence is strong, we
know that W will propagate to every CPU and to RAM before Z executes.
And because of the hb links, we know that Z will execute before F.
Thus W, which comes later than E in the coherence order, will
propagate to every CPU and to RAM before F executes.
The case where E is a load is exactly the same, except that the first
link in the sequence is fre instead of coe.
The existence of a pb link from E to F implies that E must execute
before F. To see why, suppose that F executed first. Then W would
have propagated to E's CPU before E executed. If E was a store, the
memory subsystem would then be forced to make E come after W in the
coherence order, contradicting the fact that E ->coe W. If E was a
load, the memory subsystem would then be forced to satisfy E's read
request with the value stored by W or an even later store,
contradicting the fact that E ->fre W.
A good example illustrating how pb works is the SB pattern with strong
fences:
int x = 0, y = 0;
P0()
{
int r0;
WRITE_ONCE(x, 1);
smp_mb();
r0 = READ_ONCE(y);
}
P1()
{
int r1;
WRITE_ONCE(y, 1);
smp_mb();
r1 = READ_ONCE(x);
}
If r0 = 0 at the end then there is a pb link from P0's load to P1's
load: an fre link from P0's load to P1's store (which overwrites the
value read by P0), and a strong fence between P1's store and its load.
In this example, the sequences of cumul-fence and hb links are empty.
Note that this pb link is not included in hb as an instance of prop,
because it does not start and end on the same CPU.
Similarly, if r1 = 0 at the end then there is a pb link from P1's load
to P0's. This means that if both r1 and r2 were 0 there would be a
cycle in pb, which is not possible since an instruction cannot execute
before itself. Thus, adding smp_mb() fences to the SB pattern
prevents the r0 = 0, r1 = 0 outcome.
In summary, the fact that the pb relation links events in the order
they execute means that it cannot have cycles. This requirement is
the content of the LKMM's "propagation" axiom.
RCU RELATIONS: rcu-link, rcu-gp, rcu-rscsi, rcu-order, rcu-fence, and rb
------------------------------------------------------------------------
RCU (Read-Copy-Update) is a powerful synchronization mechanism. It
rests on two concepts: grace periods and read-side critical sections.
A grace period is the span of time occupied by a call to
synchronize_rcu(). A read-side critical section (or just critical
section, for short) is a region of code delimited by rcu_read_lock()
at the start and rcu_read_unlock() at the end. Critical sections can
be nested, although we won't make use of this fact.
As far as memory models are concerned, RCU's main feature is its
Grace-Period Guarantee, which states that a critical section can never
span a full grace period. In more detail, the Guarantee says:
For any critical section C and any grace period G, at least
one of the following statements must hold:
(1) C ends before G does, and in addition, every store that
propagates to C's CPU before the end of C must propagate to
every CPU before G ends.
(2) G starts before C does, and in addition, every store that
propagates to G's CPU before the start of G must propagate
to every CPU before C starts.
In particular, it is not possible for a critical section to both start
before and end after a grace period.
Here is a simple example of RCU in action:
int x, y;
P0()
{
rcu_read_lock();
WRITE_ONCE(x, 1);
WRITE_ONCE(y, 1);
rcu_read_unlock();
}
P1()
{
int r1, r2;
r1 = READ_ONCE(x);
synchronize_rcu();
r2 = READ_ONCE(y);
}
The Grace Period Guarantee tells us that when this code runs, it will
never end with r1 = 1 and r2 = 0. The reasoning is as follows. r1 = 1
means that P0's store to x propagated to P1 before P1 called
synchronize_rcu(), so P0's critical section must have started before
P1's grace period, contrary to part (2) of the Guarantee. On the
other hand, r2 = 0 means that P0's store to y, which occurs before the
end of the critical section, did not propagate to P1 before the end of
the grace period, contrary to part (1). Together the results violate
the Guarantee.
In the kernel's implementations of RCU, the requirements for stores
to propagate to every CPU are fulfilled by placing strong fences at
suitable places in the RCU-related code. Thus, if a critical section
starts before a grace period does then the critical section's CPU will
execute an smp_mb() fence after the end of the critical section and
some time before the grace period's synchronize_rcu() call returns.
And if a critical section ends after a grace period does then the
synchronize_rcu() routine will execute an smp_mb() fence at its start
and some time before the critical section's opening rcu_read_lock()
executes.
What exactly do we mean by saying that a critical section "starts
before" or "ends after" a grace period? Some aspects of the meaning
are pretty obvious, as in the example above, but the details aren't
entirely clear. The LKMM formalizes this notion by means of the
rcu-link relation. rcu-link encompasses a very general notion of
"before": If E and F are RCU fence events (i.e., rcu_read_lock(),
rcu_read_unlock(), or synchronize_rcu()) then among other things,
E ->rcu-link F includes cases where E is po-before some memory-access
event X, F is po-after some memory-access event Y, and we have any of
X ->rfe Y, X ->co Y, or X ->fr Y.
The formal definition of the rcu-link relation is more than a little
obscure, and we won't give it here. It is closely related to the pb
relation, and the details don't matter unless you want to comb through
a somewhat lengthy formal proof. Pretty much all you need to know
about rcu-link is the information in the preceding paragraph.
The LKMM also defines the rcu-gp and rcu-rscsi relations. They bring
grace periods and read-side critical sections into the picture, in the
following way:
E ->rcu-gp F means that E and F are in fact the same event,
and that event is a synchronize_rcu() fence (i.e., a grace
period).
E ->rcu-rscsi F means that E and F are the rcu_read_unlock()
and rcu_read_lock() fence events delimiting some read-side
critical section. (The 'i' at the end of the name emphasizes
that this relation is "inverted": It links the end of the
critical section to the start.)
If we think of the rcu-link relation as standing for an extended
"before", then X ->rcu-gp Y ->rcu-link Z roughly says that X is a
grace period which ends before Z begins. (In fact it covers more than
this, because it also includes cases where some store propagates to
Z's CPU before Z begins but doesn't propagate to some other CPU until
after X ends.) Similarly, X ->rcu-rscsi Y ->rcu-link Z says that X is
the end of a critical section which starts before Z begins.
The LKMM goes on to define the rcu-order relation as a sequence of
rcu-gp and rcu-rscsi links separated by rcu-link links, in which the
number of rcu-gp links is >= the number of rcu-rscsi links. For
example:
X ->rcu-gp Y ->rcu-link Z ->rcu-rscsi T ->rcu-link U ->rcu-gp V
would imply that X ->rcu-order V, because this sequence contains two
rcu-gp links and one rcu-rscsi link. (It also implies that
X ->rcu-order T and Z ->rcu-order V.) On the other hand:
X ->rcu-rscsi Y ->rcu-link Z ->rcu-rscsi T ->rcu-link U ->rcu-gp V
does not imply X ->rcu-order V, because the sequence contains only
one rcu-gp link but two rcu-rscsi links.
The rcu-order relation is important because the Grace Period Guarantee
means that rcu-order links act kind of like strong fences. In
particular, E ->rcu-order F implies not only that E begins before F
ends, but also that any write po-before E will propagate to every CPU
before any instruction po-after F can execute. (However, it does not
imply that E must execute before F; in fact, each synchronize_rcu()
fence event is linked to itself by rcu-order as a degenerate case.)
To prove this in full generality requires some intellectual effort.
We'll consider just a very simple case:
G ->rcu-gp W ->rcu-link Z ->rcu-rscsi F.
This formula means that G and W are the same event (a grace period),
and there are events X, Y and a read-side critical section C such that:
1. G = W is po-before or equal to X;
2. X comes "before" Y in some sense (including rfe, co and fr);
3. Y is po-before Z;
4. Z is the rcu_read_unlock() event marking the end of C;
5. F is the rcu_read_lock() event marking the start of C.
From 1 - 4 we deduce that the grace period G ends before the critical
section C. Then part (2) of the Grace Period Guarantee says not only
that G starts before C does, but also that any write which executes on
G's CPU before G starts must propagate to every CPU before C starts.
In particular, the write propagates to every CPU before F finishes
executing and hence before any instruction po-after F can execute.
This sort of reasoning can be extended to handle all the situations
covered by rcu-order.
The rcu-fence relation is a simple extension of rcu-order. While
rcu-order only links certain fence events (calls to synchronize_rcu(),
rcu_read_lock(), or rcu_read_unlock()), rcu-fence links any events
that are separated by an rcu-order link. This is analogous to the way
the strong-fence relation links events that are separated by an
smp_mb() fence event (as mentioned above, rcu-order links act kind of
like strong fences). Written symbolically, X ->rcu-fence Y means
there are fence events E and F such that:
X ->po E ->rcu-order F ->po Y.
From the discussion above, we see this implies not only that X
executes before Y, but also (if X is a store) that X propagates to
every CPU before Y executes. Thus rcu-fence is sort of a
"super-strong" fence: Unlike the original strong fences (smp_mb() and
synchronize_rcu()), rcu-fence is able to link events on different
CPUs. (Perhaps this fact should lead us to say that rcu-fence isn't
really a fence at all!)
Finally, the LKMM defines the RCU-before (rb) relation in terms of
rcu-fence. This is done in essentially the same way as the pb
relation was defined in terms of strong-fence. We will omit the
details; the end result is that E ->rb F implies E must execute
before F, just as E ->pb F does (and for much the same reasons).
Putting this all together, the LKMM expresses the Grace Period
Guarantee by requiring that the rb relation does not contain a cycle.
Equivalently, this "rcu" axiom requires that there are no events E
and F with E ->rcu-link F ->rcu-order E. Or to put it a third way,
the axiom requires that there are no cycles consisting of rcu-gp and
rcu-rscsi alternating with rcu-link, where the number of rcu-gp links
is >= the number of rcu-rscsi links.
Justifying the axiom isn't easy, but it is in fact a valid
formalization of the Grace Period Guarantee. We won't attempt to go
through the detailed argument, but the following analysis gives a
taste of what is involved. Suppose both parts of the Guarantee are
violated: A critical section starts before a grace period, and some
store propagates to the critical section's CPU before the end of the
critical section but doesn't propagate to some other CPU until after
the end of the grace period.
Putting symbols to these ideas, let L and U be the rcu_read_lock() and
rcu_read_unlock() fence events delimiting the critical section in
question, and let S be the synchronize_rcu() fence event for the grace
period. Saying that the critical section starts before S means there
are events Q and R where Q is po-after L (which marks the start of the
critical section), Q is "before" R in the sense used by the rcu-link
relation, and R is po-before the grace period S. Thus we have:
L ->rcu-link S.
Let W be the store mentioned above, let Y come before the end of the
critical section and witness that W propagates to the critical
section's CPU by reading from W, and let Z on some arbitrary CPU be a
witness that W has not propagated to that CPU, where Z happens after
some event X which is po-after S. Symbolically, this amounts to:
S ->po X ->hb* Z ->fr W ->rf Y ->po U.
The fr link from Z to W indicates that W has not propagated to Z's CPU
at the time that Z executes. From this, it can be shown (see the
discussion of the rcu-link relation earlier) that S and U are related
by rcu-link:
S ->rcu-link U.
Since S is a grace period we have S ->rcu-gp S, and since L and U are
the start and end of the critical section C we have U ->rcu-rscsi L.
From this we obtain:
S ->rcu-gp S ->rcu-link U ->rcu-rscsi L ->rcu-link S,
a forbidden cycle. Thus the "rcu" axiom rules out this violation of
the Grace Period Guarantee.
For something a little more down-to-earth, let's see how the axiom
works out in practice. Consider the RCU code example from above, this
time with statement labels added:
int x, y;
P0()
{
L: rcu_read_lock();
X: WRITE_ONCE(x, 1);
Y: WRITE_ONCE(y, 1);
U: rcu_read_unlock();
}
P1()
{
int r1, r2;
Z: r1 = READ_ONCE(x);
S: synchronize_rcu();
W: r2 = READ_ONCE(y);
}
If r2 = 0 at the end then P0's store at Y overwrites the value that
P1's load at W reads from, so we have W ->fre Y. Since S ->po W and
also Y ->po U, we get S ->rcu-link U. In addition, S ->rcu-gp S
because S is a grace period.
If r1 = 1 at the end then P1's load at Z reads from P0's store at X,
so we have X ->rfe Z. Together with L ->po X and Z ->po S, this
yields L ->rcu-link S. And since L and U are the start and end of a
critical section, we have U ->rcu-rscsi L.
Then U ->rcu-rscsi L ->rcu-link S ->rcu-gp S ->rcu-link U is a
forbidden cycle, violating the "rcu" axiom. Hence the outcome is not
allowed by the LKMM, as we would expect.
For contrast, let's see what can happen in a more complicated example:
int x, y, z;
P0()
{
int r0;
L0: rcu_read_lock();
r0 = READ_ONCE(x);
WRITE_ONCE(y, 1);
U0: rcu_read_unlock();
}
P1()
{
int r1;
r1 = READ_ONCE(y);
S1: synchronize_rcu();
WRITE_ONCE(z, 1);
}
P2()
{
int r2;
L2: rcu_read_lock();
r2 = READ_ONCE(z);
WRITE_ONCE(x, 1);
U2: rcu_read_unlock();
}
If r0 = r1 = r2 = 1 at the end, then similar reasoning to before shows
that U0 ->rcu-rscsi L0 ->rcu-link S1 ->rcu-gp S1 ->rcu-link U2 ->rcu-rscsi
L2 ->rcu-link U0. However this cycle is not forbidden, because the
sequence of relations contains fewer instances of rcu-gp (one) than of
rcu-rscsi (two). Consequently the outcome is allowed by the LKMM.
The following instruction timing diagram shows how it might actually
occur:
P0 P1 P2
-------------------- -------------------- --------------------
rcu_read_lock()
WRITE_ONCE(y, 1)
r1 = READ_ONCE(y)
synchronize_rcu() starts
. rcu_read_lock()
. WRITE_ONCE(x, 1)
r0 = READ_ONCE(x) .
rcu_read_unlock() .
synchronize_rcu() ends
WRITE_ONCE(z, 1)
r2 = READ_ONCE(z)
rcu_read_unlock()
This requires P0 and P2 to execute their loads and stores out of
program order, but of course they are allowed to do so. And as you
can see, the Grace Period Guarantee is not violated: The critical
section in P0 both starts before P1's grace period does and ends
before it does, and the critical section in P2 both starts after P1's
grace period does and ends after it does.
The LKMM supports SRCU (Sleepable Read-Copy-Update) in addition to
normal RCU. The ideas involved are much the same as above, with new
relations srcu-gp and srcu-rscsi added to represent SRCU grace periods
and read-side critical sections. However, there are some significant
differences between RCU read-side critical sections and their SRCU
counterparts, as described in the next section.
SRCU READ-SIDE CRITICAL SECTIONS
--------------------------------
The LKMM uses the srcu-rscsi relation to model SRCU read-side critical
sections. They differ from RCU read-side critical sections in the
following respects:
1. Unlike the analogous RCU primitives, synchronize_srcu(),
srcu_read_lock(), and srcu_read_unlock() take a pointer to a
struct srcu_struct as an argument. This structure is called
an SRCU domain, and calls linked by srcu-rscsi must have the
same domain. Read-side critical sections and grace periods
associated with different domains are independent of one
another; the SRCU version of the RCU Guarantee applies only
to pairs of critical sections and grace periods having the
same domain.
2. srcu_read_lock() returns a value, called the index, which must
be passed to the matching srcu_read_unlock() call. Unlike
rcu_read_lock() and rcu_read_unlock(), an srcu_read_lock()
call does not always have to match the next unpaired
srcu_read_unlock(). In fact, it is possible for two SRCU
read-side critical sections to overlap partially, as in the
following example (where s is an srcu_struct and idx1 and idx2
are integer variables):
idx1 = srcu_read_lock(&s); // Start of first RSCS
idx2 = srcu_read_lock(&s); // Start of second RSCS
srcu_read_unlock(&s, idx1); // End of first RSCS
srcu_read_unlock(&s, idx2); // End of second RSCS
The matching is determined entirely by the domain pointer and
index value. By contrast, if the calls had been
rcu_read_lock() and rcu_read_unlock() then they would have
created two nested (fully overlapping) read-side critical
sections: an inner one and an outer one.
3. The srcu_down_read() and srcu_up_read() primitives work
exactly like srcu_read_lock() and srcu_read_unlock(), except
that matching calls don't have to execute within the same context.
(The names are meant to be suggestive of operations on
semaphores.) Since the matching is determined by the domain
pointer and index value, these primitives make it possible for
an SRCU read-side critical section to start on one CPU and end
on another, so to speak.
In order to account for these properties of SRCU, the LKMM models
srcu_read_lock() as a special type of load event (which is
appropriate, since it takes a memory location as argument and returns
a value, just as a load does) and srcu_read_unlock() as a special type
of store event (again appropriate, since it takes as arguments a
memory location and a value). These loads and stores are annotated as
belonging to the "srcu-lock" and "srcu-unlock" event classes
respectively.
This approach allows the LKMM to tell whether two events are
associated with the same SRCU domain, simply by checking whether they
access the same memory location (i.e., they are linked by the loc
relation). It also gives a way to tell which unlock matches a
particular lock, by checking for the presence of a data dependency
from the load (srcu-lock) to the store (srcu-unlock). For example,
given the situation outlined earlier (with statement labels added):
A: idx1 = srcu_read_lock(&s);
B: idx2 = srcu_read_lock(&s);
C: srcu_read_unlock(&s, idx1);
D: srcu_read_unlock(&s, idx2);
the LKMM will treat A and B as loads from s yielding values saved in
idx1 and idx2 respectively. Similarly, it will treat C and D as
though they stored the values from idx1 and idx2 in s. The end result
is much as if we had written:
A: idx1 = READ_ONCE(s);
B: idx2 = READ_ONCE(s);
C: WRITE_ONCE(s, idx1);
D: WRITE_ONCE(s, idx2);
except for the presence of the special srcu-lock and srcu-unlock
annotations. You can see at once that we have A ->data C and
B ->data D. These dependencies tell the LKMM that C is the
srcu-unlock event matching srcu-lock event A, and D is the
srcu-unlock event matching srcu-lock event B.
This approach is admittedly a hack, and it has the potential to lead
to problems. For example, in:
idx1 = srcu_read_lock(&s);
srcu_read_unlock(&s, idx1);
idx2 = srcu_read_lock(&s);
srcu_read_unlock(&s, idx2);
the LKMM will believe that idx2 must have the same value as idx1,
since it reads from the immediately preceding store of idx1 in s.
Fortunately this won't matter, assuming that litmus tests never do
anything with SRCU index values other than pass them to
srcu_read_unlock() or srcu_up_read() calls.
However, sometimes it is necessary to store an index value in a
shared variable temporarily. In fact, this is the only way for
srcu_down_read() to pass the index it gets to an srcu_up_read() call
on a different CPU. In more detail, we might have soething like:
struct srcu_struct s;
int x;
P0()
{
int r0;
A: r0 = srcu_down_read(&s);
B: WRITE_ONCE(x, r0);
}
P1()
{
int r1;
C: r1 = READ_ONCE(x);
D: srcu_up_read(&s, r1);
}
Assuming that P1 executes after P0 and does read the index value
stored in x, we can write this (using brackets to represent event
annotations) as:
A[srcu-lock] ->data B[once] ->rf C[once] ->data D[srcu-unlock].
The LKMM defines a carry-srcu-data relation to express this pattern;
it permits an arbitrarily long sequence of
data ; rf
pairs (that is, a data link followed by an rf link) to occur between
an srcu-lock event and the final data dependency leading to the
matching srcu-unlock event. carry-srcu-data is complicated by the
need to ensure that none of the intermediate store events in this
sequence are instances of srcu-unlock. This is necessary because in a
pattern like the one above:
A: idx1 = srcu_read_lock(&s);
B: srcu_read_unlock(&s, idx1);
C: idx2 = srcu_read_lock(&s);
D: srcu_read_unlock(&s, idx2);
the LKMM treats B as a store to the variable s and C as a load from
that variable, creating an undesirable rf link from B to C:
A ->data B ->rf C ->data D.
This would cause carry-srcu-data to mistakenly extend a data
dependency from A to D, giving the impression that D was the
srcu-unlock event matching A's srcu-lock. To avoid such problems,
carry-srcu-data does not accept sequences in which the ends of any of
the intermediate ->data links (B above) is an srcu-unlock event.
LOCKING
-------
The LKMM includes locking. In fact, there is special code for locking
in the formal model, added in order to make tools run faster.
However, this special code is intended to be more or less equivalent
to concepts we have already covered. A spinlock_t variable is treated
the same as an int, and spin_lock(&s) is treated almost the same as:
while (cmpxchg_acquire(&s, 0, 1) != 0)
cpu_relax();
This waits until s is equal to 0 and then atomically sets it to 1,
and the read part of the cmpxchg operation acts as an acquire fence.
An alternate way to express the same thing would be:
r = xchg_acquire(&s, 1);
along with a requirement that at the end, r = 0. Similarly,
spin_trylock(&s) is treated almost the same as:
return !cmpxchg_acquire(&s, 0, 1);
which atomically sets s to 1 if it is currently equal to 0 and returns
true if it succeeds (the read part of the cmpxchg operation acts as an
acquire fence only if the operation is successful). spin_unlock(&s)
is treated almost the same as:
smp_store_release(&s, 0);
The "almost" qualifiers above need some explanation. In the LKMM, the
store-release in a spin_unlock() and the load-acquire which forms the
first half of the atomic rmw update in a spin_lock() or a successful
spin_trylock() -- we can call these things lock-releases and
lock-acquires -- have two properties beyond those of ordinary releases
and acquires.
First, when a lock-acquire reads from or is po-after a lock-release,
the LKMM requires that every instruction po-before the lock-release
must execute before any instruction po-after the lock-acquire. This
would naturally hold if the release and acquire operations were on
different CPUs and accessed the same lock variable, but the LKMM says
it also holds when they are on the same CPU, even if they access
different lock variables. For example:
int x, y;
spinlock_t s, t;
P0()
{
int r1, r2;
spin_lock(&s);
r1 = READ_ONCE(x);
spin_unlock(&s);
spin_lock(&t);
r2 = READ_ONCE(y);
spin_unlock(&t);
}
P1()
{
WRITE_ONCE(y, 1);
smp_wmb();
WRITE_ONCE(x, 1);
}
Here the second spin_lock() is po-after the first spin_unlock(), and
therefore the load of x must execute before the load of y, even though
the two locking operations use different locks. Thus we cannot have
r1 = 1 and r2 = 0 at the end (this is an instance of the MP pattern).
This requirement does not apply to ordinary release and acquire
fences, only to lock-related operations. For instance, suppose P0()
in the example had been written as:
P0()
{
int r1, r2, r3;
r1 = READ_ONCE(x);
smp_store_release(&s, 1);
r3 = smp_load_acquire(&s);
r2 = READ_ONCE(y);
}
Then the CPU would be allowed to forward the s = 1 value from the
smp_store_release() to the smp_load_acquire(), executing the
instructions in the following order:
r3 = smp_load_acquire(&s); // Obtains r3 = 1
r2 = READ_ONCE(y);
r1 = READ_ONCE(x);
smp_store_release(&s, 1); // Value is forwarded
and thus it could load y before x, obtaining r2 = 0 and r1 = 1.
Second, when a lock-acquire reads from or is po-after a lock-release,
and some other stores W and W' occur po-before the lock-release and
po-after the lock-acquire respectively, the LKMM requires that W must
propagate to each CPU before W' does. For example, consider:
int x, y;
spinlock_t s;
P0()
{
spin_lock(&s);
WRITE_ONCE(x, 1);
spin_unlock(&s);
}
P1()
{
int r1;
spin_lock(&s);
r1 = READ_ONCE(x);
WRITE_ONCE(y, 1);
spin_unlock(&s);
}
P2()
{
int r2, r3;
r2 = READ_ONCE(y);
smp_rmb();
r3 = READ_ONCE(x);
}
If r1 = 1 at the end then the spin_lock() in P1 must have read from
the spin_unlock() in P0. Hence the store to x must propagate to P2
before the store to y does, so we cannot have r2 = 1 and r3 = 0. But
if P1 had used a lock variable different from s, the writes could have
propagated in either order. (On the other hand, if the code in P0 and
P1 had all executed on a single CPU, as in the example before this
one, then the writes would have propagated in order even if the two
critical sections used different lock variables.)
These two special requirements for lock-release and lock-acquire do
not arise from the operational model. Nevertheless, kernel developers
have come to expect and rely on them because they do hold on all
architectures supported by the Linux kernel, albeit for various
differing reasons.
PLAIN ACCESSES AND DATA RACES
-----------------------------
In the LKMM, memory accesses such as READ_ONCE(x), atomic_inc(&y),
smp_load_acquire(&z), and so on are collectively referred to as
"marked" accesses, because they are all annotated with special
operations of one kind or another. Ordinary C-language memory
accesses such as x or y = 0 are simply called "plain" accesses.
Early versions of the LKMM had nothing to say about plain accesses.
The C standard allows compilers to assume that the variables affected
by plain accesses are not concurrently read or written by any other
threads or CPUs. This leaves compilers free to implement all manner
of transformations or optimizations of code containing plain accesses,
making such code very difficult for a memory model to handle.
Here is just one example of a possible pitfall:
int a = 6;
int *x = &a;
P0()
{
int *r1;
int r2 = 0;
r1 = x;
if (r1 != NULL)
r2 = READ_ONCE(*r1);
}
P1()
{
WRITE_ONCE(x, NULL);
}
On the face of it, one would expect that when this code runs, the only
possible final values for r2 are 6 and 0, depending on whether or not
P1's store to x propagates to P0 before P0's load from x executes.
But since P0's load from x is a plain access, the compiler may decide
to carry out the load twice (for the comparison against NULL, then again
for the READ_ONCE()) and eliminate the temporary variable r1. The
object code generated for P0 could therefore end up looking rather
like this:
P0()
{
int r2 = 0;
if (x != NULL)
r2 = READ_ONCE(*x);
}
And now it is obvious that this code runs the risk of dereferencing a
NULL pointer, because P1's store to x might propagate to P0 after the
test against NULL has been made but before the READ_ONCE() executes.
If the original code had said "r1 = READ_ONCE(x)" instead of "r1 = x",
the compiler would not have performed this optimization and there
would be no possibility of a NULL-pointer dereference.
Given the possibility of transformations like this one, the LKMM
doesn't try to predict all possible outcomes of code containing plain
accesses. It is instead content to determine whether the code
violates the compiler's assumptions, which would render the ultimate
outcome undefined.
In technical terms, the compiler is allowed to assume that when the
program executes, there will not be any data races. A "data race"
occurs when there are two memory accesses such that:
1. they access the same location,
2. at least one of them is a store,
3. at least one of them is plain,
4. they occur on different CPUs (or in different threads on the
same CPU), and
5. they execute concurrently.
In the literature, two accesses are said to "conflict" if they satisfy
1 and 2 above. We'll go a little farther and say that two accesses
are "race candidates" if they satisfy 1 - 4. Thus, whether or not two
race candidates actually do race in a given execution depends on
whether they are concurrent.
The LKMM tries to determine whether a program contains race candidates
which may execute concurrently; if it does then the LKMM says there is
a potential data race and makes no predictions about the program's
outcome.
Determining whether two accesses are race candidates is easy; you can
see that all the concepts involved in the definition above are already
part of the memory model. The hard part is telling whether they may
execute concurrently. The LKMM takes a conservative attitude,
assuming that accesses may be concurrent unless it can prove they
are not.
If two memory accesses aren't concurrent then one must execute before
the other. Therefore the LKMM decides two accesses aren't concurrent
if they can be connected by a sequence of hb, pb, and rb links
(together referred to as xb, for "executes before"). However, there
are two complicating factors.
If X is a load and X executes before a store Y, then indeed there is
no danger of X and Y being concurrent. After all, Y can't have any
effect on the value obtained by X until the memory subsystem has
propagated Y from its own CPU to X's CPU, which won't happen until
some time after Y executes and thus after X executes. But if X is a
store, then even if X executes before Y it is still possible that X
will propagate to Y's CPU just as Y is executing. In such a case X
could very well interfere somehow with Y, and we would have to
consider X and Y to be concurrent.
Therefore when X is a store, for X and Y to be non-concurrent the LKMM
requires not only that X must execute before Y but also that X must
propagate to Y's CPU before Y executes. (Or vice versa, of course, if
Y executes before X -- then Y must propagate to X's CPU before X
executes if Y is a store.) This is expressed by the visibility
relation (vis), where X ->vis Y is defined to hold if there is an
intermediate event Z such that:
X is connected to Z by a possibly empty sequence of
cumul-fence links followed by an optional rfe link (if none of
these links are present, X and Z are the same event),
and either:
Z is connected to Y by a strong-fence link followed by a
possibly empty sequence of xb links,
or:
Z is on the same CPU as Y and is connected to Y by a possibly
empty sequence of xb links (again, if the sequence is empty it
means Z and Y are the same event).
The motivations behind this definition are straightforward:
cumul-fence memory barriers force stores that are po-before
the barrier to propagate to other CPUs before stores that are
po-after the barrier.
An rfe link from an event W to an event R says that R reads
from W, which certainly means that W must have propagated to
R's CPU before R executed.
strong-fence memory barriers force stores that are po-before
the barrier, or that propagate to the barrier's CPU before the
barrier executes, to propagate to all CPUs before any events
po-after the barrier can execute.
To see how this works out in practice, consider our old friend, the MP
pattern (with fences and statement labels, but without the conditional
test):
int buf = 0, flag = 0;
P0()
{
X: WRITE_ONCE(buf, 1);
smp_wmb();
W: WRITE_ONCE(flag, 1);
}
P1()
{
int r1;
int r2 = 0;
Z: r1 = READ_ONCE(flag);
smp_rmb();
Y: r2 = READ_ONCE(buf);
}
The smp_wmb() memory barrier gives a cumul-fence link from X to W, and
assuming r1 = 1 at the end, there is an rfe link from W to Z. This
means that the store to buf must propagate from P0 to P1 before Z
executes. Next, Z and Y are on the same CPU and the smp_rmb() fence
provides an xb link from Z to Y (i.e., it forces Z to execute before
Y). Therefore we have X ->vis Y: X must propagate to Y's CPU before Y
executes.
The second complicating factor mentioned above arises from the fact
that when we are considering data races, some of the memory accesses
are plain. Now, although we have not said so explicitly, up to this
point most of the relations defined by the LKMM (ppo, hb, prop,
cumul-fence, pb, and so on -- including vis) apply only to marked
accesses.
There are good reasons for this restriction. The compiler is not
allowed to apply fancy transformations to marked accesses, and
consequently each such access in the source code corresponds more or
less directly to a single machine instruction in the object code. But
plain accesses are a different story; the compiler may combine them,
split them up, duplicate them, eliminate them, invent new ones, and
who knows what else. Seeing a plain access in the source code tells
you almost nothing about what machine instructions will end up in the
object code.
Fortunately, the compiler isn't completely free; it is subject to some
limitations. For one, it is not allowed to introduce a data race into
the object code if the source code does not already contain a data
race (if it could, memory models would be useless and no multithreaded
code would be safe!). For another, it cannot move a plain access past
a compiler barrier.
A compiler barrier is a kind of fence, but as the name implies, it
only affects the compiler; it does not necessarily have any effect on
how instructions are executed by the CPU. In Linux kernel source
code, the barrier() function is a compiler barrier. It doesn't give
rise directly to any machine instructions in the object code; rather,
it affects how the compiler generates the rest of the object code.
Given source code like this:
... some memory accesses ...
barrier();
... some other memory accesses ...
the barrier() function ensures that the machine instructions
corresponding to the first group of accesses will all end po-before
any machine instructions corresponding to the second group of accesses
-- even if some of the accesses are plain. (Of course, the CPU may
then execute some of those accesses out of program order, but we
already know how to deal with such issues.) Without the barrier()
there would be no such guarantee; the two groups of accesses could be
intermingled or even reversed in the object code.
The LKMM doesn't say much about the barrier() function, but it does
require that all fences are also compiler barriers. In addition, it
requires that the ordering properties of memory barriers such as
smp_rmb() or smp_store_release() apply to plain accesses as well as to
marked accesses.
This is the key to analyzing data races. Consider the MP pattern
again, now using plain accesses for buf:
int buf = 0, flag = 0;
P0()
{
U: buf = 1;
smp_wmb();
X: WRITE_ONCE(flag, 1);
}
P1()
{
int r1;
int r2 = 0;
Y: r1 = READ_ONCE(flag);
if (r1) {
smp_rmb();
V: r2 = buf;
}
}
This program does not contain a data race. Although the U and V
accesses are race candidates, the LKMM can prove they are not
concurrent as follows:
The smp_wmb() fence in P0 is both a compiler barrier and a
cumul-fence. It guarantees that no matter what hash of
machine instructions the compiler generates for the plain
access U, all those instructions will be po-before the fence.
Consequently U's store to buf, no matter how it is carried out
at the machine level, must propagate to P1 before X's store to
flag does.
X and Y are both marked accesses. Hence an rfe link from X to
Y is a valid indicator that X propagated to P1 before Y
executed, i.e., X ->vis Y. (And if there is no rfe link then
r1 will be 0, so V will not be executed and ipso facto won't
race with U.)
The smp_rmb() fence in P1 is a compiler barrier as well as a
fence. It guarantees that all the machine-level instructions
corresponding to the access V will be po-after the fence, and
therefore any loads among those instructions will execute
after the fence does and hence after Y does.
Thus U's store to buf is forced to propagate to P1 before V's load
executes (assuming V does execute), ruling out the possibility of a
data race between them.
This analysis illustrates how the LKMM deals with plain accesses in
general. Suppose R is a plain load and we want to show that R
executes before some marked access E. We can do this by finding a
marked access X such that R and X are ordered by a suitable fence and
X ->xb* E. If E was also a plain access, we would also look for a
marked access Y such that X ->xb* Y, and Y and E are ordered by a
fence. We describe this arrangement by saying that R is
"post-bounded" by X and E is "pre-bounded" by Y.
In fact, we go one step further: Since R is a read, we say that R is
"r-post-bounded" by X. Similarly, E would be "r-pre-bounded" or
"w-pre-bounded" by Y, depending on whether E was a store or a load.
This distinction is needed because some fences affect only loads
(i.e., smp_rmb()) and some affect only stores (smp_wmb()); otherwise
the two types of bounds are the same. And as a degenerate case, we
say that a marked access pre-bounds and post-bounds itself (e.g., if R
above were a marked load then X could simply be taken to be R itself.)
The need to distinguish between r- and w-bounding raises yet another
issue. When the source code contains a plain store, the compiler is
allowed to put plain loads of the same location into the object code.
For example, given the source code:
x = 1;
the compiler is theoretically allowed to generate object code that
looks like:
if (x != 1)
x = 1;
thereby adding a load (and possibly replacing the store entirely).
For this reason, whenever the LKMM requires a plain store to be
w-pre-bounded or w-post-bounded by a marked access, it also requires
the store to be r-pre-bounded or r-post-bounded, so as to handle cases
where the compiler adds a load.
(This may be overly cautious. We don't know of any examples where a
compiler has augmented a store with a load in this fashion, and the
Linux kernel developers would probably fight pretty hard to change a
compiler if it ever did this. Still, better safe than sorry.)
Incidentally, the other tranformation -- augmenting a plain load by
adding in a store to the same location -- is not allowed. This is
because the compiler cannot know whether any other CPUs might perform
a concurrent load from that location. Two concurrent loads don't
constitute a race (they can't interfere with each other), but a store
does race with a concurrent load. Thus adding a store might create a
data race where one was not already present in the source code,
something the compiler is forbidden to do. Augmenting a store with a
load, on the other hand, is acceptable because doing so won't create a
data race unless one already existed.
The LKMM includes a second way to pre-bound plain accesses, in
addition to fences: an address dependency from a marked load. That
is, in the sequence:
p = READ_ONCE(ptr);
r = *p;
the LKMM says that the marked load of ptr pre-bounds the plain load of
*p; the marked load must execute before any of the machine
instructions corresponding to the plain load. This is a reasonable
stipulation, since after all, the CPU can't perform the load of *p
until it knows what value p will hold. Furthermore, without some
assumption like this one, some usages typical of RCU would count as
data races. For example:
int a = 1, b;
int *ptr = &a;
P0()
{
b = 2;
rcu_assign_pointer(ptr, &b);
}
P1()
{
int *p;
int r;
rcu_read_lock();
p = rcu_dereference(ptr);
r = *p;
rcu_read_unlock();
}
(In this example the rcu_read_lock() and rcu_read_unlock() calls don't
really do anything, because there aren't any grace periods. They are
included merely for the sake of good form; typically P0 would call
synchronize_rcu() somewhere after the rcu_assign_pointer().)
rcu_assign_pointer() performs a store-release, so the plain store to b
is definitely w-post-bounded before the store to ptr, and the two
stores will propagate to P1 in that order. However, rcu_dereference()
is only equivalent to READ_ONCE(). While it is a marked access, it is
not a fence or compiler barrier. Hence the only guarantee we have
that the load of ptr in P1 is r-pre-bounded before the load of *p
(thus avoiding a race) is the assumption about address dependencies.
This is a situation where the compiler can undermine the memory model,
and a certain amount of care is required when programming constructs
like this one. In particular, comparisons between the pointer and
other known addresses can cause trouble. If you have something like:
p = rcu_dereference(ptr);
if (p == &x)
r = *p;
then the compiler just might generate object code resembling:
p = rcu_dereference(ptr);
if (p == &x)
r = x;
or even:
rtemp = x;
p = rcu_dereference(ptr);
if (p == &x)
r = rtemp;
which would invalidate the memory model's assumption, since the CPU
could now perform the load of x before the load of ptr (there might be
a control dependency but no address dependency at the machine level).
Finally, it turns out there is a situation in which a plain write does
not need to be w-post-bounded: when it is separated from the other
race-candidate access by a fence. At first glance this may seem
impossible. After all, to be race candidates the two accesses must
be on different CPUs, and fences don't link events on different CPUs.
Well, normal fences don't -- but rcu-fence can! Here's an example:
int x, y;
P0()
{
WRITE_ONCE(x, 1);
synchronize_rcu();
y = 3;
}
P1()
{
rcu_read_lock();
if (READ_ONCE(x) == 0)
y = 2;
rcu_read_unlock();
}
Do the plain stores to y race? Clearly not if P1 reads a non-zero
value for x, so let's assume the READ_ONCE(x) does obtain 0. This
means that the read-side critical section in P1 must finish executing
before the grace period in P0 does, because RCU's Grace-Period
Guarantee says that otherwise P0's store to x would have propagated to
P1 before the critical section started and so would have been visible
to the READ_ONCE(). (Another way of putting it is that the fre link
from the READ_ONCE() to the WRITE_ONCE() gives rise to an rcu-link
between those two events.)
This means there is an rcu-fence link from P1's "y = 2" store to P0's
"y = 3" store, and consequently the first must propagate from P1 to P0
before the second can execute. Therefore the two stores cannot be
concurrent and there is no race, even though P1's plain store to y
isn't w-post-bounded by any marked accesses.
Putting all this material together yields the following picture. For
race-candidate stores W and W', where W ->co W', the LKMM says the
stores don't race if W can be linked to W' by a
w-post-bounded ; vis ; w-pre-bounded
sequence. If W is plain then they also have to be linked by an
r-post-bounded ; xb* ; w-pre-bounded
sequence, and if W' is plain then they also have to be linked by a
w-post-bounded ; vis ; r-pre-bounded
sequence. For race-candidate load R and store W, the LKMM says the
two accesses don't race if R can be linked to W by an
r-post-bounded ; xb* ; w-pre-bounded
sequence or if W can be linked to R by a
w-post-bounded ; vis ; r-pre-bounded
sequence. For the cases involving a vis link, the LKMM also accepts
sequences in which W is linked to W' or R by a
strong-fence ; xb* ; {w and/or r}-pre-bounded
sequence with no post-bounding, and in every case the LKMM also allows
the link simply to be a fence with no bounding at all. If no sequence
of the appropriate sort exists, the LKMM says that the accesses race.
There is one more part of the LKMM related to plain accesses (although
not to data races) we should discuss. Recall that many relations such
as hb are limited to marked accesses only. As a result, the
happens-before, propagates-before, and rcu axioms (which state that
various relation must not contain a cycle) doesn't apply to plain
accesses. Nevertheless, we do want to rule out such cycles, because
they don't make sense even for plain accesses.
To this end, the LKMM imposes three extra restrictions, together
called the "plain-coherence" axiom because of their resemblance to the
rules used by the operational model to ensure cache coherence (that
is, the rules governing the memory subsystem's choice of a store to
satisfy a load request and its determination of where a store will
fall in the coherence order):
If R and W are race candidates and it is possible to link R to
W by one of the xb* sequences listed above, then W ->rfe R is
not allowed (i.e., a load cannot read from a store that it
executes before, even if one or both is plain).
If W and R are race candidates and it is possible to link W to
R by one of the vis sequences listed above, then R ->fre W is
not allowed (i.e., if a store is visible to a load then the
load must read from that store or one coherence-after it).
If W and W' are race candidates and it is possible to link W
to W' by one of the vis sequences listed above, then W' ->co W
is not allowed (i.e., if one store is visible to a second then
the second must come after the first in the coherence order).
This is the extent to which the LKMM deals with plain accesses.
Perhaps it could say more (for example, plain accesses might
contribute to the ppo relation), but at the moment it seems that this
minimal, conservative approach is good enough.
ODDS AND ENDS
-------------
This section covers material that didn't quite fit anywhere in the
earlier sections.
The descriptions in this document don't always match the formal
version of the LKMM exactly. For example, the actual formal
definition of the prop relation makes the initial coe or fre part
optional, and it doesn't require the events linked by the relation to
be on the same CPU. These differences are very unimportant; indeed,
instances where the coe/fre part of prop is missing are of no interest
because all the other parts (fences and rfe) are already included in
hb anyway, and where the formal model adds prop into hb, it includes
an explicit requirement that the events being linked are on the same
CPU.
Another minor difference has to do with events that are both memory
accesses and fences, such as those corresponding to smp_load_acquire()
calls. In the formal model, these events aren't actually both reads
and fences; rather, they are read events with an annotation marking
them as acquires. (Or write events annotated as releases, in the case
smp_store_release().) The final effect is the same.
Although we didn't mention it above, the instruction execution
ordering provided by the smp_rmb() fence doesn't apply to read events
that are part of a non-value-returning atomic update. For instance,
given:
atomic_inc(&x);
smp_rmb();
r1 = READ_ONCE(y);
it is not guaranteed that the load from y will execute after the
update to x. This is because the ARMv8 architecture allows
non-value-returning atomic operations effectively to be executed off
the CPU. Basically, the CPU tells the memory subsystem to increment
x, and then the increment is carried out by the memory hardware with
no further involvement from the CPU. Since the CPU doesn't ever read
the value of x, there is nothing for the smp_rmb() fence to act on.
The LKMM defines a few extra synchronization operations in terms of
things we have already covered. In particular, rcu_dereference() is
treated as READ_ONCE() and rcu_assign_pointer() is treated as
smp_store_release() -- which is basically how the Linux kernel treats
them.
Although we said that plain accesses are not linked by the ppo
relation, they do contribute to it indirectly. Firstly, when there is
an address dependency from a marked load R to a plain store W,
followed by smp_wmb() and then a marked store W', the LKMM creates a
ppo link from R to W'. The reasoning behind this is perhaps a little
shaky, but essentially it says there is no way to generate object code
for this source code in which W' could execute before R. Just as with
pre-bounding by address dependencies, it is possible for the compiler
to undermine this relation if sufficient care is not taken.
Secondly, plain accesses can carry dependencies: If a data dependency
links a marked load R to a store W, and the store is read by a load R'
from the same thread, then the data loaded by R' depends on the data
loaded originally by R. Thus, if R' is linked to any access X by a
dependency, R is also linked to access X by the same dependency, even
if W' or R' (or both!) are plain.
There are a few oddball fences which need special treatment:
smp_mb__before_atomic(), smp_mb__after_atomic(), and
smp_mb__after_spinlock(). The LKMM uses fence events with special
annotations for them; they act as strong fences just like smp_mb()
except for the sets of events that they order. Instead of ordering
all po-earlier events against all po-later events, as smp_mb() does,
they behave as follows:
smp_mb__before_atomic() orders all po-earlier events against
po-later atomic updates and the events following them;
smp_mb__after_atomic() orders po-earlier atomic updates and
the events preceding them against all po-later events;
smp_mb__after_spinlock() orders po-earlier lock acquisition
events and the events preceding them against all po-later
events.
Interestingly, RCU and locking each introduce the possibility of
deadlock. When faced with code sequences such as:
spin_lock(&s);
spin_lock(&s);
spin_unlock(&s);
spin_unlock(&s);
or:
rcu_read_lock();
synchronize_rcu();
rcu_read_unlock();
what does the LKMM have to say? Answer: It says there are no allowed
executions at all, which makes sense. But this can also lead to
misleading results, because if a piece of code has multiple possible
executions, some of which deadlock, the model will report only on the
non-deadlocking executions. For example:
int x, y;
P0()
{
int r0;
WRITE_ONCE(x, 1);
r0 = READ_ONCE(y);
}
P1()
{
rcu_read_lock();
if (READ_ONCE(x) > 0) {
WRITE_ONCE(y, 36);
synchronize_rcu();
}
rcu_read_unlock();
}
Is it possible to end up with r0 = 36 at the end? The LKMM will tell
you it is not, but the model won't mention that this is because P1
will self-deadlock in the executions where it stores 36 in y.
Glossary
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/glossary.txt.
This document contains brief definitions of LKMM-related terms. Like most
glossaries, it is not intended to be read front to back (except perhaps
as a way of confirming a diagnosis of OCD), but rather to be searched
for specific terms.
Address Dependency: When the address of a later memory access is computed
based on the value returned by an earlier load, an "address
dependency" extends from that load extending to the later access.
Address dependencies are quite common in RCU read-side critical
sections:
1 rcu_read_lock();
2 p = rcu_dereference(gp);
3 do_something(p->a);
4 rcu_read_unlock();
In this case, because the address of "p->a" on line 3 is computed
from the value returned by the rcu_dereference() on line 2, the
address dependency extends from that rcu_dereference() to that
"p->a". In rare cases, optimizing compilers can destroy address
dependencies. Please see Documentation/RCU/rcu_dereference.rst
for more information.
See also "Control Dependency" and "Data Dependency".
Acquire: With respect to a lock, acquiring that lock, for example,
using spin_lock(). With respect to a non-lock shared variable,
a special operation that includes a load and which orders that
load before later memory references running on that same CPU.
An example special acquire operation is smp_load_acquire(),
but atomic_read_acquire() and atomic_xchg_acquire() also include
acquire loads.
When an acquire load returns the value stored by a release store
to that same variable, (in other words, the acquire load "reads
from" the release store), then all operations preceding that
store "happen before" any operations following that load acquire.
See also "Happens-Before", "Reads-From", "Relaxed", and "Release".
Coherence (co): When one CPU's store to a given variable overwrites
either the value from another CPU's store or some later value,
there is said to be a coherence link from the second CPU to
the first.
It is also possible to have a coherence link within a CPU, which
is a "coherence internal" (coi) link. The term "coherence
external" (coe) link is used when it is necessary to exclude
the coi case.
See also "From-reads" and "Reads-from".
Control Dependency: When a later store's execution depends on a test
of a value computed from a value returned by an earlier load,
a "control dependency" extends from that load to that store.
For example:
1 if (READ_ONCE(x))
2 WRITE_ONCE(y, 1);
Here, the control dependency extends from the READ_ONCE() on
line 1 to the WRITE_ONCE() on line 2. Control dependencies are
fragile, and can be easily destroyed by optimizing compilers.
Please see control-dependencies.txt for more information.
See also "Address Dependency" and "Data Dependency".
Cycle: Memory-barrier pairing is restricted to a pair of CPUs, as the
name suggests. And in a great many cases, a pair of CPUs is all
that is required. In other cases, the notion of pairing must be
extended to additional CPUs, and the result is called a "cycle".
In a cycle, each CPU's ordering interacts with that of the next:
CPU 0 CPU 1 CPU 2
WRITE_ONCE(x, 1); WRITE_ONCE(y, 1); WRITE_ONCE(z, 1);
smp_mb(); smp_mb(); smp_mb();
r0 = READ_ONCE(y); r1 = READ_ONCE(z); r2 = READ_ONCE(x);
CPU 0's smp_mb() interacts with that of CPU 1, which interacts
with that of CPU 2, which in turn interacts with that of CPU 0
to complete the cycle. Because of the smp_mb() calls between
each pair of memory accesses, the outcome where r0, r1, and r2
are all equal to zero is forbidden by LKMM.
See also "Pairing".
Data Dependency: When the data written by a later store is computed based
on the value returned by an earlier load, a "data dependency"
extends from that load to that later store. For example:
1 r1 = READ_ONCE(x);
2 WRITE_ONCE(y, r1 + 1);
In this case, the data dependency extends from the READ_ONCE()
on line 1 to the WRITE_ONCE() on line 2. Data dependencies are
fragile and can be easily destroyed by optimizing compilers.
Because optimizing compilers put a great deal of effort into
working out what values integer variables might have, this is
especially true in cases where the dependency is carried through
an integer.
See also "Address Dependency" and "Control Dependency".
From-Reads (fr): When one CPU's store to a given variable happened
too late to affect the value returned by another CPU's
load from that same variable, there is said to be a from-reads
link from the load to the store.
It is also possible to have a from-reads link within a CPU, which
is a "from-reads internal" (fri) link. The term "from-reads
external" (fre) link is used when it is necessary to exclude
the fri case.
See also "Coherence" and "Reads-from".
Fully Ordered: An operation such as smp_mb() that orders all of
its CPU's prior accesses with all of that CPU's subsequent
accesses, or a marked access such as atomic_add_return()
that orders all of its CPU's prior accesses, itself, and
all of its CPU's subsequent accesses.
Happens-Before (hb): A relation between two accesses in which LKMM
guarantees the first access precedes the second. For more
detail, please see the "THE HAPPENS-BEFORE RELATION: hb"
section of explanation.txt.
Marked Access: An access to a variable that uses an special function or
macro such as "r1 = READ_ONCE(x)" or "smp_store_release(&a, 1)".
See also "Unmarked Access".
Pairing: "Memory-barrier pairing" reflects the fact that synchronizing
data between two CPUs requires that both CPUs their accesses.
Memory barriers thus tend to come in pairs, one executed by
one of the CPUs and the other by the other CPU. Of course,
pairing also occurs with other types of operations, so that a
smp_store_release() pairs with an smp_load_acquire() that reads
the value stored.
See also "Cycle".
Reads-From (rf): When one CPU's load returns the value stored by some other
CPU, there is said to be a reads-from link from the second
CPU's store to the first CPU's load. Reads-from links have the
nice property that time must advance from the store to the load,
which means that algorithms using reads-from links can use lighter
weight ordering and synchronization compared to algorithms using
coherence and from-reads links.
It is also possible to have a reads-from link within a CPU, which
is a "reads-from internal" (rfi) link. The term "reads-from
external" (rfe) link is used when it is necessary to exclude
the rfi case.
See also Coherence" and "From-reads".
Relaxed: A marked access that does not imply ordering, for example, a
READ_ONCE(), WRITE_ONCE(), a non-value-returning read-modify-write
operation, or a value-returning read-modify-write operation whose
name ends in "_relaxed".
See also "Acquire" and "Release".
Release: With respect to a lock, releasing that lock, for example,
using spin_unlock(). With respect to a non-lock shared variable,
a special operation that includes a store and which orders that
store after earlier memory references that ran on that same CPU.
An example special release store is smp_store_release(), but
atomic_set_release() and atomic_cmpxchg_release() also include
release stores.
See also "Acquire" and "Relaxed".
Unmarked Access: An access to a variable that uses normal C-language
syntax, for example, "a = b[2]";
See also "Marked Access".
herd-representation
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/herd-representation.txt.
#
# Legend:
# R, a Load event
# W, a Store event
# F, a Fence event
# LKR, a Lock-Read event
# LKW, a Lock-Write event
# UL, an Unlock event
# LF, a Lock-Fail event
# RL, a Read-Locked event
# RU, a Read-Unlocked event
# R*, a Load event included in RMW
# W*, a Store event included in RMW
# SRCU, a Sleepable-Read-Copy-Update event
#
# po, a Program-Order link
# rmw, a Read-Modify-Write link - every rmw link is a po link
#
# By convention, a blank line in a cell means "same as the preceding line".
#
# Note that the syntactic representation does not always match the sets and
# relations in linux-kernel.cat, due to redefinitions in linux-kernel.bell and
# lock.cat. For example, the po link between LKR and LKW is upgraded to an rmw
# link, and W[ACQUIRE] are not included in the Acquire set.
#
# Disclaimer. The table includes representations of "add" and "and" operations;
# corresponding/identical representations of "sub", "inc", "dec" and "or", "xor",
# "andnot" operations are omitted.
#
------------------------------------------------------------------------------
| C macro | Events |
------------------------------------------------------------------------------
| Non-RMW ops | |
------------------------------------------------------------------------------
| READ_ONCE | R[ONCE] |
| atomic_read | |
| WRITE_ONCE | W[ONCE] |
| atomic_set | |
| smp_load_acquire | R[ACQUIRE] |
| atomic_read_acquire | |
| smp_store_release | W[RELEASE] |
| atomic_set_release | |
| smp_store_mb | W[ONCE] ->po F[MB] |
| smp_mb | F[MB] |
| smp_rmb | F[rmb] |
| smp_wmb | F[wmb] |
| smp_mb__before_atomic | F[before-atomic] |
| smp_mb__after_atomic | F[after-atomic] |
| spin_unlock | UL |
| spin_is_locked | On success: RL |
| | On failure: RU |
| smp_mb__after_spinlock | F[after-spinlock] |
| smp_mb__after_unlock_lock | F[after-unlock-lock] |
| rcu_read_lock | F[rcu-lock] |
| rcu_read_unlock | F[rcu-unlock] |
| synchronize_rcu | F[sync-rcu] |
| rcu_dereference | R[ONCE] |
| rcu_assign_pointer | W[RELEASE] |
| srcu_read_lock | R[srcu-lock] |
| srcu_down_read | |
| srcu_read_unlock | W[srcu-unlock] |
| srcu_up_read | |
| synchronize_srcu | SRCU[sync-srcu] |
| smp_mb__after_srcu_read_unlock | F[after-srcu-read-unlock] |
------------------------------------------------------------------------------
| RMW ops w/o return value | |
------------------------------------------------------------------------------
| atomic_add | R*[NORETURN] ->rmw W*[NORETURN] |
| atomic_and | |
| spin_lock | LKR ->po LKW |
------------------------------------------------------------------------------
| RMW ops w/ return value | |
------------------------------------------------------------------------------
| atomic_add_return | R*[MB] ->rmw W*[MB] |
| atomic_fetch_add | |
| atomic_fetch_and | |
| atomic_xchg | |
| xchg | |
| atomic_add_negative | |
| atomic_add_return_relaxed | R*[ONCE] ->rmw W*[ONCE] |
| atomic_fetch_add_relaxed | |
| atomic_fetch_and_relaxed | |
| atomic_xchg_relaxed | |
| xchg_relaxed | |
| atomic_add_negative_relaxed | |
| atomic_add_return_acquire | R*[ACQUIRE] ->rmw W*[ACQUIRE] |
| atomic_fetch_add_acquire | |
| atomic_fetch_and_acquire | |
| atomic_xchg_acquire | |
| xchg_acquire | |
| atomic_add_negative_acquire | |
| atomic_add_return_release | R*[RELEASE] ->rmw W*[RELEASE] |
| atomic_fetch_add_release | |
| atomic_fetch_and_release | |
| atomic_xchg_release | |
| xchg_release | |
| atomic_add_negative_release | |
------------------------------------------------------------------------------
| Conditional RMW ops | |
------------------------------------------------------------------------------
| atomic_cmpxchg | On success: R*[MB] ->rmw W*[MB] |
| | On failure: R*[MB] |
| cmpxchg | |
| atomic_add_unless | |
| atomic_cmpxchg_relaxed | On success: R*[ONCE] ->rmw W*[ONCE] |
| | On failure: R*[ONCE] |
| atomic_cmpxchg_acquire | On success: R*[ACQUIRE] ->rmw W*[ACQUIRE] |
| | On failure: R*[ACQUIRE] |
| atomic_cmpxchg_release | On success: R*[RELEASE] ->rmw W*[RELEASE] |
| | On failure: R*[RELEASE] |
| spin_trylock | On success: LKR ->po LKW |
| | On failure: LF |
------------------------------------------------------------------------------
Litmus Tests
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/litmus-tests.txt.
Linux-Kernel Memory Model Litmus Tests
======================================
This file describes the LKMM litmus-test format by example, describes
some tricks and traps, and finally outlines LKMM's limitations. Earlier
versions of this material appeared in a number of LWN articles, including:
https://lwn.net/Articles/720550/
A formal kernel memory-ordering model (part 2)
https://lwn.net/Articles/608550/
Axiomatic validation of memory barriers and atomic instructions
https://lwn.net/Articles/470681/
Validating Memory Barriers and Atomic Instructions
This document presents information in decreasing order of applicability,
so that, where possible, the information that has proven more commonly
useful is shown near the beginning.
For information on installing LKMM, including the underlying "herd7"
tool, please see tools/memory-model/README.
Copy-Pasta
==========
As with other software, it is often better (if less macho) to adapt an
existing litmus test than it is to create one from scratch. A number
of litmus tests may be found in the kernel source tree:
tools/memory-model/litmus-tests/
Documentation/litmus-tests/
Several thousand more example litmus tests are available on github
and kernel.org:
https://github.com/paulmckrcu/litmus
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/perfbook.git/tree/CodeSamples/formal/herd
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/perfbook.git/tree/CodeSamples/formal/litmus
The -l and -L arguments to "git grep" can be quite helpful in identifying
existing litmus tests that are similar to the one you need. But even if
you start with an existing litmus test, it is still helpful to have a
good understanding of the litmus-test format.
Examples and Format
===================
This section describes the overall format of litmus tests, starting
with a small example of the message-passing pattern and moving on to
more complex examples that illustrate explicit initialization and LKMM's
minimalistic set of flow-control statements.
Message-Passing Example
-----------------------
This section gives an overview of the format of a litmus test using an
example based on the common message-passing use case. This use case
appears often in the Linux kernel. For example, a flag (modeled by "y"
below) indicates that a buffer (modeled by "x" below) is now completely
filled in and ready for use. It would be very bad if the consumer saw the
flag set, but, due to memory misordering, saw old values in the buffer.
This example asks whether smp_store_release() and smp_load_acquire()
suffices to avoid this bad outcome:
1 C MP+pooncerelease+poacquireonce
2
3 {}
4
5 P0(int *x, int *y)
6 {
7 WRITE_ONCE(*x, 1);
8 smp_store_release(y, 1);
9 }
10
11 P1(int *x, int *y)
12 {
13 int r0;
14 int r1;
15
16 r0 = smp_load_acquire(y);
17 r1 = READ_ONCE(*x);
18 }
19
20 exists (1:r0=1 /\ 1:r1=0)
Line 1 starts with "C", which identifies this file as being in the
LKMM C-language format (which, as we will see, is a small fragment
of the full C language). The remainder of line 1 is the name of
the test, which by convention is the filename with the ".litmus"
suffix stripped. In this case, the actual test may be found in
tools/memory-model/litmus-tests/MP+pooncerelease+poacquireonce.litmus
in the Linux-kernel source tree.
Mechanically generated litmus tests will often have an optional
double-quoted comment string on the second line. Such strings are ignored
when running the test. Yes, you can add your own comments to litmus
tests, but this is a bit involved due to the use of multiple parsers.
For now, you can use C-language comments in the C code, and these comments
may be in either the "/* */" or the "//" style. A later section will
cover the full litmus-test commenting story.
Line 3 is the initialization section. Because the default initialization
to zero suffices for this test, the "{}" syntax is used, which mean the
initialization section is empty. Litmus tests requiring non-default
initialization must have non-empty initialization sections, as in the
example that will be presented later in this document.
Lines 5-9 show the first process and lines 11-18 the second process. Each
process corresponds to a Linux-kernel task (or kthread, workqueue, thread,
and so on; LKMM discussions often use these terms interchangeably).
The name of the first process is "P0" and that of the second "P1".
You can name your processes anything you like as long as the names consist
of a single "P" followed by a number, and as long as the numbers are
consecutive starting with zero. This can actually be quite helpful,
for example, a .litmus file matching "^P1(" but not matching "^P2("
must contain a two-process litmus test.
The argument list for each function are pointers to the global variables
used by that function. Unlike normal C-language function parameters, the
names are significant. The fact that both P0() and P1() have a formal
parameter named "x" means that these two processes are working with the
same global variable, also named "x". So the "int *x, int *y" on P0()
and P1() mean that both processes are working with two shared global
variables, "x" and "y". Global variables are always passed to processes
by reference, hence "P0(int *x, int *y)", but *never* "P0(int x, int y)".
P0() has no local variables, but P1() has two of them named "r0" and "r1".
These names may be freely chosen, but for historical reasons stemming from
other litmus-test formats, it is conventional to use names consisting of
"r" followed by a number as shown here. A common bug in litmus tests
is forgetting to add a global variable to a process's parameter list.
This will sometimes result in an error message, but can also cause the
intended global to instead be silently treated as an undeclared local
variable.
Each process's code is similar to Linux-kernel C, as can be seen on lines
7-8 and 13-17. This code may use many of the Linux kernel's atomic
operations, some of its exclusive-lock functions, and some of its RCU
and SRCU functions. An approximate list of the currently supported
functions may be found in the linux-kernel.def file.
The P0() process does "WRITE_ONCE(*x, 1)" on line 7. Because "x" is a
pointer in P0()'s parameter list, this does an unordered store to global
variable "x". Line 8 does "smp_store_release(y, 1)", and because "y"
is also in P0()'s parameter list, this does a release store to global
variable "y".
The P1() process declares two local variables on lines 13 and 14.
Line 16 does "r0 = smp_load_acquire(y)" which does an acquire load
from global variable "y" into local variable "r0". Line 17 does a
"r1 = READ_ONCE(*x)", which does an unordered load from "*x" into local
variable "r1". Both "x" and "y" are in P1()'s parameter list, so both
reference the same global variables that are used by P0().
Line 20 is the "exists" assertion expression to evaluate the final state.
This final state is evaluated after the dust has settled: both processes
have completed and all of their memory references and memory barriers
have propagated to all parts of the system. The references to the local
variables "r0" and "r1" in line 24 must be prefixed with "1:" to specify
which process they are local to.
Note that the assertion expression is written in the litmus-test
language rather than in C. For example, single "=" is an equality
operator rather than an assignment. The "/\" character combination means
"and". Similarly, "\/" stands for "or". Both of these are ASCII-art
representations of the corresponding mathematical symbols. Finally,
"~" stands for "logical not", which is "!" in C, and not to be confused
with the C-language "~" operator which instead stands for "bitwise not".
Parentheses may be used to override precedence.
The "exists" assertion on line 20 is satisfied if the consumer sees the
flag ("y") set but the buffer ("x") as not yet filled in, that is, if P1()
loaded a value from "x" that was equal to 1 but loaded a value from "y"
that was still equal to zero.
This example can be checked by running the following command, which
absolutely must be run from the tools/memory-model directory and from
this directory only:
herd7 -conf linux-kernel.cfg litmus-tests/MP+pooncerelease+poacquireonce.litmus
The output is the result of something similar to a full state-space
search, and is as follows:
1 Test MP+pooncerelease+poacquireonce Allowed
2 States 3
3 1:r0=0; 1:r1=0;
4 1:r0=0; 1:r1=1;
5 1:r0=1; 1:r1=1;
6 No
7 Witnesses
8 Positive: 0 Negative: 3
9 Condition exists (1:r0=1 /\ 1:r1=0)
10 Observation MP+pooncerelease+poacquireonce Never 0 3
11 Time MP+pooncerelease+poacquireonce 0.00
12 Hash=579aaa14d8c35a39429b02e698241d09
The most pertinent line is line 10, which contains "Never 0 3", which
indicates that the bad result flagged by the "exists" clause never
happens. This line might instead say "Sometimes" to indicate that the
bad result happened in some but not all executions, or it might say
"Always" to indicate that the bad result happened in all executions.
(The herd7 tool doesn't judge, so it is only an LKMM convention that the
"exists" clause indicates a bad result. To see this, invert the "exists"
clause's condition and run the test.) The numbers ("0 3") at the end
of this line indicate the number of end states satisfying the "exists"
clause (0) and the number not not satisfying that clause (3).
Another important part of this output is shown in lines 2-5, repeated here:
2 States 3
3 1:r0=0; 1:r1=0;
4 1:r0=0; 1:r1=1;
5 1:r0=1; 1:r1=1;
Line 2 gives the total number of end states, and each of lines 3-5 list
one of these states, with the first ("1:r0=0; 1:r1=0;") indicating that
both of P1()'s loads returned the value "0". As expected, given the
"Never" on line 10, the state flagged by the "exists" clause is not
listed. This full list of states can be helpful when debugging a new
litmus test.
The rest of the output is not normally needed, either due to irrelevance
or due to being redundant with the lines discussed above. However, the
following paragraph lists them for the benefit of readers possessed of
an insatiable curiosity. Other readers should feel free to skip ahead.
Line 1 echos the test name, along with the "Test" and "Allowed". Line 6's
"No" says that the "exists" clause was not satisfied by any execution,
and as such it has the same meaning as line 10's "Never". Line 7 is a
lead-in to line 8's "Positive: 0 Negative: 3", which lists the number
of end states satisfying and not satisfying the "exists" clause, just
like the two numbers at the end of line 10. Line 9 repeats the "exists"
clause so that you don't have to look it up in the litmus-test file.
The number at the end of line 11 (which begins with "Time") gives the
time in seconds required to analyze the litmus test. Small tests such
as this one complete in a few milliseconds, so "0.00" is quite common.
Line 12 gives a hash of the contents for the litmus-test file, and is used
by tooling that manages litmus tests and their output. This tooling is
used by people modifying LKMM itself, and among other things lets such
people know which of the several thousand relevant litmus tests were
affected by a given change to LKMM.
Initialization
--------------
The previous example relied on the default zero initialization for
"x" and "y", but a similar litmus test could instead initialize them
to some other value:
1 C MP+pooncerelease+poacquireonce
2
3 {
4 x=42;
5 y=42;
6 }
7
8 P0(int *x, int *y)
9 {
10 WRITE_ONCE(*x, 1);
11 smp_store_release(y, 1);
12 }
13
14 P1(int *x, int *y)
15 {
16 int r0;
17 int r1;
18
19 r0 = smp_load_acquire(y);
20 r1 = READ_ONCE(*x);
21 }
22
23 exists (1:r0=1 /\ 1:r1=42)
Lines 3-6 now initialize both "x" and "y" to the value 42. This also
means that the "exists" clause on line 23 must change "1:r1=0" to
"1:r1=42".
Running the test gives the same overall result as before, but with the
value 42 appearing in place of the value zero:
1 Test MP+pooncerelease+poacquireonce Allowed
2 States 3
3 1:r0=1; 1:r1=1;
4 1:r0=42; 1:r1=1;
5 1:r0=42; 1:r1=42;
6 No
7 Witnesses
8 Positive: 0 Negative: 3
9 Condition exists (1:r0=1 /\ 1:r1=42)
10 Observation MP+pooncerelease+poacquireonce Never 0 3
11 Time MP+pooncerelease+poacquireonce 0.02
12 Hash=ab9a9b7940a75a792266be279a980156
It is tempting to avoid the open-coded repetitions of the value "42"
by defining another global variable "initval=42" and replacing all
occurrences of "42" with "initval". This will not, repeat *not*,
initialize "x" and "y" to 42, but instead to the address of "initval"
(try it!). See the section below on linked lists to learn more about
why this approach to initialization can be useful.
Control Structures
------------------
LKMM supports the C-language "if" statement, which allows modeling of
conditional branches. In LKMM, conditional branches can affect ordering,
but only if you are *very* careful (compilers are surprisingly able
to optimize away conditional branches). The following example shows
the "load buffering" (LB) use case that is used in the Linux kernel to
synchronize between ring-buffer producers and consumers. In the example
below, P0() is one side checking to see if an operation may proceed and
P1() is the other side completing its update.
1 C LB+fencembonceonce+ctrlonceonce
2
3 {}
4
5 P0(int *x, int *y)
6 {
7 int r0;
8
9 r0 = READ_ONCE(*x);
10 if (r0)
11 WRITE_ONCE(*y, 1);
12 }
13
14 P1(int *x, int *y)
15 {
16 int r0;
17
18 r0 = READ_ONCE(*y);
19 smp_mb();
20 WRITE_ONCE(*x, 1);
21 }
22
23 exists (0:r0=1 /\ 1:r0=1)
P1()'s "if" statement on line 10 works as expected, so that line 11 is
executed only if line 9 loads a non-zero value from "x". Because P1()'s
write of "1" to "x" happens only after P1()'s read from "y", one would
hope that the "exists" clause cannot be satisfied. LKMM agrees:
1 Test LB+fencembonceonce+ctrlonceonce Allowed
2 States 2
3 0:r0=0; 1:r0=0;
4 0:r0=1; 1:r0=0;
5 No
6 Witnesses
7 Positive: 0 Negative: 2
8 Condition exists (0:r0=1 /\ 1:r0=1)
9 Observation LB+fencembonceonce+ctrlonceonce Never 0 2
10 Time LB+fencembonceonce+ctrlonceonce 0.00
11 Hash=e5260556f6de495fd39b556d1b831c3b
However, there is no "while" statement due to the fact that full
state-space search has some difficulty with iteration. However, there
are tricks that may be used to handle some special cases, which are
discussed below. In addition, loop-unrolling tricks may be applied,
albeit sparingly.
Tricks and Traps
================
This section covers extracting debug output from herd7, emulating
spin loops, handling trivial linked lists, adding comments to litmus tests,
emulating call_rcu(), and finally tricks to improve herd7 performance
in order to better handle large litmus tests.
Debug Output
------------
By default, the herd7 state output includes all variables mentioned
in the "exists" clause. But sometimes debugging efforts are greatly
aided by the values of other variables. Consider this litmus test
(tools/memory-order/litmus-tests/SB+rfionceonce-poonceonces.litmus but
slightly modified), which probes an obscure corner of hardware memory
ordering:
1 C SB+rfionceonce-poonceonces
2
3 {}
4
5 P0(int *x, int *y)
6 {
7 int r1;
8 int r2;
9
10 WRITE_ONCE(*x, 1);
11 r1 = READ_ONCE(*x);
12 r2 = READ_ONCE(*y);
13 }
14
15 P1(int *x, int *y)
16 {
17 int r3;
18 int r4;
19
20 WRITE_ONCE(*y, 1);
21 r3 = READ_ONCE(*y);
22 r4 = READ_ONCE(*x);
23 }
24
25 exists (0:r2=0 /\ 1:r4=0)
The herd7 output is as follows:
1 Test SB+rfionceonce-poonceonces Allowed
2 States 4
3 0:r2=0; 1:r4=0;
4 0:r2=0; 1:r4=1;
5 0:r2=1; 1:r4=0;
6 0:r2=1; 1:r4=1;
7 Ok
8 Witnesses
9 Positive: 1 Negative: 3
10 Condition exists (0:r2=0 /\ 1:r4=0)
11 Observation SB+rfionceonce-poonceonces Sometimes 1 3
12 Time SB+rfionceonce-poonceonces 0.01
13 Hash=c7f30fe0faebb7d565405d55b7318ada
(This output indicates that CPUs are permitted to "snoop their own
store buffers", which all of Linux's CPU families other than s390 will
happily do. Such snooping results in disagreement among CPUs on the
order of stores from different CPUs, which is rarely an issue.)
But the herd7 output shows only the two variables mentioned in the
"exists" clause. Someone modifying this test might wish to know the
values of "x", "y", "0:r1", and "0:r3" as well. The "locations"
statement on line 25 shows how to cause herd7 to display additional
variables:
1 C SB+rfionceonce-poonceonces
2
3 {}
4
5 P0(int *x, int *y)
6 {
7 int r1;
8 int r2;
9
10 WRITE_ONCE(*x, 1);
11 r1 = READ_ONCE(*x);
12 r2 = READ_ONCE(*y);
13 }
14
15 P1(int *x, int *y)
16 {
17 int r3;
18 int r4;
19
20 WRITE_ONCE(*y, 1);
21 r3 = READ_ONCE(*y);
22 r4 = READ_ONCE(*x);
23 }
24
25 locations [0:r1; 1:r3; x; y]
26 exists (0:r2=0 /\ 1:r4=0)
The herd7 output then displays the values of all the variables:
1 Test SB+rfionceonce-poonceonces Allowed
2 States 4
3 0:r1=1; 0:r2=0; 1:r3=1; 1:r4=0; x=1; y=1;
4 0:r1=1; 0:r2=0; 1:r3=1; 1:r4=1; x=1; y=1;
5 0:r1=1; 0:r2=1; 1:r3=1; 1:r4=0; x=1; y=1;
6 0:r1=1; 0:r2=1; 1:r3=1; 1:r4=1; x=1; y=1;
7 Ok
8 Witnesses
9 Positive: 1 Negative: 3
10 Condition exists (0:r2=0 /\ 1:r4=0)
11 Observation SB+rfionceonce-poonceonces Sometimes 1 3
12 Time SB+rfionceonce-poonceonces 0.01
13 Hash=40de8418c4b395388f6501cafd1ed38d
What if you would like to know the value of a particular global variable
at some particular point in a given process's execution? One approach
is to use a READ_ONCE() to load that global variable into a new local
variable, then add that local variable to the "locations" clause.
But be careful: In some litmus tests, adding a READ_ONCE() will change
the outcome! For one example, please see the C-READ_ONCE.litmus and
C-READ_ONCE-omitted.litmus tests located here:
https://github.com/paulmckrcu/litmus/blob/master/manual/kernel/
Spin Loops
----------
The analysis carried out by herd7 explores full state space, which is
at best of exponential time complexity. Adding processes and increasing
the amount of code in a give process can greatly increase execution time.
Potentially infinite loops, such as those used to wait for locks to
become available, are clearly problematic.
Fortunately, it is possible to avoid state-space explosion by specially
modeling such loops. For example, the following litmus tests emulates
locking using xchg_acquire(), but instead of enclosing xchg_acquire()
in a spin loop, it instead excludes executions that fail to acquire the
lock using a herd7 "filter" clause. Note that for exclusive locking, you
are better off using the spin_lock() and spin_unlock() that LKMM directly
models, if for no other reason that these are much faster. However, the
techniques illustrated in this section can be used for other purposes,
such as emulating reader-writer locking, which LKMM does not yet model.
1 C C-SB+l-o-o-u+l-o-o-u-X
2
3 {
4 }
5
6 P0(int *sl, int *x0, int *x1)
7 {
8 int r2;
9 int r1;
10
11 r2 = xchg_acquire(sl, 1);
12 WRITE_ONCE(*x0, 1);
13 r1 = READ_ONCE(*x1);
14 smp_store_release(sl, 0);
15 }
16
17 P1(int *sl, int *x0, int *x1)
18 {
19 int r2;
20 int r1;
21
22 r2 = xchg_acquire(sl, 1);
23 WRITE_ONCE(*x1, 1);
24 r1 = READ_ONCE(*x0);
25 smp_store_release(sl, 0);
26 }
27
28 filter (0:r2=0 /\ 1:r2=0)
29 exists (0:r1=0 /\ 1:r1=0)
This litmus test may be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/perfbook.git/tree/CodeSamples/formal/herd/C-SB+l-o-o-u+l-o-o-u-X.litmus
This test uses two global variables, "x1" and "x2", and also emulates a
single global spinlock named "sl". This spinlock is held by whichever
process changes the value of "sl" from "0" to "1", and is released when
that process sets "sl" back to "0". P0()'s lock acquisition is emulated
on line 11 using xchg_acquire(), which unconditionally stores the value
"1" to "sl" and stores either "0" or "1" to "r2", depending on whether
the lock acquisition was successful or unsuccessful (due to "sl" already
having the value "1"), respectively. P1() operates in a similar manner.
Rather unconventionally, execution appears to proceed to the critical
section on lines 12 and 13 in either case. Line 14 then uses an
smp_store_release() to store zero to "sl", thus emulating lock release.
The case where xchg_acquire() fails to acquire the lock is handled by
the "filter" clause on line 28, which tells herd7 to keep only those
executions in which both "0:r2" and "1:r2" are zero, that is to pay
attention only to those executions in which both locks are actually
acquired. Thus, the bogus executions that would execute the critical
sections are discarded and any effects that they might have had are
ignored. Note well that the "filter" clause keeps those executions
for which its expression is satisfied, that is, for which the expression
evaluates to true. In other words, the "filter" clause says what to
keep, not what to discard.
The result of running this test is as follows:
1 Test C-SB+l-o-o-u+l-o-o-u-X Allowed
2 States 2
3 0:r1=0; 1:r1=1;
4 0:r1=1; 1:r1=0;
5 No
6 Witnesses
7 Positive: 0 Negative: 2
8 Condition exists (0:r1=0 /\ 1:r1=0)
9 Observation C-SB+l-o-o-u+l-o-o-u-X Never 0 2
10 Time C-SB+l-o-o-u+l-o-o-u-X 0.03
The "Never" on line 9 indicates that this use of xchg_acquire() and
smp_store_release() really does correctly emulate locking.
Why doesn't the litmus test take the simpler approach of using a spin loop
to handle failed spinlock acquisitions, like the kernel does? The key
insight behind this litmus test is that spin loops have no effect on the
possible "exists"-clause outcomes of program execution in the absence
of deadlock. In other words, given a high-quality lock-acquisition
primitive in a deadlock-free program running on high-quality hardware,
each lock acquisition will eventually succeed. Because herd7 already
explores the full state space, the length of time required to actually
acquire the lock does not matter. After all, herd7 already models all
possible durations of the xchg_acquire() statements.
Why not just add the "filter" clause to the "exists" clause, thus
avoiding the "filter" clause entirely? This does work, but is slower.
The reason that the "filter" clause is faster is that (in the common case)
herd7 knows to abandon an execution as soon as the "filter" expression
fails to be satisfied. In contrast, the "exists" clause is evaluated
only at the end of time, thus requiring herd7 to waste time on bogus
executions in which both critical sections proceed concurrently. In
addition, some LKMM users like the separation of concerns provided by
using the both the "filter" and "exists" clauses.
Readers lacking a pathological interest in odd corner cases should feel
free to skip the remainder of this section.
But what if the litmus test were to temporarily set "0:r2" to a non-zero
value? Wouldn't that cause herd7 to abandon the execution prematurely
due to an early mismatch of the "filter" clause?
Why not just try it? Line 4 of the following modified litmus test
introduces a new global variable "x2" that is initialized to "1". Line 23
of P1() reads that variable into "1:r2" to force an early mismatch with
the "filter" clause. Line 24 does a known-true "if" condition to avoid
and static analysis that herd7 might do. Finally the "exists" clause
on line 32 is updated to a condition that is alway satisfied at the end
of the test.
1 C C-SB+l-o-o-u+l-o-o-u-X
2
3 {
4 x2=1;
5 }
6
7 P0(int *sl, int *x0, int *x1)
8 {
9 int r2;
10 int r1;
11
12 r2 = xchg_acquire(sl, 1);
13 WRITE_ONCE(*x0, 1);
14 r1 = READ_ONCE(*x1);
15 smp_store_release(sl, 0);
16 }
17
18 P1(int *sl, int *x0, int *x1, int *x2)
19 {
20 int r2;
21 int r1;
22
23 r2 = READ_ONCE(*x2);
24 if (r2)
25 r2 = xchg_acquire(sl, 1);
26 WRITE_ONCE(*x1, 1);
27 r1 = READ_ONCE(*x0);
28 smp_store_release(sl, 0);
29 }
30
31 filter (0:r2=0 /\ 1:r2=0)
32 exists (x1=1)
If the "filter" clause were to check each variable at each point in the
execution, running this litmus test would display no executions because
all executions would be filtered out at line 23. However, the output
is instead as follows:
1 Test C-SB+l-o-o-u+l-o-o-u-X Allowed
2 States 1
3 x1=1;
4 Ok
5 Witnesses
6 Positive: 2 Negative: 0
7 Condition exists (x1=1)
8 Observation C-SB+l-o-o-u+l-o-o-u-X Always 2 0
9 Time C-SB+l-o-o-u+l-o-o-u-X 0.04
10 Hash=080bc508da7f291e122c6de76c0088e3
Line 3 shows that there is one execution that did not get filtered out,
so the "filter" clause is evaluated only on the last assignment to
the variables that it checks. In this case, the "filter" clause is a
disjunction, so it might be evaluated twice, once at the final (and only)
assignment to "0:r2" and once at the final assignment to "1:r2".
Linked Lists
------------
LKMM can handle linked lists, but only linked lists in which each node
contains nothing except a pointer to the next node in the list. This is
of course quite restrictive, but there is nevertheless quite a bit that
can be done within these confines, as can be seen in the litmus test
at tools/memory-model/litmus-tests/MP+onceassign+derefonce.litmus:
1 C MP+onceassign+derefonce
2
3 {
4 y=z;
5 z=0;
6 }
7
8 P0(int *x, int **y)
9 {
10 WRITE_ONCE(*x, 1);
11 rcu_assign_pointer(*y, x);
12 }
13
14 P1(int *x, int **y)
15 {
16 int *r0;
17 int r1;
18
19 rcu_read_lock();
20 r0 = rcu_dereference(*y);
21 r1 = READ_ONCE(*r0);
22 rcu_read_unlock();
23 }
24
25 exists (1:r0=x /\ 1:r1=0)
Line 4's "y=z" may seem odd, given that "z" has not yet been initialized.
But "y=z" does not set the value of "y" to that of "z", but instead
sets the value of "y" to the *address* of "z". Lines 4 and 5 therefore
create a simple linked list, with "y" pointing to "z" and "z" having a
NULL pointer. A much longer linked list could be created if desired,
and circular singly linked lists can also be created and manipulated.
The "exists" clause works the same way, with the "1:r0=x" comparing P1()'s
"r0" not to the value of "x", but again to its address. This term of the
"exists" clause therefore tests whether line 20's load from "y" saw the
value stored by line 11, which is in fact what is required in this case.
P0()'s line 10 initializes "x" to the value 1 then line 11 links to "x"
from "y", replacing "z".
P1()'s line 20 loads a pointer from "y", and line 21 dereferences that
pointer. The RCU read-side critical section spanning lines 19-22 is just
for show in this example. Note that the address used for line 21's load
depends on (in this case, "is exactly the same as") the value loaded by
line 20. This is an example of what is called an "address dependency".
This particular address dependency extends from the load on line 20 to the
load on line 21. Address dependencies provide a weak form of ordering.
Running this test results in the following:
1 Test MP+onceassign+derefonce Allowed
2 States 2
3 1:r0=x; 1:r1=1;
4 1:r0=z; 1:r1=0;
5 No
6 Witnesses
7 Positive: 0 Negative: 2
8 Condition exists (1:r0=x /\ 1:r1=0)
9 Observation MP+onceassign+derefonce Never 0 2
10 Time MP+onceassign+derefonce 0.00
11 Hash=49ef7a741563570102448a256a0c8568
The only possible outcomes feature P1() loading a pointer to "z"
(which contains zero) on the one hand and P1() loading a pointer to "x"
(which contains the value one) on the other. This should be reassuring
because it says that RCU readers cannot see the old preinitialization
values when accessing a newly inserted list node. This undesirable
scenario is flagged by the "exists" clause, and would occur if P1()
loaded a pointer to "x", but obtained the pre-initialization value of
zero after dereferencing that pointer.
Comments
--------
Different portions of a litmus test are processed by different parsers,
which has the charming effect of requiring different comment syntax in
different portions of the litmus test. The C-syntax portions use
C-language comments (either "/* */" or "//"), while the other portions
use Ocaml comments "(* *)".
The following litmus test illustrates the comment style corresponding
to each syntactic unit of the test:
1 C MP+onceassign+derefonce (* A *)
2
3 (* B *)
4
5 {
6 y=z; (* C *)
7 z=0;
8 } // D
9
10 // E
11
12 P0(int *x, int **y) // F
13 {
14 WRITE_ONCE(*x, 1); // G
15 rcu_assign_pointer(*y, x);
16 }
17
18 // H
19
20 P1(int *x, int **y)
21 {
22 int *r0;
23 int r1;
24
25 rcu_read_lock();
26 r0 = rcu_dereference(*y);
27 r1 = READ_ONCE(*r0);
28 rcu_read_unlock();
29 }
30
31 // I
32
33 exists (* J *) (1:r0=x /\ (* K *) 1:r1=0) (* L *)
In short, use C-language comments in the C code and Ocaml comments in
the rest of the litmus test.
On the other hand, if you prefer C-style comments everywhere, the
C preprocessor is your friend.
Asynchronous RCU Grace Periods
------------------------------
The following litmus test is derived from the example show in
Documentation/litmus-tests/rcu/RCU+sync+free.litmus, but converted to
emulate call_rcu():
1 C RCU+sync+free
2
3 {
4 int x = 1;
5 int *y = &x;
6 int z = 1;
7 }
8
9 P0(int *x, int *z, int **y)
10 {
11 int *r0;
12 int r1;
13
14 rcu_read_lock();
15 r0 = rcu_dereference(*y);
16 r1 = READ_ONCE(*r0);
17 rcu_read_unlock();
18 }
19
20 P1(int *z, int **y, int *c)
21 {
22 rcu_assign_pointer(*y, z);
23 smp_store_release(*c, 1); // Emulate call_rcu().
24 }
25
26 P2(int *x, int *z, int **y, int *c)
27 {
28 int r0;
29
30 r0 = smp_load_acquire(*c); // Note call_rcu() request.
31 synchronize_rcu(); // Wait one grace period.
32 WRITE_ONCE(*x, 0); // Emulate the RCU callback.
33 }
34
35 filter (2:r0=1) (* Reject too-early starts. *)
36 exists (0:r0=x /\ 0:r1=0)
Lines 4-6 initialize a linked list headed by "y" that initially contains
"x". In addition, "z" is pre-initialized to prepare for P1(), which
will replace "x" with "z" in this list.
P0() on lines 9-18 enters an RCU read-side critical section, loads the
list header "y" and dereferences it, leaving the node in "0:r0" and
the node's value in "0:r1".
P1() on lines 20-24 updates the list header to instead reference "z",
then emulates call_rcu() by doing a release store into "c".
P2() on lines 27-33 emulates the behind-the-scenes effect of doing a
call_rcu(). Line 30 first does an acquire load from "c", then line 31
waits for an RCU grace period to elapse, and finally line 32 emulates
the RCU callback, which in turn emulates a call to kfree().
Of course, it is possible for P2() to start too soon, so that the
value of "2:r0" is zero rather than the required value of "1".
The "filter" clause on line 35 handles this possibility, rejecting
all executions in which "2:r0" is not equal to the value "1".
Performance
-----------
LKMM's exploration of the full state-space can be extremely helpful,
but it does not come for free. The price is exponential computational
complexity in terms of the number of processes, the average number
of statements in each process, and the total number of stores in the
litmus test.
So it is best to start small and then work up. Where possible, break
your code down into small pieces each representing a core concurrency
requirement.
That said, herd7 is quite fast. On an unprepossessing x86 laptop, it
was able to analyze the following 10-process RCU litmus test in about
six seconds.
https://github.com/paulmckrcu/litmus/blob/master/auto/C-RW-R+RW-R+RW-G+RW-G+RW-G+RW-G+RW-R+RW-R+RW-R+RW-R.litmus
One way to make herd7 run faster is to use the "-speedcheck true" option.
This option prevents herd7 from generating all possible end states,
instead causing it to focus solely on whether or not the "exists"
clause can be satisfied. With this option, herd7 evaluates the above
litmus test in about 300 milliseconds, for more than an order of magnitude
improvement in performance.
Larger 16-process litmus tests that would normally consume 15 minutes
of time complete in about 40 seconds with this option. To be fair,
you do get an extra 65,535 states when you leave off the "-speedcheck
true" option.
https://github.com/paulmckrcu/litmus/blob/master/auto/C-RW-R+RW-R+RW-G+RW-G+RW-G+RW-G+RW-R+RW-R+RW-R+RW-R+RW-G+RW-G+RW-G+RW-G+RW-R+RW-R.litmus
Nevertheless, litmus-test analysis really is of exponential complexity,
whether with or without "-speedcheck true". Increasing by just three
processes to a 19-process litmus test requires 2 hours and 40 minutes
without, and about 8 minutes with "-speedcheck true". Each of these
results represent roughly an order of magnitude slowdown compared to the
16-process litmus test. Again, to be fair, the multi-hour run explores
no fewer than 524,287 additional states compared to the shorter one.
https://github.com/paulmckrcu/litmus/blob/master/auto/C-RW-R+RW-R+RW-G+RW-G+RW-G+RW-G+RW-R+RW-R+RW-R+RW-R+RW-R+RW-R+RW-G+RW-G+RW-G+RW-G+RW-R+RW-R+RW-R.litmus
If you don't like command-line arguments, you can obtain a similar speedup
by adding a "filter" clause with exactly the same expression as your
"exists" clause.
However, please note that seeing the full set of states can be extremely
helpful when developing and debugging litmus tests.
LIMITATIONS
===========
Limitations of the Linux-kernel memory model (LKMM) include:
1. Compiler optimizations are not accurately modeled. Of course,
the use of READ_ONCE() and WRITE_ONCE() limits the compiler's
ability to optimize, but under some circumstances it is possible
for the compiler to undermine the memory model. For more
information, see Documentation/explanation.txt (in particular,
the "THE PROGRAM ORDER RELATION: po AND po-loc" and "A WARNING"
sections).
Note that this limitation in turn limits LKMM's ability to
accurately model address, control, and data dependencies.
For example, if the compiler can deduce the value of some variable
carrying a dependency, then the compiler can break that dependency
by substituting a constant of that value.
Conversely, LKMM will sometimes overestimate the amount of
reordering compilers and CPUs can carry out, leading it to miss
some pretty obvious cases of ordering. A simple example is:
r1 = READ_ONCE(x);
if (r1 == 0)
smp_mb();
WRITE_ONCE(y, 1);
The WRITE_ONCE() does not depend on the READ_ONCE(), and as a
result, LKMM does not claim ordering. However, even though no
dependency is present, the WRITE_ONCE() will not be executed before
the READ_ONCE(). There are two reasons for this:
The presence of the smp_mb() in one of the branches
prevents the compiler from moving the WRITE_ONCE()
up before the "if" statement, since the compiler has
to assume that r1 will sometimes be 0 (but see the
comment below);
CPUs do not execute stores before po-earlier conditional
branches, even in cases where the store occurs after the
two arms of the branch have recombined.
It is clear that it is not dangerous in the slightest for LKMM to
make weaker guarantees than architectures. In fact, it is
desirable, as it gives compilers room for making optimizations.
For instance, suppose that a 0 value in r1 would trigger undefined
behavior elsewhere. Then a clever compiler might deduce that r1
can never be 0 in the if condition. As a result, said clever
compiler might deem it safe to optimize away the smp_mb(),
eliminating the branch and any ordering an architecture would
guarantee otherwise.
2. Multiple access sizes for a single variable are not supported,
and neither are misaligned or partially overlapping accesses.
3. Exceptions and interrupts are not modeled. In some cases,
this limitation can be overcome by modeling the interrupt or
exception with an additional process.
4. I/O such as MMIO or DMA is not supported.
5. Self-modifying code (such as that found in the kernel's
alternatives mechanism, function tracer, Berkeley Packet Filter
JIT compiler, and module loader) is not supported.
6. Complete modeling of all variants of atomic read-modify-write
operations, locking primitives, and RCU is not provided.
For example, call_rcu() and rcu_barrier() are not supported.
However, a substantial amount of support is provided for these
operations, as shown in the linux-kernel.def file.
Here are specific limitations:
a. When rcu_assign_pointer() is passed NULL, the Linux
kernel provides no ordering, but LKMM models this
case as a store release.
b. The "unless" RMW operations are not currently modeled:
atomic_long_add_unless(), atomic_inc_unless_negative(),
and atomic_dec_unless_positive(). These can be emulated
in litmus tests, for example, by using atomic_cmpxchg().
One exception of this limitation is atomic_add_unless(),
which is provided directly by herd7 (so no corresponding
definition in linux-kernel.def). atomic_add_unless() is
modeled by herd7 therefore it can be used in litmus tests.
c. The call_rcu() function is not modeled. As was shown above,
it can be emulated in litmus tests by adding another
process that invokes synchronize_rcu() and the body of the
callback function, with (for example) a release-acquire
from the site of the emulated call_rcu() to the beginning
of the additional process.
d. The rcu_barrier() function is not modeled. It can be
emulated in litmus tests emulating call_rcu() via
(for example) a release-acquire from the end of each
additional call_rcu() process to the site of the
emulated rcu-barrier().
e. Reader-writer locking is not modeled. It can be
emulated in litmus tests using atomic read-modify-write
operations.
The fragment of the C language supported by these litmus tests is quite
limited and in some ways non-standard:
1. There is no automatic C-preprocessor pass. You can of course
run it manually, if you choose.
2. There is no way to create functions other than the Pn() functions
that model the concurrent processes.
3. The Pn() functions' formal parameters must be pointers to the
global shared variables. Nothing can be passed by value into
these functions.
4. The only functions that can be invoked are those built directly
into herd7 or that are defined in the linux-kernel.def file.
5. The "switch", "do", "for", "while", and "goto" C statements are
not supported. The "switch" statement can be emulated by the
"if" statement. The "do", "for", and "while" statements can
often be emulated by manually unrolling the loop, or perhaps by
enlisting the aid of the C preprocessor to minimize the resulting
code duplication. Some uses of "goto" can be emulated by "if",
and some others by unrolling.
6. Although you can use a wide variety of types in litmus-test
variable declarations, and especially in global-variable
declarations, the "herd7" tool understands only int and
pointer types. There is no support for floating-point types,
enumerations, characters, strings, arrays, or structures.
7. Parsing of variable declarations is very loose, with almost no
type checking.
8. Initializers differ from their C-language counterparts.
For example, when an initializer contains the name of a shared
variable, that name denotes a pointer to that variable, not
the current value of that variable. For example, "int x = y"
is interpreted the way "int x = &y" would be in C.
9. Dynamic memory allocation is not supported, although this can
be worked around in some cases by supplying multiple statically
allocated variables.
Some of these limitations may be overcome in the future, but others are
more likely to be addressed by incorporating the Linux-kernel memory model
into other tools.
Finally, please note that LKMM is subject to change as hardware, use cases,
and compilers evolve.
Locking
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/locking.txt.
[!] Note:
This file expands on the "Locking" section of recipes.txt,
focusing on locklessly accessing shared variables that are
otherwise protected by a lock.
Locking
=======
Locking is well-known and the common use cases are straightforward: Any
CPU holding a given lock sees any changes previously seen or made by any
CPU before it previously released that same lock. This last sentence
is the only part of this document that most developers will need to read.
However, developers who would like to also access lock-protected shared
variables outside of their corresponding locks should continue reading.
Locking and Prior Accesses
--------------------------
The basic rule of locking is worth repeating:
Any CPU holding a given lock sees any changes previously seen
or made by any CPU before it previously released that same lock.
Note that this statement is a bit stronger than "Any CPU holding a
given lock sees all changes made by any CPU during the time that CPU was
previously holding this same lock". For example, consider the following
pair of code fragments:
/* See MP+polocks.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
spin_lock(&mylock);
WRITE_ONCE(y, 1);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
r0 = READ_ONCE(y);
spin_unlock(&mylock);
r1 = READ_ONCE(x);
}
The basic rule guarantees that if CPU0() acquires mylock before CPU1(),
then both r0 and r1 must be set to the value 1. This also has the
consequence that if the final value of r0 is equal to 1, then the final
value of r1 must also be equal to 1. In contrast, the weaker rule would
say nothing about the final value of r1.
Locking and Subsequent Accesses
-------------------------------
The converse to the basic rule also holds: Any CPU holding a given
lock will not see any changes that will be made by any CPU after it
subsequently acquires this same lock. This converse statement is
illustrated by the following litmus test:
/* See MP+porevlocks.litmus. */
void CPU0(void)
{
r0 = READ_ONCE(y);
spin_lock(&mylock);
r1 = READ_ONCE(x);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
WRITE_ONCE(x, 1);
spin_unlock(&mylock);
WRITE_ONCE(y, 1);
}
This converse to the basic rule guarantees that if CPU0() acquires
mylock before CPU1(), then both r0 and r1 must be set to the value 0.
This also has the consequence that if the final value of r1 is equal
to 0, then the final value of r0 must also be equal to 0. In contrast,
the weaker rule would say nothing about the final value of r0.
These examples show only a single pair of CPUs, but the effects of the
locking basic rule extend across multiple acquisitions of a given lock
across multiple CPUs.
Double-Checked Locking
----------------------
It is well known that more than just a lock is required to make
double-checked locking work correctly, This litmus test illustrates
one incorrect approach:
/* See Documentation/litmus-tests/locking/DCL-broken.litmus. */
void CPU0(void)
{
r0 = READ_ONCE(flag);
if (r0 == 0) {
spin_lock(&lck);
r1 = READ_ONCE(flag);
if (r1 == 0) {
WRITE_ONCE(data, 1);
WRITE_ONCE(flag, 1);
}
spin_unlock(&lck);
}
r2 = READ_ONCE(data);
}
/* CPU1() is the exactly the same as CPU0(). */
There are two problems. First, there is no ordering between the first
READ_ONCE() of "flag" and the READ_ONCE() of "data". Second, there is
no ordering between the two WRITE_ONCE() calls. It should therefore be
no surprise that "r2" can be zero, and a quick herd7 run confirms this.
One way to fix this is to use smp_load_acquire() and smp_store_release()
as shown in this corrected version:
/* See Documentation/litmus-tests/locking/DCL-fixed.litmus. */
void CPU0(void)
{
r0 = smp_load_acquire(&flag);
if (r0 == 0) {
spin_lock(&lck);
r1 = READ_ONCE(flag);
if (r1 == 0) {
WRITE_ONCE(data, 1);
smp_store_release(&flag, 1);
}
spin_unlock(&lck);
}
r2 = READ_ONCE(data);
}
/* CPU1() is the exactly the same as CPU0(). */
The smp_load_acquire() guarantees that its load from "flags" will
be ordered before the READ_ONCE() from data, thus solving the first
problem. The smp_store_release() guarantees that its store will be
ordered after the WRITE_ONCE() to "data", solving the second problem.
The smp_store_release() pairs with the smp_load_acquire(), thus ensuring
that the ordering provided by each actually takes effect. Again, a
quick herd7 run confirms this.
In short, if you access a lock-protected variable without holding the
corresponding lock, you will need to provide additional ordering, in
this case, via the smp_load_acquire() and the smp_store_release().
Ordering Provided by a Lock to CPUs Not Holding That Lock
---------------------------------------------------------
It is not necessarily the case that accesses ordered by locking will be
seen as ordered by CPUs not holding that lock. Consider this example:
/* See Z6.0+pooncelock+pooncelock+pombonce.litmus. */
void CPU0(void)
{
spin_lock(&mylock);
WRITE_ONCE(x, 1);
WRITE_ONCE(y, 1);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
r0 = READ_ONCE(y);
WRITE_ONCE(z, 1);
spin_unlock(&mylock);
}
void CPU2(void)
{
WRITE_ONCE(z, 2);
smp_mb();
r1 = READ_ONCE(x);
}
Counter-intuitive though it might be, it is quite possible to have
the final value of r0 be 1, the final value of z be 2, and the final
value of r1 be 0. The reason for this surprising outcome is that CPU2()
never acquired the lock, and thus did not fully benefit from the lock's
ordering properties.
Ordering can be extended to CPUs not holding the lock by careful use
of smp_mb__after_spinlock():
/* See Z6.0+pooncelock+poonceLock+pombonce.litmus. */
void CPU0(void)
{
spin_lock(&mylock);
WRITE_ONCE(x, 1);
WRITE_ONCE(y, 1);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
smp_mb__after_spinlock();
r0 = READ_ONCE(y);
WRITE_ONCE(z, 1);
spin_unlock(&mylock);
}
void CPU2(void)
{
WRITE_ONCE(z, 2);
smp_mb();
r1 = READ_ONCE(x);
}
This addition of smp_mb__after_spinlock() strengthens the lock
acquisition sufficiently to rule out the counter-intuitive outcome.
In other words, the addition of the smp_mb__after_spinlock() prohibits
the counter-intuitive result where the final value of r0 is 1, the final
value of z is 2, and the final value of r1 is 0.
No Roach-Motel Locking!
-----------------------
This example requires familiarity with the herd7 "filter" clause, so
please read up on that topic in litmus-tests.txt.
It is tempting to allow memory-reference instructions to be pulled
into a critical section, but this cannot be allowed in the general case.
For example, consider a spin loop preceding a lock-based critical section.
Now, herd7 does not model spin loops, but we can emulate one with two
loads, with a "filter" clause to constrain the first to return the
initial value and the second to return the updated value, as shown below:
/* See Documentation/litmus-tests/locking/RM-fixed.litmus. */
void CPU0(void)
{
spin_lock(&lck);
r2 = atomic_inc_return(&y);
WRITE_ONCE(x, 1);
spin_unlock(&lck);
}
void CPU1(void)
{
r0 = READ_ONCE(x);
r1 = READ_ONCE(x);
spin_lock(&lck);
r2 = atomic_inc_return(&y);
spin_unlock(&lck);
}
filter (1:r0=0 /\ 1:r1=1)
exists (1:r2=1)
The variable "x" is the control variable for the emulated spin loop.
CPU0() sets it to "1" while holding the lock, and CPU1() emulates the
spin loop by reading it twice, first into "1:r0" (which should get the
initial value "0") and then into "1:r1" (which should get the updated
value "1").
The "filter" clause takes this into account, constraining "1:r0" to
equal "0" and "1:r1" to equal 1.
Then the "exists" clause checks to see if CPU1() acquired its lock first,
which should not happen given the filter clause because CPU0() updates
"x" while holding the lock. And herd7 confirms this.
But suppose that the compiler was permitted to reorder the spin loop
into CPU1()'s critical section, like this:
/* See Documentation/litmus-tests/locking/RM-broken.litmus. */
void CPU0(void)
{
int r2;
spin_lock(&lck);
r2 = atomic_inc_return(&y);
WRITE_ONCE(x, 1);
spin_unlock(&lck);
}
void CPU1(void)
{
spin_lock(&lck);
r0 = READ_ONCE(x);
r1 = READ_ONCE(x);
r2 = atomic_inc_return(&y);
spin_unlock(&lck);
}
filter (1:r0=0 /\ 1:r1=1)
exists (1:r2=1)
If "1:r0" is equal to "0", "1:r1" can never equal "1" because CPU0()
cannot update "x" while CPU1() holds the lock. And herd7 confirms this,
showing zero executions matching the "filter" criteria.
And this is why Linux-kernel lock and unlock primitives must prevent
code from entering critical sections. It is not sufficient to only
prevent code from leaving them.
Ordering
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/ordering.txt.
This document gives an overview of the categories of memory-ordering
operations provided by the Linux-kernel memory model (LKMM).
Categories of Ordering
======================
This section lists LKMM's three top-level categories of memory-ordering
operations in decreasing order of strength:
1. Barriers (also known as "fences"). A barrier orders some or
all of the CPU's prior operations against some or all of its
subsequent operations.
2. Ordered memory accesses. These operations order themselves
against some or all of the CPU's prior accesses or some or all
of the CPU's subsequent accesses, depending on the subcategory
of the operation.
3. Unordered accesses, as the name indicates, have no ordering
properties except to the extent that they interact with an
operation in the previous categories. This being the real world,
some of these "unordered" operations provide limited ordering
in some special situations.
Each of the above categories is described in more detail by one of the
following sections.
Barriers
========
Each of the following categories of barriers is described in its own
subsection below:
a. Full memory barriers.
b. Read-modify-write (RMW) ordering augmentation barriers.
c. Write memory barrier.
d. Read memory barrier.
e. Compiler barrier.
Note well that many of these primitives generate absolutely no code
in kernels built with CONFIG_SMP=n. Therefore, if you are writing
a device driver, which must correctly order accesses to a physical
device even in kernels built with CONFIG_SMP=n, please use the
ordering primitives provided for that purpose. For example, instead of
smp_mb(), use mb(). See the "Linux Kernel Device Drivers" book or the
https://lwn.net/Articles/698014/ article for more information.
Full Memory Barriers
--------------------
The Linux-kernel primitives that provide full ordering include:
o The smp_mb() full memory barrier.
o Value-returning RMW atomic operations whose names do not end in
_acquire, _release, or _relaxed.
o RCU's grace-period primitives.
First, the smp_mb() full memory barrier orders all of the CPU's prior
accesses against all subsequent accesses from the viewpoint of all CPUs.
In other words, all CPUs will agree that any earlier action taken
by that CPU happened before any later action taken by that same CPU.
For example, consider the following:
WRITE_ONCE(x, 1);
smp_mb(); // Order store to x before load from y.
r1 = READ_ONCE(y);
All CPUs will agree that the store to "x" happened before the load
from "y", as indicated by the comment. And yes, please comment your
memory-ordering primitives. It is surprisingly hard to remember their
purpose after even a few months.
Second, some RMW atomic operations provide full ordering. These
operations include value-returning RMW atomic operations (that is, those
with non-void return types) whose names do not end in _acquire, _release,
or _relaxed. Examples include atomic_add_return(), atomic_dec_and_test(),
cmpxchg(), and xchg(). Note that conditional RMW atomic operations such
as cmpxchg() are only guaranteed to provide ordering when they succeed.
When RMW atomic operations provide full ordering, they partition the
CPU's accesses into three groups:
1. All code that executed prior to the RMW atomic operation.
2. The RMW atomic operation itself.
3. All code that executed after the RMW atomic operation.
All CPUs will agree that any operation in a given partition happened
before any operation in a higher-numbered partition.
In contrast, non-value-returning RMW atomic operations (that is, those
with void return types) do not guarantee any ordering whatsoever. Nor do
value-returning RMW atomic operations whose names end in _relaxed.
Examples of the former include atomic_inc() and atomic_dec(),
while examples of the latter include atomic_cmpxchg_relaxed() and
atomic_xchg_relaxed(). Similarly, value-returning non-RMW atomic
operations such as atomic_read() do not guarantee full ordering, and
are covered in the later section on unordered operations.
Value-returning RMW atomic operations whose names end in _acquire or
_release provide limited ordering, and will be described later in this
document.
Finally, RCU's grace-period primitives provide full ordering. These
primitives include synchronize_rcu(), synchronize_rcu_expedited(),
synchronize_srcu() and so on. However, these primitives have orders
of magnitude greater overhead than smp_mb(), atomic_xchg(), and so on.
Furthermore, RCU's grace-period primitives can only be invoked in
sleepable contexts. Therefore, RCU's grace-period primitives are
typically instead used to provide ordering against RCU read-side critical
sections, as documented in their comment headers. But of course if you
need a synchronize_rcu() to interact with readers, it costs you nothing
to also rely on its additional full-memory-barrier semantics. Just please
carefully comment this, otherwise your future self will hate you.
RMW Ordering Augmentation Barriers
----------------------------------
As noted in the previous section, non-value-returning RMW operations
such as atomic_inc() and atomic_dec() guarantee no ordering whatsoever.
Nevertheless, a number of popular CPU families, including x86, provide
full ordering for these primitives. One way to obtain full ordering on
all architectures is to add a call to smp_mb():
WRITE_ONCE(x, 1);
atomic_inc(&my_counter);
smp_mb(); // Inefficient on x86!!!
r1 = READ_ONCE(y);
This works, but the added smp_mb() adds needless overhead for
x86, on which atomic_inc() provides full ordering all by itself.
The smp_mb__after_atomic() primitive can be used instead:
WRITE_ONCE(x, 1);
atomic_inc(&my_counter);
smp_mb__after_atomic(); // Order store to x before load from y.
r1 = READ_ONCE(y);
The smp_mb__after_atomic() primitive emits code only on CPUs whose
atomic_inc() implementations do not guarantee full ordering, thus
incurring no unnecessary overhead on x86. There are a number of
variations on the smp_mb__*() theme:
o smp_mb__before_atomic(), which provides full ordering prior
to an unordered RMW atomic operation.
o smp_mb__after_atomic(), which, as shown above, provides full
ordering subsequent to an unordered RMW atomic operation.
o smp_mb__after_spinlock(), which provides full ordering subsequent
to a successful spinlock acquisition. Note that spin_lock() is
always successful but spin_trylock() might not be.
o smp_mb__after_srcu_read_unlock(), which provides full ordering
subsequent to an srcu_read_unlock().
It is bad practice to place code between the smp__*() primitive and the
operation whose ordering that it is augmenting. The reason is that the
ordering of this intervening code will differ from one CPU architecture
to another.
Write Memory Barrier
--------------------
The Linux kernel's write memory barrier is smp_wmb(). If a CPU executes
the following code:
WRITE_ONCE(x, 1);
smp_wmb();
WRITE_ONCE(y, 1);
Then any given CPU will see the write to "x" has having happened before
the write to "y". However, you are usually better off using a release
store, as described in the "Release Operations" section below.
Note that smp_wmb() might fail to provide ordering for unmarked C-language
stores because profile-driven optimization could determine that the
value being overwritten is almost always equal to the new value. Such a
compiler might then reasonably decide to transform "x = 1" and "y = 1"
as follows:
if (x != 1)
x = 1;
smp_wmb(); // BUG: does not order the reads!!!
if (y != 1)
y = 1;
Therefore, if you need to use smp_wmb() with unmarked C-language writes,
you will need to make sure that none of the compilers used to build
the Linux kernel carry out this sort of transformation, both now and in
the future.
Read Memory Barrier
-------------------
The Linux kernel's read memory barrier is smp_rmb(). If a CPU executes
the following code:
r0 = READ_ONCE(y);
smp_rmb();
r1 = READ_ONCE(x);
Then any given CPU will see the read from "y" as having preceded the read from
"x". However, you are usually better off using an acquire load, as described
in the "Acquire Operations" section below.
Compiler Barrier
----------------
The Linux kernel's compiler barrier is barrier(). This primitive
prohibits compiler code-motion optimizations that might move memory
references across the point in the code containing the barrier(), but
does not constrain hardware memory ordering. For example, this can be
used to prevent the compiler from moving code across an infinite loop:
WRITE_ONCE(x, 1);
while (dontstop)
barrier();
r1 = READ_ONCE(y);
Without the barrier(), the compiler would be within its rights to move the
WRITE_ONCE() to follow the loop. This code motion could be problematic
in the case where an interrupt handler terminates the loop. Another way
to handle this is to use READ_ONCE() for the load of "dontstop".
Note that the barriers discussed previously use barrier() or its low-level
equivalent in their implementations.
Ordered Memory Accesses
=======================
The Linux kernel provides a wide variety of ordered memory accesses:
a. Release operations.
b. Acquire operations.
c. RCU read-side ordering.
d. Control dependencies.
Each of the above categories has its own section below.
Release Operations
------------------
Release operations include smp_store_release(), atomic_set_release(),
rcu_assign_pointer(), and value-returning RMW operations whose names
end in _release. These operations order their own store against all
of the CPU's prior memory accesses. Release operations often provide
improved readability and performance compared to explicit barriers.
For example, use of smp_store_release() saves a line compared to the
smp_wmb() example above:
WRITE_ONCE(x, 1);
smp_store_release(&y, 1);
More important, smp_store_release() makes it easier to connect up the
different pieces of the concurrent algorithm. The variable stored to
by the smp_store_release(), in this case "y", will normally be used in
an acquire operation in other parts of the concurrent algorithm.
To see the performance advantages, suppose that the above example reads
from "x" instead of writing to it. Then an smp_wmb() could not guarantee
ordering, and an smp_mb() would be needed instead:
r1 = READ_ONCE(x);
smp_mb();
WRITE_ONCE(y, 1);
But smp_mb() often incurs much higher overhead than does
smp_store_release(), which still provides the needed ordering of "x"
against "y". On x86, the version using smp_store_release() might compile
to a simple load instruction followed by a simple store instruction.
In contrast, the smp_mb() compiles to an expensive instruction that
provides the needed ordering.
There is a wide variety of release operations:
o Store operations, including not only the aforementioned
smp_store_release(), but also atomic_set_release(), and
atomic_long_set_release().
o RCU's rcu_assign_pointer() operation. This is the same as
smp_store_release() except that: (1) It takes the pointer to
be assigned to instead of a pointer to that pointer, (2) It
is intended to be used in conjunction with rcu_dereference()
and similar rather than smp_load_acquire(), and (3) It checks
for an RCU-protected pointer in "sparse" runs.
o Value-returning RMW operations whose names end in _release,
such as atomic_fetch_add_release() and cmpxchg_release().
Note that release ordering is guaranteed only against the
memory-store portion of the RMW operation, and not against the
memory-load portion. Note also that conditional operations such
as cmpxchg_release() are only guaranteed to provide ordering
when they succeed.
As mentioned earlier, release operations are often paired with acquire
operations, which are the subject of the next section.
Acquire Operations
------------------
Acquire operations include smp_load_acquire(), atomic_read_acquire(),
and value-returning RMW operations whose names end in _acquire. These
operations order their own load against all of the CPU's subsequent
memory accesses. Acquire operations often provide improved performance
and readability compared to explicit barriers. For example, use of
smp_load_acquire() saves a line compared to the smp_rmb() example above:
r0 = smp_load_acquire(&y);
r1 = READ_ONCE(x);
As with smp_store_release(), this also makes it easier to connect
the different pieces of the concurrent algorithm by looking for the
smp_store_release() that stores to "y". In addition, smp_load_acquire()
improves upon smp_rmb() by ordering against subsequent stores as well
as against subsequent loads.
There are a couple of categories of acquire operations:
o Load operations, including not only the aforementioned
smp_load_acquire(), but also atomic_read_acquire(), and
atomic64_read_acquire().
o Value-returning RMW operations whose names end in _acquire,
such as atomic_xchg_acquire() and atomic_cmpxchg_acquire().
Note that acquire ordering is guaranteed only against the
memory-load portion of the RMW operation, and not against the
memory-store portion. Note also that conditional operations
such as atomic_cmpxchg_acquire() are only guaranteed to provide
ordering when they succeed.
Symmetry being what it is, acquire operations are often paired with the
release operations covered earlier. For example, consider the following
example, where task0() and task1() execute concurrently:
void task0(void)
{
WRITE_ONCE(x, 1);
smp_store_release(&y, 1);
}
void task1(void)
{
r0 = smp_load_acquire(&y);
r1 = READ_ONCE(x);
}
If "x" and "y" are both initially zero, then either r0's final value
will be zero or r1's final value will be one, thus providing the required
ordering.
RCU Read-Side Ordering
----------------------
This category includes read-side markers such as rcu_read_lock()
and rcu_read_unlock() as well as pointer-traversal primitives such as
rcu_dereference() and srcu_dereference().
Compared to locking primitives and RMW atomic operations, markers
for RCU read-side critical sections incur very low overhead because
they interact only with the corresponding grace-period primitives.
For example, the rcu_read_lock() and rcu_read_unlock() markers interact
with synchronize_rcu(), synchronize_rcu_expedited(), and call_rcu().
The way this works is that if a given call to synchronize_rcu() cannot
prove that it started before a given call to rcu_read_lock(), then
that synchronize_rcu() must block until the matching rcu_read_unlock()
is reached. For more information, please see the synchronize_rcu()
docbook header comment and the material in Documentation/RCU.
RCU's pointer-traversal primitives, including rcu_dereference() and
srcu_dereference(), order their load (which must be a pointer) against any
of the CPU's subsequent memory accesses whose address has been calculated
from the value loaded. There is said to be an *address dependency*
from the value returned by the rcu_dereference() or srcu_dereference()
to that subsequent memory access.
A call to rcu_dereference() for a given RCU-protected pointer is
usually paired with a call to rcu_assign_pointer() for that same pointer
in much the same way that a call to smp_load_acquire() is paired with
a call to smp_store_release(). Calls to rcu_dereference() and
rcu_assign_pointer() are often buried in other APIs, for example,
the RCU list API members defined in include/linux/rculist.h. For more
information, please see the docbook headers in that file, the most
recent LWN article on the RCU API (https://lwn.net/Articles/988638/),
and of course the material in Documentation/RCU.
If the pointer value is manipulated between the rcu_dereference()
that returned it and a later rcu_dereference(), please read
Documentation/RCU/rcu_dereference.rst. It can also be quite helpful to
review uses in the Linux kernel.
Control Dependencies
--------------------
A control dependency extends from a marked load (READ_ONCE() or stronger)
through an "if" condition to a marked store (WRITE_ONCE() or stronger)
that is executed only by one of the legs of that "if" statement.
Control dependencies are so named because they are mediated by
control-flow instructions such as comparisons and conditional branches.
In short, you can use a control dependency to enforce ordering between
an READ_ONCE() and a WRITE_ONCE() when there is an "if" condition
between them. The canonical example is as follows:
q = READ_ONCE(a);
if (q)
WRITE_ONCE(b, 1);
In this case, all CPUs would see the read from "a" as happening before
the write to "b".
However, control dependencies are easily destroyed by compiler
optimizations, so any use of control dependencies must take into account
all of the compilers used to build the Linux kernel. Please see the
"control-dependencies.txt" file for more information.
Unordered Accesses
==================
Each of these two categories of unordered accesses has a section below:
a. Unordered marked operations.
b. Unmarked C-language accesses.
Unordered Marked Operations
---------------------------
Unordered operations to different variables are just that, unordered.
However, if a group of CPUs apply these operations to a single variable,
all the CPUs will agree on the operation order. Of course, the ordering
of unordered marked accesses can also be constrained using the mechanisms
described earlier in this document.
These operations come in three categories:
o Marked writes, such as WRITE_ONCE() and atomic_set(). These
primitives require the compiler to emit the corresponding store
instructions in the expected execution order, thus suppressing
a number of destructive optimizations. However, they provide no
hardware ordering guarantees, and in fact many CPUs will happily
reorder marked writes with each other or with other unordered
operations, unless these operations are to the same variable.
o Marked reads, such as READ_ONCE() and atomic_read(). These
primitives require the compiler to emit the corresponding load
instructions in the expected execution order, thus suppressing
a number of destructive optimizations. However, they provide no
hardware ordering guarantees, and in fact many CPUs will happily
reorder marked reads with each other or with other unordered
operations, unless these operations are to the same variable.
o Unordered RMW atomic operations. These are non-value-returning
RMW atomic operations whose names do not end in _acquire or
_release, and also value-returning RMW operations whose names
end in _relaxed. Examples include atomic_add(), atomic_or(),
and atomic64_fetch_xor_relaxed(). These operations do carry
out the specified RMW operation atomically, for example, five
concurrent atomic_inc() operations applied to a given variable
will reliably increase the value of that variable by five.
However, many CPUs will happily reorder these operations with
each other or with other unordered operations.
This category of operations can be efficiently ordered using
smp_mb__before_atomic() and smp_mb__after_atomic(), as was
discussed in the "RMW Ordering Augmentation Barriers" section.
In short, these operations can be freely reordered unless they are all
operating on a single variable or unless they are constrained by one of
the operations called out earlier in this document.
Unmarked C-Language Accesses
----------------------------
Unmarked C-language accesses are normal variable accesses to normal
variables, that is, to variables that are not "volatile" and are not
C11 atomic variables. These operations provide no ordering guarantees,
and further do not guarantee "atomic" access. For example, the compiler
might (and sometimes does) split a plain C-language store into multiple
smaller stores. A load from that same variable running on some other
CPU while such a store is executing might see a value that is a mashup
of the old value and the new value.
Unmarked C-language accesses are unordered, and are also subject to
any number of compiler optimizations, many of which can break your
concurrent code. It is possible to use unmarked C-language accesses for
shared variables that are subject to concurrent access, but great care
is required on an ongoing basis. The compiler-constraining barrier()
primitive can be helpful, as can the various ordering primitives discussed
in this document. It nevertheless bears repeating that use of unmarked
C-language accesses requires careful attention to not just your code,
but to all the compilers that might be used to build it. Such compilers
might replace a series of loads with a single load, and might replace
a series of stores with a single store. Some compilers will even split
a single store into multiple smaller stores.
But there are some ways of using unmarked C-language accesses for shared
variables without such worries:
o Guard all accesses to a given variable by a particular lock,
so that there are never concurrent conflicting accesses to
that variable. (There are "conflicting accesses" when
(1) at least one of the concurrent accesses to a variable is an
unmarked C-language access and (2) when at least one of those
accesses is a write, whether marked or not.)
o As above, but using other synchronization primitives such
as reader-writer locks or sequence locks.
o Use locking or other means to ensure that all concurrent accesses
to a given variable are reads.
o Restrict use of a given variable to statistics or heuristics
where the occasional bogus value can be tolerated.
o Declare the accessed variables as C11 atomics.
https://lwn.net/Articles/691128/
o Declare the accessed variables as "volatile".
If you need to live more dangerously, please do take the time to
understand the compilers. One place to start is these two LWN
articles:
Who's afraid of a big bad optimizing compiler?
https://lwn.net/Articles/793253
Calibrating your fear of big bad optimizing compilers
https://lwn.net/Articles/799218
Used properly, unmarked C-language accesses can reduce overhead on
fastpaths. However, the price is great care and continual attention
to your compiler as new versions come out and as new optimizations
are enabled.
README (for LKMM Documentation)
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/README.
It has been said that successful communication requires first identifying
what your audience knows and then building a bridge from their current
knowledge to what they need to know. Unfortunately, the expected
Linux-kernel memory model (LKMM) audience might be anywhere from novice
to expert both in kernel hacking and in understanding LKMM.
This document therefore points out a number of places to start reading,
depending on what you know and what you would like to learn. Please note
that the documents later in this list assume that the reader understands
the material provided by documents earlier in this list.
If LKMM-specific terms lost you, glossary.txt might help you.
o You are new to Linux-kernel concurrency: simple.txt
o You have some background in Linux-kernel concurrency, and would
like an overview of the types of low-level concurrency primitives
that the Linux kernel provides: ordering.txt
Here, "low level" means atomic operations to single variables.
o You are familiar with the Linux-kernel concurrency primitives
that you need, and just want to get started with LKMM litmus
tests: litmus-tests.txt
o You need to locklessly access shared variables that are otherwise
protected by a lock: locking.txt
This locking.txt file expands on the "Locking" section in
recipes.txt, but is self-contained.
o You are familiar with Linux-kernel concurrency, and would
like a detailed intuitive understanding of LKMM, including
situations involving more than two threads: recipes.txt
o You would like a detailed understanding of what your compiler can
and cannot do to control dependencies: control-dependencies.txt
o You would like to mark concurrent normal accesses to shared
variables so that intentional "racy" accesses can be properly
documented, especially when you are responding to complaints
from KCSAN: access-marking.txt
o You are familiar with Linux-kernel concurrency and the use of
LKMM, and would like a quick reference: cheatsheet.txt
o You are familiar with Linux-kernel concurrency and the use
of LKMM, and would like to learn about LKMM's requirements,
rationale, and implementation: explanation.txt and
herd-representation.txt
o You are interested in the publications related to LKMM, including
hardware manuals, academic literature, standards-committee
working papers, and LWN articles: references.txt
====================
DESCRIPTION OF FILES
====================
README
This file.
access-marking.txt
Guidelines for marking intentionally concurrent accesses to
shared memory.
cheatsheet.txt
Quick-reference guide to the Linux-kernel memory model.
control-dependencies.txt
Guide to preventing compiler optimizations from destroying
your control dependencies.
explanation.txt
Detailed description of the memory model.
glossary.txt
Brief definitions of LKMM-related terms.
herd-representation.txt
The (abstract) representation of the Linux-kernel concurrency
primitives in terms of events.
litmus-tests.txt
The format, features, capabilities, and limitations of the litmus
tests that LKMM can evaluate.
locking.txt
Rules for accessing lock-protected shared variables outside of
their corresponding critical sections.
ordering.txt
Overview of the Linux kernel's low-level memory-ordering
primitives by category.
recipes.txt
Common memory-ordering patterns.
references.txt
Background information.
simple.txt
Starting point for someone new to Linux-kernel concurrency.
And also a reminder of the simpler approaches to concurrency!
Recipes
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/recipes.txt.
This document provides "recipes", that is, litmus tests for commonly
occurring situations, as well as a few that illustrate subtly broken but
attractive nuisances. Many of these recipes include example code from
v5.7 of the Linux kernel.
The first section covers simple special cases, the second section
takes off the training wheels to cover more involved examples,
and the third section provides a few rules of thumb.
Simple special cases
====================
This section presents two simple special cases, the first being where
there is only one CPU or only one memory location is accessed, and the
second being use of that old concurrency workhorse, locking.
Single CPU or single memory location
------------------------------------
If there is only one CPU on the one hand or only one variable
on the other, the code will execute in order. There are (as
usual) some things to be careful of:
1. Some aspects of the C language are unordered. For example,
in the expression "f(x) + g(y)", the order in which f and g are
called is not defined; the object code is allowed to use either
order or even to interleave the computations.
2. Compilers are permitted to use the "as-if" rule. That is, a
compiler can emit whatever code it likes for normal accesses,
as long as the results of a single-threaded execution appear
just as if the compiler had followed all the relevant rules.
To see this, compile with a high level of optimization and run
the debugger on the resulting binary.
3. If there is only one variable but multiple CPUs, that variable
must be properly aligned and all accesses to that variable must
be full sized. Variables that straddle cachelines or pages void
your full-ordering warranty, as do undersized accesses that load
from or store to only part of the variable.
4. If there are multiple CPUs, accesses to shared variables should
use READ_ONCE() and WRITE_ONCE() or stronger to prevent load/store
tearing, load/store fusing, and invented loads and stores.
There are exceptions to this rule, including:
i. When there is no possibility of a given shared variable
being updated by some other CPU, for example, while
holding the update-side lock, reads from that variable
need not use READ_ONCE().
ii. When there is no possibility of a given shared variable
being either read or updated by other CPUs, for example,
when running during early boot, reads from that variable
need not use READ_ONCE() and writes to that variable
need not use WRITE_ONCE().
Locking
-------
[!] Note:
locking.txt expands on this section, providing more detail on
locklessly accessing lock-protected shared variables.
Locking is well-known and straightforward, at least if you don't think
about it too hard. And the basic rule is indeed quite simple: Any CPU that
has acquired a given lock sees any changes previously seen or made by any
CPU before it released that same lock. Note that this statement is a bit
stronger than "Any CPU holding a given lock sees all changes made by any
CPU during the time that CPU was holding this same lock". For example,
consider the following pair of code fragments:
/* See MP+polocks.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
spin_lock(&mylock);
WRITE_ONCE(y, 1);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
r0 = READ_ONCE(y);
spin_unlock(&mylock);
r1 = READ_ONCE(x);
}
The basic rule guarantees that if CPU0() acquires mylock before CPU1(),
then both r0 and r1 must be set to the value 1. This also has the
consequence that if the final value of r0 is equal to 1, then the final
value of r1 must also be equal to 1. In contrast, the weaker rule would
say nothing about the final value of r1.
The converse to the basic rule also holds, as illustrated by the
following litmus test:
/* See MP+porevlocks.litmus. */
void CPU0(void)
{
r0 = READ_ONCE(y);
spin_lock(&mylock);
r1 = READ_ONCE(x);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
WRITE_ONCE(x, 1);
spin_unlock(&mylock);
WRITE_ONCE(y, 1);
}
This converse to the basic rule guarantees that if CPU0() acquires
mylock before CPU1(), then both r0 and r1 must be set to the value 0.
This also has the consequence that if the final value of r1 is equal
to 0, then the final value of r0 must also be equal to 0. In contrast,
the weaker rule would say nothing about the final value of r0.
These examples show only a single pair of CPUs, but the effects of the
locking basic rule extend across multiple acquisitions of a given lock
across multiple CPUs.
However, it is not necessarily the case that accesses ordered by
locking will be seen as ordered by CPUs not holding that lock.
Consider this example:
/* See Z6.0+pooncelock+pooncelock+pombonce.litmus. */
void CPU0(void)
{
spin_lock(&mylock);
WRITE_ONCE(x, 1);
WRITE_ONCE(y, 1);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
r0 = READ_ONCE(y);
WRITE_ONCE(z, 1);
spin_unlock(&mylock);
}
void CPU2(void)
{
WRITE_ONCE(z, 2);
smp_mb();
r1 = READ_ONCE(x);
}
Counter-intuitive though it might be, it is quite possible to have
the final value of r0 be 1, the final value of z be 2, and the final
value of r1 be 0. The reason for this surprising outcome is that
CPU2() never acquired the lock, and thus did not benefit from the
lock's ordering properties.
Ordering can be extended to CPUs not holding the lock by careful use
of smp_mb__after_spinlock():
/* See Z6.0+pooncelock+poonceLock+pombonce.litmus. */
void CPU0(void)
{
spin_lock(&mylock);
WRITE_ONCE(x, 1);
WRITE_ONCE(y, 1);
spin_unlock(&mylock);
}
void CPU1(void)
{
spin_lock(&mylock);
smp_mb__after_spinlock();
r0 = READ_ONCE(y);
WRITE_ONCE(z, 1);
spin_unlock(&mylock);
}
void CPU2(void)
{
WRITE_ONCE(z, 2);
smp_mb();
r1 = READ_ONCE(x);
}
This addition of smp_mb__after_spinlock() strengthens the lock acquisition
sufficiently to rule out the counter-intuitive outcome.
Taking off the training wheels
==============================
This section looks at more complex examples, including message passing,
load buffering, release-acquire chains, store buffering.
Many classes of litmus tests have abbreviated names, which may be found
here: https://www.cl.cam.ac.uk/~pes20/ppc-supplemental/test6.pdf
Message passing (MP)
--------------------
The MP pattern has one CPU execute a pair of stores to a pair of variables
and another CPU execute a pair of loads from this same pair of variables,
but in the opposite order. The goal is to avoid the counter-intuitive
outcome in which the first load sees the value written by the second store
but the second load does not see the value written by the first store.
In the absence of any ordering, this goal may not be met, as can be seen
in the MP+poonceonces.litmus litmus test. This section therefore looks at
a number of ways of meeting this goal.
Release and acquire
~~~~~~~~~~~~~~~~~~~
Use of smp_store_release() and smp_load_acquire() is one way to force
the desired MP ordering. The general approach is shown below:
/* See MP+pooncerelease+poacquireonce.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
smp_store_release(&y, 1);
}
void CPU1(void)
{
r0 = smp_load_acquire(&y);
r1 = READ_ONCE(x);
}
The smp_store_release() macro orders any prior accesses against the
store, while the smp_load_acquire macro orders the load against any
subsequent accesses. Therefore, if the final value of r0 is the value 1,
the final value of r1 must also be the value 1.
The init_stack_slab() function in lib/stackdepot.c uses release-acquire
in this way to safely initialize of a slab of the stack. Working out
the mutual-exclusion design is left as an exercise for the reader.
Assign and dereference
~~~~~~~~~~~~~~~~~~~~~~
Use of rcu_assign_pointer() and rcu_dereference() is quite similar to the
use of smp_store_release() and smp_load_acquire(), except that both
rcu_assign_pointer() and rcu_dereference() operate on RCU-protected
pointers. The general approach is shown below:
/* See MP+onceassign+derefonce.litmus. */
int z;
int *y = &z;
int x;
void CPU0(void)
{
WRITE_ONCE(x, 1);
rcu_assign_pointer(y, &x);
}
void CPU1(void)
{
rcu_read_lock();
r0 = rcu_dereference(y);
r1 = READ_ONCE(*r0);
rcu_read_unlock();
}
In this example, if the final value of r0 is &x then the final value of
r1 must be 1.
The rcu_assign_pointer() macro has the same ordering properties as does
smp_store_release(), but the rcu_dereference() macro orders the load only
against later accesses that depend on the value loaded. A dependency
is present if the value loaded determines the address of a later access
(address dependency, as shown above), the value written by a later store
(data dependency), or whether or not a later store is executed in the
first place (control dependency). Note that the term "data dependency"
is sometimes casually used to cover both address and data dependencies.
In lib/math/prime_numbers.c, the expand_to_next_prime() function invokes
rcu_assign_pointer(), and the next_prime_number() function invokes
rcu_dereference(). This combination mediates access to a bit vector
that is expanded as additional primes are needed.
Write and read memory barriers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is usually better to use smp_store_release() instead of smp_wmb()
and to use smp_load_acquire() instead of smp_rmb(). However, the older
smp_wmb() and smp_rmb() APIs are still heavily used, so it is important
to understand their use cases. The general approach is shown below:
/* See MP+fencewmbonceonce+fencermbonceonce.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
smp_wmb();
WRITE_ONCE(y, 1);
}
void CPU1(void)
{
r0 = READ_ONCE(y);
smp_rmb();
r1 = READ_ONCE(x);
}
The smp_wmb() macro orders prior stores against later stores, and the
smp_rmb() macro orders prior loads against later loads. Therefore, if
the final value of r0 is 1, the final value of r1 must also be 1.
The xlog_state_switch_iclogs() function in fs/xfs/xfs_log.c contains
the following write-side code fragment:
log->l_curr_block -= log->l_logBBsize;
ASSERT(log->l_curr_block >= 0);
smp_wmb();
log->l_curr_cycle++;
And the xlog_valid_lsn() function in fs/xfs/xfs_log_priv.h contains
the corresponding read-side code fragment:
cur_cycle = READ_ONCE(log->l_curr_cycle);
smp_rmb();
cur_block = READ_ONCE(log->l_curr_block);
Alternatively, consider the following comment in function
perf_output_put_handle() in kernel/events/ring_buffer.c:
* kernel user
*
* if (LOAD ->data_tail) { LOAD ->data_head
* (A) smp_rmb() (C)
* STORE $data LOAD $data
* smp_wmb() (B) smp_mb() (D)
* STORE ->data_head STORE ->data_tail
* }
The B/C pairing is an example of the MP pattern using smp_wmb() on the
write side and smp_rmb() on the read side.
Of course, given that smp_mb() is strictly stronger than either smp_wmb()
or smp_rmb(), any code fragment that would work with smp_rmb() and
smp_wmb() would also work with smp_mb() replacing either or both of the
weaker barriers.
Load buffering (LB)
-------------------
The LB pattern has one CPU load from one variable and then store to a
second, while another CPU loads from the second variable and then stores
to the first. The goal is to avoid the counter-intuitive situation where
each load reads the value written by the other CPU's store. In the
absence of any ordering it is quite possible that this may happen, as
can be seen in the LB+poonceonces.litmus litmus test.
One way of avoiding the counter-intuitive outcome is through the use of a
control dependency paired with a full memory barrier:
/* See LB+fencembonceonce+ctrlonceonce.litmus. */
void CPU0(void)
{
r0 = READ_ONCE(x);
if (r0)
WRITE_ONCE(y, 1);
}
void CPU1(void)
{
r1 = READ_ONCE(y);
smp_mb();
WRITE_ONCE(x, 1);
}
This pairing of a control dependency in CPU0() with a full memory
barrier in CPU1() prevents r0 and r1 from both ending up equal to 1.
The A/D pairing from the ring-buffer use case shown earlier also
illustrates LB. Here is a repeat of the comment in
perf_output_put_handle() in kernel/events/ring_buffer.c, showing a
control dependency on the kernel side and a full memory barrier on
the user side:
* kernel user
*
* if (LOAD ->data_tail) { LOAD ->data_head
* (A) smp_rmb() (C)
* STORE $data LOAD $data
* smp_wmb() (B) smp_mb() (D)
* STORE ->data_head STORE ->data_tail
* }
*
* Where A pairs with D, and B pairs with C.
The kernel's control dependency between the load from ->data_tail
and the store to data combined with the user's full memory barrier
between the load from data and the store to ->data_tail prevents
the counter-intuitive outcome where the kernel overwrites the data
before the user gets done loading it.
Release-acquire chains
----------------------
Release-acquire chains are a low-overhead, flexible, and easy-to-use
method of maintaining order. However, they do have some limitations that
need to be fully understood. Here is an example that maintains order:
/* See ISA2+pooncerelease+poacquirerelease+poacquireonce.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
smp_store_release(&y, 1);
}
void CPU1(void)
{
r0 = smp_load_acquire(y);
smp_store_release(&z, 1);
}
void CPU2(void)
{
r1 = smp_load_acquire(z);
r2 = READ_ONCE(x);
}
In this case, if r0 and r1 both have final values of 1, then r2 must
also have a final value of 1.
The ordering in this example is stronger than it needs to be. For
example, ordering would still be preserved if CPU1()'s smp_load_acquire()
invocation was replaced with READ_ONCE().
It is tempting to assume that CPU0()'s store to x is globally ordered
before CPU1()'s store to z, but this is not the case:
/* See Z6.0+pooncerelease+poacquirerelease+mbonceonce.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
smp_store_release(&y, 1);
}
void CPU1(void)
{
r0 = smp_load_acquire(y);
smp_store_release(&z, 1);
}
void CPU2(void)
{
WRITE_ONCE(z, 2);
smp_mb();
r1 = READ_ONCE(x);
}
One might hope that if the final value of r0 is 1 and the final value
of z is 2, then the final value of r1 must also be 1, but it really is
possible for r1 to have the final value of 0. The reason, of course,
is that in this version, CPU2() is not part of the release-acquire chain.
This situation is accounted for in the rules of thumb below.
Despite this limitation, release-acquire chains are low-overhead as
well as simple and powerful, at least as memory-ordering mechanisms go.
Store buffering
---------------
Store buffering can be thought of as upside-down load buffering, so
that one CPU first stores to one variable and then loads from a second,
while another CPU stores to the second variable and then loads from the
first. Preserving order requires nothing less than full barriers:
/* See SB+fencembonceonces.litmus. */
void CPU0(void)
{
WRITE_ONCE(x, 1);
smp_mb();
r0 = READ_ONCE(y);
}
void CPU1(void)
{
WRITE_ONCE(y, 1);
smp_mb();
r1 = READ_ONCE(x);
}
Omitting either smp_mb() will allow both r0 and r1 to have final
values of 0, but providing both full barriers as shown above prevents
this counter-intuitive outcome.
This pattern most famously appears as part of Dekker's locking
algorithm, but it has a much more practical use within the Linux kernel
of ordering wakeups. The following comment taken from waitqueue_active()
in include/linux/wait.h shows the canonical pattern:
* CPU0 - waker CPU1 - waiter
*
* for (;;) {
* @cond = true; prepare_to_wait(&wq_head, &wait, state);
* smp_mb(); // smp_mb() from set_current_state()
* if (waitqueue_active(wq_head)) if (@cond)
* wake_up(wq_head); break;
* schedule();
* }
* finish_wait(&wq_head, &wait);
On CPU0, the store is to @cond and the load is in waitqueue_active().
On CPU1, prepare_to_wait() contains both a store to wq_head and a call
to set_current_state(), which contains an smp_mb() barrier; the load is
"if (@cond)". The full barriers prevent the undesirable outcome where
CPU1 puts the waiting task to sleep and CPU0 fails to wake it up.
Note that use of locking can greatly simplify this pattern.
Rules of thumb
==============
There might seem to be no pattern governing what ordering primitives are
needed in which situations, but this is not the case. There is a pattern
based on the relation between the accesses linking successive CPUs in a
given litmus test. There are three types of linkage:
1. Write-to-read, where the next CPU reads the value that the
previous CPU wrote. The LB litmus-test patterns contain only
this type of relation. In formal memory-modeling texts, this
relation is called "reads-from" and is usually abbreviated "rf".
2. Read-to-write, where the next CPU overwrites the value that the
previous CPU read. The SB litmus test contains only this type
of relation. In formal memory-modeling texts, this relation is
often called "from-reads" and is sometimes abbreviated "fr".
3. Write-to-write, where the next CPU overwrites the value written
by the previous CPU. The Z6.0 litmus test pattern contains a
write-to-write relation between the last access of CPU1() and
the first access of CPU2(). In formal memory-modeling texts,
this relation is often called "coherence order" and is sometimes
abbreviated "co". In the C++ standard, it is instead called
"modification order" and often abbreviated "mo".
The strength of memory ordering required for a given litmus test to
avoid a counter-intuitive outcome depends on the types of relations
linking the memory accesses for the outcome in question:
o If all links are write-to-read links, then the weakest
possible ordering within each CPU suffices. For example, in
the LB litmus test, a control dependency was enough to do the
job.
o If all but one of the links are write-to-read links, then a
release-acquire chain suffices. Both the MP and the ISA2
litmus tests illustrate this case.
o If more than one of the links are something other than
write-to-read links, then a full memory barrier is required
between each successive pair of non-write-to-read links. This
case is illustrated by the Z6.0 litmus tests, both in the
locking and in the release-acquire sections.
However, if you find yourself having to stretch these rules of thumb
to fit your situation, you should consider creating a litmus test and
running it on the model.
References
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/references.txt.
This document provides background reading for memory models and related
tools. These documents are aimed at kernel hackers who are interested
in memory models.
Hardware manuals and models
===========================
o SPARC International Inc. (Ed.). 1994. "The SPARC Architecture
Reference Manual Version 9". SPARC International Inc.
o Compaq Computer Corporation (Ed.). 2002. "Alpha Architecture
Reference Manual". Compaq Computer Corporation.
o Intel Corporation (Ed.). 2002. "A Formal Specification of Intel
Itanium Processor Family Memory Ordering". Intel Corporation.
o Intel Corporation (Ed.). 2002. "Intel 64 and IA-32 Architectures
Software Developer’s Manual". Intel Corporation.
o Peter Sewell, Susmit Sarkar, Scott Owens, Francesco Zappa Nardelli,
and Magnus O. Myreen. 2010. "x86-TSO: A Rigorous and Usable
Programmer's Model for x86 Multiprocessors". Commun. ACM 53, 7
(July, 2010), 89-97. http://doi.acm.org/10.1145/1785414.1785443
o IBM Corporation (Ed.). 2009. "Power ISA Version 2.06". IBM
Corporation.
o ARM Ltd. (Ed.). 2009. "ARM Barrier Litmus Tests and Cookbook".
ARM Ltd.
o Susmit Sarkar, Peter Sewell, Jade Alglave, Luc Maranget, and
Derek Williams. 2011. "Understanding POWER Multiprocessors". In
Proceedings of the 32Nd ACM SIGPLAN Conference on Programming
Language Design and Implementation (PLDI ’11). ACM, New York,
NY, USA, 175–186.
o Susmit Sarkar, Kayvan Memarian, Scott Owens, Mark Batty,
Peter Sewell, Luc Maranget, Jade Alglave, and Derek Williams.
2012. "Synchronising C/C++ and POWER". In Proceedings of the 33rd
ACM SIGPLAN Conference on Programming Language Design and
Implementation (PLDI '12). ACM, New York, NY, USA, 311-322.
o ARM Ltd. (Ed.). 2014. "ARM Architecture Reference Manual (ARMv8,
for ARMv8-A architecture profile)". ARM Ltd.
o Imagination Technologies, LTD. 2015. "MIPS(R) Architecture
For Programmers, Volume II-A: The MIPS64(R) Instruction,
Set Reference Manual". Imagination Technologies, LTD.
o Shaked Flur, Kathryn E. Gray, Christopher Pulte, Susmit
Sarkar, Ali Sezgin, Luc Maranget, Will Deacon, and Peter
Sewell. 2016. "Modelling the ARMv8 Architecture, Operationally:
Concurrency and ISA". In Proceedings of the 43rd Annual ACM
SIGPLAN-SIGACT Symposium on Principles of Programming Languages
(POPL ’16). ACM, New York, NY, USA, 608–621.
o Shaked Flur, Susmit Sarkar, Christopher Pulte, Kyndylan Nienhuis,
Luc Maranget, Kathryn E. Gray, Ali Sezgin, Mark Batty, and Peter
Sewell. 2017. "Mixed-size Concurrency: ARM, POWER, C/C++11,
and SC". In Proceedings of the 44th ACM SIGPLAN Symposium on
Principles of Programming Languages (POPL 2017). ACM, New York,
NY, USA, 429–442.
o Christopher Pulte, Shaked Flur, Will Deacon, Jon French,
Susmit Sarkar, and Peter Sewell. 2018. "Simplifying ARM concurrency:
multicopy-atomic axiomatic and operational models for ARMv8". In
Proceedings of the ACM on Programming Languages, Volume 2, Issue
POPL, Article No. 19. ACM, New York, NY, USA.
Linux-kernel memory model
=========================
o Jade Alglave, Will Deacon, Boqun Feng, David Howells, Daniel
Lustig, Luc Maranget, Paul E. McKenney, Andrea Parri, Nicholas
Piggin, Alan Stern, Akira Yokosawa, and Peter Zijlstra.
2019. "Calibrating your fear of big bad optimizing compilers"
Linux Weekly News. https://lwn.net/Articles/799218/
o Jade Alglave, Will Deacon, Boqun Feng, David Howells, Daniel
Lustig, Luc Maranget, Paul E. McKenney, Andrea Parri, Nicholas
Piggin, Alan Stern, Akira Yokosawa, and Peter Zijlstra.
2019. "Who's afraid of a big bad optimizing compiler?"
Linux Weekly News. https://lwn.net/Articles/793253/
o Jade Alglave, Luc Maranget, Paul E. McKenney, Andrea Parri, and
Alan Stern. 2018. "Frightening small children and disconcerting
grown-ups: Concurrency in the Linux kernel". In Proceedings of
the 23rd International Conference on Architectural Support for
Programming Languages and Operating Systems (ASPLOS 2018). ACM,
New York, NY, USA, 405-418. Webpage: http://diy.inria.fr/linux/.
o Jade Alglave, Luc Maranget, Paul E. McKenney, Andrea Parri, and
Alan Stern. 2017. "A formal kernel memory-ordering model (part 1)"
Linux Weekly News. https://lwn.net/Articles/718628/
o Jade Alglave, Luc Maranget, Paul E. McKenney, Andrea Parri, and
Alan Stern. 2017. "A formal kernel memory-ordering model (part 2)"
Linux Weekly News. https://lwn.net/Articles/720550/
o Jade Alglave, Luc Maranget, Paul E. McKenney, Andrea Parri, and
Alan Stern. 2017-2019. "A Formal Model of Linux-Kernel Memory
Ordering" (backup material for the LWN articles)
https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/LWNLinuxMM/
Memory-model tooling
====================
o Daniel Jackson. 2002. "Alloy: A Lightweight Object Modelling
Notation". ACM Trans. Softw. Eng. Methodol. 11, 2 (April 2002),
256–290. http://doi.acm.org/10.1145/505145.505149
o Jade Alglave, Luc Maranget, and Michael Tautschnig. 2014. "Herding
Cats: Modelling, Simulation, Testing, and Data Mining for Weak
Memory". ACM Trans. Program. Lang. Syst. 36, 2, Article 7 (July
2014), 7:1–7:74 pages.
o Jade Alglave, Patrick Cousot, and Luc Maranget. 2016. "Syntax and
semantics of the weak consistency model specification language
cat". CoRR abs/1608.07531 (2016). https://arxiv.org/abs/1608.07531
Memory-model comparisons
========================
o Paul E. McKenney, Ulrich Weigand, Andrea Parri, and Boqun
Feng. 2018. "Linux-Kernel Memory Model". (27 September 2018).
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0124r6.html.
Simple
Peios Kernel / Kernel development / Development tools / lkmm / docs
Literal include of tools/memory-model/Documentation/simple.txt.
This document provides options for those wishing to keep their
memory-ordering lives simple, as is necessary for those whose domain
is complex. After all, there are bugs other than memory-ordering bugs,
and the time spent gaining memory-ordering knowledge is not available
for gaining domain knowledge. Furthermore Linux-kernel memory model
(LKMM) is quite complex, with subtle differences in code often having
dramatic effects on correctness.
The options near the beginning of this list are quite simple. The idea
is not that kernel hackers don't already know about them, but rather
that they might need the occasional reminder.
Please note that this is a generic guide, and that specific subsystems
will often have special requirements or idioms. For example, developers
of MMIO-based device drivers will often need to use mb(), rmb(), and
wmb(), and therefore might find smp_mb(), smp_rmb(), and smp_wmb()
to be more natural than smp_load_acquire() and smp_store_release().
On the other hand, those coming in from other environments will likely
be more familiar with these last two.
Single-threaded code
====================
In single-threaded code, there is no reordering, at least assuming
that your toolchain and hardware are working correctly. In addition,
it is generally a mistake to assume your code will only run in a single
threaded context as the kernel can enter the same code path on multiple
CPUs at the same time. One important exception is a function that makes
no external data references.
In the general case, you will need to take explicit steps to ensure that
your code really is executed within a single thread that does not access
shared variables. A simple way to achieve this is to define a global lock
that you acquire at the beginning of your code and release at the end,
taking care to ensure that all references to your code's shared data are
also carried out under that same lock. Because only one thread can hold
this lock at a given time, your code will be executed single-threaded.
This approach is called "code locking".
Code locking can severely limit both performance and scalability, so it
should be used with caution, and only on code paths that execute rarely.
After all, a huge amount of effort was required to remove the Linux
kernel's old "Big Kernel Lock", so let's please be very careful about
adding new "little kernel locks".
One of the advantages of locking is that, in happy contrast with the
year 1981, almost all kernel developers are very familiar with locking.
The Linux kernel's lockdep (CONFIG_PROVE_LOCKING=y) is very helpful with
the formerly feared deadlock scenarios.
Please use the standard locking primitives provided by the kernel rather
than rolling your own. For one thing, the standard primitives interact
properly with lockdep. For another thing, these primitives have been
tuned to deal better with high contention. And for one final thing, it is
surprisingly hard to correctly code production-quality lock acquisition
and release functions. After all, even simple non-production-quality
locking functions must carefully prevent both the CPU and the compiler
from moving code in either direction across the locking function.
Despite the scalability limitations of single-threaded code, RCU
takes this approach for much of its grace-period processing and also
for early-boot operation. The reason RCU is able to scale despite
single-threaded grace-period processing is use of batching, where all
updates that accumulated during one grace period are handled by the
next one. In other words, slowing down grace-period processing makes
it more efficient. Nor is RCU unique: Similar batching optimizations
are used in many I/O operations.
Packaged code
=============
Even if performance and scalability concerns prevent your code from
being completely single-threaded, it is often possible to use library
functions that handle the concurrency nearly or entirely on their own.
This approach delegates any LKMM worries to the library maintainer.
In the kernel, what is the "library"? Quite a bit. It includes the
contents of the lib/ directory, much of the include/linux/ directory along
with a lot of other heavily used APIs. But heavily used examples include
the list macros (for example, include/linux/{,rcu}list.h), workqueues,
smp_call_function(), and the various hash tables and search trees.
Data locking
============
With code locking, we use single-threaded code execution to guarantee
serialized access to the data that the code is accessing. However,
we can also achieve this by instead associating the lock with specific
instances of the data structures. This creates a "critical section"
in the code execution that will execute as though it is single threaded.
By placing all the accesses and modifications to a shared data structure
inside a critical section, we ensure that the execution context that
holds the lock has exclusive access to the shared data.
The poster boy for this approach is the hash table, where placing a lock
in each hash bucket allows operations on different buckets to proceed
concurrently. This works because the buckets do not overlap with each
other, so that an operation on one bucket does not interfere with any
other bucket.
As the number of buckets increases, data locking scales naturally.
In particular, if the amount of data increases with the number of CPUs,
increasing the number of buckets as the number of CPUs increase results
in a naturally scalable data structure.
Per-CPU processing
==================
Partitioning processing and data over CPUs allows each CPU to take
a single-threaded approach while providing excellent performance and
scalability. Of course, there is no free lunch: The dark side of this
excellence is substantially increased memory footprint.
In addition, it is sometimes necessary to occasionally update some global
view of this processing and data, in which case something like locking
must be used to protect this global view. This is the approach taken
by the percpu_counter infrastructure. In many cases, there are already
generic/library variants of commonly used per-cpu constructs available.
Please use them rather than rolling your own.
RCU uses DEFINE_PER_CPU*() declaration to create a number of per-CPU
data sets. For example, each CPU does private quiescent-state processing
within its instance of the per-CPU rcu_data structure, and then uses data
locking to report quiescent states up the grace-period combining tree.
Packaged primitives: Sequence locking
=====================================
Lockless programming is considered by many to be more difficult than
lock-based programming, but there are a few lockless design patterns that
have been built out into an API. One of these APIs is sequence locking.
Although this API can be used in extremely complex ways, there are simple
and effective ways of using it that avoid the need to pay attention to
memory ordering.
The basic keep-things-simple rule for sequence locking is "do not write
in read-side code". Yes, you can do writes from within sequence-locking
readers, but it won't be so simple. For example, such writes will be
lockless and should be idempotent.
For more sophisticated use cases, LKMM can guide you, including use
cases involving combining sequence locking with other synchronization
primitives. (LKMM does not yet know about sequence locking, so it is
currently necessary to open-code it in your litmus tests.)
Additional information may be found in include/linux/seqlock.h.
Packaged primitives: RCU
========================
Another lockless design pattern that has been baked into an API
is RCU. The Linux kernel makes sophisticated use of RCU, but the
keep-things-simple rules for RCU are "do not write in read-side code"
and "do not update anything that is visible to and accessed by readers",
and "protect updates with locking".
These rules are illustrated by the functions foo_update_a() and
foo_get_a() shown in Documentation/RCU/whatisRCU.rst. Additional
RCU usage patterns maybe found in Documentation/RCU and in the
source code.
Packaged primitives: Atomic operations
======================================
Back in the day, the Linux kernel had three types of atomic operations:
1. Initialization and read-out, such as atomic_set() and atomic_read().
2. Operations that did not return a value and provided no ordering,
such as atomic_inc() and atomic_dec().
3. Operations that returned a value and provided full ordering, such as
atomic_add_return() and atomic_dec_and_test(). Note that some
value-returning operations provide full ordering only conditionally.
For example, cmpxchg() provides ordering only upon success.
More recent kernels have operations that return a value but do not
provide full ordering. These are flagged with either a _relaxed()
suffix (providing no ordering), or an _acquire() or _release() suffix
(providing limited ordering).
Additional information may be found in these files:
Documentation/atomic_t.txt
Documentation/atomic_bitops.txt
Documentation/core-api/refcount-vs-atomic.rst
Reading code using these primitives is often also quite helpful.
Lockless, fully ordered
=======================
When using locking, there often comes a time when it is necessary
to access some variable or another without holding the data lock
that serializes access to that variable.
If you want to keep things simple, use the initialization and read-out
operations from the previous section only when there are no racing
accesses. Otherwise, use only fully ordered operations when accessing
or modifying the variable. This approach guarantees that code prior
to a given access to that variable will be seen by all CPUs as having
happened before any code following any later access to that same variable.
Please note that per-CPU functions are not atomic operations and
hence they do not provide any ordering guarantees at all.
If the lockless accesses are frequently executed reads that are used
only for heuristics, or if they are frequently executed writes that
are used only for statistics, please see the next section.
Lockless statistics and heuristics
==================================
Unordered primitives such as atomic_read(), atomic_set(), READ_ONCE(), and
WRITE_ONCE() can safely be used in some cases. These primitives provide
no ordering, but they do prevent the compiler from carrying out a number
of destructive optimizations (for which please see the next section).
One example use for these primitives is statistics, such as per-CPU
counters exemplified by the rt_cache_stat structure's routing-cache
statistics counters. Another example use case is heuristics, such as
the jiffies_till_first_fqs and jiffies_till_next_fqs kernel parameters
controlling how often RCU scans for idle CPUs.
But be careful. "Unordered" really does mean "unordered". It is all
too easy to assume ordering, and this assumption must be avoided when
using these primitives.
Don't let the compiler trip you up
==================================
It can be quite tempting to use plain C-language accesses for lockless
loads from and stores to shared variables. Although this is both
possible and quite common in the Linux kernel, it does require a
surprising amount of analysis, care, and knowledge about the compiler.
Yes, some decades ago it was not unfair to consider a C compiler to be
an assembler with added syntax and better portability, but the advent of
sophisticated optimizing compilers mean that those days are long gone.
Today's optimizing compilers can profoundly rewrite your code during the
translation process, and have long been ready, willing, and able to do so.
Therefore, if you really need to use C-language assignments instead of
READ_ONCE(), WRITE_ONCE(), and so on, you will need to have a very good
understanding of both the C standard and your compiler. Here are some
introductory references and some tooling to start you on this noble quest:
Who's afraid of a big bad optimizing compiler?
https://lwn.net/Articles/793253/
Calibrating your fear of big bad optimizing compilers
https://lwn.net/Articles/799218/
Concurrency bugs should fear the big bad data-race detector (part 1)
https://lwn.net/Articles/816850/
Concurrency bugs should fear the big bad data-race detector (part 2)
https://lwn.net/Articles/816854/
More complex use cases
======================
If the alternatives above do not do what you need, please look at the
recipes.txt file to peel off the next layer of the memory-ordering
onion.
Fault-injection
Peios Kernel / Kernel development / Fault injection
Fault injection capabilities infrastructure
Peios Kernel / Kernel development / Fault injection
See also "every_nth" module option for scsi_debug.
Available fault injection capabilities #
-
failslab
injects slab allocation failures. (kmalloc(), kmem_cache_alloc(), ...)
-
fail_page_alloc
injects page allocation failures. (alloc_pages(), get_free_pages(), ...)
-
fail_usercopy
injects failures in user memory access functions. (copy_from_user(), get_user(), ...)
-
fail_futex
injects futex deadlock and uaddr fault errors.
-
fail_sunrpc
injects kernel RPC client and server failures.
-
fail_make_request
injects disk IO errors on devices permitted by setting /sys/block/<device>/make-it-fail or /sys/block/<device>/<partition>/make-it-fail. (submit_bio_noacct())
-
fail_mmc_request
injects MMC data errors on devices permitted by setting debugfs entries under /sys/kernel/debug/mmc0/fail_mmc_request
-
fail_function
injects error return on specific functions, which are marked by ALLOW_ERROR_INJECTION() macro, by setting debugfs entries under /sys/kernel/debug/fail_function. No boot option supported.
-
fail_skb_realloc
inject skb (socket buffer) reallocation events into the network path. The primary goal is to identify and prevent issues related to pointer mismanagement in the network subsystem. By forcing skb reallocation at strategic points, this feature creates scenarios where existing pointers to skb headers become invalid.
When the fault is injected and the reallocation is triggered, cached pointers to skb headers and data no longer reference valid memory locations. This deliberate invalidation helps expose code paths where proper pointer updating is neglected after a reallocation event.
By creating these controlled fault scenarios, the system can catch instances where stale pointers are used, potentially leading to memory corruption or system instability.
To select the interface to act on, write the network name to /sys/kernel/debug/fail_skb_realloc/devname. If this field is left empty (which is the default value), skb reallocation will be forced on all network interfaces.
The effectiveness of this fault detection is enhanced when KASAN is enabled, as it helps identify invalid memory references and use-after-free (UAF) issues.
-
NVMe fault injection
inject NVMe status code and retry flag on devices permitted by setting debugfs entries under /sys/kernel/debug/nvme*/fault_inject. The default status code is NVME_SC_INVALID_OPCODE with no retry. The status code and retry flag can be set via the debugfs.
-
Null test block driver fault injection
inject IO timeouts by setting config items under /sys/kernel/config/nullb/<disk>/timeout_inject, inject requeue requests by setting config items under /sys/kernel/config/nullb/<disk>/requeue_inject, and inject init_hctx() errors by setting config items under /sys/kernel/config/nullb/<disk>/init_hctx_fault_inject.
Configure fault-injection capabilities behavior #
debugfs entries #
fault-inject-debugfs kernel module provides some debugfs entries for runtime configuration of fault-injection capabilities.
-
/sys/kernel/debug/fail*/probability:
likelihood of failure injection, in percent.
Format: <percent>
Note that one-failure-per-hundred is a very high error rate for some testcases. Consider setting probability=100 and configure /sys/kernel/debug/fail*/interval for such testcases.
-
/sys/kernel/debug/fail*/interval:
specifies the interval between failures, for calls to should_fail() that pass all the other tests.
Note that if you enable this, by setting interval>1, you will probably want to set probability=100.
-
/sys/kernel/debug/fail*/times:
specifies how many times failures may happen at most. A value of -1 means "no limit".
-
/sys/kernel/debug/fail*/space:
specifies an initial resource "budget", decremented by "size" on each call to should_fail(,size). Failure injection is suppressed until "space" reaches zero.
-
/sys/kernel/debug/fail*/verbose
Format: { 0 | 1 | 2 }
specifies the verbosity of the messages when failure is injected. '0' means no messages; '1' will print only a single log line per failure; '2' will print a call trace too -- useful to debug the problems revealed by fault injection.
-
/sys/kernel/debug/fail*/task-filter:
Format: { 'Y' | 'N' }
A value of 'N' disables filtering by process (default). Any positive value limits failures to only processes indicated by /proc/<pid>/make-it-fail==1.
-
/sys/kernel/debug/fail*/require-start, /sys/kernel/debug/fail*/require-end, /sys/kernel/debug/fail*/reject-start, /sys/kernel/debug/fail*/reject-end:
specifies the range of virtual addresses tested during stacktrace walking. Failure is injected only if some caller in the walked stacktrace lies within the required range, and none lies within the rejected range. Default required range is [0,ULONG_MAX) (whole of virtual address space). Default rejected range is [0,0).
-
/sys/kernel/debug/fail*/stacktrace-depth:
specifies the maximum stacktrace depth walked during search for a caller within [require-start,require-end) OR [reject-start,reject-end).
-
/sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem:
Format: { 'Y' | 'N' }
default is 'Y', setting it to 'N' will also inject failures into highmem/user allocations (__GFP_HIGHMEM allocations).
-
-
/sys/kernel/debug/failslab/cache-filter
Format: { 'Y' | 'N' }
default is 'N', setting it to 'Y' will only inject failures when objects are requests from certain caches.
Select the cache by writing '1' to /sys/kernel/slab/<cache>/failslab:
-
-
/sys/kernel/debug/failslab/ignore-gfp-wait:
-
/sys/kernel/debug/fail_page_alloc/ignore-gfp-wait:
Format: { 'Y' | 'N' }
default is 'Y', setting it to 'N' will also inject failures into allocations that can sleep (__GFP_DIRECT_RECLAIM allocations).
-
/sys/kernel/debug/fail_page_alloc/min-order:
specifies the minimum page allocation order to be injected failures.
-
/sys/kernel/debug/fail_futex/ignore-private:
Format: { 'Y' | 'N' }
default is 'N', setting it to 'Y' will disable failure injections when dealing with private (address space) futexes.
-
/sys/kernel/debug/fail_sunrpc/ignore-client-disconnect:
Format: { 'Y' | 'N' }
default is 'N', setting it to 'Y' will disable disconnect injection on the RPC client.
-
/sys/kernel/debug/fail_sunrpc/ignore-server-disconnect:
Format: { 'Y' | 'N' }
default is 'N', setting it to 'Y' will disable disconnect injection on the RPC server.
-
/sys/kernel/debug/fail_sunrpc/ignore-cache-wait:
Format: { 'Y' | 'N' }
default is 'N', setting it to 'Y' will disable cache wait injection on the RPC server.
-
/sys/kernel/debug/fail_function/inject:
Format: { 'function-name' | '!function-name' | '' }
specifies the target function of error injection by name. If the function name leads '!' prefix, given function is removed from injection list. If nothing specified ('') injection list is cleared.
-
/sys/kernel/debug/fail_function/injectable:
(read only) shows error injectable functions and what type of error values can be specified. The error type will be one of below; - NULL: retval must be 0. - ERRNO: retval must be -1 to -MAX_ERRNO (-4096). - ERR_NULL: retval must be 0 or -1 to -MAX_ERRNO (-4096).
-
/sys/kernel/debug/fail_function/<function-name>/retval:
specifies the "error" return value to inject to the given function. This will be created when the user specifies a new injection entry. Note that this file only accepts unsigned values. So, if you want to use a negative errno, you better use 'printf' instead of 'echo', e.g.: $ printf %#x -12 > retval
-
/sys/kernel/debug/fail_skb_realloc/devname:
Specifies the network interface on which to force SKB reallocation. If left empty, SKB reallocation will be applied to all network interfaces.
Example usage:
# Force skb reallocation on eth0 echo "eth0" > /sys/kernel/debug/fail_skb_realloc/devname # Clear the selection and force skb reallocation on all interfaces echo "" > /sys/kernel/debug/fail_skb_realloc/devname
Boot option #
In order to inject faults while debugfs is not available (early boot time), use the boot option:
failslab=
fail_page_alloc=
fail_usercopy=
fail_make_request=
fail_futex=
fail_skb_realloc=
mmc_core.fail_request=<interval>,<probability>,<space>,<times>
proc entries #
-
/proc/<pid>/fail-nth, /proc/self/task/<tid>/fail-nth:
Write to this file of integer N makes N-th call in the task fail. Read from this file returns a integer value. A value of '0' indicates that the fault setup with a previous write to this file was injected. A positive integer N indicates that the fault wasn't yet injected. Note that this file enables all types of faults (slab, futex, etc). This setting takes precedence over all other generic debugfs settings like probability, interval, times, etc. But per-capability settings (e.g. fail_futex/ignore-private) take precedence over it.
This feature is intended for systematic testing of faults in a single system call. See an example below.
Error Injectable Functions #
This part is for the kernel developers considering to add a function to ALLOW_ERROR_INJECTION() macro.
Requirements for the Error Injectable Functions #
Since the function-level error injection forcibly changes the code path and returns an error even if the input and conditions are proper, this can cause unexpected kernel crash if you allow error injection on the function which is NOT error injectable. Thus, you (and reviewers) must ensure;
-
The function returns an error code if it fails, and the callers must check it correctly (need to recover from it).
-
The function does not execute any code which can change any state before the first error return. The state includes global or local, or input variable. For example, clear output address storage (e.g.
*ret = NULL), increments/decrements counter, set a flag, preempt/irq disable or get a lock (if those are recovered before returning error, that will be OK.)
The first requirement is important, and it will result in that the release (free objects) functions are usually harder to inject errors than allocate functions. If errors of such release functions are not correctly handled it will cause a memory leak easily (the caller will confuse that the object has been released or corrupted.)
The second one is for the caller which expects the function should always does something. Thus if the function error injection skips whole of the function, the expectation is betrayed and causes an unexpected error.
Type of the Error Injectable Functions #
Each error injectable functions will have the error type specified by the ALLOW_ERROR_INJECTION() macro. You have to choose it carefully if you add a new error injectable function. If the wrong error type is chosen, the kernel may crash because it may not be able to handle the error. There are 4 types of errors defined in include/asm-generic/error-injection.h
-
EI_ETYPE_NULL
This function will return
NULLif it fails. e.g. return an allocated object address. -
EI_ETYPE_ERRNO
This function will return an
-errnoerror code if it fails. e.g. return -EINVAL if the input is wrong. This will include the functions which will return an address which encodes-errnoby ERR_PTR() macro. -
EI_ETYPE_ERRNO_NULL
This function will return an
-errnoorNULLif it fails. If the caller of this function checks the return value with IS_ERR_OR_NULL() macro, this type will be appropriate. -
EI_ETYPE_TRUE
This function will return
true(non-zero positive value) if it fails.
If you specifies a wrong type, for example, EI_TYPE_ERRNO for the function which returns an allocated object, it may cause a problem because the returned value is not an object address and the caller can not access to the address.
How to add new fault injection capability #
-
#include <linux/fault-inject.h>
-
define the fault attributes
DECLARE_FAULT_ATTR(name);
Please see the definition of struct fault_attr in fault-inject.h for details.
-
provide a way to configure fault attributes
-
boot option
If you need to enable the fault injection capability from boot time, you can provide boot option to configure it. There is a helper function for it:
setup_fault_attr(attr, str);
-
debugfs entries
failslab, fail_page_alloc, fail_usercopy, and fail_make_request use this way. Helper functions:
fault_create_debugfs_attr(name, parent, attr);
-
module parameters
If the scope of the fault injection capability is limited to a single kernel module, it is better to provide module parameters to configure the fault attributes.
-
add a hook to insert failures
Upon should_fail() returning true, client code should inject a failure:
should_fail(attr, size);
Application Examples #
-
Inject slab allocation failures into module init/exit code:
#!/bin/bash FAILTYPE=failslab echo Y > /sys/kernel/debug/$FAILTYPE/task-filter echo 10 > /sys/kernel/debug/$FAILTYPE/probability echo 100 > /sys/kernel/debug/$FAILTYPE/interval echo -1 > /sys/kernel/debug/$FAILTYPE/times echo 0 > /sys/kernel/debug/$FAILTYPE/space echo 2 > /sys/kernel/debug/$FAILTYPE/verbose echo Y > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait faulty_system() { bash -c "echo 1 > /proc/self/make-it-fail && exec $*" } if [ $# -eq 0 ] then echo "Usage: $0 modulename [ modulename ... ]" exit 1 fi for m in $* do echo inserting $m... faulty_system modprobe $m echo removing $m... faulty_system modprobe -r $m done
-
Inject page allocation failures only for a specific module:
#!/bin/bash FAILTYPE=fail_page_alloc module=$1 if [ -z $module ] then echo "Usage: $0 <modulename>" exit 1 fi modprobe $module if [ ! -d /sys/module/$module/sections ] then echo Module $module is not loaded exit 1 fi cat /sys/module/$module/sections/.text > /sys/kernel/debug/$FAILTYPE/require-start cat /sys/module/$module/sections/.data > /sys/kernel/debug/$FAILTYPE/require-end echo N > /sys/kernel/debug/$FAILTYPE/task-filter echo 10 > /sys/kernel/debug/$FAILTYPE/probability echo 100 > /sys/kernel/debug/$FAILTYPE/interval echo -1 > /sys/kernel/debug/$FAILTYPE/times echo 0 > /sys/kernel/debug/$FAILTYPE/space echo 2 > /sys/kernel/debug/$FAILTYPE/verbose echo Y > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait echo Y > /sys/kernel/debug/$FAILTYPE/ignore-gfp-highmem echo 10 > /sys/kernel/debug/$FAILTYPE/stacktrace-depth trap "echo 0 > /sys/kernel/debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT echo "Injecting errors into the module $module... (interrupt to stop)" sleep 1000000
-
Inject open_ctree error while btrfs mount:
#!/bin/bash rm -f testfile.img dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 DEVICE=$(losetup --show -f testfile.img) mkfs.btrfs -f $DEVICE mkdir -p tmpmnt FAILTYPE=fail_function FAILFUNC=open_ctree echo $FAILFUNC > /sys/kernel/debug/$FAILTYPE/inject printf %#x -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval echo N > /sys/kernel/debug/$FAILTYPE/task-filter echo 100 > /sys/kernel/debug/$FAILTYPE/probability echo 0 > /sys/kernel/debug/$FAILTYPE/interval echo -1 > /sys/kernel/debug/$FAILTYPE/times echo 0 > /sys/kernel/debug/$FAILTYPE/space echo 1 > /sys/kernel/debug/$FAILTYPE/verbose mount -t btrfs $DEVICE tmpmnt if [ $? -ne 0 ] then echo "SUCCESS!" else echo "FAILED!" umount tmpmnt fi echo > /sys/kernel/debug/$FAILTYPE/inject rmdir tmpmnt losetup -d $DEVICE rm testfile.img
-
Inject only skbuff allocation failures
# mark skbuff_head_cache as faulty echo 1 > /sys/kernel/slab/skbuff_head_cache/failslab # Turn on cache filter (off by default) echo 1 > /sys/kernel/debug/failslab/cache-filter # Turn on fault injection echo 1 > /sys/kernel/debug/failslab/times echo 1 > /sys/kernel/debug/failslab/probability
Tool to run command with failslab or fail_page_alloc #
In order to make it easier to accomplish the tasks mentioned above, we can use tools/testing/fault-injection/failcmd.sh. Please run a command "./tools/testing/fault-injection/failcmd.sh --help" for more information and see the following examples.
Examples:
Run a command "make -C tools/testing/selftests/ run_tests" with injecting slab allocation failure:
# ./tools/testing/fault-injection/failcmd.sh \
-- make -C tools/testing/selftests/ run_tests
Same as above except to specify 100 times failures at most instead of one time at most by default:
# ./tools/testing/fault-injection/failcmd.sh --times=100 \
-- make -C tools/testing/selftests/ run_tests
Same as above except to inject page allocation failure instead of slab allocation failure:
# env FAILCMD_TYPE=fail_page_alloc \
./tools/testing/fault-injection/failcmd.sh --times=100 \
-- make -C tools/testing/selftests/ run_tests
Systematic faults using fail-nth #
The following code systematically faults 0-th, 1-st, 2-nd and so on capabilities in the socketpair() system call:
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int main()
{
int i, err, res, fail_nth, fds[2];
char buf[128];
system("echo N > /sys/kernel/debug/failslab/ignore-gfp-wait");
sprintf(buf, "/proc/self/task/%ld/fail-nth", syscall(SYS_gettid));
fail_nth = open(buf, O_RDWR);
for (i = 1;; i++) {
sprintf(buf, "%d", i);
write(fail_nth, buf, strlen(buf));
res = socketpair(AF_LOCAL, SOCK_STREAM, 0, fds);
err = errno;
pread(fail_nth, buf, sizeof(buf), 0);
if (res == 0) {
close(fds[0]);
close(fds[1]);
}
printf("%d-th fault %c: res=%d/%d\n", i, atoi(buf) ? 'N' : 'Y',
res, err);
if (atoi(buf))
break;
}
return 0;
}
An example output:
1-th fault Y: res=-1/23
2-th fault Y: res=-1/23
3-th fault Y: res=-1/12
4-th fault Y: res=-1/12
5-th fault Y: res=-1/23
6-th fault Y: res=-1/23
7-th fault Y: res=-1/23
8-th fault Y: res=-1/12
9-th fault Y: res=-1/12
10-th fault Y: res=-1/12
11-th fault Y: res=-1/12
12-th fault Y: res=-1/12
13-th fault Y: res=-1/12
14-th fault Y: res=-1/12
15-th fault Y: res=-1/12
16-th fault N: res=0/12
Notifier error injection
Peios Kernel / Kernel development / Fault injection
Notifier error injection provides the ability to inject artificial errors to specified notifier chain callbacks. It is useful to test the error handling of notifier call chain failures which is rarely executed. There are kernel modules that can be used to test the following notifiers.
PM notifier
Memory hotplug notifier
powerpc pSeries reconfig notifier
Netdevice notifier
PM notifier error injection module #
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
Possible PM notifier events to be failed are:
PM_HIBERNATION_PREPARE
PM_SUSPEND_PREPARE
PM_RESTORE_PREPARE
Example: Inject PM suspend error (-12 = -ENOMEM):
# cd /sys/kernel/debug/notifier-error-inject/pm/
# echo -12 > actions/PM_SUSPEND_PREPARE/error
# echo mem > /sys/power/state
bash: echo: write error: Cannot allocate memory
Memory hotplug notifier error injection module #
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
Possible memory notifier events to be failed are:
MEM_GOING_ONLINE
MEM_GOING_OFFLINE
Example: Inject memory hotplug offline error (-12 == -ENOMEM):
# cd /sys/kernel/debug/notifier-error-inject/memory
# echo -12 > actions/MEM_GOING_OFFLINE/error
# echo offline > /sys/devices/system/memory/memoryXXX/state
bash: echo: write error: Cannot allocate memory
powerpc pSeries reconfig notifier error injection module #
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
Possible pSeries reconfig notifier events to be failed are:
PSERIES_RECONFIG_ADD
PSERIES_RECONFIG_REMOVE
PSERIES_DRCONF_MEM_ADD
PSERIES_DRCONF_MEM_REMOVE
Netdevice notifier error injection module #
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
Netdevice notifier events which can be failed are:
NETDEV_REGISTER
NETDEV_CHANGEMTU
NETDEV_CHANGENAME
NETDEV_PRE_UP
NETDEV_PRE_TYPE_CHANGE
NETDEV_POST_INIT
NETDEV_PRECHANGEMTU
NETDEV_PRECHANGEUPPER
NETDEV_CHANGEUPPER
Example: Inject netdevice mtu change error (-22 == -EINVAL):
# cd /sys/kernel/debug/notifier-error-inject/netdev
# echo -22 > actions/NETDEV_CHANGEMTU/error
# ip link set eth0 mtu 1024
RTNETLINK answers: Invalid argument
For more usage examples #
There are tools/testing/selftests using the notifier error injection features for CPU and memory notifiers.
tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
These scripts first do simple online and offline tests and then do fault injection tests if notifier error injection module is available.
NVMe Fault Injection
Peios Kernel / Kernel development / Fault injection
Linux's fault injection framework provides a systematic way to support error injection via debugfs in the /sys/kernel/debug directory. When enabled, the default NVME_SC_INVALID_OPCODE with no retry will be injected into the nvme_try_complete_req. Users can change the default status code and no retry flag via the debugfs. The list of Generic Command Status can be found in include/linux/nvme.h
Following examples show how to inject an error into the nvme.
First, enable CONFIG_FAULT_INJECTION_DEBUG_FS kernel config, recompile the kernel. After booting up the kernel, do the following.
Example 1: Inject default status code with no retry #
mount /dev/nvme0n1 /mnt
echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
cp a.file /mnt
Expected Result:
cp: cannot stat ‘/mnt/a.file’: Input/output error
Message from dmesg:
FAULT_INJECTION: forcing a failure.
name fault_inject, interval 1, probability 100, space 0, times 1
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.15.0-rc8+ #2
Hardware name: innotek GmbH VirtualBox/VirtualBox,
BIOS VirtualBox 12/01/2006
Call Trace:
<IRQ>
dump_stack+0x5c/0x7d
should_fail+0x148/0x170
nvme_should_fail+0x2f/0x50 [nvme_core]
nvme_process_cq+0xe7/0x1d0 [nvme]
nvme_irq+0x1e/0x40 [nvme]
__handle_irq_event_percpu+0x3a/0x190
handle_irq_event_percpu+0x30/0x70
handle_irq_event+0x36/0x60
handle_fasteoi_irq+0x78/0x120
handle_irq+0xa7/0x130
? tick_irq_enter+0xa8/0xc0
do_IRQ+0x43/0xc0
common_interrupt+0xa2/0xa2
</IRQ>
RIP: 0010:native_safe_halt+0x2/0x10
RSP: 0018:ffffffff82003e90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdd
RAX: ffffffff817a10c0 RBX: ffffffff82012480 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 000000008e38ce64 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82012480
R13: ffffffff82012480 R14: 0000000000000000 R15: 0000000000000000
? __sched_text_end+0x4/0x4
default_idle+0x18/0xf0
do_idle+0x150/0x1d0
cpu_startup_entry+0x6f/0x80
start_kernel+0x4c4/0x4e4
? set_init_arg+0x55/0x55
secondary_startup_64+0xa5/0xb0
print_req_error: I/O error, dev nvme0n1, sector 9240
EXT4-fs error (device nvme0n1): ext4_find_entry:1436:
inode #2: comm cp: reading directory lblock 0
Example 2: Inject default status code with retry #
mount /dev/nvme0n1 /mnt
echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/status
echo 0 > /sys/kernel/debug/nvme0n1/fault_inject/dont_retry
cp a.file /mnt
Expected Result:
command success without error
Message from dmesg:
FAULT_INJECTION: forcing a failure.
name fault_inject, interval 1, probability 100, space 0, times 1
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.15.0-rc8+ #4
Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
Call Trace:
<IRQ>
dump_stack+0x5c/0x7d
should_fail+0x148/0x170
nvme_should_fail+0x30/0x60 [nvme_core]
nvme_loop_queue_response+0x84/0x110 [nvme_loop]
nvmet_req_complete+0x11/0x40 [nvmet]
nvmet_bio_done+0x28/0x40 [nvmet]
blk_update_request+0xb0/0x310
blk_mq_end_request+0x18/0x60
flush_smp_call_function_queue+0x3d/0xf0
smp_call_function_single_interrupt+0x2c/0xc0
call_function_single_interrupt+0xa2/0xb0
</IRQ>
RIP: 0010:native_safe_halt+0x2/0x10
RSP: 0018:ffffc9000068bec0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff04
RAX: ffffffff817a10c0 RBX: ffff88011a3c9680 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000001 R08: 000000008e38c131 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88011a3c9680
R13: ffff88011a3c9680 R14: 0000000000000000 R15: 0000000000000000
? __sched_text_end+0x4/0x4
default_idle+0x18/0xf0
do_idle+0x150/0x1d0
cpu_startup_entry+0x6f/0x80
start_secondary+0x187/0x1e0
secondary_startup_64+0xa5/0xb0
Example 3: Inject an error into the 10th admin command #
echo 100 > /sys/kernel/debug/nvme0/fault_inject/probability
echo 10 > /sys/kernel/debug/nvme0/fault_inject/space
echo 1 > /sys/kernel/debug/nvme0/fault_inject/times
nvme reset /dev/nvme0
Expected Result:
After NVMe controller reset, the reinitialization may or may not succeed.
It depends on which admin command is actually forced to fail.
Message from dmesg:
nvme nvme0: resetting controller
FAULT_INJECTION: forcing a failure.
name fault_inject, interval 1, probability 100, space 1, times 1
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-rc2+ #2
Hardware name: MSI MS-7A45/B150M MORTAR ARCTIC (MS-7A45), BIOS 1.50 04/25/2017
Call Trace:
<IRQ>
dump_stack+0x63/0x85
should_fail+0x14a/0x170
nvme_should_fail+0x38/0x80 [nvme_core]
nvme_irq+0x129/0x280 [nvme]
? blk_mq_end_request+0xb3/0x120
__handle_irq_event_percpu+0x84/0x1a0
handle_irq_event_percpu+0x32/0x80
handle_irq_event+0x3b/0x60
handle_edge_irq+0x7f/0x1a0
handle_irq+0x20/0x30
do_IRQ+0x4e/0xe0
common_interrupt+0xf/0xf
</IRQ>
RIP: 0010:cpuidle_enter_state+0xc5/0x460
Code: ff e8 8f 5f 86 ff 80 7d c7 00 74 17 9c 58 0f 1f 44 00 00 f6 c4 02 0f 85 69 03 00 00 31 ff e8 62 aa 8c ff fb 66 0f 1f 44 00 00 <45> 85 ed 0f 88 37 03 00 00 4c 8b 45 d0 4c 2b 45 b8 48 ba cf f7 53
RSP: 0018:ffffffff88c03dd0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdc
RAX: ffff9dac25a2ac80 RBX: ffffffff88d53760 RCX: 000000000000001f
RDX: 0000000000000000 RSI: 000000002d958403 RDI: 0000000000000000
RBP: ffffffff88c03e18 R08: fffffff75e35ffb7 R09: 00000a49a56c0b48
R10: ffffffff88c03da0 R11: 0000000000001b0c R12: ffff9dac25a34d00
R13: 0000000000000006 R14: 0000000000000006 R15: ffffffff88d53760
cpuidle_enter+0x2e/0x40
call_cpuidle+0x23/0x40
do_idle+0x201/0x280
cpu_startup_entry+0x1d/0x20
rest_init+0xaa/0xb0
arch_call_rest_init+0xe/0x1b
start_kernel+0x51c/0x53b
x86_64_start_reservations+0x24/0x26
x86_64_start_kernel+0x74/0x77
secondary_startup_64+0xa4/0xb0
nvme nvme0: Could not set queue count (16385)
nvme nvme0: IO queues not created
Provoking crashes with Linux Kernel Dump Test Module (LKDTM)
Peios Kernel / Kernel development / Fault injection
The lkdtm module provides an interface to disrupt (and usually crash) the kernel at predefined code locations to evaluate the reliability of the kernel's exception handling and to test crash dumps obtained using different dumping solutions. The module uses KPROBEs to instrument the trigger location, but can also trigger the kernel directly without KPROBE support via debugfs.
You can select the location of the trigger ("crash point name") and the type of action ("crash point type") either through module arguments when inserting the module, or through the debugfs interface.
Usage:
insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
[cpoint_count={>0}]
-
recur_count
Recursion level for the stack overflow test. By default this is dynamically calculated based on kernel configuration, with the goal of being just large enough to exhaust the kernel stack. The value can be seen at
/sys/module/lkdtm/parameters/recur_count. -
cpoint_name
Where in the kernel to trigger the action. It can be one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY, FS_SUBMIT_BH, MEM_SWAPOUT, TIMERADD, SCSI_QUEUE_RQ, or DIRECT.
-
cpoint_type
Indicates the action to be taken on hitting the crash point. These are numerous, and best queried directly from debugfs. Some of the common ones are PANIC, BUG, EXCEPTION, LOOP, and OVERFLOW. See the contents of
/sys/kernel/debug/provoke-crash/DIRECTfor a complete list. -
cpoint_count
Indicates the number of times the crash point is to be hit before triggering the action. The default is 10 (except for DIRECT, which always fires immediately).
You can also induce failures by mounting debugfs and writing the type to <debugfs>/provoke-crash/<crashpoint>. E.g.:
mount -t debugfs debugfs /sys/kernel/debug
echo EXCEPTION > /sys/kernel/debug/provoke-crash/INT_HARDWARE_ENTRY
The special file DIRECT will induce the action directly without KPROBE instrumentation. This mode is the only one available when the module is built for a kernel without KPROBEs support:
# Instead of having a BUG kill your shell, have it kill "cat":
cat <(echo WRITE_RO) >/sys/kernel/debug/provoke-crash/DIRECT
Litmus tests
Peios Kernel / Kernel development / Litmus tests
Each subdirectory contains litmus tests that are typical to describe the semantics of respective kernel APIs. For more information about how to "run" a litmus test or how to generate a kernel test module based on a litmus test, please see tools/memory-model/README.
atomic (/atomic directory) #
Atomic-RMW+mb__after_atomic-is-stronger-than-acquire.litmus
Test that an atomic RMW followed by a smp_mb__after_atomic() is
stronger than a normal acquire: both the read and write parts of
the RMW are ordered before the subsequential memory accesses.
Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
Test that atomic_set() cannot break the atomicity of atomic RMWs.
NOTE: Require herd7 7.56 or later which supports "(void)expr".
cmpxchg-fail-ordered-1.litmus
Demonstrate that a failing cmpxchg() operation acts as a full barrier
when followed by smp_mb__after_atomic().
cmpxchg-fail-ordered-2.litmus
Demonstrate that a failing cmpxchg() operation acts as an acquire
operation when followed by smp_mb__after_atomic().
cmpxchg-fail-unordered-1.litmus
Demonstrate that a failing cmpxchg() operation does not act as a
full barrier.
cmpxchg-fail-unordered-2.litmus
Demonstrate that a failing cmpxchg() operation does not act as an
acquire operation.
locking (/locking directory) #
DCL-broken.litmus
Demonstrates that double-checked locking needs more than just
the obvious lock acquisitions and releases.
DCL-fixed.litmus
Demonstrates corrected double-checked locking that uses
smp_store_release() and smp_load_acquire() in addition to the
obvious lock acquisitions and releases.
RM-broken.litmus
Demonstrates problems with "roach motel" locking, where code is
freely moved into lock-based critical sections. This example also
shows how to use the "filter" clause to discard executions that
would be excluded by other code not modeled in the litmus test.
Note also that this "roach motel" optimization is emulated by
physically moving P1()'s two reads from x under the lock.
What is a roach motel? This is from an old advertisement for
a cockroach trap, much later featured in one of the "Men in
Black" movies. "The roaches check in. They don't check out."
RM-fixed.litmus
The counterpart to RM-broken.litmus, showing P0()'s two loads from
x safely outside of the critical section.
RCU (/rcu directory) #
MP+onceassign+derefonce.litmus (under tools/memory-model/litmus-tests/)
Demonstrates the use of rcu_assign_pointer() and rcu_dereference() to
ensure that an RCU reader will not see pre-initialization garbage.
RCU+sync+read.litmus RCU+sync+free.litmus
Both the above litmus tests demonstrate the RCU grace period guarantee
that an RCU read-side critical section can never span a grace period.
Atomic-RMW+mb__after_atomic-is-stronger-than-acquire litmus test
Peios Kernel / Kernel development / Litmus tests / atomic
Source and expected outcome of this Linux memory-model litmus test.
C Atomic-RMW+mb__after_atomic-is-stronger-than-acquire
(*
* Result: Never
*
* Test that an atomic RMW followed by a smp_mb__after_atomic() is
* stronger than a normal acquire: both the read and write parts of
* the RMW are ordered before the subsequential memory accesses.
*)
{
}
P0(int *x, atomic_t *y)
{
int r0;
int r1;
r0 = READ_ONCE(*x);
smp_rmb();
r1 = atomic_read(y);
}
P1(int *x, atomic_t *y)
{
atomic_inc(y);
smp_mb__after_atomic();
WRITE_ONCE(*x, 1);
}
exists
(0:r0=1 /\ 0:r1=0)
Atomic-RMW-ops-are-atomic-WRT-atomic_set litmus test
Peios Kernel / Kernel development / Litmus tests / atomic
Source and expected outcome of this Linux memory-model litmus test.
C Atomic-RMW-ops-are-atomic-WRT-atomic_set
(*
* Result: Never
*
* Test that atomic_set() cannot break the atomicity of atomic RMWs.
* NOTE: This requires herd7 7.56 or later which supports "(void)expr".
*)
{
atomic_t v = ATOMIC_INIT(1);
}
P0(atomic_t *v)
{
(void)atomic_add_unless(v, 1, 0);
}
P1(atomic_t *v)
{
atomic_set(v, 0);
}
exists
(v=2)
cmpxchg-fail-ordered-1 litmus test
Peios Kernel / Kernel development / Litmus tests / atomic
Source and expected outcome of this Linux memory-model litmus test.
C cmpxchg-fail-ordered-1
(*
* Result: Never
*
* Demonstrate that a failing cmpxchg() operation will act as a full
* barrier when followed by smp_mb__after_atomic().
*)
{}
P0(int *x, int *y, int *z)
{
int r0;
int r1;
WRITE_ONCE(*x, 1);
r1 = cmpxchg(z, 1, 0);
smp_mb__after_atomic();
r0 = READ_ONCE(*y);
}
P1(int *x, int *y, int *z)
{
int r0;
int r1;
WRITE_ONCE(*y, 1);
r1 = cmpxchg(z, 1, 0);
smp_mb__after_atomic();
r0 = READ_ONCE(*x);
}
locations[0:r1;1:r1]
exists (0:r0=0 /\ 1:r0=0)
cmpxchg-fail-ordered-2 litmus test
Peios Kernel / Kernel development / Litmus tests / atomic
Source and expected outcome of this Linux memory-model litmus test.
C cmpxchg-fail-ordered-2
(*
* Result: Never
*
* Demonstrate use of smp_mb__after_atomic() to make a failing cmpxchg
* operation have acquire ordering.
*)
{}
P0(int *x, int *y)
{
int r1;
WRITE_ONCE(*x, 1);
r1 = cmpxchg(y, 0, 1);
}
P1(int *x, int *y)
{
int r1;
int r2;
r1 = cmpxchg(y, 0, 1);
smp_mb__after_atomic();
r2 = READ_ONCE(*x);
}
exists (0:r1=0 /\ 1:r1=1 /\ 1:r2=0)
cmpxchg-fail-unordered-1 litmus test
Peios Kernel / Kernel development / Litmus tests / atomic
Source and expected outcome of this Linux memory-model litmus test.
C cmpxchg-fail-unordered-1
(*
* Result: Sometimes
*
* Demonstrate that a failing cmpxchg() operation does not act as a
* full barrier. (In contrast, a successful cmpxchg() does act as a
* full barrier.)
*)
{}
P0(int *x, int *y, int *z)
{
int r0;
int r1;
WRITE_ONCE(*x, 1);
r1 = cmpxchg(z, 1, 0);
r0 = READ_ONCE(*y);
}
P1(int *x, int *y, int *z)
{
int r0;
int r1;
WRITE_ONCE(*y, 1);
r1 = cmpxchg(z, 1, 0);
r0 = READ_ONCE(*x);
}
locations[0:r1;1:r1]
exists (0:r0=0 /\ 1:r0=0)
cmpxchg-fail-unordered-2 litmus test
Peios Kernel / Kernel development / Litmus tests / atomic
Source and expected outcome of this Linux memory-model litmus test.
C cmpxchg-fail-unordered-2
(*
* Result: Sometimes
*
* Demonstrate that a failing cmpxchg() operation does not act as either
* an acquire release operation. (In contrast, a successful cmpxchg()
* does act as both an acquire and a release operation.)
*)
{}
P0(int *x, int *y)
{
int r1;
WRITE_ONCE(*x, 1);
r1 = cmpxchg(y, 0, 1);
}
P1(int *x, int *y)
{
int r1;
int r2;
r1 = cmpxchg(y, 0, 1);
r2 = READ_ONCE(*x);
}
exists (0:r1=0 /\ 1:r1=1 /\ 1:r2=0)
DCL-broken litmus test
Peios Kernel / Kernel development / Litmus tests / locking
Source and expected outcome of this Linux memory-model litmus test.
C DCL-broken
(*
* Result: Sometimes
*
* This litmus test demonstrates more than just locking is required to
* correctly implement double-checked locking.
*)
{
int flag;
int data;
}
P0(int *flag, int *data, spinlock_t *lck)
{
int r0;
int r1;
int r2;
r0 = READ_ONCE(*flag);
if (r0 == 0) {
spin_lock(lck);
r1 = READ_ONCE(*flag);
if (r1 == 0) {
WRITE_ONCE(*data, 1);
WRITE_ONCE(*flag, 1);
}
spin_unlock(lck);
}
r2 = READ_ONCE(*data);
}
P1(int *flag, int *data, spinlock_t *lck)
{
int r0;
int r1;
int r2;
r0 = READ_ONCE(*flag);
if (r0 == 0) {
spin_lock(lck);
r1 = READ_ONCE(*flag);
if (r1 == 0) {
WRITE_ONCE(*data, 1);
WRITE_ONCE(*flag, 1);
}
spin_unlock(lck);
}
r2 = READ_ONCE(*data);
}
locations [flag;data;0:r0;0:r1;1:r0;1:r1]
exists (0:r2=0 \/ 1:r2=0)
DCL-fixed litmus test
Peios Kernel / Kernel development / Litmus tests / locking
Source and expected outcome of this Linux memory-model litmus test.
C DCL-fixed
(*
* Result: Never
*
* This litmus test demonstrates that double-checked locking can be
* reliable given proper use of smp_load_acquire() and smp_store_release()
* in addition to the locking.
*)
{
int flag;
int data;
}
P0(int *flag, int *data, spinlock_t *lck)
{
int r0;
int r1;
int r2;
r0 = smp_load_acquire(flag);
if (r0 == 0) {
spin_lock(lck);
r1 = READ_ONCE(*flag);
if (r1 == 0) {
WRITE_ONCE(*data, 1);
smp_store_release(flag, 1);
}
spin_unlock(lck);
}
r2 = READ_ONCE(*data);
}
P1(int *flag, int *data, spinlock_t *lck)
{
int r0;
int r1;
int r2;
r0 = smp_load_acquire(flag);
if (r0 == 0) {
spin_lock(lck);
r1 = READ_ONCE(*flag);
if (r1 == 0) {
WRITE_ONCE(*data, 1);
smp_store_release(flag, 1);
}
spin_unlock(lck);
}
r2 = READ_ONCE(*data);
}
locations [flag;data;0:r0;0:r1;1:r0;1:r1]
exists (0:r2=0 \/ 1:r2=0)
RM-broken litmus test
Peios Kernel / Kernel development / Litmus tests / locking
Source and expected outcome of this Linux memory-model litmus test.
C RM-broken
(*
* Result: DEADLOCK
*
* This litmus test demonstrates that the old "roach motel" approach
* to locking, where code can be freely moved into critical sections,
* cannot be used in the Linux kernel.
*)
{
int x;
atomic_t y;
}
P0(int *x, atomic_t *y, spinlock_t *lck)
{
int r2;
spin_lock(lck);
r2 = atomic_inc_return(y);
WRITE_ONCE(*x, 1);
spin_unlock(lck);
}
P1(int *x, atomic_t *y, spinlock_t *lck)
{
int r0;
int r1;
int r2;
spin_lock(lck);
r0 = READ_ONCE(*x);
r1 = READ_ONCE(*x);
r2 = atomic_inc_return(y);
spin_unlock(lck);
}
locations [x;0:r2;1:r0;1:r1;1:r2]
filter (1:r0=0 /\ 1:r1=1)
exists (1:r2=1)
RM-fixed litmus test
Peios Kernel / Kernel development / Litmus tests / locking
Source and expected outcome of this Linux memory-model litmus test.
C RM-fixed
(*
* Result: Never
*
* This litmus test demonstrates that the old "roach motel" approach
* to locking, where code can be freely moved into critical sections,
* cannot be used in the Linux kernel.
*)
{
int x;
atomic_t y;
}
P0(int *x, atomic_t *y, spinlock_t *lck)
{
int r2;
spin_lock(lck);
r2 = atomic_inc_return(y);
WRITE_ONCE(*x, 1);
spin_unlock(lck);
}
P1(int *x, atomic_t *y, spinlock_t *lck)
{
int r0;
int r1;
int r2;
r0 = READ_ONCE(*x);
r1 = READ_ONCE(*x);
spin_lock(lck);
r2 = atomic_inc_return(y);
spin_unlock(lck);
}
locations [x;0:r2;1:r0;1:r1;1:r2]
filter (1:r0=0 /\ 1:r1=1)
exists (1:r2=1)
RCU+sync+free litmus test
Peios Kernel / Kernel development / Litmus tests / rcu
Source and expected outcome of this Linux memory-model litmus test.
C RCU+sync+free
(*
* Result: Never
*
* This litmus test demonstrates that an RCU reader can never see a write that
* follows a grace period, if it did not see writes that precede that grace
* period.
*
* This is a typical pattern of RCU usage, where the write before the grace
* period assigns a pointer, and the writes following the grace period destroy
* the object that the pointer used to point to.
*
* This is one implication of the RCU grace-period guarantee, which says (among
* other things) that an RCU read-side critical section cannot span a grace period.
*)
{
int x = 1;
int *y = &x;
int z = 1;
}
P0(int *x, int *z, int **y)
{
int *r0;
int r1;
rcu_read_lock();
r0 = rcu_dereference(*y);
r1 = READ_ONCE(*r0);
rcu_read_unlock();
}
P1(int *x, int *z, int **y)
{
rcu_assign_pointer(*y, z);
synchronize_rcu();
WRITE_ONCE(*x, 0);
}
exists (0:r0=x /\ 0:r1=0)
RCU+sync+read litmus test
Peios Kernel / Kernel development / Litmus tests / rcu
Source and expected outcome of this Linux memory-model litmus test.
C RCU+sync+read
(*
* Result: Never
*
* This litmus test demonstrates that after a grace period, an RCU updater always
* sees all stores done in prior RCU read-side critical sections. Such
* read-side critical sections would have ended before the grace period ended.
*
* This is one implication of the RCU grace-period guarantee, which says (among
* other things) that an RCU read-side critical section cannot span a grace period.
*)
{
int x = 0;
int y = 0;
}
P0(int *x, int *y)
{
rcu_read_lock();
WRITE_ONCE(*x, 1);
WRITE_ONCE(*y, 1);
rcu_read_unlock();
}
P1(int *x, int *y)
{
int r0;
int r1;
r0 = READ_ONCE(*x);
synchronize_rcu();
r1 = READ_ONCE(*y);
}
exists (1:r0=1 /\ 1:r1=0)
Tracing Peios Subsystems
Peios Kernel / Kernel development / Tracing Peios Subsystems
Peios subsystems expose static Linux tracepoints for implementation diagnostics. Use them when a result needs explanation inside the kernel. They are separate from the KMES event catalog and its audit records.
Choose a subsystem #
The trace systems cover different questions:
| System | Typical evidence |
|---|---|
kacs | Instrumented access decisions, object identifiers, masks, and return-path reasons |
kmes | Event transport, validation, loss, throttling, and buffer changes |
lcs | Registry source requests, responses, timeouts, and state changes |
The running kernel's tracefs event list is authoritative for that build.
The format file defines each event's fields and symbolic formatting.
Diagnostic constants are maintained in include/uapi/pkm/trace.h; do not
infer a reason number from a different kernel version.
On a development system with tracing available, inspect an event before selecting it:
Missing entries can mean that tracing is unavailable, the filesystem is not mounted at this path, or the selected kernel lacks the event. Do not treat them as evidence that an operation did not occur.
Capture a narrow interval #
Changing trace controls requires permission. Coordinate with other tracing users, note the existing settings, and restore them after capture. Enabling a whole subsystem can produce substantial output; start with one event.
From the trace filesystem, a focused access-check capture uses these controls:
Read trace after reproducing the operation. This example changes global
trace settings and leaves the event enabled until you restore them. A live
stream reader and a snapshot have different consumption behavior; use the
tracing reference when designing a
capture tool.
Filters operate on structured fields. For an event whose format exposes
ino, an ino == <number> filter narrows the object. Use the field names
from that event's format. perf and eBPF attach to the same tracepoints where
the kernel configuration and permissions allow them.
Interpret a KACS decision #
A negative ret describes a refusal; zero describes success at that
instrumented return path. reason identifies the path taken. access is the
requested mask, and mount_policy can explain the filesystem's treatment.
ino and sb_magic provide context, not a globally unique pathname.
Trace events expose operational information even when they omit pathnames and descriptor bytes. Limit collection and access to the resulting logs. Disabled static tracepoints have low overhead; enabled collection has real cost and finite buffering. A trace is not a complete audit guarantee.
Trace early boot #
For events registered early enough, the kernel command line can enable a selection and send it to the console:
trace_event=kacs:kacs_file_access tp_printk
A broader selection is trace_event=kacs:*,kmes:*,lcs:*. It can overwhelm a
slow console and alter timing. Preserve the exact command line and serial
log, and check for dropped output. Registration order and console readiness
limit what can be observed; this does not promise every early decision.
The former kacs.trace=1 switch is not the maintained interface. Use the
trace event controls and the kernel event model
to distinguish trace diagnostics from records delivered through KMES.
Kernel Livepatching
Peios Kernel / Kernel development / Livepatch
Livepatching APIs
Peios Kernel / Kernel development / Livepatch
Livepatch Enablement #
klp_enable_patch() #
int enable the livepatch
Parameters
struct klp_patch *patch: patch to be enabled
Description
Initializes the data structure associated with the patch, creates the sysfs interface, performs the needed symbol lookups and code relocations, registers the patched functions with ftrace.
This function is supposed to be called from the livepatch module_init()
callback.
Return
0 on success, otherwise error
Shadow Variables #
klp_shadow_get() #
void * retrieve a shadow variable data pointer
Parameters
void *obj: pointer to parent objectunsigned long id: data identifier
Return
the shadow variable data element, NULL on failure.
klp_shadow_alloc() #
void * allocate and add a new shadow variable
Parameters
void *obj: pointer to parent objectunsigned long id: data identifiersize_t size: size of attached datagfp_t gfp_flags: GFP mask for allocationklp_shadow_ctor_t ctor: custom constructor to initialize the shadow data (optional)void *ctor_data: pointer to any data needed by ctor (optional)
Description
Allocates size bytes for new shadow variable data using gfp_flags. The data are zeroed by default. They are further initialized by ctor function if it is not NULL. The new shadow variable is then added to the global hashtable.
If an existing <obj, id> shadow variable can be found, this routine will issue a WARN, exit early and return NULL.
This function guarantees that the constructor function is called only when the variable did not exist before. The cost is that ctor is called in atomic context under a spin lock.
Return
the shadow variable data element, NULL on duplicate or failure.
klp_shadow_get_or_alloc() #
void * get existing or allocate a new shadow variable
Parameters
void *obj: pointer to parent objectunsigned long id: data identifiersize_t size: size of attached datagfp_t gfp_flags: GFP mask for allocationklp_shadow_ctor_t ctor: custom constructor to initialize the shadow data (optional)void *ctor_data: pointer to any data needed by ctor (optional)
Description
Returns a pointer to existing shadow data if an <obj, id> shadow
variable is already present. Otherwise, it creates a new shadow
variable like klp_shadow_alloc().
This function guarantees that only one shadow variable exists with the given id for the given obj. It also guarantees that the constructor function will be called only when the variable did not exist before. The cost is that ctor is called in atomic context under a spin lock.
Return
the shadow variable data element, NULL on failure.
klp_shadow_free() #
void detach and free a <obj, id> shadow variable
Parameters
void *obj: pointer to parent objectunsigned long id: data identifierklp_shadow_dtor_t dtor: custom callback that can be used to unregister the variable and/or free data that the shadow variable points to (optional)
Description
This function releases the memory for this <obj, id> shadow variable instance, callers should stop referencing it accordingly.
klp_shadow_free_all() #
void detach and free all <_, id> shadow variables
Parameters
unsigned long id: data identifierklp_shadow_dtor_t dtor: custom callback that can be used to unregister the variable and/or free data that the shadow variable points to (optional)
Description
This function releases the memory for all <_, id> shadow variable instances, callers should stop referencing them accordingly.
System State Changes #
klp_get_state() #
struct klp_state * get information about system state modified by the given patch
Parameters
struct klp_patch *patch: livepatch that modifies the given system stateunsigned long id: custom identifier of the modified system state
Description
Checks whether the given patch modifies the given system state.
The function can be called either from pre/post (un)patch callbacks or from the kernel code added by the livepatch.
Return
pointer to struct klp_state when found, otherwise NULL.
klp_get_prev_state() #
struct klp_state * get information about system state modified by the already installed livepatches
Parameters
unsigned long id: custom identifier of the modified system state
Description
Checks whether already installed livepatches modify the given system state.
The same system state can be modified by more non-cumulative livepatches. It is expected that the latest livepatch has the most up-to-date information.
The function can be called only during transition when a new livepatch is being enabled or when such a transition is reverted. It is typically called only from pre/post (un)patch callbacks.
Return
pointer to the latest struct klp_state from already installed livepatches, NULL when not found.
Object Types #
struct klp_func #
function structure for live patching
Definition
;
Members
old_name: name of the function to be patchednew_func: pointer to the patched function codeold_sympos: a hint indicating which symbol position the old function can be found (optional)old_func: pointer to the function being patchedkobj: kobject for sysfs resourcesnode: list node for klp_object func_liststack_node: list node for klp_ops func_stack listold_size: size of the old functionnew_size: size of the new functionnop: temporary patch to use the original code again; dyn. allocatedpatched: the func has been added to the klp_ops listtransition: the func is currently being applied or reverted
Description
The patched and transition variables define the func's patching state. When patching, a func is always in one of the following states:
patched=0 transition=0: unpatched patched=0 transition=1: unpatched, temporary starting state patched=1 transition=1: patched, may be visible to some tasks patched=1 transition=0: patched, visible to all tasks
And when unpatching, it goes in the reverse order:
patched=1 transition=0: patched, visible to all tasks patched=1 transition=1: patched, may be visible to some tasks patched=0 transition=1: unpatched, temporary ending state patched=0 transition=0: unpatched
struct klp_object #
kernel object structure for live patching
Definition
;
Members
name: module name (or NULL for vmlinux)funcs: function entries for functions to be patched in the objectcallbacks: functions to be executed pre/post (un)patchingkobj: kobject for sysfs resourcesfunc_list: dynamic list of the function entriesnode: list node for klp_patch obj_listmod: kernel module associated with the patched object (NULL for vmlinux)dynamic: temporary object for nop functions; dynamically allocatedpatched: the object's funcs have been added to the klp_ops list
struct klp_state #
state of the system modified by the livepatch
Definition
;
Members
id: system state identifier (non-zero)version: version of the changedata: custom data
struct klp_patch #
patch structure for live patching
Definition
;
Members
mod: reference to the live patch moduleobjs: object entries for kernel objects to be patchedstates: system states that can get modifiedreplace: replace all actively used patcheslist: list node for global list of actively used patcheskobj: kobject for sysfs resourcesobj_list: dynamic list of the object entriesenabled: the patch is enabled (but operation may be incomplete)forced: was involved in a forced transitionfree_work: patch cleanup from workqueue-contextfinish: for waiting till it is safe to remove the patch module
(Un)patching Callbacks
Peios Kernel / Kernel development / Livepatch
Livepatch (un)patch-callbacks provide a mechanism for livepatch modules to execute callback functions when a kernel object is (un)patched. They can be considered a power feature that extends livepatching abilities to include:
Safe updates to global data
"Patches" to init and probe functions
Patching otherwise unpatchable code (i.e. assembly)
In most cases, (un)patch callbacks will need to be used in conjunction with memory barriers and kernel synchronization primitives, like mutexes/spinlocks, or even stop_machine(), to avoid concurrency issues.
1. Motivation #
Callbacks differ from existing kernel facilities:
Module init/exit code doesn't run when disabling and re-enabling a patch.
A module notifier can't stop a to-be-patched module from loading.
Callbacks are part of the klp_object structure and their implementation is specific to that klp_object. Other livepatch objects may or may not be patched, irrespective of the target klp_object's current state.
2. Callback types #
Callbacks can be registered for the following livepatch actions:
Pre-patch
- before a klp_object is patched
Post-patch
- after a klp_object has been patched and is active across all tasks
Pre-unpatch
- before a klp_object is unpatched (ie, patched code is active), used to clean up post-patch callback resources
Post-unpatch
- after a klp_object has been patched, all code has been restored and no tasks are running patched code, used to cleanup pre-patch callback resources
3. How it works #
Each callback is optional, omitting one does not preclude specifying any other. However, the livepatching core executes the handlers in symmetry: pre-patch callbacks have a post-unpatch counterpart and post-patch callbacks have a pre-unpatch counterpart. An unpatch callback will only be executed if its corresponding patch callback was executed. Typical use cases pair a patch handler that acquires and configures resources with an unpatch handler tears down and releases those same resources.
A callback is only executed if its host klp_object is loaded. For in-kernel vmlinux targets, this means that callbacks will always execute when a livepatch is enabled/disabled. For patch target kernel modules, callbacks will only execute if the target module is loaded. When a module target is (un)loaded, its callbacks will execute only if the livepatch module is enabled.
The pre-patch callback, if specified, is expected to return a status code (0 for success, -ERRNO on error). An error status code indicates to the livepatching core that patching of the current klp_object is not safe and to stop the current patching request. (When no pre-patch callback is provided, the transition is assumed to be safe.) If a pre-patch callback returns failure, the kernel's module loader will:
Refuse to load a livepatch, if the livepatch is loaded after targeted code.
or:
Refuse to load a module, if the livepatch was already successfully loaded.
No post-patch, pre-unpatch, or post-unpatch callbacks will be executed for a given klp_object if the object failed to patch, due to a failed pre_patch callback or for any other reason.
If a patch transition is reversed, no pre-unpatch handlers will be run (this follows the previously mentioned symmetry -- pre-unpatch callbacks will only occur if their corresponding post-patch callback executed).
If the object did successfully patch, but the patch transition never started for some reason (e.g., if another object failed to patch), only the post-unpatch callback will be called.
4. Use cases #
Sample livepatch modules demonstrating the callback API can be found in samples/livepatch/ directory. These samples were modified for use in kselftests and can be found in the lib/livepatch directory.
Global data update #
A pre-patch callback can be useful to update a global variable. For example, commit 75ff39ccc1bd ("tcp: make challenge acks less predictable") changes a global sysctl, as well as patches the tcp_send_challenge_ack() function.
In this case, if we're being super paranoid, it might make sense to patch the data after patching is complete with a post-patch callback, so that tcp_send_challenge_ack() could first be changed to read sysctl_tcp_challenge_ack_limit with READ_ONCE.
__init and probe function patches support #
Although __init and probe functions are not directly livepatch-able, it may be possible to implement similar updates via pre/post-patch callbacks.
The commit 48900cb6af42 ("virtio-net: drop NETIF_F_FRAGLIST") change the way that virtnet_probe() initialized its driver's net_device features. A pre/post-patch callback could iterate over all such devices, making a similar change to their hw_features value. (Client functions of the value may need to be updated accordingly.)
Atomic Replace & Cumulative Patches
Peios Kernel / Kernel development / Livepatch
There might be dependencies between livepatches. If multiple patches need to do different changes to the same function(s) then we need to define an order in which the patches will be installed. And function implementations from any newer livepatch must be done on top of the older ones.
This might become a maintenance nightmare. Especially when more patches modified the same function in different ways.
An elegant solution comes with the feature called "Atomic Replace". It allows creation of so called "Cumulative Patches". They include all wanted changes from all older livepatches and completely replace them in one transition.
Usage #
The atomic replace can be enabled by setting "replace" flag in struct klp_patch, for example:
static struct klp_patch patch = {
.mod = THIS_MODULE,
.objs = objs,
.replace = true,
};
All processes are then migrated to use the code only from the new patch. Once the transition is finished, all older patches are automatically disabled.
Ftrace handlers are transparently removed from functions that are no longer modified by the new cumulative patch.
As a result, the livepatch authors might maintain sources only for one cumulative patch. It helps to keep the patch consistent while adding or removing various fixes or features.
Users could keep only the last patch installed on the system after the transition to has finished. It helps to clearly see what code is actually in use. Also the livepatch might then be seen as a "normal" module that modifies the kernel behavior. The only difference is that it can be updated at runtime without breaking its functionality.
Features #
The atomic replace allows:
Atomically revert some functions in a previous patch while upgrading other functions.
Remove eventual performance impact caused by core redirection for functions that are no longer patched.
Decrease user confusion about dependencies between livepatches.
Limitations: #
Once the operation finishes, there is no straightforward way to reverse it and restore the replaced patches atomically.
A good practice is to set .replace flag in any released livepatch. Then re-adding an older livepatch is equivalent to downgrading to that patch. This is safe as long as the livepatches do _not_ do extra modifications in (un)patching callbacks or in the module_init() or module_exit() functions, see below.
Also note that the replaced patch can be removed and loaded again only when the transition was not forced.
Only the (un)patching callbacks from the _new_ cumulative livepatch are executed. Any callbacks from the replaced patches are ignored.
In other words, the cumulative patch is responsible for doing any actions that are necessary to properly replace any older patch.
As a result, it might be dangerous to replace newer cumulative patches by older ones. The old livepatches might not provide the necessary callbacks.
This might be seen as a limitation in some scenarios. But it makes life easier in many others. Only the new cumulative livepatch knows what fixes/features are added/removed and what special actions are necessary for a smooth transition.
In any case, it would be a nightmare to think about the order of the various callbacks and their interactions if the callbacks from all enabled patches were called.
There is no special handling of shadow variables. Livepatch authors must create their own rules how to pass them from one cumulative patch to the other. Especially that they should not blindly remove them in module_exit() functions.
A good practice might be to remove shadow variables in the post-unpatch callback. It is called only when the livepatch is properly disabled.
Livepatch
Peios Kernel / Kernel development / Livepatch
This document outlines basic information about kernel livepatching.
1. Motivation #
There are many situations where users are reluctant to reboot a system. It may be because their system is performing complex scientific computations or under heavy load during peak usage. In addition to keeping systems up and running, users want to also have a stable and secure system. Livepatching gives users both by allowing for function calls to be redirected; thus, fixing critical functions without a system reboot.
2. Kprobes, Ftrace, Livepatching #
There are multiple mechanisms in the Linux kernel that are directly related to redirection of code execution; namely: kernel probes, function tracing, and livepatching:
The kernel probes are the most generic. The code can be redirected by putting a breakpoint instruction instead of any instruction.
The function tracer calls the code from a predefined location that is close to the function entry point. This location is generated by the compiler using the '-pg' gcc option.
Livepatching typically needs to redirect the code at the very beginning of the function entry before the function parameters or the stack are in any way modified.
All three approaches need to modify the existing code at runtime. Therefore they need to be aware of each other and not step over each other's toes. Most of these problems are solved by using the dynamic ftrace framework as a base. A Kprobe is registered as a ftrace handler when the function entry is probed, see CONFIG_KPROBES_ON_FTRACE. Also an alternative function from a live patch is called with the help of a custom ftrace handler. But there are some limitations, see below.
3. Consistency model #
Functions are there for a reason. They take some input parameters, acquire or release locks, read, process, and even write some data in a defined way, have return values. In other words, each function has a defined semantic.
Many fixes do not change the semantic of the modified functions. For example, they add a NULL pointer or a boundary check, fix a race by adding a missing memory barrier, or add some locking around a critical section. Most of these changes are self contained and the function presents itself the same way to the rest of the system. In this case, the functions might be updated independently one by one.
But there are more complex fixes. For example, a patch might change ordering of locking in multiple functions at the same time. Or a patch might exchange meaning of some temporary structures and update all the relevant functions. In this case, the affected unit (thread, whole kernel) need to start using all new versions of the functions at the same time. Also the switch must happen only when it is safe to do so, e.g. when the affected locks are released or no data are stored in the modified structures at the moment.
The theory about how to apply functions a safe way is rather complex. The aim is to define a so-called consistency model. It attempts to define conditions when the new implementation could be used so that the system stays consistent.
Livepatch has a consistency model which is a hybrid of kGraft and kpatch: it uses kGraft's per-task consistency and syscall barrier switching combined with kpatch's stack trace switching. There are also a number of fallback options which make it quite flexible.
Patches are applied on a per-task basis, when the task is deemed safe to switch over. When a patch is enabled, livepatch enters into a transition state where tasks are converging to the patched state. Usually this transition state can complete in a few seconds. The same sequence occurs when a patch is disabled, except the tasks converge from the patched state to the unpatched state.
An interrupt handler inherits the patched state of the task it interrupts. The same is true for forked tasks: the child inherits the patched state of the parent.
Livepatch uses several complementary approaches to determine when it's safe to patch tasks:
-
The first and most effective approach is stack checking of sleeping tasks. If no affected functions are on the stack of a given task, the task is patched. In most cases this will patch most or all of the tasks on the first try. Otherwise it'll keep trying periodically. This option is only available if the architecture has reliable stacks (HAVE_RELIABLE_STACKTRACE).
-
The second approach, if needed, is kernel exit switching. A task is switched when it returns to user space from a system call, a user space IRQ, or a signal. It's useful in the following cases:
-
a) Patching I/O-bound user tasks which are sleeping on an affected function. In this case you have to send SIGSTOP and SIGCONT to force it to exit the kernel and be patched.
-
b) Patching CPU-bound user tasks. If the task is highly CPU-bound then it will get patched the next time it gets interrupted by an IRQ.
-
-
For idle "swapper" tasks, since they don't ever exit the kernel, they instead have a klp_update_patch_state() call in the idle loop which allows them to be patched before the CPU enters the idle state.
(Note there's not yet such an approach for kthreads.)
Architectures which don't have HAVE_RELIABLE_STACKTRACE solely rely on the second approach. It's highly likely that some tasks may still be running with an old version of the function, until that function returns. In this case you would have to signal the tasks. This especially applies to kthreads. They may not be woken up and would need to be forced. See below for more information.
Unless we can come up with another way to patch kthreads, architectures without HAVE_RELIABLE_STACKTRACE are not considered fully supported by the kernel livepatching.
The /sys/kernel/livepatch/<patch>/transition file shows whether a patch is in transition. Only a single patch can be in transition at a given time. A patch can remain in transition indefinitely, if any of the tasks are stuck in the initial patch state.
A transition can be reversed and effectively canceled by writing the opposite value to the /sys/kernel/livepatch/<patch>/enabled file while the transition is in progress. Then all the tasks will attempt to converge back to the original patch state.
There's also a /proc/<pid>/patch_state file which can be used to determine which tasks are blocking completion of a patching operation. If a patch is in transition, this file shows 0 to indicate the task is unpatched and 1 to indicate it's patched. Otherwise, if no patch is in transition, it shows -1. Any tasks which are blocking the transition can be signaled with SIGSTOP and SIGCONT to force them to change their patched state. This may be harmful to the system though. Sending a fake signal to all remaining blocking tasks is a better alternative. No proper signal is actually delivered (there is no data in signal pending structures). Tasks are interrupted or woken up, and forced to change their patched state. The fake signal is automatically sent every 15 seconds.
Administrator can also affect a transition through /sys/kernel/livepatch/<patch>/force attribute. Writing 1 there clears TIF_PATCH_PENDING flag of all tasks and thus forces the tasks to the patched state. Important note! The force attribute is intended for cases when the transition gets stuck for a long time because of a blocking task. Administrator is expected to collect all necessary data (namely stack traces of such blocking tasks) and request a clearance from a patch distributor to force the transition. Unauthorized usage may cause harm to the system. It depends on the nature of the patch, which functions are (un)patched, and which functions the blocking tasks are sleeping in (/proc/<pid>/stack may help here). Removal (rmmod) of patch modules is permanently disabled when the force feature is used. It cannot be guaranteed there is no task sleeping in such module. It implies unbounded reference count if a patch module is disabled and enabled in a loop.
Moreover, the usage of force may also affect future applications of live patches and cause even more harm to the system. Administrator should first consider to simply cancel a transition (see above). If force is used, reboot should be planned and no more live patches applied.
3.1 Adding consistency model support to new architectures #
For adding consistency model support to new architectures, there are a few options:
-
Add CONFIG_HAVE_RELIABLE_STACKTRACE. This means porting objtool, and for non-DWARF unwinders, also making sure there's a way for the stack tracing code to detect interrupts on the stack.
-
Alternatively, ensure that every kthread has a call to klp_update_patch_state() in a safe location. Kthreads are typically in an infinite loop which does some action repeatedly. The safe location to switch the kthread's patch state would be at a designated point in the loop where there are no locks taken and all data structures are in a well-defined state.
The location is clear when using workqueues or the kthread worker API. These kthreads process independent actions in a generic loop.
It's much more complicated with kthreads which have a custom loop. There the safe location must be carefully selected on a case-by-case basis.
In that case, arches without HAVE_RELIABLE_STACKTRACE would still be able to use the non-stack-checking parts of the consistency model:
-
a) patching user tasks when they cross the kernel/user space boundary; and
-
b) patching kthreads and idle tasks at their designated patch points.
This option isn't as good as option 1 because it requires signaling user tasks and waking kthreads to patch them. But it could still be a good backup option for those architectures which don't have reliable stack traces yet.
-
4. Livepatch module #
Livepatches are distributed using kernel modules, see samples/livepatch/livepatch-sample.c.
The module includes a new implementation of functions that we want to replace. In addition, it defines some structures describing the relation between the original and the new implementation. Then there is code that makes the kernel start using the new code when the livepatch module is loaded. Also there is code that cleans up before the livepatch module is removed. All this is explained in more details in the next sections.
4.1. New functions #
New versions of functions are typically just copied from the original sources. A good practice is to add a prefix to the names so that they can be distinguished from the original ones, e.g. in a backtrace. Also they can be declared as static because they are not called directly and do not need the global visibility.
The patch contains only functions that are really modified. But they might want to access functions or data from the original source file that may only be locally accessible. This can be solved by a special relocation section in the generated livepatch module, see Documentation/livepatch/module-elf-format.rst for more details.
4.2. Metadata #
The patch is described by several structures that split the information into three levels:
struct klp_func is defined for each patched function. It describes the relation between the original and the new implementation of a particular function.
The structure includes the name, as a string, of the original function. The function address is found via kallsyms at runtime.
Then it includes the address of the new function. It is defined directly by assigning the function pointer. Note that the new function is typically defined in the same source file.
As an optional parameter, the symbol position in the kallsyms database can be used to disambiguate functions of the same name. This is not the absolute position in the database, but rather the order it has been found only for a particular object ( vmlinux or a kernel module ). Note that kallsyms allows for searching symbols according to the object name.
struct klp_object defines an array of patched functions (struct klp_func) in the same object. Where the object is either vmlinux (NULL) or a module name.
The structure helps to group and handle functions for each object together. Note that patched modules might be loaded later than the patch itself and the relevant functions might be patched only when they are available.
struct klp_patch defines an array of patched objects (struct klp_object).
This structure handles all patched functions consistently and eventually, synchronously. The whole patch is applied only when all patched symbols are found. The only exception are symbols from objects (kernel modules) that have not been loaded yet.
For more details on how the patch is applied on a per-task basis, see the "Consistency model" section.
5. Livepatch life-cycle #
Livepatching can be described by five basic operations: loading, enabling, replacing, disabling, removing.
Where the replacing and the disabling operations are mutually exclusive. They have the same result for the given patch but not for the system.
5.1. Loading #
The only reasonable way is to enable the patch when the livepatch kernel module is being loaded. For this, klp_enable_patch() has to be called in the module_init() callback. There are two main reasons:
First, only the module has an easy access to the related struct klp_patch.
Second, the error code might be used to refuse loading the module when the patch cannot get enabled.
5.2. Enabling #
The livepatch gets enabled by calling klp_enable_patch() from the module_init() callback. The system will start using the new implementation of the patched functions at this stage.
First, the addresses of the patched functions are found according to their names. The special relocations, mentioned in the section "New functions", are applied. The relevant entries are created under /sys/kernel/livepatch/<name>. The patch is rejected when any above operation fails.
Second, livepatch enters into a transition state where tasks are converging to the patched state. If an original function is patched for the first time, a function specific struct klp_ops is created and an universal ftrace handler is registered1. This stage is indicated by a value of '1' in /sys/kernel/livepatch/<name>/transition. For more information about this process, see the "Consistency model" section.
Finally, once all tasks have been patched, the 'transition' value changes to '0'.
[1] Note that functions might be patched multiple times. The ftrace handler is registered only once for a given function. Further patches just add an entry to the list (see field func_stack) of the struct klp_ops. The right implementation is selected by the ftrace handler, see the "Consistency model" section.
That said, it is highly recommended to use cumulative livepatches because they help keeping the consistency of all changes. In this case, functions might be patched two times only during the transition period.
5.3. Replacing #
All enabled patches might get replaced by a cumulative patch that has the .replace flag set.
Once the new patch is enabled and the 'transition' finishes then all the functions (struct klp_func) associated with the replaced patches are removed from the corresponding struct klp_ops. Also the ftrace handler is unregistered and the struct klp_ops is freed when the related function is not modified by the new patch and func_stack list becomes empty.
See Documentation/livepatch/cumulative-patches.rst for more details.
5.4. Disabling #
Enabled patches might get disabled by writing '0' to /sys/kernel/livepatch/<name>/enabled.
First, livepatch enters into a transition state where tasks are converging to the unpatched state. The system starts using either the code from the previously enabled patch or even the original one. This stage is indicated by a value of '1' in /sys/kernel/livepatch/<name>/transition. For more information about this process, see the "Consistency model" section.
Second, once all tasks have been unpatched, the 'transition' value changes to '0'. All the functions (struct klp_func) associated with the to-be-disabled patch are removed from the corresponding struct klp_ops. The ftrace handler is unregistered and the struct klp_ops is freed when the func_stack list becomes empty.
Third, the sysfs interface is destroyed.
5.5. Removing #
Module removal is only safe when there are no users of functions provided by the module. This is the reason why the force feature permanently disables the removal. Only when the system is successfully transitioned to a new patch state (patched/unpatched) without being forced it is guaranteed that no task sleeps or runs in the old code.
6. Sysfs #
Information about the registered patches can be found under /sys/kernel/livepatch. The patches could be enabled and disabled by writing there.
/sys/kernel/livepatch/<patch>/force attributes allow administrator to affect a patching operation.
See Documentation/ABI/testing/sysfs-kernel-livepatch for more details.
7. Limitations #
The current Livepatch implementation has several limitations:
Only functions that can be traced could be patched.
Livepatch is based on the dynamic ftrace. In particular, functions implementing ftrace or the livepatch ftrace handler could not be patched. Otherwise, the code would end up in an infinite loop. A potential mistake is prevented by marking the problematic functions by "notrace".
Livepatch works reliably only when the dynamic ftrace is located at the very beginning of the function.
The function need to be redirected before the stack or the function parameters are modified in any way. For example, livepatch requires using -fentry gcc compiler option on x86_64.
One exception is the PPC port. It uses relative addressing and TOC. Each function has to handle TOC and save LR before it could call the ftrace handler. This operation has to be reverted on return. Fortunately, the generic ftrace code has the same problem and all this is handled on the ftrace level.
Kretprobes using the ftrace framework conflict with the patched functions.
Both kretprobes and livepatches use a ftrace handler that modifies the return address. The first user wins. Either the probe or the patch is rejected when the handler is already in use by the other.
Kprobes in the original function are ignored when the code is redirected to the new implementation.
There is a work in progress to add warnings about this situation.
Livepatch module ELF format
Peios Kernel / Kernel development / Livepatch
This document outlines the ELF format requirements that livepatch modules must follow.
1. Background and motivation #
Formerly, livepatch required separate architecture-specific code to write relocations. However, arch-specific code to write relocations already exists in the module loader, so this former approach produced redundant code. So, instead of duplicating code and re-implementing what the module loader can already do, livepatch leverages existing code in the module loader to perform the all the arch-specific relocation work. Specifically, livepatch reuses the apply_relocate_add() function in the module loader to write relocations. The patch module ELF format described in this document enables livepatch to be able to do this. The hope is that this will make livepatch more easily portable to other architectures and reduce the amount of arch-specific code required to port livepatch to a particular architecture.
Since apply_relocate_add() requires access to a module's section header table, symbol table, and relocation section indices, ELF information is preserved for livepatch modules (see section 5). Livepatch manages its own relocation sections and symbols, which are described in this document. The ELF constants used to mark livepatch symbols and relocation sections were selected from OS-specific ranges according to the definitions from glibc.
Why does livepatch need to write its own relocations? #
A typical livepatch module contains patched versions of functions that can reference non-exported global symbols and non-included local symbols. Relocations referencing these types of symbols cannot be left in as-is since the kernel module loader cannot resolve them and will therefore reject the livepatch module. Furthermore, we cannot apply relocations that affect modules not yet loaded at patch module load time (e.g. a patch to a driver that is not loaded). Formerly, livepatch solved this problem by embedding special "dynrela" (dynamic rela) sections in the resulting patch module ELF output. Using these dynrela sections, livepatch could resolve symbols while taking into account its scope and what module the symbol belongs to, and then manually apply the dynamic relocations. However this approach required livepatch to supply arch-specific code in order to write these relocations. In the new format, livepatch manages its own SHT_RELA relocation sections in place of dynrela sections, and the symbols that the relas reference are special livepatch symbols (see section 2 and 3). The arch-specific livepatch relocation code is replaced by a call to apply_relocate_add().
2. Livepatch modinfo field #
Livepatch modules are required to have the "livepatch" modinfo attribute. See the sample livepatch module in samples/livepatch/ for how this is done.
Livepatch modules can be identified by users by using the 'modinfo' command and looking for the presence of the "livepatch" field. This field is also used by the kernel module loader to identify livepatch modules.
Example: #
Modinfo output:
% modinfo livepatch-meminfo.ko
filename: livepatch-meminfo.ko
livepatch: Y
license: GPL
depends:
vermagic: 4.3.0+ SMP mod_unload
3. Livepatch relocation sections #
A livepatch module manages its own ELF relocation sections to apply relocations to modules as well as to the kernel (vmlinux) at the appropriate time. For example, if a patch module patches a driver that is not currently loaded, livepatch will apply the corresponding livepatch relocation section(s) to the driver once it loads.
Each "object" (e.g. vmlinux, or a module) within a patch module may have multiple livepatch relocation sections associated with it (e.g. patches to multiple functions within the same object). There is a 1-1 correspondence between a livepatch relocation section and the target section (usually the text section of a function) to which the relocation(s) apply. It is also possible for a livepatch module to have no livepatch relocation sections, as in the case of the sample livepatch module (see samples/livepatch).
Since ELF information is preserved for livepatch modules (see Section 5), a livepatch relocation section can be applied simply by passing in the appropriate section index to apply_relocate_add(), which then uses it to access the relocation section and apply the relocations.
Every symbol referenced by a rela in a livepatch relocation section is a livepatch symbol. These must be resolved before livepatch can call apply_relocate_add(). See Section 3 for more information.
3.1 Livepatch relocation section format #
Livepatch relocation sections must be marked with the SHF_RELA_LIVEPATCH section flag. See include/uapi/linux/elf.h for the definition. The module loader recognizes this flag and will avoid applying those relocation sections at patch module load time. These sections must also be marked with SHF_ALLOC, so that the module loader doesn't discard them on module load (i.e. they will be copied into memory along with the other SHF_ALLOC sections).
The name of a livepatch relocation section must conform to the following format:
.klp.rela.objname.section_name
^ ^^ ^ ^ ^
|________||_____| |__________|
[A] [B] [C]
-
[A]
The relocation section name is prefixed with the string ".klp.rela."
-
[B]
The name of the object (i.e. "vmlinux" or name of module) to which the relocation section belongs follows immediately after the prefix.
-
[C]
The actual name of the section to which this relocation section applies.
Examples: #
Livepatch relocation section names:
.klp.rela.ext4.text.ext4_attr_store
.klp.rela.vmlinux.text.cmdline_proc_show
`readelf --sections` output for a patch module that patches vmlinux and modules 9p, btrfs, ext4:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ snip ]
[29] .klp.rela.9p.text.caches.show RELA 0000000000000000 002d58 0000c0 18 AIo 64 9 8
[30] .klp.rela.btrfs.text.btrfs.feature.attr.show RELA 0000000000000000 002e18 000060 18 AIo 64 11 8
[ snip ]
[34] .klp.rela.ext4.text.ext4.attr.store RELA 0000000000000000 002fd8 0000d8 18 AIo 64 13 8
[35] .klp.rela.ext4.text.ext4.attr.show RELA 0000000000000000 0030b0 000150 18 AIo 64 15 8
[36] .klp.rela.vmlinux.text.cmdline.proc.show RELA 0000000000000000 003200 000018 18 AIo 64 17 8
[37] .klp.rela.vmlinux.text.meminfo.proc.show RELA 0000000000000000 003218 0000f0 18 AIo 64 19 8
[ snip ] ^ ^
| |
[*] [*]
-
[*]
Livepatch relocation sections are SHT_RELA sections but with a few special characteristics. Notice that they are marked SHF_ALLOC ("A") so that they will not be discarded when the module is loaded into memory, as well as with the SHF_RELA_LIVEPATCH flag ("o" - for OS-specific).
`readelf --relocs` output for a patch module:
Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4
0000000000000028 0000003d0000000b R_X86_64_32S 0000000000000000 .klp.sym.btrfs.btrfs_ktype,0 + 0
0000000000000036 0000003b00000002 R_X86_64_PC32 0000000000000000 .klp.sym.btrfs.can_modify_feature.isra.3,0 - 4
000000000000004c 0000004900000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.snprintf,0 - 4
[ snip ] ^
|
[*]
-
[*]
Every symbol referenced by a relocation is a livepatch symbol.
4. Livepatch symbols #
Livepatch symbols are symbols referred to by livepatch relocation sections. These are symbols accessed from new versions of functions for patched objects, whose addresses cannot be resolved by the module loader (because they are local or unexported global syms). Since the module loader only resolves exported syms, and not every symbol referenced by the new patched functions is exported, livepatch symbols were introduced. They are used also in cases where we cannot immediately know the address of a symbol when a patch module loads. For example, this is the case when livepatch patches a module that is not loaded yet. In this case, the relevant livepatch symbols are resolved simply when the target module loads. In any case, for any livepatch relocation section, all livepatch symbols referenced by that section must be resolved before livepatch can call apply_relocate_add() for that reloc section.
Livepatch symbols must be marked with SHN_LIVEPATCH so that the module loader can identify and ignore them. Livepatch modules keep these symbols in their symbol tables, and the symbol table is made accessible through module->symtab.
4.1 A livepatch module's symbol table #
Normally, a stripped down copy of a module's symbol table (containing only "core" symbols) is made available through module->symtab (See layout_symtab() in kernel/module/kallsyms.c). For livepatch modules, the symbol table copied into memory on module load must be exactly the same as the symbol table produced when the patch module was compiled. This is because the relocations in each livepatch relocation section refer to their respective symbols with their symbol indices, and the original symbol indices (and thus the symtab ordering) must be preserved in order for apply_relocate_add() to find the right symbol.
For example, take this particular rela from a livepatch module:
Relocation section '.klp.rela.btrfs.text.btrfs_feature_attr_show' at offset 0x2ba0 contains 4 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
000000000000001f 0000005e00000002 R_X86_64_PC32 0000000000000000 .klp.sym.vmlinux.printk,0 - 4
This rela refers to the symbol '.klp.sym.vmlinux.printk,0', and the symbol index is encoded in 'Info'. Here its symbol index is 0x5e, which is 94 in decimal, which refers to the symbol index 94.
And in this patch module's corresponding symbol table, symbol index 94 refers to that very symbol:
[ snip ]
94: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.printk,0
[ snip ]
4.2 Livepatch symbol format #
Livepatch symbols must have their section index marked as SHN_LIVEPATCH, so that the module loader can identify them and not attempt to resolve them. See include/uapi/linux/elf.h for the actual definitions.
Livepatch symbol names must conform to the following format:
.klp.sym.objname.symbol_name,sympos
^ ^^ ^ ^ ^ ^
|_______||_____| |_________| |
[A] [B] [C] [D]
-
[A]
The symbol name is prefixed with the string ".klp.sym."
-
[B]
The name of the object (i.e. "vmlinux" or name of module) to which the symbol belongs follows immediately after the prefix.
-
[C]
The actual name of the symbol.
-
[D]
The position of the symbol in the object (as according to kallsyms) This is used to differentiate duplicate symbols within the same object. The symbol position is expressed numerically (0, 1, 2...). The symbol position of a unique symbol is 0.
Examples: #
Livepatch symbol names:
.klp.sym.vmlinux.snprintf,0
.klp.sym.vmlinux.printk,0
.klp.sym.btrfs.btrfs_ktype,0
`readelf --symbols` output for a patch module:
Symbol table '.symtab' contains 127 entries:
Num: Value Size Type Bind Vis Ndx Name
[ snip ]
73: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.snprintf,0
74: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.capable,0
75: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.find_next_bit,0
76: 0000000000000000 0 NOTYPE GLOBAL DEFAULT OS [0xff20] .klp.sym.vmlinux.si_swapinfo,0
[ snip ] ^
|
[*]
-
[*]
Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). "OS" means OS-specific.
5. Symbol table and ELF section access #
A livepatch module's symbol table is accessible through module->symtab.
Since apply_relocate_add() requires access to a module's section headers, symbol table, and relocation section indices, ELF information is preserved for livepatch modules and is made accessible by the module loader through module->klp_info, which is a klp_modinfo struct. When a livepatch module loads, this struct is filled in by the module loader.
Reliable Stacktrace
Peios Kernel / Kernel development / Livepatch
This document outlines basic information about reliable stacktracing.
1. Introduction #
The kernel livepatch consistency model relies on accurately identifying which functions may have live state and therefore may not be safe to patch. One way to identify which functions are live is to use a stacktrace.
Existing stacktrace code may not always give an accurate picture of all functions with live state, and best-effort approaches which can be helpful for debugging are unsound for livepatching. Livepatching depends on architectures to provide a reliable stacktrace which ensures it never omits any live functions from a trace.
2. Requirements #
Architectures must implement one of the reliable stacktrace functions. Architectures using CONFIG_ARCH_STACKWALK must implement 'arch_stack_walk_reliable', and other architectures must implement 'save_stack_trace_tsk_reliable'.
Principally, the reliable stacktrace function must ensure that either:
-
The trace includes all functions that the task may be returned to, and the return code is zero to indicate that the trace is reliable.
-
The return code is non-zero to indicate that the trace is not reliable.
Secondly, the reliable stacktrace function must be robust to cases where the stack or other unwind state is corrupt or otherwise unreliable. The function should attempt to detect such cases and return a non-zero error code, and should not get stuck in an infinite loop or access memory in an unsafe way. Specific cases are described in further detail below.
3. Compile-time analysis #
To ensure that kernel code can be correctly unwound in all cases, architectures may need to verify that code has been compiled in a manner expected by the unwinder. For example, an unwinder may expect that functions manipulate the stack pointer in a limited way, or that all functions use specific prologue and epilogue sequences. Architectures with such requirements should verify the kernel compilation using objtool.
In some cases, an unwinder may require metadata to correctly unwind. Where necessary, this metadata should be generated at build time using objtool.
4. Considerations #
The unwinding process varies across architectures, their respective procedure call standards, and kernel configurations. This section describes common details that architectures should consider.
4.1 Identifying successful termination #
Unwinding may terminate early for a number of reasons, including:
-
Stack or frame pointer corruption.
-
Missing unwind support for an uncommon scenario, or a bug in the unwinder.
-
Dynamically generated code (e.g. eBPF) or foreign code (e.g. EFI runtime services) not following the conventions expected by the unwinder.
To ensure that this does not result in functions being omitted from the trace, even if not caught by other checks, it is strongly recommended that architectures verify that a stacktrace ends at an expected location, e.g.
-
Within a specific function that is an entry point to the kernel.
-
At a specific location on a stack expected for a kernel entry point.
-
On a specific stack expected for a kernel entry point (e.g. if the architecture has separate task and IRQ stacks).
4.2 Identifying unwindable code #
Unwinding typically relies on code following specific conventions (e.g. manipulating a frame pointer), but there can be code which may not follow these conventions and may require special handling in the unwinder, e.g.
-
Exception vectors and entry assembly.
-
Procedure Linkage Table (PLT) entries and veneer functions.
-
Trampoline assembly (e.g. ftrace, kprobes).
-
Dynamically generated code (e.g. eBPF, optprobe trampolines).
-
Foreign code (e.g. EFI runtime services).
To ensure that such cases do not result in functions being omitted from a trace, it is strongly recommended that architectures positively identify code which is known to be reliable to unwind from, and reject unwinding from all other code.
Kernel code including modules and eBPF can be distinguished from foreign code using '__kernel_text_address()'. Checking for this also helps to detect stack corruption.
There are several ways an architecture may identify kernel code which is deemed unreliable to unwind from, e.g.
-
Placing such code into special linker sections, and rejecting unwinding from any code in these sections.
-
Identifying specific portions of code using bounds information.
4.3 Unwinding across interrupts and exceptions #
At function call boundaries the stack and other unwind state is expected to be in a consistent state suitable for reliable unwinding, but this may not be the case part-way through a function. For example, during a function prologue or epilogue a frame pointer may be transiently invalid, or during the function body the return address may be held in an arbitrary general purpose register. For some architectures this may change at runtime as a result of dynamic instrumentation.
If an interrupt or other exception is taken while the stack or other unwind state is in an inconsistent state, it may not be possible to reliably unwind, and it may not be possible to identify whether such unwinding will be reliable. See below for examples.
Architectures which cannot identify when it is reliable to unwind such cases (or where it is never reliable) must reject unwinding across exception boundaries. Note that it may be reliable to unwind across certain exceptions (e.g. IRQ) but unreliable to unwind across other exceptions (e.g. NMI).
Architectures which can identify when it is reliable to unwind such cases (or have no such cases) should attempt to unwind across exception boundaries, as doing so can prevent unnecessarily stalling livepatch consistency checks and permits livepatch transitions to complete more quickly.
4.4 Rewriting of return addresses #
Some trampolines temporarily modify the return address of a function in order to intercept when that function returns with a return trampoline, e.g.
-
An ftrace trampoline may modify the return address so that function graph tracing can intercept returns.
-
A kprobes (or optprobes) trampoline may modify the return address so that kretprobes can intercept returns.
When this happens, the original return address will not be in its usual location. For trampolines which are not subject to live patching, where an unwinder can reliably determine the original return address and no unwind state is altered by the trampoline, the unwinder may report the original return address in place of the trampoline and report this as reliable. Otherwise, an unwinder must report these cases as unreliable.
Special care is required when identifying the original return address, as this information is not in a consistent location for the duration of the entry trampoline or return trampoline. For example, considering the x86_64 'return_to_handler' return trampoline:
SYM_CODE_START(return_to_handler)
UNWIND_HINT_UNDEFINED
subq $24, %rsp
/* Save the return values */
movq %rax, (%rsp)
movq %rdx, 8(%rsp)
movq %rbp, %rdi
call ftrace_return_to_handler
movq %rax, %rdi
movq 8(%rsp), %rdx
movq (%rsp), %rax
addq $24, %rsp
JMP_NOSPEC rdi
SYM_CODE_END(return_to_handler)
While the traced function runs its return address on the stack points to the start of return_to_handler, and the original return address is stored in the task's cur_ret_stack. During this time the unwinder can find the return address using ftrace_graph_ret_addr().
When the traced function returns to return_to_handler, there is no longer a return address on the stack, though the original return address is still stored in the task's cur_ret_stack. Within ftrace_return_to_handler(), the original return address is removed from cur_ret_stack and is transiently moved arbitrarily by the compiler before being returned in rax. The return_to_handler trampoline moves this into rdi before jumping to it.
Architectures might not always be able to unwind such sequences, such as when ftrace_return_to_handler() has removed the address from cur_ret_stack, and the location of the return address cannot be reliably determined.
It is recommended that architectures unwind cases where return_to_handler has not yet been returned to, but architectures are not required to unwind from the middle of return_to_handler and can report this as unreliable. Architectures are not required to unwind from other trampolines which modify the return address.
4.5 Obscuring of return addresses #
Some trampolines do not rewrite the return address in order to intercept returns, but do transiently clobber the return address or other unwind state.
For example, the x86_64 implementation of optprobes patches the probed function with a JMP instruction which targets the associated optprobe trampoline. When the probe is hit, the CPU will branch to the optprobe trampoline, and the address of the probed function is not held in any register or on the stack.
Similarly, the arm64 implementation of DYNAMIC_FTRACE_WITH_REGS patches traced functions with the following:
MOV X9, X30
BL <trampoline>
The MOV saves the link register (X30) into X9 to preserve the return address before the BL clobbers the link register and branches to the trampoline. At the start of the trampoline, the address of the traced function is in X9 rather than the link register as would usually be the case.
Architectures must either ensure that unwinders either reliably unwind such cases, or report the unwinding as unreliable.
4.6 Link register unreliability #
On some other architectures, 'call' instructions place the return address into a link register, and 'return' instructions consume the return address from the link register without modifying the register. On these architectures software must save the return address to the stack prior to making a function call. Over the duration of a function call, the return address may be held in the link register alone, on the stack alone, or in both locations.
Unwinders typically assume the link register is always live, but this assumption can lead to unreliable stack traces. For example, consider the following arm64 assembly for a simple function:
function:
STP X29, X30, [SP, -16]!
MOV X29, SP
BL <other_function>
LDP X29, X30, [SP], #16
RET
At entry to the function, the link register (x30) points to the caller, and the frame pointer (X29) points to the caller's frame including the caller's return address. The first two instructions create a new stackframe and update the frame pointer, and at this point the link register and the frame pointer both describe this function's return address. A trace at this point may describe this function twice, and if the function return is being traced, the unwinder may consume two entries from the fgraph return stack rather than one entry.
The BL invokes 'other_function' with the link register pointing to this function's LDR and the frame pointer pointing to this function's stackframe. When 'other_function' returns, the link register is left pointing at the BL, and so a trace at this point could result in 'function' appearing twice in the backtrace.
Similarly, a function may deliberately clobber the LR, e.g.
caller:
STP X29, X30, [SP, -16]!
MOV X29, SP
ADR LR, <callee>
BLR LR
LDP X29, X30, [SP], #16
RET
The ADR places the address of 'callee' into the LR, before the BLR branches to this address. If a trace is made immediately after the ADR, 'callee' will appear to be the parent of 'caller', rather than the child.
Due to cases such as the above, it may only be possible to reliably consume a link register value at a function call boundary. Architectures where this is the case must reject unwinding across exception boundaries unless they can reliably identify when the LR or stack value should be used (e.g. using metadata generated by objtool).
Shadow Variables
Peios Kernel / Kernel development / Livepatch
Shadow variables are a simple way for livepatch modules to associate additional "shadow" data with existing data structures. Shadow data is allocated separately from parent data structures, which are left unmodified. The shadow variable API described in this document is used to allocate/add and remove/free shadow variables to/from their parents.
The implementation introduces a global, in-kernel hashtable that associates pointers to parent objects and a numeric identifier of the shadow data. The numeric identifier is a simple enumeration that may be used to describe shadow variable version, class or type, etc. More specifically, the parent pointer serves as the hashtable key while the numeric id subsequently filters hashtable queries. Multiple shadow variables may attach to the same parent object, but their numeric identifier distinguishes between them.
1. Brief API summary #
(See the full API usage docbook notes in livepatch/shadow.c.)
A hashtable references all shadow variables. These references are stored and retrieved through a <obj, id> pair.
-
The klp_shadow variable data structure encapsulates both tracking meta-data and shadow-data:
-
meta-data
-
obj - pointer to parent object
-
id - data identifier
-
-
data[] - storage for shadow data
-
It is important to note that the klp_shadow_alloc() and klp_shadow_get_or_alloc() are zeroing the variable by default. They also allow to call a custom constructor function when a non-zero value is needed. Callers should provide whatever mutual exclusion is required.
Note that the constructor is called under klp_shadow_lock spinlock. It allows to do actions that can be done only once when a new variable is allocated.
-
klp_shadow_get() - retrieve a shadow variable data pointer - search hashtable for <obj, id> pair
-
klp_shadow_alloc() - allocate and add a new shadow variable - search hashtable for <obj, id> pair
-
if exists
- WARN and return NULL
-
if <obj, id> doesn't already exist
-
allocate a new shadow variable
-
initialize the variable using a custom constructor and data when provided
-
add <obj, id> to the global hashtable
-
-
-
klp_shadow_get_or_alloc() - get existing or alloc a new shadow variable - search hashtable for <obj, id> pair
-
if exists
- return existing shadow variable
-
if <obj, id> doesn't already exist
-
allocate a new shadow variable
-
initialize the variable using a custom constructor and data when provided
-
add <obj, id> pair to the global hashtable
-
-
-
klp_shadow_free() - detach and free a <obj, id> shadow variable - find and remove a <obj, id> reference from global hashtable
-
if found
-
call destructor function if defined
-
free shadow variable
-
-
-
klp_shadow_free_all() - detach and free all <_, id> shadow variables - find and remove any <_, id> references from global hashtable
-
if found
-
call destructor function if defined
-
free shadow variable
-
-
2. Use cases #
(See the example shadow variable livepatch modules in samples/livepatch/ for full working demonstrations.)
For the following use-case examples, consider commit 1d147bfa6429 ("mac80211: fix AP powersave TX vs. wakeup race"), which added a spinlock to net/mac80211/sta_info.h :: struct sta_info. Each use-case example can be considered a stand-alone livepatch implementation of this fix.
Matching parent's lifecycle #
If parent data structures are frequently created and destroyed, it may be easiest to align their shadow variables lifetimes to the same allocation and release functions. In this case, the parent data structure is typically allocated, initialized, then registered in some manner. Shadow variable allocation and setup can then be considered part of the parent's initialization and should be completed before the parent "goes live" (ie, any shadow variable get-API requests are made for this <obj, id> pair.)
For commit 1d147bfa6429, when a parent sta_info structure is allocated, allocate a shadow copy of the ps_lock pointer, then initialize it:
#define PS_LOCK 1
struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
const u8 *addr, gfp_t gfp)
{
struct sta_info *sta;
spinlock_t *ps_lock;
/* Parent structure is created */
sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
/* Attach a corresponding shadow variable, then initialize it */
ps_lock = klp_shadow_alloc(sta, PS_LOCK, sizeof(*ps_lock), gfp,
NULL, NULL);
if (!ps_lock)
goto shadow_fail;
spin_lock_init(ps_lock);
...
When requiring a ps_lock, query the shadow variable API to retrieve one for a specific struct sta_info::
void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
{
spinlock_t *ps_lock;
/* sync with ieee80211_tx_h_unicast_ps_buf */
ps_lock = klp_shadow_get(sta, PS_LOCK);
if (ps_lock)
spin_lock(ps_lock);
...
When the parent sta_info structure is freed, first free the shadow variable:
void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
{
klp_shadow_free(sta, PS_LOCK, NULL);
kfree(sta);
...
In-flight parent objects #
Sometimes it may not be convenient or possible to allocate shadow variables alongside their parent objects. Or a livepatch fix may require shadow variables for only a subset of parent object instances. In these cases, the klp_shadow_get_or_alloc() call can be used to attach shadow variables to parents already in-flight.
For commit 1d147bfa6429, a good spot to allocate a shadow spinlock is inside ieee80211_sta_ps_deliver_wakeup():
int ps_lock_shadow_ctor(void *obj, void *shadow_data, void *ctor_data)
{
spinlock_t *lock = shadow_data;
spin_lock_init(lock);
return 0;
}
#define PS_LOCK 1
void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
{
spinlock_t *ps_lock;
/* sync with ieee80211_tx_h_unicast_ps_buf */
ps_lock = klp_shadow_get_or_alloc(sta, PS_LOCK,
sizeof(*ps_lock), GFP_ATOMIC,
ps_lock_shadow_ctor, NULL);
if (ps_lock)
spin_lock(ps_lock);
...
This usage will create a shadow variable, only if needed, otherwise it will use one that was already created for this <obj, id> pair.
Like the previous use-case, the shadow spinlock needs to be cleaned up. A shadow variable can be freed just before its parent object is freed, or even when the shadow variable itself is no longer required.
Other use-cases #
Shadow variables can also be used as a flag indicating that a data structure was allocated by new, livepatched code. In this case, it doesn't matter what data value the shadow variable holds, its existence suggests how to handle the parent object.
3. References #
-
https://github.com/dynup/kpatch
The livepatch implementation is based on the kpatch version of shadow variables.
-
http://files.mkgnu.net/files/dynamos/doc/papers/dynamos_eurosys_07.pdf
Dynamic and Adaptive Updates of Non-Quiescent Subsystems in Commodity Operating System Kernels (Kritis Makris, Kyung Dong Ryu 2007) presented a datatype update technique called "shadow data structures".
System State Changes
Peios Kernel / Kernel development / Livepatch
Some users are really reluctant to reboot a system. This brings the need to provide more livepatches and maintain some compatibility between them.
Maintaining more livepatches is much easier with cumulative livepatches. Each new livepatch completely replaces any older one. It can keep, add, and even remove fixes. And it is typically safe to replace any version of the livepatch with any other one thanks to the atomic replace feature.
The problems might come with shadow variables and callbacks. They might change the system behavior or state so that it is no longer safe to go back and use an older livepatch or the original kernel code. Also any new livepatch must be able to detect what changes have already been done by the already installed livepatches.
This is where the livepatch system state tracking gets useful. It allows to:
store data needed to manipulate and restore the system state
define compatibility between livepatches using a change id and version
1. Livepatch system state API #
The state of the system might get modified either by several livepatch callbacks or by the newly used code. Also it must be possible to find changes done by already installed livepatches.
Each modified state is described by struct klp_state, see include/linux/livepatch.h.
Each livepatch defines an array of struct klp_states. They mention all states that the livepatch modifies.
The livepatch author must define the following two fields for each struct klp_state:
id
- Non-zero number used to identify the affected system state.
version
- Number describing the variant of the system state change that is supported by the given livepatch.
The state can be manipulated using two functions:
klp_get_state()
- Get struct klp_state associated with the given livepatch and state id.
klp_get_prev_state()
- Get struct klp_state associated with the given feature id and already installed livepatches.
2. Livepatch compatibility #
The system state version is used to prevent loading incompatible livepatches. The check is done when the livepatch is enabled. The rules are:
Any completely new system state modification is allowed.
System state modifications with the same or higher version are allowed for already modified system states.
Cumulative livepatches must handle all system state modifications from already installed livepatches.
Non-cumulative livepatches are allowed to touch already modified system states.
3. Supported scenarios #
Livepatches have their life-cycle and the same is true for the system state changes. Every compatible livepatch has to support the following scenarios:
Modify the system state when the livepatch gets enabled and the state has not been already modified by a livepatches that are being replaced.
Take over or update the system state modification when is has already been done by a livepatch that is being replaced.
Restore the original state when the livepatch is disabled.
Restore the previous state when the transition is reverted. It might be the original system state or the state modification done by livepatches that were being replaced.
Remove any already made changes when error occurs and the livepatch cannot get enabled.
4. Expected usage #
System states are usually modified by livepatch callbacks. The expected role of each callback is as follows:
pre_patch()
Allocate state->data when necessary. The allocation might fail and pre_patch() is the only callback that could stop loading of the livepatch. The allocation is not needed when the data are already provided by previously installed livepatches.
Do any other preparatory action that is needed by the new code even before the transition gets finished. For example, initialize state->data.
The system state itself is typically modified in post_patch() when the entire system is able to handle it.
Clean up its own mess in case of error. It might be done by a custom code or by calling post_unpatch() explicitly.
post_patch()
Copy state->data from the previous livepatch when they are compatible.
Do the actual system state modification. Eventually allow the new code to use it.
Make sure that state->data has all necessary information.
Free state->data from replaces livepatches when they are not longer needed.
pre_unpatch()
Prevent the code, added by the livepatch, relying on the system state change.
Revert the system state modification..
post_unpatch()
Distinguish transition reverse and livepatch disabling by checking klp_get_prev_state().
In case of transition reverse, restore the previous system state. It might mean doing nothing.
Remove any not longer needed setting or data.
Linux Tracing Technologies Guide
Peios Kernel / Kernel development / Trace
Tracing in the Linux kernel is a powerful mechanism that allows developers and system administrators to analyze and debug system behavior. This guide provides documentation on various tracing frameworks and tools available in the Linux kernel.
Introduction to Tracing #
This section provides an overview of Linux tracing mechanisms and debugging approaches.
- Using the tracer for debugging
- Using the Linux Kernel Tracepoints
- Notes on Analysing Behaviour Using Events and Tracepoints
- Tracefs ring-buffer memory mapping
Core Tracing Frameworks #
The following are the primary tracing frameworks integrated into the Linux kernel.
- ftrace - Function Tracer
- Function Tracer Design
- Using ftrace to hook to functions
- Kernel Probes (Kprobes)
- Kprobe-based Event Tracing
- Fprobe-based Event Tracing
- Eprobe - Event-based Probe Tracing
- Fprobe - Function entry/exit probe
- Lockless Ring Buffer Design
Event Tracing and Analysis #
A detailed explanation of event tracing mechanisms and their applications.
- Event Tracing
- Subsystem Trace Points: kmem
- Subsystem Trace Points: power
- NMI Trace Events
- MSR Trace Events
- Subsystem Trace Points: PCI
- Boot-time tracing
- Event Histograms
- Histogram Design Notes
Hardware and Performance Tracing #
This section covers tracing features that monitor hardware interactions and system performance.
- Intel(R) Trace Hub (TH)
- System Trace Module
- MIPI SyS-T over STP
- CoreSight - ARM Hardware Trace
- Runtime Verification
- HiSilicon PCIe Tune and Trace device
- In-kernel memory-mapped I/O tracing
- Hardware Latency Detector
- OSNOISE Tracer
- Timerlat tracer
User-Space Tracing #
These tools allow tracing user-space applications and interactions.
Additional Resources #
For more details, refer to the respective documentation of each tracing tool and framework.
Boot-time tracing
Peios Kernel / Kernel development / Trace
Author: Masami Hiramatsu <mhiramat@kernel.org>
Overview #
Boot-time tracing allows users to trace boot-time process including device initialization with full features of ftrace including per-event filter and actions, histograms, kprobe-events and synthetic-events, and trace instances. Since kernel command line is not enough to control these complex features, this uses bootconfig file to describe tracing feature programming.
Options in the Boot Config #
Here is the list of available options for boot time tracing in boot config file 1. All options are under "ftrace." or "kernel." prefix. See kernel parameters for the options which starts with "kernel." prefix 2.
[1] See Documentation/admin-guide/bootconfig.rst
[2] See Documentation/admin-guide/kernel-parameters.rst
Ftrace Global Options #
Ftrace global options have "kernel." prefix in boot config, which means these options are passed as a part of kernel legacy command line.
-
kernel.tp_printk
Output trace-event data on printk buffer too.
-
kernel.dump_on_oops [= MODE]
Dump ftrace on Oops. If MODE = 1 or omitted, dump trace buffer on all CPUs. If MODE = 2, dump a buffer on a CPU which kicks Oops.
-
kernel.traceoff_on_warning
Stop tracing if WARN_ON() occurs.
-
kernel.fgraph_max_depth = MAX_DEPTH
Set MAX_DEPTH to maximum depth of fgraph tracer.
-
kernel.fgraph_filters = FILTER[, FILTER2...]
Add fgraph tracing function filters.
-
kernel.fgraph_notraces = FILTER[, FILTER2...]
Add fgraph non-tracing function filters.
Ftrace Per-instance Options #
These options can be used for each instance including global ftrace node.
-
ftrace.[instance.INSTANCE.]options = OPT1[, OPT2[...]]
Enable given ftrace options.
-
ftrace.[instance.INSTANCE.]tracing_on = 0|1
Enable/Disable tracing on this instance when starting boot-time tracing. (you can enable it by the "traceon" event trigger action)
-
ftrace.[instance.INSTANCE.]trace_clock = CLOCK
Set given CLOCK to ftrace's trace_clock.
-
ftrace.[instance.INSTANCE.]buffer_size = SIZE
Configure ftrace buffer size to SIZE. You can use "KB" or "MB" for that SIZE.
-
ftrace.[instance.INSTANCE.]alloc_snapshot
Allocate snapshot buffer.
-
ftrace.[instance.INSTANCE.]cpumask = CPUMASK
Set CPUMASK as trace cpu-mask.
-
ftrace.[instance.INSTANCE.]events = EVENT[, EVENT2[...]]
Enable given events on boot. You can use a wild card in EVENT.
-
ftrace.[instance.INSTANCE.]tracer = TRACER
Set TRACER to current tracer on boot. (e.g. function)
-
ftrace.[instance.INSTANCE.]ftrace.filters
This will take an array of tracing function filter rules.
-
ftrace.[instance.INSTANCE.]ftrace.notraces
This will take an array of NON-tracing function filter rules.
Ftrace Per-Event Options #
These options are setting per-event options.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.enable
Enable GROUP:EVENT tracing.
-
ftrace.[instance.INSTANCE.]event.GROUP.enable
Enable all event tracing within GROUP.
-
ftrace.[instance.INSTANCE.]event.enable
Enable all event tracing.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.filter = FILTER
Set FILTER rule to the GROUP:EVENT.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.actions = ACTION[, ACTION2[...]]
Set ACTIONs to the GROUP:EVENT.
-
ftrace.[instance.INSTANCE.]event.kprobes.EVENT.probes = PROBE[, PROBE2[...]]
Defines new kprobe event based on PROBEs. It is able to define multiple probes on one event, but those must have same type of arguments. This option is available only for the event which group name is "kprobes".
-
ftrace.[instance.INSTANCE.]event.synthetic.EVENT.fields = FIELD[, FIELD2[...]]
Defines new synthetic event with FIELDs. Each field should be "type varname".
Note that kprobe and synthetic event definitions can be written under instance node, but those are also visible from other instances. So please take care for event name conflict.
Ftrace Histogram Options #
Since it is too long to write a histogram action as a string for per-event action option, there are tree-style options under per-event 'hist' subkey for the histogram actions. For the detail of the each parameter, please read the event histogram document (Documentation/trace/histogram.rst)
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]keys = KEY1[, KEY2[...]]
Set histogram key parameters. (Mandatory) The 'N' is a digit string for the multiple histogram. You can omit it if there is one histogram on the event.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]values = VAL1[, VAL2[...]]
Set histogram value parameters.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]sort = SORT1[, SORT2[...]]
Set histogram sort parameter options.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]size = NR_ENTRIES
Set histogram size (number of entries).
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]name = NAME
Set histogram name.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]var.VARIABLE = EXPR
Define a new VARIABLE by EXPR expression.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]<pause|continue|clear>
Set histogram control parameter. You can set one of them.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]onmatch.[M.]event = GROUP.EVENT
Set histogram 'onmatch' handler matching event parameter. The 'M' is a digit string for the multiple 'onmatch' handler. You can omit it if there is one 'onmatch' handler on this histogram.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]onmatch.[M.]trace = EVENT[, ARG1[...]]
Set histogram 'trace' action for 'onmatch'. EVENT must be a synthetic event name, and ARG1... are parameters for that event. Mandatory if 'onmatch.event' option is set.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]onmax.[M.]var = VAR
Set histogram 'onmax' handler variable parameter.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]onchange.[M.]var = VAR
Set histogram 'onchange' handler variable parameter.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]<onmax|onchange>.[M.]save = ARG1[, ARG2[...]]
Set histogram 'save' action parameters for 'onmax' or 'onchange' handler. This option or below 'snapshot' option is mandatory if 'onmax.var' or 'onchange.var' option is set.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.[N.]<onmax|onchange>.[M.]snapshot
Set histogram 'snapshot' action for 'onmax' or 'onchange' handler. This option or above 'save' option is mandatory if 'onmax.var' or 'onchange.var' option is set.
-
ftrace.[instance.INSTANCE.]event.GROUP.EVENT.hist.filter = FILTER_EXPR
Set histogram filter expression. You don't need 'if' in the FILTER_EXPR.
Note that this 'hist' option can conflict with the per-event 'actions' option if the 'actions' option has a histogram action.
When to Start #
All boot-time tracing options starting with ftrace will be enabled at the end of core_initcall. This means you can trace the events from postcore_initcall. Most of the subsystems and architecture dependent drivers will be initialized after that (arch_initcall or subsys_initcall). Thus, you can trace those with boot-time tracing. If you want to trace events before core_initcall, you can use the options starting with kernel. Some of them will be enabled earlier than the initcall processing (for example, kernel.ftrace=function and kernel.trace_event will start before the initcall.)
Examples #
For example, to add filter and actions for each event, define kprobe events, and synthetic events with histogram, write a boot config like below:
ftrace.event {
task.task_newtask {
filter = "pid < 128"
enable
}
kprobes.vfs_read {
probes = "vfs_read $arg1 $arg2"
filter = "common_pid < 200"
enable
}
synthetic.initcall_latency {
fields = "unsigned long func", "u64 lat"
hist {
keys = func.sym, lat
values = lat
sort = lat
}
}
initcall.initcall_start.hist {
keys = func
var.ts0 = common_timestamp.usecs
}
initcall.initcall_finish.hist {
keys = func
var.lat = common_timestamp.usecs - $ts0
onmatch {
event = initcall.initcall_start
trace = initcall_latency, func, $lat
}
}
}
Also, boot-time tracing supports "instance" node, which allows us to run several tracers for different purpose at once. For example, one tracer is for tracing functions starting with "user_", and others tracing "kernel_" functions, you can write boot config as below:
ftrace.instance {
foo {
tracer = "function"
ftrace.filters = "user_*"
}
bar {
tracer = "function"
ftrace.filters = "kernel_*"
}
}
The instance node also accepts event nodes so that each instance can customize its event tracing.
With the trigger action and kprobes, you can trace function-graph while a function is called. For example, this will trace all function calls in the pci_proc_init():
ftrace {
tracing_on = 0
tracer = function_graph
event.kprobes {
start_event {
probes = "pci_proc_init"
actions = "traceon"
}
end_event {
probes = "pci_proc_init%return"
actions = "traceoff"
}
}
}
This boot-time tracing also supports ftrace kernel parameters via boot config. For example, following kernel parameters:
trace_options=sym-addr trace_event=initcall:* tp_printk trace_buf_size=1M ftrace=function ftrace_filter="vfs*"
This can be written in boot config like below:
kernel {
trace_options = sym-addr
trace_event = "initcall:*"
tp_printk
trace_buf_size = 1M
ftrace = function
ftrace_filter = "vfs*"
}
Note that parameters start with "kernel" prefix instead of "ftrace".
Using the tracer for debugging
Peios Kernel / Kernel development / Trace
Peios: Integrity lockdown restricts debugfs access. Read-only files passing its safety checks can remain accessible, but writable or ioctl/mmap-capable debugfs interfaces can fail with
EPERM. Native authority does not bypass lockdown. These upstream diagnostic recipes therefore depend on interface availability in the configured kernel. See Peios kernel behaviour.
Copyright 2024 Google LLC.
Author: Steven Rostedt <rostedt@goodmis.org>
License: The GNU Free Documentation License, Version 1.2 (dual licensed under the GPL v2)
- Written for: 6.12
Introduction #
The tracing infrastructure can be very useful for debugging the Linux kernel. This document is a place to add various methods of using the tracer for debugging.
First, make sure that the tracefs file system is mounted:
$ sudo mount -t tracefs tracefs /sys/kernel/tracing
Using trace_printk() #
trace_printk() is a very lightweight utility that can be used in any context inside the kernel, with the exception of "noinstr" sections. It can be used in normal, softirq, interrupt and even NMI context. The trace data is written to the tracing ring buffer in a lockless way. To make it even lighter weight, when possible, it will only record the pointer to the format string, and save the raw arguments into the buffer. The format and the arguments will be post processed when the ring buffer is read. This way the trace_printk() format conversions are not done during the hot path, where the trace is being recorded.
trace_printk() is meant only for debugging, and should never be added into a subsystem of the kernel. If you need debugging traces, add trace events instead. If a trace_printk() is found in the kernel, the following will appear in the dmesg:
**********************************************************
** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
** **
** trace_printk() being used. Allocating extra memory. **
** **
** This means that this is a DEBUG kernel and it is **
** unsafe for production use. **
** **
** If you see this message and you are not debugging **
** the kernel, report this immediately to your vendor! **
** **
** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
**********************************************************
Debugging kernel crashes #
There is various methods of acquiring the state of the system when a kernel crash occurs. This could be from the oops message in printk, or one could use kexec/kdump. But these just show what happened at the time of the crash. It can be very useful in knowing what happened up to the point of the crash. The tracing ring buffer, by default, is a circular buffer that will overwrite older events with newer ones. When a crash happens, the content of the ring buffer will be all the events that lead up to the crash.
There are several kernel command line parameters that can be used to help in this. The first is "ftrace_dump_on_oops". This will dump the tracing ring buffer when a oops occurs to the console. This can be useful if the console is being logged somewhere. If a serial console is used, it may be prudent to make sure the ring buffer is relatively small, otherwise the dumping of the ring buffer may take several minutes to hours to finish. Here's an example of the kernel command line:
ftrace_dump_on_oops trace_buf_size=50K
Note, the tracing buffer is made up of per CPU buffers where each of these buffers is broken up into sub-buffers that are by default PAGE_SIZE. The above trace_buf_size option above sets each of the per CPU buffers to 50K, so, on a machine with 8 CPUs, that's actually 400K total.
Persistent buffers across boots #
If the system memory allows it, the tracing ring buffer can be specified at a specific location in memory. If the location is the same across boots and the memory is not modified, the tracing buffer can be retrieved from the following boot. There's two ways to reserve memory for the use of the ring buffer.
The more reliable way (on x86) is to reserve memory with the "memmap" kernel command line option and then use that memory for the trace_instance. This requires a bit of knowledge of the physical memory layout of the system. The advantage of using this method, is that the memory for the ring buffer will always be the same:
memmap==12M$0x284500000 trace_instance=boot_map@0x284500000:12M
The memmap above reserves 12 megabytes of memory at the physical memory location 0x284500000. Then the trace_instance option will create a trace instance "boot_map" at that same location with the same amount of memory reserved. As the ring buffer is broke up into per CPU buffers, the 12 megabytes will be broken up evenly between those CPUs. If you have 8 CPUs, each per CPU ring buffer will be 1.5 megabytes in size. Note, that also includes meta data, so the amount of memory actually used by the ring buffer will be slightly smaller.
Another more generic but less robust way to allocate a ring buffer mapping at boot is with the "reserve_mem" option:
reserve_mem=12M:4096:trace trace_instance=boot_map@trace
The reserve_mem option above will find 12 megabytes that are available at boot up, and align it by 4096 bytes. It will label this memory as "trace" that can be used by later command line options.
The trace_instance option creates a "boot_map" instance and will use the memory reserved by reserve_mem that was labeled as "trace". This method is more generic but may not be as reliable. Due to KASLR, the memory reserved by reserve_mem may not be located at the same location. If this happens, then the ring buffer will not be from the previous boot and will be reset.
Sometimes, by using a larger alignment, it can keep KASLR from moving things around in such a way that it will move the location of the reserve_mem. By using a larger alignment, you may find better that the buffer is more consistent to where it is placed:
reserve_mem=12M:0x2000000:trace trace_instance=boot_map@trace
On boot up, the memory reserved for the ring buffer is validated. It will go through a series of tests to make sure that the ring buffer contains valid data. If it is, it will then set it up to be available to read from the instance. If it fails any of the tests, it will clear the entire ring buffer and initialize it as new.
The layout of this mapped memory may not be consistent from kernel to kernel, so only the same kernel is guaranteed to work if the mapping is preserved. Switching to a different kernel version may find a different layout and mark the buffer as invalid.
NB: Both the mapped address and size must be page aligned for the architecture.
Using trace_printk() in the boot instance #
By default, the content of trace_printk() goes into the top level tracing instance. But this instance is never preserved across boots. To have the trace_printk() content, and some other internal tracing go to the preserved buffer (like dump stacks), either set the instance to be the trace_printk() destination from the kernel command line, or set it after boot up via the trace_printk_dest option.
After boot up:
echo 1 > /sys/kernel/tracing/instances/boot_map/options/trace_printk_dest
From the kernel command line:
reserve_mem=12M:4096:trace trace_instance=boot_map^traceprintk^traceoff@trace
If setting it from the kernel command line, it is recommended to also disable tracing with the "traceoff" flag, and enable tracing after boot up. Otherwise the trace from the most recent boot will be mixed with the trace from the previous boot, and may make it confusing to read.
Eprobe - Event-based Probe Tracing
Peios Kernel / Kernel development / Trace
Author: Steven Rostedt <rostedt@goodmis.org>
- Written for v6.17
Overview #
Eprobes are dynamic events that are placed on existing events to either dereference a field that is a pointer, or simply to limit what fields are recorded in the trace event.
Eprobes depend on kprobe events so to enable this feature, build your kernel with CONFIG_EPROBE_EVENTS=y.
Eprobes are created via the /sys/kernel/tracing/dynamic_events file.
Synopsis of eprobe_events #
e[:[EGRP/][EEVENT]] GRP.EVENT [FETCHARGS] : Set a probe
-:[EGRP/][EEVENT] : Clear a probe
EGRP : Group name of the new event. If omitted, use "eprobes" for it.
EEVENT : Event name. If omitted, the event name is generated and will
be the same event name as the event it attached to.
GRP : Group name of the event to attach to.
EVENT : Event name of the event to attach to.
FETCHARGS : Arguments. Each probe can have up to 128 args.
$FIELD : Fetch the value of the event field called FIELD.
@ADDR : Fetch memory at ADDR (ADDR should be in kernel)
@SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol)
$comm : Fetch current task comm.
+|-[u]OFFS(FETCHARG) : Fetch memory at FETCHARG +|- OFFS address.(\*3)(\*4)
\IMM : Store an immediate value to the argument.
NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
(u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types
(x8/x16/x32/x64), VFS layer common type(%pd/%pD), "char",
"string", "ustring", "symbol", "symstr" and "bitfield" are
supported.
Types #
The FETCHARGS above is very similar to the kprobe events as described in Documentation/trace/kprobetrace.rst.
The difference between eprobes and kprobes FETCHARGS is that eprobes has a $FIELD command that returns the content of the event field of the event that is attached. Eprobes do not have access to registers, stacks and function arguments that kprobes has.
If a field argument is a pointer, it may be dereferenced just like a memory address using the FETCHARGS syntax.
Attaching to dynamic events #
Eprobes may attach to dynamic events as well as to normal events. It may attach to a kprobe event, a synthetic event or a fprobe event. This is useful if the type of a field needs to be changed. See Example 2 below.
Usage examples #
Example 1 #
The basic usage of eprobes is to limit the data that is being recorded into the tracing buffer. For example, a common event to trace is the sched_switch trace event. That has a format of:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:char prev_comm[16]; offset:8; size:16; signed:0;
field:pid_t prev_pid; offset:24; size:4; signed:1;
field:int prev_prio; offset:28; size:4; signed:1;
field:long prev_state; offset:32; size:8; signed:1;
field:char next_comm[16]; offset:40; size:16; signed:0;
field:pid_t next_pid; offset:56; size:4; signed:1;
field:int next_prio; offset:60; size:4; signed:1;
The first four fields are common to all events and can not be limited. But the rest of the event has 60 bytes of information. It records the names of the previous and next tasks being scheduled out and in, as well as their pids and priorities. It also records the state of the previous task. If only the pids of the tasks are of interest, why waste the ring buffer with all the other fields?
An eprobe can limit what gets recorded. Note, it does not help in performance, as all the fields are recorded in a temporary buffer to process the eprobe.
# echo 'e:sched/switch sched.sched_switch prev=$prev_pid:u32 next=$next_pid:u32' >> /sys/kernel/tracing/dynamic_events
# echo 1 > /sys/kernel/tracing/events/sched/switch/enable
# cat /sys/kernel/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2721/2721 #P:8
#
# _-----=> irqs-off/BH-disabled
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / _-=> migrate-disable
# |||| / delay
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
sshd-session-1082 [004] d..4. 5041.239906: switch: (sched.sched_switch) prev=1082 next=0
bash-1085 [001] d..4. 5041.240198: switch: (sched.sched_switch) prev=1085 next=141
kworker/u34:5-141 [001] d..4. 5041.240259: switch: (sched.sched_switch) prev=141 next=1085
<idle>-0 [004] d..4. 5041.240354: switch: (sched.sched_switch) prev=0 next=1082
bash-1085 [001] d..4. 5041.240385: switch: (sched.sched_switch) prev=1085 next=141
kworker/u34:5-141 [001] d..4. 5041.240410: switch: (sched.sched_switch) prev=141 next=1085
bash-1085 [001] d..4. 5041.240478: switch: (sched.sched_switch) prev=1085 next=0
sshd-session-1082 [004] d..4. 5041.240526: switch: (sched.sched_switch) prev=1082 next=0
<idle>-0 [001] d..4. 5041.247524: switch: (sched.sched_switch) prev=0 next=90
<idle>-0 [002] d..4. 5041.247545: switch: (sched.sched_switch) prev=0 next=16
kworker/1:1-90 [001] d..4. 5041.247580: switch: (sched.sched_switch) prev=90 next=0
rcu_sched-16 [002] d..4. 5041.247591: switch: (sched.sched_switch) prev=16 next=0
<idle>-0 [002] d..4. 5041.257536: switch: (sched.sched_switch) prev=0 next=16
rcu_sched-16 [002] d..4. 5041.257573: switch: (sched.sched_switch) prev=16 next=0
Note, without adding the "u32" after the prev_pid and next_pid, the values would default showing in hexadecimal.
Example 2 #
If a specific system call is to be recorded but the syscalls events are not enabled, the raw_syscalls can still be used (syscalls are system call events are not normal events, but are created from the raw_syscalls events within the kernel). In order to trace the openat system call, one can create an event probe on top of the raw_syscalls event:
# cd /sys/kernel/tracing
# cat events/raw_syscalls/sys_enter/format
name: sys_enter
ID: 395
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:long id; offset:8; size:8; signed:1;
field:unsigned long args[6]; offset:16; size:48; signed:0;
print fmt: "NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)", REC->id, REC->args[0], REC->args[1], REC->args[2], REC->args[3], REC->args[4], REC->args[5]
From the source code, the sys_openat() has:
int sys_openat(int dirfd, const char *path, int flags, mode_t mode)
{
return my_syscall4(__NR_openat, dirfd, path, flags, mode);
}
The path is the second parameter, and that is what is wanted.
# echo 'e:openat raw_syscalls.sys_enter nr=$id filename=+8($args):ustring' >> dynamic_events
This is being run on x86_64 where the word size is 8 bytes and the openat system call __NR_openat is set at 257.
# echo 'nr == 257' > events/eprobes/openat/filter
Now enable the event and look at the trace.
# echo 1 > events/eprobes/openat/enable
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 4/4 #P:8
#
# _-----=> irqs-off/BH-disabled
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / _-=> migrate-disable
# |||| / delay
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
cat-1298 [003] ...2. 2060.875970: openat: (raw_syscalls.sys_enter) nr=0x101 filename=(fault)
cat-1298 [003] ...2. 2060.876197: openat: (raw_syscalls.sys_enter) nr=0x101 filename=(fault)
cat-1298 [003] ...2. 2060.879126: openat: (raw_syscalls.sys_enter) nr=0x101 filename=(fault)
cat-1298 [003] ...2. 2060.879639: openat: (raw_syscalls.sys_enter) nr=0x101 filename=(fault)
The filename shows "(fault)". This is likely because the filename has not been pulled into memory yet and currently trace events cannot fault in memory that is not present. When an eprobe tries to read memory that has not been faulted in yet, it will show the "(fault)" text.
To get around this, as the kernel will likely pull in this filename and make it present, attaching it to a synthetic event that can pass the address of the filename from the entry of the event to the end of the event, this can be used to show the filename when the system call returns.
Remove the old eprobe:
# echo 1 > events/eprobes/openat/enable
# echo '-:openat' >> dynamic_events
This time make an eprobe where the address of the filename is saved:
# echo 'e:openat_start raw_syscalls.sys_enter nr=$id filename=+8($args):x64' >> dynamic_events
Create a synthetic event that passes the address of the filename to the end of the event:
# echo 's:filename u64 file' >> dynamic_events
# echo 'hist:keys=common_pid:f=filename if nr == 257' > events/eprobes/openat_start/trigger
# echo 'hist:keys=common_pid:file=$f:onmatch(eprobes.openat_start).trace(filename,$file) if id == 257' > events/raw_syscalls/sys_exit/trigger
Now that the address of the filename has been passed to the end of the system call, create another eprobe to attach to the exit event to show the string:
# echo 'e:openat synthetic.filename filename=+0($file):ustring' >> dynamic_events
# echo 1 > events/eprobes/openat/enable
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 4/4 #P:8
#
# _-----=> irqs-off/BH-disabled
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / _-=> migrate-disable
# |||| / delay
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
cat-1331 [001] ...5. 2944.787977: openat: (synthetic.filename) filename="/etc/ld.so.cache"
cat-1331 [001] ...5. 2944.788480: openat: (synthetic.filename) filename="/lib/x86_64-linux-gnu/libc.so.6"
cat-1331 [001] ...5. 2944.793426: openat: (synthetic.filename) filename="/usr/lib/locale/locale-archive"
cat-1331 [001] ...5. 2944.831362: openat: (synthetic.filename) filename="trace"
Example 3 #
If syscall trace events are available, the above would not need the first eprobe, but it would still need the last one:
# echo 's:filename u64 file' >> dynamic_events
# echo 'hist:keys=common_pid:f=filename' > events/syscalls/sys_enter_openat/trigger
# echo 'hist:keys=common_pid:file=$f:onmatch(syscalls.sys_enter_openat).trace(filename,$file)' > events/syscalls/sys_exit_openat/trigger
# echo 'e:openat synthetic.filename filename=+0($file):ustring' >> dynamic_events
# echo 1 > events/eprobes/openat/enable
And this would produce the same result as Example 2.
Subsystem Trace Points: kmem
Peios Kernel / Kernel development / Trace
The kmem tracing system captures events related to object and page allocation within the kernel. Broadly speaking there are five major subheadings.
Slab allocation of small objects of unknown type (kmalloc)
Slab allocation of small objects of known type
Page allocation
Per-CPU Allocator Activity
External Fragmentation
This document describes what each of the tracepoints is and why they might be useful.
1. Slab allocation of small objects of unknown type #
kmalloc call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s
kmalloc_node call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d
kfree call_site=%lx ptr=%p
Heavy activity for these events may indicate that a specific cache is justified, particularly if kmalloc slab pages are getting significantly internal fragmented as a result of the allocation pattern. By correlating kmalloc with kfree, it may be possible to identify memory leaks and where the allocation sites were.
2. Slab allocation of small objects of known type #
kmem_cache_alloc call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s
kmem_cache_alloc_node call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d
kmem_cache_free call_site=%lx ptr=%p
These events are similar in usage to the kmalloc-related events except that it is likely easier to pin the event down to a specific cache. At the time of writing, no information is available on what slab is being allocated from, but the call_site can usually be used to extrapolate that information.
3. Page allocation #
mm_page_alloc page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s
mm_page_alloc_zone_locked page=%p pfn=%lu order=%u migratetype=%d cpu=%d percpu_refill=%d
mm_page_free page=%p pfn=%lu order=%d
mm_page_free_batched page=%p pfn=%lu order=%d cold=%d
These four events deal with page allocation and freeing. mm_page_alloc is a simple indicator of page allocator activity. Pages may be allocated from the per-CPU allocator (high performance) or the buddy allocator.
If pages are allocated directly from the buddy allocator, the mm_page_alloc_zone_locked event is triggered. This event is important as high amounts of activity imply high activity on the zone->lock. Taking this lock impairs performance by disabling interrupts, dirtying cache lines between CPUs and serialising many CPUs.
When a page is freed directly by the caller, the only mm_page_free event is triggered. Significant amounts of activity here could indicate that the callers should be batching their activities.
When pages are freed in batch, the also mm_page_free_batched is triggered. Broadly speaking, pages are taken off the LRU lock in bulk and freed in batch with a page list. Significant amounts of activity here could indicate that the system is under memory pressure and can also indicate contention on the lruvec->lru_lock.
4. Per-CPU Allocator Activity #
mm_page_alloc_zone_locked page=%p pfn=%lu order=%u migratetype=%d cpu=%d percpu_refill=%d
mm_page_pcpu_drain page=%p pfn=%lu order=%d cpu=%d migratetype=%d
In front of the page allocator is a per-cpu page allocator. It exists only for order-0 pages, reduces contention on the zone->lock and reduces the amount of writing on struct page.
When a per-CPU list is empty or pages of the wrong type are allocated, the zone->lock will be taken once and the per-CPU list refilled. The event triggered is mm_page_alloc_zone_locked for each page allocated with the event indicating whether it is for a percpu_refill or not.
When the per-CPU list is too full, a number of pages are freed, each one which triggers a mm_page_pcpu_drain event.
The individual nature of the events is so that pages can be tracked between allocation and freeing. A number of drain or refill pages that occur consecutively imply the zone->lock being taken once. Large amounts of per-CPU refills and drains could imply an imbalance between CPUs where too much work is being concentrated in one place. It could also indicate that the per-CPU lists should be a larger size. Finally, large amounts of refills on one CPU and drains on another could be a factor in causing large amounts of cache line bounces due to writes between CPUs and worth investigating if pages can be allocated and freed on the same CPU through some algorithm change.
5. External Fragmentation #
mm_page_alloc_extfrag page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d
External fragmentation affects whether a high-order allocation will be successful or not. For some types of hardware, this is important although it is avoided where possible. If the system is using huge pages and needs to be able to resize the pool over the lifetime of the system, this value is important.
Large numbers of this event implies that memory is fragmenting and high-order allocations will start failing at some time in the future. One means of reducing the occurrence of this event is to increase the size of min_free_kbytes in increments of 3*pageblock_size*nr_online_nodes where pageblock_size is usually the size of the default hugepage size.
MSR Trace Events
Peios Kernel / Kernel development / Trace
The x86 kernel supports tracing most MSR (Model Specific Register) accesses. To see the definition of the MSRs on Intel systems please see the SDM at https://www.intel.com/sdm (Volume 3)
Available trace points:
/sys/kernel/tracing/events/msr/
Trace MSR reads:
read_msr
msr: MSR number
val: Value written
failed: 1 if the access failed, otherwise 0
Trace MSR writes:
write_msr
msr: MSR number
val: Value written
failed: 1 if the access failed, otherwise 0
Trace RDPMC in kernel:
rdpmc
The trace data can be post processed with the postprocess/decode_msr.py script:
cat /sys/kernel/tracing/trace | decode_msr.py /usr/src/linux/include/asm/msr-index.h
to add symbolic MSR names.
NMI Trace Events
Peios Kernel / Kernel development / Trace
These events normally show up here:
/sys/kernel/tracing/events/nmi
nmi_handler #
You might want to use this tracepoint if you suspect that your NMI handlers are hogging large amounts of CPU time. The kernel will warn if it sees long-running handlers:
INFO: NMI handler took too long to run: 9.207 msecs
and this tracepoint will allow you to drill down and get some more details.
Let's say you suspect that perf_event_nmi_handler() is causing you some problems and you only want to trace that handler specifically. You need to find its address:
$ grep perf_event_nmi_handler /proc/kallsyms
ffffffff81625600 t perf_event_nmi_handler
Let's also say you are only interested in when that function is really hogging a lot of CPU time, like a millisecond at a time. Note that the kernel's output is in milliseconds, but the input to the filter is in nanoseconds! You can filter on 'delta_ns':
cd /sys/kernel/tracing/events/nmi/nmi_handler
echo 'handler==0xffffffff81625600 && delta_ns>1000000' > filter
echo 1 > enable
Your output would then look like:
$ cat /sys/kernel/tracing/trace_pipe
<idle>-0 [000] d.h3 505.397558: nmi_handler: perf_event_nmi_handler() delta_ns: 3236765 handled: 1
<idle>-0 [000] d.h3 505.805893: nmi_handler: perf_event_nmi_handler() delta_ns: 3174234 handled: 1
<idle>-0 [000] d.h3 506.158206: nmi_handler: perf_event_nmi_handler() delta_ns: 3084642 handled: 1
<idle>-0 [000] d.h3 506.334346: nmi_handler: perf_event_nmi_handler() delta_ns: 3080351 handled: 1
Subsystem Trace Points: PCI
Peios Kernel / Kernel development / Trace
Overview #
The PCI tracing system provides tracepoints to monitor critical hardware events that can impact system performance and reliability. These events normally show up here:
/sys/kernel/tracing/events/pci
Cf. include/trace/events/pci.h for the events definitions.
Available Tracepoints #
pci_hp_event #
Monitors PCI hotplug events including card insertion/removal and link state changes.
pci_hp_event "%s slot:%s, event:%s\n"
Event Types:
-
LINK_UP- PCIe link established -
LINK_DOWN- PCIe link lost -
CARD_PRESENT- Card detected in slot -
CARD_NOT_PRESENT- Card removed from slot
Example Usage:
# Enable the tracepoint
echo 1 > /sys/kernel/debug/tracing/events/pci/pci_hp_event/enable
# Monitor events (the following output is generated when a device is hotplugged)
cat /sys/kernel/debug/tracing/trace_pipe
irq/51-pciehp-88 [001] ..... 1311.177459: pci_hp_event: 0000:00:02.0 slot:10, event:CARD_PRESENT
irq/51-pciehp-88 [001] ..... 1311.177566: pci_hp_event: 0000:00:02.0 slot:10, event:LINK_UP
pcie_link_event #
Monitors PCIe link speed changes and provides detailed link status information.
pcie_link_event "%s type:%d, reason:%d, cur_bus_speed:%d, max_bus_speed:%d, width:%u, flit_mode:%u, status:%s\n"
Parameters:
-
type- PCIe device type (4=Root Port, etc.) -
reason- Reason for link change:-
0- Link retrain -
1- Bus enumeration -
2- Bandwidth notification enable -
3- Bandwidth notification IRQ -
4- Hotplug event
-
Example Usage:
# Enable the tracepoint
echo 1 > /sys/kernel/debug/tracing/events/pci/pcie_link_event/enable
# Monitor events (the following output is generated when a device is hotplugged)
cat /sys/kernel/debug/tracing/trace_pipe
irq/51-pciehp-88 [001] ..... 381.545386: pcie_link_event: 0000:00:02.0 type:4, reason:4, cur_bus_speed:20, max_bus_speed:23, width:1, flit_mode:0, status:DLLLA
Subsystem Trace Points: power
Peios Kernel / Kernel development / Trace
The power tracing system captures events related to power transitions within the kernel. Broadly speaking there are three major subheadings:
Power state switch which reports events related to suspend (S-states), cpuidle (C-states) and cpufreq (P-states)
System clock related changes
Power domains related changes and transitions
This document describes what each of the tracepoints is and why they might be useful.
Cf. include/trace/events/power.h for the events definitions.
1. Power state switch events #
1.1 Trace API #
A 'cpu' event class gathers the CPU-related events: cpuidle and cpufreq.
cpu_idle "state=%lu cpu_id=%lu"
cpu_frequency "state=%lu cpu_id=%lu"
cpu_frequency_limits "min=%lu max=%lu cpu_id=%lu"
A suspend event is used to indicate the system going in and out of the suspend mode:
machine_suspend "state=%lu"
Note: the value of '-1' or '4294967295' for state means an exit from the current state, i.e. trace_cpu_idle(4, smp_processor_id()) means that the system enters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id()) means that the system exits the previous idle state.
The event which has 'state=4294967295' in the trace is very important to the user space tools which are using it to detect the end of the current state, and so to correctly draw the states diagrams and to calculate accurate statistics etc.
2. Clocks events #
The clock events are used for clock enable/disable and for clock rate change.
clock_enable "%s state=%lu cpu_id=%lu"
clock_disable "%s state=%lu cpu_id=%lu"
clock_set_rate "%s state=%lu cpu_id=%lu"
The first parameter gives the clock name (e.g. "gpio1_iclk"). The second parameter is '1' for enable, '0' for disable, the target clock rate for set_rate.
3. Power domains events #
The power domain events are used for power domains transitions
power_domain_target "%s state=%lu cpu_id=%lu"
The first parameter gives the power domain name (e.g. "mpu_pwrdm"). The second parameter is the power domain target state.
4. PM QoS events #
The PM QoS events are used for QoS add/update/remove request and for target/flags update.
pm_qos_update_target "action=%s prev_value=%d curr_value=%d"
pm_qos_update_flags "action=%s prev_value=0x%x curr_value=0x%x"
The first parameter gives the QoS action name (e.g. "ADD_REQ"). The second parameter is the previous QoS value. The third parameter is the current QoS value to update.
There are also events used for device PM QoS add/update/remove request.
dev_pm_qos_add_request "device=%s type=%s new_value=%d"
dev_pm_qos_update_request "device=%s type=%s new_value=%d"
dev_pm_qos_remove_request "device=%s type=%s new_value=%d"
The first parameter gives the device name which tries to add/update/remove QoS requests. The second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY"). The third parameter is value to be added/updated/removed.
And, there are events used for CPU latency QoS add/update/remove request.
pm_qos_add_request "value=%d"
pm_qos_update_request "value=%d"
pm_qos_remove_request "value=%d"
The parameter is the value to be added/updated/removed.
Event Tracing
Peios Kernel / Kernel development / Trace
Author: Theodore Ts'o
Updated: Li Zefan and Tom Zanussi
1. Introduction #
Tracepoints (see Documentation/trace/tracepoints.rst) can be used without creating custom kernel modules to register probe functions using the event tracing infrastructure.
Not all tracepoints can be traced using the event tracing system; the kernel developer must provide code snippets which define how the tracing information is saved into the tracing buffer, and how the tracing information should be printed.
2. Using Event Tracing #
2.1 Via the 'set_event' interface #
The events which are available for tracing can be found in the file /sys/kernel/tracing/available_events.
To enable a particular event, such as 'sched_wakeup', simply echo it to /sys/kernel/tracing/set_event. For example:
# echo sched_wakeup >> /sys/kernel/tracing/set_event
To disable an event, echo the event name to the set_event file prefixed with an exclamation point:
# echo '!sched_wakeup' >> /sys/kernel/tracing/set_event
To disable all events, echo an empty line to the set_event file:
# echo > /sys/kernel/tracing/set_event
To enable all events, echo *:* or *: to the set_event file:
# echo *:* > /sys/kernel/tracing/set_event
The events are organized into subsystems, such as ext4, irq, sched, etc., and a full event name looks like this: <subsystem>:<event>. The subsystem name is optional, but it is displayed in the available_events file. All of the events in a subsystem can be specified via the syntax <subsystem>:*; for example, to enable all irq events, you can use the command:
# echo 'irq:*' > /sys/kernel/tracing/set_event
The set_event file may also be used to enable events associated to only a specific module:
# echo ':mod:<module>' > /sys/kernel/tracing/set_event
Will enable all events in the module <module>. If the module is not yet loaded, the string will be saved and when a module is that matches <module> is loaded, then it will apply the enabling of events then.
The text before :mod: will be parsed to specify specific events that the module creates:
# echo '<match>:mod:<module>' > /sys/kernel/tracing/set_event
The above will enable any system or event that <match> matches. If <match> is "*" then it will match all events.
To enable only a specific event within a system:
# echo '<system>:<event>:mod:<module>' > /sys/kernel/tracing/set_event
If <event> is "*" then it will match all events within the system for a given module.
2.2 Via the 'enable' toggle #
The events available are also listed in /sys/kernel/tracing/events/ hierarchy of directories.
To enable event 'sched_wakeup':
# echo 1 > /sys/kernel/tracing/events/sched/sched_wakeup/enable
To disable it:
# echo 0 > /sys/kernel/tracing/events/sched/sched_wakeup/enable
To enable all events in sched subsystem:
# echo 1 > /sys/kernel/tracing/events/sched/enable
To enable all events:
# echo 1 > /sys/kernel/tracing/events/enable
When reading one of these enable files, there are four results:
0 - all events this file affects are disabled
1 - all events this file affects are enabled
X - there is a mixture of events enabled and disabled
? - this file does not affect any event
2.3 Boot option #
In order to facilitate early boot debugging, use boot option:
trace_event=[event-list]
event-list is a comma separated list of events. See section 2.1 for event format.
3. Defining an event-enabled tracepoint #
See The example provided in samples/trace_events
4. Event formats #
Each trace event has a 'format' file associated with it that contains a description of each field in a logged event. This information can be used to parse the binary trace stream, and is also the place to find the field names that can be used in event filters (see section 5).
It also displays the format string that will be used to print the event in text mode, along with the event name and ID used for profiling.
Every event has a set of common fields associated with it; these are the fields prefixed with common_. The other fields vary between events and correspond to the fields defined in the TRACE_EVENT definition for that event.
Each field in the format has the form:
field:field-type field-name; offset:N; size:N;
where offset is the offset of the field in the trace record and size is the size of the data item, in bytes.
For example, here's the information displayed for the 'sched_wakeup' event:
# cat /sys/kernel/tracing/events/sched/sched_wakeup/format
name: sched_wakeup
ID: 60
format:
field:unsigned short common_type; offset:0; size:2;
field:unsigned char common_flags; offset:2; size:1;
field:unsigned char common_preempt_count; offset:3; size:1;
field:int common_pid; offset:4; size:4;
field:int common_tgid; offset:8; size:4;
field:char comm[TASK_COMM_LEN]; offset:12; size:16;
field:pid_t pid; offset:28; size:4;
field:int prio; offset:32; size:4;
field:int success; offset:36; size:4;
field:int cpu; offset:40; size:4;
print fmt: "task %s:%d [%d] success=%d [%03d]", REC->comm, REC->pid,
REC->prio, REC->success, REC->cpu
This event contains 10 fields, the first 5 common and the remaining 5 event-specific. All the fields for this event are numeric, except for 'comm' which is a string, a distinction important for event filtering.
5. Event filtering #
Trace events can be filtered in the kernel by associating boolean 'filter expressions' with them. As soon as an event is logged into the trace buffer, its fields are checked against the filter expression associated with that event type. An event with field values that 'match' the filter will appear in the trace output, and an event whose values don't match will be discarded. An event with no filter associated with it matches everything, and is the default when no filter has been set for an event.
5.1 Expression syntax #
A filter expression consists of one or more 'predicates' that can be combined using the logical operators '&&' and '||'. A predicate is simply a clause that compares the value of a field contained within a logged event with a constant value and returns either 0 or 1 depending on whether the field value matched (1) or didn't match (0):
field-name relational-operator value
Parentheses can be used to provide arbitrary logical groupings and double-quotes can be used to prevent the shell from interpreting operators as shell metacharacters.
The field-names available for use in filters can be found in the 'format' files for trace events (see section 4).
The relational-operators depend on the type of the field being tested:
The operators available for numeric fields are:
==, !=, <, <=, >, >=, &
And for string fields they are:
==, !=, ~
The glob (~) accepts a wild card character (*,?) and character classes ([). For example:
prev_comm ~ "*sh"
prev_comm ~ "sh*"
prev_comm ~ "*sh*"
prev_comm ~ "ba*sh"
If the field is a pointer that points into user space (for example "filename" from sys_enter_openat), then you have to append ".ustring" to the field name:
filename.ustring ~ "password"
As the kernel will have to know how to retrieve the memory that the pointer is at from user space.
You can convert any long type to a function address and search by function name:
call_site.function == security_prepare_creds
The above will filter when the field "call_site" falls on the address within "security_prepare_creds". That is, it will compare the value of "call_site" and the filter will return true if it is greater than or equal to the start of the function "security_prepare_creds" and less than the end of that function.
The ".function" postfix can only be attached to values of size long, and can only be compared with "==" or "!=".
Cpumask fields or scalar fields that encode a CPU number can be filtered using a user-provided cpumask in cpulist format. The format is as follows:
CPUS{$cpulist}
Operators available to cpumask filtering are:
& (intersection), ==, !=
For example, this will filter events that have their .target_cpu field present in the given cpumask:
target_cpu & CPUS{17-42}
5.2 Setting filters #
A filter for an individual event is set by writing a filter expression to the 'filter' file for the given event.
For example:
# cd /sys/kernel/tracing/events/sched/sched_wakeup
# echo "common_preempt_count > 4" > filter
A slightly more involved example:
# cd /sys/kernel/tracing/events/signal/signal_generate
# echo "((sig >= 10 && sig < 15) || sig == 17) && comm != bash" > filter
If there is an error in the expression, you'll get an 'Invalid argument' error when setting it, and the erroneous string along with an error message can be seen by looking at the filter e.g.:
# cd /sys/kernel/tracing/events/signal/signal_generate
# echo "((sig >= 10 && sig < 15) || dsig == 17) && comm != bash" > filter
-bash: echo: write error: Invalid argument
# cat filter
((sig >= 10 && sig < 15) || dsig == 17) && comm != bash
^
parse_error: Field not found
Currently the caret ('^') for an error always appears at the beginning of the filter string; the error message should still be useful though even without more accurate position info.
5.2.1 Filter limitations #
If a filter is placed on a string pointer (char *) that does not point to a string on the ring buffer, but instead points to kernel or user space memory, then, for safety reasons, at most 1024 bytes of the content is copied onto a temporary buffer to do the compare. If the copy of the memory faults (the pointer points to memory that should not be accessed), then the string compare will be treated as not matching.
5.3 Clearing filters #
To clear the filter for an event, write a '0' to the event's filter file.
To clear the filters for all events in a subsystem, write a '0' to the subsystem's filter file.
5.4 Subsystem filters #
For convenience, filters for every event in a subsystem can be set or cleared as a group by writing a filter expression into the filter file at the root of the subsystem. Note however, that if a filter for any event within the subsystem lacks a field specified in the subsystem filter, or if the filter can't be applied for any other reason, the filter for that event will retain its previous setting. This can result in an unintended mixture of filters which could lead to confusing (to the user who might think different filters are in effect) trace output. Only filters that reference just the common fields can be guaranteed to propagate successfully to all events.
Here are a few subsystem filter examples that also illustrate the above points:
Clear the filters on all events in the sched subsystem:
# cd /sys/kernel/tracing/events/sched
# echo 0 > filter
# cat sched_switch/filter
none
# cat sched_wakeup/filter
none
Set a filter using only common fields for all events in the sched subsystem (all events end up with the same filter):
# cd /sys/kernel/tracing/events/sched
# echo common_pid == 0 > filter
# cat sched_switch/filter
common_pid == 0
# cat sched_wakeup/filter
common_pid == 0
Attempt to set a filter using a non-common field for all events in the sched subsystem (all events but those that have a prev_pid field retain their old filters):
# cd /sys/kernel/tracing/events/sched
# echo prev_pid == 0 > filter
# cat sched_switch/filter
prev_pid == 0
# cat sched_wakeup/filter
common_pid == 0
5.5 PID filtering #
The set_event_pid file in the same directory as the top events directory exists, will filter all events from tracing any task that does not have the PID listed in the set_event_pid file.
# cd /sys/kernel/tracing
# echo $$ > set_event_pid
# echo 1 > events/enable
Will only trace events for the current task.
To add more PIDs without losing the PIDs already included, use '>>'.
# echo 123 244 1 >> set_event_pid
6. Event triggers #
Trace events can be made to conditionally invoke trigger 'commands' which can take various forms and are described in detail below; examples would be enabling or disabling other trace events or invoking a stack trace whenever the trace event is hit. Whenever a trace event with attached triggers is invoked, the set of trigger commands associated with that event is invoked. Any given trigger can additionally have an event filter of the same form as described in section 5 (Event filtering) associated with it - the command will only be invoked if the event being invoked passes the associated filter. If no filter is associated with the trigger, it always passes.
Triggers are added to and removed from a particular event by writing trigger expressions to the 'trigger' file for the given event.
A given event can have any number of triggers associated with it, subject to any restrictions that individual commands may have in that regard.
Event triggers are implemented on top of "soft" mode, which means that whenever a trace event has one or more triggers associated with it, the event is activated even if it isn't actually enabled, but is disabled in a "soft" mode. That is, the tracepoint will be called, but just will not be traced, unless of course it's actually enabled. This scheme allows triggers to be invoked even for events that aren't enabled, and also allows the current event filter implementation to be used for conditionally invoking triggers.
The syntax for event triggers is roughly based on the syntax for set_ftrace_filter 'ftrace filter commands' (see the 'Filter commands' section of Documentation/trace/ftrace.rst), but there are major differences and the implementation isn't currently tied to it in any way, so beware about making generalizations between the two.
6.1 Expression syntax #
Triggers are added by echoing the command to the 'trigger' file:
# echo 'command[:count] [if filter]' > trigger
Triggers are removed by echoing the same command but starting with '!' to the 'trigger' file:
# echo '!command[:count] [if filter]' > trigger
The [if filter] part isn't used in matching commands when removing, so leaving that off in a '!' command will accomplish the same thing as having it in.
The filter syntax is the same as that described in the 'Event filtering' section above.
For ease of use, writing to the trigger file using '>' currently just adds or removes a single trigger and there's no explicit '>>' support ('>' actually behaves like '>>') or truncation support to remove all triggers (you have to use '!' for each one added.)
6.2 Supported trigger commands #
The following commands are supported:
-
enable_event/disable_event
These commands can enable or disable another trace event whenever the triggering event is hit. When these commands are registered, the other trace event is activated, but disabled in a "soft" mode. That is, the tracepoint will be called, but just will not be traced. The event tracepoint stays in this mode as long as there's a trigger in effect that can trigger it.
For example, the following trigger causes kmalloc events to be traced when a read system call is entered, and the :1 at the end specifies that this enablement happens only once:
# echo 'enable_event:kmem:kmalloc:1' > \ /sys/kernel/tracing/events/syscalls/sys_enter_read/triggerThe following trigger causes kmalloc events to stop being traced when a read system call exits. This disablement happens on every read system call exit:
# echo 'disable_event:kmem:kmalloc' > \ /sys/kernel/tracing/events/syscalls/sys_exit_read/triggerThe format is:
enable_event:<system>:<event>[:count] disable_event:<system>:<event>[:count]To remove the above commands:
# echo '!enable_event:kmem:kmalloc:1' > \ /sys/kernel/tracing/events/syscalls/sys_enter_read/trigger # echo '!disable_event:kmem:kmalloc' > \ /sys/kernel/tracing/events/syscalls/sys_exit_read/triggerNote that there can be any number of enable/disable_event triggers per triggering event, but there can only be one trigger per triggered event. e.g. sys_enter_read can have triggers enabling both kmem:kmalloc and sched:sched_switch, but can't have two kmem:kmalloc versions such as kmem:kmalloc and kmem:kmalloc:1 or 'kmem:kmalloc if bytes_req == 256' and 'kmem:kmalloc if bytes_alloc == 256' (they could be combined into a single filter on kmem:kmalloc though).
-
stacktrace
This command dumps a stacktrace in the trace buffer whenever the triggering event occurs.
For example, the following trigger dumps a stacktrace every time the kmalloc tracepoint is hit:
# echo 'stacktrace' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerThe following trigger dumps a stacktrace the first 5 times a kmalloc request happens with a size >= 64K:
# echo 'stacktrace:5 if bytes_req >= 65536' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerThe format is:
stacktrace[:count]To remove the above commands:
# echo '!stacktrace' > \ /sys/kernel/tracing/events/kmem/kmalloc/trigger # echo '!stacktrace:5 if bytes_req >= 65536' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerThe latter can also be removed more simply by the following (without the filter):
# echo '!stacktrace:5' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerNote that there can be only one stacktrace trigger per triggering event.
-
snapshot
This command causes a snapshot to be triggered whenever the triggering event occurs.
The following command creates a snapshot every time a block request queue is unplugged with a depth > 1. If you were tracing a set of events or functions at the time, the snapshot trace buffer would capture those events when the trigger event occurred:
# echo 'snapshot if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/triggerTo only snapshot once:
# echo 'snapshot:1 if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/triggerTo remove the above commands:
# echo '!snapshot if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/trigger # echo '!snapshot:1 if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/triggerNote that there can be only one snapshot trigger per triggering event.
-
traceon/traceoff
These commands turn tracing on and off when the specified events are hit. The parameter determines how many times the tracing system is turned on and off. If unspecified, there is no limit.
The following command turns tracing off the first time a block request queue is unplugged with a depth > 1. If you were tracing a set of events or functions at the time, you could then examine the trace buffer to see the sequence of events that led up to the trigger event:
# echo 'traceoff:1 if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/triggerTo always disable tracing when nr_rq > 1:
# echo 'traceoff if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/triggerTo remove the above commands:
# echo '!traceoff:1 if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/trigger # echo '!traceoff if nr_rq > 1' > \ /sys/kernel/tracing/events/block/block_unplug/triggerNote that there can be only one traceon or traceoff trigger per triggering event.
-
hist
This command aggregates event hits into a hash table keyed on one or more trace event format fields (or stacktrace) and a set of running totals derived from one or more trace event format fields and/or event counts (hitcount).
See Documentation/trace/histogram.rst for details and examples.
7. In-kernel trace event API #
In most cases, the command-line interface to trace events is more than sufficient. Sometimes, however, applications might find the need for more complex relationships than can be expressed through a simple series of linked command-line expressions, or putting together sets of commands may be simply too cumbersome. An example might be an application that needs to 'listen' to the trace stream in order to maintain an in-kernel state machine detecting, for instance, when an illegal kernel state occurs in the scheduler.
The trace event subsystem provides an in-kernel API allowing modules or other kernel code to generate user-defined 'synthetic' events at will, which can be used to either augment the existing trace stream and/or signal that a particular important state has occurred.
A similar in-kernel API is also available for creating kprobe and kretprobe events.
Both the synthetic event and k/ret/probe event APIs are built on top of a lower-level "dynevent_cmd" event command API, which is also available for more specialized applications, or as the basis of other higher-level trace event APIs.
The API provided for these purposes is describe below and allows the following:
dynamically creating synthetic event definitions
dynamically creating kprobe and kretprobe event definitions
tracing synthetic events from in-kernel code
the low-level "dynevent_cmd" API
7.1 Dynamically creating synthetic event definitions #
There are a couple ways to create a new synthetic event from a kernel module or other kernel code.
The first creates the event in one step, using synth_event_create(). In this method, the name of the event to create and an array defining the fields is supplied to synth_event_create(). If successful, a synthetic event with that name and fields will exist following that call. For example, to create a new "schedtest" synthetic event:
ret = synth_event_create("schedtest", sched_fields,
ARRAY_SIZE(sched_fields), THIS_MODULE);
The sched_fields param in this example points to an array of struct synth_field_desc, each of which describes an event field by type and name:
static struct synth_field_desc sched_fields[] = {
{ .type = "pid_t", .name = "next_pid_field" },
{ .type = "char[16]", .name = "next_comm_field" },
{ .type = "u64", .name = "ts_ns" },
{ .type = "u64", .name = "ts_ms" },
{ .type = "unsigned int", .name = "cpu" },
{ .type = "char[64]", .name = "my_string_field" },
{ .type = "int", .name = "my_int_field" },
};
See synth_field_size() for available types.
If field_name contains [n], the field is considered to be a static array.
If field_names contains[] (no subscript), the field is considered to be a dynamic array, which will only take as much space in the event as is required to hold the array.
Because space for an event is reserved before assigning field values to the event, using dynamic arrays implies that the piecewise in-kernel API described below can't be used with dynamic arrays. The other non-piecewise in-kernel APIs can, however, be used with dynamic arrays.
If the event is created from within a module, a pointer to the module must be passed to synth_event_create(). This will ensure that the trace buffer won't contain unreadable events when the module is removed.
At this point, the event object is ready to be used for generating new events.
In the second method, the event is created in several steps. This allows events to be created dynamically and without the need to create and populate an array of fields beforehand.
To use this method, an empty or partially empty synthetic event should first be created using synth_event_gen_cmd_start() or synth_event_gen_cmd_array_start(). For synth_event_gen_cmd_start(), the name of the event along with one or more pairs of args each pair representing a 'type field_name;' field specification should be supplied. For synth_event_gen_cmd_array_start(), the name of the event along with an array of struct synth_field_desc should be supplied. Before calling synth_event_gen_cmd_start() or synth_event_gen_cmd_array_start(), the user should create and initialize a dynevent_cmd object using synth_event_cmd_init().
For example, to create a new "schedtest" synthetic event with two fields:
struct dynevent_cmd cmd;
char *buf;
/* Create a buffer to hold the generated command */
buf = kzalloc(MAX_DYNEVENT_CMD_LEN, GFP_KERNEL);
/* Before generating the command, initialize the cmd object */
synth_event_cmd_init(&cmd, buf, MAX_DYNEVENT_CMD_LEN);
ret = synth_event_gen_cmd_start(&cmd, "schedtest", THIS_MODULE,
"pid_t", "next_pid_field",
"u64", "ts_ns");
Alternatively, using an array of struct synth_field_desc fields containing the same information:
ret = synth_event_gen_cmd_array_start(&cmd, "schedtest", THIS_MODULE,
fields, n_fields);
Once the synthetic event object has been created, it can then be populated with more fields. Fields are added one by one using synth_event_add_field(), supplying the dynevent_cmd object, a field type, and a field name. For example, to add a new int field named "intfield", the following call should be made:
ret = synth_event_add_field(&cmd, "int", "intfield");
See synth_field_size() for available types. If field_name contains [n] the field is considered to be an array.
A group of fields can also be added all at once using an array of synth_field_desc with add_synth_fields(). For example, this would add just the first four sched_fields:
ret = synth_event_add_fields(&cmd, sched_fields, 4);
If you already have a string of the form 'type field_name', synth_event_add_field_str() can be used to add it as-is; it will also automatically append a ';' to the string.
Once all the fields have been added, the event should be finalized and registered by calling the synth_event_gen_cmd_end() function:
ret = synth_event_gen_cmd_end(&cmd);
At this point, the event object is ready to be used for tracing new events.
7.2 Tracing synthetic events from in-kernel code #
To trace a synthetic event, there are several options. The first option is to trace the event in one call, using synth_event_trace() with a variable number of values, or synth_event_trace_array() with an array of values to be set. A second option can be used to avoid the need for a pre-formed array of values or list of arguments, via synth_event_trace_start() and synth_event_trace_end() along with synth_event_add_next_val() or synth_event_add_val() to add the values piecewise.
7.2.1 Tracing a synthetic event all at once #
To trace a synthetic event all at once, the synth_event_trace() or synth_event_trace_array() functions can be used.
The synth_event_trace() function is passed the trace_event_file representing the synthetic event (which can be retrieved using trace_get_event_file() using the synthetic event name, "synthetic" as the system name, and the trace instance name (NULL if using the global trace array)), along with an variable number of u64 args, one for each synthetic event field, and the number of values being passed.
So, to trace an event corresponding to the synthetic event definition above, code like the following could be used:
ret = synth_event_trace(create_synth_test, 7, /* number of values */
444, /* next_pid_field */
(u64)"clackers", /* next_comm_field */
1000000, /* ts_ns */
1000, /* ts_ms */
smp_processor_id(),/* cpu */
(u64)"Thneed", /* my_string_field */
999); /* my_int_field */
All vals should be cast to u64, and string vals are just pointers to strings, cast to u64. Strings will be copied into space reserved in the event for the string, using these pointers.
Alternatively, the synth_event_trace_array() function can be used to accomplish the same thing. It is passed the trace_event_file representing the synthetic event (which can be retrieved using trace_get_event_file() using the synthetic event name, "synthetic" as the system name, and the trace instance name (NULL if using the global trace array)), along with an array of u64, one for each synthetic event field.
To trace an event corresponding to the synthetic event definition above, code like the following could be used:
u64 vals[7];
vals[0] = 777; /* next_pid_field */
vals[1] = (u64)"tiddlywinks"; /* next_comm_field */
vals[2] = 1000000; /* ts_ns */
vals[3] = 1000; /* ts_ms */
vals[4] = smp_processor_id(); /* cpu */
vals[5] = (u64)"thneed"; /* my_string_field */
vals[6] = 398; /* my_int_field */
The 'vals' array is just an array of u64, the number of which must match the number of field in the synthetic event, and which must be in the same order as the synthetic event fields.
All vals should be cast to u64, and string vals are just pointers to strings, cast to u64. Strings will be copied into space reserved in the event for the string, using these pointers.
In order to trace a synthetic event, a pointer to the trace event file is needed. The trace_get_event_file() function can be used to get it - it will find the file in the given trace instance (in this case NULL since the top trace array is being used) while at the same time preventing the instance containing it from going away:
schedtest_event_file = trace_get_event_file(NULL, "synthetic",
"schedtest");
Before tracing the event, it should be enabled in some way, otherwise the synthetic event won't actually show up in the trace buffer.
To enable a synthetic event from the kernel, trace_array_set_clr_event() can be used (which is not specific to synthetic events, so does need the "synthetic" system name to be specified explicitly).
To enable the event, pass 'true' to it:
trace_array_set_clr_event(schedtest_event_file->tr,
"synthetic", "schedtest", true);
To disable it pass false:
trace_array_set_clr_event(schedtest_event_file->tr,
"synthetic", "schedtest", false);
Finally, synth_event_trace_array() can be used to actually trace the event, which should be visible in the trace buffer afterwards:
ret = synth_event_trace_array(schedtest_event_file, vals,
ARRAY_SIZE(vals));
To remove the synthetic event, the event should be disabled, and the trace instance should be 'put' back using trace_put_event_file():
trace_array_set_clr_event(schedtest_event_file->tr,
"synthetic", "schedtest", false);
trace_put_event_file(schedtest_event_file);
If those have been successful, synth_event_delete() can be called to remove the event:
ret = synth_event_delete("schedtest");
7.2.2 Tracing a synthetic event piecewise #
To trace a synthetic using the piecewise method described above, the synth_event_trace_start() function is used to 'open' the synthetic event trace:
struct synth_event_trace_state trace_state;
ret = synth_event_trace_start(schedtest_event_file, &trace_state);
It's passed the trace_event_file representing the synthetic event using the same methods as described above, along with a pointer to a struct synth_event_trace_state object, which will be zeroed before use and used to maintain state between this and following calls.
Once the event has been opened, which means space for it has been reserved in the trace buffer, the individual fields can be set. There are two ways to do that, either one after another for each field in the event, which requires no lookups, or by name, which does. The tradeoff is flexibility in doing the assignments vs the cost of a lookup per field.
To assign the values one after the other without lookups, synth_event_add_next_val() should be used. Each call is passed the same synth_event_trace_state object used in the synth_event_trace_start(), along with the value to set the next field in the event. After each field is set, the 'cursor' points to the next field, which will be set by the subsequent call, continuing until all the fields have been set in order. The same sequence of calls as in the above examples using this method would be (without error-handling code):
/* next_pid_field */
ret = synth_event_add_next_val(777, &trace_state);
/* next_comm_field */
ret = synth_event_add_next_val((u64)"slinky", &trace_state);
/* ts_ns */
ret = synth_event_add_next_val(1000000, &trace_state);
/* ts_ms */
ret = synth_event_add_next_val(1000, &trace_state);
/* cpu */
ret = synth_event_add_next_val(smp_processor_id(), &trace_state);
/* my_string_field */
ret = synth_event_add_next_val((u64)"thneed_2.01", &trace_state);
/* my_int_field */
ret = synth_event_add_next_val(395, &trace_state);
To assign the values in any order, synth_event_add_val() should be used. Each call is passed the same synth_event_trace_state object used in the synth_event_trace_start(), along with the field name of the field to set and the value to set it to. The same sequence of calls as in the above examples using this method would be (without error-handling code):
ret = synth_event_add_val("next_pid_field", 777, &trace_state);
ret = synth_event_add_val("next_comm_field", (u64)"silly putty",
&trace_state);
ret = synth_event_add_val("ts_ns", 1000000, &trace_state);
ret = synth_event_add_val("ts_ms", 1000, &trace_state);
ret = synth_event_add_val("cpu", smp_processor_id(), &trace_state);
ret = synth_event_add_val("my_string_field", (u64)"thneed_9",
&trace_state);
ret = synth_event_add_val("my_int_field", 3999, &trace_state);
Note that synth_event_add_next_val() and synth_event_add_val() are incompatible if used within the same trace of an event - either one can be used but not both at the same time.
Finally, the event won't be actually traced until it's 'closed', which is done using synth_event_trace_end(), which takes only the struct synth_event_trace_state object used in the previous calls:
ret = synth_event_trace_end(&trace_state);
Note that synth_event_trace_end() must be called at the end regardless of whether any of the add calls failed (say due to a bad field name being passed in).
7.3 Dynamically creating kprobe and kretprobe event definitions #
To create a kprobe or kretprobe trace event from kernel code, the kprobe_event_gen_cmd_start() or kretprobe_event_gen_cmd_start() functions can be used.
To create a kprobe event, an empty or partially empty kprobe event should first be created using kprobe_event_gen_cmd_start(). The name of the event and the probe location should be specified along with one or args each representing a probe field should be supplied to this function. Before calling kprobe_event_gen_cmd_start(), the user should create and initialize a dynevent_cmd object using kprobe_event_cmd_init().
For example, to create a new "schedtest" kprobe event with two fields:
struct dynevent_cmd cmd;
char *buf;
/* Create a buffer to hold the generated command */
buf = kzalloc(MAX_DYNEVENT_CMD_LEN, GFP_KERNEL);
/* Before generating the command, initialize the cmd object */
kprobe_event_cmd_init(&cmd, buf, MAX_DYNEVENT_CMD_LEN);
/*
* Define the gen_kprobe_test event with the first 2 kprobe
* fields.
*/
ret = kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", "do_sys_open",
"dfd=%ax", "filename=%dx");
Once the kprobe event object has been created, it can then be populated with more fields. Fields can be added using kprobe_event_add_fields(), supplying the dynevent_cmd object along with a variable arg list of probe fields. For example, to add a couple additional fields, the following call could be made:
ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)");
Once all the fields have been added, the event should be finalized and registered by calling the kprobe_event_gen_cmd_end() or kretprobe_event_gen_cmd_end() functions, depending on whether a kprobe or kretprobe command was started:
ret = kprobe_event_gen_cmd_end(&cmd);
or:
ret = kretprobe_event_gen_cmd_end(&cmd);
At this point, the event object is ready to be used for tracing new events.
Similarly, a kretprobe event can be created using kretprobe_event_gen_cmd_start() with a probe name and location and additional params such as $retval:
ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test",
"do_sys_open", "$retval");
Similar to the synthetic event case, code like the following can be used to enable the newly created kprobe event:
gen_kprobe_test = trace_get_event_file(NULL, "kprobes", "gen_kprobe_test");
ret = trace_array_set_clr_event(gen_kprobe_test->tr,
"kprobes", "gen_kprobe_test", true);
Finally, also similar to synthetic events, the following code can be used to give the kprobe event file back and delete the event:
trace_put_event_file(gen_kprobe_test);
ret = kprobe_event_delete("gen_kprobe_test");
7.4 The "dynevent_cmd" low-level API #
Both the in-kernel synthetic event and kprobe interfaces are built on top of a lower-level "dynevent_cmd" interface. This interface is meant to provide the basis for higher-level interfaces such as the synthetic and kprobe interfaces, which can be used as examples.
The basic idea is simple and amounts to providing a general-purpose layer that can be used to generate trace event commands. The generated command strings can then be passed to the command-parsing and event creation code that already exists in the trace event subsystem for creating the corresponding trace events.
In a nutshell, the way it works is that the higher-level interface code creates a struct dynevent_cmd object, then uses a couple functions, dynevent_arg_add() and dynevent_arg_pair_add() to build up a command string, which finally causes the command to be executed using the dynevent_create() function. The details of the interface are described below.
The first step in building a new command string is to create and initialize an instance of a dynevent_cmd. Here, for instance, we create a dynevent_cmd on the stack and initialize it:
struct dynevent_cmd cmd;
char *buf;
int ret;
buf = kzalloc(MAX_DYNEVENT_CMD_LEN, GFP_KERNEL);
dynevent_cmd_init(cmd, buf, maxlen, DYNEVENT_TYPE_FOO,
foo_event_run_command);
The dynevent_cmd initialization needs to be given a user-specified buffer and the length of the buffer (MAX_DYNEVENT_CMD_LEN can be used for this purpose - at 2k it's generally too big to be comfortably put on the stack, so is dynamically allocated), a dynevent type id, which is meant to be used to check that further API calls are for the correct command type, and a pointer to an event-specific run_command() callback that will be called to actually execute the event-specific command function.
Once that's done, the command string can by built up by successive calls to argument-adding functions.
To add a single argument, define and initialize a struct dynevent_arg or struct dynevent_arg_pair object. Here's an example of the simplest possible arg addition, which is simply to append the given string as a whitespace-separated argument to the command:
struct dynevent_arg arg;
dynevent_arg_init(&arg, NULL, 0);
arg.str = name;
ret = dynevent_arg_add(cmd, &arg);
The arg object is first initialized using dynevent_arg_init() and in this case the parameters are NULL or 0, which means there's no optional sanity-checking function or separator appended to the end of the arg.
Here's another more complicated example using an 'arg pair', which is used to create an argument that consists of a couple components added together as a unit, for example, a 'type field_name;' arg or a simple expression arg e.g. 'flags=%cx':
struct dynevent_arg_pair arg_pair;
dynevent_arg_pair_init(&arg_pair, dynevent_foo_check_arg_fn, 0, ';');
arg_pair.lhs = type;
arg_pair.rhs = name;
ret = dynevent_arg_pair_add(cmd, &arg_pair);
Again, the arg_pair is first initialized, in this case with a callback function used to check the sanity of the args (for example, that neither part of the pair is NULL), along with a character to be used to add an operator between the pair (here none) and a separator to be appended onto the end of the arg pair (here ';').
There's also a dynevent_str_add() function that can be used to simply add a string as-is, with no spaces, delimiters, or arg check.
Any number of dynevent_*_add() calls can be made to build up the string (until its length surpasses cmd->maxlen). When all the arguments have been added and the command string is complete, the only thing left to do is run the command, which happens by simply calling dynevent_create():
ret = dynevent_create(&cmd);
At that point, if the return value is 0, the dynamic event has been created and is ready to use.
See the dynevent_cmd function definitions themselves for the details of the API.
Fprobe - Function entry/exit probe
Peios Kernel / Kernel development / Trace
Introduction #
Fprobe is a function entry/exit probe based on the function-graph tracing feature in ftrace. Instead of tracing all functions, if you want to attach callbacks on specific function entry and exit, similar to the kprobes and kretprobes, you can use fprobe. Compared with kprobes and kretprobes, fprobe gives faster instrumentation for multiple functions with single handler. This document describes how to use fprobe.
The usage of fprobe #
The fprobe is a wrapper of ftrace (+ kretprobe-like return callback) to attach callbacks to multiple function entry and exit. User needs to set up the struct fprobe and pass it to register_fprobe().
Typically, fprobe data structure is initialized with the entry_handler and/or exit_handler as below.
struct fprobe fp = ;
To enable the fprobe, call one of register_fprobe(), register_fprobe_ips(), and register_fprobe_syms(). These functions register the fprobe with different types of parameters.
The register_fprobe() enables a fprobe by function-name filters. E.g. this enables @fp on "func*()" function except "func2()".:
register_fprobe(&fp, "func*", "func2");
The register_fprobe_ips() enables a fprobe by ftrace-location addresses. E.g.
unsigned long ips = ;
;
And the register_fprobe_syms() enables a fprobe by symbol names. E.g.
char syms = ;
;
To disable (remove from functions) this fprobe, call:
unregister_fprobe(&fp);
You can temporally (soft) disable the fprobe by:
disable_fprobe(&fp);
and resume by:
enable_fprobe(&fp);
The above is defined by including the header:
#include <linux/fprobe.h>
Same as ftrace, the registered callbacks will start being called some time after the register_fprobe() is called and before it returns. See Documentation/trace/ftrace.rst.
Also, the unregister_fprobe() will guarantee that both enter and exit handlers are no longer being called by functions after unregister_fprobe() returns as same as unregister_ftrace_function().
The fprobe entry/exit handler #
The prototype of the entry/exit callback function are as follows:
int ;
void ;
Note that the @entry_ip is saved at function entry and passed to exit handler. If the entry callback function returns !0, the corresponding exit callback will be cancelled.
-
@fp
This is the address of
fprobedata structure related to this handler. You can embed thefprobeto your data structure and get it by container_of() macro from @fp. The @fp must not be NULL. -
@entry_ip
This is the ftrace address of the traced function (both entry and exit). Note that this may not be the actual entry address of the function but the address where the ftrace is instrumented.
-
@ret_ip
This is the return address that the traced function will return to, somewhere in the caller. This can be used at both entry and exit.
-
@fregs
This is the
ftrace_regsdata structure at the entry and exit. This includes the function parameters, or the return values. So user can access thos values via appropriateftrace_regs_*APIs. -
@entry_data
This is a local storage to share the data between entry and exit handlers. This storage is NULL by default. If the user specify
exit_handlerfield andentry_data_sizefield when registering the fprobe, the storage is allocated and passed to bothentry_handlerandexit_handler.
Entry data size and exit handlers on the same function #
Since the entry data is passed via per-task stack and it has limited size, the entry data size per probe is limited to 15 * sizeof(long). You also need to take care that the different fprobes are probing on the same function, this limit becomes smaller. The entry data size is aligned to sizeof(long) and each fprobe which has exit handler uses a sizeof(long) space on the stack, you should keep the number of fprobes on the same function as small as possible.
Share the callbacks with kprobes #
Since the recursion safeness of the fprobe (and ftrace) is a bit different from the kprobes, this may cause an issue if user wants to run the same code from the fprobe and the kprobes.
Kprobes has per-cpu 'current_kprobe' variable which protects the kprobe handler from recursion in all cases. On the other hand, fprobe uses only ftrace_test_recursion_trylock(). This allows interrupt context to call another (or same) fprobe while the fprobe user handler is running.
This is not a matter if the common callback code has its own recursion detection, or it can handle the recursion in the different contexts (normal/interrupt/NMI.) But if it relies on the 'current_kprobe' recursion lock, it has to check kprobe_running() and use kprobe_busy_*() APIs.
Fprobe has FPROBE_FL_KPROBE_SHARED flag to do this. If your common callback code will be shared with kprobes, please set FPROBE_FL_KPROBE_SHARED before registering the fprobe, like:
fprobe.flags = FPROBE_FL_KPROBE_SHARED;
;
This will protect your common callback from the nested call.
The missed counter #
The fprobe data structure has fprobe::nmissed counter field as same as kprobes. This counter counts up when;
fprobe fails to take ftrace_recursion lock. This usually means that a function which is traced by other ftrace users is called from the entry_handler.
fprobe fails to setup the function exit because of failing to allocate the data buffer from the per-task shadow stack.
The fprobe::nmissed field counts up in both cases. Therefore, the former skips both of entry and exit callback and the latter skips the exit callback, but in both case the counter will increase by 1.
Note that if you set the FTRACE_OPS_FL_RECURSION and/or FTRACE_OPS_FL_RCU to fprobe::ops::flags (ftrace_ops::flags) when registering the fprobe, this counter may not work correctly, because ftrace skips the fprobe function which increase the counter.
Functions and structures #
struct fprobe_hlist_node #
address based hash list node for fprobe.
Definition
;
Members
hlist: The hlist node for address search hash table.addr: One of the probing address of fp.fp: The fprobe which owns this.
struct fprobe_hlist #
hash list nodes for fprobe.
Definition
;
Members
hlist: The hlist node for existence checking hash table.rcu: rcu_head for RCU deferred release.fp: The fprobe which owns this fprobe_hlist.size: The size of array.array: The fprobe_hlist_node for each address to probe.
struct fprobe #
ftrace based probe.
Definition
;
Members
nmissed: The counter for missing events.flags: The status flag.entry_data_size: The private data storage size.entry_handler: The callback function for function entry.exit_handler: The callback function for function exit.hlist_array: The fprobe_hlist for fprobe search from IP hash table.
disable_fprobe() #
void Disable fprobe
Parameters
struct fprobe *fp: The fprobe to be disabled.
Description
This will soft-disable fp. Note that this doesn't remove the ftrace hooks from the function entry.
enable_fprobe() #
void Enable fprobe
Parameters
struct fprobe *fp: The fprobe to be enabled.
Description
This will soft-enable fp.
register_fprobe() #
int Register fprobe to ftrace by pattern.
Parameters
struct fprobe *fp: A fprobe data structure to be registered.const char *filter: A wildcard pattern of probed symbols.const char *notfilter: A wildcard pattern of NOT probed symbols.
Description
Register fp to ftrace for enabling the probe on the symbols matched to filter. If notfilter is not NULL, the symbols matched the notfilter are not probed.
Return 0 if fp is registered successfully, -errno if not.
register_fprobe_ips() #
int Register fprobe to ftrace by address.
Parameters
struct fprobe *fp: A fprobe data structure to be registered.unsigned long *addrs: An array of target function address.int num: The number of entries of addrs.
Description
Register fp to ftrace for enabling the probe on the address given by addrs. The addrs must be the addresses of ftrace location address, which may be the symbol address + arch-dependent offset. If you unsure what this mean, please use other registration functions.
Return 0 if fp is registered successfully, -errno if not.
register_fprobe_syms() #
int Register fprobe to ftrace by symbols.
Parameters
struct fprobe *fp: A fprobe data structure to be registered.const char **syms: An array of target symbols.int num: The number of entries of syms.
Description
Register fp to the symbols given by syms array. This will be useful if you are sure the symbols exist in the kernel.
Return 0 if fp is registered successfully, -errno if not.
unregister_fprobe() #
int Unregister fprobe.
Parameters
struct fprobe *fp: A fprobe data structure to be unregistered.
Description
Unregister fprobe (and remove ftrace hooks from the function entries).
Return 0 if fp is unregistered successfully, -errno if not.
Fprobe-based Event Tracing
Peios Kernel / Kernel development / Trace
Overview #
Fprobe event is similar to the kprobe event, but limited to probe on the function entry and exit only. It is good enough for many use cases which only traces some specific functions.
This document also covers tracepoint probe events (tprobe) since this is also works only on the tracepoint entry. User can trace a part of tracepoint argument, or the tracepoint without trace-event, which is not exposed on tracefs.
As same as other dynamic events, fprobe events and tracepoint probe events are defined via dynamic_events interface file on tracefs.
Synopsis of fprobe-events #
f[:[GRP1/][EVENT1]] SYM [FETCHARGS] : Probe on function entry
f[MAXACTIVE][:[GRP1/][EVENT1]] SYM%return [FETCHARGS] : Probe on function exit
t[:[GRP2/][EVENT2]] TRACEPOINT [FETCHARGS] : Probe on tracepoint
GRP1 : Group name for fprobe. If omitted, use "fprobes" for it.
GRP2 : Group name for tprobe. If omitted, use "tracepoints" for it.
EVENT1 : Event name for fprobe. If omitted, the event name is
"SYM__entry" or "SYM__exit".
EVENT2 : Event name for tprobe. If omitted, the event name is
the same as "TRACEPOINT", but if the "TRACEPOINT" starts
with a digit character, "_TRACEPOINT" is used.
MAXACTIVE : Maximum number of instances of the specified function that
can be probed simultaneously, or 0 for the default value
as defined in Documentation/trace/fprobe.rst
FETCHARGS : Arguments. Each probe can have up to 128 args.
ARG : Fetch "ARG" function argument using BTF (only for function
entry or tracepoint.) (\*1)
@ADDR : Fetch memory at ADDR (ADDR should be in kernel)
@SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol)
$stackN : Fetch Nth entry of stack (N >= 0)
$stack : Fetch stack address.
$argN : Fetch the Nth function argument. (N >= 1) (\*2)
$retval : Fetch return value.(\*3)
$comm : Fetch current task comm.
+|-[u]OFFS(FETCHARG) : Fetch memory at FETCHARG +|- OFFS address.(\*4)(\*5)
\IMM : Store an immediate value to the argument.
NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
(u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types
(x8/x16/x32/x64), "char", "string", "ustring", "symbol", "symstr"
and bitfield are supported.
(\*1) This is available only when BTF is enabled.
(\*2) only for the probe on function entry (offs == 0). Note, this argument access
is best effort, because depending on the argument type, it may be passed on
the stack. But this only support the arguments via registers.
(\*3) only for return probe. Note that this is also best effort. Depending on the
return value type, it might be passed via a pair of registers. But this only
accesses one register.
(\*4) this is useful for fetching a field of data structures.
(\*5) "u" means user-space dereference.
For the details of TYPE, see kprobetrace documentation.
Function arguments at exit #
Function arguments can be accessed at exit probe using $arg<N> fetcharg. This is useful to record the function parameter and return value at once, and trace the difference of structure fields (for debugging a function whether it correctly updates the given data structure or not) See the sample below for how it works.
BTF arguments #
BTF (BPF Type Format) argument allows user to trace function and tracepoint parameters by its name instead of $argN. This feature is available if the kernel is configured with CONFIG_BPF_SYSCALL and CONFIG_DEBUG_INFO_BTF. If user only specify the BTF argument, the event's argument name is also automatically set by the given name.
# echo 'f:myprobe vfs_read count pos' >> dynamic_events
# cat dynamic_events
f:fprobes/myprobe vfs_read count=count pos=pos
It also chooses the fetch type from BTF information. For example, in the above example, the count is unsigned long, and the pos is a pointer. Thus, both are converted to 64bit unsigned long, but only pos has "%Lx" print-format as below
# cat events/fprobes/myprobe/format
name: myprobe
ID: 1313
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:unsigned long __probe_ip; offset:8; size:8; signed:0;
field:u64 count; offset:16; size:8; signed:0;
field:u64 pos; offset:24; size:8; signed:0;
print fmt: "(%lx) count=%Lu pos=0x%Lx", REC->__probe_ip, REC->count, REC->pos
If user unsures the name of arguments, $arg* will be helpful. The $arg* is expanded to all function arguments of the function or the tracepoint.
# echo 'f:myprobe vfs_read $arg*' >> dynamic_events
# cat dynamic_events
f:fprobes/myprobe vfs_read file=file buf=buf count=count pos=pos
BTF also affects the $retval. If user doesn't set any type, the retval type is automatically picked from the BTF. If the function returns void, $retval is rejected.
You can access the data fields of a data structure using allow operator -> (for pointer type) and dot operator . (for data structure type.):
# echo 't sched_switch preempt prev_pid=prev->pid next_pid=next->pid' >> dynamic_events
The field access operators, -> and . can be combined for accessing deeper members and other structure members pointed by the member. e.g. foo->bar.baz->qux If there is non-name union member, you can directly access it as the C code does. For example:
struct {
union {
int a;
int b;
};
} *foo;
To access a and b, use foo->a and foo->b in this case.
This data field access is available for the return value via $retval, e.g. $retval->name.
For these BTF arguments and fields, :string and :ustring change the behavior. If these are used for BTF argument or field, it checks whether the BTF type of the argument or the data field is char * or char [], or not. If not, it rejects applying the string types. Also, with the BTF support, you don't need a memory dereference operator (+0(PTR)) for accessing the string pointed by a PTR. It automatically adds the memory dereference operator according to the BTF type. e.g.
# echo 't sched_switch prev->comm:string' >> dynamic_events
# echo 'f getname_flags%return $retval->name:string' >> dynamic_events
The prev->comm is an embedded char array in the data structure, and $retval->name is a char pointer in the data structure. But in both cases, you can use :string type to get the string.
Usage examples #
Here is an example to add fprobe events on vfs_read() function entry and exit, with BTF arguments.
# echo 'f vfs_read $arg*' >> dynamic_events
# echo 'f vfs_read%return $retval' >> dynamic_events
# cat dynamic_events
f:fprobes/vfs_read__entry vfs_read file=file buf=buf count=count pos=pos
f:fprobes/vfs_read__exit vfs_read%return arg1=$retval
# echo 1 > events/fprobes/enable
# head -n 20 trace | tail
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
sh-70 [000] ...1. 335.883195: vfs_read__entry: (vfs_read+0x4/0x340) file=0xffff888005cf9a80 buf=0x7ffef36c6879 count=1 pos=0xffffc900005aff08
sh-70 [000] ..... 335.883208: vfs_read__exit: (ksys_read+0x75/0x100 <- vfs_read) arg1=1
sh-70 [000] ...1. 335.883220: vfs_read__entry: (vfs_read+0x4/0x340) file=0xffff888005cf9a80 buf=0x7ffef36c6879 count=1 pos=0xffffc900005aff08
sh-70 [000] ..... 335.883224: vfs_read__exit: (ksys_read+0x75/0x100 <- vfs_read) arg1=1
sh-70 [000] ...1. 335.883232: vfs_read__entry: (vfs_read+0x4/0x340) file=0xffff888005cf9a80 buf=0x7ffef36c687a count=1 pos=0xffffc900005aff08
sh-70 [000] ..... 335.883237: vfs_read__exit: (ksys_read+0x75/0x100 <- vfs_read) arg1=1
sh-70 [000] ...1. 336.050329: vfs_read__entry: (vfs_read+0x4/0x340) file=0xffff888005cf9a80 buf=0x7ffef36c6879 count=1 pos=0xffffc900005aff08
sh-70 [000] ..... 336.050343: vfs_read__exit: (ksys_read+0x75/0x100 <- vfs_read) arg1=1
You can see all function arguments and return values are recorded as signed int.
Also, here is an example of tracepoint events on sched_switch tracepoint. To compare the result, this also enables the sched_switch traceevent too.
# echo 't sched_switch $arg*' >> dynamic_events
# echo 1 > events/sched/sched_switch/enable
# echo 1 > events/tracepoints/sched_switch/enable
# echo > trace
# head -n 20 trace | tail
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
sh-70 [000] d..2. 3912.083993: sched_switch: prev_comm=sh prev_pid=70 prev_prio=120 prev_state=S ==> next_comm=swapper/0 next_pid=0 next_prio=120
sh-70 [000] d..3. 3912.083995: sched_switch: (__probestub_sched_switch+0x4/0x10) preempt=0 prev=0xffff88800664e100 next=0xffffffff828229c0 prev_state=1
<idle>-0 [000] d..2. 3912.084183: sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=rcu_preempt next_pid=16 next_prio=120
<idle>-0 [000] d..3. 3912.084184: sched_switch: (__probestub_sched_switch+0x4/0x10) preempt=0 prev=0xffffffff828229c0 next=0xffff888004208000 prev_state=0
rcu_preempt-16 [000] d..2. 3912.084196: sched_switch: prev_comm=rcu_preempt prev_pid=16 prev_prio=120 prev_state=I ==> next_comm=swapper/0 next_pid=0 next_prio=120
rcu_preempt-16 [000] d..3. 3912.084196: sched_switch: (__probestub_sched_switch+0x4/0x10) preempt=0 prev=0xffff888004208000 next=0xffffffff828229c0 prev_state=1026
<idle>-0 [000] d..2. 3912.085191: sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=rcu_preempt next_pid=16 next_prio=120
<idle>-0 [000] d..3. 3912.085191: sched_switch: (__probestub_sched_switch+0x4/0x10) preempt=0 prev=0xffffffff828229c0 next=0xffff888004208000 prev_state=0
As you can see, the sched_switch trace-event shows cooked parameters, on the other hand, the sched_switch tracepoint probe event shows raw parameters. This means you can access any field values in the task structure pointed by the prev and next arguments.
For example, usually task_struct::start_time is not traced, but with this traceprobe event, you can trace that field as below.
# echo 't sched_switch comm=next->comm:string next->start_time' > dynamic_events
# head -n 20 trace | tail
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
sh-70 [000] d..3. 5606.686577: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="rcu_preempt" usage=1 start_time=245000000
rcu_preempt-16 [000] d..3. 5606.686602: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="sh" usage=1 start_time=1596095526
sh-70 [000] d..3. 5606.686637: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="swapper/0" usage=2 start_time=0
<idle>-0 [000] d..3. 5606.687190: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="rcu_preempt" usage=1 start_time=245000000
rcu_preempt-16 [000] d..3. 5606.687202: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="swapper/0" usage=2 start_time=0
<idle>-0 [000] d..3. 5606.690317: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="kworker/0:1" usage=1 start_time=137000000
kworker/0:1-14 [000] d..3. 5606.690339: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="swapper/0" usage=2 start_time=0
<idle>-0 [000] d..3. 5606.692368: sched_switch: (__probestub_sched_switch+0x4/0x10) comm="kworker/0:1" usage=1 start_time=137000000
The return probe allows us to access the results of some functions, which returns the error code and its results are passed via function parameter, such as an structure-initialization function.
For example, vfs_open() will link the file structure to the inode and update mode. You can trace that changes with return probe.
# echo 'f vfs_open mode=file->f_mode:x32 inode=file->f_inode:x64' >> dynamic_events
# echo 'f vfs_open%%return mode=file->f_mode:x32 inode=file->f_inode:x64' >> dynamic_events
# echo 1 > events/fprobes/enable
# cat trace
sh-131 [006] ...1. 1945.714346: vfs_open__entry: (vfs_open+0x4/0x40) mode=0x2 inode=0x0
sh-131 [006] ...1. 1945.714358: vfs_open__exit: (do_open+0x274/0x3d0 <- vfs_open) mode=0x4d801e inode=0xffff888008470168
cat-143 [007] ...1. 1945.717949: vfs_open__entry: (vfs_open+0x4/0x40) mode=0x1 inode=0x0
cat-143 [007] ...1. 1945.717956: vfs_open__exit: (do_open+0x274/0x3d0 <- vfs_open) mode=0x4a801d inode=0xffff888005f78d28
cat-143 [007] ...1. 1945.720616: vfs_open__entry: (vfs_open+0x4/0x40) mode=0x1 inode=0x0
cat-143 [007] ...1. 1945.728263: vfs_open__exit: (do_open+0x274/0x3d0 <- vfs_open) mode=0xa800d inode=0xffff888004ada8d8
You can see the file::f_mode and file::f_inode are updated in vfs_open().
Function Tracer Design
Peios Kernel / Kernel development / Trace
Author: Mike Frysinger
Introduction #
Here we will cover the architecture pieces that the common function tracing code relies on for proper functioning. Things are broken down into increasing complexity so that you can start simple and at least get basic functionality.
Note that this focuses on architecture implementation details only. If you want more explanation of a feature in terms of common code, review the common ftrace.txt file.
Ideally, everyone who wishes to retain performance while supporting tracing in their kernel should make it all the way to dynamic ftrace support.
Prerequisites #
-
Ftrace relies on these features being implemented:
-
STACKTRACE_SUPPORT - implement save_stack_trace()
-
TRACE_IRQFLAGS_SUPPORT - implement include/asm/irqflags.h
-
HAVE_FUNCTION_TRACER #
You will need to implement the mcount and the ftrace_stub functions.
The exact mcount symbol name will depend on your toolchain. Some call it "mcount", "_mcount", or even "__mcount". You can probably figure it out by running something like:
$ echo 'main(){}' | gcc -x c -S -o - - -pg | grep mcount
call mcount
We'll make the assumption below that the symbol is "mcount" just to keep things nice and simple in the examples.
Keep in mind that the ABI that is in effect inside of the mcount function is highly architecture/toolchain specific. We cannot help you in this regard, sorry. Dig up some old documentation and/or find someone more familiar than you to bang ideas off of. Typically, register usage (argument/scratch/etc...) is a major issue at this point, especially in relation to the location of the mcount call (before/after function prologue). You might also want to look at how glibc has implemented the mcount function for your architecture. It might be (semi-)relevant.
The mcount function should check the function pointer ftrace_trace_function to see if it is set to ftrace_stub. If it is, there is nothing for you to do, so return immediately. If it isn't, then call that function in the same way the mcount function normally calls __mcount_internal -- the first argument is the "frompc" while the second argument is the "selfpc" (adjusted to remove the size of the mcount call that is embedded in the function).
For example, if the function foo() calls bar(), when the bar() function calls mcount(), the arguments mcount() will pass to the tracer are:
"frompc" - the address bar() will use to return to foo()
"selfpc" - the address bar() (with mcount() size adjustment)
Also keep in mind that this mcount function will be called a lot, so optimizing for the default case of no tracer will help the smooth running of your system when tracing is disabled. So the start of the mcount function is typically the bare minimum with checking things before returning. That also means the code flow should usually be kept linear (i.e. no branching in the nop case). This is of course an optimization and not a hard requirement.
Here is some pseudo code that should help (these functions should actually be implemented in assembly):
void ftrace_stub(void)
{
return;
}
void mcount(void)
{
/* save any bare state needed in order to do initial checking */
extern void (*ftrace_trace_function)(unsigned long, unsigned long);
if (ftrace_trace_function != ftrace_stub)
goto do_trace;
/* restore any bare state */
return;
do_trace:
/* save all state needed by the ABI (see paragraph above) */
unsigned long frompc = ...;
unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
ftrace_trace_function(frompc, selfpc);
/* restore all state needed by the ABI */
}
Don't forget to export mcount for modules !
extern void mcount(void);
EXPORT_SYMBOL(mcount);
HAVE_FUNCTION_GRAPH_TRACER #
Deep breath ... time to do some real work. Here you will need to update the mcount function to check ftrace graph function pointers, as well as implement some functions to save (hijack) and restore the return address.
The mcount function should check the function pointers ftrace_graph_return (compare to ftrace_stub) and ftrace_graph_entry (compare to ftrace_graph_entry_stub). If either of those is not set to the relevant stub function, call the arch-specific function ftrace_graph_caller which in turn calls the arch-specific function prepare_ftrace_return. Neither of these function names is strictly required, but you should use them anyway to stay consistent across the architecture ports -- easier to compare & contrast things.
The arguments to prepare_ftrace_return are slightly different than what are passed to ftrace_trace_function. The second argument "selfpc" is the same, but the first argument should be a pointer to the "frompc". Typically this is located on the stack. This allows the function to hijack the return address temporarily to have it point to the arch-specific function return_to_handler. That function will simply call the common ftrace_return_to_handler function and that will return the original return address with which you can return to the original call site.
Here is the updated mcount pseudo code:
void mcount(void)
{
...
if (ftrace_trace_function != ftrace_stub)
goto do_trace;
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ extern void (*ftrace_graph_return)(...);
+ extern void (*ftrace_graph_entry)(...);
+ if (ftrace_graph_return != ftrace_stub ||
+ ftrace_graph_entry != ftrace_graph_entry_stub)
+ ftrace_graph_caller();
+#endif
/* restore any bare state */
...
Here is the pseudo code for the new ftrace_graph_caller assembly function:
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
void ftrace_graph_caller(void)
{
/* save all state needed by the ABI */
unsigned long *frompc = &...;
unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
/* passing frame pointer up is optional -- see below */
prepare_ftrace_return(frompc, selfpc, frame_pointer);
/* restore all state needed by the ABI */
}
#endif
For information on how to implement prepare_ftrace_return(), simply look at the x86 version (the frame pointer passing is optional; see the next section for more information). The only architecture-specific piece in it is the setup of the fault recovery table (the asm(...) code). The rest should be the same across architectures.
Here is the pseudo code for the new return_to_handler assembly function. Note that the ABI that applies here is different from what applies to the mcount code. Since you are returning from a function (after the epilogue), you might be able to skimp on things saved/restored (usually just registers used to pass return values).
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
void return_to_handler(void)
{
/* save all state needed by the ABI (see paragraph above) */
void (*original_return_point)(void) = ftrace_return_to_handler();
/* restore all state needed by the ABI */
/* this is usually either a return or a jump */
original_return_point();
}
#endif
HAVE_FUNCTION_GRAPH_FP_TEST #
An arch may pass in a unique value (frame pointer) to both the entering and exiting of a function. On exit, the value is compared and if it does not match, then it will panic the kernel. This is largely a sanity check for bad code generation with gcc. If gcc for your port sanely updates the frame pointer under different optimization levels, then ignore this option.
However, adding support for it isn't terribly difficult. In your assembly code that calls prepare_ftrace_return(), pass the frame pointer as the 3rd argument. Then in the C version of that function, do what the x86 port does and pass it along to ftrace_push_return_trace() instead of a stub value of 0.
Similarly, when you call ftrace_return_to_handler(), pass it the frame pointer.
HAVE_SYSCALL_TRACEPOINTS #
You need very few things to get the syscalls tracing in an arch.
Support HAVE_ARCH_TRACEHOOK (see arch/Kconfig).
Have a NR_syscalls variable in <asm/unistd.h> that provides the number of syscalls supported by the arch.
Support the TIF_SYSCALL_TRACEPOINT thread flags.
Put the trace_sys_enter() and trace_sys_exit() tracepoints calls from ptrace in the ptrace syscalls tracing path.
If the system call table on this arch is more complicated than a simple array of addresses of the system calls, implement an arch_syscall_addr to return the address of a given system call.
If the symbol names of the system calls do not match the function names on this arch, define ARCH_HAS_SYSCALL_MATCH_SYM_NAME in asm/ftrace.h and implement arch_syscall_match_sym_name with the appropriate logic to return true if the function name corresponds with the symbol name.
Tag this arch as HAVE_SYSCALL_TRACEPOINTS.
HAVE_DYNAMIC_FTRACE #
See scripts/recordmcount.pl for more info. Just fill in the arch-specific details for how to locate the addresses of mcount call sites via objdump. This option doesn't make much sense without also implementing dynamic ftrace.
You will first need HAVE_FUNCTION_TRACER, so scroll your reader back up if you got over eager.
-
Once those are out of the way, you will need to implement:
-
-
asm/ftrace.h:
-
MCOUNT_ADDR
-
ftrace_call_adjust()
-
struct dyn_arch_ftrace{}
-
-
-
-
asm code:
-
mcount() (new stub)
-
ftrace_caller()
-
ftrace_call()
-
ftrace_stub()
-
-
-
-
C code:
-
ftrace_dyn_arch_init()
-
ftrace_make_nop()
-
ftrace_make_call()
-
ftrace_update_ftrace_func()
-
-
-
First you will need to fill out some arch details in your asm/ftrace.h.
Define MCOUNT_ADDR as the address of your mcount symbol similar to:
#define MCOUNT_ADDR ((unsigned long)mcount)
Since no one else will have a decl for that function, you will need to:
extern void mcount(void);
You will also need the helper function ftrace_call_adjust(). Most people will be able to stub it out like so:
static inline unsigned long ftrace_call_adjust(unsigned long addr)
{
return addr;
}
<details to be filled>
Lastly you will need the custom dyn_arch_ftrace structure. If you need some extra state when runtime patching arbitrary call sites, this is the place. For now though, create an empty struct:
struct dyn_arch_ftrace {
/* No extra data needed */
};
With the header out of the way, we can fill out the assembly code. While we did already create a mcount() function earlier, dynamic ftrace only wants a stub function. This is because the mcount() will only be used during boot and then all references to it will be patched out never to return. Instead, the guts of the old mcount() will be used to create a new ftrace_caller() function. Because the two are hard to merge, it will most likely be a lot easier to have two separate definitions split up by #ifdefs. Same goes for the ftrace_stub() as that will now be inlined in ftrace_caller().
Before we get confused anymore, let's check out some pseudo code so you can implement your own stuff in assembly:
void mcount(void)
{
return;
}
void ftrace_caller(void)
{
/* save all state needed by the ABI (see paragraph above) */
unsigned long frompc = ...;
unsigned long selfpc = <return address> - MCOUNT_INSN_SIZE;
ftrace_call:
ftrace_stub(frompc, selfpc);
/* restore all state needed by the ABI */
ftrace_stub:
return;
}
This might look a little odd at first, but keep in mind that we will be runtime patching multiple things. First, only functions that we actually want to trace will be patched to call ftrace_caller(). Second, since we only have one tracer active at a time, we will patch the ftrace_caller() function itself to call the specific tracer in question. That is the point of the ftrace_call label.
With that in mind, let's move on to the C code that will actually be doing the runtime patching. You'll need a little knowledge of your arch's opcodes in order to make it through the next section.
Every arch has an init callback function. If you need to do something early on to initialize some state, this is the time to do that. Otherwise, this simple function below should be sufficient for most people:
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
There are two functions that are used to do runtime patching of arbitrary functions. The first is used to turn the mcount call site into a nop (which is what helps us retain runtime performance when not tracing). The second is used to turn the mcount call site into a call to an arbitrary location (but typically that is ftracer_caller()). See the general function definition in linux/ftrace.h for the functions:
ftrace_make_nop()
ftrace_make_call()
The rec->ip value is the address of the mcount call site that was collected by the scripts/recordmcount.pl during build time.
The last function is used to do runtime patching of the active tracer. This will be modifying the assembly code at the location of the ftrace_call symbol inside of the ftrace_caller() function. So you should have sufficient padding at that location to support the new function calls you'll be inserting. Some people will be using a "call" type instruction while others will be using a "branch" type instruction. Specifically, the function is:
ftrace_update_ftrace_func()
HAVE_DYNAMIC_FTRACE + HAVE_FUNCTION_GRAPH_TRACER #
The function grapher needs a few tweaks in order to work with dynamic ftrace. Basically, you will need to:
update:
ftrace_caller()
ftrace_graph_call()
ftrace_graph_caller()
implement:
ftrace_enable_ftrace_graph_caller()
ftrace_disable_ftrace_graph_caller()
<details to be filled>
Quick notes:
add a nop stub after the ftrace_call location named ftrace_graph_call; stub needs to be large enough to support a call to ftrace_graph_caller()
update ftrace_graph_caller() to work with being called by the new ftrace_caller() since some semantics may have changed
ftrace_enable_ftrace_graph_caller() will runtime patch the ftrace_graph_call location with a call to ftrace_graph_caller()
ftrace_disable_ftrace_graph_caller() will runtime patch the ftrace_graph_call location with nops
Using ftrace to hook to functions
Peios Kernel / Kernel development / Trace
Written for: 4.14
Introduction #
The ftrace infrastructure was originally created to attach callbacks to the beginning of functions in order to record and trace the flow of the kernel. But callbacks to the start of a function can have other use cases. Either for live kernel patching, or for security monitoring. This document describes how to use ftrace to implement your own function callbacks.
The ftrace context #
There are helper functions to help against recursion, and making sure RCU is watching. These are explained below.
The ftrace_ops structure #
To register a function callback, a ftrace_ops is required. This structure is used to tell ftrace what function should be called as the callback as well as what protections the callback will perform and not require ftrace to handle.
There is only one field that is needed to be set when registering an ftrace_ops with ftrace:
struct ftrace_ops ops = ;
Both .flags and .private are optional. Only .func is required.
To enable tracing call:
register_ftrace_function(&ops);
To disable tracing call:
unregister_ftrace_function(&ops);
The above is defined by including the header:
#include <linux/ftrace.h>
The registered callback will start being called some time after the register_ftrace_function() is called and before it returns. The exact time that callbacks start being called is dependent upon architecture and scheduling of services. The callback itself will have to handle any synchronization if it must begin at an exact moment.
The unregister_ftrace_function() will guarantee that the callback is no longer being called by functions after the unregister_ftrace_function() returns. Note that to perform this guarantee, the unregister_ftrace_function() may take some time to finish.
The callback function #
The prototype of the callback function is as follows (as of v4.14):
void ;
-
@ip
This is the instruction pointer of the function that is being traced. (where the fentry or mcount is within the function)
-
@parent_ip
This is the instruction pointer of the function that called the the function being traced (where the call of the function occurred).
-
@op
This is a pointer to ftrace_ops that was used to register the callback. This can be used to pass data to the callback via the private pointer.
-
@regs
If the FTRACE_OPS_FL_SAVE_REGS or FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED flags are set in the ftrace_ops structure, then this will be pointing to the pt_regs structure like it would be if an breakpoint was placed at the start of the function where ftrace was tracing. Otherwise it either contains garbage, or NULL.
Protect your callback #
As functions can be called from anywhere, and it is possible that a function called by a callback may also be traced, and call that same callback, recursion protection must be used. There are two helper functions that can help in this regard. If you start your code with:
int bit;
bit = ;
if
return;
and end it with:
;
The code in between will be safe to use, even if it ends up calling a function that the callback is tracing. Note, on success, ftrace_test_recursion_trylock() will disable preemption, and the ftrace_test_recursion_unlock() will enable it again (if it was previously enabled). The instruction pointer (ip) and its parent (parent_ip) is passed to ftrace_test_recursion_trylock() to record where the recursion happened (if CONFIG_FTRACE_RECORD_RECURSION is set).
Alternatively, if the FTRACE_OPS_FL_RECURSION flag is set on the ftrace_ops (as explained below), then a helper trampoline will be used to test for recursion for the callback and no recursion test needs to be done. But this is at the expense of a slightly more overhead from an extra function call.
If your callback accesses any data or critical section that requires RCU protection, it is best to make sure that RCU is "watching", otherwise that data or critical section will not be protected as expected. In this case add:
if
return;
Alternatively, if the FTRACE_OPS_FL_RCU flag is set on the ftrace_ops (as explained below), then a helper trampoline will be used to test for rcu_is_watching for the callback and no other test needs to be done. But this is at the expense of a slightly more overhead from an extra function call.
The ftrace FLAGS #
The ftrace_ops flags are all defined and documented in include/linux/ftrace.h. Some of the flags are used for internal infrastructure of ftrace, but the ones that users should be aware of are the following:
-
FTRACE_OPS_FL_SAVE_REGS
If the callback requires reading or modifying the pt_regs passed to the callback, then it must set this flag. Registering a ftrace_ops with this flag set on an architecture that does not support passing of pt_regs to the callback will fail.
-
FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED
Similar to SAVE_REGS but the registering of a ftrace_ops on an architecture that does not support passing of regs will not fail with this flag set. But the callback must check if regs is NULL or not to determine if the architecture supports it.
-
FTRACE_OPS_FL_RECURSION
By default, it is expected that the callback can handle recursion. But if the callback is not that worried about overhead, then setting this bit will add the recursion protection around the callback by calling a helper function that will do the recursion protection and only call the callback if it did not recurse.
Note, if this flag is not set, and recursion does occur, it could cause the system to crash, and possibly reboot via a triple fault.
Note, if this flag is set, then the callback will always be called with preemption disabled. If it is not set, then it is possible (but not guaranteed) that the callback will be called in preemptible context.
-
FTRACE_OPS_FL_IPMODIFY
Requires FTRACE_OPS_FL_SAVE_REGS set. If the callback is to "hijack" the traced function (have another function called instead of the traced function), it requires setting this flag. This is what live kernel patches uses. Without this flag the pt_regs->ip can not be modified.
Note, only one ftrace_ops with FTRACE_OPS_FL_IPMODIFY set may be registered to any given function at a time.
-
FTRACE_OPS_FL_RCU
If this is set, then the callback will only be called by functions where RCU is "watching". This is required if the callback function performs any rcu_read_lock() operation.
RCU stops watching when the system goes idle, the time when a CPU is taken down and comes back online, and when entering from kernel to user space and back to kernel space. During these transitions, a callback may be executed and RCU synchronization will not protect it.
-
FTRACE_OPS_FL_PERMANENT
If this is set on any ftrace ops, then the tracing cannot disabled by writing 0 to the proc sysctl ftrace_enabled. Equally, a callback with the flag set cannot be registered if ftrace_enabled is 0.
Livepatch uses it not to lose the function redirection, so the system stays protected.
Filtering which functions to trace #
If a callback is only to be called from specific functions, a filter must be set up. The filters are added by name, or ip if it is known.
int ;
-
@ops
The ops to set the filter with
-
@buf
The string that holds the function filter text.
-
@len
The length of the string.
-
@reset
Non-zero to reset all filters before applying this filter.
Filters denote which functions should be enabled when tracing is enabled. If @buf is NULL and reset is set, all functions will be enabled for tracing.
The @buf can also be a glob expression to enable all functions that match a specific pattern.
See Filter Commands in Documentation/trace/ftrace.rst.
To just trace the schedule function:
ret = ;
To add more functions, call the ftrace_set_filter() more than once with the @reset parameter set to zero. To remove the current filter set and replace it with new functions defined by @buf, have @reset be non-zero.
To remove all the filtered functions and trace all functions:
ret = ;
Sometimes more than one function has the same name. To trace just a specific function in this case, ftrace_set_filter_ip() can be used.
ret = ;
Although the ip must be the address where the call to fentry or mcount is located in the function. This function is used by perf and kprobes that gets the ip address from the user (usually using debug info from the kernel).
If a glob is used to set the filter, functions can be added to a "notrace" list that will prevent those functions from calling the callback. The "notrace" list takes precedence over the "filter" list. If the two lists are non-empty and contain the same functions, the callback will not be called by any function.
An empty "notrace" list means to allow all functions defined by the filter to be traced.
int ;
This takes the same parameters as ftrace_set_filter() but will add the functions it finds to not be traced. This is a separate list from the filter list, and this function does not modify the filter list.
A non-zero @reset will clear the "notrace" list before adding functions that match @buf to it.
Clearing the "notrace" list is the same as clearing the filter list
ret = ;
The filter and notrace lists may be changed at any time. If only a set of functions should call the callback, it is best to set the filters before registering the callback. But the changes may also happen after the callback has been registered.
If a filter is in place, and the @reset is non-zero, and @buf contains a matching glob to functions, the switch will happen during the time of the ftrace_set_filter() call. At no time will all functions call the callback.
;
;
;
;
is not the same as:
;
;
;
;
;
As the latter will have a short time where all functions will call the callback, between the time of the reset, and the time of the new setting of the filter.
ftrace - Function Tracer
Peios Kernel / Kernel development / Trace
Peios: References to Unix root and file modes below describe the inherited interface conventions. They are not sufficient Peios authorization: native descriptor/handle checks, the separate sysfs write gate, and mapped native privileges apply as appropriate. Debugfs additionally remains subject to integrity lockdown. See Peios kernel behaviour.
Copyright 2008 Red Hat Inc.
Author: Steven Rostedt <srostedt@redhat.com>
License: The GNU Free Documentation License, Version 1.2 (dual licensed under the GPL v2)
Original Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, John Kacur, and David Teigland.
-
Written for: 2.6.28-rc2
-
Updated for: 3.10
-
Updated for: 4.13 - Copyright 2017 VMware Inc. Steven Rostedt
-
Converted to rst format - Changbin Du <changbin.du@intel.com>
Introduction #
Ftrace is an internal tracer designed to help out developers and designers of systems to find what is going on inside the kernel. It can be used for debugging or analyzing latencies and performance issues that take place outside of user-space.
Although ftrace is typically considered the function tracer, it is really a framework of several assorted tracing utilities. There's latency tracing to examine what occurs between interrupts disabled and enabled, as well as for preemption and from a time a task is woken to the task is actually scheduled in.
One of the most common uses of ftrace is the event tracing. Throughout the kernel are hundreds of static event points that can be enabled via the tracefs file system to see what is going on in certain parts of the kernel.
See events.rst for more information.
Implementation Details #
See Documentation/trace/ftrace-design.rst for details for arch porters and such.
The File System #
Ftrace uses the tracefs file system to hold the control files as well as the files to display output.
When tracefs is configured into the kernel (which selecting any ftrace option will do) the directory /sys/kernel/tracing will be created. To mount this directory, you can add to your /etc/fstab file:
tracefs /sys/kernel/tracing tracefs defaults 0 0
Or you can mount it at run time with:
mount -t tracefs nodev /sys/kernel/tracing
For quicker access to that directory you may want to make a soft link to it:
ln -s /sys/kernel/tracing /tracing
That's it! (assuming that you have ftrace configured into your kernel)
After mounting tracefs you will have access to the control and output files of ftrace. Here is a list of some of the key files:
Note: all time values are in microseconds.
current_tracer:
This is used to set or display the current tracer that is configured. Changing the current tracer clears the ring buffer content as well as the "snapshot" buffer.
available_tracers:
This holds the different types of tracers that have been compiled into the kernel. The tracers listed here can be configured by echoing their name into current_tracer.
tracing_on:
This sets or displays whether writing to the trace ring buffer is enabled. Echo 0 into this file to disable the tracer or 1 to enable it. Note, this only disables writing to the ring buffer, the tracing overhead may still be occurring.
The kernel function tracing_off() can be used within the kernel to disable writing to the ring buffer, which will set this file to "0". User space can re-enable tracing by echoing "1" into the file.
Note, the function and event trigger "traceoff" will also set this file to zero and stop tracing. Which can also be re-enabled by user space using this file.
trace:
This file holds the output of the trace in a human readable format (described below). Opening this file for writing with the O_TRUNC flag clears the ring buffer content. Note, this file is not a consumer. If tracing is off (no tracer running, or tracing_on is zero), it will produce the same output each time it is read. When tracing is on, it may produce inconsistent results as it tries to read the entire buffer without consuming it.
trace_pipe:
The output is the same as the "trace" file but this file is meant to be streamed with live tracing. Reads from this file will block until new data is retrieved. Unlike the "trace" file, this file is a consumer. This means reading from this file causes sequential reads to display more current data. Once data is read from this file, it is consumed, and will not be read again with a sequential read. The "trace" file is static, and if the tracer is not adding more data, it will display the same information every time it is read.
trace_options:
This file lets the user control the amount of data that is displayed in one of the above output files. Options also exist to modify how a tracer or events work (stack traces, timestamps, etc).
options:
This is a directory that has a file for every available trace option (also in trace_options). Options may also be set or cleared by writing a "1" or "0" respectively into the corresponding file with the option name.
tracing_max_latency:
Some of the tracers record the max latency. For example, the maximum time that interrupts are disabled. The maximum time is saved in this file. The max trace will also be stored, and displayed by "trace". A new max trace will only be recorded if the latency is greater than the value in this file (in microseconds).
By echoing in a time into this file, no latency will be recorded unless it is greater than the time in this file.
tracing_thresh:
Some latency tracers will record a trace whenever the latency is greater than the number in this file. Only active when the file contains a number greater than 0. (in microseconds)
buffer_percent:
This is the watermark for how much the ring buffer needs to be filled before a waiter is woken up. That is, if an application calls a blocking read syscall on one of the per_cpu trace_pipe_raw files, it will block until the given amount of data specified by buffer_percent is in the ring buffer before it wakes the reader up. This also controls how the splice system calls are blocked on this file:
0 - means to wake up as soon as there is any data in the ring buffer. 50 - means to wake up when roughly half of the ring buffer sub-buffers are full. 100 - means to block until the ring buffer is totally full and is about to start overwriting the older data.buffer_size_kb:
This sets or displays the number of kilobytes each CPU buffer holds. By default, the trace buffers are the same size for each CPU. The displayed number is the size of the CPU buffer and not total size of all buffers. The trace buffers are allocated in pages (blocks of memory that the kernel uses for allocation, usually 4 KB in size). A few extra pages may be allocated to accommodate buffer management meta-data. If the last page allocated has room for more bytes than requested, the rest of the page will be used, making the actual allocation bigger than requested or shown. ( Note, the size may not be a multiple of the page size due to buffer management meta-data. )
Buffer sizes for individual CPUs may vary (see "per_cpu/cpu0/buffer_size_kb" below), and if they do this file will show "X".
buffer_total_size_kb:
This displays the total combined size of all the trace buffers.
buffer_subbuf_size_kb:
This sets or displays the sub buffer size. The ring buffer is broken up into several same size "sub buffers". An event can not be bigger than the size of the sub buffer. Normally, the sub buffer is the size of the architecture's page (4K on x86). The sub buffer also contains meta data at the start which also limits the size of an event. That means when the sub buffer is a page size, no event can be larger than the page size minus the sub buffer meta data.
Note, the buffer_subbuf_size_kb is a way for the user to specify the minimum size of the subbuffer. The kernel may make it bigger due to the implementation details, or simply fail the operation if the kernel can not handle the request.
Changing the sub buffer size allows for events to be larger than the page size.
Note: When changing the sub-buffer size, tracing is stopped and any data in the ring buffer and the snapshot buffer will be discarded.
free_buffer:
If a process is performing tracing, and the ring buffer should be shrunk "freed" when the process is finished, even if it were to be killed by a signal, this file can be used for that purpose. On close of this file, the ring buffer will be resized to its minimum size. Having a process that is tracing also open this file, when the process exits its file descriptor for this file will be closed, and in doing so, the ring buffer will be "freed".
It may also stop tracing if disable_on_free option is set.
tracing_cpumask:
This is a mask that lets the user only trace on specified CPUs. The format is a hex string representing the CPUs.
set_ftrace_filter:
When dynamic ftrace is configured in (see the section below "dynamic ftrace"), the code is dynamically modified (code text rewrite) to disable calling of the function profiler (mcount). This lets tracing be configured in with practically no overhead in performance. This also has a side effect of enabling or disabling specific functions to be traced. Echoing names of functions into this file will limit the trace to only those functions. This influences the tracers "function" and "function_graph" and thus also function profiling (see "function_profile_enabled").
The functions listed in "available_filter_functions" are what can be written into this file.
This interface also allows for commands to be used. See the "Filter commands" section for more details.
As a speed up, since processing strings can be quite expensive and requires a check of all functions registered to tracing, instead an index can be written into this file. A number (starting with "1") written will instead select the same corresponding at the line position of the "available_filter_functions" file.
set_ftrace_notrace:
This has an effect opposite to that of set_ftrace_filter. Any function that is added here will not be traced. If a function exists in both set_ftrace_filter and set_ftrace_notrace, the function will _not_ be traced.
set_ftrace_pid:
Have the function tracer only trace the threads whose PID are listed in this file.
If the "function-fork" option is set, then when a task whose PID is listed in this file forks, the child's PID will automatically be added to this file, and the child will be traced by the function tracer as well. This option will also cause PIDs of tasks that exit to be removed from the file.
set_ftrace_notrace_pid:
Have the function tracer ignore threads whose PID are listed in this file.
If the "function-fork" option is set, then when a task whose PID is listed in this file forks, the child's PID will automatically be added to this file, and the child will not be traced by the function tracer as well. This option will also cause PIDs of tasks that exit to be removed from the file.
If a PID is in both this file and "set_ftrace_pid", then this file takes precedence, and the thread will not be traced.
set_event_pid:
Have the events only trace a task with a PID listed in this file. Note, sched_switch and sched_wake_up will also trace events listed in this file.
To have the PIDs of children of tasks with their PID in this file added on fork, enable the "event-fork" option. That option will also cause the PIDs of tasks to be removed from this file when the task exits.
set_event_notrace_pid:
Have the events not trace a task with a PID listed in this file. Note, sched_switch and sched_wakeup will trace threads not listed in this file, even if a thread's PID is in the file if the sched_switch or sched_wakeup events also trace a thread that should be traced.
To have the PIDs of children of tasks with their PID in this file added on fork, enable the "event-fork" option. That option will also cause the PIDs of tasks to be removed from this file when the task exits.
set_graph_function:
Functions listed in this file will cause the function graph tracer to only trace these functions and the functions that they call. (See the section "dynamic ftrace" for more details). Note, set_ftrace_filter and set_ftrace_notrace still affects what functions are being traced.
set_graph_notrace:
Similar to set_graph_function, but will disable function graph tracing when the function is hit until it exits the function. This makes it possible to ignore tracing functions that are called by a specific function.
available_filter_functions:
This lists the functions that ftrace has processed and can trace. These are the function names that you can pass to "set_ftrace_filter", "set_ftrace_notrace", "set_graph_function", or "set_graph_notrace". (See the section "dynamic ftrace" below for more details.)
available_filter_functions_addrs:
Similar to available_filter_functions, but with address displayed for each function. The displayed address is the patch-site address and can differ from /proc/kallsyms address.
syscall_user_buf_size:
Some system call trace events will record the data from a user space address that one of the parameters point to. The amount of data per event is limited. This file holds the max number of bytes that will be recorded into the ring buffer to hold this data. The max value is currently 165.
dyn_ftrace_total_info:
This file is for debugging purposes. The number of functions that have been converted to nops and are available to be traced.
enabled_functions:
This file is more for debugging ftrace, but can also be useful in seeing if any function has a callback attached to it. Not only does the trace infrastructure use ftrace function trace utility, but other subsystems might too. This file displays all functions that have a callback attached to them as well as the number of callbacks that have been attached. Note, a callback may also call multiple functions which will not be listed in this count.
If the callback registered to be traced by a function with the "save regs" attribute (thus even more overhead), an 'R' will be displayed on the same line as the function that is returning registers.
If the callback registered to be traced by a function with the "ip modify" attribute (thus the regs->ip can be changed), an 'I' will be displayed on the same line as the function that can be overridden.
If a non-ftrace trampoline is attached (BPF) a 'D' will be displayed. Note, normal ftrace trampolines can also be attached, but only one "direct" trampoline can be attached to a given function at a time.
Some architectures can not call direct trampolines, but instead have the ftrace ops function located above the function entry point. In such cases an 'O' will be displayed.
If a function had either the "ip modify" or a "direct" call attached to it in the past, a 'M' will be shown. This flag is never cleared. It is used to know if a function was ever modified by the ftrace infrastructure, and can be used for debugging.
If the architecture supports it, it will also show what callback is being directly called by the function. If the count is greater than 1 it most likely will be ftrace_ops_list_func().
If the callback of a function jumps to a trampoline that is specific to the callback and which is not the standard trampoline, its address will be printed as well as the function that the trampoline calls.
touched_functions:
This file contains all the functions that ever had a function callback to it via the ftrace infrastructure. It has the same format as enabled_functions but shows all functions that have ever been traced.
To see any function that has every been modified by "ip modify" or a direct trampoline, one can perform the following command:
grep ' M ' /sys/kernel/tracing/touched_functions
function_profile_enabled:
When set it will enable all functions with either the function tracer, or if configured, the function graph tracer. It will keep a histogram of the number of functions that were called and if the function graph tracer was configured, it will also keep track of the time spent in those functions. The histogram content can be displayed in the files:
trace_stat/function<cpu> ( function0, function1, etc).
trace_stat:
A directory that holds different tracing stats.
kprobe_events:
Enable dynamic trace points. See kprobetrace.rst.
kprobe_profile:
Dynamic trace points stats. See kprobetrace.rst.
max_graph_depth:
Used with the function graph tracer. This is the max depth it will trace into a function. Setting this to a value of one will show only the first kernel function that is called from user space.
printk_formats:
This is for tools that read the raw format files. If an event in the ring buffer references a string, only a pointer to the string is recorded into the buffer and not the string itself. This prevents tools from knowing what that string was. This file displays the string and address for the string allowing tools to map the pointers to what the strings were.
saved_cmdlines:
Only the pid of the task is recorded in a trace event unless the event specifically saves the task comm as well. Ftrace makes a cache of pid mappings to comms to try to display comms for events. If a pid for a comm is not listed, then "<...>" is displayed in the output.
If the option "record-cmd" is set to "0", then comms of tasks will not be saved during recording. By default, it is enabled.
saved_cmdlines_size:
By default, 128 comms are saved (see "saved_cmdlines" above). To increase or decrease the amount of comms that are cached, echo the number of comms to cache into this file.
saved_tgids:
If the option "record-tgid" is set, on each scheduling context switch the Task Group ID of a task is saved in a table mapping the PID of the thread to its TGID. By default, the "record-tgid" option is disabled.
snapshot:
This displays the "snapshot" buffer and also lets the user take a snapshot of the current running trace. See the "Snapshot" section below for more details.
stack_max_size:
When the stack tracer is activated, this will display the maximum stack size it has encountered. See the "Stack Trace" section below.
stack_trace:
This displays the stack back trace of the largest stack that was encountered when the stack tracer is activated. See the "Stack Trace" section below.
stack_trace_filter:
This is similar to "set_ftrace_filter" but it limits what functions the stack tracer will check.
trace_clock:
Whenever an event is recorded into the ring buffer, a "timestamp" is added. This stamp comes from a specified clock. By default, ftrace uses the "local" clock. This clock is very fast and strictly per CPU, but on some systems it may not be monotonic with respect to other CPUs. In other words, the local clocks may not be in sync with local clocks on other CPUs.
Usual clocks for tracing:
# cat trace_clock [local] global counter x86-tscThe clock with the square brackets around it is the one in effect.
local:
Default clock, but may not be in sync across CPUs
global:
This clock is in sync with all CPUs but may be a bit slower than the local clock.
counter:
This is not a clock at all, but literally an atomic counter. It counts up one by one, but is in sync with all CPUs. This is useful when you need to know exactly the order events occurred with respect to each other on different CPUs.
uptime:
This uses the jiffies counter and the time stamp is relative to the time since boot up.
perf:
This makes ftrace use the same clock that perf uses. Eventually perf will be able to read ftrace buffers and this will help out in interleaving the data.
x86-tsc:
Architectures may define their own clocks. For example, x86 uses its own TSC cycle clock here.
ppc-tb:
This uses the powerpc timebase register value. This is in sync across CPUs and can also be used to correlate events across hypervisor/guest if tb_offset is known.
mono:
This uses the fast monotonic clock (CLOCK_MONOTONIC) which is monotonic and is subject to NTP rate adjustments.
mono_raw:
This is the raw monotonic clock (CLOCK_MONOTONIC_RAW) which is monotonic but is not subject to any rate adjustments and ticks at the same rate as the hardware clocksource.
boot:
This is the boot clock (CLOCK_BOOTTIME) and is based on the fast monotonic clock, but also accounts for time spent in suspend. Since the clock access is designed for use in tracing in the suspend path, some side effects are possible if clock is accessed after the suspend time is accounted before the fast mono clock is updated. In this case, the clock update appears to happen slightly sooner than it normally would have. Also on 32-bit systems, it's possible that the 64-bit boot offset sees a partial update. These effects are rare and post processing should be able to handle them. See comments in the ktime_get_boot_fast_ns() function for more information.
tai:
This is the tai clock (CLOCK_TAI) and is derived from the wall- clock time. However, this clock does not experience discontinuities and backwards jumps caused by NTP inserting leap seconds. Since the clock access is designed for use in tracing, side effects are possible. The clock access may yield wrong readouts in case the internal TAI offset is updated e.g., caused by setting the system time or using adjtimex() with an offset. These effects are rare and post processing should be able to handle them. See comments in the ktime_get_tai_fast_ns() function for more information.
To set a clock, simply echo the clock name into this file:
# echo global > trace_clockSetting a clock clears the ring buffer content as well as the "snapshot" buffer.
trace_marker:
This is a very useful file for synchronizing user space with events happening in the kernel. Writing strings into this file will be written into the ftrace buffer.
It is useful in applications to open this file at the start of the application and just reference the file descriptor for the file:
void trace_write(const char *fmt, ...) { va_list ap; char buf[256]; int n; if (trace_fd < 0) return; va_start(ap, fmt); n = vsnprintf(buf, 256, fmt, ap); va_end(ap); write(trace_fd, buf, n); }start:
trace_fd = open("trace_marker", O_WRONLY);
Note: Writing into the trace_marker file can also initiate triggers
that are written into /sys/kernel/tracing/events/ftrace/print/trigger See "Event triggers" in Documentation/trace/events.rst and an example in Documentation/trace/histogram.rst (Section 3.)
trace_marker_raw:
This is similar to trace_marker above, but is meant for binary data to be written to it, where a tool can be used to parse the data from trace_pipe_raw.
uprobe_events:
Add dynamic tracepoints in programs. See uprobetracer.rst
uprobe_profile:
Uprobe statistics. See uprobetrace.txt
instances:
This is a way to make multiple trace buffers where different events can be recorded in different buffers. See "Instances" section below.
events:
This is the trace event directory. It holds event tracepoints (also known as static tracepoints) that have been compiled into the kernel. It shows what event tracepoints exist and how they are grouped by system. There are "enable" files at various levels that can enable the tracepoints when a "1" is written to them.
See events.rst for more information.
set_event:
By echoing in the event into this file, will enable that event.
See events.rst for more information.
show_event_filters:
A list of events that have filters. This shows the system/event pair along with the filter that is attached to the event.
See events.rst for more information.
show_event_triggers:
A list of events that have triggers. This shows the system/event pair along with the trigger that is attached to the event.
See events.rst for more information.
available_events:
A list of events that can be enabled in tracing.
See events.rst for more information.
timestamp_mode:
Certain tracers may change the timestamp mode used when logging trace events into the event buffer. Events with different modes can coexist within a buffer but the mode in effect when an event is logged determines which timestamp mode is used for that event. The default timestamp mode is 'delta'.
Usual timestamp modes for tracing:
# cat timestamp_mode [delta] absolute
The timestamp mode with the square brackets around it is the one in effect.
delta: Default timestamp mode - timestamp is a delta against
a per-buffer timestamp.
absolute: The timestamp is a full timestamp, not a delta
against some other value. As such it takes up more space and is less efficient.
hwlat_detector:
Directory for the Hardware Latency Detector. See "Hardware Latency Detector" section below.
per_cpu:
This is a directory that contains the trace per_cpu information.
per_cpu/cpu0/buffer_size_kb:
The ftrace buffer is defined per_cpu. That is, there's a separate buffer for each CPU to allow writes to be done atomically, and free from cache bouncing. These buffers may have different size buffers. This file is similar to the buffer_size_kb file, but it only displays or sets the buffer size for the specific CPU. (here cpu0).
per_cpu/cpu0/trace:
This is similar to the "trace" file, but it will only display the data specific for the CPU. If written to, it only clears the specific CPU buffer.
per_cpu/cpu0/trace_pipe
This is similar to the "trace_pipe" file, and is a consuming read, but it will only display (and consume) the data specific for the CPU.
per_cpu/cpu0/trace_pipe_raw
For tools that can parse the ftrace ring buffer binary format, the trace_pipe_raw file can be used to extract the data from the ring buffer directly. With the use of the splice() system call, the buffer data can be quickly transferred to a file or to the network where a server is collecting the data.
Like trace_pipe, this is a consuming reader, where multiple reads will always produce different data.
per_cpu/cpu0/snapshot:
This is similar to the main "snapshot" file, but will only snapshot the current CPU (if supported). It only displays the content of the snapshot for a given CPU, and if written to, only clears this CPU buffer.
per_cpu/cpu0/snapshot_raw:
Similar to the trace_pipe_raw, but will read the binary format from the snapshot buffer for the given CPU.
per_cpu/cpu0/stats:
This displays certain stats about the ring buffer:
entries:
The number of events that are still in the buffer.
overrun:
The number of lost events due to overwriting when the buffer was full.
commit overrun:
Should always be zero. This gets set if so many events happened within a nested event (ring buffer is re-entrant), that it fills the buffer and starts dropping events.
bytes:
Bytes actually read (not overwritten).
oldest event ts:
The oldest timestamp in the buffer
now ts:
The current timestamp
dropped events:
Events lost due to overwrite option being off.
read events:
The number of events read.
The Tracers #
Here is the list of current tracers that may be configured.
"function"
Function call tracer to trace all kernel functions.
"function_graph"
Similar to the function tracer except that the function tracer probes the functions on their entry whereas the function graph tracer traces on both entry and exit of the functions. It then provides the ability to draw a graph of function calls similar to C code source.
Note that the function graph calculates the timings of when the function starts and returns internally and for each instance. If there are two instances that run function graph tracer and traces the same functions, the length of the timings may be slightly off as each read the timestamp separately and not at the same time.
"blk"
The block tracer. The tracer used by the blktrace user application.
"hwlat"
The Hardware Latency tracer is used to detect if the hardware produces any latency. See "Hardware Latency Detector" section below.
"irqsoff"
Traces the areas that disable interrupts and saves the trace with the longest max latency. See tracing_max_latency. When a new max is recorded, it replaces the old trace. It is best to view this trace with the latency-format option enabled, which happens automatically when the tracer is selected.
"preemptoff"
Similar to irqsoff but traces and records the amount of time for which preemption is disabled.
"preemptirqsoff"
Similar to irqsoff and preemptoff, but traces and records the largest time for which irqs and/or preemption is disabled.
"wakeup"
Traces and records the max latency that it takes for the highest priority task to get scheduled after it has been woken up. Traces all tasks as an average developer would expect.
"wakeup_rt"
Traces and records the max latency that it takes for just RT tasks (as the current "wakeup" does). This is useful for those interested in wake up timings of RT tasks.
"wakeup_dl"
Traces and records the max latency that it takes for a SCHED_DEADLINE task to be woken (as the "wakeup" and "wakeup_rt" does).
"mmiotrace"
A special tracer that is used to trace binary modules. It will trace all the calls that a module makes to the hardware. Everything it writes and reads from the I/O as well.
"branch"
This tracer can be configured when tracing likely/unlikely calls within the kernel. It will trace when a likely and unlikely branch is hit and if it was correct in its prediction of being correct.
"nop"
This is the "trace nothing" tracer. To remove all tracers from tracing simply echo "nop" into current_tracer.
Error conditions #
For most ftrace commands, failure modes are obvious and communicated using standard return codes.
For other more involved commands, extended error information may be available via the tracing/error_log file. For the commands that support it, reading the tracing/error_log file after an error will display more detailed information about what went wrong, if information is available. The tracing/error_log file is a circular error log displaying a small number (currently, 8) of ftrace errors for the last (8) failed commands.
The extended error information and usage takes the form shown in this example:
# echo xxx > /sys/kernel/tracing/events/sched/sched_wakeup/trigger echo: write error: Invalid argument # cat /sys/kernel/tracing/error_log [ 5348.887237] location: error: Couldn't yyy: zzz Command: xxx ^ [ 7517.023364] location: error: Bad rrr: sss Command: ppp qqq ^To clear the error log, echo the empty string into it:
# echo > /sys/kernel/tracing/error_log
Examples of using the tracer #
Here are typical examples of using the tracers when controlling them only with the tracefs interface (without using any user-land utilities).
Output format: #
Here is an example of the output format of the file "trace":
# tracer: function
#
# entries-in-buffer/entries-written: 140080/250280 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
bash-1977 [000] .... 17284.993652: sys_close <-system_call_fastpath
bash-1977 [000] .... 17284.993653: __close_fd <-sys_close
bash-1977 [000] .... 17284.993653: _raw_spin_lock <-__close_fd
sshd-1974 [003] .... 17284.993653: __srcu_read_unlock <-fsnotify
bash-1977 [000] .... 17284.993654: add_preempt_count <-_raw_spin_lock
bash-1977 [000] ...1 17284.993655: _raw_spin_unlock <-__close_fd
bash-1977 [000] ...1 17284.993656: sub_preempt_count <-_raw_spin_unlock
bash-1977 [000] .... 17284.993657: filp_close <-__close_fd
bash-1977 [000] .... 17284.993657: dnotify_flush <-filp_close
sshd-1974 [003] .... 17284.993658: sys_select <-system_call_fastpath
....
A header is printed with the tracer name that is represented by the trace. In this case the tracer is "function". Then it shows the number of events in the buffer as well as the total number of entries that were written. The difference is the number of entries that were lost due to the buffer filling up (250280 - 140080 = 110200 events lost).
The header explains the content of the events. Task name "bash", the task PID "1977", the CPU that it was running on "000", the latency format (explained below), the timestamp in <secs>.<usecs> format, the function name that was traced "sys_close" and the parent function that called this function "system_call_fastpath". The timestamp is the time at which the function was entered.
Latency trace format #
When the latency-format option is enabled or when one of the latency tracers is set, the trace file gives somewhat more information to see why a latency happened. Here is a typical trace:
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 259 us, #4/4, CPU#2 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: ps-6143 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: __lock_task_sighand
# => ended at: _raw_spin_unlock_irqrestore
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
ps-6143 2d... 0us!: trace_hardirqs_off <-__lock_task_sighand
ps-6143 2d..1 259us+: trace_hardirqs_on <-_raw_spin_unlock_irqrestore
ps-6143 2d..1 263us+: time_hardirqs_on <-_raw_spin_unlock_irqrestore
ps-6143 2d..1 306us : <stack trace>
=> trace_hardirqs_on_caller
=> trace_hardirqs_on
=> _raw_spin_unlock_irqrestore
=> do_task_stat
=> proc_tgid_stat
=> proc_single_show
=> seq_read
=> vfs_read
=> sys_read
=> system_call_fastpath
This shows that the current tracer is "irqsoff" tracing the time for which interrupts were disabled. It gives the trace version (which never changes) and the version of the kernel upon which this was executed on (3.8). Then it displays the max latency in microseconds (259 us). The number of trace entries displayed and the total number (both are four: #4/4). VP, KP, SP, and HP are always zero and are reserved for later use. #P is the number of online CPUs (#P:4).
The task is the process that was running when the latency occurred. (ps pid: 6143).
The start and stop (the functions in which the interrupts were disabled and enabled respectively) that caused the latencies:
__lock_task_sighand is where the interrupts were disabled.
_raw_spin_unlock_irqrestore is where they were enabled again.
The next lines after the header are the trace itself. The header explains which is which.
cmd: The name of the process in the trace.
pid: The PID of that process.
CPU#: The CPU which the process was running on.
irqs-off: 'd' interrupts are disabled. '.' otherwise.
need-resched:
'B' all, TIF_NEED_RESCHED, PREEMPT_NEED_RESCHED and TIF_RESCHED_LAZY is set,
'N' both TIF_NEED_RESCHED and PREEMPT_NEED_RESCHED is set,
'n' only TIF_NEED_RESCHED is set,
'p' only PREEMPT_NEED_RESCHED is set,
'L' both PREEMPT_NEED_RESCHED and TIF_RESCHED_LAZY is set,
'b' both TIF_NEED_RESCHED and TIF_RESCHED_LAZY is set,
'l' only TIF_RESCHED_LAZY is set
'.' otherwise.
hardirq/softirq:
'Z' - NMI occurred inside a hardirq
'z' - NMI is running
'H' - hard irq occurred inside a softirq.
'h' - hard irq is running
's' - soft irq is running
'.' - normal context.
preempt-depth: The level of preempt_disabled
The above is mostly meaningful for kernel developers.
time:
When the latency-format option is enabled, the trace file output includes a timestamp relative to the start of the trace. This differs from the output when latency-format is disabled, which includes an absolute timestamp.
delay:
This is just to help catch your eye a bit better. And needs to be fixed to be only relative to the same CPU. The marks are determined by the difference between this current trace and the next trace.
'$' - greater than 1 second
'@' - greater than 100 millisecond
'*' - greater than 10 millisecond
'#' - greater than 1000 microsecond
'!' - greater than 100 microsecond
'+' - greater than 10 microsecond
' ' - less than or equal to 10 microsecond.
The rest is the same as the 'trace' file.
Note, the latency tracers will usually end with a back trace to easily find where the latency occurred.
trace_options #
The trace_options file (or the options directory) is used to control what gets printed in the trace output, or manipulate the tracers. To see what is available, simply cat the file:
cat trace_options
print-parent
nosym-offset
nosym-addr
noverbose
noraw
nohex
nobin
noblock
nofields
trace_printk
annotate
nouserstacktrace
nosym-userobj
noprintk-msg-only
context-info
nolatency-format
record-cmd
norecord-tgid
overwrite
nodisable_on_free
irq-info
markers
noevent-fork
function-trace
nofunction-fork
nodisplay-graph
nostacktrace
nobranch
To disable one of the options, echo in the option prepended with "no":
echo noprint-parent > trace_options
To enable an option, leave off the "no":
echo sym-offset > trace_options
Here are the available options:
print-parent
On function traces, display the calling (parent) function as well as the function being traced.
print-parent: bash-4000 [01] 1477.606694: simple_strtoul <-kstrtoul noprint-parent: bash-4000 [01] 1477.606694: simple_strtoulsym-offset
Display not only the function name, but also the offset in the function. For example, instead of seeing just "ktime_get", you will see "ktime_get+0xb/0x20".
sym-offset: bash-4000 [01] 1477.606694: simple_strtoul+0x6/0xa0sym-addr
This will also display the function address as well as the function name.
sym-addr: bash-4000 [01] 1477.606694: simple_strtoul <c0339346>verbose
This deals with the trace file when the latency-format option is enabled.
bash 4000 1 0 00000000 00010a95 [58127d26] 1720.415ms \ (+0.000ms): simple_strtoul (kstrtoul)raw
This will display raw numbers. This option is best for use with user applications that can translate the raw numbers better than having it done in the kernel.
hex
Similar to raw, but the numbers will be in a hexadecimal format.
bin
This will print out the formats in raw binary.
block
When set, reading trace_pipe will not block when polled.
fields
Print the fields as described by their types. This is a better option than using hex, bin or raw, as it gives a better parsing of the content of the event.
trace_printk
Can disable trace_printk() from writing into the buffer.
trace_printk_dest
Set to have trace_printk() and similar internal tracing functions write into this instance. Note, only one trace instance can have this set. By setting this flag, it clears the trace_printk_dest flag of the instance that had it set previously. By default, the top level trace has this set, and will get it set again if another instance has it set then clears it.
This flag cannot be cleared by the top level instance, as it is the default instance. The only way the top level instance has this flag cleared, is by it being set in another instance.
copy_trace_marker
If there are applications that hard code writing into the top level trace_marker file (/sys/kernel/tracing/trace_marker or trace_marker_raw), and the tooling would like it to go into an instance, this option can be used. Create an instance and set this option, and then all writes into the top level trace_marker file will also be redirected into this instance.
Note, by default this option is set for the top level instance. If it is disabled, then writes to the trace_marker or trace_marker_raw files will not be written into the top level file. If no instance has this option set, then a write will error with the errno of ENODEV.
annotate
It is sometimes confusing when the CPU buffers are full and one CPU buffer had a lot of events recently, thus a shorter time frame, were another CPU may have only had a few events, which lets it have older events. When the trace is reported, it shows the oldest events first, and it may look like only one CPU ran (the one with the oldest events). When the annotate option is set, it will display when a new CPU buffer started:
<idle>-0 [001] dNs4 21169.031481: wake_up_idle_cpu <-add_timer_on <idle>-0 [001] dNs4 21169.031482: _raw_spin_unlock_irqrestore <-add_timer_on <idle>-0 [001] .Ns4 21169.031484: sub_preempt_count <-_raw_spin_unlock_irqrestore ##### CPU 2 buffer started #### <idle>-0 [002] .N.1 21169.031484: rcu_idle_exit <-cpu_idle <idle>-0 [001] .Ns3 21169.031484: _raw_spin_unlock <-clocksource_watchdog <idle>-0 [001] .Ns3 21169.031485: sub_preempt_count <-_raw_spin_unlockuserstacktrace
This option changes the trace. It records a stacktrace of the current user space thread after each trace event.
sym-userobj
when user stacktrace are enabled, look up which object the address belongs to, and print a relative address. This is especially useful when ASLR is on, otherwise you don't get a chance to resolve the address to object/file/line after the app is no longer running
The lookup is performed when you read trace,trace_pipe. Example:
a.out-1623 [000] 40874.465068: /root/a.out[+0x480] <-/root/a.out[+0 x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6]printk-msg-only
When set, trace_printk()s will only show the format and not their parameters (if trace_bprintk() or trace_bputs() was used to save the trace_printk()).
context-info
Show only the event data. Hides the comm, PID, timestamp, CPU, and other useful data.
latency-format
This option changes the trace output. When it is enabled, the trace displays additional information about the latency, as described in "Latency trace format".
pause-on-trace
When set, opening the trace file for read, will pause writing to the ring buffer (as if tracing_on was set to zero). This simulates the original behavior of the trace file. When the file is closed, tracing will be enabled again.
hash-ptr
When set, "%p" in the event printk format displays the hashed pointer value instead of real address. This will be useful if you want to find out which hashed value is corresponding to the real value in trace log.
bitmask-list
When enabled, bitmasks are displayed as a human-readable list of ranges (e.g., 0,2-5,7) using the printk "%*pbl" format specifier. When disabled (the default), bitmasks are displayed in the traditional hexadecimal bitmap representation. The list format is particularly useful for tracing CPU masks and other large bitmasks where individual bit positions are more meaningful than their hexadecimal encoding.
record-cmd
When any event or tracer is enabled, a hook is enabled in the sched_switch trace point to fill comm cache with mapped pids and comms. But this may cause some overhead, and if you only care about pids, and not the name of the task, disabling this option can lower the impact of tracing. See "saved_cmdlines".
record-tgid
When any event or tracer is enabled, a hook is enabled in the sched_switch trace point to fill the cache of mapped Thread Group IDs (TGID) mapping to pids. See "saved_tgids".
overwrite
This controls what happens when the trace buffer is full. If "1" (default), the oldest events are discarded and overwritten. If "0", then the newest events are discarded. (see per_cpu/cpu0/stats for overrun and dropped)
disable_on_free
When the free_buffer is closed, tracing will stop (tracing_on set to 0).
irq-info
Shows the interrupt, preempt count, need resched data. When disabled, the trace looks like:
# tracer: function # # entries-in-buffer/entries-written: 144405/9452052 #P:4 # # TASK-PID CPU# TIMESTAMP FUNCTION # | | | | | <idle>-0 [002] 23636.756054: ttwu_do_activate.constprop.89 <-try_to_wake_up <idle>-0 [002] 23636.756054: activate_task <-ttwu_do_activate.constprop.89 <idle>-0 [002] 23636.756055: enqueue_task <-activate_taskmarkers
When set, the trace_marker is writable (only by root). When disabled, the trace_marker will error with EINVAL on write.
event-fork
When set, tasks with PIDs listed in set_event_pid will have the PIDs of their children added to set_event_pid when those tasks fork. Also, when tasks with PIDs in set_event_pid exit, their PIDs will be removed from the file.
This affects PIDs listed in set_event_notrace_pid as well.
function-trace
The latency tracers will enable function tracing if this option is enabled (default it is). When it is disabled, the latency tracers do not trace functions. This keeps the overhead of the tracer down when performing latency tests.
function-fork
When set, tasks with PIDs listed in set_ftrace_pid will have the PIDs of their children added to set_ftrace_pid when those tasks fork. Also, when tasks with PIDs in set_ftrace_pid exit, their PIDs will be removed from the file.
This affects PIDs in set_ftrace_notrace_pid as well.
display-graph
When set, the latency tracers (irqsoff, wakeup, etc) will use function graph tracing instead of function tracing.
stacktrace
When set, a stack trace is recorded after any trace event is recorded.
branch
Enable branch tracing with the tracer. This enables branch tracer along with the currently set tracer. Enabling this with the "nop" tracer is the same as just enabling the "branch" tracer.
Here are the per tracer options:
Options for function tracer:
func_stack_trace
When set, a stack trace is recorded after every function that is recorded. NOTE! Limit the functions that are recorded before enabling this, with "set_ftrace_filter" otherwise the system performance will be critically degraded. Remember to disable this option before clearing the function filter.
Options for function_graph tracer:
Since the function_graph tracer has a slightly different output it has its own options to control what is displayed.
funcgraph-overrun
When set, the "overrun" of the graph stack is displayed after each function traced. The overrun, is when the stack depth of the calls is greater than what is reserved for each task. Each task has a fixed array of functions to trace in the call graph. If the depth of the calls exceeds that, the function is not traced. The overrun is the number of functions missed due to exceeding this array.
funcgraph-cpu
When set, the CPU number of the CPU where the trace occurred is displayed.
funcgraph-overhead
When set, if the function takes longer than A certain amount, then a delay marker is displayed. See "delay" above, under the header description.
funcgraph-proc
Unlike other tracers, the process' command line is not displayed by default, but instead only when a task is traced in and out during a context switch. Enabling this options has the command of each process displayed at every line.
funcgraph-duration
At the end of each function (the return) the duration of the amount of time in the function is displayed in microseconds.
funcgraph-abstime
When set, the timestamp is displayed at each line.
funcgraph-irqs
When disabled, functions that happen inside an interrupt will not be traced.
funcgraph-tail
When set, the return event will include the function that it represents. By default this is off, and only a closing curly bracket "}" is displayed for the return of a function.
funcgraph-retval
When set, the return value of each traced function will be printed after an equal sign "=". By default this is off.
funcgraph-retval-hex
When set, the return value will always be printed in hexadecimal format. If the option is not set and the return value is an error code, it will be printed in signed decimal format; otherwise it will also be printed in hexadecimal format. By default, this option is off.
sleep-time
When running function graph tracer, to include the time a task schedules out in its function. When enabled, it will account time the task has been scheduled out as part of the function call.
graph-time
When running function profiler with function graph tracer, to include the time to call nested functions. When this is not set, the time reported for the function will only include the time the function itself executed for, not the time for functions that it called.
Options for blk tracer:
blk_classic
Shows a more minimalistic output.
irqsoff #
When interrupts are disabled, the CPU can not react to any other external event (besides NMIs and SMIs). This prevents the timer interrupt from triggering or the mouse interrupt from letting the kernel know of a new mouse event. The result is a latency with the reaction time.
The irqsoff tracer tracks the time for which interrupts are disabled. When a new maximum latency is hit, the tracer saves the trace leading up to that latency point so that every time a new maximum is reached, the old saved trace is discarded and the new trace is saved.
To reset the maximum, echo 0 into tracing_max_latency. Here is an example:
# echo 0 > options/function-trace
# echo irqsoff > current_tracer
# echo 1 > tracing_on
# echo 0 > tracing_max_latency
# ls -ltr
[...]
# echo 0 > tracing_on
# cat trace
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 16 us, #4/4, CPU#0 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: swapper/0-0 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: run_timer_softirq
# => ended at: run_timer_softirq
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
<idle>-0 0d.s2 0us+: _raw_spin_lock_irq <-run_timer_softirq
<idle>-0 0dNs3 17us : _raw_spin_unlock_irq <-run_timer_softirq
<idle>-0 0dNs3 17us+: trace_hardirqs_on <-run_timer_softirq
<idle>-0 0dNs3 25us : <stack trace>
=> _raw_spin_unlock_irq
=> run_timer_softirq
=> __do_softirq
=> call_softirq
=> do_softirq
=> irq_exit
=> smp_apic_timer_interrupt
=> apic_timer_interrupt
=> rcu_idle_exit
=> cpu_idle
=> rest_init
=> start_kernel
=> x86_64_start_reservations
=> x86_64_start_kernel
Here we see that we had a latency of 16 microseconds (which is very good). The _raw_spin_lock_irq in run_timer_softirq disabled interrupts. The difference between the 16 and the displayed timestamp 25us occurred because the clock was incremented between the time of recording the max latency and the time of recording the function that had that latency.
Note the above example had function-trace not set. If we set function-trace, we get a much larger output:
with echo 1 > options/function-trace
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 71 us, #168/168, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: bash-2042 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: ata_scsi_queuecmd
# => ended at: ata_scsi_queuecmd
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
bash-2042 3d... 0us : _raw_spin_lock_irqsave <-ata_scsi_queuecmd
bash-2042 3d... 0us : add_preempt_count <-_raw_spin_lock_irqsave
bash-2042 3d..1 1us : ata_scsi_find_dev <-ata_scsi_queuecmd
bash-2042 3d..1 1us : __ata_scsi_find_dev <-ata_scsi_find_dev
bash-2042 3d..1 2us : ata_find_dev.part.14 <-__ata_scsi_find_dev
bash-2042 3d..1 2us : ata_qc_new_init <-__ata_scsi_queuecmd
bash-2042 3d..1 3us : ata_sg_init <-__ata_scsi_queuecmd
bash-2042 3d..1 4us : ata_scsi_rw_xlat <-__ata_scsi_queuecmd
bash-2042 3d..1 4us : ata_build_rw_tf <-ata_scsi_rw_xlat
[...]
bash-2042 3d..1 67us : delay_tsc <-__delay
bash-2042 3d..1 67us : add_preempt_count <-delay_tsc
bash-2042 3d..2 67us : sub_preempt_count <-delay_tsc
bash-2042 3d..1 67us : add_preempt_count <-delay_tsc
bash-2042 3d..2 68us : sub_preempt_count <-delay_tsc
bash-2042 3d..1 68us+: ata_bmdma_start <-ata_bmdma_qc_issue
bash-2042 3d..1 71us : _raw_spin_unlock_irqrestore <-ata_scsi_queuecmd
bash-2042 3d..1 71us : _raw_spin_unlock_irqrestore <-ata_scsi_queuecmd
bash-2042 3d..1 72us+: trace_hardirqs_on <-ata_scsi_queuecmd
bash-2042 3d..1 120us : <stack trace>
=> _raw_spin_unlock_irqrestore
=> ata_scsi_queuecmd
=> scsi_dispatch_cmd
=> scsi_request_fn
=> __blk_run_queue_uncond
=> __blk_run_queue
=> blk_queue_bio
=> submit_bio_noacct
=> submit_bio
=> submit_bh
=> __ext3_get_inode_loc
=> ext3_iget
=> ext3_lookup
=> lookup_real
=> __lookup_hash
=> walk_component
=> lookup_last
=> path_lookupat
=> filename_lookup
=> user_path_at_empty
=> user_path_at
=> vfs_fstatat
=> vfs_stat
=> sys_newstat
=> system_call_fastpath
Here we traced a 71 microsecond latency. But we also see all the functions that were called during that time. Note that by enabling function tracing, we incur an added overhead. This overhead may extend the latency times. But nevertheless, this trace has provided some very helpful debugging information.
If we prefer function graph output instead of function, we can set display-graph option:
with echo 1 > options/display-graph
# tracer: irqsoff
#
# irqsoff latency trace v1.1.5 on 4.20.0-rc6+
# --------------------------------------------------------------------
# latency: 3751 us, #274/274, CPU#0 | (M:desktop VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: bash-1507 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: free_debug_processing
# => ended at: return_to_handler
#
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| /
# REL TIME CPU TASK/PID |||| DURATION FUNCTION CALLS
# | | | | |||| | | | | | |
0 us | 0) bash-1507 | d... | 0.000 us | _raw_spin_lock_irqsave();
0 us | 0) bash-1507 | d..1 | 0.378 us | do_raw_spin_trylock();
1 us | 0) bash-1507 | d..2 | | set_track() {
2 us | 0) bash-1507 | d..2 | | save_stack_trace() {
2 us | 0) bash-1507 | d..2 | | __save_stack_trace() {
3 us | 0) bash-1507 | d..2 | | __unwind_start() {
3 us | 0) bash-1507 | d..2 | | get_stack_info() {
3 us | 0) bash-1507 | d..2 | 0.351 us | in_task_stack();
4 us | 0) bash-1507 | d..2 | 1.107 us | }
[...]
3750 us | 0) bash-1507 | d..1 | 0.516 us | do_raw_spin_unlock();
3750 us | 0) bash-1507 | d..1 | 0.000 us | _raw_spin_unlock_irqrestore();
3764 us | 0) bash-1507 | d..1 | 0.000 us | tracer_hardirqs_on();
bash-1507 0d..1 3792us : <stack trace>
=> free_debug_processing
=> __slab_free
=> kmem_cache_free
=> vm_area_free
=> remove_vma
=> exit_mmap
=> mmput
=> begin_new_exec
=> load_elf_binary
=> search_binary_handler
=> __do_execve_file.isra.32
=> __x64_sys_execve
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
preemptoff #
When preemption is disabled, we may be able to receive interrupts but the task cannot be preempted and a higher priority task must wait for preemption to be enabled again before it can preempt a lower priority task.
The preemptoff tracer traces the places that disable preemption. Like the irqsoff tracer, it records the maximum latency for which preemption was disabled. The control of preemptoff tracer is much like the irqsoff tracer.
# echo 0 > options/function-trace
# echo preemptoff > current_tracer
# echo 1 > tracing_on
# echo 0 > tracing_max_latency
# ls -ltr
[...]
# echo 0 > tracing_on
# cat trace
# tracer: preemptoff
#
# preemptoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 46 us, #4/4, CPU#1 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: sshd-1991 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: do_IRQ
# => ended at: do_IRQ
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
sshd-1991 1d.h. 0us+: irq_enter <-do_IRQ
sshd-1991 1d..1 46us : irq_exit <-do_IRQ
sshd-1991 1d..1 47us+: trace_preempt_on <-do_IRQ
sshd-1991 1d..1 52us : <stack trace>
=> sub_preempt_count
=> irq_exit
=> do_IRQ
=> ret_from_intr
This has some more changes. Preemption was disabled when an interrupt came in (notice the 'h'), and was enabled on exit. But we also see that interrupts have been disabled when entering the preempt off section and leaving it (the 'd'). We do not know if interrupts were enabled in the mean time or shortly after this was over.
# tracer: preemptoff
#
# preemptoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 83 us, #241/241, CPU#1 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: bash-1994 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: wake_up_new_task
# => ended at: task_rq_unlock
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
bash-1994 1d..1 0us : _raw_spin_lock_irqsave <-wake_up_new_task
bash-1994 1d..1 0us : select_task_rq_fair <-select_task_rq
bash-1994 1d..1 1us : __rcu_read_lock <-select_task_rq_fair
bash-1994 1d..1 1us : source_load <-select_task_rq_fair
bash-1994 1d..1 1us : source_load <-select_task_rq_fair
[...]
bash-1994 1d..1 12us : irq_enter <-smp_apic_timer_interrupt
bash-1994 1d..1 12us : rcu_irq_enter <-irq_enter
bash-1994 1d..1 13us : add_preempt_count <-irq_enter
bash-1994 1d.h1 13us : exit_idle <-smp_apic_timer_interrupt
bash-1994 1d.h1 13us : hrtimer_interrupt <-smp_apic_timer_interrupt
bash-1994 1d.h1 13us : _raw_spin_lock <-hrtimer_interrupt
bash-1994 1d.h1 14us : add_preempt_count <-_raw_spin_lock
bash-1994 1d.h2 14us : ktime_get_update_offsets <-hrtimer_interrupt
[...]
bash-1994 1d.h1 35us : lapic_next_event <-clockevents_program_event
bash-1994 1d.h1 35us : irq_exit <-smp_apic_timer_interrupt
bash-1994 1d.h1 36us : sub_preempt_count <-irq_exit
bash-1994 1d..2 36us : do_softirq <-irq_exit
bash-1994 1d..2 36us : __do_softirq <-call_softirq
bash-1994 1d..2 36us : __local_bh_disable <-__do_softirq
bash-1994 1d.s2 37us : add_preempt_count <-_raw_spin_lock_irq
bash-1994 1d.s3 38us : _raw_spin_unlock <-run_timer_softirq
bash-1994 1d.s3 39us : sub_preempt_count <-_raw_spin_unlock
bash-1994 1d.s2 39us : call_timer_fn <-run_timer_softirq
[...]
bash-1994 1dNs2 81us : cpu_needs_another_gp <-rcu_process_callbacks
bash-1994 1dNs2 82us : __local_bh_enable <-__do_softirq
bash-1994 1dNs2 82us : sub_preempt_count <-__local_bh_enable
bash-1994 1dN.2 82us : idle_cpu <-irq_exit
bash-1994 1dN.2 83us : rcu_irq_exit <-irq_exit
bash-1994 1dN.2 83us : sub_preempt_count <-irq_exit
bash-1994 1.N.1 84us : _raw_spin_unlock_irqrestore <-task_rq_unlock
bash-1994 1.N.1 84us+: trace_preempt_on <-task_rq_unlock
bash-1994 1.N.1 104us : <stack trace>
=> sub_preempt_count
=> _raw_spin_unlock_irqrestore
=> task_rq_unlock
=> wake_up_new_task
=> do_fork
=> sys_clone
=> stub_clone
The above is an example of the preemptoff trace with function-trace set. Here we see that interrupts were not disabled the entire time. The irq_enter code lets us know that we entered an interrupt 'h'. Before that, the functions being traced still show that it is not in an interrupt, but we can see from the functions themselves that this is not the case.
preemptirqsoff #
Knowing the locations that have interrupts disabled or preemption disabled for the longest times is helpful. But sometimes we would like to know when either preemption and/or interrupts are disabled.
Consider the following code:
local_irq_disable();
call_function_with_irqs_off();
preempt_disable();
call_function_with_irqs_and_preemption_off();
local_irq_enable();
call_function_with_preemption_off();
preempt_enable();
The irqsoff tracer will record the total length of call_function_with_irqs_off() and call_function_with_irqs_and_preemption_off().
The preemptoff tracer will record the total length of call_function_with_irqs_and_preemption_off() and call_function_with_preemption_off().
But neither will trace the time that interrupts and/or preemption is disabled. This total time is the time that we can not schedule. To record this time, use the preemptirqsoff tracer.
Again, using this trace is much like the irqsoff and preemptoff tracers.
# echo 0 > options/function-trace
# echo preemptirqsoff > current_tracer
# echo 1 > tracing_on
# echo 0 > tracing_max_latency
# ls -ltr
[...]
# echo 0 > tracing_on
# cat trace
# tracer: preemptirqsoff
#
# preemptirqsoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 100 us, #4/4, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: ls-2230 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: ata_scsi_queuecmd
# => ended at: ata_scsi_queuecmd
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
ls-2230 3d... 0us+: _raw_spin_lock_irqsave <-ata_scsi_queuecmd
ls-2230 3...1 100us : _raw_spin_unlock_irqrestore <-ata_scsi_queuecmd
ls-2230 3...1 101us+: trace_preempt_on <-ata_scsi_queuecmd
ls-2230 3...1 111us : <stack trace>
=> sub_preempt_count
=> _raw_spin_unlock_irqrestore
=> ata_scsi_queuecmd
=> scsi_dispatch_cmd
=> scsi_request_fn
=> __blk_run_queue_uncond
=> __blk_run_queue
=> blk_queue_bio
=> submit_bio_noacct
=> submit_bio
=> submit_bh
=> ext3_bread
=> ext3_dir_bread
=> htree_dirblock_to_tree
=> ext3_htree_fill_tree
=> ext3_readdir
=> vfs_readdir
=> sys_getdents
=> system_call_fastpath
The trace_hardirqs_off_thunk is called from assembly on x86 when interrupts are disabled in the assembly code. Without the function tracing, we do not know if interrupts were enabled within the preemption points. We do see that it started with preemption enabled.
Here is a trace with function-trace set:
# tracer: preemptirqsoff
#
# preemptirqsoff latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 161 us, #339/339, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: ls-2269 (uid:0 nice:0 policy:0 rt_prio:0)
# -----------------
# => started at: schedule
# => ended at: mutex_unlock
#
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
kworker/-59 3...1 0us : __schedule <-schedule
kworker/-59 3d..1 0us : rcu_preempt_qs <-rcu_note_context_switch
kworker/-59 3d..1 1us : add_preempt_count <-_raw_spin_lock_irq
kworker/-59 3d..2 1us : deactivate_task <-__schedule
kworker/-59 3d..2 1us : dequeue_task <-deactivate_task
kworker/-59 3d..2 2us : update_rq_clock <-dequeue_task
kworker/-59 3d..2 2us : dequeue_task_fair <-dequeue_task
kworker/-59 3d..2 2us : update_curr <-dequeue_task_fair
kworker/-59 3d..2 2us : update_min_vruntime <-update_curr
kworker/-59 3d..2 3us : cpuacct_charge <-update_curr
kworker/-59 3d..2 3us : __rcu_read_lock <-cpuacct_charge
kworker/-59 3d..2 3us : __rcu_read_unlock <-cpuacct_charge
kworker/-59 3d..2 3us : update_cfs_rq_blocked_load <-dequeue_task_fair
kworker/-59 3d..2 4us : clear_buddies <-dequeue_task_fair
kworker/-59 3d..2 4us : account_entity_dequeue <-dequeue_task_fair
kworker/-59 3d..2 4us : update_min_vruntime <-dequeue_task_fair
kworker/-59 3d..2 4us : update_cfs_shares <-dequeue_task_fair
kworker/-59 3d..2 5us : hrtick_update <-dequeue_task_fair
kworker/-59 3d..2 5us : wq_worker_sleeping <-__schedule
kworker/-59 3d..2 5us : kthread_data <-wq_worker_sleeping
kworker/-59 3d..2 5us : put_prev_task_fair <-__schedule
kworker/-59 3d..2 6us : pick_next_task_fair <-pick_next_task
kworker/-59 3d..2 6us : clear_buddies <-pick_next_task_fair
kworker/-59 3d..2 6us : set_next_entity <-pick_next_task_fair
kworker/-59 3d..2 6us : update_stats_wait_end <-set_next_entity
ls-2269 3d..2 7us : finish_task_switch <-__schedule
ls-2269 3d..2 7us : _raw_spin_unlock_irq <-finish_task_switch
ls-2269 3d..2 8us : do_IRQ <-ret_from_intr
ls-2269 3d..2 8us : irq_enter <-do_IRQ
ls-2269 3d..2 8us : rcu_irq_enter <-irq_enter
ls-2269 3d..2 9us : add_preempt_count <-irq_enter
ls-2269 3d.h2 9us : exit_idle <-do_IRQ
[...]
ls-2269 3d.h3 20us : sub_preempt_count <-_raw_spin_unlock
ls-2269 3d.h2 20us : irq_exit <-do_IRQ
ls-2269 3d.h2 21us : sub_preempt_count <-irq_exit
ls-2269 3d..3 21us : do_softirq <-irq_exit
ls-2269 3d..3 21us : __do_softirq <-call_softirq
ls-2269 3d..3 21us+: __local_bh_disable <-__do_softirq
ls-2269 3d.s4 29us : sub_preempt_count <-_local_bh_enable_ip
ls-2269 3d.s5 29us : sub_preempt_count <-_local_bh_enable_ip
ls-2269 3d.s5 31us : do_IRQ <-ret_from_intr
ls-2269 3d.s5 31us : irq_enter <-do_IRQ
ls-2269 3d.s5 31us : rcu_irq_enter <-irq_enter
[...]
ls-2269 3d.s5 31us : rcu_irq_enter <-irq_enter
ls-2269 3d.s5 32us : add_preempt_count <-irq_enter
ls-2269 3d.H5 32us : exit_idle <-do_IRQ
ls-2269 3d.H5 32us : handle_irq <-do_IRQ
ls-2269 3d.H5 32us : irq_to_desc <-handle_irq
ls-2269 3d.H5 33us : handle_fasteoi_irq <-handle_irq
[...]
ls-2269 3d.s5 158us : _raw_spin_unlock_irqrestore <-rtl8139_poll
ls-2269 3d.s3 158us : net_rps_action_and_irq_enable.isra.65 <-net_rx_action
ls-2269 3d.s3 159us : __local_bh_enable <-__do_softirq
ls-2269 3d.s3 159us : sub_preempt_count <-__local_bh_enable
ls-2269 3d..3 159us : idle_cpu <-irq_exit
ls-2269 3d..3 159us : rcu_irq_exit <-irq_exit
ls-2269 3d..3 160us : sub_preempt_count <-irq_exit
ls-2269 3d... 161us : __mutex_unlock_slowpath <-mutex_unlock
ls-2269 3d... 162us+: trace_hardirqs_on <-mutex_unlock
ls-2269 3d... 186us : <stack trace>
=> __mutex_unlock_slowpath
=> mutex_unlock
=> process_output
=> n_tty_write
=> tty_write
=> vfs_write
=> sys_write
=> system_call_fastpath
This is an interesting trace. It started with kworker running and scheduling out and ls taking over. But as soon as ls released the rq lock and enabled interrupts (but not preemption) an interrupt triggered. When the interrupt finished, it started running softirqs. But while the softirq was running, another interrupt triggered. When an interrupt is running inside a softirq, the annotation is 'H'.
wakeup #
One common case that people are interested in tracing is the time it takes for a task that is woken to actually wake up. Now for non Real-Time tasks, this can be arbitrary. But tracing it nonetheless can be interesting.
Without function tracing:
# echo 0 > options/function-trace
# echo wakeup > current_tracer
# echo 1 > tracing_on
# echo 0 > tracing_max_latency
# chrt -f 5 sleep 1
# echo 0 > tracing_on
# cat trace
# tracer: wakeup
#
# wakeup latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 15 us, #4/4, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: kworker/3:1H-312 (uid:0 nice:-20 policy:0 rt_prio:0)
# -----------------
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
<idle>-0 3dNs7 0us : 0:120:R + [003] 312:100:R kworker/3:1H
<idle>-0 3dNs7 1us+: ttwu_do_activate.constprop.87 <-try_to_wake_up
<idle>-0 3d..3 15us : __schedule <-schedule
<idle>-0 3d..3 15us : 0:120:R ==> [003] 312:100:R kworker/3:1H
The tracer only traces the highest priority task in the system to avoid tracing the normal circumstances. Here we see that the kworker with a nice priority of -20 (not very nice), took just 15 microseconds from the time it woke up, to the time it ran.
Non Real-Time tasks are not that interesting. A more interesting trace is to concentrate only on Real-Time tasks.
wakeup_rt #
In a Real-Time environment it is very important to know the wakeup time it takes for the highest priority task that is woken up to the time that it executes. This is also known as "schedule latency". I stress the point that this is about RT tasks. It is also important to know the scheduling latency of non-RT tasks, but the average schedule latency is better for non-RT tasks. Tools like LatencyTop are more appropriate for such measurements.
Real-Time environments are interested in the worst case latency. That is the longest latency it takes for something to happen, and not the average. We can have a very fast scheduler that may only have a large latency once in a while, but that would not work well with Real-Time tasks. The wakeup_rt tracer was designed to record the worst case wakeups of RT tasks. Non-RT tasks are not recorded because the tracer only records one worst case and tracing non-RT tasks that are unpredictable will overwrite the worst case latency of RT tasks (just run the normal wakeup tracer for a while to see that effect).
Since this tracer only deals with RT tasks, we will run this slightly differently than we did with the previous tracers. Instead of performing an 'ls', we will run 'sleep 1' under 'chrt' which changes the priority of the task.
# echo 0 > options/function-trace
# echo wakeup_rt > current_tracer
# echo 1 > tracing_on
# echo 0 > tracing_max_latency
# chrt -f 5 sleep 1
# echo 0 > tracing_on
# cat trace
# tracer: wakeup
#
# tracer: wakeup_rt
#
# wakeup_rt latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 5 us, #4/4, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: sleep-2389 (uid:0 nice:0 policy:1 rt_prio:5)
# -----------------
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
<idle>-0 3d.h4 0us : 0:120:R + [003] 2389: 94:R sleep
<idle>-0 3d.h4 1us+: ttwu_do_activate.constprop.87 <-try_to_wake_up
<idle>-0 3d..3 5us : __schedule <-schedule
<idle>-0 3d..3 5us : 0:120:R ==> [003] 2389: 94:R sleep
Running this on an idle system, we see that it only took 5 microseconds to perform the task switch. Note, since the trace point in the schedule is before the actual "switch", we stop the tracing when the recorded task is about to schedule in. This may change if we add a new marker at the end of the scheduler.
Notice that the recorded task is 'sleep' with the PID of 2389 and it has an rt_prio of 5. This priority is user-space priority and not the internal kernel priority. The policy is 1 for SCHED_FIFO and 2 for SCHED_RR.
Note, that the trace data shows the internal priority (99 - rtprio).
<idle>-0 3d..3 5us : 0:120:R ==> [003] 2389: 94:R sleep
The 0:120:R means idle was running with a nice priority of 0 (120 - 120) and in the running state 'R'. The sleep task was scheduled in with 2389: 94:R. That is the priority is the kernel rtprio (99 - 5 = 94) and it too is in the running state.
Doing the same with chrt -r 5 and function-trace set.
echo 1 > options/function-trace
# tracer: wakeup_rt
#
# wakeup_rt latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 29 us, #85/85, CPU#3 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: sleep-2448 (uid:0 nice:0 policy:1 rt_prio:5)
# -----------------
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
<idle>-0 3d.h4 1us+: 0:120:R + [003] 2448: 94:R sleep
<idle>-0 3d.h4 2us : ttwu_do_activate.constprop.87 <-try_to_wake_up
<idle>-0 3d.h3 3us : check_preempt_curr <-ttwu_do_wakeup
<idle>-0 3d.h3 3us : resched_curr <-check_preempt_curr
<idle>-0 3dNh3 4us : task_woken_rt <-ttwu_do_wakeup
<idle>-0 3dNh3 4us : _raw_spin_unlock <-try_to_wake_up
<idle>-0 3dNh3 4us : sub_preempt_count <-_raw_spin_unlock
<idle>-0 3dNh2 5us : ttwu_stat <-try_to_wake_up
<idle>-0 3dNh2 5us : _raw_spin_unlock_irqrestore <-try_to_wake_up
<idle>-0 3dNh2 6us : sub_preempt_count <-_raw_spin_unlock_irqrestore
<idle>-0 3dNh1 6us : _raw_spin_lock <-__run_hrtimer
<idle>-0 3dNh1 6us : add_preempt_count <-_raw_spin_lock
<idle>-0 3dNh2 7us : _raw_spin_unlock <-hrtimer_interrupt
<idle>-0 3dNh2 7us : sub_preempt_count <-_raw_spin_unlock
<idle>-0 3dNh1 7us : tick_program_event <-hrtimer_interrupt
<idle>-0 3dNh1 7us : clockevents_program_event <-tick_program_event
<idle>-0 3dNh1 8us : ktime_get <-clockevents_program_event
<idle>-0 3dNh1 8us : lapic_next_event <-clockevents_program_event
<idle>-0 3dNh1 8us : irq_exit <-smp_apic_timer_interrupt
<idle>-0 3dNh1 9us : sub_preempt_count <-irq_exit
<idle>-0 3dN.2 9us : idle_cpu <-irq_exit
<idle>-0 3dN.2 9us : rcu_irq_exit <-irq_exit
<idle>-0 3dN.2 10us : rcu_eqs_enter_common.isra.45 <-rcu_irq_exit
<idle>-0 3dN.2 10us : sub_preempt_count <-irq_exit
<idle>-0 3.N.1 11us : rcu_idle_exit <-cpu_idle
<idle>-0 3dN.1 11us : rcu_eqs_exit_common.isra.43 <-rcu_idle_exit
<idle>-0 3.N.1 11us : tick_nohz_idle_exit <-cpu_idle
<idle>-0 3dN.1 12us : menu_hrtimer_cancel <-tick_nohz_idle_exit
<idle>-0 3dN.1 12us : ktime_get <-tick_nohz_idle_exit
<idle>-0 3dN.1 12us : tick_do_update_jiffies64 <-tick_nohz_idle_exit
<idle>-0 3dN.1 13us : cpu_load_update_nohz <-tick_nohz_idle_exit
<idle>-0 3dN.1 13us : _raw_spin_lock <-cpu_load_update_nohz
<idle>-0 3dN.1 13us : add_preempt_count <-_raw_spin_lock
<idle>-0 3dN.2 13us : __cpu_load_update <-cpu_load_update_nohz
<idle>-0 3dN.2 14us : sched_avg_update <-__cpu_load_update
<idle>-0 3dN.2 14us : _raw_spin_unlock <-cpu_load_update_nohz
<idle>-0 3dN.2 14us : sub_preempt_count <-_raw_spin_unlock
<idle>-0 3dN.1 15us : calc_load_nohz_stop <-tick_nohz_idle_exit
<idle>-0 3dN.1 15us : touch_softlockup_watchdog <-tick_nohz_idle_exit
<idle>-0 3dN.1 15us : hrtimer_cancel <-tick_nohz_idle_exit
<idle>-0 3dN.1 15us : hrtimer_try_to_cancel <-hrtimer_cancel
<idle>-0 3dN.1 16us : lock_hrtimer_base.isra.18 <-hrtimer_try_to_cancel
<idle>-0 3dN.1 16us : _raw_spin_lock_irqsave <-lock_hrtimer_base.isra.18
<idle>-0 3dN.1 16us : add_preempt_count <-_raw_spin_lock_irqsave
<idle>-0 3dN.2 17us : __remove_hrtimer <-remove_hrtimer.part.16
<idle>-0 3dN.2 17us : hrtimer_force_reprogram <-__remove_hrtimer
<idle>-0 3dN.2 17us : tick_program_event <-hrtimer_force_reprogram
<idle>-0 3dN.2 18us : clockevents_program_event <-tick_program_event
<idle>-0 3dN.2 18us : ktime_get <-clockevents_program_event
<idle>-0 3dN.2 18us : lapic_next_event <-clockevents_program_event
<idle>-0 3dN.2 19us : _raw_spin_unlock_irqrestore <-hrtimer_try_to_cancel
<idle>-0 3dN.2 19us : sub_preempt_count <-_raw_spin_unlock_irqrestore
<idle>-0 3dN.1 19us : hrtimer_forward <-tick_nohz_idle_exit
<idle>-0 3dN.1 20us : ktime_add_safe <-hrtimer_forward
<idle>-0 3dN.1 20us : ktime_add_safe <-hrtimer_forward
<idle>-0 3dN.1 20us : hrtimer_start_range_ns <-hrtimer_start_expires.constprop.11
<idle>-0 3dN.1 20us : __hrtimer_start_range_ns <-hrtimer_start_range_ns
<idle>-0 3dN.1 21us : lock_hrtimer_base.isra.18 <-__hrtimer_start_range_ns
<idle>-0 3dN.1 21us : _raw_spin_lock_irqsave <-lock_hrtimer_base.isra.18
<idle>-0 3dN.1 21us : add_preempt_count <-_raw_spin_lock_irqsave
<idle>-0 3dN.2 22us : ktime_add_safe <-__hrtimer_start_range_ns
<idle>-0 3dN.2 22us : enqueue_hrtimer <-__hrtimer_start_range_ns
<idle>-0 3dN.2 22us : tick_program_event <-__hrtimer_start_range_ns
<idle>-0 3dN.2 23us : clockevents_program_event <-tick_program_event
<idle>-0 3dN.2 23us : ktime_get <-clockevents_program_event
<idle>-0 3dN.2 23us : lapic_next_event <-clockevents_program_event
<idle>-0 3dN.2 24us : _raw_spin_unlock_irqrestore <-__hrtimer_start_range_ns
<idle>-0 3dN.2 24us : sub_preempt_count <-_raw_spin_unlock_irqrestore
<idle>-0 3dN.1 24us : account_idle_ticks <-tick_nohz_idle_exit
<idle>-0 3dN.1 24us : account_idle_time <-account_idle_ticks
<idle>-0 3.N.1 25us : sub_preempt_count <-cpu_idle
<idle>-0 3.N.. 25us : schedule <-cpu_idle
<idle>-0 3.N.. 25us : __schedule <-preempt_schedule
<idle>-0 3.N.. 26us : add_preempt_count <-__schedule
<idle>-0 3.N.1 26us : rcu_note_context_switch <-__schedule
<idle>-0 3.N.1 26us : rcu_sched_qs <-rcu_note_context_switch
<idle>-0 3dN.1 27us : rcu_preempt_qs <-rcu_note_context_switch
<idle>-0 3.N.1 27us : _raw_spin_lock_irq <-__schedule
<idle>-0 3dN.1 27us : add_preempt_count <-_raw_spin_lock_irq
<idle>-0 3dN.2 28us : put_prev_task_idle <-__schedule
<idle>-0 3dN.2 28us : pick_next_task_stop <-pick_next_task
<idle>-0 3dN.2 28us : pick_next_task_rt <-pick_next_task
<idle>-0 3dN.2 29us : dequeue_pushable_task <-pick_next_task_rt
<idle>-0 3d..3 29us : __schedule <-preempt_schedule
<idle>-0 3d..3 30us : 0:120:R ==> [003] 2448: 94:R sleep
This isn't that big of a trace, even with function tracing enabled, so I included the entire trace.
The interrupt went off while when the system was idle. Somewhere before task_woken_rt() was called, the NEED_RESCHED flag was set, this is indicated by the first occurrence of the 'N' flag.
Latency tracing and events #
As function tracing can induce a much larger latency, but without seeing what happens within the latency it is hard to know what caused it. There is a middle ground, and that is with enabling events.
# echo 0 > options/function-trace
# echo wakeup_rt > current_tracer
# echo 1 > events/enable
# echo 1 > tracing_on
# echo 0 > tracing_max_latency
# chrt -f 5 sleep 1
# echo 0 > tracing_on
# cat trace
# tracer: wakeup_rt
#
# wakeup_rt latency trace v1.1.5 on 3.8.0-test+
# --------------------------------------------------------------------
# latency: 6 us, #12/12, CPU#2 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
# -----------------
# | task: sleep-5882 (uid:0 nice:0 policy:1 rt_prio:5)
# -----------------
#
# _------=> CPU#
# / _-----=> irqs-off
# | / _----=> need-resched
# || / _---=> hardirq/softirq
# ||| / _--=> preempt-depth
# |||| / delay
# cmd pid ||||| time | caller
# \ / ||||| \ | /
<idle>-0 2d.h4 0us : 0:120:R + [002] 5882: 94:R sleep
<idle>-0 2d.h4 0us : ttwu_do_activate.constprop.87 <-try_to_wake_up
<idle>-0 2d.h4 1us : sched_wakeup: comm=sleep pid=5882 prio=94 success=1 target_cpu=002
<idle>-0 2dNh2 1us : hrtimer_expire_exit: hrtimer=ffff88007796feb8
<idle>-0 2.N.2 2us : power_end: cpu_id=2
<idle>-0 2.N.2 3us : cpu_idle: state=4294967295 cpu_id=2
<idle>-0 2dN.3 4us : hrtimer_cancel: hrtimer=ffff88007d50d5e0
<idle>-0 2dN.3 4us : hrtimer_start: hrtimer=ffff88007d50d5e0 function=tick_sched_timer expires=34311211000000 softexpires=34311211000000
<idle>-0 2.N.2 5us : rcu_utilization: Start context switch
<idle>-0 2.N.2 5us : rcu_utilization: End context switch
<idle>-0 2d..3 6us : __schedule <-schedule
<idle>-0 2d..3 6us : 0:120:R ==> [002] 5882: 94:R sleep
Hardware Latency Detector #
The hardware latency detector is executed by enabling the "hwlat" tracer.
NOTE, this tracer will affect the performance of the system as it will periodically make a CPU constantly busy with interrupts disabled.
# echo hwlat > current_tracer
# sleep 100
# cat trace
# tracer: hwlat
#
# entries-in-buffer/entries-written: 13/13 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
<...>-1729 [001] d... 678.473449: #1 inner/outer(us): 11/12 ts:1581527483.343962693 count:6
<...>-1729 [004] d... 689.556542: #2 inner/outer(us): 16/9 ts:1581527494.889008092 count:1
<...>-1729 [005] d... 714.756290: #3 inner/outer(us): 16/16 ts:1581527519.678961629 count:5
<...>-1729 [001] d... 718.788247: #4 inner/outer(us): 9/17 ts:1581527523.889012713 count:1
<...>-1729 [002] d... 719.796341: #5 inner/outer(us): 13/9 ts:1581527524.912872606 count:1
<...>-1729 [006] d... 844.787091: #6 inner/outer(us): 9/12 ts:1581527649.889048502 count:2
<...>-1729 [003] d... 849.827033: #7 inner/outer(us): 18/9 ts:1581527654.889013793 count:1
<...>-1729 [007] d... 853.859002: #8 inner/outer(us): 9/12 ts:1581527658.889065736 count:1
<...>-1729 [001] d... 855.874978: #9 inner/outer(us): 9/11 ts:1581527660.861991877 count:1
<...>-1729 [001] d... 863.938932: #10 inner/outer(us): 9/11 ts:1581527668.970010500 count:1 nmi-total:7 nmi-count:1
<...>-1729 [007] d... 878.050780: #11 inner/outer(us): 9/12 ts:1581527683.385002600 count:1 nmi-total:5 nmi-count:1
<...>-1729 [007] d... 886.114702: #12 inner/outer(us): 9/12 ts:1581527691.385001600 count:1
The above output is somewhat the same in the header. All events will have interrupts disabled 'd'. Under the FUNCTION title there is:
#1
This is the count of events recorded that were greater than the tracing_threshold (See below).
inner/outer(us): 11/11
This shows two numbers as "inner latency" and "outer latency". The test runs in a loop checking a timestamp twice. The latency detected within the two timestamps is the "inner latency" and the latency detected after the previous timestamp and the next timestamp in the loop is the "outer latency".
ts:1581527483.343962693
The absolute timestamp that the first latency was recorded in the window.
count:6
The number of times a latency was detected during the window.
nmi-total:7 nmi-count:1
On architectures that support it, if an NMI comes in during the test, the time spent in NMI is reported in "nmi-total" (in microseconds).
All architectures that have NMIs will show the "nmi-count" if an NMI comes in during the test.
hwlat files:
tracing_threshold
This gets automatically set to "10" to represent 10 microseconds. This is the threshold of latency that needs to be detected before the trace will be recorded.
Note, when hwlat tracer is finished (another tracer is written into "current_tracer"), the original value for tracing_threshold is placed back into this file.
hwlat_detector/width
The length of time the test runs with interrupts disabled.
hwlat_detector/window
The length of time of the window which the test runs. That is, the test will run for "width" microseconds per "window" microseconds
tracing_cpumask
When the test is started. A kernel thread is created that runs the test. This thread will alternate between CPUs listed in the tracing_cpumask between each period (one "window"). To limit the test to specific CPUs set the mask in this file to only the CPUs that the test should run on.
function #
This tracer is the function tracer. Enabling the function tracer can be done from the debug file system. Make sure the ftrace_enabled is set; otherwise this tracer is a nop. See the "ftrace_enabled" section below.
# sysctl kernel.ftrace_enabled=1
# echo function > current_tracer
# echo 1 > tracing_on
# usleep 1
# echo 0 > tracing_on
# cat trace
# tracer: function
#
# entries-in-buffer/entries-written: 24799/24799 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
bash-1994 [002] .... 3082.063030: mutex_unlock <-rb_simple_write
bash-1994 [002] .... 3082.063031: __mutex_unlock_slowpath <-mutex_unlock
bash-1994 [002] .... 3082.063031: __fsnotify_parent <-fsnotify_modify
bash-1994 [002] .... 3082.063032: fsnotify <-fsnotify_modify
bash-1994 [002] .... 3082.063032: __srcu_read_lock <-fsnotify
bash-1994 [002] .... 3082.063032: add_preempt_count <-__srcu_read_lock
bash-1994 [002] ...1 3082.063032: sub_preempt_count <-__srcu_read_lock
bash-1994 [002] .... 3082.063033: __srcu_read_unlock <-fsnotify
[...]
Note: function tracer uses ring buffers to store the above entries. The newest data may overwrite the oldest data. Sometimes using echo to stop the trace is not sufficient because the tracing could have overwritten the data that you wanted to record. For this reason, it is sometimes better to disable tracing directly from a program. This allows you to stop the tracing at the point that you hit the part that you are interested in. To disable the tracing directly from a C program, something like following code snippet can be used:
int trace_fd;
[...]
int main(int argc, char *argv[]) {
[...]
trace_fd = open(tracing_file("tracing_on"), O_WRONLY);
[...]
if (condition_hit()) {
write(trace_fd, "0", 1);
}
[...]
}
Single thread tracing #
By writing into set_ftrace_pid you can trace a single thread. For example:
# cat set_ftrace_pid
no pid
# echo 3111 > set_ftrace_pid
# cat set_ftrace_pid
3111
# echo function > current_tracer
# cat trace | head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
yum-updatesd-3111 [003] 1637.254676: finish_task_switch <-thread_return
yum-updatesd-3111 [003] 1637.254681: hrtimer_cancel <-schedule_hrtimeout_range
yum-updatesd-3111 [003] 1637.254682: hrtimer_try_to_cancel <-hrtimer_cancel
yum-updatesd-3111 [003] 1637.254683: lock_hrtimer_base <-hrtimer_try_to_cancel
yum-updatesd-3111 [003] 1637.254685: fget_light <-do_sys_poll
yum-updatesd-3111 [003] 1637.254686: pipe_poll <-do_sys_poll
# echo > set_ftrace_pid
# cat trace |head
# tracer: function
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
##### CPU 3 buffer started ####
yum-updatesd-3111 [003] 1701.957688: free_poll_entry <-poll_freewait
yum-updatesd-3111 [003] 1701.957689: remove_wait_queue <-free_poll_entry
yum-updatesd-3111 [003] 1701.957691: fput <-free_poll_entry
yum-updatesd-3111 [003] 1701.957692: audit_syscall_exit <-sysret_audit
yum-updatesd-3111 [003] 1701.957693: path_put <-audit_syscall_exit
If you want to trace a function when executing, you could use something like this simple program.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define _STR(x) #x
#define STR(x) _STR(x)
#define MAX_PATH 256
const char *find_tracefs(void)
{
static char tracefs[MAX_PATH+1];
static int tracefs_found;
char type[100];
FILE *fp;
if (tracefs_found)
return tracefs;
if ((fp = fopen("/proc/mounts","r")) == NULL) {
perror("/proc/mounts");
return NULL;
}
while (fscanf(fp, "%*s %"
STR(MAX_PATH)
"s %99s %*s %*d %*d\n",
tracefs, type) == 2) {
if (strcmp(type, "tracefs") == 0)
break;
}
fclose(fp);
if (strcmp(type, "tracefs") != 0) {
fprintf(stderr, "tracefs not mounted");
return NULL;
}
strcat(tracefs, "/tracing/");
tracefs_found = 1;
return tracefs;
}
const char *tracing_file(const char *file_name)
{
static char trace_file[MAX_PATH+1];
snprintf(trace_file, MAX_PATH, "%s/%s", find_tracefs(), file_name);
return trace_file;
}
int main (int argc, char **argv)
{
if (argc < 1)
exit(-1);
if (fork() > 0) {
int fd, ffd;
char line[64];
int s;
ffd = open(tracing_file("current_tracer"), O_WRONLY);
if (ffd < 0)
exit(-1);
write(ffd, "nop", 3);
fd = open(tracing_file("set_ftrace_pid"), O_WRONLY);
s = sprintf(line, "%d\n", getpid());
write(fd, line, s);
write(ffd, "function", 8);
close(fd);
close(ffd);
execvp(argv[1], argv+1);
}
return 0;
}
Or this simple script!
#!/bin/bash
tracefs=`sed -ne 's/^tracefs \(.*\) tracefs.*/\1/p' /proc/mounts`
echo 0 > $tracefs/tracing_on
echo $$ > $tracefs/set_ftrace_pid
echo function > $tracefs/current_tracer
echo 1 > $tracefs/tracing_on
exec "$@"
function graph tracer #
This tracer is similar to the function tracer except that it probes a function on its entry and its exit. This is done by using a dynamically allocated stack of return addresses in each task_struct. On function entry the tracer overwrites the return address of each function traced to set a custom probe. Thus the original return address is stored on the stack of return address in the task_struct.
Probing on both ends of a function leads to special features such as:
-
measure of a function's time execution
-
having a reliable call stack to draw function calls graph
This tracer is useful in several situations:
-
you want to find the reason of a strange kernel behavior and need to see what happens in detail on any areas (or specific ones).
-
you are experiencing weird latencies but it's difficult to find its origin.
-
you want to find quickly which path is taken by a specific function
-
you just want to peek inside a working kernel and want to see what happens there.
# tracer: function_graph
#
# CPU DURATION FUNCTION CALLS
# | | | | | | |
0) | sys_open() {
0) | do_sys_open() {
0) | getname() {
0) | kmem_cache_alloc() {
0) 1.382 us | __might_sleep();
0) 2.478 us | }
0) | strncpy_from_user() {
0) | might_fault() {
0) 1.389 us | __might_sleep();
0) 2.553 us | }
0) 3.807 us | }
0) 7.876 us | }
0) | alloc_fd() {
0) 0.668 us | _spin_lock();
0) 0.570 us | expand_files();
0) 0.586 us | _spin_unlock();
There are several columns that can be dynamically enabled/disabled. You can use every combination of options you want, depending on your needs.
-
The cpu number on which the function executed is default enabled. It is sometimes better to only trace one cpu (see tracing_cpumask file) or you might sometimes see unordered function calls while cpu tracing switch.
-
hide: echo nofuncgraph-cpu > trace_options
-
show: echo funcgraph-cpu > trace_options
-
-
The duration (function's time of execution) is displayed on the closing bracket line of a function or on the same line than the current function in case of a leaf one. It is default enabled.
-
hide: echo nofuncgraph-duration > trace_options
-
show: echo funcgraph-duration > trace_options
-
-
The overhead field precedes the duration field in case of reached duration thresholds.
-
hide: echo nofuncgraph-overhead > trace_options
-
show: echo funcgraph-overhead > trace_options
-
depends on: funcgraph-duration
ie:
3) # 1837.709 us | } /* __switch_to */ 3) | finish_task_switch() { 3) 0.313 us | _raw_spin_unlock_irq(); 3) 3.177 us | } 3) # 1889.063 us | } /* __schedule */ 3) ! 140.417 us | } /* __schedule */ 3) # 2034.948 us | } /* schedule */ 3) * 33998.59 us | } /* schedule_preempt_disabled */ [...] 1) 0.260 us | msecs_to_jiffies(); 1) 0.313 us | __rcu_read_unlock(); 1) + 61.770 us | } 1) + 64.479 us | } 1) 0.313 us | rcu_bh_qs(); 1) 0.313 us | __local_bh_enable(); 1) ! 217.240 us | } 1) 0.365 us | idle_cpu(); 1) | rcu_irq_exit() { 1) 0.417 us | rcu_eqs_enter_common.isra.47(); 1) 3.125 us | } 1) ! 227.812 us | } 1) ! 457.395 us | } 1) @ 119760.2 us | } [...] 2) | handle_IPI() { 1) 6.979 us | } 2) 0.417 us | scheduler_ipi(); 1) 9.791 us | } 1) + 12.917 us | } 2) 3.490 us | } 1) + 15.729 us | } 1) + 18.542 us | } 2) $ 3594274 us | } -
Flags:
+ means that the function exceeded 10 usecs.
! means that the function exceeded 100 usecs.
# means that the function exceeded 1000 usecs.
* means that the function exceeded 10 msecs.
@ means that the function exceeded 100 msecs.
$ means that the function exceeded 1 sec.
-
The task/pid field displays the thread cmdline and pid which executed the function. It is default disabled.
-
hide: echo nofuncgraph-proc > trace_options
-
show: echo funcgraph-proc > trace_options
ie:
# tracer: function_graph # # CPU TASK/PID DURATION FUNCTION CALLS # | | | | | | | | | 0) sh-4802 | | d_free() { 0) sh-4802 | | call_rcu() { 0) sh-4802 | | __call_rcu() { 0) sh-4802 | 0.616 us | rcu_process_gp_end(); 0) sh-4802 | 0.586 us | check_for_new_grace_period(); 0) sh-4802 | 2.899 us | } 0) sh-4802 | 4.040 us | } 0) sh-4802 | 5.151 us | } 0) sh-4802 | + 49.370 us | } -
-
The absolute time field is an absolute timestamp given by the system clock since it started. A snapshot of this time is given on each entry/exit of functions
-
hide: echo nofuncgraph-abstime > trace_options
-
show: echo funcgraph-abstime > trace_options
ie:
# # TIME CPU DURATION FUNCTION CALLS # | | | | | | | | 360.774522 | 1) 0.541 us | } 360.774522 | 1) 4.663 us | } 360.774523 | 1) 0.541 us | __wake_up_bit(); 360.774524 | 1) 6.796 us | } 360.774524 | 1) 7.952 us | } 360.774525 | 1) 9.063 us | } 360.774525 | 1) 0.615 us | journal_mark_dirty(); 360.774527 | 1) 0.578 us | __brelse(); 360.774528 | 1) | reiserfs_prepare_for_journal() { 360.774528 | 1) | unlock_buffer() { 360.774529 | 1) | wake_up_bit() { 360.774529 | 1) | bit_waitqueue() { 360.774530 | 1) 0.594 us | __phys_addr(); -
The function name is always displayed after the closing bracket for a function if the start of that function is not in the trace buffer.
Display of the function name after the closing bracket may be enabled for functions whose start is in the trace buffer, allowing easier searching with grep for function durations. It is default disabled.
hide: echo nofuncgraph-tail > trace_options
show: echo funcgraph-tail > trace_options
Example with nofuncgraph-tail (default):
0) | putname() { 0) | kmem_cache_free() { 0) 0.518 us | __phys_addr(); 0) 1.757 us | } 0) 2.861 us | }Example with funcgraph-tail:
0) | putname() { 0) | kmem_cache_free() { 0) 0.518 us | __phys_addr(); 0) 1.757 us | } /* kmem_cache_free() */ 0) 2.861 us | } /* putname() */
The return value of each traced function can be displayed after an equal sign "=". When encountering system call failures, it can be very helpful to quickly locate the function that first returns an error code.
hide: echo nofuncgraph-retval > trace_options
show: echo funcgraph-retval > trace_options
Example with funcgraph-retval:
1) | cgroup_migrate() { 1) 0.651 us | cgroup_migrate_add_task(); /* = 0xffff93fcfd346c00 */ 1) | cgroup_migrate_execute() { 1) | cpu_cgroup_can_attach() { 1) | cgroup_taskset_first() { 1) 0.732 us | cgroup_taskset_next(); /* = 0xffff93fc8fb20000 */ 1) 1.232 us | } /* cgroup_taskset_first = 0xffff93fc8fb20000 */ 1) 0.380 us | sched_rt_can_attach(); /* = 0x0 */ 1) 2.335 us | } /* cpu_cgroup_can_attach = -22 */ 1) 4.369 us | } /* cgroup_migrate_execute = -22 */ 1) 7.143 us | } /* cgroup_migrate = -22 */
The above example shows that the function cpu_cgroup_can_attach returned the error code -22 firstly, then we can read the code of this function to get the root cause.
When the option funcgraph-retval-hex is not set, the return value can be displayed in a smart way. Specifically, if it is an error code, it will be printed in signed decimal format, otherwise it will printed in hexadecimal format.
smart: echo nofuncgraph-retval-hex > trace_options
hexadecimal: echo funcgraph-retval-hex > trace_options
Example with funcgraph-retval-hex:
1) | cgroup_migrate() { 1) 0.651 us | cgroup_migrate_add_task(); /* = 0xffff93fcfd346c00 */ 1) | cgroup_migrate_execute() { 1) | cpu_cgroup_can_attach() { 1) | cgroup_taskset_first() { 1) 0.732 us | cgroup_taskset_next(); /* = 0xffff93fc8fb20000 */ 1) 1.232 us | } /* cgroup_taskset_first = 0xffff93fc8fb20000 */ 1) 0.380 us | sched_rt_can_attach(); /* = 0x0 */ 1) 2.335 us | } /* cpu_cgroup_can_attach = 0xffffffea */ 1) 4.369 us | } /* cgroup_migrate_execute = 0xffffffea */ 1) 7.143 us | } /* cgroup_migrate = 0xffffffea */
At present, there are some limitations when using the funcgraph-retval option, and these limitations will be eliminated in the future:
-
Even if the function return type is void, a return value will still be printed, and you can just ignore it.
-
Even if return values are stored in multiple registers, only the value contained in the first register will be recorded and printed. To illustrate, in the x86 architecture, eax and edx are used to store a 64-bit return value, with the lower 32 bits saved in eax and the upper 32 bits saved in edx. However, only the value stored in eax will be recorded and printed.
-
In certain procedure call standards, such as arm64's AAPCS64, when a type is smaller than a GPR, it is the responsibility of the consumer to perform the narrowing, and the upper bits may contain UNKNOWN values. Therefore, it is advisable to check the code for such cases. For instance, when using a u8 in a 64-bit GPR, bits [63:8] may contain arbitrary values, especially when larger types are truncated, whether explicitly or implicitly. Here are some specific cases to illustrate this point:
Case One:
The function narrow_to_u8 is defined as follows:
u8 narrow_to_u8(u64 val) { // implicitly truncated return val; }It may be compiled to:
narrow_to_u8: < ... ftrace instrumentation ... > RETIf you pass 0x123456789abcdef to this function and want to narrow it, it may be recorded as 0x123456789abcdef instead of 0xef.
Case Two:
The function error_if_not_4g_aligned is defined as follows:
int error_if_not_4g_aligned(u64 val) { if (val & GENMASK(31, 0)) return -EINVAL; return 0; }It could be compiled to:
error_if_not_4g_aligned: CBNZ w0, .Lnot_aligned RET // bits [31:0] are zero, bits // [63:32] are UNKNOWN .Lnot_aligned: MOV x0, #-EINVAL RETWhen passing 0x2_0000_0000 to it, the return value may be recorded as 0x2_0000_0000 instead of 0.
You can put some comments on specific functions by using trace_printk() For example, if you want to put a comment inside the __might_sleep() function, you just have to include <linux/ftrace.h> and call trace_printk() inside __might_sleep():
trace_printk("I'm a comment!\n")
will produce:
1) | __might_sleep() {
1) | /* I'm a comment! */
1) 1.449 us | }
You might find other useful features for this tracer in the following "dynamic ftrace" section such as tracing only specific functions or tasks.
dynamic ftrace #
If CONFIG_DYNAMIC_FTRACE is set, the system will run with virtually no overhead when function tracing is disabled. The way this works is the mcount function call (placed at the start of every kernel function, produced by the -pg switch in gcc), starts of pointing to a simple return. (Enabling FTRACE will include the -pg switch in the compiling of the kernel.)
At compile time every C file object is run through the recordmcount program (located in the scripts directory). This program will parse the ELF headers in the C object to find all the locations in the .text section that call mcount. Starting with gcc version 4.6, the -mfentry has been added for x86, which calls "__fentry__" instead of "mcount". Which is called before the creation of the stack frame.
Note, not all sections are traced. They may be prevented by either a notrace, or blocked another way and all inline functions are not traced. Check the "available_filter_functions" file to see what functions can be traced.
A section called "__mcount_loc" is created that holds references to all the mcount/fentry call sites in the .text section. The recordmcount program re-links this section back into the original object. The final linking stage of the kernel will add all these references into a single table.
On boot up, before SMP is initialized, the dynamic ftrace code scans this table and updates all the locations into nops. It also records the locations, which are added to the available_filter_functions list. Modules are processed as they are loaded and before they are executed. When a module is unloaded, it also removes its functions from the ftrace function list. This is automatic in the module unload code, and the module author does not need to worry about it.
When tracing is enabled, the process of modifying the function tracepoints is dependent on architecture. The old method is to use kstop_machine to prevent races with the CPUs executing code being modified (which can cause the CPU to do undesirable things, especially if the modified code crosses cache (or page) boundaries), and the nops are patched back to calls. But this time, they do not call mcount (which is just a function stub). They now call into the ftrace infrastructure.
The new method of modifying the function tracepoints is to place a breakpoint at the location to be modified, sync all CPUs, modify the rest of the instruction not covered by the breakpoint. Sync all CPUs again, and then remove the breakpoint with the finished version to the ftrace call site.
Some archs do not even need to monkey around with the synchronization, and can just slap the new code on top of the old without any problems with other CPUs executing it at the same time.
One special side-effect to the recording of the functions being traced is that we can now selectively choose which functions we wish to trace and which ones we want the mcount calls to remain as nops.
Two files are used, one for enabling and one for disabling the tracing of specified functions. They are:
set_ftrace_filter
and
set_ftrace_notrace
A list of available functions that you can add to these files is listed in:
available_filter_functions
# cat available_filter_functions
put_prev_task_idle
kmem_cache_create
pick_next_task_rt
cpus_read_lock
pick_next_task_fair
mutex_lock
[...]
If I am only interested in sys_nanosleep and hrtimer_interrupt:
# echo sys_nanosleep hrtimer_interrupt > set_ftrace_filter
# echo function > current_tracer
# echo 1 > tracing_on
# usleep 1
# echo 0 > tracing_on
# cat trace
# tracer: function
#
# entries-in-buffer/entries-written: 5/5 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
usleep-2665 [001] .... 4186.475355: sys_nanosleep <-system_call_fastpath
<idle>-0 [001] d.h1 4186.475409: hrtimer_interrupt <-smp_apic_timer_interrupt
usleep-2665 [001] d.h1 4186.475426: hrtimer_interrupt <-smp_apic_timer_interrupt
<idle>-0 [003] d.h1 4186.475426: hrtimer_interrupt <-smp_apic_timer_interrupt
<idle>-0 [002] d.h1 4186.475427: hrtimer_interrupt <-smp_apic_timer_interrupt
To see which functions are being traced, you can cat the file:
# cat set_ftrace_filter
hrtimer_interrupt
sys_nanosleep
Perhaps this is not enough. The filters also allow glob(7) matching.
<match>*will match functions that begin with <match>
*<match>will match functions that end with <match>
*<match>*will match functions that have <match> in it
<match1>*<match2>will match functions that begin with <match1> and end with <match2>
# echo 'hrtimer_*' > set_ftrace_filter
Produces:
# tracer: function
#
# entries-in-buffer/entries-written: 897/897 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
<idle>-0 [003] dN.1 4228.547803: hrtimer_cancel <-tick_nohz_idle_exit
<idle>-0 [003] dN.1 4228.547804: hrtimer_try_to_cancel <-hrtimer_cancel
<idle>-0 [003] dN.2 4228.547805: hrtimer_force_reprogram <-__remove_hrtimer
<idle>-0 [003] dN.1 4228.547805: hrtimer_forward <-tick_nohz_idle_exit
<idle>-0 [003] dN.1 4228.547805: hrtimer_start_range_ns <-hrtimer_start_expires.constprop.11
<idle>-0 [003] d..1 4228.547858: hrtimer_get_next_event <-get_next_timer_interrupt
<idle>-0 [003] d..1 4228.547859: hrtimer_start <-__tick_nohz_idle_enter
<idle>-0 [003] d..2 4228.547860: hrtimer_force_reprogram <-__rem
Notice that we lost the sys_nanosleep.
# cat set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_setup
hrtimer_cancel
hrtimer_try_to_cancel
hrtimer_forward
hrtimer_start
hrtimer_reprogram
hrtimer_force_reprogram
hrtimer_get_next_event
hrtimer_interrupt
hrtimer_nanosleep
hrtimer_wakeup
hrtimer_get_remaining
hrtimer_get_res
hrtimer_init_sleeper
This is because the '>' and '>>' act just like they do in bash. To rewrite the filters, use '>' To append to the filters, use '>>'
To clear out a filter so that all functions will be recorded again:
# echo > set_ftrace_filter
# cat set_ftrace_filter
#
Again, now we want to append.
# echo sys_nanosleep > set_ftrace_filter
# cat set_ftrace_filter
sys_nanosleep
# echo 'hrtimer_*' >> set_ftrace_filter
# cat set_ftrace_filter
hrtimer_run_queues
hrtimer_run_pending
hrtimer_setup
hrtimer_cancel
hrtimer_try_to_cancel
hrtimer_forward
hrtimer_start
hrtimer_reprogram
hrtimer_force_reprogram
hrtimer_get_next_event
hrtimer_interrupt
sys_nanosleep
hrtimer_nanosleep
hrtimer_wakeup
hrtimer_get_remaining
hrtimer_get_res
hrtimer_init_sleeper
The set_ftrace_notrace prevents those functions from being traced.
# echo '*preempt*' '*lock*' > set_ftrace_notrace
Produces:
# tracer: function
#
# entries-in-buffer/entries-written: 39608/39608 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
bash-1994 [000] .... 4342.324896: file_ra_state_init <-do_dentry_open
bash-1994 [000] .... 4342.324897: open_check_o_direct <-do_last
bash-1994 [000] .... 4342.324897: ima_file_check <-do_last
bash-1994 [000] .... 4342.324898: process_measurement <-ima_file_check
bash-1994 [000] .... 4342.324898: ima_get_action <-process_measurement
bash-1994 [000] .... 4342.324898: ima_match_policy <-ima_get_action
bash-1994 [000] .... 4342.324899: do_truncate <-do_last
bash-1994 [000] .... 4342.324899: setattr_should_drop_suidgid <-do_truncate
bash-1994 [000] .... 4342.324899: notify_change <-do_truncate
bash-1994 [000] .... 4342.324900: current_fs_time <-notify_change
bash-1994 [000] .... 4342.324900: current_kernel_time <-current_fs_time
bash-1994 [000] .... 4342.324900: timespec_trunc <-current_fs_time
We can see that there's no more lock or preempt tracing.
Selecting function filters via index #
Because processing of strings is expensive (the address of the function needs to be looked up before comparing to the string being passed in), an index can be used as well to enable functions. This is useful in the case of setting thousands of specific functions at a time. By passing in a list of numbers, no string processing will occur. Instead, the function at the specific location in the internal array (which corresponds to the functions in the "available_filter_functions" file), is selected.
# echo 1 > set_ftrace_filter
Will select the first function listed in "available_filter_functions"
# head -1 available_filter_functions
trace_initcall_finish_cb
# cat set_ftrace_filter
trace_initcall_finish_cb
# head -50 available_filter_functions | tail -1
x86_pmu_commit_txn
# echo 1 50 > set_ftrace_filter
# cat set_ftrace_filter
trace_initcall_finish_cb
x86_pmu_commit_txn
Dynamic ftrace with the function graph tracer #
Although what has been explained above concerns both the function tracer and the function-graph-tracer, there are some special features only available in the function-graph tracer.
If you want to trace only one function and all of its children, you just have to echo its name into set_graph_function:
echo __do_fault > set_graph_function
will produce the following "expanded" trace of the __do_fault() function:
0) | __do_fault() {
0) | filemap_fault() {
0) | find_lock_page() {
0) 0.804 us | find_get_page();
0) | __might_sleep() {
0) 1.329 us | }
0) 3.904 us | }
0) 4.979 us | }
0) 0.653 us | _spin_lock();
0) 0.578 us | page_add_file_rmap();
0) 0.525 us | native_set_pte_at();
0) 0.585 us | _spin_unlock();
0) | unlock_page() {
0) 0.541 us | page_waitqueue();
0) 0.639 us | __wake_up_bit();
0) 2.786 us | }
0) + 14.237 us | }
0) | __do_fault() {
0) | filemap_fault() {
0) | find_lock_page() {
0) 0.698 us | find_get_page();
0) | __might_sleep() {
0) 1.412 us | }
0) 3.950 us | }
0) 5.098 us | }
0) 0.631 us | _spin_lock();
0) 0.571 us | page_add_file_rmap();
0) 0.526 us | native_set_pte_at();
0) 0.586 us | _spin_unlock();
0) | unlock_page() {
0) 0.533 us | page_waitqueue();
0) 0.638 us | __wake_up_bit();
0) 2.793 us | }
0) + 14.012 us | }
You can also expand several functions at once:
echo sys_open > set_graph_function
echo sys_close >> set_graph_function
Now if you want to go back to trace all functions you can clear this special filter via:
echo > set_graph_function
ftrace_enabled #
Note, the proc sysctl ftrace_enable is a big on/off switch for the function tracer. By default it is enabled (when function tracing is enabled in the kernel). If it is disabled, all function tracing is disabled. This includes not only the function tracers for ftrace, but also for any other uses (perf, kprobes, stack tracing, profiling, etc). It cannot be disabled if there is a callback with FTRACE_OPS_FL_PERMANENT set registered.
Please disable this with care.
This can be disable (and enabled) with:
sysctl kernel.ftrace_enabled=0
sysctl kernel.ftrace_enabled=1
or
echo 0 > /proc/sys/kernel/ftrace_enabled
echo 1 > /proc/sys/kernel/ftrace_enabled
Filter commands #
A few commands are supported by the set_ftrace_filter interface. Trace commands have the following format:
<function>:<command>:<parameter>
The following commands are supported:
-
mod: This command enables function filtering per module. The parameter defines the module. For example, if only the write* functions in the ext3 module are desired, run:
echo 'write*:mod:ext3' > set_ftrace_filter
This command interacts with the filter in the same way as filtering based on function names. Thus, adding more functions in a different module is accomplished by appending (>>) to the filter file. Remove specific module functions by prepending '!':
echo '!writeback*:mod:ext3' >> set_ftrace_filterMod command supports module globbing. Disable tracing for all functions except a specific module:
echo '!*:mod:!ext3' >> set_ftrace_filterDisable tracing for all modules, but still trace kernel:
echo '!*:mod:*' >> set_ftrace_filterEnable filter only for kernel:
echo '*write*:mod:!*' >> set_ftrace_filterEnable filter for module globbing:
echo '*write*:mod:*snd*' >> set_ftrace_filter -
traceon/traceoff: These commands turn tracing on and off when the specified functions are hit. The parameter determines how many times the tracing system is turned on and off. If unspecified, there is no limit. For example, to disable tracing when a schedule bug is hit the first 5 times, run:
echo '__schedule_bug:traceoff:5' > set_ftrace_filterTo always disable tracing when __schedule_bug is hit:
echo '__schedule_bug:traceoff' > set_ftrace_filterThese commands are cumulative whether or not they are appended to set_ftrace_filter. To remove a command, prepend it by '!' and drop the parameter:
echo '!__schedule_bug:traceoff:0' > set_ftrace_filterThe above removes the traceoff command for __schedule_bug that have a counter. To remove commands without counters:
echo '!__schedule_bug:traceoff' > set_ftrace_filter -
snapshot: Will cause a snapshot to be triggered when the function is hit.
echo 'native_flush_tlb_others:snapshot' > set_ftrace_filterTo only snapshot once:
echo 'native_flush_tlb_others:snapshot:1' > set_ftrace_filterTo remove the above commands:
echo '!native_flush_tlb_others:snapshot' > set_ftrace_filter echo '!native_flush_tlb_others:snapshot:0' > set_ftrace_filter -
enable_event/disable_event: These commands can enable or disable a trace event. Note, because function tracing callbacks are very sensitive, when these commands are registered, the trace point is activated, but disabled in a "soft" mode. That is, the tracepoint will be called, but just will not be traced. The event tracepoint stays in this mode as long as there's a command that triggers it.
echo 'try_to_wake_up:enable_event:sched:sched_switch:2' > \ set_ftrace_filterThe format is:
<function>:enable_event:<system>:<event>[:count] <function>:disable_event:<system>:<event>[:count]To remove the events commands:
echo '!try_to_wake_up:enable_event:sched:sched_switch:0' > \ set_ftrace_filter echo '!schedule:disable_event:sched:sched_switch' > \ set_ftrace_filter -
dump: When the function is hit, it will dump the contents of the ftrace ring buffer to the console. This is useful if you need to debug something, and want to dump the trace when a certain function is hit. Perhaps it's a function that is called before a triple fault happens and does not allow you to get a regular dump.
-
cpudump: When the function is hit, it will dump the contents of the ftrace ring buffer for the current CPU to the console. Unlike the "dump" command, it only prints out the contents of the ring buffer for the CPU that executed the function that triggered the dump.
-
stacktrace: When the function is hit, a stack trace is recorded.
trace_pipe #
The trace_pipe outputs the same content as the trace file, but the effect on the tracing is different. Every read from trace_pipe is consumed. This means that subsequent reads will be different. The trace is live.
# echo function > current_tracer
# cat trace_pipe > /tmp/trace.out &
[1] 4153
# echo 1 > tracing_on
# usleep 1
# echo 0 > tracing_on
# cat trace
# tracer: function
#
# entries-in-buffer/entries-written: 0/0 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
#
# cat /tmp/trace.out
bash-1994 [000] .... 5281.568961: mutex_unlock <-rb_simple_write
bash-1994 [000] .... 5281.568963: __mutex_unlock_slowpath <-mutex_unlock
bash-1994 [000] .... 5281.568963: __fsnotify_parent <-fsnotify_modify
bash-1994 [000] .... 5281.568964: fsnotify <-fsnotify_modify
bash-1994 [000] .... 5281.568964: __srcu_read_lock <-fsnotify
bash-1994 [000] .... 5281.568964: add_preempt_count <-__srcu_read_lock
bash-1994 [000] ...1 5281.568965: sub_preempt_count <-__srcu_read_lock
bash-1994 [000] .... 5281.568965: __srcu_read_unlock <-fsnotify
bash-1994 [000] .... 5281.568967: sys_dup2 <-system_call_fastpath
Note, reading the trace_pipe file will block until more input is added. This is contrary to the trace file. If any process opened the trace file for reading, it will actually disable tracing and prevent new entries from being added. The trace_pipe file does not have this limitation.
trace entries #
Having too much or not enough data can be troublesome in diagnosing an issue in the kernel. The file buffer_size_kb is used to modify the size of the internal trace buffers. The number listed is the number of entries that can be recorded per CPU. To know the full size, multiply the number of possible CPUs with the number of entries.
# cat buffer_size_kb
1408 (units kilobytes)
Or simply read buffer_total_size_kb
# cat buffer_total_size_kb
5632
To modify the buffer, simple echo in a number (in 1024 byte segments).
# echo 10000 > buffer_size_kb
# cat buffer_size_kb
10000 (units kilobytes)
It will try to allocate as much as possible. If you allocate too much, it can cause Out-Of-Memory to trigger.
# echo 1000000000000 > buffer_size_kb
-bash: echo: write error: Cannot allocate memory
# cat buffer_size_kb
85
The per_cpu buffers can be changed individually as well:
# echo 10000 > per_cpu/cpu0/buffer_size_kb
# echo 100 > per_cpu/cpu1/buffer_size_kb
When the per_cpu buffers are not the same, the buffer_size_kb at the top level will just show an X
# cat buffer_size_kb
X
This is where the buffer_total_size_kb is useful:
# cat buffer_total_size_kb
12916
Writing to the top level buffer_size_kb will reset all the buffers to be the same again.
Snapshot #
CONFIG_TRACER_SNAPSHOT makes a generic snapshot feature available to all non latency tracers. (Latency tracers which record max latency, such as "irqsoff" or "wakeup", can't use this feature, since those are already using the snapshot mechanism internally.)
Snapshot preserves a current trace buffer at a particular point in time without stopping tracing. Ftrace swaps the current buffer with a spare buffer, and tracing continues in the new current (=previous spare) buffer.
The following tracefs files in "tracing" are related to this feature:
snapshot:
This is used to take a snapshot and to read the output of the snapshot. Echo 1 into this file to allocate a spare buffer and to take a snapshot (swap), then read the snapshot from this file in the same format as "trace" (described above in the section "The File System"). Both reads snapshot and tracing are executable in parallel. When the spare buffer is allocated, echoing 0 frees it, and echoing else (positive) values clear the snapshot contents. More details are shown in the table below.
status\input
0
1
else
not allocated
(do nothing)
alloc+swap
(do nothing)
allocated
free
swap
clear
Here is an example of using the snapshot feature.
# echo 1 > events/sched/enable
# echo 1 > snapshot
# cat snapshot
# tracer: nop
#
# entries-in-buffer/entries-written: 71/71 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
<idle>-0 [005] d... 2440.603828: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=snapshot-test-2 next_pid=2242 next_prio=120
sleep-2242 [005] d... 2440.603846: sched_switch: prev_comm=snapshot-test-2 prev_pid=2242 prev_prio=120 prev_state=R ==> next_comm=kworker/5:1 next_pid=60 next_prio=120
[...]
<idle>-0 [002] d... 2440.707230: sched_switch: prev_comm=swapper/2 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=snapshot-test-2 next_pid=2229 next_prio=120
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 77/77 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
<idle>-0 [007] d... 2440.707395: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=snapshot-test-2 next_pid=2243 next_prio=120
snapshot-test-2-2229 [002] d... 2440.707438: sched_switch: prev_comm=snapshot-test-2 prev_pid=2229 prev_prio=120 prev_state=S ==> next_comm=swapper/2 next_pid=0 next_prio=120
[...]
If you try to use this snapshot feature when current tracer is one of the latency tracers, you will get the following results.
# echo wakeup > current_tracer
# echo 1 > snapshot
bash: echo: write error: Device or resource busy
# cat snapshot
cat: snapshot: Device or resource busy
Instances #
In the tracefs tracing directory, there is a directory called "instances". This directory can have new directories created inside of it using mkdir, and removing directories with rmdir. The directory created with mkdir in this directory will already contain files and other directories after it is created.
# mkdir instances/foo
# ls instances/foo
buffer_size_kb buffer_total_size_kb events free_buffer per_cpu
set_event snapshot trace trace_clock trace_marker trace_options
trace_pipe tracing_on
As you can see, the new directory looks similar to the tracing directory itself. In fact, it is very similar, except that the buffer and events are agnostic from the main directory, or from any other instances that are created.
The files in the new directory work just like the files with the same name in the tracing directory except the buffer that is used is a separate and new buffer. The files affect that buffer but do not affect the main buffer with the exception of trace_options. Currently, the trace_options affect all instances and the top level buffer the same, but this may change in future releases. That is, options may become specific to the instance they reside in.
Notice that none of the function tracer files are there, nor is current_tracer and available_tracers. This is because the buffers can currently only have events enabled for them.
# mkdir instances/foo
# mkdir instances/bar
# mkdir instances/zoot
# echo 100000 > buffer_size_kb
# echo 1000 > instances/foo/buffer_size_kb
# echo 5000 > instances/bar/per_cpu/cpu1/buffer_size_kb
# echo function > current_trace
# echo 1 > instances/foo/events/sched/sched_wakeup/enable
# echo 1 > instances/foo/events/sched/sched_wakeup_new/enable
# echo 1 > instances/foo/events/sched/sched_switch/enable
# echo 1 > instances/bar/events/irq/enable
# echo 1 > instances/zoot/events/syscalls/enable
# cat trace_pipe
CPU:2 [LOST 11745 EVENTS]
bash-2044 [002] .... 10594.481032: _raw_spin_lock_irqsave <-get_page_from_freelist
bash-2044 [002] d... 10594.481032: add_preempt_count <-_raw_spin_lock_irqsave
bash-2044 [002] d..1 10594.481032: __rmqueue <-get_page_from_freelist
bash-2044 [002] d..1 10594.481033: _raw_spin_unlock <-get_page_from_freelist
bash-2044 [002] d..1 10594.481033: sub_preempt_count <-_raw_spin_unlock
bash-2044 [002] d... 10594.481033: get_pageblock_flags_group <-get_pageblock_migratetype
bash-2044 [002] d... 10594.481034: __mod_zone_page_state <-get_page_from_freelist
bash-2044 [002] d... 10594.481034: zone_statistics <-get_page_from_freelist
bash-2044 [002] d... 10594.481034: __inc_zone_state <-zone_statistics
bash-2044 [002] d... 10594.481034: __inc_zone_state <-zone_statistics
bash-2044 [002] .... 10594.481035: arch_dup_task_struct <-copy_process
[...]
# cat instances/foo/trace_pipe
bash-1998 [000] d..4 136.676759: sched_wakeup: comm=kworker/0:1 pid=59 prio=120 success=1 target_cpu=000
bash-1998 [000] dN.4 136.676760: sched_wakeup: comm=bash pid=1998 prio=120 success=1 target_cpu=000
<idle>-0 [003] d.h3 136.676906: sched_wakeup: comm=rcu_preempt pid=9 prio=120 success=1 target_cpu=003
<idle>-0 [003] d..3 136.676909: sched_switch: prev_comm=swapper/3 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=rcu_preempt next_pid=9 next_prio=120
rcu_preempt-9 [003] d..3 136.676916: sched_switch: prev_comm=rcu_preempt prev_pid=9 prev_prio=120 prev_state=S ==> next_comm=swapper/3 next_pid=0 next_prio=120
bash-1998 [000] d..4 136.677014: sched_wakeup: comm=kworker/0:1 pid=59 prio=120 success=1 target_cpu=000
bash-1998 [000] dN.4 136.677016: sched_wakeup: comm=bash pid=1998 prio=120 success=1 target_cpu=000
bash-1998 [000] d..3 136.677018: sched_switch: prev_comm=bash prev_pid=1998 prev_prio=120 prev_state=R+ ==> next_comm=kworker/0:1 next_pid=59 next_prio=120
kworker/0:1-59 [000] d..4 136.677022: sched_wakeup: comm=sshd pid=1995 prio=120 success=1 target_cpu=001
kworker/0:1-59 [000] d..3 136.677025: sched_switch: prev_comm=kworker/0:1 prev_pid=59 prev_prio=120 prev_state=S ==> next_comm=bash next_pid=1998 next_prio=120
[...]
# cat instances/bar/trace_pipe
migration/1-14 [001] d.h3 138.732674: softirq_raise: vec=3 [action=NET_RX]
<idle>-0 [001] dNh3 138.732725: softirq_raise: vec=3 [action=NET_RX]
bash-1998 [000] d.h1 138.733101: softirq_raise: vec=1 [action=TIMER]
bash-1998 [000] d.h1 138.733102: softirq_raise: vec=9 [action=RCU]
bash-1998 [000] ..s2 138.733105: softirq_entry: vec=1 [action=TIMER]
bash-1998 [000] ..s2 138.733106: softirq_exit: vec=1 [action=TIMER]
bash-1998 [000] ..s2 138.733106: softirq_entry: vec=9 [action=RCU]
bash-1998 [000] ..s2 138.733109: softirq_exit: vec=9 [action=RCU]
sshd-1995 [001] d.h1 138.733278: irq_handler_entry: irq=21 name=uhci_hcd:usb4
sshd-1995 [001] d.h1 138.733280: irq_handler_exit: irq=21 ret=unhandled
sshd-1995 [001] d.h1 138.733281: irq_handler_entry: irq=21 name=eth0
sshd-1995 [001] d.h1 138.733283: irq_handler_exit: irq=21 ret=handled
[...]
# cat instances/zoot/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 18996/18996 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
bash-1998 [000] d... 140.733501: sys_write -> 0x2
bash-1998 [000] d... 140.733504: sys_dup2(oldfd: a, newfd: 1)
bash-1998 [000] d... 140.733506: sys_dup2 -> 0x1
bash-1998 [000] d... 140.733508: sys_fcntl(fd: a, cmd: 1, arg: 0)
bash-1998 [000] d... 140.733509: sys_fcntl -> 0x1
bash-1998 [000] d... 140.733510: sys_close(fd: a)
bash-1998 [000] d... 140.733510: sys_close -> 0x0
bash-1998 [000] d... 140.733514: sys_rt_sigprocmask(how: 0, nset: 0, oset: 6e2768, sigsetsize: 8)
bash-1998 [000] d... 140.733515: sys_rt_sigprocmask -> 0x0
bash-1998 [000] d... 140.733516: sys_rt_sigaction(sig: 2, act: 7fff718846f0, oact: 7fff71884650, sigsetsize: 8)
bash-1998 [000] d... 140.733516: sys_rt_sigaction -> 0x0
You can see that the trace of the top most trace buffer shows only the function tracing. The foo instance displays wakeups and task switches.
To remove the instances, simply delete their directories:
# rmdir instances/foo
# rmdir instances/bar
# rmdir instances/zoot
Note, if a process has a trace file open in one of the instance directories, the rmdir will fail with EBUSY.
Stack trace #
Since the kernel has a fixed sized stack, it is important not to waste it in functions. A kernel developer must be conscious of what they allocate on the stack. If they add too much, the system can be in danger of a stack overflow, and corruption will occur, usually leading to a system panic.
There are some tools that check this, usually with interrupts periodically checking usage. But if you can perform a check at every function call that will become very useful. As ftrace provides a function tracer, it makes it convenient to check the stack size at every function call. This is enabled via the stack tracer.
CONFIG_STACK_TRACER enables the ftrace stack tracing functionality. To enable it, write a '1' into /proc/sys/kernel/stack_tracer_enabled.
# echo 1 > /proc/sys/kernel/stack_tracer_enabled
You can also enable it from the kernel command line to trace the stack size of the kernel during boot up, by adding "stacktrace" to the kernel command line parameter.
After running it for a few minutes, the output looks like:
# cat stack_max_size
2928
# cat stack_trace
Depth Size Location (18 entries)
----- ---- --------
0) 2928 224 update_sd_lb_stats+0xbc/0x4ac
1) 2704 160 find_busiest_group+0x31/0x1f1
2) 2544 256 load_balance+0xd9/0x662
3) 2288 80 idle_balance+0xbb/0x130
4) 2208 128 __schedule+0x26e/0x5b9
5) 2080 16 schedule+0x64/0x66
6) 2064 128 schedule_timeout+0x34/0xe0
7) 1936 112 wait_for_common+0x97/0xf1
8) 1824 16 wait_for_completion+0x1d/0x1f
9) 1808 128 flush_work+0xfe/0x119
10) 1680 16 tty_flush_to_ldisc+0x1e/0x20
11) 1664 48 input_available_p+0x1d/0x5c
12) 1616 48 n_tty_poll+0x6d/0x134
13) 1568 64 tty_poll+0x64/0x7f
14) 1504 880 do_select+0x31e/0x511
15) 624 400 core_sys_select+0x177/0x216
16) 224 96 sys_select+0x91/0xb9
17) 128 128 system_call_fastpath+0x16/0x1b
Note, if -mfentry is being used by gcc, functions get traced before they set up the stack frame. This means that leaf level functions are not tested by the stack tracer when -mfentry is used.
Currently, -mfentry is used by gcc 4.6.0 and above on x86 only.
More #
More details can be found in the source code, in the kernel/trace/*.c files.
HiSilicon PCIe Tune and Trace device
Peios Kernel / Kernel development / Trace
Introduction #
HiSilicon PCIe tune and trace device (PTT) is a PCIe Root Complex integrated Endpoint (RCiEP) device, providing the capability to dynamically monitor and tune the PCIe link's events (tune), and trace the TLP headers (trace). The two functions are independent, but is recommended to use them together to analyze and enhance the PCIe link's performance.
On Kunpeng 930 SoC, the PCIe Root Complex is composed of several PCIe cores. Each PCIe core includes several Root Ports and a PTT RCiEP, like below. The PTT device is capable of tuning and tracing the links of the PCIe core.
+--------------Core 0-------+
| | [ PTT ] |
| | [Root Port]---[Endpoint]
| | [Root Port]---[Endpoint]
| | [Root Port]---[Endpoint]
Root Complex |------Core 1-------+
| | [ PTT ] |
| | [Root Port]---[ Switch ]---[Endpoint]
| | [Root Port]---[Endpoint] `-[Endpoint]
| | [Root Port]---[Endpoint]
+---------------------------+
The PTT device driver registers one PMU device for each PTT device. The name of each PTT device is composed of 'hisi_ptt' prefix with the id of the SICL and the Core where it locates. The Kunpeng 930 SoC encapsulates multiple CPU dies (SCCL, Super CPU Cluster) and IO dies (SICL, Super I/O Cluster), where there's one PCIe Root Complex for each SICL.
/sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>
Tune #
PTT tune is designed for monitoring and adjusting PCIe link parameters (events). Currently we support events in 2 classes. The scope of the events covers the PCIe core to which the PTT device belongs.
Each event is presented as a file under $(PTT PMU dir)/tune, and a simple open/read/write/close cycle will be used to tune the event.
$ cd /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune
$ ls
qos_tx_cpl qos_tx_np qos_tx_p
tx_path_rx_req_alloc_buf_level
tx_path_tx_req_alloc_buf_level
$ cat qos_tx_dp
1
$ echo 2 > qos_tx_dp
$ cat qos_tx_dp
2
Current value (numerical value) of the event can be simply read from the file, and the desired value written to the file to tune.
1. Tx Path QoS Control #
The following files are provided to tune the QoS of the tx path of the PCIe core.
-
qos_tx_cpl: weight of Tx completion TLPs
-
qos_tx_np: weight of Tx non-posted TLPs
-
qos_tx_p: weight of Tx posted TLPs
The weight influences the proportion of certain packets on the PCIe link. For example, for the storage scenario, increase the proportion of the completion packets on the link to enhance the performance as more completions are consumed.
The available tune data of these events is [0, 1, 2]. Writing a negative value will return an error, and out of range values will be converted to 2. Note that the event value just indicates a probable level, but is not precise.
2. Tx Path Buffer Control #
Following files are provided to tune the buffer of tx path of the PCIe core.
-
rx_alloc_buf_level: watermark of Rx requested
-
tx_alloc_buf_level: watermark of Tx requested
These events influence the watermark of the buffer allocated for each type. Rx means the inbound while Tx means outbound. The packets will be stored in the buffer first and then transmitted either when the watermark reached or when timed out. For a busy direction, you should increase the related buffer watermark to avoid frequently posting and thus enhance the performance. In most cases just keep the default value.
The available tune data of above events is [0, 1, 2]. Writing a negative value will return an error, and out of range values will be converted to 2. Note that the event value just indicates a probable level, but is not precise.
Trace #
PTT trace is designed for dumping the TLP headers to the memory, which can be used to analyze the transactions and usage condition of the PCIe Link. You can choose to filter the traced headers by either Requester ID, or those downstream of a set of Root Ports on the same core of the PTT device. It's also supported to trace the headers of certain type and of certain direction.
You can use the perf command perf record to set the parameters, start trace and get the data. It's also supported to decode the trace data with perf report. The control parameters for trace is inputted as event code for each events, which will be further illustrated later. An example usage is like
$ perf record -e hisi_ptt0_2/filter=0x80001,type=1,direction=1,
format=1/ -- sleep 5
This will trace the TLP headers downstream root port 0000:00:10.1 (event code for event 'filter' is 0x80001) with type of posted TLP requests, direction of inbound and traced data format of 8DW.
1. Filter #
The TLP headers to trace can be filtered by the Root Ports or the Requester ID of the Endpoint, which are located on the same core of the PTT device. You can set the filter by specifying the filter parameter which is required to start the trace. The parameter value is 20 bit. Bit 19 indicates the filter type. 1 for Root Port filter and 0 for Requester filter. Bit[15:0] indicates the filter value. The value for a Root Port is a mask of the core port id which is calculated from its PCI Slot ID as (slotid & 7) * 2. The value for a Requester is the Requester ID (Device ID of the PCIe function). Bit[18:16] is currently reserved for extension.
For example, if the desired filter is Endpoint function 0000:01:00.1 the filter value will be 0x00101. If the desired filter is Root Port 0000:00:10.0 then then filter value is calculated as 0x80001.
The driver also presents every supported Root Port and Requester filter through sysfs. Each filter will be an individual file with name of its related PCIe device name (domain:bus:device.function). The files of Root Port filters are under $(PTT PMU dir)/root_port_filters and files of Requester filters are under $(PTT PMU dir)/requester_filters.
Note that multiple Root Ports can be specified at one time, but only one Endpoint function can be specified in one trace. Specifying both Root Port and function at the same time is not supported. Driver maintains a list of available filters and will check the invalid inputs.
The available filters will be dynamically updated, which means you will always get correct filter information when hotplug events happen, or when you manually remove/rescan the devices.
2. Type #
You can trace the TLP headers of certain types by specifying the type parameter, which is required to start the trace. The parameter value is 8 bit. Current supported types and related values are shown below:
-
8'b00000001: posted requests (P)
-
8'b00000010: non-posted requests (NP)
-
8'b00000100: completions (CPL)
You can specify multiple types when tracing inbound TLP headers, but can only specify one when tracing outbound TLP headers.
3. Direction #
You can trace the TLP headers from certain direction, which is relative to the Root Port or the PCIe core, by specifying the direction parameter. This is optional and the default parameter is inbound. The parameter value is 4 bit. When the desired format is 4DW, directions and related values supported are shown below:
-
4'b0000: inbound TLPs (P, NP, CPL)
-
4'b0001: outbound TLPs (P, NP, CPL)
-
4'b0010: outbound TLPs (P, NP, CPL) and inbound TLPs (P, NP, CPL B)
-
4'b0011: outbound TLPs (P, NP, CPL) and inbound TLPs (CPL A)
When the desired format is 8DW, directions and related values supported are shown below:
-
4'b0000: reserved
-
4'b0001: outbound TLPs (P, NP, CPL)
-
4'b0010: inbound TLPs (P, NP, CPL B)
-
4'b0011: inbound TLPs (CPL A)
Inbound completions are classified into two types:
-
completion A (CPL A): completion of CHI/DMA/Native non-posted requests, except for CPL B
-
completion B (CPL B): completion of DMA remote2local and P2P non-posted requests
4. Format #
You can change the format of the traced TLP headers by specifying the format parameter. The default format is 4DW. The parameter value is 4 bit. Current supported formats and related values are shown below:
-
4'b0000: 4DW length per TLP header
-
4'b0001: 8DW length per TLP header
The traced TLP header format is different from the PCIe standard.
When using the 8DW data format, the entire TLP header is logged (Header DW0-3 shown below). For example, the TLP header for Memory Reads with 64-bit addresses is shown in PCIe r5.0, Figure 2-17; the header for Configuration Requests is shown in Figure 2.20, etc.
In addition, 8DW trace buffer entries contain a timestamp and possibly a prefix for a PASID TLP prefix (see Figure 6-20, PCIe r5.0). Otherwise this field will be all 0.
The bit[31:11] of DW0 is always 0x1fffff, which can be used to distinguish the data format. 8DW format is like
bits [ 31:11 ][ 10:0 ]
|---------------------------------------|-------------------|
DW0 [ 0x1fffff ][ Reserved (0x7ff) ]
DW1 [ Prefix ]
DW2 [ Header DW0 ]
DW3 [ Header DW1 ]
DW4 [ Header DW2 ]
DW5 [ Header DW3 ]
DW6 [ Reserved (0x0) ]
DW7 [ Time ]
When using the 4DW data format, DW0 of the trace buffer entry contains selected fields of DW0 of the TLP, together with a timestamp. DW1-DW3 of the trace buffer entry contain DW1-DW3 directly from the TLP header.
4DW format is like
bits [31:30] [ 29:25 ][24][23][22][21][ 20:11 ][ 10:0 ]
|-----|---------|---|---|---|---|-------------|-------------|
DW0 [ Fmt ][ Type ][T9][T8][TH][SO][ Length ][ Time ]
DW1 [ Header DW1 ]
DW2 [ Header DW2 ]
DW3 [ Header DW3 ]
5. Memory Management #
The traced TLP headers will be written to the memory allocated by the driver. The hardware accepts 4 DMA address with same size, and writes the buffer sequentially like below. If DMA addr 3 is finished and the trace is still on, it will return to addr 0.
+->[DMA addr 0]->[DMA addr 1]->[DMA addr 2]->[DMA addr 3]-+
+---------------------------------------------------------+
Driver will allocate each DMA buffer of 4MiB. The finished buffer will be copied to the perf AUX buffer allocated by the perf core. Once the AUX buffer is full while the trace is still on, driver will commit the AUX buffer first and then apply for a new one with the same size. The size of AUX buffer is default to 16MiB. User can adjust the size by specifying the -m parameter of the perf command.
6. Decoding #
You can decode the traced data with perf report -D command (currently only support to dump the raw trace data). The traced data will be decoded according to the format described previously (take 8DW as an example):
[...perf headers and other information]
. ... HISI PTT data: size 4194304 bytes
. 00000000: 00 00 00 00 Prefix
. 00000004: 01 00 00 60 Header DW0
. 00000008: 0f 1e 00 01 Header DW1
. 0000000c: 04 00 00 00 Header DW2
. 00000010: 40 00 81 02 Header DW3
. 00000014: 33 c0 04 00 Time
. 00000020: 00 00 00 00 Prefix
. 00000024: 01 00 00 60 Header DW0
. 00000028: 0f 1e 00 01 Header DW1
. 0000002c: 04 00 00 00 Header DW2
. 00000030: 40 00 81 02 Header DW3
. 00000034: 02 00 00 00 Time
. 00000040: 00 00 00 00 Prefix
. 00000044: 01 00 00 60 Header DW0
. 00000048: 0f 1e 00 01 Header DW1
. 0000004c: 04 00 00 00 Header DW2
. 00000050: 40 00 81 02 Header DW3
[...]
Histogram Design Notes
Peios Kernel / Kernel development / Trace
Author: Tom Zanussi <zanussi@kernel.org>
This document attempts to provide a description of how the ftrace histograms work and how the individual pieces map to the data structures used to implement them in trace_events_hist.c and tracing_map.c.
'hist_debug' trace event files #
If the kernel is compiled with CONFIG_HIST_TRIGGERS_DEBUG set, an event file named 'hist_debug' will appear in each event's subdirectory. This file can be read at any time and will display some of the hist trigger internals described in this document. Specific examples and output will be described in test cases below.
Basic histograms #
First, basic histograms. Below is pretty much the simplest thing you can do with histograms - create one with a single key on a single event and cat the output:
# echo 'hist:keys=pid' >> events/sched/sched_waking/trigger
# cat events/sched/sched_waking/hist
{ pid: 18249 } hitcount: 1
{ pid: 13399 } hitcount: 1
{ pid: 17973 } hitcount: 1
{ pid: 12572 } hitcount: 1
...
{ pid: 10 } hitcount: 921
{ pid: 18255 } hitcount: 1444
{ pid: 25526 } hitcount: 2055
{ pid: 5257 } hitcount: 2055
{ pid: 27367 } hitcount: 2055
{ pid: 1728 } hitcount: 2161
Totals:
Hits: 21305
Entries: 183
Dropped: 0
What this does is create a histogram on the sched_waking event using pid as a key and with a single value, hitcount, which even if not explicitly specified, exists for every histogram regardless.
The hitcount value is a per-bucket value that's automatically incremented on every hit for the given key, which in this case is the pid.
So in this histogram, there's a separate bucket for each pid, and each bucket contains a value for that bucket, counting the number of times sched_waking was called for that pid.
Each histogram is represented by a hist_data struct.
To keep track of each key and value field in the histogram, hist_data keeps an array of these fields named fields[]. The fields[] array is an array containing struct hist_field representations of each histogram val and key in the histogram (variables are also included here, but are discussed later). So for the above histogram we have one key and one value; in this case the one value is the hitcount value, which all histograms have, regardless of whether they define that value or not, which the above histogram does not.
Each struct hist_field contains a pointer to the ftrace_event_field from the event's trace_event_file along with various bits related to that such as the size, offset, type, and a hist_field_fn_t function, which is used to grab the field's data from the ftrace event buffer (in most cases - some hist_fields such as hitcount don't directly map to an event field in the trace buffer - in these cases the function implementation gets its value from somewhere else). The flags field indicates which type of field it is - key, value, variable, variable reference, etc., with value being the default.
The other important hist_data data structure in addition to the fields[] array is the tracing_map instance created for the histogram, which is held in the .map member. The tracing_map implements the lock-free hash table used to implement histograms (see kernel/trace/tracing_map.h for much more discussion about the low-level data structures implementing the tracing_map). For the purposes of this discussion, the tracing_map contains a number of buckets, each bucket corresponding to a particular tracing_map_elt object hashed by a given histogram key.
Below is a diagram the first part of which describes the hist_data and associated key and value fields for the histogram described above. As you can see, there are two fields in the fields array, one val field for the hitcount and one key field for the pid key.
Below that is a diagram of a run-time snapshot of what the tracing_map might look like for a given run. It attempts to show the relationships between the hist_data fields and the tracing_map elements for a couple hypothetical keys and values.:
+------------------+
| hist_data |
+------------------+ +----------------+
| .fields[] |---->| val = hitcount |----------------------------+
+----------------+ +----------------+ |
| .map | | .size | |
+----------------+ +--------------+ |
| .offset | |
+--------------+ |
| .fn() | |
+--------------+ |
. |
. |
. |
+----------------+ <--- n_vals |
| key = pid |----------------------------|--+
+----------------+ | |
| .size | | |
+--------------+ | |
| .offset | | |
+--------------+ | |
| .fn() | | |
+----------------+ <--- n_fields | |
| unused | | |
+----------------+ | |
| | | |
+--------------+ | |
| | | |
+--------------+ | |
| | | |
+--------------+ | |
n_keys = n_fields - n_vals | |
The hist_data n_vals and n_fields delineate the extent of the fields[] array and separate keys from values for the rest of the code.
Below is a run-time representation of the tracing_map part of the histogram, with pointers from various parts of the fields[] array to corresponding parts of the tracing_map.
The tracing_map consists of an array of tracing_map_entrys and a set of preallocated tracing_map_elts (abbreviated below as map_entry and map_elt). The total number of map_entrys in the hist_data.map array = map->max_elts (actually map->map_size but only max_elts of those are used. This is a property required by the map_insert() algorithm).
If a map_entry is unused, meaning no key has yet hashed into it, its .key value is 0 and its .val pointer is NULL. Once a map_entry has been claimed, the .key value contains the key's hash value and the .val member points to a map_elt containing the full key and an entry for each key or value in the map_elt.fields[] array. There is an entry in the map_elt.fields[] array corresponding to each hist_field in the histogram, and this is where the continually aggregated sums corresponding to each histogram value are kept.
The diagram attempts to show the relationship between the hist_data.fields[] and the map_elt.fields[] with the links drawn between diagrams:
+-----------+ | |
| hist_data | | |
+-----------+ | |
| .fields | | |
+---------+ +-----------+ | |
| .map |---->| map_entry | | |
+---------+ +-----------+ | |
| .key |---> 0 | |
+---------+ | |
| .val |---> NULL | |
+-----------+ | |
| map_entry | | |
+-----------+ | |
| .key |---> pid = 999 | |
+---------+ +-----------+ | |
| .val |--->| map_elt | | |
+---------+ +-----------+ | |
. | .key |---> full key * | |
. +---------+ +---------------+ | |
. | .fields |--->| .sum (val) |<-+ |
+-----------+ +---------+ | 2345 | | |
| map_entry | +---------------+ | |
+-----------+ | .offset (key) |<----+
| .key |---> 0 | 0 | | |
+---------+ +---------------+ | |
| .val |---> NULL . | |
+-----------+ . | |
| map_entry | . | |
+-----------+ +---------------+ | |
| .key | | .sum (val) or | | |
+---------+ +---------+ | .offset (key) | | |
| .val |--->| map_elt | +---------------+ | |
+-----------+ +---------+ | .sum (val) or | | |
| map_entry | | .offset (key) | | |
+-----------+ +---------------+ | |
| .key |---> pid = 4444 | |
+---------+ +-----------+ | |
| .val | | map_elt | | |
+---------+ +-----------+ | |
| .key |---> full key * | |
+---------+ +---------------+ | |
| .fields |--->| .sum (val) |<-+ |
+---------+ | 65523 | |
+---------------+ |
| .offset (key) |<----+
| 0 |
+---------------+
.
.
.
+---------------+
| .sum (val) or |
| .offset (key) |
+---------------+
| .sum (val) or |
| .offset (key) |
+---------------+
Abbreviations used in the diagrams:
hist_data = struct hist_trigger_data
hist_data.fields = struct hist_field
fn = hist_field_fn_t
map_entry = struct tracing_map_entry
map_elt = struct tracing_map_elt
map_elt.fields = struct tracing_map_field
Whenever a new event occurs and it has a hist trigger associated with it, event_hist_trigger() is called. event_hist_trigger() first deals with the key: for each subkey in the key (in the above example, there is just one subkey corresponding to pid), the hist_field that represents that subkey is retrieved from hist_data.fields[] and the hist_field_fn_t fn() associated with that field, along with the field's size and offset, is used to grab that subkey's data from the current trace record.
Once the complete key has been retrieved, it's used to look that key up in the tracing_map. If there's no tracing_map_elt associated with that key, an empty one is claimed and inserted in the map for the new key. In either case, the tracing_map_elt associated with that key is returned.
Once a tracing_map_elt available, hist_trigger_elt_update() is called. As the name implies, this updates the element, which basically means updating the element's fields. There's a tracing_map_field associated with each key and value in the histogram, and each of these correspond to the key and value hist_fields created when the histogram was created. hist_trigger_elt_update() goes through each value hist_field and, as for the keys, uses the hist_field's fn() and size and offset to grab the field's value from the current trace record. Once it has that value, it simply adds that value to that field's continually-updated tracing_map_field.sum member. Some hist_field fn()s, such as for the hitcount, don't actually grab anything from the trace record (the hitcount fn() just increments the counter sum by 1), but the idea is the same.
Once all the values have been updated, hist_trigger_elt_update() is done and returns. Note that there are also tracing_map_fields for each subkey in the key, but hist_trigger_elt_update() doesn't look at them or update anything - those exist only for sorting, which can happen later.
Basic histogram test #
This is a good example to try. It produces 3 value fields and 2 key fields in the output:
# echo 'hist:keys=common_pid,call_site.sym:values=bytes_req,bytes_alloc,hitcount' >> events/kmem/kmalloc/trigger
To see the debug data, cat the kmem/kmalloc's 'hist_debug' file. It will show the trigger info of the histogram it corresponds to, along with the address of the hist_data associated with the histogram, which will become useful in later examples. It then displays the number of total hist_fields associated with the histogram along with a count of how many of those correspond to keys and how many correspond to values.
It then goes on to display details for each field, including the field's flags and the position of each field in the hist_data's fields[] array, which is useful information for verifying that things internally appear correct or not, and which again will become even more useful in further examples:
# cat events/kmem/kmalloc/hist_debug
# event histogram
#
# trigger info: hist:keys=common_pid,call_site.sym:vals=hitcount,bytes_req,bytes_alloc:sort=hitcount:size=2048 [active]
#
hist_data: 000000005e48c9a5
n_vals: 3
n_keys: 2
n_fields: 5
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
VAL: normal u64 value
ftrace_event_field name: bytes_req
type: size_t
size: 8
is_signed: 0
hist_data->fields[2]:
flags:
VAL: normal u64 value
ftrace_event_field name: bytes_alloc
type: size_t
size: 8
is_signed: 0
key fields:
hist_data->fields[3]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: common_pid
type: int
size: 8
is_signed: 1
hist_data->fields[4]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: call_site
type: unsigned long
size: 8
is_signed: 0
The commands below can be used to clean things up for the next test:
# echo '!hist:keys=common_pid,call_site.sym:values=bytes_req,bytes_alloc,hitcount' >> events/kmem/kmalloc/trigger
Variables #
Variables allow data from one hist trigger to be saved by one hist trigger and retrieved by another hist trigger. For example, a trigger on the sched_waking event can capture a timestamp for a particular pid, and later a sched_switch event that switches to that pid event can grab the timestamp and use it to calculate a time delta between the two events:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >>
events/sched/sched_waking/trigger
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0' >>
events/sched/sched_switch/trigger
In terms of the histogram data structures, variables are implemented as another type of hist_field and for a given hist trigger are added to the hist_data.fields[] array just after all the val fields. To distinguish them from the existing key and val fields, they're given a new flag type, HIST_FIELD_FL_VAR (abbreviated FL_VAR) and they also make use of a new .var.idx field member in struct hist_field, which maps them to an index in a new map_elt.vars[] array added to the map_elt specifically designed to store and retrieve variable values. The diagram below shows those new elements and adds a new variable entry, ts0, corresponding to the ts0 variable in the sched_waking trigger above.
sched_waking histogram #
+------------------+
| hist_data |<-------------------------------------------------------+
+------------------+ +-------------------+ |
| .fields[] |-->| val = hitcount | |
+----------------+ +-------------------+ |
| .map | | .size | |
+----------------+ +-----------------+ |
| .offset | |
+-----------------+ |
| .fn() | |
+-----------------+ |
| .flags | |
+-----------------+ |
| .var.idx | |
+-------------------+ |
| var = ts0 | |
+-------------------+ |
| .size | |
+-----------------+ |
| .offset | |
+-----------------+ |
| .fn() | |
+-----------------+ |
| .flags & FL_VAR | |
+-----------------+ |
| .var.idx |----------------------------+-+ |
+-----------------+ | | |
. | | |
. | | |
. | | |
+-------------------+ <--- n_vals | | |
| key = pid | | | |
+-------------------+ | | |
| .size | | | |
+-----------------+ | | |
| .offset | | | |
+-----------------+ | | |
| .fn() | | | |
+-----------------+ | | |
| .flags & FL_KEY | | | |
+-----------------+ | | |
| .var.idx | | | |
+-------------------+ <--- n_fields | | |
| unused | | | |
+-------------------+ | | |
| | | | |
+-----------------+ | | |
| | | | |
+-----------------+ | | |
| | | | |
+-----------------+ | | |
| | | | |
+-----------------+ | | |
| | | | |
+-----------------+ | | |
n_keys = n_fields - n_vals | | |
| | |
This is very similar to the basic case. In the above diagram, we can see a new .flags member has been added to the struct hist_field struct, and a new entry added to hist_data.fields representing the ts0 variable. For a normal val hist_field, .flags is just 0 (modulo modifier flags), but if the value is defined as a variable, the .flags contains a set FL_VAR bit.
As you can see, the ts0 entry's .var.idx member contains the index into the tracing_map_elts' .vars[] array containing variable values. This idx is used whenever the value of the variable is set or read. The map_elt.vars idx assigned to the given variable is assigned and saved in .var.idx by create_tracing_map_fields() after it calls tracing_map_add_var().
Below is a representation of the histogram at run-time, which populates the map, along with correspondence to the above hist_data and hist_field data structures.
The diagram attempts to show the relationship between the hist_data.fields[] and the map_elt.fields[] and map_elt.vars[] with the links drawn between diagrams. For each of the map_elts, you can see that the .fields[] members point to the .sum or .offset of a key or val and the .vars[] members point to the value of a variable. The arrows between the two diagrams show the linkages between those tracing_map members and the field definitions in the corresponding hist_data fields[] members.:
+-----------+ | | |
| hist_data | | | |
+-----------+ | | |
| .fields | | | |
+---------+ +-----------+ | | |
| .map |---->| map_entry | | | |
+---------+ +-----------+ | | |
| .key |---> 0 | | |
+---------+ | | |
| .val |---> NULL | | |
+-----------+ | | |
| map_entry | | | |
+-----------+ | | |
| .key |---> pid = 999 | | |
+---------+ +-----------+ | | |
| .val |--->| map_elt | | | |
+---------+ +-----------+ | | |
. | .key |---> full key * | | |
. +---------+ +---------------+ | | |
. | .fields |--->| .sum (val) | | | |
. +---------+ | 2345 | | | |
. +--| .vars | +---------------+ | | |
. | +---------+ | .offset (key) | | | |
. | | 0 | | | |
. | +---------------+ | | |
. | . | | |
. | . | | |
. | . | | |
. | +---------------+ | | |
. | | .sum (val) or | | | |
. | | .offset (key) | | | |
. | +---------------+ | | |
. | | .sum (val) or | | | |
. | | .offset (key) | | | |
. | +---------------+ | | |
. | | | |
. +---------------->+---------------+ | | |
. | ts0 |<--+ | |
. | 113345679876 | | | |
. +---------------+ | | |
. | unused | | | |
. | | | | |
. +---------------+ | | |
. . | | |
. . | | |
. . | | |
. +---------------+ | | |
. | unused | | | |
. | | | | |
. +---------------+ | | |
. | unused | | | |
. | | | | |
. +---------------+ | | |
. | | |
+-----------+ | | |
| map_entry | | | |
+-----------+ | | |
| .key |---> pid = 4444 | | |
+---------+ +-----------+ | | |
| .val |--->| map_elt | | | |
+---------+ +-----------+ | | |
. | .key |---> full key * | | |
. +---------+ +---------------+ | | |
. | .fields |--->| .sum (val) | | | |
+---------+ | 2345 | | | |
+--| .vars | +---------------+ | | |
| +---------+ | .offset (key) | | | |
| | 0 | | | |
| +---------------+ | | |
| . | | |
| . | | |
| . | | |
| +---------------+ | | |
| | .sum (val) or | | | |
| | .offset (key) | | | |
| +---------------+ | | |
| | .sum (val) or | | | |
| | .offset (key) | | | |
| +---------------+ | | |
| | | |
| +---------------+ | | |
+---------------->| ts0 |<--+ | |
| 213499240729 | | |
+---------------+ | |
| unused | | |
| | | |
+---------------+ | |
. | |
. | |
. | |
+---------------+ | |
| unused | | |
| | | |
+---------------+ | |
| unused | | |
| | | |
+---------------+ | |
For each used map entry, there's a map_elt pointing to an array of .vars containing the current value of the variables associated with that histogram entry. So in the above, the timestamp associated with pid 999 is 113345679876, and the timestamp variable in the same .var.idx for pid 4444 is 213499240729.
sched_switch histogram #
The sched_switch histogram paired with the above sched_waking histogram is shown below. The most important aspect of the sched_switch histogram is that it references a variable on the sched_waking histogram above.
The histogram diagram is very similar to the others so far displayed, but it adds variable references. You can see the normal hitcount and key fields along with a new wakeup_lat variable implemented in the same way as the sched_waking ts0 variable, but in addition there's an entry with the new FL_VAR_REF (short for HIST_FIELD_FL_VAR_REF) flag.
Associated with the new var ref field are a couple of new hist_field members, var.hist_data and var_ref_idx. For a variable reference, the var.hist_data goes with the var.idx, which together uniquely identify a particular variable on a particular histogram. The var_ref_idx is just the index into the var_ref_vals[] array that caches the values of each variable whenever a hist trigger is updated. Those resulting values are then finally accessed by other code such as trace action code that uses the var_ref_idx values to assign param values.
The diagram below describes the situation for the sched_switch histogram referred to before:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0' >>
events/sched/sched_switch/trigger
| |
+------------------+ | |
| hist_data | | |
+------------------+ +-----------------------+ | |
| .fields[] |-->| val = hitcount | | |
+----------------+ +-----------------------+ | |
| .map | | .size | | |
+----------------+ +---------------------+ | |
+--| .var_refs[] | | .offset | | |
| +----------------+ +---------------------+ | |
| | .fn() | | |
| var_ref_vals[] +---------------------+ | |
| +-------------+ | .flags | | |
| | $ts0 |<---+ +---------------------+ | |
| +-------------+ | | .var.idx | | |
| | | | +---------------------+ | |
| +-------------+ | | .var.hist_data | | |
| | | | +---------------------+ | |
| +-------------+ | | .var_ref_idx | | |
| | | | +-----------------------+ | |
| +-------------+ | | var = wakeup_lat | | |
| . | +-----------------------+ | |
| . | | .size | | |
| . | +---------------------+ | |
| +-------------+ | | .offset | | |
| | | | +---------------------+ | |
| +-------------+ | | .fn() | | |
| | | | +---------------------+ | |
| +-------------+ | | .flags & FL_VAR | | |
| | +---------------------+ | |
| | | .var.idx | | |
| | +---------------------+ | |
| | | .var.hist_data | | |
| | +---------------------+ | |
| | | .var_ref_idx | | |
| | +---------------------+ | |
| | . | |
| | . | |
| | . | |
| | +-----------------------+ <--- n_vals | |
| | | key = pid | | |
| | +-----------------------+ | |
| | | .size | | |
| | +---------------------+ | |
| | | .offset | | |
| | +---------------------+ | |
| | | .fn() | | |
| | +---------------------+ | |
| | | .flags | | |
| | +---------------------+ | |
| | | .var.idx | | |
| | +-----------------------+ <--- n_fields | |
| | | unused | | |
| | +-----------------------+ | |
| | | | | |
| | +---------------------+ | |
| | | | | |
| | +---------------------+ | |
| | | | | |
| | +---------------------+ | |
| | | | | |
| | +---------------------+ | |
| | | | | |
| | +---------------------+ | |
| | n_keys = n_fields - n_vals | |
| | | |
| | | |
| | +-----------------------+ | |
+---------------------->| var_ref = $ts0 | | |
| +-----------------------+ | |
| | .size | | |
| +---------------------+ | |
| | .offset | | |
| +---------------------+ | |
| | .fn() | | |
| +---------------------+ | |
| | .flags & FL_VAR_REF | | |
| +---------------------+ | |
| | .var.idx |--------------------------+ |
| +---------------------+ |
| | .var.hist_data |----------------------------+
| +---------------------+
+---| .var_ref_idx |
+---------------------+
Abbreviations used in the diagrams:
hist_data = struct hist_trigger_data
hist_data.fields = struct hist_field
fn = hist_field_fn_t
FL_KEY = HIST_FIELD_FL_KEY
FL_VAR = HIST_FIELD_FL_VAR
FL_VAR_REF = HIST_FIELD_FL_VAR_REF
When a hist trigger makes use of a variable, a new hist_field is created with flag HIST_FIELD_FL_VAR_REF. For a VAR_REF field, the var.idx and var.hist_data take the same values as the referenced variable, as well as the referenced variable's size, type, and is_signed values. The VAR_REF field's .name is set to the name of the variable it references. If a variable reference was created using the explicit system.event.$var_ref notation, the hist_field's system and event_name variables are also set.
So, in order to handle an event for the sched_switch histogram, because we have a reference to a variable on another histogram, we need to resolve all variable references first. This is done via the resolve_var_refs() calls made from event_hist_trigger(). What this does is grabs the var_refs[] array from the hist_data representing the sched_switch histogram. For each one of those, the referenced variable's var.hist_data along with the current key is used to look up the corresponding tracing_map_elt in that histogram. Once found, the referenced variable's var.idx is used to look up the variable's value using tracing_map_read_var(elt, var.idx), which yields the value of the variable for that element, ts0 in the case above. Note that both the hist_fields representing both the variable and the variable reference have the same var.idx, so this is straightforward.
Variable and variable reference test #
This example creates a variable on the sched_waking event, ts0, and uses it in the sched_switch trigger. The sched_switch trigger also creates its own variable, wakeup_lat, but nothing yet uses it:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0' >> events/sched/sched_switch/trigger
Looking at the sched_waking 'hist_debug' output, in addition to the normal key and value hist_fields, in the val fields section we see a field with the HIST_FIELD_FL_VAR flag, which indicates that that field represents a variable. Note that in addition to the variable name, contained in the var.name field, it includes the var.idx, which is the index into the tracing_map_elt.vars[] array of the actual variable location. Note also that the output shows that variables live in the same part of the hist_data->fields[] array as normal values:
# cat events/sched/sched_waking/hist_debug
# event histogram
#
# trigger info: hist:keys=pid:vals=hitcount:ts0=common_timestamp.usecs:sort=hitcount:size=2048:clock=global [active]
#
hist_data: 000000009536f554
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: ts0
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 8
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: pid
type: pid_t
size: 8
is_signed: 1
Moving on to the sched_switch trigger hist_debug output, in addition to the unused wakeup_lat variable, we see a new section displaying variable references. Variable references are displayed in a separate section because in addition to being logically separate from variables and values, they actually live in a separate hist_data array, var_refs[].
In this example, the sched_switch trigger has a reference to a variable on the sched_waking trigger, $ts0. Looking at the details, we can see that the var.hist_data value of the referenced variable matches the previously displayed sched_waking trigger, and the var.idx value matches the previously displayed var.idx value for that variable. Also displayed is the var_ref_idx value for that variable reference, which is where the value for that variable is cached for use when the trigger is invoked:
# cat events/sched/sched_switch/hist_debug
# event histogram
#
# trigger info: hist:keys=next_pid:vals=hitcount:wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global [active]
#
hist_data: 00000000f4ee8006
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 0
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: next_pid
type: pid_t
size: 8
is_signed: 1
variable reference fields:
hist_data->var_refs[0]:
flags:
HIST_FIELD_FL_VAR_REF
name: ts0
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 000000009536f554
var_ref_idx (into hist_data->var_refs[]): 0
type: u64
size: 8
is_signed: 0
The commands below can be used to clean things up for the next test:
# echo '!hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0' >> events/sched/sched_switch/trigger
# echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
Actions and Handlers #
Adding onto the previous example, we will now do something with that wakeup_lat variable, namely send it and another field as a synthetic event.
The onmatch() action below basically says that whenever we have a sched_switch event, if we have a matching sched_waking event, in this case if we have a pid in the sched_waking histogram that matches the next_pid field on this sched_switch event, we retrieve the variables specified in the wakeup_latency() trace action, and use them to generate a new wakeup_latency event into the trace stream.
Note that the way the trace handlers such as wakeup_latency() (which could equivalently be written trace(wakeup_latency,$wakeup_lat,next_pid) are implemented, the parameters specified to the trace handler must be variables. In this case, $wakeup_lat is obviously a variable, but next_pid isn't, since it's just naming a field in the sched_switch trace event. Since this is something that almost every trace() and save() action does, a special shortcut is implemented to allow field names to be used directly in those cases. How it works is that under the covers, a temporary variable is created for the named field, and this variable is what is actually passed to the trace handler. In the code and documentation, this type of variable is called a 'field variable'.
Fields on other trace event's histograms can be used as well. In that case we have to generate a new histogram and an unfortunately named 'synthetic_field' (the use of synthetic here has nothing to do with synthetic events) and use that special histogram field as a variable.
The diagram below illustrates the new elements described above in the context of the sched_switch histogram using the onmatch() handler and the trace() action.
First, we define the wakeup_latency synthetic event:
# echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events
Next, the sched_waking hist trigger as before:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >>
events/sched/sched_waking/trigger
Finally, we create a hist trigger on the sched_switch event that generates a wakeup_latency() trace event. In this case we pass next_pid into the wakeup_latency synthetic event invocation, which means it will be automatically converted into a field variable:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid)' >>
/sys/kernel/tracing/events/sched/sched_switch/trigger
The diagram for the sched_switch event is similar to previous examples but shows the additional field_vars[] array for hist_data and shows the linkages between the field_vars and the variables and references created to implement the field variables. The details are discussed below:
+------------------+
| hist_data |
+------------------+ +-----------------------+
| .fields[] |-->| val = hitcount |
+----------------+ +-----------------------+
| .map | | .size |
+----------------+ +---------------------+
+---| .field_vars[] | | .offset |
| +----------------+ +---------------------+
|+--| .var_refs[] | | .offset |
|| +----------------+ +---------------------+
|| | .fn() |
|| var_ref_vals[] +---------------------+
|| +-------------+ | .flags |
|| | $ts0 |<---+ +---------------------+
|| +-------------+ | | .var.idx |
|| | $next_pid |<-+ | +---------------------+
|| +-------------+ | | | .var.hist_data |
||+>| $wakeup_lat | | | +---------------------+
||| +-------------+ | | | .var_ref_idx |
||| | | | | +-----------------------+
||| +-------------+ | | | var = wakeup_lat |
||| . | | +-----------------------+
||| . | | | .size |
||| . | | +---------------------+
||| +-------------+ | | | .offset |
||| | | | | +---------------------+
||| +-------------+ | | | .fn() |
||| | | | | +---------------------+
||| +-------------+ | | | .flags & FL_VAR |
||| | | +---------------------+
||| | | | .var.idx |
||| | | +---------------------+
||| | | | .var.hist_data |
||| | | +---------------------+
||| | | | .var_ref_idx |
||| | | +---------------------+
||| | | .
||| | | .
||| | | .
||| | | .
||| +--------------+ | | .
+-->| field_var | | | .
|| +--------------+ | | .
|| | var | | | .
|| +------------+ | | .
|| | val | | | .
|| +--------------+ | | .
|| | field_var | | | .
|| +--------------+ | | .
|| | var | | | .
|| +------------+ | | .
|| | val | | | .
|| +------------+ | | .
|| . | | .
|| . | | .
|| . | | +-----------------------+ <--- n_vals
|| +--------------+ | | | key = pid |
|| | field_var | | | +-----------------------+
|| +--------------+ | | | .size |
|| | var |--+| +---------------------+
|| +------------+ ||| | .offset |
|| | val |-+|| +---------------------+
|| +------------+ ||| | .fn() |
|| ||| +---------------------+
|| ||| | .flags |
|| ||| +---------------------+
|| ||| | .var.idx |
|| ||| +---------------------+ <--- n_fields
|| |||
|| ||| n_keys = n_fields - n_vals
|| ||| +-----------------------+
|| |+->| var = next_pid |
|| | | +-----------------------+
|| | | | .size |
|| | | +---------------------+
|| | | | .offset |
|| | | +---------------------+
|| | | | .flags & FL_VAR |
|| | | +---------------------+
|| | | | .var.idx |
|| | | +---------------------+
|| | | | .var.hist_data |
|| | | +-----------------------+
|| +-->| val for next_pid |
|| | | +-----------------------+
|| | | | .size |
|| | | +---------------------+
|| | | | .offset |
|| | | +---------------------+
|| | | | .fn() |
|| | | +---------------------+
|| | | | .flags |
|| | | +---------------------+
|| | | | |
|| | | +---------------------+
|| | |
|| | |
|| | | +-----------------------+
+|------------------|-|>| var_ref = $ts0 |
| | | +-----------------------+
| | | | .size |
| | | +---------------------+
| | | | .offset |
| | | +---------------------+
| | | | .fn() |
| | | +---------------------+
| | | | .flags & FL_VAR_REF |
| | | +---------------------+
| | +---| .var_ref_idx |
| | +-----------------------+
| | | var_ref = $next_pid |
| | +-----------------------+
| | | .size |
| | +---------------------+
| | | .offset |
| | +---------------------+
| | | .fn() |
| | +---------------------+
| | | .flags & FL_VAR_REF |
| | +---------------------+
| +-----| .var_ref_idx |
| +-----------------------+
| | var_ref = $wakeup_lat |
| +-----------------------+
| | .size |
| +---------------------+
| | .offset |
| +---------------------+
| | .fn() |
| +---------------------+
| | .flags & FL_VAR_REF |
| +---------------------+
+------------------------| .var_ref_idx |
+---------------------+
As you can see, for a field variable, two hist_fields are created: one representing the variable, in this case next_pid, and one to actually get the value of the field from the trace stream, like a normal val field does. These are created separately from normal variable creation and are saved in the hist_data->field_vars[] array. See below for how these are used. In addition, a reference hist_field is also created, which is needed to reference the field variables such as $next_pid variable in the trace() action.
Note that $wakeup_lat is also a variable reference, referencing the value of the expression common_timestamp-$ts0, and so also needs to have a hist field entry representing that reference created.
When hist_trigger_elt_update() is called to get the normal key and value fields, it also calls update_field_vars(), which goes through each field_var created for the histogram, and available from hist_data->field_vars and calls val->fn() to get the data from the current trace record, and then uses the var's var.idx to set the variable at the var.idx offset in the appropriate tracing_map_elt's variable at elt->vars[var.idx].
Once all the variables have been updated, resolve_var_refs() can be called from event_hist_trigger(), and not only can our $ts0 and $next_pid references be resolved but the $wakeup_lat reference as well. At this point, the trace() action can simply access the values assembled in the var_ref_vals[] array and generate the trace event.
The same process occurs for the field variables associated with the save() action.
Abbreviations used in the diagram:
hist_data = struct hist_trigger_data
hist_data.fields = struct hist_field
field_var = struct field_var
fn = hist_field_fn_t
FL_KEY = HIST_FIELD_FL_KEY
FL_VAR = HIST_FIELD_FL_VAR
FL_VAR_REF = HIST_FIELD_FL_VAR_REF
trace() action field variable test #
This example adds to the previous test example by finally making use of the wakeup_lat variable, but in addition also creates a couple of field variables that then are all passed to the wakeup_latency() trace action via the onmatch() handler.
First, we create the wakeup_latency synthetic event:
# echo 'wakeup_latency u64 lat; pid_t pid; char comm[16]' >> synthetic_events
Next, the sched_waking trigger from previous examples:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
Finally, as in the previous test example, we calculate and assign the wakeup latency using the $ts0 reference from the sched_waking trigger to the wakeup_lat variable, and finally use it along with a couple sched_switch event fields, next_pid and next_comm, to generate a wakeup_latency trace event. The next_pid and next_comm event fields are automatically converted into field variables for this purpose:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm)' >> /sys/kernel/tracing/events/sched/sched_switch/trigger
The sched_waking hist_debug output shows the same data as in the previous test example:
# cat events/sched/sched_waking/hist_debug
# event histogram
#
# trigger info: hist:keys=pid:vals=hitcount:ts0=common_timestamp.usecs:sort=hitcount:size=2048:clock=global [active]
#
hist_data: 00000000d60ff61f
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: ts0
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 8
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: pid
type: pid_t
size: 8
is_signed: 1
The sched_switch hist_debug output shows the same key and value fields as in the previous test example - note that wakeup_lat is still in the val fields section, but that the new field variables are not there - although the field variables are variables, they're held separately in the hist_data's field_vars[] array. Although the field variables and the normal variables are located in separate places, you can see that the actual variable locations for those variables in the tracing_map_elt.vars[] do have increasing indices as expected: wakeup_lat takes the var.idx = 0 slot, while the field variables for next_pid and next_comm have values var.idx = 1, and var.idx = 2. Note also that those are the same values displayed for the variable references corresponding to those variables in the variable reference fields section. Since there are two triggers and thus two hist_data addresses, those addresses also need to be accounted for when doing the matching - you can see that the first variable refers to the 0 var.idx on the previous hist trigger (see the hist_data address associated with that trigger), while the second variable refers to the 0 var.idx on the sched_switch hist trigger, as do all the remaining variable references.
Finally, the action tracking variables section just shows the system and event name for the onmatch() handler:
# cat events/sched/sched_switch/hist_debug
# event histogram
#
# trigger info: hist:keys=next_pid:vals=hitcount:wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm) [active]
#
hist_data: 0000000008f551b7
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 0
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: next_pid
type: pid_t
size: 8
is_signed: 1
variable reference fields:
hist_data->var_refs[0]:
flags:
HIST_FIELD_FL_VAR_REF
name: ts0
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 00000000d60ff61f
var_ref_idx (into hist_data->var_refs[]): 0
type: u64
size: 8
is_signed: 0
hist_data->var_refs[1]:
flags:
HIST_FIELD_FL_VAR_REF
name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 0000000008f551b7
var_ref_idx (into hist_data->var_refs[]): 1
type: u64
size: 0
is_signed: 0
hist_data->var_refs[2]:
flags:
HIST_FIELD_FL_VAR_REF
name: next_pid
var.idx (into tracing_map_elt.vars[]): 1
var.hist_data: 0000000008f551b7
var_ref_idx (into hist_data->var_refs[]): 2
type: pid_t
size: 4
is_signed: 0
hist_data->var_refs[3]:
flags:
HIST_FIELD_FL_VAR_REF
name: next_comm
var.idx (into tracing_map_elt.vars[]): 2
var.hist_data: 0000000008f551b7
var_ref_idx (into hist_data->var_refs[]): 3
type: char[16]
size: 256
is_signed: 0
field variables:
hist_data->field_vars[0]:
field_vars[0].var:
flags:
HIST_FIELD_FL_VAR
var.name: next_pid
var.idx (into tracing_map_elt.vars[]): 1
field_vars[0].val:
ftrace_event_field name: next_pid
type: pid_t
size: 4
is_signed: 1
hist_data->field_vars[1]:
field_vars[1].var:
flags:
HIST_FIELD_FL_VAR
var.name: next_comm
var.idx (into tracing_map_elt.vars[]): 2
field_vars[1].val:
ftrace_event_field name: next_comm
type: char[16]
size: 256
is_signed: 0
action tracking variables (for onmax()/onchange()/onmatch()):
hist_data->actions[0].match_data.event_system: sched
hist_data->actions[0].match_data.event: sched_waking
The commands below can be used to clean things up for the next test:
# echo '!hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm)' >> /sys/kernel/tracing/events/sched/sched_switch/trigger
# echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
# echo '!wakeup_latency u64 lat; pid_t pid; char comm[16]' >> synthetic_events
action_data and the trace() action #
As mentioned above, when the trace() action generates a synthetic event, all the parameters to the synthetic event either already are variables or are converted into variables (via field variables), and finally all those variable values are collected via references to them into a var_ref_vals[] array.
The values in the var_ref_vals[] array, however, don't necessarily follow the same ordering as the synthetic event params. To address that, struct action_data contains another array, var_ref_idx[] that maps the trace action params to the var_ref_vals[] values. Below is a diagram illustrating that for the wakeup_latency() synthetic event:
+------------------+ wakeup_latency()
| action_data | event params var_ref_vals[]
+------------------+ +-----------------+ +-----------------+
| .var_ref_idx[] |--->| $wakeup_lat idx |---+ | |
+----------------+ +-----------------+ | +-----------------+
| .synth_event | | $next_pid idx |---|-+ | $wakeup_lat val |
+----------------+ +-----------------+ | | +-----------------+
. | +->| $next_pid val |
. | +-----------------+
. | .
+-----------------+ | .
| | | .
+-----------------+ | +-----------------+
+--->| $wakeup_lat val |
+-----------------+
Basically, how this ends up getting used in the synthetic event probe function, trace_event_raw_event_synth(), is as follows:
for each field i in .synth_event
val_idx = .var_ref_idx[i]
val = var_ref_vals[val_idx]
action_data and the onXXX() handlers #
The hist trigger onXXX() actions other than onmatch(), such as onmax() and onchange(), also make use of and internally create hidden variables. This information is contained in the action_data.track_data struct, and is also visible in the hist_debug output as will be described in the example below.
Typically, the onmax() or onchange() handlers are used in conjunction with the save() and snapshot() actions. For example:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm)' >>
/sys/kernel/tracing/events/sched/sched_switch/trigger
or:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
onmax($wakeup_lat).snapshot()' >>
/sys/kernel/tracing/events/sched/sched_switch/trigger
save() action field variable test #
For this example, instead of generating a synthetic event, the save() action is used to save field values whenever an onmax() handler detects that a new max latency has been hit. As in the previous example, the values being saved are also field values, but in this case, are kept in a separate hist_data array named save_vars[].
As in previous test examples, we set up the sched_waking trigger:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
In this case, however, we set up the sched_switch trigger to save some sched_switch field values whenever we hit a new maximum latency. For both the onmax() handler and save() action, variables will be created, which we can use the hist_debug files to examine:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm)' >> events/sched/sched_switch/trigger
The sched_waking hist_debug output shows the same data as in the previous test examples:
# cat events/sched/sched_waking/hist_debug
#
# trigger info: hist:keys=pid:vals=hitcount:ts0=common_timestamp.usecs:sort=hitcount:size=2048:clock=global [active]
#
hist_data: 00000000e6290f48
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: ts0
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 8
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: pid
type: pid_t
size: 8
is_signed: 1
The output of the sched_switch trigger shows the same val and key values as before, but also shows a couple new sections.
First, the action tracking variables section now shows the actions[].track_data information describing the special tracking variables and references used to track, in this case, the running maximum value. The actions[].track_data.var_ref member contains the reference to the variable being tracked, in this case the $wakeup_lat variable. In order to perform the onmax() handler function, there also needs to be a variable that tracks the current maximum by getting updated whenever a new maximum is hit. In this case, we can see that an auto-generated variable named ' __max' has been created and is visible in the actions[].track_data.track_var variable.
Finally, in the new 'save action variables' section, we can see that the 4 params to the save() function have resulted in 4 field variables being created for the purposes of saving the values of the named fields when the max is hit. These variables are kept in a separate save_vars[] array off of hist_data, so are displayed in a separate section:
# cat events/sched/sched_switch/hist_debug
# event histogram
#
# trigger info: hist:keys=next_pid:vals=hitcount:wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global:onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) [active]
#
hist_data: 0000000057bcd28d
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 0
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: next_pid
type: pid_t
size: 8
is_signed: 1
variable reference fields:
hist_data->var_refs[0]:
flags:
HIST_FIELD_FL_VAR_REF
name: ts0
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 00000000e6290f48
var_ref_idx (into hist_data->var_refs[]): 0
type: u64
size: 8
is_signed: 0
hist_data->var_refs[1]:
flags:
HIST_FIELD_FL_VAR_REF
name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 0000000057bcd28d
var_ref_idx (into hist_data->var_refs[]): 1
type: u64
size: 0
is_signed: 0
action tracking variables (for onmax()/onchange()/onmatch()):
hist_data->actions[0].track_data.var_ref:
flags:
HIST_FIELD_FL_VAR_REF
name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 0000000057bcd28d
var_ref_idx (into hist_data->var_refs[]): 1
type: u64
size: 0
is_signed: 0
hist_data->actions[0].track_data.track_var:
flags:
HIST_FIELD_FL_VAR
var.name: __max
var.idx (into tracing_map_elt.vars[]): 1
type: u64
size: 8
is_signed: 0
save action variables (save() params):
hist_data->save_vars[0]:
save_vars[0].var:
flags:
HIST_FIELD_FL_VAR
var.name: next_comm
var.idx (into tracing_map_elt.vars[]): 2
save_vars[0].val:
ftrace_event_field name: next_comm
type: char[16]
size: 256
is_signed: 0
hist_data->save_vars[1]:
save_vars[1].var:
flags:
HIST_FIELD_FL_VAR
var.name: prev_pid
var.idx (into tracing_map_elt.vars[]): 3
save_vars[1].val:
ftrace_event_field name: prev_pid
type: pid_t
size: 4
is_signed: 1
hist_data->save_vars[2]:
save_vars[2].var:
flags:
HIST_FIELD_FL_VAR
var.name: prev_prio
var.idx (into tracing_map_elt.vars[]): 4
save_vars[2].val:
ftrace_event_field name: prev_prio
type: int
size: 4
is_signed: 1
hist_data->save_vars[3]:
save_vars[3].var:
flags:
HIST_FIELD_FL_VAR
var.name: prev_comm
var.idx (into tracing_map_elt.vars[]): 5
save_vars[3].val:
ftrace_event_field name: prev_comm
type: char[16]
size: 256
is_signed: 0
The commands below can be used to clean things up for the next test:
# echo '!hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm)' >> events/sched/sched_switch/trigger
# echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
A couple special cases #
While the above covers the basics of the histogram internals, there are a couple of special cases that should be discussed, since they tend to create even more confusion. Those are field variables on other histograms, and aliases, both described below through example tests using the hist_debug files.
Test of field variables on other histograms #
This example is similar to the previous examples, but in this case, the sched_switch trigger references a hist trigger field on another event, namely the sched_waking event. In order to accomplish this, a field variable is created for the other event, but since an existing histogram can't be used, as existing histograms are immutable, a new histogram with a matching variable is created and used, and we'll see that reflected in the hist_debug output shown below.
First, we create the wakeup_latency synthetic event. Note the addition of the prio field:
# echo 'wakeup_latency u64 lat; pid_t pid; int prio' >> synthetic_events
As in previous test examples, we set up the sched_waking trigger:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
Here we set up a hist trigger on sched_switch to send a wakeup_latency event using an onmatch handler naming the sched_waking event. Note that the third param being passed to the wakeup_latency() is prio, which is a field name that needs to have a field variable created for it. There isn't however any prio field on the sched_switch event so it would seem that it wouldn't be possible to create a field variable for it. The matching sched_waking event does have a prio field, so it should be possible to make use of it for this purpose. The problem with that is that it's not currently possible to define a new variable on an existing histogram, so it's not possible to add a new prio field variable to the existing sched_waking histogram. It is however possible to create an additional new 'matching' sched_waking histogram for the same event, meaning that it uses the same key and filters, and define the new prio field variable on that.
Here's the sched_switch trigger:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,prio)' >> events/sched/sched_switch/trigger
And here's the output of the hist_debug information for the sched_waking hist trigger. Note that there are two histograms displayed in the output: the first is the normal sched_waking histogram we've seen in the previous examples, and the second is the special histogram we created to provide the prio field variable.
Looking at the second histogram below, we see a variable with the name synthetic_prio. This is the field variable created for the prio field on that sched_waking histogram:
# cat events/sched/sched_waking/hist_debug
# event histogram
#
# trigger info: hist:keys=pid:vals=hitcount:ts0=common_timestamp.usecs:sort=hitcount:size=2048:clock=global [active]
#
hist_data: 00000000349570e4
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: ts0
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 8
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: pid
type: pid_t
size: 8
is_signed: 1
# event histogram
#
# trigger info: hist:keys=pid:vals=hitcount:synthetic_prio=prio:sort=hitcount:size=2048 [active]
#
hist_data: 000000006920cf38
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
ftrace_event_field name: prio
var.name: synthetic_prio
var.idx (into tracing_map_elt.vars[]): 0
type: int
size: 4
is_signed: 1
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: pid
type: pid_t
size: 8
is_signed: 1
Looking at the sched_switch histogram below, we can see a reference to the synthetic_prio variable on sched_waking, and looking at the associated hist_data address we see that it is indeed associated with the new histogram. Note also that the other references are to a normal variable, wakeup_lat, and to a normal field variable, next_pid, the details of which are in the field variables section:
# cat events/sched/sched_switch/hist_debug
# event histogram
#
# trigger info: hist:keys=next_pid:vals=hitcount:wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,prio) [active]
#
hist_data: 00000000a73b67df
n_vals: 2
n_keys: 1
n_fields: 3
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
var.name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
type: u64
size: 0
is_signed: 0
key fields:
hist_data->fields[2]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: next_pid
type: pid_t
size: 8
is_signed: 1
variable reference fields:
hist_data->var_refs[0]:
flags:
HIST_FIELD_FL_VAR_REF
name: ts0
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 00000000349570e4
var_ref_idx (into hist_data->var_refs[]): 0
type: u64
size: 8
is_signed: 0
hist_data->var_refs[1]:
flags:
HIST_FIELD_FL_VAR_REF
name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 00000000a73b67df
var_ref_idx (into hist_data->var_refs[]): 1
type: u64
size: 0
is_signed: 0
hist_data->var_refs[2]:
flags:
HIST_FIELD_FL_VAR_REF
name: next_pid
var.idx (into tracing_map_elt.vars[]): 1
var.hist_data: 00000000a73b67df
var_ref_idx (into hist_data->var_refs[]): 2
type: pid_t
size: 4
is_signed: 0
hist_data->var_refs[3]:
flags:
HIST_FIELD_FL_VAR_REF
name: synthetic_prio
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 000000006920cf38
var_ref_idx (into hist_data->var_refs[]): 3
type: int
size: 4
is_signed: 1
field variables:
hist_data->field_vars[0]:
field_vars[0].var:
flags:
HIST_FIELD_FL_VAR
var.name: next_pid
var.idx (into tracing_map_elt.vars[]): 1
field_vars[0].val:
ftrace_event_field name: next_pid
type: pid_t
size: 4
is_signed: 1
action tracking variables (for onmax()/onchange()/onmatch()):
hist_data->actions[0].match_data.event_system: sched
hist_data->actions[0].match_data.event: sched_waking
The commands below can be used to clean things up for the next test:
# echo '!hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,prio)' >> events/sched/sched_switch/trigger
# echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
# echo '!wakeup_latency u64 lat; pid_t pid; int prio' >> synthetic_events
Alias test #
This example is very similar to previous examples, but demonstrates the alias flag.
First, we create the wakeup_latency synthetic event:
# echo 'wakeup_latency u64 lat; pid_t pid; char comm[16]' >> synthetic_events
Next, we create a sched_waking trigger similar to previous examples, but in this case we save the pid in the waking_pid variable:
# echo 'hist:keys=pid:waking_pid=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
For the sched_switch trigger, instead of using $waking_pid directly in the wakeup_latency synthetic event invocation, we create an alias of $waking_pid named $woken_pid, and use that in the synthetic event invocation instead:
# echo 'hist:keys=next_pid:woken_pid=$waking_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,$woken_pid,next_comm)' >> events/sched/sched_switch/trigger
Looking at the sched_waking hist_debug output, in addition to the normal fields, we can see the waking_pid variable:
# cat events/sched/sched_waking/hist_debug
# event histogram
#
# trigger info: hist:keys=pid:vals=hitcount:waking_pid=pid,ts0=common_timestamp.usecs:sort=hitcount:size=2048:clock=global [active]
#
hist_data: 00000000a250528c
n_vals: 3
n_keys: 1
n_fields: 4
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
ftrace_event_field name: pid
var.name: waking_pid
var.idx (into tracing_map_elt.vars[]): 0
type: pid_t
size: 4
is_signed: 1
hist_data->fields[2]:
flags:
HIST_FIELD_FL_VAR
var.name: ts0
var.idx (into tracing_map_elt.vars[]): 1
type: u64
size: 8
is_signed: 0
key fields:
hist_data->fields[3]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: pid
type: pid_t
size: 8
is_signed: 1
The sched_switch hist_debug output shows that a variable named woken_pid has been created but that it also has the HIST_FIELD_FL_ALIAS flag set. It also has the HIST_FIELD_FL_VAR flag set, which is why it appears in the val field section.
Despite that implementation detail, an alias variable is actually more like a variable reference; in fact it can be thought of as a reference to a reference. The implementation copies the var_ref->fn() from the variable reference being referenced, in this case, the waking_pid fn(), which is hist_field_var_ref() and makes that the fn() of the alias. The hist_field_var_ref() fn() requires the var_ref_idx of the variable reference it's using, so waking_pid's var_ref_idx is also copied to the alias. The end result is that when the value of alias is retrieved, in the end it just does the same thing the original reference would have done and retrieves the same value from the var_ref_vals[] array. You can verify this in the output by noting that the var_ref_idx of the alias, in this case woken_pid, is the same as the var_ref_idx of the reference, waking_pid, in the variable reference fields section.
Additionally, once it gets that value, since it is also a variable, it then saves that value into its var.idx. So the var.idx of the woken_pid alias is 0, which it fills with the value from var_ref_idx 0 when its fn() is called to update itself. You'll also notice that there's a woken_pid var_ref in the variable refs section. That is the reference to the woken_pid alias variable, and you can see that it retrieves the value from the same var.idx as the woken_pid alias, 0, and then in turn saves that value in its own var_ref_idx slot, 3, and the value at this position is finally what gets assigned to the $woken_pid slot in the trace event invocation:
# cat events/sched/sched_switch/hist_debug
# event histogram
#
# trigger info: hist:keys=next_pid:vals=hitcount:woken_pid=$waking_pid,wakeup_lat=common_timestamp.usecs-$ts0:sort=hitcount:size=2048:clock=global:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,$woken_pid,next_comm) [active]
#
hist_data: 0000000055d65ed0
n_vals: 3
n_keys: 1
n_fields: 4
val fields:
hist_data->fields[0]:
flags:
VAL: HIST_FIELD_FL_HITCOUNT
type: u64
size: 8
is_signed: 0
hist_data->fields[1]:
flags:
HIST_FIELD_FL_VAR
HIST_FIELD_FL_ALIAS
var.name: woken_pid
var.idx (into tracing_map_elt.vars[]): 0
var_ref_idx (into hist_data->var_refs[]): 0
type: pid_t
size: 4
is_signed: 1
hist_data->fields[2]:
flags:
HIST_FIELD_FL_VAR
var.name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 1
type: u64
size: 0
is_signed: 0
key fields:
hist_data->fields[3]:
flags:
HIST_FIELD_FL_KEY
ftrace_event_field name: next_pid
type: pid_t
size: 8
is_signed: 1
variable reference fields:
hist_data->var_refs[0]:
flags:
HIST_FIELD_FL_VAR_REF
name: waking_pid
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 00000000a250528c
var_ref_idx (into hist_data->var_refs[]): 0
type: pid_t
size: 4
is_signed: 1
hist_data->var_refs[1]:
flags:
HIST_FIELD_FL_VAR_REF
name: ts0
var.idx (into tracing_map_elt.vars[]): 1
var.hist_data: 00000000a250528c
var_ref_idx (into hist_data->var_refs[]): 1
type: u64
size: 8
is_signed: 0
hist_data->var_refs[2]:
flags:
HIST_FIELD_FL_VAR_REF
name: wakeup_lat
var.idx (into tracing_map_elt.vars[]): 1
var.hist_data: 0000000055d65ed0
var_ref_idx (into hist_data->var_refs[]): 2
type: u64
size: 0
is_signed: 0
hist_data->var_refs[3]:
flags:
HIST_FIELD_FL_VAR_REF
name: woken_pid
var.idx (into tracing_map_elt.vars[]): 0
var.hist_data: 0000000055d65ed0
var_ref_idx (into hist_data->var_refs[]): 3
type: pid_t
size: 4
is_signed: 1
hist_data->var_refs[4]:
flags:
HIST_FIELD_FL_VAR_REF
name: next_comm
var.idx (into tracing_map_elt.vars[]): 2
var.hist_data: 0000000055d65ed0
var_ref_idx (into hist_data->var_refs[]): 4
type: char[16]
size: 256
is_signed: 0
field variables:
hist_data->field_vars[0]:
field_vars[0].var:
flags:
HIST_FIELD_FL_VAR
var.name: next_comm
var.idx (into tracing_map_elt.vars[]): 2
field_vars[0].val:
ftrace_event_field name: next_comm
type: char[16]
size: 256
is_signed: 0
action tracking variables (for onmax()/onchange()/onmatch()):
hist_data->actions[0].match_data.event_system: sched
hist_data->actions[0].match_data.event: sched_waking
The commands below can be used to clean things up for the next test:
# echo '!hist:keys=next_pid:woken_pid=$waking_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,$woken_pid,next_comm)' >> events/sched/sched_switch/trigger
# echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
# echo '!wakeup_latency u64 lat; pid_t pid; char comm[16]' >> synthetic_events
Event Histograms
Peios Kernel / Kernel development / Trace
Documentation written by Tom Zanussi
1. Introduction #
Histogram triggers are special event triggers that can be used to aggregate trace event data into histograms. For information on trace events and event triggers, see Documentation/trace/events.rst.
2. Histogram Trigger Command #
A histogram trigger command is an event trigger command that aggregates event hits into a hash table keyed on one or more trace event format fields (or stacktrace) and a set of running totals derived from one or more trace event format fields and/or event counts (hitcount).
The format of a hist trigger is as follows:
hist:keys=<field1[,field2,...]>[:values=<field1[,field2,...]>] [:sort=<field1[,field2,...]>][:size=#entries][:pause][:continue] [:clear][:name=histname1][:nohitcount][:<handler>.<action>] [if <filter>]When a matching event is hit, an entry is added to a hash table using the key(s) and value(s) named. Keys and values correspond to fields in the event's format description. Values must correspond to numeric fields - on an event hit, the value(s) will be added to a sum kept for that field. The special string 'hitcount' can be used in place of an explicit value field - this is simply a count of event hits. If 'values' isn't specified, an implicit 'hitcount' value will be automatically created and used as the only value. Keys can be any field, or the special string 'common_stacktrace', which will use the event's kernel stacktrace as the key. The keywords 'keys' or 'key' can be used to specify keys, and the keywords 'values', 'vals', or 'val' can be used to specify values. Compound keys consisting of up to three fields can be specified by the 'keys' keyword. Hashing a compound key produces a unique entry in the table for each unique combination of component keys, and can be useful for providing more fine-grained summaries of event data. Additionally, sort keys consisting of up to two fields can be specified by the 'sort' keyword. If more than one field is specified, the result will be a 'sort within a sort': the first key is taken to be the primary sort key and the second the secondary key. If a hist trigger is given a name using the 'name' parameter, its histogram data will be shared with other triggers of the same name, and trigger hits will update this common data. Only triggers with 'compatible' fields can be combined in this way; triggers are 'compatible' if the fields named in the trigger share the same number and type of fields and those fields also have the same names. Note that any two events always share the compatible 'hitcount' and 'common_stacktrace' fields and can therefore be combined using those fields, however pointless that may be.
'hist' triggers add a 'hist' file to each event's subdirectory. Reading the 'hist' file for the event will dump the hash table in its entirety to stdout. If there are multiple hist triggers attached to an event, there will be a table for each trigger in the output. The table displayed for a named trigger will be the same as any other instance having the same name. Each printed hash table entry is a simple list of the keys and values comprising the entry; keys are printed first and are delineated by curly braces, and are followed by the set of value fields for the entry. By default, numeric fields are displayed as base-10 integers. This can be modified by appending any of the following modifiers to the field name:
.hex
display a number as a hex value
.sym
display an address as a symbol
.sym-offset
display an address as a symbol and offset
.syscall
display a syscall id as a system call name
.execname
display a common_pid as a program name
.log2
display log2 value rather than raw number
.buckets=size
display grouping of values rather than raw number
.usecs
display a common_timestamp in microseconds
.percent
display a number of percentage value
.graph
display a bar-graph of a value
.stacktrace
display as a stacktrace (must be a long[] type)
Note that in general the semantics of a given field aren't interpreted when applying a modifier to it, but there are some restrictions to be aware of in this regard:
only the 'hex' modifier can be used for values (because values are essentially sums, and the other modifiers don't make sense in that context).
the 'execname' modifier can only be used on a 'common_pid'. The reason for this is that the execname is simply the 'comm' value saved for the 'current' process when an event was triggered, which is the same as the common_pid value saved by the event tracing code. Trying to apply that comm value to other pid values wouldn't be correct, and typically events that care save pid-specific comm fields in the event itself.
A typical usage scenario would be the following to enable a hist trigger, read its current contents, and then turn it off:
# echo 'hist:keys=skbaddr.hex:vals=len' > \ /sys/kernel/tracing/events/net/netif_rx/trigger # cat /sys/kernel/tracing/events/net/netif_rx/hist # echo '!hist:keys=skbaddr.hex:vals=len' > \ /sys/kernel/tracing/events/net/netif_rx/triggerThe trigger file itself can be read to show the details of the currently attached hist trigger. This information is also displayed at the top of the 'hist' file when read.
By default, the size of the hash table is 2048 entries. The 'size' parameter can be used to specify more or fewer than that. The units are in terms of hashtable entries - if a run uses more entries than specified, the results will show the number of 'drops', the number of hits that were ignored. The size should be a power of 2 between 128 and 131072 (any non- power-of-2 number specified will be rounded up).
The 'sort' parameter can be used to specify a value field to sort on. The default if unspecified is 'hitcount' and the default sort order is 'ascending'. To sort in the opposite direction, append .descending' to the sort key.
The 'pause' parameter can be used to pause an existing hist trigger or to start a hist trigger but not log any events until told to do so. 'continue' or 'cont' can be used to start or restart a paused hist trigger.
The 'clear' parameter will clear the contents of a running hist trigger and leave its current paused/active state.
Note that the 'pause', 'cont', and 'clear' parameters should be applied using 'append' shell operator ('>>') if applied to an existing trigger, rather than via the '>' operator, which will cause the trigger to be removed through truncation.
The 'nohitcount' (or NOHC) parameter will suppress display of raw hitcount in the histogram. This option requires at least one value field which is not a 'raw hitcount'. For example, 'hist:...:vals=hitcount:nohitcount' is rejected, but 'hist:...:vals=hitcount.percent:nohitcount' is OK.
-
enable_hist/disable_hist
The enable_hist and disable_hist triggers can be used to have one event conditionally start and stop another event's already-attached hist trigger. Any number of enable_hist and disable_hist triggers can be attached to a given event, allowing that event to kick off and stop aggregations on a host of other events.
The format is very similar to the enable/disable_event triggers:
enable_hist:<system>:<event>[:count] disable_hist:<system>:<event>[:count]Instead of enabling or disabling the tracing of the target event into the trace buffer as the enable/disable_event triggers do, the enable/disable_hist triggers enable or disable the aggregation of the target event into a hash table.
A typical usage scenario for the enable_hist/disable_hist triggers would be to first set up a paused hist trigger on some event, followed by an enable_hist/disable_hist pair that turns the hist aggregation on and off when conditions of interest are hit:
# echo 'hist:keys=skbaddr.hex:vals=len:pause' > \ /sys/kernel/tracing/events/net/netif_receive_skb/trigger # echo 'enable_hist:net:netif_receive_skb if filename==/usr/bin/wget' > \ /sys/kernel/tracing/events/sched/sched_process_exec/trigger # echo 'disable_hist:net:netif_receive_skb if comm==wget' > \ /sys/kernel/tracing/events/sched/sched_process_exit/triggerThe above sets up an initially paused hist trigger which is unpaused and starts aggregating events when a given program is executed, and which stops aggregating when the process exits and the hist trigger is paused again.
The examples below provide a more concrete illustration of the concepts and typical usage patterns discussed above.
2.1. 'special' event fields #
There are a number of 'special event fields' available for use as keys or values in a hist trigger. These look like and behave as if they were actual event fields, but aren't really part of the event's field definition or format file. They are however available for any event, and can be used anywhere an actual event field could be. They are:
common_timestamp
u64
timestamp (from ring buffer) associated with the event, in nanoseconds. May be modified by .usecs to have timestamps interpreted as microseconds.
common_cpu
int
the cpu on which the event occurred.
2.2. Extended error information #
For some error conditions encountered when invoking a hist trigger command, extended error information is available via the tracing/error_log file. See "Error conditions" section in Documentation/trace/ftrace.rst for details.
2.3. 'hist' trigger examples #
The first set of examples creates aggregations using the kmalloc event. The fields that can be used for the hist trigger are listed in the kmalloc event's format file:
# cat /sys/kernel/tracing/events/kmem/kmalloc/format name: kmalloc ID: 374 format: field:unsigned short common_type; offset:0; size:2; signed:0; field:unsigned char common_flags; offset:2; size:1; signed:0; field:unsigned char common_preempt_count; offset:3; size:1; signed:0; field:int common_pid; offset:4; size:4; signed:1; field:unsigned long call_site; offset:8; size:8; signed:0; field:const void * ptr; offset:16; size:8; signed:0; field:size_t bytes_req; offset:24; size:8; signed:0; field:size_t bytes_alloc; offset:32; size:8; signed:0; field:gfp_t gfp_flags; offset:40; size:4; signed:0;We'll start by creating a hist trigger that generates a simple table that lists the total number of bytes requested for each function in the kernel that made one or more calls to kmalloc:
# echo 'hist:key=call_site:val=bytes_req.buckets=32' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerThis tells the tracing system to create a 'hist' trigger using the call_site field of the kmalloc event as the key for the table, which just means that each unique call_site address will have an entry created for it in the table. The 'val=bytes_req' parameter tells the hist trigger that for each unique entry (call_site) in the table, it should keep a running total of the number of bytes requested by that call_site.
We'll let it run for a while and then dump the contents of the 'hist' file in the kmalloc event's subdirectory (for readability, a number of entries have been omitted):
# cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=call_site:vals=bytes_req:sort=hitcount:size=2048 [active] { call_site: 18446744072106379007 } hitcount: 1 bytes_req: 176 { call_site: 18446744071579557049 } hitcount: 1 bytes_req: 1024 { call_site: 18446744071580608289 } hitcount: 1 bytes_req: 16384 { call_site: 18446744071581827654 } hitcount: 1 bytes_req: 24 { call_site: 18446744071580700980 } hitcount: 1 bytes_req: 8 { call_site: 18446744071579359876 } hitcount: 1 bytes_req: 152 { call_site: 18446744071580795365 } hitcount: 3 bytes_req: 144 { call_site: 18446744071581303129 } hitcount: 3 bytes_req: 144 { call_site: 18446744071580713234 } hitcount: 4 bytes_req: 2560 { call_site: 18446744071580933750 } hitcount: 4 bytes_req: 736 . . . { call_site: 18446744072106047046 } hitcount: 69 bytes_req: 5576 { call_site: 18446744071582116407 } hitcount: 73 bytes_req: 2336 { call_site: 18446744072106054684 } hitcount: 136 bytes_req: 140504 { call_site: 18446744072106224230 } hitcount: 136 bytes_req: 19584 { call_site: 18446744072106078074 } hitcount: 153 bytes_req: 2448 { call_site: 18446744072106062406 } hitcount: 153 bytes_req: 36720 { call_site: 18446744071582507929 } hitcount: 153 bytes_req: 37088 { call_site: 18446744072102520590 } hitcount: 273 bytes_req: 10920 { call_site: 18446744071582143559 } hitcount: 358 bytes_req: 716 { call_site: 18446744072106465852 } hitcount: 417 bytes_req: 56712 { call_site: 18446744072102523378 } hitcount: 485 bytes_req: 27160 { call_site: 18446744072099568646 } hitcount: 1676 bytes_req: 33520 Totals: Hits: 4610 Entries: 45 Dropped: 0The output displays a line for each entry, beginning with the key specified in the trigger, followed by the value(s) also specified in the trigger. At the beginning of the output is a line that displays the trigger info, which can also be displayed by reading the 'trigger' file:
# cat /sys/kernel/tracing/events/kmem/kmalloc/trigger hist:keys=call_site:vals=bytes_req:sort=hitcount:size=2048 [active]At the end of the output are a few lines that display the overall totals for the run. The 'Hits' field shows the total number of times the event trigger was hit, the 'Entries' field shows the total number of used entries in the hash table, and the 'Dropped' field shows the number of hits that were dropped because the number of used entries for the run exceeded the maximum number of entries allowed for the table (normally 0, but if not a hint that you may want to increase the size of the table using the 'size' parameter).
Notice in the above output that there's an extra field, 'hitcount', which wasn't specified in the trigger. Also notice that in the trigger info output, there's a parameter, 'sort=hitcount', which wasn't specified in the trigger either. The reason for that is that every trigger implicitly keeps a count of the total number of hits attributed to a given entry, called the 'hitcount'. That hitcount information is explicitly displayed in the output, and in the absence of a user-specified sort parameter, is used as the default sort field.
The value 'hitcount' can be used in place of an explicit value in the 'values' parameter if you don't really need to have any particular field summed and are mainly interested in hit frequencies.
To turn the hist trigger off, simply call up the trigger in the command history and re-execute it with a '!' prepended:
# echo '!hist:key=call_site:val=bytes_req' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerFinally, notice that the call_site as displayed in the output above isn't really very useful. It's an address, but normally addresses are displayed in hex. To have a numeric field displayed as a hex value, simply append '.hex' to the field name in the trigger:
# echo 'hist:key=call_site.hex:val=bytes_req' > \ /sys/kernel/tracing/events/kmem/kmalloc/trigger # cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=call_site.hex:vals=bytes_req:sort=hitcount:size=2048 [active] { call_site: ffffffffa026b291 } hitcount: 1 bytes_req: 433 { call_site: ffffffffa07186ff } hitcount: 1 bytes_req: 176 { call_site: ffffffff811ae721 } hitcount: 1 bytes_req: 16384 { call_site: ffffffff811c5134 } hitcount: 1 bytes_req: 8 { call_site: ffffffffa04a9ebb } hitcount: 1 bytes_req: 511 { call_site: ffffffff8122e0a6 } hitcount: 1 bytes_req: 12 { call_site: ffffffff8107da84 } hitcount: 1 bytes_req: 152 { call_site: ffffffff812d8246 } hitcount: 1 bytes_req: 24 { call_site: ffffffff811dc1e5 } hitcount: 3 bytes_req: 144 { call_site: ffffffffa02515e8 } hitcount: 3 bytes_req: 648 { call_site: ffffffff81258159 } hitcount: 3 bytes_req: 144 { call_site: ffffffff811c80f4 } hitcount: 4 bytes_req: 544 . . . { call_site: ffffffffa06c7646 } hitcount: 106 bytes_req: 8024 { call_site: ffffffffa06cb246 } hitcount: 132 bytes_req: 31680 { call_site: ffffffffa06cef7a } hitcount: 132 bytes_req: 2112 { call_site: ffffffff8137e399 } hitcount: 132 bytes_req: 23232 { call_site: ffffffffa06c941c } hitcount: 185 bytes_req: 171360 { call_site: ffffffffa06f2a66 } hitcount: 185 bytes_req: 26640 { call_site: ffffffffa036a70e } hitcount: 265 bytes_req: 10600 { call_site: ffffffff81325447 } hitcount: 292 bytes_req: 584 { call_site: ffffffffa072da3c } hitcount: 446 bytes_req: 60656 { call_site: ffffffffa036b1f2 } hitcount: 526 bytes_req: 29456 { call_site: ffffffffa0099c06 } hitcount: 1780 bytes_req: 35600 Totals: Hits: 4775 Entries: 46 Dropped: 0Even that's only marginally more useful - while hex values do look more like addresses, what users are typically more interested in when looking at text addresses are the corresponding symbols instead. To have an address displayed as symbolic value instead, simply append '.sym' or '.sym-offset' to the field name in the trigger:
# echo 'hist:key=call_site.sym:val=bytes_req' > \ /sys/kernel/tracing/events/kmem/kmalloc/trigger # cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=call_site.sym:vals=bytes_req:sort=hitcount:size=2048 [active] { call_site: [ffffffff810adcb9] syslog_print_all } hitcount: 1 bytes_req: 1024 { call_site: [ffffffff8154bc62] usb_control_msg } hitcount: 1 bytes_req: 8 { call_site: [ffffffffa00bf6fe] hidraw_send_report [hid] } hitcount: 1 bytes_req: 7 { call_site: [ffffffff8154acbe] usb_alloc_urb } hitcount: 1 bytes_req: 192 { call_site: [ffffffffa00bf1ca] hidraw_report_event [hid] } hitcount: 1 bytes_req: 7 { call_site: [ffffffff811e3a25] __seq_open_private } hitcount: 1 bytes_req: 40 { call_site: [ffffffff8109524a] alloc_fair_sched_group } hitcount: 2 bytes_req: 128 { call_site: [ffffffff811febd5] fsnotify_alloc_group } hitcount: 2 bytes_req: 528 { call_site: [ffffffff81440f58] __tty_buffer_request_room } hitcount: 2 bytes_req: 2624 { call_site: [ffffffff81200ba6] inotify_new_group } hitcount: 2 bytes_req: 96 { call_site: [ffffffffa05e19af] ieee80211_start_tx_ba_session [mac80211] } hitcount: 2 bytes_req: 464 { call_site: [ffffffff81672406] tcp_get_metrics } hitcount: 2 bytes_req: 304 { call_site: [ffffffff81097ec2] alloc_rt_sched_group } hitcount: 2 bytes_req: 128 { call_site: [ffffffff81089b05] sched_create_group } hitcount: 2 bytes_req: 1424 . . . { call_site: [ffffffffa04a580c] intel_crtc_page_flip [i915] } hitcount: 1185 bytes_req: 123240 { call_site: [ffffffffa0287592] drm_mode_page_flip_ioctl [drm] } hitcount: 1185 bytes_req: 104280 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state [i915] } hitcount: 1402 bytes_req: 190672 { call_site: [ffffffff812891ca] ext4_find_extent } hitcount: 1518 bytes_req: 146208 { call_site: [ffffffffa029070e] drm_vma_node_allow [drm] } hitcount: 1746 bytes_req: 69840 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 2021 bytes_req: 792312 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc [drm] } hitcount: 2592 bytes_req: 145152 { call_site: [ffffffffa0489a66] intel_ring_begin [i915] } hitcount: 2629 bytes_req: 378576 { call_site: [ffffffffa046041c] i915_gem_execbuffer2 [i915] } hitcount: 2629 bytes_req: 3783248 { call_site: [ffffffff81325607] apparmor_file_alloc_security } hitcount: 5192 bytes_req: 10384 { call_site: [ffffffffa00b7c06] hid_report_raw_event [hid] } hitcount: 5529 bytes_req: 110584 { call_site: [ffffffff8131ebf7] aa_alloc_task_context } hitcount: 21943 bytes_req: 702176 { call_site: [ffffffff8125847d] ext4_htree_store_dirent } hitcount: 55759 bytes_req: 5074265 Totals: Hits: 109928 Entries: 71 Dropped: 0Because the default sort key above is 'hitcount', the above shows a the list of call_sites by increasing hitcount, so that at the bottom we see the functions that made the most kmalloc calls during the run. If instead we wanted to see the top kmalloc callers in terms of the number of bytes requested rather than the number of calls, and we wanted the top caller to appear at the top, we can use the 'sort' parameter, along with the 'descending' modifier:
# echo 'hist:key=call_site.sym:val=bytes_req:sort=bytes_req.descending' > \ /sys/kernel/tracing/events/kmem/kmalloc/trigger # cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=call_site.sym:vals=bytes_req:sort=bytes_req.descending:size=2048 [active] { call_site: [ffffffffa046041c] i915_gem_execbuffer2 [i915] } hitcount: 2186 bytes_req: 3397464 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 1790 bytes_req: 712176 { call_site: [ffffffff8125847d] ext4_htree_store_dirent } hitcount: 8132 bytes_req: 513135 { call_site: [ffffffff811e2a1b] seq_buf_alloc } hitcount: 106 bytes_req: 440128 { call_site: [ffffffffa0489a66] intel_ring_begin [i915] } hitcount: 2186 bytes_req: 314784 { call_site: [ffffffff812891ca] ext4_find_extent } hitcount: 2174 bytes_req: 208992 { call_site: [ffffffff811ae8e1] __kmalloc } hitcount: 8 bytes_req: 131072 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state [i915] } hitcount: 859 bytes_req: 116824 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc [drm] } hitcount: 1834 bytes_req: 102704 { call_site: [ffffffffa04a580c] intel_crtc_page_flip [i915] } hitcount: 972 bytes_req: 101088 { call_site: [ffffffffa0287592] drm_mode_page_flip_ioctl [drm] } hitcount: 972 bytes_req: 85536 { call_site: [ffffffffa00b7c06] hid_report_raw_event [hid] } hitcount: 3333 bytes_req: 66664 { call_site: [ffffffff8137e559] sg_kmalloc } hitcount: 209 bytes_req: 61632 . . . { call_site: [ffffffff81095225] alloc_fair_sched_group } hitcount: 2 bytes_req: 128 { call_site: [ffffffff81097ec2] alloc_rt_sched_group } hitcount: 2 bytes_req: 128 { call_site: [ffffffff812d8406] copy_semundo } hitcount: 2 bytes_req: 48 { call_site: [ffffffff81200ba6] inotify_new_group } hitcount: 1 bytes_req: 48 { call_site: [ffffffffa027121a] drm_getmagic [drm] } hitcount: 1 bytes_req: 48 { call_site: [ffffffff811e3a25] __seq_open_private } hitcount: 1 bytes_req: 40 { call_site: [ffffffff811c52f4] bprm_change_interp } hitcount: 2 bytes_req: 16 { call_site: [ffffffff8154bc62] usb_control_msg } hitcount: 1 bytes_req: 8 { call_site: [ffffffffa00bf1ca] hidraw_report_event [hid] } hitcount: 1 bytes_req: 7 { call_site: [ffffffffa00bf6fe] hidraw_send_report [hid] } hitcount: 1 bytes_req: 7 Totals: Hits: 32133 Entries: 81 Dropped: 0To display the offset and size information in addition to the symbol name, just use 'sym-offset' instead:
# echo 'hist:key=call_site.sym-offset:val=bytes_req:sort=bytes_req.descending' > \ /sys/kernel/tracing/events/kmem/kmalloc/trigger # cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=call_site.sym-offset:vals=bytes_req:sort=bytes_req.descending:size=2048 [active] { call_site: [ffffffffa046041c] i915_gem_execbuffer2+0x6c/0x2c0 [i915] } hitcount: 4569 bytes_req: 3163720 { call_site: [ffffffffa0489a66] intel_ring_begin+0xc6/0x1f0 [i915] } hitcount: 4569 bytes_req: 657936 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23+0x694/0x1020 [i915] } hitcount: 1519 bytes_req: 472936 { call_site: [ffffffffa045e646] i915_gem_do_execbuffer.isra.23+0x516/0x1020 [i915] } hitcount: 3050 bytes_req: 211832 { call_site: [ffffffff811e2a1b] seq_buf_alloc+0x1b/0x50 } hitcount: 34 bytes_req: 148384 { call_site: [ffffffffa04a580c] intel_crtc_page_flip+0xbc/0x870 [i915] } hitcount: 1385 bytes_req: 144040 { call_site: [ffffffff811ae8e1] __kmalloc+0x191/0x1b0 } hitcount: 8 bytes_req: 131072 { call_site: [ffffffffa0287592] drm_mode_page_flip_ioctl+0x282/0x360 [drm] } hitcount: 1385 bytes_req: 121880 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc+0x32/0x100 [drm] } hitcount: 1848 bytes_req: 103488 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state+0x2c/0xa0 [i915] } hitcount: 461 bytes_req: 62696 { call_site: [ffffffffa029070e] drm_vma_node_allow+0x2e/0xd0 [drm] } hitcount: 1541 bytes_req: 61640 { call_site: [ffffffff815f8d7b] sk_prot_alloc+0xcb/0x1b0 } hitcount: 57 bytes_req: 57456 . . . { call_site: [ffffffff8109524a] alloc_fair_sched_group+0x5a/0x1a0 } hitcount: 2 bytes_req: 128 { call_site: [ffffffffa027b921] drm_vm_open_locked+0x31/0xa0 [drm] } hitcount: 3 bytes_req: 96 { call_site: [ffffffff8122e266] proc_self_follow_link+0x76/0xb0 } hitcount: 8 bytes_req: 96 { call_site: [ffffffff81213e80] load_elf_binary+0x240/0x1650 } hitcount: 3 bytes_req: 84 { call_site: [ffffffff8154bc62] usb_control_msg+0x42/0x110 } hitcount: 1 bytes_req: 8 { call_site: [ffffffffa00bf6fe] hidraw_send_report+0x7e/0x1a0 [hid] } hitcount: 1 bytes_req: 7 { call_site: [ffffffffa00bf1ca] hidraw_report_event+0x8a/0x120 [hid] } hitcount: 1 bytes_req: 7 Totals: Hits: 26098 Entries: 64 Dropped: 0We can also add multiple fields to the 'values' parameter. For example, we might want to see the total number of bytes allocated alongside bytes requested, and display the result sorted by bytes allocated in a descending order:
# echo 'hist:keys=call_site.sym:values=bytes_req,bytes_alloc:sort=bytes_alloc.descending' > \ /sys/kernel/tracing/events/kmem/kmalloc/trigger # cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=call_site.sym:vals=bytes_req,bytes_alloc:sort=bytes_alloc.descending:size=2048 [active] { call_site: [ffffffffa046041c] i915_gem_execbuffer2 [i915] } hitcount: 7403 bytes_req: 4084360 bytes_alloc: 5958016 { call_site: [ffffffff811e2a1b] seq_buf_alloc } hitcount: 541 bytes_req: 2213968 bytes_alloc: 2228224 { call_site: [ffffffffa0489a66] intel_ring_begin [i915] } hitcount: 7404 bytes_req: 1066176 bytes_alloc: 1421568 { call_site: [ffffffffa045e7c4] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 1565 bytes_req: 557368 bytes_alloc: 1037760 { call_site: [ffffffff8125847d] ext4_htree_store_dirent } hitcount: 9557 bytes_req: 595778 bytes_alloc: 695744 { call_site: [ffffffffa045e646] i915_gem_do_execbuffer.isra.23 [i915] } hitcount: 5839 bytes_req: 430680 bytes_alloc: 470400 { call_site: [ffffffffa04c4a3c] intel_plane_duplicate_state [i915] } hitcount: 2388 bytes_req: 324768 bytes_alloc: 458496 { call_site: [ffffffffa02911f2] drm_modeset_lock_crtc [drm] } hitcount: 3911 bytes_req: 219016 bytes_alloc: 250304 { call_site: [ffffffff815f8d7b] sk_prot_alloc } hitcount: 235 bytes_req: 236880 bytes_alloc: 240640 { call_site: [ffffffff8137e559] sg_kmalloc } hitcount: 557 bytes_req: 169024 bytes_alloc: 221760 { call_site: [ffffffffa00b7c06] hid_report_raw_event [hid] } hitcount: 9378 bytes_req: 187548 bytes_alloc: 206312 { call_site: [ffffffffa04a580c] intel_crtc_page_flip [i915] } hitcount: 1519 bytes_req: 157976 bytes_alloc: 194432 . . . { call_site: [ffffffff8109bd3b] sched_autogroup_create_attach } hitcount: 2 bytes_req: 144 bytes_alloc: 192 { call_site: [ffffffff81097ee8] alloc_rt_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128 { call_site: [ffffffff8109524a] alloc_fair_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128 { call_site: [ffffffff81095225] alloc_fair_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128 { call_site: [ffffffff81097ec2] alloc_rt_sched_group } hitcount: 2 bytes_req: 128 bytes_alloc: 128 { call_site: [ffffffff81213e80] load_elf_binary } hitcount: 3 bytes_req: 84 bytes_alloc: 96 { call_site: [ffffffff81079a2e] kthread_create_on_node } hitcount: 1 bytes_req: 56 bytes_alloc: 64 { call_site: [ffffffffa00bf6fe] hidraw_send_report [hid] } hitcount: 1 bytes_req: 7 bytes_alloc: 8 { call_site: [ffffffff8154bc62] usb_control_msg } hitcount: 1 bytes_req: 8 bytes_alloc: 8 { call_site: [ffffffffa00bf1ca] hidraw_report_event [hid] } hitcount: 1 bytes_req: 7 bytes_alloc: 8 Totals: Hits: 66598 Entries: 65 Dropped: 0Finally, to finish off our kmalloc example, instead of simply having the hist trigger display symbolic call_sites, we can have the hist trigger additionally display the complete set of kernel stack traces that led to each call_site. To do that, we simply use the special value 'common_stacktrace' for the key parameter:
# echo 'hist:keys=common_stacktrace:values=bytes_req,bytes_alloc:sort=bytes_alloc' > \ /sys/kernel/tracing/events/kmem/kmalloc/triggerThe above trigger will use the kernel stack trace in effect when an event is triggered as the key for the hash table. This allows the enumeration of every kernel callpath that led up to a particular event, along with a running total of any of the event fields for that event. Here we tally bytes requested and bytes allocated for every callpath in the system that led up to a kmalloc (in this case every callpath to a kmalloc for a kernel compile):
# cat /sys/kernel/tracing/events/kmem/kmalloc/hist # trigger info: hist:keys=common_stacktrace:vals=bytes_req,bytes_alloc:sort=bytes_alloc:size=2048 [active] { common_stacktrace: __kmalloc_track_caller+0x10b/0x1a0 kmemdup+0x20/0x50 hidraw_report_event+0x8a/0x120 [hid] hid_report_raw_event+0x3ea/0x440 [hid] hid_input_report+0x112/0x190 [hid] hid_irq_in+0xc2/0x260 [usbhid] __usb_hcd_giveback_urb+0x72/0x120 usb_giveback_urb_bh+0x9e/0xe0 tasklet_hi_action+0xf8/0x100 __do_softirq+0x114/0x2c0 irq_exit+0xa5/0xb0 do_IRQ+0x5a/0xf0 ret_from_intr+0x0/0x30 cpuidle_enter+0x17/0x20 cpu_startup_entry+0x315/0x3e0 rest_init+0x7c/0x80 } hitcount: 3 bytes_req: 21 bytes_alloc: 24 { common_stacktrace: __kmalloc_track_caller+0x10b/0x1a0 kmemdup+0x20/0x50 hidraw_report_event+0x8a/0x120 [hid] hid_report_raw_event+0x3ea/0x440 [hid] hid_input_report+0x112/0x190 [hid] hid_irq_in+0xc2/0x260 [usbhid] __usb_hcd_giveback_urb+0x72/0x120 usb_giveback_urb_bh+0x9e/0xe0 tasklet_hi_action+0xf8/0x100 __do_softirq+0x114/0x2c0 irq_exit+0xa5/0xb0 do_IRQ+0x5a/0xf0 ret_from_intr+0x0/0x30 } hitcount: 3 bytes_req: 21 bytes_alloc: 24 { common_stacktrace: kmem_cache_alloc_trace+0xeb/0x150 aa_alloc_task_context+0x27/0x40 apparmor_cred_prepare+0x1f/0x50 security_prepare_creds+0x16/0x20 prepare_creds+0xdf/0x1a0 SyS_capset+0xb5/0x200 system_call_fastpath+0x12/0x6a } hitcount: 1 bytes_req: 32 bytes_alloc: 32 . . . { common_stacktrace: __kmalloc+0x11b/0x1b0 i915_gem_execbuffer2+0x6c/0x2c0 [i915] drm_ioctl+0x349/0x670 [drm] do_vfs_ioctl+0x2f0/0x4f0 SyS_ioctl+0x81/0xa0 system_call_fastpath+0x12/0x6a } hitcount: 17726 bytes_req: 13944120 bytes_alloc: 19593808 { common_stacktrace: __kmalloc+0x11b/0x1b0 load_elf_phdrs+0x76/0xa0 load_elf_binary+0x102/0x1650 search_binary_handler+0x97/0x1d0 do_execveat_common.isra.34+0x551/0x6e0 SyS_execve+0x3a/0x50 return_from_execve+0x0/0x23 } hitcount: 33348 bytes_req: 17152128 bytes_alloc: 20226048 { common_stacktrace: kmem_cache_alloc_trace+0xeb/0x150 apparmor_file_alloc_security+0x27/0x40 security_file_alloc+0x16/0x20 get_empty_filp+0x93/0x1c0 path_openat+0x31/0x5f0 do_filp_open+0x3a/0x90 do_sys_open+0x128/0x220 SyS_open+0x1e/0x20 system_call_fastpath+0x12/0x6a } hitcount: 4766422 bytes_req: 9532844 bytes_alloc: 38131376 { common_stacktrace: __kmalloc+0x11b/0x1b0 seq_buf_alloc+0x1b/0x50 seq_read+0x2cc/0x370 proc_reg_read+0x3d/0x80 __vfs_read+0x28/0xe0 vfs_read+0x86/0x140 SyS_read+0x46/0xb0 system_call_fastpath+0x12/0x6a } hitcount: 19133 bytes_req: 78368768 bytes_alloc: 78368768 Totals: Hits: 6085872 Entries: 253 Dropped: 0If you key a hist trigger on common_pid, in order for example to gather and display sorted totals for each process, you can use the special .execname modifier to display the executable names for the processes in the table rather than raw pids. The example below keeps a per-process sum of total bytes read:
# echo 'hist:key=common_pid.execname:val=count:sort=count.descending' > \ /sys/kernel/tracing/events/syscalls/sys_enter_read/trigger # cat /sys/kernel/tracing/events/syscalls/sys_enter_read/hist # trigger info: hist:keys=common_pid.execname:vals=count:sort=count.descending:size=2048 [active] { common_pid: gnome-terminal [ 3196] } hitcount: 280 count: 1093512 { common_pid: Xorg [ 1309] } hitcount: 525 count: 256640 { common_pid: compiz [ 2889] } hitcount: 59 count: 254400 { common_pid: bash [ 8710] } hitcount: 3 count: 66369 { common_pid: dbus-daemon-lau [ 8703] } hitcount: 49 count: 47739 { common_pid: irqbalance [ 1252] } hitcount: 27 count: 27648 { common_pid: 01ifupdown [ 8705] } hitcount: 3 count: 17216 { common_pid: dbus-daemon [ 772] } hitcount: 10 count: 12396 { common_pid: Socket Thread [ 8342] } hitcount: 11 count: 11264 { common_pid: nm-dhcp-client. [ 8701] } hitcount: 6 count: 7424 { common_pid: gmain [ 1315] } hitcount: 18 count: 6336 . . . { common_pid: postgres [ 1892] } hitcount: 2 count: 32 { common_pid: postgres [ 1891] } hitcount: 2 count: 32 { common_pid: gmain [ 8704] } hitcount: 2 count: 32 { common_pid: upstart-dbus-br [ 2740] } hitcount: 21 count: 21 { common_pid: nm-dispatcher.a [ 8696] } hitcount: 1 count: 16 { common_pid: indicator-datet [ 2904] } hitcount: 1 count: 16 { common_pid: gdbus [ 2998] } hitcount: 1 count: 16 { common_pid: rtkit-daemon [ 2052] } hitcount: 1 count: 8 { common_pid: init [ 1] } hitcount: 2 count: 2 Totals: Hits: 2116 Entries: 51 Dropped: 0Similarly, if you key a hist trigger on syscall id, for example to gather and display a list of systemwide syscall hits, you can use the special .syscall modifier to display the syscall names rather than raw ids. The example below keeps a running total of syscall counts for the system during the run:
# echo 'hist:key=id.syscall:val=hitcount' > \ /sys/kernel/tracing/events/raw_syscalls/sys_enter/trigger # cat /sys/kernel/tracing/events/raw_syscalls/sys_enter/hist # trigger info: hist:keys=id.syscall:vals=hitcount:sort=hitcount:size=2048 [active] { id: sys_fsync [ 74] } hitcount: 1 { id: sys_newuname [ 63] } hitcount: 1 { id: sys_prctl [157] } hitcount: 1 { id: sys_statfs [137] } hitcount: 1 { id: sys_symlink [ 88] } hitcount: 1 { id: sys_sendmmsg [307] } hitcount: 1 { id: sys_semctl [ 66] } hitcount: 1 { id: sys_readlink [ 89] } hitcount: 3 { id: sys_bind [ 49] } hitcount: 3 { id: sys_getsockname [ 51] } hitcount: 3 { id: sys_unlink [ 87] } hitcount: 3 { id: sys_rename [ 82] } hitcount: 4 { id: unknown_syscall [ 58] } hitcount: 4 { id: sys_connect [ 42] } hitcount: 4 { id: sys_getpid [ 39] } hitcount: 4 . . . { id: sys_rt_sigprocmask [ 14] } hitcount: 952 { id: sys_futex [202] } hitcount: 1534 { id: sys_write [ 1] } hitcount: 2689 { id: sys_setitimer [ 38] } hitcount: 2797 { id: sys_read [ 0] } hitcount: 3202 { id: sys_select [ 23] } hitcount: 3773 { id: sys_writev [ 20] } hitcount: 4531 { id: sys_poll [ 7] } hitcount: 8314 { id: sys_recvmsg [ 47] } hitcount: 13738 { id: sys_ioctl [ 16] } hitcount: 21843 Totals: Hits: 67612 Entries: 72 Dropped: 0The syscall counts above provide a rough overall picture of system call activity on the system; we can see for example that the most popular system call on this system was the 'sys_ioctl' system call.
We can use 'compound' keys to refine that number and provide some further insight as to which processes exactly contribute to the overall ioctl count.
The command below keeps a hitcount for every unique combination of system call id and pid - the end result is essentially a table that keeps a per-pid sum of system call hits. The results are sorted using the system call id as the primary key, and the hitcount sum as the secondary key:
# echo 'hist:key=id.syscall,common_pid.execname:val=hitcount:sort=id,hitcount' > \ /sys/kernel/tracing/events/raw_syscalls/sys_enter/trigger # cat /sys/kernel/tracing/events/raw_syscalls/sys_enter/hist # trigger info: hist:keys=id.syscall,common_pid.execname:vals=hitcount:sort=id.syscall,hitcount:size=2048 [active] { id: sys_read [ 0], common_pid: rtkit-daemon [ 1877] } hitcount: 1 { id: sys_read [ 0], common_pid: gdbus [ 2976] } hitcount: 1 { id: sys_read [ 0], common_pid: console-kit-dae [ 3400] } hitcount: 1 { id: sys_read [ 0], common_pid: postgres [ 1865] } hitcount: 1 { id: sys_read [ 0], common_pid: deja-dup-monito [ 3543] } hitcount: 2 { id: sys_read [ 0], common_pid: NetworkManager [ 890] } hitcount: 2 { id: sys_read [ 0], common_pid: evolution-calen [ 3048] } hitcount: 2 { id: sys_read [ 0], common_pid: postgres [ 1864] } hitcount: 2 { id: sys_read [ 0], common_pid: nm-applet [ 3022] } hitcount: 2 { id: sys_read [ 0], common_pid: whoopsie [ 1212] } hitcount: 2 . . . { id: sys_ioctl [ 16], common_pid: bash [ 8479] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: bash [ 3472] } hitcount: 12 { id: sys_ioctl [ 16], common_pid: gnome-terminal [ 3199] } hitcount: 16 { id: sys_ioctl [ 16], common_pid: Xorg [ 1267] } hitcount: 1808 { id: sys_ioctl [ 16], common_pid: compiz [ 2994] } hitcount: 5580 . . . { id: sys_waitid [247], common_pid: upstart-dbus-br [ 2690] } hitcount: 3 { id: sys_waitid [247], common_pid: upstart-dbus-br [ 2688] } hitcount: 16 { id: sys_inotify_add_watch [254], common_pid: gmain [ 975] } hitcount: 2 { id: sys_inotify_add_watch [254], common_pid: gmain [ 3204] } hitcount: 4 { id: sys_inotify_add_watch [254], common_pid: gmain [ 2888] } hitcount: 4 { id: sys_inotify_add_watch [254], common_pid: gmain [ 3003] } hitcount: 4 { id: sys_inotify_add_watch [254], common_pid: gmain [ 2873] } hitcount: 4 { id: sys_inotify_add_watch [254], common_pid: gmain [ 3196] } hitcount: 6 { id: sys_openat [257], common_pid: java [ 2623] } hitcount: 2 { id: sys_eventfd2 [290], common_pid: ibus-ui-gtk3 [ 2760] } hitcount: 4 { id: sys_eventfd2 [290], common_pid: compiz [ 2994] } hitcount: 6 Totals: Hits: 31536 Entries: 323 Dropped: 0The above list does give us a breakdown of the ioctl syscall by pid, but it also gives us quite a bit more than that, which we don't really care about at the moment. Since we know the syscall id for sys_ioctl (16, displayed next to the sys_ioctl name), we can use that to filter out all the other syscalls:
# echo 'hist:key=id.syscall,common_pid.execname:val=hitcount:sort=id,hitcount if id == 16' > \ /sys/kernel/tracing/events/raw_syscalls/sys_enter/trigger # cat /sys/kernel/tracing/events/raw_syscalls/sys_enter/hist # trigger info: hist:keys=id.syscall,common_pid.execname:vals=hitcount:sort=id.syscall,hitcount:size=2048 if id == 16 [active] { id: sys_ioctl [ 16], common_pid: gmain [ 2769] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: evolution-addre [ 8571] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: gmain [ 3003] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: gmain [ 2781] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: gmain [ 2829] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: bash [ 8726] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: bash [ 8508] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: gmain [ 2970] } hitcount: 1 { id: sys_ioctl [ 16], common_pid: gmain [ 2768] } hitcount: 1 . . . { id: sys_ioctl [ 16], common_pid: pool [ 8559] } hitcount: 45 { id: sys_ioctl [ 16], common_pid: pool [ 8555] } hitcount: 48 { id: sys_ioctl [ 16], common_pid: pool [ 8551] } hitcount: 48 { id: sys_ioctl [ 16], common_pid: avahi-daemon [ 896] } hitcount: 66 { id: sys_ioctl [ 16], common_pid: Xorg [ 1267] } hitcount: 26674 { id: sys_ioctl [ 16], common_pid: compiz [ 2994] } hitcount: 73443 Totals: Hits: 101162 Entries: 103 Dropped: 0The above output shows that 'compiz' and 'Xorg' are far and away the heaviest ioctl callers (which might lead to questions about whether they really need to be making all those calls and to possible avenues for further investigation.)
The compound key examples used a key and a sum value (hitcount) to sort the output, but we can just as easily use two keys instead. Here's an example where we use a compound key composed of the common_pid and size event fields. Sorting with pid as the primary key and 'size' as the secondary key allows us to display an ordered summary of the recvfrom sizes, with counts, received by each process:
# echo 'hist:key=common_pid.execname,size:val=hitcount:sort=common_pid,size' > \ /sys/kernel/tracing/events/syscalls/sys_enter_recvfrom/trigger # cat /sys/kernel/tracing/events/syscalls/sys_enter_recvfrom/hist # trigger info: hist:keys=common_pid.execname,size:vals=hitcount:sort=common_pid.execname,size:size=2048 [active] { common_pid: smbd [ 784], size: 4 } hitcount: 1 { common_pid: dnsmasq [ 1412], size: 4096 } hitcount: 672 { common_pid: postgres [ 1796], size: 1000 } hitcount: 6 { common_pid: postgres [ 1867], size: 1000 } hitcount: 10 { common_pid: bamfdaemon [ 2787], size: 28 } hitcount: 2 { common_pid: bamfdaemon [ 2787], size: 14360 } hitcount: 1 { common_pid: compiz [ 2994], size: 8 } hitcount: 1 { common_pid: compiz [ 2994], size: 20 } hitcount: 11 { common_pid: gnome-terminal [ 3199], size: 4 } hitcount: 2 { common_pid: firefox [ 8817], size: 4 } hitcount: 1 { common_pid: firefox [ 8817], size: 8 } hitcount: 5 { common_pid: firefox [ 8817], size: 588 } hitcount: 2 { common_pid: firefox [ 8817], size: 628 } hitcount: 1 { common_pid: firefox [ 8817], size: 6944 } hitcount: 1 { common_pid: firefox [ 8817], size: 408880 } hitcount: 2 { common_pid: firefox [ 8822], size: 8 } hitcount: 2 { common_pid: firefox [ 8822], size: 160 } hitcount: 2 { common_pid: firefox [ 8822], size: 320 } hitcount: 2 { common_pid: firefox [ 8822], size: 352 } hitcount: 1 . . . { common_pid: pool [ 8923], size: 1960 } hitcount: 10 { common_pid: pool [ 8923], size: 2048 } hitcount: 10 { common_pid: pool [ 8924], size: 1960 } hitcount: 10 { common_pid: pool [ 8924], size: 2048 } hitcount: 10 { common_pid: pool [ 8928], size: 1964 } hitcount: 4 { common_pid: pool [ 8928], size: 1965 } hitcount: 2 { common_pid: pool [ 8928], size: 2048 } hitcount: 6 { common_pid: pool [ 8929], size: 1982 } hitcount: 1 { common_pid: pool [ 8929], size: 2048 } hitcount: 1 Totals: Hits: 2016 Entries: 224 Dropped: 0The above example also illustrates the fact that although a compound key is treated as a single entity for hashing purposes, the sub-keys it's composed of can be accessed independently.
The next example uses a string field as the hash key and demonstrates how you can manually pause and continue a hist trigger. In this example, we'll aggregate fork counts and don't expect a large number of entries in the hash table, so we'll drop it to a much smaller number, say 256:
# echo 'hist:key=child_comm:val=hitcount:size=256' > \ /sys/kernel/tracing/events/sched/sched_process_fork/trigger # cat /sys/kernel/tracing/events/sched/sched_process_fork/hist # trigger info: hist:keys=child_comm:vals=hitcount:sort=hitcount:size=256 [active] { child_comm: dconf worker } hitcount: 1 { child_comm: ibus-daemon } hitcount: 1 { child_comm: whoopsie } hitcount: 1 { child_comm: smbd } hitcount: 1 { child_comm: gdbus } hitcount: 1 { child_comm: kthreadd } hitcount: 1 { child_comm: dconf worker } hitcount: 1 { child_comm: evolution-alarm } hitcount: 2 { child_comm: Socket Thread } hitcount: 2 { child_comm: postgres } hitcount: 2 { child_comm: bash } hitcount: 3 { child_comm: compiz } hitcount: 3 { child_comm: evolution-sourc } hitcount: 4 { child_comm: dhclient } hitcount: 4 { child_comm: pool } hitcount: 5 { child_comm: nm-dispatcher.a } hitcount: 8 { child_comm: firefox } hitcount: 8 { child_comm: dbus-daemon } hitcount: 8 { child_comm: glib-pacrunner } hitcount: 10 { child_comm: evolution } hitcount: 23 Totals: Hits: 89 Entries: 20 Dropped: 0If we want to pause the hist trigger, we can simply append :pause to the command that started the trigger. Notice that the trigger info displays as [paused]:
# echo 'hist:key=child_comm:val=hitcount:size=256:pause' >> \ /sys/kernel/tracing/events/sched/sched_process_fork/trigger # cat /sys/kernel/tracing/events/sched/sched_process_fork/hist # trigger info: hist:keys=child_comm:vals=hitcount:sort=hitcount:size=256 [paused] { child_comm: dconf worker } hitcount: 1 { child_comm: kthreadd } hitcount: 1 { child_comm: dconf worker } hitcount: 1 { child_comm: gdbus } hitcount: 1 { child_comm: ibus-daemon } hitcount: 1 { child_comm: Socket Thread } hitcount: 2 { child_comm: evolution-alarm } hitcount: 2 { child_comm: smbd } hitcount: 2 { child_comm: bash } hitcount: 3 { child_comm: whoopsie } hitcount: 3 { child_comm: compiz } hitcount: 3 { child_comm: evolution-sourc } hitcount: 4 { child_comm: pool } hitcount: 5 { child_comm: postgres } hitcount: 6 { child_comm: firefox } hitcount: 8 { child_comm: dhclient } hitcount: 10 { child_comm: emacs } hitcount: 12 { child_comm: dbus-daemon } hitcount: 20 { child_comm: nm-dispatcher.a } hitcount: 20 { child_comm: evolution } hitcount: 35 { child_comm: glib-pacrunner } hitcount: 59 Totals: Hits: 199 Entries: 21 Dropped: 0To manually continue having the trigger aggregate events, append :cont instead. Notice that the trigger info displays as [active] again, and the data has changed:
# echo 'hist:key=child_comm:val=hitcount:size=256:cont' >> \ /sys/kernel/tracing/events/sched/sched_process_fork/trigger # cat /sys/kernel/tracing/events/sched/sched_process_fork/hist # trigger info: hist:keys=child_comm:vals=hitcount:sort=hitcount:size=256 [active] { child_comm: dconf worker } hitcount: 1 { child_comm: dconf worker } hitcount: 1 { child_comm: kthreadd } hitcount: 1 { child_comm: gdbus } hitcount: 1 { child_comm: ibus-daemon } hitcount: 1 { child_comm: Socket Thread } hitcount: 2 { child_comm: evolution-alarm } hitcount: 2 { child_comm: smbd } hitcount: 2 { child_comm: whoopsie } hitcount: 3 { child_comm: compiz } hitcount: 3 { child_comm: evolution-sourc } hitcount: 4 { child_comm: bash } hitcount: 5 { child_comm: pool } hitcount: 5 { child_comm: postgres } hitcount: 6 { child_comm: firefox } hitcount: 8 { child_comm: dhclient } hitcount: 11 { child_comm: emacs } hitcount: 12 { child_comm: dbus-daemon } hitcount: 22 { child_comm: nm-dispatcher.a } hitcount: 22 { child_comm: evolution } hitcount: 35 { child_comm: glib-pacrunner } hitcount: 59 Totals: Hits: 206 Entries: 21 Dropped: 0The previous example showed how to start and stop a hist trigger by appending 'pause' and 'continue' to the hist trigger command. A hist trigger can also be started in a paused state by initially starting the trigger with ':pause' appended. This allows you to start the trigger only when you're ready to start collecting data and not before. For example, you could start the trigger in a paused state, then unpause it and do something you want to measure, then pause the trigger again when done.
Of course, doing this manually can be difficult and error-prone, but it is possible to automatically start and stop a hist trigger based on some condition, via the enable_hist and disable_hist triggers.
For example, suppose we wanted to take a look at the relative weights in terms of skb length for each callpath that leads to a netif_receive_skb event when downloading a decent-sized file using wget.
First we set up an initially paused stacktrace trigger on the netif_receive_skb event:
# echo 'hist:key=common_stacktrace:vals=len:pause' > \ /sys/kernel/tracing/events/net/netif_receive_skb/triggerNext, we set up an 'enable_hist' trigger on the sched_process_exec event, with an 'if filename==/usr/bin/wget' filter. The effect of this new trigger is that it will 'unpause' the hist trigger we just set up on netif_receive_skb if and only if it sees a sched_process_exec event with a filename of '/usr/bin/wget'. When that happens, all netif_receive_skb events are aggregated into a hash table keyed on stacktrace:
# echo 'enable_hist:net:netif_receive_skb if filename==/usr/bin/wget' > \ /sys/kernel/tracing/events/sched/sched_process_exec/triggerThe aggregation continues until the netif_receive_skb is paused again, which is what the following disable_hist event does by creating a similar setup on the sched_process_exit event, using the filter 'comm==wget':
# echo 'disable_hist:net:netif_receive_skb if comm==wget' > \ /sys/kernel/tracing/events/sched/sched_process_exit/triggerWhenever a process exits and the comm field of the disable_hist trigger filter matches 'comm==wget', the netif_receive_skb hist trigger is disabled.
The overall effect is that netif_receive_skb events are aggregated into the hash table for only the duration of the wget. Executing a wget command and then listing the 'hist' file will display the output generated by the wget command:
$ wget https://www.kernel.org/pub/linux/kernel/v3.x/patch-3.19.xz # cat /sys/kernel/tracing/events/net/netif_receive_skb/hist # trigger info: hist:keys=common_stacktrace:vals=len:sort=hitcount:size=2048 [paused] { common_stacktrace: __netif_receive_skb_core+0x46d/0x990 __netif_receive_skb+0x18/0x60 netif_receive_skb_internal+0x23/0x90 napi_gro_receive+0xc8/0x100 ieee80211_deliver_skb+0xd6/0x270 [mac80211] ieee80211_rx_handlers+0xccf/0x22f0 [mac80211] ieee80211_prepare_and_rx_handle+0x4e7/0xc40 [mac80211] ieee80211_rx+0x31d/0x900 [mac80211] iwlagn_rx_reply_rx+0x3db/0x6f0 [iwldvm] iwl_rx_dispatch+0x8e/0xf0 [iwldvm] iwl_pcie_irq_handler+0xe3c/0x12f0 [iwlwifi] irq_thread_fn+0x20/0x50 irq_thread+0x11f/0x150 kthread+0xd2/0xf0 ret_from_fork+0x42/0x70 } hitcount: 85 len: 28884 { common_stacktrace: __netif_receive_skb_core+0x46d/0x990 __netif_receive_skb+0x18/0x60 netif_receive_skb_internal+0x23/0x90 napi_gro_complete+0xa4/0xe0 dev_gro_receive+0x23a/0x360 napi_gro_receive+0x30/0x100 ieee80211_deliver_skb+0xd6/0x270 [mac80211] ieee80211_rx_handlers+0xccf/0x22f0 [mac80211] ieee80211_prepare_and_rx_handle+0x4e7/0xc40 [mac80211] ieee80211_rx+0x31d/0x900 [mac80211] iwlagn_rx_reply_rx+0x3db/0x6f0 [iwldvm] iwl_rx_dispatch+0x8e/0xf0 [iwldvm] iwl_pcie_irq_handler+0xe3c/0x12f0 [iwlwifi] irq_thread_fn+0x20/0x50 irq_thread+0x11f/0x150 kthread+0xd2/0xf0 } hitcount: 98 len: 664329 { common_stacktrace: __netif_receive_skb_core+0x46d/0x990 __netif_receive_skb+0x18/0x60 process_backlog+0xa8/0x150 net_rx_action+0x15d/0x340 __do_softirq+0x114/0x2c0 do_softirq_own_stack+0x1c/0x30 do_softirq+0x65/0x70 __local_bh_enable_ip+0xb5/0xc0 ip_finish_output+0x1f4/0x840 ip_output+0x6b/0xc0 ip_local_out_sk+0x31/0x40 ip_send_skb+0x1a/0x50 udp_send_skb+0x173/0x2a0 udp_sendmsg+0x2bf/0x9f0 inet_sendmsg+0x64/0xa0 sock_sendmsg+0x3d/0x50 } hitcount: 115 len: 13030 { common_stacktrace: __netif_receive_skb_core+0x46d/0x990 __netif_receive_skb+0x18/0x60 netif_receive_skb_internal+0x23/0x90 napi_gro_complete+0xa4/0xe0 napi_gro_flush+0x6d/0x90 iwl_pcie_irq_handler+0x92a/0x12f0 [iwlwifi] irq_thread_fn+0x20/0x50 irq_thread+0x11f/0x150 kthread+0xd2/0xf0 ret_from_fork+0x42/0x70 } hitcount: 934 len: 5512212 Totals: Hits: 1232 Entries: 4 Dropped: 0The above shows all the netif_receive_skb callpaths and their total lengths for the duration of the wget command.
The 'clear' hist trigger param can be used to clear the hash table. Suppose we wanted to try another run of the previous example but this time also wanted to see the complete list of events that went into the histogram. In order to avoid having to set everything up again, we can just clear the histogram first:
# echo 'hist:key=common_stacktrace:vals=len:clear' >> \ /sys/kernel/tracing/events/net/netif_receive_skb/triggerJust to verify that it is in fact cleared, here's what we now see in the hist file:
# cat /sys/kernel/tracing/events/net/netif_receive_skb/hist # trigger info: hist:keys=common_stacktrace:vals=len:sort=hitcount:size=2048 [paused] Totals: Hits: 0 Entries: 0 Dropped: 0Since we want to see the detailed list of every netif_receive_skb event occurring during the new run, which are in fact the same events being aggregated into the hash table, we add some additional 'enable_event' events to the triggering sched_process_exec and sched_process_exit events as such:
# echo 'enable_event:net:netif_receive_skb if filename==/usr/bin/wget' > \ /sys/kernel/tracing/events/sched/sched_process_exec/trigger # echo 'disable_event:net:netif_receive_skb if comm==wget' > \ /sys/kernel/tracing/events/sched/sched_process_exit/triggerIf you read the trigger files for the sched_process_exec and sched_process_exit triggers, you should see two triggers for each: one enabling/disabling the hist aggregation and the other enabling/disabling the logging of events:
# cat /sys/kernel/tracing/events/sched/sched_process_exec/trigger enable_event:net:netif_receive_skb:unlimited if filename==/usr/bin/wget enable_hist:net:netif_receive_skb:unlimited if filename==/usr/bin/wget # cat /sys/kernel/tracing/events/sched/sched_process_exit/trigger enable_event:net:netif_receive_skb:unlimited if comm==wget disable_hist:net:netif_receive_skb:unlimited if comm==wgetIn other words, whenever either of the sched_process_exec or sched_process_exit events is hit and matches 'wget', it enables or disables both the histogram and the event log, and what you end up with is a hash table and set of events just covering the specified duration. Run the wget command again:
$ wget https://www.kernel.org/pub/linux/kernel/v3.x/patch-3.19.xzDisplaying the 'hist' file should show something similar to what you saw in the last run, but this time you should also see the individual events in the trace file:
# cat /sys/kernel/tracing/trace # tracer: nop # # entries-in-buffer/entries-written: 183/1426 #P:4 # # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | wget-15108 [000] ..s1 31769.606929: netif_receive_skb: dev=lo skbaddr=ffff88009c353100 len=60 wget-15108 [000] ..s1 31769.606999: netif_receive_skb: dev=lo skbaddr=ffff88009c353200 len=60 dnsmasq-1382 [000] ..s1 31769.677652: netif_receive_skb: dev=lo skbaddr=ffff88009c352b00 len=130 dnsmasq-1382 [000] ..s1 31769.685917: netif_receive_skb: dev=lo skbaddr=ffff88009c352200 len=138 ##### CPU 2 buffer started #### irq/29-iwlwifi-559 [002] ..s. 31772.031529: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d433d00 len=2948 irq/29-iwlwifi-559 [002] ..s. 31772.031572: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d432200 len=1500 irq/29-iwlwifi-559 [002] ..s. 31772.032196: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d433100 len=2948 irq/29-iwlwifi-559 [002] ..s. 31772.032761: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d433000 len=2948 irq/29-iwlwifi-559 [002] ..s. 31772.033220: netif_receive_skb: dev=wlan0 skbaddr=ffff88009d432e00 len=1500 . . .The following example demonstrates how multiple hist triggers can be attached to a given event. This capability can be useful for creating a set of different summaries derived from the same set of events, or for comparing the effects of different filters, among other things:
# echo 'hist:keys=skbaddr.hex:vals=len if len < 0' >> \ /sys/kernel/tracing/events/net/netif_receive_skb/trigger # echo 'hist:keys=skbaddr.hex:vals=len if len > 4096' >> \ /sys/kernel/tracing/events/net/netif_receive_skb/trigger # echo 'hist:keys=skbaddr.hex:vals=len if len == 256' >> \ /sys/kernel/tracing/events/net/netif_receive_skb/trigger # echo 'hist:keys=skbaddr.hex:vals=len' >> \ /sys/kernel/tracing/events/net/netif_receive_skb/trigger # echo 'hist:keys=len:vals=common_preempt_count' >> \ /sys/kernel/tracing/events/net/netif_receive_skb/triggerThe above set of commands create four triggers differing only in their filters, along with a completely different though fairly nonsensical trigger. Note that in order to append multiple hist triggers to the same file, you should use the '>>' operator to append them ('>' will also add the new hist trigger, but will remove any existing hist triggers beforehand).
Displaying the contents of the 'hist' file for the event shows the contents of all five histograms:
# cat /sys/kernel/tracing/events/net/netif_receive_skb/hist # event histogram # # trigger info: hist:keys=len:vals=hitcount,common_preempt_count:sort=hitcount:size=2048 [active] # { len: 176 } hitcount: 1 common_preempt_count: 0 { len: 223 } hitcount: 1 common_preempt_count: 0 { len: 4854 } hitcount: 1 common_preempt_count: 0 { len: 395 } hitcount: 1 common_preempt_count: 0 { len: 177 } hitcount: 1 common_preempt_count: 0 { len: 446 } hitcount: 1 common_preempt_count: 0 { len: 1601 } hitcount: 1 common_preempt_count: 0 . . . { len: 1280 } hitcount: 66 common_preempt_count: 0 { len: 116 } hitcount: 81 common_preempt_count: 40 { len: 708 } hitcount: 112 common_preempt_count: 0 { len: 46 } hitcount: 221 common_preempt_count: 0 { len: 1264 } hitcount: 458 common_preempt_count: 0 Totals: Hits: 1428 Entries: 147 Dropped: 0 # event histogram # # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 [active] # { skbaddr: ffff8800baee5e00 } hitcount: 1 len: 130 { skbaddr: ffff88005f3d5600 } hitcount: 1 len: 1280 { skbaddr: ffff88005f3d4900 } hitcount: 1 len: 1280 { skbaddr: ffff88009fed6300 } hitcount: 1 len: 115 { skbaddr: ffff88009fe0ad00 } hitcount: 1 len: 115 { skbaddr: ffff88008cdb1900 } hitcount: 1 len: 46 { skbaddr: ffff880064b5ef00 } hitcount: 1 len: 118 { skbaddr: ffff880044e3c700 } hitcount: 1 len: 60 { skbaddr: ffff880100065900 } hitcount: 1 len: 46 { skbaddr: ffff8800d46bd500 } hitcount: 1 len: 116 { skbaddr: ffff88005f3d5f00 } hitcount: 1 len: 1280 { skbaddr: ffff880100064700 } hitcount: 1 len: 365 { skbaddr: ffff8800badb6f00 } hitcount: 1 len: 60 . . . { skbaddr: ffff88009fe0be00 } hitcount: 27 len: 24677 { skbaddr: ffff88009fe0a400 } hitcount: 27 len: 23052 { skbaddr: ffff88009fe0b700 } hitcount: 31 len: 25589 { skbaddr: ffff88009fe0b600 } hitcount: 32 len: 27326 { skbaddr: ffff88006a462800 } hitcount: 68 len: 71678 { skbaddr: ffff88006a463700 } hitcount: 70 len: 72678 { skbaddr: ffff88006a462b00 } hitcount: 71 len: 77589 { skbaddr: ffff88006a463600 } hitcount: 73 len: 71307 { skbaddr: ffff88006a462200 } hitcount: 81 len: 81032 Totals: Hits: 1451 Entries: 318 Dropped: 0 # event histogram # # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 if len == 256 [active] # Totals: Hits: 0 Entries: 0 Dropped: 0 # event histogram # # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 if len > 4096 [active] # { skbaddr: ffff88009fd2c300 } hitcount: 1 len: 7212 { skbaddr: ffff8800d2bcce00 } hitcount: 1 len: 7212 { skbaddr: ffff8800d2bcd700 } hitcount: 1 len: 7212 { skbaddr: ffff8800d2bcda00 } hitcount: 1 len: 21492 { skbaddr: ffff8800ae2e2d00 } hitcount: 1 len: 7212 { skbaddr: ffff8800d2bcdb00 } hitcount: 1 len: 7212 { skbaddr: ffff88006a4df500 } hitcount: 1 len: 4854 { skbaddr: ffff88008ce47b00 } hitcount: 1 len: 18636 { skbaddr: ffff8800ae2e2200 } hitcount: 1 len: 12924 { skbaddr: ffff88005f3e1000 } hitcount: 1 len: 4356 { skbaddr: ffff8800d2bcdc00 } hitcount: 2 len: 24420 { skbaddr: ffff8800d2bcc200 } hitcount: 2 len: 12996 Totals: Hits: 14 Entries: 12 Dropped: 0 # event histogram # # trigger info: hist:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 if len < 0 [active] # Totals: Hits: 0 Entries: 0 Dropped: 0Named triggers can be used to have triggers share a common set of histogram data. This capability is mostly useful for combining the output of events generated by tracepoints contained inside inline functions, but names can be used in a hist trigger on any event. For example, these two triggers when hit will update the same 'len' field in the shared 'foo' histogram data:
# echo 'hist:name=foo:keys=skbaddr.hex:vals=len' > \ /sys/kernel/tracing/events/net/netif_receive_skb/trigger # echo 'hist:name=foo:keys=skbaddr.hex:vals=len' > \ /sys/kernel/tracing/events/net/netif_rx/triggerYou can see that they're updating common histogram data by reading each event's hist files at the same time:
# cat /sys/kernel/tracing/events/net/netif_receive_skb/hist; cat /sys/kernel/tracing/events/net/netif_rx/hist # event histogram # # trigger info: hist:name=foo:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 [active] # { skbaddr: ffff88000ad53500 } hitcount: 1 len: 46 { skbaddr: ffff8800af5a1500 } hitcount: 1 len: 76 { skbaddr: ffff8800d62a1900 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bccb00 } hitcount: 1 len: 468 { skbaddr: ffff8800d3c69900 } hitcount: 1 len: 46 { skbaddr: ffff88009ff09100 } hitcount: 1 len: 52 { skbaddr: ffff88010f13ab00 } hitcount: 1 len: 168 { skbaddr: ffff88006a54f400 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bcc500 } hitcount: 1 len: 260 { skbaddr: ffff880064505000 } hitcount: 1 len: 46 { skbaddr: ffff8800baf24e00 } hitcount: 1 len: 32 { skbaddr: ffff88009fe0ad00 } hitcount: 1 len: 46 { skbaddr: ffff8800d3edff00 } hitcount: 1 len: 44 { skbaddr: ffff88009fe0b400 } hitcount: 1 len: 168 { skbaddr: ffff8800a1c55a00 } hitcount: 1 len: 40 { skbaddr: ffff8800d2bcd100 } hitcount: 1 len: 40 { skbaddr: ffff880064505f00 } hitcount: 1 len: 174 { skbaddr: ffff8800a8bff200 } hitcount: 1 len: 160 { skbaddr: ffff880044e3cc00 } hitcount: 1 len: 76 { skbaddr: ffff8800a8bfe700 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bcdc00 } hitcount: 1 len: 32 { skbaddr: ffff8800a1f64800 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bcde00 } hitcount: 1 len: 988 { skbaddr: ffff88006a5dea00 } hitcount: 1 len: 46 { skbaddr: ffff88002e37a200 } hitcount: 1 len: 44 { skbaddr: ffff8800a1f32c00 } hitcount: 2 len: 676 { skbaddr: ffff88000ad52600 } hitcount: 2 len: 107 { skbaddr: ffff8800a1f91e00 } hitcount: 2 len: 92 { skbaddr: ffff8800af5a0200 } hitcount: 2 len: 142 { skbaddr: ffff8800d2bcc600 } hitcount: 2 len: 220 { skbaddr: ffff8800ba36f500 } hitcount: 2 len: 92 { skbaddr: ffff8800d021f800 } hitcount: 2 len: 92 { skbaddr: ffff8800a1f33600 } hitcount: 2 len: 675 { skbaddr: ffff8800a8bfff00 } hitcount: 3 len: 138 { skbaddr: ffff8800d62a1300 } hitcount: 3 len: 138 { skbaddr: ffff88002e37a100 } hitcount: 4 len: 184 { skbaddr: ffff880064504400 } hitcount: 4 len: 184 { skbaddr: ffff8800a8bfec00 } hitcount: 4 len: 184 { skbaddr: ffff88000ad53700 } hitcount: 5 len: 230 { skbaddr: ffff8800d2bcdb00 } hitcount: 5 len: 196 { skbaddr: ffff8800a1f90000 } hitcount: 6 len: 276 { skbaddr: ffff88006a54f900 } hitcount: 6 len: 276 Totals: Hits: 81 Entries: 42 Dropped: 0 # event histogram # # trigger info: hist:name=foo:keys=skbaddr.hex:vals=hitcount,len:sort=hitcount:size=2048 [active] # { skbaddr: ffff88000ad53500 } hitcount: 1 len: 46 { skbaddr: ffff8800af5a1500 } hitcount: 1 len: 76 { skbaddr: ffff8800d62a1900 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bccb00 } hitcount: 1 len: 468 { skbaddr: ffff8800d3c69900 } hitcount: 1 len: 46 { skbaddr: ffff88009ff09100 } hitcount: 1 len: 52 { skbaddr: ffff88010f13ab00 } hitcount: 1 len: 168 { skbaddr: ffff88006a54f400 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bcc500 } hitcount: 1 len: 260 { skbaddr: ffff880064505000 } hitcount: 1 len: 46 { skbaddr: ffff8800baf24e00 } hitcount: 1 len: 32 { skbaddr: ffff88009fe0ad00 } hitcount: 1 len: 46 { skbaddr: ffff8800d3edff00 } hitcount: 1 len: 44 { skbaddr: ffff88009fe0b400 } hitcount: 1 len: 168 { skbaddr: ffff8800a1c55a00 } hitcount: 1 len: 40 { skbaddr: ffff8800d2bcd100 } hitcount: 1 len: 40 { skbaddr: ffff880064505f00 } hitcount: 1 len: 174 { skbaddr: ffff8800a8bff200 } hitcount: 1 len: 160 { skbaddr: ffff880044e3cc00 } hitcount: 1 len: 76 { skbaddr: ffff8800a8bfe700 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bcdc00 } hitcount: 1 len: 32 { skbaddr: ffff8800a1f64800 } hitcount: 1 len: 46 { skbaddr: ffff8800d2bcde00 } hitcount: 1 len: 988 { skbaddr: ffff88006a5dea00 } hitcount: 1 len: 46 { skbaddr: ffff88002e37a200 } hitcount: 1 len: 44 { skbaddr: ffff8800a1f32c00 } hitcount: 2 len: 676 { skbaddr: ffff88000ad52600 } hitcount: 2 len: 107 { skbaddr: ffff8800a1f91e00 } hitcount: 2 len: 92 { skbaddr: ffff8800af5a0200 } hitcount: 2 len: 142 { skbaddr: ffff8800d2bcc600 } hitcount: 2 len: 220 { skbaddr: ffff8800ba36f500 } hitcount: 2 len: 92 { skbaddr: ffff8800d021f800 } hitcount: 2 len: 92 { skbaddr: ffff8800a1f33600 } hitcount: 2 len: 675 { skbaddr: ffff8800a8bfff00 } hitcount: 3 len: 138 { skbaddr: ffff8800d62a1300 } hitcount: 3 len: 138 { skbaddr: ffff88002e37a100 } hitcount: 4 len: 184 { skbaddr: ffff880064504400 } hitcount: 4 len: 184 { skbaddr: ffff8800a8bfec00 } hitcount: 4 len: 184 { skbaddr: ffff88000ad53700 } hitcount: 5 len: 230 { skbaddr: ffff8800d2bcdb00 } hitcount: 5 len: 196 { skbaddr: ffff8800a1f90000 } hitcount: 6 len: 276 { skbaddr: ffff88006a54f900 } hitcount: 6 len: 276 Totals: Hits: 81 Entries: 42 Dropped: 0And here's an example that shows how to combine histogram data from any two events even if they don't share any 'compatible' fields other than 'hitcount' and 'common_stacktrace'. These commands create a couple of triggers named 'bar' using those fields:
# echo 'hist:name=bar:key=common_stacktrace:val=hitcount' > \ /sys/kernel/tracing/events/sched/sched_process_fork/trigger # echo 'hist:name=bar:key=common_stacktrace:val=hitcount' > \ /sys/kernel/tracing/events/net/netif_rx/triggerAnd displaying the output of either shows some interesting if somewhat confusing output:
# cat /sys/kernel/tracing/events/sched/sched_process_fork/hist # cat /sys/kernel/tracing/events/net/netif_rx/hist # event histogram # # trigger info: hist:name=bar:keys=common_stacktrace:vals=hitcount:sort=hitcount:size=2048 [active] # { common_stacktrace: kernel_clone+0x18e/0x330 kernel_thread+0x29/0x30 kthreadd+0x154/0x1b0 ret_from_fork+0x3f/0x70 } hitcount: 1 { common_stacktrace: netif_rx_internal+0xb2/0xd0 netif_rx_ni+0x20/0x70 dev_loopback_xmit+0xaa/0xd0 ip_mc_output+0x126/0x240 ip_local_out_sk+0x31/0x40 igmp_send_report+0x1e9/0x230 igmp_timer_expire+0xe9/0x120 call_timer_fn+0x39/0xf0 run_timer_softirq+0x1e1/0x290 __do_softirq+0xfd/0x290 irq_exit+0x98/0xb0 smp_apic_timer_interrupt+0x4a/0x60 apic_timer_interrupt+0x6d/0x80 cpuidle_enter+0x17/0x20 call_cpuidle+0x3b/0x60 cpu_startup_entry+0x22d/0x310 } hitcount: 1 { common_stacktrace: netif_rx_internal+0xb2/0xd0 netif_rx_ni+0x20/0x70 dev_loopback_xmit+0xaa/0xd0 ip_mc_output+0x17f/0x240 ip_local_out_sk+0x31/0x40 ip_send_skb+0x1a/0x50 udp_send_skb+0x13e/0x270 udp_sendmsg+0x2bf/0x980 inet_sendmsg+0x67/0xa0 sock_sendmsg+0x38/0x50 SYSC_sendto+0xef/0x170 SyS_sendto+0xe/0x10 entry_SYSCALL_64_fastpath+0x12/0x6a } hitcount: 2 { common_stacktrace: netif_rx_internal+0xb2/0xd0 netif_rx+0x1c/0x60 loopback_xmit+0x6c/0xb0 dev_hard_start_xmit+0x219/0x3a0 __dev_queue_xmit+0x415/0x4f0 dev_queue_xmit_sk+0x13/0x20 ip_finish_output2+0x237/0x340 ip_finish_output+0x113/0x1d0 ip_output+0x66/0xc0 ip_local_out_sk+0x31/0x40 ip_send_skb+0x1a/0x50 udp_send_skb+0x16d/0x270 udp_sendmsg+0x2bf/0x980 inet_sendmsg+0x67/0xa0 sock_sendmsg+0x38/0x50 ___sys_sendmsg+0x14e/0x270 } hitcount: 76 { common_stacktrace: netif_rx_internal+0xb2/0xd0 netif_rx+0x1c/0x60 loopback_xmit+0x6c/0xb0 dev_hard_start_xmit+0x219/0x3a0 __dev_queue_xmit+0x415/0x4f0 dev_queue_xmit_sk+0x13/0x20 ip_finish_output2+0x237/0x340 ip_finish_output+0x113/0x1d0 ip_output+0x66/0xc0 ip_local_out_sk+0x31/0x40 ip_send_skb+0x1a/0x50 udp_send_skb+0x16d/0x270 udp_sendmsg+0x2bf/0x980 inet_sendmsg+0x67/0xa0 sock_sendmsg+0x38/0x50 ___sys_sendmsg+0x269/0x270 } hitcount: 77 { common_stacktrace: netif_rx_internal+0xb2/0xd0 netif_rx+0x1c/0x60 loopback_xmit+0x6c/0xb0 dev_hard_start_xmit+0x219/0x3a0 __dev_queue_xmit+0x415/0x4f0 dev_queue_xmit_sk+0x13/0x20 ip_finish_output2+0x237/0x340 ip_finish_output+0x113/0x1d0 ip_output+0x66/0xc0 ip_local_out_sk+0x31/0x40 ip_send_skb+0x1a/0x50 udp_send_skb+0x16d/0x270 udp_sendmsg+0x2bf/0x980 inet_sendmsg+0x67/0xa0 sock_sendmsg+0x38/0x50 SYSC_sendto+0xef/0x170 } hitcount: 88 { common_stacktrace: kernel_clone+0x18e/0x330 SyS_clone+0x19/0x20 entry_SYSCALL_64_fastpath+0x12/0x6a } hitcount: 244 Totals: Hits: 489 Entries: 7 Dropped: 0
2.4. Inter-event hist triggers #
Inter-event hist triggers are hist triggers that combine values from one or more other events and create a histogram using that data. Data from an inter-event histogram can in turn become the source for further combined histograms, thus providing a chain of related histograms, which is important for some applications.
The most important example of an inter-event quantity that can be used in this manner is latency, which is simply a difference in timestamps between two events. Although latency is the most important inter-event quantity, note that because the support is completely general across the trace event subsystem, any event field can be used in an inter-event quantity.
An example of a histogram that combines data from other histograms into a useful chain would be a 'wakeupswitch latency' histogram that combines a 'wakeup latency' histogram and a 'switch latency' histogram.
Normally, a hist trigger specification consists of a (possibly compound) key along with one or more numeric values, which are continually updated sums associated with that key. A histogram specification in this case consists of individual key and value specifications that refer to trace event fields associated with a single event type.
The inter-event hist trigger extension allows fields from multiple events to be referenced and combined into a multi-event histogram specification. In support of this overall goal, a few enabling features have been added to the hist trigger support:
In order to compute an inter-event quantity, a value from one event needs to saved and then referenced from another event. This requires the introduction of support for histogram 'variables'.
The computation of inter-event quantities and their combination require some minimal amount of support for applying simple expressions to variables (+ and -).
A histogram consisting of inter-event quantities isn't logically a histogram on either event (so having the 'hist' file for either event host the histogram output doesn't really make sense). To address the idea that the histogram is associated with a combination of events, support is added allowing the creation of 'synthetic' events that are events derived from other events. These synthetic events are full-fledged events just like any other and can be used as such, as for instance to create the 'combination' histograms mentioned previously.
A set of 'actions' can be associated with histogram entries - these can be used to generate the previously mentioned synthetic events, but can also be used for other purposes, such as for example saving context when a 'max' latency has been hit.
Trace events don't have a 'timestamp' associated with them, but there is an implicit timestamp saved along with an event in the underlying ftrace ring buffer. This timestamp is now exposed as a a synthetic field named 'common_timestamp' which can be used in histograms as if it were any other event field; it isn't an actual field in the trace format but rather is a synthesized value that nonetheless can be used as if it were an actual field. By default it is in units of nanoseconds; appending '.usecs' to a common_timestamp field changes the units to microseconds.
A note on inter-event timestamps: If common_timestamp is used in a histogram, the trace buffer is automatically switched over to using absolute timestamps and the "global" trace clock, in order to avoid bogus timestamp differences with other clocks that aren't coherent across CPUs. This can be overridden by specifying one of the other trace clocks instead, using the "clock=XXX" hist trigger attribute, where XXX is any of the clocks listed in the tracing/trace_clock pseudo-file.
These features are described in more detail in the following sections.
2.5. Histogram Variables #
Variables are simply named locations used for saving and retrieving values between matching events. A 'matching' event is defined as an event that has a matching key - if a variable is saved for a histogram entry corresponding to that key, any subsequent event with a matching key can access that variable.
A variable's value is normally available to any subsequent event until it is set to something else by a subsequent event. The one exception to that rule is that any variable used in an expression is essentially 'read-once' - once it's used by an expression in a subsequent event, it's reset to its 'unset' state, which means it can't be used again unless it's set again. This ensures not only that an event doesn't use an uninitialized variable in a calculation, but that that variable is used only once and not for any unrelated subsequent match.
The basic syntax for saving a variable is to simply prefix a unique variable name not corresponding to any keyword along with an '=' sign to any event field.
Either keys or values can be saved and retrieved in this way. This creates a variable named 'ts0' for a histogram entry with the key 'next_pid':
# echo 'hist:keys=next_pid:vals=$ts0:ts0=common_timestamp ... >> \
event/trigger
The ts0 variable can be accessed by any subsequent event having the same pid as 'next_pid'.
Variable references are formed by prepending the variable name with the '$' sign. Thus for example, the ts0 variable above would be referenced as '$ts0' in expressions.
Because 'vals=' is used, the common_timestamp variable value above will also be summed as a normal histogram value would (though for a timestamp it makes little sense).
The below shows that a key value can also be saved in the same way:
# echo 'hist:timer_pid=common_pid:key=timer_pid ...' >> event/trigger
If a variable isn't a key variable or prefixed with 'vals=', the associated event field will be saved in a variable but won't be summed as a value:
# echo 'hist:keys=next_pid:ts1=common_timestamp ...' >> event/trigger
Multiple variables can be assigned at the same time. The below would result in both ts0 and b being created as variables, with both common_timestamp and field1 additionally being summed as values:
# echo 'hist:keys=pid:vals=$ts0,$b:ts0=common_timestamp,b=field1 ...' >> \
event/trigger
Note that variable assignments can appear either preceding or following their use. The command below behaves identically to the command above:
# echo 'hist:keys=pid:ts0=common_timestamp,b=field1:vals=$ts0,$b ...' >> \
event/trigger
Any number of variables not bound to a 'vals=' prefix can also be assigned by simply separating them with colons. Below is the same thing but without the values being summed in the histogram:
# echo 'hist:keys=pid:ts0=common_timestamp:b=field1 ...' >> event/trigger
Variables set as above can be referenced and used in expressions on another event.
For example, here's how a latency can be calculated:
# echo 'hist:keys=pid,prio:ts0=common_timestamp ...' >> event1/trigger
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp-$ts0 ...' >> event2/trigger
In the first line above, the event's timestamp is saved into the variable ts0. In the next line, ts0 is subtracted from the second event's timestamp to produce the latency, which is then assigned into yet another variable, 'wakeup_lat'. The hist trigger below in turn makes use of the wakeup_lat variable to compute a combined latency using the same key and variable from yet another event:
# echo 'hist:key=pid:wakeupswitch_lat=$wakeup_lat+$switchtime_lat ...' >> event3/trigger
Expressions support the use of addition, subtraction, multiplication and division operators (+-*/).
Note if division by zero cannot be detected at parse time (i.e. the divisor is not a constant), the result will be -1.
Numeric constants can also be used directly in an expression:
# echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/1000000 ...' >> event/trigger
or assigned to a variable and referenced in a subsequent expression:
# echo 'hist:keys=next_pid:us_per_sec=1000000 ...' >> event/trigger
# echo 'hist:keys=next_pid:timestamp_secs=common_timestamp/$us_per_sec ...' >> event/trigger
Variables can even hold stacktraces, which are useful with synthetic events.
2.6. Synthetic Events #
Synthetic events are user-defined events generated from hist trigger variables or fields associated with one or more other events. Their purpose is to provide a mechanism for displaying data spanning multiple events consistent with the existing and already familiar usage for normal events.
To define a synthetic event, the user writes a simple specification consisting of the name of the new event along with one or more variables and their types, which can be any valid field type, separated by semicolons, to the tracing/synthetic_events file.
See synth_field_size() for available types.
If field_name contains [n], the field is considered to be a static array.
If field_names contains[] (no subscript), the field is considered to be a dynamic array, which will only take as much space in the event as is required to hold the array.
A string field can be specified using either the static notation:
char name[32];
Or the dynamic:
char name[];
The size limit for either is 256.
For instance, the following creates a new event named 'wakeup_latency' with 3 fields: lat, pid, and prio. Each of those fields is simply a variable reference to a variable on another event:
# echo 'wakeup_latency \
u64 lat; \
pid_t pid; \
int prio' >> \
/sys/kernel/tracing/synthetic_events
Reading the tracing/synthetic_events file lists all the currently defined synthetic events, in this case the event defined above:
# cat /sys/kernel/tracing/synthetic_events
wakeup_latency u64 lat; pid_t pid; int prio
An existing synthetic event definition can be removed by prepending the command that defined it with a '!':
# echo '!wakeup_latency u64 lat pid_t pid int prio' >> \
/sys/kernel/tracing/synthetic_events
At this point, there isn't yet an actual 'wakeup_latency' event instantiated in the event subsystem - for this to happen, a 'hist trigger action' needs to be instantiated and bound to actual fields and variables defined on other events (see Section 2.7. below on how that is done using hist trigger 'onmatch' action). Once that is done, the 'wakeup_latency' synthetic event instance is created.
The new event is created under the tracing/events/synthetic/ directory and looks and behaves just like any other event:
# ls /sys/kernel/tracing/events/synthetic/wakeup_latency
enable filter format hist id trigger
A histogram can now be defined for the new synthetic event:
# echo 'hist:keys=pid,prio,lat.log2:sort=lat' >> \
/sys/kernel/tracing/events/synthetic/wakeup_latency/trigger
The above shows the latency "lat" in a power of 2 grouping.
Like any other event, once a histogram is enabled for the event, the output can be displayed by reading the event's 'hist' file:
# cat /sys/kernel/tracing/events/synthetic/wakeup_latency/hist
# event histogram
#
# trigger info: hist:keys=pid,prio,lat.log2:vals=hitcount:sort=lat.log2:size=2048 [active]
#
{ pid: 2035, prio: 9, lat: ~ 2^2 } hitcount: 43
{ pid: 2034, prio: 9, lat: ~ 2^2 } hitcount: 60
{ pid: 2029, prio: 9, lat: ~ 2^2 } hitcount: 965
{ pid: 2034, prio: 120, lat: ~ 2^2 } hitcount: 9
{ pid: 2033, prio: 120, lat: ~ 2^2 } hitcount: 5
{ pid: 2030, prio: 9, lat: ~ 2^2 } hitcount: 335
{ pid: 2030, prio: 120, lat: ~ 2^2 } hitcount: 10
{ pid: 2032, prio: 120, lat: ~ 2^2 } hitcount: 1
{ pid: 2035, prio: 120, lat: ~ 2^2 } hitcount: 2
{ pid: 2031, prio: 9, lat: ~ 2^2 } hitcount: 176
{ pid: 2028, prio: 120, lat: ~ 2^2 } hitcount: 15
{ pid: 2033, prio: 9, lat: ~ 2^2 } hitcount: 91
{ pid: 2032, prio: 9, lat: ~ 2^2 } hitcount: 125
{ pid: 2029, prio: 120, lat: ~ 2^2 } hitcount: 4
{ pid: 2031, prio: 120, lat: ~ 2^2 } hitcount: 3
{ pid: 2029, prio: 120, lat: ~ 2^3 } hitcount: 2
{ pid: 2035, prio: 9, lat: ~ 2^3 } hitcount: 41
{ pid: 2030, prio: 120, lat: ~ 2^3 } hitcount: 1
{ pid: 2032, prio: 9, lat: ~ 2^3 } hitcount: 32
{ pid: 2031, prio: 9, lat: ~ 2^3 } hitcount: 44
{ pid: 2034, prio: 9, lat: ~ 2^3 } hitcount: 40
{ pid: 2030, prio: 9, lat: ~ 2^3 } hitcount: 29
{ pid: 2033, prio: 9, lat: ~ 2^3 } hitcount: 31
{ pid: 2029, prio: 9, lat: ~ 2^3 } hitcount: 31
{ pid: 2028, prio: 120, lat: ~ 2^3 } hitcount: 18
{ pid: 2031, prio: 120, lat: ~ 2^3 } hitcount: 2
{ pid: 2028, prio: 120, lat: ~ 2^4 } hitcount: 1
{ pid: 2029, prio: 9, lat: ~ 2^4 } hitcount: 4
{ pid: 2031, prio: 120, lat: ~ 2^7 } hitcount: 1
{ pid: 2032, prio: 120, lat: ~ 2^7 } hitcount: 1
Totals:
Hits: 2122
Entries: 30
Dropped: 0
The latency values can also be grouped linearly by a given size with the ".buckets" modifier and specify a size (in this case groups of 10):
# echo 'hist:keys=pid,prio,lat.buckets=10:sort=lat' >> \
/sys/kernel/tracing/events/synthetic/wakeup_latency/trigger
# event histogram
#
# trigger info: hist:keys=pid,prio,lat.buckets=10:vals=hitcount:sort=lat.buckets=10:size=2048 [active]
#
{ pid: 2067, prio: 9, lat: ~ 0-9 } hitcount: 220
{ pid: 2068, prio: 9, lat: ~ 0-9 } hitcount: 157
{ pid: 2070, prio: 9, lat: ~ 0-9 } hitcount: 100
{ pid: 2067, prio: 120, lat: ~ 0-9 } hitcount: 6
{ pid: 2065, prio: 120, lat: ~ 0-9 } hitcount: 2
{ pid: 2066, prio: 120, lat: ~ 0-9 } hitcount: 2
{ pid: 2069, prio: 9, lat: ~ 0-9 } hitcount: 122
{ pid: 2069, prio: 120, lat: ~ 0-9 } hitcount: 8
{ pid: 2070, prio: 120, lat: ~ 0-9 } hitcount: 1
{ pid: 2068, prio: 120, lat: ~ 0-9 } hitcount: 7
{ pid: 2066, prio: 9, lat: ~ 0-9 } hitcount: 365
{ pid: 2064, prio: 120, lat: ~ 0-9 } hitcount: 35
{ pid: 2065, prio: 9, lat: ~ 0-9 } hitcount: 998
{ pid: 2071, prio: 9, lat: ~ 0-9 } hitcount: 85
{ pid: 2065, prio: 9, lat: ~ 10-19 } hitcount: 2
{ pid: 2064, prio: 120, lat: ~ 10-19 } hitcount: 2
Totals:
Hits: 2112
Entries: 16
Dropped: 0
To save stacktraces, create a synthetic event with a field of type "unsigned long[]" or even just "long[]". For example, to see how long a task is blocked in an uninterruptible state:
# cd /sys/kernel/tracing
# echo 's:block_lat pid_t pid; u64 delta; unsigned long[] stack;' > dynamic_events
# echo 'hist:keys=next_pid:ts=common_timestamp.usecs,st=common_stacktrace if prev_state == 2' >> events/sched/sched_switch/trigger
# echo 'hist:keys=prev_pid:delta=common_timestamp.usecs-$ts,s=$st:onmax($delta).trace(block_lat,prev_pid,$delta,$s)' >> events/sched/sched_switch/trigger
# echo 1 > events/synthetic/block_lat/enable
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2 #P:8
#
# _-----=> irqs-off/BH-disabled
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / _-=> migrate-disable
# |||| / delay
# TASK-PID CPU# ||||| TIMESTAMP FUNCTION
# | | | ||||| | |
<idle>-0 [005] d..4. 521.164922: block_lat: pid=0 delta=8322 stack=STACK:
=> __schedule+0x448/0x7b0
=> schedule+0x5a/0xb0
=> io_schedule+0x42/0x70
=> bit_wait_io+0xd/0x60
=> __wait_on_bit+0x4b/0x140
=> out_of_line_wait_on_bit+0x91/0xb0
=> jbd2_journal_commit_transaction+0x1679/0x1a70
=> kjournald2+0xa9/0x280
=> kthread+0xe9/0x110
=> ret_from_fork+0x2c/0x50
<...>-2 [004] d..4. 525.184257: block_lat: pid=2 delta=76 stack=STACK:
=> __schedule+0x448/0x7b0
=> schedule+0x5a/0xb0
=> schedule_timeout+0x11a/0x150
=> wait_for_completion_killable+0x144/0x1f0
=> __kthread_create_on_node+0xe7/0x1e0
=> kthread_create_on_node+0x51/0x70
=> create_worker+0xcc/0x1a0
=> worker_thread+0x2ad/0x380
=> kthread+0xe9/0x110
=> ret_from_fork+0x2c/0x50
A synthetic event that has a stacktrace field may use it as a key in histogram:
# echo 'hist:keys=delta.buckets=100,stack.stacktrace:sort=delta' > events/synthetic/block_lat/trigger
# cat events/synthetic/block_lat/hist
# event histogram
#
# trigger info: hist:keys=delta.buckets=100,stack.stacktrace:vals=hitcount:sort=delta.buckets=100:size=2048 [active]
#
{ delta: ~ 0-99, stack.stacktrace __schedule+0xa19/0x1520
schedule+0x6b/0x110
io_schedule+0x46/0x80
bit_wait_io+0x11/0x80
__wait_on_bit+0x4e/0x120
out_of_line_wait_on_bit+0x8d/0xb0
__wait_on_buffer+0x33/0x40
jbd2_journal_commit_transaction+0x155a/0x19b0
kjournald2+0xab/0x270
kthread+0xfa/0x130
ret_from_fork+0x29/0x50
} hitcount: 1
{ delta: ~ 0-99, stack.stacktrace __schedule+0xa19/0x1520
schedule+0x6b/0x110
io_schedule+0x46/0x80
rq_qos_wait+0xd0/0x170
wbt_wait+0x9e/0xf0
__rq_qos_throttle+0x25/0x40
blk_mq_submit_bio+0x2c3/0x5b0
__submit_bio+0xff/0x190
submit_bio_noacct_nocheck+0x25b/0x2b0
submit_bio_noacct+0x20b/0x600
submit_bio+0x28/0x90
ext4_bio_write_page+0x1e0/0x8c0
mpage_submit_page+0x60/0x80
mpage_process_page_bufs+0x16c/0x180
mpage_prepare_extent_to_map+0x23f/0x530
} hitcount: 1
{ delta: ~ 0-99, stack.stacktrace __schedule+0xa19/0x1520
schedule+0x6b/0x110
schedule_hrtimeout_range_clock+0x97/0x110
schedule_hrtimeout_range+0x13/0x20
usleep_range_state+0x65/0x90
__intel_wait_for_register+0x1c1/0x230 [i915]
intel_psr_wait_for_idle_locked+0x171/0x2a0 [i915]
intel_pipe_update_start+0x169/0x360 [i915]
intel_update_crtc+0x112/0x490 [i915]
skl_commit_modeset_enables+0x199/0x600 [i915]
intel_atomic_commit_tail+0x7c4/0x1080 [i915]
intel_atomic_commit_work+0x12/0x20 [i915]
process_one_work+0x21c/0x3f0
worker_thread+0x50/0x3e0
kthread+0xfa/0x130
} hitcount: 3
{ delta: ~ 0-99, stack.stacktrace __schedule+0xa19/0x1520
schedule+0x6b/0x110
schedule_timeout+0x11e/0x160
__wait_for_common+0x8f/0x190
wait_for_completion+0x24/0x30
__flush_work.isra.0+0x1cc/0x360
flush_work+0xe/0x20
drm_mode_rmfb+0x18b/0x1d0 [drm]
drm_mode_rmfb_ioctl+0x10/0x20 [drm]
drm_ioctl_kernel+0xb8/0x150 [drm]
drm_ioctl+0x243/0x560 [drm]
__x64_sys_ioctl+0x92/0xd0
do_syscall_64+0x59/0x90
entry_SYSCALL_64_after_hwframe+0x72/0xdc
} hitcount: 1
{ delta: ~ 0-99, stack.stacktrace __schedule+0xa19/0x1520
schedule+0x6b/0x110
schedule_timeout+0x87/0x160
__wait_for_common+0x8f/0x190
wait_for_completion_timeout+0x1d/0x30
drm_atomic_helper_wait_for_flip_done+0x57/0x90 [drm_kms_helper]
intel_atomic_commit_tail+0x8ce/0x1080 [i915]
intel_atomic_commit_work+0x12/0x20 [i915]
process_one_work+0x21c/0x3f0
worker_thread+0x50/0x3e0
kthread+0xfa/0x130
ret_from_fork+0x29/0x50
} hitcount: 1
{ delta: ~ 100-199, stack.stacktrace __schedule+0xa19/0x1520
schedule+0x6b/0x110
schedule_hrtimeout_range_clock+0x97/0x110
schedule_hrtimeout_range+0x13/0x20
usleep_range_state+0x65/0x90
pci_set_low_power_state+0x17f/0x1f0
pci_set_power_state+0x49/0x250
pci_finish_runtime_suspend+0x4a/0x90
pci_pm_runtime_suspend+0xcb/0x1b0
__rpm_callback+0x48/0x120
rpm_callback+0x67/0x70
rpm_suspend+0x167/0x780
rpm_idle+0x25a/0x380
pm_runtime_work+0x93/0xc0
process_one_work+0x21c/0x3f0
} hitcount: 1
Totals:
Hits: 10
Entries: 7
Dropped: 0
2.7. Hist trigger 'handlers' and 'actions' #
A hist trigger 'action' is a function that's executed (in most cases conditionally) whenever a histogram entry is added or updated.
When a histogram entry is added or updated, a hist trigger 'handler' is what decides whether the corresponding action is actually invoked or not.
Hist trigger handlers and actions are paired together in the general form:
<handler>.<action>
To specify a handler.action pair for a given event, simply specify that handler.action pair between colons in the hist trigger specification.
In theory, any handler can be combined with any action, but in practice, not every handler.action combination is currently supported; if a given handler.action combination isn't supported, the hist trigger will fail with -EINVAL;
The default 'handler.action' if none is explicitly specified is as it always has been, to simply update the set of values associated with an entry. Some applications, however, may want to perform additional actions at that point, such as generate another event, or compare and save a maximum.
The supported handlers and actions are listed below, and each is described in more detail in the following paragraphs, in the context of descriptions of some common and useful handler.action combinations.
The available handlers are:
onmatch(matching.event) - invoke action on any addition or update
onmax(var) - invoke action if var exceeds current max
onchange(var) - invoke action if var changes
The available actions are:
trace(<synthetic_event_name>,param list) - generate synthetic event
save(field,...) - save current event fields
snapshot() - snapshot the trace buffer
The following commonly-used handler.action pairs are available:
onmatch(matching.event).trace(<synthetic_event_name>,param list)
The 'onmatch(matching.event).trace(<synthetic_event_name>,param list)' hist trigger action is invoked whenever an event matches and the histogram entry would be added or updated. It causes the named synthetic event to be generated with the values given in the 'param list'. The result is the generation of a synthetic event that consists of the values contained in those variables at the time the invoking event was hit. For example, if the synthetic event name is 'wakeup_latency', a wakeup_latency event is generated using onmatch(event).trace(wakeup_latency,arg1,arg2).
There is also an equivalent alternative form available for generating synthetic events. In this form, the synthetic event name is used as if it were a function name. For example, using the 'wakeup_latency' synthetic event name again, the wakeup_latency event would be generated by invoking it as if it were a function call, with the event field values passed in as arguments: onmatch(event).wakeup_latency(arg1,arg2). The syntax for this form is:
onmatch(matching.event).<synthetic_event_name>(param list)
In either case, the 'param list' consists of one or more parameters which may be either variables or fields defined on either the 'matching.event' or the target event. The variables or fields specified in the param list may be either fully-qualified or unqualified. If a variable is specified as unqualified, it must be unique between the two events. A field name used as a param can be unqualified if it refers to the target event, but must be fully qualified if it refers to the matching event. A fully-qualified name is of the form 'system.event_name.$var_name' or 'system.event_name.field'.
The 'matching.event' specification is simply the fully qualified event name of the event that matches the target event for the onmatch() functionality, in the form 'system.event_name'. Histogram keys of both events are compared to find if events match. In case multiple histogram keys are used, they all must match in the specified order.
Finally, the number and type of variables/fields in the 'param list' must match the number and types of the fields in the synthetic event being generated.
As an example the below defines a simple synthetic event and uses a variable defined on the sched_wakeup_new event as a parameter when invoking the synthetic event. Here we define the synthetic event:
# echo 'wakeup_new_test pid_t pid' >> \ /sys/kernel/tracing/synthetic_events # cat /sys/kernel/tracing/synthetic_events wakeup_new_test pid_t pidThe following hist trigger both defines the missing testpid variable and specifies an onmatch() action that generates a wakeup_new_test synthetic event whenever a sched_wakeup_new event occurs, which because of the 'if comm == "cyclictest"' filter only happens when the executable is cyclictest:
# echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\ wakeup_new_test($testpid) if comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_wakeup_new/triggerOr, equivalently, using the 'trace' keyword syntax:
# echo 'hist:keys=$testpid:testpid=pid:onmatch(sched.sched_wakeup_new).\ trace(wakeup_new_test,$testpid) if comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_wakeup_new/triggerCreating and displaying a histogram based on those events is now just a matter of using the fields and new synthetic event in the tracing/events/synthetic directory, as usual:
# echo 'hist:keys=pid:sort=pid' >> \ /sys/kernel/tracing/events/synthetic/wakeup_new_test/triggerRunning 'cyclictest' should cause wakeup_new events to generate wakeup_new_test synthetic events which should result in histogram output in the wakeup_new_test event's hist file:
# cat /sys/kernel/tracing/events/synthetic/wakeup_new_test/histA more typical usage would be to use two events to calculate a latency. The following example uses a set of hist triggers to produce a 'wakeup_latency' histogram.
First, we define a 'wakeup_latency' synthetic event:
# echo 'wakeup_latency u64 lat; pid_t pid; int prio' >> \ /sys/kernel/tracing/synthetic_eventsNext, we specify that whenever we see a sched_waking event for a cyclictest thread, save the timestamp in a 'ts0' variable:
# echo 'hist:keys=$saved_pid:saved_pid=pid:ts0=common_timestamp.usecs \ if comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_waking/triggerThen, when the corresponding thread is actually scheduled onto the CPU by a sched_switch event (saved_pid matches next_pid), calculate the latency and use that along with another variable and an event field to generate a wakeup_latency synthetic event:
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:\ onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,\ $saved_pid,next_prio) if next_comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_switch/triggerWe also need to create a histogram on the wakeup_latency synthetic event in order to aggregate the generated synthetic event data:
# echo 'hist:keys=pid,prio,lat:sort=pid,lat' >> \ /sys/kernel/tracing/events/synthetic/wakeup_latency/triggerFinally, once we've run cyclictest to actually generate some events, we can see the output by looking at the wakeup_latency synthetic event's hist file:
# cat /sys/kernel/tracing/events/synthetic/wakeup_latency/histonmax(var).save(field,.. .)
The 'onmax(var).save(field,...)' hist trigger action is invoked whenever the value of 'var' associated with a histogram entry exceeds the current maximum contained in that variable.
The end result is that the trace event fields specified as the onmax.save() params will be saved if 'var' exceeds the current maximum for that hist trigger entry. This allows context from the event that exhibited the new maximum to be saved for later reference. When the histogram is displayed, additional fields displaying the saved values will be printed.
As an example the below defines a couple of hist triggers, one for sched_waking and another for sched_switch, keyed on pid. Whenever a sched_waking occurs, the timestamp is saved in the entry corresponding to the current pid, and when the scheduler switches back to that pid, the timestamp difference is calculated. If the resulting latency, stored in wakeup_lat, exceeds the current maximum latency, the values specified in the save() fields are recorded:
# echo 'hist:keys=pid:ts0=common_timestamp.usecs \ if comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_waking/trigger # echo 'hist:keys=next_pid:\ wakeup_lat=common_timestamp.usecs-$ts0:\ onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) \ if next_comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_switch/triggerWhen the histogram is displayed, the max value and the saved values corresponding to the max are displayed following the rest of the fields:
# cat /sys/kernel/tracing/events/sched/sched_switch/hist { next_pid: 2255 } hitcount: 239 common_timestamp-ts0: 0 max: 27 next_comm: cyclictest prev_pid: 0 prev_prio: 120 prev_comm: swapper/1 { next_pid: 2256 } hitcount: 2355 common_timestamp-ts0: 0 max: 49 next_comm: cyclictest prev_pid: 0 prev_prio: 120 prev_comm: swapper/0 Totals: Hits: 12970 Entries: 2 Dropped: 0onmax(var).snapshot()
The 'onmax(var).snapshot()' hist trigger action is invoked whenever the value of 'var' associated with a histogram entry exceeds the current maximum contained in that variable.
The end result is that a global snapshot of the trace buffer will be saved in the tracing/snapshot file if 'var' exceeds the current maximum for any hist trigger entry.
Note that in this case the maximum is a global maximum for the current trace instance, which is the maximum across all buckets of the histogram. The key of the specific trace event that caused the global maximum and the global maximum itself are displayed, along with a message stating that a snapshot has been taken and where to find it. The user can use the key information displayed to locate the corresponding bucket in the histogram for even more detail.
As an example the below defines a couple of hist triggers, one for sched_waking and another for sched_switch, keyed on pid. Whenever a sched_waking event occurs, the timestamp is saved in the entry corresponding to the current pid, and when the scheduler switches back to that pid, the timestamp difference is calculated. If the resulting latency, stored in wakeup_lat, exceeds the current maximum latency, a snapshot is taken. As part of the setup, all the scheduler events are also enabled, which are the events that will show up in the snapshot when it is taken at some point:
# echo 1 > /sys/kernel/tracing/events/sched/enable # echo 'hist:keys=pid:ts0=common_timestamp.usecs \ if comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_waking/trigger # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \ onmax($wakeup_lat).save(next_prio,next_comm,prev_pid,prev_prio, \ prev_comm):onmax($wakeup_lat).snapshot() \ if next_comm=="cyclictest"' >> \ /sys/kernel/tracing/events/sched/sched_switch/triggerWhen the histogram is displayed, for each bucket the max value and the saved values corresponding to the max are displayed following the rest of the fields.
If a snapshot was taken, there is also a message indicating that, along with the value and event that triggered the global maximum:
# cat /sys/kernel/tracing/events/sched/sched_switch/hist { next_pid: 2101 } hitcount: 200 max: 52 next_prio: 120 next_comm: cyclictest \ prev_pid: 0 prev_prio: 120 prev_comm: swapper/6 { next_pid: 2103 } hitcount: 1326 max: 572 next_prio: 19 next_comm: cyclictest \ prev_pid: 0 prev_prio: 120 prev_comm: swapper/1 { next_pid: 2102 } hitcount: 1982 \ max: 74 next_prio: 19 next_comm: cyclictest \ prev_pid: 0 prev_prio: 120 prev_comm: swapper/5 Snapshot taken (see tracing/snapshot). Details: triggering value { onmax($wakeup_lat) }: 572 \ triggered by event with key: { next_pid: 2103 } Totals: Hits: 3508 Entries: 3 Dropped: 0In the above case, the event that triggered the global maximum has the key with next_pid == 2103. If you look at the bucket that has 2103 as the key, you'll find the additional values save()'d along with the local maximum for that bucket, which should be the same as the global maximum (since that was the same value that triggered the global snapshot).
And finally, looking at the snapshot data should show at or near the end the event that triggered the snapshot (in this case you can verify the timestamps between the sched_waking and sched_switch events, which should match the time displayed in the global maximum):
# cat /sys/kernel/tracing/snapshot <...>-2103 [005] d..3 309.873125: sched_switch: prev_comm=cyclictest prev_pid=2103 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 <idle>-0 [005] d.h3 309.873611: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 <idle>-0 [005] dNh4 309.873613: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 <idle>-0 [005] d..3 309.873616: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 <...>-2102 [005] d..3 309.873625: sched_switch: prev_comm=cyclictest prev_pid=2102 prev_prio=19 prev_state=D ==> next_comm=swapper/5 next_pid=0 next_prio=120 <idle>-0 [005] d.h3 309.874624: sched_waking: comm=cyclictest pid=2102 prio=19 target_cpu=005 <idle>-0 [005] dNh4 309.874626: sched_wakeup: comm=cyclictest pid=2102 prio=19 target_cpu=005 <idle>-0 [005] dNh3 309.874628: sched_waking: comm=cyclictest pid=2103 prio=19 target_cpu=005 <idle>-0 [005] dNh4 309.874630: sched_wakeup: comm=cyclictest pid=2103 prio=19 target_cpu=005 <idle>-0 [005] d..3 309.874633: sched_switch: prev_comm=swapper/5 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2102 next_prio=19 <idle>-0 [004] d.h3 309.874757: sched_waking: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 <idle>-0 [004] dNh4 309.874762: sched_wakeup: comm=gnome-terminal- pid=1699 prio=120 target_cpu=004 <idle>-0 [004] d..3 309.874766: sched_switch: prev_comm=swapper/4 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=gnome-terminal- next_pid=1699 next_prio=120 gnome-terminal--1699 [004] d.h2 309.874941: sched_stat_runtime: comm=gnome-terminal- pid=1699 runtime=180706 [ns] vruntime=1126870572 [ns] <idle>-0 [003] d.s4 309.874956: sched_waking: comm=rcu_sched pid=9 prio=120 target_cpu=007 <idle>-0 [003] d.s5 309.874960: sched_wake_idle_without_ipi: cpu=7 <idle>-0 [003] d.s5 309.874961: sched_wakeup: comm=rcu_sched pid=9 prio=120 target_cpu=007 <idle>-0 [007] d..3 309.874963: sched_switch: prev_comm=swapper/7 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=rcu_sched next_pid=9 next_prio=120 rcu_sched-9 [007] d..3 309.874973: sched_stat_runtime: comm=rcu_sched pid=9 runtime=13646 [ns] vruntime=22531430286 [ns] rcu_sched-9 [007] d..3 309.874978: sched_switch: prev_comm=rcu_sched prev_pid=9 prev_prio=120 prev_state=R+ ==> next_comm=swapper/7 next_pid=0 next_prio=120 <...>-2102 [005] d..4 309.874994: sched_migrate_task: comm=cyclictest pid=2103 prio=19 orig_cpu=5 dest_cpu=1 <...>-2102 [005] d..4 309.875185: sched_wake_idle_without_ipi: cpu=1 <idle>-0 [001] d..3 309.875200: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=S ==> next_comm=cyclictest next_pid=2103 next_prio=19onchange(var).save(field,.. .)
The 'onchange(var).save(field,...)' hist trigger action is invoked whenever the value of 'var' associated with a histogram entry changes.
The end result is that the trace event fields specified as the onchange.save() params will be saved if 'var' changes for that hist trigger entry. This allows context from the event that changed the value to be saved for later reference. When the histogram is displayed, additional fields displaying the saved values will be printed.
onchange(var).snapshot()
The 'onchange(var).snapshot()' hist trigger action is invoked whenever the value of 'var' associated with a histogram entry changes.
The end result is that a global snapshot of the trace buffer will be saved in the tracing/snapshot file if 'var' changes for any hist trigger entry.
Note that in this case the changed value is a global variable associated with current trace instance. The key of the specific trace event that caused the value to change and the global value itself are displayed, along with a message stating that a snapshot has been taken and where to find it. The user can use the key information displayed to locate the corresponding bucket in the histogram for even more detail.
As an example the below defines a hist trigger on the tcp_probe event, keyed on dport. Whenever a tcp_probe event occurs, the cwnd field is checked against the current value stored in the $cwnd variable. If the value has changed, a snapshot is taken. As part of the setup, all the scheduler and tcp events are also enabled, which are the events that will show up in the snapshot when it is taken at some point:
# echo 1 > /sys/kernel/tracing/events/sched/enable # echo 1 > /sys/kernel/tracing/events/tcp/enable # echo 'hist:keys=dport:cwnd=snd_cwnd: \ onchange($cwnd).save(snd_wnd,srtt,rcv_wnd): \ onchange($cwnd).snapshot()' >> \ /sys/kernel/tracing/events/tcp/tcp_probe/triggerWhen the histogram is displayed, for each bucket the tracked value and the saved values corresponding to that value are displayed following the rest of the fields.
If a snapshot was taken, there is also a message indicating that, along with the value and event that triggered the snapshot:
# cat /sys/kernel/tracing/events/tcp/tcp_probe/hist { dport: 1521 } hitcount: 8 changed: 10 snd_wnd: 35456 srtt: 154262 rcv_wnd: 42112 { dport: 80 } hitcount: 23 changed: 10 snd_wnd: 28960 srtt: 19604 rcv_wnd: 29312 { dport: 9001 } hitcount: 172 changed: 10 snd_wnd: 48384 srtt: 260444 rcv_wnd: 55168 { dport: 443 } hitcount: 211 changed: 10 snd_wnd: 26960 srtt: 17379 rcv_wnd: 28800 Snapshot taken (see tracing/snapshot). Details: triggering value { onchange($cwnd) }: 10 triggered by event with key: { dport: 80 } Totals: Hits: 414 Entries: 4 Dropped: 0In the above case, the event that triggered the snapshot has the key with dport == 80. If you look at the bucket that has 80 as the key, you'll find the additional values save()'d along with the changed value for that bucket, which should be the same as the global changed value (since that was the same value that triggered the global snapshot).
And finally, looking at the snapshot data should show at or near the end the event that triggered the snapshot:
# cat /sys/kernel/tracing/snapshot gnome-shell-1261 [006] dN.3 49.823113: sched_stat_runtime: comm=gnome-shell pid=1261 runtime=49347 [ns] vruntime=1835730389 [ns] kworker/u16:4-773 [003] d..3 49.823114: sched_switch: prev_comm=kworker/u16:4 prev_pid=773 prev_prio=120 prev_state=R+ ==> next_comm=kworker/3:2 next_pid=135 next_prio=120 gnome-shell-1261 [006] d..3 49.823114: sched_switch: prev_comm=gnome-shell prev_pid=1261 prev_prio=120 prev_state=R+ ==> next_comm=kworker/6:2 next_pid=387 next_prio=120 kworker/3:2-135 [003] d..3 49.823118: sched_stat_runtime: comm=kworker/3:2 pid=135 runtime=5339 [ns] vruntime=17815800388 [ns] kworker/6:2-387 [006] d..3 49.823120: sched_stat_runtime: comm=kworker/6:2 pid=387 runtime=9594 [ns] vruntime=14589605367 [ns] kworker/6:2-387 [006] d..3 49.823122: sched_switch: prev_comm=kworker/6:2 prev_pid=387 prev_prio=120 prev_state=R+ ==> next_comm=gnome-shell next_pid=1261 next_prio=120 kworker/3:2-135 [003] d..3 49.823123: sched_switch: prev_comm=kworker/3:2 prev_pid=135 prev_prio=120 prev_state=T ==> next_comm=swapper/3 next_pid=0 next_prio=120 <idle>-0 [004] ..s7 49.823798: tcp_probe: src=10.0.0.10:54326 dest=23.215.104.193:80 mark=0x0 length=32 snd_nxt=0xe3ae2ff5 snd_una=0xe3ae2ecd snd_cwnd=10 ssthresh=2147483647 snd_wnd=28960 srtt=19604 rcv_wnd=29312
2.8. User space creating a trigger #
Writing into /sys/kernel/tracing/trace_marker writes into the ftrace ring buffer. This can also act like an event, by writing into the trigger file located in /sys/kernel/tracing/events/ftrace/print/
Modifying cyclictest to write into the trace_marker file before it sleeps and after it wakes up, something like this:
static void traceputs(char *str)
{
/* tracemark_fd is the trace_marker file descriptor */
if (tracemark_fd < 0)
return;
/* write the tracemark message */
write(tracemark_fd, str, strlen(str));
}
And later add something like:
traceputs("start");
clock_nanosleep(...);
traceputs("end");
We can make a histogram from this:
# cd /sys/kernel/tracing
# echo 'latency u64 lat' > synthetic_events
# echo 'hist:keys=common_pid:ts0=common_timestamp.usecs if buf == "start"' > events/ftrace/print/trigger
# echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat) if buf == "end"' >> events/ftrace/print/trigger
# echo 'hist:keys=lat,common_pid:sort=lat' > events/synthetic/latency/trigger
The above created a synthetic event called "latency" and two histograms against the trace_marker, one gets triggered when "start" is written into the trace_marker file and the other when "end" is written. If the pids match, then it will call the "latency" synthetic event with the calculated latency as its parameter. Finally, a histogram is added to the latency synthetic event to record the calculated latency along with the pid.
Now running cyclictest with:
# ./cyclictest -p80 -d0 -i250 -n -a -t --tracemark -b 1000
-p80 : run threads at priority 80
-d0 : have all threads run at the same interval
-i250 : start the interval at 250 microseconds (all threads will do this)
-n : sleep with nanosleep
-a : affine all threads to a separate CPU
-t : one thread per available CPU
--tracemark : enable trace mark writing
-b 1000 : stop if any latency is greater than 1000 microseconds
Note, the -b 1000 is used just to make --tracemark available.
Then we can see the histogram created by this with:
# cat events/synthetic/latency/hist
# event histogram
#
# trigger info: hist:keys=lat,common_pid:vals=hitcount:sort=lat:size=2048 [active]
#
{ lat: 107, common_pid: 2039 } hitcount: 1
{ lat: 122, common_pid: 2041 } hitcount: 1
{ lat: 166, common_pid: 2039 } hitcount: 1
{ lat: 174, common_pid: 2039 } hitcount: 1
{ lat: 194, common_pid: 2041 } hitcount: 1
{ lat: 196, common_pid: 2036 } hitcount: 1
{ lat: 197, common_pid: 2038 } hitcount: 1
{ lat: 198, common_pid: 2039 } hitcount: 1
{ lat: 199, common_pid: 2039 } hitcount: 1
{ lat: 200, common_pid: 2041 } hitcount: 1
{ lat: 201, common_pid: 2039 } hitcount: 2
{ lat: 202, common_pid: 2038 } hitcount: 1
{ lat: 202, common_pid: 2043 } hitcount: 1
{ lat: 203, common_pid: 2039 } hitcount: 1
{ lat: 203, common_pid: 2036 } hitcount: 1
{ lat: 203, common_pid: 2041 } hitcount: 1
{ lat: 206, common_pid: 2038 } hitcount: 2
{ lat: 207, common_pid: 2039 } hitcount: 1
{ lat: 207, common_pid: 2036 } hitcount: 1
{ lat: 208, common_pid: 2040 } hitcount: 1
{ lat: 209, common_pid: 2043 } hitcount: 1
{ lat: 210, common_pid: 2039 } hitcount: 1
{ lat: 211, common_pid: 2039 } hitcount: 4
{ lat: 212, common_pid: 2043 } hitcount: 1
{ lat: 212, common_pid: 2039 } hitcount: 2
{ lat: 213, common_pid: 2039 } hitcount: 1
{ lat: 214, common_pid: 2038 } hitcount: 1
{ lat: 214, common_pid: 2039 } hitcount: 2
{ lat: 214, common_pid: 2042 } hitcount: 1
{ lat: 215, common_pid: 2039 } hitcount: 1
{ lat: 217, common_pid: 2036 } hitcount: 1
{ lat: 217, common_pid: 2040 } hitcount: 1
{ lat: 217, common_pid: 2039 } hitcount: 1
{ lat: 218, common_pid: 2039 } hitcount: 6
{ lat: 219, common_pid: 2039 } hitcount: 9
{ lat: 220, common_pid: 2039 } hitcount: 11
{ lat: 221, common_pid: 2039 } hitcount: 5
{ lat: 221, common_pid: 2042 } hitcount: 1
{ lat: 222, common_pid: 2039 } hitcount: 7
{ lat: 223, common_pid: 2036 } hitcount: 1
{ lat: 223, common_pid: 2039 } hitcount: 3
{ lat: 224, common_pid: 2039 } hitcount: 4
{ lat: 224, common_pid: 2037 } hitcount: 1
{ lat: 224, common_pid: 2036 } hitcount: 2
{ lat: 225, common_pid: 2039 } hitcount: 5
{ lat: 225, common_pid: 2042 } hitcount: 1
{ lat: 226, common_pid: 2039 } hitcount: 7
{ lat: 226, common_pid: 2036 } hitcount: 4
{ lat: 227, common_pid: 2039 } hitcount: 6
{ lat: 227, common_pid: 2036 } hitcount: 12
{ lat: 227, common_pid: 2043 } hitcount: 1
{ lat: 228, common_pid: 2039 } hitcount: 7
{ lat: 228, common_pid: 2036 } hitcount: 14
{ lat: 229, common_pid: 2039 } hitcount: 9
{ lat: 229, common_pid: 2036 } hitcount: 8
{ lat: 229, common_pid: 2038 } hitcount: 1
{ lat: 230, common_pid: 2039 } hitcount: 11
{ lat: 230, common_pid: 2036 } hitcount: 6
{ lat: 230, common_pid: 2043 } hitcount: 1
{ lat: 230, common_pid: 2042 } hitcount: 2
{ lat: 231, common_pid: 2041 } hitcount: 1
{ lat: 231, common_pid: 2036 } hitcount: 6
{ lat: 231, common_pid: 2043 } hitcount: 1
{ lat: 231, common_pid: 2039 } hitcount: 8
{ lat: 232, common_pid: 2037 } hitcount: 1
{ lat: 232, common_pid: 2039 } hitcount: 6
{ lat: 232, common_pid: 2040 } hitcount: 2
{ lat: 232, common_pid: 2036 } hitcount: 5
{ lat: 232, common_pid: 2043 } hitcount: 1
{ lat: 233, common_pid: 2036 } hitcount: 5
{ lat: 233, common_pid: 2039 } hitcount: 11
{ lat: 234, common_pid: 2039 } hitcount: 4
{ lat: 234, common_pid: 2038 } hitcount: 2
{ lat: 234, common_pid: 2043 } hitcount: 2
{ lat: 234, common_pid: 2036 } hitcount: 11
{ lat: 234, common_pid: 2040 } hitcount: 1
{ lat: 235, common_pid: 2037 } hitcount: 2
{ lat: 235, common_pid: 2036 } hitcount: 8
{ lat: 235, common_pid: 2043 } hitcount: 2
{ lat: 235, common_pid: 2039 } hitcount: 5
{ lat: 235, common_pid: 2042 } hitcount: 2
{ lat: 235, common_pid: 2040 } hitcount: 4
{ lat: 235, common_pid: 2041 } hitcount: 1
{ lat: 236, common_pid: 2036 } hitcount: 7
{ lat: 236, common_pid: 2037 } hitcount: 1
{ lat: 236, common_pid: 2041 } hitcount: 5
{ lat: 236, common_pid: 2039 } hitcount: 3
{ lat: 236, common_pid: 2043 } hitcount: 9
{ lat: 236, common_pid: 2040 } hitcount: 7
{ lat: 237, common_pid: 2037 } hitcount: 1
{ lat: 237, common_pid: 2040 } hitcount: 1
{ lat: 237, common_pid: 2036 } hitcount: 9
{ lat: 237, common_pid: 2039 } hitcount: 3
{ lat: 237, common_pid: 2043 } hitcount: 8
{ lat: 237, common_pid: 2042 } hitcount: 2
{ lat: 237, common_pid: 2041 } hitcount: 2
{ lat: 238, common_pid: 2043 } hitcount: 10
{ lat: 238, common_pid: 2040 } hitcount: 1
{ lat: 238, common_pid: 2037 } hitcount: 9
{ lat: 238, common_pid: 2038 } hitcount: 1
{ lat: 238, common_pid: 2039 } hitcount: 1
{ lat: 238, common_pid: 2042 } hitcount: 3
{ lat: 238, common_pid: 2036 } hitcount: 7
{ lat: 239, common_pid: 2041 } hitcount: 1
{ lat: 239, common_pid: 2043 } hitcount: 11
{ lat: 239, common_pid: 2037 } hitcount: 11
{ lat: 239, common_pid: 2038 } hitcount: 6
{ lat: 239, common_pid: 2036 } hitcount: 7
{ lat: 239, common_pid: 2040 } hitcount: 1
{ lat: 239, common_pid: 2042 } hitcount: 9
{ lat: 240, common_pid: 2037 } hitcount: 29
{ lat: 240, common_pid: 2043 } hitcount: 15
{ lat: 240, common_pid: 2040 } hitcount: 44
{ lat: 240, common_pid: 2039 } hitcount: 1
{ lat: 240, common_pid: 2041 } hitcount: 2
{ lat: 240, common_pid: 2038 } hitcount: 1
{ lat: 240, common_pid: 2036 } hitcount: 10
{ lat: 240, common_pid: 2042 } hitcount: 13
{ lat: 241, common_pid: 2036 } hitcount: 21
{ lat: 241, common_pid: 2041 } hitcount: 36
{ lat: 241, common_pid: 2037 } hitcount: 34
{ lat: 241, common_pid: 2042 } hitcount: 14
{ lat: 241, common_pid: 2040 } hitcount: 94
{ lat: 241, common_pid: 2039 } hitcount: 12
{ lat: 241, common_pid: 2038 } hitcount: 2
{ lat: 241, common_pid: 2043 } hitcount: 28
{ lat: 242, common_pid: 2040 } hitcount: 109
{ lat: 242, common_pid: 2041 } hitcount: 506
{ lat: 242, common_pid: 2039 } hitcount: 155
{ lat: 242, common_pid: 2042 } hitcount: 21
{ lat: 242, common_pid: 2037 } hitcount: 52
{ lat: 242, common_pid: 2043 } hitcount: 21
{ lat: 242, common_pid: 2036 } hitcount: 16
{ lat: 242, common_pid: 2038 } hitcount: 156
{ lat: 243, common_pid: 2037 } hitcount: 46
{ lat: 243, common_pid: 2039 } hitcount: 40
{ lat: 243, common_pid: 2042 } hitcount: 119
{ lat: 243, common_pid: 2041 } hitcount: 611
{ lat: 243, common_pid: 2036 } hitcount: 69
{ lat: 243, common_pid: 2038 } hitcount: 784
{ lat: 243, common_pid: 2040 } hitcount: 323
{ lat: 243, common_pid: 2043 } hitcount: 14
{ lat: 244, common_pid: 2043 } hitcount: 35
{ lat: 244, common_pid: 2042 } hitcount: 305
{ lat: 244, common_pid: 2039 } hitcount: 8
{ lat: 244, common_pid: 2040 } hitcount: 4515
{ lat: 244, common_pid: 2038 } hitcount: 371
{ lat: 244, common_pid: 2037 } hitcount: 31
{ lat: 244, common_pid: 2036 } hitcount: 114
{ lat: 244, common_pid: 2041 } hitcount: 3396
{ lat: 245, common_pid: 2036 } hitcount: 700
{ lat: 245, common_pid: 2041 } hitcount: 2772
{ lat: 245, common_pid: 2037 } hitcount: 268
{ lat: 245, common_pid: 2039 } hitcount: 472
{ lat: 245, common_pid: 2038 } hitcount: 2758
{ lat: 245, common_pid: 2042 } hitcount: 3833
{ lat: 245, common_pid: 2040 } hitcount: 3105
{ lat: 245, common_pid: 2043 } hitcount: 645
{ lat: 246, common_pid: 2038 } hitcount: 3451
{ lat: 246, common_pid: 2041 } hitcount: 142
{ lat: 246, common_pid: 2037 } hitcount: 5101
{ lat: 246, common_pid: 2040 } hitcount: 68
{ lat: 246, common_pid: 2043 } hitcount: 5099
{ lat: 246, common_pid: 2039 } hitcount: 5608
{ lat: 246, common_pid: 2042 } hitcount: 3723
{ lat: 246, common_pid: 2036 } hitcount: 4738
{ lat: 247, common_pid: 2042 } hitcount: 312
{ lat: 247, common_pid: 2043 } hitcount: 2385
{ lat: 247, common_pid: 2041 } hitcount: 452
{ lat: 247, common_pid: 2038 } hitcount: 792
{ lat: 247, common_pid: 2040 } hitcount: 78
{ lat: 247, common_pid: 2036 } hitcount: 2375
{ lat: 247, common_pid: 2039 } hitcount: 1834
{ lat: 247, common_pid: 2037 } hitcount: 2655
{ lat: 248, common_pid: 2037 } hitcount: 36
{ lat: 248, common_pid: 2042 } hitcount: 11
{ lat: 248, common_pid: 2038 } hitcount: 122
{ lat: 248, common_pid: 2036 } hitcount: 135
{ lat: 248, common_pid: 2039 } hitcount: 26
{ lat: 248, common_pid: 2041 } hitcount: 503
{ lat: 248, common_pid: 2043 } hitcount: 66
{ lat: 248, common_pid: 2040 } hitcount: 46
{ lat: 249, common_pid: 2037 } hitcount: 29
{ lat: 249, common_pid: 2038 } hitcount: 1
{ lat: 249, common_pid: 2043 } hitcount: 29
{ lat: 249, common_pid: 2039 } hitcount: 8
{ lat: 249, common_pid: 2042 } hitcount: 56
{ lat: 249, common_pid: 2040 } hitcount: 27
{ lat: 249, common_pid: 2041 } hitcount: 11
{ lat: 249, common_pid: 2036 } hitcount: 27
{ lat: 250, common_pid: 2038 } hitcount: 1
{ lat: 250, common_pid: 2036 } hitcount: 30
{ lat: 250, common_pid: 2040 } hitcount: 19
{ lat: 250, common_pid: 2043 } hitcount: 22
{ lat: 250, common_pid: 2042 } hitcount: 20
{ lat: 250, common_pid: 2041 } hitcount: 1
{ lat: 250, common_pid: 2039 } hitcount: 6
{ lat: 250, common_pid: 2037 } hitcount: 48
{ lat: 251, common_pid: 2037 } hitcount: 43
{ lat: 251, common_pid: 2039 } hitcount: 1
{ lat: 251, common_pid: 2036 } hitcount: 12
{ lat: 251, common_pid: 2042 } hitcount: 2
{ lat: 251, common_pid: 2041 } hitcount: 1
{ lat: 251, common_pid: 2043 } hitcount: 15
{ lat: 251, common_pid: 2040 } hitcount: 3
{ lat: 252, common_pid: 2040 } hitcount: 1
{ lat: 252, common_pid: 2036 } hitcount: 12
{ lat: 252, common_pid: 2037 } hitcount: 21
{ lat: 252, common_pid: 2043 } hitcount: 14
{ lat: 253, common_pid: 2037 } hitcount: 21
{ lat: 253, common_pid: 2039 } hitcount: 2
{ lat: 253, common_pid: 2036 } hitcount: 9
{ lat: 253, common_pid: 2043 } hitcount: 6
{ lat: 253, common_pid: 2040 } hitcount: 1
{ lat: 254, common_pid: 2036 } hitcount: 8
{ lat: 254, common_pid: 2043 } hitcount: 3
{ lat: 254, common_pid: 2041 } hitcount: 1
{ lat: 254, common_pid: 2042 } hitcount: 1
{ lat: 254, common_pid: 2039 } hitcount: 1
{ lat: 254, common_pid: 2037 } hitcount: 12
{ lat: 255, common_pid: 2043 } hitcount: 1
{ lat: 255, common_pid: 2037 } hitcount: 2
{ lat: 255, common_pid: 2036 } hitcount: 2
{ lat: 255, common_pid: 2039 } hitcount: 8
{ lat: 256, common_pid: 2043 } hitcount: 1
{ lat: 256, common_pid: 2036 } hitcount: 4
{ lat: 256, common_pid: 2039 } hitcount: 6
{ lat: 257, common_pid: 2039 } hitcount: 5
{ lat: 257, common_pid: 2036 } hitcount: 4
{ lat: 258, common_pid: 2039 } hitcount: 5
{ lat: 258, common_pid: 2036 } hitcount: 2
{ lat: 259, common_pid: 2036 } hitcount: 7
{ lat: 259, common_pid: 2039 } hitcount: 7
{ lat: 260, common_pid: 2036 } hitcount: 8
{ lat: 260, common_pid: 2039 } hitcount: 6
{ lat: 261, common_pid: 2036 } hitcount: 5
{ lat: 261, common_pid: 2039 } hitcount: 7
{ lat: 262, common_pid: 2039 } hitcount: 5
{ lat: 262, common_pid: 2036 } hitcount: 5
{ lat: 263, common_pid: 2039 } hitcount: 7
{ lat: 263, common_pid: 2036 } hitcount: 7
{ lat: 264, common_pid: 2039 } hitcount: 9
{ lat: 264, common_pid: 2036 } hitcount: 9
{ lat: 265, common_pid: 2036 } hitcount: 5
{ lat: 265, common_pid: 2039 } hitcount: 1
{ lat: 266, common_pid: 2036 } hitcount: 1
{ lat: 266, common_pid: 2039 } hitcount: 3
{ lat: 267, common_pid: 2036 } hitcount: 1
{ lat: 267, common_pid: 2039 } hitcount: 3
{ lat: 268, common_pid: 2036 } hitcount: 1
{ lat: 268, common_pid: 2039 } hitcount: 6
{ lat: 269, common_pid: 2036 } hitcount: 1
{ lat: 269, common_pid: 2043 } hitcount: 1
{ lat: 269, common_pid: 2039 } hitcount: 2
{ lat: 270, common_pid: 2040 } hitcount: 1
{ lat: 270, common_pid: 2039 } hitcount: 6
{ lat: 271, common_pid: 2041 } hitcount: 1
{ lat: 271, common_pid: 2039 } hitcount: 5
{ lat: 272, common_pid: 2039 } hitcount: 10
{ lat: 273, common_pid: 2039 } hitcount: 8
{ lat: 274, common_pid: 2039 } hitcount: 2
{ lat: 275, common_pid: 2039 } hitcount: 1
{ lat: 276, common_pid: 2039 } hitcount: 2
{ lat: 276, common_pid: 2037 } hitcount: 1
{ lat: 276, common_pid: 2038 } hitcount: 1
{ lat: 277, common_pid: 2039 } hitcount: 1
{ lat: 277, common_pid: 2042 } hitcount: 1
{ lat: 278, common_pid: 2039 } hitcount: 1
{ lat: 279, common_pid: 2039 } hitcount: 4
{ lat: 279, common_pid: 2043 } hitcount: 1
{ lat: 280, common_pid: 2039 } hitcount: 3
{ lat: 283, common_pid: 2036 } hitcount: 2
{ lat: 284, common_pid: 2039 } hitcount: 1
{ lat: 284, common_pid: 2043 } hitcount: 1
{ lat: 288, common_pid: 2039 } hitcount: 1
{ lat: 289, common_pid: 2039 } hitcount: 1
{ lat: 300, common_pid: 2039 } hitcount: 1
{ lat: 384, common_pid: 2039 } hitcount: 1
Totals:
Hits: 67625
Entries: 278
Dropped: 0
Note, the writes are around the sleep, so ideally they will all be of 250 microseconds. If you are wondering how there are several that are under 250 microseconds, that is because the way cyclictest works, is if one iteration comes in late, the next one will set the timer to wake up less that 250. That is, if an iteration came in 50 microseconds late, the next wake up will be at 200 microseconds.
But this could easily be done in userspace. To make this even more interesting, we can mix the histogram between events that happened in the kernel with trace_marker:
# cd /sys/kernel/tracing
# echo 'latency u64 lat' > synthetic_events
# echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger
# echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat) if buf == "end"' > events/ftrace/print/trigger
# echo 'hist:keys=lat,common_pid:sort=lat' > events/synthetic/latency/trigger
The difference this time is that instead of using the trace_marker to start the latency, the sched_waking event is used, matching the common_pid for the trace_marker write with the pid that is being woken by sched_waking.
After running cyclictest again with the same parameters, we now have:
# cat events/synthetic/latency/hist
# event histogram
#
# trigger info: hist:keys=lat,common_pid:vals=hitcount:sort=lat:size=2048 [active]
#
{ lat: 7, common_pid: 2302 } hitcount: 640
{ lat: 7, common_pid: 2299 } hitcount: 42
{ lat: 7, common_pid: 2303 } hitcount: 18
{ lat: 7, common_pid: 2305 } hitcount: 166
{ lat: 7, common_pid: 2306 } hitcount: 1
{ lat: 7, common_pid: 2301 } hitcount: 91
{ lat: 7, common_pid: 2300 } hitcount: 17
{ lat: 8, common_pid: 2303 } hitcount: 8296
{ lat: 8, common_pid: 2304 } hitcount: 6864
{ lat: 8, common_pid: 2305 } hitcount: 9464
{ lat: 8, common_pid: 2301 } hitcount: 9213
{ lat: 8, common_pid: 2306 } hitcount: 6246
{ lat: 8, common_pid: 2302 } hitcount: 8797
{ lat: 8, common_pid: 2299 } hitcount: 8771
{ lat: 8, common_pid: 2300 } hitcount: 8119
{ lat: 9, common_pid: 2305 } hitcount: 1519
{ lat: 9, common_pid: 2299 } hitcount: 2346
{ lat: 9, common_pid: 2303 } hitcount: 2841
{ lat: 9, common_pid: 2301 } hitcount: 1846
{ lat: 9, common_pid: 2304 } hitcount: 3861
{ lat: 9, common_pid: 2302 } hitcount: 1210
{ lat: 9, common_pid: 2300 } hitcount: 2762
{ lat: 9, common_pid: 2306 } hitcount: 4247
{ lat: 10, common_pid: 2299 } hitcount: 16
{ lat: 10, common_pid: 2306 } hitcount: 333
{ lat: 10, common_pid: 2303 } hitcount: 16
{ lat: 10, common_pid: 2304 } hitcount: 168
{ lat: 10, common_pid: 2302 } hitcount: 240
{ lat: 10, common_pid: 2301 } hitcount: 28
{ lat: 10, common_pid: 2300 } hitcount: 95
{ lat: 10, common_pid: 2305 } hitcount: 18
{ lat: 11, common_pid: 2303 } hitcount: 5
{ lat: 11, common_pid: 2305 } hitcount: 8
{ lat: 11, common_pid: 2306 } hitcount: 221
{ lat: 11, common_pid: 2302 } hitcount: 76
{ lat: 11, common_pid: 2304 } hitcount: 26
{ lat: 11, common_pid: 2300 } hitcount: 125
{ lat: 11, common_pid: 2299 } hitcount: 2
{ lat: 12, common_pid: 2305 } hitcount: 3
{ lat: 12, common_pid: 2300 } hitcount: 6
{ lat: 12, common_pid: 2306 } hitcount: 90
{ lat: 12, common_pid: 2302 } hitcount: 4
{ lat: 12, common_pid: 2303 } hitcount: 1
{ lat: 12, common_pid: 2304 } hitcount: 122
{ lat: 13, common_pid: 2300 } hitcount: 12
{ lat: 13, common_pid: 2301 } hitcount: 1
{ lat: 13, common_pid: 2306 } hitcount: 32
{ lat: 13, common_pid: 2302 } hitcount: 5
{ lat: 13, common_pid: 2305 } hitcount: 1
{ lat: 13, common_pid: 2303 } hitcount: 1
{ lat: 13, common_pid: 2304 } hitcount: 61
{ lat: 14, common_pid: 2303 } hitcount: 4
{ lat: 14, common_pid: 2306 } hitcount: 5
{ lat: 14, common_pid: 2305 } hitcount: 4
{ lat: 14, common_pid: 2304 } hitcount: 62
{ lat: 14, common_pid: 2302 } hitcount: 19
{ lat: 14, common_pid: 2300 } hitcount: 33
{ lat: 14, common_pid: 2299 } hitcount: 1
{ lat: 14, common_pid: 2301 } hitcount: 4
{ lat: 15, common_pid: 2305 } hitcount: 1
{ lat: 15, common_pid: 2302 } hitcount: 25
{ lat: 15, common_pid: 2300 } hitcount: 11
{ lat: 15, common_pid: 2299 } hitcount: 5
{ lat: 15, common_pid: 2301 } hitcount: 1
{ lat: 15, common_pid: 2304 } hitcount: 8
{ lat: 15, common_pid: 2303 } hitcount: 1
{ lat: 15, common_pid: 2306 } hitcount: 6
{ lat: 16, common_pid: 2302 } hitcount: 31
{ lat: 16, common_pid: 2306 } hitcount: 3
{ lat: 16, common_pid: 2300 } hitcount: 5
{ lat: 17, common_pid: 2302 } hitcount: 6
{ lat: 17, common_pid: 2303 } hitcount: 1
{ lat: 18, common_pid: 2304 } hitcount: 1
{ lat: 18, common_pid: 2302 } hitcount: 8
{ lat: 18, common_pid: 2299 } hitcount: 1
{ lat: 18, common_pid: 2301 } hitcount: 1
{ lat: 19, common_pid: 2303 } hitcount: 4
{ lat: 19, common_pid: 2304 } hitcount: 5
{ lat: 19, common_pid: 2302 } hitcount: 4
{ lat: 19, common_pid: 2299 } hitcount: 3
{ lat: 19, common_pid: 2306 } hitcount: 1
{ lat: 19, common_pid: 2300 } hitcount: 4
{ lat: 19, common_pid: 2305 } hitcount: 5
{ lat: 20, common_pid: 2299 } hitcount: 2
{ lat: 20, common_pid: 2302 } hitcount: 3
{ lat: 20, common_pid: 2305 } hitcount: 1
{ lat: 20, common_pid: 2300 } hitcount: 2
{ lat: 20, common_pid: 2301 } hitcount: 2
{ lat: 20, common_pid: 2303 } hitcount: 3
{ lat: 21, common_pid: 2305 } hitcount: 1
{ lat: 21, common_pid: 2299 } hitcount: 5
{ lat: 21, common_pid: 2303 } hitcount: 4
{ lat: 21, common_pid: 2302 } hitcount: 7
{ lat: 21, common_pid: 2300 } hitcount: 1
{ lat: 21, common_pid: 2301 } hitcount: 5
{ lat: 21, common_pid: 2304 } hitcount: 2
{ lat: 22, common_pid: 2302 } hitcount: 5
{ lat: 22, common_pid: 2303 } hitcount: 1
{ lat: 22, common_pid: 2306 } hitcount: 3
{ lat: 22, common_pid: 2301 } hitcount: 2
{ lat: 22, common_pid: 2300 } hitcount: 1
{ lat: 22, common_pid: 2299 } hitcount: 1
{ lat: 22, common_pid: 2305 } hitcount: 1
{ lat: 22, common_pid: 2304 } hitcount: 1
{ lat: 23, common_pid: 2299 } hitcount: 1
{ lat: 23, common_pid: 2306 } hitcount: 2
{ lat: 23, common_pid: 2302 } hitcount: 6
{ lat: 24, common_pid: 2302 } hitcount: 3
{ lat: 24, common_pid: 2300 } hitcount: 1
{ lat: 24, common_pid: 2306 } hitcount: 2
{ lat: 24, common_pid: 2305 } hitcount: 1
{ lat: 24, common_pid: 2299 } hitcount: 1
{ lat: 25, common_pid: 2300 } hitcount: 1
{ lat: 25, common_pid: 2302 } hitcount: 4
{ lat: 26, common_pid: 2302 } hitcount: 2
{ lat: 27, common_pid: 2305 } hitcount: 1
{ lat: 27, common_pid: 2300 } hitcount: 1
{ lat: 27, common_pid: 2302 } hitcount: 3
{ lat: 28, common_pid: 2306 } hitcount: 1
{ lat: 28, common_pid: 2302 } hitcount: 4
{ lat: 29, common_pid: 2302 } hitcount: 1
{ lat: 29, common_pid: 2300 } hitcount: 2
{ lat: 29, common_pid: 2306 } hitcount: 1
{ lat: 29, common_pid: 2304 } hitcount: 1
{ lat: 30, common_pid: 2302 } hitcount: 4
{ lat: 31, common_pid: 2302 } hitcount: 6
{ lat: 32, common_pid: 2302 } hitcount: 1
{ lat: 33, common_pid: 2299 } hitcount: 1
{ lat: 33, common_pid: 2302 } hitcount: 3
{ lat: 34, common_pid: 2302 } hitcount: 2
{ lat: 35, common_pid: 2302 } hitcount: 1
{ lat: 35, common_pid: 2304 } hitcount: 1
{ lat: 36, common_pid: 2302 } hitcount: 4
{ lat: 37, common_pid: 2302 } hitcount: 6
{ lat: 38, common_pid: 2302 } hitcount: 2
{ lat: 39, common_pid: 2302 } hitcount: 2
{ lat: 39, common_pid: 2304 } hitcount: 1
{ lat: 40, common_pid: 2304 } hitcount: 2
{ lat: 40, common_pid: 2302 } hitcount: 5
{ lat: 41, common_pid: 2304 } hitcount: 1
{ lat: 41, common_pid: 2302 } hitcount: 8
{ lat: 42, common_pid: 2302 } hitcount: 6
{ lat: 42, common_pid: 2304 } hitcount: 1
{ lat: 43, common_pid: 2302 } hitcount: 3
{ lat: 43, common_pid: 2304 } hitcount: 4
{ lat: 44, common_pid: 2302 } hitcount: 6
{ lat: 45, common_pid: 2302 } hitcount: 5
{ lat: 46, common_pid: 2302 } hitcount: 5
{ lat: 47, common_pid: 2302 } hitcount: 7
{ lat: 48, common_pid: 2301 } hitcount: 1
{ lat: 48, common_pid: 2302 } hitcount: 9
{ lat: 49, common_pid: 2302 } hitcount: 3
{ lat: 50, common_pid: 2302 } hitcount: 1
{ lat: 50, common_pid: 2301 } hitcount: 1
{ lat: 51, common_pid: 2302 } hitcount: 2
{ lat: 51, common_pid: 2301 } hitcount: 1
{ lat: 61, common_pid: 2302 } hitcount: 1
{ lat: 110, common_pid: 2302 } hitcount: 1
Totals:
Hits: 89565
Entries: 158
Dropped: 0
This doesn't tell us any information about how late cyclictest may have woken up, but it does show us a nice histogram of how long it took from the time that cyclictest was woken to the time it made it into user space.
Hardware Latency Detector
Peios Kernel / Kernel development / Trace
Introduction #
The tracer hwlat_detector is a special purpose tracer that is used to detect large system latencies induced by the behavior of certain underlying hardware or firmware, independent of Linux itself. The code was developed originally to detect SMIs (System Management Interrupts) on x86 systems, however there is nothing x86 specific about this patchset. It was originally written for use by the "RT" patch since the Real Time kernel is highly latency sensitive.
SMIs are not serviced by the Linux kernel, which means that it does not even know that they are occurring. SMIs are instead set up by BIOS code and are serviced by BIOS code, usually for "critical" events such as management of thermal sensors and fans. Sometimes though, SMIs are used for other tasks and those tasks can spend an inordinate amount of time in the handler (sometimes measured in milliseconds). Obviously this is a problem if you are trying to keep event service latencies down in the microsecond range.
The hardware latency detector works by hogging one of the cpus for configurable amounts of time (with interrupts disabled), polling the CPU Time Stamp Counter for some period, then looking for gaps in the TSC data. Any gap indicates a time when the polling was interrupted and since the interrupts are disabled, the only thing that could do that would be an SMI or other hardware hiccup (or an NMI, but those can be tracked).
Note that the hwlat detector should NEVER be used in a production environment. It is intended to be run manually to determine if the hardware platform has a problem with long system firmware service routines.
Usage #
Write the ASCII text "hwlat" into the current_tracer file of the tracing system (mounted at /sys/kernel/tracing or /sys/kernel/tracing). It is possible to redefine the threshold in microseconds (us) above which latency spikes will be taken into account.
Example:
# echo hwlat > /sys/kernel/tracing/current_tracer
# echo 100 > /sys/kernel/tracing/tracing_thresh
The /sys/kernel/tracing/hwlat_detector interface contains the following files:
width - time period to sample with CPUs held (usecs)
must be less than the total window size (enforced)
window - total period of sampling, width being inside (usecs)
By default the width is set to 500,000 and window to 1,000,000, meaning that for every 1,000,000 usecs (1s) the hwlat detector will spin for 500,000 usecs (0.5s). If tracing_thresh contains zero when hwlat tracer is enabled, it will change to a default of 10 usecs. If any latencies that exceed the threshold is observed then the data will be written to the tracing ring buffer.
The minimum sleep time between periods is 1 millisecond. Even if width is less than 1 millisecond apart from window, to allow the system to not be totally starved.
If tracing_thresh was zero when hwlat detector was started, it will be set back to zero if another tracer is loaded. Note, the last value in tracing_thresh that hwlat detector had will be saved and this value will be restored in tracing_thresh if it is still zero when hwlat detector is started again.
The following tracing directory files are used by the hwlat_detector:
in /sys/kernel/tracing:
tracing_threshold - minimum latency value to be considered (usecs)
tracing_max_latency - maximum hardware latency actually observed (usecs)
tracing_cpumask - the CPUs to move the hwlat thread across
hwlat_detector/width - specified amount of time to spin within window (usecs)
hwlat_detector/window - amount of time between (width) runs (usecs)
hwlat_detector/mode - the thread mode
By default, one hwlat detector's kernel thread will migrate across each CPU specified in cpumask at the beginning of a new window, in a round-robin fashion. This behavior can be changed by changing the thread mode, the available options are:
none: do not force migration
round-robin: migrate across each CPU specified in cpumask [default]
per-cpu: create one thread for each cpu in tracing_cpumask
Intel(R) Trace Hub (TH)
Peios Kernel / Kernel development / Trace
Overview #
Intel(R) Trace Hub (TH) is a set of hardware blocks that produce, switch and output trace data from multiple hardware and software sources over several types of trace output ports encoded in System Trace Protocol (MIPI STPv2) and is intended to perform full system debugging. For more information on the hardware, see Intel(R) Trace Hub developer's manual [1].
It consists of trace sources, trace destinations (outputs) and a switch (Global Trace Hub, GTH). These devices are placed on a bus of their own ("intel_th"), where they can be discovered and configured via sysfs attributes.
-
Currently, the following Intel TH subdevices (blocks) are supported:
-
Software Trace Hub (STH), trace source, which is a System Trace Module (STM) device,
-
Memory Storage Unit (MSU), trace output, which allows storing trace hub output in system memory,
-
Parallel Trace Interface output (PTI), trace output to an external debug host via a PTI port,
-
Global Trace Hub (GTH), which is a switch and a central component of Intel(R) Trace Hub architecture.
-
Common attributes for output devices are described in Documentation/ABI/testing/sysfs-bus-intel_th-output-devices, the most notable of them is "active", which enables or disables trace output into that particular output device.
GTH allows directing different STP masters into different output ports via its "masters" attribute group. More detailed GTH interface description is at Documentation/ABI/testing/sysfs-bus-intel_th-devices-gth.
STH registers an stm class device, through which it provides interface to userspace and kernelspace software trace sources. See Documentation/trace/stm.rst for more information on that.
MSU can be configured to collect trace data into a system memory buffer, which can later on be read from its device nodes via read() or mmap() interface and directed to a "software sink" driver that will consume the data and/or relay it further.
On the whole, Intel(R) Trace Hub does not require any special userspace software to function; everything can be configured, started and collected via sysfs attributes, and device nodes.
[1] https://software.intel.com/sites/default/files/managed/d3/3c/intel-th-developer-manual.pdf
Bus and Subdevices #
For each Intel TH device in the system a bus of its own is created and assigned an id number that reflects the order in which TH devices were enumerated. All TH subdevices (devices on intel_th bus) begin with this id: 0-gth, 0-msc0, 0-msc1, 0-pti, 0-sth, which is followed by device's name and an optional index.
Output devices also get a device node in /dev/intel_thN, where N is the Intel TH device id. For example, MSU's memory buffers, when allocated, are accessible via /dev/intel_th0/msc{0,1}.
Quick example #
# figure out which GTH port is the first memory controller:
$ cat /sys/bus/intel_th/devices/0-msc0/port
0
# looks like it's port 0, configure master 33 to send data to port 0:
$ echo 0 > /sys/bus/intel_th/devices/0-gth/masters/33
# allocate a 2-windowed multiblock buffer on the first memory # controller, each with 64 pages:
$ echo multi > /sys/bus/intel_th/devices/0-msc0/mode
$ echo 64,64 > /sys/bus/intel_th/devices/0-msc0/nr_pages
# enable wrapping for this controller, too:
$ echo 1 > /sys/bus/intel_th/devices/0-msc0/wrap
# and enable tracing into this port:
$ echo 1 > /sys/bus/intel_th/devices/0-msc0/active
# .. send data to master 33, see stm.txt for more details .. # .. wait for traces to pile up .. # .. and stop the trace:
$ echo 0 > /sys/bus/intel_th/devices/0-msc0/active
# and now you can collect the trace from the device node:
$ cat /dev/intel_th0/msc0 > my_stp_trace
Host Debugger Mode #
It is possible to configure the Trace Hub and control its trace capture from a remote debug host, which should be connected via one of the hardware debugging interfaces, which will then be used to both control Intel Trace Hub and transfer its trace data to the debug host.
The driver needs to be told that such an arrangement is taking place so that it does not touch any capture/port configuration and avoids conflicting with the debug host's configuration accesses. The only activity that the driver will perform in this mode is collecting software traces to the Software Trace Hub (an stm class device). The user is still responsible for setting up adequate master/channel mappings that the decoder on the receiving end would recognize.
In order to enable the host mode, set the 'host_mode' parameter of the 'intel_th' kernel module to 'y'. None of the virtual output devices will show up on the intel_th bus. Also, trace configuration and capture controlling attribute groups of the 'gth' device will not be exposed. The 'sth' device will operate as usual.
Software Sinks #
The Memory Storage Unit (MSU) driver provides an in-kernel API for drivers to register themselves as software sinks for the trace data. Such drivers can further export the data via other devices, such as USB device controllers or network cards.
-
The API has two main parts::
-
notifying the software sink that a particular window is full, and "locking" that window, that is, making it unavailable for the trace collection; when this happens, the MSU driver will automatically switch to the next window in the buffer if it is unlocked, or stop the trace capture if it's not;
-
tracking the "locked" state of windows and providing a way for the software sink driver to notify the MSU driver when a window is unlocked and can be used again to collect trace data.
-
An example sink driver, msu-sink illustrates the implementation of a software sink. Functionally, it simply unlocks windows as soon as they are full, keeping the MSU running in a circular buffer mode. Unlike the "multi" mode, it will fill out all the windows in the buffer as opposed to just the first one. It can be enabled by writing "sink" to the "mode" file (assuming msu-sink.ko is loaded).
Kernel Probes (Kprobes)
Peios Kernel / Kernel development / Trace
Author: Jim Keniston <jkenisto@us.ibm.com>
Author: Prasanna S Panchamukhi <prasanna.panchamukhi@gmail.com>
Author: Masami Hiramatsu <mhiramat@kernel.org>
Concepts: Kprobes and Return Probes #
Kprobes enables you to dynamically break into any kernel routine and collect debugging and performance information non-disruptively. You can trap at almost any kernel code address 1, specifying a handler routine to be invoked when the breakpoint is hit.
[1] some parts of the kernel code can not be trapped, see Blacklist)
There are currently two types of probes: kprobes, and kretprobes (also called return probes). A kprobe can be inserted on virtually any instruction in the kernel. A return probe fires when a specified function returns.
In the typical case, Kprobes-based instrumentation is packaged as a kernel module. The module's init function installs ("registers") one or more probes, and the exit function unregisters them. A registration function such as register_kprobe() specifies where the probe is to be inserted and what handler is to be called when the probe is hit.
There are also register_/unregister_*probes() functions for batch registration/unregistration of a group of *probes. These functions can speed up unregistration process when you have to unregister a lot of probes at once.
The next four subsections explain how the different types of probes work and how jump optimization works. They explain certain things that you'll need to know in order to make the best use of Kprobes -- e.g., the difference between a pre_handler and a post_handler, and how to use the maxactive and nmissed fields of a kretprobe. But if you're in a hurry to start using Kprobes, you can skip ahead to Architectures Supported.
How Does a Kprobe Work? #
When a kprobe is registered, Kprobes makes a copy of the probed instruction and replaces the first byte(s) of the probed instruction with a breakpoint instruction (e.g., int3 on i386 and x86_64).
When a CPU hits the breakpoint instruction, a trap occurs, the CPU's registers are saved, and control passes to Kprobes via the notifier_call_chain mechanism. Kprobes executes the "pre_handler" associated with the kprobe, passing the handler the addresses of the kprobe struct and the saved registers.
Next, Kprobes single-steps its copy of the probed instruction. (It would be simpler to single-step the actual instruction in place, but then Kprobes would have to temporarily remove the breakpoint instruction. This would open a small time window when another CPU could sail right past the probepoint.)
After the instruction is single-stepped, Kprobes executes the "post_handler," if any, that is associated with the kprobe. Execution then continues with the instruction following the probepoint.
Changing Execution Path #
Since kprobes can probe into a running kernel code, it can change the register set, including instruction pointer. This operation requires maximum care, such as keeping the stack frame, recovering the execution path etc. Since it operates on a running kernel and needs deep knowledge of computer architecture and concurrent computing, you can easily shoot your foot.
If you change the instruction pointer (and set up other related registers) in pre_handler, you must return !0 so that kprobes stops single stepping and just returns to the given address. This also means post_handler should not be called anymore.
Note that this operation may be harder on some architectures which use TOC (Table of Contents) for function call, since you have to setup a new TOC for your function in your module, and recover the old one after returning from it.
Return Probes #
How Does a Return Probe Work? #
When you call register_kretprobe(), Kprobes establishes a kprobe at the entry to the function. When the probed function is called and this probe is hit, Kprobes saves a copy of the return address, and replaces the return address with the address of a "trampoline." The trampoline is an arbitrary piece of code -- typically just a nop instruction. At boot time, Kprobes registers a kprobe at the trampoline.
When the probed function executes its return instruction, control passes to the trampoline and that probe is hit. Kprobes' trampoline handler calls the user-specified return handler associated with the kretprobe, then sets the saved instruction pointer to the saved return address, and that's where execution resumes upon return from the trap.
While the probed function is executing, its return address is stored in an object of type kretprobe_instance. Before calling register_kretprobe(), the user sets the maxactive field of the kretprobe struct to specify how many instances of the specified function can be probed simultaneously. register_kretprobe() pre-allocates the indicated number of kretprobe_instance objects.
For example, if the function is non-recursive and is called with a spinlock held, maxactive = 1 should be enough. If the function is non-recursive and can never relinquish the CPU (e.g., via a semaphore or preemption), NR_CPUS should be enough. If maxactive <= 0, it is set to a default value: max(10, 2*NR_CPUS).
It's not a disaster if you set maxactive too low; you'll just miss some probes. In the kretprobe struct, the nmissed field is set to zero when the return probe is registered, and is incremented every time the probed function is entered but there is no kretprobe_instance object available for establishing the return probe.
Kretprobe entry-handler #
Kretprobes also provides an optional user-specified handler which runs on function entry. This handler is specified by setting the entry_handler field of the kretprobe struct. Whenever the kprobe placed by kretprobe at the function entry is hit, the user-defined entry_handler, if any, is invoked. If the entry_handler returns 0 (success) then a corresponding return handler is guaranteed to be called upon function return. If the entry_handler returns a non-zero error then Kprobes leaves the return address as is, and the kretprobe has no further effect for that particular function instance.
Multiple entry and return handler invocations are matched using the unique kretprobe_instance object associated with them. Additionally, a user may also specify per return-instance private data to be part of each kretprobe_instance object. This is especially useful when sharing private data between corresponding user entry and return handlers. The size of each private data object can be specified at kretprobe registration time by setting the data_size field of the kretprobe struct. This data can be accessed through the data field of each kretprobe_instance object.
In case probed function is entered but there is no kretprobe_instance object available, then in addition to incrementing the nmissed count, the user entry_handler invocation is also skipped.
How Does Jump Optimization Work? #
If your kernel is built with CONFIG_OPTPROBES=y (currently this flag is automatically set 'y' on x86/x86-64, non-preemptive kernel) and the "debug.kprobes_optimization" kernel parameter is set to 1 (see sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump instruction instead of a breakpoint instruction at each probepoint.
Init a Kprobe #
When a probe is registered, before attempting this optimization, Kprobes inserts an ordinary, breakpoint-based kprobe at the specified address. So, even if it's not possible to optimize this particular probepoint, there'll be a probe there.
Safety Check #
Before optimizing a probe, Kprobes performs the following safety checks:
-
Kprobes verifies that the region that will be replaced by the jump instruction (the "optimized region") lies entirely within one function. (A jump instruction is multiple bytes, and so may overlay multiple instructions.)
-
Kprobes analyzes the entire function and verifies that there is no jump into the optimized region. Specifically:
-
the function contains no indirect jump;
-
the function contains no instruction that causes an exception (since the fixup code triggered by the exception could jump back into the optimized region -- Kprobes checks the exception tables to verify this);
-
there is no near jump to the optimized region (other than to the first byte).
-
-
For each instruction in the optimized region, Kprobes verifies that the instruction can be executed out of line.
Preparing Detour Buffer #
Next, Kprobes prepares a "detour" buffer, which contains the following instruction sequence:
-
code to push the CPU's registers (emulating a breakpoint trap)
-
a call to the trampoline code which calls user's probe handlers.
-
code to restore registers
-
the instructions from the optimized region
-
a jump back to the original execution path.
Pre-optimization #
After preparing the detour buffer, Kprobes verifies that none of the following situations exist:
-
The probe has a post_handler.
-
Other instructions in the optimized region are probed.
-
The probe is disabled.
In any of the above cases, Kprobes won't start optimizing the probe. Since these are temporary situations, Kprobes tries to start optimizing it again if the situation is changed.
If the kprobe can be optimized, Kprobes enqueues the kprobe to an optimizing list, and kicks the kprobe-optimizer workqueue to optimize it. If the to-be-optimized probepoint is hit before being optimized, Kprobes returns control to the original instruction path by setting the CPU's instruction pointer to the copied code in the detour buffer -- thus at least avoiding the single-step.
Optimization #
The Kprobe-optimizer doesn't insert the jump instruction immediately; rather, it calls synchronize_rcu() for safety first, because it's possible for a CPU to be interrupted in the middle of executing the optimized region 3. As you know, synchronize_rcu() can ensure that all interruptions that were active when synchronize_rcu() was called are done, but only if CONFIG_PREEMPT=n. So, this version of kprobe optimization supports only kernels with CONFIG_PREEMPT=n 4.
After that, the Kprobe-optimizer calls stop_machine() to replace the optimized region with a jump instruction to the detour buffer, using text_poke_smp().
Unoptimization #
When an optimized kprobe is unregistered, disabled, or blocked by another kprobe, it will be unoptimized. If this happens before the optimization is complete, the kprobe is just dequeued from the optimized list. If the optimization has been done, the jump is replaced with the original code (except for an int3 breakpoint in the first byte) by using text_poke_smp().
[3] Please imagine that the 2nd instruction is interrupted and then the optimizer replaces the 2nd instruction with the jump address while the interrupt handler is running. When the interrupt returns to original address, there is no valid instruction, and it causes an unexpected result.
[4] This optimization-safety checking may be replaced with the stop-machine method that ksplice uses for supporting a CONFIG_PREEMPT=y kernel.
NOTE for geeks: The jump optimization changes the kprobe's pre_handler behavior. Without optimization, the pre_handler can change the kernel's execution path by changing regs->ip and returning 1. However, when the probe is optimized, that modification is ignored. Thus, if you want to tweak the kernel's execution path, you need to suppress optimization, using one of the following techniques:
- Specify an empty function for the kprobe's post_handler.
or
- Execute 'sysctl -w debug.kprobes_optimization=n'
Blacklist #
Kprobes can probe most of the kernel except itself. This means that there are some functions where kprobes cannot probe. Probing (trapping) such functions can cause a recursive trap (e.g. double fault) or the nested probe handler may never be called. Kprobes manages such functions as a blacklist. If you want to add a function into the blacklist, you just need to (1) include linux/kprobes.h and (2) use NOKPROBE_SYMBOL() macro to specify a blacklisted function. Kprobes checks the given probe address against the blacklist and rejects registering it, if the given address is in the blacklist.
Architectures Supported #
Kprobes and return probes are implemented on the following architectures:
-
i386 (Supports jump optimization)
-
x86_64 (AMD-64, EM64T) (Supports jump optimization)
-
ppc64
-
sparc64 (Return probes not yet implemented.)
-
arm
-
ppc
-
mips
-
s390
-
parisc
-
loongarch
-
riscv
Configuring Kprobes #
When configuring the kernel using make menuconfig/xconfig/oldconfig, ensure that CONFIG_KPROBES is set to "y", look for "Kprobes" under "General architecture-dependent options".
So that you can load and unload Kprobes-based instrumentation modules, make sure "Loadable module support" (CONFIG_MODULES) and "Module unloading" (CONFIG_MODULE_UNLOAD) are set to "y".
Also make sure that CONFIG_KALLSYMS and perhaps even CONFIG_KALLSYMS_ALL are set to "y", since kallsyms_lookup_name() is used by the in-kernel kprobe address resolution code.
If you need to insert a probe in the middle of a function, you may find it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), so you can use "objdump -d -l vmlinux" to see the source-to-object code mapping.
API Reference #
The Kprobes API includes a "register" function and an "unregister" function for each type of probe. The API also includes "register_*probes" and "unregister_*probes" functions for (un)registering arrays of probes. Here are terse, mini-man-page specifications for these functions and the associated probe handlers that you'll write. See the files in the samples/kprobes/ sub-directory for examples.
register_kprobe #
#include <linux/kprobes.h>
int register_kprobe(struct kprobe *kp);
Sets a breakpoint at the address kp->addr. When the breakpoint is hit, Kprobes calls kp->pre_handler. After the probed instruction is single-stepped, Kprobe calls kp->post_handler. Any or all handlers can be NULL. If kp->flags is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled, so, its handlers aren't hit until calling enable_kprobe(kp).
register_kprobe() returns 0 on success, or a negative errno otherwise.
User's pre-handler (kp->pre_handler):
#include <linux/kprobes.h>
#include <linux/ptrace.h>
int pre_handler(struct kprobe *p, struct pt_regs *regs);
Called with p pointing to the kprobe associated with the breakpoint, and regs pointing to the struct containing the registers saved when the breakpoint was hit. Return 0 here unless you're a Kprobes geek.
User's post-handler (kp->post_handler):
#include <linux/kprobes.h>
#include <linux/ptrace.h>
void post_handler(struct kprobe *p, struct pt_regs *regs,
unsigned long flags);
p and regs are as described for the pre_handler. flags always seems to be zero.
register_kretprobe #
#include <linux/kprobes.h>
int register_kretprobe(struct kretprobe *rp);
Establishes a return probe for the function whose address is rp->kp.addr. When that function returns, Kprobes calls rp->handler. You must set rp->maxactive appropriately before you call register_kretprobe(); see "How Does a Return Probe Work?" for details.
register_kretprobe() returns 0 on success, or a negative errno otherwise.
User's return-probe handler (rp->handler):
#include <linux/kprobes.h>
#include <linux/ptrace.h>
int kretprobe_handler(struct kretprobe_instance *ri,
struct pt_regs *regs);
regs is as described for kprobe.pre_handler. ri points to the kretprobe_instance object, of which the following fields may be of interest:
-
ret_addr: the return address
-
rp: points to the corresponding kretprobe object
-
task: points to the corresponding task struct
-
-
data: points to per return-instance private data; see "Kretprobe
entry-handler" for details.
-
The regs_return_value(regs) macro provides a simple abstraction to extract the return value from the appropriate register as defined by the architecture's ABI.
The handler's return value is currently ignored.
unregister_*probe #
#include <linux/kprobes.h>
void unregister_kprobe(struct kprobe *kp);
void unregister_kretprobe(struct kretprobe *rp);
Removes the specified probe. The unregister function can be called at any time after the probe has been registered.
register_*probes #
#include <linux/kprobes.h>
int register_kprobes(struct kprobe **kps, int num);
int register_kretprobes(struct kretprobe **rps, int num);
Registers each of the num probes in the specified array. If any error occurs during registration, all probes in the array, up to the bad probe, are safely unregistered before the register_*probes function returns.
-
kps/rps: an array of pointers to
*probedata structures -
num: the number of the array entries.
unregister_*probes #
#include <linux/kprobes.h>
void unregister_kprobes(struct kprobe **kps, int num);
void unregister_kretprobes(struct kretprobe **rps, int num);
Removes each of the num probes in the specified array at once.
disable_*probe #
#include <linux/kprobes.h>
int disable_kprobe(struct kprobe *kp);
int disable_kretprobe(struct kretprobe *rp);
Temporarily disables the specified *probe. You can enable it again by using enable_*probe(). You must specify the probe which has been registered.
enable_*probe #
#include <linux/kprobes.h>
int enable_kprobe(struct kprobe *kp);
int enable_kretprobe(struct kretprobe *rp);
Enables *probe which has been disabled by disable_*probe(). You must specify the probe which has been registered.
Kprobes Features and Limitations #
Kprobes allows multiple probes at the same address. Also, a probepoint for which there is a post_handler cannot be optimized. So if you install a kprobe with a post_handler, at an optimized probepoint, the probepoint will be unoptimized automatically.
In general, you can install a probe anywhere in the kernel. In particular, you can probe interrupt handlers. Known exceptions are discussed in this section.
The register_*probe functions will return -EINVAL if you attempt to install a probe in the code that implements Kprobes (mostly kernel/kprobes.c and arch/*/kernel/kprobes.c, but also functions such as do_page_fault and notifier_call_chain).
If you install a probe in an inline-able function, Kprobes makes no attempt to chase down all inline instances of the function and install probes there. gcc may inline a function without being asked, so keep this in mind if you're not seeing the probe hits you expect.
A probe handler can modify the environment of the probed function -- e.g., by modifying kernel data structures, or by modifying the contents of the pt_regs struct (which are restored to the registers upon return from the breakpoint). So Kprobes can be used, for example, to install a bug fix or to inject faults for testing. Kprobes, of course, has no way to distinguish the deliberately injected faults from the accidental ones. Don't drink and probe.
Kprobes makes no attempt to prevent probe handlers from stepping on each other -- e.g., probing printk() and then calling printk() from a probe handler. If a probe handler hits a probe, that second probe's handlers won't be run in that instance, and the kprobe.nmissed member of the second probe will be incremented.
As of Linux v2.6.15-rc1, multiple handlers (or multiple instances of the same handler) may run concurrently on different CPUs.
Kprobes does not use mutexes or allocate memory except during registration and unregistration.
Probe handlers are run with preemption disabled or interrupt disabled, which depends on the architecture and optimization state. (e.g., kretprobe handlers and optimized kprobe handlers run without interrupt disabled on x86/x86-64). In any case, your handler should not yield the CPU (e.g., by attempting to acquire a semaphore, or waiting I/O).
Since a return probe is implemented by replacing the return address with the trampoline's address, stack backtraces and calls to __builtin_return_address() will typically yield the trampoline's address instead of the real return address for kretprobed functions. (As far as we can tell, __builtin_return_address() is used only for instrumentation and error reporting.)
If the number of times a function is called does not match the number of times it returns, registering a return probe on that function may produce undesirable results. In such a case, a line: kretprobe BUG!: Processing kretprobe d000000000041aa8 @ c00000000004f48c gets printed. With this information, one will be able to correlate the exact instance of the kretprobe that caused the problem. We have the do_exit() case covered. do_execve() and do_fork() are not an issue. We're unaware of other specific cases where this could be a problem.
If, upon entry to or exit from a function, the CPU is running on a stack other than that of the current task, registering a return probe on that function may produce undesirable results. For this reason, Kprobes doesn't support return probes (or kprobes) on the x86_64 version of __switch_to(); the registration functions return -EINVAL.
On x86/x86-64, since the Jump Optimization of Kprobes modifies instructions widely, there are some limitations to optimization. To explain it, we introduce some terminology. Imagine a 3-instruction sequence consisting of a two 2-byte instructions and one 3-byte instruction.
IA
|
[-2][-1][0][1][2][3][4][5][6][7]
[ins1][ins2][ ins3 ]
[<- DCR ->]
[<- JTPR ->]
ins1: 1st Instruction
ins2: 2nd Instruction
ins3: 3rd Instruction
IA: Insertion Address
JTPR: Jump Target Prohibition Region
DCR: Detoured Code Region
The instructions in DCR are copied to the out-of-line buffer of the kprobe, because the bytes in DCR are replaced by a 5-byte jump instruction. So there are several limitations.
-
a) The instructions in DCR must be relocatable.
-
b) The instructions in DCR must not include a call instruction.
-
c) JTPR must not be targeted by any jump or call instruction.
-
d) DCR must not straddle the border between functions.
Anyway, these limitations are checked by the in-kernel instruction decoder, so you don't need to worry about that.
Probe Overhead #
On a typical CPU in use in 2005, a kprobe hit takes 0.5 to 1.0 microseconds to process. Specifically, a benchmark that hits the same probepoint repeatedly, firing a simple handler each time, reports 1-2 million hits per second, depending on the architecture. A return-probe hit typically takes 50-75% longer than a kprobe hit. When you have a return probe set on a function, adding a kprobe at the entry to that function adds essentially no overhead.
Here are sample overhead figures (in usec) for different architectures:
k = kprobe; r = return probe; kr = kprobe + return probe
on same function
i386: Intel Pentium M, 1495 MHz, 2957.31 bogomips
k = 0.57 usec; r = 0.92; kr = 0.99
x86_64: AMD Opteron 246, 1994 MHz, 3971.48 bogomips
k = 0.49 usec; r = 0.80; kr = 0.82
ppc64: POWER5 (gr), 1656 MHz (SMT disabled, 1 virtual CPU per physical CPU)
k = 0.77 usec; r = 1.26; kr = 1.45
Optimized Probe Overhead #
Typically, an optimized kprobe hit takes 0.07 to 0.1 microseconds to process. Here are sample overhead figures (in usec) for x86 architectures:
k = unoptimized kprobe, b = boosted (single-step skipped), o = optimized kprobe,
r = unoptimized kretprobe, rb = boosted kretprobe, ro = optimized kretprobe.
i386: Intel(R) Xeon(R) E5410, 2.33GHz, 4656.90 bogomips
k = 0.80 usec; b = 0.33; o = 0.05; r = 1.10; rb = 0.61; ro = 0.33
x86-64: Intel(R) Xeon(R) E5410, 2.33GHz, 4656.90 bogomips
k = 0.99 usec; b = 0.43; o = 0.06; r = 1.24; rb = 0.68; ro = 0.30
TODO #
-
a. SystemTap (http://sourceware.org/systemtap): Provides a simplified programming interface for probe-based instrumentation. Try it out.
-
b. Kernel return probes for sparc64.
-
c. Support for other architectures.
-
d. User-space probes.
-
e. Watchpoint probes (which fire on data references).
Kprobes Example #
See samples/kprobes/kprobe_example.c
Kretprobes Example #
See samples/kprobes/kretprobe_example.c
Deprecated Features #
Jprobes is now a deprecated feature. People who are depending on it should migrate to other tracing features or use older kernels. Please consider to migrate your tool to one of the following options:
-
Use trace-event to trace target function with arguments.
trace-event is a low-overhead (and almost no visible overhead if it is off) statically defined event interface. You can define new events and trace it via ftrace or any other tracing tools.
See the following urls:
-
Use ftrace dynamic events (kprobe event) with perf-probe.
If you build your kernel with debug info (CONFIG_DEBUG_INFO=y), you can find which register/stack is assigned to which local variable or arguments by using perf-probe and set up new event to trace it.
See following documents:
-
tools/perf/Documentation/perf-probe.txt
The kprobes debugfs interface #
With recent kernels (> 2.6.20) the list of registered kprobes is visible under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug).
/sys/kernel/debug/kprobes/list: Lists all registered probes on the system:
c015d71a k vfs_read+0x0
c03dedc5 r tcp_v4_rcv+0x0
The first column provides the kernel address where the probe is inserted. The second column identifies the type of probe (k - kprobe and r - kretprobe) while the third column specifies the symbol+offset of the probe. If the probed function belongs to a module, the module name is also specified. Following columns show probe status. If the probe is on a virtual address that is no longer valid (module init sections, module virtual addresses that correspond to modules that've been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. If the probe is optimized, it is marked with [OPTIMIZED]. If the probe is ftrace-based, it is marked with [FTRACE].
/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly.
Provides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing "0" to this file, all registered probes will be disarmed, till such time a "1" is echoed to this file. Note that this knob just disarms and arms all kprobes and doesn't change each probe's disabling state. This means that disabled kprobes (marked [DISABLED]) will be not enabled if you turn ON all kprobes by this knob.
The kprobes sysctl interface #
/proc/sys/debug/kprobes-optimization: Turn kprobes optimization ON/OFF.
When CONFIG_OPTPROBES=y, this sysctl interface appears and it provides a knob to globally and forcibly turn jump optimization (see section How Does Jump Optimization Work?) ON or OFF. By default, jump optimization is allowed (ON). If you echo "0" to this file or set "debug.kprobes_optimization" to 0 via sysctl, all optimized probes will be unoptimized, and any new probes registered after that will not be optimized.
Note that this knob changes the optimized state. This means that optimized probes (marked [OPTIMIZED]) will be unoptimized ([OPTIMIZED] tag will be removed). If the knob is turned on, they will be optimized again.
References #
For additional information on Kprobes, refer to the following URLs:
Kprobe-based Event Tracing
Peios Kernel / Kernel development / Trace
Author: Masami Hiramatsu
Overview #
These events are similar to tracepoint-based events. Instead of tracepoints, this is based on kprobes (kprobe and kretprobe). So it can probe wherever kprobes can probe (this means, all functions except those with __kprobes/nokprobe_inline annotation and those marked NOKPROBE_SYMBOL). Unlike the tracepoint-based event, this can be added and removed dynamically, on the fly.
To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y.
Similar to the event tracer, this doesn't need to be activated via current_tracer. Instead of that, add probe points via /sys/kernel/tracing/kprobe_events, and enable it via /sys/kernel/tracing/events/kprobes/<EVENT>/enable.
You can also use /sys/kernel/tracing/dynamic_events instead of kprobe_events. That interface will provide unified access to other dynamic events too.
Synopsis of kprobe_events #
p[:[GRP/][EVENT]] [MOD:]SYM[+offs]|MEMADDR [FETCHARGS] : Set a probe
r[MAXACTIVE][:[GRP/][EVENT]] [MOD:]SYM[+0] [FETCHARGS] : Set a return probe
p[:[GRP/][EVENT]] [MOD:]SYM[+0]%return [FETCHARGS] : Set a return probe
-:[GRP/][EVENT] : Clear a probe
GRP : Group name. If omitted, use "kprobes" for it.
EVENT : Event name. If omitted, the event name is generated
based on SYM+offs or MEMADDR.
MOD : Module name which has given SYM.
SYM[+offs] : Symbol+offset where the probe is inserted.
SYM%return : Return address of the symbol
MEMADDR : Address where the probe is inserted.
MAXACTIVE : Maximum number of instances of the specified function that
can be probed simultaneously, or 0 for the default value
as defined in Documentation/trace/kprobes.rst section 1.3.1.
FETCHARGS : Arguments. Each probe can have up to 128 args.
%REG : Fetch register REG
@ADDR : Fetch memory at ADDR (ADDR should be in kernel)
@SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol)
$stackN : Fetch Nth entry of stack (N >= 0)
$stack : Fetch stack address.
$argN : Fetch the Nth function argument. (N >= 1) (\*1)
$retval : Fetch return value.(\*2)
$comm : Fetch current task comm.
+|-[u]OFFS(FETCHARG) : Fetch memory at FETCHARG +|- OFFS address.(\*3)(\*4)
\IMM : Store an immediate value to the argument.
NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
(u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types
(x8/x16/x32/x64), VFS layer common type(%pd/%pD), "char",
"string", "ustring", "symbol", "symstr" and bitfield are
supported.
(\*1) only for the probe on function entry (offs == 0). Note, this argument access
is best effort, because depending on the argument type, it may be passed on
the stack. But this only support the arguments via registers.
(\*2) only for return probe. Note that this is also best effort. Depending on the
return value type, it might be passed via a pair of registers. But this only
accesses one register.
(\*3) this is useful for fetching a field of data structures.
(\*4) "u" means user-space dereference. See :ref:`user_mem_access`.
Function arguments at kretprobe #
Function arguments can be accessed at kretprobe using $arg<N> fetcharg. This is useful to record the function parameter and return value at once, and trace the difference of structure fields (for debugging a function whether it correctly updates the given data structure or not). See the sample in fprobe event for how it works.
Types #
Several types are supported for fetchargs. Kprobe tracer will access memory by given type. Prefix 's' and 'u' means those types are signed and unsigned respectively. 'x' prefix implies it is unsigned. Traced arguments are shown in decimal ('s' and 'u') or hexadecimal ('x'). Without type casting, 'x32' or 'x64' is used depends on the architecture (e.g. x86-32 uses x32, and x86-64 uses x64).
These value types can be an array. To record array data, you can add '[N]' (where N is a fixed number, less than 64) to the base type. E.g. 'x16[4]' means an array of x16 (2-byte hex) with 4 elements. Note that the array can be applied to memory type fetchargs, you can not apply it to registers/stack-entries etc. (for example, '$stack1:x8[8]' is wrong, but '+8($stack):x8[8]' is OK.)
Char type can be used to show the character value of traced arguments.
String type is a special type, which fetches a "null-terminated" string from kernel space. This means it will fail and store NULL if the string container has been paged out. "ustring" type is an alternative of string for user-space. See User Memory Access for more info.
The string array type is a bit different from other types. For other base types, <base-type>[1] is equal to <base-type> (e.g. +0(%di):x32[1] is same as +0(%di):x32.) But string[1] is not equal to string. The string type itself represents "char array", but string array type represents "char * array". So, for example, +0(%di):string[1] is equal to +0(+0(%di)):string. Bitfield is another special type, which takes 3 parameters, bit-width, bit- offset, and container-size (usually 32). The syntax is:
b<bit-width>@<bit-offset>/<container-size>
Symbol type('symbol') is an alias of u32 or u64 type (depends on BITS_PER_LONG) which shows given pointer in "symbol+offset" style. On the other hand, symbol-string type ('symstr') converts the given address to "symbol+offset/symbolsize" style and stores it as a null-terminated string. With 'symstr' type, you can filter the event with wildcard pattern of the symbols, and you don't need to solve symbol name by yourself. For $comm, the default type is "string"; any other type is invalid.
VFS layer common type(%pd/%pD) is a special type, which fetches dentry's or file's name from struct dentry's address or struct file's address.
User Memory Access #
Kprobe events supports user-space memory access. For that purpose, you can use either user-space dereference syntax or 'ustring' type.
The user-space dereference syntax allows you to access a field of a data structure in user-space. This is done by adding the "u" prefix to the dereference syntax. For example, +u4(%si) means it will read memory from the address in the register %si offset by 4, and the memory is expected to be in user-space. You can use this for strings too, e.g. +u0(%si):string will read a string from the address in the register %si that is expected to be in user- space. 'ustring' is a shortcut way of performing the same task. That is, +0(%si):ustring is equivalent to +u0(%si):string.
Note that kprobe-event provides the user-memory access syntax but it doesn't use it transparently. This means if you use normal dereference or string type for user memory, it might fail, and may always fail on some architectures. The user has to carefully check if the target data is in kernel or user space.
Per-Probe Event Filtering #
Per-probe event filtering feature allows you to set different filter on each probe and gives you what arguments will be shown in trace buffer. If an event name is specified right after 'p:' or 'r:' in kprobe_events, it adds an event under tracing/events/kprobes/<EVENT>, at the directory you can see 'id', 'enable', 'format', 'filter' and 'trigger'.
-
enable:
You can enable/disable the probe by writing 1 or 0 on it.
-
format:
This shows the format of this probe event.
-
filter:
You can write filtering rules of this event.
-
id:
This shows the id of this probe event.
-
trigger:
This allows to install trigger commands which are executed when the event is hit (for details, see Documentation/trace/events.rst, section 6).
Event Profiling #
You can check the total number of probe hits and probe miss-hits via /sys/kernel/tracing/kprobe_profile. The first column is event name, the second is the number of probe hits, the third is the number of probe miss-hits.
Kernel Boot Parameter #
You can add and enable new kprobe events when booting up the kernel by "kprobe_event=" parameter. The parameter accepts a semicolon-delimited kprobe events, which format is similar to the kprobe_events. The difference is that the probe definition parameters are comma-delimited instead of space. For example, adding myprobe event on do_sys_open like below:
p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack)
should be below for kernel boot parameter (just replace spaces with comma):
p:myprobe,do_sys_open,dfd=%ax,filename=%dx,flags=%cx,mode=+4($stack)
Usage examples #
To add a probe as a new event, write a new definition to kprobe_events as below:
echo 'p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack)' > /sys/kernel/tracing/kprobe_events
This sets a kprobe on the top of do_sys_open() function with recording 1st to 4th arguments as "myprobe" event. Note, which register/stack entry is assigned to each function argument depends on arch-specific ABI. If you unsure the ABI, please try to use probe subcommand of perf-tools (you can find it under tools/perf/). As this example shows, users can choose more familiar names for each arguments.
echo 'r:myretprobe do_sys_open $retval' >> /sys/kernel/tracing/kprobe_events
This sets a kretprobe on the return point of do_sys_open() function with recording return value as "myretprobe" event. You can see the format of these events via /sys/kernel/tracing/events/kprobes/<EVENT>/format.
cat /sys/kernel/tracing/events/kprobes/myprobe/format
name: myprobe
ID: 780
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1;signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:unsigned long __probe_ip; offset:12; size:4; signed:0;
field:int __probe_nargs; offset:16; size:4; signed:1;
field:unsigned long dfd; offset:20; size:4; signed:0;
field:unsigned long filename; offset:24; size:4; signed:0;
field:unsigned long flags; offset:28; size:4; signed:0;
field:unsigned long mode; offset:32; size:4; signed:0;
print fmt: "(%lx) dfd=%lx filename=%lx flags=%lx mode=%lx", REC->__probe_ip,
REC->dfd, REC->filename, REC->flags, REC->mode
You can see that the event has 4 arguments as in the expressions you specified.
echo > /sys/kernel/tracing/kprobe_events
This clears all probe points.
Or,
echo -:myprobe >> kprobe_events
This clears probe points selectively.
Right after definition, each event is disabled by default. For tracing these events, you need to enable it.
echo 1 > /sys/kernel/tracing/events/kprobes/myprobe/enable
echo 1 > /sys/kernel/tracing/events/kprobes/myretprobe/enable
Use the following command to start tracing in an interval.
# echo 1 > tracing_on
Open something...
# echo 0 > tracing_on
And you can see the traced information via /sys/kernel/tracing/trace.
cat /sys/kernel/tracing/trace
# tracer: nop
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
<...>-1447 [001] 1038282.286875: myprobe: (do_sys_open+0x0/0xd6) dfd=3 filename=7fffd1ec4440 flags=8000 mode=0
<...>-1447 [001] 1038282.286878: myretprobe: (sys_openat+0xc/0xe <- do_sys_open) $retval=fffffffffffffffe
<...>-1447 [001] 1038282.286885: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=40413c flags=8000 mode=1b6
<...>-1447 [001] 1038282.286915: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) $retval=3
<...>-1447 [001] 1038282.286969: myprobe: (do_sys_open+0x0/0xd6) dfd=ffffff9c filename=4041c6 flags=98800 mode=10
<...>-1447 [001] 1038282.286976: myretprobe: (sys_open+0x1b/0x1d <- do_sys_open) $retval=3
Each line shows when the kernel hits an event, and <- SYMBOL means kernel returns from SYMBOL(e.g. "sys_open+0x1b/0x1d <- do_sys_open" means kernel returns from do_sys_open to sys_open+0x1b).
In-kernel memory-mapped I/O tracing
Peios Kernel / Kernel development / Trace
Peios: Integrity lockdown restricts debugfs access. Read-only files passing its safety checks can remain accessible, but writable or ioctl/mmap-capable debugfs interfaces can fail with
EPERM. Native authority does not bypass lockdown. These upstream diagnostic recipes therefore depend on interface availability in the configured kernel. See Peios kernel behaviour.
Peios: Linux capability names in this interface retain their API meaning, but KACS evaluates them through native token privileges or compatibility rules. UID 0,
setcapand Unix mode bits do not independently grant native authority. Object access and PIP checks remain additional constraints where applicable. See Peios kernel behaviour for the mapping and exceptions.
Home page and links to optional user space tools:
MMIO tracing was originally developed by Intel around 2003 for their Fault Injection Test Harness. In Dec 2006 - Jan 2007, using the code from Intel, Jeff Muizelaar created a tool for tracing MMIO accesses with the Nouveau project in mind. Since then many people have contributed.
Mmiotrace was built for reverse engineering any memory-mapped IO device with the Nouveau project as the first real user. Only x86 and x86_64 architectures are supported.
Out-of-tree mmiotrace was originally modified for mainline inclusion and ftrace framework by Pekka Paalanen <pq@iki.fi>.
Preparation #
Mmiotrace feature is compiled in by the CONFIG_MMIOTRACE option. Tracing is disabled by default, so it is safe to have this set to yes. SMP systems are supported, but tracing is unreliable and may miss events if more than one CPU is on-line, therefore mmiotrace takes all but one CPU off-line during run-time activation. You can re-enable CPUs by hand, but you have been warned, there is no way to automatically detect if you are losing events due to CPUs racing.
Usage Quick Reference #
$ mount -t debugfs debugfs /sys/kernel/debug
$ echo mmiotrace > /sys/kernel/tracing/current_tracer
$ cat /sys/kernel/tracing/trace_pipe > mydump.txt &
Start X or whatever.
$ echo "X is up" > /sys/kernel/tracing/trace_marker
$ echo nop > /sys/kernel/tracing/current_tracer
Check for lost events.
Usage #
Make sure debugfs is mounted to /sys/kernel/debug. If not (requires root privileges):
$ mount -t debugfs debugfs /sys/kernel/debug
Check that the driver you are about to trace is not loaded.
Activate mmiotrace (requires root privileges):
$ echo mmiotrace > /sys/kernel/tracing/current_tracer
Start storing the trace:
$ cat /sys/kernel/tracing/trace_pipe > mydump.txt &
The 'cat' process should stay running (sleeping) in the background.
Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active.
During tracing you can place comments (markers) into the trace by $ echo "X is up" > /sys/kernel/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do.
Shut down mmiotrace (requires root privileges):
$ echo nop > /sys/kernel/tracing/current_tracer
The 'cat' process exits. If it does not, kill it by issuing 'fg' command and pressing ctrl+c.
Check that mmiotrace did not lose events due to a buffer filling up. Either:
$ grep -i lost mydump.txt
which tells you exactly how many events were lost, or use:
$ dmesg
to view your kernel log and look for "mmiotrace has lost events" warning. If events were lost, the trace is incomplete. You should enlarge the buffers and try again. Buffers are enlarged by first seeing how large the current buffers are:
$ cat /sys/kernel/tracing/buffer_size_kb
gives you a number. Approximately double this number and write it back, for instance:
$ echo 128000 > /sys/kernel/tracing/buffer_size_kb
Then start again from the top.
If you are doing a trace for a driver project, e.g. Nouveau, you should also do the following before sending your results:
$ lspci -vvv > lspci.txt
$ dmesg > dmesg.txt
$ tar zcf pciid-nick-mmiotrace.tar.gz mydump.txt lspci.txt dmesg.txt
and then send the .tar.gz file. The trace compresses considerably. Replace "pciid" and "nick" with the PCI ID or model name of your piece of hardware under investigation and your nickname.
How Mmiotrace Works #
Access to hardware IO-memory is gained by mapping addresses from PCI bus by calling one of the ioremap_*() functions. Mmiotrace is hooked into the __ioremap() function and gets called whenever a mapping is created. Mapping is an event that is recorded into the trace log. Note that ISA range mappings are not caught, since the mapping always exists and is returned directly.
MMIO accesses are recorded via page faults. Just before __ioremap() returns, the mapped pages are marked as not present. Any access to the pages causes a fault. The page fault handler calls mmiotrace to handle the fault. Mmiotrace marks the page present, sets TF flag to achieve single stepping and exits the fault handler. The instruction that faulted is executed and debug trap is entered. Here mmiotrace again marks the page as not present. The instruction is decoded to get the type of operation (read/write), data width and the value read or written. These are stored to the trace log.
Setting the page present in the page fault handler has a race condition on SMP machines. During the single stepping other CPUs may run freely on that page and events can be missed without a notice. Re-enabling other CPUs during tracing is discouraged.
Trace Log Format #
The raw log is text and easily filtered with e.g. grep and awk. One record is one line in the log. A record starts with a keyword, followed by keyword- dependent arguments. Arguments are separated by a space, or continue until the end of line. The format for version 20070824 is as follows:
Explanation Keyword Space-separated arguments #
read event R width, timestamp, map id, physical, value, PC, PID write event W width, timestamp, map id, physical, value, PC, PID ioremap event MAP timestamp, map id, physical, virtual, length, PC, PID iounmap event UNMAP timestamp, map id, PC, PID marker MARK timestamp, text version VERSION the string "20070824" info for reader LSPCI one line from lspci -v PCI address map PCIDEV space-separated /proc/bus/pci/devices data unk. opcode UNKNOWN timestamp, map id, physical, data, PC, PID
Timestamp is in seconds with decimals. Physical is a PCI bus address, virtual is a kernel virtual address. Width is the data width in bytes and value is the data value. Map id is an arbitrary id number identifying the mapping that was used in an operation. PC is the program counter and PID is process id. PC is zero if it is not recorded. PID is always zero as tracing MMIO accesses originating in user space memory is not yet supported.
For instance, the following awk filter will pass all 32-bit writes that target physical addresses in the range [0xfb73ce40, 0xfb800000]
$ awk '/W 4 / { adr=strtonum($5); if (adr >= 0xfb73ce40 &&
adr < 0xfb800000) print; }'
Tools for Developers #
-
The user space tools include utilities for:
-
replacing numeric addresses and values with hardware register names
-
replaying MMIO logs, i.e., re-executing the recorded writes
-
OSNOISE Tracer
Peios Kernel / Kernel development / Trace
In the context of high-performance computing (HPC), the Operating System Noise (osnoise) refers to the interference experienced by an application due to activities inside the operating system. In the context of Linux, NMIs, IRQs, SoftIRQs, and any other system thread can cause noise to the system. Moreover, hardware-related jobs can also cause noise, for example, via SMIs.
hwlat_detector is one of the tools used to identify the most complex source of noise: hardware noise.
In a nutshell, the hwlat_detector creates a thread that runs periodically for a given period. At the beginning of a period, the thread disables interrupt and starts sampling. While running, the hwlatd thread reads the time in a loop. As interrupts are disabled, threads, IRQs, and SoftIRQs cannot interfere with the hwlatd thread. Hence, the cause of any gap between two different reads of the time roots either on NMI or in the hardware itself. At the end of the period, hwlatd enables interrupts and reports the max observed gap between the reads. It also prints a NMI occurrence counter. If the output does not report NMI executions, the user can conclude that the hardware is the culprit for the latency. The hwlat detects the NMI execution by observing the entry and exit of a NMI.
The osnoise tracer leverages the hwlat_detector by running a similar loop with preemption, SoftIRQs and IRQs enabled, thus allowing all the sources of osnoise during its execution. Using the same approach of hwlat, osnoise takes note of the entry and exit point of any source of interferences, increasing a per-cpu interference counter. The osnoise tracer also saves an interference counter for each source of interference. The interference counter for NMI, IRQs, SoftIRQs, and threads is increased anytime the tool observes these interferences' entry events. When a noise happens without any interference from the operating system level, the hardware noise counter increases, pointing to a hardware-related noise. In this way, osnoise can account for any source of interference. At the end of the period, the osnoise tracer prints the sum of all noise, the max single noise, the percentage of CPU available for the thread, and the counters for the noise sources.
Usage #
Write the ASCII text "osnoise" into the current_tracer file of the tracing system (generally mounted at /sys/kernel/tracing).
For example:
[root@f32 ~]# cd /sys/kernel/tracing/
[root@f32 tracing]# echo osnoise > current_tracer
It is possible to follow the trace by reading the trace file:
[root@f32 tracing]# cat trace
# tracer: osnoise
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth MAX
# || / SINGLE Interference counters:
# |||| RUNTIME NOISE % OF CPU NOISE +-----------------------------+
# TASK-PID CPU# |||| TIMESTAMP IN US IN US AVAILABLE IN US HW NMI IRQ SIRQ THREAD
# | | | |||| | | | | | | | | | |
<...>-859 [000] .... 81.637220: 1000000 190 99.98100 9 18 0 1007 18 1
<...>-860 [001] .... 81.638154: 1000000 656 99.93440 74 23 0 1006 16 3
<...>-861 [002] .... 81.638193: 1000000 5675 99.43250 202 6 0 1013 25 21
<...>-862 [003] .... 81.638242: 1000000 125 99.98750 45 1 0 1011 23 0
<...>-863 [004] .... 81.638260: 1000000 1721 99.82790 168 7 0 1002 49 41
<...>-864 [005] .... 81.638286: 1000000 263 99.97370 57 6 0 1006 26 2
<...>-865 [006] .... 81.638302: 1000000 109 99.98910 21 3 0 1006 18 1
<...>-866 [007] .... 81.638326: 1000000 7816 99.21840 107 8 0 1016 39 19
In addition to the regular trace fields (from TASK-PID to TIMESTAMP), the tracer prints a message at the end of each period for each CPU that is running an osnoise/ thread. The osnoise specific fields report:
The RUNTIME IN US reports the amount of time in microseconds that the osnoise thread kept looping reading the time.
The NOISE IN US reports the sum of noise in microseconds observed by the osnoise tracer during the associated runtime.
The % OF CPU AVAILABLE reports the percentage of CPU available for the osnoise thread during the runtime window.
The MAX SINGLE NOISE IN US reports the maximum single noise observed during the runtime window.
The Interference counters display how many each of the respective interference happened during the runtime window.
Note that the example above shows a high number of HW noise samples. The reason being is that this sample was taken on a virtual machine, and the host interference is detected as a hardware interference.
Tracer Configuration #
The tracer has a set of options inside the osnoise directory, they are:
osnoise/cpus: CPUs at which a osnoise thread will execute.
osnoise/period_us: the period of the osnoise thread.
osnoise/runtime_us: how long an osnoise thread will look for noise.
osnoise/stop_tracing_us: stop the system tracing if a single noise higher than the configured value happens. Writing 0 disables this option.
osnoise/stop_tracing_total_us: stop the system tracing if total noise higher than the configured value happens. Writing 0 disables this option.
tracing_threshold: the minimum delta between two time() reads to be considered as noise, in us. When set to 0, the default value will be used, which is currently 1 us.
osnoise/options: a set of on/off options that can be enabled by writing the option name to the file or disabled by writing the option name preceded with the 'NO_' prefix. For example, writing NO_OSNOISE_WORKLOAD disables the OSNOISE_WORKLOAD option. The special DEAFAULTS option resets all options to the default value.
Tracer Options #
The osnoise/options file exposes a set of on/off configuration options for the osnoise tracer. These options are:
DEFAULTS: reset the options to the default value.
OSNOISE_WORKLOAD: do not dispatch osnoise workload (see dedicated section below).
PANIC_ON_STOP: call panic() if the tracer stops. This option serves to capture a vmcore.
OSNOISE_PREEMPT_DISABLE: disable preemption while running the osnoise workload, allowing only IRQ and hardware-related noise.
OSNOISE_IRQ_DISABLE: disable IRQs while running the osnoise workload, allowing only NMIs and hardware-related noise, like hwlat tracer.
Additional Tracing #
In addition to the tracer, a set of tracepoints were added to facilitate the identification of the osnoise source.
osnoise:sample_threshold: printed anytime a noise is higher than the configurable tolerance_ns.
osnoise:nmi_noise: noise from NMI, including the duration.
osnoise:irq_noise: noise from an IRQ, including the duration.
osnoise:softirq_noise: noise from a SoftIRQ, including the duration.
osnoise:thread_noise: noise from a thread, including the duration.
Note that all the values are net values. For example, if while osnoise is running, another thread preempts the osnoise thread, it will start a thread_noise duration at the start. Then, an IRQ takes place, preempting the thread_noise, starting a irq_noise. When the IRQ ends its execution, it will compute its duration, and this duration will be subtracted from the thread_noise, in such a way as to avoid the double accounting of the IRQ execution. This logic is valid for all sources of noise.
Here is one example of the usage of these tracepoints:
osnoise/8-961 [008] d.h. 5789.857532: irq_noise: local_timer:236 start 5789.857529929 duration 1845 ns
osnoise/8-961 [008] dNh. 5789.858408: irq_noise: local_timer:236 start 5789.858404871 duration 2848 ns
migration/8-54 [008] d... 5789.858413: thread_noise: migration/8:54 start 5789.858409300 duration 3068 ns
osnoise/8-961 [008] .... 5789.858413: sample_threshold: start 5789.858404555 duration 8812 ns interferences 2
In this example, a noise sample of 8 microseconds was reported in the last line, pointing to two interferences. Looking backward in the trace, the two previous entries were about the migration thread running after a timer IRQ execution. The first event is not part of the noise because it took place one millisecond before.
It is worth noticing that the sum of the duration reported in the tracepoints is smaller than eight us reported in the sample_threshold. The reason roots in the overhead of the entry and exit code that happens before and after any interference execution. This justifies the dual approach: measuring thread and tracing.
Running osnoise tracer without workload #
By enabling the osnoise tracer with the NO_OSNOISE_WORKLOAD option set, the osnoise: tracepoints serve to measure the execution time of any type of Linux task, free from the interference of other tasks.
Lockless Ring Buffer Design
Peios Kernel / Kernel development / Trace
Copyright 2009 Red Hat Inc.
Author: Steven Rostedt <srostedt@redhat.com>
License: The GNU Free Documentation License, Version 1.2 (dual licensed under the GPL v2)
Reviewers: Mathieu Desnoyers, Huang Ying, Hidetoshi Seto, and Frederic Weisbecker.
Written for: 2.6.31
Terminology used in this Document #
-
tail
- where new writes happen in the ring buffer.
-
head
- where new reads happen in the ring buffer.
-
producer
- the task that writes into the ring buffer (same as writer)
-
writer
- same as producer
-
consumer
- the task that reads from the buffer (same as reader)
-
reader
- same as consumer.
-
reader_page
- A page outside the ring buffer used solely (for the most part) by the reader.
-
head_page
- a pointer to the page that the reader will use next
-
tail_page
- a pointer to the page that will be written to next
-
commit_page
- a pointer to the page with the last finished non-nested write.
-
cmpxchg
-
hardware-assisted atomic transaction that performs the following:
A = B if previous A == C R = cmpxchg(A, C, B) is saying that we replace A with B if and only if current A is equal to C, and we put the old (current) A into R R gets the previous A regardless if A is updated with B or not.To see if the update was successful a compare of
R == Cmay be used.
-
The Generic Ring Buffer #
The ring buffer can be used in either an overwrite mode or in producer/consumer mode.
Producer/consumer mode is where if the producer were to fill up the buffer before the consumer could free up anything, the producer will stop writing to the buffer. This will lose most recent events.
Overwrite mode is where if the producer were to fill up the buffer before the consumer could free up anything, the producer will overwrite the older data. This will lose the oldest events.
No two writers can write at the same time (on the same per-cpu buffer), but a writer may interrupt another writer, but it must finish writing before the previous writer may continue. This is very important to the algorithm. The writers act like a "stack". The way interrupts works enforces this behavior:
writer1 start
<preempted> writer2 start
<preempted> writer3 start
writer3 finishes
writer2 finishes
writer1 finishes
This is very much like a writer being preempted by an interrupt and the interrupt doing a write as well.
Readers can happen at any time. But no two readers may run at the same time, nor can a reader preempt/interrupt another reader. A reader cannot preempt/interrupt a writer, but it may read/consume from the buffer at the same time as a writer is writing, but the reader must be on another processor to do so. A reader may read on its own processor and can be preempted by a writer.
A writer can preempt a reader, but a reader cannot preempt a writer. But a reader can read the buffer at the same time (on another processor) as a writer.
The ring buffer is made up of a list of pages held together by a linked list.
At initialization a reader page is allocated for the reader that is not part of the ring buffer.
The head_page, tail_page and commit_page are all initialized to point to the same page.
The reader page is initialized to have its next pointer pointing to the head page, and its previous pointer pointing to a page before the head page.
The reader has its own page to use. At start up time, this page is allocated but is not attached to the list. When the reader wants to read from the buffer, if its page is empty (like it is on start-up), it will swap its page with the head_page. The old reader page will become part of the ring buffer and the head_page will be removed. The page after the inserted page (old reader_page) will become the new head page.
Once the new page is given to the reader, the reader could do what it wants with it, as long as a writer has left that page.
A sample of how the reader page is swapped: Note this does not show the head page in the buffer, it is for demonstrating a swap only.
+------+
|reader| RING BUFFER
|page |
+------+
+---+ +---+ +---+
| |-->| |-->| |
| |<--| |<--| |
+---+ +---+ +---+
^ | ^ |
| +-------------+ |
+-----------------+
+------+
|reader| RING BUFFER
|page |-------------------+
+------+ v
| +---+ +---+ +---+
| | |-->| |-->| |
| | |<--| |<--| |<-+
| +---+ +---+ +---+ |
| ^ | ^ | |
| | +-------------+ | |
| +-----------------+ |
+------------------------------------+
+------+
|reader| RING BUFFER
|page |-------------------+
+------+ <---------------+ v
| ^ +---+ +---+ +---+
| | | |-->| |-->| |
| | | | | |<--| |<-+
| | +---+ +---+ +---+ |
| | | ^ | |
| | +-------------+ | |
| +-----------------------------+ |
+------------------------------------+
+------+
|buffer| RING BUFFER
|page |-------------------+
+------+ <---------------+ v
| ^ +---+ +---+ +---+
| | | | | |-->| |
| | New | | | |<--| |<-+
| | Reader +---+ +---+ +---+ |
| | page ----^ | |
| | | |
| +-----------------------------+ |
+------------------------------------+
It is possible that the page swapped is the commit page and the tail page, if what is in the ring buffer is less than what is held in a buffer page.
reader page commit page tail page
| | |
v | |
+---+ | |
| |<----------+ |
| |<------------------------+
| |------+
+---+ |
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
This case is still valid for this algorithm. When the writer leaves the page, it simply goes into the ring buffer since the reader page still points to the next location in the ring buffer.
The main pointers:
reader page
- The page used solely by the reader and is not part of the ring buffer (may be swapped in)
head page
- the next page in the ring buffer that will be swapped with the reader page.
tail page
- the page where the next write will take place.
commit page
- the page that last finished a write.
The commit page only is updated by the outermost writer in the writer stack. A writer that preempts another writer will not move the commit page.
When data is written into the ring buffer, a position is reserved in the ring buffer and passed back to the writer. When the writer is finished writing data into that position, it commits the write.
Another write (or a read) may take place at anytime during this transaction. If another write happens it must finish before continuing with the previous write.
Write reserve:
Buffer page +---------+ |written | +---------+ <--- given back to writer (current commit) |reserved | +---------+ <--- tail pointer | empty | +---------+Write commit:
Buffer page +---------+ |written | +---------+ |written | +---------+ <--- next position for write (current commit) | empty | +---------+If a write happens after the first reserve:
Buffer page +---------+ |written | +---------+ <-- current commit |reserved | +---------+ <--- given back to second writer |reserved | +---------+ <--- tail pointer After second writer commits:: Buffer page +---------+ |written | +---------+ <--(last full commit) |reserved | +---------+ |pending | |commit | +---------+ <--- tail pointer When the first writer commits:: Buffer page +---------+ |written | +---------+ |written | +---------+ |written | +---------+ <--(last full commit and tail pointer)
The commit pointer points to the last write location that was committed without preempting another write. When a write that preempted another write is committed, it only becomes a pending commit and will not be a full commit until all writes have been committed.
The commit page points to the page that has the last full commit. The tail page points to the page with the last write (before committing).
The tail page is always equal to or after the commit page. It may be several pages ahead. If the tail page catches up to the commit page then no more writes may take place (regardless of the mode of the ring buffer: overwrite and produce/consumer).
The order of pages is:
head page
commit page
tail page
Possible scenario:
tail page
head page commit page |
| | |
v v v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
There is a special case that the head page is after either the commit page and possibly the tail page. That is when the commit (and tail) page has been swapped with the reader page. This is because the head page is always part of the ring buffer, but the reader page is not. Whenever there has been less than a full page that has been committed inside the ring buffer, and a reader swaps out a page, it will be swapping out the commit page.
reader page commit page tail page
| | |
v | |
+---+ | |
| |<----------+ |
| |<------------------------+
| |------+
+---+ |
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
^
|
head page
In this case, the head page will not move when the tail and commit move back into the ring buffer.
The reader cannot swap a page into the ring buffer if the commit page is still on that page. If the read meets the last commit (real commit not pending or reserved), then there is nothing more to read. The buffer is considered empty until another full commit finishes.
When the tail meets the head page, if the buffer is in overwrite mode, the head page will be pushed ahead one. If the buffer is in producer/consumer mode, the write will fail.
Overwrite mode:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
^
|
head page
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
^
|
head page
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
^
|
head page
Note, the reader page will still point to the previous head page. But when a swap takes place, it will use the most recent head page.
Making the Ring Buffer Lockless: #
The main idea behind the lockless algorithm is to combine the moving of the head_page pointer with the swapping of pages with the reader. State flags are placed inside the pointer to the page. To do this, each page must be aligned in memory by 4 bytes. This will allow the 2 least significant bits of the address to be used as flags, since they will always be zero for the address. To get the address, simply mask out the flags:
MASK = ~3
address & MASK
Two flags will be kept by these two bits:
HEADER
- the page being pointed to is a head page
UPDATE
- the page being pointed to is being updated by a writer and was or is about to be a head page.
reader page
|
v
+---+
| |------+
+---+ |
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-H->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The above pointer "-H->" would have the HEADER flag set. That is the next page is the next page to be swapped out by the reader. This pointer means the next page is the head page.
When the tail page meets the head pointer, it will use cmpxchg to change the pointer to the UPDATE state:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-H->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
"-U->" represents a pointer in the UPDATE state.
Any access to the reader will need to take some sort of lock to serialize the readers. But the writers will never take a lock to write to the ring buffer. This means we only need to worry about a single reader, and writes only preempt in "stack" formation.
When the reader tries to swap the page with the ring buffer, it will also use cmpxchg. If the flag bit in the pointer to the head page does not have the HEADER flag set, the compare will fail and the reader will need to look for the new head page and try again. Note, the flags UPDATE and HEADER are never set at the same time.
The reader swaps the reader page as follows:
+------+
|reader| RING BUFFER
|page |
+------+
+---+ +---+ +---+
| |--->| |--->| |
| |<---| |<---| |
+---+ +---+ +---+
^ | ^ |
| +---------------+ |
+-----H-------------+
The reader sets the reader page next pointer as HEADER to the page after the head page:
+------+
|reader| RING BUFFER
|page |-------H-----------+
+------+ v
| +---+ +---+ +---+
| | |--->| |--->| |
| | |<---| |<---| |<-+
| +---+ +---+ +---+ |
| ^ | ^ | |
| | +---------------+ | |
| +-----H-------------+ |
+--------------------------------------+
It does a cmpxchg with the pointer to the previous head page to make it point to the reader page. Note that the new pointer does not have the HEADER flag set. This action atomically moves the head page forward:
+------+
|reader| RING BUFFER
|page |-------H-----------+
+------+ v
| ^ +---+ +---+ +---+
| | | |-->| |-->| |
| | | |<--| |<--| |<-+
| | +---+ +---+ +---+ |
| | | ^ | |
| | +-------------+ | |
| +-----------------------------+ |
+------------------------------------+
After the new head page is set, the previous pointer of the head page is updated to the reader page:
+------+
|reader| RING BUFFER
|page |-------H-----------+
+------+ <---------------+ v
| ^ +---+ +---+ +---+
| | | |-->| |-->| |
| | | | | |<--| |<-+
| | +---+ +---+ +---+ |
| | | ^ | |
| | +-------------+ | |
| +-----------------------------+ |
+------------------------------------+
+------+
|buffer| RING BUFFER
|page |-------H-----------+ <--- New head page
+------+ <---------------+ v
| ^ +---+ +---+ +---+
| | | | | |-->| |
| | New | | | |<--| |<-+
| | Reader +---+ +---+ +---+ |
| | page ----^ | |
| | | |
| +-----------------------------+ |
+------------------------------------+
Another important point: The page that the reader page points back to by its previous pointer (the one that now points to the new head page) never points back to the reader page. That is because the reader page is not part of the ring buffer. Traversing the ring buffer via the next pointers will always stay in the ring buffer. Traversing the ring buffer via the prev pointers may not.
Note, the way to determine a reader page is simply by examining the previous pointer of the page. If the next pointer of the previous page does not point back to the original page, then the original page is a reader page:
+--------+
| reader | next +----+
| page |-------->| |<====== (buffer page)
+--------+ +----+
| | ^
| v | next
prev | +----+
+------------->| |
+----+
The way the head page moves forward:
When the tail page meets the head page and the buffer is in overwrite mode and more writes take place, the head page must be moved forward before the writer may move the tail page. The way this is done is that the writer performs a cmpxchg to convert the pointer to the head page from the HEADER flag to have the UPDATE flag set. Once this is done, the reader will not be able to swap the head page from the buffer, nor will it be able to move the head page, until the writer is finished with the move.
This eliminates any races that the reader can have on the writer. The reader must spin, and this is why the reader cannot preempt the writer:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-H->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The following page will be made into the new head page:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
After the new head page has been set, we can set the old head page pointer back to NORMAL:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
After the head page has been moved, the tail page may now move forward:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The above are the trivial updates. Now for the more complex scenarios.
As stated before, if enough writes preempt the first write, the tail page may make it all the way around the buffer and meet the commit page. At this time, we must start dropping writes (usually with some kind of warning to the user). But what happens if the commit was still on the reader page? The commit page is not part of the ring buffer. The tail page must account for this:
reader page commit page
| |
v |
+---+ |
| |<----------+
| |
| |------+
+---+ |
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-H->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
^
|
tail page
If the tail page were to simply push the head page forward, the commit when leaving the reader page would not be pointing to the correct page.
The solution to this is to test if the commit page is on the reader page before pushing the head page. If it is, then it can be assumed that the tail page wrapped the buffer, and we must drop new writes.
This is not a race condition, because the commit page can only be moved by the outermost writer (the writer that was preempted). This means that the commit will not move while a writer is moving the tail page. The reader cannot swap the reader page if it is also being used as the commit page. The reader can simply check that the commit is off the reader page. Once the commit page leaves the reader page it will never go back on it unless a reader does another swap with the buffer page that is also the commit page.
Nested writes #
In the pushing forward of the tail page we must first push forward the head page if the head page is the next page. If the head page is not the next page, the tail page is simply updated with a cmpxchg.
Only writers move the tail page. This must be done atomically to protect against nested writers:
temp_page = tail_page
next_page = temp_page->next
cmpxchg(tail_page, temp_page, next_page)
The above will update the tail page if it is still pointing to the expected page. If this fails, a nested write pushed it forward, the current write does not need to push it:
temp page
|
v
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Nested write comes in and moves the tail page forward:
tail page (moved by nested writer)
temp page |
| |
v v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The above would fail the cmpxchg, but since the tail page has already been moved forward, the writer will just try again to reserve storage on the new tail page.
But the moving of the head page is a bit more complex:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-H->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The write converts the head page pointer to UPDATE:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
But if a nested writer preempts here, it will see that the next page is a head page, but it is also nested. It will detect that it is nested and will save that information. The detection is the fact that it sees the UPDATE flag instead of a HEADER or NORMAL pointer.
The nested writer will set the new head page pointer:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
But it will not reset the update back to normal. Only the writer that converted a pointer from HEAD to UPDATE will convert it back to NORMAL:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
After the nested writer finishes, the outermost writer will convert the UPDATE pointer to NORMAL:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
It can be even more complex if several nested writes came in and moved the tail page ahead several pages:
(first writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-H->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The write converts the head page pointer to UPDATE:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Next writer comes in, and sees the update and sets up the new head page:
(second writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The nested writer moves the tail page forward. But does not set the old update page to NORMAL because it is not the outermost writer:
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Another writer preempts and sees the page after the tail page is a head page. It changes it from HEAD to UPDATE:
(third writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-U->| |--->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The writer will move the head page forward:
(third writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-U->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
But now that the third writer did change the HEAD flag to UPDATE it will convert it to normal:
(third writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Then it will move the tail page, and return back to the second writer:
(second writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The second writer will fail to move the tail page because it was already moved, so it will try again and add its data to the new tail page. It will return to the first writer:
(first writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
The first writer cannot know atomically if the tail page moved while it updates the HEAD page. It will then update the head page to what it thinks is the new head page:
(first writer)
tail page
|
v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Since the cmpxchg returns the old value of the pointer the first writer will see it succeeded in updating the pointer from NORMAL to HEAD. But as we can see, this is not good enough. It must also check to see if the tail page is either where it use to be or on the next page:
(first writer)
A B tail page
| | |
v v v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |-H->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
If tail page != A and tail page != B, then it must reset the pointer back to NORMAL. The fact that it only needs to worry about nested writers means that it only needs to check this after setting the HEAD page:
(first writer)
A B tail page
| | |
v v v
+---+ +---+ +---+ +---+
<---| |--->| |-U->| |--->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Now the writer can update the head page. This is also why the head page must remain in UPDATE and only reset by the outermost writer. This prevents the reader from seeing the incorrect head page:
(first writer)
A B tail page
| | |
v v v
+---+ +---+ +---+ +---+
<---| |--->| |--->| |--->| |-H->
--->| |<---| |<---| |<---| |<---
+---+ +---+ +---+ +---+
Tracefs ring-buffer memory mapping
Peios Kernel / Kernel development / Trace
Author: Vincent Donnefort <vdonnefort@google.com>
Overview #
Tracefs ring-buffer memory map provides an efficient method to stream data as no memory copy is necessary. The application mapping the ring-buffer becomes then a consumer for that ring-buffer, in a similar fashion to trace_pipe.
Memory mapping setup #
The mapping works with a mmap() of the trace_pipe_raw interface.
The first system page of the mapping contains ring-buffer statistics and description. It is referred to as the meta-page. One of the most important fields of the meta-page is the reader. It contains the sub-buffer ID which can be safely read by the mapper (see ring-buffer-design.rst).
The meta-page is followed by all the sub-buffers, ordered by ascending ID. It is therefore effortless to know where the reader starts in the mapping:
reader_id = meta->reader->id;
reader_offset = meta->meta_page_size + reader_id * meta->subbuf_size;
When the application is done with the current reader, it can get a new one using the trace_pipe_raw ioctl() TRACE_MMAP_IOCTL_GET_READER. This ioctl also updates the meta-page fields.
Limitations #
When a mapping is in place on a Tracefs ring-buffer, it is not possible to either resize it (either by increasing the entire size of the ring-buffer or each subbuf). It is also not possible to use snapshot and causes splice to copy the ring buffer data instead of using the copyless swap from the ring buffer.
Concurrent readers (either another application mapping that ring-buffer or the kernel with trace_pipe) are allowed but not recommended. They will compete for the ring-buffer and the output is unpredictable, just like concurrent readers on trace_pipe would be.
Example #
int
System Trace Module
Peios Kernel / Kernel development / Trace
System Trace Module (STM) is a device described in MIPI STP specs as STP trace stream generator. STP (System Trace Protocol) is a trace protocol multiplexing data from multiple trace sources, each one of which is assigned a unique pair of master and channel. While some of these masters and channels are statically allocated to certain hardware trace sources, others are available to software. Software trace sources are usually free to pick for themselves any master/channel combination from this pool.
On the receiving end of this STP stream (the decoder side), trace sources can only be identified by master/channel combination, so in order for the decoder to be able to make sense of the trace that involves multiple trace sources, it needs to be able to map those master/channel pairs to the trace sources that it understands.
For instance, it is helpful to know that syslog messages come on master 7 channel 15, while arbitrary user applications can use masters 48 to 63 and channels 0 to 127.
To solve this mapping problem, stm class provides a policy management mechanism via configfs, that allows defining rules that map string identifiers to ranges of masters and channels. If these rules (policy) are consistent with what decoder expects, it will be able to properly process the trace data.
This policy is a tree structure containing rules (policy_node) that have a name (string identifier) and a range of masters and channels associated with it, located in "stp-policy" subsystem directory in configfs. The topmost directory's name (the policy) is formatted as the STM device name to which this policy applies and an arbitrary string identifier separated by a stop. From the example above, a rule may look like this:
$ ls /config/stp-policy/dummy_stm.my-policy/user
channels masters
$ cat /config/stp-policy/dummy_stm.my-policy/user/masters
48 63
$ cat /config/stp-policy/dummy_stm.my-policy/user/channels
0 127
which means that the master allocation pool for this rule consists of masters 48 through 63 and channel allocation pool has channels 0 through 127 in it. Now, any producer (trace source) identifying itself with "user" identification string will be allocated a master and channel from within these ranges.
These rules can be nested, for example, one can define a rule "dummy" under "user" directory from the example above and this new rule will be used for trace sources with the id string of "user/dummy".
Trace sources have to open the stm class device's node and write their trace data into its file descriptor.
In order to find an appropriate policy node for a given trace source, several mechanisms can be used. First, a trace source can explicitly identify itself by calling an STP_POLICY_ID_SET ioctl on the character device's file descriptor, providing their id string, before they write any data there. Secondly, if they chose not to perform the explicit identification (because you may not want to patch existing software to do this), they can just start writing the data, at which point the stm core will try to find a policy node with the name matching the task's name (e.g., "syslogd") and if one exists, it will be used. Thirdly, if the task name can't be found among the policy nodes, the catch-all entry "default" will be used, if it exists. This entry also needs to be created and configured by the system administrator or whatever tools are taking care of the policy configuration. Finally, if all the above steps failed, the write() to an stm file descriptor will return a error (EINVAL).
Previously, if no policy nodes were found for a trace source, the stm class would silently fall back to allocating the first available contiguous range of master/channels from the beginning of the device's master/channel range. The new requirement for a policy node to exist will help programmers and sysadmins identify gaps in configuration and have better control over the un-identified sources.
Some STM devices may allow direct mapping of the channel mmio regions to userspace for zero-copy writing. One mappable page (in terms of mmu) will usually contain multiple channels' mmios, so the user will need to allocate that many channels to themselves (via the aforementioned ioctl() call) to be able to do this. That is, if your stm device's channel mmio region is 64 bytes and hardware page size is 4096 bytes, after a successful STP_POLICY_ID_SET ioctl() call with width==64, you should be able to mmap() one page on this file descriptor and obtain direct access to an mmio region for 64 channels.
Examples of STM devices are Intel(R) Trace Hub [1] and Coresight STM [2].
stm_source #
For kernel-based trace sources, there is "stm_source" device class. Devices of this class can be connected and disconnected to/from stm devices at runtime via a sysfs attribute called "stm_source_link" by writing the name of the desired stm device there, for example:
$ echo dummy_stm.0 > /sys/class/stm_source/console/stm_source_link
For examples on how to use stm_source interface in the kernel, refer to stm_console, stm_heartbeat or stm_ftrace drivers.
Each stm_source device will need to assume a master and a range of channels, depending on how many channels it requires. These are allocated for the device according to the policy configuration. If there's a node in the root of the policy directory that matches the stm_source device's name (for example, "console"), this node will be used to allocate master and channel numbers. If there's no such policy node, the stm core will use the catch-all entry "default", if one exists. If neither policy nodes exist, the write() to stm_source_link will return an error.
stm_console #
One implementation of this interface also used in the example above is the "stm_console" driver, which basically provides a one-way console for kernel messages over an stm device.
To configure the master/channel pair that will be assigned to this console in the STP stream, create a "console" policy entry (see the beginning of this text on how to do that). When initialized, it will consume one channel.
stm_ftrace #
This is another "stm_source" device, once the stm_ftrace has been linked with an stm device, and if "function" tracer is enabled, function address and parent function address which Ftrace subsystem would store into ring buffer will be exported via the stm device at the same time.
Currently only Ftrace "function" tracer is supported.
MIPI SyS-T over STP
Peios Kernel / Kernel development / Trace
The MIPI SyS-T protocol driver can be used with STM class devices to generate standardized trace stream. Aside from being a standard, it provides better trace source identification and timestamp correlation.
In order to use the MIPI SyS-T protocol driver with your STM device, first, you'll need CONFIG_STM_PROTO_SYS_T.
Now, you can select which protocol driver you want to use when you create a policy for your STM device, by specifying it in the policy name:
# mkdir /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/
In other words, the policy name format is extended like this:
<device_name>:<protocol_name>.<policy_name>
With Intel TH, therefore it can look like "0-sth:p_sys-t.my-policy".
If the protocol name is omitted, the STM class will chose whichever protocol driver was loaded first.
You can also double check that everything is working as expected by
# cat /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/protocol p_sys-t
Now, with the MIPI SyS-T protocol driver, each policy node in the configfs gets a few additional attributes, which determine per-source parameters specific to the protocol:
# mkdir /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/default # ls /config/stp-policy/dummy_stm.0:p_sys-t.my-policy/default channels clocksync_interval do_len masters ts_interval uuid
The most important one here is the "uuid", which determines the UUID that will be used to tag all data coming from this source. It is automatically generated when a new node is created, but it is likely that you would want to change it.
do_len switches on/off the additional "payload length" field in the MIPI SyS-T message header. It is off by default as the STP already marks message boundaries.
ts_interval and clocksync_interval determine how much time in milliseconds can pass before we need to include a protocol (not transport, aka STP) timestamp in a message header or send a CLOCKSYNC packet, respectively.
See Documentation/ABI/testing/configfs-stp-policy-p_sys-t for more details.
Timerlat tracer
Peios Kernel / Kernel development / Trace
The timerlat tracer aims to help the preemptive kernel developers to find sources of wakeup latencies of real-time threads. Like cyclictest, the tracer sets a periodic timer that wakes up a thread. The thread then computes a wakeup latency value as the difference between the current time and the absolute time that the timer was set to expire. The main goal of timerlat is tracing in such a way to help kernel developers.
Usage #
Write the ASCII text "timerlat" into the current_tracer file of the tracing system (generally mounted at /sys/kernel/tracing).
For example:
[root@f32 ~]# cd /sys/kernel/tracing/
[root@f32 tracing]# echo timerlat > current_tracer
It is possible to follow the trace by reading the trace file:
[root@f32 tracing]# cat trace
# tracer: timerlat
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# || /
# |||| ACTIVATION
# TASK-PID CPU# |||| TIMESTAMP ID CONTEXT LATENCY
# | | | |||| | | | |
<idle>-0 [000] d.h1 54.029328: #1 context irq timer_latency 932 ns
<...>-867 [000] .... 54.029339: #1 context thread timer_latency 11700 ns
<idle>-0 [001] dNh1 54.029346: #1 context irq timer_latency 2833 ns
<...>-868 [001] .... 54.029353: #1 context thread timer_latency 9820 ns
<idle>-0 [000] d.h1 54.030328: #2 context irq timer_latency 769 ns
<...>-867 [000] .... 54.030330: #2 context thread timer_latency 3070 ns
<idle>-0 [001] d.h1 54.030344: #2 context irq timer_latency 935 ns
<...>-868 [001] .... 54.030347: #2 context thread timer_latency 4351 ns
The tracer creates a per-cpu kernel thread with real-time priority SCHED_FIFO:95 that prints two lines at every activation. The first is the timer latency observed at the hardirq context before the activation of the thread. The second is the timer latency observed by the thread. The ACTIVATION ID field serves to relate the irq execution to its respective thread execution.
The irq/thread splitting is important to clarify in which context the unexpected high value is coming from. The irq context can be delayed by hardware-related actions, such as SMIs, NMIs, IRQs, or by thread masking interrupts. Once the timer happens, the delay can also be influenced by blocking caused by threads. For example, by postponing the scheduler execution via preempt_disable(), scheduler execution, or masking interrupts. Threads can also be delayed by the interference from other threads and IRQs.
Tracer options #
The timerlat tracer is built on top of osnoise tracer. So its configuration is also done in the osnoise/ config directory. The timerlat configs are:
cpus: CPUs at which a timerlat thread will execute.
timerlat_period_us: the period of the timerlat thread.
stop_tracing_us: stop the system tracing if a timer latency at the irq context higher than the configured value happens. Writing 0 disables this option.
stop_tracing_total_us: stop the system tracing if a timer latency at the thread context is higher than the configured value happens. Writing 0 disables this option.
print_stack: save the stack of the IRQ occurrence. The stack is printed after the thread context event, or at the IRQ handler if stop_tracing_us is hit.
timerlat and osnoise #
The timerlat can also take advantage of the osnoise: traceevents. For example:
[root@f32 ~]# cd /sys/kernel/tracing/
[root@f32 tracing]# echo timerlat > current_tracer
[root@f32 tracing]# echo 1 > events/osnoise/enable
[root@f32 tracing]# echo 25 > osnoise/stop_tracing_total_us
[root@f32 tracing]# tail -10 trace
cc1-87882 [005] d..h... 548.771078: #402268 context irq timer_latency 13585 ns
cc1-87882 [005] dNLh1.. 548.771082: irq_noise: local_timer:236 start 548.771077442 duration 7597 ns
cc1-87882 [005] dNLh2.. 548.771099: irq_noise: qxl:21 start 548.771085017 duration 7139 ns
cc1-87882 [005] d...3.. 548.771102: thread_noise: cc1:87882 start 548.771078243 duration 9909 ns
timerlat/5-1035 [005] ....... 548.771104: #402268 context thread timer_latency 39960 ns
In this case, the root cause of the timer latency does not point to a single cause but to multiple ones. Firstly, the timer IRQ was delayed for 13 us, which may point to a long IRQ disabled section (see IRQ stacktrace section). Then the timer interrupt that wakes up the timerlat thread took 7597 ns, and the qxl:21 device IRQ took 7139 ns. Finally, the cc1 thread noise took 9909 ns of time before the context switch. Such pieces of evidence are useful for the developer to use other tracing methods to figure out how to debug and optimize the system.
It is worth mentioning that the duration values reported by the osnoise: events are net values. For example, the thread_noise does not include the duration of the overhead caused by the IRQ execution (which indeed accounted for 12736 ns). But the values reported by the timerlat tracer (timerlat_latency) are gross values.
The art below illustrates a CPU timeline and how the timerlat tracer observes it at the top and the osnoise: events at the bottom. Each "-" in the timelines means circa 1 us, and the time moves ==>:
External timer irq thread
clock latency latency
event 13585 ns 39960 ns
| ^ ^
v | |
|-------------| |
|-------------+-------------------------|
^ ^
========================================================================
[tmr irq] [dev irq]
[another thread...^ v..^ v.......][timerlat/ thread] <-- CPU timeline
=========================================================================
|-------| |-------|
|--^ v-------|
| | |
| | + thread_noise: 9909 ns
| +-> irq_noise: 6139 ns
+-> irq_noise: 7597 ns
IRQ stacktrace #
The osnoise/print_stack option is helpful for the cases in which a thread noise causes the major factor for the timer latency, because of preempt or irq disabled. For example:
[root@f32 tracing]# echo 500 > osnoise/stop_tracing_total_us
[root@f32 tracing]# echo 500 > osnoise/print_stack
[root@f32 tracing]# echo timerlat > current_tracer
[root@f32 tracing]# tail -21 per_cpu/cpu7/trace
insmod-1026 [007] dN.h1.. 200.201948: irq_noise: local_timer:236 start 200.201939376 duration 7872 ns
insmod-1026 [007] d..h1.. 200.202587: #29800 context irq timer_latency 1616 ns
insmod-1026 [007] dN.h2.. 200.202598: irq_noise: local_timer:236 start 200.202586162 duration 11855 ns
insmod-1026 [007] dN.h3.. 200.202947: irq_noise: local_timer:236 start 200.202939174 duration 7318 ns
insmod-1026 [007] d...3.. 200.203444: thread_noise: insmod:1026 start 200.202586933 duration 838681 ns
timerlat/7-1001 [007] ....... 200.203445: #29800 context thread timer_latency 859978 ns
timerlat/7-1001 [007] ....1.. 200.203446: <stack trace>
=> timerlat_irq
=> __hrtimer_run_queues
=> hrtimer_interrupt
=> __sysvec_apic_timer_interrupt
=> asm_call_irq_on_stack
=> sysvec_apic_timer_interrupt
=> asm_sysvec_apic_timer_interrupt
=> delay_tsc
=> dummy_load_1ms_pd_init
=> do_one_initcall
=> do_init_module
=> __do_sys_finit_module
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
In this case, it is possible to see that the thread added the highest contribution to the timer latency and the stack trace, saved during the timerlat IRQ handler, points to a function named dummy_load_1ms_pd_init, which had the following code (on purpose):
static int __init dummy_load_1ms_pd_init(void)
{
preempt_disable();
mdelay(1);
preempt_enable();
return 0;
}
User-space interface #
Timerlat allows user-space threads to use timerlat infra-structure to measure scheduling latency. This interface is accessible via a per-CPU file descriptor inside $tracing_dir/osnoise/per_cpu/cpu$ID/timerlat_fd.
This interface is accessible under the following conditions:
timerlat tracer is enable
osnoise workload option is set to NO_OSNOISE_WORKLOAD
The user-space thread is affined to a single processor
The thread opens the file associated with its single processor
Only one thread can access the file at a time
The open() syscall will fail if any of these conditions are not met. After opening the file descriptor, the user space can read from it.
The read() system call will run a timerlat code that will arm the timer in the future and wait for it as the regular kernel thread does.
When the timer IRQ fires, the timerlat IRQ will execute, report the IRQ latency and wake up the thread waiting in the read. The thread will be scheduled and report the thread latency via tracer - as for the kernel thread.
The difference from the in-kernel timerlat is that, instead of re-arming the timer, timerlat will return to the read() system call. At this point, the user can run any code.
If the application rereads the file timerlat file descriptor, the tracer will report the return from user-space latency, which is the total latency. If this is the end of the work, it can be interpreted as the response time for the request.
After reporting the total latency, timerlat will restart the cycle, arm a timer, and go to sleep for the following activation.
If at any time one of the conditions is broken, e.g., the thread migrates while in user space, or the timerlat tracer is disabled, the SIG_KILL signal will be sent to the user-space thread.
Here is an basic example of user-space code for timerlat:
int main(void)
{
char buffer[1024];
int timerlat_fd;
int retval;
long cpu = 0; /* place in CPU 0 */
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(cpu, &set);
if (sched_setaffinity(gettid(), sizeof(set), &set) == -1)
return 1;
snprintf(buffer, sizeof(buffer),
"/sys/kernel/tracing/osnoise/per_cpu/cpu%ld/timerlat_fd",
cpu);
timerlat_fd = open(buffer, O_RDONLY);
if (timerlat_fd < 0) {
printf("error opening %s: %s\n", buffer, strerror(errno));
exit(1);
}
for (;;) {
retval = read(timerlat_fd, buffer, 1024);
if (retval < 0)
break;
}
close(timerlat_fd);
exit(0);
}
Notes on Analysing Behaviour Using Events and Tracepoints
Peios Kernel / Kernel development / Trace
Peios: Linux capability names in this interface retain their API meaning, but KACS evaluates them through native token privileges or compatibility rules. UID 0,
setcapand Unix mode bits do not independently grant native authority. Object access and PIP checks remain additional constraints where applicable. See Peios kernel behaviour for the mapping and exceptions.
Author: Mel Gorman (PCL information heavily based on email from Ingo Molnar)
1. Introduction #
Tracepoints (see Documentation/trace/tracepoints.rst) can be used without creating custom kernel modules to register probe functions using the event tracing infrastructure.
Simplistically, tracepoints represent important events that can be taken in conjunction with other tracepoints to build a "Big Picture" of what is going on within the system. There are a large number of methods for gathering and interpreting these events. Lacking any current Best Practises, this document describes some of the methods that can be used.
This document assumes that debugfs is mounted on /sys/kernel/debug and that the appropriate tracing options have been configured into the kernel. It is assumed that the PCL tool tools/perf has been installed and is in your path.
2. Listing Available Events #
2.1 Standard Utilities #
All possible events are visible from /sys/kernel/tracing/events. Simply calling:
$ find /sys/kernel/tracing/events -type d
will give a fair indication of the number of events available.
2.2 PCL (Performance Counters for Linux) #
Discovery and enumeration of all counters and events, including tracepoints, are available with the perf tool. Getting a list of available events is a simple case of:
$ perf list 2>&1 | grep Tracepoint
ext4:ext4_free_inode [Tracepoint event]
ext4:ext4_request_inode [Tracepoint event]
ext4:ext4_allocate_inode [Tracepoint event]
ext4:ext4_write_begin [Tracepoint event]
ext4:ext4_ordered_write_end [Tracepoint event]
[ .... remaining output snipped .... ]
3. Enabling Events #
3.1 System-Wide Event Enabling #
See Documentation/trace/events.rst for a proper description on how events can be enabled system-wide. A short example of enabling all events related to page allocation would look something like:
$ for i in `find /sys/kernel/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done
3.2 System-Wide Event Enabling with SystemTap #
In SystemTap, tracepoints are accessible using the kernel.trace() function call. The following is an example that reports every 5 seconds what processes were allocating the pages.
global page_allocs
probe kernel.trace("mm_page_alloc") {
page_allocs[execname()]++
}
function print_count() {
printf ("%-25s %-s\n", "#Pages Allocated", "Process Name")
foreach (proc in page_allocs-)
printf("%-25d %s\n", page_allocs[proc], proc)
printf ("\n")
delete page_allocs
}
probe timer.s(5) {
print_count()
}
3.3 System-Wide Event Enabling with PCL #
By specifying the -a switch and analysing sleep, the system-wide events for a duration of time can be examined.
$ perf stat -a \
-e kmem:mm_page_alloc -e kmem:mm_page_free \
-e kmem:mm_page_free_batched \
sleep 10
Performance counter stats for 'sleep 10':
9630 kmem:mm_page_alloc
2143 kmem:mm_page_free
7424 kmem:mm_page_free_batched
10.002577764 seconds time elapsed
Similarly, one could execute a shell and exit it as desired to get a report at that point.
3.4 Local Event Enabling #
Documentation/trace/ftrace.rst describes how to enable events on a per-thread basis using set_ftrace_pid.
3.5 Local Event Enablement with PCL #
Events can be activated and tracked for the duration of a process on a local basis using PCL such as follows.
$ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free \
-e kmem:mm_page_free_batched ./hackbench 10
Time: 0.909
Performance counter stats for './hackbench 10':
17803 kmem:mm_page_alloc
12398 kmem:mm_page_free
4827 kmem:mm_page_free_batched
0.973913387 seconds time elapsed
4. Event Filtering #
Documentation/trace/ftrace.rst covers in-depth how to filter events in ftrace. Obviously using grep and awk of trace_pipe is an option as well as any script reading trace_pipe.
5. Analysing Event Variances with PCL #
Any workload can exhibit variances between runs and it can be important to know what the standard deviation is. By and large, this is left to the performance analyst to do it by hand. In the event that the discrete event occurrences are useful to the performance analyst, then perf can be used.
$ perf stat --repeat 5 -e kmem:mm_page_alloc -e kmem:mm_page_free
-e kmem:mm_page_free_batched ./hackbench 10
Time: 0.890
Time: 0.895
Time: 0.915
Time: 1.001
Time: 0.899
Performance counter stats for './hackbench 10' (5 runs):
16630 kmem:mm_page_alloc ( +- 3.542% )
11486 kmem:mm_page_free ( +- 4.771% )
4730 kmem:mm_page_free_batched ( +- 2.325% )
0.982653002 seconds time elapsed ( +- 1.448% )
In the event that some higher-level event is required that depends on some aggregation of discrete events, then a script would need to be developed.
Using --repeat, it is also possible to view how events are fluctuating over time on a system-wide basis using -a and sleep.
$ perf stat -e kmem:mm_page_alloc -e kmem:mm_page_free \
-e kmem:mm_page_free_batched \
-a --repeat 10 \
sleep 1
Performance counter stats for 'sleep 1' (10 runs):
1066 kmem:mm_page_alloc ( +- 26.148% )
182 kmem:mm_page_free ( +- 5.464% )
890 kmem:mm_page_free_batched ( +- 30.079% )
1.002251757 seconds time elapsed ( +- 0.005% )
6. Higher-Level Analysis with Helper Scripts #
When events are enabled the events that are triggering can be read from /sys/kernel/tracing/trace_pipe in human-readable format although binary options exist as well. By post-processing the output, further information can be gathered on-line as appropriate. Examples of post-processing might include
Reading information from /proc for the PID that triggered the event
Deriving a higher-level event from a series of lower-level events.
Calculating latencies between two events
Documentation/trace/postprocess/trace-pagealloc-postprocess.pl is an example script that can read trace_pipe from STDIN or a copy of a trace. When used on-line, it can be interrupted once to generate a report without exiting and twice to exit.
Simplistically, the script just reads STDIN and counts up events but it also can do more such as
Derive high-level events from many low-level events. If a number of pages are freed to the main allocator from the per-CPU lists, it recognises that as one per-CPU drain even though there is no specific tracepoint for that event
It can aggregate based on PID or individual process number
In the event memory is getting externally fragmented, it reports on whether the fragmentation event was severe or moderate.
When receiving an event about a PID, it can record who the parent was so that if large numbers of events are coming from very short-lived processes, the parent process responsible for creating all the helpers can be identified
7. Lower-Level Analysis with PCL #
There may also be a requirement to identify what functions within a program were generating events within the kernel. To begin this sort of analysis, the data must be recorded. At the time of writing, this required root:
$ perf record -c 1 \
-e kmem:mm_page_alloc -e kmem:mm_page_free \
-e kmem:mm_page_free_batched \
./hackbench 10
Time: 0.894
[ perf record: Captured and wrote 0.733 MB perf.data (~32010 samples) ]
Note the use of '-c 1' to set the event period to sample. The default sample period is quite high to minimise overhead but the information collected can be very coarse as a result.
This record outputted a file called perf.data which can be analysed using perf report.
$ perf report
# Samples: 30922
#
# Overhead Command Shared Object
# ........ ......... ................................
#
87.27% hackbench [vdso]
6.85% hackbench /lib/i686/cmov/libc-2.9.so
2.62% hackbench /lib/ld-2.9.so
1.52% perf [vdso]
1.22% hackbench ./hackbench
0.48% hackbench [kernel]
0.02% perf /lib/i686/cmov/libc-2.9.so
0.01% perf /usr/bin/perf
0.01% perf /lib/ld-2.9.so
0.00% hackbench /lib/i686/cmov/libpthread-2.9.so
#
# (For more details, try: perf report --sort comm,dso,symbol)
#
According to this, the vast majority of events triggered on events within the VDSO. With simple binaries, this will often be the case so let's take a slightly different example. In the course of writing this, it was noticed that X was generating an insane amount of page allocations so let's look at it:
$ perf record -c 1 -f \
-e kmem:mm_page_alloc -e kmem:mm_page_free \
-e kmem:mm_page_free_batched \
-p `pidof X`
This was interrupted after a few seconds and
$ perf report
# Samples: 27666
#
# Overhead Command Shared Object
# ........ ....... .......................................
#
51.95% Xorg [vdso]
47.95% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1
0.09% Xorg /lib/i686/cmov/libc-2.9.so
0.01% Xorg [kernel]
#
# (For more details, try: perf report --sort comm,dso,symbol)
#
So, almost half of the events are occurring in a library. To get an idea which symbol:
$ perf report --sort comm,dso,symbol
# Samples: 27666
#
# Overhead Command Shared Object Symbol
# ........ ....... ....................................... ......
#
51.95% Xorg [vdso] [.] 0x000000ffffe424
47.93% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] pixmanFillsse2
0.09% Xorg /lib/i686/cmov/libc-2.9.so [.] _int_malloc
0.01% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] pixman_region32_copy_f
0.01% Xorg [kernel] [k] read_hpet
0.01% Xorg /opt/gfx-test/lib/libpixman-1.so.0.13.1 [.] get_fast_path
0.00% Xorg [kernel] [k] ftrace_trace_userstack
To see where within the function pixmanFillsse2 things are going wrong:
$ perf annotate pixmanFillsse2
[ ... ]
0.00 : 34eeb: 0f 18 08 prefetcht0 (%eax)
: }
:
: extern __inline void __attribute__((__gnu_inline__, __always_inline__, _
: _mm_store_si128 (__m128i *__P, __m128i __B) : {
: *__P = __B;
12.40 : 34eee: 66 0f 7f 80 40 ff ff movdqa %xmm0,-0xc0(%eax)
0.00 : 34ef5: ff
12.40 : 34ef6: 66 0f 7f 80 50 ff ff movdqa %xmm0,-0xb0(%eax)
0.00 : 34efd: ff
12.39 : 34efe: 66 0f 7f 80 60 ff ff movdqa %xmm0,-0xa0(%eax)
0.00 : 34f05: ff
12.67 : 34f06: 66 0f 7f 80 70 ff ff movdqa %xmm0,-0x90(%eax)
0.00 : 34f0d: ff
12.58 : 34f0e: 66 0f 7f 40 80 movdqa %xmm0,-0x80(%eax)
12.31 : 34f13: 66 0f 7f 40 90 movdqa %xmm0,-0x70(%eax)
12.40 : 34f18: 66 0f 7f 40 a0 movdqa %xmm0,-0x60(%eax)
12.31 : 34f1d: 66 0f 7f 40 b0 movdqa %xmm0,-0x50(%eax)
At a glance, it looks like the time is being spent copying pixmaps to the card. Further investigation would be needed to determine why pixmaps are being copied around so much but a starting point would be to take an ancient build of libpixmap out of the library path where it was totally forgotten about from months ago!
Using the Linux Kernel Tracepoints
Peios Kernel / Kernel development / Trace
Author: Mathieu Desnoyers
This document introduces Linux Kernel Tracepoints and their use. It provides examples of how to insert tracepoints in the kernel and connect probe functions to them and provides some examples of probe functions.
Purpose of tracepoints #
A tracepoint placed in code provides a hook to call a function (probe) that you can provide at runtime. A tracepoint can be "on" (a probe is connected to it) or "off" (no probe is attached). When a tracepoint is "off" it has no effect, except for adding a tiny time penalty (checking a condition for a branch) and space penalty (adding a few bytes for the function call at the end of the instrumented function and adds a data structure in a separate section). When a tracepoint is "on", the function you provide is called each time the tracepoint is executed, in the execution context of the caller. When the function provided ends its execution, it returns to the caller (continuing from the tracepoint site).
You can put tracepoints at important locations in the code. They are lightweight hooks that can pass an arbitrary number of parameters, whose prototypes are described in a tracepoint declaration placed in a header file.
They can be used for tracing and performance accounting.
Usage #
Two elements are required for tracepoints :
-
A tracepoint definition, placed in a header file.
-
The tracepoint statement, in C code.
In order to use tracepoints, you should include linux/tracepoint.h.
In include/trace/events/subsys.h:
#undef TRACE_SYSTEM
#define TRACE_SYSTEM subsys
#if !defined(_TRACE_SUBSYS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SUBSYS_H
#include <linux/tracepoint.h>
DECLARE_TRACE(subsys_eventname,
TP_PROTO(int firstarg, struct task_struct *p),
TP_ARGS(firstarg, p));
#endif /* _TRACE_SUBSYS_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
In subsys/file.c (where the tracing statement must be added):
#include <trace/events/subsys.h>
#define CREATE_TRACE_POINTS
DEFINE_TRACE(subsys_eventname);
void somefct(void)
{
...
trace_subsys_eventname_tp(arg, task);
...
}
-
Where :
-
subsys_eventname is an identifier unique to your event
-
subsys is the name of your subsystem.
-
eventname is the name of the event to trace.
-
-
TP_PROTO(int firstarg, struct task_struct *p)is the prototype of the function called by this tracepoint. -
TP_ARGS(firstarg, p)are the parameters names, same as found in the prototype. -
if you use the header in multiple source files,
#define CREATE_TRACE_POINTSshould appear only in one source file.
-
Connecting a function (probe) to a tracepoint is done by providing a probe (function to call) for the specific tracepoint through register_trace_subsys_eventname(). Removing a probe is done through unregister_trace_subsys_eventname(); it will remove the probe.
tracepoint_synchronize_unregister() must be called before the end of the module exit function to make sure there is no caller left using the probe. This, and the fact that preemption is disabled around the probe call, make sure that probe removal and module unload are safe.
The tracepoint mechanism supports inserting multiple instances of the same tracepoint, but a single definition must be made of a given tracepoint name over all the kernel to make sure no type conflict will occur. Name mangling of the tracepoints is done using the prototypes to make sure typing is correct. Verification of probe type correctness is done at the registration site by the compiler. Tracepoints can be put in inline functions, inlined static functions, and unrolled loops as well as regular functions.
The naming scheme "subsys_event" is suggested here as a convention intended to limit collisions. Tracepoint names are global to the kernel: they are considered as being the same whether they are in the core kernel image or in modules.
If the tracepoint has to be used in kernel modules, an EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be used to export the defined tracepoints.
If you need to do a bit of work for a tracepoint parameter, and that work is only used for the tracepoint, that work can be encapsulated within an if statement with the following:
if (trace_foo_bar_enabled()) {
int i;
int tot = 0;
for (i = 0; i < count; i++)
tot += calculate_nuggets();
trace_foo_bar_tp(tot);
}
All trace_<tracepoint>_tp() calls have a matching trace_<tracepoint>_enabled() function defined that returns true if the tracepoint is enabled and false otherwise. The trace_<tracepoint>_tp() should always be within the block of the if (trace_<tracepoint>_enabled()) to prevent races between the tracepoint being enabled and the check being seen.
The advantage of using the trace_<tracepoint>_enabled() is that it uses the static_key of the tracepoint to allow the if statement to be implemented with jump labels and avoid conditional branches.
If you require calling a tracepoint from a header file, it is not recommended to call one directly or to use the trace_<tracepoint>_enabled() function call, as tracepoints in header files can have side effects if a header is included from a file that has CREATE_TRACE_POINTS set, as well as the trace_<tracepoint>() is not that small of an inline and can bloat the kernel if used by other inlined functions. Instead, include tracepoint-defs.h and use tracepoint_enabled().
In a C file:
void do_trace_foo_bar_wrapper(args)
{
trace_foo_bar_tp(args); // for tracepoints created via DECLARE_TRACE
// or
trace_foo_bar(args); // for tracepoints created via TRACE_EVENT
}
In the header file:
DECLARE_TRACEPOINT(foo_bar);
static inline void some_inline_function()
{
[..]
if (tracepoint_enabled(foo_bar))
do_trace_foo_bar_wrapper(args);
[..]
}
Uprobe-tracer: Uprobe-based Event Tracing
Peios Kernel / Kernel development / Trace
Author: Srikar Dronamraju
Overview #
Uprobe based trace events are similar to kprobe based trace events. To enable this feature, build your kernel with CONFIG_UPROBE_EVENTS=y.
Similar to the kprobe-event tracer, this doesn't need to be activated via current_tracer. Instead of that, add probe points via /sys/kernel/tracing/uprobe_events, and enable it via /sys/kernel/tracing/events/uprobes/<EVENT>/enable.
However unlike kprobe-event tracer, the uprobe event interface expects the user to calculate the offset of the probepoint in the object.
You can also use /sys/kernel/tracing/dynamic_events instead of uprobe_events. That interface will provide unified access to other dynamic events too.
Synopsis of uprobe_tracer #
p[:[GRP/][EVENT]] PATH:OFFSET [FETCHARGS] : Set a uprobe
r[:[GRP/][EVENT]] PATH:OFFSET [FETCHARGS] : Set a return uprobe (uretprobe)
p[:[GRP/][EVENT]] PATH:OFFSET%return [FETCHARGS] : Set a return uprobe (uretprobe)
-:[GRP/][EVENT] : Clear uprobe or uretprobe event
GRP : Group name. If omitted, "uprobes" is the default value.
EVENT : Event name. If omitted, the event name is generated based
on PATH+OFFSET.
PATH : Path to an executable or a library.
OFFSET : Offset where the probe is inserted.
OFFSET%return : Offset where the return probe is inserted.
FETCHARGS : Arguments. Each probe can have up to 128 args.
%REG : Fetch register REG
@ADDR : Fetch memory at ADDR (ADDR should be in userspace)
@+OFFSET : Fetch memory at OFFSET (OFFSET from same file as PATH)
$stackN : Fetch Nth entry of stack (N >= 0)
$stack : Fetch stack address.
$retval : Fetch return value.(\*1)
$comm : Fetch current task comm.
+|-[u]OFFS(FETCHARG) : Fetch memory at FETCHARG +|- OFFS address.(\*2)(\*3)
\IMM : Store an immediate value to the argument.
NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
(u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types
(x8/x16/x32/x64), "string" and bitfield are supported.
(\*1) only for return probe.
(\*2) this is useful for fetching a field of data structures.
(\*3) Unlike kprobe event, "u" prefix will just be ignored, because uprobe
events can access only user-space memory.
Types #
Several types are supported for fetch-args. Uprobe tracer will access memory by given type. Prefix 's' and 'u' means those types are signed and unsigned respectively. 'x' prefix implies it is unsigned. Traced arguments are shown in decimal ('s' and 'u') or hexadecimal ('x'). Without type casting, 'x32' or 'x64' is used depends on the architecture (e.g. x86-32 uses x32, and x86-64 uses x64). String type is a special type, which fetches a "null-terminated" string from user space. Bitfield is another special type, which takes 3 parameters, bit-width, bit- offset, and container-size (usually 32). The syntax is:
b<bit-width>@<bit-offset>/<container-size>
For $comm, the default type is "string"; any other type is invalid.
Event Profiling #
You can check the total number of probe hits per event via /sys/kernel/tracing/uprobe_profile. The first column is the filename, the second is the event name, the third is the number of probe hits.
Usage examples #
Add a probe as a new uprobe event, write a new definition to uprobe_events as below (sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash):
echo 'p /bin/bash:0x4245c0' > /sys/kernel/tracing/uprobe_eventsAdd a probe as a new uretprobe event:
echo 'r /bin/bash:0x4245c0' > /sys/kernel/tracing/uprobe_eventsUnset registered event:
echo '-:p_bash_0x4245c0' >> /sys/kernel/tracing/uprobe_eventsPrint out the events that are registered:
cat /sys/kernel/tracing/uprobe_eventsClear all events:
echo > /sys/kernel/tracing/uprobe_events
Following example shows how to dump the instruction pointer and %ax register at the probed text address. Probe zfree function in /bin/zsh:
# cd /sys/kernel/tracing/
# cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp
00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh
# objdump -T /bin/zsh | grep -w zfree
0000000000446420 g DF .text 0000000000000012 Base zfree
0x46420 is the offset of zfree in object /bin/zsh that is loaded at 0x00400000. Hence the command to uprobe would be:
# echo 'p:zfree_entry /bin/zsh:0x46420 %ip %ax' > uprobe_events
And the same for the uretprobe would be:
# echo 'r:zfree_exit /bin/zsh:0x46420 %ip %ax' >> uprobe_events
We can see the events that are registered by looking at the uprobe_events file.
# cat uprobe_events
p:uprobes/zfree_entry /bin/zsh:0x00046420 arg1=%ip arg2=%ax
r:uprobes/zfree_exit /bin/zsh:0x00046420 arg1=%ip arg2=%ax
Format of events can be seen by viewing the file events/uprobes/zfree_entry/format.
# cat events/uprobes/zfree_entry/format
name: zfree_entry
ID: 922
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:int common_padding; offset:8; size:4; signed:1;
field:unsigned long __probe_ip; offset:12; size:4; signed:0;
field:u32 arg1; offset:16; size:4; signed:0;
field:u32 arg2; offset:20; size:4; signed:0;
print fmt: "(%lx) arg1=%lx arg2=%lx", REC->__probe_ip, REC->arg1, REC->arg2
Right after definition, each event is disabled by default. For tracing these events, you need to enable it by:
# echo 1 > events/uprobes/enable
Lets start tracing, sleep for some time and stop tracing.
# echo 1 > tracing_on
# sleep 20
# echo 0 > tracing_on
Also, you can disable the event by:
# echo 0 > events/uprobes/enable
And you can see the traced information via /sys/kernel/tracing/trace.
# cat trace
# tracer: nop
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
zsh-24842 [006] 258544.995456: zfree_entry: (0x446420) arg1=446420 arg2=79
zsh-24842 [007] 258545.000270: zfree_exit: (0x446540 <- 0x446420) arg1=446540 arg2=0
zsh-24842 [002] 258545.043929: zfree_entry: (0x446420) arg1=446420 arg2=79
zsh-24842 [004] 258547.046129: zfree_exit: (0x446540 <- 0x446420) arg1=446540 arg2=0
Output shows us uprobe was triggered for a pid 24842 with ip being 0x446420 and contents of ax register being 79. And uretprobe was triggered with ip at 0x446540 with counterpart function entry at 0x446420.
user_events: User-based Event Tracing
Peios Kernel / Kernel development / Trace
Peios: Linux capability names in this interface retain their API meaning, but KACS evaluates them through native token privileges or compatibility rules. UID 0,
setcapand Unix mode bits do not independently grant native authority. Object access and PIP checks remain additional constraints where applicable. See Peios kernel behaviour for the mapping and exceptions.
Author: Beau Belgrave
Overview #
User based trace events allow user processes to create events and trace data that can be viewed via existing tools, such as ftrace and perf. To enable this feature, build your kernel with CONFIG_USER_EVENTS=y.
Programs can view status of the events via /sys/kernel/tracing/user_events_status and can both register and write data out via /sys/kernel/tracing/user_events_data.
Programs can also use /sys/kernel/tracing/dynamic_events to register and delete user based events via the u: prefix. The format of the command to dynamic_events is the same as the ioctl with the u: prefix applied. This requires CAP_PERFMON due to the event persisting, otherwise -EPERM is returned.
Typically programs will register a set of events that they wish to expose to tools that can read trace_events (such as ftrace and perf). The registration process tells the kernel which address and bit to reflect if any tool has enabled the event and data should be written. The registration will give back a write index which describes the data when a write() or writev() is called on the /sys/kernel/tracing/user_events_data file.
The structures referenced in this document are contained within the /include/uapi/linux/user_events.h file in the source tree.
NOTE: Both user_events_status and user_events_data are under the tracefs filesystem and may be mounted at different paths than above.
Registering #
Registering within a user process is done via ioctl() out to the /sys/kernel/tracing/user_events_data file. The command to issue is DIAG_IOCSREG.
This command takes a packed struct user_reg as an argument:
struct user_reg {
/* Input: Size of the user_reg structure being used */
__u32 size;
/* Input: Bit in enable address to use */
__u8 enable_bit;
/* Input: Enable size in bytes at address */
__u8 enable_size;
/* Input: Flags to use, if any */
__u16 flags;
/* Input: Address to update when enabled */
__u64 enable_addr;
/* Input: Pointer to string with event name, description and flags */
__u64 name_args;
/* Output: Index of the event to use when writing data */
__u32 write_index;
} __attribute__((__packed__));
The struct user_reg requires all the above inputs to be set appropriately.
-
size: This must be set to sizeof(struct user_reg).
-
enable_bit: The bit to reflect the event status at the address specified by enable_addr.
-
enable_size: The size of the value specified by enable_addr. This must be 4 (32-bit) or 8 (64-bit). 64-bit values are only allowed to be used on 64-bit kernels, however, 32-bit can be used on all kernels.
-
flags: The flags to use, if any. Callers should first attempt to use flags and retry without flags to ensure support for lower versions of the kernel. If a flag is not supported -EINVAL is returned.
-
enable_addr: The address of the value to use to reflect event status. This must be naturally aligned and write accessible within the user program.
-
name_args: The name and arguments to describe the event, see command format for details.
The following flags are currently supported.
-
USER_EVENT_REG_PERSIST: The event will not delete upon the last reference closing. Callers may use this if an event should exist even after the process closes or unregisters the event. Requires CAP_PERFMON otherwise -EPERM is returned.
-
USER_EVENT_REG_MULTI_FORMAT: The event can contain multiple formats. This allows programs to prevent themselves from being blocked when their event format changes and they wish to use the same name. When this flag is used the tracepoint name will be in the new format of "name.unique_id" vs the older format of "name". A tracepoint will be created for each unique pair of name and format. This means if several processes use the same name and format, they will use the same tracepoint. If yet another process uses the same name, but a different format than the other processes, it will use a different tracepoint with a new unique id. Recording programs need to scan tracefs for the various different formats of the event name they are interested in recording. The system name of the tracepoint will also use "user_events_multi" instead of "user_events". This prevents single-format event names conflicting with any multi-format event names within tracefs. The unique_id is output as a hex string. Recording programs should ensure the tracepoint name starts with the event name they registered and has a suffix that starts with . and only has hex characters. For example to find all versions of the event "test" you can use the regex "^test.[0-9a-fA-F]+$".
Upon successful registration the following is set.
- write_index: The index to use for this file descriptor that represents this event when writing out data. The index is unique to this instance of the file descriptor that was used for the registration. See writing data for details.
User based events show up under tracefs like any other event under the subsystem named "user_events". This means tools that wish to attach to the events need to use /sys/kernel/tracing/events/user_events/[name]/enable or perf record -e user_events:[name] when attaching/recording.
NOTE: The event subsystem name by default is "user_events". Callers should not assume it will always be "user_events". Operators reserve the right in the future to change the subsystem name per-process to accommodate event isolation. In addition if the USER_EVENT_REG_MULTI_FORMAT flag is used the tracepoint name will have a unique id appended to it and the system name will be "user_events_multi" as described above.
Command Format #
The command string format is as follows:
name[:FLAG1[,FLAG2...]] [Field1[;Field2...]]
Supported Flags #
None yet
Field Format #
type name [size]
Basic types are supported (__data_loc, u32, u64, int, char, char[20], etc). User programs are encouraged to use clearly sized types like u32.
NOTE: Long is not supported since size can vary between user and kernel.
The size is only valid for types that start with a struct prefix. This allows user programs to describe custom structs out to tools, if required.
For example, a struct in C that looks like this:
struct mytype {
char data[20];
};
Would be represented by the following field:
struct mytype myname 20
Deleting #
Deleting an event from within a user process is done via ioctl() out to the /sys/kernel/tracing/user_events_data file. The command to issue is DIAG_IOCSDEL.
This command only requires a single string specifying the event to delete by its name. Delete will only succeed if there are no references left to the event (in both user and kernel space). User programs should use a separate file to request deletes than the one used for registration due to this.
NOTE: By default events will auto-delete when there are no references left to the event. If programs do not want auto-delete, they must use the USER_EVENT_REG_PERSIST flag when registering the event. Once that flag is used the event exists until DIAG_IOCSDEL is invoked. Both register and delete of an event that persists requires CAP_PERFMON, otherwise -EPERM is returned. When there are multiple formats of the same event name, all events with the same name will be attempted to be deleted. If only a specific version is wanted to be deleted then the /sys/kernel/tracing/dynamic_events file should be used for that specific format of the event.
Unregistering #
If after registering an event it is no longer wanted to be updated then it can be disabled via ioctl() out to the /sys/kernel/tracing/user_events_data file. The command to issue is DIAG_IOCSUNREG. This is different than deleting, where deleting actually removes the event from the system. Unregistering simply tells the kernel your process is no longer interested in updates to the event.
This command takes a packed struct user_unreg as an argument:
struct user_unreg {
/* Input: Size of the user_unreg structure being used */
__u32 size;
/* Input: Bit to unregister */
__u8 disable_bit;
/* Input: Reserved, set to 0 */
__u8 __reserved;
/* Input: Reserved, set to 0 */
__u16 __reserved2;
/* Input: Address to unregister */
__u64 disable_addr;
} __attribute__((__packed__));
The struct user_unreg requires all the above inputs to be set appropriately.
-
size: This must be set to sizeof(struct user_unreg).
-
disable_bit: This must be set to the bit to disable (same bit that was previously registered via enable_bit).
-
disable_addr: This must be set to the address to disable (same address that was previously registered via enable_addr).
NOTE: Events are automatically unregistered when execve() is invoked. During fork() the registered events will be retained and must be unregistered manually in each process if wanted.
Status #
When tools attach/record user based events the status of the event is updated in realtime. This allows user programs to only incur the cost of the write() or writev() calls when something is actively attached to the event.
The kernel will update the specified bit that was registered for the event as tools attach/detach from the event. User programs simply check if the bit is set to see if something is attached or not.
Administrators can easily check the status of all registered events by reading the user_events_status file directly via a terminal. The output is as follows:
Name [# Comments]
...
Active: ActiveCount
Busy: BusyCount
For example, on a system that has a single event the output looks like this:
test
Active: 1
Busy: 0
If a user enables the user event via ftrace, the output would change to this:
test # Used by ftrace
Active: 1
Busy: 1
Writing Data #
After registering an event the same fd that was used to register can be used to write an entry for that event. The write_index returned must be at the start of the data, then the remaining data is treated as the payload of the event.
For example, if write_index returned was 1 and I wanted to write out an int payload of the event. Then the data would have to be 8 bytes (2 ints) in size, with the first 4 bytes being equal to 1 and the last 4 bytes being equal to the value I want as the payload.
In memory this would look like this:
int index;
int payload;
User programs might have well known structs that they wish to use to emit out as payloads. In those cases writev() can be used, with the first vector being the index and the following vector(s) being the actual event payload.
For example, if I have a struct like this:
struct payload {
int src;
int dst;
int flags;
} __attribute__((__packed__));
It's advised for user programs to do the following:
struct iovec io[2];
struct payload e;
io[0].iov_base = &write_index;
io[0].iov_len = sizeof(write_index);
io[1].iov_base = &e;
io[1].iov_len = sizeof(e);
writev(fd, (const struct iovec*)io, 2);
NOTE: The write_index is not emitted out into the trace being recorded.
Example Code #
See sample code in samples/user_events.
CoreSight - ARM Hardware Trace
Peios Kernel / Kernel development / Trace / coresight
- CoreSight System Configuration Manager
- Coresight CPU Debug Module
- Coresight Dummy Trace Module
- CoreSight Embedded Cross Trigger (CTI & CTM).
- ETMv4 sysfs linux driver programming reference.
- CoreSight - Perf
- The trace performance monitoring and diagnostics aggregator(TPDA)
- Trace performance monitoring and diagnostics monitor(TPDM)
- Trace Buffer Extension (TRBE).
- Coresight - HW Assisted Tracing on ARM
- CoreSight - ARM Hardware Trace
- Using Coresight for Kernel panic and Watchdog reset
- UltraSoc - HW Assisted Tracing on SoC
CoreSight System Configuration Manager
Peios Kernel / Kernel development / Trace / coresight
Author: Mike Leach <mike.leach@linaro.org>
Date: October 2020
Introduction #
The CoreSight System Configuration manager is an API that allows the programming of the CoreSight system with pre-defined configurations that can then be easily enabled from sysfs or perf.
Many CoreSight components can be programmed in complex ways - especially ETMs. In addition, components can interact across the CoreSight system, often via the cross trigger components such as CTI and CTM. These system settings can be defined and enabled as named configurations.
Basic Concepts #
This section introduces the basic concepts of a CoreSight system configuration.
Features #
A feature is a named set of programming for a CoreSight device. The programming is device dependent, and can be defined in terms of absolute register values, resource usage and parameter values.
The feature is defined using a descriptor. This descriptor is used to load onto a matching device, either when the feature is loaded into the system, or when the CoreSight device is registered with the configuration manager.
The load process involves interpreting the descriptor into a set of register accesses in the driver - the resource usage and parameter descriptions translated into appropriate register accesses. This interpretation makes it easy and efficient for the feature to be programmed onto the device when required.
The feature will not be active on the device until the feature is enabled, and the device itself is enabled. When the device is enabled then enabled features will be programmed into the device hardware.
A feature is enabled as part of a configuration being enabled on the system.
Parameter Value #
A parameter value is a named value that may be set by the user prior to the feature being enabled that can adjust the behaviour of the operation programmed by the feature.
For example, this could be a count value in a programmed operation that repeats at a given rate. When the feature is enabled then the current value of the parameter is used in programming the device.
The feature descriptor defines a default value for a parameter, which is used if the user does not supply a new value.
Users can update parameter values using the configfs API for the CoreSight system - which is described below.
The current value of the parameter is loaded into the device when the feature is enabled on that device.
Configurations #
A configuration defines a set of features that are to be used in a trace session where the configuration is selected. For any trace session only one configuration may be selected.
The features defined may be on any type of device that is registered to support system configuration. A configuration may select features to be enabled on a class of devices - i.e. any ETMv4, or specific devices, e.g. a specific CTI on the system.
As with the feature, a descriptor is used to define the configuration. This will define the features that must be enabled as part of the configuration as well as any preset values that can be used to override default parameter values.
Preset Values #
Preset values are easily selectable sets of parameter values for the features that the configuration uses. The number of values in a single preset set, equals the sum of parameter values in the features used by the configuration.
e.g. a configuration consists of 3 features, one has 2 parameters, one has a single parameter, and another has no parameters. A single preset set will therefore have 3 values.
Presets are optionally defined by the configuration, up to 15 can be defined. If no preset is selected, then the parameter values defined in the feature are used as normal.
Operation #
The following steps take place in the operation of a configuration.
-
In this example, the configuration is 'autofdo', which has an associated feature 'strobing' that works on ETMv4 CoreSight Devices.
-
The configuration is enabled. For example 'perf' may select the configuration as part of its command line:
perf record -e cs_etm/autofdo/ myappwhich will enable the 'autofdo' configuration.
-
perf starts tracing on the system. As each ETMv4 that perf uses for trace is enabled, the configuration manager will check if the ETMv4 has a feature that relates to the currently active configuration. In this case 'strobing' is enabled & programmed into the ETMv4.
-
When the ETMv4 is disabled, any registers marked as needing to be saved will be read back.
-
At the end of the perf session, the configuration will be disabled.
Viewing Configurations and Features #
The set of configurations and features that are currently loaded into the system can be viewed using the configfs API.
Mount configfs as normal and the 'cs-syscfg' subsystem will appear:
$ ls /config
cs-syscfg stp-policy
This has two sub-directories:
$ cd cs-syscfg/
$ ls
configurations features
The system has the configuration 'autofdo' built in. It may be examined as follows:
$ cd configurations/
$ ls
autofdo
$ cd autofdo/
$ ls
description feature_refs preset1 preset3 preset5 preset7 preset9
enable preset preset2 preset4 preset6 preset8
$ cat description
Setup ETMs with strobing for autofdo
$ cat feature_refs
strobing
Each preset declared has a 'preset<n>' subdirectory declared. The values for the preset can be examined:
$ cat preset1/values
strobing.window = 0x1388 strobing.period = 0x2
$ cat preset2/values
strobing.window = 0x1388 strobing.period = 0x4
The 'enable' and 'preset' files allow the control of a configuration when using CoreSight with sysfs.
The features referenced by the configuration can be examined in the features directory:
$ cd ../../features/strobing/
$ ls
description matches nr_params params
$ cat description
Generate periodic trace capture windows.
parameter 'window': a number of CPU cycles (W)
parameter 'period': trace enabled for W cycles every period x W cycles
$ cat matches
SRC_ETMV4
$ cat nr_params
2
Move to the params directory to examine and adjust parameters:
cd params
$ ls
period window
$ cd period
$ ls
value
$ cat value
0x2710
# echo 15000 > value
# cat value
0x3a98
Parameters adjusted in this way are reflected in all device instances that have loaded the feature.
Using Configurations in perf #
The configurations loaded into the CoreSight configuration management are also declared in the perf 'cs_etm' event infrastructure so that they can be selected when running trace under perf:
$ ls /sys/devices/cs_etm
cpu0 cpu2 events nr_addr_filters power subsystem uevent
cpu1 cpu3 format perf_event_mux_interval_ms sinks type
The key directory here is 'events' - a generic perf directory which allows selection on the perf command line. As with the sinks entries, this provides a hash of the configuration name.
The entry in the 'events' directory uses perfs built in syntax generator to substitute the syntax for the name when evaluating the command:
$ ls events/
autofdo
$ cat events/autofdo
configid=0xa7c3dddd
The 'autofdo' configuration may be selected on the perf command line:
$ perf record -e cs_etm/autofdo/u --per-thread <application>
A preset to override the current parameter values can also be selected:
$ perf record -e cs_etm/autofdo,preset=1/u --per-thread <application>
When configurations are selected in this way, then the trace sink used is automatically selected.
Using Configurations in sysfs #
Coresight can be controlled using sysfs. When this is in use then a configuration can be made active for the devices that are used in the sysfs session.
In a configuration there are 'enable' and 'preset' files.
To enable a configuration for use with sysfs:
$ cd configurations/autofdo
$ echo 1 > enable
This will then use any default parameter values in the features - which can be adjusted as described above.
To use a preset<n> set of parameter values:
$ echo 3 > preset
This will select preset3 for the configuration. The valid values for preset are 0 - to deselect presets, and any value of <n> where a preset<n> sub-directory is present.
Note that the active sysfs configuration is a global parameter, therefore only a single configuration can be active for sysfs at any one time. Attempting to enable a second configuration will result in an error. Additionally, attempting to disable the configuration while in use will also result in an error.
The use of the active configuration by sysfs is independent of the configuration used in perf.
Creating and Loading Custom Configurations #
Custom configurations and / or features can be dynamically loaded into the system by using a loadable module.
An example of a custom configuration is found in ./samples/coresight.
This creates a new configuration that uses the existing built in strobing feature, but provides a different set of presets.
When the module is loaded, then the configuration appears in the configfs file system and is selectable in the same way as the built in configuration described above.
Configurations can use previously loaded features. The system will ensure that it is not possible to unload a feature that is currently in use, by enforcing the unload order as the strict reverse of the load order.
Coresight CPU Debug Module
Peios Kernel / Kernel development / Trace / coresight
Author: Leo Yan <leo.yan@linaro.org>
Date: April 5th, 2017
Introduction #
Coresight CPU debug module is defined in ARMv8-a architecture reference manual (ARM DDI 0487A.k) Chapter 'Part H: External debug', the CPU can integrate debug module and it is mainly used for two modes: self-hosted debug and external debug. Usually the external debug mode is well known as the external debugger connects with SoC from JTAG port; on the other hand the program can explore debugging method which rely on self-hosted debug mode, this document is to focus on this part.
The debug module provides sample-based profiling extension, which can be used to sample CPU program counter, secure state and exception level, etc; usually every CPU has one dedicated debug module to be connected. Based on self-hosted debug mechanism, Linux kernel can access these related registers from mmio region when the kernel panic happens. The callback notifier for kernel panic will dump related registers for every CPU; finally this is good for assistant analysis for panic.
Implementation #
-
During driver registration, it uses EDDEVID and EDDEVID1 - two device ID registers to decide if sample-based profiling is implemented or not. On some platforms this hardware feature is fully or partially implemented; and if this feature is not supported then registration will fail.
-
At the time this documentation was written, the debug driver mainly relies on information gathered by the kernel panic callback notifier from three sampling registers: EDPCSR, EDVIDSR and EDCIDSR: from EDPCSR we can get program counter; EDVIDSR has information for secure state, exception level, bit width, etc; EDCIDSR is context ID value which contains the sampled value of CONTEXTIDR_EL1.
-
The driver supports a CPU running in either AArch64 or AArch32 mode. The registers naming convention is a bit different between them, AArch64 uses 'ED' for register prefix (ARM DDI 0487A.k, chapter H9.1) and AArch32 uses 'DBG' as prefix (ARM DDI 0487A.k, chapter G5.1). The driver is unified to use AArch64 naming convention.
-
ARMv8-a (ARM DDI 0487A.k) and ARMv7-a (ARM DDI 0406C.b) have different register bits definition. So the driver consolidates two difference:
If PCSROffset=0b0000, on ARMv8-a the feature of EDPCSR is not implemented; but ARMv7-a defines "PCSR samples are offset by a value that depends on the instruction set state". For ARMv7-a, the driver checks furthermore if CPU runs with ARM or thumb instruction set and calibrate PCSR value, the detailed description for offset is in ARMv7-a ARM (ARM DDI 0406C.b) chapter C11.11.34 "DBGPCSR, Program Counter Sampling Register".
If PCSROffset=0b0010, ARMv8-a defines "EDPCSR implemented, and samples have no offset applied and do not sample the instruction set state in AArch32 state". So on ARMv8 if EDDEVID1.PCSROffset is 0b0010 and the CPU operates in AArch32 state, EDPCSR is not sampled; when the CPU operates in AArch64 state EDPCSR is sampled and no offset are applied.
Clock and power domain #
Before accessing debug registers, we should ensure the clock and power domain have been enabled properly. In ARMv8-a ARM (ARM DDI 0487A.k) chapter 'H9.1 Debug registers', the debug registers are spread into two domains: the debug domain and the CPU domain.
+---------------+
| |
| |
+----------+--+ |
dbg_clock -->| |**| |<-- cpu_clock
| Debug |**| CPU |
dbg_power_domain -->| |**| |<-- cpu_power_domain
+----------+--+ |
| |
| |
+---------------+
For debug domain, the user uses DT binding "clocks" and "power-domains" to specify the corresponding clock source and power supply for the debug logic. The driver calls the pm_runtime_{put|get} operations as needed to handle the debug power domain.
For CPU domain, the different SoC designs have different power management schemes and finally this heavily impacts external debug module. So we can divide into below cases:
-
On systems with a sane power controller which can behave correctly with respect to CPU power domain, the CPU power domain can be controlled by register EDPRCR in driver. The driver firstly writes bit EDPRCR.COREPURQ to power up the CPU, and then writes bit EDPRCR.CORENPDRQ for emulation of CPU power down. As result, this can ensure the CPU power domain is powered on properly during the period when access debug related registers;
-
Some designs will power down an entire cluster if all CPUs on the cluster are powered down - including the parts of the debug registers that should remain powered in the debug power domain. The bits in EDPRCR are not respected in these cases, so these designs do not support debug over power down in the way that the CoreSight / Debug designers anticipated. This means that even checking EDPRSR has the potential to cause a bus hang if the target register is unpowered.
In this case, accessing to the debug registers while they are not powered is a recipe for disaster; so we need preventing CPU low power states at boot time or when user enable module at the run time. Please see chapter "How to use the module" for detailed usage info for this.
Device Tree Bindings #
See Documentation/devicetree/bindings/arm/arm,coresight-cpu-debug.yaml for details.
How to use the module #
If you want to enable debugging functionality at boot time, you can add "coresight_cpu_debug.enable=1" to the kernel command line parameter.
The driver also can work as module, so can enable the debugging when insmod module:
# insmod coresight_cpu_debug.ko debug=1
When boot time or insmod module you have not enabled the debugging, the driver uses the debugfs file system to provide a knob to dynamically enable or disable debugging:
To enable it, write a '1' into /sys/kernel/debug/coresight_cpu_debug/enable:
# echo 1 > /sys/kernel/debug/coresight_cpu_debug/enable
To disable it, write a '0' into /sys/kernel/debug/coresight_cpu_debug/enable:
# echo 0 > /sys/kernel/debug/coresight_cpu_debug/enable
As explained in chapter "Clock and power domain", if you are working on one platform which has idle states to power off debug logic and the power controller cannot work well for the request from EDPRCR, then you should firstly constraint CPU idle states before enable CPU debugging feature; so can ensure the accessing to debug logic.
If you want to limit idle states at boot time, you can use "nohlt" or "cpuidle.off=1" in the kernel command line.
At the runtime you can disable idle states with below methods:
It is possible to disable CPU idle states by way of the PM QoS subsystem, more specifically by using the "/dev/cpu_dma_latency" interface (see Documentation/power/pm_qos_interface.rst for more details). As specified in the PM QoS documentation the requested parameter will stay in effect until the file descriptor is released. For example:
# exec 3<> /dev/cpu_dma_latency; echo 0 >&3
...
Do some work...
...
# exec 3<>-
The same can also be done from an application program.
Disable specific CPU's specific idle state from cpuidle sysfs (see Documentation/admin-guide/pm/cpuidle.rst):
# echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable
Output format #
Here is an example of the debugging output format:
ARM external debug module:
coresight-cpu-debug 850000.debug: CPU[0]:
coresight-cpu-debug 850000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock)
coresight-cpu-debug 850000.debug: EDPCSR: handle_IPI+0x174/0x1d8
coresight-cpu-debug 850000.debug: EDCIDSR: 00000000
coresight-cpu-debug 850000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
coresight-cpu-debug 852000.debug: CPU[1]:
coresight-cpu-debug 852000.debug: EDPRSR: 00000001 (Power:On DLK:Unlock)
coresight-cpu-debug 852000.debug: EDPCSR: debug_notifier_call+0x23c/0x358
coresight-cpu-debug 852000.debug: EDCIDSR: 00000000
coresight-cpu-debug 852000.debug: EDVIDSR: 90000000 (State:Non-secure Mode:EL1/0 Width:64bits VMID:0)
Coresight Dummy Trace Module
Peios Kernel / Kernel development / Trace / coresight
Author: Hao Zhang <quic_hazha@quicinc.com>
Date: June 2023
Introduction #
The Coresight dummy trace module is for the specific devices that kernel don't have permission to access or configure, e.g., CoreSight TPDMs on Qualcomm platforms. For these devices, a dummy driver is needed to register them as Coresight devices. The module may also be used to define components that may not have any programming interfaces, so that paths can be created in the driver. It provides Coresight API for operations on dummy devices, such as enabling and disabling them. It also provides the Coresight dummy sink/source paths for debugging.
Config details #
There are two types of nodes, dummy sink and dummy source. These nodes are available at /sys/bus/coresight/devices.
Example output:
$ ls -l /sys/bus/coresight/devices | grep dummy
dummy_sink0 -> ../../../devices/platform/soc@0/soc@0:sink/dummy_sink0
dummy_source0 -> ../../../devices/platform/soc@0/soc@0:source/dummy_source0
CoreSight Embedded Cross Trigger (CTI & CTM).
Peios Kernel / Kernel development / Trace / coresight
Author: Mike Leach <mike.leach@linaro.org>
Date: November 2019
Hardware Description #
The CoreSight Cross Trigger Interface (CTI) is a hardware device that takes individual input and output hardware signals known as triggers to and from devices and interconnects them via the Cross Trigger Matrix (CTM) to other devices via numbered channels, in order to propagate events between devices.
e.g.:
0000000 in_trigs :::::::
0 C 0----------->: : +======>(other CTI channel IO)
0 P 0<-----------: : v
0 U 0 out_trigs : : Channels ***** :::::::
0000000 : CTI :<=========>*CTM*<====>: CTI :---+
####### in_trigs : : (id 0-3) ***** ::::::: v
# ETM #----------->: : ^ #######
# #<-----------: : +---# ETR #
####### out_trigs ::::::: #######
The CTI driver enables the programming of the CTI to attach triggers to channels. When an input trigger becomes active, the attached channel will become active. Any output trigger attached to that channel will also become active. The active channel is propagated to other CTIs via the CTM, activating connected output triggers there, unless filtered by the CTI channel gate.
It is also possible to activate a channel using system software directly programming registers in the CTI.
The CTIs are registered by the system to be associated with CPUs and/or other CoreSight devices on the trace data path. When these devices are enabled the attached CTIs will also be enabled. By default/on power up the CTIs have no programmed trigger/channel attachments, so will not affect the system until explicitly programmed.
The hardware trigger connections between CTIs and devices is implementation defined, unless the CPU/ETM combination is a v8 architecture, in which case the connections have an architecturally defined standard layout.
The hardware trigger signals can also be connected to non-CoreSight devices (e.g. UART), or be propagated off chip as hardware IO lines.
All the CTI devices are associated with a CTM. On many systems there will be a single effective CTM (one CTM, or multiple CTMs all interconnected), but it is possible that systems can have nets of CTIs+CTM that are not interconnected by a CTM to each other. On these systems a CTM index is declared to associate CTI devices that are interconnected via a given CTM.
Sysfs files and directories #
The CTI devices appear on the existing CoreSight bus alongside the other CoreSight devices:
>$ ls /sys/bus/coresight/devices
cti_cpu0 cti_cpu2 cti_sys0 etm0 etm2 funnel0 replicator0 tmc_etr0
cti_cpu1 cti_cpu3 cti_sys1 etm1 etm3 funnel1 tmc_etf0 tpiu0
The cti_cpu<N> named CTIs are associated with a CPU, and any ETM used by that core. The cti_sys<N> CTIs are general system infrastructure CTIs that can be associated with other CoreSight devices, or other system hardware capable of generating or using trigger signals.:
>$ ls /sys/bus/coresight/devices/etm0/cti_cpu0
channels ctmid enable nr_trigger_cons mgmt power powered regs
connections subsystem triggers0 triggers1 uevent
-
Key file items are:-
-
enable: enables/disables the CTI. Read to determine current state. If this shows as enabled (1), butpoweredshows unpowered (0), then the enable indicates a request to enabled when the device is powered. -
ctmid: associated CTM - only relevant if system has multiple CTI+CTM clusters that are not interconnected. -
nr_trigger_cons: total connections - triggers<N> directories. -
powered: Read to determine if the CTI is currently powered.
-
-
Sub-directories:-
-
triggers<N>: contains list of triggers for an individual connection. -
channels: Contains the channel API - CTI main programming interface. -
regs: Gives access to the raw programmable CTI regs. -
mgmt: the standard CoreSight management registers. -
connections: Links to connected CoreSight devices. The number of links can be 0 tonr_trigger_cons. Actual number given bynr_linksin this directory.
-
triggers<N> directories #
Individual trigger connection information. This describes trigger signals for CoreSight and non-CoreSight connections.
Each triggers directory has a set of parameters describing the triggers for the connection.
name: name of connection
in_signals: input trigger signal indexes used in this connection.
in_types: functional types for in signals.
out_signals: output trigger signals for this connection.
out_types: functional types for out signals.
e.g:
>$ ls ./cti_cpu0/triggers0/
in_signals in_types name out_signals out_types
>$ cat ./cti_cpu0/triggers0/name
cpu0
>$ cat ./cti_cpu0/triggers0/out_signals
0-2
>$ cat ./cti_cpu0/triggers0/out_types
pe_edbgreq pe_dbgrestart pe_ctiirq
>$ cat ./cti_cpu0/triggers0/in_signals
0-1
>$ cat ./cti_cpu0/triggers0/in_types
pe_dbgtrigger pe_pmuirq
If a connection has zero signals in either the 'in' or 'out' triggers then those parameters will be omitted.
Channels API Directory #
This provides an easy way to attach triggers to channels, without needing the multiple register operations that are required if manipulating the 'regs' sub-directory elements directly.
A number of files provide this API:
>$ ls ./cti_sys0/channels/
chan_clear chan_inuse chan_xtrigs_out trigin_attach
chan_free chan_pulse chan_xtrigs_reset trigin_detach
chan_gate_disable chan_set chan_xtrigs_sel trigout_attach
chan_gate_enable chan_xtrigs_in trig_filter_enable trigout_detach
trigout_filtered
Most access to these elements take the form:
echo <chan> [<trigger>] > /<device_path>/<operation>
where the optional <trigger> is only needed for trigXX_attach | detach operations.
e.g.:
>$ echo 0 1 > ./cti_sys0/channels/trigout_attach
>$ echo 0 > ./cti_sys0/channels/chan_set
Attaches trigout(1) to channel(0), then activates channel(0) generating a set state on cti_sys0.trigout(1)
API operations
trigin_attach, trigout_attach: Attach a channel to a trigger signal.
trigin_detach, trigout_detach: Detach a channel from a trigger signal.
chan_set: Set the channel - the set state will be propagated around the CTM to other connected devices.
chan_clear: Clear the channel.
chan_pulse: Set the channel for a single CoreSight clock cycle.
chan_gate_enable: Write operation sets the CTI gate to propagate (enable) the channel to other devices. This operation takes a channel number. CTI gate is enabled for all channels by default at power up. Read to list the currently enabled channels on the gate.
chan_gate_disable: Write channel number to disable gate for that channel.
chan_inuse: Show the current channels attached to any signal
chan_free: Show channels with no attached signals.
chan_xtrigs_sel: write a channel number to select a channel to view, read to show the selected channel number.
chan_xtrigs_in: Read to show the input triggers attached to the selected view channel.
chan_xtrigs_out:Read to show the output triggers attached to the selected view channel.
trig_filter_enable: Defaults to enabled, disable to allow potentially dangerous output signals to be set.
trigout_filtered: Trigger out signals that are prevented from being set if filteringtrig_filter_enableis enabled. One use is to prevent accidentalEDBGREQsignals stopping a core.
chan_xtrigs_reset: Write 1 to clear all channel / trigger programming. Resets device hardware to default state.
The example below attaches input trigger index 1 to channel 2, and output trigger index 6 to the same channel. It then examines the state of the channel / trigger connections using the appropriate sysfs attributes.
The settings mean that if either input trigger 1, or channel 2 go active then trigger out 6 will go active. We then enable the CTI, and use the software channel control to activate channel 2. We see the active channel on the choutstatus register and the active signal on the trigoutstatus register. Finally clearing the channel removes this.
e.g.:
.../cti_sys0/channels# echo 2 1 > trigin_attach
.../cti_sys0/channels# echo 2 6 > trigout_attach
.../cti_sys0/channels# cat chan_free
0-1,3
.../cti_sys0/channels# cat chan_inuse
2
.../cti_sys0/channels# echo 2 > chan_xtrigs_sel
.../cti_sys0/channels# cat chan_xtrigs_trigin
1
.../cti_sys0/channels# cat chan_xtrigs_trigout
6
.../cti_sys0/# echo 1 > enable
.../cti_sys0/channels# echo 2 > chan_set
.../cti_sys0/channels# cat ../regs/choutstatus
0x4
.../cti_sys0/channels# cat ../regs/trigoutstatus
0x40
.../cti_sys0/channels# echo 2 > chan_clear
.../cti_sys0/channels# cat ../regs/trigoutstatus
0x0
.../cti_sys0/channels# cat ../regs/choutstatus
0x0
ETMv4 sysfs linux driver programming reference.
Peios Kernel / Kernel development / Trace / coresight
Author: Mike Leach <mike.leach@linaro.org>
Date: October 11th, 2019
Supplement to existing ETMv4 driver documentation.
Sysfs files and directories #
Root: /sys/bus/coresight/devices/etm<N>
The following paragraphs explain the association between sysfs files and the ETMv4 registers that they effect. Note the register names are given without the ‘TRC’ prefix.
File: mode (rw)
Trace Registers: {CONFIGR + others}
Notes: Bit select trace features. See ‘mode’ section below. Bits in this will cause equivalent programming of trace config and other registers to enable the features requested.
Syntax & eg: echo bitfield > mode
bitfield up to 32 bits setting trace features.
Example: $> echo 0x012 > mode
File: reset (wo)
Trace Registers: All
Notes: Reset all programming to trace nothing / no logic programmed.
Syntax: echo 1 > reset
File: enable_source (wo)
Trace Registers: PRGCTLR, All hardware regs.
Notes: - > 0 : Programs up the hardware with the current values held in the driver and enables trace.
- = 0 : disable trace hardware.
Syntax: echo 1 > enable_source
File: cpu (ro)
Trace Registers: None.
Notes: CPU ID that this ETM is attached to.
Example: $> cat cpu
$> 0
File: ts_source (ro)
Trace Registers: None.
Notes: When FEAT_TRF is implemented, value of TRFCR_ELx.TS used for trace session. Otherwise -1 indicates an unknown time source. Check trcidr0.tssize to see if a global timestamp is available.
Example: $> cat ts_source
$> 1
File: addr_idx (rw)
Trace Registers: None.
Notes: Virtual register to index address comparator and range features. Set index for first of the pair in a range.
Syntax: echo idx > addr_idx
Where idx < nr_addr_cmp x 2
File: addr_range (rw)
Trace Registers: ACVR[idx, idx+1], VIIECTLR
Notes: Pair of addresses for a range selected by addr_idx. Include / exclude according to the optional parameter, or if omitted uses the current ‘mode’ setting. Select comparator range in control register. Error if index is odd value.
Depends: mode, addr_idx
Syntax: echo addr1 addr2 [exclude] > addr_range
Where addr1 and addr2 define the range and addr1 < addr2.
Optional exclude value:-
-
0 for include
-
1 for exclude.
Example: $> echo 0x0000 0x2000 0 > addr_range
File: addr_single (rw)
Trace Registers: ACVR[idx]
Notes: Set a single address comparator according to addr_idx. This is used if the address comparator is used as part of event generation logic etc.
Depends: addr_idx
Syntax: echo addr1 > addr_single
File: addr_start (rw)
Trace Registers: ACVR[idx], VISSCTLR
Notes: Set a trace start address comparator according to addr_idx. Select comparator in control register.
Depends: addr_idx
Syntax: echo addr1 > addr_start
File: addr_stop (rw)
Trace Registers: ACVR[idx], VISSCTLR
Notes: Set a trace stop address comparator according to addr_idx. Select comparator in control register.
Depends: addr_idx
Syntax: echo addr1 > addr_stop
File: addr_context (rw)
Trace Registers: ACATR[idx,{6:4}]
Notes: Link context ID comparator to address comparator addr_idx
Depends: addr_idx
Syntax: echo ctxt_idx > addr_context
Where ctxt_idx is the index of the linked context id / vmid comparator.
File: addr_ctxtype (rw)
Trace Registers: ACATR[idx,{3:2}]
Notes: Input value string. Set type for linked context ID comparator
Depends: addr_idx
Syntax: echo type > addr_ctxtype
Type one of {all, vmid, ctxid, none}
Example: $> echo ctxid > addr_ctxtype
File: addr_exlevel_s_ns (rw)
Trace Registers: ACATR[idx,{14:8}]
Notes: Set the ELx secure and non-secure matching bits for the selected address comparator
Depends: addr_idx
Syntax: echo val > addr_exlevel_s_ns
val is a 7 bit value for exception levels to exclude. Input value shifted to correct bits in register.
Example: $> echo 0x4F > addr_exlevel_s_ns
File: addr_instdatatype (rw)
Trace Registers: ACATR[idx,{1:0}]
Notes: Set the comparator address type for matching. Driver only supports setting instruction address type.
Depends: addr_idx
File: addr_cmp_view (ro)
Trace Registers: ACVR[idx, idx+1], ACATR[idx], VIIECTLR
Notes: Read the currently selected address comparator. If part of address range then display both addresses.
Depends: addr_idx
Syntax: cat addr_cmp_view
Example: > $> cat addr_cmp_view
addr_cmp[0] range 0x0 0xffffffffffffffff include ctrl(0x4b00)
File: nr_addr_cmp (ro)
Trace Registers: From IDR4
Notes: Number of address comparator pairs
File: sshot_idx (rw)
Trace Registers: None
Notes: Select single shot register set.
File: sshot_ctrl (rw)
Trace Registers: SSCCR[idx]
Notes: Access a single shot comparator control register.
Depends: sshot_idx
Syntax: echo val > sshot_ctrl
Writes val into the selected control register.
File: sshot_status (ro)
Trace Registers: SSCSR[idx]
Notes: Read a single shot comparator status register
Depends: sshot_idx
Syntax: cat sshot_status
Read status.
Example: $> cat sshot_status
0x1
File: sshot_pe_ctrl (rw)
Trace Registers: SSPCICR[idx]
Notes: Access a single shot PE comparator input control register.
Depends: sshot_idx
Syntax: echo val > sshot_pe_ctrl
Writes val into the selected control register.
File: ns_exlevel_vinst (rw)
Trace Registers: VICTLR{23:20}
Notes: Program non-secure exception level filters. Set / clear NS exception filter bits. Setting ‘1’ excludes trace from the exception level.
Syntax: echo bitfield > ns_exlevel_viinst
Where bitfield contains bits to set clear for EL0 to EL2
Example: %> echo 0x4 > ns_exlevel_viinst
Excludes EL2 NS trace.
File: vinst_pe_cmp_start_stop (rw)
Trace Registers: VIPCSSCTLR
Notes: Access PE start stop comparator input control registers
File: bb_ctrl (rw)
Trace Registers: BBCTLR
Notes: Define ranges that Branch Broadcast will operate in. Default (0x0) is all addresses.
Depends: BB enabled.
File: cyc_threshold (rw)
Trace Registers: CCCTLR
Notes: Set the threshold for which cycle counts will be emitted. Error if attempt to set below minimum defined in IDR3, masked to width of valid bits.
Depends: CC enabled.
File: syncfreq (rw)
Trace Registers: SYNCPR
Notes: Set trace synchronisation period. Power of 2 value, 0 (off) or 8-20. Driver defaults to 12 (every 4096 bytes).
File: cntr_idx (rw)
Trace Registers: none
Notes: Select the counter to access
Syntax: echo idx > cntr_idx
Where idx < nr_cntr
File: cntr_ctrl (rw)
Trace Registers: CNTCTLR[idx]
Notes: Set counter control value.
Depends: cntr_idx
Syntax: echo val > cntr_ctrl
Where val is per ETMv4 spec.
File: cntrldvr (rw)
Trace Registers: CNTRLDVR[idx]
Notes: Set counter reload value.
Depends: cntr_idx
Syntax: echo val > cntrldvr
Where val is per ETMv4 spec.
File: nr_cntr (ro)
Trace Registers: From IDR5
Notes: Number of counters implemented.
File: ctxid_idx (rw)
Trace Registers: None
Notes: Select the context ID comparator to access
Syntax: echo idx > ctxid_idx
Where idx < numcidc
File: ctxid_pid (rw)
Trace Registers: CIDCVR[idx]
Notes: Set the context ID comparator value
Depends: ctxid_idx
File: ctxid_masks (rw)
Trace Registers: CIDCCTLR0, CIDCCTLR1, CIDCVR<0-7>
Notes: Pair of values to set the byte masks for 1-8 context ID comparators. Automatically clears masked bytes to 0 in CID value registers.
Syntax: echo m3m2m1m0 [m7m6m5m4] > ctxid_masks
32 bit values made up of mask bytes, where mN represents a byte mask value for Context ID comparator N.
Second value not required on systems that have fewer than 4 context ID comparators
File: numcidc (ro)
Trace Registers: From IDR4
Notes: Number of Context ID comparators
File: vmid_idx (rw)
Trace Registers: None
Notes: Select the VM ID comparator to access.
Syntax: echo idx > vmid_idx
Where idx < numvmidc
File: vmid_val (rw)
Trace Registers: VMIDCVR[idx]
Notes: Set the VM ID comparator value
Depends: vmid_idx
File: vmid_masks (rw)
Trace Registers: VMIDCCTLR0, VMIDCCTLR1, VMIDCVR<0-7>
Notes: Pair of values to set the byte masks for 1-8 VM ID comparators. Automatically clears masked bytes to 0 in VMID value registers.
Syntax: echo m3m2m1m0 [m7m6m5m4] > vmid_masks
Where mN represents a byte mask value for VMID comparator N. Second value not required on systems that have fewer than 4 VMID comparators.
File: numvmidc (ro)
Trace Registers: From IDR4
Notes: Number of VMID comparators
File: res_idx (rw)
Trace Registers: None.
Notes: Select the resource selector control to access. Must be 2 or higher as selectors 0 and 1 are hardwired.
Syntax: echo idx > res_idx
Where 2 <= idx < nr_resource x 2
File: res_ctrl (rw)
Trace Registers: RSCTLR[idx]
Notes: Set resource selector control value. Value per ETMv4 spec.
Depends: res_idx
Syntax: echo val > res_cntr
Where val is per ETMv4 spec.
File: nr_resource (ro)
Trace Registers: From IDR4
Notes: Number of resource selector pairs
File: event (rw)
Trace Registers: EVENTCTRL0R
Notes: Set up to 4 implemented event fields.
Syntax: echo ev3ev2ev1ev0 > event
Where evN is an 8 bit event field. Up to 4 event fields make up the 32-bit input value. Number of valid fields is implementation dependent, defined in IDR0.
File: event_instren (rw)
Trace Registers: EVENTCTRL1R
Notes: Choose events which insert event packets into trace stream.
Depends: EVENTCTRL0R
Syntax: echo bitfield > event_instren
Where bitfield is up to 4 bits according to number of event fields.
File: event_ts (rw)
Trace Registers: TSCTLR
Notes: Set the event that will generate timestamp requests.
Depends: TS activated
Syntax: echo evfield > event_ts
Where evfield is an 8 bit event selector.
File: seq_idx (rw)
Trace Registers: None
Notes: Sequencer event register select - 0 to 2
File: seq_state (rw)
Trace Registers: SEQSTR
Notes: Sequencer current state - 0 to 3.
File: seq_event (rw)
Trace Registers: SEQEVR[idx]
Notes: State transition event registers
Depends: seq_idx
Syntax: echo evBevF > seq_event
Where evBevF is a 16 bit value made up of two event selectors,
-
evB : back
-
evF : forwards.
File: seq_reset_event (rw)
Trace Registers: SEQRSTEVR
Notes: Sequencer reset event
Syntax: echo evfield > seq_reset_event
Where evfield is an 8 bit event selector.
File: nrseqstate (ro)
Trace Registers: From IDR5
Notes: Number of sequencer states (0 or 4)
File: nr_pe_cmp (ro)
Trace Registers: From IDR4
Notes: Number of PE comparator inputs
File: nr_ext_inp (ro)
Trace Registers: From IDR5
Notes: Number of external inputs
File: nr_ss_cmp (ro)
Trace Registers: From IDR4
Notes: Number of Single Shot control registers
Note: When programming any address comparator the driver will tag the comparator with a type used - i.e. RANGE, SINGLE, START, STOP. Once this tag is set, then only the values can be changed using the same sysfs file / type used to program it.
Thus:
% echo 0 > addr_idx ; select address comparator 0
% echo 0x1000 0x5000 0 > addr_range ; set address range on comparators 0, 1.
% echo 0x2000 > addr_start ; error as comparator 0 is a range comparator
% echo 2 > addr_idx ; select address comparator 2
% echo 0x2000 > addr_start ; this is OK as comparator 2 is unused.
% echo 0x3000 > addr_stop ; error as comparator 2 set as start address.
% echo 2 > addr_idx ; select address comparator 3
% echo 0x3000 > addr_stop ; this is OK
To remove programming on all the comparators (and all the other hardware) use the reset parameter:
% echo 1 > reset
The ‘mode’ sysfs parameter. #
This is a bitfield selection parameter that sets the overall trace mode for the ETM. The table below describes the bits, using the defines from the driver source file, along with a description of the feature these represent. Many features are optional and therefore dependent on implementation in the hardware.
Bit assignments shown below:-
-
bit (0):
ETM_MODE_EXCLUDE
-
description:
This is the default value for the include / exclude function when setting address ranges. Set 1 for exclude range. When the mode parameter is set this value is applied to the currently indexed address range.
-
bit (4):
ETM_MODE_BB
-
description:
Set to enable branch broadcast if supported in hardware [IDR0]. The primary use for this feature is when code is patched dynamically at run time and the full program flow may not be able to be reconstructed using only conditional branches.
There is currently no support in Perf for supplying modified binaries to the decoder, so this feature is only intended to be used for debugging purposes or with a 3rd party tool.
Choosing this option will result in a significant increase in the amount of trace generated - possible danger of overflows, or fewer instructions covered. Note, that this option also overrides any setting of ETM_MODE_RETURNSTACK, so where a branch broadcast range overlaps a return stack range, return stacks will not be available for that range.
-
bit (5):
ETMv4_MODE_CYCACC
-
description:
Set to enable cycle accurate trace if supported [IDR0].
-
bit (6):
ETMv4_MODE_CTXID
-
description:
Set to enable context ID tracing if supported in hardware [IDR2].
-
bit (7):
ETM_MODE_VMID
-
description:
Set to enable virtual machine ID tracing if supported [IDR2].
-
bit (11):
ETMv4_MODE_TIMESTAMP
-
description:
Set to enable timestamp generation if supported [IDR0].
-
bit (12):
ETM_MODE_RETURNSTACK
-
description:
Set to enable trace return stack use if supported [IDR0].
-
bit (13-14):
ETM_MODE_QELEM(val)
-
description:
‘val’ determines level of Q element support enabled if implemented by the ETM [IDR0]
-
bit (19):
ETM_MODE_ATB_TRIGGER
-
description:
Set to enable the ATBTRIGGER bit in the event control register [EVENTCTLR1] if supported [IDR5].
-
bit (20):
ETM_MODE_LPOVERRIDE
-
description:
Set to enable the LPOVERRIDE bit in the event control register [EVENTCTLR1], if supported [IDR5].
-
bit (21):
ETM_MODE_ISTALL_EN
-
description:
Set to enable the ISTALL bit in the stall control register [STALLCTLR]
-
bit (23):
ETM_MODE_INSTPRIO
-
description:
Set to enable the INSTPRIORITY bit in the stall control register [STALLCTLR] , if supported [IDR0].
-
bit (24):
ETM_MODE_NOOVERFLOW
-
description:
Set to enable the NOOVERFLOW bit in the stall control register [STALLCTLR], if supported [IDR3].
-
bit (25):
ETM_MODE_TRACE_RESET
-
description:
Set to enable the TRCRESET bit in the viewinst control register [VICTLR] , if supported [IDR3].
-
bit (26):
ETM_MODE_TRACE_ERR
-
description:
Set to enable the TRCCTRL bit in the viewinst control register [VICTLR].
-
bit (27):
ETM_MODE_VIEWINST_STARTSTOP
-
description:
Set the initial state value of the ViewInst start / stop logic in the viewinst control register [VICTLR]
-
bit (30):
ETM_MODE_EXCL_KERN
-
description:
Set default trace setup to exclude kernel mode trace (see note a)
-
bit (31):
ETM_MODE_EXCL_USER
-
description:
Set default trace setup to exclude user space trace (see note a)
Note a) On startup the ETM is programmed to trace the complete address space using address range comparator 0. ‘mode’ bits 30 / 31 modify this setting to set EL exclude bits for NS state in either user space (EL0) or kernel space (EL1) in the address range comparator. (the default setting excludes all secure EL, and NS EL2)
Once the reset parameter has been used, and/or custom programming has been implemented - using these bits will result in the EL bits for address comparator 0 being set in the same way.
Note b) Bits 2-3, 8-10, 15-16, 18, 22, control features that only work with data trace. As A-profile data trace is architecturally prohibited in ETMv4, these have been omitted here. Possible uses could be where a kernel has support for control of R or M profile infrastructure as part of a heterogeneous system.
Bits 17, 28-29 are unused.
CoreSight - Perf
Peios Kernel / Kernel development / Trace / coresight
Author: Carsten Haitzler <carsten.haitzler@arm.com>
Date: June 29th, 2022
Perf is able to locally access CoreSight trace data and store it to the output perf data files. This data can then be later decoded to give the instructions that were traced for debugging or profiling purposes. You can log such data with a perf record command like:
perf record -e cs_etm//u testbinary
This would run some test binary (testbinary) until it exits and record a perf.data trace file. That file would have AUX sections if CoreSight is working correctly. You can dump the content of this file as readable text with a command like:
perf report --stdio --dump -i perf.data
You should find some sections of this file have AUX data blocks like:
0x1e78 [0x30]: PERF_RECORD_AUXTRACE size: 0x11dd0 offset: 0 ref: 0x1b614fc1061b0ad1 idx: 0 tid: 531230 cpu: -1
. ... CoreSight ETM Trace data: size 73168 bytes
Idx:0; ID:10; I_ASYNC : Alignment Synchronisation.
Idx:12; ID:10; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }
Idx:17; ID:10; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000;
Idx:26; ID:10; I_TRACE_ON : Trace On.
Idx:27; ID:10; I_ADDR_CTXT_L_64IS0 : Address & Context, Long, 64 bit, IS0.; Addr=0x0000FFFFB6069140; Ctxt: AArch64,EL0, NS;
Idx:38; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
Idx:39; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
Idx:40; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEEEEEEEEEEEEEE
Idx:41; ID:10; I_ATOM_F6 : Atom format 6.; EEEEEEEEEEEN
...
If you see these above, then your system is tracing CoreSight data correctly.
To compile perf with CoreSight support in the tools/perf directory do:
make CORESIGHT=1
This requires OpenCSD to build. You may install distribution packages for the support such as libopencsd and libopencsd-dev or download it and build yourself. Upstream OpenCSD is located at:
For complete information on building perf with CoreSight support and more extensive usage look at:
Kernel CoreSight Support #
You will also want CoreSight support enabled in your kernel config. Ensure it is enabled with:
CONFIG_CORESIGHT=y
There are various other CoreSight options you probably also want enabled like:
CONFIG_CORESIGHT_LINKS_AND_SINKS=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_CATU=y
CONFIG_CORESIGHT_SINK_TPIU=y
CONFIG_CORESIGHT_SINK_ETBV10=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
CONFIG_CORESIGHT_CTI=y
CONFIG_CORESIGHT_CTI_INTEGRATION_REGS=y
Please refer to the kernel configuration help for more information.
Fine-grained tracing with AUX pause and resume #
Arm CoreSight may generate a large amount of hardware trace data, which will lead to overhead in recording and distract users when reviewing profiling result. To mitigate the issue of excessive trace data, Perf provides AUX pause and resume functionality for fine-grained tracing.
The AUX pause and resume can be triggered by associated events. These events can be ftrace tracepoints (including static and dynamic tracepoints) or PMU events (e.g. CPU PMU cycle event). To create a perf session with AUX pause / resume, three configuration terms are introduced:
-
"aux-action=start-paused": it is specified for the cs_etm PMU event to launch in a paused state.
-
"aux-action=pause": an associated event is specified with this term to pause AUX trace.
-
"aux-action=resume": an associated event is specified with this term to resume AUX trace.
Example for triggering AUX pause and resume with ftrace tracepoints:
perf record -e cs_etm/aux-action=start-paused/k,syscalls:sys_enter_openat/aux-action=resume/,syscalls:sys_exit_openat/aux-action=pause/ ls
Example for triggering AUX pause and resume with PMU event:
perf record -a -e cs_etm/aux-action=start-paused/k \
-e cycles/aux-action=pause,period=10000000/ \
-e cycles/aux-action=resume,period=1050000/ -- sleep 1
Perf test - Verify kernel and userspace perf CoreSight work #
When you run perf test, it will do a lot of self tests. Some of those tests will cover CoreSight (only if enabled and on ARM64). You generally would run perf test from the tools/perf directory in the kernel tree. Some tests will check some internal perf support like:
Check Arm CoreSight trace data recording and synthesized samples Check Arm SPE trace data recording and synthesized samples
Some others will actually use perf record and some test binaries that are in tests/shell/coresight and will collect traces to ensure a minimum level of functionality is met. The scripts that launch these tests are in the same directory. These will all look like:
CoreSight / ASM Pure Loop CoreSight / Memcpy 16k 10 Threads CoreSight / Thread Loop 10 Threads - Check TID etc.
These perf record tests will not run if the tool binaries do not exist in tests/shell/coresight/*/ and will be skipped. If you do not have CoreSight support in hardware then either do not build perf with CoreSight support or remove these binaries in order to not have these tests fail and have them skip instead.
These tests will log historical results in the current working directory (e.g. tools/perf) and will be named stats-*.csv like:
stats-asm_pure_loop-out.csv stats-memcpy_thread-16k_10.csv ...
These statistic files log some aspects of the AUX data sections in the perf data output counting some numbers of certain encodings (a good way to know that it's working in a very simple way). One problem with CoreSight is that given a large enough amount of data needing to be logged, some of it can be lost due to the processor not waking up in time to read out all the data from buffers etc.. You will notice that the amount of data collected can vary a lot per run of perf test. If you wish to see how this changes over time, simply run perf test multiple times and all these csv files will have more and more data appended to it that you can later examine, graph and otherwise use to figure out if things have become worse or better.
This means sometimes these tests fail as they don't capture all the data needed. This is about tracking quality and amount of data produced over time and to see when changes to the Linux kernel improve quality of traces.
Be aware that some of these tests take quite a while to run, specifically in processing the perf data file and dumping contents to then examine what is inside.
You can change where these csv logs are stored by setting the PERF_TEST_CORESIGHT_STATDIR environment variable before running perf test like:
export PERF_TEST_CORESIGHT_STATDIR=/var/tmp
perf test
They will also store resulting perf output data in the current directory for later inspection like:
perf-asm_pure_loop-out.data
perf-memcpy_thread-16k_10.data
...
You can alter where the perf data files are stored by setting the PERF_TEST_CORESIGHT_DATADIR environment variable such as:
PERF_TEST_CORESIGHT_DATADIR=/var/tmp
perf test
You may wish to set these above environment variables if you wish to keep the output of tests outside of the current working directory for longer term storage and examination.
The trace performance monitoring and diagnostics aggregator(TPDA)
Peios Kernel / Kernel development / Trace / coresight
Author: Jinlong Mao <quic_jinlmao@quicinc.com>
Date: January 2023
Hardware Description #
TPDA - The trace performance monitoring and diagnostics aggregator or TPDA in short serves as an arbitration and packetization engine for the performance monitoring and diagnostics network specification. The primary use case of the TPDA is to provide packetization, funneling and timestamping of Monitor data.
Sysfs files and directories #
Root: /sys/bus/coresight/devices/tpda<N>
Config details #
The tpdm and tpda nodes should be observed at the coresight path "/sys/bus/coresight/devices". e.g. /sys/bus/coresight/devices # ls -l | grep tpd tpda0 -> ../../../devices/platform/soc@0/6004000.tpda/tpda0 tpdm0 -> ../../../devices/platform/soc@0/6c08000.mm.tpdm/tpdm0
We can use the commands are similar to the below to validate TPDMs. Enable coresight sink first. The port of tpda which is connected to the tpdm will be enabled after commands below.
echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink echo 1 > /sys/bus/coresight/devices/tpdm0/enable_source echo 1 > /sys/bus/coresight/devices/tpdm0/integration_test echo 2 > /sys/bus/coresight/devices/tpdm0/integration_test
The test data will be collected in the coresight sink which is enabled. If rwp register of the sink is keeping updating when do integration_test (by cat tmc_etf0/mgmt/rwp), it means there is data generated from TPDM to sink.
There must be a tpda between tpdm and the sink. When there are some other trace event hw components in the same HW block with tpdm, tpdm and these hw components will connect to the coresight funnel. When there is only tpdm trace hw in the HW block, tpdm will connect to tpda directly.
Trace performance monitoring and diagnostics monitor(TPDM)
Peios Kernel / Kernel development / Trace / coresight
Author: Jinlong Mao <quic_jinlmao@quicinc.com>
Date: January 2023
Hardware Description #
TPDM - The trace performance monitoring and diagnostics monitor or TPDM in short serves as data collection component for various dataset types. The primary use case of the TPDM is to collect data from different data sources and send it to a TPDA for packetization, timestamping and funneling.
Sysfs files and directories #
Root: /sys/bus/coresight/devices/tpdm<N>
File: enable_source (RW)
Notes: - > 0 : enable the datasets of TPDM.
- = 0 : disable the datasets of TPDM.
Syntax: echo 1 > enable_source
File: integration_test (wo)
Notes: Integration test will generate test data for tpdm.
Syntax: echo value > integration_test
value - 1 or 2.
Trace Buffer Extension (TRBE).
Peios Kernel / Kernel development / Trace / coresight
Author: Anshuman Khandual <anshuman.khandual@arm.com>
Date: November 2020
Hardware Description #
Trace Buffer Extension (TRBE) is a percpu hardware which captures in system memory, CPU traces generated from a corresponding percpu tracing unit. This gets plugged in as a coresight sink device because the corresponding trace generators (ETE), are plugged in as source device.
The TRBE is not compliant to CoreSight architecture specifications, but is driven via the CoreSight driver framework to support the ETE (which is CoreSight compliant) integration.
Sysfs files and directories #
The TRBE devices appear on the existing coresight bus alongside the other coresight devices:
>$ ls /sys/bus/coresight/devices
trbe0 trbe1 trbe2 trbe3
The trbe<N> named TRBEs are associated with a CPU.:
>$ ls /sys/bus/coresight/devices/trbe0/
align flag
-
Key file items are:-
-
align: TRBE write pointer alignment -
flag: TRBE updates memory with access and dirty flags
-
Coresight - HW Assisted Tracing on ARM
Peios Kernel / Kernel development / Trace / coresight
Author: Mathieu Poirier <mathieu.poirier@linaro.org>
Date: September 11th, 2014
Introduction #
Coresight is an umbrella of technologies allowing for the debugging of ARM based SoC. It includes solutions for JTAG and HW assisted tracing. This document is concerned with the latter.
HW assisted tracing is becoming increasingly useful when dealing with systems that have many SoCs and other components like GPU and DMA engines. ARM has developed a HW assisted tracing solution by means of different components, each being added to a design at synthesis time to cater to specific tracing needs. Components are generally categorised as source, link and sinks and are (usually) discovered using the AMBA bus.
"Sources" generate a compressed stream representing the processor instruction path based on tracing scenarios as configured by users. From there the stream flows through the coresight system (via ATB bus) using links that are connecting the emanating source to a sink(s). Sinks serve as endpoints to the coresight implementation, either storing the compressed stream in a memory buffer or creating an interface to the outside world where data can be transferred to a host without fear of filling up the onboard coresight memory buffer.
At typical coresight system would look like this:
*****************************************************************
**************************** AMBA AXI ****************************===||
***************************************************************** ||
^ ^ | ||
| | * **
0000000 ::::: 0000000 ::::: ::::: @@@@@@@ ||||||||||||
0 CPU 0<-->: C : 0 CPU 0<-->: C : : C : @ STM @ || System ||
|->0000000 : T : |->0000000 : T : : T :<--->@@@@@ || Memory ||
| #######<-->: I : | #######<-->: I : : I : @@@<-| ||||||||||||
| # ETM # ::::: | # PTM # ::::: ::::: @ |
| ##### ^ ^ | ##### ^ ! ^ ! . | |||||||||
| |->### | ! | |->### | ! | ! . | || DAP ||
| | # | ! | | # | ! | ! . | |||||||||
| | . | ! | | . | ! | ! . | | |
| | . | ! | | . | ! | ! . | | *
| | . | ! | | . | ! | ! . | | SWD/
| | . | ! | | . | ! | ! . | | JTAG
*****************************************************************<-|
*************************** AMBA Debug APB ************************
*****************************************************************
| . ! . ! ! . |
| . * . * * . |
*****************************************************************
******************** Cross Trigger Matrix (CTM) *******************
*****************************************************************
| . ^ . . |
| * ! * * |
*****************************************************************
****************** AMBA Advanced Trace Bus (ATB) ******************
*****************************************************************
| ! =============== |
| * ===== F =====<---------|
| ::::::::: ==== U ====
|-->:: CTI ::<!! === N ===
| ::::::::: ! == N ==
| ^ * == E ==
| ! &&&&&&&&& IIIIIII == L ==
|------>&& ETB &&<......II I =======
| ! &&&&&&&&& II I .
| ! I I .
| ! I REP I<..........
| ! I I
| !!>&&&&&&&&& II I *Source: ARM ltd.
|------>& TPIU &<......II I DAP = Debug Access Port
&&&&&&&&& IIIIIII ETM = Embedded Trace Macrocell
; PTM = Program Trace Macrocell
; CTI = Cross Trigger Interface
* ETB = Embedded Trace Buffer
To trace port TPIU= Trace Port Interface Unit
SWD = Serial Wire Debug
While on target configuration of the components is done via the APB bus, all trace data are carried out-of-band on the ATB bus. The CTM provides a way to aggregate and distribute signals between CoreSight components.
The coresight framework provides a central point to represent, configure and manage coresight devices on a platform. This first implementation centers on the basic tracing functionality, enabling components such ETM/PTM, funnel, replicator, TMC, TPIU and ETB. Future work will enable more intricate IP blocks such as STM and CTI.
Acronyms and Classification #
Acronyms:
-
PTM:
Program Trace Macrocell
-
ETM:
Embedded Trace Macrocell
-
STM:
System trace Macrocell
-
ETB:
Embedded Trace Buffer
-
ITM:
Instrumentation Trace Macrocell
-
TPIU:
Trace Port Interface Unit
-
TMC-ETR:
Trace Memory Controller, configured as Embedded Trace Router
-
TMC-ETF:
Trace Memory Controller, configured as Embedded Trace FIFO
-
CTI:
Cross Trigger Interface
Classification:
-
Source:
ETMv3.x ETMv4, PTMv1.0, PTMv1.1, STM, STM500, ITM
-
Link:
Funnel, replicator (intelligent or not), TMC-ETR
-
Sinks:
ETBv1.0, ETB1.1, TPIU, TMC-ETF
-
Misc:
CTI
Device Tree Bindings #
See Documentation/devicetree/bindings/arm/arm,coresight-*.yaml for details.
As of this writing drivers for ITM, STMs and CTIs are not provided but are expected to be added as the solution matures.
Framework and implementation #
The coresight framework provides a central point to represent, configure and manage coresight devices on a platform. Any coresight compliant device can register with the framework for as long as they use the right APIs:
struct coresight_device *;
void ;
The registering function is taking a struct coresight_desc *desc and register the device with the core framework. The unregister function takes a reference to a struct coresight_device *csdev obtained at registration time.
If everything goes well during the registration process the new devices will show up under /sys/bus/coresight/devices, as showns here for a TC2 platform:
root:~# ls /sys/bus/coresight/devices/
replicator 20030000.tpiu 2201c000.ptm 2203c000.etm 2203e000.etm
20010000.etb 20040000.funnel 2201d000.ptm 2203d000.etm
root:~#
The functions take a struct coresight_device, which looks like this:
struct coresight_desc {
enum coresight_dev_type type;
struct coresight_dev_subtype subtype;
const struct coresight_ops *ops;
struct coresight_platform_data *pdata;
struct device *dev;
const struct attribute_group **groups;
};
The "coresight_dev_type" identifies what the device is, i.e, source link or sink while the "coresight_dev_subtype" will characterise that type further.
The struct coresight_ops is mandatory and will tell the framework how to perform base operations related to the components, each component having a different set of requirement. For that struct coresight_ops_sink, struct coresight_ops_link and struct coresight_ops_source have been provided.
The next field struct coresight_platform_data *pdata is acquired by calling of_get_coresight_platform_data(), as part of the driver's _probe routine and struct device *dev gets the device reference embedded in the amba_device:
static int etm_probe(struct amba_device *adev, const struct amba_id *id)
{
...
...
drvdata->dev = &adev->dev;
...
}
Specific class of device (source, link, or sink) have generic operations that can be performed on them (see struct coresight_ops). The **groups is a list of sysfs entries pertaining to operations specific to that component only. "Implementation defined" customisations are expected to be accessed and controlled using those entries.
Device Naming scheme #
The devices that appear on the "coresight" bus were named the same as their parent devices, i.e, the real devices that appears on AMBA bus or the platform bus. Thus the names were based on the Linux Open Firmware layer naming convention, which follows the base physical address of the device followed by the device type. e.g:
root:~# ls /sys/bus/coresight/devices/
20010000.etf 20040000.funnel 20100000.stm 22040000.etm
22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu
20070000.etr 20120000.replicator 220c0000.funnel
23040000.etm 23140000.etm 23340000.etm
However, with the introduction of ACPI support, the names of the real devices are a bit cryptic and non-obvious. Thus, a new naming scheme was introduced to use more generic names based on the type of the device. The following rules apply:
1) Devices that are bound to CPUs, are named based on the CPU logical
number.
e.g, ETM bound to CPU0 is named "etm0"
2) All other devices follow a pattern, "<device_type_prefix>N", where :
<device_type_prefix> - A prefix specific to the type of the device
N - a sequential number assigned based on the order
of probing.
e.g, tmc_etf0, tmc_etr0, funnel0, funnel1
Thus, with the new scheme the devices could appear as
root:~# ls /sys/bus/coresight/devices/
etm0 etm1 etm2 etm3 etm4 etm5 funnel0
funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0
Some of the examples below might refer to old naming scheme and some to the newer scheme, to give a confirmation that what you see on your system is not unexpected. One must use the "names" as they appear on the system under specified locations.
Topology Representation #
Each CoreSight component has a connections directory which will contain links to other CoreSight components. This allows the user to explore the trace topology and for larger systems, determine the most appropriate sink for a given source. The connection information can also be used to establish which CTI devices are connected to a given component. This directory contains a nr_links attribute detailing the number of links in the directory.
For an ETM source, in this case etm0 on a Juno platform, a typical arrangement will be:
linaro-developer:~# ls - l /sys/bus/coresight/devices/etm0/connections
<file details> cti_cpu0 -> ../../../23020000.cti/cti_cpu0
<file details> nr_links
<file details> out:0 -> ../../../230c0000.funnel/funnel2
Following the out port to funnel2:
linaro-developer:~# ls -l /sys/bus/coresight/devices/funnel2/connections
<file details> in:0 -> ../../../23040000.etm/etm0
<file details> in:1 -> ../../../23140000.etm/etm3
<file details> in:2 -> ../../../23240000.etm/etm4
<file details> in:3 -> ../../../23340000.etm/etm5
<file details> nr_links
<file details> out:0 -> ../../../20040000.funnel/funnel0
And again to funnel0:
linaro-developer:~# ls -l /sys/bus/coresight/devices/funnel0/connections
<file details> in:0 -> ../../../220c0000.funnel/funnel1
<file details> in:1 -> ../../../230c0000.funnel/funnel2
<file details> nr_links
<file details> out:0 -> ../../../20010000.etf/tmc_etf0
Finding the first sink tmc_etf0. This can be used to collect data as a sink, or as a link to propagate further along the chain:
linaro-developer:~# ls -l /sys/bus/coresight/devices/tmc_etf0/connections
<file details> cti_sys0 -> ../../../20020000.cti/cti_sys0
<file details> in:0 -> ../../../20040000.funnel/funnel0
<file details> nr_links
<file details> out:0 -> ../../../20150000.funnel/funnel4
via funnel4:
linaro-developer:~# ls -l /sys/bus/coresight/devices/funnel4/connections
<file details> in:0 -> ../../../20010000.etf/tmc_etf0
<file details> in:1 -> ../../../20140000.etf/tmc_etf1
<file details> nr_links
<file details> out:0 -> ../../../20120000.replicator/replicator0
and a replicator0:
linaro-developer:~# ls -l /sys/bus/coresight/devices/replicator0/connections
<file details> in:0 -> ../../../20150000.funnel/funnel4
<file details> nr_links
<file details> out:0 -> ../../../20030000.tpiu/tpiu0
<file details> out:1 -> ../../../20070000.etr/tmc_etr0
Arriving at the final sink in the chain, tmc_etr0:
linaro-developer:~# ls -l /sys/bus/coresight/devices/tmc_etr0/connections
<file details> cti_sys0 -> ../../../20020000.cti/cti_sys0
<file details> in:0 -> ../../../20120000.replicator/replicator0
<file details> nr_links
As described below, when using sysfs it is sufficient to enable a sink and a source for successful trace. The framework will correctly enable all intermediate links as required.
Note: cti_sys0 appears in two of the connections lists above. CTIs can connect to multiple devices and are arranged in a star topology via the CTM. See (Documentation/trace/coresight/coresight-ect.rst) 4 for further details. Looking at this device we see 4 connections:
linaro-developer:~# ls -l /sys/bus/coresight/devices/cti_sys0/connections
<file details> nr_links
<file details> stm0 -> ../../../20100000.stm/stm0
<file details> tmc_etf0 -> ../../../20010000.etf/tmc_etf0
<file details> tmc_etr0 -> ../../../20070000.etr/tmc_etr0
<file details> tpiu0 -> ../../../20030000.tpiu/tpiu0
How to use the tracer modules #
There are two ways to use the Coresight framework:
-
using the perf cmd line tools.
-
interacting directly with the Coresight devices using the sysFS interface.
Preference is given to the former as using the sysFS interface requires a deep understanding of the Coresight HW. The following sections provide details on using both methods.
Using the sysFS interface #
Before trace collection can start, a coresight sink needs to be identified. There is no limit on the amount of sinks (nor sources) that can be enabled at any given moment. As a generic operation, all device pertaining to the sink class will have an "active" entry in sysfs:
root:/sys/bus/coresight/devices# ls
replicator 20030000.tpiu 2201c000.ptm 2203c000.etm 2203e000.etm
20010000.etb 20040000.funnel 2201d000.ptm 2203d000.etm
root:/sys/bus/coresight/devices# ls 20010000.etb
enable_sink status trigger_cntr
root:/sys/bus/coresight/devices# echo 1 > 20010000.etb/enable_sink
root:/sys/bus/coresight/devices# cat 20010000.etb/enable_sink
1
root:/sys/bus/coresight/devices#
At boot time the current etm3x driver will configure the first address comparator with "_stext" and "_etext", essentially tracing any instruction that falls within that range. As such "enabling" a source will immediately trigger a trace capture:
root:/sys/bus/coresight/devices# echo 1 > 2201c000.ptm/enable_source
root:/sys/bus/coresight/devices# cat 2201c000.ptm/enable_source
1
root:/sys/bus/coresight/devices# cat 20010000.etb/status
Depth: 0x2000
Status: 0x1
RAM read ptr: 0x0
RAM wrt ptr: 0x19d3 <----- The write pointer is moving
Trigger cnt: 0x0
Control: 0x1
Flush status: 0x0
Flush ctrl: 0x2001
root:/sys/bus/coresight/devices#
Trace collection is stopped the same way:
root:/sys/bus/coresight/devices# echo 0 > 2201c000.ptm/enable_source
root:/sys/bus/coresight/devices#
The content of the ETB buffer can be harvested directly from /dev:
root:/sys/bus/coresight/devices# dd if=/dev/20010000.etb \
of=~/cstrace.bin
64+0 records in
64+0 records out
32768 bytes (33 kB) copied, 0.00125258 s, 26.2 MB/s
root:/sys/bus/coresight/devices#
The file cstrace.bin can be decompressed using "ptm2human", DS-5 or Trace32.
Following is a DS-5 output of an experimental loop that increments a variable up to a certain value. The example is simple and yet provides a glimpse of the wealth of possibilities that coresight provides.
Info Tracing enabled
Instruction 106378866 0x8026B53C E52DE004 false PUSH {lr}
Instruction 0 0x8026B540 E24DD00C false SUB sp,sp,#0xc
Instruction 0 0x8026B544 E3A03000 false MOV r3,#0
Instruction 0 0x8026B548 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B54C E59D3004 false LDR r3,[sp,#4]
Instruction 0 0x8026B550 E3530004 false CMP r3,#4
Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1
Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c
Timestamp Timestamp: 17106715833
Instruction 319 0x8026B54C E59D3004 false LDR r3,[sp,#4]
Instruction 0 0x8026B550 E3530004 false CMP r3,#4
Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1
Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c
Instruction 9 0x8026B54C E59D3004 false LDR r3,[sp,#4]
Instruction 0 0x8026B550 E3530004 false CMP r3,#4
Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1
Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c
Instruction 7 0x8026B54C E59D3004 false LDR r3,[sp,#4]
Instruction 0 0x8026B550 E3530004 false CMP r3,#4
Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1
Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c
Instruction 7 0x8026B54C E59D3004 false LDR r3,[sp,#4]
Instruction 0 0x8026B550 E3530004 false CMP r3,#4
Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1
Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c
Instruction 10 0x8026B54C E59D3004 false LDR r3,[sp,#4]
Instruction 0 0x8026B550 E3530004 false CMP r3,#4
Instruction 0 0x8026B554 E2833001 false ADD r3,r3,#1
Instruction 0 0x8026B558 E58D3004 false STR r3,[sp,#4]
Instruction 0 0x8026B55C DAFFFFFA true BLE {pc}-0x10 ; 0x8026b54c
Instruction 6 0x8026B560 EE1D3F30 false MRC p15,#0x0,r3,c13,c0,#1
Instruction 0 0x8026B564 E1A0100D false MOV r1,sp
Instruction 0 0x8026B568 E3C12D7F false BIC r2,r1,#0x1fc0
Instruction 0 0x8026B56C E3C2203F false BIC r2,r2,#0x3f
Instruction 0 0x8026B570 E59D1004 false LDR r1,[sp,#4]
Instruction 0 0x8026B574 E59F0010 false LDR r0,[pc,#16] ; [0x8026B58C] = 0x80550368
Instruction 0 0x8026B578 E592200C false LDR r2,[r2,#0xc]
Instruction 0 0x8026B57C E59221D0 false LDR r2,[r2,#0x1d0]
Instruction 0 0x8026B580 EB07A4CF true BL {pc}+0x1e9344 ; 0x804548c4
Info Tracing enabled
Instruction 13570831 0x8026B584 E28DD00C false ADD sp,sp,#0xc
Instruction 0 0x8026B588 E8BD8000 true LDM sp!,{pc}
Timestamp Timestamp: 17107041535
Using perf framework #
Coresight tracers are represented using the Perf framework's Performance Monitoring Unit (PMU) abstraction. As such the perf framework takes charge of controlling when tracing gets enabled based on when the process of interest is scheduled. When configured in a system, Coresight PMUs will be listed when queried by the perf command line tool:
linaro@linaro-nano:~$ ./perf list pmu
List of pre-defined events (to be used in -e):
cs_etm// [Kernel PMU event]
Regardless of the number of tracers available in a system (usually equal to the amount of processor cores), the "cs_etm" PMU will be listed only once.
A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is provided along with configuration options within forward slashes '/' (see Config option formats).
Advanced Perf framework usage #
Sink selection #
An appropriate sink will be selected automatically for use with Perf, but since there will typically be more than one sink, the name of the sink to use may be specified as a special config option prefixed with '@'.
The available sinks are listed in sysFS under ($SYSFS)/bus/event_source/devices/cs_etm/sinks/:
root@localhost:/sys/bus/event_source/devices/cs_etm/sinks# ls
tmc_etf0 tmc_etr0 tpiu0
root@linaro-nano:~# perf record -e cs_etm/@tmc_etr0/u --per-thread program
More information on the above and other example on how to use Coresight with the perf tools can be found in the "HOWTO.md" file of the openCSD gitHub repository 3.
AutoFDO analysis using the perf tools #
perf can be used to record and analyze trace of programs.
Execution can be recorded using 'perf record' with the cs_etm event, specifying the name of the sink to record to, e.g:
perf record -e cs_etm//u --per-thread
The 'perf report' and 'perf script' commands can be used to analyze execution, synthesizing instruction and branch events from the instruction trace. 'perf inject' can be used to replace the trace data with the synthesized events. The --itrace option controls the type and frequency of synthesized events (see perf documentation).
Note that only 64-bit programs are currently supported - further work is required to support instruction decode of 32-bit Arm programs.
Tracing PID #
The kernel can be built to write the PID value into the PE ContextID registers. For a kernel running at EL1, the PID is stored in CONTEXTIDR_EL1. A PE may implement Arm Virtualization Host Extensions (VHE), which the kernel can run at EL2 as a virtualisation host; in this case, the PID value is stored in CONTEXTIDR_EL2.
perf provides PMU formats that program the ETM to insert these values into the trace data; the PMU formats are defined as below:
"contextid1": Available on both EL1 kernel and EL2 kernel. When the
kernel is running at EL1, "contextid1" enables the PID tracing; when the kernel is running at EL2, this enables tracing the PID of guest applications.
"contextid2": Only usable when the kernel is running at EL2. When
selected, enables PID tracing on EL2 kernel.
"contextid": Will be an alias for the option that enables PID
tracing. I.e, contextid == contextid1, on EL1 kernel. contextid == contextid2, on EL2 kernel.
perf will always enable PID tracing at the relevant EL, this is accomplished by automatically enable the "contextid" config - but for EL2 it is possible to make specific adjustments using configs "contextid1" and "contextid2", E.g. if a user wants to trace PIDs for both host and guest, the two configs "contextid1" and "contextid2" can be set at the same time:
perf record -e cs_etm/contextid1,contextid2/u -- vm
Generating coverage files for Feedback Directed Optimization: AutoFDO #
'perf inject' accepts the --itrace option in which case tracing data is removed and replaced with the synthesized events. e.g.
perf inject --itrace --strip -i perf.data -o perf.data.new
Below is an example of using ARM ETM for autoFDO. It requires autofdo (https://github.com/google/autofdo) and gcc version 5. The bubble sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tutorial).
$ gcc-5 -O3 sort.c -o sort
$ taskset -c 2 ./sort
Bubble sorting array of 30000 elements
5910 ms
$ perf record -e cs_etm//u --per-thread taskset -c 2 ./sort
Bubble sorting array of 30000 elements
12543 ms
[ perf record: Woken up 35 times to write data ]
[ perf record: Captured and wrote 69.640 MB perf.data ]
$ perf inject -i perf.data -o inj.data --itrace=il64 --strip
$ create_gcov --binary=./sort --profile=inj.data --gcov=sort.gcov -gcov_version=1
$ gcc-5 -O3 -fauto-profile=sort.gcov sort.c -o sort_autofdo
$ taskset -c 2 ./sort_autofdo
Bubble sorting array of 30000 elements
5806 ms
Config option formats #
The following strings can be provided between // on the perf command line to enable various options. They are also listed in the folder /sys/bus/event_source/devices/cs_etm/format/
|
Option |
Description |
|---|---|
|
branch_broadcast |
Session local version of the system wide setting: ETM_MODE_BB |
|
contextid |
See Tracing PID |
|
contextid1 |
See Tracing PID |
|
contextid2 |
See Tracing PID |
|
configid |
Selection for a custom configuration. This is an implementation detail and not used directly, see using configurations in perf |
|
preset |
Override for parameters in a custom configuration, see using configurations in perf |
|
sinkid |
Hashed version of the string to select a sink, automatically set when using the @ notation. This is an internal implementation detail and is not used directly, see Using perf framework. |
|
cycacc |
Session local version of the system wide setting: ETMv4_MODE_CYCACC |
|
retstack |
Session local version of the system wide setting: ETM_MODE_RETURNSTACK |
|
timestamp |
Controls generation and interval of timestamps. 0 = off, 1 = minimum interval .. 15 = maximum interval. Values 1 - 14 use a counter that decrements every cycle to generate a timestamp on underflow. The reload value for the counter is 2 ^ (interval - 1). If the value is 1 then the reload value is 1, if the value is 11 then the reload value is 1024 etc. Setting the maximum interval (15) will disable the counter generated timestamps, freeing the counter resource, leaving only ones emitted when a SYNC packet is generated. The sync interval is controlled with TRCSYNCPR.PERIOD which is every 4096 bytes of trace by default. |
|
cc_threshold |
Cycle count threshold value. If nothing is provided here or the provided value is 0, then the default value i.e 0x100 will be used. If provided value is less than minimum cycles threshold value, as indicated via TRCIDR3.CCITMIN, then the minimum value will be used instead. |
How to use the STM module #
Using the System Trace Macrocell module is the same as the tracers - the only difference is that clients are driving the trace capture rather than the program flow through the code.
As with any other CoreSight component, specifics about the STM tracer can be found in sysfs with more information on each entry being found in 1:
root@genericarmv8:~# ls /sys/bus/coresight/devices/stm0
enable_source hwevent_select port_enable subsystem uevent
hwevent_enable mgmt port_select traceid
root@genericarmv8:~#
Like any other source a sink needs to be identified and the STM enabled before being used:
root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/stm0/enable_source
From there user space applications can request and use channels using the devfs interface provided for that purpose by the generic STM API:
root@genericarmv8:~# ls -l /dev/stm0
crw------- 1 root root 10, 61 Jan 3 18:11 /dev/stm0
root@genericarmv8:~#
Details on how to use the generic STM API can be found here: - Documentation/trace/stm.rst 2.
The CTI & CTM Modules #
The CTI (Cross Trigger Interface) provides a set of trigger signals between individual CTIs and components, and can propagate these between all CTIs via channels on the CTM (Cross Trigger Matrix).
A separate documentation file is provided to explain the use of these devices. (Documentation/trace/coresight/coresight-ect.rst) 4.
CoreSight System Configuration #
CoreSight components can be complex devices with many programming options. Furthermore, components can be programmed to interact with each other across the complete system.
A CoreSight System Configuration manager is provided to allow these complex programming configurations to be selected and used easily from perf and sysfs.
See the separate document for further information. (Documentation/trace/coresight/coresight-config.rst) 5.
[1] Documentation/ABI/testing/sysfs-bus-coresight-devices-stm
[2] Documentation/trace/stm.rst
[3] https://github.com/Linaro/perf-opencsd
Using Coresight for Kernel panic and Watchdog reset
Peios Kernel / Kernel development / Trace / coresight
Introduction #
This documentation is about using Linux coresight trace support to debug kernel panic and watchdog reset scenarios.
Coresight trace during Kernel panic #
From the coresight driver point of view, addressing the kernel panic situation has four main requirements.
-
a. Support for allocation of trace buffer pages from reserved memory area. Platform can advertise this using a new device tree property added to relevant coresight nodes.
-
b. Support for stopping coresight blocks at the time of panic
-
c. Saving required metadata in the specified format
-
d. Support for reading trace data captured at the time of panic
Allocation of trace buffer pages from reserved RAM #
A new optional device tree property "memory-region" is added to the Coresight TMC device nodes, that would give the base address and size of trace buffer.
Static allocation of trace buffers would ensure that both IOMMU enabled and disabled cases are handled. Also, platforms that support persistent RAM will allow users to read trace data in the subsequent boot without booting the crashdump kernel.
Note: For ETR sink devices, this reserved region will be used for both trace capture and trace data retrieval. For ETF sink devices, internal SRAM would be used for trace capture, and they would be synced to reserved region for retrieval.
Disabling coresight blocks at the time of panic #
In order to avoid the situation of losing relevant trace data after a kernel panic, it would be desirable to stop the coresight blocks at the time of panic.
This can be achieved by configuring the comparator, CTI and sink devices as below:
Trigger on panic
Comparator --->External out --->CTI -->External In---->ETR/ETF stop
Saving metadata at the time of kernel panic #
Coresight metadata involves all additional data that are required for a successful trace decode in addition to the trace data. This involves ETR/ETF/ETB register snapshot etc.
A new optional device property "memory-region" is added to the ETR/ETF/ETB device nodes for this.
Reading trace data captured at the time of panic #
Trace data captured at the time of panic, can be read from rebooted kernel or from crashdump kernel using a special device file /dev/crash_tmc_xxx. This device file is created only when there is a valid crashdata available.
General flow of trace capture and decode in case of kernel panic #
-
Enable source and sink on all the cores using the sysfs interface. ETR sinks should have trace buffers allocated from reserved memory, by selecting "resrv" buffer mode from sysfs.
-
Run relevant tests.
-
On a kernel panic, all coresight blocks are disabled, necessary metadata is synced by kernel panic handler.
System would eventually reboot or boot a crashdump kernel.
-
For platforms that supports crashdump kernel, raw trace data can be dumped using the coresight sysfs interface from the crashdump kernel itself. Persistent RAM is not a requirement in this case.
-
For platforms that supports persistent RAM, trace data can be dumped using the coresight sysfs interface in the subsequent Linux boot. Crashdump kernel is not a requirement in this case. Persistent RAM ensures that trace data is intact across reboot.
Coresight trace during Watchdog reset #
The main difference between addressing the watchdog reset and kernel panic case are below,
-
a. Saving coresight metadata need to be taken care by the SCP(system control processor) firmware in the specified format, instead of kernel.
-
b. Reserved memory region given by firmware for trace buffer and metadata has to be in persistent RAM. Note: This is a requirement for watchdog reset case but optional in kernel panic case.
Watchdog reset can be supported only on platforms that meet the above two requirements.
Sample commands for testing a Kernel panic case with ETR sink #
-
Boot Linux kernel with "crash_kexec_post_notifiers" added to the kernel bootargs. This is mandatory if the user would like to read the tracedata from the crashdump kernel.
-
Enable the preloaded ETM configuration:
#echo 1 > /sys/kernel/config/cs-syscfg/configurations/panicstop/enable -
Configure CTI using sysfs interface:
#./cti_setup.sh #cat cti_setup.sh cd /sys/bus/coresight/devices/ ap_cti_config () { #ETM trig out[0] trigger to Channel 0 echo 0 4 > channels/trigin_attach } etf_cti_config () { #ETF Flush in trigger from Channel 0 echo 0 1 > channels/trigout_attach echo 1 > channels/trig_filter_enable } etr_cti_config () { #ETR Flush in from Channel 0 echo 0 1 > channels/trigout_attach echo 1 > channels/trig_filter_enable } ctidevs=`find . -name "cti*"` for i in $ctidevs do cd $i connection=`find . -name "ete*"` if [ ! -z "$connection" ] then echo "AP CTI config for $i" ap_cti_config fi connection=`find . -name "tmc_etf*"` if [ ! -z "$connection" ] then echo "ETF CTI config for $i" etf_cti_config fi connection=`find . -name "tmc_etr*"` if [ ! -z "$connection" ] then echo "ETR CTI config for $i" etr_cti_config fi cd .. done
Note: CTI connections are SOC specific and hence the above script is added just for reference.
-
Choose reserved buffer mode for ETR buffer:
#echo "resrv" > /sys/bus/coresight/devices/tmc_etr0/buf_mode_preferred -
Enable stop on flush trigger configuration:
#echo 1 > /sys/bus/coresight/devices/tmc_etr0/stop_on_flush -
Start Coresight tracing on cores 1 and 2 using sysfs interface
-
Run some application on core 1:
#taskset -c 1 dd if=/dev/urandom of=/dev/null & -
Invoke kernel panic on core 2:
#echo 1 > /proc/sys/kernel/panic #taskset -c 2 echo c > /proc/sysrq-trigger -
From rebooted kernel or crashdump kernel, read crashdata:
#dd if=/dev/crash_tmc_etr0 of=/trace/cstrace.bin -
Run opencsd decoder tools/scripts to generate the instruction trace.
Sample instruction trace dump #
Core1 dump:
A etm4_enable_hw: ffff800008ae1dd4
CONTEXT EL2 etm4_enable_hw: ffff800008ae1dd4
I etm4_enable_hw: ffff800008ae1dd4:
d503201f nop
I etm4_enable_hw: ffff800008ae1dd8:
d503201f nop
I etm4_enable_hw: ffff800008ae1ddc:
d503201f nop
I etm4_enable_hw: ffff800008ae1de0:
d503201f nop
I etm4_enable_hw: ffff800008ae1de4:
d503201f nop
I etm4_enable_hw: ffff800008ae1de8:
d503233f paciasp
I etm4_enable_hw: ffff800008ae1dec:
a9be7bfd stp x29, x30, [sp, #-32]!
I etm4_enable_hw: ffff800008ae1df0:
910003fd mov x29, sp
I etm4_enable_hw: ffff800008ae1df4:
a90153f3 stp x19, x20, [sp, #16]
I etm4_enable_hw: ffff800008ae1df8:
2a0003f4 mov w20, w0
I etm4_enable_hw: ffff800008ae1dfc:
900085b3 adrp x19, ffff800009b95000 <reserved_mem+0xc48>
I etm4_enable_hw: ffff800008ae1e00:
910f4273 add x19, x19, #0x3d0
I etm4_enable_hw: ffff800008ae1e04:
f8747a60 ldr x0, [x19, x20, lsl #3]
E etm4_enable_hw: ffff800008ae1e08:
b4000140 cbz x0, ffff800008ae1e30 <etm4_starting_cpu+0x50>
I 149.039572921 etm4_enable_hw: ffff800008ae1e30:
a94153f3 ldp x19, x20, [sp, #16]
I 149.039572921 etm4_enable_hw: ffff800008ae1e34:
52800000 mov w0, #0x0 // #0
I 149.039572921 etm4_enable_hw: ffff800008ae1e38:
a8c27bfd ldp x29, x30, [sp], #32
..snip
149.052324811 chacha_block_generic: ffff800008642d80:
9100a3e0 add x0,
I 149.052324811 chacha_block_generic: ffff800008642d84:
b86178a2 ldr w2, [x5, x1, lsl #2]
I 149.052324811 chacha_block_generic: ffff800008642d88:
8b010803 add x3, x0, x1, lsl #2
I 149.052324811 chacha_block_generic: ffff800008642d8c:
b85fc063 ldur w3, [x3, #-4]
I 149.052324811 chacha_block_generic: ffff800008642d90:
0b030042 add w2, w2, w3
I 149.052324811 chacha_block_generic: ffff800008642d94:
b8217882 str w2, [x4, x1, lsl #2]
I 149.052324811 chacha_block_generic: ffff800008642d98:
91000421 add x1, x1, #0x1
I 149.052324811 chacha_block_generic: ffff800008642d9c:
f100443f cmp x1, #0x11
Core 2 dump:
A etm4_enable_hw: ffff800008ae1dd4
CONTEXT EL2 etm4_enable_hw: ffff800008ae1dd4
I etm4_enable_hw: ffff800008ae1dd4:
d503201f nop
I etm4_enable_hw: ffff800008ae1dd8:
d503201f nop
I etm4_enable_hw: ffff800008ae1ddc:
d503201f nop
I etm4_enable_hw: ffff800008ae1de0:
d503201f nop
I etm4_enable_hw: ffff800008ae1de4:
d503201f nop
I etm4_enable_hw: ffff800008ae1de8:
d503233f paciasp
I etm4_enable_hw: ffff800008ae1dec:
a9be7bfd stp x29, x30, [sp, #-32]!
I etm4_enable_hw: ffff800008ae1df0:
910003fd mov x29, sp
I etm4_enable_hw: ffff800008ae1df4:
a90153f3 stp x19, x20, [sp, #16]
I etm4_enable_hw: ffff800008ae1df8:
2a0003f4 mov w20, w0
I etm4_enable_hw: ffff800008ae1dfc:
900085b3 adrp x19, ffff800009b95000 <reserved_mem+0xc48>
I etm4_enable_hw: ffff800008ae1e00:
910f4273 add x19, x19, #0x3d0
I etm4_enable_hw: ffff800008ae1e04:
f8747a60 ldr x0, [x19, x20, lsl #3]
E etm4_enable_hw: ffff800008ae1e08:
b4000140 cbz x0, ffff800008ae1e30 <etm4_starting_cpu+0x50>
I 149.046243445 etm4_enable_hw: ffff800008ae1e30:
a94153f3 ldp x19, x20, [sp, #16]
I 149.046243445 etm4_enable_hw: ffff800008ae1e34:
52800000 mov w0, #0x0 // #0
I 149.046243445 etm4_enable_hw: ffff800008ae1e38:
a8c27bfd ldp x29, x30, [sp], #32
I 149.046243445 etm4_enable_hw: ffff800008ae1e3c:
d50323bf autiasp
E 149.046243445 etm4_enable_hw: ffff800008ae1e40:
d65f03c0 ret
A ete_sysreg_write: ffff800008adfa18
..snip
I 149.05422547 panic: ffff800008096300:
a90363f7 stp x23, x24, [sp, #48]
I 149.05422547 panic: ffff800008096304:
6b00003f cmp w1, w0
I 149.05422547 panic: ffff800008096308:
3a411804 ccmn w0, #0x1, #0x4, ne // ne = any
N 149.05422547 panic: ffff80000809630c:
540001e0 b.eq ffff800008096348 <panic+0xe0> // b.none
I 149.05422547 panic: ffff800008096310:
f90023f9 str x25, [sp, #64]
E 149.05422547 panic: ffff800008096314:
97fe44ef bl ffff8000080276d0 <panic_smp_self_stop>
A panic: ffff80000809634c
I 149.05422547 panic: ffff80000809634c:
910102d5 add x21, x22, #0x40
I 149.05422547 panic: ffff800008096350:
52800020 mov w0, #0x1 // #1
E 149.05422547 panic: ffff800008096354:
94166b8b bl ffff800008631180 <bust_spinlocks>
N 149.054225518 bust_spinlocks: ffff800008631180:
340000c0 cbz w0, ffff800008631198 <bust_spinlocks+0x18>
I 149.054225518 bust_spinlocks: ffff800008631184:
f000a321 adrp x1, ffff800009a98000 <pbufs.0+0xbb8>
I 149.054225518 bust_spinlocks: ffff800008631188:
b9405c20 ldr w0, [x1, #92]
I 149.054225518 bust_spinlocks: ffff80000863118c:
11000400 add w0, w0, #0x1
I 149.054225518 bust_spinlocks: ffff800008631190:
b9005c20 str w0, [x1, #92]
E 149.054225518 bust_spinlocks: ffff800008631194:
d65f03c0 ret
A panic: ffff800008096358
Perf based testing #
Starting perf session #
ETF:
perf record -e cs_etm/panicstop,@tmc_etf1/ -C 1
perf record -e cs_etm/panicstop,@tmc_etf2/ -C 2
ETR:
perf record -e cs_etm/panicstop,@tmc_etr0/ -C 1,2
Reading trace data after panic #
Same sysfs based method explained above can be used to retrieve and decode the trace data after the reboot on kernel panic.
UltraSoc - HW Assisted Tracing on SoC
Peios Kernel / Kernel development / Trace / coresight
Author: Qi Liu <liuqi115@huawei.com>
Date: January 2023
Introduction #
UltraSoc SMB is a per SCCL (Super CPU Cluster) hardware. It provides a way to buffer and store CPU trace messages in a region of shared system memory. The device acts as a coresight sink device and the corresponding trace generators (ETM) are attached as source devices.
Sysfs files and directories #
The SMB devices appear on the existing coresight bus alongside other devices:
$# ls /sys/bus/coresight/devices/
ultra_smb0 ultra_smb1 ultra_smb2 ultra_smb3
The ultra_smb<N> names SMB device associated with SCCL.:
$# ls /sys/bus/coresight/devices/ultra_smb0
enable_sink mgmt
$# ls /sys/bus/coresight/devices/ultra_smb0/mgmt
buf_size buf_status read_pos write_pos
Key file items are:
read_pos: Shows the value on the read pointer register.
write_pos: Shows the value on the write pointer register.
buf_status: Shows the value on the status register. BIT(0) is zero value which means the buffer is empty.
buf_size: Shows the buffer size of each device.
Firmware Bindings #
The device is only supported with ACPI. Its binding describes device identifier, resource information and graph structure.
The device is identified as ACPI HID "HISI03A1". Device resources are allocated using the _CRS method. Each device must present two base address; the first one is the configuration base address of the device, the second one is the 32-bit base address of shared system memory.
Example:
Device(USMB) { \
Name(_HID, "HISI03A1") \
Name(_CRS, ResourceTemplate() { \
QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, NonCacheable, \
ReadWrite, 0x0, 0x95100000, 0x951FFFFF, 0x0, 0x100000) \
QWordMemory (ResourceConsumer, , MinFixed, MaxFixed, Cacheable, \
ReadWrite, 0x0, 0x50000000, 0x53FFFFFF, 0x0, 0x4000000) \
}) \
Name(_DSD, Package() { \
ToUUID("ab02a46b-74c7-45a2-bd68-f7d344ef2153"), \
/* Use CoreSight Graph ACPI bindings to describe connections topology */
Package() { \
0, \
1, \
Package() { \
1, \
ToUUID("3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"), \
8, \
Package() {0x8, 0, \_SB.S00.SL11.CL28.F008, 0}, \
Package() {0x9, 0, \_SB.S00.SL11.CL29.F009, 0}, \
Package() {0xa, 0, \_SB.S00.SL11.CL2A.F010, 0}, \
Package() {0xb, 0, \_SB.S00.SL11.CL2B.F011, 0}, \
Package() {0xc, 0, \_SB.S00.SL11.CL2C.F012, 0}, \
Package() {0xd, 0, \_SB.S00.SL11.CL2D.F013, 0}, \
Package() {0xe, 0, \_SB.S00.SL11.CL2E.F014, 0}, \
Package() {0xf, 0, \_SB.S00.SL11.CL2F.F015, 0}, \
} \
} \
}) \
}
Runtime Verification
Peios Kernel / Kernel development / Trace / rv
Deterministic Automata Instrumentation
Peios Kernel / Kernel development / Trace / rv
The RV monitor file created by dot2k, with the name "$MODEL_NAME.c" includes a section dedicated to instrumentation.
In the example of the wip.dot monitor created on [1], it will look like:
/*
* This is the instrumentation part of the monitor.
*
* This is the section where manual work is required. Here the kernel events
* are translated into model's event.
*
*/
static void handle_preempt_disable(void *data, /* XXX: fill header */)
{
da_handle_event_wip(preempt_disable_wip);
}
static void handle_preempt_enable(void *data, /* XXX: fill header */)
{
da_handle_event_wip(preempt_enable_wip);
}
static void handle_sched_waking(void *data, /* XXX: fill header */)
{
da_handle_event_wip(sched_waking_wip);
}
static int enable_wip(void)
{
int retval;
retval = da_monitor_init_wip();
if (retval)
return retval;
rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_disable);
rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_enable);
rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_sched_waking);
return 0;
}
The comment at the top of the section explains the general idea: the instrumentation section translates kernel events into the model's event.
Tracing callback functions #
The first three functions are the starting point of the callback handler functions for each of the three events from the wip model. The developer does not necessarily need to use them: they are just starting points.
Using the example of:
void handle_preempt_disable(void *data, /* XXX: fill header */)
{
da_handle_event_wip(preempt_disable_wip);
}
The preempt_disable event from the model connects directly to the preemptirq:preempt_disable. The preemptirq:preempt_disable event has the following signature, from include/trace/events/preemptirq.h:
TP_PROTO(unsigned long ip, unsigned long parent_ip)
Hence, the handle_preempt_disable() function will look like:
void handle_preempt_disable(void *data, unsigned long ip, unsigned long parent_ip)
In this case, the kernel event translates one to one with the automata event, and indeed, no other change is required for this function.
The next handler function, handle_preempt_enable() has the same argument list from the handle_preempt_disable(). The difference is that the preempt_enable event will be used to synchronize the system to the model.
Initially, the model is placed in the initial state. However, the system might or might not be in the initial state. The monitor cannot start processing events until it knows that the system has reached the initial state. Otherwise, the monitor and the system could be out-of-sync.
Looking at the automata definition, it is possible to see that the system and the model are expected to return to the initial state after the preempt_enable execution. Hence, it can be used to synchronize the system and the model at the initialization of the monitoring section.
The start is informed via a special handle function, the "da_handle_start_event_$(MONITOR_NAME)(event)", in this case:
da_handle_start_event_wip(preempt_enable_wip);
So, the callback function will look like:
void handle_preempt_enable(void *data, unsigned long ip, unsigned long parent_ip)
{
da_handle_start_event_wip(preempt_enable_wip);
}
Finally, the "handle_sched_waking()" will look like:
void handle_sched_waking(void *data, struct task_struct *task)
{
da_handle_event_wip(sched_waking_wip);
}
And the explanation is left for the reader as an exercise.
enable and disable functions #
dot2k automatically creates two special functions:
enable_$(MONITOR_NAME)()
disable_$(MONITOR_NAME)()
These functions are called when the monitor is enabled and disabled, respectively.
They should be used to attach and detach the instrumentation to the running system. The developer must add to the relative function all that is needed to attach and detach its monitor to the system.
For the wip case, these functions were named:
enable_wip()
disable_wip()
But no change was required because: by default, these functions attach and detach the tracepoints_to_attach, which was enough for this case.
Instrumentation helpers #
To complete the instrumentation, the handler functions need to be attached to a kernel event, at the monitoring enable phase.
The RV interface also facilitates this step. For example, the macro "rv_attach_trace_probe()" is used to connect the wip model events to the relative kernel event. dot2k automatically adds "rv_attach_trace_probe()" function call for each model event in the enable phase, as a suggestion.
For example, from the wip sample model:
static int enable_wip(void)
{
int retval;
retval = da_monitor_init_wip();
if (retval)
return retval;
rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_enable);
rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_sched_waking);
rv_attach_trace_probe("wip", /* XXX: tracepoint */, handle_preempt_disable);
return 0;
}
The probes then need to be detached at the disable phase.
[1] The wip model is presented in:
The wip monitor is presented in:
Deterministic Automata
Peios Kernel / Kernel development / Trace / rv
Formally, a deterministic automaton, denoted by G, is defined as a quintuple:
G = { X, E, f, x0, Xm }
where:
-
X is the set of states;
-
E is the finite set of events;
-
x0 is the initial state;
-
Xm (subset of X) is the set of marked (or final) states.
-
f : X x E -> X $ is the transition function. It defines the state transition in the occurrence of an event from E in the state X. In the special case of deterministic automata, the occurrence of the event in E in a state in X has a deterministic next state from X.
For example, a given automaton named 'wip' (wakeup in preemptive) can be defined as:
-
X = {
preemptive,non_preemptive} -
E = {
preempt_enable,preempt_disable,sched_waking} -
x0 =
preemptive -
Xm = {
preemptive} -
-
f =
-
f(
preemptive,preempt_disable) =non_preemptive -
f(
non_preemptive,sched_waking) =non_preemptive -
f(
non_preemptive,preempt_enable) =preemptive
-
-
One of the benefits of this formal definition is that it can be presented in multiple formats. For example, using a graphical representation, using vertices (nodes) and edges, which is very intuitive for operating system practitioners, without any loss.
The previous 'wip' automaton can also be represented as:
preempt_enable
+---------------------------------+
v |
#============# preempt_disable +------------------+
--> H preemptive H -----------------> | non_preemptive |
#============# +------------------+
^ |
| sched_waking |
+--------------+
Deterministic Automaton in C #
In the paper "Efficient formal verification for the Linux kernel", the authors present a simple way to represent an automaton in C that can be used as regular code in the Linux kernel.
For example, the 'wip' automata can be presented as (augmented with comments):
/* enum representation of X (set of states) to be used as index */
enum states {
preemptive = 0,
non_preemptive,
state_max
};
#define INVALID_STATE state_max
/* enum representation of E (set of events) to be used as index */
enum events {
preempt_disable = 0,
preempt_enable,
sched_waking,
event_max
};
struct automaton {
char *state_names[state_max]; // X: the set of states
char *event_names[event_max]; // E: the finite set of events
unsigned char function[state_max][event_max]; // f: transition function
unsigned char initial_state; // x_0: the initial state
bool final_states[state_max]; // X_m: the set of marked states
};
struct automaton aut = {
.state_names = {
"preemptive",
"non_preemptive"
},
.event_names = {
"preempt_disable",
"preempt_enable",
"sched_waking"
},
.function = {
{ non_preemptive, INVALID_STATE, INVALID_STATE },
{ INVALID_STATE, preemptive, non_preemptive },
},
.initial_state = preemptive,
.final_states = { 1, 0 },
};
The transition function is represented as a matrix of states (lines) and events (columns), and so the function f : X x E -> X can be solved in O(1). For example:
next_state = automaton_wip.function[curr_state][event];
Graphviz .dot format #
The Graphviz open-source tool can produce the graphical representation of an automaton using the (textual) DOT language as the source code. The DOT format is widely used and can be converted to many other formats.
For example, this is the 'wip' model in DOT:
digraph state_automaton {
{node [shape = circle] "non_preemptive"};
{node [shape = plaintext, style=invis, label=""] "__init_preemptive"};
{node [shape = doublecircle] "preemptive"};
{node [shape = circle] "preemptive"};
"__init_preemptive" -> "preemptive";
"non_preemptive" [label = "non_preemptive"];
"non_preemptive" -> "non_preemptive" [ label = "sched_waking" ];
"non_preemptive" -> "preemptive" [ label = "preempt_enable" ];
"preemptive" [label = "preemptive"];
"preemptive" -> "non_preemptive" [ label = "preempt_disable" ];
{ rank = min ;
"__init_preemptive";
"preemptive";
}
}
This DOT format can be transformed into a bitmap or vectorial image using the dot utility, or into an ASCII art using graph-easy. For instance:
$ dot -Tsvg -o wip.svg wip.dot
$ graph-easy wip.dot > wip.txt
dot2c #
dot2c is a utility that can parse a .dot file containing an automaton as in the example above and automatically convert it to the C representation presented in [3].
For example, having the previous 'wip' model into a file named 'wip.dot', the following command will transform the .dot file into the C representation (previously shown) in the 'wip.h' file:
$ dot2c wip.dot > wip.h
The 'wip.h' content is the code sample in section 'Deterministic Automaton in C'.
Remarks #
The automata formalism allows modeling discrete event systems (DES) in multiple formats, suitable for different applications/users.
For example, the formal description using set theory is better suitable for automata operations, while the graphical format for human interpretation; and computer languages for machine execution.
References #
Many textbooks cover automata formalism. For a brief introduction see:
O'Regan, Gerard. Concise guide to software engineering. Springer,
Cham, 2017.
For a detailed description, including operations, and application on Discrete Event Systems (DES), see:
Cassandras, Christos G., and Stephane Lafortune, eds. Introduction to discrete
event systems. Boston, MA: Springer US, 2008.
For the C representation in kernel, see:
De Oliveira, Daniel Bristot; Cucinotta, Tommaso; De Oliveira, Romulo
Silva. Efficient formal verification for the Linux kernel. In:
International Conference on Software Engineering and Formal Methods.
Springer, Cham, 2019. p. 315-332.
Linear temporal logic
Peios Kernel / Kernel development / Trace / rv
Introduction #
Runtime verification monitor is a verification technique which checks that the kernel follows a specification. It does so by using tracepoints to monitor the kernel's execution trace, and verifying that the execution trace sastifies the specification.
Initially, the specification can only be written in the form of deterministic automaton (DA). However, while attempting to implement DA monitors for some complex specifications, deterministic automaton is found to be inappropriate as the specification language. The automaton is complicated, hard to understand, and error-prone.
Thus, RV monitors based on linear temporal logic (LTL) are introduced. This type of monitor uses LTL as specification instead of DA. For some cases, writing the specification as LTL is more concise and intuitive.
Many materials explain LTL in details. One book is:
Christel Baier and Joost-Pieter Katoen: Principles of Model Checking, The MIT
Press, 2008.
Grammar #
Unlike some existing syntax, kernel's implementation of LTL is more verbose. This is motivated by considering that the people who read the LTL specifications may not be well-versed in LTL.
-
Grammar:
ltl ::= opd | ( ltl ) | ltl binop ltl | unop ltl
-
Operands (opd):
true, false, user-defined names consisting of upper-case characters, digits, and underscore.
-
Unary Operators (unop):
always eventually next not
-
Binary Operators (binop):
until and or imply equivalent
This grammar is ambiguous: operator precedence is not defined. Parentheses must be used.
Example linear temporal logic #
RAIN imply (GO_OUTSIDE imply HAVE_UMBRELLA)
means: if it is raining, going outside means having an umbrella.
RAIN imply (WET until not RAIN)
means: if it is raining, it is going to be wet until the rain stops.
RAIN imply eventually not RAIN
means: if it is raining, rain will eventually stop.
The above examples are referring to the current time instance only. For kernel verification, the always operator is usually desirable, to specify that something is always true at the present and for all future. For example:
always (RAIN imply eventually not RAIN)
means: all rain eventually stops.
In the above examples, RAIN, GO_OUTSIDE, HAVE_UMBRELLA and WET are the "atomic propositions".
Monitor synthesis #
To synthesize an LTL into a kernel monitor, the rvgen tool can be used: tools/verification/rvgen. The specification needs to be provided as a file, and it must have a "RULE = LTL" assignment. For example:
RULE = always (ACQUIRE imply ((not KILLED and not CRASHED) until RELEASE))
which says: if ACQUIRE, then RELEASE must happen before KILLED or CRASHED.
The LTL can be broken down using sub-expressions. The above is equivalent to:
RULE = always (ACQUIRE imply (ALIVE until RELEASE)) ALIVE = not KILLED and not CRASHED
From this specification, rvgen generates the C implementation of a Buchi automaton - a non-deterministic state machine which checks the satisfiability of the LTL. See Documentation/trace/rv/monitor_synthesis.rst for details on using rvgen.
References #
One book covering model checking and linear temporal logic is:
Christel Baier and Joost-Pieter Katoen: Principles of Model Checking, The MIT
Press, 2008.
For an example of using linear temporal logic in software testing, see:
Ruijie Meng, Zhen Dong, Jialin Li, Ivan Beschastnikh, and Abhik Roychoudhury.
2022. Linear-time temporal logic guided greybox fuzzing. In Proceedings of the
44th International Conference on Software Engineering (ICSE '22). Association
for Computing Machinery, New York, NY, USA, 1343–1355.
https://doi.org/10.1145/3510003.3510082
The kernel's LTL monitor implementation is based on:
Gerth, R., Peled, D., Vardi, M.Y., Wolper, P. (1996). Simple On-the-fly
Automatic Verification of Linear Temporal Logic. In: Dembiński, P., Średniawa,
M. (eds) Protocol Specification, Testing and Verification XV. PSTV 1995. IFIP
Advances in Information and Communication Technology. Springer, Boston, MA.
https://doi.org/10.1007/978-0-387-34892-6_1
Real-time application monitors
Peios Kernel / Kernel development / Trace / rv
-
Name: rtapp
-
Type: container for multiple monitors
-
Author: Nam Cao <namcao@linutronix.de>
Description #
Real-time applications may have design flaws such that they experience unexpected latency and fail to meet their time requirements. Often, these flaws follow a few patterns:
Page faults: A real-time thread may access memory that does not have a mapped physical backing or must first be copied (such as for copy-on-write). Thus a page fault is raised and the kernel must first perform the expensive action. This causes significant delays to the real-time thread
Priority inversion: A real-time thread blocks waiting for a lower-priority thread. This causes the real-time thread to effectively take on the scheduling priority of the lower-priority thread. For example, the real-time thread needs to access a shared resource that is protected by a non-pi-mutex, but the mutex is currently owned by a non-real-time thread.
The rtapp monitor detects these patterns. It aids developers to identify reasons for unexpected latency with real-time applications. It is a container of multiple sub-monitors described in the following sections.
Monitor pagefault #
The pagefault monitor reports real-time tasks raising page faults. Its specification is:
RULE = always (RT imply not PAGEFAULT)
To fix warnings reported by this monitor, mlockall() or mlock() can be used to ensure physical backing for memory.
This monitor may have false negatives because the pages used by the real-time threads may just happen to be directly available during testing. To minimize this, the system can be put under memory pressure (e.g. invoking the OOM killer using a program that does ptr = malloc(SIZE_OF_RAM); memset(ptr, 0, SIZE_OF_RAM);) so that the kernel executes aggressive strategies to recycle as much physical memory as possible.
Monitor sleep #
The sleep monitor reports real-time threads sleeping in a manner that may cause undesirable latency. Real-time applications should only put a real-time thread to sleep for one of the following reasons:
Cyclic work: real-time thread sleeps waiting for the next cycle. For this case, only the
clock_nanosleepsyscall should be used withTIMER_ABSTIME(to avoid time drift) andCLOCK_MONOTONIC(to avoid the clock being changed). No other method is safe for real-time. For example, threads waiting for timerfd can be woken by softirq which provides no real-time guarantee.Real-time thread waiting for something to happen (e.g. another thread releasing shared resources, or a completion signal from another thread). In this case, only futexes (FUTEX_LOCK_PI, FUTEX_LOCK_PI2 or one of FUTEX_WAIT_*) should be used. Applications usually do not use futexes directly, but use PI mutexes and PI condition variables which are built on top of futexes. Be aware that the C library might not implement conditional variables as safe for real-time. As an alternative, the librtpi library exists to provide a conditional variable implementation that is correct for real-time applications in Linux.
Beside the reason for sleeping, the eventual waker should also be real-time-safe. Namely, one of:
An equal-or-higher-priority thread
Hard interrupt handler
Non-maskable interrupt handler
This monitor's warning usually means one of the following:
Real-time thread is blocked by a non-real-time thread (e.g. due to contention on a mutex without priority inheritance). This is priority inversion.
Time-critical work waits for something which is not safe for real-time (e.g. timerfd).
The work executed by the real-time thread does not need to run at real-time priority at all. This is not a problem for the real-time thread itself, but it is potentially taking the CPU away from other important real-time work.
Application developers may purposely choose to have their real-time application sleep in a way that is not safe for real-time. It is debatable whether that is a problem. Application developers must analyze the warnings to make a proper assessment.
The monitor's specification is:
RULE = always ((RT and SLEEP) imply (RT_FRIENDLY_SLEEP or ALLOWLIST))
RT_FRIENDLY_SLEEP = (RT_VALID_SLEEP_REASON or KERNEL_THREAD)
and ((not WAKE) until RT_FRIENDLY_WAKE)
RT_VALID_SLEEP_REASON = FUTEX_WAIT
or RT_FRIENDLY_NANOSLEEP
RT_FRIENDLY_NANOSLEEP = CLOCK_NANOSLEEP
and NANOSLEEP_TIMER_ABSTIME
and NANOSLEEP_CLOCK_MONOTONIC
RT_FRIENDLY_WAKE = WOKEN_BY_EQUAL_OR_HIGHER_PRIO
or WOKEN_BY_HARDIRQ
or WOKEN_BY_NMI
or KTHREAD_SHOULD_STOP
ALLOWLIST = BLOCK_ON_RT_MUTEX
or FUTEX_LOCK_PI
or TASK_IS_RCU
or TASK_IS_MIGRATION
Beside the scenarios described above, this specification also handle some special cases:
KERNEL_THREAD: kernel tasks do not have any pattern that can be recognized as valid real-time sleeping reasons. Therefore sleeping reason is not checked for kernel tasks.
KTHREAD_SHOULD_STOP: a non-real-time thread may stop a real-time kernel thread by waking it and waiting for it to exit (kthread_stop()). This wakeup is safe for real-time.
ALLOWLIST: to handle known false positives with the kernel.
BLOCK_ON_RT_MUTEXis included in the allowlist due to its implementation. In the release path of rt_mutex, a boosted task is de-boosted before waking the rt_mutex's waiter. Consequently, the monitor may see a real-time-unsafe wakeup (e.g. non-real-time task waking real-time task). This is actually real-time-safe because preemption is disabled for the duration.
FUTEX_LOCK_PIis included in the allowlist for the same reason asBLOCK_ON_RT_MUTEX.
Scheduler monitors
Peios Kernel / Kernel development / Trace / rv
-
Name: sched
-
Type: container for multiple monitors
-
Author: Gabriele Monaco <gmonaco@redhat.com>, Daniel Bristot de Oliveira <bristot@kernel.org>
Description #
Monitors describing complex systems, such as the scheduler, can easily grow to the point where they are just hard to understand because of the many possible state transitions. Often it is possible to break such descriptions into smaller monitors, sharing some or all events. Enabling those smaller monitors concurrently is, in fact, testing the system as if we had one single larger monitor. Splitting models into multiple specification is not only easier to understand, but gives some more clues when we see errors.
The sched monitor is a set of specifications to describe the scheduler behaviour. It includes several per-cpu and per-task monitors that work independently to verify different specifications the scheduler should follow.
To make this system as straightforward as possible, sched specifications are nested monitors, whereas sched itself is a container. From the interface perspective, sched includes other monitors as sub-directories, enabling/disabling or setting reactors to sched, propagates the change to all monitors, however single monitors can be used independently as well.
It is important that future modules are built after their container (sched, in this case), otherwise the linker would not respect the order and the nesting wouldn't work as expected. To do so, simply add them after sched in the Makefile.
Specifications #
The specifications included in sched are currently a work in progress, adapting the ones defined in by Daniel Bristot in [1].
Currently we included the following:
Monitor sco #
The scheduling context operations (sco) monitor ensures changes in a task state happen only in thread context:
|
|
v
sched_set_state +------------------+
+------------------ | |
| | thread_context |
+-----------------> | | <+
+------------------+ |
| |
| schedule_entry | schedule_exit
v |
|
scheduling_context -+
Monitor snroc #
The set non runnable on its own context (snroc) monitor ensures changes in a task state happens only in the respective task's context. This is a per-task monitor:
|
|
v
+------------------+
| other_context | <+
+------------------+ |
| |
| sched_switch_in | sched_switch_out
v |
sched_set_state |
+------------------ |
| own_context |
+-----------------> -+
Monitor scpd #
The schedule called with preemption disabled (scpd) monitor ensures schedule is called with preemption disabled:
|
|
v
+------------------+
| cant_sched | <+
+------------------+ |
| |
| preempt_disable | preempt_enable
v |
schedule_entry |
schedule_exit |
+----------------- can_sched |
| |
+----------------> -+
Monitor snep #
The schedule does not enable preempt (snep) monitor ensures a schedule call does not enable preemption:
|
|
v
preempt_disable +------------------------+
preempt_enable | |
+------------------ | non_scheduling_context |
| | |
+-----------------> | | <+
+------------------------+ |
| |
| schedule_entry | schedule_exit
v |
|
scheduling_contex -+
Monitor sts #
The schedule implies task switch (sts) monitor ensures a task switch happens only in scheduling context and up to once, as well as scheduling occurs with interrupts enabled but no task switch can happen before interrupts are disabled. When the next task picked for execution is the same as the previously running one, no real task switch occurs but interrupts are disabled nonetheless:
irq_entry |
+----+ |
v | v
+------------+ irq_enable #===================# irq_disable
| | ------------> H H irq_entry
| cant_sched | <------------ H H irq_enable
| | irq_disable H can_sched H --------------+
+------------+ H H |
H H |
+---------------> H H <-------------+
| #===================#
| |
schedule_exit | schedule_entry
| v
| +-------------------+ irq_enable
| | scheduling | <---------------+
| +-------------------+ |
| | |
| | irq_disable +--------+ irq_entry
| v | | --------+
| +-------------------+ irq_entry | in_irq | |
| | | -----------> | | <-------+
| | disable_to_switch | +--------+
| | | --+
| +-------------------+ |
| | |
| | sched_switch |
| v |
| +-------------------+ |
| | switching | | irq_enable
| +-------------------+ |
| | |
| | irq_enable |
| v |
| +-------------------+ |
+-- | enable_to_exit | <-+
+-------------------+
^ | irq_disable
| | irq_entry
+---------------+ irq_enable
Monitor nrp #
The need resched preempts (nrp) monitor ensures preemption requires need_resched. Only kernel preemption is considered, since preemption while returning to userspace, for this monitor, is indistinguishable from sched_switch_yield (described in the sssw monitor). A kernel preemption is whenever __schedule is called with the preemption flag set to true (e.g. from preempt_enable or exiting from interrupts). This type of preemption occurs after the need for rescheduling has been set. This is not valid for the lazy variant of the flag, which causes only userspace preemption. A schedule_entry_preempt may involve a task switch or not, in the latter case, a task goes through the scheduler from a preemption context but it is picked as the next task to run. Since the scheduler runs, this clears the need to reschedule. The any_thread_running state does not imply the monitored task is not running as this monitor does not track the outcome of scheduling.
In theory, a preemption can only occur after the need_resched flag is set. In practice, however, it is possible to see a preemption where the flag is not set. This can happen in one specific condition:
need_resched
preempt_schedule()
preempt_schedule_irq()
__schedule()
!need_resched
__schedule()
In the situation above, standard preemption starts (e.g. from preempt_enable when the flag is set), an interrupt occurs before scheduling and, on its exit path, it schedules, which clears the need_resched flag. When the preempted task runs again, the standard preemption started earlier resumes, although the flag is no longer set. The monitor considers this a nested_preemption, this allows another preemption without re-setting the flag. This condition relaxes the monitor constraints and may catch false negatives (i.e. no real nested_preemptions) but makes the monitor more robust and able to validate other scenarios. For simplicity, the monitor starts in preempt_irq, although no interrupt occurred, as the situation above is hard to pinpoint:
schedule_entry
irq_entry #===========================================#
+-------------------------- H H
| H H
+-------------------------> H any_thread_running H
H H
+-------------------------> H H
| #===========================================#
| schedule_entry | ^
| schedule_entry_preempt | sched_need_resched | schedule_entry
| | schedule_entry_preempt
| v |
| +----------------------+ |
| +--- | | |
| sched_need_resched | | rescheduling | -+
| +--> | |
| +----------------------+
| | irq_entry
| v
| +----------------------+
| | | ---+
| ---> | | | sched_need_resched
| | preempt_irq | | irq_entry
| | | <--+
| | | <--+
| +----------------------+ |
| | schedule_entry | sched_need_resched
| | schedule_entry_preempt |
| v |
| +-----------------------+ |
+-------------------------- | nested_preempt | --+
+-----------------------+
^ irq_entry |
+-------------------+
Due to how the need_resched flag on the preemption count works on arm64, this monitor is unstable on that architecture, as it often records preemption when the flag is not set, even in presence of the workaround above. For the time being, the monitor is disabled by default on arm64.
Monitor sssw #
The set state sleep and wakeup (sssw) monitor ensures set_state to sleepable leads to sleeping and sleeping tasks require wakeup. It includes the following types of switch:
-
switch_suspend: a task puts itself to sleep, this can happen only after explicitly setting the task tosleepable. After a task is suspended, it needs to be woken up (wakingstate) before being switched in again. Setting the task's state tosleepablecan be reverted before switching if it is woken up or set torunnable. -
switch_blocking: a special case of aswitch_suspendwhere the task is waiting on a sleeping RT lock (PREEMPT_RTonly), it is common to see wakeup and set state events racing with each other and this leads the model to perceive this type of switch when the task is not set to sleepable. This is a limitation of the model in SMP system and workarounds may slow down the system. -
switch_preempt: a task switch as a result of kernel preemption (schedule_entry_preemptin the nrp model). -
switch_yield: a task explicitly calls the scheduler or is preempted while returning to userspace. It can happen after ayieldsystem call, from the idle task or if theneed_reschedflag is set. By definition, a task cannot yield whilesleepableas that would be a suspension. A special case of a yield occurs when a task inTASK_INTERRUPTIBLEcalls the scheduler while a signal is pending. The task doesn't go through the usual blocking/waking and is set back to runnable, the resulting switch (if there) looks like a yield to thesignal_wakeupstate and is followed by the signal delivery. From this state, the monitor expects a signal even if it sees a wakeup event, although not necessary, to rule out false negatives.
This monitor doesn't include a running state, sleepable and runnable are only referring to the task's desired state, which could be scheduled out (e.g. due to preemption). However, it does include the event sched_switch_in to represent when a task is allowed to become running. This can be triggered also by preemption, but cannot occur after the task got to sleeping before a wakeup occurs:
+--------------------------------------------------------------------------+
| |
| |
| switch_suspend | |
| switch_blocking | |
v v |
+----------+ #==========================# set_state_runnable |
| | H H wakeup |
| | H H switch_in |
| | H H switch_yield |
| sleeping | H H switch_preempt |
| | H H signal_deliver |
| | switch_ H H ------+ |
| | _blocking H runnable H | |
| | <----------- H H <-----+ |
+----------+ H H |
| wakeup H H |
+---------------------> H H |
H H |
+---------> H H |
| #==========================# |
| | ^ |
| | | set_state_runnable |
| | | wakeup |
| set_state_sleepable | +------------------------+
| v | |
| +--------------------------+ set_state_sleepable
| | | switch_in
| | | switch_preempt
signal_deliver | sleepable | signal_deliver
| | | ------+
| | | |
| | | <-----+
| +--------------------------+
| | ^
| switch_yield | set_state_sleepable
| v |
| +---------------+ |
+---------- | signal_wakeup | -+
+---------------+
^ | switch_in
| | switch_preempt
| | switch_yield
+-----------+ wakeup
Monitor opid #
The operations with preemption and irq disabled (opid) monitor ensures operations like wakeup and need_resched occur with interrupts and preemption disabled or during interrupt context, in such case preemption may not be disabled explicitly. need_resched can be set by some RCU internals functions, in which case it doesn't match a task wakeup and might occur with only interrupts disabled:
| sched_need_resched
| sched_waking
| irq_entry
| +--------------------+
v v |
+------------------------------------------------------+
+----------- | disabled | <+
| +------------------------------------------------------+ |
| | ^ |
| | preempt_disable sched_need_resched |
| preempt_enable | +--------------------+ |
| v | v | |
| +------------------------------------------------------+ |
| | irq_disabled | |
| +------------------------------------------------------+ |
| | | ^ |
| irq_entry irq_entry | | |
| sched_need_resched v | irq_disable |
| sched_waking +--------------+ | | |
| +----- | | irq_enable | |
| | | in_irq | | | |
| +----> | | | | |
| +--------------+ | | irq_disable
| | | | |
| irq_enable | irq_enable | | |
| v v | |
| #======================================================# |
| H enabled H |
| #======================================================# |
| | ^ ^ preempt_enable | |
| preempt_disable preempt_enable +--------------------+ |
| v | |
| +------------------+ | |
+----------> | preempt_disabled | -+ |
+------------------+ |
| |
+-------------------------------------------------------+
This monitor is designed to work on PREEMPT_RT kernels, the special case of events occurring in interrupt context is a shortcut to identify valid scenarios where the preemption tracepoints might not be visible, during interrupts preemption is always disabled. On non- PREEMPT_RT kernels, the interrupts might invoke a softirq to set need_resched and wake up a task. This is another special case that is currently not supported by the monitor.
References #
Runtime Verification Monitor Synthesis
Peios Kernel / Kernel development / Trace / rv
The starting point for the application of runtime verification (RV) techniques is the specification or modeling of the desired (or undesired) behavior of the system under scrutiny.
The formal representation needs to be then synthesized into a monitor that can then be used in the analysis of the trace of the system. The monitor connects to the system via an instrumentation that converts the events from the system to the events of the specification.
In Linux terms, the runtime verification monitors are encapsulated inside the RV monitor abstraction. The RV monitor includes a set of instances of the monitor (per-cpu monitor, per-task monitor, and so on), the helper functions that glue the monitor to the system reference model, and the trace output as a reaction to event parsing and exceptions, as depicted below:
Linux +----- RV Monitor ----------------------------------+ Formal
Realm | | Realm
+-------------------+ +----------------+ +-----------------+
| Linux kernel | | Monitor | | Reference |
| Tracing | -> | Instance(s) | <- | Model |
| (instrumentation) | | (verification) | | (specification) |
+-------------------+ +----------------+ +-----------------+
| | |
| V |
| +----------+ |
| | Reaction | |
| +--+--+--+-+ |
| | | | |
| | | +-> trace output ? |
+------------------------|--|----------------------+
| +----> panic ?
+-------> <user-specified>
RV monitor synthesis #
The synthesis of a specification into the Linux RV monitor abstraction is automated by the rvgen tool and the header file containing common code for creating monitors. The header files are:
rv/da_monitor.h for deterministic automaton monitor.
rv/ltl_monitor.h for linear temporal logic monitor.
rvgen #
The rvgen utility converts a specification into the C presentation and creating the skeleton of a kernel monitor in C.
For example, it is possible to transform the wip.dot model present in [1] into a per-cpu monitor with the following command:
$ rvgen monitor -c da -s wip.dot -t per_cpu
This will create a directory named wip/ with the following files:
-
wip.h: the wip model in C
-
wip.c: the RV monitor
The wip.c file contains the monitor declaration and the starting point for the system instrumentation.
Similarly, a linear temporal logic monitor can be generated with the following command:
$ rvgen monitor -c ltl -s pagefault.ltl -t per_task
This generates pagefault/ directory with:
-
pagefault.h: The Buchi automaton (the non-deterministic state machine to verify the specification)
-
pagefault.c: The skeleton for the RV monitor
Monitor header files #
The header files:
-
rv/da_monitor.hfor deterministic automaton monitor -
rv/ltl_monitorfor linear temporal logic monitor
include common macros and static functions for implementing Monitor Instance(s).
The benefits of having all common functionalities in a single header file are 3-fold:
Reduce the code duplication;
Facilitate the bug fix/improvement;
Avoid the case of developers changing the core of the monitor code to manipulate the model in a (let's say) non-standard way.
rv/da_monitor.h #
This initial implementation presents three different types of monitor instances:
-
#define RV_MON_TYPE RV_MON_GLOBAL -
#define RV_MON_TYPE RV_MON_PER_CPU -
#define RV_MON_TYPE RV_MON_PER_TASK
The first sets up functions declaration for a global deterministic automata monitor, the second for monitors with per-cpu instances, and the third with per-task instances.
In all cases, the C file must include the $(MODEL_NAME).h file (generated by rvgen), for example, to define the per-cpu 'wip' monitor, the wip.c source file must include:
#define RV_MON_TYPE RV_MON_PER_CPU
#include "wip.h"
#include <rv/da_monitor.h>
The monitor is executed by sending events to be processed via the functions presented below:
da_handle_event($(event from event enum));
da_handle_start_event($(event from event enum));
da_handle_start_run_event($(event from event enum));
The function da_handle_event() is the regular case where the event will be processed if the monitor is processing events.
When a monitor is enabled, it is placed in the initial state of the automata. However, the monitor does not know if the system is in the initial state.
The da_handle_start_event() function is used to notify the monitor that the system is returning to the initial state, so the monitor can start monitoring the next event.
The da_handle_start_run_event() function is used to notify the monitor that the system is known to be in the initial state, so the monitor can start monitoring and monitor the current event.
Using the wip model as example, the events "preempt_disable" and "sched_waking" should be sent to monitor, respectively, via [2]:
da_handle_event(preempt_disable_wip);
da_handle_event(sched_waking_wip);
While the event "preempt_enabled" will use:
da_handle_start_event(preempt_enable_wip);
To notify the monitor that the system will be returning to the initial state, so the system and the monitor should be in sync.
rv/ltl_monitor.h #
This file must be combined with the $(MODEL_NAME).h file (generated by rvgen) to be complete. For example, for the pagefault monitor, the pagefault.c source file must include:
#include "pagefault.h"
#include <rv/ltl_monitor.h>
(the skeleton monitor file generated by rvgen already does this).
$(MODEL_NAME).h (pagefault.h in the above example) includes the implementation of the Buchi automaton - a non-deterministic state machine that verifies the LTL specification. While rv/ltl_monitor.h includes the common helper functions to interact with the Buchi automaton and to implement an RV monitor. An important definition in $(MODEL_NAME).h is:
enum ltl_atom {
LTL_$(FIRST_ATOMIC_PROPOSITION),
LTL_$(SECOND_ATOMIC_PROPOSITION),
...
LTL_NUM_ATOM
};
which is the list of atomic propositions present in the LTL specification (prefixed with "LTL_" to avoid name collision). This enum is passed to the functions interacting with the Buchi automaton.
While generating code, rvgen cannot understand the meaning of the atomic propositions. Thus, that task is left for manual work. The recommended practice is adding tracepoints to places where the atomic propositions change; and in the tracepoints' handlers: the Buchi automaton is executed using:
void ltl_atom_update(struct task_struct *task, enum ltl_atom atom, bool value)
which tells the Buchi automaton that the atomic proposition atom is now value. The Buchi automaton checks whether the LTL specification is still satisfied, and invokes the monitor's error tracepoint and the reactor if violation is detected.
Tracepoints and ltl_atom_update() should be used whenever possible. However, it is sometimes not the most convenient. For some atomic propositions which are changed in multiple places in the kernel, it is cumbersome to trace all those places. Furthermore, it may not be important that the atomic propositions are updated at precise times. For example, considering the following linear temporal logic:
RULE = always (RT imply not PAGEFAULT)
This LTL states that a real-time task does not raise page faults. For this specification, it is not important when RT changes, as long as it has the correct value when PAGEFAULT is true. Motivated by this case, another function is introduced:
void ltl_atom_fetch(struct task_struct *task, struct ltl_monitor *mon)
This function is called whenever the Buchi automaton is triggered. Therefore, it can be manually implemented to "fetch" RT:
void ltl_atom_fetch(struct task_struct *task, struct ltl_monitor *mon)
{
ltl_atom_set(mon, LTL_RT, rt_task(task));
}
Effectively, whenever PAGEFAULT is updated with a call to ltl_atom_update(), RT is also fetched. Thus, the LTL specification can be verified without tracing RT everywhere.
For atomic propositions which act like events, they usually need to be set (or cleared) and then immediately cleared (or set). A convenient function is provided:
void ltl_atom_pulse(struct task_struct *task, enum ltl_atom atom, bool value)
which is equivalent to:
ltl_atom_update(task, atom, value);
ltl_atom_update(task, atom, !value);
To initialize the atomic propositions, the following function must be implemented:
ltl_atoms_init(struct task_struct *task, struct ltl_monitor *mon, bool task_creation)
This function is called for all running tasks when the monitor is enabled. It is also called for new tasks created after the enabling the monitor. It should initialize as many atomic propositions as possible, for example:
void ltl_atom_init(struct task_struct *task, struct ltl_monitor *mon, bool task_creation)
{
ltl_atom_set(mon, LTL_RT, rt_task(task));
if (task_creation)
ltl_atom_set(mon, LTL_PAGEFAULT, false);
}
Atomic propositions not initialized by ltl_atom_init() will stay in the unknown state until relevant tracepoints are hit, which can take some time. As monitoring for a task cannot be done until all atomic propositions is known for the task, the monitor may need some time to start validating tasks which have been running before the monitor is enabled. Therefore, it is recommended to start the tasks of interest after enabling the monitor.
Final remarks #
With the monitor synthesis in place using the header files and rvgen, the developer's work should be limited to the instrumentation of the system, increasing the confidence in the overall approach.
[1] For details about deterministic automata format and the translation from one representation to another, see:
Documentation/trace/rv/deterministic_automata.rst
[2] rvgen appends the monitor's name suffix to the events enums to avoid conflicting variables when exporting the global vmlinux.h use by BPF programs.
Monitor wip
Peios Kernel / Kernel development / Trace / rv
-
Name: wip - wakeup in preemptive
-
Type: per-cpu deterministic automaton
-
Author: Daniel Bristot de Oliveira <bristot@kernel.org>
Description #
The wakeup in preemptive (wip) monitor is a sample per-cpu monitor that verifies if the wakeup events always take place with preemption disabled:
|
|
v
#==================#
H preemptive H <+
#==================# |
| |
| preempt_disable | preempt_enable
v |
sched_waking +------------------+ |
+--------------- | | |
| | non_preemptive | |
+--------------> | | -+
+------------------+
The wakeup event always takes place with preemption disabled because of the scheduler synchronization. However, because the preempt_count and its trace event are not atomic with regard to interrupts, some inconsistencies might happen. For example:
preempt_disable() {
__preempt_count_add(1)
-------> smp_apic_timer_interrupt() {
preempt_disable()
do not trace (preempt count >= 1)
wake up a thread
preempt_enable()
do not trace (preempt count >= 1)
}
<------
trace_preempt_disable();
}
-
This problem was reported and discussed here:
https://lore.kernel.org/r/cover.1559051152.git.bristot@redhat.com/
Specification #
Grapviz Dot file in tools/verification/models/wip.dot
Monitor wwnr
Peios Kernel / Kernel development / Trace / rv
-
Name: wwrn - wakeup while not running
-
Type: per-task deterministic automaton
-
Author: Daniel Bristot de Oliveira <bristot@kernel.org>
Description #
This is a per-task sample monitor, with the following definition:
|
|
v
wakeup +-------------+
+--------- | |
| | not_running |
+--------> | | <+
+-------------+ |
| |
| switch_in | switch_out
v |
+-------------+ |
| running | -+
+-------------+
This model is broken, the reason is that a task can be running in the processor without being set as RUNNABLE. Think about a task about to sleep:
1: set_current_state(TASK_UNINTERRUPTIBLE);
2: schedule();
And then imagine an IRQ happening in between the lines one and two, waking the task up. BOOM, the wakeup will happen while the task is running.
-
Why do we need this model, so?
-
To test the reactors.
Specification #
Grapviz Dot file in tools/verification/models/wwnr.dot
Runtime Verification
Peios Kernel / Kernel development / Trace / rv
Runtime Verification (RV) is a lightweight (yet rigorous) method that complements classical exhaustive verification techniques (such as model checking and theorem proving) with a more practical approach for complex systems.
Instead of relying on a fine-grained model of a system (e.g., a re-implementation at instruction level), RV works by analyzing the trace of the system's actual execution, comparing it against a formal specification of the system behavior.
The main advantage is that RV can give precise information on the runtime behavior of the monitored system, without the pitfalls of developing models that require a re-implementation of the entire system in a modeling language. Moreover, given an efficient monitoring method, it is possible to execute an online verification of a system, enabling the reaction for unexpected events, avoiding, for example, the propagation of a failure on safety-critical systems.
Runtime Monitors and Reactors #
A monitor is the central part of the runtime verification of a system. The monitor stands in between the formal specification of the desired (or undesired) behavior, and the trace of the actual system.
In Linux terms, the runtime verification monitors are encapsulated inside the RV monitor abstraction. A RV monitor includes a reference model of the system, a set of instances of the monitor (per-cpu monitor, per-task monitor, and so on), and the helper functions that glue the monitor to the system via trace, as depicted below:
Linux +---- RV Monitor ----------------------------------+ Formal
Realm | | Realm
+-------------------+ +----------------+ +-----------------+
| Linux kernel | | Monitor | | Reference |
| Tracing | -> | Instance(s) | <- | Model |
| (instrumentation) | | (verification) | | (specification) |
+-------------------+ +----------------+ +-----------------+
| | |
| V |
| +----------+ |
| | Reaction | |
| +--+--+--+-+ |
| | | | |
| | | +-> trace output ? |
+------------------------|--|----------------------+
| +----> panic ?
+-------> <user-specified>
In addition to the verification and monitoring of the system, a monitor can react to an unexpected event. The forms of reaction can vary from logging the event occurrence to the enforcement of the correct behavior to the extreme action of taking a system down to avoid the propagation of a failure.
In Linux terms, a reactor is an reaction method available for RV monitors. By default, all monitors should provide a trace output of their actions, which is already a reaction. In addition, other reactions will be available so the user can enable them as needed.
For further information about the principles of runtime verification and RV applied to Linux:
Bartocci, Ezio, et al. Introduction to runtime verification. In: Lectures on Runtime Verification. Springer, Cham, 2018. p. 1-33.
Falcone, Ylies, et al. A taxonomy for classifying runtime verification tools. In: International Conference on Runtime Verification. Springer, Cham, 2018. p. 241-262.
De Oliveira, Daniel Bristot. Automata-based formal analysis and verification of the real-time Linux kernel. Ph.D. Thesis, 2020.
Online RV monitors #
Monitors can be classified as offline and online monitors. Offline monitor process the traces generated by a system after the events, generally by reading the trace execution from a permanent storage system. Online monitors process the trace during the execution of the system. Online monitors are said to be synchronous if the processing of an event is attached to the system execution, blocking the system during the event monitoring. On the other hand, an asynchronous monitor has its execution detached from the system. Each type of monitor has a set of advantages. For example, offline monitors can be executed on different machines but require operations to save the log to a file. In contrast, synchronous online method can react at the exact moment a violation occurs.
Another important aspect regarding monitors is the overhead associated with the event analysis. If the system generates events at a frequency higher than the monitor's ability to process them in the same system, only the offline methods are viable. On the other hand, if the tracing of the events incurs on higher overhead than the simple handling of an event by a monitor, then a synchronous online monitors will incur on lower overhead.
Indeed, the research presented in:
De Oliveira, Daniel Bristot; Cucinotta, Tommaso; De Oliveira, Romulo Silva. Efficient formal verification for the Linux kernel. In: International Conference on Software Engineering and Formal Methods. Springer, Cham, 2019. p. 315-332.
Shows that for Deterministic Automata models, the synchronous processing of events in-kernel causes lower overhead than saving the same events to the trace buffer, not even considering collecting the trace for user-space analysis. This motivated the development of an in-kernel interface for online monitors.
For further information about modeling of Linux kernel behavior using automata, see:
De Oliveira, Daniel B.; De Oliveira, Romulo S.; Cucinotta, Tommaso. A thread synchronization model for the PREEMPT_RT Linux kernel. Journal of Systems Architecture, 2020, 107: 101729.
The user interface #
The user interface resembles the tracing interface (on purpose). It is currently at "/sys/kernel/tracing/rv/".
The following files/folders are currently available:
available_monitors
- Reading list the available monitors, one per line
For example:
# cat available_monitors
wip
wwnr
available_reactors
- Reading shows the available reactors, one per line.
For example:
# cat available_reactors
nop
panic
printk
enabled_monitors:
-
Reading lists the enabled monitors, one per line
-
Writing to it enables a given monitor
-
Writing a monitor name with a '!' prefix disables it
-
Truncating the file disables all enabled monitors
For example:
# cat enabled_monitors
# echo wip > enabled_monitors
# echo wwnr >> enabled_monitors
# cat enabled_monitors
wip
wwnr
# echo '!wip' >> enabled_monitors
# cat enabled_monitors
wwnr
# echo > enabled_monitors
# cat enabled_monitors
#
Note that it is possible to enable more than one monitor concurrently.
monitoring_on
This is an on/off general switcher for monitoring. It resembles the "tracing_on" switcher in the trace interface.
-
Writing "0" stops the monitoring
-
Writing "1" continues the monitoring
-
Reading returns the current status of the monitoring
Note that it does not disable enabled monitors but stop the per-entity monitors monitoring the events received from the system.
reacting_on
-
Writing "0" prevents reactions for happening
-
Writing "1" enable reactions
-
Reading returns the current status of the reaction
monitors/
Each monitor will have its own directory inside "monitors/". There the monitor-specific files will be presented. The "monitors/" directory resembles the "events" directory on tracefs.
For example:
# cd monitors/wip/
# ls
desc enable
# cat desc
wakeup in preemptive per-cpu testing monitor.
# cat enable
0
monitors/MONITOR/desc
- Reading shows a description of the monitor MONITOR
monitors/MONITOR/enable
-
Writing "0" disables the MONITOR
-
Writing "1" enables the MONITOR
-
Reading return the current status of the MONITOR
monitors/MONITOR/reactors
-
List available reactors, with the select reaction for the given MONITOR inside "[]". The default one is the nop (no operation) reactor.
-
Writing the name of a reactor enables it to the given MONITOR.
For example:
# cat monitors/wip/reactors
[nop]
panic
printk
# echo panic > monitors/wip/reactors
# cat monitors/wip/reactors
nop
[panic]
printk
Symbolic MSR names in traces
Peios Kernel / Kernel development / Trace / postprocess
Adds symbolic MSR names to read_msr and write_msr trace entries using an MSR index header.
#!/usr/bin/env python
# add symbolic names to read_msr / write_msr in trace
# decode_msr msr-index.h < trace
=
=
=
=
=
= None
=
=
= %
break
=
Page-allocation trace postprocessor
Peios Kernel / Kernel development / Trace / postprocess
Original prototype for summarizing page-allocation trace output, including its parser limitations and command options.
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
my %perprocesspid;
my %perprocess;
my $opt_ignorepid;
my $opt_read_procstat;
my $opt_prepend_parent;
my $sigint_report = 0;
my $sigint_exit = 0;
my $sigint_pending = 0;
my $sigint_received = 0;
{
my $current_time = ;
if ($current_time - 2 > $sigint_received) {
;
$sigint_report = 1;
} else {
if (!$sigint_exit) {
;
}
$sigint_exit++;
}
if ($sigint_exit > 3) {
;
exit;
}
$sigint_received = $current_time;
$sigint_pending = 1;
}
$SIG = ;
(
=> \$opt_ignorepid,
=> \$opt_read_procstat,
=> \$opt_prepend_parent,
);
my $regex_fragdetails_default = ;
my $regex_fragdetails;
my $regex_traceevent = ;
my $regex_statname = ;
my $regex_statppid = ;
{
my $event = ;
my $default = ;
my $regex;
if (! (FORMAT, )) {
$regex = $default;
} else {
my $line;
while (!(FORMAT)) {
$line = ;
if ($line =~ //) {
$regex = $1;
$regex =~ ;
$regex =~ ;
$regex =~ ;
}
}
}
my $tuple;
foreach $tuple ( //, $regex) {
my ($key, $value) = (//, $tuple);
my $expected = ;
if ($key ne $expected) {
();
$regex =~ ;
}
}
if ( ) {
die();
}
return $regex;
}
$regex_fragdetails = (,
$regex_fragdetails_default,
, ,
, , ,
, ,
, );
{
my $pid = $_;
my $statline;
if ((STAT, )) {
$statline = ;
(STAT);
}
if ($statline eq ) {
$statline = ;
}
return $statline;
}
{
my $pid = $_;
my $statline = $_;
if ($pid == 0) {
return ;
}
if ($statline !~ //o) {
die();
}
return ;
}
{
my $pid = $_;
my $statline = $_;
my $ppid;
if ($pid == 0) {
return ;
}
if ($statline !~ //o) {
die();
}
$ppid = $1;
return ($ppid, ($ppid));
}
{
my $traceevent;
my $process_pid;
my $cpus;
my $timestamp;
my $tracepoint;
my $details;
my $statline;
EVENT_PROCESS:
while ($traceevent = ) {
if ($traceevent =~ //o) {
$process_pid = $1;
$tracepoint = $4;
if ($opt_read_procstat || $opt_prepend_parent) {
$process_pid =~ //;
my $process = $1;
my $pid = $2;
$statline = ($pid);
if ($opt_read_procstat && $process eq ) {
$process_pid = ($pid, $statline);
}
if ($opt_prepend_parent) {
$process_pid = ($pid, $statline) . ;
}
}
} else {
next;
}
if ($tracepoint eq ) {
$perprocesspid->++;
} elsif ($tracepoint eq ) {
$perprocesspid->++
} elsif ($tracepoint eq ) {
$perprocesspid->++;
} elsif ($tracepoint eq ) {
$perprocesspid->++;
$perprocesspid->++;
} elsif ($tracepoint eq ) {
$perprocesspid->++;
$perprocesspid->++;
} elsif ($tracepoint eq ) {
$details = $5;
my ($page, $pfn);
my ($alloc_order, $fallback_order, $pageblock_order);
my ($alloc_migratetype, $fallback_migratetype);
my ($fragmenting, $change_ownership);
if ($details !~ //o) {
;
next;
}
$perprocesspid->++;
$page = $1;
$pfn = $2;
$alloc_order = $3;
$fallback_order = $4;
$pageblock_order = $5;
$alloc_migratetype = $6;
$fallback_migratetype = $7;
$fragmenting = $8;
$change_ownership = $9;
if ($fragmenting) {
$perprocesspid->++;
if ($fallback_order <= 3) {
$perprocesspid->++;
} else {
$perprocesspid->++;
}
}
if ($change_ownership) {
$perprocesspid->++;
}
} else {
$perprocesspid->++;
}
if ($perprocesspid-> &&
$tracepoint ne ) {
$perprocesspid->++;
$perprocesspid-> = 0;
}
if ($perprocesspid-> &&
$tracepoint ne ) {
$perprocesspid->++;
$perprocesspid-> = 0;
}
if ($sigint_pending) {
last EVENT_PROCESS;
}
}
}
{
my $hashref = ;
my %stats = %$hashref;
my $process_pid;
my $max_strlen = 0;
foreach $process_pid ( %perprocesspid) {
my $len = ($process_pid);
if ($len > $max_strlen) {
$max_strlen = $len;
}
}
$max_strlen += 2;
();
( . $max_strlen . ,
, , , , , , , , , , , , , );
( . $max_strlen . ,
, , , , , , , , , , , , , );
( . $max_strlen . ,
, , , , , , , , , , , , , );
foreach $process_pid ( %stats) {
if ($stats->) {
$stats->++;
$stats-> = 0;
}
if ($stats->) {
$stats->++;
$stats-> = 0;
}
( . $max_strlen . ,
$process_pid,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->);
}
}
{
my $process_pid;
my $process;
%perprocess;
foreach $process_pid ( %perprocesspid) {
$process = $process_pid;
$process =~ ;
if ($process eq ) {
$process = ;
}
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
}
}
{
if (!$opt_ignorepid) {
(\%perprocesspid);
} else {
();
(\%perprocess);
}
}
{
my $sigint_processed;
do {
$sigint_processed = 0;
();
if ($sigint_pending) {
my $current_time = ;
if ($sigint_exit) {
;
$sigint_pending = 0;
}
if ($sigint_report) {
if ($current_time >= $sigint_received + 2) {
();
$sigint_report = 0;
$sigint_pending = 0;
$sigint_processed = 1;
}
}
}
} while ($sigint_pending || $sigint_processed);
}
();
();
Page-reclaim trace postprocessor
Peios Kernel / Kernel development / Trace / postprocess
Original prototype for summarizing page-reclaim trace output, including its parser limitations and command options.
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
my %perprocesspid;
my %perprocess;
my %last_procmap;
my $opt_ignorepid;
my $opt_read_procstat;
my $total_wakeup_kswapd;
my ($total_direct_reclaim, $total_direct_nr_scanned);
my ($total_direct_nr_file_scanned, $total_direct_nr_anon_scanned);
my ($total_direct_latency, $total_kswapd_latency);
my ($total_direct_nr_reclaimed);
my ($total_direct_nr_file_reclaimed, $total_direct_nr_anon_reclaimed);
my ($total_direct_writepage_file_sync, $total_direct_writepage_file_async);
my ($total_direct_writepage_anon_sync, $total_direct_writepage_anon_async);
my ($total_kswapd_nr_scanned, $total_kswapd_wake);
my ($total_kswapd_nr_file_scanned, $total_kswapd_nr_anon_scanned);
my ($total_kswapd_writepage_file_sync, $total_kswapd_writepage_file_async);
my ($total_kswapd_writepage_anon_sync, $total_kswapd_writepage_anon_async);
my ($total_kswapd_nr_reclaimed);
my ($total_kswapd_nr_file_reclaimed, $total_kswapd_nr_anon_reclaimed);
my $sigint_report = 0;
my $sigint_exit = 0;
my $sigint_pending = 0;
my $sigint_received = 0;
{
my $current_time = ;
if ($current_time - 2 > $sigint_received) {
;
$sigint_report = 1;
} else {
if (!$sigint_exit) {
;
}
$sigint_exit++;
}
if ($sigint_exit > 3) {
;
exit;
}
$sigint_received = $current_time;
$sigint_pending = 1;
}
$SIG = ;
(
=> \$opt_ignorepid,
=> \$opt_read_procstat,
);
my $regex_direct_begin_default = ;
my $regex_direct_end_default = ;
my $regex_kswapd_wake_default = ;
my $regex_kswapd_sleep_default = ;
my $regex_wakeup_kswapd_default = ;
my $regex_lru_isolate_default = ;
my $regex_lru_shrink_inactive_default = ;
my $regex_lru_shrink_active_default = ;
my $regex_writepage_default = ;
my $regex_direct_begin;
my $regex_direct_end;
my $regex_kswapd_wake;
my $regex_kswapd_sleep;
my $regex_wakeup_kswapd;
my $regex_lru_isolate;
my $regex_lru_shrink_inactive;
my $regex_lru_shrink_active;
my $regex_writepage;
my $regex_traceevent = ;
my $regex_statname = ;
my $regex_statppid = ;
{
my $event = ;
my $default = ;
my $regex;
if (! (FORMAT, )) {
();
return $default;
} else {
my $line;
while (!(FORMAT)) {
$line = ;
$line =~ ;
if ($line =~ //) {
$regex = $1;
$regex =~ ;
$regex =~ ;
$regex =~ ;
$regex =~ ;
$regex =~ ;
}
}
}
$regex =~ ;
my $tuple;
foreach $tuple ( //, $regex) {
my ($key, $value) = (//, $tuple);
my $expected = ;
if ($key ne $expected) {
();
$regex =~ ;
}
}
if ( ) {
die();
}
return $regex;
}
$regex_direct_begin = (
,
$regex_direct_begin_default,
, );
$regex_direct_end = (
,
$regex_direct_end_default,
);
$regex_kswapd_wake = (
,
$regex_kswapd_wake_default,
, );
$regex_kswapd_sleep = (
,
$regex_kswapd_sleep_default,
);
$regex_wakeup_kswapd = (
,
$regex_wakeup_kswapd_default,
, , );
$regex_lru_isolate = (
,
$regex_lru_isolate_default,
, ,
, , , ,
);
$regex_lru_shrink_inactive = (
,
$regex_lru_shrink_inactive_default,
, , , , ,
, , ,
, ,
, , );
$regex_lru_shrink_active = (
,
$regex_lru_shrink_active_default,
, , , , ,
, );
$regex_writepage = (
,
$regex_writepage_default,
, , );
{
my $pid = $_;
my $statline;
if ((STAT, )) {
$statline = ;
(STAT);
}
if ($statline eq ) {
$statline = ;
}
return $statline;
}
{
my $pid = $_;
my $statline = $_;
if ($pid == 0) {
return ;
}
if ($statline !~ //o) {
die();
}
return ;
}
{
my $timestamp = $_;
my ($sec, $usec) = (//, $timestamp);
return ($sec * 1000) + ($usec / 1000);
}
{
my $traceevent;
my $process_pid;
my $cpus;
my $timestamp;
my $tracepoint;
my $details;
my $statline;
EVENT_PROCESS:
while ($traceevent = ) {
if ($traceevent =~ //o) {
$process_pid = $1;
$timestamp = $4;
$tracepoint = $5;
$process_pid =~ //;
my $process = $1;
my $pid = $2;
if ($process eq ) {
$process = $last_procmap;
$process_pid = ;
}
$last_procmap = $process;
if ($opt_read_procstat) {
$statline = ($pid);
if ($opt_read_procstat && $process eq ) {
$process_pid = ($pid, $statline);
}
}
} else {
next;
}
if ($tracepoint eq ) {
$timestamp = ($timestamp);
$perprocesspid->++;
$perprocesspid-> = $timestamp;
$details = $6;
if ($details !~ //o) {
;
;
;
next;
}
my $order = $1;
$perprocesspid->++;
$perprocesspid-> = $order;
} elsif ($tracepoint eq ) {
my $index = $perprocesspid->;
$perprocesspid->++;
if ( $perprocesspid->) {
$timestamp = ($timestamp);
my $order = $perprocesspid->;
my $latency = ($timestamp - $perprocesspid->);
$perprocesspid-> = ;
}
} elsif ($tracepoint eq ) {
$details = $6;
if ($details !~ //o) {
;
;
;
next;
}
my $order = $2;
$perprocesspid-> = $order;
if (!$perprocesspid->) {
$timestamp = ($timestamp);
$perprocesspid->++;
$perprocesspid-> = $timestamp;
$perprocesspid->++;
} else {
$perprocesspid->++;
$perprocesspid->++;
}
} elsif ($tracepoint eq ) {
my $index = $perprocesspid->;
$perprocesspid->++;
$timestamp = ($timestamp);
my $order = $perprocesspid->;
my $latency = ($timestamp - $perprocesspid->);
$perprocesspid-> = ;
$perprocesspid-> = 0;
} elsif ($tracepoint eq ) {
$perprocesspid->++;
$details = $6;
if ($details !~ //o) {
;
;
;
next;
}
my $order = $2;
$perprocesspid->++;
} elsif ($tracepoint eq ) {
$details = $6;
if ($details !~ //o) {
;
;
;
next;
}
my $nr_scanned = $4;
my $lru = $7;
if ($lru =~ //) {
$perprocesspid-> += $nr_scanned;
if ($lru =~ //) {
$perprocesspid-> += $nr_scanned;
} else {
$perprocesspid-> += $nr_scanned;
}
}
} elsif ($tracepoint eq ) {
$details = $6;
if ($details !~ //o) {
;
;
;
next;
}
my $nr_reclaimed = $3;
my $flags = $13;
my $file = 0;
if ($flags =~ //) {
$file = 1;
}
$perprocesspid-> += $nr_reclaimed;
if ($file) {
$perprocesspid-> += $nr_reclaimed;
} else {
$perprocesspid-> += $nr_reclaimed;
}
} elsif ($tracepoint eq ) {
$details = $6;
if ($details !~ //o) {
;
;
;
next;
}
my $flags = $3;
my $file = 0;
my $sync_io = 0;
if ($flags =~ //) {
$file = 1;
}
if ($flags =~ //) {
$sync_io = 1;
}
if ($sync_io) {
if ($file) {
$perprocesspid->++;
} else {
$perprocesspid->++;
}
} else {
if ($file) {
$perprocesspid->++;
} else {
$perprocesspid->++;
}
}
} else {
$perprocesspid->++;
}
if ($sigint_pending) {
last EVENT_PROCESS;
}
}
}
{
my $hashref = ;
my %stats = %$hashref;
my $process_pid;
my $max_strlen = 0;
foreach $process_pid ( %perprocesspid) {
my $len = ($process_pid);
if ($len > $max_strlen) {
$max_strlen = $len;
}
}
$max_strlen += 2;
() if !$opt_ignorepid;
() if !$opt_ignorepid;
foreach $process_pid ( %stats) {
if (!$stats-> &&
!$stats->) {
next;
}
. $max_strlen . , $process_pid if !$opt_ignorepid;
my $index = 0;
while ( $stats-> ||
$stats->) {
if ($stats->) {
(, $stats->) if !$opt_ignorepid;
my ($dummy, $latency) = (//, $stats->);
$total_direct_latency += $latency;
} else {
(, $stats->) if !$opt_ignorepid;
my ($dummy, $latency) = (//, $stats->);
$total_kswapd_latency += $latency;
}
$index++;
}
if !$opt_ignorepid;
}
();
( . $max_strlen . , , , , , , , , );
( . $max_strlen . , , , , , , , , );
foreach $process_pid ( %stats) {
if (!$stats->) {
next;
}
$total_direct_reclaim += $stats->;
$total_wakeup_kswapd += $stats->;
$total_direct_nr_scanned += $stats->;
$total_direct_nr_file_scanned += $stats->;
$total_direct_nr_anon_scanned += $stats->;
$total_direct_nr_reclaimed += $stats->;
$total_direct_nr_file_reclaimed += $stats->;
$total_direct_nr_anon_reclaimed += $stats->;
$total_direct_writepage_file_sync += $stats->;
$total_direct_writepage_anon_sync += $stats->;
$total_direct_writepage_file_async += $stats->;
$total_direct_writepage_anon_async += $stats->;
my $index = 0;
my $this_reclaim_delay = 0;
while ( $stats->) {
my ($dummy, $latency) = (//, $stats->);
$this_reclaim_delay += $latency;
$index++;
}
( . $max_strlen . ,
$process_pid,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats-> + $stats->,
$stats-> + $stats->,
$this_reclaim_delay / 1000);
if ($stats->) {
;
for (my $order = 0; $order < 20; $order++) {
my $count = $stats->;
if ($count != 0) {
;
}
}
}
if ($stats->) {
;
for (my $order = 0; $order < 20; $order++) {
my $count = $stats->;
if ($count != 0) {
;
}
}
}
;
}
();
( . $max_strlen . , , , , , , , );
( . $max_strlen . , , , , , , , );
foreach $process_pid ( %stats) {
if (!$stats->) {
next;
}
$total_kswapd_wake += $stats->;
$total_kswapd_nr_scanned += $stats->;
$total_kswapd_nr_file_scanned += $stats->;
$total_kswapd_nr_anon_scanned += $stats->;
$total_kswapd_nr_reclaimed += $stats->;
$total_kswapd_nr_file_reclaimed += $stats->;
$total_kswapd_nr_anon_reclaimed += $stats->;
$total_kswapd_writepage_file_sync += $stats->;
$total_kswapd_writepage_anon_sync += $stats->;
$total_kswapd_writepage_file_async += $stats->;
$total_kswapd_writepage_anon_async += $stats->;
( . $max_strlen . ,
$process_pid,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats->,
$stats-> + $stats->,
$stats-> + $stats->);
if ($stats->) {
;
for (my $order = 0; $order < 20; $order++) {
my $count = $stats->;
if ($count != 0) {
;
}
}
}
if ($stats->) {
;
for (my $order = 0; $order < 20; $order++) {
my $count = $stats->;
if ($count != 0) {
;
}
}
}
();
}
$total_direct_latency /= 1000;
$total_kswapd_latency /= 1000;
;
;
;
;
;
;
;
;
;
;
;
;
;
, $total_direct_latency;
;
;
;
;
;
;
;
;
;
;
;
;
, $total_kswapd_latency;
}
{
my $process_pid;
my $process;
%perprocess;
foreach $process_pid ( %perprocesspid) {
$process = $process_pid;
$process =~ ;
if ($process eq ) {
$process = ;
}
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
for (my $order = 0; $order < 20; $order++) {
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
$perprocess-> += $perprocesspid->;
}
my $wr_index = $perprocess->;
my $rd_index = 0;
while ( $perprocesspid->) {
$perprocess-> = $perprocesspid->;
$rd_index++;
$wr_index++;
}
$perprocess-> = $wr_index;
my $wr_index = $perprocess->;
my $rd_index = 0;
while ( $perprocesspid->) {
$perprocess-> = $perprocesspid->;
$rd_index++;
$wr_index++;
}
$perprocess-> = $wr_index;
}
}
{
if (!$opt_ignorepid) {
(\%perprocesspid);
} else {
();
(\%perprocess);
}
}
{
my $sigint_processed;
do {
$sigint_processed = 0;
();
if ($sigint_pending) {
my $current_time = ;
if ($sigint_exit) {
;
$sigint_pending = 0;
}
if ($sigint_report) {
if ($current_time >= $sigint_received + 2) {
();
$sigint_report = 0;
$sigint_pending = 0;
$sigint_processed = 1;
}
}
}
} while ($sigint_pending || $sigint_processed);
}
();
();
Vim folding for function-graph traces
Peios Kernel / Kernel development / Trace
Vim folding definitions for ftrace function_graph output, with usage and single-CPU trace guidance in the source.
" Enable folding for ftrace function_graph traces.
"
" To use, :source this file while viewing a function_graph trace, or use vim's
" -S option to load from the command-line together with a trace. You can then
" use the usual vim fold commands, such as "za", to open and close nested
" functions. While closed, a fold will show the total time taken for a call,
" as would normally appear on the line with the closing brace. Folded
" functions will not include finish_task_switch(), so folding should remain
" relatively sane even through a context switch.
"
" Note that this will almost certainly only work well with a
" single-CPU trace (e.g. trace-cmd report --cpu 1).
lnum)
let line = getline(a:lnum)
if line[-1:] == '{'
if line =~ 'finish_task_switch() {$'
return '>1'
endif
return 'a1'
elseif line[-1:] == '}'
return 's1'
else
return '='
endif
endfunction
)
let s = split(getline(v:foldstart), '|', 1)
if getline(v:foldend+1) =~ 'finish_task_switch() {$'
let s[2] = ' task switch '
else
let e = split(getline(v:foldend), '|', 1)
let s[2] = e[2]
endif
return join(s, '|')
endfunction
setlocal foldexpr=FunctionGraphFoldExpr(v:lnum)
setlocal foldtext=FunctionGraphFoldText()
setlocal foldcolumn=12
setlocal foldmethod=expr
How to write kernel documentation
Peios Kernel / Kernel development / Writing documentation
Maintaining Peios kernel documentation
Peios Kernel / Kernel development / Writing documentation
The Peios Kernel documentation is maintained in docs/. Edit its Trail articles
directly. The old upstream prose has been removed from Documentation/; Git
retains its history and the migration source map records where each document went.
Choosing the source to edit #
Ordinary prose, diagrams and images belong in docs/. Files included live by
Trail, such as examples, historical text and CSV tables, live in docs/sources/.
The configured plugin launcher keeps this directory out of article discovery
while allowing the preview to watch its inputs. Edit the
included file when changing its contents, and edit its Markdown wrapper for the
surrounding explanation. Plugin paths are relative to the kernel source root.
Documentation/ retains files consumed by kernel tooling: device-tree and Netlink
schemas, ABI records, architecture feature tables, NFS XDR definitions, Kconfig
and build integration, and the sources needed by specific documentation tools.
RTLA/RV manual-page sources and the RST inputs parsed by checkpatch and the sysctl
checker remain there. For those retained inputs, edit the machine-consumed source
and reconcile the corresponding Trail article in the same change. YAML and other
live generated references update through their plugins. Kernel-doc comments
continue to live beside the code they describe.
The per-file decisions are recorded in
peios/docs-migration/source-inventory.json. Its storage field distinguishes
retained inputs, relocated inputs and removed originals. source-map.json maps
the original paths to maintained article paths and records runtime dependencies.
An old Documentation/... reference in a code comment can therefore be looked up
in the source map without restoring duplicate prose.
Building and checking #
Run these commands from the kernel source root, with Trail and the dependencies
listed in tools/docs/trail-kernel-doc/README.md installed:
Set TRAIL=/path/to/trail to choose a binary and BUILDDIR=/path/to/output to
choose the output directory. The default output is Documentation/output.
linkcheckdocs checks local links, anchors and assets. make mandocs builds the
retained RTLA/RV manual pages using rst2man. The former Sphinx output formats
are no longer built by the Peios documentation targets.
For a preview:
Reconciling upstream changes #
Compare the recorded upstream revision with the new upstream commit:
Review the affected articles and tooling inputs. The report uses original paths,
including paths removed from this checkout, and follows relocated dependencies.
New upstream documentation requires an explicit disposition. Do not regenerate
over maintained Markdown or restore the old prose tree during an upstream merge.
Use git show REVISION:Documentation/path to read an upstream source version.
After reviewing an edit, refresh its current output or dependency hash in the mapping; retain the original source and initial output hashes as provenance. Keep inventory storage hashes aligned with reviewed input changes. Run the inventory and authority checks, then build Trail and check its rendered links:
The migration tools also retain the original conversion-fidelity checks for use with a complete historical source checkout. Those checks establish what was preserved during import; they do not require current Peios prose to match upstream word for word.
Organizing articles #
The product is divided into Internals, Kernel development, Administration, Hardware and drivers, and Userspace interfaces. Use shelves to group related topics; shelves do not contribute to article addresses. Use an anthology when a collection needs several independent topics, rather than placing hundreds of articles into one topic. Books are for deliberately sequential reading.
An article move must update both the source map and its inbound links. Keep
the original upstream source identity unchanged, update inventory ownership
and asset paths, and record the old article address in previous_references.
make htmldocs-redirects produces redirects from those addresses as well as
the former upstream RST URLs. Rebuild these redirects after each site build.
Checking for needed translation updates
Peios Kernel / Kernel development / Writing documentation
This script helps track the translation status of the documentation in different locales, i.e., whether the documentation is up-to-date with the English counterpart.
How it works #
It uses git log command to track the latest English commit from the translation commit (order by author date) and the latest English commits from HEAD. If any differences occur, the file is considered as out-of-date, then commits that need to be updated will be collected and reported.
Features implemented
-
check all files in a certain locale
-
check a single file or a set of files
-
provide options to change output format
-
track the translation status of files that have no translation
Usage #
tools/docs/checktransupdate.py --help
Please refer to the output of argument parser for usage details.
Samples
-
tools/docs/checktransupdate.py -l zh_CNThis will print all the files that need to be updated in the zh_CN locale. -
tools/docs/checktransupdate.py Documentation/translations/zh_CN/dev-tools/testing-overview.rstThis will only print the status of the specified file.
Then the output is something like:
Documentation/dev-tools/kfence.rst
No translation in the locale of zh_CN
Documentation/translations/zh_CN/dev-tools/testing-overview.rst
commit 42fb9cfd5b18 ("Documentation: dev-tools: Add link to RV docs")
1 commits needs resolving in total
Features to be implemented
- files can be a folder instead of only a file
How to help improve kernel documentation
Peios Kernel / Kernel development / Writing documentation
Documentation is an important part of any software-development project. Good documentation helps to bring new developers in and helps established developers work more effectively. Without top-quality documentation, a lot of time is wasted in reverse-engineering the code and making avoidable mistakes.
Unfortunately, the kernel's documentation currently falls far short of what it needs to be to support a project of this size and importance.
This guide is for contributors who would like to improve that situation. Kernel documentation improvements can be made by developers at a variety of skill levels; they are a relatively easy way to learn the kernel process in general and find a place in the community. The bulk of what follows is the documentation maintainer's list of tasks that most urgently need to be done.
The documentation TODO list #
There is an endless list of tasks that need to be carried out to get our documentation to where it should be. This list contains a number of important items, but is far from exhaustive; if you see a different way to improve the documentation, please do not hold back!
Addressing warnings #
The documentation build currently spews out an unbelievable number of warnings. When you have that many, you might as well have none at all; people ignore them, and they will never notice when their work adds new ones. For this reason, eliminating warnings is one of the highest-priority tasks on the documentation TODO list. The task itself is reasonably straightforward, but it must be approached in the right way to be successful.
Warnings issued by a compiler for C code can often be dismissed as false positives, leading to patches aimed at simply shutting the compiler up. Warnings from the documentation build almost always point at a real problem; making those warnings go away requires understanding the problem and fixing it at its source. For this reason, patches fixing documentation warnings should probably not say "fix a warning" in the changelog title; they should indicate the real problem that has been fixed.
Another important point is that documentation warnings are often created by problems in kerneldoc comments in C code. While the documentation maintainer appreciates being copied on fixes for these warnings, the documentation tree is often not the right one to actually carry those fixes; they should go to the maintainer of the subsystem in question.
For example, in a documentation build I grabbed a pair of warnings nearly at random:
./drivers/devfreq/devfreq.c:1818: warning: bad line:
- Resource-managed devfreq_register_notifier()
./drivers/devfreq/devfreq.c:1854: warning: bad line:
- Resource-managed devfreq_unregister_notifier()
(The lines were split for readability).
A quick look at the source file named above turned up a couple of kerneldoc comments that look like this:
/**
* devm_devfreq_register_notifier()
- Resource-managed devfreq_register_notifier()
* @dev: The devfreq user device. (parent of devfreq)
* @devfreq: The devfreq object.
* @nb: The notifier block to be unregistered.
* @list: DEVFREQ_TRANSITION_NOTIFIER.
*/
The problem is the missing "*", which confuses the build system's simplistic idea of what C comment blocks look like. This problem had been present since that comment was added in 2016 — a full four years. Fixing it was a matter of adding the missing asterisks. A quick look at the history for that file showed what the normal format for subject lines is, and scripts/get_maintainer.pl told me who should receive it (pass paths to your patches as arguments to scripts/get_maintainer.pl). The resulting patch looked like this:
[PATCH] PM / devfreq: Fix two malformed kerneldoc comments
Two kerneldoc comments in devfreq.c fail to adhere to the required format,
resulting in these doc-build warnings:
./drivers/devfreq/devfreq.c:1818: warning: bad line:
- Resource-managed devfreq_register_notifier()
./drivers/devfreq/devfreq.c:1854: warning: bad line:
- Resource-managed devfreq_unregister_notifier()
Add a couple of missing asterisks and make kerneldoc a little happier.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
drivers/devfreq/devfreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 57f6944d65a6..00c9b80b3d33 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -1814,7 +1814,7 @@ static void devm_devfreq_notifier_release(struct device *dev, void *res)
/**
* devm_devfreq_register_notifier()
- - Resource-managed devfreq_register_notifier()
+ * - Resource-managed devfreq_register_notifier()
* @dev: The devfreq user device. (parent of devfreq)
* @devfreq: The devfreq object.
* @nb: The notifier block to be unregistered.
@@ -1850,7 +1850,7 @@ EXPORT_SYMBOL(devm_devfreq_register_notifier);
/**
* devm_devfreq_unregister_notifier()
- - Resource-managed devfreq_unregister_notifier()
+ * - Resource-managed devfreq_unregister_notifier()
* @dev: The devfreq user device. (parent of devfreq)
* @devfreq: The devfreq object.
* @nb: The notifier block to be unregistered.
--
2.24.1
The entire process only took a few minutes. Of course, I then found that somebody else had fixed it in a separate tree, highlighting another lesson: always check linux-next to see if a problem has been fixed before you dig into it.
Other fixes will take longer, especially those relating to structure members or function parameters that lack documentation. In such cases, it is necessary to work out what the role of those members or parameters is and describe them correctly. Overall, this task gets a little tedious at times, but it's highly important. If we can actually eliminate warnings from the documentation build, then we can start expecting developers to avoid adding new ones.
In addition to warnings from the regular documentation build, you can also run make refcheckdocs to find references to nonexistent documentation files.
Languishing kerneldoc comments #
Developers are encouraged to write kerneldoc comments for their code, but many of those comments are never pulled into the docs build. That makes this information harder to find and, for example, makes Sphinx unable to generate links to that documentation. Adding kernel-doc directives to the documentation to bring those comments in can help the community derive the full value of the work that has gone into creating them.
The tools/docs/find-unused-docs.sh tool can be used to find these overlooked comments.
Note that the most value comes from pulling in the documentation for exported functions and data structures. Many subsystems also have kerneldoc comments for internal use; those should not be pulled into the documentation build unless they are placed in a document that is specifically aimed at developers working within the relevant subsystem.
Typo fixes #
Fixing typographical or formatting errors in the documentation is a quick way to figure out how to create and send patches, and it is a useful service. I am always willing to accept such patches. That said, once you have fixed a few, please consider moving on to more advanced tasks, leaving some typos for the next beginner to address.
Please note that some things are not typos and should not be "fixed":
Both American and British English spellings are allowed within the kernel documentation. There is no need to fix one by replacing it with the other.
The question of whether a period should be followed by one or two spaces is not to be debated in the context of kernel documentation. Other areas of rational disagreement, such as the "Oxford comma", are also off-topic here.
As with any patch to any project, please consider whether your change is really making things better.
Ancient documentation #
Some kernel documentation is current, maintained, and useful. Some documentation is ... not. Dusty, old, and inaccurate documentation can mislead readers and casts doubt on our documentation as a whole. Anything that can be done to address such problems is more than welcome.
Whenever you are working with a document, please consider whether it is current, whether it needs updating, or whether it should perhaps be removed altogether. There are a number of warning signs that you can pay attention to here:
References to 2.x kernels
Pointers to SourceForge repositories
Nothing but typo fixes in the history for several years
Discussion of pre-Git workflows
The best thing to do, of course, would be to bring the documentation current, adding whatever information is needed. Such work often requires the cooperation of developers familiar with the subsystem in question, of course. Developers are often more than willing to cooperate with people working to improve the documentation when asked nicely, and when their answers are listened to and acted upon.
Some documentation is beyond hope; we occasionally find documents that refer to code that was removed from the kernel long ago, for example. There is surprising resistance to removing obsolete documentation, but we should do that anyway. Extra cruft in our documentation helps nobody.
In cases where there is perhaps some useful information in a badly outdated document, and you are unable to update it, the best thing to do may be to add a warning at the beginning. The following text is recommended:
.. warning ::
This document is outdated and in need of attention. Please use
this information with caution, and please consider sending patches
to update it.
That way, at least our long-suffering readers have been warned that the document may lead them astray.
Documentation coherency #
The old-timers around here will remember the Linux books that showed up on the shelves in the 1990s. They were simply collections of documentation files scrounged from various locations on the net. The books have (mostly) improved since then, but the kernel's documentation is still mostly built on that model. It is thousands of files, almost each of which was written in isolation from all of the others. We don't have a coherent body of kernel documentation; we have thousands of individual documents.
We have been trying to improve the situation through the creation of a set of "books" that group documentation for specific readers. These include:
As well as this book on documentation itself.
Moving documents into the appropriate books is an important task and needs to continue. There are a couple of challenges associated with this work, though. Moving documentation files creates short-term pain for the people who work with those files; they are understandably unenthusiastic about such changes. Usually the case can be made to move a document once; we really don't want to keep shifting them around, though.
Even when all documents are in the right place, though, we have only managed to turn a big pile into a group of smaller piles. The work of trying to knit all of those documents together into a single whole has not yet begun. If you have bright ideas on how we could proceed on that front, we would be more than happy to hear them.
Stylesheet improvements #
With the adoption of Sphinx we have much nicer-looking HTML output than we once did. But it could still use a lot of improvement; Donald Knuth and Edward Tufte would be unimpressed. That requires tweaking our stylesheets to create more typographically sound, accessible, and readable output.
Be warned: if you take on this task you are heading into classic bikeshed territory. Expect a lot of opinions and discussion for even relatively obvious changes. That is, alas, the nature of the world we live in.
Non-LaTeX PDF build #
This is a decidedly nontrivial task for somebody with a lot of time and Python skills. The Sphinx toolchain is relatively small and well contained; it is easy to add to a development system. But building PDF or EPUB output requires installing LaTeX, which is anything but small or well contained. That would be a nice thing to eliminate.
The original hope had been to use the rst2pdf tool (https://rst2pdf.org/) for PDF generation, but it turned out to not be up to the task. Development work on rst2pdf seems to have picked up again in recent times, though, which is a hopeful sign. If a suitably motivated developer were to work with that project to make rst2pdf work with the kernel documentation build, the world would be eternally grateful.
Write more documentation #
Naturally, there are massive parts of the kernel that are severely underdocumented. If you have the knowledge to document a specific kernel subsystem and the desire to do so, please do not hesitate to do some writing and contribute the result to the kernel. Untold numbers of kernel developers and users will thank you.
Writing kernel-doc comments
Peios Kernel / Kernel development / Writing documentation
Writing kernel-doc comments #
The Linux kernel source files may contain structured documentation comments in the kernel-doc format to describe the functions, types and design of the code. It is easier to keep documentation up-to-date when it is embedded in source files.
The kernel-doc structure is extracted from the comments, and proper Sphinx C Domain function and type descriptions with anchors are generated from them. The descriptions are filtered for special kernel-doc highlights and cross-references. See below for details.
Every function that is exported to loadable modules using EXPORT_SYMBOL or EXPORT_SYMBOL_GPL should have a kernel-doc comment. Functions and data structures in header files which are intended to be used by modules should also have kernel-doc comments.
It is good practice to also provide kernel-doc formatted documentation for functions externally visible to other kernel files (not marked static). We also recommend providing kernel-doc formatted documentation for private (file static) routines, for consistency of kernel source code layout. This is lower priority and at the discretion of the maintainer of that kernel source file.
How to format kernel-doc comments #
The opening comment mark /** is used for kernel-doc comments. The kernel-doc tool will extract comments marked this way. The rest of the comment is formatted like a normal multi-line comment with a column of asterisks on the left side, closing with */ on a line by itself.
The function and type kernel-doc comments should be placed just before the function or type being described in order to maximise the chance that somebody changing the code will also change the documentation. The overview kernel-doc comments may be placed anywhere at the top indentation level.
Running the kernel-doc tool with increased verbosity and without actual output generation may be used to verify proper formatting of the documentation comments. For example:
tools/docs/kernel-doc -v -none drivers/foo/bar.c
The documentation format of .c files is also verified by the kernel build when it is requested to perform extra gcc checks:
make W=n
However, the above command does not verify header files. These should be checked separately using kernel-doc.
Function documentation #
The general format of a function and function-like macro kernel-doc comment is:
/**
* function_name() - Brief description of function.
* @arg1: Describe the first argument.
* @arg2: Describe the second argument.
* One can provide multiple line descriptions
* for arguments.
*
* A longer description, with more discussion of the function function_name()
* that might be useful to those using or modifying it. Begins with an
* empty comment line, and may include additional embedded empty
* comment lines.
*
* The longer description may have multiple paragraphs.
*
* Context: Describes whether the function can sleep, what locks it takes,
* releases, or expects to be held. It can extend over multiple
* lines.
* Return: Describe the return value of function_name.
*
* The return value description can also have multiple paragraphs, and should
* be placed at the end of the comment block.
*/
The brief description following the function name may span multiple lines, and ends with an argument description, a blank comment line, or the end of the comment block.
Function parameters #
Each function argument should be described in order, immediately following the short function description. Do not leave a blank line between the function description and the arguments, nor between the arguments.
Each @argument: description may span multiple lines.
If a function has a variable number of arguments, its description should be written in kernel-doc notation as:
* @...: description
Function context #
The context in which a function can be called should be described in a section named Context. This should include whether the function sleeps or can be called from interrupt context, as well as what locks it takes, releases and expects to be held by its caller.
Examples:
* Context: Any context.
* Context: Any context. Takes and releases the RCU lock.
* Context: Any context. Expects <lock> to be held by caller.
* Context: Process context. May sleep if @gfp flags permit.
* Context: Process context. Takes and releases <mutex>.
* Context: Softirq or process context. Takes and releases <lock>, BH-safe.
* Context: Interrupt context.
Return values #
The return value, if any, should be described in a dedicated section named Return (or Returns).
Structure, union, and enumeration documentation #
The general format of a struct, union, and enum kernel-doc comment is:
/**
* struct struct_name - Brief description.
* @member1: Description of member1.
* @member2: Description of member2.
* One can provide multiple line descriptions
* for members.
*
* Description of the structure.
*/
You can replace the struct in the above example with union or enum to describe unions or enums. member is used to mean struct and union member names as well as enumerations in an enum.
The brief description following the structure name may span multiple lines, and ends with a member description, a blank comment line, or the end of the comment block.
Members #
Members of structs, unions and enums should be documented the same way as function parameters; they immediately succeed the short description and may be multi-line.
Inside a struct or union description, you can use the private: and public: comment tags. Structure fields that are inside a private: area are not listed in the generated output documentation.
The private: and public: tags must begin immediately following a /* comment marker. They may optionally include comments between the : and the ending */ marker.
Example:
/**
* struct my_struct - short description
* @a: first member
* @b: second member
* @d: fourth member
*
* Longer description
*/
struct my_struct {
int a;
int b;
/* private: internal use only */
int c;
/* public: the next one is public */
int d;
};
Nested structs/unions #
It is possible to document nested structs and unions, like:
/**
* struct nested_foobar - a struct with nested unions and structs
* @memb1: first member of anonymous union/anonymous struct
* @memb2: second member of anonymous union/anonymous struct
* @memb3: third member of anonymous union/anonymous struct
* @memb4: fourth member of anonymous union/anonymous struct
* @bar: non-anonymous union
* @bar.st1: struct st1 inside @bar
* @bar.st2: struct st2 inside @bar
* @bar.st1.memb1: first member of struct st1 on union bar
* @bar.st1.memb2: second member of struct st1 on union bar
* @bar.st2.memb1: first member of struct st2 on union bar
* @bar.st2.memb2: second member of struct st2 on union bar
*/
struct nested_foobar {
/* Anonymous union/struct*/
union {
struct {
int memb1;
int memb2;
};
struct {
void *memb3;
int memb4;
};
};
union {
struct {
int memb1;
int memb2;
} st1;
struct {
void *memb1;
int memb2;
} st2;
} bar;
};
In-line member documentation comments #
The structure members may also be documented in-line within the definition. There are two styles, single-line comments where both the opening /** and closing */ are on the same line, and multi-line comments where they are each on a line of their own, like all other kernel-doc comments:
/**
* struct foo - Brief description.
* @foo: The Foo member.
*/
struct foo {
int foo;
/**
* @bar: The Bar member.
*/
int bar;
/**
* @baz: The Baz member.
*
* Here, the member description may contain several paragraphs.
*/
int baz;
union {
/** @foobar: Single line description. */
int foobar;
};
/** @bar2: Description for struct @bar2 inside @foo */
struct {
/**
* @bar2.barbar: Description for @barbar inside @foo.bar2
*/
int barbar;
} bar2;
};
Typedef documentation #
The general format of a typedef kernel-doc comment is:
/**
* typedef type_name - Brief description.
*
* Description of the type.
*/
Typedefs with function prototypes can also be documented:
/**
* typedef type_name - Brief description.
* @arg1: description of arg1
* @arg2: description of arg2
*
* Description of the type.
*
* Context: Locking context.
* Returns: Meaning of the return value.
*/
typedef void (*type_name)(struct v4l2_ctrl *arg1, void *arg2);
Variables documentation #
The general format of a kernel-doc variable comment is:
/**
* var var_name - Brief description.
*
* Description of the var_name variable.
*/
extern int var_name;
Object-like macro documentation #
Object-like macros are distinct from function-like macros. They are differentiated by whether the macro name is immediately followed by a left parenthesis ('(') for function-like macros or not followed by one for object-like macros.
Function-like macros are handled like functions by tools/docs/kernel-doc. They may have a parameter list. Object-like macros have do not have a parameter list.
The general format of an object-like macro kernel-doc comment is:
/**
* define object_name - Brief description.
*
* Description of the object.
*/
Example:
/**
* define MAX_ERRNO - maximum errno value that is supported
*
* Kernel pointers have redundant information, so we can use a
* scheme where we can return either an error code or a normal
* pointer with the same return value.
*/
#define MAX_ERRNO 4095
Example:
/**
* define DRM_GEM_VRAM_PLANE_HELPER_FUNCS - \
* Initializes struct drm_plane_helper_funcs for VRAM handling
*
* This macro initializes struct drm_plane_helper_funcs to use the
* respective helper functions.
*/
#define DRM_GEM_VRAM_PLANE_HELPER_FUNCS \
.prepare_fb = drm_gem_vram_plane_helper_prepare_fb, \
.cleanup_fb = drm_gem_vram_plane_helper_cleanup_fb
Highlights and cross-references #
The following special patterns are recognized in the kernel-doc comment descriptive text and converted to proper reStructuredText markup and Sphinx C Domain references.
-
funcname()Function reference.
-
@parameterName of a function parameter. (No cross-referencing, just formatting.)
-
%CONSTName of a constant. (No cross-referencing, just formatting.)
Examples:
%0 %NULL %-1 %-EFAULT %-EINVAL %-ENOMEM -
``literal``A literal block that should be handled as-is. The output will use a
monospaced font.Useful if you need to use special characters that would otherwise have some meaning either by kernel-doc script or by reStructuredText.
This is particularly useful if you need to use things like
%phinside a function description. -
$ENVVARName of an environment variable. (No cross-referencing, just formatting.)
-
&struct nameStructure reference.
-
&enum nameEnum reference.
-
&typedef nameTypedef reference.
-
&struct_name->memberor&struct_name.memberstructorunionmember reference. The cross-reference will be to thestructoruniondefinition, not the member directly. -
&nameA generic type reference. Prefer using the full reference described above instead. This is mostly for legacy comments.
Cross-referencing from reStructuredText #
No additional syntax is needed to cross-reference the functions and types defined in the kernel-doc comments from reStructuredText documents. Just end function names with () and write struct, union, enum or typedef before types. For example:
See foo().
See struct foo.
See union bar.
See enum baz.
See typedef meh.
However, if you want custom text in the cross-reference link, that can be done through the following syntax:
See :c:func:`my custom link text for function foo <foo>`.
See :c:type:`my custom link text for struct bar <bar>`.
For further details, please refer to the Sphinx C Domain documentation.
Overview documentation comments #
To facilitate having source code and comments close together, you can include kernel-doc documentation blocks that are free-form comments instead of being kernel-doc for functions, structures, unions, enums, typedefs or variables. This could be used for something like a theory of operation for a driver or library code, for example.
This is done by using a DOC: section keyword with a section title.
The general format of an overview or high-level documentation comment is:
/**
* DOC: Theory of Operation
*
* The whizbang foobar is a dilly of a gizmo. It can do whatever you
* want it to do, at any time. It reads your mind. Here's how it works.
*
* foo bar splat
*
* The only drawback to this gizmo is that is can sometimes damage
* hardware, software, or its subject(s).
*/
The title following DOC: acts as a heading within the source file, but also as an identifier for extracting the documentation comment. Thus, the title must be unique within the file.
Including kernel-doc comments #
The documentation comments may be included in any of the reStructuredText documents using a dedicated kernel-doc Sphinx directive extension.
The kernel-doc directive is of the format:
.. kernel-doc:: source
:option:
The source is the path to a source file, relative to the kernel source tree. The following directive options are supported:
-
export: [source-pattern ...]
Include documentation for all functions in source that have been exported using
EXPORT_SYMBOLorEXPORT_SYMBOL_GPLeither in source or in any of the files specified by source-pattern.The source-pattern is useful when the kernel-doc comments have been placed in header files, while
EXPORT_SYMBOLandEXPORT_SYMBOL_GPLare next to the function definitions.Examples:
.. kernel-doc:: lib/bitmap.c :export: .. kernel-doc:: include/net/mac80211.h :export: net/mac80211/*.c -
internal: [source-pattern ...]
Include documentation for all functions and types in source that have not been exported using
EXPORT_SYMBOLorEXPORT_SYMBOL_GPLeither in source or in any of the files specified by source-pattern.Example:
.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c :internal: -
identifiers: [ function/type ...]
Include documentation for each function and type in source. If no function is specified, the documentation for all functions and types in the source will be included. type can be a
struct,union,enum,typedeforvaridentifier.Examples:
.. kernel-doc:: lib/bitmap.c :identifiers: bitmap_parselist bitmap_parselist_user .. kernel-doc:: lib/idr.c :identifiers: -
no-identifiers: [ function/type ...]
Exclude documentation for each function and type in source.
Example:
.. kernel-doc:: lib/bitmap.c :no-identifiers: bitmap_parselist -
functions: [ function/type ...]
This is an alias of the 'identifiers' directive and deprecated.
-
doc: title
Include documentation for the
DOC:paragraph identified by title in source. Spaces are allowed in title; do not quote the title. The title is only used as an identifier for the paragraph, and is not included in the output. Please make sure to have an appropriate heading in the enclosing reStructuredText document.Example:
.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c :doc: High Definition Audio over HDMI and Display Port
Without options, the kernel-doc directive includes all documentation comments from the source file.
The kernel-doc extension is included in the kernel source tree, at Documentation/sphinx/kerneldoc.py. Internally, it uses the tools/docs/kernel-doc script to extract the documentation comments from the source.
How to use kernel-doc to generate man pages #
To generate man pages for all files that contain kernel-doc markups, run:
$ make mandocs
Or calling script-build-wrapper directly:
$ ./tools/docs/sphinx-build-wrapper mandocs
The output will be at /man directory inside the output directory (by default: Documentation/output).
Optionally, it is possible to generate a partial set of man pages by using SPHINXDIRS:
$ make SPHINXDIRS=driver-api/media mandocs
Documentation subsystem maintainer entry profile
Peios Kernel / Kernel development / Writing documentation
The documentation "subsystem" is the central coordinating point for the kernel's documentation and associated infrastructure. It covers the hierarchy under Documentation/ (with the exception of Documentation/devicetree), various utilities under scripts/ and, at least some of the time, LICENSES/.
It's worth noting, though, that the boundaries of this subsystem are rather fuzzier than normal. Many other subsystem maintainers like to keep control of portions of Documentation/, and many more freely apply changes there when it is convenient. Beyond that, much of the kernel's documentation is found in the source as kerneldoc comments; those are usually (but not always) maintained by the relevant subsystem maintainer.
The mailing list for documentation is linux-doc@vger.kernel.org. Patches should be made against the docs-next tree whenever possible.
Submit checklist addendum #
When making documentation changes, you should actually build the documentation and ensure that no new errors or warnings have been introduced. Generating HTML documents and looking at the result will help to avoid unsightly misunderstandings about how things will be rendered.
All new documentation (including additions to existing documents) should ideally justify who the intended target audience is somewhere in the changelog; this way, we ensure that the documentation ends up in the correct place. Some possible categories are: kernel developers (experts or beginners), userspace programmers, end users and/or system administrators, and distributors.
Key cycle dates #
Patches can be sent anytime, but response will be slower than usual during the merge window. The docs tree tends to close late before the merge window opens, since the risk of regressions from documentation patches is low.
Review cadence #
I am the sole maintainer for the documentation subsystem, and I am doing the work on my own time, so the response to patches will occasionally be slow. I try to always send out a notification when a patch is merged (or when I decide that one cannot be). Do not hesitate to send a ping if you have not heard back within a week of sending a patch.
Including uAPI header files
Peios Kernel / Kernel development / Writing documentation
Sometimes, it is useful to include header files and C example codes in order to describe the userspace API and to generate cross-references between the code and the documentation. Adding cross-references for userspace API files has an additional advantage: Sphinx will generate warnings if a symbol is not found at the documentation. That helps to keep the uAPI documentation in sync with the Kernel changes. The parse_headers.py provides a way to generate such cross-references. It has to be called via Makefile, while building the documentation. Please see Documentation/userspace-api/media/Makefile for an example about how to use it inside the Kernel tree.
tools/docs/parse_headers.py #
NAME #
parse_headers.py - parse a C file, in order to identify functions, structs, enums and defines and create cross-references to a Sphinx book.
USAGE #
parse-headers.py [-h] [-d] [-t] FILE_IN FILE_OUT FILE_RULES
SYNOPSIS #
Converts a C header or source file FILE_IN into a ReStructured Text included via ..parsed-literal block with cross-references for the documentation files that describe the API. It accepts an optional FILE_RULES file to describe what elements will be either ignored or be pointed to a non-default reference type/name.
The output is written at FILE_OUT.
It is capable of identifying define, struct, typedef, enum and enum symbol, creating cross-references for all of them.
It is also capable of distinguishing #define used for specifying Linux-specific macros used to define ioctl.
The optional FILE_RULES contains a set of rules like:
ignore ioctl VIDIOC_ENUM_FMT
replace ioctl VIDIOC_DQBUF vidioc_qbuf
replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det`
POSITIONAL ARGUMENTS #
FILE_INInput C file
FILE_OUTOutput RST file
FILE_RULESExceptions file (optional)
OPTIONS #
-h,--helpshow a help message and exit
-d,--debugIncrease debug level. Can be used multiple times
-t,--tocinstead of a literal block, outputs a TOC table at the RST file
DESCRIPTION #
Creates an enriched version of a Kernel header file with cross-links to each C data structure type, from FILE_IN, formatting it with reStructuredText notation, either as-is or as a table of contents.
It accepts an optional FILE_RULES which describes what elements will be either ignored or be pointed to a non-default reference, and optionally defines the C namespace to be used.
It is meant to allow having more comprehensive documentation, where uAPI headers will create cross-reference links to the code.
The output is written at the FILE_OUT.
The FILE_RULES may contain contain three types of statements: ignore, replace and namespace.
By default, it create rules for all symbols and defines, but it also allows parsing an exception file. Such file contains a set of rules using the syntax below:
-
Ignore rules:
ignore type symbol
Removes the symbol from reference generation.
-
Replace rules:
replace type old_symbol new_reference
Replaces old_symbol with a new_reference. The new_reference can be:
-
A simple symbol name;
-
A full Sphinx reference.
-
-
Namespace rules
namespace namespace
Sets C namespace to be used during cross-reference generation. Can be overridden by replace rules.
On ignore and replace rules, type can be:
ioctl:
for defines of the form
_IO*, e.g., ioctl definitions
define:
for other defines
symbol:
for symbols defined within enums;
typedef:
for typedefs;
enum:
for the name of a non-anonymous enum;
struct:
for structs.
EXAMPLES #
-
Ignore a define
_VIDEODEV2_HatFILE_IN:ignore define _VIDEODEV2_H -
On an data structure like this enum:
enum foo { BAR1, BAR2, PRIVATE };It won't generate cross-references for
PRIVATE:ignore symbol PRIVATEAt the same struct, instead of creating one cross reference per symbol, make them all point to the
enum fooC type:replace symbol BAR1 :c:type:\`foo\` replace symbol BAR2 :c:type:\`foo\` -
Use C namespace
MCfor all symbols atFILE_IN:namespace MC
BUGS #
Report bugs to Mauro Carvalho Chehab <mchehab@kernel.org>
COPYRIGHT #
Copyright (c) 2016, 2025 by Mauro Carvalho Chehab <mchehab+huawei@kernel.org>.
License GPLv2: GNU GPL version 2 <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Using Sphinx for kernel documentation
Peios Kernel / Kernel development / Writing documentation
The Linux kernel uses Sphinx to generate pretty documentation from reStructuredText files under Documentation. To build the documentation in HTML or PDF formats, use make htmldocs or make pdfdocs. The generated documentation is placed in Documentation/output.
The reStructuredText files may contain directives to include structured documentation comments, or kernel-doc comments, from source files. Usually these are used to describe the functions and types and design of the code. The kernel-doc comments have some special structure and formatting, but beyond that they are also treated as reStructuredText.
Finally, there are thousands of plain text documentation files scattered around Documentation. Some of these will likely be converted to reStructuredText over time, but the bulk of them will remain in plain text.
Sphinx Install #
The ReST markups currently used by the Documentation/ files are meant to be built with Sphinx version 3.4.3 or higher.
There's a script that checks for the Sphinx requirements. Please see Checking for Sphinx dependencies for further details.
Most distributions are shipped with Sphinx, but its toolchain is fragile, and it is not uncommon that upgrading it or some other Python packages on your machine would cause the documentation build to break.
A way to avoid that is to use a different version than the one shipped with your distributions. In order to do so, it is recommended to install Sphinx inside a virtual environment, using virtualenv-3 or virtualenv, depending on how your distribution packaged Python 3.
In summary, if you want to install the latest version of Sphinx, you should do:
$ virtualenv sphinx_latest
$ . sphinx_latest/bin/activate
(sphinx_latest) $ pip install -r Documentation/sphinx/requirements.txt
After running . sphinx_latest/bin/activate, the prompt will change, in order to indicate that you're using the new environment. If you open a new shell, you need to rerun this command to enter again at the virtual environment before building the documentation.
Image output #
The kernel documentation build system contains an extension that handles images in both GraphViz and SVG formats (see Figures & Images).
For it to work, you need to install both GraphViz and ImageMagick packages. If those packages are not installed, the build system will still build the documentation, but won't include any images at the output.
PDF and LaTeX builds #
Such builds are currently supported only with Sphinx versions 2.4 and higher.
For PDF and LaTeX output, you'll also need XeLaTeX version 3.14159265.
Depending on the distribution, you may also need to install a series of texlive packages that provide the minimal set of functionalities required for XeLaTeX to work.
Math Expressions in HTML #
Some ReST pages contain math expressions. Due to the way Sphinx works, those expressions are written using LaTeX notation. There are two options for Sphinx to render math expressions in html output. One is an extension called imgmath which converts math expressions into images and embeds them in html pages. The other is an extension called mathjax which delegates math rendering to JavaScript capable web browsers. The former was the only option for pre-6.1 kernel documentation and it requires quite a few texlive packages including amsfonts and amsmath among others.
Since kernel release 6.1, html pages with math expressions can be built without installing any texlive packages. See Choice of Math Renderer for further info.
Checking for Sphinx dependencies #
There's a script that automatically checks for Sphinx dependencies. If it can recognize your distribution, it will also give a hint about the install command line options for your distro:
$ ./tools/docs/sphinx-pre-install
Checking if the needed tools for Fedora release 26 (Twenty Six) are available
Warning: better to also install "texlive-luatex85".
You should run:
sudo dnf install -y texlive-luatex85
/usr/bin/virtualenv sphinx_2.4.4
. sphinx_2.4.4/bin/activate
pip install -r Documentation/sphinx/requirements.txt
Can't build as 1 mandatory dependency is missing at ./tools/docs/sphinx-pre-install line 468.
By default, it checks all the requirements for both html and PDF, including the requirements for images, math expressions and LaTeX build, and assumes that a virtual Python environment will be used. The ones needed for html builds are assumed to be mandatory; the others to be optional.
It supports two optional parameters:
-
--no-pdfDisable checks for PDF;
-
--no-virtualenvUse OS packaging for Sphinx instead of Python virtual environment.
Installing Sphinx Minimal Version #
When changing Sphinx build system, it is important to ensure that the minimal version will still be supported. Nowadays, it is becoming harder to do that on modern distributions, as it is not possible to install with Python 3.13 and above.
Testing with the lowest supported Python version as defined at Documentation/process/changes.rst can be done by creating a venv with it with, and install minimal requirements with:
/usr/bin/python3.9 -m venv sphinx_min
. sphinx_min/bin/activate
pip install -r Documentation/sphinx/min_requirements.txt
A more comprehensive test can be done by using:
tools/docs/test_doc_build.py
Such script create one Python venv per supported version, optionally building documentation for a range of Sphinx versions.
Sphinx Build #
The usual way to generate the documentation is to run make htmldocs or make pdfdocs. There are also other formats available: see the documentation section of make help. The generated documentation is placed in format-specific subdirectories under Documentation/output.
To generate documentation, Sphinx (sphinx-build) must obviously be installed. For PDF output you'll also need XeLaTeX and convert(1) from ImageMagick (https://www.imagemagick.org).1 All of these are widely available and packaged in distributions.
To pass extra options to Sphinx, you can use the SPHINXOPTS make variable. For example, use make SPHINXOPTS=-v htmldocs to get more verbose output.
It is also possible to pass an extra DOCS_CSS overlay file, in order to customize the html layout, by using the DOCS_CSS make variable.
By default, the "Alabaster" theme is used to build the HTML documentation; this theme is bundled with Sphinx and need not be installed separately. The Sphinx theme can be overridden by using the DOCS_THEME make variable.
There is another make variable SPHINXDIRS, which is useful when test building a subset of documentation. For example, you can build documents under Documentation/doc-guide by running make SPHINXDIRS=doc-guide htmldocs. The documentation section of make help will show you the list of subdirectories you can specify.
To remove the generated documentation, run make cleandocs.
[1] Having inkscape(1) from Inkscape (https://inkscape.org) as well would improve the quality of images embedded in PDF documents, especially for kernel releases 5.18 and later.
Choice of Math Renderer #
Since kernel release 6.1, mathjax works as a fallback math renderer for html output.2
Math renderer is chosen depending on available commands as shown below:
|
Math renderer |
Required commands |
Image format |
|---|---|---|
|
imgmath |
latex, dvipng |
PNG (raster) |
|
mathjax |
The choice can be overridden by setting an environment variable SPHINX_IMGMATH as shown below:
|
Setting |
Renderer |
|---|---|
|
|
imgmath |
|
|
mathjax |
[2] Fallback of math renderer requires Sphinx >=1.8.
Writing Documentation #
Adding new documentation can be as simple as:
-
Add a new
.rstfile somewhere underDocumentation. -
Refer to it from the Sphinx main TOC tree in
Documentation/index.rst.
This is usually good enough for simple documentation (like the one you're reading right now), but for larger documents it may be advisable to create a subdirectory (or use an existing one). For example, the graphics subsystem documentation is under Documentation/gpu, split to several .rst files, and has a separate index.rst (with a toctree of its own) referenced from the main index.
See the documentation for Sphinx and reStructuredText on what you can do with them. In particular, the Sphinx reStructuredText Primer is a good place to get started with reStructuredText. There are also some Sphinx specific markup constructs.
Specific guidelines for the kernel documentation #
Here are some specific guidelines for the kernel documentation:
-
Please don't go overboard with reStructuredText markup. Keep it simple. For the most part the documentation should be plain text with just enough consistency in formatting that it can be converted to other formats.
-
Please keep the formatting changes minimal when converting existing documentation to reStructuredText.
-
Also update the content, not just the formatting, when converting documentation.
-
Please stick to this order of heading adornments:
-
=with overline for document title:============== Document title ============== -
=for chapters:Chapters ======== -
-for sections:Section ------- -
~for subsections:Subsection ~~~~~~~~~~
Although RST doesn't mandate a specific order ("Rather than imposing a fixed number and order of section title adornment styles, the order enforced will be the order as encountered."), having the higher levels the same overall makes it easier to follow the documents.
-
-
For inserting fixed width text blocks (for code examples, use case examples, etc.), use
::for anything that doesn't really benefit from syntax highlighting, especially short snippets. Use.. code-block:: <language>for longer code blocks that benefit from highlighting. For a short snippet of code embedded in the text, use ``.
The C domain #
The Sphinx C Domain (name c) is suited for documentation of C API. E.g. a function prototype:
The C domain of the kernel-doc has some additional features. E.g. you can rename the reference name of a function with a common name like open or ioctl:
The func-name (e.g. ioctl) remains in the output but the ref-name changed from ioctl to VIDIOC_LOG_STATUS. The index entry for this function is also changed to VIDIOC_LOG_STATUS.
Please note that there is no need to use c:func: to generate cross references to function documentation. Due to some Sphinx extension magic, the documentation build system will automatically turn a reference to function() into a cross reference if an index entry for the given function name exists. If you see c:func: use in a kernel document, please feel free to remove it.
Tables #
ReStructuredText provides several options for table syntax. Kernel style for tables is to prefer simple table syntax or grid table syntax. See the reStructuredText user reference for table syntax for more details.
list tables #
The list-table formats can be useful for tables that are not easily laid out in the usual Sphinx ASCII-art formats. These formats are nearly impossible for readers of the plain-text documents to understand, though, and should be avoided in the absence of a strong justification for their use.
The flat-table is a double-stage list similar to the list-table with some additional features:
-
column-span: with the role
cspana cell can be extended through additional columns -
row-span: with the role
rspana cell can be extended through additional rows -
auto span rightmost cell of a table row over the missing cells on the right side of that table-row. With Option
:fill-cells:this behavior can changed from auto span to auto fill, which automatically inserts (empty) cells instead of spanning the last cell.
options:
-
:header-rows:[int] count of header rows -
:stub-columns:[int] count of stub columns -
:widths:[[int] [int] ... ] widths of columns -
:fill-cells:instead of auto-spanning missing cells, insert missing cells
roles:
-
:cspan:[int] additional columns (morecols) -
:rspan:[int] additional rows (morerows)
The example below shows how to use this markup. The first level of the staged list is the table-row. In the table-row there is only one markup allowed, the list of the cells in this table-row. Exceptions are comments ( .. ) and targets (e.g. a ref to :ref:`last row <last row>` / last row).
Rendered as:
table title
head col 1
head col 2
head col 3
head col 4
row 1
field 1.1
field 1.2 with autospan
row 2
field 2.1
field 2.2 - 3.3
row 3
Cross-referencing #
Cross-referencing from one documentation page to another can be done simply by writing the path to the document file, no special syntax required. The path can be either absolute or relative. For absolute paths, start it with "Documentation/". For example, to cross-reference to this page, all the following are valid options, depending on the current document's directory (note that the .rst extension is required):
See Documentation/doc-guide/sphinx.rst. This always works.
Take a look at sphinx.rst, which is at this same directory.
Read ../sphinx.rst, which is one directory above.
If you want the link to have a different rendered text other than the document's title, you need to use Sphinx's doc role. For example:
See :doc:`my custom link text for document sphinx <sphinx>`.
For most use cases, the former is preferred, as it is cleaner and more suited for people reading the source files. If you come across a :doc: usage that isn't adding any value, please feel free to convert it to just the document path.
For information on cross-referencing to kernel-doc functions or types, see Documentation/doc-guide/kernel-doc.rst.
Referencing commits #
References to git commits are automatically hyperlinked given that they are written in one of these formats:
commit 72bf4f1767f0
commit 72bf4f1767f0 ("net: do not leave an empty skb in write queue")
Figures & Images #
If you want to add an image, you should use the kernel-figure and kernel-image directives. E.g. to insert a figure with a scalable image format, use SVG (svg_image_example):
.. kernel-figure:: svg_image.svg
:alt: simple SVG image
SVG image example
SVG image example
The kernel figure (and image) directive supports DOT formatted files, see
A simple example (hello_dot_file):
.. kernel-figure:: hello.dot
:alt: hello world
DOT's hello world example
flowchart TB n0(["Hello"]) n1(["World"]) n0 --- n1
hello world
DOT's hello world example
Embedded render markups (or languages) like Graphviz's DOT are provided by the kernel-render directives.:
.. kernel-render:: DOT
:alt: foobar digraph
:caption: Embedded **DOT** (Graphviz) code
digraph foo {
"bar" -> "baz";
}
How this will be rendered depends on the installed tools. If Graphviz is installed, you will see a vector image. If not, the raw markup is inserted as literal-block (hello_dot_render).
flowchart TB n0(["bar"]) n1(["baz"]) n0 --> n1
foobar digraph
Embedded DOT (Graphviz) code
The render directive has all the options known from the figure directive, plus option caption. If caption has a value, a figure node is inserted. If not, an image node is inserted. A caption is also needed, if you want to refer to it (hello_svg_render).
Embedded SVG:
.. kernel-render:: SVG
:caption: Embedded **SVG** markup
:alt: so-nw-arrow
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" ...>
...
</svg>
Embedded SVG markup
The Linux Kernel documentation
Peios Kernel / Kernel development / Writing documentation
This is the top level of the kernel's documentation tree. Kernel documentation, like the kernel itself, is very much a work in progress; that is especially true as we work to integrate our many scattered documents into a coherent whole. Please note that improvements to the documentation are welcome; join the linux-doc list at vger.kernel.org if you want to help out.
Working with the development community #
The essential guides for interacting with the kernel's development community and getting your work upstream.
- Development process
- Submitting patches
- Code of conduct
- Maintainer handbook
- All development-process docs
Internal API manuals #
Manuals for use by developers working to interface with the rest of the kernel.
Development tools and processes #
Various other manuals with useful information for all kernel developers.
- Licensing rules
- Writing documentation
- Development tools
- Testing guide
- Hacking guide
- Tracing
- Fault injection
- Livepatching
- Rust
User-oriented documentation #
The following manuals are written for users of the kernel — those who are trying to get it to work optimally on a given system and application developers seeking information on the kernel's user-space APIs.
See also: the Linux man pages, which are kept separately from the kernel's own documentation.
Firmware-related documentation #
The following holds information on the kernel's expectations regarding the platform firmware.
Architecture-specific documentation #
Other documentation #
There are several unsorted documents that don't seem to fit on other parts of the documentation body, or may require some adjustments and/or conversion to reStructuredText format, or are simply too old.
Translations #
Indices and tables #
Kernel subsystem documentation
Peios Kernel / Kernel development / Writing documentation
These books get into the details of how specific kernel subsystems work from the point of view of a kernel developer. Much of the information here is taken directly from the kernel source, with supplemental material added as needed (or at least as we managed to add it — probably not all that is needed).
Core subsystems #
- Core API Documentation
- Driver implementer's API guide
- Memory Management Documentation
- Power Management
- Scheduler
- Timers
- index
Human interfaces #
- Input Documentation
- Human Interface Devices (HID)
- Sound Subsystem Documentation
- GPU Driver Developer's Guide
- Frame Buffer
- LEDs
Networking interfaces #
Storage interfaces #
Other subsystems #
Fixme: much more organizational work is needed here.
- Accounting
- CPUFreq - CPU frequency and voltage scaling code in the Linux(TM) kernel
- EDAC Subsystem
- FPGA
- I2C/SMBus Subsystem
- Industrial I/O
- PCMCIA
- Serial Peripheral Interface (SPI)
- 1-Wire Subsystem
- Watchdog Support
- Virtualization Support
- Hardware Monitoring
- Compute Accelerators
- Security Documentation
- Crypto API
- BPF Documentation
- USB support
- PCI Bus Subsystem
- Assorted Miscellaneous Devices Documentation
- PECI Subsystem
- WMI Subsystem
- TEE Subsystem
Kernel Maintainer Handbook
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This document is the humble beginning of a manual for kernel maintainers. There is a lot yet to go here! Please feel free to propose (and write) additions to this manual.
Configuring Git
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This chapter describes maintainer level git configuration.
Tagged branches used in pull requests (see Documentation/maintainer/pull-requests.rst) should be signed with the developers public GPG key. Signed tags can be created by passing -u <key-id> to git tag. However, since you would usually use the same key for the project, you can set it in the configuration and use the -s flag. To set the default key-id use:
git config user.signingkey "keyname"
Alternatively, edit your .git/config or ~/.gitconfig file by hand:
[user]
name = Jane Developer
email = jd@domain.org
signingkey = jd@domain.org
You may need to tell git to use gpg2:
[gpg]
program = /path/to/gpg2
You may also like to tell gpg which tty to use (add to your shell rc file):
export GPG_TTY=$(tty)
Feature and driver maintainers
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The term "maintainer" spans a very wide range of levels of engagement from people handling patches and pull requests as almost a full time job to people responsible for a small feature or a driver.
Unlike most of the chapter, this section is meant for the latter (more populous) group. It provides tips and describes the expectations and responsibilities of maintainers of a small(ish) section of the code.
Drivers and alike most often do not have their own mailing lists and git trees but instead send and review patches on the list of a larger subsystem.
Responsibilities #
The amount of maintenance work is usually proportional to the size and popularity of the code base. Small features and drivers should require relatively small amount of care and feeding. Nonetheless when the work does arrive (in form of patches which need review, user bug reports etc.) it has to be acted upon promptly. Even when a particular driver only sees one patch a month, or a quarter, a subsystem could well have a hundred such drivers. Subsystem maintainers cannot afford to wait a long time to hear from reviewers.
The exact expectations on the response time will vary by subsystem. The patch review SLA the subsystem had set for itself can sometimes be found in the subsystem documentation. Failing that as a rule of thumb reviewers should try to respond quicker than what is the usual patch review delay of the subsystem maintainer. The resulting expectations may range from two working days for fast-paced subsystems (e.g. networking) to as long as a few weeks in slower moving parts of the kernel.
Mailing list participation #
Linux kernel uses mailing lists as the primary form of communication. Maintainers must be subscribed and follow the appropriate subsystem-wide mailing list. Either by subscribing to the whole list or using more modern, selective setup like lei.
Maintainers must know how to communicate on the list (plain text, no invasive legal footers, no top posting, etc.)
Reviews #
Maintainers must review all patches touching exclusively their drivers, no matter how trivial. If the patch is a tree wide change and modifies multiple drivers - whether to provide a review is left to the maintainer.
When there are multiple maintainers for a piece of code an Acked-by or Reviewed-by tag (or review comments) from a single maintainer is enough to satisfy this requirement.
If the review process or validation for a particular change will take longer than the expected review timeline for the subsystem, maintainer should reply to the submission indicating that the work is being done, and when to expect full results.
Refactoring and core changes #
Occasionally core code needs to be changed to improve the maintainability of the kernel as a whole. Maintainers are expected to be present and help guide and test changes to their code to fit the new infrastructure.
Bug reports #
Maintainers must ensure severe problems in their code reported to them are resolved in a timely manner: regressions, kernel crashes, kernel warnings, compilation errors, lockups, data loss, and other bugs of similar scope.
Maintainers furthermore should respond to reports about other kinds of bugs as well, if the report is of reasonable quality or indicates a problem that might be severe -- especially if they have Supported status of the codebase in the MAINTAINERS file.
Open development #
Discussions about user reported issues, and development of new code should be conducted in a manner typical for the larger subsystem. It is common for development within a single company to be conducted behind closed doors. However, development and discussions initiated by community members must not be redirected from public to closed forums or to private email conversations. Reasonable exceptions to this guidance include discussions about security related issues.
Selecting the maintainer #
The previous section described the expectations of the maintainer, this section provides guidance on selecting one and describes common misconceptions.
The author #
Most natural and common choice of a maintainer is the author of the code. The author is intimately familiar with the code, so it is the best person to take care of it on an ongoing basis.
That said, being a maintainer is an active role. The MAINTAINERS file is not a list of credits (in fact a separate CREDITS file exists), it is a list of those who will actively help with the code. If the author does not have the time, interest or ability to maintain the code, a different maintainer must be selected.
Multiple maintainers #
Modern best practices dictate that there should be at least two maintainers for any piece of code, no matter how trivial. It spreads the burden, helps people take vacations and prevents burnout, trains new members of the community etc. etc. Even when there is clearly one perfect candidate, another maintainer should be found.
Maintainers must be human, therefore, it is not acceptable to add a mailing list or a group email as a maintainer. Trust and understanding are the foundation of kernel maintenance and one cannot build trust with a mailing list. Having a mailing list in addition to humans is perfectly fine.
Corporate structures #
To an outsider the Linux kernel may resemble a hierarchical organization with Linus as the CEO. While the code flows in a hierarchical fashion, the corporate template does not apply here. Linux is an anarchy held together by (rarely expressed) mutual respect, trust and convenience.
All that is to say that managers almost never make good maintainers. The maintainer position more closely matches an on-call rotation than a position of power.
The following characteristics of a person selected as a maintainer are clear red flags:
unknown to the community, never sent an email to the list before
did not author any of the code
(when development is contracted) works for a company which paid for the development rather than the company which did the work
Non compliance #
Subsystem maintainers may remove inactive maintainers from the MAINTAINERS file. If the maintainer was a significant author or played an important role in the development of the code, they should be moved to the CREDITS file.
Removing an inactive maintainer should not be seen as a punitive action. Having an inactive maintainer has a real cost as all developers have to remember to include the maintainers in discussions and subsystem maintainers spend brain power figuring out how to solicit feedback.
Subsystem maintainers may remove code for lacking maintenance.
Subsystem maintainers may refuse accepting code from companies which repeatedly neglected their maintainership duties.
Maintainer Entry Profile
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The Maintainer Entry Profile supplements the top-level process documents (submitting-patches, submitting drivers...) with subsystem/device-driver-local customs as well as details about the patch submission life-cycle. A contributor uses this document to level set their expectations and avoid common mistakes; maintainers may use these profiles to look across subsystems for opportunities to converge on common practices.
Overview #
Provide an introduction to how the subsystem operates. While MAINTAINERS tells the contributor where to send patches for which files, it does not convey other subsystem-local infrastructure and mechanisms that aid development.
Example questions to consider:
-
Are there notifications when patches are applied to the local tree, or merged upstream?
-
Does the subsystem have a patchwork instance? Are patchwork state changes notified?
-
Any bots or CI infrastructure that watches the list, or automated testing feedback that the subsystem uses to gate acceptance?
-
Git branches that are pulled into -next?
-
What branch should contributors submit against?
-
Links to any other Maintainer Entry Profiles? For example a device-driver may point to an entry for its parent subsystem. This makes the contributor aware of obligations a maintainer may have for other maintainers in the submission chain.
Submit Checklist Addendum #
List mandatory and advisory criteria, beyond the common "submit-checklist", for a patch to be considered healthy enough for maintainer attention. For example: "pass checkpatch.pl with no errors, or warning. Pass the unit test detailed at $URI".
The Submit Checklist Addendum can also include details about the status of related hardware specifications. For example, does the subsystem require published specifications at a certain revision before patches will be considered.
Key Cycle Dates #
One of the common misunderstandings of submitters is that patches can be sent at any time before the merge window closes and can still be considered for the next -rc1. The reality is that most patches need to be settled in soaking in linux-next in advance of the merge window opening. Clarify for the submitter the key dates (in terms of -rc release week) that patches might be considered for merging and when patches need to wait for the next -rc. At a minimum:
-
Last -rc for new feature submissions:
New feature submissions targeting the next merge window should have their first posting for consideration before this point. Patches that are submitted after this point should be clear that they are targeting the NEXT+1 merge window, or should come with sufficient justification why they should be considered on an expedited schedule. A general guideline is to set expectation with contributors that new feature submissions should appear before -rc5.
-
Last -rc to merge features: Deadline for merge decisions
Indicate to contributors the point at which an as yet un-applied patch set will need to wait for the NEXT+1 merge window. Of course there is no obligation to ever accept any given patchset, but if the review has not concluded by this point the expectation is the contributor should wait and resubmit for the following merge window.
Optional:
- First -rc at which the development baseline branch, listed in the overview section, should be considered ready for new submissions.
Review Cadence #
One of the largest sources of contributor angst is how soon to ping after a patchset has been posted without receiving any feedback. In addition to specifying how long to wait before a resubmission this section can also indicate a preferred style of update like, resend the full series, or privately send a reminder email. This section might also list how review works for this code area and methods to get feedback that are not directly from the maintainer.
Existing profiles #
For now, existing maintainer profiles are listed here; we will likely want to do something different in the near future.
- Documentation subsystem maintainer entry profile
- LIBNVDIMM Maintainer Entry Profile
- arch/riscv maintenance guidelines for developers
- SoC Subsystem
- SoC Platforms with DTS Compliance Requirements
- Media Subsystem Profile
- Networking subsystem (netdev)
- Acceptance criteria for vfio-pci device specific driver variants
- Linux NVMe feature and quirk policy
- NFSD Maintainer Entry Profile
- XFS Maintainer Entry Profile
- DAMON Maintainer Entry Profile
Handling messy pull-request diffstats
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Subsystem maintainers routinely use git request-pull as part of the process of sending work upstream. Normally, the result includes a nice diffstat that shows which files will be touched and how much of each will be changed. Occasionally, though, a repository with a relatively complicated development history will yield a massive diffstat containing a great deal of unrelated work. The result looks ugly and obscures what the pull request is actually doing. This document describes what is happening and how to fix things up; it is derived from The Wisdom of Linus Torvalds, found in Linus1 and Linus2.
A Git development history proceeds as a series of commits. In a simplified manner, mainline kernel development looks like this:
... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN
If one wants to see what has changed between two points, a command like this will do the job:
$ git diff --stat --summary vN-rc2..vN-rc3
Here, there are two clear points in the history; Git will essentially "subtract" the beginning point from the end point and display the resulting differences. The requested operation is unambiguous and easy enough to understand.
When a subsystem maintainer creates a branch and commits changes to it, the result in the simplest case is a history that looks like:
... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN
|
+-- c1 --- c2 --- ... --- cN
If that maintainer now uses git diff to see what has changed between the mainline branch (let's call it "linus") and cN, there are still two clear endpoints, and the result is as expected. So a pull request generated with git request-pull will also be as expected. But now consider a slightly more complex development history:
... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN
| |
| +-- c1 --- c2 --- ... --- cN
| /
+-- x1 --- x2 --- x3
Our maintainer has created one branch at vN-rc1 and another at vN-rc2; the two were then subsequently merged into c2. Now a pull request generated for cN may end up being messy indeed, and developers often end up wondering why.
What is happening here is that there are no longer two clear end points for the git diff operation to use. The development culminating in cN started in two different places; to generate the diffstat, git diff ends up having pick one of them and hoping for the best. If the diffstat starts at vN-rc1, it may end up including all of the changes between there and the second origin end point (vN-rc2), which is certainly not what our maintainer had in mind. With all of that extra junk in the diffstat, it may be impossible to tell what actually happened in the changes leading up to cN.
Maintainers often try to resolve this problem by, for example, rebasing the branch or performing another merge with the linus branch, then recreating the pull request. This approach tends not to lead to joy at the receiving end of that pull request; rebasing and/or merging just before pushing upstream is a well-known way to get a grumpy response.
So what is to be done? The best response when confronted with this situation is to indeed to do a merge with the branch you intend your work to be pulled into, but to do it privately, as if it were the source of shame. Create a new, throwaway branch and do the merge there:
... vM --- vN-rc1 --- vN-rc2 --- vN-rc3 --- ... --- vN-rc7 --- vN
| | |
| +-- c1 --- c2 --- ... --- cN |
| / | |
+-- x1 --- x2 --- x3 +------------+-- TEMP
The merge operation resolves all of the complications resulting from the multiple beginning points, yielding a coherent result that contains only the differences from the mainline branch. Now it will be possible to generate a diffstat with the desired information:
$ git diff -C --stat --summary linus..TEMP
Save the output from this command, then simply delete the TEMP branch; definitely do not expose it to the outside world. Take the saved diffstat output and edit it into the messy pull request, yielding a result that shows what is really going on. That request can then be sent upstream.
Modifying Patches
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
If you are a subsystem or branch maintainer, sometimes you need to slightly modify patches you receive in order to merge them, because the code is not exactly the same in your tree and the submitters'. If you stick strictly to rule (c) of the developers certificate of origin, you should ask the submitter to rediff, but this is a totally counter-productive waste of time and energy. Rule (b) allows you to adjust the code, but then it is very impolite to change one submitters code and make him endorse your bugs. To solve this problem, it is recommended that you add a line between the last Signed-off-by header and yours, indicating the nature of your changes. While there is nothing mandatory about this, it seems like prepending the description with your mail and/or name, all enclosed in square brackets, is noticeable enough to make it obvious that you are responsible for last-minute changes. Example:
Signed-off-by: Random J Developer <random@developer.example.org>
[lucky@maintainer.example.org: struct foo moved from foo.c to foo.h]
Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org>
This practice is particularly helpful if you maintain a stable branch and want at the same time to credit the author, track changes, merge the fix, and protect the submitter from complaints. Note that under no circumstances can you change the author's identity (the From header), as it is the one which appears in the changelog.
Special note to back-porters: It seems to be a common and useful practice to insert an indication of the origin of a patch at the top of the commit message (just after the subject line) to facilitate tracking. For instance, here's what we see in a 3.x-stable release:
Date: Tue Oct 7 07:26:38 2014 -0400
libata: Un-break ATA blacklist
commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream.
And here's what might appear in an older kernel once a patch is backported:
Date: Tue May 13 22:12:27 2008 +0200
wireless, airo: waitbusy() won't delay
[backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a]
Whatever the format, this information provides a valuable help to people tracking your trees, and to people trying to troubleshoot bugs in your tree.
Creating Pull Requests
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This chapter describes how maintainers can create and submit pull requests to other maintainers. This is useful for transferring changes from one maintainers tree to another maintainers tree.
This document was written by Tobin C. Harding (who at that time, was not an experienced maintainer) primarily from comments made by Greg Kroah-Hartman and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and Mauro Carvalho Chehab. Misrepresentation was unintentional but inevitable, please direct abuse to Tobin C. Harding <me@tobin.cc>.
Original email thread:
https://lore.kernel.org/r/20171114110500.GA21175@kroah.com
Create Branch #
To start with you will need to have all the changes you wish to include in the pull request on a separate branch. Typically you will base this branch off of a branch in the developers tree whom you intend to send the pull request to.
In order to create the pull request you must first tag the branch that you have just created. It is recommended that you choose a meaningful tag name, in a way that you and others can understand, even after some time. A good practice is to include in the name an indicator of the subsystem of origin and the target kernel version.
Greg offers the following. A pull request with miscellaneous stuff for drivers/char, to be applied at the Kernel version 4.15-rc1 could be named as char-misc-4.15-rc1. If such tag would be produced from a branch named char-misc-next, you would be using the following command:
git tag -s char-misc-4.15-rc1 char-misc-next
that will create a signed tag called char-misc-4.15-rc1 based on the last commit in the char-misc-next branch, and sign it with your gpg key (see Documentation/maintainer/configure-git.rst).
Linus will only accept pull requests based on a signed tag. Other maintainers may differ.
When you run the above command git will drop you into an editor and ask you to describe the tag. In this case, you are describing a pull request, so outline what is contained here, why it should be merged, and what, if any, testing has been done. All of this information will end up in the tag itself, and then in the merge commit that the maintainer makes if/when they merge the pull request. So write it up well, as it will be in the kernel tree forever.
As said by Linus:
Anyway, at least to me, the important part is the *message*. I want
to understand what I'm pulling, and why I should pull it. I also
want to use that message as the message for the merge, so it should
not just make sense to me, but make sense as a historical record
too.
Note that if there is something odd about the pull request, that
should very much be in the explanation. If you're touching files
that you don't maintain, explain _why_. I will see it in the
diffstat anyway, and if you didn't mention it, I'll just be extra
suspicious. And when you send me new stuff after the merge window
(or even bug-fixes, but ones that look scary), explain not just
what they do and why they do it, but explain the _timing_. What
happened that this didn't go through the merge window..
I will take both what you write in the email pull request _and_ in
the signed tag, so depending on your workflow, you can either
describe your work in the signed tag (which will also automatically
make it into the pull request email), or you can make the signed
tag just a placeholder with nothing interesting in it, and describe
the work later when you actually send me the pull request.
And yes, I will edit the message. Partly because I tend to do just
trivial formatting (the whole indentation and quoting etc), but
partly because part of the message may make sense for me at pull
time (describing the conflicts and your personal issues for sending
it right now), but may not make sense in the context of a merge
commit message, so I will try to make it all make sense. I will
also fix any speeling mistaeks and bad grammar I notice,
particularly for non-native speakers (but also for native ones
;^). But I may miss some, or even add some.
Linus
Greg gives, as an example pull request:
Char/Misc patches for 4.15-rc1
Here is the big char/misc patch set for the 4.15-rc1 merge window.
Contained in here is the normal set of new functions added to all
of these crazy drivers, as well as the following brand new
subsystems:
- time_travel_controller: Finally a set of drivers for the
latest time travel bus architecture that provides i/o to
the CPU before it asked for it, allowing uninterrupted
processing
- relativity_shifters: due to the affect that the
time_travel_controllers have on the overall system, there
was a need for a new set of relativity shifter drivers to
accommodate the newly formed black holes that would
threaten to suck CPUs into them. This subsystem handles
this in a way to successfully neutralize the problems.
There is a Kconfig option to force these to be enabled
when needed, so problems should not occur.
All of these patches have been successfully tested in the latest
linux-next releases, and the original problems that it found have
all been resolved (apologies to anyone living near Canberra for the
lack of the Kconfig options in the earlier versions of the
linux-next tree creations.)
Signed-off-by: Your-name-here <your_email@domain>
The tag message format is just like a git commit id. One line at the top for a "summary subject" and be sure to sign-off at the bottom.
Now that you have a local signed tag, you need to push it up to where it can be retrieved:
git push origin char-misc-4.15-rc1
Create Pull Request #
The last thing to do is create the pull request message. git handily will do this for you with the git request-pull command, but it needs a bit of help determining what you want to pull, and on what to base the pull against (to show the correct changes to be pulled and the diffstat). The following command(s) will generate a pull request:
git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1
Quoting Greg:
This is asking git to compare the difference from the
'char-misc-4.15-rc1' tag location, to the head of the 'master'
branch (which in my case points to the last location in Linus's
tree that I diverged from, usually a -rc release) and to use the
git:// protocol to pull from. If you wish to use https://, that
can be used here instead as well (but note that some people behind
firewalls will have problems with https git pulls).
If the char-misc-4.15-rc1 tag is not present in the repo that I am
asking to be pulled from, git will complain saying it is not there,
a handy way to remember to actually push it to a public location.
The output of 'git request-pull' will contain the location of the
git tree and specific tag to pull from, and the full text
description of that tag (which is why you need to provide good
information in that tag). It will also create a diffstat of the
pull request, and a shortlog of the individual commits that the
pull request will provide.
Linus responded that he tends to prefer the git:// protocol. Other maintainers may have different preferences. Also, note that if you are creating pull requests without a signed tag then https:// may be a better choice. Please see the original thread for the full discussion.
Submit Pull Request #
A pull request is submitted in the same way as an ordinary patch. Send as inline email to the maintainer and CC LKML and any sub-system specific lists if required. Pull requests to Linus typically have a subject line something like:
[GIT PULL] <subsystem> changes for v4.15-rc1
Rebasing and merging
Peios Kernel / Kernel development / Maintainer guidance
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Maintaining a subsystem, as a general rule, requires a familiarity with the Git source-code management system. Git is a powerful tool with a lot of features; as is often the case with such tools, there are right and wrong ways to use those features. This document looks in particular at the use of rebasing and merging. Maintainers often get in trouble when they use those tools incorrectly, but avoiding problems is not actually all that hard.
One thing to be aware of in general is that, unlike many other projects, the kernel community is not scared by seeing merge commits in its development history. Indeed, given the scale of the project, avoiding merges would be nearly impossible. Some problems encountered by maintainers result from a desire to avoid merges, while others come from merging a little too often.
Rebasing #
"Rebasing" is the process of changing the history of a series of commits within a repository. There are two different types of operations that are referred to as rebasing since both are done with the git rebase command, but there are significant differences between them:
Changing the parent (starting) commit upon which a series of patches is built. For example, a rebase operation could take a patch set built on the previous kernel release and base it, instead, on the current release. We'll call this operation "reparenting" in the discussion below.
Changing the history of a set of patches by fixing (or deleting) broken commits, adding patches, adding tags to commit changelogs, or changing the order in which commits are applied. In the following text, this type of operation will be referred to as "history modification"
The term "rebasing" will be used to refer to both of the above operations. Used properly, rebasing can yield a cleaner and clearer development history; used improperly, it can obscure that history and introduce bugs.
There are a few rules of thumb that can help developers to avoid the worst perils of rebasing:
History that has been exposed to the world beyond your private system should usually not be changed. Others may have pulled a copy of your tree and built on it; modifying your tree will create pain for them. If work is in need of rebasing, that is usually a sign that it is not yet ready to be committed to a public repository.
That said, there are always exceptions. Some trees (linux-next being a significant example) are frequently rebased by their nature, and developers know not to base work on them. Developers will sometimes expose an unstable branch for others to test with or for automated testing services. If you do expose a branch that may be unstable in this way, be sure that prospective users know not to base work on it.
Do not rebase a branch that contains history created by others. If you have pulled changes from another developer's repository, you are now a custodian of their history. You should not change it. With few exceptions, for example, a broken commit in a tree like this should be explicitly reverted rather than disappeared via history modification.
Do not reparent a tree without a good reason to do so. Just being on a newer base or avoiding a merge with an upstream repository is not generally a good reason.
If you must reparent a repository, do not pick some random kernel commit as the new base. The kernel is often in a relatively unstable state between release points; basing development on one of those points increases the chances of running into surprising bugs. When a patch series must move to a new base, pick a stable point (such as one of the -rc releases) to move to.
Realize that reparenting a patch series (or making significant history modifications) changes the environment in which it was developed and, likely, invalidates much of the testing that was done. A reparented patch series should, as a general rule, be treated like new code and retested from the beginning.
A frequent cause of merge-window trouble is when Linus is presented with a patch series that has clearly been reparented, often to a random commit, shortly before the pull request was sent. The chances of such a series having been adequately tested are relatively low - as are the chances of the pull request being acted upon.
If, instead, rebasing is limited to private trees, commits are based on a well-known starting point, and they are well tested, the potential for trouble is low.
Merging #
Merging is a common operation in the kernel development process; the 5.1 development cycle included 1,126 merge commits - nearly 9% of the total. Kernel work is accumulated in over 100 different subsystem trees, each of which may contain multiple topic branches; each branch is usually developed independently of the others. So naturally, at least one merge will be required before any given branch finds its way into an upstream repository.
Many projects require that branches in pull requests be based on the current trunk so that no merge commits appear in the history. The kernel is not such a project; any rebasing of branches to avoid merges will, most likely, lead to trouble.
Subsystem maintainers find themselves having to do two types of merges: from lower-level subsystem trees and from others, either sibling trees or the mainline. The best practices to follow differ in those two situations.
Merging from lower-level trees #
Larger subsystems tend to have multiple levels of maintainers, with the lower-level maintainers sending pull requests to the higher levels. Acting on such a pull request will almost certainly generate a merge commit; that is as it should be. In fact, subsystem maintainers may want to use the --no-ff flag to force the addition of a merge commit in the rare cases where one would not normally be created so that the reasons for the merge can be recorded. The changelog for the merge should, for any kind of merge, say why the merge is being done. For a lower-level tree, "why" is usually a summary of the changes that will come with that pull.
Maintainers at all levels should be using signed tags on their pull requests, and upstream maintainers should verify the tags when pulling branches. Failure to do so threatens the security of the development process as a whole.
As per the rules outlined above, once you have merged somebody else's history into your tree, you cannot rebase that branch, even if you otherwise would be able to.
Merging from sibling or upstream trees #
While merges from downstream are common and unremarkable, merges from other trees tend to be a red flag when it comes time to push a branch upstream. Such merges need to be carefully thought about and well justified, or there's a good chance that a subsequent pull request will be rejected.
It is natural to want to merge the master branch into a repository; this type of merge is often called a "back merge". Back merges can help to make sure that there are no conflicts with parallel development and generally gives a warm, fuzzy feeling of being up-to-date. But this temptation should be avoided almost all of the time.
Why is that? Back merges will muddy the development history of your own branch. They will significantly increase your chances of encountering bugs from elsewhere in the community and make it hard to ensure that the work you are managing is stable and ready for upstream. Frequent merges can also obscure problems with the development process in your tree; they can hide interactions with other trees that should not be happening (often) in a well-managed branch.
That said, back merges are occasionally required; when that happens, be sure to document why it was required in the commit message. As always, merge to a well-known stable point, rather than to some random commit. Even then, you should not back merge a tree above your immediate upstream tree; if a higher-level back merge is really required, the upstream tree should do it first.
One of the most frequent causes of merge-related trouble is when a maintainer merges with the upstream in order to resolve merge conflicts before sending a pull request. Again, this temptation is easy enough to understand, but it should absolutely be avoided. This is especially true for the final pull request: Linus is adamant that he would much rather see merge conflicts than unnecessary back merges. Seeing the conflicts lets him know where potential problem areas are. He does a lot of merges (382 in the 5.1 development cycle) and has gotten quite good at conflict resolution - often better than the developers involved.
So what should a maintainer do when there is a conflict between their subsystem branch and the mainline? The most important step is to warn Linus in the pull request that the conflict will happen; if nothing else, that demonstrates an awareness of how your branch fits into the whole. For especially difficult conflicts, create and push a separate branch to show how you would resolve things. Mention that branch in your pull request, but the pull request itself should be for the unmerged branch.
Even in the absence of known conflicts, doing a test merge before sending a pull request is a good idea. It may alert you to problems that you somehow didn't see from linux-next and helps to understand exactly what you are asking upstream to do.
Another reason for doing merges of upstream or another subsystem tree is to resolve dependencies. These dependency issues do happen at times, and sometimes a cross-merge with another tree is the best way to resolve them; as always, in such situations, the merge commit should explain why the merge has been done. Take a moment to do it right; people will read those changelogs.
Often, though, dependency issues indicate that a change of approach is needed. Merging another subsystem tree to resolve a dependency risks bringing in other bugs and should almost never be done. If that subsystem tree fails to be pulled upstream, whatever problems it had will block the merging of your tree as well. Preferable alternatives include agreeing with the maintainer to carry both sets of changes in one of the trees or creating a topic branch dedicated to the prerequisite commits that can be merged into both trees. If the dependency is related to major infrastructural changes, the right solution might be to hold the dependent commits for one development cycle so that those changes have time to stabilize in the mainline.
Finally #
It is relatively common to merge with the mainline toward the beginning of the development cycle in order to pick up changes and fixes done elsewhere in the tree. As always, such a merge should pick a well-known release point rather than some random spot. If your upstream-bound branch has emptied entirely into the mainline during the merge window, you can pull it forward with a command like:
git merge --ff-only v5.2-rc1
The guidelines laid out above are just that: guidelines. There will always be situations that call out for a different solution, and these guidelines should not prevent developers from doing the right thing when the need arises. But one should always think about whether the need has truly arisen and be prepared to explain why something abnormal needs to be done.
Working with the kernel development community
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
So you want to be a Linux kernel developer? Welcome! While there is a lot to be learned about the kernel in a technical sense, it is also important to learn about how our community works. Reading these documents will make it much easier for you to get your changes merged with a minimum of trouble.
An introduction to how kernel development works #
Read these documents first: an understanding of the material here will ease your entry into the kernel community.
- HOWTO do Linux kernel development
- A guide to the Kernel Development Process
- Submitting patches: the essential guide to getting your code into the kernel
- Linux Kernel patch submission checklist
Tools and technical guides for kernel developers #
This is a collection of material that kernel developers should be familiar with.
- Minimal requirements to compile the Kernel
- Programming Language
- Linux kernel coding style
- Kernel Maintainer PGP guide
- Email clients info for Linux
- Applying Patches To The Linux Kernel
- Backporting and conflict resolution
- Adding a New System Call
- Why the "volatile" type class should not be used
- (How to avoid) Botching up ioctls
Policy guides and developer statements #
These are the rules that we try to live by in the kernel community (and beyond).
- Linux kernel licensing rules
- Contributor Covenant Code of Conduct
- Linux Kernel Contributor Covenant Code of Conduct Interpretation
- Linux Kernel Contribution Maturity Model
- Linux Kernel Enforcement Statement
- Kernel Driver Statement
- The Linux Kernel Driver Interface
- Everything you ever wanted to know about Linux -stable releases
- Linux kernel management style
- Researcher Guidelines
- Kernel Guidelines for Tool-Generated Content
- AI Coding Assistants
- Linux kernel project continuity
Dealing with bugs #
Bugs are a fact of life; it is important that we handle them properly. The documents below provide general advice about debugging and describe our policies around the handling of a couple of special classes of bugs: regressions and security problems.
- Debugging advice for Linux Kernel developers
- Handling regressions
- Security bugs
- CVEs
- Embargoed hardware issues
Maintainer information #
How to find the people who will accept your patches.
Other material #
Here are some other guides to the community that are of interest to most developers:
Introduction
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Executive summary #
The rest of this section covers the scope of the kernel development process and the kinds of frustrations that developers and their employers can encounter there. There are a great many reasons why kernel code should be merged into the official ("mainline") kernel, including automatic availability to users, community support in many forms, and the ability to influence the direction of kernel development. Code contributed to the Linux kernel must be made available under a GPL-compatible license.
How the development process works introduces the development process, the kernel release cycle, and the mechanics of the merge window. The various phases in the patch development, review, and merging cycle are covered. There is some discussion of tools and mailing lists. Developers wanting to get started with kernel development are encouraged to track down and fix bugs as an initial exercise.
Early-stage planning covers early-stage project planning, with an emphasis on involving the development community as soon as possible.
Getting the code right is about the coding process; several pitfalls which have been encountered by other developers are discussed. Some requirements for patches are covered, and there is an introduction to some of the tools which can help to ensure that kernel patches are correct.
Posting patches talks about the process of posting patches for review. To be taken seriously by the development community, patches must be properly formatted and described, and they must be sent to the right place. Following the advice in this section should help to ensure the best possible reception for your work.
Followthrough covers what happens after posting patches; the job is far from done at that point. Working with reviewers is a crucial part of the development process; this section offers a number of tips on how to avoid problems at this important stage. Developers are cautioned against assuming that the job is done when a patch is merged into the mainline.
Advanced topics introduces a couple of "advanced" topics: managing patches with git and reviewing patches posted by others.
For more information concludes the document with pointers to sources for more information on kernel development.
What this document is about #
The Linux kernel, at over 8 million lines of code and well over 1000 contributors to each release, is one of the largest and most active free software projects in existence. Since its humble beginning in 1991, this kernel has evolved into a best-of-breed operating system component which runs on pocket-sized digital music players, desktop PCs, the largest supercomputers in existence, and all types of systems in between. It is a robust, efficient, and scalable solution for almost any situation.
With the growth of Linux has come an increase in the number of developers (and companies) wishing to participate in its development. Hardware vendors want to ensure that Linux supports their products well, making those products attractive to Linux users. Embedded systems vendors, who use Linux as a component in an integrated product, want Linux to be as capable and well-suited to the task at hand as possible. Distributors and other software vendors who base their products on Linux have a clear interest in the capabilities, performance, and reliability of the Linux kernel. And end users, too, will often wish to change Linux to make it better suit their needs.
One of the most compelling features of Linux is that it is accessible to these developers; anybody with the requisite skills can improve Linux and influence the direction of its development. Proprietary products cannot offer this kind of openness, which is a characteristic of the free software process. But, if anything, the kernel is even more open than most other free software projects. A typical three-month kernel development cycle can involve over 1000 developers working for more than 100 different companies (or for no company at all).
Working with the kernel development community is not especially hard. But, that notwithstanding, many potential contributors have experienced difficulties when trying to do kernel work. The kernel community has evolved its own distinct ways of operating which allow it to function smoothly (and produce a high-quality product) in an environment where thousands of lines of code are being changed every day. So it is not surprising that Linux kernel development process differs greatly from proprietary development methods.
The kernel's development process may come across as strange and intimidating to new developers, but there are good reasons and solid experience behind it. A developer who does not understand the kernel community's ways (or, worse, who tries to flout or circumvent them) will have a frustrating experience in store. The development community, while being helpful to those who are trying to learn, has little time for those who will not listen or who do not care about the development process.
It is hoped that those who read this document will be able to avoid that frustrating experience. There is a lot of material here, but the effort involved in reading it will be repaid in short order. The development community is always in need of developers who will help to make the kernel better; the following text should help you - or those who work for you - join our community.
Credits #
This document was written by Jonathan Corbet, corbet@lwn.net. It has been improved by comments from Johannes Berg, James Berry, Alex Chiang, Roland Dreier, Randy Dunlap, Jake Edge, Jiri Kosina, Matt Mackall, Arthur Marsh, Amanda McPherson, Andrew Morton, Andrew Price, Tsugikazu Shibata, and Jochen Voß.
This work was supported by the Linux Foundation; thanks especially to Amanda McPherson, who saw the value of this effort and made it all happen.
The importance of getting code into the mainline #
Some companies and developers occasionally wonder why they should bother learning how to work with the kernel community and get their code into the mainline kernel (the "mainline" being the kernel maintained by Linus Torvalds and used as a base by Linux distributors). In the short term, contributing code can look like an avoidable expense; it seems easier to just keep the code separate and support users directly. The truth of the matter is that keeping code separate ("out of tree") is a false economy.
As a way of illustrating the costs of out-of-tree code, here are a few relevant aspects of the kernel development process; most of these will be discussed in greater detail later in this document. Consider:
-
Code which has been merged into the mainline kernel is available to all Linux users. It will automatically be present on all distributions which enable it. There is no need for driver disks, downloads, or the hassles of supporting multiple versions of multiple distributions; it all just works, for the developer and for the user. Incorporation into the mainline solves a large number of distribution and support problems.
-
While kernel developers strive to maintain a stable interface to user space, the internal kernel API is in constant flux. The lack of a stable internal interface is a deliberate design decision; it allows fundamental improvements to be made at any time and results in higher-quality code. But one result of that policy is that any out-of-tree code requires constant upkeep if it is to work with new kernels. Maintaining out-of-tree code requires significant amounts of work just to keep that code working.
Code which is in the mainline, instead, does not require this work as the result of a simple rule requiring any developer who makes an API change to also fix any code that breaks as the result of that change. So code which has been merged into the mainline has significantly lower maintenance costs.
-
Beyond that, code which is in the kernel will often be improved by other developers. Surprising results can come from empowering your user community and customers to improve your product.
-
Kernel code is subjected to review, both before and after merging into the mainline. No matter how strong the original developer's skills are, this review process invariably finds ways in which the code can be improved. Often review finds severe bugs and security problems. This is especially true for code which has been developed in a closed environment; such code benefits strongly from review by outside developers. Out-of-tree code is lower-quality code.
-
Participation in the development process is your way to influence the direction of kernel development. Users who complain from the sidelines are heard, but active developers have a stronger voice - and the ability to implement changes which make the kernel work better for their needs.
-
When code is maintained separately, the possibility that a third party will contribute a different implementation of a similar feature always exists. Should that happen, getting your code merged will become much harder - to the point of impossibility. Then you will be faced with the unpleasant alternatives of either (1) maintaining a nonstandard feature out of tree indefinitely, or (2) abandoning your code and migrating your users over to the in-tree version.
-
Contribution of code is the fundamental action which makes the whole process work. By contributing your code you can add new functionality to the kernel and provide capabilities and examples which are of use to other kernel developers. If you have developed code for Linux (or are thinking about doing so), you clearly have an interest in the continued success of this platform; contributing code is one of the best ways to help ensure that success.
All of the reasoning above applies to any out-of-tree kernel code, including code which is distributed in proprietary, binary-only form. There are, however, additional factors which should be taken into account before considering any sort of binary-only kernel code distribution. These include:
-
The legal issues around the distribution of proprietary kernel modules are cloudy at best; quite a few kernel copyright holders believe that most binary-only modules are derived products of the kernel and that, as a result, their distribution is a violation of the GNU General Public License (about which more will be said below). Your author is not a lawyer, and nothing in this document can possibly be considered to be legal advice. The true legal status of closed-source modules can only be determined by the courts. But the uncertainty which haunts those modules is there regardless.
-
Binary modules greatly increase the difficulty of debugging kernel problems, to the point that most kernel developers will not even try. So the distribution of binary-only modules will make it harder for your users to get support from the community.
-
Support is also harder for distributors of binary-only modules, who must provide a version of the module for every distribution and every kernel version they wish to support. Dozens of builds of a single module can be required to provide reasonably comprehensive coverage, and your users will have to upgrade your module separately every time they upgrade their kernel.
-
Everything that was said above about code review applies doubly to closed-source code. Since this code is not available at all, it cannot have been reviewed by the community and will, beyond doubt, have serious problems.
Makers of embedded systems, in particular, may be tempted to disregard much of what has been said in this section in the belief that they are shipping a self-contained product which uses a frozen kernel version and requires no more development after its release. This argument misses the value of widespread code review and the value of allowing your users to add capabilities to your product. But these products, too, have a limited commercial life, after which a new version must be released. At that point, vendors whose code is in the mainline and well maintained will be much better positioned to get the new product ready for market quickly.
Licensing #
Code is contributed to the Linux kernel under a number of licenses, but all code must be compatible with version 2 of the GNU General Public License (GPLv2), which is the license covering the kernel distribution as a whole. In practice, that means that all code contributions are covered either by GPLv2 (with, optionally, language allowing distribution under later versions of the GPL) or the three-clause BSD license. Any contributions which are not covered by a compatible license will not be accepted into the kernel.
Copyright assignments are not required (or requested) for code contributed to the kernel. All code merged into the mainline kernel retains its original ownership; as a result, the kernel now has thousands of owners.
One implication of this ownership structure is that any attempt to change the licensing of the kernel is doomed to almost certain failure. There are few practical scenarios where the agreement of all copyright holders could be obtained (or their code removed from the kernel). So, in particular, there is no prospect of a migration to version 3 of the GPL in the foreseeable future.
It is imperative that all code contributed to the kernel be legitimately free software. For that reason, code from contributors without a known identity or anonymous contributors will not be accepted. All contributors are required to "sign off" on their code, stating that the code can be distributed with the kernel under the GPL. Code which has not been licensed as free software by its owner, or which risks creating copyright-related problems for the kernel (such as code which derives from reverse-engineering efforts lacking proper safeguards) cannot be contributed.
Questions about copyright-related issues are common on Linux development mailing lists. Such questions will normally receive no shortage of answers, but one should bear in mind that the people answering those questions are not lawyers and cannot provide legal advice. If you have legal questions relating to Linux source code, there is no substitute for talking with a lawyer who understands this field. Relying on answers obtained on technical mailing lists is a risky affair.
How the development process works
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Linux kernel development in the early 1990s was a pretty loose affair, with relatively small numbers of users and developers involved. With a user base in the millions and with some 2,000 developers involved over the course of one year, the kernel has since had to evolve a number of processes to keep development happening smoothly. A solid understanding of how the process works is required in order to be an effective part of it.
The big picture #
The Linux kernel uses a loosely time-based, rolling release development model. A new major kernel release (which we will call, as an example, 9.x) 1 happens every two or three months, which comes with new features, internal API changes, and more. A typical release can contain about 13,000 changesets with changes to several hundred thousand lines of code. Recent releases, along with their dates, can be found at Wikipedia.
[1] Strictly speaking, the Linux kernel does not use semantic versioning number scheme, but rather the 9.x pair identifies major release version as a whole number. For each release, x is incremented, but 9 is incremented only if x is deemed large enough (e.g. Linux 5.0 is released following Linux 4.20).
A relatively straightforward discipline is followed with regard to the merging of patches for each release. At the beginning of each development cycle, the "merge window" is said to be open. At that time, code which is deemed to be sufficiently stable (and which is accepted by the development community) is merged into the mainline kernel. The bulk of changes for a new development cycle (and all of the major changes) will be merged during this time, at a rate approaching 1,000 changes ("patches," or "changesets") per day.
(As an aside, it is worth noting that the changes integrated during the merge window do not come out of thin air; they have been collected, tested, and staged ahead of time. How that process works will be described in detail later on).
The merge window lasts for approximately two weeks. At the end of this time, Linus Torvalds will declare that the window is closed and release the first of the "rc" kernels. For the kernel which is destined to be 9.x, for example, the release which happens at the end of the merge window will be called 9.x-rc1. The -rc1 release is the signal that the time to merge new features has passed, and that the time to stabilize the next kernel has begun.
Over the next six to ten weeks, only patches which fix problems should be submitted to the mainline. On occasion a more significant change will be allowed, but such occasions are rare; developers who try to merge new features outside of the merge window tend to get an unfriendly reception. As a general rule, if you miss the merge window for a given feature, the best thing to do is to wait for the next development cycle. (An occasional exception is made for drivers for previously-unsupported hardware; if they touch no in-tree code, they cannot cause regressions and should be safe to add at any time).
As fixes make their way into the mainline, the patch rate will slow over time. Linus releases new -rc kernels about once a week; a normal series will get up to somewhere between -rc6 and -rc9 before the kernel is considered to be sufficiently stable and the final release is made. At that point the whole process starts over again.
As an example, here is how the 5.4 development cycle went (all dates in 2019):
September 15
5.3 stable release
September 30
5.4-rc1, merge window closes
October 6
5.4-rc2
October 13
5.4-rc3
October 20
5.4-rc4
October 27
5.4-rc5
November 3
5.4-rc6
November 10
5.4-rc7
November 17
5.4-rc8
November 24
5.4 stable release
How do the developers decide when to close the development cycle and create the stable release? The most significant metric used is the list of regressions from previous releases. No bugs are welcome, but those which break systems which worked in the past are considered to be especially serious. For this reason, patches which cause regressions are looked upon unfavorably and are quite likely to be reverted during the stabilization period.
The developers' goal is to fix all known regressions before the stable release is made. In the real world, this kind of perfection is hard to achieve; there are just too many variables in a project of this size. There comes a point where delaying the final release just makes the problem worse; the pile of changes waiting for the next merge window will grow larger, creating even more regressions the next time around. So most kernels go out with a handful of known regressions, though, hopefully, none of them are serious.
Once a stable release is made, its ongoing maintenance is passed off to the "stable team," currently consists of Greg Kroah-Hartman and Sasha Levin. The stable team will release occasional updates to the stable release using the 9.x.y numbering scheme.
To be considered for an update release, a patch must (1) fix a significant bug, and (2) already be merged into the mainline for the next development kernel. Kernels will typically receive stable updates for a little more than one development cycle past their initial release. So, for example, the 5.2 kernel's history looked like this (all dates in 2019):
July 7
5.2 stable release
July 14
5.2.1
July 21
5.2.2
July 26
5.2.3
July 28
5.2.4
July 31
5.2.5
...
...
October 11
5.2.21
5.2.21 was the final stable update of the 5.2 release.
Some kernels are designated "long term" kernels; they will receive support for a longer period. Please refer to the following link for the list of active long term kernel versions and their maintainers:
The selection of a kernel for long-term support is purely a matter of a maintainer having the need and the time to maintain that release. There are no known plans for long-term support for any specific upcoming release.
The lifecycle of a patch #
Patches do not go directly from the developer's keyboard into the mainline kernel. There is, instead, a somewhat involved (if somewhat informal) process designed to ensure that each patch is reviewed for quality and that each patch implements a change which is desirable to have in the mainline. This process can happen quickly for minor fixes, or, in the case of large and controversial changes, go on for years. Much developer frustration comes from a lack of understanding of this process or from attempts to circumvent it.
In the hopes of reducing that frustration, this document will describe how a patch gets into the kernel. What follows below is an introduction which describes the process in a somewhat idealized way. A much more detailed treatment will come in later sections.
The stages that a patch goes through are, generally:
Design. This is where the real requirements for the patch - and the way those requirements will be met - are laid out. Design work is often done without involving the community, but it is better to do this work in the open if at all possible; it can save a lot of time redesigning things later.
Early review. Patches are posted to the relevant mailing list, and developers on that list reply with any comments they may have. This process should turn up any major problems with a patch if all goes well.
Wider review. When the patch is getting close to ready for mainline inclusion, it should be accepted by a relevant subsystem maintainer - though this acceptance is not a guarantee that the patch will make it all the way to the mainline. The patch will show up in the maintainer's subsystem tree and into the -next trees (described below). When the process works, this step leads to more extensive review of the patch and the discovery of any problems resulting from the integration of this patch with work being done by others.
- Please note that most maintainers also have day jobs, so merging your patch may not be their highest priority. If your patch is getting feedback about changes that are needed, you should either make those changes or justify why they should not be made. If your patch has no review complaints but is not being merged by its appropriate subsystem or driver maintainer, you should be persistent in updating the patch to the current kernel so that it applies cleanly and keep sending it for review and merging.
Merging into the mainline. Eventually, a successful patch will be merged into the mainline repository managed by Linus Torvalds. More comments and/or problems may surface at this time; it is important that the developer be responsive to these and fix any issues which arise.
Stable release. The number of users potentially affected by the patch is now large, so, once again, new problems may arise.
Long-term maintenance. While it is certainly possible for a developer to forget about code after merging it, that sort of behavior tends to leave a poor impression in the development community. Merging code eliminates some of the maintenance burden, in that others will fix problems caused by API changes. But the original developer should continue to take responsibility for the code if it is to remain useful in the longer term.
One of the largest mistakes made by kernel developers (or their employers) is to try to cut the process down to a single "merging into the mainline" step. This approach invariably leads to frustration for everybody involved.
How patches get into the Kernel #
There is exactly one person who can merge patches into the mainline kernel repository: Linus Torvalds. But, for example, of the over 9,500 patches which went into the 2.6.38 kernel, only 112 (around 1.3%) were directly chosen by Linus himself. The kernel project has long since grown to a size where no single developer could possibly inspect and select every patch unassisted. The way the kernel developers have addressed this growth is through the use of a lieutenant system built around a chain of trust.
The kernel code base is logically broken down into a set of subsystems: networking, specific architecture support, memory management, video devices, etc. Most subsystems have a designated maintainer, a developer who has overall responsibility for the code within that subsystem. These subsystem maintainers are the gatekeepers (in a loose way) for the portion of the kernel they manage; they are the ones who will (usually) accept a patch for inclusion into the mainline kernel.
Subsystem maintainers each manage their own version of the kernel source tree, usually (but certainly not always) using the git source management tool. Tools like git (and related tools like quilt or mercurial) allow maintainers to track a list of patches, including authorship information and other metadata. At any given time, the maintainer can identify which patches in his or her repository are not found in the mainline.
When the merge window opens, top-level maintainers will ask Linus to "pull" the patches they have selected for merging from their repositories. If Linus agrees, the stream of patches will flow up into his repository, becoming part of the mainline kernel. The amount of attention that Linus pays to specific patches received in a pull operation varies. It is clear that, sometimes, he looks quite closely. But, as a general rule, Linus trusts the subsystem maintainers to not send bad patches upstream.
Subsystem maintainers, in turn, can pull patches from other maintainers. For example, the networking tree is built from patches which accumulated first in trees dedicated to network device drivers, wireless networking, etc. This chain of repositories can be arbitrarily long, though it rarely exceeds two or three links. Since each maintainer in the chain trusts those managing lower-level trees, this process is known as the "chain of trust."
Clearly, in a system like this, getting patches into the kernel depends on finding the right maintainer. Sending patches directly to Linus is not normally the right way to go.
Next trees #
The chain of subsystem trees guides the flow of patches into the kernel, but it also raises an interesting question: what if somebody wants to look at all of the patches which are being prepared for the next merge window? Developers will be interested in what other changes are pending to see whether there are any conflicts to worry about; a patch which changes a core kernel function prototype, for example, will conflict with any other patches which use the older form of that function. Reviewers and testers want access to the changes in their integrated form before all of those changes land in the mainline kernel. One could pull changes from all of the interesting subsystem trees, but that would be a big and error-prone job.
The answer comes in the form of -next trees, where subsystem trees are collected for testing and review. The older of these trees, maintained by Andrew Morton, is called "-mm" (for memory management, which is how it got started). The -mm tree integrates patches from a long list of subsystem trees; it also has some patches aimed at helping with debugging.
Beyond that, -mm contains a significant collection of patches which have been selected by Andrew directly. These patches may have been posted on a mailing list, or they may apply to a part of the kernel for which there is no designated subsystem tree. As a result, -mm operates as a sort of subsystem tree of last resort; if there is no other obvious path for a patch into the mainline, it is likely to end up in -mm. Miscellaneous patches which accumulate in -mm will eventually either be forwarded on to an appropriate subsystem tree or be sent directly to Linus. In a typical development cycle, approximately 5-10% of the patches going into the mainline get there via -mm.
The current -mm patch is available in the "mmotm" (-mm of the moment) directory at:
Use of the MMOTM tree is likely to be a frustrating experience, though; there is a definite chance that it will not even compile.
The primary tree for next-cycle patch merging is linux-next, maintained by Stephen Rothwell. The linux-next tree is, by design, a snapshot of what the mainline is expected to look like after the next merge window closes. Linux-next trees are announced on the linux-kernel and linux-next mailing lists when they are assembled; they can be downloaded from:
Linux-next has become an integral part of the kernel development process; all patches merged during a given merge window should really have found their way into linux-next some time before the merge window opens.
Staging trees #
The kernel source tree contains the drivers/staging/ directory, where many sub-directories for drivers or filesystems that are on their way to being added to the kernel tree live. They remain in drivers/staging while they still need more work; once complete, they can be moved into the kernel proper. This is a way to keep track of drivers that aren't up to Linux kernel coding or quality standards, but people may want to use them and track development.
Greg Kroah-Hartman currently maintains the staging tree. Drivers that still need work are sent to him, with each driver having its own subdirectory in drivers/staging/. Along with the driver source files, a TODO file should be present in the directory as well. The TODO file lists the pending work that the driver needs for acceptance into the kernel proper, as well as a list of people that should be Cc'd for any patches to the driver. Current rules require that drivers contributed to staging must, at a minimum, compile properly.
Staging can be a relatively easy way to get new drivers into the mainline where, with luck, they will come to the attention of other developers and improve quickly. Entry into staging is not the end of the story, though; code in staging which is not seeing regular progress will eventually be removed. Distributors also tend to be relatively reluctant to enable staging drivers. So staging is, at best, a stop on the way toward becoming a proper mainline driver.
Tools #
As can be seen from the above text, the kernel development process depends heavily on the ability to herd collections of patches in various directions. The whole thing would not work anywhere near as well as it does without suitably powerful tools. Tutorials on how to use these tools are well beyond the scope of this document, but there is space for a few pointers.
By far the dominant source code management system used by the kernel community is git. Git is one of a number of distributed version control systems being developed in the free software community. It is well tuned for kernel development, in that it performs quite well when dealing with large repositories and large numbers of patches. It also has a reputation for being difficult to learn and use, though it has gotten better over time. Some sort of familiarity with git is almost a requirement for kernel developers; even if they do not use it for their own work, they'll need git to keep up with what other developers (and the mainline) are doing.
Git is now packaged by almost all Linux distributions. There is a home page at:
That page has pointers to documentation and tutorials.
Among the kernel developers who do not use git, the most popular choice is almost certainly Mercurial:
Mercurial shares many features with git, but it provides an interface which many find easier to use.
The other tool worth knowing about is Quilt:
Quilt is a patch management system, rather than a source code management system. It does not track history over time; it is, instead, oriented toward tracking a specific set of changes against an evolving code base. Some major subsystem maintainers use quilt to manage patches intended to go upstream. For the management of certain kinds of trees (-mm, for example), quilt is the best tool for the job.
Mailing lists #
A great deal of Linux kernel development work is done by way of mailing lists. It is hard to be a fully-functioning member of the community without joining at least one list somewhere. But Linux mailing lists also represent a potential hazard to developers, who risk getting buried under a load of electronic mail, running afoul of the conventions used on the Linux lists, or both.
Most kernel mailing lists are hosted at kernel.org; the master list can be found at:
There are lists hosted elsewhere; please check the MAINTAINERS file for the list relevant for any particular subsystem.
The core mailing list for kernel development is, of course, linux-kernel. This list is an intimidating place to be; volume can reach 500 messages per day, the amount of noise is high, the conversation can be severely technical, and participants are not always concerned with showing a high degree of politeness. But there is no other place where the kernel development community comes together as a whole; developers who avoid this list will miss important information.
There are a few hints which can help with linux-kernel survival:
-
Have the list delivered to a separate folder, rather than your main mailbox. One must be able to ignore the stream for sustained periods of time.
-
Do not try to follow every conversation - nobody else does. It is important to filter on both the topic of interest (though note that long-running conversations can drift away from the original subject without changing the email subject line) and the people who are participating.
-
Do not feed the trolls. If somebody is trying to stir up an angry response, ignore them.
-
When responding to linux-kernel email (or that on other lists) preserve the Cc: header for all involved. In the absence of a strong reason (such as an explicit request), you should never remove recipients. Always make sure that the person you are responding to is in the Cc: list. This convention also makes it unnecessary to explicitly ask to be copied on replies to your postings.
-
Search the list archives (and the net as a whole) before asking questions. Some developers can get impatient with people who clearly have not done their homework.
-
Use interleaved ("inline") replies, which makes your response easier to read. (i.e. avoid top-posting -- the practice of putting your answer above the quoted text you are responding to.) For more details, see Documentation/process/submitting-patches.rst.
-
Ask on the correct mailing list. Linux-kernel may be the general meeting point, but it is not the best place to find developers from all subsystems.
The last point - finding the correct mailing list - is a common place for beginning developers to go wrong. Somebody who asks a networking-related question on linux-kernel will almost certainly receive a polite suggestion to ask on the netdev list instead, as that is the list frequented by most networking developers. Other lists exist for the SCSI, video4linux, IDE, filesystem, etc. subsystems. The best place to look for mailing lists is in the MAINTAINERS file packaged with the kernel source.
Getting started with Kernel development #
Questions about how to get started with the kernel development process are common - from both individuals and companies. Equally common are missteps which make the beginning of the relationship harder than it has to be.
Companies often look to hire well-known developers to get a development group started. This can, in fact, be an effective technique. But it also tends to be expensive and does not do much to grow the pool of experienced kernel developers. It is possible to bring in-house developers up to speed on Linux kernel development, given the investment of a bit of time. Taking this time can endow an employer with a group of developers who understand the kernel and the company both, and who can help to train others as well. Over the medium term, this is often the more profitable approach.
Individual developers are often, understandably, at a loss for a place to start. Beginning with a large project can be intimidating; one often wants to test the waters with something smaller first. This is the point where some developers jump into the creation of patches fixing spelling errors or minor coding style issues. Unfortunately, such patches create a level of noise which is distracting for the development community as a whole, so, increasingly, they are looked down upon. New developers wishing to introduce themselves to the community will not get the sort of reception they wish for by these means.
Andrew Morton gives this advice for aspiring kernel developers
The #1 project for all kernel beginners should surely be "make sure
that the kernel runs perfectly at all times on all machines which
you can lay your hands on". Usually the way to do this is to work
with others on getting things fixed up (this can require
persistence!) but that's fine - it's a part of kernel development.
(https://lwn.net/Articles/283982/).
In the absence of obvious problems to fix, developers are advised to look at the current lists of regressions and open bugs in general. There is never any shortage of issues in need of fixing; by addressing these issues, developers will gain experience with the process while, at the same time, building respect with the rest of the development community.
Early-stage planning
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
When contemplating a Linux kernel development project, it can be tempting to jump right in and start coding. As with any significant project, though, much of the groundwork for success is best laid before the first line of code is written. Some time spent in early planning and communication can save far more time later on.
Specifying the problem #
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 easy: when a driver is needed for a specific piece of hardware, for example. In others, though, it is tempting to confuse the real problem with the proposed solution, and that can lead to difficulties.
Consider an example: some years ago, developers working with Linux audio sought a way to run applications without dropouts or other artifacts caused by excessive latency in the system. The solution they arrived at was a kernel module intended to hook into the Linux Security Module (LSM) framework; this module could be configured to give specific applications access to the realtime scheduler. This module was implemented and sent to the linux-kernel mailing list, where it immediately ran into problems.
To the audio developers, this security module was sufficient to solve their immediate problem. To the wider kernel community, though, it was seen as a misuse of the LSM framework (which is not intended to confer privileges onto processes which they would not otherwise have) and a risk to system stability. Their preferred solutions involved realtime scheduling access via the rlimit mechanism for the short term, and ongoing latency reduction work in the long term.
The audio community, however, could not see past the particular solution they had implemented; they were unwilling to accept alternatives. The resulting disagreement left those developers feeling disillusioned with the entire kernel development process; one of them went back to an audio list and posted this:
There are a number of very good Linux kernel developers, but they tend to get outshouted by a large crowd of arrogant fools. Trying to communicate user requirements to these people is a waste of time. They are much too "intelligent" to listen to lesser mortals.
(https://lwn.net/Articles/131776/).
The reality of the situation was different; the kernel developers were far more concerned about system stability, long-term maintenance, and finding the right solution to the problem than they were with a specific module. The moral of the story is to focus on the problem - not a specific solution - and to discuss it with the development community before investing in the creation of a body of code.
So, when contemplating a kernel development project, one should obtain answers to a short set of questions:
What, exactly, is the problem which needs to be solved?
Who are the users affected by this problem? Which use cases should the solution address?
How does the kernel fall short in addressing that problem now?
Only then does it make sense to start considering possible solutions.
Early discussion #
When planning a kernel development project, it makes great sense to hold discussions with the community before launching into implementation. Early communication can save time and trouble in a number of ways:
It may well be that the problem is addressed by the kernel in ways which you have not understood. The Linux kernel is large and has a number of features and capabilities which are not immediately obvious. Not all kernel capabilities are documented as well as one might like, and it is easy to miss things. Your author has seen the posting of a complete driver which duplicated an existing driver that the new author had been unaware of. Code which reinvents existing wheels is not only wasteful; it will also not be accepted into the mainline kernel.
There may be elements of the proposed solution which will not be acceptable for mainline merging. It is better to find out about problems like this before writing the code.
It's entirely possible that other developers have thought about the problem; they may have ideas for a better solution, and may be willing to help in the creation of that solution.
Years of experience with the kernel development community have taught a clear lesson: kernel code which is designed and developed behind closed doors invariably has problems which are only revealed when the code is released into the community. Sometimes these problems are severe, requiring months or years of effort before the code can be brought up to the kernel community's standards. Some examples include:
The Devicescape network stack was designed and implemented for single-processor systems. It could not be merged into the mainline until it was made suitable for multiprocessor systems. Retrofitting locking and such into code is a difficult task; as a result, the merging of this code (now called mac80211) was delayed for over a year.
The Reiser4 filesystem included a number of capabilities which, in the core kernel developers' opinion, should have been implemented in the virtual filesystem layer instead. It also included features which could not easily be implemented without exposing the system to user-caused deadlocks. The late revelation of these problems - and refusal to address some of them - has caused Reiser4 to stay out of the mainline kernel.
The AppArmor security module made use of internal virtual filesystem data structures in ways which were considered to be unsafe and unreliable. This concern (among others) kept AppArmor out of the mainline for years.
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.
Who do you talk to? #
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 the right maintainer. For mailing lists, the best approach is to look in the MAINTAINERS file for a relevant place to post. If there is a suitable subsystem list, posting there is often preferable to posting on linux-kernel; you are more likely to reach developers with expertise in the relevant subsystem and the environment may be more supportive.
Finding maintainers can be a bit harder. Again, the MAINTAINERS file is the place to start. That file tends to not always be up to date, though, and not all subsystems are represented there. The person listed in the MAINTAINERS file may, in fact, not be the person who is actually acting in that role currently. So, when there is doubt about who to contact, a useful trick is to use git (and "git log" in particular) to see who is currently active within the subsystem of interest. Look at who is writing patches, and who, if anybody, is attaching Signed-off-by lines to those patches. Those are the people who will be best placed to help with a new development project.
The task of finding the right maintainer is sometimes challenging enough that the kernel developers have added a script to ease the process:
.../scripts/get_maintainer.pl
This script will return the current maintainer(s) for a given file or directory when given the "-f" option. If passed a patch on the command line, it will list the maintainers who should probably receive copies of the patch. This is the preferred way (unlike "-f" option) to get the list of people to Cc for your patches. There are a number of options regulating how hard get_maintainer.pl will search for maintainers; please be careful about using the more aggressive options as you may end up including developers who have no real interest in the code you are modifying.
If all else fails, talking to Andrew Morton can be an effective way to track down a maintainer for a specific piece of code.
When to post? #
If possible, posting your plans during the early stages can only be helpful. Describe the problem being solved and any plans that have been made on how the implementation will be done. Any information you can provide can help the development community provide useful input on the project.
One discouraging thing which can happen at this stage is not a hostile reaction, but, instead, little or no reaction at all. The sad truth of the matter is (1) kernel developers tend to be busy, (2) there is no shortage of people with grand plans and little code (or even prospect of code) to back them up, and (3) nobody is obligated to review or comment on ideas posted by others. Beyond that, high-level designs often hide problems which are only revealed when somebody actually tries to implement those designs; for that reason, kernel developers would rather see the code.
If a request-for-comments posting yields little in the way of comments, do not assume that it means there is no interest in the project. Unfortunately, you also cannot assume that there are no problems with your idea. The best thing to do in this situation is to proceed, keeping the community informed as you go.
Getting official buy-in #
If your work is being done in a corporate environment - as most Linux kernel work is - you must, obviously, have permission from suitably empowered managers before you can post your company's plans or code to a public mailing list. The posting of code which has not been cleared for release under a GPL-compatible license can be especially problematic; the sooner that a company's management and legal staff can agree on the posting of a kernel development project, the better off everybody involved will be.
Some readers may be thinking at this point that their kernel work is intended to support a product which does not yet have an officially acknowledged existence. Revealing their employer's plans on a public mailing list may not be a viable option. In cases like this, it is worth considering whether the secrecy is really necessary; there is often no real need to keep development plans behind closed doors.
That said, there are also cases where a company legitimately cannot disclose its plans early in the development process. Companies with experienced kernel developers may choose to proceed in an open-loop manner on the assumption that they will be able to avoid serious integration problems later. For companies without that sort of in-house expertise, the best option is often to hire an outside developer to review the plans under a non-disclosure agreement. The Linux Foundation operates an NDA program designed to help with this sort of situation; more information can be found at:
This kind of review is often enough to avoid serious problems later on without requiring public disclosure of the project.
Getting the code right
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
While there is much to be said for a solid and community-oriented design process, the proof of any kernel development project is in the resulting code. It is the code which will be examined by other developers and merged (or not) into the mainline tree. So it is the quality of this code which will determine the ultimate success of the project.
This section will examine the coding process. We'll start with a look at a number of ways in which kernel developers can go wrong. Then the focus will shift toward doing things right and the tools which can help in that quest.
Pitfalls #
Coding style #
The kernel has long had a standard coding style, described in Documentation/process/coding-style.rst. For much of that time, the policies described in that file were taken as being, at most, advisory. As a result, there is a substantial amount of code in the kernel which does not meet the coding style guidelines. The presence of that code leads to two independent hazards for kernel developers.
The first of these is to believe that the kernel coding standards do not matter and are not enforced. The truth of the matter is that adding new code to the kernel is very difficult if that code is not coded according to the standard; many developers will request that the code be reformatted before they will even review it. A code base as large as the kernel requires some uniformity of code to make it possible for developers to quickly understand any part of it. So there is no longer room for strangely-formatted code.
Occasionally, the kernel's coding style will run into conflict with an employer's mandated style. In such cases, the kernel's style will have to win before the code can be merged. Putting code into the kernel means giving up a degree of control in a number of ways - including control over how the code is formatted.
The other trap is to assume that code which is already in the kernel is urgently in need of coding style fixes. Developers may start to generate reformatting patches as a way of gaining familiarity with the process, or as a way of getting their name into the kernel changelogs - or both. But pure coding style fixes are seen as noise by the development community; they tend to get a chilly reception. So this type of patch is best avoided. It is natural to fix the style of a piece of code while working on it for other reasons, but coding style changes should not be made for their own sake.
The coding style document also should not be read as an absolute law which can never be transgressed. If there is a good reason to go against the style (a line which becomes far less readable if split to fit within the 80-column limit, for example), just do it.
Note that you can also use the clang-format tool to help you with these rules, to quickly re-format parts of your code automatically, and to review full files in order to spot coding style mistakes, typos and possible improvements. It is also handy for sorting #includes, for aligning variables/macros, for reflowing text and other similar tasks. See the file Documentation/dev-tools/clang-format.rst for more details.
Some basic editor settings, such as indentation and line endings, will be set automatically if you are using an editor that is compatible with EditorConfig. See the official EditorConfig website for more information: https://editorconfig.org/
Abstraction layers #
Computer Science professors teach students to make extensive use of abstraction layers in the name of flexibility and information hiding. Certainly the kernel makes extensive use of abstraction; no project involving several million lines of code could do otherwise and survive. But experience has shown that excessive or premature abstraction can be just as harmful as premature optimization. Abstraction should be used to the level required and no further.
At a simple level, consider a function which has an argument which is always passed as zero by all callers. One could retain that argument just in case somebody eventually needs to use the extra flexibility that it provides. By that time, though, chances are good that the code which implements this extra argument has been broken in some subtle way which was never noticed - because it has never been used. Or, when the need for extra flexibility arises, it does not do so in a way which matches the programmer's early expectation. Kernel developers will routinely submit patches to remove unused arguments; they should, in general, not be added in the first place.
Abstraction layers which hide access to hardware - often to allow the bulk of a driver to be used with multiple operating systems - are especially frowned upon. Such layers obscure the code and may impose a performance penalty; they do not belong in the Linux kernel.
On the other hand, if you find yourself copying significant amounts of code from another kernel subsystem, it is time to ask whether it would, in fact, make sense to pull out some of that code into a separate library or to implement that functionality at a higher level. There is no value in replicating the same code throughout the kernel.
#ifdef and preprocessor use in general #
The C preprocessor seems to present a powerful temptation to some C programmers, who see it as a way to efficiently encode a great deal of flexibility into a source file. But the preprocessor is not C, and heavy use of it results in code which is much harder for others to read and harder for the compiler to check for correctness. Heavy preprocessor use is almost always a sign of code which needs some cleanup work.
Conditional compilation with #ifdef is, indeed, a powerful feature, and it is used within the kernel. But there is little desire to see code which is sprinkled liberally with #ifdef blocks. As a general rule, #ifdef use should be confined to header files whenever possible. Conditionally-compiled code can be confined to functions which, if the code is not to be present, simply become empty. The compiler will then quietly optimize out the call to the empty function. The result is far cleaner code which is easier to follow.
C preprocessor macros present a number of hazards, including possible multiple evaluation of expressions with side effects and no type safety. If you are tempted to define a macro, consider creating an inline function instead. The code which results will be the same, but inline functions are easier to read, do not evaluate their arguments multiple times, and allow the compiler to perform type checking on the arguments and return value.
Inline functions #
Inline functions present a hazard of their own, though. Programmers can become enamored of the perceived efficiency inherent in avoiding a function call and fill a source file with inline functions. Those functions, however, can actually reduce performance. Since their code is replicated at each call site, they end up bloating the size of the compiled kernel. That, in turn, creates pressure on the processor's memory caches, which can slow execution dramatically. Inline functions, as a rule, should be quite small and relatively rare. The cost of a function call, after all, is not that high; the creation of large numbers of inline functions is a classic example of premature optimization.
In general, kernel programmers ignore cache effects at their peril. The classic time/space tradeoff taught in beginning data structures classes often does not apply to contemporary hardware. Space is time, in that a larger program will run slower than one which is more compact.
More recent compilers take an increasingly active role in deciding whether a given function should actually be inlined or not. So the liberal placement of "inline" keywords may not just be excessive; it could also be irrelevant.
Locking #
In May 2006, the "Devicescape" networking stack was, with great fanfare, released under the GPL and made available for inclusion in the mainline kernel. This donation was welcome news; support for wireless networking in Linux was considered substandard at best, and the Devicescape stack offered the promise of fixing that situation. Yet, this code did not actually make it into the mainline until June 2007 (2.6.22). What happened?
This code showed a number of signs of having been developed behind corporate doors. But one large problem in particular was that it was not designed to work on multiprocessor systems. Before this networking stack (now called mac80211) could be merged, a locking scheme needed to be retrofitted onto it.
Once upon a time, Linux kernel code could be developed without thinking about the concurrency issues presented by multiprocessor systems. Now, however, this document is being written on a dual-core laptop. Even on single-processor systems, work being done to improve responsiveness will raise the level of concurrency within the kernel. The days when kernel code could be written without thinking about locking are long past.
Any resource (data structures, hardware registers, etc.) which could be accessed concurrently by more than one thread must be protected by a lock. New code should be written with this requirement in mind; retrofitting locking after the fact is a rather more difficult task. Kernel developers should take the time to understand the available locking primitives well enough to pick the right tool for the job. Code which shows a lack of attention to concurrency will have a difficult path into the mainline.
Regressions #
One final hazard worth mentioning is this: it can be tempting to make a change (which may bring big improvements) which causes something to break for existing users. This kind of change is called a "regression," and regressions have become most unwelcome in the mainline kernel. With few exceptions, changes which cause regressions will be backed out if the regression cannot be fixed in a timely manner. Far better to avoid the regression in the first place.
It is often argued that a regression can be justified if it causes things to work for more people than it creates problems for. Why not make a change if it brings new functionality to ten systems for each one it breaks? The best answer to this question was expressed by Linus in July 2007:
So we don't fix bugs by introducing new problems. That way lies
madness, and nobody ever knows if you actually make any real
progress at all. Is it two steps forwards, one step back, or one
step forward and two steps back?
(https://lwn.net/Articles/243460/).
An especially unwelcome type of regression is any sort of change to the user-space ABI. Once an interface has been exported to user space, it must be supported indefinitely. This fact makes the creation of user-space interfaces particularly challenging: since they cannot be changed in incompatible ways, they must be done right the first time. For this reason, a great deal of thought, clear documentation, and wide review for user-space interfaces is always required.
Code checking tools #
For now, at least, the writing of error-free code remains an ideal that few of us can reach. What we can hope to do, though, is to catch and fix as many of those errors as possible before our code goes into the mainline kernel. To that end, the kernel developers have put together an impressive array of tools which can catch a wide variety of obscure problems in an automated way. Any problem caught by the computer is a problem which will not afflict a user later on, so it stands to reason that the automated tools should be used whenever possible.
The first step is simply to heed the warnings produced by the compiler. Contemporary versions of gcc can detect (and warn about) a large number of potential errors. Quite often, these warnings point to real problems. Code submitted for review should, as a rule, not produce any compiler warnings. When silencing warnings, take care to understand the real cause and try to avoid "fixes" which make the warning go away without addressing its cause.
Note that not all compiler warnings are enabled by default. Build the kernel with "make KCFLAGS=-W" to get the full set.
The kernel provides several configuration options which turn on debugging features; most of these are found in the "kernel hacking" submenu. Several of these options should be turned on for any kernel used for development or testing purposes. In particular, you should turn on:
FRAME_WARN to get warnings for stack frames larger than a given amount. The output generated can be verbose, but one need not worry about warnings from other parts of the kernel.
DEBUG_OBJECTS will add code to track the lifetime of various objects created by the kernel and warn when things are done out of order. If you are adding a subsystem which creates (and exports) complex objects of its own, consider adding support for the object debugging infrastructure.
DEBUG_SLAB can find a variety of memory allocation and use errors; it should be used on most development kernels.
DEBUG_SPINLOCK, DEBUG_ATOMIC_SLEEP, and DEBUG_MUTEXES will find a number of common locking errors.
There are quite a few other debugging options, some of which will be discussed below. Some of them have a significant performance impact and should not be used all of the time. But some time spent learning the available options will likely be paid back many times over in short order.
One of the heavier debugging tools is the locking checker, or "lockdep." This tool will track the acquisition and release of every lock (spinlock or mutex) in the system, the order in which locks are acquired relative to each other, the current interrupt environment, and more. It can then ensure that locks are always acquired in the same order, that the same interrupt assumptions apply in all situations, and so on. In other words, lockdep can find a number of scenarios in which the system could, on rare occasion, deadlock. This kind of problem can be painful (for both developers and users) in a deployed system; lockdep allows them to be found in an automated manner ahead of time. Code with any sort of non-trivial locking should be run with lockdep enabled before being submitted for inclusion.
As a diligent kernel programmer, you will, beyond doubt, check the return status of any operation (such as a memory allocation) which can fail. The fact of the matter, though, is that the resulting failure recovery paths are, probably, completely untested. Untested code tends to be broken code; you could be much more confident of your code if all those error-handling paths had been exercised a few times.
The kernel provides a fault injection framework which can do exactly that, especially where memory allocations are involved. With fault injection enabled, a configurable percentage of memory allocations will be made to fail; these failures can be restricted to a specific range of code. Running with fault injection enabled allows the programmer to see how the code responds when things go badly. See Documentation/fault-injection/fault-injection.rst for more information on how to use this facility.
Other kinds of errors can be found with the "sparse" static analysis tool. With sparse, the programmer can be warned about confusion between user-space and kernel-space addresses, mixture of big-endian and small-endian quantities, the passing of integer values where a set of bit flags is expected, and so on. Sparse must be installed separately (it can be found at https://sparse.wiki.kernel.org/index.php/Main_Page if your distributor does not package it); it can then be run on the code by adding "C=1" to your make command.
The "Coccinelle" tool (http://coccinelle.lip6.fr/) is able to find a wide variety of potential coding problems; it can also propose fixes for those problems. Quite a few "semantic patches" for the kernel have been packaged under the scripts/coccinelle directory; running "make coccicheck" will run through those semantic patches and report on any problems found. See Documentation/dev-tools/coccinelle.rst for more information.
Other kinds of portability errors are best found by compiling your code for other architectures. If you do not happen to have an S/390 system or a Blackfin development board handy, you can still perform the compilation step. A large set of cross compilers for x86 systems can be found at
Some time spent installing and using these compilers will help avoid embarrassment later.
Documentation #
Documentation has often been more the exception than the rule with kernel development. Even so, adequate documentation will help to ease the merging of new code into the kernel, make life easier for other developers, and will be helpful for your users. In many cases, the addition of documentation has become essentially mandatory.
The first piece of documentation for any patch is its associated changelog. Log entries should describe the problem being solved, the form of the solution, the people who worked on the patch, any relevant effects on performance, and anything else that might be needed to understand the patch. Be sure that the changelog says why the patch is worth applying; a surprising number of developers fail to provide that information.
Any code which adds a new user-space interface - including new sysfs or /proc files - should include documentation of that interface which enables user-space developers to know what they are working with. See Documentation/ABI/README for a description of how this documentation should be formatted and what information needs to be provided.
The file Documentation/admin-guide/kernel-parameters.rst describes all of the kernel's boot-time parameters. Any patch which adds new parameters should add the appropriate entries to this file.
Any new configuration options must be accompanied by help text which clearly explains the options and when the user might want to select them.
Internal API information for many subsystems is documented by way of specially-formatted comments; these comments can be extracted and formatted in a number of ways by the "kernel-doc" script. If you are working within a subsystem which has kerneldoc comments, you should maintain them and add them, as appropriate, for externally-available functions. Even in areas which have not been so documented, there is no harm in adding kerneldoc comments for the future; indeed, this can be a useful activity for beginning kernel developers. The format of these comments, along with some information on how to create kerneldoc templates can be found at Documentation/doc-guide/.
Anybody who reads through a significant amount of existing kernel code will note that, often, comments are most notable by their absence. Once again, the expectations for new code are higher than they were in the past; merging uncommented code will be harder. That said, there is little desire for verbosely-commented code. The code should, itself, be readable, with comments explaining the more subtle aspects.
Certain things should always be commented. Uses of memory barriers should be accompanied by a line explaining why the barrier is necessary. The locking rules for data structures generally need to be explained somewhere. Major data structures need comprehensive documentation in general. Non-obvious dependencies between separate bits of code should be pointed out. Anything which might tempt a code janitor to make an incorrect "cleanup" needs a comment saying why it is done the way it is. And so on.
Internal API changes #
The binary interface provided by the kernel to user space cannot be broken except under the most severe circumstances. The kernel's internal programming interfaces, instead, are highly fluid and can be changed when the need arises. If you find yourself having to work around a kernel API, or simply not using a specific functionality because it does not meet your needs, that may be a sign that the API needs to change. As a kernel developer, you are empowered to make such changes.
There are, of course, some catches. API changes can be made, but they need to be well justified. So any patch making an internal API change should be accompanied by a description of what the change is and why it is necessary. This kind of change should also be broken out into a separate patch, rather than buried within a larger patch.
The other catch is that a developer who changes an internal API is generally charged with the task of fixing any code within the kernel tree which is broken by the change. For a widely-used function, this duty can lead to literally hundreds or thousands of changes - many of which are likely to conflict with work being done by other developers. Needless to say, this can be a large job, so it is best to be sure that the justification is solid. Note that the Coccinelle tool can help with wide-ranging API changes.
When making an incompatible API change, one should, whenever possible, ensure that code which has not been updated is caught by the compiler. This will help you to be sure that you have found all in-tree uses of that interface. It will also alert developers of out-of-tree code that there is a change that they need to respond to. Supporting out-of-tree code is not something that kernel developers need to be worried about, but we also do not have to make life harder for out-of-tree developers than it needs to be.
Posting patches
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Sooner or later, the time comes when your work is ready to be presented to the community for review and, eventually, inclusion into the mainline kernel. Unsurprisingly, the kernel development community has evolved a set of conventions and procedures which are used in the posting of patches; following them will make life much easier for everybody involved. This document will attempt to cover these expectations in reasonable detail; more information can also be found in the files Documentation/process/submitting-patches.rst and Documentation/process/submit-checklist.rst.
When to post #
There is a constant temptation to avoid posting patches before they are completely "ready." For simple patches, that is not a problem. If the work being done is complex, though, there is a lot to be gained by getting feedback from the community before the work is complete. So you should consider posting in-progress work, or even making a git tree available so that interested developers can catch up with your work at any time.
When posting code which is not yet considered ready for inclusion, it is a good idea to say so in the posting itself. Also mention any major work which remains to be done and any known problems. Fewer people will look at patches which are known to be half-baked, but those who do will come in with the idea that they can help you drive the work in the right direction.
Before creating patches #
There are a number of things which should be done before you consider sending patches to the development community. These include:
Test the code to the extent that you can. Make use of the kernel's debugging tools, ensure that the kernel will build with all reasonable combinations of configuration options, use cross-compilers to build for different architectures, etc. Add tests, likely using an existing testing framework like KUnit, and include them as a separate member of your series (see the next section for more about patch series). Note that this may be mandatory when affecting some subsystems. For example, library functions (resides under lib/) are extensively used almost everywhere and expected to be tested appropriately.
Make sure your code is compliant with the kernel coding style guidelines.
Does your change have performance implications? If so, you should run benchmarks showing what the impact (or benefit) of your change is; a summary of the results should be included with the patch.
Be sure that you have the right to post the code. If this work was done for an employer, the employer likely has a right to the work and must be agreeable with its release under the GPL.
As a general rule, putting in some extra thought before posting code almost always pays back the effort in short order.
Patch preparation #
The preparation of patches for posting can be a surprising amount of work, but, once again, attempting to save time here is not generally advisable even in the short term.
Patches must be prepared against a specific version of the kernel. As a general rule, a patch should be based on the current mainline as found in Linus's git tree. When basing on mainline, start with a well-known release point - a stable or -rc release - rather than branching off the mainline at an arbitrary spot.
It may become necessary to make versions against -mm, linux-next, or a subsystem tree, though, to facilitate wider testing and review. Depending on the area of your patch and what is going on elsewhere, basing a patch against these other trees can require a significant amount of work resolving conflicts and dealing with API changes.
Only the most simple changes should be formatted as a single patch; everything else should be made as a logical series of changes. Splitting up patches is a bit of an art; some developers spend a long time figuring out how to do it in the way that the community expects. There are a few rules of thumb, however, which can help considerably:
The patch series you post will almost certainly not be the series of changes found in your working revision control system. Instead, the changes you have made need to be considered in their final form, then split apart in ways which make sense. The developers are interested in discrete, self-contained changes, not the path you took to get to those changes.
Each logically independent change should be formatted as a separate patch. These changes can be small ("add a field to this structure") or large (adding a significant new driver, for example), but they should be conceptually small and amenable to a one-line description. Each patch should make a specific change which can be reviewed on its own and verified to do what it says it does.
As a way of restating the guideline above: do not mix different types of changes in the same patch. If a single patch fixes a critical security bug, rearranges a few structures, and reformats the code, there is a good chance that it will be passed over and the important fix will be lost.
Each patch should yield a kernel which builds and runs properly; if your patch series is interrupted in the middle, the result should still be a working kernel. Partial application of a patch series is a common scenario when the "git bisect" tool is used to find regressions; if the result is a broken kernel, you will make life harder for developers and users who are engaging in the noble work of tracking down problems.
Do not overdo it, though. One developer once posted a set of edits to a single file as 500 separate patches - an act which did not make him the most popular person on the kernel mailing list. A single patch can be reasonably large as long as it still contains a single logical change.
It can be tempting to add a whole new infrastructure with a series of patches, but to leave that infrastructure unused until the final patch in the series enables the whole thing. This temptation should be avoided if possible; if that series adds regressions, bisection will finger the last patch as the one which caused the problem, even though the real bug is elsewhere. Whenever possible, a patch which adds new code should make that code active immediately.
Working to create the perfect patch series can be a frustrating process which takes quite a bit of time and thought after the "real work" has been done. When done properly, though, it is time well spent.
Patch formatting and changelogs #
So now you have a perfect series of patches for posting, but the work is not done quite yet. Each patch needs to be formatted into a message which quickly and clearly communicates its purpose to the rest of the world. To that end, each patch will be composed of the following:
An optional "From" line naming the author of the patch. This line is only necessary if you are passing on somebody else's patch via email, but it never hurts to add it when in doubt.
A one-line description of what the patch does. This message should be enough for a reader who sees it with no other context to figure out the scope of the patch; it is the line that will show up in the "short form" changelogs. This message is usually formatted with the relevant subsystem name first, followed by the purpose of the patch. For example:
gpio: fix build on CONFIG_GPIO_SYSFS=nA blank line followed by a detailed description of the contents of the patch. This description can be as long as is required; it should say what the patch does and why it should be applied to the kernel.
One or more tag lines, with, at a minimum, one Signed-off-by: line from the author of the patch. Tags will be described in more detail below.
The items above, together, form the changelog for the patch. Writing good changelogs is a crucial but often-neglected art; it's worth spending another moment discussing this issue. When writing a changelog, you should bear in mind that a number of different people will be reading your words. These include subsystem maintainers and reviewers who need to decide whether the patch should be included, distributors and other maintainers trying to decide whether a patch should be backported to other kernels, bug hunters wondering whether the patch is responsible for a problem they are chasing, users who want to know how the kernel has changed, and more. A good changelog conveys the needed information to all of these people in the most direct and concise way possible.
To that end, the summary line should describe the effects of and motivation for the change as well as possible given the one-line constraint. The detailed description can then amplify on those topics and provide any needed additional information. If the patch fixes a bug, cite the commit which introduced the bug if possible (and please provide both the commit ID and the title when citing commits). If a problem is associated with specific log or compiler output, include that output to help others searching for a solution to the same problem. If the change is meant to support other changes coming in later patch, say so. If internal APIs are changed, detail those changes and how other developers should respond. In general, the more you can put yourself into the shoes of everybody who will be reading your changelog, the better that changelog (and the kernel as a whole) will be.
Needless to say, the changelog should be the text used when committing the change to a revision control system. It will be followed by:
- The patch itself, in the unified ("-u") patch format. Using the "-p" option to diff will associate function names with changes, making the resulting patch easier for others to read.
The tags already briefly mentioned above are used to provide insights how the patch came into being. They are described in detail in the Documentation/process/submitting-patches.rst document; what follows here is a brief summary.
One tag is used to refer to earlier commits which introduced problems fixed by the patch:
Fixes: 1f2e3d4c5b6a ("The first line of the commit specified by the first 12 characters of its SHA-1 ID")
Another tag is used for linking web pages with additional backgrounds or details, for example an earlier discussion which leads to the patch or a document with a specification implemented by the patch:
Link: https://example.com/somewhere.html optional-other-stuff
As per guidance from the Chief Penguin, a Link: tag should only be added to a commit if it leads to useful information that is not found in the commit itself.
If the URL points to a public bug report being fixed by the patch, use the "Closes:" tag instead:
Closes: https://example.com/issues/1234 optional-other-stuff
Some bug trackers have the ability to close issues automatically when a commit with such a tag is applied. Some bots monitoring mailing lists can also track such tags and take certain actions. Private bug trackers and invalid URLs are forbidden.
Another kind of tag is used to document who was involved in the development of the patch. Each of these uses this format:
tag: Full Name <email address> optional-other-stuff
The tags in common use are:
Signed-off-by: this is a developer's certification that he or she has the right to submit the patch for inclusion into the kernel. It is an agreement to the Developer's Certificate of Origin, the full text of which can be found in Documentation/process/submitting-patches.rst Code without a proper signoff cannot be merged into the mainline.
Co-developed-by: states that the patch was co-created by several developers; it is a used to give attribution to co-authors (in addition to the author attributed by the From: tag) when multiple people work on a single patch. Every Co-developed-by: must be immediately followed by a Signed-off-by: of the associated co-author. Details and examples can be found in Documentation/process/submitting-patches.rst.
Acked-by: indicates an agreement by another developer (often a maintainer of the relevant code) that the patch is appropriate for inclusion into the kernel.
Tested-by: states that the named person has tested the patch and found it to work.
Reviewed-by: the named developer has reviewed the patch for correctness; see the reviewer's statement in Documentation/process/submitting-patches.rst for more detail.
Reported-by: names a user who reported a problem which is fixed by this patch; this tag is used to give credit to the (often underappreciated) people who test our code and let us know when things do not work correctly. Note, this tag should be followed by a Closes: tag pointing to the report, unless the report is not available on the web. The Link: tag can be used instead of Closes: if the patch fixes a part of the issue(s) being reported.
A Suggested-by: tag indicates that the patch idea is suggested by the person named and ensures credit to the person for the idea. This will, hopefully, inspire them to help us again in the future.
Cc: the named person received a copy of the patch and had the opportunity to comment on it.
Be careful in the addition of the aforementioned tags to your patches, as all except for Cc:, Reported-by:, and Suggested-by: need explicit permission of the person named. For those three implicit permission is sufficient if the person contributed to the Linux kernel using that name and email address according to the lore archives or the commit history -- and in case of Reported-by: and Suggested-by: did the reporting or suggestion in public. Note, bugzilla.kernel.org is a public place in this sense, but email addresses used there are private; so do not expose them in tags, unless the person used them in earlier contributions.
Sending the patch #
Before you mail your patches, there are a couple of other things you should take care of:
Are you sure that your mailer will not corrupt the patches? Patches which have had gratuitous white-space changes or line wrapping performed by the mail client will not apply at the other end, and often will not be examined in any detail. If there is any doubt at all, mail the patch to yourself and convince yourself that it shows up intact.
Documentation/process/email-clients.rst has some helpful hints on making specific mail clients work for sending patches.
Are you sure your patch is free of silly mistakes? You should always run patches through scripts/checkpatch.pl and address the complaints it comes up with. Please bear in mind that checkpatch.pl, while being the embodiment of a fair amount of thought about what kernel patches should look like, is not smarter than you. If fixing a checkpatch.pl complaint would make the code worse, don't do it.
Patches should always be sent as plain text. Please do not send them as attachments; that makes it much harder for reviewers to quote sections of the patch in their replies. Instead, just put the patch directly into your message.
When mailing patches, it is important to send copies to anybody who might be interested in it. Unlike some other projects, the kernel encourages people to err on the side of sending too many copies; don't assume that the relevant people will see your posting on the mailing lists. In particular, copies should go to:
The maintainer(s) of the affected subsystem(s). As described earlier, the MAINTAINERS file is the first place to look for these people.
Other developers who have been working in the same area - especially those who might be working there now. Using git to see who else has modified the files you are working on can be helpful.
If you are responding to a bug report or a feature request, copy the original poster as well.
Send a copy to the relevant mailing list, or, if nothing else applies, the linux-kernel list.
If you are fixing a bug, think about whether the fix should go into the next stable update. If so, stable@vger.kernel.org should get a copy of the patch. Also add a "Cc: stable@vger.kernel.org" to the tags within the patch itself; that will cause the stable team to get a notification when your fix goes into the mainline.
When selecting recipients for a patch, it is good to have an idea of who you think will eventually accept the patch and get it merged. While it is possible to send patches directly to Linus Torvalds and have him merge them, things are not normally done that way. Linus is busy, and there are subsystem maintainers who watch over specific parts of the kernel. Usually you will be wanting that maintainer to merge your patches. If there is no obvious maintainer, Andrew Morton is often the patch target of last resort.
Patches need good subject lines. The canonical format for a patch line is something like:
[PATCH nn/mm] subsys: one-line description of the patch
where "nn" is the ordinal number of the patch, "mm" is the total number of patches in the series, and "subsys" is the name of the affected subsystem. Clearly, nn/mm can be omitted for a single, standalone patch.
If you have a significant series of patches, it is customary to send an introductory description as part zero. This convention is not universally followed though; if you use it, remember that information in the introduction does not make it into the kernel changelogs. So please ensure that the patches, themselves, have complete changelog information.
In general, the second and following parts of a multi-part patch should be sent as a reply to the first part so that they all thread together at the receiving end. Tools like git and quilt have commands to mail out a set of patches with the proper threading. If you have a long series, though, and are using git, please stay away from the --chain-reply-to option to avoid creating exceptionally deep nesting.
Followthrough
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
At this point, you have followed the guidelines given so far and, with the addition of your own engineering skills, have posted a perfect series of patches. One of the biggest mistakes that even experienced kernel developers can make is to conclude that their work is now done. In truth, posting patches indicates a transition into the next stage of the process, with, possibly, quite a bit of work yet to be done.
It is a rare patch which is so good at its first posting that there is no room for improvement. The kernel development process recognizes this fact, and, as a result, is heavily oriented toward the improvement of posted code. You, as the author of that code, will be expected to work with the kernel community to ensure that your code is up to the kernel's quality standards. A failure to participate in this process is quite likely to prevent the inclusion of your patches into the mainline.
Working with reviewers #
A patch of any significance will result in a number of comments from other developers as they review the code. Working with reviewers can be, for many developers, the most intimidating part of the kernel development process. Life can be made much easier, though, if you keep a few things in mind:
If you have explained your patch well, reviewers will understand its value and why you went to the trouble of writing it. But that value will not keep them from asking a fundamental question: what will it be like to maintain a kernel with this code in it five or ten years later? Many of the changes you may be asked to make - from coding style tweaks to substantial rewrites - come from the understanding that Linux will still be around and under development a decade from now.
Code review is hard work, and it is a relatively thankless occupation; people remember who wrote kernel code, but there is little lasting fame for those who reviewed it. So reviewers can get grumpy, especially when they see the same mistakes being made over and over again. If you get a review which seems angry, insulting, or outright offensive, resist the impulse to respond in kind. Code review is about the code, not about the people, and code reviewers are not attacking you personally.
Similarly, code reviewers are not trying to promote their employers' agendas at the expense of your own. Kernel developers often expect to be working on the kernel years from now, but they understand that their employer could change. They truly are, almost without exception, working toward the creation of the best kernel they can; they are not trying to create discomfort for their employers' competitors.
Be prepared for seemingly silly requests for coding style changes and requests to factor out some of your code to shared parts of the kernel. One job the maintainers do is to keep things looking the same. Sometimes this means that the clever hack in your driver to get around a problem actually needs to become a generalized kernel feature ready for next time.
What all of this comes down to is that, when reviewers send you comments, you need to pay attention to the technical observations that they are making. Do not let their form of expression or your own pride keep that from happening. When you get review comments on a patch, take the time to understand what the reviewer is trying to say. If possible, fix the things that the reviewer is asking you to fix. And respond back to the reviewer: thank them, and describe how you will answer their questions.
Note that you do not have to agree with every change suggested by reviewers. If you believe that the reviewer has misunderstood your code, explain what is really going on. If you have a technical objection to a suggested change, describe it and justify your solution to the problem. If your explanations make sense, the reviewer will accept them. Should your explanation not prove persuasive, though, especially if others start to agree with the reviewer, take some time to think things over again. It can be easy to become blinded by your own solution to a problem to the point that you don't realize that something is fundamentally wrong or, perhaps, you're not even solving the right problem.
Andrew Morton has suggested that every review comment which does not result in a code change should result in an additional code comment instead; that can help future reviewers avoid the questions which came up the first time around.
One fatal mistake is to ignore review comments in the hope that they will go away. They will not go away. If you repost code without having responded to the comments you got the time before, you're likely to find that your patches go nowhere.
Speaking of reposting code: please bear in mind that reviewers are not going to remember all the details of the code you posted the last time around. So it is always a good idea to remind reviewers of previously raised issues and how you dealt with them; the patch changelog is a good place for this kind of information. Reviewers should not have to search through list archives to familiarize themselves with what was said last time; if you help them get a running start, they will be in a better mood when they revisit your code.
What if you've tried to do everything right and things still aren't going anywhere? Most technical disagreements can be resolved through discussion, but there are times when somebody simply has to make a decision. If you honestly believe that this decision is going against you wrongly, you can always try appealing to a higher power. As of this writing, that higher power tends to be Andrew Morton. Andrew has a great deal of respect in the kernel development community; he can often unjam a situation which seems to be hopelessly blocked. Appealing to Andrew should not be done lightly, though, and not before all other alternatives have been explored. And bear in mind, of course, that he may not agree with you either.
What happens next #
If a patch is considered to be a good thing to add to the kernel, and once most of the review issues have been resolved, the next step is usually entry into a subsystem maintainer's tree. How that works varies from one subsystem to the next; each maintainer has his or her own way of doing things. In particular, there may be more than one tree - one, perhaps, dedicated to patches planned for the next merge window, and another for longer-term work.
For patches applying to areas for which there is no obvious subsystem tree (memory management patches, for example), the default tree often ends up being -mm. Patches which affect multiple subsystems can also end up going through the -mm tree.
Inclusion into a subsystem tree can bring a higher level of visibility to a patch. Now other developers working with that tree will get the patch by default. Subsystem trees typically feed linux-next as well, making their contents visible to the development community as a whole. At this point, there's a good chance that you will get more comments from a new set of reviewers; these comments need to be answered as in the previous round.
What may also happen at this point, depending on the nature of your patch, is that conflicts with work being done by others turn up. In the worst case, heavy patch conflicts can result in some work being put on the back burner so that the remaining patches can be worked into shape and merged. Other times, conflict resolution will involve working with the other developers and, possibly, moving some patches between trees to ensure that everything applies cleanly. This work can be a pain, but count your blessings: before the advent of the linux-next tree, these conflicts often only turned up during the merge window and had to be addressed in a hurry. Now they can be resolved at leisure, before the merge window opens.
Some day, if all goes well, you'll log on and see that your patch has been merged into the mainline kernel. Congratulations! Once the celebration is complete (and you have added yourself to the MAINTAINERS file), though, it is worth remembering an important little fact: the job still is not done. Merging into the mainline brings its own challenges.
To begin with, the visibility of your patch has increased yet again. There may be a new round of comments from developers who had not been aware of the patch before. It may be tempting to ignore them, since there is no longer any question of your code being merged. Resist that temptation, though; you still need to be responsive to developers who have questions or suggestions.
More importantly, though: inclusion into the mainline puts your code into the hands of a much larger group of testers. Even if you have contributed a driver for hardware which is not yet available, you will be surprised by how many people will build your code into their kernels. And, of course, where there are testers, there will be bug reports.
The worst sort of bug reports are regressions. If your patch causes a regression, you'll find an uncomfortable number of eyes upon you; regressions need to be fixed as soon as possible. If you are unwilling or unable to fix the regression (and nobody else does it for you), your patch will almost certainly be removed during the stabilization period. Beyond negating all of the work you have done to get your patch into the mainline, having a patch pulled as the result of a failure to fix a regression could well make it harder for you to get work merged in the future.
After any regressions have been dealt with, there may be other, ordinary bugs to deal with. The stabilization period is your best opportunity to fix these bugs and ensure that your code's debut in a mainline kernel release is as solid as possible. So, please, answer bug reports, and fix the problems if at all possible. That's what the stabilization period is for; you can start creating cool new patches once any problems with the old ones have been taken care of.
And don't forget that there are other milestones which may also create bug reports: the next mainline stable release, when prominent distributors pick up a version of the kernel containing your patch, etc. Continuing to respond to these reports is a matter of basic pride in your work. If that is insufficient motivation, though, it's also worth considering that the development community remembers developers who lose interest in their code after it's merged. The next time you post a patch, they will be evaluating it with the assumption that you will not be around to maintain it afterward.
Other things that can happen #
One day, you may open your mail client and see that somebody has mailed you a patch to your code. That is one of the advantages of having your code out there in the open, after all. If you agree with the patch, you can either forward it on to the subsystem maintainer (be sure to include a proper From: line so that the attribution is correct, and add a signoff of your own), or send an Acked-by: response back and let the original poster send it upward.
If you disagree with the patch, send a polite response explaining why. If possible, tell the author what changes need to be made to make the patch acceptable to you. There is a certain resistance to merging patches which are opposed by the author and maintainer of the code, but it only goes so far. If you are seen as needlessly blocking good work, those patches will eventually flow around you and get into the mainline anyway. In the Linux kernel, nobody has absolute veto power over any code. Except maybe Linus.
On very rare occasion, you may see something completely different: another developer posts a different solution to your problem. At that point, chances are that one of the two patches will not be merged, and "mine was here first" is not considered to be a compelling technical argument. If somebody else's patch displaces yours and gets into the mainline, there is really only one way to respond: be pleased that your problem got solved and get on with your work. Having one's work shoved aside in this manner can be hurtful and discouraging, but the community will remember your reaction long after they have forgotten whose patch actually got merged.
Advanced topics
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
At this point, hopefully, you have a handle on how the development process works. There is still more to learn, however! This section will cover a number of topics which can be helpful for developers wanting to become a regular part of the Linux kernel development process.
Managing patches with git #
The use of distributed version control for the kernel began in early 2002, when Linus first started playing with the proprietary BitKeeper application. While BitKeeper was controversial, the approach to software version management it embodied most certainly was not. Distributed version control enabled an immediate acceleration of the kernel development project. In current times, there are several free alternatives to BitKeeper. For better or for worse, the kernel project has settled on git as its tool of choice.
Managing patches with git can make life much easier for the developer, especially as the volume of those patches grows. Git also has its rough edges and poses certain hazards; it is a young and powerful tool which is still being civilized by its developers. This document will not attempt to teach the reader how to use git; that would be sufficient material for a long document in its own right. Instead, the focus here will be on how git fits into the kernel development process in particular. Developers who wish to come up to speed with git will find more information at:
https://www.kernel.org/pub/software/scm/git/docs/user-manual.html
and on various tutorials found on the web.
The first order of business is to read the above sites and get a solid understanding of how git works before trying to use it to make patches available to others. A git-using developer should be able to obtain a copy of the mainline repository, explore the revision history, commit changes to the tree, use branches, etc. An understanding of git's tools for the rewriting of history (such as rebase) is also useful. Git comes with its own terminology and concepts; a new user of git should know about refs, remote branches, the index, fast-forward merges, pushes and pulls, detached heads, etc. It can all be a little intimidating at the outset, but the concepts are not that hard to grasp with a bit of study.
Using git to generate patches for submission by email can be a good exercise while coming up to speed.
When you are ready to start putting up git trees for others to look at, you will, of course, need a server that can be pulled from. Setting up such a server with git-daemon is relatively straightforward if you have a system which is accessible to the Internet. Otherwise, free, public hosting sites (GitHub, for example) are starting to appear on the net. Established developers can get an account on kernel.org, but those are not easy to come by; see https://kernel.org/faq/ for more information.
The normal git workflow involves the use of a lot of branches. Each line of development can be separated into a separate "topic branch" and maintained independently. Branches in git are cheap, there is no reason to not make free use of them. And, in any case, you should not do your development in any branch which you intend to ask others to pull from. Publicly-available branches should be created with care; merge in patches from development branches when they are in complete form and ready to go - not before.
Git provides some powerful tools which can allow you to rewrite your development history. An inconvenient patch (one which breaks bisection, say, or which has some other sort of obvious bug) can be fixed in place or made to disappear from the history entirely. A patch series can be rewritten as if it had been written on top of today's mainline, even though you have been working on it for months. Changes can be transparently shifted from one branch to another. And so on. Judicious use of git's ability to revise history can help in the creation of clean patch sets with fewer problems.
Excessive use of this capability can lead to other problems, though, beyond a simple obsession for the creation of the perfect project history. Rewriting history will rewrite the changes contained in that history, turning a tested (hopefully) kernel tree into an untested one. But, beyond that, developers cannot easily collaborate if they do not have a shared view of the project history; if you rewrite history which other developers have pulled into their repositories, you will make life much more difficult for those developers. So a simple rule of thumb applies here: history which has been exported to others should generally be seen as immutable thereafter.
So, once you push a set of changes to your publicly-available server, those changes should not be rewritten. Git will attempt to enforce this rule if you try to push changes which do not result in a fast-forward merge (i.e. changes which do not share the same history). It is possible to override this check, and there may be times when it is necessary to rewrite an exported tree. Moving changesets between trees to avoid conflicts in linux-next is one example. But such actions should be rare. This is one of the reasons why development should be done in private branches (which can be rewritten if necessary) and only moved into public branches when it's in a reasonably advanced state.
As the mainline (or other tree upon which a set of changes is based) advances, it is tempting to merge with that tree to stay on the leading edge. For a private branch, rebasing can be an easy way to keep up with another tree, but rebasing is not an option once a tree is exported to the world. Once that happens, a full merge must be done. Merging occasionally makes good sense, but overly frequent merges can clutter the history needlessly. Suggested technique in this case is to merge infrequently, and generally only at specific release points (such as a mainline -rc release). If you are nervous about specific changes, you can always perform test merges in a private branch. The git "rerere" tool can be useful in such situations; it remembers how merge conflicts were resolved so that you don't have to do the same work twice.
One of the biggest recurring complaints about tools like git is this: the mass movement of patches from one repository to another makes it easy to slip in ill-advised changes which go into the mainline below the review radar. Kernel developers tend to get unhappy when they see that kind of thing happening; putting up a git tree with unreviewed or off-topic patches can affect your ability to get trees pulled in the future. Quoting Linus:
You can send me patches, but for me to pull a git patch from you, I
need to know that you know what you're doing, and I need to be able
to trust things *without* then having to go and check every
individual change by hand.
(https://lwn.net/Articles/224135/).
To avoid this kind of situation, ensure that all patches within a given branch stick closely to the associated topic; a "driver fixes" branch should not be making changes to the core memory management code. And, most importantly, do not use a git tree to bypass the review process. Post an occasional summary of the tree to the relevant list, and, when the time is right, request that the tree be included in linux-next.
If and when others start to send patches for inclusion into your tree, don't forget to review them. Also ensure that you maintain the correct authorship information; the git "am" tool does its best in this regard, but you may have to add a "From:" line to the patch if it has been relayed to you via a third party.
When requesting a pull, be sure to give all the relevant information: where your tree is, what branch to pull, and what changes will result from the pull. The git request-pull command can be helpful in this regard; it will format the request as other developers expect, and will also check to be sure that you have remembered to push those changes to the public server.
Reviewing patches #
Some readers will certainly object to putting this section with "advanced topics" on the grounds that even beginning kernel developers should be reviewing patches. It is certainly true that there is no better way to learn how to program in the kernel environment than by looking at code posted by others. In addition, reviewers are forever in short supply; by looking at code you can make a significant contribution to the process as a whole.
Reviewing code can be an intimidating prospect, especially for a new kernel developer who may well feel nervous about questioning code - in public - which has been posted by those with more experience. Even code written by the most experienced developers can be improved, though. Perhaps the best piece of advice for reviewers (all reviewers) is this: phrase review comments as questions rather than criticisms. Asking "how does the lock get released in this path?" will always work better than stating "the locking here is wrong."
Another technique that is useful in case of a disagreement is to ask for others to chime in. If a discussion reaches a stalemate after a few exchanges, then call for opinions of other reviewers or maintainers. Often those in agreement with a reviewer remain silent unless called upon. The opinion of multiple people carries exponentially more weight.
Different developers will review code from different points of view. Some are mostly concerned with coding style and whether code lines have trailing white space. Others will focus primarily on whether the change implemented by the patch as a whole is a good thing for the kernel or not. Yet others will check for problematic locking, excessive stack usage, possible security issues, duplication of code found elsewhere, adequate documentation, adverse effects on performance, user-space ABI changes, etc. All types of review, if they lead to better code going into the kernel, are welcome and worthwhile.
There is no strict requirement to use specific tags like Reviewed-by. In fact reviews in plain English are more informative and encouraged even when a tag is provided, e.g. "I looked at aspects A, B and C of this submission and it looks good to me." Some form of a review message or reply is obviously necessary otherwise maintainers will not know that the reviewer has looked at the patch at all!
Last but not least patch review may become a negative process, focused on pointing out problems. Please throw in a compliment once in a while, particularly for newbies!
For more information
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
For more information #
There are numerous sources of information on Linux kernel development and related topics. First among those will always be the Documentation directory found in the kernel source distribution. Start with the top-level process/howto.rst; also read process/submitting-patches.rst. Many internal kernel APIs are documented using the kerneldoc mechanism; "make htmldocs" or "make pdfdocs" can be used to generate those documents in HTML or PDF format (though the version of TeX shipped by some distributions runs into internal limits and fails to process the documents properly).
Various web sites discuss kernel development at all levels of detail. Your author would like to humbly suggest https://lwn.net/ as a source; information on many specific kernel topics can be found via the LWN kernel index at:
Beyond that, a valuable resource for kernel developers is:
And, of course, one should not forget https://kernel.org/, the definitive location for kernel release information.
There are a number of books on kernel development:
Linux Device Drivers, 3rd Edition (Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman). Online at https://lwn.net/Kernel/LDD3/.
Linux Kernel Development (Robert Love).
Understanding the Linux Kernel (Daniel Bovet and Marco Cesati).
All of these books suffer from a common fault, though: they tend to be somewhat obsolete by the time they hit the shelves, and they have been on the shelves for a while now. Still, there is quite a bit of good information to be found there.
Documentation for git can be found at:
https://www.kernel.org/pub/software/scm/git/docs/
https://www.kernel.org/pub/software/scm/git/docs/user-manual.html
Conclusion #
Congratulations to anybody who has made it through this long-winded document. Hopefully it has provided a helpful understanding of how the Linux kernel is developed and how you can participate in that process.
In the end, it's the participation that matters. Any open source software project is no more than the sum of what its contributors put into it. The Linux kernel has progressed as quickly and as well as it has because it has been helped by an impressively large group of developers, all of whom are working to make it better. The kernel is a premier example of what can be done when thousands of people work together toward a common goal.
The kernel can always benefit from a larger developer base, though. There is always more work to do. But, just as importantly, most other participants in the Linux ecosystem can benefit through contributing to the kernel. Getting code into the mainline is the key to higher code quality, lower maintenance and distribution costs, a higher level of influence over the direction of kernel development, and more. It is a situation where everybody involved wins. Fire up your editor and come join us; you will be more than welcome.
Adding a New System Call
Peios Kernel / Kernel development / Development process
Peios: This article describes the Linux upstream syscall-development process. Peios also has native syscall entries starting at 1000 in the x86-64 table. Design new Peios authorization in terms of native objects, rights and privileges; choosing a Linux capability or matching Unix IDs alone is not sufficient. See Peios kernel behaviour and Building Peios.
This document describes what's involved in adding a new system call to the Linux kernel, over and above the normal submission advice in Documentation/process/submitting-patches.rst.
System Call Alternatives #
The first thing to consider when adding a new system call is whether one of the alternatives might be suitable instead. Although system calls are the most traditional and most obvious interaction points between userspace and the kernel, there are other possibilities -- choose what fits best for your interface.
If the operations involved can be made to look like a filesystem-like object, it may make more sense to create a new filesystem or device. This also makes it easier to encapsulate the new functionality in a kernel module rather than requiring it to be built into the main kernel.
If the new functionality involves operations where the kernel notifies userspace that something has happened, then returning a new file descriptor for the relevant object allows userspace to use
poll/select/epollto receive that notification.However, operations that don't map to
read(2)/write(2)-like operations have to be implemented asioctl(2)requests, which can lead to a somewhat opaque API.If you're just exposing runtime system information, a new node in sysfs (see
Documentation/filesystems/sysfs.rst) or the/procfilesystem may be more appropriate. However, access to these mechanisms requires that the relevant filesystem is mounted, which might not always be the case (e.g. in a namespaced/sandboxed/chrooted environment). Avoid adding any API to debugfs, as this is not considered a 'production' interface to userspace.If the operation is specific to a particular file or file descriptor, then an additional
fcntl(2)command option may be more appropriate. However,fcntl(2)is a multiplexing system call that hides a lot of complexity, so this option is best for when the new function is closely analogous to existingfcntl(2)functionality, or the new functionality is very simple (for example, getting/setting a simple flag related to a file descriptor).If the operation is specific to a particular task or process, then an additional
prctl(2)command option may be more appropriate. As withfcntl(2), this system call is a complicated multiplexor so is best reserved for near-analogs of existingprctl()commands or getting/setting a simple flag related to a process.
Designing the API: Planning for Extension #
A new system call forms part of the API of the kernel, and has to be supported indefinitely. As such, it's a very good idea to explicitly discuss the interface on the kernel mailing list, and it's important to plan for future extensions of the interface.
(The syscall table is littered with historical examples where this wasn't done, together with the corresponding follow-up system calls -- eventfd/eventfd2, dup2/dup3, inotify_init/inotify_init1, pipe/pipe2, renameat/renameat2 -- so learn from the history of the kernel and plan for extensions from the start.)
For simpler system calls that only take a couple of arguments, the preferred way to allow for future extensibility is to include a flags argument to the system call. To make sure that userspace programs can safely use flags between kernel versions, check whether the flags value holds any unknown flags, and reject the system call (with EINVAL) if it does:
if (flags & ~(THING_FLAG1 | THING_FLAG2 | THING_FLAG3))
return -EINVAL;
(If no flags values are used yet, check that the flags argument is zero.)
For more sophisticated system calls that involve a larger number of arguments, it's preferred to encapsulate the majority of the arguments into a structure that is passed in by pointer. Such a structure can cope with future extension by including a size argument in the structure:
struct xyzzy_params {
u32 size; /* userspace sets p->size = sizeof(struct xyzzy_params) */
u32 param_1;
u64 param_2;
u64 param_3;
};
As long as any subsequently added field, say param_4, is designed so that a zero value gives the previous behaviour, then this allows both directions of version mismatch:
To cope with a later userspace program calling an older kernel, the kernel code should check that any memory beyond the size of the structure that it expects is zero (effectively checking that
param_4 == 0).To cope with an older userspace program calling a newer kernel, the kernel code can zero-extend a smaller instance of the structure (effectively setting
param_4 = 0).
See perf_event_open(2) and the perf_copy_attr() function (in kernel/events/core.c) for an example of this approach.
Designing the API: Other Considerations #
If your new system call allows userspace to refer to a kernel object, it should use a file descriptor as the handle for that object -- don't invent a new type of userspace object handle when the kernel already has mechanisms and well-defined semantics for using file descriptors.
If your new xyzzy(2) system call does return a new file descriptor, then the flags argument should include a value that is equivalent to setting O_CLOEXEC on the new FD. This makes it possible for userspace to close the timing window between xyzzy() and calling fcntl(fd, F_SETFD, FD_CLOEXEC), where an unexpected fork() and execve() in another thread could leak a descriptor to the exec'ed program. (However, resist the temptation to reuse the actual value of the O_CLOEXEC constant, as it is architecture-specific and is part of a numbering space of O_* flags that is fairly full.)
If your system call returns a new file descriptor, you should also consider what it means to use the poll(2) family of system calls on that file descriptor. Making a file descriptor ready for reading or writing is the normal way for the kernel to indicate to userspace that an event has occurred on the corresponding kernel object.
If your new xyzzy(2) system call involves a filename argument:
int sys_xyzzy(const char __user *path, ..., unsigned int flags);
you should also consider whether an xyzzyat(2) version is more appropriate:
int sys_xyzzyat(int dfd, const char __user *path, ..., unsigned int flags);
This allows more flexibility for how userspace specifies the file in question; in particular it allows userspace to request the functionality for an already-opened file descriptor using the AT_EMPTY_PATH flag, effectively giving an fxyzzy(3) operation for free:
- xyzzyat(AT_FDCWD, path, ..., 0) is equivalent to xyzzy(path,...)
- xyzzyat(fd, "", ..., AT_EMPTY_PATH) is equivalent to fxyzzy(fd, ...)
(For more details on the rationale of the *at() calls, see the openat(2) man page; for an example of AT_EMPTY_PATH, see the fstatat(2) man page.)
If your new xyzzy(2) system call involves a parameter describing an offset within a file, make its type loff_t so that 64-bit offsets can be supported even on 32-bit architectures.
If your new xyzzy(2) system call involves privileged functionality, it needs to be governed by the appropriate Linux capability bit (checked with a call to capable()), as described in the capabilities(7) man page. Choose an existing capability bit that governs related functionality, but try to avoid combining lots of only vaguely related functions together under the same bit, as this goes against capabilities' purpose of splitting the power of root. In particular, avoid adding new uses of the already overly-general CAP_SYS_ADMIN capability.
If your new xyzzy(2) system call manipulates a process other than the calling process, it should be restricted (using a call to ptrace_may_access()) so that only a calling process with the same permissions as the target process, or with the necessary capabilities, can manipulate the target process.
Finally, be aware that some non-x86 architectures have an easier time if system call parameters that are explicitly 64-bit fall on odd-numbered arguments (i.e. parameter 1, 3, 5), to allow use of contiguous pairs of 32-bit registers. (This concern does not apply if the arguments are part of a structure that's passed in by pointer.)
Proposing the API #
To make new system calls easy to review, it's best to divide up the patchset into separate chunks. These should include at least the following items as distinct commits (each of which is described further below):
The core implementation of the system call, together with prototypes, generic numbering, Kconfig changes and fallback stub implementation.
Wiring up of the new system call for one particular architecture, usually x86 (including all of x86_64, x86_32 and x32).
A demonstration of the use of the new system call in userspace via a selftest in
tools/testing/selftests/.A draft man-page for the new system call, either as plain text in the cover letter, or as a patch to the (separate) man-pages repository.
New system call proposals, like any change to the kernel's API, should always be cc'ed to linux-api@vger.kernel.org.
Generic System Call Implementation #
The main entry point for your new xyzzy(2) system call will be called sys_xyzzy(), but you add this entry point with the appropriate SYSCALL_DEFINEn() macro rather than explicitly. The 'n' indicates the number of arguments to the system call, and the macro takes the system call name followed by the (type, name) pairs for the parameters as arguments. Using this macro allows metadata about the new system call to be made available for other tools.
The new entry point also needs a corresponding function prototype, in include/linux/syscalls.h, marked as asmlinkage to match the way that system calls are invoked:
asmlinkage long sys_xyzzy(...);
Some architectures (e.g. x86) have their own architecture-specific syscall tables, but several other architectures share a generic syscall table. Add your new system call to the generic list by adding an entry to the list in include/uapi/asm-generic/unistd.h:
#define __NR_xyzzy 292
__SYSCALL(__NR_xyzzy, sys_xyzzy)
Also update the __NR_syscalls count to reflect the additional system call, and note that if multiple new system calls are added in the same merge window, your new syscall number may get adjusted to resolve conflicts.
The file kernel/sys_ni.c provides a fallback stub implementation of each system call, returning -ENOSYS. Add your new system call here too:
COND_SYSCALL(xyzzy);
Your new kernel functionality, and the system call that controls it, should normally be optional, so add a CONFIG option (typically to init/Kconfig) for it. As usual for new CONFIG options:
Include a description of the new functionality and system call controlled by the option.
Make the option depend on EXPERT if it should be hidden from normal users.
Make any new source files implementing the function dependent on the CONFIG option in the Makefile (e.g.
obj-$(CONFIG_XYZZY_SYSCALL) += xyzzy.o).Double check that the kernel still builds with the new CONFIG option turned off.
To summarize, you need a commit that includes:
CONFIGoption for the new function, normally ininit/Kconfig
SYSCALL_DEFINEn(xyzzy, ...)for the entry pointcorresponding prototype in
include/linux/syscalls.hgeneric table entry in
include/uapi/asm-generic/unistd.hfallback stub in
kernel/sys_ni.c
Since 6.11 #
Starting with kernel version 6.11, general system call implementation for the following architectures no longer requires modifications to include/uapi/asm-generic/unistd.h:
arc
arm64
csky
hexagon
loongarch
nios2
openrisc
riscv
Instead, you need to update scripts/syscall.tbl and, if applicable, adjust arch/*/kernel/Makefile.syscalls.
As scripts/syscall.tbl serves as a common syscall table across multiple architectures, a new entry is required in this table:
468 common xyzzy sys_xyzzy
Note that adding an entry to scripts/syscall.tbl with the "common" ABI also affects all architectures that share this table. For more limited or architecture-specific changes, consider using an architecture-specific ABI or defining a new one.
If a new ABI, say xyz, is introduced, the corresponding updates should be made to arch/*/kernel/Makefile.syscalls as well:
syscall_abis_{32,64} += xyz (...)
To summarize, you need a commit that includes:
CONFIGoption for the new function, normally ininit/Kconfig
SYSCALL_DEFINEn(xyzzy, ...)for the entry pointcorresponding prototype in
include/linux/syscalls.hnew entry in
scripts/syscall.tbl(if needed) Makefile updates in
arch/*/kernel/Makefile.syscallsfallback stub in
kernel/sys_ni.c
x86 System Call Implementation #
To wire up your new system call for x86 platforms, you need to update the master syscall tables. Assuming your new system call isn't special in some way (see below), this involves a "common" entry (for x86_64 and x32) in arch/x86/entry/syscalls/syscall_64.tbl:
333 common xyzzy sys_xyzzy
and an "i386" entry in arch/x86/entry/syscalls/syscall_32.tbl:
380 i386 xyzzy sys_xyzzy
Again, these numbers are liable to be changed if there are conflicts in the relevant merge window.
Compatibility System Calls (Generic) #
For most system calls the same 64-bit implementation can be invoked even when the userspace program is itself 32-bit; even if the system call's parameters include an explicit pointer, this is handled transparently.
However, there are a couple of situations where a compatibility layer is needed to cope with size differences between 32-bit and 64-bit.
The first is if the 64-bit kernel also supports 32-bit userspace programs, and so needs to parse areas of (__user) memory that could hold either 32-bit or 64-bit values. In particular, this is needed whenever a system call argument is:
a pointer to a pointer
a pointer to a struct containing a pointer (e.g.
struct iovec __user *)a pointer to a varying sized integral type (
time_t,off_t,long, ...)a pointer to a struct containing a varying sized integral type.
The second situation that requires a compatibility layer is if one of the system call's arguments has a type that is explicitly 64-bit even on a 32-bit architecture, for example loff_t or __u64. In this case, a value that arrives at a 64-bit kernel from a 32-bit application will be split into two 32-bit values, which then need to be re-assembled in the compatibility layer.
(Note that a system call argument that's a pointer to an explicit 64-bit type does not need a compatibility layer; for example, splice(2)'s arguments of type loff_t __user * do not trigger the need for a compat_ system call.)
The compatibility version of the system call is called compat_sys_xyzzy(), and is added with the COMPAT_SYSCALL_DEFINEn() macro, analogously to SYSCALL_DEFINEn. This version of the implementation runs as part of a 64-bit kernel, but expects to receive 32-bit parameter values and does whatever is needed to deal with them. (Typically, the compat_sys_ version converts the values to 64-bit versions and either calls on to the sys_ version, or both of them call a common inner implementation function.)
The compat entry point also needs a corresponding function prototype, in include/linux/compat.h, marked as asmlinkage to match the way that system calls are invoked:
asmlinkage long compat_sys_xyzzy(...);
If the system call involves a structure that is laid out differently on 32-bit and 64-bit systems, say struct xyzzy_args, then the include/linux/compat.h header file should also include a compat version of the structure (struct compat_xyzzy_args) where each variable-size field has the appropriate compat_ type that corresponds to the type in struct xyzzy_args. The compat_sys_xyzzy() routine can then use this compat_ structure to parse the arguments from a 32-bit invocation.
For example, if there are fields:
struct xyzzy_args {
const char __user *ptr;
__kernel_long_t varying_val;
u64 fixed_val;
/* ... */
};
in struct xyzzy_args, then struct compat_xyzzy_args would have:
struct compat_xyzzy_args {
compat_uptr_t ptr;
compat_long_t varying_val;
u64 fixed_val;
/* ... */
};
The generic system call list also needs adjusting to allow for the compat version; the entry in include/uapi/asm-generic/unistd.h should use __SC_COMP rather than __SYSCALL:
#define __NR_xyzzy 292
__SC_COMP(__NR_xyzzy, sys_xyzzy, compat_sys_xyzzy)
To summarize, you need:
a
COMPAT_SYSCALL_DEFINEn(xyzzy, ...)for the compat entry pointcorresponding prototype in
include/linux/compat.h(if needed) 32-bit mapping struct in
include/linux/compat.hinstance of
__SC_COMPnot__SYSCALLininclude/uapi/asm-generic/unistd.h
Since 6.11 #
This applies to all the architectures listed in Since 6.11 under "Generic System Call Implementation", except arm64. See Compatibility System Calls (arm64) for more information.
You need to extend the entry in scripts/syscall.tbl with an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point:
468 common xyzzy sys_xyzzy compat_sys_xyzzy
To summarize, you need:
COMPAT_SYSCALL_DEFINEn(xyzzy, ...)for the compat entry pointcorresponding prototype in
include/linux/compat.hmodification of the entry in
scripts/syscall.tblto include an extra "compat" column(if needed) 32-bit mapping struct in
include/linux/compat.h
Compatibility System Calls (arm64) #
On arm64, there is a dedicated syscall table for compatibility system calls targeting 32-bit (AArch32) userspace: arch/arm64/tools/syscall_32.tbl. You need to add an additional line to this table specifying the compat entry point:
468 common xyzzy sys_xyzzy compat_sys_xyzzy
Compatibility System Calls (x86) #
To wire up the x86 architecture of a system call with a compatibility version, the entries in the syscall tables need to be adjusted.
First, the entry in arch/x86/entry/syscalls/syscall_32.tbl gets an extra column to indicate that a 32-bit userspace program running on a 64-bit kernel should hit the compat entry point:
380 i386 xyzzy sys_xyzzy __ia32_compat_sys_xyzzy
Second, you need to figure out what should happen for the x32 ABI version of the new system call. There's a choice here: the layout of the arguments should either match the 64-bit version or the 32-bit version.
If there's a pointer-to-a-pointer involved, the decision is easy: x32 is ILP32, so the layout should match the 32-bit version, and the entry in arch/x86/entry/syscalls/syscall_64.tbl is split so that x32 programs hit the compatibility wrapper:
333 64 xyzzy sys_xyzzy
...
555 x32 xyzzy __x32_compat_sys_xyzzy
If no pointers are involved, then it is preferable to reuse the 64-bit system call for the x32 ABI (and consequently the entry in arch/x86/entry/syscalls/syscall_64.tbl is unchanged).
In either case, you should check that the types involved in your argument layout do indeed map exactly from x32 (-mx32) to either the 32-bit (-m32) or 64-bit (-m64) equivalents.
System Calls Returning Elsewhere #
For most system calls, once the system call is complete the user program continues exactly where it left off -- at the next instruction, with the stack the same and most of the registers the same as before the system call, and with the same virtual memory space.
However, a few system calls do things differently. They might return to a different location (rt_sigreturn) or change the memory space (fork/vfork/clone) or even architecture (execve/execveat) of the program.
To allow for this, the kernel implementation of the system call may need to save and restore additional registers to the kernel stack, allowing complete control of where and how execution continues after the system call.
This is arch-specific, but typically involves defining assembly entry points that save/restore additional registers and invoke the real system call entry point.
For x86_64, this is implemented as a stub_xyzzy entry point in arch/x86/entry/entry_64.S, and the entry in the syscall table (arch/x86/entry/syscalls/syscall_64.tbl) is adjusted to match:
333 common xyzzy stub_xyzzy
The equivalent for 32-bit programs running on a 64-bit kernel is normally called stub32_xyzzy and implemented in arch/x86/entry/entry_64_compat.S, with the corresponding syscall table adjustment in arch/x86/entry/syscalls/syscall_32.tbl:
380 i386 xyzzy sys_xyzzy stub32_xyzzy
If the system call needs a compatibility layer (as in the previous section) then the stub32_ version needs to call on to the compat_sys_ version of the system call rather than the native 64-bit version. Also, if the x32 ABI implementation is not common with the x86_64 version, then its syscall table will also need to invoke a stub that calls on to the compat_sys_ version.
For completeness, it's also nice to set up a mapping so that user-mode Linux still works -- its syscall table will reference stub_xyzzy, but the UML build doesn't include arch/x86/entry/entry_64.S implementation (because UML simulates registers etc). Fixing this is as simple as adding a #define to arch/x86/um/sys_call_table_64.c:
#define stub_xyzzy sys_xyzzy
Other Details #
Most of the kernel treats system calls in a generic way, but there is the occasional exception that may need updating for your particular system call.
The audit subsystem is one such special case; it includes (arch-specific) functions that classify some special types of system call -- specifically file open (open/openat), program execution (execve/exeveat) or socket multiplexor (socketcall) operations. If your new system call is analogous to one of these, then the audit system should be updated.
More generally, if there is an existing system call that is analogous to your new system call, it's worth doing a kernel-wide grep for the existing system call to check there are no other special cases.
Testing #
A new system call should obviously be tested; it is also useful to provide reviewers with a demonstration of how user space programs will use the system call. A good way to combine these aims is to include a simple self-test program in a new directory under tools/testing/selftests/.
For a new system call, there will obviously be no libc wrapper function and so the test will need to invoke it using syscall(); also, if the system call involves a new userspace-visible structure, the corresponding header will need to be installed to compile the test.
Make sure the selftest runs successfully on all supported architectures. For example, check that it works when compiled as an x86_64 (-m64), x86_32 (-m32) and x32 (-mx32) ABI program.
For more extensive and thorough testing of new functionality, you should also consider adding tests to the Linux Test Project, or to the xfstests project for filesystem-related changes.
git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
Man Page #
All new system calls should come with a complete man page, ideally using groff markup, but plain text will do. If groff is used, it's helpful to include a pre-rendered ASCII version of the man page in the cover email for the patchset, for the convenience of reviewers.
The man page should be cc'ed to linux-man@vger.kernel.org For more details, see https://www.kernel.org/doc/man-pages/patches.html
Do not call System Calls in the Kernel #
System calls are, as stated above, interaction points between userspace and the kernel. Therefore, system call functions such as sys_xyzzy() or compat_sys_xyzzy() should only be called from userspace via the syscall table, but not from elsewhere in the kernel. If the syscall functionality is useful to be used within the kernel, needs to be shared between an old and a new syscall, or needs to be shared between a syscall and its compatibility variant, it should be implemented by means of a "helper" function (such as ksys_xyzzy()). This kernel function may then be called within the syscall stub (sys_xyzzy()), the compatibility syscall stub (compat_sys_xyzzy()), and/or other kernel code.
At least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not call system call functions in the kernel. It uses a different calling convention for system calls where struct pt_regs is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain).
Moreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling sys_xyzzy() is generally a bad idea.
Exceptions to this rule are only allowed in architecture-specific overrides, architecture-specific compatibility wrappers, or other code in arch/.
References and Sources #
LWN article from Michael Kerrisk on use of flags argument in system calls: https://lwn.net/Articles/585415/
LWN article from Michael Kerrisk on how to handle unknown flags in a system call: https://lwn.net/Articles/588444/
LWN article from Jake Edge describing constraints on 64-bit system call arguments: https://lwn.net/Articles/311630/
Pair of LWN articles from David Drysdale that describe the system call implementation paths in detail for v3.14:
Architecture-specific requirements for system calls are discussed in the
syscall(2)man-page: http://man7.org/linux/man-pages/man2/syscall.2.html#NOTESCollated emails from Linus Torvalds discussing the problems with
ioctl(): https://yarchive.net/comp/linux/ioctl.html"How to not invent kernel interfaces", Arnd Bergmann, https://www.ukuug.org/events/linux2007/2007/papers/Bergmann.pdf
LWN article from Michael Kerrisk on avoiding new uses of CAP_SYS_ADMIN: https://lwn.net/Articles/486306/
Recommendation from Andrew Morton that all related information for a new system call should come in the same email thread: https://lore.kernel.org/r/20140724144747.3041b208832bbdf9fbce5d96@linux-foundation.org
Recommendation from Michael Kerrisk that a new system call should come with a man page: https://lore.kernel.org/r/CAKgNAkgMA39AfoSoA5Pe1r9N+ZzfYQNvNPvcRN7tOvRb8+v06Q@mail.gmail.com
Suggestion from Thomas Gleixner that x86 wire-up should be in a separate commit: https://lore.kernel.org/r/alpine.DEB.2.11.1411191249560.3909@nanos
Suggestion from Greg Kroah-Hartman that it's good for new system calls to come with a man-page & selftest: https://lore.kernel.org/r/20140320025530.GA25469@kroah.com
Discussion from Michael Kerrisk of new system call vs.
prctl(2)extension: https://lore.kernel.org/r/CAHO5Pa3F2MjfTtfNxa8LbnkeeU8=YJ+9tDqxZpw7Gz59E-4AUg@mail.gmail.comSuggestion from Ingo Molnar that system calls that involve multiple arguments should encapsulate those arguments in a struct, which includes a size field for future extensibility: https://lore.kernel.org/r/20150730083831.GA22182@gmail.com
Numbering oddities arising from (re-)use of O_* numbering space flags:
commit 75069f2b5bfb ("vfs: renumber FMODE_NONOTIFY and add to uniqueness check")
commit 12ed2e36c98a ("fanotify: FMODE_NONOTIFY and __O_SYNC in sparc conflict")
commit bb458c644a59 ("Safer ABI for O_TMPFILE")
Discussion from Matthew Wilcox about restrictions on 64-bit arguments: https://lore.kernel.org/r/20081212152929.GM26095@parisc-linux.org
Recommendation from Greg Kroah-Hartman that unknown flags should be policed: https://lore.kernel.org/r/20140717193330.GB4703@kroah.com
Recommendation from Linus Torvalds that x32 system calls should prefer compatibility with 64-bit versions rather than 32-bit versions: https://lore.kernel.org/r/CA+55aFxfmwfB7jbbrXxa=K7VBYPfAvmu3XOkGrLbB1UFjX1+Ew@mail.gmail.com
Patch series revising system call table infrastructure to use scripts/syscall.tbl across multiple architectures: https://lore.kernel.org/lkml/20240704143611.2979589-1-arnd@kernel.org
Applying Patches To The Linux Kernel
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
-
Original by:
Jesper Juhl, August 2005
A frequently asked question on the Linux Kernel Mailing List is how to apply a patch to the kernel or, more specifically, what base kernel a patch for one of the many trees/branches should be applied to. Hopefully this document will explain this to you.
In addition to explaining how to apply and revert patches, a brief description of the different kernel trees (and examples of how to apply their specific patches) is also provided.
What is a patch? #
A patch is a small text document containing a delta of changes between two different versions of a source tree. Patches are created with the diff program.
To correctly apply a patch you need to know what base it was generated from and what new version the patch will change the source tree into. These should both be present in the patch file metadata or be possible to deduce from the filename.
How do I apply or revert a patch? #
You apply a patch with the patch program. The patch program reads a diff (or patch) file and makes the changes to the source tree described in it.
Patches for the Linux kernel are generated relative to the parent directory holding the kernel source dir.
This means that paths to files inside the patch file contain the name of the kernel source directories it was generated against (or some other directory names like "a/" and "b/").
Since this is unlikely to match the name of the kernel source dir on your local machine (but is often useful info to see what version an otherwise unlabeled patch was generated against) you should change into your kernel source directory and then strip the first element of the path from filenames in the patch file when applying it (the -p1 argument to patch does this).
To revert a previously applied patch, use the -R argument to patch. So, if you applied a patch like this:
patch -p1 < ../patch-x.y.z
You can revert (undo) it like this:
patch -R -p1 < ../patch-x.y.z
How do I feed a patch/diff file to patch? #
This (as usual with Linux and other UNIX like operating systems) can be done in several different ways.
In all the examples below I feed the file (in uncompressed form) to patch via stdin using the following syntax:
patch -p1 < path/to/patch-x.y.z
If you just want to be able to follow the examples below and don't want to know of more than one way to use patch, then you can stop reading this section here.
Patch can also get the name of the file to use via the -i argument, like this:
patch -p1 -i path/to/patch-x.y.z
If your patch file is compressed with gzip or xz and you don't want to uncompress it before applying it, then you can feed it to patch like this instead:
xzcat path/to/patch-x.y.z.xz | patch -p1
bzcat path/to/patch-x.y.z.gz | patch -p1
If you wish to uncompress the patch file by hand first before applying it (what I assume you've done in the examples below), then you simply run gunzip or xz on the file -- like this:
gunzip patch-x.y.z.gz
xz -d patch-x.y.z.xz
Which will leave you with a plain text patch-x.y.z file that you can feed to patch via stdin or the -i argument, as you prefer.
A few other nice arguments for patch are -s which causes patch to be silent except for errors which is nice to prevent errors from scrolling out of the screen too fast, and --dry-run which causes patch to just print a listing of what would happen, but doesn't actually make any changes. Finally --verbose tells patch to print more information about the work being done.
Common errors when patching #
When patch applies a patch file it attempts to verify the sanity of the file in different ways.
Checking that the file looks like a valid patch file and checking the code around the bits being modified matches the context provided in the patch are just two of the basic sanity checks patch does.
If patch encounters something that doesn't look quite right it has two options. It can either refuse to apply the changes and abort or it can try to find a way to make the patch apply with a few minor changes.
One example of something that's not 'quite right' that patch will attempt to fix up is if all the context matches, the lines being changed match, but the line numbers are different. This can happen, for example, if the patch makes a change in the middle of the file but for some reasons a few lines have been added or removed near the beginning of the file. In that case everything looks good it has just moved up or down a bit, and patch will usually adjust the line numbers and apply the patch.
Whenever patch applies a patch that it had to modify a bit to make it fit it'll tell you about it by saying the patch applied with fuzz. You should be wary of such changes since even though patch probably got it right it doesn't /always/ get it right, and the result will sometimes be wrong.
When patch encounters a change that it can't fix up with fuzz it rejects it outright and leaves a file with a .rej extension (a reject file). You can read this file to see exactly what change couldn't be applied, so you can go fix it up by hand if you wish.
If you don't have any third-party patches applied to your kernel source, but only patches from kernel.org and you apply the patches in the correct order, and have made no modifications yourself to the source files, then you should never see a fuzz or reject message from patch. If you do see such messages anyway, then there's a high risk that either your local source tree or the patch file is corrupted in some way. In that case you should probably try re-downloading the patch and if things are still not OK then you'd be advised to start with a fresh tree downloaded in full from kernel.org.
Let's look a bit more at some of the messages patch can produce.
If patch stops and presents a File to patch: prompt, then patch could not find a file to be patched. Most likely you forgot to specify -p1 or you are in the wrong directory. Less often, you'll find patches that need to be applied with -p0 instead of -p1 (reading the patch file should reveal if this is the case -- if so, then this is an error by the person who created the patch but is not fatal).
If you get Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines). or a message similar to that, then it means that patch had to adjust the location of the change (in this example it needed to move 7 lines from where it expected to make the change to make it fit).
The resulting file may or may not be OK, depending on the reason the file was different than expected.
This often happens if you try to apply a patch that was generated against a different kernel version than the one you are trying to patch.
If you get a message like Hunk #3 FAILED at 2387., then it means that the patch could not be applied correctly and the patch program was unable to fuzz its way through. This will generate a .rej file with the change that caused the patch to fail and also a .orig file showing you the original content that couldn't be changed.
If you get Reversed (or previously applied) patch detected! Assume -R? [n] then patch detected that the change contained in the patch seems to have already been made.
If you actually did apply this patch previously and you just re-applied it in error, then just say [n]o and abort this patch. If you applied this patch previously and actually intended to revert it, but forgot to specify -R, then you can say [y]es here to make patch revert it for you.
This can also happen if the creator of the patch reversed the source and destination directories when creating the patch, and in that case reverting the patch will in fact apply it.
A message similar to patch: **** unexpected end of file in patch or patch unexpectedly ends in middle of line means that patch could make no sense of the file you fed to it. Either your download is broken, you tried to feed patch a compressed patch file without uncompressing it first, or the patch file that you are using has been mangled by a mail client or mail transfer agent along the way somewhere, e.g., by splitting a long line into two lines. Often these warnings can easily be fixed by joining (concatenating) the two lines that had been split.
As I already mentioned above, these errors should never happen if you apply a patch from kernel.org to the correct version of an unmodified source tree. So if you get these errors with kernel.org patches then you should probably assume that either your patch file or your tree is broken and I'd advise you to start over with a fresh download of a full kernel tree and the patch you wish to apply.
Are there any alternatives to patch? #
Yes there are alternatives.
You can use the interdiff program (http://cyberelk.net/tim/patchutils/) to generate a patch representing the differences between two patches and then apply the result.
This will let you move from something like 5.7.2 to 5.7.3 in a single step. The -z flag to interdiff will even let you feed it patches in gzip or bzip2 compressed form directly without the use of zcat or bzcat or manual decompression.
Here's how you'd go from 5.7.2 to 5.7.3 in a single step:
interdiff -z ../patch-5.7.2.gz ../patch-5.7.3.gz | patch -p1
Although interdiff may save you a step or two you are generally advised to do the additional steps since interdiff can get things wrong in some cases.
Another alternative is ketchup, which is a python script for automatic downloading and applying of patches (https://www.selenic.com/ketchup/).
Other nice tools are diffstat, which shows a summary of changes made by a patch; lsdiff, which displays a short listing of affected files in a patch file, along with (optionally) the line numbers of the start of each patch; and grepdiff, which displays a list of the files modified by a patch where the patch contains a given regular expression.
Where can I download the patches? #
The patches are available at https://kernel.org/ Most recent patches are linked from the front page, but they also have specific homes.
The 5.x.y (-stable) and 5.x patches live at
The 5.x.y incremental patches live at
The -rc patches are not stored on the webserver but are generated on demand from git tags such as
The stable -rc patches live at
The 5.x kernels #
These are the base stable releases released by Linus. The highest numbered release is the most recent.
If regressions or other serious flaws are found, then a -stable fix patch will be released (see below) on top of this base. Once a new 5.x base kernel is released, a patch is made available that is a delta between the previous 5.x kernel and the new one.
To apply a patch moving from 5.6 to 5.7, you'd do the following (note that such patches do NOT apply on top of 5.x.y kernels but on top of the base 5.x kernel -- if you need to move from 5.x.y to 5.x+1 you need to first revert the 5.x.y patch).
Here are some examples:
# moving from 5.6 to 5.7
$ cd ~/linux-5.6 # change to kernel source dir
$ patch -p1 < ../patch-5.7 # apply the 5.7 patch
$ cd ..
$ mv linux-5.6 linux-5.7 # rename source dir
# moving from 5.6.1 to 5.7
$ cd ~/linux-5.6.1 # change to kernel source dir
$ patch -p1 -R < ../patch-5.6.1 # revert the 5.6.1 patch
# source dir is now 5.6
$ patch -p1 < ../patch-5.7 # apply new 5.7 patch
$ cd ..
$ mv linux-5.6.1 linux-5.7 # rename source dir
The 5.x.y kernels #
Kernels with 3-digit versions are -stable kernels. They contain small(ish) critical fixes for security problems or significant regressions discovered in a given 5.x kernel.
This is the recommended branch for users who want the most recent stable kernel and are not interested in helping test development/experimental versions.
If no 5.x.y kernel is available, then the highest numbered 5.x kernel is the current stable kernel.
The -stable team provides normal as well as incremental patches. Below is how to apply these patches.
Normal patches #
These patches are not incremental, meaning that for example the 5.7.3 patch does not apply on top of the 5.7.2 kernel source, but rather on top of the base 5.7 kernel source.
So, in order to apply the 5.7.3 patch to your existing 5.7.2 kernel source you have to first back out the 5.7.2 patch (so you are left with a base 5.7 kernel source) and then apply the new 5.7.3 patch.
Here's a small example:
$ cd ~/linux-5.7.2 # change to the kernel source dir
$ patch -p1 -R < ../patch-5.7.2 # revert the 5.7.2 patch
$ patch -p1 < ../patch-5.7.3 # apply the new 5.7.3 patch
$ cd ..
$ mv linux-5.7.2 linux-5.7.3 # rename the kernel source dir
Incremental patches #
Incremental patches are different: instead of being applied on top of base 5.x kernel, they are applied on top of previous stable kernel (5.x.y-1).
Here's the example to apply these:
$ cd ~/linux-5.7.2 # change to the kernel source dir
$ patch -p1 < ../patch-5.7.2-3 # apply the new 5.7.3 patch
$ cd ..
$ mv linux-5.7.2 linux-5.7.3 # rename the kernel source dir
The -rc kernels #
These are release-candidate kernels. These are development kernels released by Linus whenever he deems the current git (the kernel's source management tool) tree to be in a reasonably sane state adequate for testing.
These kernels are not stable and you should expect occasional breakage if you intend to run them. This is however the most stable of the main development branches and is also what will eventually turn into the next stable kernel, so it is important that it be tested by as many people as possible.
This is a good branch to run for people who want to help out testing development kernels but do not want to run some of the really experimental stuff (such people should see the sections about -next and -mm kernels below).
The -rc patches are not incremental, they apply to a base 5.x kernel, just like the 5.x.y patches described above. The kernel version before the -rcN suffix denotes the version of the kernel that this -rc kernel will eventually turn into.
So, 5.8-rc5 means that this is the fifth release candidate for the 5.8 kernel and the patch should be applied on top of the 5.7 kernel source.
Here are 3 examples of how to apply these patches:
# first an example of moving from 5.7 to 5.8-rc3
$ cd ~/linux-5.7 # change to the 5.7 source dir
$ patch -p1 < ../patch-5.8-rc3 # apply the 5.8-rc3 patch
$ cd ..
$ mv linux-5.7 linux-5.8-rc3 # rename the source dir
# now let's move from 5.8-rc3 to 5.8-rc5
$ cd ~/linux-5.8-rc3 # change to the 5.8-rc3 dir
$ patch -p1 -R < ../patch-5.8-rc3 # revert the 5.8-rc3 patch
$ patch -p1 < ../patch-5.8-rc5 # apply the new 5.8-rc5 patch
$ cd ..
$ mv linux-5.8-rc3 linux-5.8-rc5 # rename the source dir
# finally let's try and move from 5.7.3 to 5.8-rc5
$ cd ~/linux-5.7.3 # change to the kernel source dir
$ patch -p1 -R < ../patch-5.7.3 # revert the 5.7.3 patch
$ patch -p1 < ../patch-5.8-rc5 # apply new 5.8-rc5 patch
$ cd ..
$ mv linux-5.7.3 linux-5.8-rc5 # rename the kernel source dir
The -mm patches and the linux-next tree #
The -mm patches are experimental patches released by Andrew Morton.
In the past, -mm tree were used to also test subsystem patches, but this function is now done via the linux-next (https://www.kernel.org/doc/man-pages/linux-next.html) tree. The Subsystem maintainers push their patches first to linux-next, and, during the merge window, sends them directly to Linus.
The -mm patches serve as a sort of proving ground for new features and other experimental patches that aren't merged via a subsystem tree. Once such patches has proved its worth in -mm for a while Andrew pushes it on to Linus for inclusion in mainline.
The linux-next tree is daily updated, and includes the -mm patches. Both are in constant flux and contains many experimental features, a lot of debugging patches not appropriate for mainline etc., and is the most experimental of the branches described in this document.
These patches are not appropriate for use on systems that are supposed to be stable and they are more risky to run than any of the other branches (make sure you have up-to-date backups -- that goes for any experimental kernel but even more so for -mm patches or using a Kernel from the linux-next tree).
Testing of -mm patches and linux-next is greatly appreciated since the whole point of those are to weed out regressions, crashes, data corruption bugs, build breakage (and any other bug in general) before changes are merged into the more stable mainline Linus tree.
But testers of -mm and linux-next should be aware that breakages are more common than in any other tree.
This concludes this list of explanations of the various kernel trees. I hope you are now clear on how to apply the various patches and help testing the kernel.
Thank you's to Randy Dunlap, Rolf Eike Beer, Linus Torvalds, Bodo Eggert, Johannes Stezenbach, Grant Coady, Pavel Machek and others that I may have forgotten for their reviews and contributions to this document.
Backporting and conflict resolution
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Author: Vegard Nossum <vegard.nossum@oracle.com>
Introduction #
Some developers may never really have to deal with backporting patches, merging branches, or resolving conflicts in their day-to-day work, so when a merge conflict does pop up, it can be daunting. Luckily, resolving conflicts is a skill like any other, and there are many useful techniques you can use to make the process smoother and increase your confidence in the result.
This document aims to be a comprehensive, step-by-step guide to backporting and conflict resolution.
Applying the patch to a tree #
Sometimes the patch you are backporting already exists as a git commit, in which case you just cherry-pick it directly using git cherry-pick. However, if the patch comes from an email, as it often does for the Linux kernel, you will need to apply it to a tree using git am.
If you've ever used git am, you probably already know that it is quite picky about the patch applying perfectly to your source tree. In fact, you've probably had nightmares about .rej files and trying to edit the patch to make it apply.
It is strongly recommended to instead find an appropriate base version where the patch applies cleanly and then cherry-pick it over to your destination tree, as this will make git output conflict markers and let you resolve conflicts with the help of git and any other conflict resolution tools you might prefer to use. For example, if you want to apply a patch that just arrived on LKML to an older stable kernel, you can apply it to the most recent mainline kernel and then cherry-pick it to your older stable branch.
It's generally better to use the exact same base as the one the patch was generated from, but it doesn't really matter that much as long as it applies cleanly and isn't too far from the original base. The only problem with applying the patch to the "wrong" base is that it may pull in more unrelated changes in the context of the diff when cherry-picking it to the older branch.
A good reason to prefer git cherry-pick over git am is that git knows the precise history of an existing commit, so it will know when code has moved around and changed the line numbers; this in turn makes it less likely to apply the patch to the wrong place (which can result in silent mistakes or messy conflicts).
If you are using b4. and you are applying the patch directly from an email, you can use b4 am with the options -g/--guess-base and -3/--prep-3way to do some of this automatically (see the b4 presentation for more information). However, the rest of this article will assume that you are doing a plain git cherry-pick.
Once you have the patch in git, you can go ahead and cherry-pick it into your source tree. Don't forget to cherry-pick with -x if you want a written record of where the patch came from!
Note that if you are submitting a patch for stable, the format is slightly different; the first line after the subject line needs to be either:
commit <upstream commit> upstream
or:
[ Upstream commit <upstream commit> ]
Resolving conflicts #
Uh-oh; the cherry-pick failed with a vaguely threatening message:
CONFLICT (content): Merge conflict
What to do now?
In general, conflicts appear when the context of the patch (i.e., the lines being changed and/or the lines surrounding the changes) doesn't match what's in the tree you are trying to apply the patch to.
For backports, what likely happened was that the branch you are backporting from contains patches not in the branch you are backporting to. However, the reverse is also possible. In any case, the result is a conflict that needs to be resolved.
If your attempted cherry-pick fails with a conflict, git automatically edits the files to include so-called conflict markers showing you where the conflict is and how the two branches have diverged. Resolving the conflict typically means editing the end result in such a way that it takes into account these other commits.
Resolving the conflict can be done either by hand in a regular text editor or using a dedicated conflict resolution tool.
Many people prefer to use their regular text editor and edit the conflict directly, as it may be easier to understand what you're doing and to control the final result. There are definitely pros and cons to each method, and sometimes there's value in using both.
We will not cover using dedicated merge tools here beyond providing some pointers to various tools that you could use:
To configure git to work with these, see git mergetool --help or the official git-mergetool documentation.
Prerequisite patches #
Most conflicts happen because the branch you are backporting to is missing some patches compared to the branch you are backporting from. In the more general case (such as merging two independent branches), development could have happened on either branch, or the branches have simply diverged -- perhaps your older branch had some other backports applied to it that themselves needed conflict resolutions, causing a divergence.
It's important to always identify the commit or commits that caused the conflict, as otherwise you cannot be confident in the correctness of your resolution. As an added bonus, especially if the patch is in an area you're not that familiar with, the changelogs of these commits will often give you the context to understand the code and potential problems or pitfalls with your conflict resolution.
git log #
A good first step is to look at git log for the file that has the conflict -- this is usually sufficient when there aren't a lot of patches to the file, but may get confusing if the file is big and frequently patched. You should run git log on the range of commits between your currently checked-out branch (HEAD) and the parent of the patch you are picking (<commit>), i.e.:
git log HEAD..<commit>^ -- <path>
Even better, if you want to restrict this output to a single function (because that's where the conflict appears), you can use the following syntax:
git log -L:'\<function\>':<path> HEAD..<commit>^
Another useful option for git log is -G, which allows you to filter on certain strings appearing in the diffs of the commits you are listing:
git log -G'regex' HEAD..<commit>^ -- <path>
This can also be a handy way to quickly find when something (e.g. a function call or a variable) was changed, added, or removed. The search string is a regular expression, which means you can potentially search for more specific things like assignments to a specific struct member:
git log -G'\->index\>.*='
git blame #
Another way to find prerequisite commits (albeit only the most recent one for a given conflict) is to run git blame. In this case, you need to run it against the parent commit of the patch you are cherry-picking and the file where the conflict appeared, i.e.:
git blame <commit>^ -- <path>
This command also accepts the -L argument (for restricting the output to a single function), but in this case you specify the filename at the end of the command as usual:
git blame -L:'\<function\>' <commit>^ -- <path>
Navigate to the place where the conflict occurred. The first column of the blame output is the commit ID of the patch that added a given line of code.
It might be a good idea to git show these commits and see if they look like they might be the source of the conflict. Sometimes there will be more than one of these commits, either because multiple commits changed different lines of the same conflict area or because multiple subsequent patches changed the same line (or lines) multiple times. In the latter case, you may have to run git blame again and specify the older version of the file to look at in order to dig further back in the history of the file.
Prerequisite vs. incidental patches #
Having found the patch that caused the conflict, you need to determine whether it is a prerequisite for the patch you are backporting or whether it is just incidental and can be skipped. An incidental patch would be one that touches the same code as the patch you are backporting, but does not change the semantics of the code in any material way. For example, a whitespace cleanup patch is completely incidental -- likewise, a patch that simply renames a function or a variable would be incidental as well. On the other hand, if the function being changed does not even exist in your current branch then this would not be incidental at all and you need to carefully consider whether the patch adding the function should be cherry-picked first.
If you find that there is a necessary prerequisite patch, then you need to stop and cherry-pick that instead. If you've already resolved some conflicts in a different file and don't want to do it again, you can create a temporary copy of that file.
To abort the current cherry-pick, go ahead and run git cherry-pick --abort, then restart the cherry-picking process with the commit ID of the prerequisite patch instead.
Understanding conflict markers #
Combined diffs #
Let's say you've decided against picking (or reverting) additional patches and you just want to resolve the conflict. Git will have inserted conflict markers into your file. Out of the box, this will look something like:
<<<<<<< HEAD
this is what's in your current tree before cherry-picking
=======
this is what the patch wants it to be after cherry-picking
>>>>>>> <commit>... title
This is what you would see if you opened the file in your editor. However, if you were to run git diff without any arguments, the output would look something like this:
$ git diff
[...]
++<<<<<<<< HEAD
+this is what's in your current tree before cherry-picking
++========
+ this is what the patch wants it to be after cherry-picking
++>>>>>>>> <commit>... title
When you are resolving a conflict, the behavior of git diff differs from its normal behavior. Notice the two columns of diff markers instead of the usual one; this is a so-called "combined diff", here showing the 3-way diff (or diff-of-diffs) between
-
the current branch (before cherry-picking) and the current working directory, and
-
the current branch (before cherry-picking) and the file as it looks after the original patch has been applied.
Better diffs #
3-way combined diffs include all the other changes that happened to the file between your current branch and the branch you are cherry-picking from. While this is useful for spotting other changes that you need to take into account, this also makes the output of git diff somewhat intimidating and difficult to read. You may instead prefer to run git diff HEAD (or git diff --ours) which shows only the diff between the current branch before cherry-picking and the current working directory. It looks like this:
$ git diff HEAD
[...]
+<<<<<<<< HEAD
this is what's in your current tree before cherry-picking
+========
+this is what the patch wants it to be after cherry-picking
+>>>>>>>> <commit>... title
As you can see, this reads just like any other diff and makes it clear which lines are in the current branch and which lines are being added because they are part of the merge conflict or the patch being cherry-picked.
Merge styles and diff3 #
The default conflict marker style shown above is known as the merge style. There is also another style available, known as the diff3 style, which looks like this:
<<<<<<< HEAD
this is what is in your current tree before cherry-picking
||||||| parent of <commit> (title)
this is what the patch expected to find there
=======
this is what the patch wants it to be after being applied
>>>>>>> <commit> (title)
As you can see, this has 3 parts instead of 2, and includes what git expected to find there but didn't. It is highly recommended to use this conflict style as it makes it much clearer what the patch actually changed; i.e., it allows you to compare the before-and-after versions of the file for the commit you are cherry-picking. This allows you to make better decisions about how to resolve the conflict.
To change conflict marker styles, you can use the following command:
git config merge.conflictStyle diff3
There is a third option, zdiff3, introduced in Git 2.35, which has the same 3 sections as diff3, but where common lines have been trimmed off, making the conflict area smaller in some cases.
Iterating on conflict resolutions #
The first step in any conflict resolution process is to understand the patch you are backporting. For the Linux kernel this is especially important, since an incorrect change can lead to the whole system crashing -- or worse, an undetected security vulnerability.
Understanding the patch can be easy or difficult depending on the patch itself, the changelog, and your familiarity with the code being changed. However, a good question for every change (or every hunk of the patch) might be: "Why is this hunk in the patch?" The answers to these questions will inform your conflict resolution.
Resolution process #
Sometimes the easiest thing to do is to just remove all but the first part of the conflict, leaving the file essentially unchanged, and apply the changes by hand. Perhaps the patch is changing a function call argument from 0 to 1 while a conflicting change added an entirely new (and insignificant) parameter to the end of the parameter list; in that case, it's easy enough to change the argument from 0 to 1 by hand and leave the rest of the arguments alone. This technique of manually applying changes is mostly useful if the conflict pulled in a lot of unrelated context that you don't really need to care about.
For particularly nasty conflicts with many conflict markers, you can use git add or git add -i to selectively stage your resolutions to get them out of the way; this also lets you use git diff HEAD to always see what remains to be resolved or git diff --cached to see what your patch looks like so far.
Dealing with file renames #
One of the most annoying things that can happen while backporting a patch is discovering that one of the files being patched has been renamed, as that typically means git won't even put in conflict markers, but will just throw up its hands and say (paraphrased): "Unmerged path! You do the work..."
There are generally a few ways to deal with this. If the patch to the renamed file is small, like a one-line change, the easiest thing is to just go ahead and apply the change by hand and be done with it. On the other hand, if the change is big or complicated, you definitely don't want to do it by hand.
As a first pass, you can try something like this, which will lower the rename detection threshold to 30% (by default, git uses 50%, meaning that two files need to have at least 50% in common for it to consider an add-delete pair to be a potential rename):
git cherry-pick -strategy=recursive -Xrename-threshold=30
Sometimes the right thing to do will be to also backport the patch that did the rename, but that's definitely not the most common case. Instead, what you can do is to temporarily rename the file in the branch you're backporting to (using git mv and committing the result), restart the attempt to cherry-pick the patch, rename the file back (git mv and committing again), and finally squash the result using git rebase -i (see the rebase tutorial) so it appears as a single commit when you are done.
Gotchas #
Function arguments #
Pay attention to changing function arguments! It's easy to gloss over details and think that two lines are the same but actually they differ in some small detail like which variable was passed as an argument (especially if the two variables are both a single character that look the same, like i and j).
Error handling #
If you cherry-pick a patch that includes a goto statement (typically for error handling), it is absolutely imperative to double check that the target label is still correct in the branch you are backporting to. The same goes for added return, break, and continue statements.
Error handling is typically located at the bottom of the function, so it may not be part of the conflict even though could have been changed by other patches.
A good way to ensure that you review the error paths is to always use git diff -W and git show -W (AKA --function-context) when inspecting your changes. For C code, this will show you the whole function that's being changed in a patch. One of the things that often go wrong during backports is that something else in the function changed on either of the branches that you're backporting from or to. By including the whole function in the diff you get more context and can more easily spot problems that might otherwise go unnoticed.
Refactored code #
Something that happens quite often is that code gets refactored by "factoring out" a common code sequence or pattern into a helper function. When backporting patches to an area where such a refactoring has taken place, you effectively need to do the reverse when backporting: a patch to a single location may need to be applied to multiple locations in the backported version. (One giveaway for this scenario is that a function was renamed -- but that's not always the case.)
To avoid incomplete backports, it's worth trying to figure out if the patch fixes a bug that appears in more than one place. One way to do this would be to use git grep. (This is actually a good idea to do in general, not just for backports.) If you do find that the same kind of fix would apply to other places, it's also worth seeing if those places exist upstream -- if they don't, it's likely the patch may need to be adjusted. git log is your friend to figure out what happened to these areas as git blame won't show you code that has been removed.
If you do find other instances of the same pattern in the upstream tree and you're not sure whether it's also a bug, it may be worth asking the patch author. It's not uncommon to find new bugs during backporting!
Verifying the result #
colordiff #
Having committed a conflict-free new patch, you can now compare your patch to the original patch. It is highly recommended that you use a tool such as colordiff that can show two files side by side and color them according to the changes between them:
colordiff -yw -W 200 <(git diff -W <upstream commit>^-) <(git diff -W HEAD^-) | less -SR
Here, -y means to do a side-by-side comparison; -w ignores whitespace, and -W 200 sets the width of the output (as otherwise it will use 130 by default, which is often a bit too little).
The rev^- syntax is a handy shorthand for rev^..rev, essentially giving you just the diff for that single commit; also see the official git rev-parse documentation.
Again, note the inclusion of -W for git diff; this ensures that you will see the full function for any function that has changed.
One incredibly important thing that colordiff does is to highlight lines that are different. For example, if an error-handling goto has changed labels between the original and backported patch, colordiff will show these side-by-side but highlighted in a different color. Thus, it is easy to see that the two goto statements are jumping to different labels. Likewise, lines that were not modified by either patch but differ in the context will also be highlighted and thus stand out during a manual inspection.
Of course, this is just a visual inspection; the real test is building and running the patched kernel (or program).
Build testing #
We won't cover runtime testing here, but it can be a good idea to build just the files touched by the patch as a quick sanity check. For the Linux kernel you can build single files like this, assuming you have the .config and build environment set up correctly:
make path/to/file.o
Note that this won't discover linker errors, so you should still do a full build after verifying that the single file compiles. By compiling the single file first you can avoid having to wait for a full build in case there are compiler errors in any of the files you've changed.
Runtime testing #
Even a successful build or boot test is not necessarily enough to rule out a missing dependency somewhere. Even though the chances are small, there could be code changes where two independent changes to the same file result in no conflicts, no compile-time errors, and runtime errors only in exceptional cases.
One concrete example of this was a pair of patches to the system call entry code where the first patch saved/restored a register and a later patch made use of the same register somewhere in the middle of this sequence. Since there was no overlap between the changes, one could cherry-pick the second patch, have no conflicts, and believe that everything was fine, when in fact the code was now scribbling over an unsaved register.
Although the vast majority of errors will be caught during compilation or by superficially exercising the code, the only way to really verify a backport is to review the final patch with the same level of scrutiny as you would (or should) give to any other patch. Having unit tests and regression tests or other types of automatic testing can help increase the confidence in the correctness of a backport.
Submitting backports to stable #
As the stable maintainers try to cherry-pick mainline fixes onto their stable kernels, they may send out emails asking for backports when encountering conflicts, see e.g. <https://lore.kernel.org/stable/2023101528-jawed-shelving-071a@gregkh/>. These emails typically include the exact steps you need to cherry-pick the patch to the correct tree and submit the patch.
One thing to make sure is that your changelog conforms to the expected format:
<original patch title>
[ Upstream commit <mainline rev> ]
<rest of the original changelog>
[ <summary of the conflicts and their resolutions> ]
Signed-off-by: <your name and email>
The "Upstream commit" line is sometimes slightly different depending on the stable version. Older version used this format:
commit <mainline rev> upstream.
It is most common to indicate the kernel version the patch applies to in the email subject line (using e.g. git send-email --subject-prefix='PATCH 6.1.y'), but you can also put it in the Signed-off-by:-area or below the --- line.
The stable maintainers expect separate submissions for each active stable version, and each submission should also be tested separately.
A few final words of advice #
-
Approach the backporting process with humility.
-
Understand the patch you are backporting; this means reading both the changelog and the code.
-
Be honest about your confidence in the result when submitting the patch.
-
Ask relevant maintainers for explicit acks.
Examples #
The above shows roughly the idealized process of backporting a patch. For a more concrete example, see this video tutorial where two patches are backported from mainline to stable: Backporting Linux Kernel Patches.
(How to avoid) Botching up ioctls
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
From: https://blog.ffwll.ch/2013/11/botching-up-ioctls.html
By: Daniel Vetter, Copyright © 2013 Intel Corporation
One clear insight kernel graphics hackers gained in the past few years is that trying to come up with a unified interface to manage the execution units and memory on completely different GPUs is a futile effort. So nowadays every driver has its own set of ioctls to allocate memory and submit work to the GPU. Which is nice, since there's no more insanity in the form of fake-generic, but actually only used once interfaces. But the clear downside is that there's much more potential to screw things up.
To avoid repeating all the same mistakes again I've written up some of the lessons learned while botching the job for the drm/i915 driver. Most of these only cover technicalities and not the big-picture issues like what the command submission ioctl exactly should look like. Learning these lessons is probably something every GPU driver has to do on its own.
Prerequisites #
First the prerequisites. Without these you have already failed, because you will need to add a 32-bit compat layer:
Only use fixed sized integers. To avoid conflicts with typedefs in userspace the kernel has special types like __u32, __s64. Use them.
Align everything to the natural size and use explicit padding. 32-bit platforms don't necessarily align 64-bit values to 64-bit boundaries, but 64-bit platforms do. So we always need padding to the natural size to get this right.
Pad the entire struct to a multiple of 64-bits if the structure contains 64-bit types - the structure size will otherwise differ on 32-bit versus 64-bit. Having a different structure size hurts when passing arrays of structures to the kernel, or if the kernel checks the structure size, which e.g. the drm core does.
Pointers are __u64, cast from/to a uintptr_t on the userspace side and from/to a void __user * in the kernel. Try really hard not to delay this conversion or worse, fiddle the raw __u64 through your code since that diminishes the checking tools like sparse can provide. The macro u64_to_user_ptr can be used in the kernel to avoid warnings about integers and pointers of different sizes.
Basics #
With the joys of writing a compat layer avoided we can take a look at the basic fumbles. Neglecting these will make backward and forward compatibility a real pain. And since getting things wrong on the first attempt is guaranteed you will have a second iteration or at least an extension for any given interface.
Have a clear way for userspace to figure out whether your new ioctl or ioctl extension is supported on a given kernel. If you can't rely on old kernels rejecting the new flags/modes or ioctls (since doing that was botched in the past) then you need a driver feature flag or revision number somewhere.
Have a plan for extending ioctls with new flags or new fields at the end of the structure. The drm core checks the passed-in size for each ioctl call and zero-extends any mismatches between kernel and userspace. That helps, but isn't a complete solution since newer userspace on older kernels won't notice that the newly added fields at the end get ignored. So this still needs a new driver feature flags.
Check all unused fields and flags and all the padding for whether it's 0, and reject the ioctl if that's not the case. Otherwise your nice plan for future extensions is going right down the gutters since someone will submit an ioctl struct with random stack garbage in the yet unused parts. Which then bakes in the ABI that those fields can never be used for anything else but garbage. This is also the reason why you must explicitly pad all structures, even if you never use them in an array - the padding the compiler might insert could contain garbage.
Have simple testcases for all of the above.
Fun with Error Paths #
Nowadays we don't have any excuse left any more for drm drivers being neat little root exploits. This means we both need full input validation and solid error handling paths - GPUs will die eventually in the oddmost corner cases anyway:
The ioctl must check for array overflows. Also it needs to check for over/underflows and clamping issues of integer values in general. The usual example is sprite positioning values fed directly into the hardware with the hardware just having 12 bits or so. Works nicely until some odd display server doesn't bother with clamping itself and the cursor wraps around the screen.
Have simple testcases for every input validation failure case in your ioctl. Check that the error code matches your expectations. And finally make sure that you only test for one single error path in each subtest by submitting otherwise perfectly valid data. Without this an earlier check might reject the ioctl already and shadow the codepath you actually want to test, hiding bugs and regressions.
Make all your ioctls restartable. First X really loves signals and second this will allow you to test 90% of all error handling paths by just interrupting your main test suite constantly with signals. Thanks to X's love for signal you'll get an excellent base coverage of all your error paths pretty much for free for graphics drivers. Also, be consistent with how you handle ioctl restarting - e.g. drm has a tiny drmIoctl helper in its userspace library. The i915 driver botched this with the set_tiling ioctl, now we're stuck forever with some arcane semantics in both the kernel and userspace.
If you can't make a given codepath restartable make a stuck task at least killable. GPUs just die and your users won't like you more if you hang their entire box (by means of an unkillable X process). If the state recovery is still too tricky have a timeout or hangcheck safety net as a last-ditch effort in case the hardware has gone bananas.
Have testcases for the really tricky corner cases in your error recovery code - it's way too easy to create a deadlock between your hangcheck code and waiters.
Time, Waiting and Missing it #
GPUs do most everything asynchronously, so we have a need to time operations and wait for outstanding ones. This is really tricky business; at the moment none of the ioctls supported by the drm/i915 get this fully right, which means there's still tons more lessons to learn here.
Use CLOCK_MONOTONIC as your reference time, always. It's what alsa, drm and v4l use by default nowadays. But let userspace know which timestamps are derived from different clock domains like your main system clock (provided by the kernel) or some independent hardware counter somewhere else. Clocks will mismatch if you look close enough, but if performance measuring tools have this information they can at least compensate. If your userspace can get at the raw values of some clocks (e.g. through in-command-stream performance counter sampling instructions) consider exposing those also.
Use __s64 seconds plus __u64 nanoseconds to specify time. It's not the most convenient time specification, but it's mostly the standard.
Check that input time values are normalized and reject them if not. Note that the kernel native struct ktime has a signed integer for both seconds and nanoseconds, so beware here.
For timeouts, use absolute times. If you're a good fellow and made your ioctl restartable relative timeouts tend to be too coarse and can indefinitely extend your wait time due to rounding on each restart. Especially if your reference clock is something really slow like the display frame counter. With a spec lawyer hat on this isn't a bug since timeouts can always be extended - but users will surely hate you if their neat animations starts to stutter due to this.
Consider ditching any synchronous wait ioctls with timeouts and just deliver an asynchronous event on a pollable file descriptor. It fits much better into event driven applications' main loop.
Have testcases for corner-cases, especially whether the return values for already-completed events, successful waits and timed-out waits are all sane and suiting to your needs.
Leaking Resources, Not #
A full-blown drm driver essentially implements a little OS, but specialized to the given GPU platforms. This means a driver needs to expose tons of handles for different objects and other resources to userspace. Doing that right entails its own little set of pitfalls:
Always attach the lifetime of your dynamically created resources to the lifetime of a file descriptor. Consider using a 1:1 mapping if your resource needs to be shared across processes - fd-passing over unix domain sockets also simplifies lifetime management for userspace.
Always have O_CLOEXEC support.
Ensure that you have sufficient insulation between different clients. By default pick a private per-fd namespace which forces any sharing to be done explicitly. Only go with a more global per-device namespace if the objects are truly device-unique. One counterexample in the drm modeset interfaces is that the per-device modeset objects like connectors share a namespace with framebuffer objects, which mostly are not shared at all. A separate namespace, private by default, for framebuffers would have been more suitable.
Think about uniqueness requirements for userspace handles. E.g. for most drm drivers it's a userspace bug to submit the same object twice in the same command submission ioctl. But then if objects are shareable userspace needs to know whether it has seen an imported object from a different process already or not. I haven't tried this myself yet due to lack of a new class of objects, but consider using inode numbers on your shared file descriptors as unique identifiers - it's how real files are told apart, too. Unfortunately this requires a full-blown virtual filesystem in the kernel.
Last, but not Least #
Not every problem needs a new ioctl:
Think hard whether you really want a driver-private interface. Of course it's much quicker to push a driver-private interface than engaging in lengthy discussions for a more generic solution. And occasionally doing a private interface to spearhead a new concept is what's required. But in the end, once the generic interface comes around you'll end up maintaining two interfaces. Indefinitely.
Consider other interfaces than ioctls. A sysfs attribute is much better for per-device settings, or for child objects with fairly static lifetimes (like output connectors in drm with all the detection override attributes). Or maybe only your testsuite needs this interface, and then debugfs with its disclaimer of not having a stable ABI would be better.
Finally, the name of the game is to get it right on the first attempt, since if your driver proves popular and your hardware platforms long-lived then you'll be stuck with a given ioctl essentially forever. You can try to deprecate horrible ioctls on newer iterations of your hardware, but generally it takes years to accomplish this. And then again years until the last user able to complain about regressions disappears, too.
Minimal requirements to compile the Kernel
Peios Kernel / Kernel development / Development process
Peios: Use Building Peios for the repository build, toolchain, configuration and test entry points. This article describes the underlying Linux machinery or upstream workflow. Its standalone build/install commands do not establish a qualified Peios kernel or signed release modules.
Intro #
This document is designed to provide a list of the minimum levels of software necessary to run the current kernel version.
This document is originally based on my "Changes" file for 2.0.x kernels and therefore owes credit to the same people as that file (Jared Mauch, Axel Boldt, Alessandro Sigala, and countless other users all over the 'net).
Current Minimal Requirements #
Upgrade to at least these software revisions before thinking you've encountered a bug! If you're unsure what version you're currently running, the suggested command should tell you.
Again, keep in mind that this list assumes you are already functionally running a Linux kernel. Also, not all tools are necessary on all systems; obviously, if you don't have any PC Card hardware, for example, you probably needn't concern yourself with pcmciautils.
|
Program |
Minimal version |
Command to check the version |
|---|---|---|
|
GNU C |
8.1 |
gcc --version |
|
Clang/LLVM (optional) |
15.0.0 |
clang --version |
|
Rust (optional) |
1.78.0 |
rustc --version |
|
bindgen (optional) |
0.65.1 |
bindgen --version |
|
GNU make |
4.0 |
make --version |
|
bash |
4.2 |
bash --version |
|
binutils |
2.30 |
ld -v |
|
flex |
2.5.35 |
flex --version |
|
bison |
2.0 |
bison --version |
|
pahole |
1.22 |
pahole --version |
|
util-linux |
2.10o |
mount --version |
|
kmod |
13 |
depmod -V |
|
e2fsprogs |
1.41.4 |
e2fsck -V |
|
jfsutils |
1.1.3 |
fsck.jfs -V |
|
xfsprogs |
2.6.0 |
xfs_db -V |
|
squashfs-tools |
4.0 |
mksquashfs -version |
|
btrfs-progs |
0.18 |
btrfs --version |
|
pcmciautils |
004 |
pccardctl -V |
|
quota-tools |
3.09 |
quota -V |
|
PPP |
2.4.0 |
pppd --version |
|
nfs-utils |
1.0.5 |
showmount --version |
|
procps |
3.2.0 |
ps --version |
|
udev |
081 |
udevd --version |
|
grub |
0.93 |
grub --version || grub-install --version |
|
mcelog |
0.6 |
mcelog --version |
|
iptables |
1.4.2 |
iptables -V |
|
openssl & libcrypto |
1.0.0 |
openssl version |
|
bc |
1.06.95 |
bc --version |
|
Sphinx1 |
3.4.3 |
sphinx-build --version |
|
GNU tar |
1.28 |
tar --version |
|
gtags (optional) |
6.6.5 |
gtags --version |
|
mkimage (optional) |
2017.01 |
mkimage --version |
|
Python |
3.9.x |
python3 --version |
|
GNU AWK (optional) |
5.1.0 |
gawk --version |
[1] Sphinx is needed only to build the Kernel documentation
Kernel compilation #
GCC #
The gcc version requirements may vary depending on the type of CPU in your computer.
Clang/LLVM (optional) #
The latest formal release of clang and LLVM utils (according to releases.llvm.org) are supported for building kernels. Older releases aren't guaranteed to work, and we may drop workarounds from the kernel that were used to support older versions. Please see additional docs on Building Linux with Clang/LLVM.
Rust (optional) #
A recent version of the Rust compiler is required.
Please see Documentation/rust/quick-start.rst for instructions on how to satisfy the build requirements of Rust support. In particular, the Makefile target rustavailable is useful to check why the Rust toolchain may not be detected.
bindgen (optional) #
bindgen is used to generate the Rust bindings to the C side of the kernel. It depends on libclang.
Make #
You will need GNU make 4.0 or later to build the kernel.
Bash #
Some bash scripts are used for the kernel build. Bash 4.2 or newer is needed.
Binutils #
Binutils 2.30 or newer is needed to build the kernel.
pkg-config #
The build system, as of 4.18, requires pkg-config to check for installed kconfig tools and to determine flags settings for use in 'make {g,x}config'. Previously pkg-config was being used but not verified or documented.
Flex #
Since Linux 4.16, the build system generates lexical analyzers during build. This requires flex 2.5.35 or later.
Bison #
Since Linux 4.16, the build system generates parsers during build. This requires bison 2.0 or later.
pahole #
Since Linux 5.2, if CONFIG_DEBUG_INFO_BTF is selected, the build system generates BTF (BPF Type Format) from DWARF in vmlinux, a bit later from kernel modules as well. This requires pahole v1.22 or later.
It is found in the 'dwarves' or 'pahole' distro packages or from https://fedorapeople.org/~acme/dwarves/.
Perl #
You will need perl 5 and the following modules: Getopt::Long, Getopt::Std, File::Basename, and File::Find to build the kernel.
Python #
Several config options require it: it is required for arm/arm64 default configs, CONFIG_LTO_CLANG, some DRM optional configs, the kernel-doc tool, and docs build (Sphinx), among others.
BC #
You will need bc to build kernels 3.10 and higher
OpenSSL #
Module signing and external certificate handling use the OpenSSL program and crypto library to do key creation and signature generation.
You will need openssl to build kernels 3.7 and higher if module signing is enabled. You will also need openssl development packages to build kernels 4.3 and higher.
Tar #
GNU tar is needed if you want to enable access to the kernel headers via sysfs (CONFIG_IKHEADERS).
gtags / GNU GLOBAL (optional) #
The kernel build requires GNU GLOBAL version 6.6.5 or later to generate tag files through make gtags. This is due to its use of the gtags -C (--directory) flag.
mkimage #
This tool is used when building a Flat Image Tree (FIT), commonly used on ARM platforms. The tool is available via the u-boot-tools package or can be built from the U-Boot source code. See the instructions at https://docs.u-boot.org/en/latest/build/tools.html#building-tools-for-linux
GNU AWK #
GNU AWK is needed if you want kernel builds to generate address range data for builtin modules (CONFIG_BUILTIN_MODULE_RANGES).
System utilities #
Architectural changes #
DevFS has been obsoleted in favour of udev (https://www.kernel.org/pub/linux/utils/kernel/hotplug/)
32-bit UID support is now in place. Have fun!
Linux documentation for functions is transitioning to inline documentation via specially-formatted comments near their definitions in the source. These comments can be combined with ReST files in the Documentation/ directory to make enriched documentation, which can then be converted to PostScript, HTML, LaTex, ePUB and PDF files. In order to convert from ReST format to a format of your choice, you'll need Sphinx.
Util-linux #
New versions of util-linux provide fdisk support for larger disks, support new options to mount, recognize more supported partition types, and similar goodies. You'll probably want to upgrade.
Ksymoops #
If the unthinkable happens and your kernel oopses, you may need the ksymoops tool to decode it, but in most cases you don't. It is generally preferred to build the kernel with CONFIG_KALLSYMS so that it produces readable dumps that can be used as-is (this also produces better output than ksymoops). If for some reason your kernel is not build with CONFIG_KALLSYMS and you have no way to rebuild and reproduce the Oops with that option, then you can still decode that Oops with ksymoops.
Mkinitrd #
These changes to the /lib/modules file tree layout also require that mkinitrd be upgraded.
E2fsprogs #
The latest version of e2fsprogs fixes several bugs in fsck and debugfs. Obviously, it's a good idea to upgrade.
JFSutils #
The jfsutils package contains the utilities for the file system. The following utilities are available:
-
fsck.jfs- initiate replay of the transaction log, and check and repair a JFS formatted partition. -
mkfs.jfs- create a JFS formatted partition. -
other file system utilities are also available in this package.
Xfsprogs #
The latest version of xfsprogs contains mkfs.xfs, xfs_db, and the xfs_repair utilities, among others, for the XFS filesystem. It is architecture independent and any version from 2.0.0 onward should work correctly with this version of the XFS kernel code (2.6.0 or later is recommended, due to some significant improvements).
PCMCIAutils #
PCMCIAutils replaces pcmcia-cs. It properly sets up PCMCIA sockets at system startup and loads the appropriate modules for 16-bit PCMCIA devices if the kernel is modularized and the hotplug subsystem is used.
Quota-tools #
Support for 32 bit uid's and gid's is required if you want to use the newer version 2 quota format. Quota-tools version 3.07 and newer has this support. Use the recommended version or newer from the table above.
Intel IA32 microcode #
A driver has been added to allow updating of Intel IA32 microcode, accessible as a normal (misc) character device. If you are not using udev you may need to:
mkdir /dev/cpu
mknod /dev/cpu/microcode c 10 184
chmod 0644 /dev/cpu/microcode
as root before you can use this. You'll probably also want to get the user-space microcode_ctl utility to use with this.
udev #
udev is a userspace application for populating /dev dynamically with only entries for devices actually present. udev replaces the basic functionality of devfs, while allowing persistent device naming for devices.
FUSE #
Needs libfuse 2.4.0 or later. Absolute minimum is 2.3.0 but mount options direct_io and kernel_cache won't work.
Networking #
General changes #
If you have advanced network configuration needs, you should probably consider using the network tools from ip-route2.
Packet Filter / NAT #
The packet filtering and NAT code uses the same tools like the previous 2.4.x kernel series (iptables). It still includes backwards-compatibility modules for 2.2.x-style ipchains and 2.0.x-style ipfwadm.
PPP #
The PPP driver has been restructured to support multilink and to enable it to operate over diverse media layers. If you use PPP, upgrade pppd to at least 2.4.0.
If you are not using udev, you must have the device file /dev/ppp which can be made by:
mknod /dev/ppp c 108 0
as root.
NFS-utils #
In ancient (2.4 and earlier) kernels, the nfs server needed to know about any client that expected to be able to access files via NFS. This information would be given to the kernel by mountd when the client mounted the filesystem, or by exportfs at system startup. exportfs would take information about active clients from /var/lib/nfs/rmtab.
This approach is quite fragile as it depends on rmtab being correct which is not always easy, particularly when trying to implement fail-over. Even when the system is working well, rmtab suffers from getting lots of old entries that never get removed.
With modern kernels we have the option of having the kernel tell mountd when it gets a request from an unknown host, and mountd can give appropriate export information to the kernel. This removes the dependency on rmtab and means that the kernel only needs to know about currently active clients.
To enable this new functionality, you need to:
mount -t nfsd nfsd /proc/fs/nfsd
before running exportfs or mountd. It is recommended that all NFS services be protected from the internet-at-large by a firewall where that is possible.
mcelog #
On x86 kernels the mcelog utility is needed to process and log machine check events when CONFIG_X86_MCE is enabled. Machine check events are errors reported by the CPU. Processing them is strongly encouraged.
Kernel documentation #
Sphinx #
Please see sphinx_install in Documentation/doc-guide/sphinx.rst for details about Sphinx requirements.
rustdoc #
rustdoc is used to generate the documentation for Rust code. Please see Documentation/rust/general-information.rst for more information.
Getting updated software #
Kernel compilation #
gcc #
Clang/LLVM #
Rust #
bindgen #
Make #
Bash #
Binutils #
Flex #
Bison #
OpenSSL #
System utilities #
Util-linux #
Kmod #
Ksymoops #
Mkinitrd #
E2fsprogs #
JFSutils #
Xfsprogs #
Pcmciautils #
Quota-tools #
Intel P6 microcode #
udev #
FUSE #
mcelog #
Networking #
PPP #
NFS-utils #
Iptables #
Ip-route2 #
OProfile #
Kernel documentation #
Sphinx #
Linux Kernel Contributor Covenant Code of Conduct Interpretation
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The Contributor Covenant Code of Conduct is a general document meant to provide a set of rules for almost any open source community. Every open-source community is unique and the Linux kernel is no exception. Because of this, this document describes how we in the Linux kernel community will interpret it. We also do not expect this interpretation to be static over time, and will adjust it as needed.
The Linux kernel development effort is a very personal process compared to "traditional" ways of developing software. Your contributions and ideas behind them will be carefully reviewed, often resulting in critique and criticism. The review will almost always require improvements before the material can be included in the kernel. Know that this happens because everyone involved wants to see the best possible solution for the overall success of Linux. This development process has been proven to create the most robust operating system kernel ever, and we do not want to do anything to cause the quality of submission and eventual result to ever decrease.
Maintainers #
The Code of Conduct uses the term "maintainers" numerous times. In the kernel community, a "maintainer" is anyone who is responsible for a subsystem, driver, or file, and is listed in the MAINTAINERS file in the kernel source tree.
Responsibilities #
The Code of Conduct mentions rights and responsibilities for maintainers, and this needs some further clarifications.
First and foremost, it is a reasonable expectation to have maintainers lead by example.
That being said, our community is vast and broad, and there is no new requirement for maintainers to unilaterally handle how other people behave in the parts of the community where they are active. That responsibility is upon all of us, and ultimately the Code of Conduct documents final escalation paths in case of unresolved concerns regarding conduct issues.
Maintainers should be willing to help when problems occur, and work with others in the community when needed. Do not be afraid to reach out to the Technical Advisory Board (TAB) or other maintainers if you're uncertain how to handle situations that come up. It will not be considered a violation report unless you want it to be. If you are uncertain about approaching the TAB or any other maintainers, please reach out to our conflict mediator, Joanna Lee <jlee@linuxfoundation.org>.
In the end, "be kind to each other" is really what the end goal is for everybody. We know everyone is human and we all fail at times, but the primary goal for all of us should be to work toward amicable resolutions of problems. Enforcement of the code of conduct will only be a last resort option.
Our goal of creating a robust and technically advanced operating system and the technical complexity involved naturally require expertise and decision-making.
The required expertise varies depending on the area of contribution. It is determined mainly by context and technical complexity and only secondary by the expectations of contributors and maintainers.
Both the expertise expectations and decision-making are subject to discussion, but at the very end there is a basic necessity to be able to make decisions in order to make progress. This prerogative is in the hands of maintainers and project's leadership and is expected to be used in good faith.
As a consequence, setting expertise expectations, making decisions and rejecting unsuitable contributions are not viewed as a violation of the Code of Conduct.
While maintainers are in general welcoming to newcomers, their capacity of helping contributors overcome the entry hurdles is limited, so they have to set priorities. This, also, is not to be seen as a violation of the Code of Conduct. The kernel community is aware of that and provides entry level programs in various forms like kernelnewbies.org.
Scope #
The Linux kernel community primarily interacts on a set of public email lists distributed around a number of different servers controlled by a number of different companies or individuals. All of these lists are defined in the MAINTAINERS file in the kernel source tree. Any emails sent to those mailing lists are considered covered by the Code of Conduct.
Developers who use the kernel.org bugzilla, and other subsystem bugzilla or bug tracking tools should follow the guidelines of the Code of Conduct. The Linux kernel community does not have an "official" project email address, or "official" social media address. Any activity performed using a kernel.org email account must follow the Code of Conduct as published for kernel.org, just as any individual using a corporate email account must follow the specific rules of that corporation.
The Code of Conduct does not prohibit continuing to include names, email addresses, and associated comments in mailing list messages, kernel change log messages, or code comments.
Interaction in other forums is covered by whatever rules apply to said forums and is in general not covered by the Code of Conduct. Exceptions may be considered for extreme circumstances.
Contributions submitted for the kernel should use appropriate language. Content that already exists predating the Code of Conduct will not be addressed now as a violation. Inappropriate language can be seen as a bug, though; such bugs will be fixed more quickly if any interested parties submit patches to that effect. Expressions that are currently part of the user/kernel API, or reflect terminology used in published standards or specifications, are not considered bugs.
Enforcement #
The address listed in the Code of Conduct goes to the Code of Conduct Committee. The exact members receiving these emails at any given time are listed at https://kernel.org/code-of-conduct.html. Members can not access reports made before they joined or after they have left the committee.
The Code of Conduct Committee consists of volunteer community members appointed by the TAB, as well as a professional mediator acting as a neutral third party. The processes the Code of Conduct committee will use to address reports is varied and will depend on the individual circumstance, however, this file serves as documentation for the general process used.
Any member of the committee, including the mediator, can be contacted directly if a reporter does not wish to include the full committee in a complaint or concern.
The Code of Conduct Committee reviews the cases according to the processes (see above) and consults with the TAB as needed and appropriate, for instance to request and receive information about the kernel community.
Any decisions regarding enforcement recommendations will be brought to the TAB for implementation of enforcement with the relevant maintainers if needed. Once the TAB approves one or more of the measures outlined in the scope of the ban by two-thirds of the members voting for the measures, the Code of Conduct Committee will enforce the TAB approved measures. Any Code of Conduct Committee members serving on the TAB will not vote on the measures.
At quarterly intervals, the Code of Conduct Committee and TAB will provide a report summarizing the anonymised reports that the Code of Conduct committee has received and their status, as well details of any TAB approved decisions including complete and identifiable voting details.
Because how we interpret and enforce the Code of Conduct will evolve over time, this document will be updated when necessary to reflect any changes.
Enforcement for Unacceptable Behavior Code of Conduct Violations #
The Code of Conduct committee works to ensure that our community continues to be inclusive and fosters diverse discussions and viewpoints, and works to improve those characteristics over time. A majority of the reports the Code of Conduct Committee receives stem from incorrect understanding regarding the development process and maintainers' roles, responsibilities, and their right to make decisions on code acceptance. These are resolved through clarification of the development process and the scope of the Code of Conduct.
Unacceptable behaviors could interrupt respectful collaboration for a short period of time and negatively impact the health of the community longer term. Unacceptable behaviors often get resolved when individuals acknowledge their behavior and make amends for it in the setting the violation has taken place.
The Code of Conduct Committee receives reports about unacceptable behaviors when they don't get resolved through community discussions. The Code of Conduct committee takes measures to restore productive and respectful collaboration when an unacceptable behavior has negatively impacted that relationship.
The Code of Conduct Committee has the obligation to keep the reports and reporters' information private. Reports could come from injured parties and community members who are observers of unacceptable behaviors. The Code of Conduct Committee has the responsibility to investigate and resolve these reports, working with all involved parties.
The Code of Conduct Committee works with the individual to bring about change in their understanding of the importance to repair the damage caused by their behavior to the injured party and the long term negative impact on the community.
The goal is to reach a resolution which is agreeable to all parties. If working with the individual fails to bring about the desired outcome, the Code of Conduct Committee will evaluate other measures such as seeking public apology to repair the damage.
Seek public apology for the violation #
The Code of Conduct Committee publicly calls out the behavior in the setting in which the violation has taken place, seeking public apology for the violation.
A public apology for the violation is the first step towards rebuilding the trust. Trust is essential for the continued success and health of the community which operates on trust and respect.
Remedial measures if there is no public apology for the violation #
The Code of Conduct Committee determines the next course of action to restore the healthy collaboration by recommending remedial measure(s) to the TAB for approval.
- Ban violator from participating in the kernel development process for a period of up to a full kernel development cycle. The Code of Conduct Committee could require public apology as a condition for lifting the ban.
The scope of the ban for a period of time could include:
a. denying patch contributions and pull requests
b. pausing collaboration with the violator by ignoring their contributions and/or blocking their email account(s)
c. restricting their ability to communicate via kernel.org platforms, such as mailing lists and social media sites
Once the TAB approves one or more of the measures outlined in the scope of the ban by two-thirds of the members voting for the measures, the Code of Conduct Committee will enforce the TAB approved measure(s) in collaboration with the community, maintainers, sub-maintainers, and kernel.org administrators. Any Code of Conduct Committee members serving on the TAB will not vote on the measures.
The Code of Conduct Committee is mindful of the negative impact of seeking public apology and instituting ban could have on individuals. It is also mindful of the longer term harm to the community that could result from not taking action when such serious public violations occur.
The effectiveness of the remedial measure(s) approved by the TAB depends on the trust and cooperation from the community, maintainers, sub-maintainers, and kernel.org administrators in enforcing them.
The Code of Conduct Committee sincerely hopes that unacceptable behaviors that require seeking public apologies continue to be exceedingly rare occurrences in the future.
Contributor Covenant Code of Conduct
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Our Pledge #
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
Our Standards #
Examples of behavior that contributes to creating a positive environment include:
-
Using welcoming and inclusive language
-
Being respectful of differing viewpoints and experiences
-
Gracefully accepting constructive criticism
-
Focusing on what is best for the community
-
Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
-
The use of sexualized language or imagery and unwelcome sexual attention or advances
-
Trolling, insulting/derogatory comments, and personal or political attacks
-
Public or private harassment
-
Publishing others’ private information, such as a physical or electronic address, without explicit permission
-
Other conduct which could reasonably be considered inappropriate in a professional setting
Our Responsibilities #
Maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Scope #
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
Enforcement #
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Code of Conduct Committee at <conduct@kernel.org>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The Code of Conduct Committee is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Attribution #
This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
Interpretation #
See the Linux Kernel Contributor Covenant Code of Conduct Interpretation document for how the Linux kernel community will be interpreting this document.
AI Coding Assistants
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This document provides guidance for AI tools and developers using AI assistance when contributing to the Linux kernel.
AI tools helping with Linux kernel development should follow the standard kernel development process:
Licensing and Legal Requirements #
All contributions must comply with the kernel's licensing requirements:
-
All code must be compatible with GPL-2.0-only
-
Use appropriate SPDX license identifiers
-
See Documentation/process/license-rules.rst for details
Signed-off-by and Developer Certificate of Origin #
AI agents MUST NOT add Signed-off-by tags. Only humans can legally certify the Developer Certificate of Origin (DCO). The human submitter is responsible for:
-
Reviewing all AI-generated code
-
Ensuring compliance with licensing requirements
-
Adding their own Signed-off-by tag to certify the DCO
-
Taking full responsibility for the contribution
Attribution #
When AI tools contribute to kernel development, proper attribution helps track the evolving role of AI in the development process. Contributions should include an Assisted-by tag in the following format:
Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]
Where:
-
AGENT_NAMEis the name of the AI tool or framework -
MODEL_VERSIONis the specific model version used -
[TOOL1] [TOOL2]are optional specialized analysis tools used (e.g., coccinelle, sparse, smatch, clang-tidy)
Basic development tools (git, gcc, make, editors) should not be listed.
Example:
Assisted-by: Claude:claude-3-opus coccinelle sparse
Linux kernel coding style
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This is a short document describing the preferred coding style for the linux kernel. Coding style is very personal, and I won't force my views on anybody, but this is what goes for anything that I have to be able to maintain, and I'd prefer it for most other things too. Please at least consider the points made here.
First off, I'd suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it's a great symbolic gesture.
Anyway, here goes:
1) Indentation #
Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.
Rationale: The whole idea behind indentation is to clearly define where a block of control starts and ends. Especially when you've been looking at your screen for 20 straight hours, you'll find it a lot easier to see how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
In short, 8-char indents make things easier to read, and have the added benefit of warning you when you're nesting your functions too deep. Heed that warning.
The preferred way to ease multiple indentation levels in a switch statement is to align the switch and its subordinate case labels in the same column instead of double-indenting the case labels. E.g.:
switch
Don't put multiple statements on a single line unless you have something to hide:
if do_this;
do_something_everytime;
Don't use commas to avoid using braces:
if
, ;
Always use braces for multiple statements:
if
Don't put multiple assignments on a single line either. Kernel coding style is super simple. Avoid tricky expressions.
Outside of comments, documentation and except in Kconfig, spaces are never used for indentation, and the above example is deliberately broken.
Get a decent editor and don't leave whitespace at the end of lines.
2) Breaking long lines and strings #
Coding style is all about readability and maintainability using commonly available tools.
The preferred limit on the length of a single line is 80 columns.
Statements longer than 80 columns should be broken into sensible chunks, unless exceeding 80 columns significantly increases readability and does not hide information.
Descendants are always substantially shorter than the parent and are placed substantially to the right. A very commonly used style is to align descendants to a function open parenthesis.
These same rules are applied to function headers with a long argument list.
However, never break user-visible strings such as printk messages because that breaks the ability to grep for them.
3) Placing Braces and Spaces #
The other issue that always comes up in C styling is the placement of braces. Unlike the indent size, there are few technical reasons to choose one placement strategy over the other, but the preferred way, as shown to us by the prophets Kernighan and Ritchie, is to put the opening brace last on the line, and put the closing brace first, thusly:
if
This applies to all non-function statement blocks (if, switch, for, while, do). E.g.:
switch
However, there is one special case, namely functions: they have the opening brace at the beginning of the next line, thus:
int
Heretic people all over the world have claimed that this inconsistency is ... well ... inconsistent, but all right-thinking people know that (a) K&R are right and (b) K&R are right. Besides, functions are special anyway (you can't nest them in C).
Note that the closing brace is empty on a line of its own, except in the cases where it is followed by a continuation of the same statement, ie a while in a do-statement or an else in an if-statement, like this:
do while ;
and
if else if else
Rationale: K&R.
Also, note that this brace-placement also minimizes the number of empty (or almost empty) lines, without any loss of readability. Thus, as the supply of new-lines on your screen is not a renewable resource (think 25-line terminal screens here), you have more empty lines to put comments on.
Do not unnecessarily use braces where a single statement will do.
if
;
and
if
;
else
;
This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:
if else
Also, use braces when a loop contains more than a single simple statement:
while
3.1) Spaces #
Linux kernel style for use of spaces depends (mostly) on function-versus-keyword usage. Use a space after (most) keywords. The notable exceptions are sizeof, typeof, alignof, and __attribute__, which look somewhat like functions (and are usually used with parentheses in Linux, although they are not required in the language, as in: sizeof info after struct fileinfo info; is declared).
So use a space after these keywords:
if, switch, case, for, do, while
but not with sizeof, typeof, alignof, or __attribute__. E.g.,
s = sizeof;
Do not add spaces around (inside) parenthesized expressions. This example is bad:
s = sizeof;
When declaring pointer data or a function that returns a pointer type, the preferred use of * is adjacent to the data name or function name and not adjacent to the type name. Examples:
char *linux_banner;
unsigned long long ;
char *;
Use one space around (on each side of) most binary and ternary operators, such as any of these:
= + - < > * / % | & ^ <= >= == != ? :
but no space after unary operators:
& * + - ~ ! sizeof typeof alignof __attribute__ defined
no space before the postfix increment & decrement unary operators:
++ --
no space after the prefix increment & decrement unary operators:
++ --
and no space around the . and -> structure member operators.
Do not leave trailing whitespace at the ends of lines. Some editors with smart indentation will insert whitespace at the beginning of new lines as appropriate, so you can start typing the next line of code right away. However, some such editors do not remove the whitespace if you end up not putting a line of code there, such as if you leave a blank line. As a result, you end up with lines containing trailing whitespace.
Git will warn you about patches that introduce trailing whitespace, and can optionally strip the trailing whitespace for you; however, if applying a series of patches, this may make later patches in the series fail by changing their context lines.
4) Naming #
C is a Spartan language, and your naming conventions should follow suit. Unlike Modula-2 and Pascal programmers, C programmers do not use cute names like ThisVariableIsATemporaryCounter. A C programmer would call that variable tmp, which is much easier to write, and not the least more difficult to understand.
HOWEVER, while mixed-case names are frowned upon, descriptive names for global variables are a must. To call a global function foo is a shooting offense.
GLOBAL variables (to be used only if you really need them) need to have descriptive names, as do global functions. If you have a function that counts the number of active users, you should call that count_active_users() or similar, you should not call it cntusr().
Encoding the type of a function into the name (so-called Hungarian notation) is asinine - the compiler knows the types anyway and can check those, and it only confuses the programmer.
LOCAL variable names should be short, and to the point. If you have some random integer loop counter, it should probably be called i. Calling it loop_counter is non-productive, if there is no chance of it being mis-understood. Similarly, tmp can be just about any type of variable that is used to hold a temporary value.
If you are afraid to mix up your local variable names, you have another problem, which is called the function-growth-hormone-imbalance syndrome. See chapter 6 (Functions).
For symbol names and documentation, avoid introducing new usage of 'master / slave' (or 'slave' independent of 'master') and 'blacklist / whitelist'.
-
Recommended replacements for 'master / slave' are:
'{primary,main} / {secondary,replica,subordinate}' '{initiator,requester} / {target,responder}' '{controller,host} / {device,worker,proxy}' 'leader / follower' 'director / performer'
-
Recommended replacements for 'blacklist/whitelist' are:
'denylist / allowlist' 'blocklist / passlist'
Exceptions for introducing new usage is to maintain a userspace ABI/API, or when updating code for an existing (as of 2020) hardware or protocol specification that mandates those terms. For new specifications translate specification usage of the terminology to the kernel coding standard where possible.
5) Typedefs #
Please don't use things like vps_t. It's a mistake to use typedef for structures and pointers. When you see a
vps_t a;
in the source, what does it mean? In contrast, if it says
struct virtual_container *a;
you can actually tell what a is.
Lots of people think that typedefs help readability. Not so. They are useful only for:
(a) totally opaque objects (where the typedef is actively used to hide what the object is).
Example:
pte_tetc. opaque objects that you can only access using the proper accessor functions.(b) Clear integer types, where the abstraction helps avoid confusion whether it is
intorlong.u8/u16/u32 are perfectly fine typedefs, although they fit into category (d) better than here.
but if there is a clear reason for why it under certain circumstances might be an
unsigned intand under other configurations might beunsigned long, then by all means go ahead and use a typedef.(c) when you use sparse to literally create a new type for type-checking.
(d) New types which are identical to standard C99 types, in certain exceptional circumstances.
Although it would only take a short amount of time for the eyes and brain to become accustomed to the standard types like
uint32_t, some people object to their use anyway.Therefore, the Linux-specific
u8/u16/u32/u64types and their signed equivalents which are identical to standard types are permitted -- although they are not mandatory in new code of your own.When editing existing code which already uses one or the other set of types, you should conform to the existing choices in that code.
(e) Types safe for use in userspace.
In certain structures which are visible to userspace, we cannot require C99 types and cannot use the
u32form above. Thus, we use __u32 and similar types in all structures which are shared with userspace.
Maybe there are other cases too, but the rule should basically be to NEVER EVER use a typedef unless you can clearly match one of those rules.
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
6) Functions #
Functions should be short and sweet, and do just one thing. They should fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24, as we all know), and do one thing and do that well.
The maximum length of a function is inversely proportional to the complexity and indentation level of that function. So, if you have a conceptually simple function that is just one long (but simple) case-statement, where you have to do lots of small things for a lot of different cases, it's OK to have a longer function.
However, if you have a complex function, and you suspect that a less-than-gifted first-year high-school student might not even understand what the function is all about, you should adhere to the maximum limits all the more closely. Use helper functions with descriptive names (you can ask the compiler to in-line them if you think it's performance-critical, and it will probably do a better job of it than you would have done).
Another measure of the function is the number of local variables. They shouldn't exceed 5-10, or you're doing something wrong. Re-think the function, and split it into smaller pieces. A human brain can generally easily keep track of about 7 different things, anything more and it gets confused. You know you're brilliant, but maybe you'd like to understand what you did 2 weeks from now.
In source files, separate functions with one blank line. If the function is exported, the EXPORT macro for it should follow immediately after the closing function brace line. E.g.:
int
;
6.1) Function prototypes #
In function prototypes, include parameter names with their data types. Although this is not required by the C language, it is preferred in Linux because it is a simple way to add valuable information for the reader.
Do not use the extern keyword with function declarations as this makes lines longer and isn't strictly necessary.
When writing function prototypes, please keep the order of elements regular. For example, using this function declaration example:
__init void * __must_check action(enum magic value, size_t size, u8 count,
char *fmt, ...) __printf(4, 5) __malloc;
The preferred order of elements for a function prototype is:
-
storage class (below,
static __always_inline, noting that__always_inlineis technically an attribute but is treated likeinline) -
storage class attributes (here,
__init-- i.e. section declarations, but also things like__cold) -
return type (here,
void *) -
return type attributes (here,
__must_check) -
function name (here,
action) -
function parameters (here,
(enum magic value, size_t size, u8 count, char *fmt, ...), noting that parameter names should always be included) -
function parameter attributes (here,
__printf(4, 5)) -
function behavior attributes (here,
__malloc)
Note that for a function definition (i.e. the actual function body), the compiler does not allow function parameter attributes after the function parameters. In these cases, they should go after the storage class attributes (e.g. note the changed position of __printf(4, 5) below, compared to the declaration example above):
static __always_inline __init __printf(4, 5) void * __must_check action(enum magic value,
size_t size, u8 count, char *fmt, ...) __malloc
{
...
}
7) Centralized exiting of functions #
Albeit deprecated by some people, the equivalent of the goto statement is used frequently by compilers in form of the unconditional jump instruction.
The goto statement comes in handy when a function exits from multiple locations and some common work such as cleanup has to be done. If there is no cleanup needed then just return directly.
Choose label names which say what the goto does or why the goto exists. An example of a good name could be out_free_buffer: if the goto frees buffer. Avoid using GW-BASIC names like err1: and err2:, as you would have to renumber them if you ever add or remove exit paths, and they make correctness difficult to verify anyway.
The rationale for using gotos is:
-
unconditional statements are easier to understand and follow
-
nesting is reduced
-
errors by not updating individual exit points when making modifications are prevented
-
saves the compiler work to optimize redundant code away ;)
int
A common type of bug to be aware of is one err bugs which look like this:
err:
;
;
return ret;
The bug in this code is that on some exit paths foo is NULL. Normally the fix for this is to split it up into two error labels err_free_bar: and err_free_foo::
err_free_bar:
;
err_free_foo:
;
return ret;
Ideally you should simulate errors to test all exit paths.
8) Commenting #
Comments are good, but there is also a danger of over-commenting. NEVER try to explain HOW your code works in a comment: it's much better to write the code so that the working is obvious, and it's a waste of time to explain badly written code.
Generally, you want your comments to tell WHAT your code does, not HOW. Also, try to avoid putting comments inside a function body: if the function is so complex that you need to separately comment parts of it, you should probably go back to chapter 6 for a while. You can make small comments to note or warn about something particularly clever (or ugly), but try to avoid excess. Instead, put the comments at the head of the function, telling people what it does, and possibly WHY it does it.
When commenting the kernel API functions, please use the kernel-doc format. See the files at Documentation/doc-guide/ and tools/docs/kernel-doc for details. Note that the danger of over-commenting applies to kernel-doc comments all the same. Do not add boilerplate kernel-doc which simply reiterates what's obvious from the signature of the function.
The preferred style for long (multi-line) comments is:
/*
* This is the preferred style for multi-line
* comments in the Linux kernel source code.
* Please use it consistently.
*
* Description: A column of asterisks on the left side,
* with beginning and ending almost-blank lines.
*/
It's also important to comment data, whether they are basic types or derived types. To this end, use just one data declaration per line (no commas for multiple data declarations). This leaves you room for a small comment on each item, explaining its use.
9) You've made a mess of it #
That's OK, we all do. You've probably been told by your long-time Unix user helper that GNU emacs automatically formats the C sources for you, and you've noticed that yes, it does do that, but the defaults it uses are less than desirable (in fact, they are worse than random typing - an infinite number of monkeys typing into GNU emacs would never make a good program).
So, you can either get rid of GNU emacs, or change it to use saner values. To do the latter, you can stick the following in your .emacs file:
(defun c-lineup-arglist-tabs-only (ignored)
"Line up argument lists by tabs, not spaces"
(let* ((anchor (c-langelem-pos c-syntactic-element))
(column (c-langelem-2nd-pos c-syntactic-element))
(offset (- (1+ column) anchor))
(steps (floor offset c-basic-offset)))
(* (max steps 1)
c-basic-offset)))
(dir-locals-set-class-variables
'linux-kernel
'((c-mode . (
(c-basic-offset . 8)
(c-label-minimum-indentation . 0)
(c-offsets-alist . (
(arglist-close . c-lineup-arglist-tabs-only)
(arglist-cont-nonempty .
(c-lineup-gcc-asm-reg c-lineup-arglist-tabs-only))
(arglist-intro . +)
(brace-list-intro . +)
(c . c-lineup-C-comments)
(case-label . 0)
(comment-intro . c-lineup-comment)
(cpp-define-intro . +)
(cpp-macro . -1000)
(cpp-macro-cont . +)
(defun-block-intro . +)
(else-clause . 0)
(func-decl-cont . +)
(inclass . +)
(inher-cont . c-lineup-multi-inher)
(knr-argdecl-intro . 0)
(label . -1000)
(statement . 0)
(statement-block-intro . +)
(statement-case-intro . +)
(statement-cont . +)
(substatement . +)
))
(indent-tabs-mode . t)
(show-trailing-whitespace . t)
))))
(dir-locals-set-directory-class
(expand-file-name "~/src/linux-trees")
'linux-kernel)
This will make emacs go better with the kernel coding style for C files below ~/src/linux-trees.
But even if you fail in getting emacs to do sane formatting, not everything is lost: use indent.
Now, again, GNU indent has the same brain-dead settings that GNU emacs has, which is why you need to give it a few command line options. However, that's not too bad, because even the makers of GNU indent recognize the authority of K&R (the GNU people aren't evil, they are just severely misguided in this matter), so you just give indent the options -kr -i8 (stands for K&R, 8 character indents), or use scripts/Lindent, which indents in the latest style.
indent has a lot of options, and especially when it comes to comment re-formatting you may want to take a look at the man page. But remember: indent is not a fix for bad programming.
Note that you can also use the clang-format tool to help you with these rules, to quickly re-format parts of your code automatically, and to review full files in order to spot coding style mistakes, typos and possible improvements. It is also handy for sorting #includes, for aligning variables/macros, for reflowing text and other similar tasks. See the file Documentation/dev-tools/clang-format.rst for more details.
Some basic editor settings, such as indentation and line endings, will be set automatically if you are using an editor that is compatible with EditorConfig. See the official EditorConfig website for more information: https://editorconfig.org/
10) Kconfig configuration files #
For all of the Kconfig* configuration files throughout the source tree, the indentation is somewhat different. Lines under a config definition are indented with one tab, while help text is indented an additional two spaces. Example:
config AUDIT
bool "Auditing support"
depends on NET
help
Enable auditing infrastructure that can be used with another
kernel subsystem, such as SELinux (which requires this for
logging of avc messages output). Does not do system-call
auditing without CONFIG_AUDITSYSCALL.
Seriously dangerous features (such as write support for certain filesystems) should advertise this prominently in their prompt string:
config ADFS_FS_RW
bool "ADFS write support (DANGEROUS)"
depends on ADFS_FS
...
For full documentation on the configuration files, see the file Documentation/kbuild/kconfig-language.rst.
11) Data structures #
Data structures that have visibility outside the single-threaded environment they are created and destroyed in should always have reference counts. In the kernel, garbage collection doesn't exist (and outside the kernel garbage collection is slow and inefficient), which means that you absolutely have to reference count all your uses.
Reference counting means that you can avoid locking, and allows multiple users to have access to the data structure in parallel - and not having to worry about the structure suddenly going away from under them just because they slept or did something else for a while.
Note that locking is not a replacement for reference counting. Locking is used to keep data structures coherent, while reference counting is a memory management technique. Usually both are needed, and they are not to be confused with each other.
Many data structures can indeed have two levels of reference counting, when there are users of different classes. The subclass count counts the number of subclass users, and decrements the global count just once when the subclass count goes to zero.
Examples of this kind of multi-level-reference-counting can be found in memory management (struct mm_struct: mm_users and mm_count), and in filesystem code (struct super_block: s_count and s_active).
Remember: if another thread can find your data structure, and you don't have a reference count on it, you almost certainly have a bug.
12) Macros, Enums and RTL #
Names of macros defining constants and labels in enums are capitalized.
Enums are preferred when defining several related constants.
CAPITALIZED macro names are appreciated but macros resembling functions may be named in lower case.
Generally, inline functions are preferable to macros resembling functions.
Macros with multiple statements should be enclosed in a do - while block:
Function-like macros with unused parameters should be replaced by static inline functions to avoid the issue of unused variables:
static inline void
Due to historical practices, many files still employ the "cast to (void)" approach to evaluate parameters. However, this method is not advisable. Inline functions address the issue of "expression with side effects evaluated more than once", circumvent unused-variable problems, and are generally better documented than macros for some reason.
/*
* Avoid doing this whenever possible and instead opt for static
* inline functions
*/
Things to avoid when using macros:
- macros that affect control flow:
is a very bad idea. It looks like a function call but exits the calling function; don't break the internal parsers of those who will read the code.
- macros that depend on having a local variable with a magic name:
might look like a good thing, but it's confusing as hell when one reads the code and it's prone to breakage from seemingly innocent changes.
3) macros with arguments that are used as l-values: FOO(x) = y; will bite you if somebody e.g. turns FOO into an inline function.
4) forgetting about precedence: macros defining constants using expressions must enclose the expression in parentheses. Beware of similar issues with macros using parameters.
5) namespace collisions when defining local variables in macros resembling functions:
ret is a common name for a local variable - __foo_ret is less likely to collide with an existing variable.
The cpp manual deals with macros exhaustively. The gcc internals manual also covers RTL which is used frequently with assembly language in the kernel.
13) Printing kernel messages #
Kernel developers like to be seen as literate. Do mind the spelling of kernel messages to make a good impression. Do not use incorrect contractions like dont; use do not or don't instead. Make the messages concise, clear, and unambiguous.
Kernel messages do not have to be terminated with a period.
Printing numbers in parentheses (%d) adds no value and should be avoided.
There are a number of driver model diagnostic macros in <linux/dev_printk.h> which you should use to make sure messages are matched to the right device and driver, and are tagged with the right level: dev_err(), dev_warn(), dev_info(), and so forth. For messages that aren't associated with a particular device, <linux/printk.h> defines pr_notice(), pr_info(), pr_warn(), pr_err(), etc. When drivers are working properly they are quiet, so prefer to use dev_dbg/pr_debug unless something is wrong.
Coming up with good debugging messages can be quite a challenge; and once you have them, they can be a huge help for remote troubleshooting. However debug message printing is handled differently than printing other non-debug messages. While the other pr_XXX() functions print unconditionally, pr_debug() does not; it is compiled out by default, unless either DEBUG is defined or CONFIG_DYNAMIC_DEBUG is set. That is true for dev_dbg() also, and a related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the ones already enabled by DEBUG.
Many subsystems have Kconfig debug options to turn on -DDEBUG in the corresponding Makefile; in other cases specific files #define DEBUG. And when a debug message should be unconditionally printed, such as if it is already inside a debug-related #ifdef section, printk(KERN_DEBUG ...) can be used.
14) Allocating memory #
The kernel provides the following general purpose memory allocators: kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and vzalloc(). Please refer to the API documentation for further information about them. Documentation/core-api/memory-allocation.rst
The preferred form for passing a size of a struct is the following:
p = ;
The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not.
Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.
The preferred form for allocating an array is the following:
p = ;
The preferred form for allocating a zeroed array is the following:
p = ;
Both forms check for overflow on the allocation size n * sizeof(...), and return NULL if that occurred.
These generic allocation functions all emit a stack dump on failure when used without __GFP_NOWARN so there is no use in emitting an additional failure message when NULL is returned.
15) The inline disease #
There appears to be a common misperception that gcc has a magic "make me faster" speedup option called inline. While the use of inlines can be appropriate (for example as a means of replacing macros, see Chapter 12), it very often is not. Abundant use of the inline keyword leads to a much bigger kernel, which in turn slows the system as a whole down, due to a bigger icache footprint for the CPU and simply because there is less memory available for the pagecache. Just think about it; a pagecache miss causes a disk seek, which easily takes 5 milliseconds. There are a LOT of cpu cycles that can go into these 5 milliseconds.
A reasonable rule of thumb is to not put inline at functions that have more than 3 lines of code in them. An exception to this rule are the cases where a parameter is known to be a compile time constant, and as a result of this constantness you know the compiler will be able to optimize most of your function away at compile time. For a good example of this later case, see the kmalloc() inline function.
Often people argue that adding inline to functions that are static and used only once is always a win since there is no space tradeoff. While this is technically correct, gcc is capable of inlining these automatically without help, and the maintenance issue of removing the inline when a second user appears outweighs the potential value of the hint that tells gcc to do something it would have done anyway.
16) Function return values and names #
Functions can return values of many different kinds, and one of the most common is a value indicating whether the function succeeded or failed. Such a value can be represented as an error-code integer (-Exxx = failure, 0 = success) or a succeeded boolean (0 = failure, non-zero = success).
Mixing up these two sorts of representations is a fertile source of difficult-to-find bugs. If the C language included a strong distinction between integers and booleans then the compiler would find these mistakes for us... but it doesn't. To help prevent such bugs, always follow this convention:
If the name of a function is an action or an imperative command,
the function should return an error-code integer. If the name
is a predicate, the function should return a "succeeded" boolean.
For example, add work is a command, and the add_work() function returns 0 for success or -EBUSY for failure. In the same way, PCI device present is a predicate, and the pci_dev_present() function returns 1 if it succeeds in finding a matching device or 0 if it doesn't.
All EXPORTed functions must respect this convention, and so should all public functions. Private (static) functions need not, but it is recommended that they do.
Functions whose return value is the actual result of a computation, rather than an indication of whether the computation succeeded, are not subject to this rule. Generally they indicate failure by returning some out-of-range result. Typical examples would be functions that return pointers; they use NULL or the ERR_PTR mechanism to report failure.
17) Using bool #
The Linux kernel bool type is an alias for the C99 _Bool type. bool values can only evaluate to 0 or 1, and implicit or explicit conversion to bool automatically converts the value to true or false. When using bool types the !! construction is not needed, which eliminates a class of bugs.
When working with bool values the true and false definitions should be used instead of 1 and 0.
bool function return types and stack variables are always fine to use whenever appropriate. Use of bool is encouraged to improve readability and is often a better option than 'int' for storing boolean values.
Do not use bool if cache line layout or size of the value matters, as its size and alignment varies based on the compiled architecture. Structures that are optimized for alignment and size should not use bool.
If a structure has many true/false values, consider consolidating them into a bitfield with 1 bit members, or using an appropriate fixed width type, such as u8.
Similarly for function arguments, many true/false values can be consolidated into a single bitwise 'flags' argument and 'flags' can often be a more readable alternative if the call-sites have naked true/false constants.
Otherwise limited use of bool in structures and arguments can improve readability.
18) Don't re-invent the kernel macros #
There are many header files in include/linux/ that contain a number of macros that you should use, rather than explicitly coding some variant of them yourself. For example, if you need to calculate the length of an array, take advantage of the macro
which is defined in array_size.h.
Similarly, if you need to calculate the size of some structure member, use
which is defined in stddef.h.
There are also min() and max() macros defined in minmax.h that do strict type checking if you need them. Feel free to peruse the header files to see what else is already defined that you shouldn't reproduce in your code.
19) Editor modelines and other cruft #
Some editors can interpret configuration information embedded in source files, indicated with special markers. For example, emacs interprets lines marked like this:
-*- mode: c -*-
Or like this:
/*
Local Variables:
compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c"
End:
*/
Vim interprets markers that look like this:
/* vim:set sw=8 noet */
Do not include any of these in source files. People have their own personal editor configurations, and your source files should not override them. This includes markers for indentation and mode configuration. People may use their own custom mode, or may have some other magic method for making indentation work correctly.
20) Inline assembly #
In architecture-specific code, you may need to use inline assembly to interface with CPU or platform functionality. Don't hesitate to do so when necessary. However, don't use inline assembly gratuitously when C can do the job. You can and should poke hardware from C when possible.
Consider writing simple helper functions that wrap common bits of inline assembly, rather than repeatedly writing them with slight variations. Remember that inline assembly can use C parameters.
Large, non-trivial assembly functions should go in .S files, with corresponding C prototypes defined in C header files. The C prototypes for assembly functions should use asmlinkage.
You may need to mark your asm statement as volatile, to prevent GCC from removing it if GCC doesn't notice any side effects. You don't always need to do so, though, and doing so unnecessarily can limit optimization.
When writing a single inline assembly statement containing multiple instructions, put each instruction on a separate line in a separate quoted string, and end each string except the last with \n\t to properly indent the next instruction in the assembly output:
;
21) Conditional Compilation #
Wherever possible, don't use preprocessor conditionals (#if, #ifdef) in .c files; doing so makes code harder to read and logic harder to follow. Instead, use such conditionals in a header file defining functions for use in those .c files, providing no-op stub versions in the #else case, and then call those functions unconditionally from .c files. The compiler will avoid generating any code for the stub calls, producing identical results, but the logic will remain easy to follow.
Prefer to compile out entire functions, rather than portions of functions or portions of expressions. Rather than putting an ifdef in an expression, factor out part or all of the expression into a separate helper function and apply the conditional to that function.
If you have a function or variable which may potentially go unused in a particular configuration, and the compiler would warn about its definition going unused, mark the definition as __maybe_unused rather than wrapping it in a preprocessor conditional. (However, if a function or variable always goes unused, delete it.)
Within code, where possible, use the IS_ENABLED macro to convert a Kconfig symbol into a C boolean expression, and use it in a normal C conditional:
if
The compiler will constant-fold the conditional away, and include or exclude the block of code just as with an #ifdef, so this will not add any runtime overhead. However, this approach still allows the C compiler to see the code inside the block, and check it for correctness (syntax, types, symbol references, etc). Thus, you still have to use an #ifdef if the code inside the block references symbols that will not exist if the condition is not met.
At the end of any non-trivial #if or #ifdef block (more than a few lines), place a comment after the #endif on the same line, noting the conditional expression used. For instance:
...
/* CONFIG_SOMETHING */
22) Do not crash the kernel #
In general, the decision to crash the kernel belongs to the user, rather than to the kernel developer.
Avoid panic() #
panic() should be used with care and primarily only during system boot. panic() is, for example, acceptable when running out of memory during boot and not being able to continue.
Use WARN() rather than BUG() #
Do not add new code that uses any of the BUG() variants, such as BUG(), BUG_ON(), or VM_BUG_ON(). Instead, use a WARN*() variant, preferably WARN_ON_ONCE(), and possibly with recovery code. Recovery code is not required if there is no reasonable way to at least partially recover.
"I'm too lazy to do error handling" is not an excuse for using BUG(). Major internal corruptions with no way of continuing may still use BUG(), but need good justification.
Use WARN_ON_ONCE() rather than WARN() or WARN_ON() #
WARN_ON_ONCE() is generally preferred over WARN() or WARN_ON(), because it is common for a given warning condition, if it occurs at all, to occur multiple times. This can fill up and wrap the kernel log, and can even slow the system enough that the excessive logging turns into its own, additional problem.
Do not WARN lightly #
WARN*() is intended for unexpected, this-should-never-happen situations. WARN*() macros are not to be used for anything that is expected to happen during normal operation. These are not pre- or post-condition asserts, for example. Again: WARN*() must not be used for a condition that is expected to trigger easily, for example, by user space actions. pr_warn_once() is a possible alternative, if you need to notify the user of a problem.
Do not worry about panic_on_warn users #
A few more words about panic_on_warn: Remember that panic_on_warn is an available kernel option, and that many users set this option. This is why there is a "Do not WARN lightly" writeup, above. However, the existence of panic_on_warn users is not a valid reason to avoid the judicious use WARN*(). That is because, whoever enables panic_on_warn has explicitly asked the kernel to crash if a WARN*() fires, and such users must be prepared to deal with the consequences of a system that is somewhat more likely to crash.
Use BUILD_BUG_ON() for compile-time assertions #
The use of BUILD_BUG_ON() is acceptable and encouraged, because it is a compile-time assertion that has no effect at runtime.
Appendix I) References #
The C Programming Language, Second Edition by Brian W. Kernighan and Dennis M. Ritchie. Prentice Hall, Inc., 1988. ISBN 0-13-110362-8 (paperback), 0-13-110370-9 (hardback).
The Practice of Programming by Brian W. Kernighan and Rob Pike. Addison-Wesley, Inc., 1999. ISBN 0-201-61586-X.
GNU manuals - where in compliance with K&R and this text - for cpp, gcc, gcc internals and indent, all available from https://www.gnu.org/manual/
WG14 is the international standardization working group for the programming language C, URL: http://www.open-std.org/JTC1/SC22/WG14/
Kernel CodingStyle, by greg@kroah.com at OLS 2002: http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/
Linux kernel project continuity
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The Linux kernel development project is widely distributed, with over 100 maintainers each working to keep changes moving through their own repositories. The final step, though, is a centralized one where changes are pulled into the mainline repository. That is normally done by Linus Torvalds but, as was demonstrated by the 4.19 release in 2018, there are others who can do that work when the need arises.
Should the maintainers of that repository become unwilling or unable to do that work going forward (including facilitating a transition), the project will need to find one or more replacements without delay. The process by which that will be done is listed below. $ORGANIZER is the last Maintainer Summit organizer or the current Linux Foundation (LF) Technical Advisory Board (TAB) Chair as a backup.
-
Within 72 hours, $ORGANIZER will open a discussion with the invitees of the most recently concluded Maintainers Summit. A meeting of those invitees and the TAB, either online or in-person, will be set as soon as possible in a way that maximizes the number of people who can participate.
-
If there has been no Maintainers Summit in the last 15 months, the set of invitees for this meeting will be determined by the TAB.
-
The invitees to this meeting may bring in other maintainers as needed.
-
This meeting, chaired by $ORGANIZER, will consider options for the ongoing management of the top-level kernel repository consistent with the expectation that it maximizes the long term health of the project and its community.
-
Within two weeks, a representative of this group will communicate to the broader community, using the ksummit@lists.linux.dev mailing list, what the next steps will be.
The Linux Foundation, as guided by the TAB, will take the steps necessary to support and implement this plan.
Linux Kernel Contribution Maturity Model
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Background #
As a part of the 2021 Linux Kernel Maintainers’ Summit, there was a discussion about the challenges in recruiting kernel maintainers as well as maintainer succession. Some of the conclusions from that discussion included that companies which are a part of the Linux Kernel community need to allow engineers to be maintainers as part of their job, so they can grow into becoming respected leaders and eventually, kernel maintainers. To support a strong talent pipeline, developers should be allowed and encouraged to take on upstream contributions such as reviewing other people’s patches, refactoring kernel infrastructure, and writing documentation.
To that end, the Linux Foundation Technical Advisory Board (TAB) proposes this Linux Kernel Contribution Maturity Model. These common expectations for upstream community engagement aim to increase the influence of individual developers, increase the collaboration of organizations, and improve the overall health of the Linux Kernel ecosystem.
The TAB urges organizations to continuously evaluate their Open Source maturity model and commit to improvements to align with this model. To be effective, this evaluation should incorporate feedback from across the organization, including management and developers at all seniority levels. In the spirit of Open Source, we encourage organizations to publish their evaluations and plans to improve their engagement with the upstream community.
Level 0 #
- Software Engineers are not allowed to contribute patches to the Linux kernel.
Level 1 #
- Software Engineers are allowed to contribute patches to the Linux kernel, either as part of their job responsibilities or on their own time.
Level 2 #
-
Software Engineers are expected to contribute to the Linux Kernel as part of their job responsibilities.
-
Software Engineers will be supported to attend Linux-related conferences as a part of their job.
-
A Software Engineer’s upstream code contributions will be considered in promotion and performance reviews.
Level 3 #
-
Software Engineers are expected to review patches (including patches authored by engineers from other companies) as part of their job responsibilities
-
Contributing presentations or papers to Linux-related or academic conferences (such those organized by the Linux Foundation, Usenix, ACM, etc.), are considered part of an engineer’s work.
-
A Software Engineer’s community contributions will be considered in promotion and performance reviews.
-
Organizations will regularly report metrics of their open source contributions and track these metrics over time. These metrics may be published only internally within the organization, or at the organization’s discretion, some or all may be published externally. Metrics that are strongly suggested include:
-
The number of upstream kernel contributions by team or organization (e.g., all people reporting up to a manager, director, or VP).
-
The percentage of kernel developers who have made upstream contributions relative to the total kernel developers in the organization.
-
The time interval between kernels used in the organization’s servers and/or products, and the publication date of the upstream kernel upon which the internal kernel is based.
-
The number of out-of-tree commits present in internal kernels.
-
Level 4 #
-
Software Engineers are encouraged to spend a portion of their work time focused on Upstream Work, which is defined as reviewing patches, serving on program committees, improving core project infrastructure such as writing or maintaining tests, upstream tech debt reduction, writing documentation, etc.
-
Software Engineers are supported in helping to organize Linux-related conferences.
-
Organizations will consider community member feedback in official performance reviews.
Level 5 #
-
Upstream kernel development is considered a formal job position, with at least a third of the engineer’s time spent doing Upstream Work.
-
Organizations will actively seek out community member feedback as a factor in official performance reviews.
-
Organizations will regularly report internally on the ratio of Upstream Work to work focused on directly pursuing business goals.
CVEs
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Common Vulnerabilities and Exposure (CVE®) numbers were developed as an unambiguous way to identify, define, and catalog publicly disclosed security vulnerabilities. Over time, their usefulness has declined with regards to the kernel project, and CVE numbers were very often assigned in inappropriate ways and for inappropriate reasons. Because of this, the kernel development community has tended to avoid them. However, the combination of continuing pressure to assign CVEs and other forms of security identifiers, and ongoing abuses by individuals and companies outside of the kernel community has made it clear that the kernel community should have control over those assignments.
The Linux kernel developer team does have the ability to assign CVEs for potential Linux kernel security issues. This assignment is independent of the normal Linux kernel security bug reporting process.
A list of all assigned CVEs for the Linux kernel can be found in the archives of the linux-cve mailing list, as seen on https://lore.kernel.org/linux-cve-announce/. To get notice of the assigned CVEs, please subscribe to that mailing list.
Process #
As part of the normal stable release process, kernel changes that are potentially security issues are identified by the developers responsible for CVE number assignments and have CVE numbers automatically assigned to them. These assignments are published on the linux-cve-announce mailing list as announcements on a frequent basis.
Note, due to the layer at which the Linux kernel is in a system, almost any bug might be exploitable to compromise the security of the kernel, but the possibility of exploitation is often not evident when the bug is fixed. Because of this, the CVE assignment team is overly cautious and assign CVE numbers to any bugfix that they identify. This explains the seemingly large number of CVEs that are issued by the Linux kernel team.
If the CVE assignment team misses a specific fix that any user feels should have a CVE assigned to it, please email them at <cve@kernel.org> and the team there will work with you on it. Note that no potential security issues should be sent to this alias, it is ONLY for assignment of CVEs for fixes that are already in released kernel trees. If you feel you have found an unfixed security issue, please follow the normal Linux kernel security bug reporting process.
No CVEs will be automatically assigned for unfixed security issues in the Linux kernel; assignment will only automatically happen after a fix is available and applied to a stable kernel tree, and it will be tracked that way by the git commit id of the original fix. If anyone wishes to have a CVE assigned before an issue is resolved with a commit, please contact the kernel CVE assignment team at <cve@kernel.org> to get an identifier assigned from their batch of reserved identifiers.
No CVEs will be assigned for any issue found in a version of the kernel that is not currently being actively supported by the Stable/LTS kernel team. A list of the currently supported kernel branches can be found at https://kernel.org/releases.html
Disputes of assigned CVEs #
The authority to dispute or modify an assigned CVE for a specific kernel change lies solely with the maintainers of the relevant subsystem affected. This principle ensures a high degree of accuracy and accountability in vulnerability reporting. Only those individuals with deep expertise and intimate knowledge of the subsystem can effectively assess the validity and scope of a reported vulnerability and determine its appropriate CVE designation. Any attempt to modify or dispute a CVE outside of this designated authority could lead to confusion, inaccurate reporting, and ultimately, compromised systems.
Invalid CVEs #
If a security issue is found in a Linux kernel that is only supported by a Linux distribution due to the changes that have been made by that distribution, or due to the distribution supporting a kernel version that is no longer one of the kernel.org supported releases, then a CVE can not be assigned by the Linux kernel CVE team, and must be asked for from that Linux distribution itself.
Any CVE that is assigned against the Linux kernel for an actively supported kernel version, by any group other than the kernel assignment CVE team should not be treated as a valid CVE. Please notify the kernel CVE assignment team at <cve@kernel.org> so that they can work to invalidate such entries through the CNA remediation process.
Applicability of specific CVEs #
As the Linux kernel can be used in many different ways, with many different ways of accessing it by external users, or no access at all, the applicability of any specific CVE is up to the user of Linux to determine, it is not up to the CVE assignment team. Please do not contact us to attempt to determine the applicability of any specific CVE.
Also, as the source tree is so large, and any one system only uses a small subset of the source tree, any users of Linux should be aware that large numbers of assigned CVEs are not relevant for their systems.
In short, we do not know your use case, and we do not know what portions of the kernel that you use, so there is no way for us to determine if a specific CVE is relevant for your system.
As always, it is best to take all released kernel changes, as they are tested together in a unified whole by many community members, and not as individual cherry-picked changes. Also note that for many bugs, the solution to the overall problem is not found in a single change, but by the sum of many fixes on top of each other. Ideally CVEs will be assigned to all fixes for all issues, but sometimes we will fail to notice fixes, therefore assume that some changes without a CVE assigned might be relevant to take.
Deprecated Interfaces, Language Features, Attributes, and Conventions
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
In a perfect world, it would be possible to convert all instances of some deprecated API into the new API and entirely remove the old API in a single development cycle. However, due to the size of the kernel, the maintainership hierarchy, and timing, it's not always feasible to do these kinds of conversions at once. This means that new instances may sneak into the kernel while old ones are being removed, only making the amount of work to remove the API grow. In order to educate developers about what has been deprecated and why, this list has been created as a place to point when uses of deprecated things are proposed for inclusion in the kernel.
__deprecated #
While this attribute does visually mark an interface as deprecated, it does not produce warnings during builds any more because one of the standing goals of the kernel is to build without warnings and no one was actually doing anything to remove these deprecated interfaces. While using __deprecated is nice to note an old API in a header file, it isn't the full solution. Such interfaces must either be fully removed from the kernel, or added to this file to discourage others from using them in the future.
BUG() and BUG_ON() #
Use WARN() and WARN_ON() instead, and handle the "impossible" error condition as gracefully as possible. While the BUG()-family of APIs were originally designed to act as an "impossible situation" assert and to kill a kernel thread "safely", they turn out to just be too risky. (e.g. "In what order do locks need to be released? Have various states been restored?") Very commonly, using BUG() will destabilize a system or entirely break it, which makes it impossible to debug or even get viable crash reports. Linus has very strong feelings about this.
Note that the WARN()-family should only be used for "expected to be unreachable" situations. If you want to warn about "reachable but undesirable" situations, please use the pr_warn()-family of functions. System owners may have set the panic_on_warn sysctl, to make sure their systems do not continue running in the face of "unreachable" conditions. (For example, see commits like this one.)
open-coded arithmetic in allocator arguments #
Dynamic size calculations (especially multiplication) should not be performed in memory allocator (or similar) function arguments due to the risk of them overflowing. This could lead to values wrapping around and a smaller allocation being made than the caller was expecting. Using those allocations could lead to linear overflows of heap memory and other misbehaviors. (One exception to this is literal values where the compiler can warn if they might overflow. However, the preferred way in these cases is to refactor the code as suggested below to avoid the open-coded arithmetic.)
For example, do not use count * size as an argument, as in:
foo = kmalloc(count * size, GFP_KERNEL);
Instead, the 2-factor form of the allocator should be used:
foo = kmalloc_array(count, size, GFP_KERNEL);
Specifically, kmalloc() can be replaced with kmalloc_array(), and kzalloc() can be replaced with kcalloc().
If no 2-factor form is available, the saturate-on-overflow helpers should be used:
bar = dma_alloc_coherent(dev, array_size(count, size), &dma, GFP_KERNEL);
Another common case to avoid is calculating the size of a structure with a trailing array of others structures, as in:
header = kzalloc(sizeof(*header) + count * sizeof(*header->item),
GFP_KERNEL);
Instead, use the helper:
header = kzalloc(struct_size(header, item, count), GFP_KERNEL);
For other calculations, please compose the use of the size_mul(), size_add(), and size_sub() helpers. For example, in the case of:
foo = krealloc(current_size + chunk_size * (count - 3), GFP_KERNEL);
Instead, use the helpers:
foo = krealloc(size_add(current_size,
size_mul(chunk_size,
size_sub(count, 3))), GFP_KERNEL);
For more details, also see array3_size() and flex_array_size(), as well as the related check_mul_overflow(), check_add_overflow(), check_sub_overflow(), and check_shl_overflow() family of functions.
simple_strtol(), simple_strtoll(), simple_strtoul(), simple_strtoull() #
The simple_strtol(), simple_strtoll(), simple_strtoul(), and simple_strtoull() functions explicitly ignore overflows, which may lead to unexpected results in callers. The respective kstrtol(), kstrtoll(), kstrtoul(), and kstrtoull() functions tend to be the correct replacements, though note that those require the string to be NUL or newline terminated.
strcpy() #
strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. While CONFIG_FORTIFY_SOURCE=y and various compiler flags help reduce the risk of using this function, there is no good reason to add new uses of this function. The safe replacement is strscpy(), though care must be given to any cases where the return value of strcpy() was used, since strscpy() does not return a pointer to the destination, but rather a count of non-NUL bytes copied (or negative errno when it truncates).
strncpy() on NUL-terminated strings #
Use of strncpy() does not guarantee that the destination buffer will be NUL terminated. This can lead to various linear read overflows and other misbehavior due to the missing termination. It also NUL-pads the destination buffer if the source contents are shorter than the destination buffer size, which may be a needless performance penalty for callers using only NUL-terminated strings.
When the destination is required to be NUL-terminated, the replacement is strscpy(), though care must be given to any cases where the return value of strncpy() was used, since strscpy() does not return a pointer to the destination, but rather a count of non-NUL bytes copied (or negative errno when it truncates). Any cases still needing NUL-padding should instead use strscpy_pad().
If a caller is using non-NUL-terminated strings, strtomem() should be used, and the destinations should be marked with the __nonstring attribute to avoid future compiler warnings. For cases still needing NUL-padding, strtomem_pad() can be used.
strlcpy() #
strlcpy() reads the entire source buffer first (since the return value is meant to match that of strlen()). This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated. The safe replacement is strscpy(), though care must be given to any cases where the return value of strlcpy() is used, since strscpy() will return negative errno values when it truncates.
%p format specifier #
Traditionally, using "%p" in format strings would lead to regular address exposure flaws in dmesg, proc, sysfs, etc. Instead of leaving these to be exploitable, all "%p" uses in the kernel are being printed as a hashed value, rendering them unusable for addressing. New uses of "%p" should not be added to the kernel. For text addresses, using "%pS" is likely better, as it produces the more useful symbol name instead. For nearly everything else, just do not add "%p" at all.
Paraphrasing Linus's current guidance:
-
If the hashed "%p" value is pointless, ask yourself whether the pointer itself is important. Maybe it should be removed entirely?
-
If you really think the true pointer value is important, why is some system state or user privilege level considered "special"? If you think you can justify it (in comments and commit log) well enough to stand up to Linus's scrutiny, maybe you can use "%px", along with making sure you have sensible permissions.
If you are debugging something where "%p" hashing is causing problems, you can temporarily boot with the debug flag "no_hash_pointers".
Variable Length Arrays (VLAs) #
Using stack VLAs produces much worse machine code than statically sized stack arrays. While these non-trivial performance issues are reason enough to eliminate VLAs, they are also a security risk. Dynamic growth of a stack array may exceed the remaining memory in the stack segment. This could lead to a crash, possible overwriting sensitive contents at the end of the stack (when built without CONFIG_THREAD_INFO_IN_TASK=y), or overwriting memory adjacent to the stack (when built without CONFIG_VMAP_STACK=y)
Implicit switch case fall-through #
The C language allows switch cases to fall through to the next case when a "break" statement is missing at the end of a case. This, however, introduces ambiguity in the code, as it's not always clear if the missing break is intentional or a bug. For example, it's not obvious just from looking at the code if STATE_ONE is intentionally designed to fall through into STATE_TWO:
switch (value) {
case STATE_ONE:
do_something();
case STATE_TWO:
do_other();
break;
default:
WARN("unknown state");
}
As there have been a long list of flaws due to missing "break" statements, we no longer allow implicit fall-through. In order to identify intentional fall-through cases, we have adopted a pseudo-keyword macro "fallthrough" which expands to gcc's extension __attribute__((__fallthrough__)). (When the C17/C18 [[fallthrough]] syntax is more commonly supported by C compilers, static analyzers, and IDEs, we can switch to using that syntax for the macro pseudo-keyword.)
All switch/case blocks must end in one of:
-
break;
-
fallthrough;
-
continue;
-
goto <label>;
-
return [expression];
Zero-length and one-element arrays #
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use "flexible array members" for these cases. The older style of one-element or zero-length arrays should no longer be used.
In older C code, dynamically sized trailing elements were done by specifying a one-element array at the end of a structure:
struct something {
size_t count;
struct foo items[1];
};
This led to fragile size calculations via sizeof() (which would need to remove the size of the single trailing element to get a correct size of the "header"). A GNU C extension was introduced to allow for zero-length arrays, to avoid these kinds of size problems:
struct something {
size_t count;
struct foo items[0];
};
But this led to other problems, and didn't solve some problems shared by both styles, like not being able to detect when such an array is accidentally being used _not_ at the end of a structure (which could happen directly, or when such a struct was in unions, structs of structs, etc).
C99 introduced "flexible array members", which lacks a numeric size for the array declaration entirely:
struct something {
size_t count;
struct foo items[];
};
This is the way the kernel expects dynamically sized trailing elements to be declared. It allows the compiler to generate errors when the flexible array does not occur last in the structure, which helps to prevent some kind of undefined behavior bugs from being inadvertently introduced to the codebase. It also allows the compiler to correctly analyze array sizes (via sizeof(), CONFIG_FORTIFY_SOURCE, and CONFIG_UBSAN_BOUNDS). For instance, there is no mechanism that warns us that the following application of the sizeof() operator to a zero-length array always results in zero:
struct something {
size_t count;
struct foo items[0];
};
struct something *instance;
instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL);
instance->count = count;
size = sizeof(instance->items) * instance->count;
memcpy(instance->items, source, size);
At the last line of code above, size turns out to be zero, when one might have thought it represents the total size in bytes of the dynamic memory recently allocated for the trailing array items. Here are a couple examples of this issue: link 1, link 2. Instead, flexible array members have incomplete type, and so the sizeof() operator may not be applied, so any misuse of such operators will be immediately noticed at build time.
With respect to one-element arrays, one has to be acutely aware that such arrays occupy at least as much space as a single object of the type, hence they contribute to the size of the enclosing structure. This is prone to error every time people want to calculate the total size of dynamic memory to allocate for a structure containing an array of this kind as a member:
struct something {
size_t count;
struct foo items[1];
};
struct something *instance;
instance = kmalloc(struct_size(instance, items, count - 1), GFP_KERNEL);
instance->count = count;
size = sizeof(instance->items) * instance->count;
memcpy(instance->items, source, size);
In the example above, we had to remember to calculate count - 1 when using the struct_size() helper, otherwise we would have --unintentionally-- allocated memory for one too many items objects. The cleanest and least error-prone way to implement this is through the use of a flexible array member, together with struct_size() and flex_array_size() helpers:
struct something {
size_t count;
struct foo items[];
};
struct something *instance;
instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL);
instance->count = count;
memcpy(instance->items, source, flex_array_size(instance, items, instance->count));
There are two special cases of replacement where the DECLARE_FLEX_ARRAY() helper needs to be used. (Note that it is named __DECLARE_FLEX_ARRAY() for use in UAPI headers.) Those cases are when the flexible array is either alone in a struct or is part of a union. These are disallowed by the C99 specification, but for no technical reason (as can be seen by both the existing use of such arrays in those places and the work-around that DECLARE_FLEX_ARRAY() uses). For example, to convert this:
struct something {
...
union {
struct type1 one[0];
struct type2 two[0];
};
};
The helper must be used:
struct something {
...
union {
DECLARE_FLEX_ARRAY(struct type1, one);
DECLARE_FLEX_ARRAY(struct type2, two);
};
};
Open-coded kmalloc assignments for struct objects #
Performing open-coded kmalloc()-family allocation assignments prevents the kernel (and compiler) from being able to examine the type of the variable being assigned, which limits any related introspection that may help with alignment, wrap-around, or additional hardening. The kmalloc_obj()-family of macros provide this introspection, which can be used for the common code patterns for single, array, and flexible object allocations. For example, these open coded assignments:
ptr = kmalloc(sizeof(*ptr), gfp);
ptr = kzalloc(sizeof(*ptr), gfp);
ptr = kmalloc_array(count, sizeof(*ptr), gfp);
ptr = kcalloc(count, sizeof(*ptr), gfp);
ptr = kmalloc(struct_size(ptr, flex_member, count), gfp);
ptr = kmalloc(sizeof(struct foo, gfp);
become, respectively:
ptr = kmalloc_obj(*ptr, gfp);
ptr = kzalloc_obj(*ptr, gfp);
ptr = kmalloc_objs(*ptr, count, gfp);
ptr = kzalloc_objs(*ptr, count, gfp);
ptr = kmalloc_flex(*ptr, flex_member, count, gfp);
__auto_type ptr = kmalloc_obj(struct foo, gfp);
If ptr->flex_member is annotated with __counted_by(), the allocation will automatically fail if count is larger than the maximum representable value that can be stored in the counter member associated with flex_member.
A guide to the Kernel Development Process
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The purpose of this document is to help developers (and their managers) work with the development community with a minimum of frustration. It is an attempt to document how this community works in a way which is accessible to those who are not intimately familiar with Linux kernel development (or, indeed, free software development in general). While there is some technical material here, this is very much a process-oriented discussion which does not require a deep knowledge of kernel programming to understand.
Contents
Email clients info for Linux
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Git #
These days most developers use git send-email instead of regular email clients. The man page for this is quite good. On the receiving end, maintainers use git am to apply the patches.
If you are new to git then send your first patch to yourself. Save it as raw text including all the headers. Run git am raw_email.txt and then review the changelog with git log. When that works then send the patch to the appropriate mailing list(s).
General Preferences #
Patches for the Linux kernel are submitted via email, preferably as inline text in the body of the email. Some maintainers accept attachments, but then the attachments should have content-type text/plain. However, attachments are generally frowned upon because it makes quoting portions of the patch more difficult in the patch review process.
It's also strongly recommended that you use plain text in your email body, for patches and other emails alike. https://useplaintext.email may be useful for information on how to configure your preferred email client, as well as listing recommended email clients should you not already have a preference.
Email clients that are used for Linux kernel patches should send the patch text untouched. For example, they should not modify or delete tabs or spaces, even at the beginning or end of lines.
Don't send patches with format=flowed. This can cause unexpected and unwanted line breaks.
Don't let your email client do automatic word wrapping for you. This can also corrupt your patch.
Email clients should not modify the character set encoding of the text. Emailed patches should be in ASCII or UTF-8 encoding only. If you configure your email client to send emails with UTF-8 encoding, you avoid some possible charset problems.
Email clients should generate and maintain "References:" or "In-Reply-To:" headers so that mail threading is not broken.
Copy-and-paste (or cut-and-paste) usually does not work for patches because tabs are converted to spaces. Using xclipboard, xclip, and/or xcutsel may work, but it's best to test this for yourself or just avoid copy-and-paste.
Don't use PGP/GPG signatures in mail that contains patches. This breaks many scripts that read and apply the patches. (This should be fixable.)
It's a good idea to send a patch to yourself, save the received message, and successfully apply it with 'patch' before sending patches to Linux mailing lists.
Some email client (MUA) hints #
Here are some specific MUA configuration hints for editing and sending patches for the Linux kernel. These are not meant to be complete software package configuration summaries.
Legend:
-
TUI = text-based user interface
-
GUI = graphical user interface
Alpine (TUI) #
Config options:
In the Sending Preferences section:
-
Do Not Send Flowed Textmust beenabled -
Strip Whitespace Before Sendingmust bedisabled
When composing the message, the cursor should be placed where the patch should appear, and then pressing CTRL-R let you specify the patch file to insert into the message.
Claws Mail (GUI) #
Works. Some people use this successfully for patches.
To insert a patch use Message-->Insert File (CTRL-I) or an external editor.
If the inserted patch has to be edited in the Claws composition window "Auto wrapping" in Configuration-->Preferences-->Compose-->Wrapping should be disabled.
Evolution (GUI) #
Some people use this successfully for patches.
-
When composing mail select: Preformat
from
Format-->Paragraph Style-->Preformatted(CTRL-7) or the toolbar
Then use: Insert-->Text File... (ALT-N x) to insert the patch.
You can also diff -Nru old.c new.c | xclip, select Preformat, then paste with the middle button.
Kmail (GUI) #
Some people use Kmail successfully for patches.
The default setting of not composing in HTML is appropriate; do not enable it.
When composing an email, under options, uncheck "word wrap". The only disadvantage is any text you type in the email will not be word-wrapped so you will have to manually word wrap text before the patch. The easiest way around this is to compose your email with word wrap enabled, then save it as a draft. Once you pull it up again from your drafts it is now hard word-wrapped and you can uncheck "word wrap" without losing the existing wrapping.
At the bottom of your email, put the commonly-used patch delimiter before inserting your patch: three hyphens (---).
Then from the Message menu item, select insert file and choose your patch. As an added bonus you can customise the message creation toolbar menu and put the insert file icon there.
Make the composer window wide enough so that no lines wrap. As of KMail 1.13.5 (KDE 4.5.4), KMail will apply word wrapping when sending the email if the lines wrap in the composer window. Having word wrapping disabled in the Options menu isn't enough. Thus, if your patch has very long lines, you must make the composer window very wide before sending the email. See: https://bugs.kde.org/show_bug.cgi?id=174034
You can safely GPG sign attachments, but inlined text is preferred for patches so do not GPG sign them. Signing patches that have been inserted as inlined text will make them tricky to extract from their 7-bit encoding.
If you absolutely must send patches as attachments instead of inlining them as text, right click on the attachment and select properties, and highlight Suggest automatic display to make the attachment inlined to make it more viewable.
When saving patches that are sent as inlined text, select the email that contains the patch from the message list pane, right click and select save as. You can use the whole email unmodified as a patch if it was properly composed. Emails are saved as read-write for user only so you will have to chmod them to make them group and world readable if you copy them elsewhere.
Lotus Notes (GUI) #
Run away from it.
IBM Verse (Web GUI) #
See Lotus Notes.
Mutt (TUI) #
Plenty of Linux developers use mutt, so it must work pretty well.
Mutt doesn't come with an editor, so whatever editor you use should be used in a way that there are no automatic linebreaks. Most editors have an insert file option that inserts the contents of a file unaltered.
To use vim with mutt:
set editor="vi"
If using xclip, type the command:
:set paste
before middle button or shift-insert or use:
:r filename
if you want to include the patch inline. (a)ttach works fine without set paste.
You can also generate patches with git format-patch and then use Mutt to send them:
$ mutt -H 0001-some-bug-fix.patch
Config options:
It should work with default settings. However, it's a good idea to set the send_charset to:
set send_charset="us-ascii:utf-8"
Mutt is highly customizable. Here is a minimum configuration to start using Mutt to send patches through Gmail:
# .muttrc
# ================ IMAP ====================
set imap_user = 'yourusername@gmail.com'
set imap_pass = 'yourpassword'
set spoolfile = imaps://imap.gmail.com/INBOX
set folder = imaps://imap.gmail.com/
set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
set mbox="imaps://imap.gmail.com/[Gmail]/All Mail"
# ================ SMTP ====================
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = $imap_pass
set ssl_force_tls = yes # Require encrypted connection
# ================ Composition ====================
set editor = `echo \$EDITOR`
set edit_headers = yes # See the headers when editing
set charset = UTF-8 # value of $LANG; also fallback for send_charset
# Sender, email address, and sign-off line must match
unset use_domain # because joe@localhost is just embarrassing
set realname = "YOUR NAME"
set from = "username@gmail.com"
set use_from = yes
The Mutt docs have lots more information:
Pine (TUI) #
Pine has had some whitespace truncation issues in the past, but these should all be fixed now.
Use alpine (pine's successor) if you can.
Config options:
-
quell-flowed-textis needed for recent versions -
the
no-strip-whitespace-before-sendoption is needed
Sylpheed (GUI) #
-
Works well for inlining text (or using attachments).
-
Allows use of an external editor.
-
Is slow on large folders.
-
Won't do TLS SMTP auth over a non-SSL connection.
-
Has a helpful ruler bar in the compose window.
-
Adding addresses to address book doesn't understand the display name properly.
Thunderbird (GUI) #
Thunderbird is an Outlook clone that likes to mangle text, but there are ways to coerce it into behaving.
After doing the modifications, this includes installing the extensions, you need to restart Thunderbird.
-
Allow use of an external editor:
The easiest thing to do with Thunderbird and patches is to use extensions which open your favorite external editor.
Here are some example extensions which are capable of doing this.
-
"External Editor Revived"
https://github.com/Frederick888/external-editor-revived
https://addons.thunderbird.net/en-GB/thunderbird/addon/external-editor-revived/
It requires installing a "native messaging host". Please read the wiki which can be found here: https://github.com/Frederick888/external-editor-revived/wiki
-
"External Editor"
https://github.com/exteditor/exteditor
To do this, download and install the extension, then open the
composewindow, add a button for it usingView-->Toolbars-->Customize...then just click on the new button when you wish to use the external editor.Please note that "External Editor" requires that your editor must not fork, or in other words, the editor must not return before closing. You may have to pass additional flags or change the settings of your editor. Most notably if you are using gvim then you must pass the -f option to gvim by putting
/usr/bin/gvim --nofork"(if the binary is in/usr/bin) to the text editor field inexternal editorsettings. If you are using some other editor then please read its manual to find out how to do this.
-
To beat some sense out of the internal editor, do this:
-
Edit your Thunderbird config settings so that it won't use
format=flowed! Go to your main window and find the button for your main dropdown menu.Main Menu-->Preferences-->General-->Config Editor...to bring up the thunderbird's registry editor.-
Set
mailnews.send_plaintext_flowedtofalse -
Set
mailnews.wraplengthfrom72to0or install the "Toggle Line Wrap" extensionhttps://github.com/jan-kiszka/togglelinewrap
https://addons.thunderbird.net/thunderbird/addon/toggle-line-wrap
to control this registry on the fly.
-
-
Don't write HTML messages! Go to the main window
Main Menu-->Account Settings-->youracc@server.something-->Composition & Addressing! There you can disable the option "Compose messages in HTML format". -
Open messages only as plain text! Go to the main window
Main Menu-->View-->Message Body As-->Plain Text!
TkRat (GUI) #
Works. Use "Insert file..." or external editor.
Gmail (Web GUI) #
Does not work for sending patches.
Gmail web client converts tabs to spaces automatically.
At the same time it wraps lines every 78 chars with CRLF style line breaks although tab2space problem can be solved with external editor.
Another problem is that Gmail will base64-encode any message that has a non-ASCII character. That includes things like European names.
HacKerMaiL (TUI) #
HacKerMaiL (hkml) is a public-inbox based simple mails management tool that doesn't require subscription of mailing lists. It is developed and maintained by the DAMON maintainer and aims to support simple development workflows for DAMON and general kernel subsystems. Refer to the README (https://github.com/sjp38/hackermail/blob/master/README.md) for details.
Embargoed hardware issues
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Scope #
Hardware issues which result in security problems are a different category of security bugs than pure software bugs which only affect the Linux kernel.
Hardware issues like Meltdown, Spectre, L1TF etc. must be treated differently because they usually affect all Operating Systems ("OS") and therefore need coordination across different OS vendors, distributions, silicon vendors, hardware integrators, and other parties. For some of the issues, software mitigations can depend on microcode or firmware updates, which need further coordination.
Contact #
The Linux kernel hardware security team is separate from the regular Linux kernel security team.
The team only handles developing fixes for embargoed hardware security issues. Reports of pure software security bugs in the Linux kernel are not handled by this team and the reporter will be guided to contact the regular Linux kernel security team (Documentation/admin-guide/) instead.
The team can be contacted by email at <hardware-security@kernel.org>. This is a private list of security officers who will help you coordinate a fix according to our documented process.
The list is encrypted and email to the list can be sent by either PGP or S/MIME encrypted and must be signed with the reporter's PGP key or S/MIME certificate. The list's PGP key and S/MIME certificate are available from the following URLs:
While hardware security issues are often handled by the affected silicon vendor, we welcome contact from researchers or individuals who have identified a potential hardware flaw.
Hardware security officers #
The current team of hardware security officers:
Linus Torvalds (Linux Foundation Fellow)
Greg Kroah-Hartman (Linux Foundation Fellow)
Thomas Gleixner (Linux Foundation Fellow)
Operation of mailing-lists #
The encrypted mailing-lists which are used in our process are hosted on Linux Foundation's IT infrastructure. By providing this service, members of Linux Foundation's IT operations personnel technically have the ability to access the embargoed information, but are obliged to confidentiality by their employment contract. Linux Foundation IT personnel are also responsible for operating and managing the rest of kernel.org's infrastructure.
The Linux Foundation's current director of IT Project infrastructure is Konstantin Ryabitsev.
Non-disclosure agreements #
The Linux kernel hardware security team is not a formal body and therefore unable to enter into any non-disclosure agreements. The kernel community is aware of the sensitive nature of such issues and offers a Memorandum of Understanding instead.
Memorandum of Understanding #
The Linux kernel community has a deep understanding of the requirement to keep hardware security issues under embargo for coordination between different OS vendors, distributors, silicon vendors, and other parties.
The Linux kernel community has successfully handled hardware security issues in the past and has the necessary mechanisms in place to allow community compliant development under embargo restrictions.
The Linux kernel community has a dedicated hardware security team for initial contact, which oversees the process of handling such issues under embargo rules.
The hardware security team identifies the developers (domain experts) who will form the initial response team for a particular issue. The initial response team can bring in further developers (domain experts) to address the issue in the best technical way.
All involved developers pledge to adhere to the embargo rules and to keep the received information confidential. Violation of the pledge will lead to immediate exclusion from the current issue and removal from all related mailing lists. In addition, the hardware security team will also exclude the offender from future issues. The impact of this consequence is a highly effective deterrent in our community. In case a violation happens the hardware security team will inform the involved parties immediately. If you or anyone else becomes aware of a potential violation, please report it immediately to the Hardware security officers.
Process #
Due to the globally distributed nature of Linux kernel development, face-to-face meetings are almost impossible to address hardware security issues. Phone conferences are hard to coordinate due to time zones and other factors and should be only used when absolutely necessary. Encrypted email has been proven to be the most effective and secure communication method for these types of issues.
Start of Disclosure #
Disclosure starts by emailing the Linux kernel hardware security team per the Contact section above. This initial contact should contain a description of the problem and a list of any known affected silicon. If your organization builds or distributes the affected hardware, we encourage you to also consider what other hardware could be affected. The disclosing party is responsible for contacting the affected silicon vendors in a timely manner.
The hardware security team will provide an incident-specific encrypted mailing list which will be used for initial discussion with the reporter, further disclosure, and coordination of fixes.
The hardware security team will provide the disclosing party a list of developers (domain experts) who should be informed initially about the issue after confirming with the developers that they will adhere to this Memorandum of Understanding and the documented process. These developers form the initial response team and will be responsible for handling the issue after initial contact. The hardware security team is supporting the response team, but is not necessarily involved in the mitigation development process.
While individual developers might be covered by a non-disclosure agreement via their employer, they cannot enter individual non-disclosure agreements in their role as Linux kernel developers. They will, however, agree to adhere to this documented process and the Memorandum of Understanding.
The disclosing party should provide a list of contacts for all other entities who have already been, or should be, informed about the issue. This serves several purposes:
The list of disclosed entities allows communication across the industry, e.g. other OS vendors, HW vendors, etc.
The disclosed entities can be contacted to name experts who should participate in the mitigation development.
If an expert who is required to handle an issue is employed by a listed entity or member of an listed entity, then the response teams can request the disclosure of that expert from that entity. This ensures that the expert is also part of the entity's response team.
Disclosure #
The disclosing party provides detailed information to the initial response team via the specific encrypted mailing-list.
From our experience, the technical documentation of these issues is usually a sufficient starting point, and further technical clarification is best done via email.
Mitigation development #
The initial response team sets up an encrypted mailing-list or repurposes an existing one if appropriate.
Using a mailing list is close to the normal Linux development process and has been successfully used to develop mitigations for various hardware security issues in the past.
The mailing list operates in the same way as normal Linux development. Patches are posted, discussed, and reviewed and if agreed upon, applied to a non-public git repository which is only accessible to the participating developers via a secure connection. The repository contains the main development branch against the mainline kernel and backport branches for stable kernel versions as necessary.
The initial response team will identify further experts from the Linux kernel developer community as needed. Any involved party can suggest further experts to be included, each of which will be subject to the same requirements outlined above.
Bringing in experts can happen at any time in the development process and needs to be handled in a timely manner.
If an expert is employed by or a member of an entity on the disclosure list provided by the disclosing party, then participation will be requested from the relevant entity.
If not, then the disclosing party will be informed about the experts' participation. The experts are covered by the Memorandum of Understanding and the disclosing party is requested to acknowledge their participation. In the case where the disclosing party has a compelling reason to object, any objection must to be raised within five working days and resolved with the incident team immediately. If the disclosing party does not react within five working days this is taken as silent acknowledgment.
After the incident team acknowledges or resolves an objection, the expert is disclosed and brought into the development process.
List participants may not communicate about the issue outside of the private mailing list. List participants may not use any shared resources (e.g. employer build farms, CI systems, etc) when working on patches.
Early access #
The patches discussed and developed on the list can neither be distributed to any individual who is not a member of the response team nor to any other organization.
To allow the affected silicon vendors to work with their internal teams and industry partners on testing, validation, and logistics, the following exception is provided:
Designated representatives of the affected silicon vendors are allowed to hand over the patches at any time to the silicon vendor’s response team. The representative must notify the kernel response team about the handover. The affected silicon vendor must have and maintain their own documented security process for any patches shared with their response team that is consistent with this policy.
The silicon vendor’s response team can distribute these patches to their industry partners and to their internal teams under the silicon vendor’s documented security process. Feedback from the industry partners goes back to the silicon vendor and is communicated by the silicon vendor to the kernel response team.
The handover to the silicon vendor’s response team removes any responsibility or liability from the kernel response team regarding premature disclosure, which happens due to the involvement of the silicon vendor’s internal teams or industry partners. The silicon vendor guarantees this release of liability by agreeing to this process.
Coordinated release #
The involved parties will negotiate the date and time when the embargo ends. At that point, the prepared mitigations are published into the relevant kernel trees. There is no pre-notification process: the mitigations are published in public and available to everyone at the same time.
While we understand that hardware security issues need coordinated embargo time, the embargo time should be constrained to the minimum time that is required for all involved parties to develop, test, and prepare their mitigations. Extending embargo time artificially to meet conference talk dates or other non-technical reasons creates more work and burden for the involved developers and response teams as the patches need to be kept up to date in order to follow the ongoing upstream kernel development, which might create conflicting changes.
CVE assignment #
Neither the hardware security team nor the initial response team assign CVEs, nor are CVEs required for the development process. If CVEs are provided by the disclosing party they can be used for documentation purposes.
Process ambassadors #
For assistance with this process we have established ambassadors in various organizations, who can answer questions about or provide guidance on the reporting process and further handling. Ambassadors are not involved in the disclosure of a particular issue, unless requested by a response team or by an involved disclosed party. The current ambassadors list:
AMD
Tom Lendacky <thomas.lendacky@amd.com>
Ampere
Darren Hart <darren@os.amperecomputing.com>
ARM
Catalin Marinas <catalin.marinas@arm.com>
IBM Power
Madhavan Srinivasan <maddy@linux.ibm.com>
IBM Z
Christian Borntraeger <borntraeger@de.ibm.com>
Intel
Tony Luck <tony.luck@intel.com>
Qualcomm
Trilok Soni <quic_tsoni@quicinc.com>
RISC-V
Palmer Dabbelt <palmer@dabbelt.com>
Samsung
Javier González <javier.gonz@samsung.com>
Microsoft
James Morris <jamorris@linux.microsoft.com>
Xen
Andrew Cooper <andrew.cooper3@citrix.com>
Canonical
John Johansen <john.johansen@canonical.com>
Debian
Ben Hutchings <ben@decadent.org.uk>
Oracle
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Red Hat
Josh Poimboeuf <jpoimboe@redhat.com>
SUSE
Jiri Kosina <jkosina@suse.cz>
Kees Cook <keescook@chromium.org>
LLVM
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
If you want your organization to be added to the ambassadors list, please contact the hardware security team. The nominated ambassador has to understand and support our process fully and is ideally well-connected in the Linux kernel community.
Encrypted mailing-lists #
We use encrypted mailing lists for communication. The operating principle of these lists is that email sent to the list is encrypted either with the list's PGP key or with the list's S/MIME certificate. The mailing list software decrypts the email and re-encrypts it individually for each subscriber with the subscriber's PGP key or S/MIME certificate. Details about the mailing list software and the setup that is used to ensure the security of the lists and protection of the data can be found here: https://korg.wiki.kernel.org/userdoc/remail.
List keys #
For initial contact see the Contact section above. For incident specific mailing lists, the key and S/MIME certificate are conveyed to the subscribers by email sent from the specific list.
Subscription to incident-specific lists #
Subscription to incident-specific lists is handled by the response teams. Disclosed parties who want to participate in the communication send a list of potential experts to the response team so the response team can validate subscription requests.
Each subscriber needs to send a subscription request to the response team by email. The email must be signed with the subscriber's PGP key or S/MIME certificate. If a PGP key is used, it must be available from a public key server and is ideally connected to the Linux kernel's PGP web of trust. See also: https://www.kernel.org/signature.html.
The response team verifies that the subscriber request is valid and adds the subscriber to the list. After subscription the subscriber will receive email from the mailing-list which is signed either with the list's PGP key or the list's S/MIME certificate. The subscriber's email client can extract the PGP key or the S/MIME certificate from the signature so the subscriber can send encrypted email to the list.
Kernel Guidelines for Tool-Generated Content
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Purpose #
Kernel contributors have been using tooling to generate contributions for a long time. These tools can increase the volume of contributions. At the same time, reviewer and maintainer bandwidth is a scarce resource. Understanding which portions of a contribution come from humans versus tools is helpful to maintain those resources and keep kernel development healthy.
The goal here is to clarify community expectations around tools. This lets everyone become more productive while also maintaining high degrees of trust between submitters and reviewers.
Out of Scope #
These guidelines do not apply to tools that make trivial tweaks to preexisting content. Nor do they pertain to tooling that helps with menial tasks. Some examples:
Spelling and grammar fix ups, like rephrasing to imperative voice
Typing aids like identifier completion, common boilerplate or trivial pattern completion
Purely mechanical transformations like variable renaming
Reformatting, like running Lindent,
clang-formatorrust-fmt
Even whenever your tool use is out of scope, you should still always consider if it would help reviewing your contribution if the reviewer knows about the tool that you used.
In Scope #
These guidelines apply when a meaningful amount of content in a kernel contribution was not written by a person in the Signed-off-by chain, but was instead created by a tool.
Detection of a problem and testing the fix for it is also part of the development process; if a tool was used to find a problem addressed by a change, that should be noted in the changelog. This not only gives credit where it is due, it also helps fellow developers find out about these tools.
-
Some examples:
-
Any tool-suggested fix such as
checkpatch.pl --fix -
Coccinelle scripts
-
A chatbot generated a new function in your patch to sort list entries.
-
A .c file in the patch was originally generated by a coding assistant but cleaned up by hand.
-
The changelog was generated by handing the patch to a generative AI tool and asking it to write the changelog.
-
The changelog was translated from another language.
-
If in doubt, choose transparency and assume these guidelines apply to your contribution.
Guidelines #
First, read the Developer's Certificate of Origin: Documentation/process/submitting-patches.rst. Its rules are simple and have been in place for a long time. They have covered many tool-generated contributions. Ensure that you understand your entire submission and are prepared to respond to review comments.
Second, when making a contribution, be transparent about the origin of content in cover letters and changelogs. You can be more transparent by adding information like this:
What tools were used?
The input to the tools you used, like the Coccinelle source script.
If code was largely generated from a single or short set of prompts, include those prompts. For longer sessions, include a summary of the prompts and the nature of resulting assistance.
Which portions of the content were affected by that tool?
How is the submission tested and what tools were used to test the fix?
As with all contributions, individual maintainers have discretion to choose how they handle the contribution. For example, they might:
Treat it just like any other contribution.
Reject it outright.
Treat the contribution specially, for example, asking for extra testing, reviewing with extra scrutiny, or reviewing at a lower priority than human-generated content.
Ask for some other special steps, like asking the contributor to elaborate on how the tool or model was trained.
Ask the submitter to explain in more detail about the contribution so that the maintainer can be assured that the submitter fully understands how the code works.
Suggest a better prompt instead of suggesting specific code changes.
If tools permit you to generate a contribution automatically, expect additional scrutiny in proportion to how much of it was generated.
As with the output of any tooling, the result may be incorrect or inappropriate. You are expected to understand and to be able to defend everything you submit. If you are unable to do so, then do not submit the resulting changes.
If you do so anyway, maintainers are entitled to reject your series without detailed review.
Handling regressions
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
We don't cause regressions -- this document describes what this "first rule of Linux kernel development" means in practice for developers. It complements Documentation/admin-guide/reporting-regressions.rst, which covers the topic from a user's point of view; if you never read that text, go and at least skim over it before continuing here.
The important bits (aka "The TL;DR") #
-
Ensure subscribers of the regression mailing list (regressions@lists.linux.dev) quickly become aware of any new regression report:
-
When receiving a mailed report that did not CC the list, bring it into the loop by immediately sending at least a brief "Reply-all" with the list CCed.
-
Forward or bounce any reports submitted in bug trackers to the list.
-
-
Make the Linux kernel regression tracking bot "regzbot" track the issue (this is optional, but recommended):
-
For mailed reports, check if the reporter included a line like
#regzbot introduced: v5.13..v5.14-rc1. If not, send a reply (with the regressions list in CC) containing a paragraph like the following, which tells regzbot when the issue started to happen:#regzbot ^introduced: 1f2e3d4c5b6a -
When forwarding reports from a bug tracker to the regressions list (see above), include a paragraph like the following:
#regzbot introduced: v5.13..v5.14-rc1 #regzbot from: Some N. Ice Human <some.human@example.com> #regzbot monitor: http://some.bugtracker.example.com/ticket?id=123456789
-
-
When submitting fixes for regressions, add "Closes:" tags to the patch description pointing to all places where the issue was reported, as mandated by Documentation/process/submitting-patches.rst and Documentation/process/5.Posting.rst. If you are only fixing part of the issue that caused the regression, you may use "Link:" tags instead. regzbot currently makes no distinction between the two.
-
Try to fix regressions quickly once the culprit has been identified; fixes for most regressions should be merged within two weeks, but some need to be resolved within two or three days.
All the details on Linux kernel regressions relevant for developers #
The important basics in more detail #
What to do when receiving regression reports #
Ensure the Linux kernel's regression tracker and others subscribers of the regression mailing list (regressions@lists.linux.dev) become aware of any newly reported regression:
When you receive a report by mail that did not CC the list, immediately bring it into the loop by sending at least a brief "Reply-all" with the list CCed; try to ensure it gets CCed again in case you reply to a reply that omitted the list.
If a report submitted in a bug tracker hits your Inbox, forward or bounce it to the list. Consider checking the list archives beforehand, if the reporter already forwarded the report as instructed by Documentation/admin-guide/reporting-issues.rst.
When doing either, consider making the Linux kernel regression tracking bot "regzbot" immediately start tracking the issue:
For mailed reports, check if the reporter included a "regzbot command" like
#regzbot introduced: 1f2e3d4c5b6a. If not, send a reply (with the regressions list in CC) with a paragraph like the following::#regzbot ^introduced: v5.13..v5.14-rc1This tells regzbot the version range in which the issue started to happen; you can specify a range using commit-ids as well or state a single commit-id in case the reporter bisected the culprit.
Note the caret (^) before the "introduced": it tells regzbot to treat the parent mail (the one you reply to) as the initial report for the regression you want to see tracked; that's important, as regzbot will later look out for patches with "Closes:" tags pointing to the report in the archives on lore.kernel.org.
When forwarding a regression reported to a bug tracker, include a paragraph with these regzbot commands:
#regzbot introduced: 1f2e3d4c5b6a #regzbot from: Some N. Ice Human <some.human@example.com> #regzbot monitor: http://some.bugtracker.example.com/ticket?id=123456789Regzbot will then automatically associate patches with the report that contain "Closes:" tags pointing to your mail or the mentioned ticket.
What's important when fixing regressions #
You don't need to do anything special when submitting fixes for regression, just remember to do what Documentation/process/submitting-patches.rst, Documentation/process/5.Posting.rst, and Documentation/process/stable-kernel-rules.rst already explain in more detail:
Point to all places where the issue was reported using "Closes:" tags:
Closes: https://lore.kernel.org/r/30th.anniversary.repost@klaava.Helsinki.FI/ Closes: https://bugzilla.kernel.org/show_bug.cgi?id=1234567890If you are only fixing part of the issue, you may use "Link:" instead as described in the first document mentioned above. regzbot currently treats both of these equivalently and considers the linked reports as resolved.
Add a "Fixes:" tag to specify the commit causing the regression.
If the culprit was merged in an earlier development cycle, explicitly mark the fix for backporting using the
Cc: stable@vger.kernel.orgtag.
All this is expected from you and important when it comes to regression, as these tags are of great value for everyone (you included) that might be looking into the issue weeks, months, or years later. These tags are also crucial for tools and scripts used by other kernel developers or Linux distributions; one of these tools is regzbot, which heavily relies on the "Closes:" tags to associate reports for regression with changes resolving them.
Expectations and best practices for fixing regressions #
As a Linux kernel developer, you are expected to give your best to prevent situations where a regression caused by a recent change of yours leaves users only these options:
Run a kernel with a regression that impacts usage.
Switch to an older or newer kernel series.
Continue running an outdated and thus potentially insecure kernel for more than three weeks after the regression's culprit was identified. Ideally it should be less than two. And it ought to be just a few days, if the issue is severe or affects many users -- either in general or in prevalent environments.
How to realize that in practice depends on various factors. Use the following rules of thumb as a guide.
In general:
Prioritize work on regressions over all other Linux kernel work, unless the latter concerns a severe issue (e.g. acute security vulnerability, data loss, bricked hardware, ...).
Expedite fixing mainline regressions that recently made it into a proper mainline, stable, or longterm release (either directly or via backport).
Do not consider regressions from the current cycle as something that can wait till the end of the cycle, as the issue might discourage or prevent users and CI systems from testing mainline now or generally.
Work with the required care to avoid additional or bigger damage, even if resolving an issue then might take longer than outlined below.
On timing once the culprit of a regression is known:
Aim to mainline a fix within two or three days, if the issue is severe or bothering many users -- either in general or in prevalent conditions like a particular hardware environment, distribution, or stable/longterm series.
Aim to mainline a fix by Sunday after the next, if the culprit made it into a recent mainline, stable, or longterm release (either directly or via backport); if the culprit became known early during a week and is simple to resolve, try to mainline the fix within the same week.
For other regressions, aim to mainline fixes before the hindmost Sunday within the next three weeks. One or two Sundays later are acceptable, if the regression is something people can live with easily for a while -- like a mild performance regression.
It's strongly discouraged to delay mainlining regression fixes till the next merge window, except when the fix is extraordinarily risky or when the culprit was mainlined more than a year ago.
On procedure:
Always consider reverting the culprit, as it's often the quickest and least dangerous way to fix a regression. Don't worry about mainlining a fixed variant later: that should be straight-forward, as most of the code went through review once already.
Try to resolve any regressions introduced in mainline during the past twelve months before the current development cycle ends: Linus wants such regressions to be handled like those from the current cycle, unless fixing bears unusual risks.
Consider CCing Linus on discussions or patch review, if a regression seems tangly. Do the same in precarious or urgent cases -- especially if the subsystem maintainer might be unavailable. Also CC the stable team, when you know such a regression made it into a mainline, stable, or longterm release.
For urgent regressions, consider asking Linus to pick up the fix straight from the mailing list: he is totally fine with that for uncontroversial fixes. Ideally though such requests should happen in accordance with the subsystem maintainers or come directly from them.
In case you are unsure if a fix is worth the risk applying just days before a new mainline release, send Linus a mail with the usual lists and people in CC; in it, summarize the situation while asking him to consider picking up the fix straight from the list. He then himself can make the call and when needed even postpone the release. Such requests again should ideally happen in accordance with the subsystem maintainers or come directly from them.
Regarding stable and longterm kernels:
You are free to leave regressions to the stable team, if they at no point in time occurred with mainline or were fixed there already.
If a regression made it into a proper mainline release during the past twelve months, ensure to tag the fix with "Cc: stable@vger.kernel.org", as a "Fixes:" tag alone does not guarantee a backport. Please add the same tag, in case you know the culprit was backported to stable or longterm kernels.
When receiving reports about regressions in recent stable or longterm kernel series, please evaluate at least briefly if the issue might happen in current mainline as well -- and if that seems likely, take hold of the report. If in doubt, ask the reporter to check mainline.
Whenever you want to swiftly resolve a regression that recently also made it into a proper mainline, stable, or longterm release, fix it quickly in mainline; when appropriate thus involve Linus to fast-track the fix (see above). That's because the stable team normally does neither revert nor fix any changes that cause the same problems in mainline.
In case of urgent regression fixes you might want to ensure prompt backporting by dropping the stable team a note once the fix was mainlined; this is especially advisable during merge windows and shortly thereafter, as the fix otherwise might land at the end of a huge patch queue.
On patch flow:
Developers, when trying to reach the time periods mentioned above, remember to account for the time it takes to get fixes tested, reviewed, and merged by Linus, ideally with them being in linux-next at least briefly. Hence, if a fix is urgent, make it obvious to ensure others handle it appropriately.
Reviewers, you are kindly asked to assist developers in reaching the time periods mentioned above by reviewing regression fixes in a timely manner.
Subsystem maintainers, you likewise are encouraged to expedite the handling of regression fixes. Thus evaluate if skipping linux-next is an option for the particular fix. Also consider sending git pull requests more often than usual when needed. And try to avoid holding onto regression fixes over weekends -- especially when the fix is marked for backporting.
More aspects regarding regressions developers should be aware of #
How to deal with changes where a risk of regression is known #
Evaluate how big the risk of regressions is, for example by performing a code search in Linux distributions and Git forges. Also consider asking other developers or projects likely to be affected to evaluate or even test the proposed change; if problems surface, maybe some solution acceptable for all can be found.
If the risk of regressions in the end seems to be relatively small, go ahead with the change, but let all involved parties know about the risk. Hence, make sure your patch description makes this aspect obvious. Once the change is merged, tell the Linux kernel's regression tracker and the regressions mailing list about the risk, so everyone has the change on the radar in case reports trickle in. Depending on the risk, you also might want to ask the subsystem maintainer to mention the issue in his mainline pull request.
What else is there to known about regressions? #
Check out Documentation/admin-guide/reporting-regressions.rst, it covers a lot of other aspects you want might want to be aware of:
the purpose of the "no regressions" rule
what issues actually qualify as regression
who's in charge for finding the root cause of a regression
how to handle tricky situations, e.g. when a regression is caused by a security fix or when fixing a regression might cause another one
Whom to ask for advice when it comes to regressions #
Send a mail to the regressions mailing list (regressions@lists.linux.dev) while CCing the Linux kernel's regression tracker (regressions@leemhuis.info); if the issue might better be dealt with in private, feel free to omit the list.
More about regression tracking and regzbot #
Why the Linux kernel has a regression tracker, and why is regzbot used? #
Rules like "no regressions" need someone to ensure they are followed, otherwise they are broken either accidentally or on purpose. History has shown this to be true for the Linux kernel as well. That's why Thorsten Leemhuis volunteered to keep an eye on things as the Linux kernel's regression tracker, who's occasionally helped by other people. Neither of them are paid to do this, that's why regression tracking is done on a best effort basis.
Earlier attempts to manually track regressions have shown it's an exhausting and frustrating work, which is why they were abandoned after a while. To prevent this from happening again, Thorsten developed regzbot to facilitate the work, with the long term goal to automate regression tracking as much as possible for everyone involved.
How does regression tracking work with regzbot? #
The bot watches for replies to reports of tracked regressions. Additionally, it's looking out for posted or committed patches referencing such reports with "Closes:" tags; replies to such patch postings are tracked as well. Combined this data provides good insights into the current state of the fixing process.
Regzbot tries to do its job with as little overhead as possible for both reporters and developers. In fact, only reporters are burdened with an extra duty: they need to tell regzbot about the regression report using the #regzbot introduced command outlined above; if they don't do that, someone else can take care of that using #regzbot ^introduced.
For developers there normally is no extra work involved, they just need to make sure to do something that was expected long before regzbot came to light: add links to the patch description pointing to all reports about the issue fixed.
Do I have to use regzbot? #
It's in the interest of everyone if you do, as kernel maintainers like Linus Torvalds partly rely on regzbot's tracking in their work -- for example when deciding to release a new version or extend the development phase. For this they need to be aware of all unfixed regression; to do that, Linus is known to look into the weekly reports sent by regzbot.
Do I have to tell regzbot about every regression I stumble upon? #
Ideally yes: we are all humans and easily forget problems when something more important unexpectedly comes up -- for example a bigger problem in the Linux kernel or something in real life that's keeping us away from keyboards for a while. Hence, it's best to tell regzbot about every regression, except when you immediately write a fix and commit it to a tree regularly merged to the affected kernel series.
How to see which regressions regzbot tracks currently? #
Check regzbot's web-interface for the latest info; alternatively, search for the latest regression report, which regzbot normally sends out once a week on Sunday evening (UTC), which is a few hours before Linus usually publishes new (pre-)releases.
What places is regzbot monitoring? #
Regzbot is watching the most important Linux mailing lists as well as the git repositories of linux-next, mainline, and stable/longterm.
What kind of issues are supposed to be tracked by regzbot? #
The bot is meant to track regressions, hence please don't involve regzbot for regular issues. But it's okay for the Linux kernel's regression tracker if you use regzbot to track severe issues, like reports about hangs, corrupted data, or internal errors (Panic, Oops, BUG(), warning, ...).
Can I add regressions found by CI systems to regzbot's tracking? #
Feel free to do so, if the particular regression likely has impact on practical use cases and thus might be noticed by users; hence, please don't involve regzbot for theoretical regressions unlikely to show themselves in real world usage.
How to interact with regzbot? #
By using a 'regzbot command' in a direct or indirect reply to the mail with the regression report. These commands need to be in their own paragraph (IOW: they need to be separated from the rest of the mail using blank lines).
One such command is #regzbot introduced: <version or commit>, which makes regzbot consider your mail as a regressions report added to the tracking, as already described above; #regzbot ^introduced: <version or commit> is another such command, which makes regzbot consider the parent mail as a report for a regression which it starts to track.
Once one of those two commands has been utilized, other regzbot commands can be used in direct or indirect replies to the report. You can write them below one of the introduced commands or in replies to the mail that used one of them or itself is a reply to that mail:
Set or update the title:
#regzbot title: fooMonitor a discussion or bugzilla.kernel.org ticket where additions aspects of the issue or a fix are discussed -- for example the posting of a patch fixing the regression:
#regzbot monitor: https://lore.kernel.org/all/30th.anniversary.repost@klaava.Helsinki.FI/Monitoring only works for lore.kernel.org and bugzilla.kernel.org; regzbot will consider all messages in that thread or ticket as related to the fixing process.
Point to a place with further details of interest, like a mailing list post or a ticket in a bug tracker that are slightly related, but about a different topic:
#regzbot link: https://bugzilla.kernel.org/show_bug.cgi?id=123456789Mark a regression as fixed by a commit that is heading upstream or already landed:
#regzbot fix: 1f2e3d4c5dMark a regression as a duplicate of another one already tracked by regzbot:
#regzbot dup-of: https://lore.kernel.org/all/30th.anniversary.repost@klaava.Helsinki.FI/Mark a regression as invalid:
#regzbot invalid: wasn't a regression, problem has always existed
Is there more to tell about regzbot and its commands? #
More detailed and up-to-date information about the Linux kernel's regression tracking bot can be found on its project page, which among others contains a getting started guide and reference documentation which both cover more details than the above section.
Quotes from Linus about regression #
Find below a few real life examples of how Linus Torvalds expects regressions to be handled:
From 2017-10-26 (1/2):
If you break existing user space setups THAT IS A REGRESSION. It's not ok to say "but we'll fix the user space setup". Really. NOT OK. [...] The first rule is: - we don't cause regressions and the corollary is that when regressions *do* occur, we admit to them and fix them, instead of blaming user space. The fact that you have apparently been denying the regression now for three weeks means that I will revert, and I will stop pulling apparmor requests until the people involved understand how kernel development is done.From 2017-10-26 (2/2):
People should basically always feel like they can update their kernel and simply not have to worry about it. I refuse to introduce "you can only update the kernel if you also update that other program" kind of limitations. If the kernel used to work for you, the rule is that it continues to work for you. There have been exceptions, but they are few and far between, and they generally have some major and fundamental reasons for having happened, that were basically entirely unavoidable, and people _tried_hard_ to avoid them. Maybe we can't practically support the hardware any more after it is decades old and nobody uses it with modern kernels any more. Maybe there's a serious security issue with how we did things, and people actually depended on that fundamentally broken model. Maybe there was some fundamental other breakage that just _had_ to have a flag day for very core and fundamental reasons. And notice that this is very much about *breaking* peoples environments. Behavioral changes happen, and maybe we don't even support some feature any more. There's a number of fields in /proc/<pid>/stat that are printed out as zeroes, simply because they don't even *exist* in the kernel any more, or because showing them was a mistake (typically an information leak). But the numbers got replaced by zeroes, so that the code that used to parse the fields still works. The user might not see everything they used to see, and so behavior is clearly different, but things still _work_, even if they might no longer show sensitive (or no longer relevant) information. But if something actually breaks, then the change must get fixed or reverted. And it gets fixed in the *kernel*. Not by saying "well, fix your user space then". It was a kernel change that exposed the problem, it needs to be the kernel that corrects for it, because we have a "upgrade in place" model. We don't have a "upgrade with new user space". And I seriously will refuse to take code from people who do not understand and honor this very simple rule. This rule is also not going to change. And yes, I realize that the kernel is "special" in this respect. I'm proud of it. I have seen, and can point to, lots of projects that go "We need to break that use case in order to make progress" or "you relied on undocumented behavior, it sucks to be you" or "there's a better way to do what you want to do, and you have to change to that new better way", and I simply don't think that's acceptable outside of very early alpha releases that have experimental users that know what they signed up for. The kernel hasn't been in that situation for the last two decades. We do API breakage _inside_ the kernel all the time. We will fix internal problems by saying "you now need to do XYZ", but then it's about internal kernel API's, and the people who do that then also obviously have to fix up all the in-kernel users of that API. Nobody can say "I now broke the API you used, and now _you_ need to fix it up". Whoever broke something gets to fix it too. And we simply do not break user space.From 2020-05-21:
The rules about regressions have never been about any kind of documented behavior, or where the code lives. The rules about regressions are always about "breaks user workflow". Users are literally the _only_ thing that matters. No amount of "you shouldn't have used this" or "that behavior was undefined, it's your own fault your app broke" or "that used to work simply because of a kernel bug" is at all relevant. Now, reality is never entirely black-and-white. So we've had things like "serious security issue" etc that just forces us to make changes that may break user space. But even then the rule is that we don't really have other options that would allow things to continue. And obviously, if users take years to even notice that something broke, or if we have sane ways to work around the breakage that doesn't make for too much trouble for users (ie "ok, there are a handful of users, and they can use a kernel command line to work around it" kind of things) we've also been a bit less strict. But no, "that was documented to be broken" (whether it's because the code was in staging or because the man-page said something else) is irrelevant. If staging code is so useful that people end up using it, that means that it's basically regular kernel code with a flag saying "please clean this up". The other side of the coin is that people who talk about "API stability" are entirely wrong. API's don't matter either. You can make any changes to an API you like - as long as nobody notices. Again, the regression rule is not about documentation, not about API's, and not about the phase of the moon. It's entirely about "we caused problems for user space that used to work".From 2017-11-05:
And our regression rule has never been "behavior doesn't change". That would mean that we could never make any changes at all. For example, we do things like add new error handling etc all the time, which we then sometimes even add tests for in our kselftest directory. So clearly behavior changes all the time and we don't consider that a regression per se. The rule for a regression for the kernel is that some real user workflow breaks. Not some test. Not a "look, I used to be able to do X, now I can't".From 2018-08-03:
YOU ARE MISSING THE #1 KERNEL RULE. We do not regress, and we do not regress exactly because your are 100% wrong. And the reason you state for your opinion is in fact exactly *WHY* you are wrong. Your "good reasons" are pure and utter garbage. The whole point of "we do not regress" is so that people can upgrade the kernel and never have to worry about it. > Kernel had a bug which has been fixed That is *ENTIRELY* immaterial. Guys, whether something was buggy or not DOES NOT MATTER. Why? Bugs happen. That's a fact of life. Arguing that "we had to break something because we were fixing a bug" is completely insane. We fix tens of bugs every single day, thinking that "fixing a bug" means that we can break something is simply NOT TRUE. So bugs simply aren't even relevant to the discussion. They happen, they get found, they get fixed, and it has nothing to do with "we break users". Because the only thing that matters IS THE USER. How hard is that to understand? Anybody who uses "but it was buggy" as an argument is entirely missing the point. As far as the USER was concerned, it wasn't buggy - it worked for him/her. Maybe it worked *because* the user had taken the bug into account, maybe it worked because the user didn't notice - again, it doesn't matter. It worked for the user. Breaking a user workflow for a "bug" is absolutely the WORST reason for breakage you can imagine. It's basically saying "I took something that worked, and I broke it, but now it's better". Do you not see how f*cking insane that statement is? And without users, your program is not a program, it's a pointless piece of code that you might as well throw away. Seriously. This is *why* the #1 rule for kernel development is "we don't break users". Because "I fixed a bug" is absolutely NOT AN ARGUMENT if that bug fix broke a user setup. You actually introduced a MUCH BIGGER bug by "fixing" something that the user clearly didn't even care about. And dammit, we upgrade the kernel ALL THE TIME without upgrading any other programs at all. It is absolutely required, because flag-days and dependencies are horribly bad. And it is also required simply because I as a kernel developer do not upgrade random other tools that I don't even care about as I develop the kernel, and I want any of my users to feel safe doing the same time. So no. Your rule is COMPLETELY wrong. If you cannot upgrade a kernel without upgrading some other random binary, then we have a problem.From 2021-06-05:
THERE ARE NO VALID ARGUMENTS FOR REGRESSIONS. Honestly, security people need to understand that "not working" is not a success case of security. It's a failure case. Yes, "not working" may be secure. But security in that case is *pointless*.From 2011-05-06 (1/3):
Binary compatibility is more important. And if binaries don't use the interface to parse the format (or just parse it wrongly - see the fairly recent example of adding uuid's to /proc/self/mountinfo), then it's a regression. And regressions get reverted, unless there are security issues or similar that makes us go "Oh Gods, we really have to break things". I don't understand why this simple logic is so hard for some kernel developers to understand. Reality matters. Your personal wishes matter NOT AT ALL. If you made an interface that can be used without parsing the interface description, then we're stuck with the interface. Theory simply doesn't matter. You could help fix the tools, and try to avoid the compatibility issues that way. There aren't that many of them.From 2011-05-06 (2/3):
it's clearly NOT an internal tracepoint. By definition. It's being used by powertop.From 2011-05-06 (3/3):
We have programs that use that ABI and thus it's a regression if they break.From 2012-07-06:
> Now this got me wondering if Debian _unstable_ actually qualifies as a > standard distro userspace. Oh, if the kernel breaks some standard user space, that counts. Tons of people run Debian unstableFrom 2019-09-15:
One _particularly_ last-minute revert is the top-most commit (ignoring the version change itself) done just before the release, and while it's very annoying, it's perhaps also instructive. What's instructive about it is that I reverted a commit that wasn't actually buggy. In fact, it was doing exactly what it set out to do, and did it very well. In fact it did it _so_ well that the much improved IO patterns it caused then ended up revealing a user-visible regression due to a real bug in a completely unrelated area. The actual details of that regression are not the reason I point that revert out as instructive, though. It's more that it's an instructive example of what counts as a regression, and what the whole "no regressions" kernel rule means. The reverted commit didn't change any API's, and it didn't introduce any new bugs. But it ended up exposing another problem, and as such caused a kernel upgrade to fail for a user. So it got reverted. The point here being that we revert based on user-reported _behavior_, not based on some "it changes the ABI" or "it caused a bug" concept. The problem was really pre-existing, and it just didn't happen to trigger before. The better IO patterns introduced by the change just happened to expose an old bug, and people had grown to depend on the previously benign behavior of that old issue. And never fear, we'll re-introduce the fix that improved on the IO patterns once we've decided just how to handle the fact that we had a bad interaction with an interface that people had then just happened to rely on incidental behavior for before. It's just that we'll have to hash through how to do that (there are no less than three different patches by three different developers being discussed, and there might be more coming...). In the meantime, I reverted the thing that exposed the problem to users for this release, even if I hope it will be re-introduced (perhaps even backported as a stable patch) once we have consensus about the issue it exposed. Take-away from the whole thing: it's not about whether you change the kernel-userspace ABI, or fix a bug, or about whether the old code "should never have worked in the first place". It's about whether something breaks existing users' workflow. Anyway, that was my little aside on the whole regression thing. Since it's that "first rule of kernel programming", I felt it is perhaps worth just bringing it up every once in a while
HOWTO do Linux kernel development
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This is the be-all, end-all document on this topic. It contains instructions on how to become a Linux kernel developer and how to learn to work with the Linux kernel development community. It tries to not contain anything related to the technical aspects of kernel programming, but will help point you in the right direction for that.
If anything in this document becomes out of date, please send in patches to the maintainer of this file, who is listed at the bottom of the document.
Introduction #
So, you want to learn how to become a Linux kernel developer? Or you have been told by your manager, "Go write a Linux driver for this device." This document's goal is to teach you everything you need to know to achieve this by describing the process you need to go through, and hints on how to work with the community. It will also try to explain some of the reasons why the community works like it does.
The kernel is written mostly in C, with some architecture-dependent parts written in assembly. A good understanding of C is required for kernel development. Assembly (any architecture) is not required unless you plan to do low-level development for that architecture. Though they are not a good substitute for a solid C education and/or years of experience, the following books are good for, if anything, reference:
"The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
"Practical C Programming" by Steve Oualline [O'Reilly]
"C: A Reference Manual" by Harbison and Steele [Prentice Hall]
The kernel is written using GNU C and the GNU toolchain. While it adheres to the ISO C11 standard, it uses a number of extensions that are not featured in the standard. The kernel is a freestanding C environment, with no reliance on the standard C library, so some portions of the C standard are not supported. Arbitrary long long divisions and floating point are not allowed. It can sometimes be difficult to understand the assumptions the kernel has on the toolchain and the extensions that it uses, and unfortunately there is no definitive reference for them. Please check the gcc info pages (info gcc) for some information on them.
Please remember that you are trying to learn how to work with the existing development community. It is a diverse group of people, with high standards for coding, style and procedure. These standards have been created over time based on what they have found to work best for such a large and geographically dispersed team. Try to learn as much as possible about these standards ahead of time, as they are well documented; do not expect people to adapt to you or your company's way of doing things.
Legal Issues #
The Linux kernel source code is released under the GPL. Please see the file COPYING in the main directory of the source tree. The Linux kernel licensing rules and how to use SPDX identifiers in source code are described in Documentation/process/license-rules.rst. If you have further questions about the license, please contact a lawyer, and do not ask on the Linux kernel mailing list. The people on the mailing lists are not lawyers, and you should not rely on their statements on legal matters.
For common questions and answers about the GPL, please see:
Documentation #
The Linux kernel source tree has a large range of documents that are invaluable for learning how to interact with the kernel community. When new features are added to the kernel, it is recommended that new documentation files are also added which explain how to use the feature. When a kernel change causes the interface that the kernel exposes to userspace to change, it is recommended that you send the information or a patch to the manual pages explaining the change to the manual pages maintainer at alx@kernel.org, and CC the list linux-api@vger.kernel.org.
Here is a list of files that are in the kernel source tree that are required reading:
Documentation/admin-guide/README.rst
This file gives a short background on the Linux kernel and describes what is necessary to do to configure and build the kernel. People who are new to the kernel should start here.
Documentation/process/changes.rst
This file gives a list of the minimum levels of various software packages that are necessary to build and run the kernel successfully.
Documentation/process/coding-style.rst
This describes the Linux kernel coding style, and some of the rationale behind it. All new code is expected to follow the guidelines in this document. Most maintainers will only accept patches if these rules are followed, and many people will only review code if it is in the proper style.
Documentation/process/submitting-patches.rst
This file describes in explicit detail how to successfully create and send a patch, including (but not limited to):
Email contents
Email format
Who to send it to
Following these rules will not guarantee success (as all patches are subject to scrutiny for content and style), but not following them will almost always prevent it.
Other excellent descriptions of how to create patches properly are:
"The Perfect Patch"
"Linux kernel patch submission format"
https://web.archive.org/web/20180829112450/http://linux.yyz.us/patch-format.html
Documentation/process/stable-api-nonsense.rst
This file describes the rationale behind the conscious decision to not have a stable API within the kernel, including things like:
Subsystem shim-layers (for compatibility?)
Driver portability between Operating Systems.
Mitigating rapid change within the kernel source tree (or preventing rapid change)
This document is crucial for understanding the Linux development philosophy and is very important for people moving to Linux from development on other Operating Systems.
Documentation/process/security-bugs.rst
If you feel you have found a security problem in the Linux kernel, please follow the steps in this document to help notify the kernel developers, and help solve the issue.
Documentation/process/management-style.rst
This document describes how Linux kernel maintainers operate and the shared ethos behind their methodologies. This is important reading for anyone new to kernel development (or anyone simply curious about it), as it resolves a lot of common misconceptions and confusion about the unique behavior of kernel maintainers.
Documentation/process/stable-kernel-rules.rst
This file describes the rules on how the stable kernel releases happen, and what to do if you want to get a change into one of these releases.
Documentation/process/kernel-docs.rst
A list of external documentation that pertains to kernel development. Please consult this list if you do not find what you are looking for within the in-kernel documentation.
Documentation/process/applying-patches.rst
A good introduction describing exactly what a patch is and how to apply it to the different development branches of the kernel.
The kernel also has a large number of documents that can be automatically generated from the source code itself or from ReStructuredText markups (ReST), like this one. This includes a full description of the in-kernel API, and rules on how to handle locking properly.
All such documents can be generated as PDF or HTML by running:
make pdfdocs
make htmldocs
respectively from the main kernel source directory.
The documents that uses ReST markup will be generated at Documentation/output. They can also be generated on LaTeX and ePub formats with:
make latexdocs
make epubdocs
Becoming A Kernel Developer #
If you do not know anything about Linux kernel development, you should look at the Linux KernelNewbies project:
It consists of a helpful mailing list where you can ask almost any type of basic kernel development question (make sure to search the archives first, before asking something that has already been answered in the past.) It also has an IRC channel that you can use to ask questions in real-time, and a lot of helpful documentation that is useful for learning about Linux kernel development.
The website has basic information about code organization, subsystems, and current projects (both in-tree and out-of-tree). It also describes some basic logistical information, like how to compile a kernel and apply a patch.
If you do not know where you want to start, but you want to look for some task to start doing to join into the kernel development community, go to the Linux Kernel Janitor's project:
It is a great place to start. It describes a list of relatively simple problems that need to be cleaned up and fixed within the Linux kernel source tree. Working with the developers in charge of this project, you will learn the basics of getting your patch into the Linux kernel tree, and possibly be pointed in the direction of what to go work on next, if you do not already have an idea.
Before making any actual modifications to the Linux kernel code, it is imperative to understand how the code in question works. For this purpose, nothing is better than reading through it directly (most tricky bits are commented well), perhaps even with the help of specialized tools. One such tool that is particularly recommended is the Linux Cross-Reference project, which is able to present source code in a self-referential, indexed webpage format. An excellent up-to-date repository of the kernel code may be found at:
The development process #
Linux kernel development process currently consists of a few different main kernel "branches" and lots of different subsystem-specific kernel branches. These different branches are:
Linus's mainline tree
Various stable trees with multiple major numbers
Subsystem-specific trees
linux-next integration testing tree
Mainline tree #
The mainline tree is maintained by Linus Torvalds, and can be found at https://kernel.org or in the repo. Its development process is as follows:
As soon as a new kernel is released a two week window is open, during this period of time maintainers can submit big diffs to Linus, usually the patches that have already been included in the linux-next for a few weeks. The preferred way to submit big changes is using git (the kernel's source management tool, more information can be found at https://git-scm.com/) but plain patches are also just fine.
After two weeks a -rc1 kernel is released and the focus is on making the new kernel as rock solid as possible. Most of the patches at this point should fix a regression. Bugs that have always existed are not regressions, so only push these kinds of fixes if they are important. Please note that a whole new driver (or filesystem) might be accepted after -rc1 because there is no risk of causing regressions with such a change as long as the change is self-contained and does not affect areas outside of the code that is being added. git can be used to send patches to Linus after -rc1 is released, but the patches need to also be sent to a public mailing list for review.
A new -rc is released whenever Linus deems the current git tree to be in a reasonably sane state adequate for testing. The goal is to release a new -rc kernel every week.
Process continues until the kernel is considered "ready", the process should last around 6 weeks.
It is worth mentioning what Andrew Morton wrote on the linux-kernel mailing list about kernel releases:
"Nobody knows when a kernel will be released, because it's released according to perceived bug status, not according to a preconceived timeline."
Various stable trees with multiple major numbers #
Kernels with 3-part versions are -stable kernels. They contain relatively small and critical fixes for security problems or significant regressions discovered in a given major mainline release. Each release in a major stable series increments the third part of the version number, keeping the first two parts the same.
This is the recommended branch for users who want the most recent stable kernel and are not interested in helping test development/experimental versions.
Stable trees are maintained by the "stable" team <stable@vger.kernel.org>, and are released as needs dictate. The normal release period is approximately two weeks, but it can be longer if there are no pressing problems. A security-related problem, instead, can cause a release to happen almost instantly.
The file Documentation/process/stable-kernel-rules.rst in the kernel tree documents what kinds of changes are acceptable for the -stable tree, and how the release process works.
Subsystem-specific trees #
The maintainers of the various kernel subsystems --- and also many kernel subsystem developers --- expose their current state of development in source repositories. That way, others can see what is happening in the different areas of the kernel. In areas where development is rapid, a developer may be asked to base his submissions onto such a subsystem kernel tree so that conflicts between the submission and other already ongoing work are avoided.
Most of these repositories are git trees, but there are also other SCMs in use, or patch queues being published as quilt series. Addresses of these subsystem repositories are listed in the MAINTAINERS file. Many of them can be browsed at https://git.kernel.org/.
Before a proposed patch is committed to such a subsystem tree, it is subject to review which primarily happens on mailing lists (see the respective section below). For several kernel subsystems, this review process is tracked with the tool patchwork. Patchwork offers a web interface which shows patch postings, any comments on a patch or revisions to it, and maintainers can mark patches as under review, accepted, or rejected. Most of these patchwork sites are listed at https://patchwork.kernel.org/.
linux-next integration testing tree #
Before updates from subsystem trees are merged into the mainline tree, they need to be integration-tested. For this purpose, a special testing repository exists into which virtually all subsystem trees are pulled on an almost daily basis:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
This way, the linux-next gives a summary outlook onto what will be expected to go into the mainline kernel at the next merge period. Adventurous testers are very welcome to runtime-test the linux-next.
Bug Reporting #
The file 'Documentation/admin-guide/reporting-issues.rst' in the main kernel source directory describes how to report a possible kernel bug, and details what kind of information is needed by the kernel developers to help track down the problem.
Managing bug reports #
One of the best ways to put into practice your hacking skills is by fixing bugs reported by other people. Not only will you help to make the kernel more stable, but you'll also learn to fix real-world problems and you will improve your skills, and other developers will be aware of your presence. Fixing bugs is one of the best ways to get merits among other developers, because not many people like wasting time fixing other people's bugs.
To work on already reported bug reports, find a subsystem you are interested in. Check the MAINTAINERS file where bugs for that subsystem get reported to; often it will be a mailing list, rarely a bugtracker. Search the archives of said place for recent reports and help where you see fit. You may also want to check https://bugzilla.kernel.org for bug reports; only a handful of kernel subsystems use it actively for reporting or tracking, nevertheless bugs for the whole kernel get filed there.
Mailing lists #
As some of the above documents describe, the majority of the core kernel developers participate on the Linux Kernel Mailing list. Details on how to subscribe and unsubscribe from the list can be found at:
There are archives of the mailing list on the web in many different places. Use a search engine to find these archives. For example:
It is highly recommended that you search the archives about the topic you want to bring up, before you post it to the list. A lot of things already discussed in detail are only recorded at the mailing list archives.
Most of the individual kernel subsystems also have their own separate mailing list where they do their development efforts. See the MAINTAINERS file for a list of what these lists are for the different groups.
Many of the lists are hosted on kernel.org. Information on them can be found at:
Please remember to follow good behavioral habits when using the lists. Though a bit cheesy, the following URL has some simple guidelines for interacting with the list (or any list):
If multiple people respond to your mail, the CC: list of recipients may get pretty large. Don't remove anybody from the CC: list without a good reason, or don't reply only to the list address. Get used to receiving the mail twice, one from the sender and the one from the list, and don't try to tune that by adding fancy mail-headers, people will not like it.
Remember to keep the context and the attribution of your replies intact, keep the "John Kernelhacker wrote ...:" lines at the top of your reply, and add your statements between the individual quoted sections instead of writing at the top of the mail.
If you add patches to your mail, make sure they are plain readable text as stated in Documentation/process/submitting-patches.rst. Kernel developers don't want to deal with attachments or compressed patches; they may want to comment on individual lines of your patch, which works only that way. Make sure you use a mail program that does not mangle spaces and tab characters. A good first test is to send the mail to yourself and try to apply your own patch by yourself. If that doesn't work, get your mail program fixed or change it until it works.
Above all, please remember to show respect to other subscribers.
Working with the community #
The goal of the kernel community is to provide the best possible kernel there is. When you submit a patch for acceptance, it will be reviewed on its technical merits and those alone. So, what should you be expecting?
criticism
comments
requests for change
requests for justification
silence
Remember, this is part of getting your patch into the kernel. You have to be able to take criticism and comments about your patches, evaluate them at a technical level and either rework your patches or provide clear and concise reasoning as to why those changes should not be made. If there are no responses to your posting, wait a few days and try again, sometimes things get lost in the huge volume.
What should you not do?
expect your patch to be accepted without question
become defensive
ignore comments
resubmit the patch without making any of the requested changes
In a community that is looking for the best technical solution possible, there will always be differing opinions on how beneficial a patch is. You have to be cooperative, and willing to adapt your idea to fit within the kernel. Or at least be willing to prove your idea is worth it. Remember, being wrong is acceptable as long as you are willing to work toward a solution that is right.
It is normal that the answers to your first patch might simply be a list of a dozen things you should correct. This does not imply that your patch will not be accepted, and it is not meant against you personally. Simply correct all issues raised against your patch and resend it.
Differences between the kernel community and corporate structures #
The kernel community works differently than most traditional corporate development environments. Here are a list of things that you can try to do to avoid problems:
Good things to say regarding your proposed changes:
"This solves multiple problems."
"This deletes 2000 lines of code."
"Here is a patch that explains what I am trying to describe."
"I tested it on 5 different architectures..."
"Here is a series of small patches that..."
"This increases performance on typical machines..."
Bad things you should avoid saying:
"We did it this way in AIX/ptx/Solaris, so therefore it must be good..."
"I've being doing this for 20 years, so..."
"This is required for my company to make money"
"This is for our Enterprise product line."
"Here is my 1000 page design document that describes my idea"
"I've been working on this for 6 months..."
"Here's a 5000 line patch that..."
"I rewrote all of the current mess, and here it is..."
"I have a deadline, and this patch needs to be applied now."
Another way the kernel community is different than most traditional software engineering work environments is the faceless nature of interaction. One benefit of using email and irc as the primary forms of communication is the lack of discrimination based on gender or race. The Linux kernel work environment is accepting of women and minorities because all you are is an email address. The international aspect also helps to level the playing field because you can't guess gender based on a person's name. A man may be named Andrea and a woman may be named Pat. Most women who have worked in the Linux kernel and have expressed an opinion have had positive experiences.
The language barrier can cause problems for some people who are not comfortable with English. A good grasp of the language can be needed in order to get ideas across properly on mailing lists, so it is recommended that you check your emails to make sure they make sense in English before sending them.
Break up your changes #
The Linux kernel community does not gladly accept large chunks of code dropped on it all at once. The changes need to be properly introduced, discussed, and broken up into tiny, individual portions. This is almost the exact opposite of what companies are used to doing. Your proposal should also be introduced very early in the development process, so that you can receive feedback on what you are doing. It also lets the community feel that you are working with them, and not simply using them as a dumping ground for your feature. However, don't send 50 emails at one time to a mailing list, your patch series should be smaller than that almost all of the time.
The reasons for breaking things up are the following:
-
Small patches increase the likelihood that your patches will be applied, since they don't take much time or effort to verify for correctness. A 5 line patch can be applied by a maintainer with barely a second glance. However, a 500 line patch may take hours to review for correctness (the time it takes is exponentially proportional to the size of the patch, or something).
Small patches also make it very easy to debug when something goes wrong. It's much easier to back out patches one by one than it is to dissect a very large patch after it's been applied (and broken something).
-
It's important not only to send small patches, but also to rewrite and simplify (or simply re-order) patches before submitting them.
Here is an analogy from kernel developer Al Viro:
"Think of a teacher grading homework from a math student. The teacher does not want to see the student's trials and errors before they came up with the solution. They want to see the cleanest, most elegant answer. A good student knows this, and would never submit her intermediate work before the final solution.
The same is true of kernel development. The maintainers and reviewers do not want to see the thought process behind the solution to the problem one is solving. They want to see a simple and elegant solution."
It may be challenging to keep the balance between presenting an elegant solution and working together with the community and discussing your unfinished work. Therefore it is good to get early in the process to get feedback to improve your work, but also keep your changes in small chunks that they may get already accepted, even when your whole task is not ready for inclusion now.
Also realize that it is not acceptable to send patches for inclusion that are unfinished and will be "fixed up later."
Justify your change #
Along with breaking up your patches, it is very important for you to let the Linux community know why they should add this change. New features must be justified as being needed and useful.
Document your change #
When sending in your patches, pay special attention to what you say in the text in your email. This information will become the ChangeLog information for the patch, and will be preserved for everyone to see for all time. It should describe the patch completely, containing:
why the change is necessary
the overall design approach in the patch
implementation details
testing results
For more details on what this should all look like, please see the ChangeLog section of the document:
"The Perfect Patch"
All of these things are sometimes very hard to do. It can take years to perfect these practices (if at all). It's a continuous process of improvement that requires a lot of patience and determination. But don't give up, it's possible. Many have done it before, and each had to start exactly where you are now.
Thanks to Paolo Ciarrocchi who allowed the "Development Process" (https://lwn.net/Articles/94386/) section to be based on text he had written, and to Randy Dunlap and Gerrit Huizenga for some of the list of things you should and should not say. Also thanks to Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers, Vojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi Kleen, Vadim Lobanov, Jesper Juhl, Adrian Bunk, Keri Harris, Frans Pop, David A. Wheeler, Junio Hamano, Michael Kerrisk, and Alex Shepard for their review, comments, and contributions. Without their help, this document would not have been possible.
Maintainer: Greg Kroah-Hartman <greg@kroah.com>
Index of Further Kernel Documentation
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The need for a document like this one became apparent in the linux-kernel mailing list as the same questions, asking for pointers to information, appeared again and again.
Fortunately, as more and more people get to GNU/Linux, more and more get interested in the Kernel. But reading the sources is not always enough. It is easy to understand the code, but miss the concepts, the philosophy and design decisions behind this code.
Unfortunately, not many documents are available for beginners to start. And, even if they exist, there was no "well-known" place which kept track of them. These lines try to cover this lack.
PLEASE, if you know any paper not listed here or write a new document, include a reference to it here, following the kernel's patch submission process. Any corrections, ideas or comments are also welcome.
All documents are cataloged with the following fields: the document's "Title", the "Author"/s, the "URL" where they can be found, some "Keywords" helpful when searching for specific topics, and a brief "Description" of the Document.
Docs at the Linux Kernel tree #
The Sphinx books should be built with make {htmldocs | pdfdocs | epubdocs}.
Name: linux/Documentation
Author: Many.
Location: Documentation/
Keywords: text files, Sphinx.
Description: Documentation that comes with the kernel sources, inside the Documentation directory. Some pages from this document (including this document itself) have been moved there, and might be more up to date than the web version.
On-line docs #
Title: Linux Kernel Mailing List Glossary
Author: various
URL: https://kernelnewbies.org/KernelGlossary
Date: rolling version
Keywords: glossary, terms, linux-kernel.
Description: From the introduction: "This glossary is intended as a brief description of some of the acronyms and terms you may hear during discussion of the Linux kernel".
Title: The Linux Kernel Module Programming Guide
Author: Peter Jay Salzman, Michael Burian, Ori Pomerantz, Bob Mottram, Jim Huang.
URL: https://sysprog21.github.io/lkmpg/
Date: 2021
Keywords: modules, GPL book, /proc, ioctls, system calls, interrupt handlers .
Description: A very nice GPL book on the topic of modules programming. Lots of examples. Currently the new version is being actively maintained at https://github.com/sysprog21/lkmpg.
Published books #
Title: The Linux Memory Manager
Author: Lorenzo Stoakes
Publisher: No Starch Press
Date: February 2025
Pages: 1300
ISBN: 978-1718504462
Notes: Memory management. Full draft available as early access for pre-order, full release scheduled for Fall 2025. See https://nostarch.com/linux-memory-manager for further info.
Title: Practical Linux System Administration: A Guide to Installation, Configuration, and Management, 1st Edition
Author: Kenneth Hess
Publisher: O'Reilly Media
Date: May, 2023
Pages: 246
ISBN: 978-1098109035
Notes: System administration
Title: Linux Kernel Debugging: Leverage proven tools and advanced techniques to effectively debug Linux kernels and kernel modules
Author: Kaiwan N Billimoria
Publisher: Packt Publishing Ltd
Date: August, 2022
Pages: 638
ISBN: 978-1801075039
Notes: Debugging book
Title: Linux Kernel Programming: A Comprehensive Guide to Kernel Internals, Writing Kernel Modules, and Kernel Synchronization
Author: Kaiwan N Billimoria
Publisher: Packt Publishing Ltd
Date: March, 2021 (Second Edition published in 2024)
Pages: 754
ISBN: 978-1789953435 (Second Edition ISBN is 978-1803232225)
Title: Linux Kernel Programming Part 2 - Char Device Drivers and Kernel Synchronization: Create user-kernel interfaces, work with peripheral I/O, and handle hardware interrupts
Author: Kaiwan N Billimoria
Publisher: Packt Publishing Ltd
Date: March, 2021
Pages: 452
ISBN: 978-1801079518
Title: Linux System Programming: Talking Directly to the Kernel and C Library
Author: Robert Love
Publisher: O'Reilly Media
Date: June, 2013
Pages: 456
ISBN: 978-1449339531
Notes: Foundational book
Title: Linux Kernel Development, 3rd Edition
Author: Robert Love
Publisher: Addison-Wesley
Date: July, 2010
Pages: 440
ISBN: 978-0672329463
Notes: Foundational book
Title: Linux Device Drivers, 3rd Edition
Authors: Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman
Publisher: O'Reilly & Associates
Date: 2005
Pages: 636
ISBN: 0-596-00590-3
Notes: Foundational book. Further information in http://www.oreilly.com/catalog/linuxdrive3/ PDF format, URL: https://lwn.net/Kernel/LDD3/
Title: The Design of the UNIX Operating System
Author: Maurice J. Bach
Publisher: Prentice Hall
Date: 1986
Pages: 471
ISBN: 0-13-201757-1
Notes: Foundational book
Miscellaneous #
Name: Cross-Referencing Linux
URL: https://elixir.bootlin.com/
Keywords: Browsing source code.
Description: Another web-based Linux kernel source code browser. Lots of cross references to variables and functions. You can see where they are defined and where they are used.
Name: Linux Weekly News
URL: https://lwn.net
Keywords: latest kernel news.
Description: The title says it all. There's a fixed kernel section summarizing developers' work, bug fixes, new features and versions produced during the week.
Name: The home page of Linux-MM
Author: The Linux-MM team.
Keywords: memory management, Linux-MM, mm patches, TODO, docs, mailing list.
Description: Site devoted to Linux Memory Management development. Memory related patches, HOWTOs, links, mm developers... Don't miss it if you are interested in memory management development!
Name: Kernel Newbies IRC Channel and Website
URL: https://www.kernelnewbies.org
Keywords: IRC, newbies, channel, asking doubts.
Description: #kernelnewbies on irc.oftc.net. #kernelnewbies is an IRC network dedicated to the 'newbie' kernel hacker. The audience mostly consists of people who are learning about the kernel, working on kernel projects or professional kernel hackers that want to help less seasoned kernel people. #kernelnewbies is on the OFTC IRC Network. Try irc.oftc.net as your server and then /join #kernelnewbies. The kernelnewbies website also hosts articles, documents, FAQs...
Name: linux-kernel mailing list archives and search engines
URL: https://subspace.kernel.org
Keywords: linux-kernel, archives, search.
Description: Some of the linux-kernel mailing list archivers. If you have a better/another one, please let me know.
Name: The Linux Foundation YouTube channel
URL: https://www.youtube.com/user/thelinuxfoundation
Keywords: linux, videos, linux-foundation, youtube.
Description: The Linux Foundation uploads video recordings of their collaborative events, Linux conferences including LinuxCon, and other original research and content related to Linux and software development.
Rust #
Title: Rust for Linux
Author: various
URL: https://rust-for-linux.com/
Date: rolling version
Keywords: glossary, terms, linux-kernel, rust.
Description: From the website: "Rust for Linux is the project adding support for the Rust language to the Linux kernel. This website is intended as a hub of links, documentation and resources related to the project".
Title: Learn Rust the Dangerous Way
Author: Cliff L. Biffle
URL: https://cliffle.com/p/dangerust/
Date: Accessed Sep 11 2024
Keywords: rust, blog.
Description: From the website: "LRtDW is a series of articles putting Rust features in context for low-level C programmers who maybe don’t have a formal CS background — the sort of people who work on firmware, game engines, OS kernels, and the like. Basically, people like me.". It illustrates line-by-line conversions from C to Rust.
Title: The Rust Book
Author: Steve Klabnik and Carol Nichols, with contributions from the Rust community
URL: https://doc.rust-lang.org/book/
Date: Accessed Sep 11 2024
Keywords: rust, book.
Description: From the website: "This book fully embraces the potential of Rust to empower its users. It’s a friendly and approachable text intended to help you level up not just your knowledge of Rust, but also your reach and confidence as a programmer in general. So dive in, get ready to learn—and welcome to the Rust community!".
Title: Rust for the Polyglot Programmer
Author: Ian Jackson
URL: https://www.chiark.greenend.org.uk/~ianmdlvl/rust-polyglot/index.html
Date: December 2022
Keywords: rust, blog, tooling.
Description: From the website: "There are many guides and introductions to Rust. This one is something different: it is intended for the experienced programmer who already knows many other programming languages. I try to be comprehensive enough to be a starting point for any area of Rust, but to avoid going into too much detail except where things are not as you might expect. Also this guide is not entirely free of opinion, including recommendations of libraries (crates), tooling, etc.".
Title: Fasterthanli.me
Author: Amos Wenger
Date: Accessed Sep 11 2024
Keywords: rust, blog, news.
Description: From the website: "I make articles and videos about how computers work. My content is long-form, didactic and exploratory — and often an excuse to teach Rust!".
Title: Comprehensive Rust
Author: Android team at Google
URL: https://google.github.io/comprehensive-rust/
Date: Accessed Sep 13 2024
Keywords: rust, blog.
Description: From the website: "The course covers the full spectrum of Rust, from basic syntax to advanced topics like generics and error handling".
Title: The Embedded Rust Book
Author: Multiple contributors, mostly Jorge Aparicio
URL: https://docs.rust-embedded.org/book/
Date: Accessed Sep 13 2024
Keywords: rust, blog.
Description: From the website: "An introductory book about using the Rust Programming Language on "Bare Metal" embedded systems, such as Microcontrollers".
Title: Experiment: Improving the Rust Book
Author: Cognitive Engineering Lab at Brown University
URL: https://rust-book.cs.brown.edu/
Date: Accessed Sep 22 2024
Keywords: rust, blog.
Description: From the website: "The goal of this experiment is to evaluate and improve the content of the Rust Book to help people learn Rust more effectively.".
Title: New Rustacean (podcast)
Author: Chris Krycho
URL: https://newrustacean.com/
Date: Accessed Sep 22 2024
Keywords: rust, podcast.
Description: From the website: "This is a podcast about learning the programming language Rust—from scratch! Apart from this spiffy landing page, all the site content is built with Rust's own documentation tools.".
Title: Opsem-team (repository)
Author: Operational semantics team
URL: https://github.com/rust-lang/opsem-team/tree/main
Date: Accessed Sep 22 2024
Keywords: rust, repository.
Description: From the README: "The opsem team is the successor of the unsafe-code-guidelines working group and responsible for answering many of the difficult questions about the semantics of unsafe Rust".
Title: You Can't Spell Trust Without Rust
Author: Alexis Beingessner
URL: https://repository.library.carleton.ca/downloads/1j92g820w?locale=en
Date: 2015
Keywords: rust, master, thesis.
Description: This thesis focuses on Rust's ownership system, which ensures memory safety by controlling data manipulation and lifetime, while also highlighting its limitations and comparing it to similar systems in Cyclone and C++.
Name: Linux Plumbers (LPC) 2024 Rust presentations
Title: Rust microconference
URL: https://lpc.events/event/18/sessions/186/#20240918
Title: Rust for Linux
URL: https://lpc.events/event/18/contributions/1912/
Title: Journey of a C kernel engineer starting a Rust driver project
URL: https://lpc.events/event/18/contributions/1911/
Title: Crafting a Linux kernel scheduler that runs in user-space using Rust
URL: https://lpc.events/event/18/contributions/1723/
Title: openHCL: A Linux and Rust based paravisor
URL: https://lpc.events/event/18/contributions/1956/
Keywords: rust, lpc, presentations.
Description: A number of LPC talks related to Rust.
Name: The Rustacean Station Podcast
URL: https://rustacean-station.org/
Keywords: rust, podcasts.
Description: A community project for creating podcast content for the Rust programming language.
This document was originally based on:
https://www.dit.upm.es/~jmseyas/linux/kernel/hackers-docs.html
and written by Juan-Mariano de Goyeneche
Kernel Driver Statement
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Position Statement on Linux Kernel Modules #
We, the undersigned Linux kernel developers, consider any closed-source Linux kernel module or driver to be harmful and undesirable. We have repeatedly found them to be detrimental to Linux users, businesses, and the greater Linux ecosystem. Such modules negate the openness, stability, flexibility, and maintainability of the Linux development model and shut their users off from the expertise of the Linux community. Vendors that provide closed-source kernel modules force their customers to give up key Linux advantages or choose new vendors. Therefore, in order to take full advantage of the cost savings and shared support benefits open source has to offer, we urge vendors to adopt a policy of supporting their customers on Linux with open-source kernel code.
We speak only for ourselves, and not for any company we might work for today, have in the past, or will in the future.
Dave Airlie
Nick Andrew
Jens Axboe
Ralf Baechle
Felipe Balbi
Ohad Ben-Cohen
Muli Ben-Yehuda
Jiri Benc
Arnd Bergmann
Thomas Bogendoerfer
Vitaly Bordug
James Bottomley
Josh Boyer
Neil Brown
Mark Brown
David Brownell
Michael Buesch
Franck Bui-Huu
Adrian Bunk
François Cami
Ralph Campbell
Luiz Fernando N. Capitulino
Mauro Carvalho Chehab
Denis Cheng
Jonathan Corbet
Glauber Costa
Alan Cox
Magnus Damm
Ahmed S. Darwish
Robert P. J. Day
Hans de Goede
Arnaldo Carvalho de Melo
Helge Deller
Jean Delvare
Mathieu Desnoyers
Sven-Thorsten Dietrich
Alexey Dobriyan
Daniel Drake
Alex Dubov
Randy Dunlap
Michael Ellerman
Pekka Enberg
Jan Engelhardt
Mark Fasheh
- J. Bruce Fields
Larry Finger
Jeremy Fitzhardinge
Mike Frysinger
Kumar Gala
Robin Getz
Liam Girdwood
Jan-Benedict Glaw
Thomas Gleixner
Brice Goglin
Cyrill Gorcunov
Andy Gospodarek
Thomas Graf
Krzysztof Halasa
Harvey Harrison
Stephen Hemminger
Michael Hennerich
Tejun Heo
Benjamin Herrenschmidt
Kristian Høgsberg
Henrique de Moraes Holschuh
Marcel Holtmann
Mike Isely
Takashi Iwai
Olof Johansson
Dave Jones
Jesper Juhl
Matthias Kaehlcke
Kenji Kaneshige
Jan Kara
Jeremy Kerr
Russell King
Olaf Kirch
Roel Kluin
Hans-Jürgen Koch
Auke Kok
Peter Korsgaard
Jiri Kosina
Aaro Koskinen
Mariusz Kozlowski
Greg Kroah-Hartman
Michael Krufky
Aneesh Kumar
Clemens Ladisch
Christoph Lameter
Gunnar Larisch
Anders Larsen
Grant Likely
John W. Linville
Yinghai Lu
Tony Luck
Pavel Machek
Matt Mackall
Paul Mackerras
Roland McGrath
Patrick McHardy
Kyle McMartin
Paul Menage
Thierry Merle
Eric Miao
Akinobu Mita
Ingo Molnar
James Morris
Andrew Morton
Paul Mundt
Oleg Nesterov
Luca Olivetti
S.Çağlar Onur
Pierre Ossman
Keith Owens
Venkatesh Pallipadi
Nick Piggin
Nicolas Pitre
Evgeniy Polyakov
Richard Purdie
Mike Rapoport
Sam Ravnborg
Gerrit Renker
Stefan Richter
David Rientjes
Luis R. Rodriguez
Stefan Roese
Francois Romieu
Rami Rosen
Stephen Rothwell
Maciej W. Rozycki
Mark Salyzyn
Yoshinori Sato
Deepak Saxena
Holger Schurig
Amit Shah
Yoshihiro Shimoda
Sergei Shtylyov
Kay Sievers
Sebastian Siewior
Rik Snel
Jes Sorensen
Alexey Starikovskiy
Alan Stern
Timur Tabi
Hirokazu Takata
Eliezer Tamir
Eugene Teo
Doug Thompson
FUJITA Tomonori
Dmitry Torokhov
Marcelo Tosatti
Steven Toth
Theodore Tso
Matthias Urlichs
Geert Uytterhoeven
Arjan van de Ven
Ivo van Doorn
Rik van Riel
Wim Van Sebroeck
Hans Verkuil
Horst H. von Brand
Dmitri Vorobiev
Anton Vorontsov
Daniel Walker
Johannes Weiner
Harald Welte
Matthew Wilcox
Dan J. Williams
Darrick J. Wong
David Woodhouse
Chris Wright
Bryan Wu
Rafael J. Wysocki
Herbert Xu
Vlad Yasevich
Peter Zijlstra
Bartlomiej Zolnierkiewicz
Linux Kernel Enforcement Statement
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
As developers of the Linux kernel, we have a keen interest in how our software is used and how the license for our software is enforced. Compliance with the reciprocal sharing obligations of GPL-2.0 is critical to the long-term sustainability of our software and community.
Although there is a right to enforce the separate copyright interests in the contributions made to our community, we share an interest in ensuring that individual enforcement actions are conducted in a manner that benefits our community and do not have an unintended negative impact on the health and growth of our software ecosystem. In order to deter unhelpful enforcement actions, we agree that it is in the best interests of our development community to undertake the following commitment to users of the Linux kernel on behalf of ourselves and any successors to our copyright interests:
Notwithstanding the termination provisions of the GPL-2.0, we agree that it is in the best interests of our development community to adopt the following provisions of GPL-3.0 as additional permissions under our license with respect to any non-defensive assertion of rights under the license.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Our intent in providing these assurances is to encourage more use of the software. We want companies and individuals to use, modify and distribute this software. We want to work with users in an open and transparent way to eliminate any uncertainty about our expectations regarding compliance or enforcement that might limit adoption of our software. We view legal action as a last resort, to be initiated only when other community efforts have failed to resolve the problem.
Finally, once a non-compliance issue is resolved, we hope the user will feel welcome to join us in our efforts on this project. Working together, we will be stronger.
Except where noted below, we speak only for ourselves, and not for any company we might work for today, have in the past, or will in the future.
Laura Abbott
Bjorn Andersson (Linaro)
Andrea Arcangeli
Neil Armstrong
Jens Axboe
Pablo Neira Ayuso
Khalid Aziz
Ralf Baechle
Felipe Balbi
Arnd Bergmann
Ard Biesheuvel
Tim Bird
Paolo Bonzini
Christian Borntraeger
Mark Brown (Linaro)
Paul Burton
Javier Martinez Canillas
Rob Clark
Kees Cook (Google)
Jonathan Corbet
Dennis Dalessandro
Vivien Didelot (Savoir-faire Linux)
Hans de Goede
Mel Gorman (SUSE)
Sven Eckelmann
Alex Elder (Linaro)
Fabio Estevam
Larry Finger
Bhumika Goyal
Andy Gross
Juergen Gross
Shawn Guo
Ulf Hansson
Stephen Hemminger (Microsoft)
Tejun Heo
Rob Herring
Masami Hiramatsu
Michal Hocko
Simon Horman
Johan Hovold (Hovold Consulting AB)
Christophe JAILLET
Olof Johansson
Lee Jones (Linaro)
Heiner Kallweit
Srinivas Kandagatla
Jan Kara
Shuah Khan (Samsung)
David Kershner
Jaegeuk Kim
Namhyung Kim
Colin Ian King
Jeff Kirsher
Greg Kroah-Hartman (Linux Foundation)
Christian König
Vinod Koul
Krzysztof Kozlowski
Viresh Kumar
Aneesh Kumar K.V
Julia Lawall
Doug Ledford
Chuck Lever (Oracle)
Daniel Lezcano
Shaohua Li
Xin Long
Tony Luck
Catalin Marinas (Arm Ltd)
Mike Marshall
Chris Mason
Paul E. McKenney
Arnaldo Carvalho de Melo
David S. Miller
Ingo Molnar
Kuninori Morimoto
Trond Myklebust
Martin K. Petersen (Oracle)
Borislav Petkov
Jiri Pirko
Josh Poimboeuf
Sebastian Reichel (Collabora)
Guenter Roeck
Joerg Roedel
Leon Romanovsky
Steven Rostedt (VMware)
Frank Rowand
Ivan Safonov
Anna Schumaker
Jes Sorensen
K.Y. Srinivasan
David Sterba (SUSE)
Heiko Stuebner
Jiri Kosina (SUSE)
Willy Tarreau
Dmitry Torokhov
Linus Torvalds
Thierry Reding
Rik van Riel
Luis R. Rodriguez
Geert Uytterhoeven (Glider bvba)
Eduardo Valentin (Amazon.com)
Daniel Vetter
Linus Walleij
Richard Weinberger
Dan Williams
Rafael J. Wysocki
Arvind Yadav
Masahiro Yamada
Wei Yongjun
Lv Zheng
Marc Zyngier (Arm Ltd)
Linux kernel licensing rules
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The Linux Kernel is provided under the terms of the GNU General Public License version 2 only (GPL-2.0), as provided in LICENSES/preferred/GPL-2.0, with an explicit syscall exception described in LICENSES/exceptions/Linux-syscall-note, as described in the COPYING file.
This documentation file provides a description of how each source file should be annotated to make its license clear and unambiguous. It doesn't replace the Kernel's license.
The license described in the COPYING file applies to the kernel source as a whole, though individual source files can have a different license which is required to be compatible with the GPL-2.0:
GPL-1.0+ : GNU General Public License v1.0 or later
GPL-2.0+ : GNU General Public License v2.0 or later
LGPL-2.0 : GNU Library General Public License v2 only
LGPL-2.0+ : GNU Library General Public License v2 or later
LGPL-2.1 : GNU Lesser General Public License v2.1 only
LGPL-2.1+ : GNU Lesser General Public License v2.1 or later
Aside from that, individual files can be provided under a dual license, e.g. one of the compatible GPL variants and alternatively under a permissive license like BSD, MIT etc.
The User-space API (UAPI) header files, which describe the interface of user-space programs to the kernel are a special case. According to the note in the kernel COPYING file, the syscall interface is a clear boundary, which does not extend the GPL requirements to any software which uses it to communicate with the kernel. Because the UAPI headers must be includable into any source files which create an executable running on the Linux kernel, the exception must be documented by a special license expression.
The common way of expressing the license of a source file is to add the matching boilerplate text into the top comment of the file. Due to formatting, typos etc. these "boilerplates" are hard to validate for tools which are used in the context of license compliance.
An alternative to boilerplate text is the use of Software Package Data Exchange (SPDX) license identifiers in each source file. SPDX license identifiers are machine parsable and precise shorthands for the license under which the content of the file is contributed. SPDX license identifiers are managed by the SPDX Workgroup at the Linux Foundation and have been agreed on by partners throughout the industry, tool vendors, and legal teams. For further information see https://spdx.org/
The Linux kernel requires the precise SPDX identifier in all source files. The valid identifiers used in the kernel are explained in the section License identifiers and have been retrieved from the official SPDX license list at https://spdx.org/licenses/ along with the license texts.
License identifier syntax #
-
Placement:
The SPDX license identifier in kernel files shall be added at the first possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX identifier goes into the second line.
-
Style:
The SPDX license identifier is added in form of a comment. The comment style depends on the file type:
C source: // SPDX-License-Identifier: <SPDX License Expression> C header: /* SPDX-License-Identifier: <SPDX License Expression> */ ASM: /* SPDX-License-Identifier: <SPDX License Expression> */ scripts: # SPDX-License-Identifier: <SPDX License Expression> .rst: .. SPDX-License-Identifier: <SPDX License Expression> .dts{i}: // SPDX-License-Identifier: <SPDX License Expression>If a specific tool cannot handle the standard comment style, then the appropriate comment mechanism which the tool accepts shall be used. This is the reason for having the "/* */" style comment in C header files. There was build breakage observed with generated .lds files where 'ld' failed to parse the C++ comment. This has been fixed by now, but there are still older assembler tools which cannot handle C++ style comments.
-
Syntax:
A <SPDX License Expression> is either an SPDX short form license identifier found on the SPDX License List, or the combination of two SPDX short form license identifiers separated by "WITH" when a license exception applies. When multiple licenses apply, an expression consists of keywords "AND", "OR" separating sub-expressions and surrounded by "(", ")" .
License identifiers for licenses like [L]GPL with the 'or later' option are constructed by using a "+" for indicating the 'or later' option.:
// SPDX-License-Identifier: GPL-2.0+ // SPDX-License-Identifier: LGPL-2.1+WITH should be used when there is a modifier to a license needed. For example, the linux kernel UAPI files use the expression:
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-noteOther examples using WITH exceptions found in the kernel are:
// SPDX-License-Identifier: GPL-2.0 WITH mif-exception // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0Exceptions can only be used with particular License identifiers. The valid License identifiers are listed in the tags of the exception text file. For details see the point Exceptions in the chapter License identifiers.
OR should be used if the file is dual licensed and only one license is to be selected. For example, some dtsi files are available under dual licenses:
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-ClauseExamples from the kernel for license expressions in dual licensed files:
// SPDX-License-Identifier: GPL-2.0 OR MIT // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSLAND should be used if the file has multiple licenses whose terms all apply to use the file. For example, if code is inherited from another project and permission has been given to put it in the kernel, but the original license terms need to remain in effect:
// SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MITAnother other example where both sets of license terms need to be adhered to is:
// SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+
License identifiers #
The licenses currently used, as well as the licenses for code added to the kernel, can be broken down into:
-
Whenever possible these licenses should be used as they are known to be fully compatible and widely used. These licenses are available from the directory:
LICENSES/preferred/in the kernel source tree.
The files in this directory contain the full license text and Metatags. The file names are identical to the SPDX license identifier which shall be used for the license in source files.
Examples:
LICENSES/preferred/GPL-2.0Contains the GPL version 2 license text and the required metatags:
LICENSES/preferred/MITContains the MIT license text and the required metatags
The following meta tags must be available in a license file:
-
Valid-License-Identifier:
One or more lines which declare which License Identifiers are valid inside the project to reference this particular license text. Usually this is a single valid identifier, but e.g. for licenses with the 'or later' options two identifiers are valid.
-
SPDX-URL:
The URL of the SPDX page which contains additional information related to the license.
-
Usage-Guidance:
Freeform text for usage advice. The text must include correct examples for the SPDX license identifiers as they should be put into source files according to the License identifier syntax guidelines.
-
License-Text:
All text after this tag is treated as the original license text
File format examples:
Valid-License-Identifier: GPL-2.0 Valid-License-Identifier: GPL-2.0+ SPDX-URL: https://spdx.org/licenses/GPL-2.0.html Usage-Guide: To use this license in source code, put one of the following SPDX tag/value pairs into a comment according to the placement guidelines in the licensing rules documentation. For 'GNU General Public License (GPL) version 2 only' use: SPDX-License-Identifier: GPL-2.0 For 'GNU General Public License (GPL) version 2 or any later version' use: SPDX-License-Identifier: GPL-2.0+ License-Text: Full license textSPDX-License-Identifier: MIT SPDX-URL: https://spdx.org/licenses/MIT.html Usage-Guide: To use this license in source code, put the following SPDX tag/value pair into a comment according to the placement guidelines in the licensing rules documentation. SPDX-License-Identifier: MIT License-Text: Full license text -
-
Deprecated licenses:
These licenses should only be used for existing code or for importing code from a different project. These licenses are available from the directory:
LICENSES/deprecated/in the kernel source tree.
The files in this directory contain the full license text and Metatags. The file names are identical to the SPDX license identifier which shall be used for the license in source files.
Examples:
LICENSES/deprecated/ISCContains the Internet Systems Consortium license text and the required metatags:
LICENSES/deprecated/GPL-1.0Contains the GPL version 1 license text and the required metatags.
Metatags:
The metatag requirements for 'other' licenses are identical to the requirements of the Preferred licenses.
File format example:
Valid-License-Identifier: ISC SPDX-URL: https://spdx.org/licenses/ISC.html Usage-Guide: Usage of this license in the kernel for new code is discouraged and it should solely be used for importing code from an already existing project. To use this license in source code, put the following SPDX tag/value pair into a comment according to the placement guidelines in the licensing rules documentation. SPDX-License-Identifier: ISC License-Text: Full license text -
Dual Licensing Only
These licenses should only be used to dual license code with another license in addition to a preferred license. These licenses are available from the directory:
LICENSES/dual/in the kernel source tree.
The files in this directory contain the full license text and Metatags. The file names are identical to the SPDX license identifier which shall be used for the license in source files.
Examples:
LICENSES/dual/MPL-1.1Contains the Mozilla Public License version 1.1 license text and the required metatags:
LICENSES/dual/Apache-2.0Contains the Apache License version 2.0 license text and the required metatags.
Metatags:
The metatag requirements for 'other' licenses are identical to the requirements of the Preferred licenses.
File format example:
Valid-License-Identifier: MPL-1.1 SPDX-URL: https://spdx.org/licenses/MPL-1.1.html Usage-Guide: Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for dual-licensed files where the other license is GPL2 compatible. If you end up using this it MUST be used together with a GPL2 compatible license using "OR". To use the Mozilla Public License version 1.1 put the following SPDX tag/value pair into a comment according to the placement guidelines in the licensing rules documentation: SPDX-License-Identifier: MPL-1.1 License-Text: Full license text -
Some licenses can be amended with exceptions which grant certain rights which the original license does not. These exceptions are available from the directory:
LICENSES/exceptions/in the kernel source tree. The files in this directory contain the full exception text and the required Exception Metatags.
Examples:
LICENSES/exceptions/Linux-syscall-noteContains the Linux syscall exception as documented in the COPYING file of the Linux kernel, which is used for UAPI header files. e.g. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */:
LICENSES/exceptions/GCC-exception-2.0Contains the GCC 'linking exception' which allows to link any binary independent of its license against the compiled version of a file marked with this exception. This is required for creating runnable executables from source code which is not compatible with the GPL.
The following meta tags must be available in an exception file:
-
SPDX-Exception-Identifier:
One exception identifier which can be used with SPDX license identifiers.
-
SPDX-URL:
The URL of the SPDX page which contains additional information related to the exception.
-
SPDX-Licenses:
A comma separated list of SPDX license identifiers for which the exception can be used.
-
Usage-Guidance:
Freeform text for usage advice. The text must be followed by correct examples for the SPDX license identifiers as they should be put into source files according to the License identifier syntax guidelines.
-
Exception-Text:
All text after this tag is treated as the original exception text
File format examples:
SPDX-Exception-Identifier: Linux-syscall-note SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+ Usage-Guidance: This exception is used together with one of the above SPDX-Licenses to mark user-space API (uapi) header files so they can be included into non GPL compliant user-space application code. To use this exception add it with the keyword WITH to one of the identifiers in the SPDX-Licenses tag: SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note Exception-Text: Full exception textSPDX-Exception-Identifier: GCC-exception-2.0 SPDX-URL: https://spdx.org/licenses/GCC-exception-2.0.html SPDX-Licenses: GPL-2.0, GPL-2.0+ Usage-Guidance: The "GCC Runtime Library exception 2.0" is used together with one of the above SPDX-Licenses for code imported from the GCC runtime library. To use this exception add it with the keyword WITH to one of the identifiers in the SPDX-Licenses tag: SPDX-License-Identifier: <SPDX-License> WITH GCC-exception-2.0 Exception-Text: Full exception text -
All SPDX license identifiers and exceptions must have a corresponding file in the LICENSES subdirectories. This is required to allow tool verification (e.g. checkpatch.pl) and to have the licenses ready to read and extract right from the source, which is recommended by various FOSS organizations, e.g. the FSFE REUSE initiative.
MODULE_LICENSE #
Loadable kernel modules also require a MODULE_LICENSE() tag. This tag is neither a replacement for proper source code license information (SPDX-License-Identifier) nor in any way relevant for expressing or determining the exact license under which the source code of the module is provided.
The sole purpose of this tag is to provide sufficient information whether the module is free software or proprietary for the kernel module loader and for user space tools.
The valid license strings for MODULE_LICENSE() are:
"GPL"
Module is licensed under GPL version 2. This does not express any distinction between GPL-2.0-only or GPL-2.0-or-later. The exact license information can only be determined via the license information in the corresponding source files.
"GPL v2"
Same as "GPL". It exists for historic reasons.
"GPL and additional rights"
Historical variant of expressing that the module source is dual licensed under a GPL v2 variant and MIT license. Please do not use in new code.
"Dual MIT/GPL"
The correct way of expressing that the module is dual licensed under a GPL v2 variant or MIT license choice.
"Dual BSD/GPL"
The module is dual licensed under a GPL v2 variant or BSD license choice. The exact variant of the BSD license can only be determined via the license information in the corresponding source files.
"Dual MPL/GPL"
The module is dual licensed under a GPL v2 variant or Mozilla Public License (MPL) choice. The exact variant of the MPL license can only be determined via the license information in the corresponding source files.
"Proprietary"
The module is under a proprietary license. "Proprietary" is to be understood only as "The license is not compatible to GPLv2". This string is solely for non-GPL2 compatible third party modules and cannot be used for modules which have their source code in the kernel tree. Modules tagged that way are tainting the kernel with the 'P' flag when loaded and the kernel module loader refuses to link such modules against symbols which are exported with EXPORT_SYMBOL_GPL().
Subsystem and maintainer tree specific development process notes
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The purpose of this document is to provide subsystem specific information which is supplementary to the general development process handbook Documentation/process.
Contents:
KVM x86
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Foreword #
KVM strives to be a welcoming community; contributions from newcomers are valued and encouraged. Please do not be discouraged or intimidated by the length of this document and the many rules/guidelines it contains. Everyone makes mistakes, and everyone was a newbie at some point. So long as you make an honest effort to follow KVM x86's guidelines, are receptive to feedback, and learn from any mistakes you make, you will be welcomed with open arms, not torches and pitchforks.
TL;DR #
Testing is mandatory. Be consistent with established styles and patterns.
Trees #
KVM x86 is currently in a transition period from being part of the main KVM tree, to being "just another KVM arch". As such, KVM x86 is split across the main KVM tree, git.kernel.org/pub/scm/virt/kvm/kvm.git, and a KVM x86 specific tree, github.com/kvm-x86/linux.git.
Generally speaking, fixes for the current cycle are applied directly to the main KVM tree, while all development for the next cycle is routed through the KVM x86 tree. In the unlikely event that a fix for the current cycle is routed through the KVM x86 tree, it will be applied to the fixes branch before making its way to the main KVM tree.
Note, this transition period is expected to last quite some time, i.e. will be the status quo for the foreseeable future.
Branches #
The KVM x86 tree is organized into multiple topic branches. The purpose of using finer-grained topic branches is to make it easier to keep tabs on an area of development, and to limit the collateral damage of human errors and/or buggy commits, e.g. dropping the HEAD commit of a topic branch has no impact on other in-flight commits' SHA1 hashes, and having to reject a pull request due to bugs delays only that topic branch.
All topic branches, except for next and fixes, are rolled into next via a Cthulhu merge on an as-needed basis, i.e. when a topic branch is updated. As a result, force pushes to next are common.
Lifecycle #
Fixes that target the current release, a.k.a. mainline, are typically applied directly to the main KVM tree, i.e. do not route through the KVM x86 tree.
Changes that target the next release are routed through the KVM x86 tree. Pull requests (from KVM x86 to main KVM) are sent for each KVM x86 topic branch, typically the week before Linus' opening of the merge window, e.g. the week following rc7 for "normal" releases. If all goes well, the topic branches are rolled into the main KVM pull request sent during Linus' merge window.
The KVM x86 tree doesn't have its own official merge window, but there's a soft close around rc5 for new features, and a soft close around rc6 for fixes (for the next release; see above for fixes that target the current release).
Timeline #
Submissions are typically reviewed and applied in FIFO order, with some wiggle room for the size of a series, patches that are "cache hot", etc. Fixes, especially for the current release and or stable trees, get to jump the queue. Patches that will be taken through a non-KVM tree (most often through the tip tree) and/or have other acks/reviews also jump the queue to some extent.
Note, the vast majority of review is done between rc1 and rc6, give or take. The period between rc6 and the next rc1 is used to catch up on other tasks, i.e. radio silence during this period isn't unusual.
Pings to get a status update are welcome, but keep in mind the timing of the current release cycle and have realistic expectations. If you are pinging for acceptance, i.e. not just for feedback or an update, please do everything you can, within reason, to ensure that your patches are ready to be merged! Pings on series that break the build or fail tests lead to unhappy maintainers!
Development #
Base Tree/Branch #
Fixes that target the current release, a.k.a. mainline, should be based on git://git.kernel.org/pub/scm/virt/kvm/kvm.git master. Note, fixes do not automatically warrant inclusion in the current release. There is no singular rule, but typically only fixes for bugs that are urgent, critical, and/or were introduced in the current release should target the current release.
Everything else should be based on kvm-x86/next, i.e. there is no need to select a specific topic branch as the base. If there are conflicts and/or dependencies across topic branches, it is the maintainer's job to sort them out.
The only exception to using kvm-x86/next as the base is if a patch/series is a multi-arch series, i.e. has non-trivial modifications to common KVM code and/or has more than superficial changes to other architectures' code. Multi- arch patch/series should instead be based on a common, stable point in KVM's history, e.g. the release candidate upon which kvm-x86 next is based. If you're unsure whether a patch/series is truly multi-arch, err on the side of caution and treat it as multi-arch, i.e. use a common base.
Coding Style #
When it comes to style, naming, patterns, etc., consistency is the number one priority in KVM x86. If all else fails, match what already exists.
With a few caveats listed below, follow the tip tree maintainers' preferred Coding style notes, as patches/series often touch both KVM and non-KVM x86 files, i.e. draw the attention of KVM and tip tree maintainers.
Using reverse fir tree, a.k.a. reverse Christmas tree or reverse XMAS tree, for variable declarations isn't strictly required, though it is still preferred.
Except for a handful of special snowflakes, do not use kernel-doc comments for functions. The vast majority of "public" KVM functions aren't truly public as they are intended only for KVM-internal consumption (there are plans to privatize KVM's headers and exports to enforce this).
Comments #
Write comments using imperative mood and avoid pronouns. Use comments to provide a high level overview of the code, and/or to explain why the code does what it does. Do not reiterate what the code literally does; let the code speak for itself. If the code itself is inscrutable, comments will not help.
SDM and APM References #
Much of KVM's code base is directly tied to architectural behavior defined in Intel's Software Development Manual (SDM) and AMD's Architecture Programmer’s Manual (APM). Use of "Intel's SDM" and "AMD's APM", or even just "SDM" or "APM", without additional context is a-ok.
Do not reference specific sections, tables, figures, etc. by number, especially not in comments. Instead, if necessary (see below), copy-paste the relevant snippet and reference sections/tables/figures by name. The layouts of the SDM and APM are constantly changing, and so the numbers/labels aren't stable.
Generally speaking, do not explicitly reference or copy-paste from the SDM or APM in comments. With few exceptions, KVM must honor architectural behavior, therefore it's implied that KVM behavior is emulating SDM and/or APM behavior. Note, referencing the SDM/APM in changelogs to justify the change and provide context is perfectly ok and encouraged.
Shortlog #
The preferred prefix format is KVM: <topic>:, where <topic> is one of:
- x86
- x86/mmu
- x86/pmu
- x86/xen
- selftests
- SVM
- nSVM
- VMX
- nVMX
DO NOT use x86/kvm! x86/kvm is used exclusively for Linux-as-a-KVM-guest changes, i.e. for arch/x86/kernel/kvm.c. Do not use file names or complete file paths as the subject/shortlog prefix.
Note, these don't align with the topics branches (the topic branches care much more about code conflicts).
All names are case sensitive! KVM: x86: is good, kvm: vmx: is not.
Capitalize the first word of the condensed patch description, but omit ending punctionation. E.g.:
KVM: x86: Fix a null pointer dereference in function_xyz()
not:
kvm: x86: fix a null pointer dereference in function_xyz.
If a patch touches multiple topics, traverse up the conceptual tree to find the first common parent (which is often simply x86). When in doubt, git log path/to/file should provide a reasonable hint.
New topics do occasionally pop up, but please start an on-list discussion if you want to propose introducing a new topic, i.e. don't go rogue.
See The canonical patch format for more information, with one amendment: do not treat the 70-75 character limit as an absolute, hard limit. Instead, use 75 characters as a firm-but-not-hard limit, and use 80 characters as a hard limit. I.e. let the shortlog run a few characters over the standard limit if you have good reason to do so.
Changelog #
Most importantly, write changelogs using imperative mood and avoid pronouns.
See Describe your changes for more information, with one amendment: lead with a short blurb on the actual changes, and then follow up with the context and background. Note! This order directly conflicts with the tip tree's preferred approach! Please follow the tip tree's preferred style when sending patches that primarily target arch/x86 code that is _NOT_ KVM code.
Stating what a patch does before diving into details is preferred by KVM x86 for several reasons. First and foremost, what code is actually being changed is arguably the most important information, and so that info should be easy to find. Changelogs that bury the "what's actually changing" in a one-liner after 3+ paragraphs of background make it very hard to find that information.
For initial review, one could argue the "what's broken" is more important, but for skimming logs and git archaeology, the gory details matter less and less. E.g. when doing a series of "git blame", the details of each change along the way are useless, the details only matter for the culprit. Providing the "what changed" makes it easy to quickly determine whether or not a commit might be of interest.
Another benefit of stating "what's changing" first is that it's almost always possible to state "what's changing" in a single sentence. Conversely, all but the most simple bugs require multiple sentences or paragraphs to fully describe the problem. If both the "what's changing" and "what's the bug" are super short then the order doesn't matter. But if one is shorter (almost always the "what's changing), then covering the shorter one first is advantageous because it's less of an inconvenience for readers/reviewers that have a strict ordering preference. E.g. having to skip one sentence to get to the context is less painful than having to skip three paragraphs to get to "what's changing".
Fixes #
If a change fixes a KVM/kernel bug, add a Fixes: tag even if the change doesn't need to be backported to stable kernels, and even if the change fixes a bug in an older release.
Conversely, if a fix does need to be backported, explicitly tag the patch with "Cc: stable@vger.kernel" (though the email itself doesn't need to Cc: stable); KVM x86 opts out of backporting Fixes: by default. Some auto-selected patches do get backported, but require explicit maintainer approval (search MANUALSEL).
Function References #
When a function is mentioned in a comment, changelog, or shortlog (or anywhere for that matter), use the format function_name(). The parentheses provide context and disambiguate the reference.
Testing #
At a bare minimum, all patches in a series must build cleanly for KVM_INTEL=m KVM_AMD=m, and KVM_WERROR=y. Building every possible combination of Kconfigs isn't feasible, but the more the merrier. KVM_SMM, KVM_XEN, PROVE_LOCKING, and X86_64 are particularly interesting knobs to turn.
Running KVM selftests and KVM-unit-tests is also mandatory (and stating the obvious, the tests need to pass). The only exception is for changes that have negligible probability of affecting runtime behavior, e.g. patches that only modify comments. When possible and relevant, testing on both Intel and AMD is strongly preferred. Booting an actual VM is encouraged, but not mandatory.
For changes that touch KVM's shadow paging code, running with TDP (EPT/NPT) disabled is mandatory. For changes that affect common KVM MMU code, running with TDP disabled is strongly encouraged. For all other changes, if the code being modified depends on and/or interacts with a module param, testing with the relevant settings is mandatory.
Note, KVM selftests and KVM-unit-tests do have known failures. If you suspect a failure is not due to your changes, verify that the exact same failure occurs with and without your changes.
Changes that touch reStructured Text documentation, i.e. .rst files, must build htmldocs cleanly, i.e. with no new warnings or errors.
If you can't fully test a change, e.g. due to lack of hardware, clearly state what level of testing you were able to do, e.g. in the cover letter.
New Features #
With one exception, new features must come with test coverage. KVM specific tests aren't strictly required, e.g. if coverage is provided by running a sufficiently enabled guest VM, or by running a related kernel selftest in a VM, but dedicated KVM tests are preferred in all cases. Negative testcases in particular are mandatory for enabling of new hardware features as error and exception flows are rarely exercised simply by running a VM.
The only exception to this rule is if KVM is simply advertising support for a feature via KVM_GET_SUPPORTED_CPUID, i.e. for instructions/features that KVM can't prevent a guest from using and for which there is no true enabling.
Note, "new features" does not just mean "new hardware features"! New features that can't be well validated using existing KVM selftests and/or KVM-unit-tests must come with tests.
Posting new feature development without tests to get early feedback is more than welcome, but such submissions should be tagged RFC, and the cover letter should clearly state what type of feedback is requested/expected. Do not abuse the RFC process; RFCs will typically not receive in-depth review.
Bug Fixes #
Except for "obvious" found-by-inspection bugs, fixes must be accompanied by a reproducer for the bug being fixed. In many cases the reproducer is implicit, e.g. for build errors and test failures, but it should still be clear to readers what is broken and how to verify the fix. Some leeway is given for bugs that are found via non-public workloads/tests, but providing regression tests for such bugs is strongly preferred.
In general, regression tests are preferred for any bug that is not trivial to hit. E.g. even if the bug was originally found by a fuzzer such as syzkaller, a targeted regression test may be warranted if the bug requires hitting a one-in-a-million type race condition.
Note, KVM bugs are rarely urgent and non-trivial to reproduce. Ask yourself if a bug is really truly the end of the world before posting a fix without a reproducer.
Posting #
Links #
Do not explicitly reference bug reports, prior versions of a patch/series, etc. via In-Reply-To: headers. Using In-Reply-To: becomes an unholy mess for large series and/or when the version count gets high, and In-Reply-To: is useless for anyone that doesn't have the original message, e.g. if someone wasn't Cc'd on the bug report or if the list of recipients changes between versions.
To link to a bug report, previous version, or anything of interest, use lore links. For referencing previous version(s), generally speaking do not include a Link: in the changelog as there is no need to record the history in git, i.e. put the link in the cover letter or in the section git ignores. Do provide a formal Link: for bug reports and/or discussions that led to the patch. The context of why a change was made is highly valuable for future readers.
Git Base #
If you are using git version 2.9.0 or later (Googlers, this is all of you!), use git format-patch with the --base flag to automatically include the base tree information in the generated patches.
Note, --base=auto works as expected if and only if a branch's upstream is set to the base topic branch, e.g. it will do the wrong thing if your upstream is set to your personal repository for backup purposes. An alternative "auto" solution is to derive the names of your development branches based on their KVM x86 topic, and feed that into --base. E.g. x86/pmu/my_branch_name, and then write a small wrapper to extract pmu from the current branch name to yield --base=x/pmu, where x is whatever name your repository uses to track the KVM x86 remote.
Co-Posting Tests #
KVM selftests that are associated with KVM changes, e.g. regression tests for bug fixes, should be posted along with the KVM changes as a single series. The standard kernel rules for bisection apply, i.e. KVM changes that result in test failures should be ordered after the selftests updates, and vice versa, new tests that fail due to KVM bugs should be ordered after the KVM fixes.
KVM-unit-tests should always be posted separately. Tools, e.g. b4 am, don't know that KVM-unit-tests is a separate repository and get confused when patches in a series apply on different trees. To tie KVM-unit-tests patches back to KVM patches, first post the KVM changes and then provide a lore Link: to the KVM patch/series in the KVM-unit-tests patch(es).
Notifications #
When a patch/series is officially accepted, a notification email will be sent in reply to the original posting (cover letter for multi-patch series). The notification will include the tree and topic branch, along with the SHA1s of the commits of applied patches.
If a subset of patches is applied, this will be clearly stated in the notification. Unless stated otherwise, it's implied that any patches in the series that were not accepted need more work and should be submitted in a new version.
If for some reason a patch is dropped after officially being accepted, a reply will be sent to the notification email explaining why the patch was dropped, as well as the next steps.
SHA1 Stability #
SHA1s are not 100% guaranteed to be stable until they land in Linus' tree! A SHA1 is usually stable once a notification has been sent, but things happen. In most cases, an update to the notification email be provided if an applied patch's SHA1 changes. However, in some scenarios, e.g. if all KVM x86 branches need to be rebased, individual notifications will not be given.
Vulnerabilities #
Bugs that can be exploited by the guest to attack the host (kernel or userspace), or that can be exploited by a nested VM to its host (L2 attacking L1), are of particular interest to KVM. Please follow the protocol for Security bugs if you suspect a bug can lead to an escape, data leak, etc.
Networking subsystem (netdev)
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
tl;dr #
designate your patch to a tree -
[PATCH net]or[PATCH net-next]for fixes the
Fixes:tag is required, regardless of the treedon't post large series (> 15 patches), break them up
don't repost your patches within one 24h period
reverse xmas tree
netdev #
netdev is a mailing list for all network-related Linux stuff. This includes anything found under net/ (i.e. core code like IPv6) and drivers/net (i.e. hardware specific drivers) in the Linux source tree.
Note that some subsystems (e.g. wireless drivers) which have a high volume of traffic have their own specific mailing lists and trees.
Like many other Linux mailing lists, the netdev list is hosted at kernel.org with archives available at https://lore.kernel.org/netdev/.
Aside from subsystems like those mentioned above, all network-related Linux development (i.e. RFC, review, comments, etc.) takes place on netdev.
Development cycle #
Here is a bit of background information on the cadence of Linux development. Each new release starts off with a two week "merge window" where the main maintainers feed their new stuff to Linus for merging into the mainline tree. After the two weeks, the merge window is closed, and it is called/tagged -rc1. No new features get mainlined after this -- only fixes to the rc1 content are expected. After roughly a week of collecting fixes to the rc1 content, rc2 is released. This repeats on a roughly weekly basis until rc7 (typically; sometimes rc6 if things are quiet, or rc8 if things are in a state of churn), and a week after the last vX.Y-rcN was done, the official vX.Y is released.
To find out where we are now in the cycle - load the mainline (Linus) page here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
and note the top of the "tags" section. If it is rc1, it is early in the dev cycle. If it was tagged rc7 a week ago, then a release is probably imminent. If the most recent tag is a final release tag (without an -rcN suffix) - we are most likely in a merge window and net-next is closed.
git trees and patch flow #
There are two networking trees (git repositories) in play. Both are driven by David Miller, the main network maintainer. There is the net tree, and the net-next tree. As you can probably guess from the names, the net tree is for fixes to existing code already in the mainline tree from Linus, and net-next is where the new code goes for the future release. You can find the trees here:
-
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
-
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
Relating that to kernel development: At the beginning of the 2-week merge window, the net-next tree will be closed - no new changes/features. The accumulated new content of the past ~10 weeks will be passed onto mainline/Linus via a pull request for vX.Y -- at the same time, the net tree will start accumulating fixes for this pulled content relating to vX.Y
An announcement indicating when net-next has been closed is usually sent to netdev, but knowing the above, you can predict that in advance.
RFC patches sent for review only are obviously welcome at any time (use --subject-prefix='RFC net-next' with git format-patch).
Shortly after the two weeks have passed (and vX.Y-rc1 is released), the tree for net-next reopens to collect content for the next (vX.Y+1) release.
If you aren't subscribed to netdev and/or are simply unsure if net-next has re-opened yet, simply check the net-next git repository link above for any new networking-related commits. You may also check the following website for the current status:
The net tree continues to collect fixes for the vX.Y content, and is fed back to Linus at regular (~weekly) intervals. Meaning that the focus for net is on stabilization and bug fixes.
Finally, the vX.Y gets released, and the whole cycle starts over.
netdev patch review #
Patch status #
Status of a patch can be checked by looking at the main patchwork queue for netdev:
The "State" field will tell you exactly where things are at with your patch:
|
Patch state |
Description |
|---|---|
|
New, Under review |
pending review, patch is in the maintainer’s queue for review; the two states are used interchangeably (depending on the exact co-maintainer handling patchwork at the time) |
|
Accepted |
patch was applied to the appropriate networking tree, this is usually set automatically by the pw-bot |
|
Needs ACK |
waiting for an ack from an area expert or testing |
|
Changes requested |
patch has not passed the review, new revision is expected with appropriate code and commit message changes |
|
Rejected |
patch has been rejected and new revision is not expected |
|
Not applicable |
patch is expected to be applied outside of the networking subsystem |
|
Awaiting upstream |
patch should be reviewed and handled by appropriate sub-maintainer, who will send it on to the networking trees; patches set to |
|
Deferred |
patch needs to be reposted later, usually due to dependency or because it was posted for a closed tree |
|
Superseded |
new version of the patch was posted, usually set by the pw-bot |
|
RFC |
not to be applied, usually not in maintainer’s review queue, pw-bot can automatically set patches to this state based on subject tags |
Patches are indexed by the Message-ID header of the emails which carried them so if you have trouble finding your patch append the value of Message-ID to the URL above.
Updating patch status #
Contributors and reviewers do not have the permissions to update patch state directly in patchwork. Patchwork doesn't expose much information about the history of the state of patches, therefore having multiple people update the state leads to confusion.
Instead of delegating patchwork permissions netdev uses a simple mail bot which looks for special commands/lines within the emails sent to the mailing list. For example to mark a series as Changes Requested one needs to send the following line anywhere in the email thread:
pw-bot: changes-requested
As a result the bot will set the entire series to Changes Requested. This may be useful when author discovers a bug in their own series and wants to prevent it from getting applied.
The use of the bot is entirely optional, if in doubt ignore its existence completely. Maintainers will classify and update the state of the patches themselves. No email should ever be sent to the list with the main purpose of communicating with the bot, the bot commands should be seen as metadata.
The use of the bot is restricted to authors of the patches (the From: header on patch submission and command must match!), maintainers of the modified code according to the MAINTAINERS file (again, From: must match the MAINTAINERS entry) and a handful of senior reviewers.
Bot records its activity here:
Review timelines #
Generally speaking, the patches get triaged quickly (in less than 48h). But be patient, if your patch is active in patchwork (i.e. it's listed on the project's patch list) the chances it was missed are close to zero.
The high volume of development on netdev makes reviewers move on from discussions relatively quickly. New comments and replies are very unlikely to arrive after a week of silence. If a patch is no longer active in patchwork and the thread went idle for more than a week - clarify the next steps and/or post the next version.
For RFC postings specifically, if nobody responded in a week - reviewers either missed the posting or have no strong opinions. If the code is ready, repost as a PATCH.
Emails saying just "ping" or "bump" are considered rude. If you can't figure out the status of the patch from patchwork or where the discussion has landed - describe your best guess and ask if it's correct. For example:
I don't understand what the next steps are. Person X seems to be unhappy
with A, should I do B and repost the patches?
Changes requested #
Patches marked as Changes Requested need to be revised. The new version should come with a change log, preferably including links to previous postings, for example:
[PATCH net-next v3] net: make cows go moo
Even users who don't drink milk appreciate hearing the cows go "moo".
The amount of mooing will depend on packet rate so should match
the diurnal cycle quite well.
Signed-off-by: Joe Defarmer <joe@barn.org>
---
v3:
- add a note about time-of-day mooing fluctuation to the commit message
v2: https://lore.kernel.org/netdev/123themessageid@barn.org/
- fix missing argument in kernel doc for netif_is_bovine()
- fix memory leak in netdev_register_cow()
v1: https://lore.kernel.org/netdev/456getstheclicks@barn.org/
The commit message should be revised to answer any questions reviewers had to ask in previous discussions. Occasionally the update of the commit message will be the only change in the new version.
Partial resends #
Please always resend the entire patch series and make sure you do number your patches such that it is clear this is the latest and greatest set of patches that can be applied. Do not try to resend just the patches which changed.
Handling misapplied patches #
Occasionally a patch series gets applied before receiving critical feedback, or the wrong version of a series gets applied.
Making the patch disappear once it is pushed out is not possible, the commit history in netdev trees is immutable. Please send incremental versions on top of what has been merged in order to fix the patches the way they would look like if your latest patch series was to be merged.
In cases where full revert is needed the revert has to be submitted as a patch to the list with a commit message explaining the technical problems with the reverted commit. Reverts should be used as a last resort, when original change is completely wrong; incremental fixes are preferred.
Stable tree #
While it used to be the case that netdev submissions were not supposed to carry explicit CC: stable@vger.kernel.org tags that is no longer the case today. Please follow the standard stable rules in Documentation/process/stable-kernel-rules.rst, and make sure you include appropriate Fixes tags!
Security fixes #
Do not email netdev maintainers directly if you think you discovered a bug that might have possible security implications. The current netdev maintainer has consistently requested that people use the mailing lists and not reach out directly. If you aren't OK with that, then perhaps consider mailing security@kernel.org or reading about http://oss-security.openwall.org/wiki/mailing-lists/distros as possible alternative mechanisms.
Co-posting changes to user space components #
User space code exercising kernel features should be posted alongside kernel patches. This gives reviewers a chance to see how any new interface is used and how well it works.
When user space tools reside in the kernel repo itself all changes should generally come as one series. If series becomes too large or the user space project is not reviewed on netdev include a link to a public repo where user space patches can be seen.
In case user space tooling lives in a separate repository but is reviewed on netdev (e.g. patches to iproute2 tools) kernel and user space patches should form separate series (threads) when posted to the mailing list, e.g.:
[PATCH net-next 0/3] net: some feature cover letter
└─ [PATCH net-next 1/3] net: some feature prep
└─ [PATCH net-next 2/3] net: some feature do it
└─ [PATCH net-next 3/3] selftest: net: some feature
[PATCH iproute2-next] ip: add support for some feature
Posting as one thread is discouraged because it confuses patchwork (as of patchwork 2.2.2).
Co-posting selftests #
Selftests should be part of the same series as the code changes. Specifically for fixes both code change and related test should go into the same tree (the tests may lack a Fixes tag, which is expected). Mixing code changes and test changes in a single commit is discouraged.
Preparing changes #
Attention to detail is important. Re-read your own work as if you were the reviewer. You can start with using checkpatch.pl, perhaps even with the --strict flag. But do not be mindlessly robotic in doing so. If your change is a bug fix, make sure your commit log indicates the end-user visible symptom, the underlying reason as to why it happens, and then if necessary, explain why the fix proposed is the best way to get things done. Don't mangle whitespace, and as is common, don't mis-indent function arguments that span multiple lines. If it is your first patch, mail it to yourself so you can test apply it to an unpatched tree to confirm infrastructure didn't mangle it.
Finally, go back and read Documentation/process/submitting-patches.rst to be sure you are not repeating some common mistake documented there.
Indicating target tree #
To help maintainers and CI bots you should explicitly mark which tree your patch is targeting. Assuming that you use git, use the prefix flag:
git format-patch --subject-prefix='PATCH net-next' start..finish
Use net instead of net-next (always lower case) in the above for bug-fix net content.
Dividing work into patches #
Put yourself in the shoes of the reviewer. Each patch is read separately and therefore should constitute a comprehensible step towards your stated goal.
Avoid sending series longer than 15 patches. Larger series takes longer to review as reviewers will defer looking at it until they find a large chunk of time. A small series can be reviewed in a short time, so Maintainers just do it. As a result, a sequence of smaller series gets merged quicker and with better review coverage. Re-posting large series also increases the mailing list traffic.
Limit patches outstanding on mailing list #
Avoid having more than 15 patches, across all series, outstanding for review on the mailing list for a single tree. In other words, a maximum of 15 patches under review on net, and a maximum of 15 patches under review on net-next.
This limit is intended to focus developer effort on testing patches before upstream review. Aiding the quality of upstream submissions, and easing the load on reviewers.
Local variable ordering ("reverse xmas tree", "RCS") #
Netdev has a convention for ordering local variables in functions. Order the variable declaration lines longest to shortest, e.g.:
struct scatterlist *sg;
struct sk_buff *skb;
int err, i;
If there are dependencies between the variables preventing the ordering move the initialization out of line.
Format precedence #
When working in existing code which uses nonstandard formatting make your code follow the most recent guidelines, so that eventually all code in the domain of netdev is in the preferred format.
Using device-managed and cleanup.h constructs #
Netdev remains skeptical about promises of all "auto-cleanup" APIs, including even devm_ helpers, historically. They are not the preferred style of implementation, merely an acceptable one.
Use of guard() is discouraged within any function longer than 20 lines, scoped_guard() is considered more readable. Using normal lock/unlock is still (weakly) preferred.
Low level cleanup constructs (such as __free()) can be used when building APIs and helpers, especially scoped iterators. However, direct use of __free() within networking core and drivers is discouraged. Similar guidance applies to declaring variables mid-function.
Clean-up patches #
Netdev discourages patches which perform simple clean-ups, which are not in the context of other work. For example:
-
Addressing
checkpatch.pl, and other trivial coding style warnings -
Addressing Local variable ordering issues
-
Conversions to device-managed APIs (
devm_helpers)
This is because it is felt that the churn that such changes produce comes at a greater cost than the value of such clean-ups.
Conversely, spelling and grammar fixes are not discouraged.
Resending after review #
Allow at least 24 hours to pass between postings. This will ensure reviewers from all geographical locations have a chance to chime in. Do not wait too long (weeks) between postings either as it will make it harder for reviewers to recall all the context.
Make sure you address all the feedback in your new posting. Do not post a new version of the code if the discussion about the previous version is still ongoing, unless directly instructed by a reviewer.
The new version of patches should be posted as a separate thread, not as a reply to the previous posting. Change log should include a link to the previous posting (see Changes requested).
Testing #
Expected level of testing #
At the very minimum your changes must survive an allyesconfig and an allmodconfig build with W=1 set without new warnings or failures.
Ideally you will have done run-time testing specific to your change, and the patch series contains a set of kernel selftest for tools/testing/selftests/net or using the KUnit framework.
You are expected to test your changes on top of the relevant networking tree (net or net-next) and not e.g. a stable tree or linux-next.
patchwork checks #
Checks in patchwork are mostly simple wrappers around existing kernel scripts, the sources are available at:
https://github.com/linux-netdev/nipa/tree/master/tests
Do not post your patches just to run them through the checks. You must ensure that your patches are ready by testing them locally before posting to the mailing list. The patchwork build bot instance gets overloaded very easily and netdev@vger really doesn't need more traffic if we can help it.
netdevsim #
netdevsim is a test driver which can be used to exercise driver configuration APIs without requiring capable hardware. Mock-ups and tests based on netdevsim are strongly encouraged when adding new APIs, but netdevsim in itself is not considered a use case/user. You must also implement the new APIs in a real driver.
We give no guarantees that netdevsim won't change in the future in a way which would break what would normally be considered uAPI.
netdevsim is reserved for use by upstream tests only, so any new netdevsim features must be accompanied by selftests under tools/testing/selftests/.
Supported status for drivers #
Netdev defines additional requirements for drivers which want to acquire the Supported status in the MAINTAINERS file. Supported drivers must be running all upstream driver tests and reporting the results twice a day. Drivers which do not comply with this requirement should use the Maintained status. There is currently no difference in how Supported and Maintained drivers are treated upstream.
The exact rules a driver must follow to acquire the Supported status:
-
Must run all tests under
drivers/netanddrivers/net/hwtargets of Linux selftests. Running and reporting private / internal tests is also welcome, but upstream tests are a must. -
The minimum run frequency is once every 12 hours. Must test the designated branch from the selected branch feed. Note that branches are auto-constructed and exposed to intentional malicious patch posting, so the test systems must be isolated.
-
Drivers supporting multiple generations of devices must test at least one device from each generation. A testbed manifest (exact format TBD) should describe the device models tested.
-
The tests must run reliably, if multiple branches are skipped or tests are failing due to execution environment problems the
Supportedstatus will be withdrawn. -
Test failures due to bugs either in the driver or the test itself, or lack of support for the feature the test is targgeting are not a basis for losing the
Supportedstatus.
netdev CI will maintain an official page of supported devices, listing their recent test results.
The driver maintainer may arrange for someone else to run the test, there is no requirement for the person listed as maintainer (or their employer) to be responsible for running the tests. Collaboration between vendors, hosting GH CI, other repos under linux-netdev, etc. is most welcome.
See https://github.com/linux-netdev/nipa/wiki for more information about netdev CI. Feel free to reach out to maintainers or the list with any questions.
Reviewer guidance #
Reviewing other people's patches on the list is highly encouraged, regardless of the level of expertise. For general guidance and helpful tips please see Reviewing patches.
It's safe to assume that netdev maintainers know the community and the level of expertise of the reviewers. The reviewers should not be concerned about their comments impeding or derailing the patch flow.
Less experienced reviewers are highly encouraged to do more in-depth review of submissions and not focus exclusively on trivial or subjective matters like code formatting, tags etc.
Testimonials / feedback #
Some companies use peer feedback in employee performance reviews. Please feel free to request feedback from netdev maintainers, especially if you spend significant amount of time reviewing code and go out of your way to improve shared infrastructure.
The feedback must be requested by you, the contributor, and will always be shared with you (even if you request for it to be submitted to your manager).
Kernel Maintainer PGP guide
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Author: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
This document is aimed at Linux kernel developers, and especially at subsystem maintainers. It contains a subset of information discussed in the more general "Protecting Code Integrity" guide published by the Linux Foundation. Please read that document for more in-depth discussion on some of the topics mentioned in this guide.
The role of PGP in Linux Kernel development #
PGP helps ensure the integrity of the code that is produced by the Linux kernel development community and, to a lesser degree, establish trusted communication channels between developers via PGP-signed email exchange.
The Linux kernel source code is available in two main formats:
-
Distributed source repositories (git)
-
Periodic release snapshots (tarballs)
Both git repositories and tarballs carry PGP signatures of the kernel developers who create official kernel releases. These signatures offer a cryptographic guarantee that downloadable versions made available via kernel.org or any other mirrors are identical to what these developers have on their workstations. To this end:
-
git repositories provide PGP signatures on all tags
-
tarballs provide detached PGP signatures with all downloads
Trusting the developers, not infrastructure #
Ever since the 2011 compromise of core kernel.org systems, the main operating principle of the Kernel Archives project has been to assume that any part of the infrastructure can be compromised at any time. For this reason, the administrators have taken deliberate steps to emphasize that trust must always be placed with developers and never with the code hosting infrastructure, regardless of how good the security practices for the latter may be.
The above guiding principle is the reason why this guide is needed. We want to make sure that by placing trust into developers we do not merely shift the blame for potential future security incidents to someone else. The goal is to provide a set of guidelines developers can use to create a secure working environment and safeguard the PGP keys used to establish the integrity of the Linux kernel itself.
PGP tools #
Use GnuPG 2.4 or later #
Your distro should already have GnuPG installed by default, you just need to verify that you are using a reasonably recent version of it. To check, run:
$ gpg --version | head -n1
If you have version 2.4 or above, then you are good to go. If you have an earlier version, then you are using a release of GnuPG that is no longer maintained and some commands from this guide may not work.
Configure gpg-agent options #
The GnuPG agent is a helper tool that will start automatically whenever you use the gpg command and run in the background with the purpose of caching the private key passphrase. There are two options you should know in order to tweak when the passphrase should be expired from cache:
-
default-cache-ttl(seconds): If you use the same key again before the time-to-live expires, the countdown will reset for another period. The default is 600 (10 minutes). -
max-cache-ttl(seconds): Regardless of how recently you've used the key since initial passphrase entry, if the maximum time-to-live countdown expires, you'll have to enter the passphrase again. The default is 30 minutes.
If you find either of these defaults too short (or too long), you can edit your ~/.gnupg/gpg-agent.conf file to set your own values:
# set to 30 minutes for regular ttl, and 2 hours for max ttl
default-cache-ttl 1800
max-cache-ttl 7200
Protect your PGP key #
This guide assumes that you already have a PGP key that you use for Linux kernel development purposes. If you do not yet have one, please see the "Protecting Code Integrity" document mentioned earlier for guidance on how to create a new one.
You should also make a new key if your current one is weaker than 2048 bits (RSA).
Understanding PGP Subkeys #
A PGP key rarely consists of a single keypair -- usually it is a collection of independent subkeys that can be used for different purposes based on their capabilities, assigned at their creation time. PGP defines four capabilities that a key can have:
-
[S] keys can be used for signing
-
[E] keys can be used for encryption
-
[A] keys can be used for authentication
-
[C] keys can be used for certifying other keys
The key with the [C] capability is often called the "master" key, but this terminology is misleading because it implies that the Certify key can be used in place of any of other subkey on the same chain (like a physical "master key" can be used to open locks made for other keys). Since this is not the case, this guide will refer to it as "the Certify key" to avoid any ambiguity.
It is critical to fully understand the following:
-
All subkeys are fully independent from each other. If you lose a private subkey, it cannot be restored or recreated from any other private key on your chain.
-
With the exception of the Certify key, there can be multiple subkeys with identical capabilities (e.g. you can have 2 valid encryption subkeys, 3 valid signing subkeys, but only one valid certification subkey). All subkeys are fully independent -- a message encrypted to one [E] subkey cannot be decrypted with any other [E] subkey you may also have.
-
A single subkey may have multiple capabilities (e.g. your [C] key can also be your [S] key).
The key carrying the [C] (certify) capability is the only key that can be used to indicate relationship with other keys. Only the [C] key can be used to:
-
add or revoke other keys (subkeys) with S/E/A capabilities
-
add, change or revoke identities (uids) associated with the key
-
add or change the expiration date on itself or any subkey
-
sign other people's keys for web of trust purposes
By default, GnuPG creates the following when generating new keys:
-
One subkey carrying both Certify and Sign capabilities ([SC])
-
A separate subkey with the Encryption capability ([E])
If you used the default parameters when generating your key, then that is what you will have. You can verify by running gpg --list-secret-keys, for example:
sec ed25519 2022-12-20 [SC] [expires: 2024-12-19]
000000000000000000000000AAAABBBBCCCCDDDD
uid [ultimate] Alice Dev <adev@kernel.org>
ssb cv25519 2022-12-20 [E] [expires: 2024-12-19]
The long line under the sec entry is your key fingerprint -- whenever you see [fpr] in the examples below, that 40-character string is what it refers to.
Ensure your passphrase is strong #
GnuPG uses passphrases to encrypt your private keys before storing them on disk. This way, even if your .gnupg directory is leaked or stolen in its entirety, the attackers cannot use your private keys without first obtaining the passphrase to decrypt them.
It is absolutely essential that your private keys are protected by a strong passphrase. To set it or change it, use:
$ gpg --change-passphrase [fpr]
Create a separate Signing subkey #
Our goal is to protect your Certify key by moving it to offline media, so if you only have a combined [SC] key, then you should create a separate signing subkey:
$ gpg --quick-addkey [fpr] ed25519 sign
Back up your Certify key for disaster recovery #
The more signatures you have on your PGP key from other developers, the more reasons you have to create a backup version that lives on something other than digital media, for disaster recovery reasons.
A good way to create a printable hardcopy of your private key is by using the paperkey software written for this very purpose. See man paperkey for more details on the output format and its benefits over other solutions. Paperkey should already be packaged for most distributions.
Run the following command to create a hardcopy backup of your private key:
$ gpg --export-secret-key [fpr] | paperkey -o /tmp/key-backup.txt
Print out that file, then take a pen and write your passphrase on the margin of the paper. This is strongly recommended because the key printout is still encrypted with that passphrase, and if you ever change it you will not remember what it used to be when you had created the backup -- guaranteed.
Put the resulting printout and the hand-written passphrase into an envelope and store in a secure and well-protected place, preferably away from your home, such as your bank vault.
Back up your whole GnuPG directory #
It is important to have a readily available backup of your PGP keys should you need to recover them. This is different from the disaster-level preparedness we did with paperkey. You will also rely on these external copies whenever you need to use your Certify key -- such as when making changes to your own key or signing other people's keys after conferences and summits.
Start by getting an external media card (preferably two!) that you will use for backup purposes. You will need to create an encrypted partition on this device using LUKS -- refer to your distro's documentation on how to accomplish this.
For the encryption passphrase, you can use the same one as on your PGP key.
Once the encryption process is over, re-insert your device and make sure it gets properly mounted. Copy your entire .gnupg directory over to the encrypted storage:
$ cp -a ~/.gnupg /media/disk/foo/gnupg-backup
You should now test to make sure everything still works:
$ gpg --homedir=/media/disk/foo/gnupg-backup --list-key [fpr]
If you don't get any errors, then you should be good to go. Unmount the device, distinctly label it so you don't overwrite it by accident, and put in a safe place -- but not too far away, because you'll need to use it every now and again for things like editing identities, adding or revoking subkeys, or signing other people's keys.
Remove the Certify key from your homedir #
The files in our home directory are not as well protected as we like to think. They can be leaked or stolen via many different means:
-
by accident when making quick homedir copies to set up a new workstation
-
by systems administrator negligence or malice
-
via poorly secured backups
-
via malware in desktop apps (browsers, pdf viewers, etc)
-
via coercion when crossing international borders
Protecting your key with a good passphrase greatly helps reduce the risk of any of the above, but passphrases can be discovered via keyloggers, shoulder-surfing, or any number of other means. For this reason, the recommended setup is to remove your Certify key from your home directory and store it on offline storage.
First, identify the "keygrip" of your Certify key:
$ gpg --with-keygrip --list-key [fpr]
The output will be something like this:
pub ed25519 2022-12-20 [SC] [expires: 2022-12-19]
000000000000000000000000AAAABBBBCCCCDDDD
Keygrip = 1111000000000000000000000000000000000000
uid [ultimate] Alice Dev <adev@kernel.org>
sub cv25519 2022-12-20 [E] [expires: 2022-12-19]
Keygrip = 2222000000000000000000000000000000000000
sub ed25519 2022-12-20 [S]
Keygrip = 3333000000000000000000000000000000000000
Find the keygrip entry that is beneath the pub line (right under the Certify key fingerprint). This will correspond directly to a file in your ~/.gnupg directory:
$ cd ~/.gnupg/private-keys-v1.d
$ ls
1111000000000000000000000000000000000000.key
2222000000000000000000000000000000000000.key
3333000000000000000000000000000000000000.key
It is sufficient to remove the .key file that corresponds to the Certify key keygrip:
$ cd ~/.gnupg/private-keys-v1.d
$ rm 1111000000000000000000000000000000000000.key
Now, if you issue the --list-secret-keys command, it will show that the Certify key is missing (the # indicates it is not available):
$ gpg --list-secret-keys
sec# ed25519 2022-12-20 [SC] [expires: 2024-12-19]
000000000000000000000000AAAABBBBCCCCDDDD
uid [ultimate] Alice Dev <adev@kernel.org>
ssb cv25519 2022-12-20 [E] [expires: 2024-12-19]
ssb ed25519 2022-12-20 [S]
You should also remove any secring.gpg files in the ~/.gnupg directory, which may be left over from previous versions of GnuPG.
If you don't have the "private-keys-v1.d" directory #
If you do not have a ~/.gnupg/private-keys-v1.d directory, then your secret keys are still stored in the legacy secring.gpg file used by GnuPG v1. Making any changes to your key, such as changing the passphrase or adding a subkey, should automatically convert the old secring.gpg format to use private-keys-v1.d instead.
Once you get that done, make sure to delete the obsolete secring.gpg file, which still contains your private keys.
Move the subkeys to a dedicated crypto device #
Even though the Certify key is now safe from being leaked or stolen, the subkeys are still in your home directory. Anyone who manages to get their hands on those will be able to decrypt your communication or fake your signatures (if they know the passphrase). Furthermore, each time a GnuPG operation is performed, the keys are loaded into system memory and can be stolen from there by sufficiently advanced malware (think Meltdown and Spectre).
A good way to completely protect your keys is to move them to a specialized hardware device that is capable of smartcard operations.
The benefits of smartcards #
A smartcard contains a cryptographic chip that is capable of storing private keys and performing crypto operations directly on the card itself. Because the key contents never leave the smartcard, the operating system of the computer into which you plug in the hardware device is not able to retrieve the private keys themselves. This is very different from the encrypted media storage device we used earlier for backup purposes -- while that device is plugged in and mounted, the operating system is able to access the private key contents.
Using external encrypted media is not a substitute to having a smartcard-capable device.
Available smartcard devices #
Unless all your laptops and workstations have smartcard readers, the easiest is to get a specialized USB device that implements smartcard functionality. There are several options available:
-
Nitrokey Start: Open hardware and Free Software, based on FSI Japan's Gnuk. One of the cheapest options, but offers fewest security features (such as resistance to tampering or some side-channel attacks).
-
Nitrokey 3: Similar to the Nitrokey Start, but more tamper-resistant and offers more security features and USB form-factors. Supports ECC cryptography (ED25519 and NISTP).
-
Yubikey 5: proprietary hardware and software, but cheaper than Nitrokey with a similar set of features. Supports ECC cryptography (ED25519 and NISTP).
Your choice will depend on cost, shipping availability in your geographical region, and open/proprietary hardware considerations.
Configure your smartcard device #
Your smartcard device should Just Work (TM) the moment you plug it into any modern Linux workstation. You can verify it by running:
$ gpg --card-status
If you see full smartcard details, then you are good to go. Unfortunately, troubleshooting all possible reasons why things may not be working for you is way beyond the scope of this guide. If you are having trouble getting the card to work with GnuPG, please seek help via usual support channels.
To configure your smartcard, you will need to use the GnuPG menu system, as there are no convenient command-line switches:
$ gpg --card-edit
[...omitted...]
gpg/card> admin
Admin commands are allowed
gpg/card> passwd
You should set the user PIN (1), Admin PIN (3), and the Reset Code (4). Please make sure to record and store these in a safe place -- especially the Admin PIN and the Reset Code (which allows you to completely wipe the smartcard). You so rarely need to use the Admin PIN, that you will inevitably forget what it is if you do not record it.
Getting back to the main card menu, you can also set other values (such as name, gender, login data, etc), but it's not necessary and will additionally leak information about your smartcard should you lose it.
Move the subkeys to your smartcard #
Exit the card menu (using "q") and save all changes. Next, let's move your subkeys onto the smartcard. You will need both your PGP key passphrase and the admin PIN of the card for most operations:
$ gpg --edit-key [fpr]
Secret subkeys are available.
pub ed25519/AAAABBBBCCCCDDDD
created: 2022-12-20 expires: 2024-12-19 usage: SC
trust: ultimate validity: ultimate
ssb cv25519/1111222233334444
created: 2022-12-20 expires: never usage: E
ssb ed25519/5555666677778888
created: 2017-12-07 expires: never usage: S
[ultimate] (1). Alice Dev <adev@kernel.org>
gpg>
Using --edit-key puts us into the menu mode again, and you will notice that the key listing is a little different. From here on, all commands are done from inside this menu mode, as indicated by gpg>.
First, let's select the key we'll be putting onto the card -- you do this by typing key 1 (it's the first one in the listing, the [E] subkey):
gpg> key 1
In the output, you should now see ssb* on the [E] key. The * indicates which key is currently "selected." It works as a toggle, meaning that if you type key 1 again, the * will disappear and the key will not be selected any more.
Now, let's move that key onto the smartcard:
gpg> keytocard
Please select where to store the key:
(2) Encryption key
Your selection? 2
Since it's our [E] key, it makes sense to put it into the Encryption slot. When you submit your selection, you will be prompted first for your PGP key passphrase, and then for the admin PIN. If the command returns without an error, your key has been moved.
Important: Now type key 1 again to unselect the first key, and key 2 to select the [S] key:
gpg> key 1
gpg> key 2
gpg> keytocard
Please select where to store the key:
(1) Signature key
(3) Authentication key
Your selection? 1
You can use the [S] key both for Signature and Authentication, but we want to make sure it's in the Signature slot, so choose (1). Once again, if your command returns without an error, then the operation was successful:
gpg> q
Save changes? (y/N) y
Saving the changes will delete the keys you moved to the card from your home directory (but it's okay, because we have them in our backups should we need to do this again for a replacement smartcard).
Verifying that the keys were moved #
If you perform --list-secret-keys now, you will see a subtle difference in the output:
$ gpg --list-secret-keys
sec# ed25519 2022-12-20 [SC] [expires: 2024-12-19]
000000000000000000000000AAAABBBBCCCCDDDD
uid [ultimate] Alice Dev <adev@kernel.org>
ssb> cv25519 2022-12-20 [E] [expires: 2024-12-19]
ssb> ed25519 2022-12-20 [S]
The > in the ssb> output indicates that the subkey is only available on the smartcard. If you go back into your secret keys directory and look at the contents there, you will notice that the .key files there have been replaced with stubs:
$ cd ~/.gnupg/private-keys-v1.d
$ strings *.key | grep 'private-key'
The output should contain shadowed-private-key to indicate that these files are only stubs and the actual content is on the smartcard.
Verifying that the smartcard is functioning #
To verify that the smartcard is working as intended, you can create a signature:
$ echo "Hello world" | gpg --clearsign > /tmp/test.asc
$ gpg --verify /tmp/test.asc
This should ask for your smartcard PIN on your first command, and then show "Good signature" after you run gpg --verify.
Congratulations, you have successfully made it extremely difficult to steal your digital developer identity!
Other common GnuPG operations #
Here is a quick reference for some common operations you'll need to do with your PGP key.
Mounting your safe offline storage #
You will need your Certify key for any of the operations below, so you will first need to mount your backup offline storage and tell GnuPG to use it:
$ export GNUPGHOME=/media/disk/foo/gnupg-backup
$ gpg --list-secret-keys
You want to make sure that you see sec and not sec# in the output (the # means the key is not available and you're still using your regular home directory location).
Extending key expiration date #
The Certify key has the default expiration date of 2 years from the date of creation. This is done both for security reasons and to make obsolete keys eventually disappear from keyservers.
To extend the expiration on your key by a year from current date, just run:
$ gpg --quick-set-expire [fpr] 1y
You can also use a specific date if that is easier to remember (e.g. your birthday, January 1st, or Canada Day):
$ gpg --quick-set-expire [fpr] 2038-07-01
Remember to send the updated key back to keyservers:
$ gpg --send-key [fpr]
Updating your work directory after any changes #
After you make any changes to your key using the offline storage, you will want to import these changes back into your regular working directory:
$ gpg --export | gpg --homedir ~/.gnupg --import
$ unset GNUPGHOME
Using gpg-agent over ssh #
You can forward your gpg-agent over ssh if you need to sign tags or commits on a remote system. Please refer to the instructions provided on the GnuPG wiki:
It works more smoothly if you can modify the sshd server settings on the remote end.
Using PGP with Git #
One of the core features of Git is its decentralized nature -- once a repository is cloned to your system, you have full history of the project, including all of its tags, commits and branches. However, with hundreds of cloned repositories floating around, how does anyone verify that their copy of linux.git has not been tampered with by a malicious third party?
Or what happens if malicious code is discovered in the kernel and the "Author" line in the commit says it was done by you, while you're pretty sure you had nothing to do with it?
To address both of these issues, Git introduced PGP integration. Signed tags prove the repository integrity by assuring that its contents are exactly the same as on the workstation of the developer who created the tag, while signed commits make it nearly impossible for someone to impersonate you without having access to your PGP keys.
Configure git to use your PGP key #
If you only have one secret key in your keyring, then you don't really need to do anything extra, as it becomes your default key. However, if you happen to have multiple secret keys, you can tell git which key should be used ([fpr] is the fingerprint of your key):
$ git config --global user.signingKey [fpr]
How to work with signed tags #
To create a signed tag, pass the -s switch to the tag command:
$ git tag -s [tagname]
Our recommendation is to always sign git tags, as this allows other developers to ensure that the git repository they are pulling from has not been maliciously altered.
How to verify signed tags #
To verify a signed tag, use the verify-tag command:
$ git verify-tag [tagname]
If you are pulling a tag from another fork of the project repository, git should automatically verify the signature at the tip you're pulling and show you the results during the merge operation:
$ git pull [url] tags/sometag
The merge message will contain something like this:
Merge tag 'sometag' of [url]
[Tag message]
# gpg: Signature made [...]
# gpg: Good signature from [...]
If you are verifying someone else's git tag, you will first need to import their PGP key. Please refer to the "How to work with signed patches" section below.
Configure git to always sign annotated tags #
Chances are, if you're creating an annotated tag, you'll want to sign it. To force git to always sign annotated tags, you can set a global configuration option:
$ git config --global tag.forceSignAnnotated true
How to work with signed commits #
It is also possible to create signed commits, but they have limited usefulness in Linux kernel development. The kernel contribution workflow relies on sending in patches, and converting commits to patches does not preserve git commit signatures. Furthermore, when rebasing your own repository on a newer upstream, PGP commit signatures will end up discarded. For this reason, most kernel developers don't bother signing their commits and will ignore signed commits in any external repositories that they rely upon in their work.
That said, if you have your working git tree publicly available at some git hosting service (kernel.org, infradead.org, ozlabs.org, or others), then the recommendation is that you sign all your git commits even if upstream developers do not directly benefit from this practice.
We recommend this for the following reasons:
-
Should there ever be a need to perform code forensics or track code provenance, even externally maintained trees carrying PGP commit signatures will be valuable for such purposes.
-
If you ever need to re-clone your local repository (for example, after reinstalling your system), this lets you verify the repository integrity before resuming your work.
-
If someone needs to cherry-pick your commits, this allows them to quickly verify their integrity before applying them.
Creating signed commits #
To create a signed commit, pass the -S flag to the git commit command (it's capital -S due to collision with another flag):
$ git commit -S
Configure git to always sign commits #
You can tell git to always sign commits:
git config --global commit.gpgSign true
How to work with signed patches #
It is possible to use your PGP key to sign patches sent to kernel developer mailing lists. Since existing email signature mechanisms (PGP-Mime or PGP-inline) tend to cause problems with regular code review tasks, you should use the tool kernel.org created for this purpose that puts cryptographic attestation signatures into message headers (a-la DKIM):
Installing and configuring patatt #
Patatt is packaged for many distributions already, so please check there first. You can also install it from pypi using "pip install patatt".
If you already have your PGP key configured with git (via the user.signingKey configuration parameter), then patatt requires no further configuration. You can start signing your patches by installing the git-send-email hook in the repository you want:
patatt install-hook
Now any patches you send with git send-email will be automatically signed with your cryptographic signature.
Checking patatt signatures #
If you are using b4 to retrieve and apply patches, then it will automatically attempt to verify all DKIM and patatt signatures it encounters, for example:
$ b4 am 20220720205013.890942-1-broonie@kernel.org
[...]
Checking attestation on all messages, may take a moment...
---
✓ [PATCH v1 1/3] kselftest/arm64: Correct buffer allocation for SVE Z registers
✓ [PATCH v1 2/3] arm64/sve: Document our actual ABI for clearing registers on syscall
✓ [PATCH v1 3/3] kselftest/arm64: Enforce actual ABI for SVE syscalls
---
✓ Signed: openpgp/broonie@kernel.org
✓ Signed: DKIM/kernel.org
How to verify kernel developer identities #
Signing tags and commits is straightforward, but how does one go about verifying that the key used to sign something belongs to the actual kernel developer and not to a malicious imposter?
Configure auto-key-retrieval using WKD and DANE #
If you are not already someone with an extensive collection of other developers' public keys, then you can jumpstart your keyring by relying on key auto-discovery and auto-retrieval. GnuPG can piggyback on other delegated trust technologies, namely DNSSEC and TLS, to get you going if the prospect of starting your own Web of Trust from scratch is too daunting.
Add the following to your ~/.gnupg/gpg.conf:
auto-key-locate wkd,dane,local
auto-key-retrieve
DNS-Based Authentication of Named Entities ("DANE") is a method for publishing public keys in DNS and securing them using DNSSEC signed zones. Web Key Directory ("WKD") is the alternative method that uses https lookups for the same purpose. When using either DANE or WKD for looking up public keys, GnuPG will validate DNSSEC or TLS certificates, respectively, before adding auto-retrieved public keys to your local keyring.
Kernel.org publishes the WKD for all developers who have kernel.org accounts. Once you have the above changes in your gpg.conf, you can auto-retrieve the keys for Linus Torvalds and Greg Kroah-Hartman (if you don't already have them):
$ gpg --locate-keys torvalds@kernel.org gregkh@kernel.org
If you have a kernel.org account, then you should add the kernel.org UID to your key to make WKD more useful to other kernel developers.
Web of Trust (WOT) vs. Trust on First Use (TOFU) #
PGP incorporates a trust delegation mechanism known as the "Web of Trust." At its core, this is an attempt to replace the need for centralized Certification Authorities of the HTTPS/TLS world. Instead of various software makers dictating who should be your trusted certifying entity, PGP leaves this responsibility to each user.
Unfortunately, very few people understand how the Web of Trust works. While it is still an important part of the OpenPGP specification, recent versions of GnuPG (2.2 and above) have implemented an alternative mechanism called "Trust on First Use" (TOFU). You can think of TOFU as "the SSH-like approach to trust." With SSH, the first time you connect to a remote system, its key fingerprint is recorded and remembered. If the key changes in the future, the SSH client will alert you and refuse to connect, forcing you to make a decision on whether you choose to trust the changed key or not. Similarly, the first time you import someone's PGP key, it is assumed to be valid. If at any point in the future GnuPG comes across another key with the same identity, both the previously imported key and the new key will be marked for verification and you will need to manually figure out which one to keep.
We recommend that you use the combined TOFU+PGP trust model (which is the new default in GnuPG v2). To set it, add (or modify) the trust-model setting in ~/.gnupg/gpg.conf:
trust-model tofu+pgp
Using the kernel.org web of trust repository #
Kernel.org maintains a git repository with developers' public keys as a replacement for replicating keyserver networks that have gone mostly dark in the past few years. The full documentation for how to set up that repository as your source of public keys can be found here:
If you are a kernel developer, please consider submitting your key for inclusion into that keyring.
SoC Platforms with DTS Compliance Requirements
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Overview #
SoC platforms or subarchitectures should follow all the rules from Documentation/process/maintainer-soc.rst. This document referenced in MAINTAINERS impose additional requirements listed below.
Strict DTS DT Schema and dtc Compliance #
No changes to the SoC platform Devicetree sources (DTS files) should introduce new make dtbs_check W=1 warnings. Warnings in a new board DTS, which are results of issues in an included DTSI file, are considered existing, not new warnings. For series split between different trees (DT bindings go via driver subsystem tree), warnings on linux-next are decisive. The platform maintainers have automation in place which should point out any new warnings.
If a commit introducing new warnings gets accepted somehow, the resulting issues shall be fixed in reasonable time (e.g. within one release) or the commit reverted.
SoC Subsystem
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Overview #
The SoC subsystem is a place of aggregation for SoC-specific code. The main components of the subsystem are:
-
devicetrees (DTS) for 32- & 64-bit ARM and RISC-V
-
32-bit ARM board files (arch/arm/mach*)
-
32- & 64-bit ARM defconfigs
-
SoC-specific drivers across architectures, in particular for 32- & 64-bit ARM, RISC-V and Loongarch
These "SoC-specific drivers" do not include clock, GPIO etc drivers that have other top-level maintainers. The drivers/soc/ directory is generally meant for kernel-internal drivers that are used by other drivers to provide SoC- specific functionality like identifying an SoC revision or interfacing with power domains.
The SoC subsystem also serves as an intermediate location for changes to drivers/bus, drivers/firmware, drivers/reset and drivers/memory. The addition of new platforms, or the removal of existing ones, often go through the SoC tree as a dedicated branch covering multiple subsystems.
-
The main SoC tree is housed on git.kernel.org:
https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git/
Maintainers #
Clearly this is quite a wide range of topics, which no one person, or even small group of people are capable of maintaining. Instead, the SoC subsystem is comprised of many submaintainers (platform maintainers), each taking care of individual platforms and driver subdirectories. In this regard, "platform" usually refers to a series of SoCs from a given vendor, for example, Nvidia's series of Tegra SoCs. Many submaintainers operate on a vendor level, responsible for multiple product lines. For several reasons, including acquisitions/different business units in a company, things vary significantly here. The various submaintainers are documented in the MAINTAINERS file.
Most of these submaintainers have their own trees where they stage patches, sending pull requests to the main SoC tree. These trees are usually, but not always, listed in MAINTAINERS.
What the SoC tree is not, however, is a location for architecture-specific code changes. Each architecture has its own maintainers that are responsible for architectural details, CPU errata and the like.
Submitting Patches for Given SoC #
All typical platform related patches should be sent via SoC submaintainers (platform-specific maintainers). This includes also changes to per-platform or shared defconfigs. Note that scripts/get_maintainer.pl might not provide correct addresses for the shared defconfig, so ignore its output and manually create CC-list based on MAINTAINERS file or use something like scripts/get_maintainer.pl -f drivers/soc/FOO/).
Submitting Patches to the Main SoC Maintainers #
The main SoC maintainers can be reached via the alias soc@kernel.org only in following cases:
-
There are no platform-specific maintainers.
-
Platform-specific maintainers are unresponsive.
-
Introducing a completely new SoC platform. Such new SoC work should be sent first to common mailing lists, pointed out by scripts/get_maintainer.pl, for community review. After positive community review, work should be sent to soc@kernel.org in one patchset containing new arch/foo/Kconfig entry, DTS files, MAINTAINERS file entry and optionally initial drivers with their Devicetree bindings. The MAINTAINERS file entry should list new platform-specific maintainers, who are going to be responsible for handling patches for the platform from now on.
Note that the soc@kernel.org is usually not the place to discuss the patches, thus work sent to this address should be already considered as acceptable by the community.
Information for (new) Submaintainers #
As new platforms spring up, they often bring with them new submaintainers, many of whom work for the silicon vendor, and may not be familiar with the process.
Devicetree ABI Stability #
Perhaps one of the most important things to highlight is that dt-bindings document the ABI between the devicetree and the kernel. Please read Documentation/devicetree/bindings/ABI.rst.
If changes are being made to a DTS that are incompatible with old kernels, the DTS patch should not be applied until the driver is, or an appropriate time later. Most importantly, any incompatible changes should be clearly pointed out in the patch description and pull request, along with the expected impact on existing users, such as bootloaders or other operating systems.
Driver Branch Dependencies #
A common problem is synchronizing changes between device drivers and devicetree files. Even if a change is compatible in both directions, this may require coordinating how the changes get merged through different maintainer trees.
Usually the branch that includes a driver change will also include the corresponding change to the devicetree binding description, to ensure they are in fact compatible. This means that the devicetree branch can end up causing warnings in the make dtbs_check step. If a devicetree change depends on missing additions to a header file in include/dt-bindings/, it will fail the make dtbs step and not get merged.
There are multiple ways to deal with this:
-
Avoid defining custom macros in include/dt-bindings/ for hardware constants that can be derived from a datasheet -- binding macros in header files should only be used as a last resort if there is no natural way to define a binding
-
Use literal values in the devicetree file in place of macros even when a header is required, and change them to the named representation in a following release
-
Defer the devicetree changes to a release after the binding and driver have already been merged
-
Change the bindings in a shared immutable branch that is used as the base for both the driver change and the devicetree changes
-
Add duplicate defines in the devicetree file guarded by an #ifndef section, removing them in a later release
Devicetree Naming Convention #
The general naming scheme for devicetree files is as follows. The aspects of a platform that are set at the SoC level, like CPU cores, are contained in a file named $soc.dtsi, for example, jh7100.dtsi. Integration details, that will vary from board to board, are described in $soc-$board.dts. An example of this is jh7100-beaglev-starlight.dts. Often many boards are variations on a theme, and frequently there are intermediate files, such as jh7100-common.dtsi, which sit between the $soc.dtsi and $soc-$board.dts files, containing the descriptions of common hardware.
Some platforms also have System on Modules, containing an SoC, which are then integrated into several different boards. For these platforms, $soc-$som.dtsi and $soc-$som-$board.dts are typical.
Directories are usually named after the vendor of the SoC at the time of its inclusion, leading to some historical directory names in the tree.
Validating Devicetree Files #
make dtbs_check can be used to validate that devicetree files are compliant with the dt-bindings that describe the ABI. Please read the section "Running checks" of Documentation/devicetree/bindings/writing-schema.rst for more information on the validation of devicetrees.
For new platforms, or additions to existing ones, make dtbs_check should not add any new warnings. For RISC-V and Samsung SoC, make dtbs_check W=1 is required to not add any new warnings. If in any doubt about a devicetree change, reach out to the devicetree maintainers.
Branches and Pull Requests #
Just as the main SoC tree has several branches, it is expected that submaintainers will do the same. Driver, defconfig and devicetree changes should all be split into separate branches and appear in separate pull requests to the SoC maintainers. Each branch should be usable by itself and avoid regressions that originate from dependencies on other branches.
Small sets of patches can also be sent as separate emails to soc@kernel.org, grouped into the same categories.
If changes do not fit into the normal patterns, there can be additional top-level branches, e.g. for a treewide rework, or the addition of new SoC platforms including dts files and drivers.
Branches with a lot of changes can benefit from getting split up into separate topics branches, even if they end up getting merged into the same branch of the SoC tree. An example here would be one branch for devicetree warning fixes, one for a rework and one for newly added boards.
Another common way to split up changes is to send an early pull request with the majority of the changes at some point between rc1 and rc4, following up with one or more smaller pull requests towards the end of the cycle that can add late changes or address problems identified while testing the first set.
While there is no cut-off time for late pull requests, it helps to only send small branches as time gets closer to the merge window.
Pull requests for bugfixes for the current release can be sent at any time, but again having multiple smaller branches is better than trying to combine too many patches into one pull request.
The subject line of a pull request should begin with "[GIT PULL]" and made using a signed tag, rather than a branch. This tag should contain a short description summarising the changes in the pull request. For more detail on sending pull requests, please see Documentation/maintainer/pull-requests.rst.
The tip tree handbook
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
What is the tip tree? #
The tip tree is a collection of several subsystems and areas of development. The tip tree is both a direct development tree and an aggregation tree for several sub-maintainer trees. The tip tree gitweb URL is: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
The tip tree contains the following subsystems:
x86 architecture
The x86 architecture development takes place in the tip tree except for the x86 KVM and XEN specific parts which are maintained in the corresponding subsystems and routed directly to mainline from there. It's still good practice to Cc the x86 maintainers on x86-specific KVM and XEN patches.
Some x86 subsystems have their own maintainers in addition to the overall x86 maintainers. Please Cc the overall x86 maintainers on patches touching files in arch/x86 even when they are not called out by the MAINTAINER file.
Note, that
x86@kernel.orgis not a mailing list. It is merely a mail alias which distributes mails to the x86 top-level maintainer team. Please always Cc the Linux Kernel mailing list (LKML)linux-kernel@vger.kernel.org, otherwise your mail ends up only in the private inboxes of the maintainers.Scheduler
Scheduler development takes place in the -tip tree, in the sched/core branch - with occasional sub-topic trees for work-in-progress patch-sets.
Locking and atomics
Locking development (including atomics and other synchronization primitives that are connected to locking) takes place in the -tip tree, in the locking/core branch - with occasional sub-topic trees for work-in-progress patch-sets.
Generic interrupt subsystem and interrupt chip drivers:
interrupt core development happens in the irq/core branch
interrupt chip driver development also happens in the irq/core branch, but the patches are usually applied in a separate maintainer tree and then aggregated into irq/core
Time, timers, timekeeping, NOHZ and related chip drivers:
timekeeping, clocksource core, NTP and alarmtimer development happens in the timers/core branch, but patches are usually applied in a separate maintainer tree and then aggregated into timers/core
clocksource/event driver development happens in the timers/core branch, but patches are mostly applied in a separate maintainer tree and then aggregated into timers/core
Performance counters core, architecture support and tooling:
perf core and architecture support development happens in the perf/core branch
perf tooling development happens in the perf tools maintainer tree and is aggregated into the tip tree.
CPU hotplug core
RAS core
Mostly x86-specific RAS patches are collected in the tip ras/core branch.
EFI core
EFI development in the efi git tree. The collected patches are aggregated in the tip efi/core branch.
RCU
RCU development happens in the linux-rcu tree. The resulting changes are aggregated into the tip core/rcu branch.
Various core code components:
debugobjects
objtool
random bits and pieces
Patch submission notes #
Selecting the tree/branch #
In general, development against the head of the tip tree master branch is fine, but for the subsystems which are maintained separately, have their own git tree and are only aggregated into the tip tree, development should take place against the relevant subsystem tree or branch.
Bug fixes which target mainline should always be applicable against the mainline kernel tree. Potential conflicts against changes which are already queued in the tip tree are handled by the maintainers.
Patch subject #
The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq/core:'. Please do not use file names or complete file paths as prefix. 'git log path/to/file' should give you a reasonable hint in most cases.
The condensed patch description in the subject line should start with an uppercase letter and should be written in imperative tone.
Changelog #
The general rules about changelogs in the Submitting patches guide, apply.
The tip tree maintainers set value on following these rules, especially on the request to write changelogs in imperative mood and not impersonating code or the execution of it. This is not just a whim of the maintainers. Changelogs written in abstract words are more precise and tend to be less confusing than those written in the form of novels.
It's also useful to structure the changelog into several paragraphs and not lump everything together into a single one. A good structure is to explain the context, the problem and the solution in separate paragraphs and this order.
Examples for illustration:
Example 1:
x86/intel_rdt/mbm: Fix MBM overflow handler during hot cpu When a CPU is dying, we cancel the worker and schedule a new worker on a different CPU on the same domain. But if the timer is already about to expire (say 0.99s) then we essentially double the interval. We modify the hot cpu handling to cancel the delayed work on the dying cpu and run the worker immediately on a different cpu in same domain. We do not flush the worker because the MBM overflow worker reschedules the worker on same CPU and scans the domain->cpu_mask to get the domain pointer.Improved version:
x86/intel_rdt/mbm: Fix MBM overflow handler during CPU hotplug When a CPU is dying, the overflow worker is canceled and rescheduled on a different CPU in the same domain. But if the timer is already about to expire this essentially doubles the interval which might result in a non detected overflow. Cancel the overflow worker and reschedule it immediately on a different CPU in the same domain. The work could be flushed as well, but that would reschedule it on the same CPU.Example 2:
time: POSIX CPU timers: Ensure that variable is initialized If cpu_timer_sample_group returns -EINVAL, it will not have written into *sample. Checking for cpu_timer_sample_group's return value precludes the potential use of an uninitialized value of now in the following block. Given an invalid clock_idx, the previous code could otherwise overwrite *oldval in an undefined manner. This is now prevented. We also exploit short-circuiting of && to sample the timer only if the result will actually be used to update *oldval.Improved version:
posix-cpu-timers: Make set_process_cpu_timer() more robust Because the return value of cpu_timer_sample_group() is not checked, compilers and static checkers can legitimately warn about a potential use of the uninitialized variable 'now'. This is not a runtime issue as all call sites hand in valid clock ids. Also cpu_timer_sample_group() is invoked unconditionally even when the result is not used because *oldval is NULL. Make the invocation conditional and check the return value.Example 3:
The entity can also be used for other purposes. Let's rename it to be more generic.Improved version:
The entity can also be used for other purposes. Rename it to be more generic.
For complex scenarios, especially race conditions and memory ordering issues, it is valuable to depict the scenario with a table which shows the parallelism and the temporal order of events. Here is an example:
CPU0 CPU1
free_irq(X) interrupt X
spin_lock(desc->lock)
wake irq thread()
spin_unlock(desc->lock)
spin_lock(desc->lock)
remove action()
shutdown_irq()
release_resources() thread_handler()
spin_unlock(desc->lock) access released resources.
^^^^^^^^^^^^^^^^^^^^^^^^^
synchronize_irq()
Lockdep provides similar useful output to depict a possible deadlock scenario:
CPU0 CPU1
rtmutex_lock(&rcu->rt_mutex)
spin_lock(&rcu->rt_mutex.wait_lock)
local_irq_disable()
spin_lock(&timer->it_lock)
spin_lock(&rcu->mutex.wait_lock)
--> Interrupt
spin_lock(&timer->it_lock)
Function references in changelogs #
When a function is mentioned in the changelog, either the text body or the subject line, please use the format 'function_name()'. Omitting the brackets after the function name can be ambiguous:
Subject: subsys/component: Make reservation_count static
reservation_count is only used in reservation_stats. Make it static.
The variant with brackets is more precise:
Subject: subsys/component: Make reservation_count() static
reservation_count() is only called from reservation_stats(). Make it
static.
Backtraces in changelogs #
See Backtraces in commit messages.
Ordering of commit tags #
To have a uniform view of the commit tags, the tip maintainers use the following tag ordering scheme:
Fixes: 12+char-SHA1 ("sub/sys: Original subject line")
A Fixes tag should be added even for changes which do not need to be backported to stable kernels, i.e. when addressing a recently introduced issue which only affects tip or the current head of mainline. These tags are helpful to identify the original commit and are much more valuable than prominently mentioning the commit which introduced a problem in the text of the changelog itself because they can be automatically extracted.
The following example illustrates the difference:
Commit abcdef012345678 ("x86/xxx: Replace foo with bar") left an unused instance of variable foo around. Remove it. Signed-off-by: J.Dev <j.dev@mail>Please say instead:
The recent replacement of foo with bar left an unused instance of variable foo around. Remove it. Fixes: abcdef012345678 ("x86/xxx: Replace foo with bar") Signed-off-by: J.Dev <j.dev@mail>The latter puts the information about the patch into the focus and amends it with the reference to the commit which introduced the issue rather than putting the focus on the original commit in the first place.
Reported-by:
Reporter <reporter@mail>Closes:
URL or Message-ID of the bug report this is fixingOriginally-by:
Original author <original-author@mail>Suggested-by:
Suggester <suggester@mail>Co-developed-by:
Co-author <co-author@mail>Signed-off-by:
Co-author <co-author@mail>Note, that Co-developed-by and Signed-off-by of the co-author(s) must come in pairs.
Signed-off-by:
Author <author@mail>The first Signed-off-by (SOB) after the last Co-developed-by/SOB pair is the author SOB, i.e. the person flagged as author by git.
Signed-off-by:
Patch handler <handler@mail>SOBs after the author SOB are from people handling and transporting the patch, but were not involved in development. SOB chains should reflect the real route a patch took as it was propagated to us, with the first SOB entry signalling primary authorship of a single author. Acks should be given as Acked-by lines and review approvals as Reviewed-by lines.
If the handler made modifications to the patch or the changelog, then this should be mentioned after the changelog text and above all commit tags in the following format:
... changelog text ends. [ handler: Replaced foo by bar and updated changelog ] First-tag: .....Note the two empty new lines which separate the changelog text and the commit tags from that notice.
If a patch is sent to the mailing list by a handler then the author has to be noted in the first line of the changelog with:
From: Author <author@mail> Changelog text starts here....so the authorship is preserved. The 'From:' line has to be followed by a empty newline. If that 'From:' line is missing, then the patch would be attributed to the person who sent (transported, handled) it. The 'From:' line is automatically removed when the patch is applied and does not show up in the final git changelog. It merely affects the authorship information of the resulting Git commit.
Tested-by:
Tester <tester@mail>Reviewed-by:
Reviewer <reviewer@mail>Acked-by:
Acker <acker@mail>Cc:
cc-ed-person <person@mail>If the patch should be backported to stable, then please add a '
Cc: stable@vger.kernel.org' tag, but do not Cc stable when sending your mail.Link:
https://link/to/informationFor referring to an email posted to the kernel mailing lists, please use the lore.kernel.org redirector URL:
Link: https://lore.kernel.org/email-message-id@hereThis URL should be used when referring to relevant mailing list topics, related patch sets, or other notable discussion threads. A convenient way to associate
Link:trailers with the commit message is to use markdown-like bracketed notation, for example:A similar approach was attempted before as part of a different effort [1], but the initial implementation caused too many regressions [2], so it was backed out and reimplemented. Link: https://lore.kernel.org/some-msgid@here # [1] Link: https://bugzilla.example.org/bug/12345 # [2]You can also use
Link:trailers to indicate the origin of the patch when applying it to your git tree. In that case, please use the dedicatedpatch.msgid.linkdomain instead oflore.kernel.org. This practice makes it possible for automated tooling to identify which link to use to retrieve the original patch submission. For example:Link: https://patch.msgid.link/patch-source-message-id@here
Please do not use combined tags, e.g. Reported-and-tested-by, as they just complicate automated extraction of tags.
Links to documentation #
Providing links to documentation in the changelog is a great help to later debugging and analysis. Unfortunately, URLs often break very quickly because companies restructure their websites frequently. Non-'volatile' exceptions include the Intel SDM and the AMD APM.
Therefore, for 'volatile' documents, please create an entry in the kernel bugzilla https://bugzilla.kernel.org and attach a copy of these documents to the bugzilla entry. Finally, provide the URL of the bugzilla entry in the changelog.
Patch resend or reminders #
See Don't get discouraged - or impatient.
Merge window #
Please do not expect patches to be reviewed or merged by tip maintainers around or during the merge window. The trees are closed to all but urgent fixes during this time. They reopen once the merge window closes and a new -rc1 kernel has been released.
Large series should be submitted in mergeable state at least a week before the merge window opens. Exceptions are made for bug fixes and sometimes for small standalone drivers for new hardware or minimally invasive patches for hardware enablement.
During the merge window, the maintainers instead focus on following the upstream changes, fixing merge window fallout, collecting bug fixes, and allowing themselves a breath. Please respect that.
So called _urgent_ branches will be merged into mainline during the stabilization phase of each release.
Git #
The tip maintainers accept git pull requests from maintainers who provide subsystem changes for aggregation in the tip tree.
Pull requests for new patch submissions are usually not accepted and do not replace proper patch submission to the mailing list. The main reason for this is that the review workflow is email based.
If you submit a larger patch series it is helpful to provide a git branch in a private repository which allows interested people to easily pull the series for testing. The usual way to offer this is a git URL in the cover letter of the patch series.
Testing #
Code should be tested before submitting to the tip maintainers. Anything other than minor changes should be built, booted and tested with comprehensive (and heavyweight) kernel debugging options enabled.
These debugging options can be found in kernel/configs/x86_debug.config and can be added to an existing kernel config by running:
make x86_debug.config
Some of these options are x86-specific and can be left out when testing on other architectures.
Coding style notes #
Comment style #
Sentences in comments start with an uppercase letter.
Single line comments:
/* This is a single line comment */
Multi-line comments:
/*
* This is a properly formatted
* multi-line comment.
*
* Larger multi-line comments should be split into paragraphs.
*/
No tail comments (see below):
Please refrain from using tail comments. Tail comments disturb the reading flow in almost all contexts, but especially in code:
if (somecondition_is_true) /* Don't put a comment here */ dostuff(); /* Neither here */ seed = MAGIC_CONSTANT; /* Nor here */Use freestanding comments instead:
/* This condition is not obvious without a comment */ if (somecondition_is_true) { /* This really needs to be documented */ dostuff(); } /* This magic initialization needs a comment. Maybe not? */ seed = MAGIC_CONSTANT;Use C++ style, tail comments when documenting structs in headers to achieve a more compact layout and better readability:
// eax u32 x2apic_shift : 5, // Number of bits to shift APIC ID right // for the topology ID at the next level : 27; // Reserved // ebx u32 num_processors : 16, // Number of processors at current level : 16; // Reservedversus:
/* eax */ /* * Number of bits to shift APIC ID right for the topology ID * at the next level */ u32 x2apic_shift : 5, /* Reserved */ : 27; /* ebx */ /* Number of processors at current level */ u32 num_processors : 16, /* Reserved */ : 16;
Comment the important things:
Comments should be added where the operation is not obvious. Documenting the obvious is just a distraction:
/* Decrement refcount and check for zero */ if (refcount_dec_and_test(&p->refcnt)) { do; lots; of; magic; things; }Instead, comments should explain the non-obvious details and document constraints:
if (refcount_dec_and_test(&p->refcnt)) { /* * Really good explanation why the magic things below * need to be done, ordering and locking constraints, * etc.. */ do; lots; of; magic; /* Needs to be the last operation because ... */ things; }
Function documentation comments:
To document functions and their arguments please use kernel-doc format and not free form comments:
/** * magic_function - Do lots of magic stuff * @magic: Pointer to the magic data to operate on * @offset: Offset in the data array of @magic * * Deep explanation of mysterious things done with @magic along * with documentation of the return values. * * Note, that the argument descriptors above are arranged * in a tabular fashion. */This applies especially to globally visible functions and inline functions in public header files. It might be overkill to use kernel-doc format for every (static) function which needs a tiny explanation. The usage of descriptive function names often replaces these tiny comments. Apply common sense as always.
Documenting locking requirements #
Documenting locking requirements is a good thing, but comments are not necessarily the best choice. Instead of writing:
/* Caller must hold foo->lock */ void func(struct foo *foo) { ... }Please use:
void func(struct foo *foo) { lockdep_assert_held(&foo->lock); ... }In PROVE_LOCKING kernels, lockdep_assert_held() emits a warning if the caller doesn't hold the lock. Comments can't do that.
Bracket rules #
Brackets should be omitted only if the statement which follows 'if', 'for', 'while' etc. is truly a single line:
if (foo)
do_something();
The following is not considered to be a single line statement even though C does not require brackets:
for (i = 0; i < end; i++)
if (foo[i])
do_something(foo[i]);
Adding brackets around the outer loop enhances the reading flow:
for (i = 0; i < end; i++) {
if (foo[i])
do_something(foo[i]);
}
Variable declarations #
The preferred ordering of variable declarations at the beginning of a function is reverse fir tree order:
struct long_struct_name *descriptive_name;
unsigned long foo, bar;
unsigned int tmp;
int ret;
The above is faster to parse than the reverse ordering:
int ret;
unsigned int tmp;
unsigned long foo, bar;
struct long_struct_name *descriptive_name;
And even more so than random ordering:
unsigned long foo, bar;
int ret;
struct long_struct_name *descriptive_name;
unsigned int tmp;
Also please try to aggregate variables of the same type into a single line. There is no point in wasting screen space:
unsigned long a;
unsigned long b;
unsigned long c;
unsigned long d;
It's really sufficient to do:
unsigned long a, b, c, d;
Please also refrain from introducing line splits in variable declarations:
struct long_struct_name *descriptive_name = container_of(bar,
struct long_struct_name,
member);
struct foobar foo;
It's way better to move the initialization to a separate line after the declarations:
struct long_struct_name *descriptive_name;
struct foobar foo;
descriptive_name = container_of(bar, struct long_struct_name, member);
Variable types #
Please use the proper u8, u16, u32, u64 types for variables which are meant to describe hardware or are used as arguments for functions which access hardware. These types are clearly defining the bit width and avoid truncation, expansion and 32/64-bit confusion.
u64 is also recommended in code which would become ambiguous for 32-bit kernels when 'unsigned long' would be used instead. While in such situations 'unsigned long long' could be used as well, u64 is shorter and also clearly shows that the operation is required to be 64 bits wide independent of the target CPU.
Please use 'unsigned int' instead of 'unsigned'.
Constants #
Please do not use literal (hexa)decimal numbers in code or initializers. Either use proper defines which have descriptive names or consider using an enum.
Struct declarations and initializers #
Struct declarations should align the struct member names in a tabular fashion:
struct bar_order {
unsigned int guest_id;
int ordered_item;
struct menu *menu;
};
Please avoid documenting struct members within the declaration, because this often results in strangely formatted comments and the struct members become obfuscated:
struct bar_order {
unsigned int guest_id; /* Unique guest id */
int ordered_item;
/* Pointer to a menu instance which contains all the drinks */
struct menu *menu;
};
Instead, please consider using the kernel-doc format in a comment preceding the struct declaration, which is easier to read and has the added advantage of including the information in the kernel documentation, for example, as follows:
/**
* struct bar_order - Description of a bar order
* @guest_id: Unique guest id
* @ordered_item: The item number from the menu
* @menu: Pointer to the menu from which the item
* was ordered
*
* Supplementary information for using the struct.
*
* Note, that the struct member descriptors above are arranged
* in a tabular fashion.
*/
struct bar_order {
unsigned int guest_id;
int ordered_item;
struct menu *menu;
};
Static struct initializers must use C99 initializers and should also be aligned in a tabular fashion:
static struct foo statfoo = {
.a = 0,
.plain_integer = CONSTANT_DEFINE_OR_ENUM,
.bar = &statbar,
};
Note that while C99 syntax allows the omission of the final comma, we recommend the use of a comma on the last line because it makes reordering and addition of new lines easier, and makes such future patches slightly easier to read as well.
Line breaks #
Restricting line length to 80 characters makes deeply indented code hard to read. Consider breaking out code into helper functions to avoid excessive line breaking.
The 80 character rule is not a strict rule, so please use common sense when breaking lines. Especially format strings should never be broken up.
When splitting function declarations or function calls, then please align the first argument in the second line with the first argument in the first line:
static int long_function_name(struct foobar *barfoo, unsigned int id,
unsigned int offset)
{
if (!id) {
ret = longer_function_name(barfoo, DEFAULT_BARFOO_ID,
offset);
...
Namespaces #
Function/variable namespaces improve readability and allow easy grepping. These namespaces are string prefixes for globally visible function and variable names, including inlines. These prefixes should combine the subsystem and the component name such as 'x86_comp_', 'sched_', 'irq_', and 'mutex_'.
This also includes static file scope functions that are immediately put into globally visible driver templates - it's useful for those symbols to carry a good prefix as well, for backtrace readability.
Namespace prefixes may be omitted for local static functions and variables. Truly local functions, only called by other local functions, can have shorter descriptive names - our primary concern is greppability and backtrace readability.
Please note that 'xxx_vendor_' and 'vendor_xxx_` prefixes are not helpful for static functions in vendor-specific files. After all, it is already clear that the code is vendor-specific. In addition, vendor names should only be for truly vendor-specific functionality.
As always apply common sense and aim for consistency and readability.
Commit notifications #
The tip tree is monitored by a bot for new commits. The bot sends an email for each new commit to a dedicated mailing list (linux-tip-commits@vger.kernel.org) and Cc's all people who are mentioned in one of the commit tags. It uses the email message ID from the Link tag at the end of the tag list to set the In-Reply-To email header so the message is properly threaded with the patch submission email.
The tip maintainers and submaintainers try to reply to the submitter when merging a patch, but they sometimes forget or it does not fit the workflow of the moment. While the bot message is purely mechanical, it also implies a 'Thank you! Applied.'.
Maintainers
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Descriptions of section entries and preferred order #
M: *Mail* patches to: FullName <address@domain>
R: Designated *Reviewer*: FullName <address@domain>
These reviewers should be CCed on patches.
L: *Mailing list* that is relevant to this area
S: *Status*, one of the following:
Supported: Someone is actually paid to look after this.
Maintained: Someone actually looks after it.
Odd Fixes: It has a maintainer but they don't have time to do
much other than throw the odd patch in. See below..
Orphan: No current maintainer [but maybe you could take the
role as you write your new code].
Obsolete: Old code. Something tagged obsolete generally means
it has been replaced by a better system and you
should be using that.
W: *Web-page* with status/info
Q: *Patchwork* web based patch tracking system site
B: URI for where to file *bugs*. A web-page with detailed bug
filing info, a direct bug tracker link, or a mailto: URI.
C: URI for *chat* protocol, server and channel where developers
usually hang out, for example irc://server/channel.
P: *Subsystem Profile* document for more details submitting
patches to the given subsystem. This is either an in-tree file,
or a URI. See Documentation/maintainer/maintainer-entry-profile.rst
for details.
T: *SCM* tree type and location.
Type is one of: git, hg, quilt, stgit, topgit
F: *Files* and directories wildcard patterns.
A trailing slash includes all files and subdirectory files.
F: drivers/net/ all files in and below drivers/net
F: drivers/net/* all files in drivers/net, but not below
F: */net/* all files in "any top level directory"/net
One pattern per line. Multiple F: lines acceptable.
X: *Excluded* files and directories that are NOT maintained, same
rules as F:. Files exclusions are tested before file matches.
Can be useful for excluding a specific subdirectory, for instance:
F: net/
X: net/ipv6/
matches all files in and below net excluding net/ipv6/
N: Files and directories *Regex* patterns.
N: [^a-z]tegra all files whose path contains tegra
(not including files like integrator)
One pattern per line. Multiple N: lines acceptable.
scripts/get_maintainer.pl has different behavior for files that
match F: pattern and matches of N: patterns. By default,
get_maintainer will not look at git log history when an F: pattern
match occurs. When an N: match occurs, git log history is used
to also notify the people that have git commit signatures.
K: *Content regex* (perl extended) pattern match in a patch or file.
For instance:
K: of_get_profile
matches patches or files that contain "of_get_profile"
K: \b(printk|pr_(info|err))\b
matches patches or files that contain one or more of the words
printk, pr_info or pr_err
One regex pattern per line. Multiple K: lines acceptable.
Maintainers List #
3C59X NETWORK DRIVER #
- Mail: Steffen Klassert <klassert@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/networking/device_drivers/ethernet/3com/vortex.rst,drivers/net/ethernet/3com/3c59x.c
3CR990 NETWORK DRIVER #
- Mail: David Dillow <dave@thedillows.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/3com/typhoon*
3WARE SAS/SATA-RAID SCSI DRIVERS (3W-XXXX, 3W-9XXX, 3W-SAS) #
- Mail: Adam Radford <aradford@gmail.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.lsi.com
- Files:
drivers/scsi/3w-*
53C700 AND 53C700-66 SCSI DRIVER #
- Mail: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/53c700*
6LOWPAN GENERIC (BTLE/IEEE 802.15.4) #
- Mail: Alexander Aring <alex.aring@gmail.com>
- Mailing list: linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/6lowpan.rst,include/net/6lowpan.h,net/6lowpan/
6PACK NETWORK DRIVER FOR AX.25 #
- Mail: Andreas Koensgen <ajk@comnets.uni-bremen.de>
- Mailing list: linux-hams@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/hamradio/6pack.c
802.11 (including CFG80211/NL80211) #
- Mail: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/
- Patchwork: https://patchwork.kernel.org/project/linux-wireless/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git, git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
- Files:
Documentation/driver-api/80211/cfg80211.rst,Documentation/networking/regulatory.rst,include/linux/ieee80211.h,include/net/cfg80211.h,include/net/ieee80211_radiotap.h,include/net/iw_handler.h,include/net/wext.h,include/uapi/linux/nl80211.h - Regex:
include/uapi/linux/nl80211-.* - Files:
include/uapi/linux/wireless.h,net/wireless/
8169 10/100/1000 GIGABIT ETHERNET DRIVER #
- Mail: Heiner Kallweit <hkallweit1@gmail.com>, nic_swsd@realtek.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/realtek/r8169*
8250/16?50 (AND CLONE UARTS) SERIAL DRIVER #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
- Files:
drivers/tty/serial/8250*,include/linux/serial_8250.h
8390 NETWORK DRIVERS [WD80x3/SMC-ELITE, SMC-ULTRA, NE2000, 3C503, etc.] #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan / Obsolete
- Files:
drivers/net/ethernet/8390/
9P FILE SYSTEM #
- Mail: Eric Van Hensbergen <ericvh@kernel.org>, Latchesar Ionkov <lucho@ionkov.net>, Dominique Martinet <asmadeus@codewreck.org>
- Reviewer: Christian Schoenebeck <linux_oss@crudebyte.com>
- Mailing list: v9fs@lists.linux.dev
- Status: Maintained
- Web-page: http://github.com/v9fs
- Patchwork: http://patchwork.kernel.org/project/v9fs-devel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs.git, git https://github.com/martinetd/linux.git
- Files:
Documentation/filesystems/9p.rst,fs/9p/,include/net/9p/,include/trace/events/9p.h,include/uapi/linux/virtio_9p.h,net/9p/
A64FX DIAG DRIVER #
- Mail: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
- Status: Supported
- Files:
drivers/soc/fujitsu/a64fx-diag.c
A8293 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/a8293*
AACRAID SCSI RAID DRIVER #
- Mail: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.adaptec.com/
- Files:
Documentation/scsi/aacraid.rst,drivers/scsi/aacraid/
AAEON UPBOARD FPGA MFD DRIVER #
- Mail: Thomas Richard <thomas.richard@bootlin.com>
- Status: Maintained
- Files:
drivers/leds/leds-upboard.c,drivers/mfd/upboard-fpga.c,drivers/pinctrl/pinctrl-upboard.c,include/linux/mfd/upboard-fpga.h
AB8500 BATTERY AND CHARGER DRIVERS #
- Mail: Linus Walleij <linusw@kernel.org>
- Files:
Documentation/devicetree/bindings/power/supply/*ab8500*,drivers/power/supply/*ab8500*
ABI/API #
- Mailing list: linux-api@vger.kernel.org
- Files:
include/linux/syscalls.h,kernel/sys_ni.c - Excluded:
arch/*/include/uapi/,include/uapi/
ABIT UGURU 1,2 HARDWARE MONITOR DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/abituguru.c
ABIT UGURU 3 HARDWARE MONITOR DRIVER #
- Mail: Alistair John Strachan <alistair@devzero.co.uk>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/abituguru3.c
ACCES 104-DIO-48E GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-104-dio-48e.c
ACCES 104-IDI-48 GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-104-idi-48.c
ACCES 104-IDIO-16 GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-104-idio-16.c
ACCES 104-QUAD-8 DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/counter/104-quad-8.c
ACCES IDIO-16 GPIO LIBRARY #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-idio-16.c,drivers/gpio/gpio-idio-16.h
ACCES PCI-IDIO-16 GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-pci-idio-16.c
ACCES PCIe-IDIO-24 GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-pcie-idio-24.c
ACENIC DRIVER #
- Mail: Jes Sorensen <jes@trained-monkey.org>
- Mailing list: linux-acenic@sunsite.dk
- Status: Maintained
- Files:
drivers/net/ethernet/alteon/acenic*
ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER #
- Mail: Peter Kaestle <peter@piie.net>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: http://piie.net/?section=acerhdf
- Files:
drivers/platform/x86/acerhdf.c
ACER WMI LAPTOP EXTRAS #
- Mail: "Lee, Chun-Yi" <jlee@suse.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/acer-wmi.c
ACPI #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Reviewer: Len Brown <lenb@kernel.org>
- Mailing list: linux-acpi@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-acpi/list/
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
- Files:
Documentation/ABI/testing/configfs-acpi,Documentation/ABI/testing/sysfs-bus-acpi,Documentation/firmware-guide/acpi/,arch/x86/kernel/acpi/,arch/x86/pci/acpi.c,drivers/acpi/,drivers/pci/*/*acpi*,drivers/pci/*acpi*,drivers/pnp/pnpacpi/,include/acpi/,include/linux/acpi.h,include/linux/fwnode.h,include/linux/fw_table.h,lib/fw_table.c,rust/kernel/acpi.rs,tools/power/acpi/
ACPI APEI #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Reviewer: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>, Hanjun Guo <guohanjun@huawei.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Shuai Xue <xueshuai@linux.alibaba.com>
- Mailing list: linux-acpi@vger.kernel.org
- Files:
drivers/acpi/apei/,drivers/firmware/efi/cper*
ACPI COMPONENT ARCHITECTURE (ACPICA) #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>, Robert Moore <robert.moore@intel.com>
- Mailing list: linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev
- Status: Supported
- Web-page: https://acpica.org/, https://github.com/acpica/acpica/
- Patchwork: https://patchwork.kernel.org/project/linux-acpi/list/
- bugs: https://bugzilla.kernel.org, https://bugs.acpica.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
- Files:
drivers/acpi/acpica/,include/acpi/,tools/power/acpi/
ACPI FOR ARM64 (ACPI/arm64) #
- Mail: Lorenzo Pieralisi <lpieralisi@kernel.org>, Hanjun Guo <guohanjun@huawei.com>, Sudeep Holla <sudeep.holla@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
- Mailing list: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/acpi/arm64,include/linux/acpi_iort.h
ACPI FOR RISC-V (ACPI/riscv) #
- Mail: Sunil V L <sunilvl@ventanamicro.com>
- Mailing list: linux-acpi@vger.kernel.org, linux-riscv@lists.infradead.org
- Status: Maintained
- Files:
drivers/acpi/riscv/,include/linux/acpi_rimt.h
ACPI PCC(Platform Communication Channel) MAILBOX DRIVER #
- Mail: Sudeep Holla <sudeep.holla@kernel.org>
- Mailing list: linux-acpi@vger.kernel.org
- Status: Supported
- Files:
drivers/mailbox/pcc.c
ACPI PMIC DRIVERS #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>
- Reviewer: Andy Shevchenko <andy@kernel.org>, Mika Westerberg <westeri@kernel.org>
- Mailing list: linux-acpi@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-acpi/list/
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
- Files:
drivers/acpi/pmic/
ACPI QUICKSTART DRIVER #
- Mail: Armin Wolf <W_Armin@gmx.de>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/quickstart.c
ACPI SERIAL MULTI INSTANTIATE DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/serial-multi-instantiate.c
ACPI THERMAL DRIVER #
- Mail: Rafael J. Wysocki <rafael@kernel.org>
- Reviewer: Zhang Rui <rui.zhang@intel.com>
- Mailing list: linux-acpi@vger.kernel.org
- Status: Supported
- bugs: https://bugzilla.kernel.org
- Files:
drivers/acpi/*thermal*
ACPI VIOT DRIVER #
- Mail: Jean-Philippe Brucker <jpb@kernel.org>
- Mailing list: linux-acpi@vger.kernel.org, iommu@lists.linux.dev
- Status: Maintained
- Files:
drivers/acpi/viot.c,include/linux/acpi_viot.h
ACPI WMI DRIVER #
- Mail: Armin Wolf <W_Armin@gmx.de>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-wmi,Documentation/driver-api/wmi.rst,Documentation/wmi/,drivers/platform/wmi/,include/uapi/linux/wmi.h
ACRN HYPERVISOR SERVICE MODULE #
- Mail: Fei Li <fei1.li@intel.com>
- Mailing list: acrn-dev@lists.projectacrn.org (subscribers-only)
- Status: Supported
- Web-page: https://projectacrn.org
- Files:
Documentation/virt/acrn/,drivers/virt/acrn/,include/uapi/linux/acrn.h
AD1889 ALSA SOUND DRIVER #
- Mailing list: linux-parisc@vger.kernel.org
- Status: Maintained
- Web-page: https://parisc.wiki.kernel.org/index.php/AD1889
- Files:
sound/pci/ad1889.*
AD5110 ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER #
- Mail: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/iio/potentiometer/ad5110.c
AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/AD5254, https://ez.analog.com/linux-software-drivers
- Files:
drivers/misc/ad525x_dpot.c
AD5398 CURRENT REGULATOR DRIVER (AD5398/AD5821) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/AD5398, https://ez.analog.com/linux-software-drivers
- Files:
drivers/regulator/ad5398.c
AD5446 ANALOG DEVICES INC AD5446 DAC DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ad5446.yaml,drivers/iio/dac/ad5446-i2c.c,drivers/iio/dac/ad5446-spi.c,drivers/iio/dac/ad5446.c,drivers/iio/dac/ad5446.h
AD714X CAPACITANCE TOUCH SENSOR DRIVER (AD7142/3/7/8/7A) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/AD7142, https://ez.analog.com/linux-software-drivers
- Files:
drivers/input/misc/ad714x.c
AD738X ADC DRIVER (AD7380/1/2/4) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: David Lechner <dlechner@baylibre.com>
- Status: Supported
- Web-page: https://wiki.analog.com/resources/tools-software/linux-drivers/iio-adc/ad738x, https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml,Documentation/iio/ad7380.rst,drivers/iio/adc/ad7380.c
AD7476 ADC DRIVER FOR VARIOUS SIMPLE 1-CHANNEL SPI ADCs #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Maintained
- Files:
drivers/iio/adc/ad7476.c
AD7877 TOUCHSCREEN DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/AD7877, https://ez.analog.com/linux-software-drivers
- Files:
drivers/input/touchscreen/ad7877.c
AD7879 TOUCHSCREEN DRIVER (AD7879/AD7889) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/AD7879, https://ez.analog.com/linux-software-drivers
- Files:
drivers/input/touchscreen/ad7879.c
AD7944 ADC DRIVER (AD7944/AD7985/AD7986) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: David Lechner <dlechner@baylibre.com>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7944.yaml,Documentation/iio/ad7944.rst,drivers/iio/adc/ad7944.c
ADAFRUIT MINI I2C GAMEPAD #
- Mail: Anshul Dalal <anshulusr@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/adafruit,seesaw-gamepad.yaml,drivers/input/joystick/adafruit-seesaw.c
ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR) #
- Mail: Jiri Kosina <jikos@kernel.org>
- Status: Maintained
ADF7242 IEEE 802.15.4 RADIO DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Mailing list: linux-wpan@vger.kernel.org
- Status: Supported
- Web-page: https://wiki.analog.com/ADF7242, https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/net/ieee802154/adf7242.txt,drivers/net/ieee802154/adf7242.c
ADM1025 HARDWARE MONITOR DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/adm1025.rst,drivers/hwmon/adm1025.c
ADM1029 HARDWARE MONITOR DRIVER #
- Mail: Corentin Labbe <clabbe.montjoie@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/adm1029.c
ADM8211 WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wireless/admtek/
ADP1050 HARDWARE MONITOR DRIVER #
- Mail: Radu Sabau <radu.sabau@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/pmbus/adi,adp1050.yaml
ADP1653 FLASH CONTROLLER DRIVER #
- Mail: Sakari Ailus <sakari.ailus@iki.fi>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/adi,adp1653.txt,drivers/media/i2c/adp1653.c,include/media/i2c/adp1653.h
ADP5520 BACKLIGHT DRIVER WITH IO EXPANDER (ADP5520/ADP5501) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/ADP5520, https://ez.analog.com/linux-software-drivers
- Files:
drivers/gpio/gpio-adp5520.c,drivers/input/keyboard/adp5520-keys.c,drivers/leds/leds-adp5520.c,drivers/mfd/adp5520.c,drivers/video/backlight/adp5520_bl.c
ADP5585 GPIO EXPANDER, PWM AND KEYPAD CONTROLLER DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/*/adi,adp5585*.yaml,drivers/gpio/gpio-adp5585.c,drivers/input/keyboard/adp5585-keys.c,drivers/mfd/adp5585.c,drivers/pwm/pwm-adp5585.c,include/linux/mfd/adp5585.h
ADP5588 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5588/ADP5587) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/ADP5588, https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/input/adi,adp5588.yaml,drivers/input/keyboard/adp5588-keys.c
ADP8860 BACKLIGHT DRIVER (ADP8860/ADP8861/ADP8863) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/ADP8860, https://ez.analog.com/linux-software-drivers
- Files:
drivers/video/backlight/adp8860_bl.c
ADT746X FAN DRIVER #
- Mail: Colin Leroy <colin@colino.net>
- Status: Maintained
- Files:
drivers/macintosh/therm_adt746x.c
ADT7475 HARDWARE MONITOR DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/adt7475.rst,drivers/hwmon/adt7475.c
ADVANSYS SCSI DRIVER #
- Mail: Matthew Wilcox <willy@infradead.org>, Hannes Reinecke <hare@suse.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/scsi/advansys.rst,drivers/scsi/advansys.c
ADVANTECH SWBTN DRIVER #
- Mail: Andrea Ho <Andrea.Ho@advantech.com.tw>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/adv_swbutton.c
ADXL313 THREE-AXIS DIGITAL ACCELEROMETER DRIVER #
- Mail: Lucas Stankus <lucas.p.stankus@gmail.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml,drivers/iio/accel/adxl313*
ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/ADXL345, https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/accel/adi,adxl345.yaml,drivers/input/misc/adxl34x.c
ADXL355 THREE-AXIS DIGITAL ACCELEROMETER DRIVER #
- Mail: Puranjay Mohan <puranjay@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/accel/adi,adxl355.yaml,drivers/iio/accel/adxl355.h,drivers/iio/accel/adxl355_core.c,drivers/iio/accel/adxl355_i2c.c,drivers/iio/accel/adxl355_spi.c
ADXL367 THREE-AXIS DIGITAL ACCELEROMETER DRIVER #
- Mail: Cosmin Tanislav <cosmin.tanislav@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/accel/adi,adxl367.yaml,drivers/iio/accel/adxl367*
ADXL372 THREE-AXIS DIGITAL ACCELEROMETER DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/accel/adi,adxl372.yaml,drivers/iio/accel/adxl372.c,drivers/iio/accel/adxl372_i2c.c,drivers/iio/accel/adxl372_spi.c
ADXL380 THREE-AXIS DIGITAL ACCELEROMETER DRIVER #
- Mail: Ramona Gradinariu <ramona.gradinariu@analog.com>, Antoniu Miclaus <antoniu.miclaus@analog.com>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/accel/adi,adxl380.yaml,drivers/iio/accel/adxl380.c,drivers/iio/accel/adxl380.h,drivers/iio/accel/adxl380_i2c.c,drivers/iio/accel/adxl380_spi.c
AEONSEMI PHY DRIVER #
- Mail: Christian Marangi <ansuelsmth@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/aeonsemi,as21xxx.yaml,drivers/net/phy/as21xxx.c
AF8133J THREE-AXIS MAGNETOMETER DRIVER #
- Mail: Ondřej Jirman <megi@xff.cz>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml,drivers/iio/magnetometer/af8133j.c
AF9013 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/af9013*
AF9033 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/af9033*
AFFS FILE SYSTEM #
- Mail: David Sterba <dsterba@suse.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/filesystems/affs.rst,fs/affs/
AFS FILESYSTEM #
- Mail: David Howells <dhowells@redhat.com>, Marc Dionne <marc.dionne@auristor.com>
- Mailing list: linux-afs@lists.infradead.org
- Status: Supported
- Web-page: https://www.infradead.org/~dhowells/kafs/
- Files:
Documentation/filesystems/afs.rst,fs/afs/,include/trace/events/afs.h
AGPGART DRIVER #
- Mail: David Airlie <airlied@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/kernel.git
- Files:
drivers/char/agp/,include/linux/agp*,include/uapi/linux/agp*
AHA152X SCSI DRIVER #
- Mail: "Juergen E. Fischer" <fischer@norbit.de>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/aha152x*,drivers/scsi/pcmcia/aha152x*
AIC7XXX / AIC79XX SCSI DRIVER #
- Mail: Hannes Reinecke <hare@suse.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/aic7xxx/
AIMSLAB FM RADIO RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-aimslab*
AIO #
- Mail: Benjamin LaHaise <bcrl@kvack.org>
- Mailing list: linux-aio@kvack.org
- Status: Supported
- Files:
fs/aio.c,include/linux/*aio*.h
AIROHA ETHERNET DRIVER #
- Mail: Lorenzo Bianconi <lorenzo@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers), netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/airoha,en7581-eth.yaml,drivers/net/ethernet/airoha/
AIROHA PCIE PHY DRIVER #
- Mail: Lorenzo Bianconi <lorenzo@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/airoha,en7581-pcie-phy.yaml,drivers/phy/phy-airoha-pcie-regs.h,drivers/phy/phy-airoha-pcie.c
AIROHA SPI SNFI DRIVER #
- Mail: Lorenzo Bianconi <lorenzo@kernel.org>, Ray Liu <ray.liu@airoha.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml,drivers/spi/spi-airoha-snfi.c
AIRSPY MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/airspy/
ALACRITECH GIGABIT ETHERNET DRIVER #
- Mail: Lino Sanfilippo <LinoSanfilippo@gmx.de>
- Status: Maintained
- Files:
drivers/net/ethernet/alacritech/*
ALCATEL SPEEDTOUCH USB DRIVER #
- Mail: Duncan Sands <duncan.sands@free.fr>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Web-page: http://www.linux-usb.org/SpeedTouch/
- Files:
drivers/usb/atm/speedtch.c,drivers/usb/atm/usbatm.c
ALCHEMY AU1XX0 MMC DRIVER #
- Mail: Manuel Lauss <manuel.lauss@gmail.com>
- Status: Maintained
- Files:
drivers/mmc/host/au1xmmc.c
ALI1563 I2C DRIVER #
- Mail: Rudolf Marek <r.marek@assembler.cz>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/i2c/busses/i2c-ali1563.rst,drivers/i2c/busses/i2c-ali1563.c
ALIBABA ELASTIC RDMA DRIVER #
- Mail: Cheng Xu <chengyou@linux.alibaba.com>, Kai Shen <kaishen@linux.alibaba.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/hw/erdma,include/uapi/rdma/erdma-abi.h
ALIBABA PMU DRIVER #
- Mail: Shuai Xue <xueshuai@linux.alibaba.com>
- Status: Supported
- Files:
Documentation/admin-guide/perf/alibaba_pmu.rst,drivers/perf/alibaba_uncore_drw_pmu.c
ALIENWARE WMI DRIVER #
- Mail: Kurt Borja <kuurtb@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-alienware-wmi,Documentation/ABI/testing/sysfs-platform-alienware-wmi,Documentation/admin-guide/laptops/alienware-wmi.rst,Documentation/wmi/devices/alienware-wmi.rst,drivers/platform/x86/dell/alienware-wmi*
ALLEGRO DVT VIDEO IP CORE DRIVER #
- Mail: Michael Tretter <m.tretter@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/allegro,al5e.yaml,drivers/media/platform/allegro-dvt/
ALLIED VISION ALVIUM CAMERA DRIVER #
- Mail: Tommaso Merciai <tomm.merciai@gmail.com>, Martin Hecht <mhecht73@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/alliedvision,alvium-csi2.yaml,drivers/media/i2c/alvium-csi2.c,drivers/media/i2c/alvium-csi2.h
ALLWINNER A10 CSI DRIVER #
- Mail: Maxime Ripard <mripard@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml,drivers/media/platform/sunxi/sun4i-csi/
ALLWINNER A31 CSI DRIVER #
- Mail: Yong Deng <yong.deng@magewell.com>, Paul Kocialkowski <paulk@sys-base.io>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/allwinner,sun6i-a31-csi.yaml,drivers/media/platform/sunxi/sun6i-csi/
ALLWINNER A31 ISP DRIVER #
- Mail: Paul Kocialkowski <paulk@sys-base.io>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/allwinner,sun6i-a31-isp.yaml,drivers/staging/media/sunxi/sun6i-isp/,drivers/staging/media/sunxi/sun6i-isp/uapi/sun6i-isp-config.h
ALLWINNER A31 MIPI CSI-2 BRIDGE DRIVER #
- Mail: Paul Kocialkowski <paulk@sys-base.io>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/allwinner,sun6i-a31-mipi-csi2.yaml,drivers/media/platform/sunxi/sun6i-mipi-csi2/
ALLWINNER CPUFREQ DRIVER #
- Mail: Yangtao Li <tiny.windzz@gmail.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml,drivers/cpufreq/sun50i-cpufreq-nvmem.c
ALLWINNER CRYPTO DRIVERS #
- Mail: Corentin Labbe <clabbe.montjoie@gmail.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/allwinner/
ALLWINNER DMIC DRIVERS #
- Mail: Ban Tao <fengzheng923@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/allwinner,sun50i-h6-dmic.yaml,sound/soc/sunxi/sun50i-dmic.c
ALLWINNER HARDWARE SPINLOCK SUPPORT #
- Mail: Wilken Gottwalt <wilken.gottwalt@posteo.net>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwlock/allwinner,sun6i-a31-hwspinlock.yaml,drivers/hwspinlock/sun6i_hwspinlock.c
ALLWINNER THERMAL DRIVER #
- Mail: Vasily Khoruzhick <anarsoul@gmail.com>, Yangtao Li <tiny.windzz@gmail.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml,drivers/thermal/sun8i_thermal.c
ALLWINNER VPU DRIVER #
- Mail: Maxime Ripard <mripard@kernel.org>, Paul Kocialkowski <paulk@sys-base.io>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/staging/media/sunxi/cedrus/
ALPHA PORT #
- Mail: Richard Henderson <richard.henderson@linaro.org>, Matt Turner <mattst88@gmail.com>, Magnus Lindholm <linmag7@gmail.com>
- Mailing list: linux-alpha@vger.kernel.org
- Status: Odd Fixes
- Files:
arch/alpha/
ALPS PS/2 TOUCHPAD DRIVER #
- Reviewer: Pali Rohár <pali@kernel.org>
- Files:
drivers/input/mouse/alps.*
ALTERA MAILBOX DRIVER #
- Mail: Tien Sung Ang <tiensung.ang@altera.com>
- Status: Maintained
- Files:
drivers/mailbox/mailbox-altera.c
ALTERA MSGDMA IP CORE DRIVER #
- Mail: Olivier Dautricourt <olivierdautricourt@gmail.com>
- Reviewer: Stefan Roese <sr@denx.de>
- Mailing list: dmaengine@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/dma/altr,msgdma.yaml,drivers/dma/altera-msgdma.c
ALTERA PIO DRIVER #
- Mail: Adrian Ng <adrianhoyin.ng@altera.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-altera.c
ALTERA TRIPLE SPEED ETHERNET DRIVER #
- Mail: Boon Khai Ng <boon.khai.ng@altera.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/altera/
ALTERA UART/JTAG UART SERIAL DRIVERS #
- Mail: Tobias Klauser <tklauser@distanz.ch>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- Files:
drivers/tty/serial/altera_jtaguart.c,drivers/tty/serial/altera_uart.c,include/linux/altera_jtaguart.h,include/linux/altera_uart.h
AMAZON ANNAPURNA LABS FIC DRIVER #
- Mail: Talel Shenhar <talel@amazon.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/amazon,al-fic.yaml,drivers/irqchip/irq-al-fic.c
AMAZON ANNAPURNA LABS MEMORY CONTROLLER EDAC #
- Mail: Talel Shenhar <talel@amazon.com>, Talel Shenhar <talelshenhar@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml,drivers/edac/al_mc_edac.c
AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER #
- Mail: Talel Shenhar <talel@amazon.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/amazon,al-thermal.yaml,drivers/thermal/thermal_mmio.c
AMAZON ETHERNET DRIVERS #
- Mail: Arthur Kiyanovski <akiyano@amazon.com>, David Arinzon <darinzon@amazon.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/amazon/ena.rst,drivers/net/ethernet/amazon/
AMAZON RDMA EFA DRIVER #
- Mail: Michael Margolin <mrgolin@amazon.com>
- Reviewer: Gal Pressman <gal.pressman@linux.dev>, Yossi Leybovich <sleybo@amazon.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-rdma/list/
- Files:
drivers/infiniband/hw/efa/,include/uapi/rdma/efa-abi.h
AMD 3D V-CACHE PERFORMANCE OPTIMIZER DRIVER #
- Mail: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
- Reviewer: Mario Limonciello <mario.limonciello@amd.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
Documentation/ABI/testing/sysfs-bus-platform-drivers-amd_x3d_vcache,drivers/platform/x86/amd/x3d_vcache.c
AMD ADDRESS TRANSLATION LIBRARY (ATL) #
- Mail: Yazen Ghannam <Yazen.Ghannam@amd.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Supported
- Files:
drivers/ras/amd/atl/*
AMD AE4DMA DRIVER #
- Mail: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Files:
drivers/dma/amd/ae4dma/
AMD ASoC DRIVERS #
- Mail: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
- Reviewer: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- Files:
sound/soc/amd/
AMD AXI W1 DRIVER #
- Mail: Kris Chaplin <kris.chaplin@amd.com>
- Reviewer: Thomas Delev <thomas.delev@amd.com>, Michal Simek <michal.simek@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/w1/amd,axi-1wire-host.yaml,drivers/w1/masters/amd_axi_w1.c
AMD CDX BUS DRIVER #
- Mail: Nipun Gupta <nipun.gupta@amd.com>, Nikhil Agarwal <nikhil.agarwal@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/bus/xlnx,versal-net-cdx.yaml,drivers/cdx/*,include/linux/cdx/*
AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER #
- Mail: Tom Lendacky <thomas.lendacky@amd.com>, John Allen <john.allen@amd.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
drivers/crypto/ccp/,include/linux/ccp.h
AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - SEV SUPPORT #
- Mail: Ashish Kalra <ashish.kalra@amd.com>, Tom Lendacky <thomas.lendacky@amd.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
drivers/crypto/ccp/sev*,include/uapi/linux/psp-sev.h
AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DBC SUPPORT #
- Mail: Mario Limonciello <mario.limonciello@amd.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
drivers/crypto/ccp/dbc.c,drivers/crypto/ccp/dbc.h,drivers/crypto/ccp/platform-access.c,drivers/crypto/ccp/platform-access.h,include/uapi/linux/psp-dbc.h,tools/crypto/ccp/*.c,tools/crypto/ccp/*.py
AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - HSTI SUPPORT #
- Mail: Mario Limonciello <mario.limonciello@amd.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
drivers/crypto/ccp/hsti.*
AMD DISPLAY CORE #
- Mail: Harry Wentland <harry.wentland@amd.com>, Leo Li <sunpeng.li@amd.com>
- Reviewer: Rodrigo Siqueira <siqueira@igalia.com>
- Mailing list: amd-gfx@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/agd5f/linux.git
- Files:
drivers/gpu/drm/amd/display/
AMD DISPLAY CORE - DML #
- Mail: Austin Zheng <austin.zheng@amd.com>, Jun Lei <jun.lei@amd.com>
- Status: Supported
- Files:
drivers/gpu/drm/amd/display/dc/dml/,drivers/gpu/drm/amd/display/dc/dml2_0/
AMD FAM15H PROCESSOR POWER MONITORING DRIVER #
- Mail: Huang Rui <ray.huang@amd.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Files:
Documentation/hwmon/fam15h_power.rst,drivers/hwmon/fam15h_power.c
AMD FCH GPIO DRIVER #
- Mail: Enrico Weigelt, metux IT consult <info@metux.net>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-amd-fch.c,include/linux/platform_data/gpio/gpio-amd-fch.h
AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER #
- Mailing list: linux-geode@lists.infradead.org (moderated for non-subscribers)
- Status: Orphan
- Files:
drivers/usb/gadget/udc/amd5536udc.*
AMD GEODE PROCESSOR/CHIPSET SUPPORT #
- Mail: Andres Salomon <dilinger@queued.net>
- Mailing list: linux-geode@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Web-page: http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html
- Files:
arch/x86/include/asm/geode.h,drivers/char/hw_random/geode-rng.c,drivers/crypto/geode*,drivers/video/fbdev/geode/
AMD HSMP DRIVER #
- Mail: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
- Reviewer: Carlos Bilbao <carlos.bilbao@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/arch/x86/amd_hsmp.rst,arch/x86/include/asm/amd/hsmp.h,arch/x86/include/uapi/asm/amd_hsmp.h,drivers/platform/x86/amd/hsmp/
AMD HETERO CORE HARDWARE FEEDBACK DRIVER #
- Mail: Mario Limonciello <mario.limonciello@amd.com>
- Reviewer: Perry Yuan <perry.yuan@amd.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- bugs: https://gitlab.freedesktop.org/drm/amd/-/issues
- Files:
Documentation/arch/x86/amd-hfi.rst,drivers/platform/x86/amd/hfi/
AMD IOMMU (AMD-VI) #
- Mail: Joerg Roedel <joro@8bytes.org>
- Reviewer: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
- Mailing list: iommu@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
- Files:
drivers/iommu/amd/,include/linux/amd-iommu.h
AMD KFD #
- Mail: Felix Kuehling <Felix.Kuehling@amd.com>
- Mailing list: amd-gfx@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/agd5f/linux.git
- Files:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd*.[ch],drivers/gpu/drm/amd/amdkfd/,drivers/gpu/drm/amd/include/cik_structs.h,drivers/gpu/drm/amd/include/kgd_kfd_interface.h,drivers/gpu/drm/amd/include/v9_structs.h,drivers/gpu/drm/amd/include/vi_structs.h,include/uapi/linux/kfd_ioctl.h,include/uapi/linux/kfd_sysfs.h
AMD MP2 I2C DRIVER #
- Mail: Elie Morisse <syniurge@gmail.com>, Shyam Sundar S K <shyam-sundar.s-k@amd.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-amd-mp2*
AMD ASF I2C DRIVER #
- Mail: Shyam Sundar S K <shyam-sundar.s-k@amd.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
drivers/i2c/busses/i2c-amd-asf-plat.c
AMD NODE DRIVER #
- Mail: Mario Limonciello <mario.limonciello@amd.com>, Yazen Ghannam <yazen.ghannam@amd.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
arch/x86/include/asm/amd/node.h,arch/x86/kernel/amd_node.c
AMD PDS CORE DRIVER #
- Mail: Brett Creeley <brett.creeley@amd.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/amd/pds_core.rst,drivers/net/ethernet/amd/pds_core/,include/linux/pds/
AMD PENSANDO RDMA DRIVER #
- Mail: Abhijit Gangurde <abhijit.gangurde@amd.com>, Allen Hubbe <allen.hubbe@amd.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/pensando/ionic_rdma.rst,drivers/infiniband/hw/ionic/,include/uapi/rdma/ionic-abi.h
AMD PMC DRIVER #
- Mail: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/x86/amd/pmc/
AMD PMF DRIVER #
- Mail: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
Documentation/ABI/testing/sysfs-amd-pmf,drivers/platform/x86/amd/pmf/
AMD POWERPLAY AND SWSMU #
- Mail: Kenneth Feng <kenneth.feng@amd.com>
- Mailing list: amd-gfx@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/agd5f/linux.git
- Files:
drivers/gpu/drm/amd/pm/
AMD PSTATE DRIVER #
- Mail: Huang Rui <ray.huang@amd.com>, Gautham R. Shenoy <gautham.shenoy@amd.com>, Mario Limonciello <mario.limonciello@amd.com>
- Reviewer: Perry Yuan <perry.yuan@amd.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Files:
Documentation/admin-guide/pm/amd-pstate.rst,drivers/cpufreq/amd-pstate*,tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
AMD PTDMA DRIVER #
- Mail: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Files:
drivers/dma/amd/ptdma/
AMD QDMA DRIVER #
- Mail: Nishad Saraf <nishads@amd.com>, Lizhi Hou <lizhi.hou@amd.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Files:
drivers/dma/amd/qdma/,include/linux/platform_data/amd_qdma.h
AMD SEATTLE DEVICE TREE SUPPORT #
- Mail: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Tom Lendacky <thomas.lendacky@amd.com>
- Status: Supported
- Files:
arch/arm64/boot/dts/amd/
AMD SENSOR FUSION HUB DRIVER #
- Mail: Basavaraj Natikar <basavaraj.natikar@amd.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hid/amd-sfh*,drivers/hid/amd-sfh-hid/
AMD SPI DRIVER #
- Mail: Raju Rangoju <Raju.Rangoju@amd.com>, Krishnamoorthi M <krishnamoorthi.m@amd.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Supported
- Files:
drivers/spi/spi-amd-pci.c,drivers/spi/spi-amd.c,drivers/spi/spi-amd.h
AMD XDNA DRIVER #
- Mail: Min Ma <mamin506@gmail.com>, Lizhi Hou <lizhi.hou@amd.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/accel/amdxdna/,drivers/accel/amdxdna/,include/trace/events/amdxdna.h,include/uapi/drm/amdxdna_accel.h
AMD XGBE DRIVER #
- Mail: Raju Rangoju <Raju.Rangoju@amd.com>, Prashanth Kumar K R <PrashanthKumar.K.R@amd.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi,drivers/net/ethernet/amd/xgbe/
AMLOGIC BLUETOOTH DRIVER #
- Mail: Yang Li <yang.li@amlogic.com>
- Mailing list: linux-bluetooth@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/bluetooth/amlogic,w155s2-bt.yaml,drivers/bluetooth/hci_aml.c
AMLOGIC DDR PMU DRIVER #
- Mail: Jiucheng Xu <jiucheng.xu@amlogic.com>
- Mailing list: linux-amlogic@lists.infradead.org
- Status: Supported
- Web-page: http://www.amlogic.com
- Files:
Documentation/admin-guide/perf/meson-ddr-pmu.rst,Documentation/devicetree/bindings/perf/amlogic,g12-ddr-pmu.yaml,drivers/perf/amlogic/,include/soc/amlogic/
AMLOGIC ISP DRIVER #
- Mail: Keke Li <keke.li@amlogic.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/c3-isp.dot,Documentation/admin-guide/media/c3-isp.rst,Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml,Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst,drivers/media/platform/amlogic/c3/isp/,include/uapi/linux/media/amlogic/
AMLOGIC MIPI ADAPTER DRIVER #
- Mail: Keke Li <keke.li@amlogic.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/amlogic,c3-mipi-adapter.yaml,drivers/media/platform/amlogic/c3/mipi-adapter/
AMLOGIC MIPI CSI2 DRIVER #
- Mail: Keke Li <keke.li@amlogic.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/amlogic,c3-mipi-csi2.yaml,drivers/media/platform/amlogic/c3/mipi-csi2/
AMLOGIC PINCTRL DRIVER #
- Mail: Xianwei Zhao <xianwei.zhao@amlogic.com>
- Mailing list: linux-amlogic@lists.infradead.org, linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/amlogic,pinctrl-a4.yaml,drivers/pinctrl/meson/pinctrl-amlogic-a4.c
AMLOGIC RTC DRIVER #
- Mail: Yiting Deng <yiting.deng@amlogic.com>, Xianwei Zhao <xianwei.zhao@amlogic.com>
- Mailing list: linux-amlogic@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rtc/amlogic,a4-rtc.yaml,drivers/rtc/rtc-amlogic-a4.c
AMLOGIC SPIFC DRIVER #
- Mail: Liang Yang <liang.yang@amlogic.com>, Feng Chen <feng.chen@amlogic.com>, Xianwei Zhao <xianwei.zhao@amlogic.com>
- Mailing list: linux-amlogic@lists.infradead.org, linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/amlogic,a4-spifc.yaml,drivers/spi/spi-amlogic-spifc-a4.c
AMLOGIC SPISG DRIVER #
- Mail: Sunny Luo <sunny.luo@amlogic.com>, Xianwei Zhao <xianwei.zhao@amlogic.com>
- Mailing list: linux-amlogic@lists.infradead.org, linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/amlogic,a4-spisg.yaml,drivers/spi/spi-amlogic-spisg.c
AMPHENOL CHIPCAP 2 DRIVER #
- Mail: Javier Carrasco <javier.carrasco.cruz@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/amphenol,chipcap2.yaml,Documentation/hwmon/chipcap2.rst,drivers/hwmon/chipcap2.c
AMPHION VPU CODEC V4L2 DRIVER #
- Mail: Ming Qian <ming.qian@nxp.com>, Zhou Peng <eagle.zhou@nxp.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/amphion,vpu.yaml,drivers/media/platform/amphion/
AMS AS73211 DRIVER #
- Mail: Christian Eggers <ceggers@arri.de>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/ams,as73211.yaml,drivers/iio/light/as73211.c
AMT (Automatic Multicast Tunneling) #
- Mail: Taehee Yoo <ap420073@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git, git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
- Files:
drivers/net/amt.c
ANALOG DEVICES INC AD3530R DRIVER #
- Mail: Kim Seer Paller <kimseer.paller@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ad3530r.yaml,drivers/iio/dac/ad3530r.c
ANALOG DEVICES INC AD3552R DRIVER #
- Mail: Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml,Documentation/iio/ad3552r.rst,drivers/iio/dac/ad3552r.c
ANALOG DEVICES INC AD4000 DRIVER #
- Mail: Marcelo Schmitt <marcelo.schmitt@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4000.yaml,Documentation/iio/ad4000.rst,drivers/iio/adc/ad4000.c
AD4030 ADC DRIVER (AD4030-24/AD4630-16/AD4630-24/AD4632-16/AD4632-24) #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: Esteban Blanc <eblanc@baylibre.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4030.yaml,Documentation/iio/ad4030.rst,drivers/iio/adc/ad4030.c
ANALOG DEVICES INC AD4062 DRIVER #
- Mail: Jorge Marques <jorge.marques@analog.com>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4062.yaml,Documentation/iio/ad4062.rst,drivers/iio/adc/ad4062.c
ANALOG DEVICES INC AD4080 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml,drivers/iio/adc/ad4080.c
ANALOG DEVICES INC AD4130 DRIVER #
- Mail: Cosmin Tanislav <cosmin.tanislav@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130,Documentation/devicetree/bindings/iio/adc/adi,ad4130.yaml,drivers/iio/adc/ad4130.c
ANALOG DEVICES INC AD4134 DRIVER #
- Mail: Marcelo Schmitt <marcelo.schmitt@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml,drivers/iio/adc/ad4134.c
ANALOG DEVICES INC AD4170-4 DRIVER #
- Mail: Marcelo Schmitt <marcelo.schmitt@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4170-4.yaml,drivers/iio/adc/ad4170-4.c
ANALOG DEVICES INC AD4695 DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: David Lechner <dlechner@baylibre.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml,Documentation/iio/ad4695.rst,drivers/iio/adc/ad4695.c,include/dt-bindings/iio/adc/adi,ad4695.h
ANALOG DEVICES INC AD4851 DRIVER #
- Mail: Sergiu Cuciurean <sergiu.cuciurean@analog.com>, Dragos Bogdan <dragos.bogdan@analog.com>
- Reviewer: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml,drivers/iio/adc/ad4851.c
ANALOG DEVICES INC AD7091R DRIVER #
- Mail: Marcelo Schmitt <marcelo.schmitt@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: http://ez.analog.com/community/linux-device-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7091r*,drivers/iio/adc/ad7091r*
ANALOG DEVICES INC AD7191 DRIVER #
- Mail: Alisa-Dariana Roman <alisa.roman@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7191.yaml,Documentation/iio/ad7191.rst,drivers/iio/adc/ad7191.c
ANALOG DEVICES INC AD7192 DRIVER #
- Mail: Alisa-Dariana Roman <alisa.roman@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml,drivers/iio/adc/ad7192.c
ANALOG DEVICES INC AD7292 DRIVER #
- Mail: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml,drivers/iio/adc/ad7292.c
ANALOG DEVICES INC AD7293 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ad7293.yaml,drivers/iio/dac/ad7293.c
ANALOG DEVICES INC AD74115 DRIVER #
- Mail: Cosmin Tanislav <cosmin.tanislav@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml,drivers/iio/addac/ad74115.c
ANALOG DEVICES INC AD74413R DRIVER #
- Mail: Cosmin Tanislav <cosmin.tanislav@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml,drivers/iio/addac/ad74413r.c,include/dt-bindings/iio/addac/adi,ad74413r.h
ANALOG DEVICES INC AD7625 DRIVER #
- Mail: Michael Hennerich <Michael.Hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: Trevor Gamblin <tgamblin@baylibre.com>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers, http://analogdevicesinc.github.io/hdl/projects/pulsar_lvds/index.html
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7625.yaml,Documentation/iio/ad7625.rst,drivers/iio/adc/ad7625.c
ANALOG DEVICES INC AD7768-1 DRIVER #
- Mail: Michael Hennerich <Michael.Hennerich@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml,drivers/iio/adc/ad7768-1.c,include/dt-bindings/iio/adc/adi,ad7768-1.h
ANALOG DEVICES INC AD7780 DRIVER #
- Mail: Michael Hennerich <Michael.Hennerich@analog.com>, Renato Lui Geh <renatogeh@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ad7780.yaml,drivers/iio/adc/ad7780.c
ANALOG DEVICES INC AD9467 DRIVER #
- Mail: Michael Hennerich <Michael.Hennerich@analog.com>, Nuno Sa <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/ABI/testing/debugfs-iio-ad9467,Documentation/devicetree/bindings/iio/adc/adi,ad9467.yaml,drivers/iio/adc/ad9467.c
ANALOG DEVICES INC AD8460 DRIVER #
- Mail: Mariel Tinaco <Mariel.Tinaco@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ad8460.yaml,drivers/iio/dac/ad8460.c
ANALOG DEVICES INC AD9739a DRIVER #
- Mail: Nuno Sa <nuno.sa@analog.com>, Dragos Bogdan <dragos.bogdan@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ad9739a.yaml,drivers/iio/dac/ad9739a.c
ANALOG DEVICES INC MAX22007 DRIVER #
- Mail: Janani Sunil <janani.sunil@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,max22007.yaml,drivers/iio/dac/max22007.c
ANALOG DEVICES INC ADA4250 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/amplifiers/adi,ada4250.yaml,drivers/iio/amplifiers/ada4250.c
ANALOG DEVICES INC ADE9000 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,ade9000.yaml,drivers/iio/adc/ade9000.c
ANALOG DEVICES INC ADF4377 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml,drivers/iio/frequency/adf4377.c
ANALOG DEVICES INC ADGS1408 DRIVER #
- Mail: Mircea Caprioru <mircea.caprioru@analog.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/mux/adi,adgs1408.txt,drivers/mux/adgs1408.c
ANALOG DEVICES INC ADIN DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/net/adi,adin.yaml,drivers/net/phy/adin.c
ANALOG DEVICES INC ADIS DRIVER LIBRARY #
- Mail: Nuno Sa <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/iio/imu/adis.c,drivers/iio/imu/adis_buffer.c,drivers/iio/imu/adis_trigger.c,include/linux/iio/imu/adis.h
ANALOG DEVICES INC ADIS16460 DRIVER #
- Mail: Dragos Bogdan <dragos.bogdan@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml,drivers/iio/imu/adis16460.c
ANALOG DEVICES INC ADIS16475 DRIVER #
- Mail: Nuno Sa <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml,drivers/iio/imu/adis16475.c
ANALOG DEVICES INC ADIS16550 DRIVER #
- Mail: Nuno Sa <nuno.sa@analog.com>, Ramona Gradinariu <ramona.gradinariu@analog.com>, Antoniu Miclaus <antoniu.miclaus@analog.com>, Robert Budai <robert.budai@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml
ANALOG DEVICES INC ADM1177 DRIVER #
- Mail: Michael Hennerich <Michael.Hennerich@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/adi,adm1177.yaml,drivers/hwmon/adm1177.c
ANALOG DEVICES INC ADMFM2000 DRIVER #
- Mail: Kim Seer Paller <kimseer.paller@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/frequency/adi,admfm2000.yaml,drivers/iio/frequency/admfm2000.c
ANALOG DEVICES INC ADMV1013 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/frequency/adi,admv1013.yaml,drivers/iio/frequency/admv1013.c
ANALOG DEVICES INC ADMV1014 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/frequency/adi,admv1014.yaml,drivers/iio/frequency/admv1014.c
ANALOG DEVICES INC ADMV8818 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/filter/adi,admv8818.yaml,drivers/iio/filter/admv8818.c
ANALOG DEVICES INC ADP5055 DRIVER #
- Mail: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/regulator/adi,adp5055-regulator.yaml,drivers/regulator/adp5055-regulator.c
ANALOG DEVICES INC ADP5061 DRIVER #
- Mail: Michael Hennerich <Michael.Hennerich@analog.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
drivers/power/supply/adp5061.c
ANALOG DEVICES INC ADRF6780 DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/frequency/adi,adrf6780.yaml,drivers/iio/frequency/adrf6780.c
ANALOG DEVICES INC ADV7180 DRIVER #
- Mail: Lars-Peter Clausen <lars@metafoo.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/media/i2c/adi,adv7180.yaml,drivers/media/i2c/adv7180.c
ANALOG DEVICES INC ADV748X DRIVER #
- Mail: Kieran Bingham <kieran.bingham@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/adi,adv748x.yaml,drivers/media/i2c/adv748x/*
ANALOG DEVICES INC ADV7511 DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/adv7511*
ANALOG DEVICES INC ADV7604 DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/adi,adv7604.yaml,drivers/media/i2c/adv7604*
ANALOG DEVICES INC ADV7842 DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/adv7842*
ANALOG DEVICES INC ADXRS290 DRIVER #
- Mail: Nishant Malpani <nish.malpani25@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/gyroscope/adi,adxrs290.yaml,drivers/iio/gyro/adxrs290.c
ANALOG DEVICES INC ASOC CODEC DRIVERS #
- Mail: Lars-Peter Clausen <lars@metafoo.de>, Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- Web-page: http://wiki.analog.com/, https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/sound/adi,*,Documentation/devicetree/bindings/sound/trivial-codec.yaml,sound/soc/codecs/ad1*,sound/soc/codecs/ad7*,sound/soc/codecs/adau*,sound/soc/codecs/adav*,sound/soc/codecs/sigmadsp.*,sound/soc/codecs/ssm*
ANALOG DEVICES INC AXI DAC DRIVER #
- Mail: Nuno Sa <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,axi-dac.yaml,drivers/iio/dac/adi-axi-dac.c
ANALOG DEVICES INC DMA DRIVERS #
- Mail: Lars-Peter Clausen <lars@metafoo.de>
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
drivers/dma/dma-axi-dmac.c
ANALOG DEVICES INC IIO DRIVERS #
- Mail: Lars-Peter Clausen <lars@metafoo.de>, Michael Hennerich <Michael.Hennerich@analog.com>
- Status: Supported
- Web-page: http://wiki.analog.com/, https://ez.analog.com/linux-software-drivers
- Files:
Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523,Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350,Documentation/devicetree/bindings/iio/*/adi,*,Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml,Documentation/devicetree/bindings/iio/adc/lltc,ltc2497.yaml,Documentation/iio/ad7606.rst,drivers/iio/*/ad*,drivers/iio/adc/ltc249*,drivers/iio/amplifiers/hmc425a.c,drivers/staging/iio/*/ad* - Excluded:
drivers/iio/*/adjd*
ANALOGBITS PLL LIBRARIES #
- Mail: Paul Walmsley <pjw@kernel.org>, Samuel Holland <samuel.holland@sifive.com>
- Status: Supported
- Files:
drivers/clk/analogbits/*,include/linux/clk/analogbits*
ANDES ATCSPI200 SPI DRIVER #
- Mail: CL Wang <cl634@andestech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/spi/andestech,ae350-spi.yaml,drivers/spi/spi-atcspi200.c
ANDROID DRIVERS #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Arve Hjønnevåg <arve@android.com>, Todd Kjos <tkjos@android.com>, Christian Brauner <christian@brauner.io>, Carlos Llamas <cmllamas@google.com>, Alice Ryhl <aliceryhl@google.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
- Files:
Documentation/netlink/specs/binder.yaml,drivers/android/
ANDROID GOLDFISH PIC DRIVER #
- Mail: Miodrag Dinic <miodrag.dinic@mips.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/interrupt-controller/google,goldfish-pic.yaml,drivers/irqchip/irq-goldfish-pic.c
ANDROID GOLDFISH RTC DRIVER #
- Mail: Jiaxun Yang <jiaxun.yang@flygoat.com>
- Status: Supported
- Files:
drivers/rtc/rtc-goldfish.c
AOA (Apple Onboard Audio) ALSA DRIVER #
- Mail: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linuxppc-dev@lists.ozlabs.org, linux-sound@vger.kernel.org
- Status: Maintained
- Files:
sound/aoa/
APEX EMBEDDED SYSTEMS STX104 IIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/addac/stx104.c
APM DRIVER #
- Mail: Jiri Kosina <jikos@kernel.org>
- Status: Odd fixes
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/apm.git
- Files:
arch/x86/kernel/apm_32.c,drivers/char/apm-emulation.c,include/linux/apm_bios.h,include/uapi/linux/apm_bios.h
APPARMOR SECURITY MODULE #
- Mail: John Johansen <john.johansen@canonical.com>, John Johansen <john@apparmor.net>
- Mailing list: apparmor@lists.ubuntu.com (moderated for non-subscribers)
- Status: Supported
- Web-page: apparmor.net
- bugs: https://gitlab.com/apparmor/apparmor-kernel
- chat: irc://irc.oftc.net/apparmor
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor, https://gitlab.com/apparmor/apparmor-kernel.git
- Files:
Documentation/admin-guide/LSM/apparmor.rst,security/apparmor/
APPLE BCM5974 MULTITOUCH DRIVER #
- Mail: Henrik Rydberg <rydberg@bitmath.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Odd fixes
- Files:
drivers/input/mouse/bcm5974.c
APPLE PCIE CONTROLLER DRIVER #
- Mail: Marc Zyngier <maz@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/controller/pcie-apple.c
APPLE SMC DRIVER #
- Mail: Henrik Rydberg <rydberg@bitmath.org>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Odd fixes
- Files:
drivers/hwmon/applesmc.c
APPLETALK NETWORK LAYER #
- Mailing list: netdev@vger.kernel.org
- Status: Odd fixes
- Files:
include/linux/atalk.h,include/uapi/linux/atalk.h,net/appletalk/
APPLIED MICRO (APM) X-GENE DEVICE TREE SUPPORT #
- Mail: Khuong Dinh <khuong@os.amperecomputing.com>
- Status: Supported
- Files:
arch/arm64/boot/dts/apm/
APPLIED MICRO (APM) X-GENE SOC EDAC #
- Mail: Khuong Dinh <khuong@os.amperecomputing.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/edac/apm,xgene-edac.yaml,drivers/edac/xgene_edac.c
APPLIED MICRO (APM) X-GENE SOC ETHERNET (V2) DRIVER #
- Mail: Iyappan Subramanian <iyappan@os.amperecomputing.com>, Keyur Chudgar <keyur@os.amperecomputing.com>
- Status: Maintained
- Files:
drivers/net/ethernet/apm/xgene-v2/
APPLIED MICRO (APM) X-GENE SOC ETHERNET DRIVER #
- Mail: Iyappan Subramanian <iyappan@os.amperecomputing.com>, Keyur Chudgar <keyur@os.amperecomputing.com>, Quan Nguyen <quan@os.amperecomputing.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/apm,xgene-enet.yaml,Documentation/devicetree/bindings/net/apm,xgene-mdio-rgmii.yaml,drivers/net/ethernet/apm/xgene/,drivers/net/mdio/mdio-xgene.c
APPLIED MICRO (APM) X-GENE SOC PMU #
- Mail: Khuong Dinh <khuong@os.amperecomputing.com>
- Status: Supported
- Files:
Documentation/admin-guide/perf/xgene-pmu.rst,Documentation/devicetree/bindings/perf/apm,xgene-pmu.yaml,drivers/perf/xgene_pmu.c
APPLIED MICRO QT2025 PHY DRIVER #
- Mail: FUJITA Tomonori <fujita.tomonori@gmail.com>
- Reviewer: Trevor Gross <tmgross@umich.edu>
- Mailing list: netdev@vger.kernel.org, rust-for-linux@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/qt2025.rs
APTINA CAMERA SENSOR PLL #
- Mail: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/aptina-pll.*
AQUACOMPUTER D5 NEXT PUMP SENSOR DRIVER #
- Mail: Aleksa Savic <savicaleksa83@gmail.com>, Jack Doan <me@jackdoan.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/aquacomputer_d5next.rst,drivers/hwmon/aquacomputer_d5next.c
AQUANTIA ETHERNET DRIVER (atlantic) #
- Mail: Igor Russkikh <irusskikh@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://www.marvell.com/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
Documentation/networking/device_drivers/ethernet/aquantia/atlantic.rst,drivers/net/ethernet/aquantia/atlantic/
AQUANTIA ETHERNET DRIVER PTP SUBSYSTEM #
- Mail: Egor Pomozov <epomozov@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.aquantia.com
- Files:
drivers/net/ethernet/aquantia/atlantic/aq_ptp*
AR0521 ON SEMICONDUCTOR CAMERA SENSOR DRIVER #
- Mail: Krzysztof Hałasa <khalasa@piap.pl>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/onnn,ar0521.yaml,drivers/media/i2c/ar0521.c
ARASAN NAND CONTROLLER DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Reviewer: Michal Simek <michal.simek@amd.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mtd/arasan,nand-controller.yaml,drivers/mtd/nand/raw/arasan-nand-controller.c
ARC FRAMEBUFFER DRIVER #
- Mail: Jaya Kumar <jayalk@intworks.biz>
- Status: Maintained
- Files:
drivers/video/fbdev/arcfb.c,drivers/video/fbdev/core/fb_defio.c
ARC PGU DRM DRIVER #
- Mail: Alexey Brodkin <abrodkin@synopsys.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/display/snps,arcpgu.txt,drivers/gpu/drm/tiny/arcpgu.c
ARCNET NETWORK LAYER #
- Mail: Michael Grzeschik <m.grzeschik@pengutronix.de>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/arcnet/,include/uapi/linux/if_arcnet.h
ARM AND ARM64 SoC SUB-ARCHITECTURES (COMMON PARTS) #
- Mail: Arnd Bergmann <arnd@arndb.de>, Krzysztof Kozlowski <krzk@kernel.org>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Linus Walleij <linusw@kernel.org>
- Reviewer: Drew Fustini <fustini@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), soc@lists.linux.dev
- Status: Maintained
- Subsystem Profile: Documentation/process/maintainer-soc.rst
- chat: irc://irc.libera.chat/armlinux
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
- Files:
Documentation/process/maintainer-soc*.rst,arch/arm/boot/dts/Makefile,arch/arm64/boot/dts/Makefile
ARM ARCHITECTED TIMER DRIVER #
- Mail: Mark Rutland <mark.rutland@arm.com>, Marc Zyngier <maz@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/include/asm/arch_timer.h,arch/arm64/include/asm/arch_timer.h,drivers/clocksource/arm_arch_timer.c,drivers/clocksource/arm_arch_timer_mmio.c
ARM ETHOS-U NPU DRIVER #
- Mail: Rob Herring (Arm) <robh@kernel.org>, Tomeu Vizoso <tomeu@tomeuvizoso.net>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/accel/ethosu/,include/uapi/drm/ethosu_accel.h
ARM GENERIC INTERRUPT CONTROLLER DRIVERS #
- Mail: Marc Zyngier <maz@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/arm,gic*,arch/arm/include/asm/arch_gicv3.h,arch/arm64/include/asm/arch_gicv3.h,drivers/irqchip/irq-gic*.[ch],include/linux/irqchip/arm-gic*.h,include/linux/irqchip/arm-vgic-info.h
ARM GENERIC INTERRUPT CONTROLLER V5 DRIVERS #
- Mail: Lorenzo Pieralisi <lpieralisi@kernel.org>, Marc Zyngier <maz@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v5*.yaml,drivers/irqchip/irq-gic-its-msi-parent.[ch],drivers/irqchip/irq-gic-v5*.[ch],include/linux/irqchip/arm-gic-v5.h
ARM HDLCD DRM DRIVER #
- Mail: Liviu Dudau <liviu.dudau@arm.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/display/arm,hdlcd.yaml,drivers/gpu/drm/arm/hdlcd_*
ARM INTEGRATOR, VERSATILE AND REALVIEW SUPPORT #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/arm,integrator.yaml,Documentation/devicetree/bindings/arm/arm,realview.yaml,Documentation/devicetree/bindings/arm/arm,versatile.yaml,Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml,Documentation/devicetree/bindings/auxdisplay/arm,versatile-lcd.yaml,Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml,Documentation/devicetree/bindings/i2c/arm,i2c-versatile.yaml,Documentation/devicetree/bindings/interrupt-controller/arm,versatile-fpga-irq.yaml,Documentation/devicetree/bindings/mtd/mtd-physmap.yaml,arch/arm/boot/dts/arm/arm-realview-*,arch/arm/boot/dts/arm/integrator*,arch/arm/boot/dts/arm/versatile*,arch/arm/mach-versatile/,drivers/bus/arm-integrator-lm.c,drivers/clk/versatile/,drivers/i2c/busses/i2c-versatile.c,drivers/irqchip/irq-versatile-fpga.c,drivers/mtd/maps/physmap-versatile.*,drivers/power/reset/arm-versatile-reboot.c,drivers/soc/versatile/
ARM INTERCONNECT PMU DRIVERS #
- Mail: Robin Murphy <robin.murphy@arm.com>
- Status: Supported
- Files:
Documentation/admin-guide/perf/arm-cmn.rst,Documentation/admin-guide/perf/arm-ni.rst,Documentation/devicetree/bindings/perf/arm,cmn.yaml,Documentation/devicetree/bindings/perf/arm,ni.yaml,drivers/perf/arm-cmn.c,drivers/perf/arm-ni.c,tools/perf/pmu-events/arch/arm64/arm/cmn/
ARM KOMEDA DRM-KMS DRIVER #
- Mail: Liviu Dudau <liviu.dudau@arm.com>
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/arm,komeda.yaml,Documentation/gpu/komeda-kms.rst,drivers/gpu/drm/arm/display/include/,drivers/gpu/drm/arm/display/komeda/
ARM MALI PANFROST DRM DRIVER #
- Mail: Boris Brezillon <boris.brezillon@collabora.com>, Rob Herring <robh@kernel.org>, Steven Price <steven.price@arm.com>, Adrián Larumbe <adrian.larumbe@collabora.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/gpu/panfrost.rst,drivers/gpu/drm/ci/xfails/panfrost*,drivers/gpu/drm/panfrost/,include/uapi/drm/panfrost_drm.h
ARM MALI-C55 ISP DRIVER #
- Mail: Daniel Scally <dan.scally@ideasonboard.com>, Jacopo Mondi <jacopo.mondi@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media_tree.git
- Files:
Documentation/admin-guide/media/mali-c55-graph.dot,Documentation/admin-guide/media/mali-c55.rst,Documentation/devicetree/bindings/media/arm,mali-c55.yaml,Documentation/userspace-api/media/drivers/mali-c55.rst,Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst,drivers/media/platform/arm/mali-c55/,include/uapi/linux/media/arm/mali-c55-config.h
ARM MALI PANTHOR DRM DRIVER #
- Mail: Boris Brezillon <boris.brezillon@collabora.com>, Steven Price <steven.price@arm.com>, Liviu Dudau <liviu.dudau@arm.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml,drivers/gpu/drm/panthor/,include/uapi/drm/panthor_drm.h
ARM MALI TYR DRM DRIVER #
- Mail: Daniel Almeida <daniel.almeida@collabora.com>, Alice Ryhl <aliceryhl@google.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- Web-page: https://rust-for-linux.com/tyr-gpu-driver, https://drm.pages.freedesktop.org/maintainer-tools/drm-rust.html
- bugs: https://gitlab.freedesktop.org/panfrost/linux/-/issues
- SCM: git https://gitlab.freedesktop.org/drm/rust/kernel.git
- Files:
Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml,drivers/gpu/drm/tyr/,include/uapi/drm/panthor_drm.h
ARM MALI-DP DRM DRIVER #
- Mail: Liviu Dudau <liviu.dudau@arm.com>
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/arm,malidp.yaml,Documentation/gpu/afbc.rst,drivers/gpu/drm/arm/
ARM MFM AND FLOPPY DRIVERS #
- Mail: Ian Molton <spyro@f2s.com>
- Status: Maintained
- Files:
arch/arm/include/asm/floppy.h,arch/arm/mach-rpc/floppydma.S
ARM PMU PROFILING AND DEBUGGING #
- Mail: Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-perf-users@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/pmu.yaml,Documentation/devicetree/bindings/perf/,arch/arm*/include/asm/hw_breakpoint.h,arch/arm*/include/asm/perf_event.h,arch/arm*/kernel/hw_breakpoint.c,arch/arm*/kernel/perf_*,drivers/perf/,include/linux/perf/arm_pmu*.h
ARM PORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Web-page: http://www.armlinux.org.uk/
- SCM: git git://git.armlinux.org.uk/~rmk/linux-arm.git
- Files:
arch/arm/ - Excluded:
arch/arm/boot/dts/
ARM PRIMECELL AACI PL041 DRIVER #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Odd Fixes
- Files:
sound/arm/aaci.*
ARM PRIMECELL BUS SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Odd Fixes
- Files:
drivers/amba/,include/linux/amba/bus.h
ARM PRIMECELL KMI PL050 DRIVER #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Odd Fixes
- Files:
drivers/input/serio/ambakmi.*,include/linux/amba/kmi.h
ARM PRIMECELL MMCI PL180/1 DRIVER #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Odd Fixes
- Files:
drivers/mmc/host/mmci.*,include/linux/amba/mmci.h
ARM PRIMECELL PL35X NAND CONTROLLER DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Reviewer: Michal Simek <michal.simek@amd.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mtd/arm,pl353-nand-r2p1.yaml,drivers/mtd/nand/raw/pl35x-nand-controller.c
ARM PRIMECELL PL35X SMC DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Reviewer: Michal Simek <michal.simek@amd.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/arm,pl35x-smc.yaml,drivers/memory/pl353-smc.c
ARM PRIMECELL SSP PL022 SPI DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/spi-pl022.yaml,drivers/spi/spi-pl022.c
ARM PRIMECELL UART PL010 AND PL011 DRIVERS #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Odd Fixes
- Files:
drivers/tty/serial/amba-pl01*.c,include/linux/amba/serial.h
ARM PRIMECELL VIC PL190/PL192 DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/arm,vic.yaml,drivers/irqchip/irq-vic.c
ARM SMC WATCHDOG DRIVER #
- Mail: Julius Werner <jwerner@chromium.org>
- Reviewer: Evan Benn <evanbenn@chromium.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/watchdog/arm-smc-wdt.yaml,drivers/watchdog/arm_smc_wdt.c
ARM SMMU DRIVERS #
- Mail: Will Deacon <will@kernel.org>
- Reviewer: Robin Murphy <robin.murphy@arm.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iommu/arm,smmu*,drivers/iommu/arm/,drivers/iommu/io-pgtable-arm*
ARM SMMU SVA SUPPORT #
- Reviewer: Jean-Philippe Brucker <jpb@kernel.org>
- Files:
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
ARM SUB-ARCHITECTURES #
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- chat: irc://irc.libera.chat/armlinux
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
- Files:
arch/arm/mach-*/,arch/arm/plat-*/
ARM/ACTIONS SEMI ARCHITECTURE #
- Mail: Andreas Färber <afaerber@suse.de>, Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-actions@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/actions.yaml,Documentation/devicetree/bindings/clock/actions,owl-cmu.yaml,Documentation/devicetree/bindings/dma/owl-dma.yaml,Documentation/devicetree/bindings/i2c/i2c-owl.yaml,Documentation/devicetree/bindings/interrupt-controller/actions,owl-sirq.yaml,Documentation/devicetree/bindings/mmc/owl-mmc.yaml,Documentation/devicetree/bindings/net/actions,owl-emac.yaml,Documentation/devicetree/bindings/pinctrl/actions,*,Documentation/devicetree/bindings/power/actions,s500-sps.yaml,Documentation/devicetree/bindings/timer/actions,owl-timer.yaml,arch/arm/boot/dts/actions/,arch/arm/mach-actions/,arch/arm64/boot/dts/actions/,drivers/clk/actions/,drivers/clocksource/timer-owl*,drivers/dma/owl-dma.c,drivers/i2c/busses/i2c-owl.c,drivers/irqchip/irq-owl-sirq.c,drivers/mmc/host/owl-mmc.c,drivers/net/ethernet/actions/,drivers/pinctrl/actions/*,drivers/pmdomain/actions/,include/dt-bindings/power/owl-*,include/dt-bindings/reset/actions,*,include/linux/soc/actions/ - Regex:
owl
ARM/AIROHA SOC SUPPORT #
- Mail: Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
arch/arm/boot/dts/airoha/,arch/arm64/boot/dts/airoha/
ARM/Allwinner SoC Clock Support #
- Mail: Emilio López <emilio@elopez.com.ar>
- Status: Maintained
- Files:
drivers/clk/sunxi/
ARM/Allwinner sunXi SoC support #
- Mail: Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-sunxi@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git
- Files:
arch/arm/mach-sunxi/,arch/arm64/boot/dts/allwinner/,drivers/clk/sunxi-ng/,drivers/pinctrl/sunxi/,drivers/soc/sunxi/ - Regex:
allwinner,sun[x456789]i,sun[25]0i
ARM/ALPHASCALE ARCHITECTURE #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
arch/arm/boot/dts/alphascale/,drivers/clk/clk-asm9260.c,drivers/clocksource/asm9260_timer.c,drivers/rtc/rtc-asm9260.c,drivers/watchdog/asm9260_wdt.c
ARM/AMD PENSANDO ARM64 ARCHITECTURE #
- Mail: Brad Larson <blarson@amd.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/*/amd,pensando*,arch/arm64/boot/dts/amd/elba*
ARM/Amlogic Meson SoC CLOCK FRAMEWORK #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>, Jerome Brunet <jbrunet@baylibre.com>
- Mailing list: linux-amlogic@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/amlogic*,drivers/clk/meson/,include/dt-bindings/clock/amlogic,a1*,include/dt-bindings/clock/gxbb*,include/dt-bindings/clock/meson*
ARM/Amlogic Meson SoC Crypto Drivers #
- Mail: Corentin Labbe <clabbe@baylibre.com>
- Mailing list: linux-crypto@vger.kernel.org, linux-amlogic@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/amlogic*,drivers/crypto/amlogic/
ARM/Amlogic Meson SoC Sound Drivers #
- Mail: Jerome Brunet <jbrunet@baylibre.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/amlogic*,sound/soc/meson/
ARM/Amlogic Meson SoC support #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>, Kevin Hilman <khilman@baylibre.com>
- Reviewer: Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-amlogic@lists.infradead.org
- Status: Maintained
- Web-page: http://linux-meson.com/
- Files:
Documentation/devicetree/bindings/phy/amlogic*,arch/arm/boot/dts/amlogic/,arch/arm/mach-meson/,arch/arm64/boot/dts/amlogic/,drivers/pmdomain/amlogic/,drivers/mmc/host/meson*,drivers/phy/amlogic/,drivers/pinctrl/meson/,drivers/rtc/rtc-meson*,drivers/soc/amlogic/ - Regex:
meson
ARM/Annapurna Labs ALPINE ARCHITECTURE #
- Mail: Antoine Tenart <atenart@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
arch/arm/boot/dts/amazon/,arch/arm/mach-alpine/,arch/arm64/boot/dts/amazon/,drivers/*/*alpine*
ARM/APPLE MACHINE SOUND DRIVERS #
- Mail: Martin Povišer <povik+lin@cutebit.org>
- Mailing list: asahi@lists.linux.dev, linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/apple,*,Documentation/devicetree/bindings/sound/cirrus,cs42l84.yaml,Documentation/devicetree/bindings/sound/trivial-codec.yaml,sound/soc/apple/*,sound/soc/codecs/cs42l83-i2c.c,sound/soc/codecs/cs42l84.*,sound/soc/codecs/ssm3515.c
ARM/APPLE MACHINE SUPPORT #
- Mail: Sven Peter <sven@kernel.org>, Janne Grunau <j@jannau.net>
- Reviewer: Neal Gompa <neal@gompa.dev>
- Mailing list: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: https://asahilinux.org
- bugs: https://github.com/AsahiLinux/linux/issues
- chat: irc://irc.oftc.net/asahi-dev
- SCM: git https://github.com/AsahiLinux/linux.git
- Files:
Documentation/devicetree/bindings/arm/apple.yaml,Documentation/devicetree/bindings/arm/apple/*,Documentation/devicetree/bindings/clock/apple,nco.yaml,Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml,Documentation/devicetree/bindings/dma/apple,admac.yaml,Documentation/devicetree/bindings/gpio/apple,smc-gpio.yaml,Documentation/devicetree/bindings/gpu/apple,agx.yaml,Documentation/devicetree/bindings/i2c/apple,i2c.yaml,Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml,Documentation/devicetree/bindings/interrupt-controller/apple,*,Documentation/devicetree/bindings/iommu/apple,dart.yaml,Documentation/devicetree/bindings/iommu/apple,sart.yaml,Documentation/devicetree/bindings/leds/backlight/apple,dwi-bl.yaml,Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml,Documentation/devicetree/bindings/mfd/apple,smc.yaml,Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml,Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml,Documentation/devicetree/bindings/nvmem/apple,efuses.yaml,Documentation/devicetree/bindings/nvmem/apple,spmi-nvmem.yaml,Documentation/devicetree/bindings/pci/apple,pcie.yaml,Documentation/devicetree/bindings/phy/apple,atcphy.yaml,Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml,Documentation/devicetree/bindings/power/apple*,Documentation/devicetree/bindings/power/reset/apple,smc-reboot.yaml,Documentation/devicetree/bindings/pwm/apple,s5l-fpwm.yaml,Documentation/devicetree/bindings/rtc/apple,smc-rtc.yaml,Documentation/devicetree/bindings/spi/apple,spi.yaml,Documentation/devicetree/bindings/spmi/apple,spmi.yaml,Documentation/devicetree/bindings/usb/apple,dwc3.yaml,Documentation/devicetree/bindings/watchdog/apple,wdt.yaml,Documentation/hwmon/macsmc-hwmon.rst,arch/arm64/boot/dts/apple/,drivers/bluetooth/hci_bcm4377.c,drivers/clk/clk-apple-nco.c,drivers/cpufreq/apple-soc-cpufreq.c,drivers/dma/apple-admac.c,drivers/gpio/gpio-macsmc.c,drivers/hwmon/macsmc-hwmon.c,drivers/pmdomain/apple/,drivers/i2c/busses/i2c-pasemi-core.c,drivers/i2c/busses/i2c-pasemi-platform.c,drivers/input/touchscreen/apple_z2.c,drivers/iommu/apple-dart.c,drivers/iommu/io-pgtable-dart.c,drivers/irqchip/irq-apple-aic.c,drivers/mfd/macsmc.c,drivers/nvme/host/apple.c,drivers/nvmem/apple-efuses.c,drivers/nvmem/apple-spmi-nvmem.c,drivers/phy/apple/,drivers/pinctrl/pinctrl-apple-gpio.c,drivers/power/reset/macsmc-reboot.c,drivers/pwm/pwm-apple.c,drivers/rtc/rtc-macsmc.c,drivers/soc/apple/*,drivers/spi/spi-apple.c,drivers/spmi/spmi-apple-controller.c,drivers/usb/dwc3/dwc3-apple.c,drivers/video/backlight/apple_dwi_bl.c,drivers/watchdog/apple_wdt.c,include/dt-bindings/interrupt-controller/apple-aic.h,include/dt-bindings/pinctrl/apple.h,include/linux/mfd/macsmc.h,include/linux/soc/apple/*,include/uapi/drm/asahi_drm.h
ARM/ARTPEC MACHINE SUPPORT #
- Mail: Jesper Nilsson <jesper.nilsson@axis.com>, Lars Persson <lars.persson@axis.com>
- Mailing list: linux-arm-kernel@axis.com
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/axis,artpec6-pinctrl.txt,arch/arm/boot/dts/axis/,arch/arm/mach-artpec,drivers/clk/axis,drivers/crypto/axis,drivers/mmc/host/usdhi6rol0.c,drivers/pinctrl/pinctrl-artpec*
ARM/ASPEED I2C DRIVER #
- Mail: Ryan Chen <ryan_chen@aspeedtech.com>
- Reviewer: Benjamin Herrenschmidt <benh@kernel.crashing.org>, Joel Stanley <joel@jms.id.au>
- Mailing list: linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/aspeed,i2c.yaml,Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2400-i2c-ic.yaml,drivers/i2c/busses/i2c-aspeed.c,drivers/irqchip/irq-aspeed-i2c-ic.c
ARM/ASPEED MACHINE SUPPORT #
- Mail: Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@codeconstruct.com.au>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
- Status: Supported
- Patchwork: https://patchwork.ozlabs.org/project/linux-aspeed/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/bmc/linux.git
- Files:
Documentation/devicetree/bindings/arm/aspeed/,arch/arm/boot/dts/aspeed/,arch/arm/mach-aspeed/ - Regex:
aspeed
ARM/AXIADO ARCHITECTURE #
- Mail: Harshit Shah <hshah@axiado.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/axiado.yaml,arch/arm64/boot/dts/axiado/ - Regex:
axiado
ARM/AXM LSI SOC #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/arm/axxia.yaml,arch/arm/boot/dts/intel/axm/,arch/arm/mach-axxia/
ARM/BITMAIN ARCHITECTURE #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/bitmain.yaml,Documentation/devicetree/bindings/clock/bitmain,bm1880-clk.yaml,Documentation/devicetree/bindings/pinctrl/bitmain,bm1880-pinctrl.yaml,arch/arm64/boot/dts/bitmain/,drivers/clk/clk-bm1880.c,drivers/pinctrl/pinctrl-bm1880.c
ARM/BLAIZE ARCHITECTURE #
- Mail: James Cowgill <james.cowgill@blaize.com>, Matt Redfearn <matt.redfearn@blaize.com>, Neil Jones <neil.jones@blaize.com>, Nikolaos Pasaloukos <nikolaos.pasaloukos@blaize.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/blaize.yaml,arch/arm64/boot/dts/blaize/
ARM/BST SOC SUPPORT #
- Mail: Ge Gordon <gordon.ge@bst.ai>
- Reviewer: BST Linux Kernel Upstream Group <bst-upstream@bstai.top>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/arm/bst.yaml,arch/arm64/boot/dts/bst/
ARM/CALXEDA HIGHBANK ARCHITECTURE #
- Mail: Andre Przywara <andre.przywara@arm.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/calxeda/,arch/arm/mach-highbank/
ARM/CAVIUM THUNDER NETWORK DRIVER #
- Mail: Sunil Goutham <sgoutham@marvell.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/net/ethernet/cavium/thunder/
ARM/CIRRUS LOGIC BK3 MACHINE SUPPORT #
- Mail: Lukasz Majewski <lukma@denx.de>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/mach-ep93xx/ts72xx.c
ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE #
- Mail: Hartley Sweeten <hsweeten@visionengravers.com>, Alexander Sverdlin <alexander.sverdlin@gmail.com>, Nikita Shubin <nikita.shubin@maquefel.me>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/cirrus,ep9301-adc.yaml,Documentation/devicetree/bindings/sound/cirrus,ep9301-*,arch/arm/boot/compressed/misc-ep93xx.h,arch/arm/mach-ep93xx/,drivers/iio/adc/ep93xx_adc.c
ARM/CIX SOC SUPPORT #
- Mail: Peter Chen <peter.chen@cixtech.com>, Fugang Duan <fugang.duan@cixtech.com>
- Reviewer: CIX Linux Kernel Upstream Group <cix-kernel-upstream@cixtech.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/cix.git
- Files:
Documentation/devicetree/bindings/arm/cix.yaml,Documentation/devicetree/bindings/mailbox/cix,sky1-mbox.yaml,arch/arm64/boot/dts/cix/,drivers/mailbox/cix-mailbox.c - Content regex:
\bcix\b
ARM/CLKDEV SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.armlinux.org.uk/~rmk/linux-arm.git clkdev
- Files:
drivers/clk/clkdev.c
ARM/CONEXANT DIGICOLOR MACHINE SUPPORT #
- Mail: Baruch Siach <baruch@tkos.co.il>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/cnxt/ - Regex:
digicolor
ARM/CORESIGHT FRAMEWORK AND DRIVERS #
- Mail: Suzuki K Poulose <suzuki.poulose@arm.com>
- Reviewer: Mike Leach <mike.leach@linaro.org>, James Clark <james.clark@linaro.org>
- Mailing list: coresight@lists.linaro.org (moderated for non-subscribers), linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux.git
- Files:
Documentation/ABI/testing/sysfs-bus-coresight-devices-*,Documentation/devicetree/bindings/arm/arm,coresight-*.yaml,Documentation/devicetree/bindings/arm/arm,embedded-trace-extension.yaml,Documentation/devicetree/bindings/arm/arm,trace-buffer-extension.yaml,Documentation/devicetree/bindings/arm/qcom,coresight-*.yaml,Documentation/trace/coresight/*,drivers/hwtracing/coresight/*,include/dt-bindings/arm/coresight-cti-dt.h,include/linux/coresight*,include/uapi/linux/coresight*,samples/coresight/*,tools/perf/Documentation/arm-coresight.txt,tools/perf/arch/arm/util/auxtrace.c,tools/perf/arch/arm/util/cs-etm.c,tools/perf/arch/arm/util/cs-etm.h,tools/perf/arch/arm/util/pmu.c,tools/perf/tests/shell/*coresight*,tools/perf/tests/shell/coresight/*,tools/perf/tests/shell/lib/*coresight*,tools/perf/util/cs-etm-decoder/*,tools/perf/util/cs-etm.*
ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE #
- Mail: Hans Ulli Kroll <ulli.kroll@googlemail.com>, Linus Walleij <linusw@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/ulli-kroll/linux.git
- Files:
Documentation/devicetree/bindings/arm/gemini.yaml,Documentation/devicetree/bindings/net/cortina,gemini-ethernet.yaml,Documentation/devicetree/bindings/pinctrl/cortina,gemini-pinctrl.txt,Documentation/devicetree/bindings/rtc/faraday,ftrtc010.yaml,arch/arm/boot/dts/gemini/,arch/arm/mach-gemini/,drivers/crypto/gemini/,drivers/net/ethernet/cortina/,drivers/pinctrl/pinctrl-gemini.c,drivers/rtc/rtc-ftrtc010.c
ARM/CZ.NIC TURRIS SUPPORT #
- Mail: Marek Behún <kabel@kernel.org>
- Status: Maintained
- Web-page: https://www.turris.cz/
- Files:
Documentation/ABI/testing/debugfs-moxtet,Documentation/ABI/testing/sysfs-bus-i2c-devices-turris-omnia-mcu,Documentation/ABI/testing/sysfs-bus-moxtet-devices,Documentation/ABI/testing/sysfs-firmware-turris-mox-rwtm,Documentation/devicetree/bindings/bus/cznic,moxtet.yaml,Documentation/devicetree/bindings/firmware/cznic,turris-mox-rwtm.yaml,Documentation/devicetree/bindings/firmware/cznic,turris-omnia-mcu.yaml,Documentation/devicetree/bindings/interrupt-controller/marvell,mpic.yaml,Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml,Documentation/devicetree/bindings/watchdog/marvell,armada-3700-wdt.yaml,drivers/bus/moxtet.c,drivers/firmware/turris-mox-rwtm.c,drivers/gpio/gpio-moxtet.c,drivers/leds/leds-turris-omnia.c,drivers/mailbox/armada-37xx-rwtm-mailbox.c,drivers/platform/cznic/,drivers/watchdog/armada_37xx_wdt.c,include/dt-bindings/bus/moxtet.h,include/linux/armada-37xx-rwtm-mailbox.h,include/linux/moxtet.h,include/linux/turris-omnia-mcu-interface.h,include/linux/turris-signing-key.h
ARM/FARADAY FA526 PORT #
- Mail: Hans Ulli Kroll <ulli.kroll@googlemail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.berlios.de/gemini-board
- Files:
arch/arm/mm/*-fa*
ARM/FOOTBRIDGE ARCHITECTURE #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://www.armlinux.org.uk/
- Files:
arch/arm/include/asm/hardware/dec21285.h,arch/arm/mach-footbridge/
ARM/FREESCALE IMX / MXC ARM ARCHITECTURE #
- Mail: Frank Li <Frank.Li@nxp.com>, Sascha Hauer <s.hauer@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>
- Mailing list: imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux.git
- Files:
Documentation/devicetree/bindings/firmware/fsl*,Documentation/devicetree/bindings/firmware/nxp*,arch/arm/boot/dts/nxp/imx/,arch/arm/boot/dts/nxp/mxs/,arch/arm64/boot/dts/freescale/ - Excluded:
Documentation/devicetree/bindings/media/i2c/,arch/arm64/boot/dts/freescale/fsl-*,arch/arm64/boot/dts/freescale/qoriq-*,drivers/media/i2c/ - Regex:
imx,mxs,\bmxc[^\d]
ARM/FREESCALE LAYERSCAPE ARM ARCHITECTURE #
- Mail: Frank Li <Frank.Li@nxp.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux.git
- Files:
arch/arm/boot/dts/nxp/ls/,arch/arm64/boot/dts/freescale/fsl-*,arch/arm64/boot/dts/freescale/qoriq-*
ARM/FREESCALE VYBRID ARM ARCHITECTURE #
- Mail: Frank Li <Frank.Li@nxp.com>, Sascha Hauer <s.hauer@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>, Stefan Agner <stefan@agner.ch>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux.git
- Files:
arch/arm/boot/dts/nxp/vf/,arch/arm/mach-imx/*vf610*
ARM/GUMSTIX MACHINE SUPPORT #
- Mail: Steve Sakoman <sakoman@gmail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
ARM/HISILICON SOC SUPPORT #
- Mail: Wei Xu <xuwei5@hisilicon.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Web-page: http://www.hisilicon.com
- SCM: git https://github.com/hisilicon/linux-hisi.git
- Files:
arch/arm/boot/dts/hisilicon/,arch/arm/mach-hisi/,arch/arm64/boot/dts/hisilicon/
ARM/HP JORNADA 7XX MACHINE SUPPORT #
- Mail: Kristoffer Ericson <kristoffer.ericson@gmail.com>
- Status: Maintained
- Web-page: www.jlime.com
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kristoffer/linux-hpc.git
- Files:
arch/arm/mach-sa1100/include/mach/jornada720.h,arch/arm/mach-sa1100/jornada720.c
ARM/HPE GXP ARCHITECTURE #
- Mail: Jean-Marie Verdun <verdun@hpe.com>, Nick Hawkins <nick.hawkins@hpe.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/hpe,gxp.yaml,Documentation/devicetree/bindings/hwmon/hpe,gxp-fan-ctrl.yaml,Documentation/devicetree/bindings/i2c/hpe,gxp-i2c.yaml,Documentation/devicetree/bindings/spi/hpe,gxp-spifi.yaml,Documentation/devicetree/bindings/timer/hpe,gxp-timer.yaml,Documentation/hwmon/gxp-fan-ctrl.rst,arch/arm/boot/dts/hpe/,drivers/clocksource/timer-gxp.c,drivers/hwmon/gxp-fan-ctrl.c,drivers/i2c/busses/i2c-gxp.c,drivers/spi/spi-gxp.c,drivers/watchdog/gxp-wdt.c
ARM/IGEP MACHINE SUPPORT #
- Mail: Enric Balletbo i Serra <eballetbo@gmail.com>, Javier Martinez Canillas <javier@dowhile0.org>
- Mailing list: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/ti/omap/omap3-igep*
ARM/INTEL IXP4XX ARM ARCHITECTURE #
- Mail: Linus Walleij <linusw@kernel.org>, Imre Kaloz <kaloz@openwrt.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml,Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.yaml,Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml,Documentation/devicetree/bindings/memory-controllers/intel,ixp4xx-expansion*,Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml,Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml,arch/arm/boot/dts/intel/ixp/,arch/arm/mach-ixp4xx/,drivers/bus/intel-ixp4xx-eb.c,drivers/char/hw_random/ixp4xx-rng.c,drivers/clocksource/timer-ixp4xx.c,drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c,drivers/gpio/gpio-ixp4xx.c,drivers/irqchip/irq-ixp4xx.c,drivers/net/ethernet/xscale/ixp4xx_eth.c,drivers/net/wan/ixp4xx_hss.c,drivers/soc/ixp4xx/ixp4xx-npe.c,drivers/soc/ixp4xx/ixp4xx-qmgr.c,include/linux/soc/ixp4xx/npe.h,include/linux/soc/ixp4xx/qmgr.h
ARM/INTEL KEEMBAY ARCHITECTURE #
- Mail: Paul J. Murphy <paul.j.murphy@intel.com>, Daniele Alessandrelli <daniele.alessandrelli@intel.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/intel,keembay.yaml,arch/arm64/boot/dts/intel/keembay-evm.dts,arch/arm64/boot/dts/intel/keembay-soc.dtsi
ARM/INTEL XSC3 (MANZANO) ARM CORE #
- Mail: Lennert Buytenhek <kernel@wantstofly.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
ARM/LG1K ARCHITECTURE #
- Mail: Chanho Min <chanho.min@lge.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm64/boot/dts/lg/
ARM/LPC18XX ARCHITECTURE #
- Mail: Vladimir Zapolskiy <vz@mleia.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/nxp,lpc1788-i2c.yaml,arch/arm/boot/dts/nxp/lpc/lpc43*,drivers/i2c/busses/i2c-lpc2k.c,drivers/memory/pl172.c,drivers/mtd/spi-nor/controllers/nxp-spifi.c,drivers/rtc/rtc-lpc24xx.c - Regex:
lpc18xx
ARM/LPC32XX SOC SUPPORT #
- Mail: Vladimir Zapolskiy <vz@mleia.com>, Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/vzapolskiy/linux-lpc32xx.git
- Files:
Documentation/devicetree/bindings/i2c/nxp,pnx-i2c.yaml,arch/arm/boot/dts/nxp/lpc/lpc32*,arch/arm/mach-lpc32xx/,drivers/dma/lpc32xx-dmamux.c,drivers/i2c/busses/i2c-pnx.c,drivers/net/ethernet/nxp/lpc_eth.c,drivers/usb/host/ohci-nxp.c,drivers/watchdog/pnx4008_wdt.c - Regex:
lpc32xx
LPC32XX DMAMUX SUPPORT #
- Mail: J.M.B. Downing <jonathan.downing@nautel.com>, Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
- Reviewer: Vladimir Zapolskiy <vz@mleia.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/nxp,lpc3220-dmamux.yaml
ARM/Marvell Dove/MV78xx0/Orion SOC support #
- Mail: Andrew Lunn <andrew@lunn.ch>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>, Gregory Clement <gregory.clement@bootlin.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gclement/mvebu.git
- Files:
Documentation/devicetree/bindings/arm/marvell/marvell,dove.yaml,Documentation/devicetree/bindings/arm/marvell/marvell,orion5x.yaml,Documentation/devicetree/bindings/soc/dove/,arch/arm/boot/dts/marvell/dove*,arch/arm/boot/dts/marvell/orion5x*,arch/arm/mach-dove/,arch/arm/mach-mv78xx0/,arch/arm/mach-orion5x/,arch/arm/plat-orion/,drivers/bus/mvebu-mbus.c,drivers/soc/dove/
ARM/Marvell Kirkwood and Armada 370, 375, 38x, 39x, XP, 3700, 7K/8K, CN9130 SOC support #
- Mail: Andrew Lunn <andrew@lunn.ch>, Gregory Clement <gregory.clement@bootlin.com>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gclement/mvebu.git
- Files:
Documentation/devicetree/bindings/arm/marvell/,arch/arm/boot/dts/marvell/armada*,arch/arm/boot/dts/marvell/db-falcon*,arch/arm/boot/dts/marvell/kirkwood*,arch/arm/configs/mvebu_*_defconfig,arch/arm/mach-mvebu/,arch/arm64/boot/dts/marvell/,drivers/clk/mvebu/,drivers/cpufreq/armada-37xx-cpufreq.c,drivers/cpufreq/armada-8k-cpufreq.c,drivers/cpufreq/mvebu-cpufreq.c,drivers/irqchip/irq-armada-370-xp.c,drivers/irqchip/irq-mvebu-*,drivers/pinctrl/mvebu/,drivers/rtc/rtc-armada38x.c
ARM/Marvell PXA1908 SOC support #
- Mail: Duje Mihanović <duje@dujemihanovic.xyz>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/marvell,pxa1908.yaml,arch/arm64/boot/dts/marvell/mmp/,drivers/clk/mmp/Kconfig,drivers/clk/mmp/clk-pxa1908*.c,drivers/pmdomain/marvell/,include/dt-bindings/clock/marvell,pxa1908.h,include/dt-bindings/power/marvell,pxa1908-power.h
ARM/Mediatek RTC DRIVER #
- Mail: Eddie Huang <eddie.huang@mediatek.com>, Sean Wang <sean.wang@mediatek.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rtc/mediatek,mt2712-rtc.yaml,Documentation/devicetree/bindings/rtc/mediatek,mt7622-rtc.yaml,drivers/rtc/rtc-mt2712.c,drivers/rtc/rtc-mt6397.c,drivers/rtc/rtc-mt7622.c
ARM/Mediatek SoC support #
- Mail: Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
- Mailing list: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: https://mtk.wiki.kernel.org/
- chat: irc://irc.libera.chat/linux-mediatek
- Files:
arch/arm/boot/dts/mediatek/,arch/arm/mach-mediatek/,arch/arm64/boot/dts/mediatek/,drivers/soc/mediatek/ - Regex:
mtk,mt[2678] - Content regex:
mediatek
ARM/Mediatek USB3 PHY DRIVER #
- Mail: Chunfeng Yun <chunfeng.yun@mediatek.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/mediatek,*,drivers/phy/mediatek/
ARM/MICROCHIP (ARM64) SoC support #
- Mail: Conor Dooley <conor@kernel.org>, Nicolas Ferre <nicolas.ferre@microchip.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git
- Files:
arch/arm64/boot/dts/microchip/
ARM/Microchip (AT91) SoC support #
- Mail: Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Web-page: http://www.linux4sam.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git
- Files:
arch/arm/boot/dts/microchip/,arch/arm/include/debug/at91.S,arch/arm/mach-at91/,drivers/memory/atmel*,drivers/watchdog/sama5d4_wdt.c,include/soc/at91/ - Excluded:
drivers/input/touchscreen/atmel_mxt_ts.c - Regex:
at91,atmel
ARM/Microchip Sparx5 SoC support #
- Mail: Steen Hegelund <Steen.Hegelund@microchip.com>, Daniel Machon <daniel.machon@microchip.com>, UNGLinuxDriver@microchip.com
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
arch/arm64/boot/dts/microchip/sparx*,drivers/net/ethernet/microchip/vcap/,drivers/pinctrl/pinctrl-microchip-sgpio.c - Regex:
sparx5
ARM/MILBEAUT ARCHITECTURE #
- Mail: Taichi Sugaya <sugaya.taichi@socionext.com>, Takao Orito <orito.takao@socionext.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/socionext/milbeaut*,arch/arm/mach-milbeaut/ - Regex:
milbeaut
ARM/MORELLO PLATFORM #
- Mail: Vincenzo Frascino <vincenzo.frascino@arm.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/arm,morello.yaml,arch/arm64/boot/dts/arm/morello*
ARM/MOXA ART SOC #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/arm/moxart.yaml,Documentation/devicetree/bindings/clock/moxa,moxart-clock.yaml,arch/arm/boot/dts/moxa/,drivers/clk/clk-moxart.c
ARM/MStar/Sigmastar Armv7 SoC support #
- Mail: Daniel Palmer <daniel@thingy.jp>, Romain Perier <romain.perier@gmail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://linux-chenxing.org/
- SCM: git https://github.com/linux-chenxing/linux.git
- Files:
Documentation/devicetree/bindings/arm/mstar/*,Documentation/devicetree/bindings/clock/mstar,msc313-mpll.yaml,Documentation/devicetree/bindings/gpio/mstar,msc313-gpio.yaml,arch/arm/boot/dts/sigmastar/,arch/arm/mach-mstar/,drivers/clk/mstar/,drivers/clocksource/timer-msc313e.c,drivers/gpio/gpio-msc313.c,drivers/rtc/rtc-msc313.c,drivers/watchdog/msc313e_wdt.c,include/dt-bindings/clock/mstar-*,include/dt-bindings/gpio/msc313-gpio.h
ARM/NOMADIK/Ux500 ARCHITECTURES #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
- Files:
Documentation/devicetree/bindings/arm/ste-*,Documentation/devicetree/bindings/arm/ux500.yaml,Documentation/devicetree/bindings/arm/ux500/,Documentation/devicetree/bindings/gpio/st,nomadik-gpio.yaml,Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml,arch/arm/boot/dts/st/ste-*,arch/arm/mach-nomadik/,arch/arm/mach-ux500/,drivers/clk/clk-nomadik.c,drivers/clocksource/clksrc-dbx500-prcmu.c,drivers/dma/ste_dma40*,drivers/pmdomain/st/ste-ux500-pm-domain.c,drivers/gpio/gpio-nomadik.c,drivers/hwspinlock/u8500_hsem.c,drivers/i2c/busses/i2c-nomadik.c,drivers/iio/adc/ab8500-gpadc.c,drivers/mfd/ab8500*,drivers/mfd/abx500*,drivers/mfd/db8500*,drivers/pinctrl/nomadik/,drivers/rtc/rtc-ab8500.c,drivers/rtc/rtc-pl031.c,drivers/soc/ux500/
ARM/NUVOTON MA35 ARCHITECTURE #
- Mail: Jacky Huang <ychuang3@nuvoton.com>, Shan-Chun Hung <schung@nuvoton.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/*/*/*ma35*,Documentation/devicetree/bindings/*/*ma35*,arch/arm64/boot/dts/nuvoton/*ma35*,drivers/*/*/*ma35*,drivers/*/*ma35* - Content regex:
ma35d1
ARM/NUVOTON NPCM ARCHITECTURE #
- Mail: Andrew Jeffery <andrew@codeconstruct.com.au>, Avi Fishman <avifishman70@gmail.com>, Tomer Maimon <tmaimon77@gmail.com>, Tali Perry <tali.perry1@gmail.com>
- Reviewer: Patrick Venture <venture@google.com>, Nancy Yuen <yuenn@google.com>, Benjamin Fair <benjaminfair@google.com>
- Mailing list: openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/bmc/linux.git
- Files:
Documentation/devicetree/bindings/*/*/*npcm*,Documentation/devicetree/bindings/*/*npcm*,Documentation/devicetree/bindings/rtc/nuvoton,nct3018y.yaml,arch/arm/boot/dts/nuvoton/nuvoton-npcm*,arch/arm/mach-npcm/,arch/arm64/boot/dts/nuvoton/,drivers/*/*/*npcm*,drivers/*/*npcm*,drivers/rtc/rtc-nct3018y.c,include/dt-bindings/clock/nuvoton,npcm7xx-clock.h,include/dt-bindings/clock/nuvoton,npcm845-clk.h
ARM/NUVOTON NPCM VIDEO ENGINE DRIVER #
- Mail: Joseph Liu <kwliu@nuvoton.com>, Marvin Lin <kflin@nuvoton.com>
- Mailing list: linux-media@vger.kernel.org, openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/nuvoton,npcm-ece.yaml,Documentation/devicetree/bindings/media/nuvoton,npcm-vcd.yaml,Documentation/userspace-api/media/drivers/npcm-video.rst,drivers/media/platform/nuvoton/,include/uapi/linux/npcm-video.h
ARM/NUVOTON WPCM450 ARCHITECTURE #
- Mail: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
- Mailing list: openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: https://github.com/neuschaefer/wpcm450/wiki
- Files:
Documentation/devicetree/bindings/*/*wpcm*,arch/arm/boot/dts/nuvoton/nuvoton-wpcm450*,arch/arm/configs/wpcm450_defconfig,arch/arm/mach-npcm/wpcm450.c,drivers/*/*/*wpcm*,drivers/*/*wpcm*
ARM/NXP S32G ARCHITECTURE #
- Reviewer: Chester Lin <chester62515@gmail.com>, Matthias Brugger <mbrugger@suse.com>, Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com>, NXP S32 Linux Team <s32@nxp.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rtc/nxp,s32g-rtc.yaml,arch/arm64/boot/dts/freescale/s32g*.dts*,drivers/pinctrl/nxp/,drivers/rtc/rtc-s32g.c
ARM/NXP S32G PCIE CONTROLLER DRIVER #
- Mail: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
- Reviewer: NXP S32 Linux Team <s32@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/nxp,s32g-pcie.yaml,drivers/pci/controller/dwc/pcie-nxp-s32g*
ARM/NXP S32G/S32R DWMAC ETHERNET DRIVER #
- Mail: Jan Petrous <jan.petrous@oss.nxp.com>
- Reviewer: s32@nxp.com
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml,drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c
ARM/Orion SoC/Technologic Systems TS-78xx platform support #
- Mail: Alexander Clouter <alex@digriz.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://www.digriz.org.uk/ts78xx/kernel
- Files:
arch/arm/mach-orion5x/ts78xx-*
ARM/QUALCOMM CHROMEBOOK SUPPORT #
- Reviewer: cros-qcom-dts-watchers@chromium.org
- Files:
arch/arm64/boot/dts/qcom/sc7180*,arch/arm64/boot/dts/qcom/sc7280*
ARM/QUALCOMM MAILING LIST #
- Mailing list: linux-arm-msm@vger.kernel.org
- chat: irc://irc.oftc.net/linux-msm
- Files:
Documentation/devicetree/bindings/*/qcom*,Documentation/devicetree/bindings/soc/qcom/,arch/arm/boot/dts/qcom/,arch/arm/configs/qcom_defconfig,arch/arm/mach-qcom/,arch/arm64/boot/dts/qcom/,drivers/*/*/pm8???-*,drivers/*/*/qcom*,drivers/*/*/qcom/,drivers/*/qcom*,drivers/*/qcom/,drivers/bluetooth/btqcomsmd.c,drivers/clocksource/timer-qcom.c,drivers/cpuidle/cpuidle-qcom-spm.c,drivers/extcon/extcon-qcom*,drivers/i2c/busses/i2c-qcom-geni.c,drivers/i2c/busses/i2c-qup.c,drivers/iommu/msm*,drivers/mfd/ssbi.c,drivers/mmc/host/mmci_qcom*,drivers/mmc/host/sdhci-msm.c,drivers/pci/controller/dwc/pcie-qcom*,drivers/phy/qualcomm/,drivers/power/*/msm*,drivers/reset/reset-qcom-*,drivers/rtc/rtc-pm8xxx.c,drivers/spi/spi-geni-qcom.c,drivers/spi/spi-qcom-qspi.c,drivers/spi/spi-qup.c,drivers/tty/serial/msm_serial.c,drivers/ufs/host/ufs-qcom*,drivers/usb/dwc3/dwc3-qcom.c,include/dt-bindings/*/qcom*,include/linux/*/qcom*,include/linux/soc/qcom/
ARM/QUALCOMM SUPPORT #
- Mail: Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konradybcio@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- chat: irc://irc.oftc.net/linux-msm
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git
- Files:
Documentation/devicetree/bindings/arm/qcom-soc.yaml,Documentation/devicetree/bindings/arm/qcom.yaml,Documentation/devicetree/bindings/bus/qcom*,Documentation/devicetree/bindings/cache/qcom,llcc.yaml,Documentation/devicetree/bindings/firmware/qcom,scm.yaml,Documentation/devicetree/bindings/reserved-memory/qcom*,Documentation/devicetree/bindings/soc/qcom/,arch/arm/boot/dts/qcom/,arch/arm/configs/qcom_defconfig,arch/arm/mach-qcom/,arch/arm64/boot/dts/qcom/,drivers/bus/qcom*,drivers/firmware/qcom/,drivers/soc/qcom/,include/dt-bindings/arm/qcom,ids.h,include/dt-bindings/firmware/qcom,scm.h,include/dt-bindings/soc/qcom*,include/linux/firmware/qcom,include/linux/soc/qcom/,include/soc/qcom/
ARM/RDA MICRO ARCHITECTURE #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-unisoc@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/rda.yaml,Documentation/devicetree/bindings/gpio/gpio-rda.yaml,Documentation/devicetree/bindings/interrupt-controller/rda,8810pl-intc.yaml,Documentation/devicetree/bindings/serial/rda,8810pl-uart.yaml,Documentation/devicetree/bindings/timer/rda,8810pl-timer.yaml,arch/arm/boot/dts/unisoc/,drivers/clocksource/timer-rda.c,drivers/gpio/gpio-rda.c,drivers/irqchip/irq-rda-intc.c,drivers/tty/serial/rda-uart.c
ARM/REALTEK ARCHITECTURE #
- Mail: Andreas Färber <afaerber@suse.de>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-realtek-soc@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/realtek.yaml,arch/arm/boot/dts/realtek/,arch/arm/mach-realtek/,arch/arm64/boot/dts/realtek/
ARM/RISC-V/RENESAS ARCHITECTURE #
- Mail: Geert Uytterhoeven <geert+renesas@glider.be>, Magnus Damm <magnus.damm@gmail.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Patchwork: http://patchwork.kernel.org/project/linux-renesas-soc/list/
- chat: irc://irc.libera.chat/renesas-soc
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next
- Files:
Documentation/devicetree/bindings/hwinfo/renesas,prr.yaml,Documentation/devicetree/bindings/nvmem/renesas,*,Documentation/devicetree/bindings/soc/renesas/,arch/arm/boot/dts/renesas/,arch/arm/configs/shmobile_defconfig,arch/arm/include/debug/renesas-scif.S,arch/arm/mach-shmobile/,arch/arm64/boot/dts/renesas/,arch/riscv/boot/dts/renesas/,drivers/pmdomain/renesas/,drivers/soc/renesas/,include/linux/soc/renesas/ - Regex:
rcar - Content regex:
\brenesas,
ARM/RISCPC ARCHITECTURE #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://www.armlinux.org.uk/
- Files:
arch/arm/include/asm/hardware/ioc.h,arch/arm/include/asm/hardware/iomd.h,arch/arm/include/asm/hardware/memc.h,arch/arm/mach-rpc/,drivers/net/ethernet/8390/etherh.c,drivers/net/ethernet/i825xx/ether1*,drivers/net/ethernet/seeq/ether3*,drivers/scsi/arm/
ARM/Rockchip SoC support #
- Mail: Heiko Stuebner <heiko@sntech.de>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-rockchip@lists.infradead.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git
- Files:
Documentation/devicetree/bindings/i2c/i2c-rk3x.yaml,Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml,Documentation/devicetree/bindings/spi/spi-rockchip.yaml,arch/arm/boot/dts/rockchip/,arch/arm/mach-rockchip/,drivers/*/*/*rockchip*,drivers/*/*rockchip*,drivers/clk/rockchip/,drivers/i2c/busses/i2c-rk3x.c,drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c,sound/soc/rockchip/ - Regex:
rockchip
ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Reviewer: Alim Akhtar <alim.akhtar@samsung.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/process/maintainer-soc-clean-dts.rst
- Patchwork: https://patchwork.kernel.org/project/linux-samsung-soc/list/
- bugs: mailto:linux-samsung-soc@vger.kernel.org
- chat: irc://irc.libera.chat/linux-exynos
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git
- Files:
Documentation/arch/arm/samsung/,Documentation/devicetree/bindings/arm/samsung/,Documentation/devicetree/bindings/hwinfo/samsung,*,Documentation/devicetree/bindings/power/pd-samsung.yaml,Documentation/devicetree/bindings/soc/samsung/,arch/arm/boot/dts/samsung/,arch/arm/mach-exynos*/,arch/arm/mach-s3c/,arch/arm/mach-s5p*/,arch/arm64/boot/dts/exynos/,arch/arm64/boot/dts/tesla/,drivers/*/*/*s3c24*,drivers/*/*s3c24*,drivers/*/*s3c64xx*,drivers/*/*s5pv210*,drivers/clocksource/samsung_pwm_timer.c,drivers/firmware/samsung/,drivers/mailbox/exynos-mailbox.c,drivers/memory/samsung/,drivers/pwm/pwm-samsung.c,drivers/soc/samsung/,drivers/tty/serial/samsung*,include/clocksource/samsung_pwm.h,include/linux/platform_data/*s3c*,include/linux/serial_s3c.h,include/linux/soc/samsung/ - Regex:
exynos,s3c64xx,s5pv210
ARM/SAMSUNG S5P SERIES 2D GRAPHICS ACCELERATION (G2D) SUPPORT #
- Mail: Łukasz Stelmach <l.stelmach@samsung.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/platform/samsung/s5p-g2d/
ARM/SAMSUNG S5P SERIES HDMI CEC SUBSYSTEM SUPPORT #
- Mail: Marek Szyprowski <m.szyprowski@samsung.com>
- Mailing list: linux-samsung-soc@vger.kernel.org, linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/cec/samsung,s5p-cec.yaml,drivers/media/cec/platform/s5p/
ARM/SAMSUNG S5P SERIES JPEG CODEC SUPPORT #
- Mail: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>, Jacek Anaszewski <jacek.anaszewski@gmail.com>, Sylwester Nawrocki <s.nawrocki@samsung.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/samsung,s5pv210-jpeg.yaml,drivers/media/platform/samsung/s5p-jpeg/
ARM/SAMSUNG S5P SERIES Multi Format Codec (MFC) SUPPORT #
- Mail: Marek Szyprowski <m.szyprowski@samsung.com>, Andrzej Hajda <andrzej.hajda@intel.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml,drivers/media/platform/samsung/s5p-mfc/
ARM/SOCFPGA ARCHITECTURE #
- Mail: Dinh Nguyen <dinguyen@kernel.org>
- Status: Maintained
- Web-page: http://www.rocketboards.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
- Files:
arch/arm/boot/dts/intel/socfpga/,arch/arm/configs/socfpga_defconfig,arch/arm/mach-socfpga/,arch/arm64/boot/dts/altera/,arch/arm64/boot/dts/intel/
ARM/SOCFPGA CLOCK FRAMEWORK SUPPORT #
- Mail: Dinh Nguyen <dinguyen@kernel.org>
- Status: Maintained
- Files:
drivers/clk/socfpga/
ARM/SOCFPGA DWMAC GLUE LAYER BINDINGS #
- Mail: Matthew Gerlach <matthew.gerlach@altera.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/altr,gmii-to-sgmii-2.0.yaml,Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml
ARM/SOCFPGA DWMAC GLUE LAYER #
- Mail: Maxime Chevallier <maxime.chevallier@bootlin.com>
- Status: Maintained
- Files:
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
ARM/SOCFPGA EDAC BINDINGS #
- Mail: Niravkumar L Rabara <niravkumarlaxmidas.rabara@altera.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/edac/altr,socfpga-ecc-manager.yaml
ARM/SOCFPGA EDAC SUPPORT #
- Mail: Dinh Nguyen <dinguyen@kernel.org>
- Status: Maintained
- Files:
drivers/edac/altera_edac.[ch]
ARM/SPREADTRUM SoC SUPPORT #
- Mail: Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang7@gmail.com>
- Reviewer: Chunyan Zhang <zhang.lyra@gmail.com>
- Status: Maintained
- Files:
arch/arm64/boot/dts/sprd - Regex:
sprd,sc27xx,sc2731
ARM/STI ARCHITECTURE #
- Mail: Patrice Chotard <patrice.chotard@foss.st.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://www.stlinux.com
- Files:
Documentation/devicetree/bindings/i2c/st,sti-i2c.yaml,Documentation/devicetree/bindings/spi/st,ssc-spi.yaml,arch/arm/boot/dts/st/sti*,arch/arm/mach-sti/,drivers/ata/ahci_st.c,drivers/char/hw_random/st-rng.c,drivers/clocksource/arm_global_timer.c,drivers/clocksource/clksrc_st_lpc.c,drivers/cpufreq/sti-cpufreq.c,drivers/dma/st_fdma*,drivers/i2c/busses/i2c-st.c,drivers/media/rc/st_rc.c,drivers/mmc/host/sdhci-st.c,drivers/phy/st/phy-miphy28lp.c,drivers/phy/st/phy-stih407-usb.c,drivers/pinctrl/pinctrl-st.c,drivers/remoteproc/st_remoteproc.c,drivers/remoteproc/st_slim_rproc.c,drivers/reset/sti/,drivers/rtc/rtc-st-lpc.c,drivers/tty/serial/st-asc.c,drivers/usb/dwc3/dwc3-st.c,drivers/usb/host/ehci-st.c,drivers/usb/host/ohci-st.c,drivers/watchdog/st_lpc_wdt.c,include/linux/remoteproc/st_slim_rproc.h
ARM/STM32 ARCHITECTURE #
- Mail: Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>
- Mailing list: linux-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers), linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-next
- Files:
arch/arm/boot/dts/st/stm32*,arch/arm/mach-stm32/,arch/arm64/boot/dts/st/,drivers/clocksource/armv7m_systick.c - Regex:
stm32,stm
ARM/SUNPLUS SP7021 SOC SUPPORT #
- Mail: Qin Jian <qinjian@cqplus1.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for mon-subscribers)
- Status: Maintained
- Web-page: https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
- Files:
Documentation/devicetree/bindings/arm/sunplus,sp7021.yaml,Documentation/devicetree/bindings/clock/sunplus,sp7021-clkc.yaml,Documentation/devicetree/bindings/interrupt-controller/sunplus,sp7021-intc.yaml,Documentation/devicetree/bindings/reset/sunplus,reset.yaml,arch/arm/boot/dts/sunplus/,arch/arm/configs/sp7021_*defconfig,drivers/clk/clk-sp7021.c,drivers/irqchip/irq-sp7021-intc.c,drivers/reset/reset-sunplus.c,include/dt-bindings/clock/sunplus,sp7021-clkc.h,include/dt-bindings/reset/sunplus,sp7021-reset.h
ARM/Synaptics SoC support #
- Mail: Jisheng Zhang <jszhang@kernel.org>, Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/synaptics/,arch/arm/mach-berlin/,arch/arm64/boot/dts/synaptics/
ARM/TEGRA HDMI CEC SUBSYSTEM SUPPORT #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-tegra@vger.kernel.org, linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/cec/nvidia,tegra114-cec.yaml,drivers/media/cec/platform/tegra/
ARM/TESLA FSD SoC SUPPORT #
- Mail: Alim Akhtar <alim.akhtar@samsung.com>, linux-fsd@tesla.com
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/process/maintainer-soc-clean-dts.rst
- Files:
arch/arm64/boot/dts/tesla/
ARM/TEXAS INSTRUMENT AEMIF/EMIF DRIVERS #
- Mail: Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/memory/*emif*
ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE #
- Mail: Nishanth Menon <nm@ti.com>, Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
- Files:
arch/arm/boot/dts/ti/keystone/,arch/arm/mach-keystone/
ARM/TEXAS INSTRUMENT KEYSTONE CLOCK FRAMEWORK #
- Mail: Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/clk/keystone/
ARM/TEXAS INSTRUMENT KEYSTONE CLOCKSOURCE #
- Mail: Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/clocksource/timer-keystone.c
ARM/TEXAS INSTRUMENT KEYSTONE RESET DRIVER #
- Mail: Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/power/reset/keystone-reset.c
ARM/TEXAS INSTRUMENTS K3 ARCHITECTURE #
- Mail: Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>, Tero Kristo <kristo@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/arm/ti/k3.yaml,Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml,arch/arm64/boot/dts/ti/Makefile,arch/arm64/boot/dts/ti/k3-*
ARM/TEXAS INSTRUMENTS NSPIRE ARCHITECTURE #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/*/*/ti,nspire*,Documentation/devicetree/bindings/*/ti,nspire*,Documentation/devicetree/bindings/arm/ti/nspire.yaml,arch/arm/boot/dts/nspire/
ARM/TOSHIBA VISCONTI ARCHITECTURE #
- Mail: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/iwamatsu/linux-visconti.git
- Files:
Documentation/devicetree/bindings/arm/toshiba.yaml,Documentation/devicetree/bindings/clock/toshiba,tmpv770x-pipllct.yaml,Documentation/devicetree/bindings/clock/toshiba,tmpv770x-pismu.yaml,Documentation/devicetree/bindings/gpio/toshiba,gpio-visconti.yaml,Documentation/devicetree/bindings/net/toshiba,visconti-dwmac.yaml,Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml,Documentation/devicetree/bindings/pinctrl/toshiba,visconti-pinctrl.yaml,Documentation/devicetree/bindings/watchdog/toshiba,visconti-wdt.yaml,arch/arm64/boot/dts/toshiba/,drivers/clk/visconti/,drivers/gpio/gpio-visconti.c,drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c,drivers/pci/controller/dwc/pcie-visconti.c,drivers/pinctrl/visconti/,drivers/watchdog/visconti_wdt.c - Regex:
visconti
ARM/UNIPHIER ARCHITECTURE #
- Mail: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>, Masami Hiramatsu <mhiramat@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/socionext/uniphier.yaml,Documentation/devicetree/bindings/gpio/socionext,uniphier-gpio.yaml,Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml,Documentation/devicetree/bindings/soc/socionext/socionext,uniphier*.yaml,arch/arm/boot/dts/socionext/uniphier*,arch/arm/include/asm/hardware/cache-uniphier.h,arch/arm/mm/cache-uniphier.c,arch/arm64/boot/dts/socionext/uniphier*,drivers/bus/uniphier-system-bus.c,drivers/clk/uniphier/,drivers/dma/uniphier-mdmac.c,drivers/gpio/gpio-uniphier.c,drivers/i2c/busses/i2c-uniphier*,drivers/irqchip/irq-uniphier-aidet.c,drivers/mmc/host/uniphier-sd.c,drivers/pinctrl/uniphier/,drivers/reset/reset-uniphier.c,drivers/tty/serial/8250/8250_uniphier.c - Regex:
uniphier
ARM/VERSATILE EXPRESS PLATFORM #
- Mail: Liviu Dudau <liviu.dudau@arm.com>, Sudeep Holla <sudeep.holla@kernel.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Regex:
mps2,vexpress - Files:
arch/arm/mach-versatile/,arch/arm64/boot/dts/arm/,drivers/clocksource/timer-versatile.c - Excluded:
drivers/cpufreq/vexpress-spc-cpufreq.c,Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml
ARM/VFP SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://www.armlinux.org.uk/
- Files:
arch/arm/vfp/
ARM/VT8500 ARM ARCHITECTURE #
- Mail: Alexey Charkov <alchark@gmail.com>, Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/hwinfo/via,vt8500-scc-id.yaml,Documentation/devicetree/bindings/i2c/wm,wm8505-i2c.yaml,Documentation/devicetree/bindings/interrupt-controller/via,vt8500-intc.yaml,Documentation/devicetree/bindings/pwm/via,vt8500-pwm.yaml,Documentation/devicetree/bindings/timer/via,vt8500-timer.yaml,arch/arm/boot/dts/vt8500/,arch/arm/mach-vt8500/,drivers/clocksource/timer-vt8500.c,drivers/i2c/busses/i2c-viai2c-wmt.c,drivers/mmc/host/wmt-sdmmc.c,drivers/pwm/pwm-vt8500.c,drivers/rtc/rtc-vt8500.c,drivers/soc/vt8500/,drivers/tty/serial/vt8500_serial.c,drivers/video/fbdev/vt8500lcdfb.*,drivers/video/fbdev/wm8505fb*,drivers/video/fbdev/wmt_ge_rops.*
ARM/ZYNQ ARCHITECTURE #
- Mail: Michal Simek <michal.simek@amd.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Web-page: http://wiki.xilinx.com
- SCM: git https://github.com/Xilinx/linux-xlnx.git
- Files:
Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml,Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml,Documentation/devicetree/bindings/memory-controllers/snps,dw-umctl2-ddrc.yaml,Documentation/devicetree/bindings/memory-controllers/xlnx,zynq-ddrc-a05.yaml,Documentation/devicetree/bindings/soc/xilinx/xilinx.yaml,Documentation/devicetree/bindings/spi/xlnx,zynq-qspi.yaml,arch/arm/mach-zynq/,drivers/clocksource/timer-cadence-ttc.c,drivers/cpuidle/cpuidle-zynq.c,drivers/edac/synopsys_edac.c,drivers/i2c/busses/i2c-cadence.c,drivers/i2c/busses/i2c-xiic.c,drivers/mmc/host/sdhci-of-arasan.c - Regex:
zynq,xilinx
ARM64 FIT SUPPORT #
- Mail: Simon Glass <sjg@chromium.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm64/boot/Makefile,scripts/make_fit.py
ARM64 PLATFORM DRIVERS #
- Mail: Hans de Goede <hansg@kernel.org>, Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
- Reviewer: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/platform-driver-x86/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
- Files:
drivers/platform/arm64/
ARM64 PORT (AARCH64 ARCHITECTURE) #
- Mail: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
- Files:
Documentation/arch/arm64/,arch/arm64/,drivers/virt/coco/arm-cca-guest/,drivers/virt/coco/pkvm-guest/,tools/testing/selftests/arm64/ - Excluded:
arch/arm64/boot/dts/,arch/arm64/configs/defconfig
ARROW SPEEDCHIPS XRS7000 SERIES ETHERNET SWITCH DRIVER #
- Mail: George McCollister <george.mccollister@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml,drivers/net/dsa/xrs700x/*,net/dsa/tag_xrs700x.c
AS3645A LED FLASH CONTROLLER DRIVER #
- Mail: Sakari Ailus <sakari.ailus@iki.fi>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
drivers/leds/flash/leds-as3645a.c
AS3668 LED DRIVER #
- Mail: Lukas Timmermann <linux@timmermann.space>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/ams,as3668.yaml,drivers/leds/leds-as3668.c
ASAHI KASEI AK7375 LENS VOICE COIL DRIVER #
- Mail: Tianshu Qiu <tian.shu.qiu@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/asahi-kasei,ak7375.yaml,drivers/media/i2c/ak7375.c
ASAHI KASEI AK8974 DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: http://www.akm.com/
- Files:
drivers/iio/magnetometer/ak8974.c
AOSONG AGS02MA TVOC SENSOR DRIVER #
- Mail: Anshul Dalal <anshulusr@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/chemical/aosong,ags02ma.yaml,drivers/iio/chemical/ags02ma.c
AOSONG ADP810 DIFFERENTIAL PRESSURE SENSOR DRIVER #
- Mail: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/pressure/aosong,adp810.yaml,drivers/iio/pressure/adp810.c
ASC7621 HARDWARE MONITOR DRIVER #
- Mail: George Joseph <george.joseph@fairview5.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/asc7621.rst,drivers/hwmon/asc7621.c
ASIX AX88796C SPI ETHERNET ADAPTER #
- Mail: Łukasz Stelmach <l.stelmach@samsung.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/asix,ax88796c.yaml,drivers/net/ethernet/asix/ax88796c_*
ASIX PHY DRIVER [RUST] #
- Mail: FUJITA Tomonori <fujita.tomonori@gmail.com>
- Reviewer: Trevor Gross <tmgross@umich.edu>
- Mailing list: netdev@vger.kernel.org, rust-for-linux@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/ax88796b_rust.rs
ARM/ASPEED CLOCK SUPPORT #
- Mail: Ryan Chen <ryan_chen@aspeedtech.com>
- Reviewer: Joel Stanley <joel@jms.id.au>
- Mailing list: linux-clk@vger.kernel.org, linux-aspeed@lists.ozlabs.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml,drivers/clk/aspeed/
ASPEED CRYPTO DRIVER #
- Mail: Neal Liu <neal_liu@aspeedtech.com>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/aspeed,*,drivers/crypto/aspeed/
ASPEED PECI CONTROLLER #
- Mail: Iwona Winiarska <iwona.winiarska@intel.com>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers), openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/peci/peci-aspeed.yaml,drivers/peci/controller/peci-aspeed.c
ASPEED PINCTRL DRIVERS #
- Mail: Andrew Jeffery <andrew@codeconstruct.com.au>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers), openbmc@lists.ozlabs.org (moderated for non-subscribers), linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/aspeed,*,drivers/pinctrl/aspeed/
ASPEED SCU INTERRUPT CONTROLLER DRIVER #
- Mail: Eddie James <eajames@linux.ibm.com>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2500-scu-ic.yaml,drivers/irqchip/irq-aspeed-scu-ic.c,include/dt-bindings/interrupt-controller/aspeed-scu-ic.h
ASPEED SD/MMC DRIVER #
- Mail: Andrew Jeffery <andrew@codeconstruct.com.au>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers), openbmc@lists.ozlabs.org (moderated for non-subscribers), linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mmc/aspeed,sdhci.yaml,drivers/mmc/host/sdhci-of-aspeed*
ASPEED SMC SPI DRIVER #
- Mail: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com>, Cédric Le Goater <clg@kaod.org>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers), openbmc@lists.ozlabs.org (moderated for non-subscribers), linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml,drivers/spi/spi-aspeed-smc.c
ASPEED USB UDC DRIVER #
- Mail: Neal Liu <neal_liu@aspeedtech.com>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/aspeed,ast2600-udc.yaml,drivers/usb/gadget/udc/aspeed_udc.c
ASPEED VIDEO ENGINE DRIVER #
- Mail: Eddie James <eajames@linux.ibm.com>
- Mailing list: linux-media@vger.kernel.org, openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/aspeed,video-engine.yaml,drivers/media/platform/aspeed/
ASPEED PCIE CONTROLLER DRIVER #
- Mail: Jacky Chou <jacky_chou@aspeedtech.com>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers), linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/aspeed,ast2600-pcie.yaml,drivers/pci/controller/pcie-aspeed.c
ASUS EC HARDWARE MONITOR DRIVER #
- Mail: Eugene Shalygin <eugene.shalygin@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/asus-ec-sensors.c
ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS #
- Mail: Corentin Chary <corentin.chary@gmail.com>, Luke D. Jones <luke@ljones.dev>, Denis Benato <denis.benato@linux.dev>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: https://asus-linux.org/
- Files:
drivers/platform/x86/asus*.c,drivers/platform/x86/eeepc*.c
ASUS TF103C DOCK DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
- Files:
drivers/platform/x86/asus-tf103c-dock.c
ASUS ROG RYUJIN AIO HARDWARE MONITOR DRIVER #
- Mail: Aleksa Savic <savicaleksa83@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/asus_rog_ryujin.c
ASUS WIRELESS RADIO CONTROL DRIVER #
- Mail: João Paulo Rechi Vita <jprvita@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/asus-wireless.c
ASUS WMI HARDWARE MONITOR DRIVER #
- Mail: Ed Brindley <kernel@maidavale.org>, Denis Pauk <pauk.denis@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/asus_wmi_sensors.c
ASYMMETRIC KEYS #
- Mail: David Howells <dhowells@redhat.com>, Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>
- Mailing list: keyrings@vger.kernel.org, linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/crypto/asymmetric-keys.rst,crypto/asymmetric_keys/,include/crypto/pkcs7.h,include/crypto/public_key.h,include/keys/asymmetric-*.h,include/linux/verification.h
ASYMMETRIC KEYS - ECDSA #
- Mail: Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>
- Reviewer: Stefan Berger <stefanb@linux.ibm.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
crypto/ecc*,crypto/ecdsa*,include/crypto/ecc*
ASYMMETRIC KEYS - GOST #
- Mail: Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Odd fixes
- Files:
crypto/ecrdsa*
ASYMMETRIC KEYS - RSA #
- Mail: Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
crypto/rsa*
ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API #
- Reviewer: Dan Williams <dan.j.williams@intel.com>
- Status: Odd fixes
- Web-page: http://sourceforge.net/projects/xscaleiop
- Files:
Documentation/crypto/async-tx-api.rst,crypto/async_tx/,include/linux/async_tx.h
AT24 EEPROM DRIVER #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
- Files:
Documentation/devicetree/bindings/eeprom/at24.yaml,drivers/misc/eeprom/at24.c
ATA OVER ETHERNET (AOE) DRIVER #
- Mail: "Justin Sanders" <justin@coraid.com>
- Status: Supported
- Web-page: http://www.openaoe.org/
- Files:
Documentation/admin-guide/aoe/,drivers/block/aoe/
ATC260X PMIC MFD DRIVER #
- Mail: Manivannan Sadhasivam <mani@kernel.org>, Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
- Mailing list: linux-actions@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/actions,atc260x.yaml,drivers/input/misc/atc260x-onkey.c,drivers/mfd/atc260*,drivers/power/reset/atc260x-poweroff.c,drivers/regulator/atc260x-regulator.c,include/linux/mfd/atc260x/*
ATCRTC100 RTC DRIVER #
- Mail: CL Wang <cl634@andestech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/rtc/andestech,atcrtc100.yaml,drivers/rtc/rtc-atcrtc100.c
ATHEROS 71XX/9XXX GPIO DRIVER #
- Mail: Alban Bedel <albeu@free.fr>
- Status: Maintained
- Web-page: https://github.com/AlbanBedel/linux
- SCM: git https://github.com/AlbanBedel/linux.git
- Files:
Documentation/devicetree/bindings/gpio/qca,ar7100-gpio.yaml,drivers/gpio/gpio-ath79.c
ATHEROS 71XX/9XXX USB PHY DRIVER #
- Mail: Alban Bedel <albeu@free.fr>
- Status: Maintained
- Web-page: https://github.com/AlbanBedel/linux
- SCM: git https://github.com/AlbanBedel/linux.git
- Files:
Documentation/devicetree/bindings/phy/qca,ar7100-usb-phy.yaml,drivers/phy/qualcomm/phy-ath79-usb.c
ATHEROS ATH GENERIC UTILITIES #
- Mail: Jeff Johnson <jjohnson@kernel.org>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Files:
drivers/net/wireless/ath/*
ATHEROS ATH5K WIRELESS DRIVER #
- Mail: Jiri Slaby <jirislaby@kernel.org>, Nick Kossifidis <mickflemm@gmail.com>, Luis Chamberlain <mcgrof@kernel.org>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k
- Files:
drivers/net/wireless/ath/ath5k/
ATHEROS ATH6KL WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl
- Files:
drivers/net/wireless/ath/ath6kl/
ATI_REMOTE2 DRIVER #
- Mail: Ville Syrjala <syrjala@sci.fi>
- Status: Maintained
- Files:
drivers/input/misc/ati_remote2.c
ATK0110 HWMON DRIVER #
- Mail: Luca Tettamanti <kronos.it@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/asus_atk0110.c
ATLX ETHERNET DRIVERS #
- Mail: Chris Snook <chris.snook@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://sourceforge.net/projects/atl1, http://atl1.sourceforge.net
- Files:
drivers/net/ethernet/atheros/
ATM #
- Mail: Chas Williams <3chas3@gmail.com>
- Mailing list: linux-atm-general@lists.sourceforge.net (moderated for non-subscribers), netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://linux-atm.sourceforge.net
- Files:
drivers/atm/,include/linux/atm*,include/linux/sonet.h,include/uapi/linux/atm*,include/uapi/linux/sonet.h
ATMEL MACB ETHERNET DRIVER #
- Mail: Nicolas Ferre <nicolas.ferre@microchip.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Status: Maintained
- Files:
drivers/net/ethernet/cadence/
ATMEL MAXTOUCH DRIVER #
- Mail: Nick Dyer <nick@shmanahar.org>
- Status: Maintained
- SCM: git https://github.com/ndyer/linux.git
- Files:
Documentation/devicetree/bindings/input/atmel,maxtouch.yaml,drivers/input/touchscreen/atmel_mxt_ts.c
ATOMIC INFRASTRUCTURE #
- Mail: Will Deacon <will@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Boqun Feng <boqun@kernel.org>
- Reviewer: Mark Rutland <mark.rutland@arm.com>, Gary Guo <gary@garyguo.net>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/atomic_*.txt,arch/*/include/asm/atomic*.h,include/*/atomic*.h,include/linux/refcount.h,scripts/atomic/,rust/kernel/sync/atomic.rs,rust/kernel/sync/atomic/,rust/kernel/sync/refcount.rs
ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER #
- Mail: Bradley Grove <linuxdrivers@attotech.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.attotech.com
- Files:
drivers/scsi/esas2r
ATUSB IEEE 802.15.4 RADIO DRIVER #
- Mail: Stefan Schmidt <stefan@datenfreihafen.org>
- Mailing list: linux-wpan@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ieee802154/at86rf230.h,drivers/net/ieee802154/atusb.c,drivers/net/ieee802154/atusb.h
AUDIT SUBSYSTEM #
- Mail: Paul Moore <paul@paul-moore.com>, Eric Paris <eparis@redhat.com>
- Mailing list: audit@vger.kernel.org
- Status: Supported
- Web-page: https://github.com/linux-audit
- Patchwork: https://patchwork.kernel.org/project/audit/list
- bugs: mailto:audit@vger.kernel.org
- Subsystem Profile: https://github.com/linux-audit/audit-kernel/blob/main/README.md
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git
- Files:
include/asm-generic/audit_*.h,include/linux/audit.h,include/linux/audit_arch.h,include/uapi/linux/audit.h,kernel/audit*,lib/*audit.c - Content regex:
\baudit_[a-z_0-9]\+\b
AUTOFDO BUILD #
- Mail: Rong Xu <xur@google.com>, Han Shen <shenhan@google.com>
- Status: Supported
- Files:
Documentation/dev-tools/autofdo.rst,scripts/Makefile.autofdo
AUXILIARY BUS DRIVER #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Danilo Krummrich <dakr@kernel.org>
- Reviewer: Dave Ertman <david.m.ertman@intel.com>, Ira Weiny <ira.weiny@intel.com>, Leon Romanovsky <leon@kernel.org>
- Mailing list: driver-core@lists.linux.dev
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
- Files:
Documentation/driver-api/auxiliary_bus.rst,drivers/base/auxiliary.c,include/linux/auxiliary_bus.h,rust/helpers/auxiliary.c,rust/kernel/auxiliary.rs,samples/rust/rust_driver_auxiliary.rs
AUXILIARY DISPLAY DRIVERS #
- Mail: Andy Shevchenko <andy@kernel.org>
- Reviewer: Geert Uytterhoeven <geert@linux-m68k.org>
- Status: Odd Fixes
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-auxdisplay.git
- Files:
Documentation/devicetree/bindings/auxdisplay/,drivers/auxdisplay/,include/linux/cfag12864b.h,include/uapi/linux/map_to_14segment.h,include/uapi/linux/map_to_7segment.h
AVAGO APDS9306 AMBIENT LIGHT SENSOR DRIVER #
- Mail: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/avago,apds9300.yaml,drivers/iio/light/apds9306.c
AVIA HX711 ANALOG DIGITAL CONVERTER IIO DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml,drivers/iio/adc/hx711.c
AWINIC AW99706 WLED BACKLIGHT DRIVER #
- Mail: Junjie Cao <caojunjie650@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/backlight/awinic,aw99706.yaml,drivers/video/backlight/aw99706.c
AX.25 NETWORK LAYER #
- Mailing list: linux-hams@vger.kernel.org
- Status: Orphan
- Web-page: https://linux-ax25.in-berlin.de
- Files:
include/net/ax25.h,include/uapi/linux/ax25.h,net/ax25/
AXENTIA ARM DEVICES #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/microchip/at91-linea.dtsi,arch/arm/boot/dts/microchip/at91-natte.dtsi,arch/arm/boot/dts/microchip/at91-nattis-2-natte-2.dts,arch/arm/boot/dts/microchip/at91-tse850-3.dts
AXENTIA ASOC DRIVERS #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/axentia,*,sound/soc/atmel/tse850-pcm5142.c
AXIS ARTPEC ARM64 SoC SUPPORT #
- Mail: Jesper Nilsson <jesper.nilsson@axis.com>, Lars Persson <lars.persson@axis.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org, linux-arm-kernel@axis.com
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/axis,artpec*-clock.yaml,arch/arm64/boot/dts/exynos/axis/,drivers/clk/samsung/clk-artpec*.c,include/dt-bindings/clock/axis,artpec*-clk.h
AXI-FAN-CONTROL HARDWARE MONITOR DRIVER #
- Mail: Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/adi,axi-fan-control.yaml,drivers/hwmon/axi-fan-control.c
AXI SPI ENGINE #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: David Lechner <dlechner@baylibre.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml,drivers/spi/spi-axi-spi-engine.c
AXI PWM GENERATOR #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Nuno Sá <nuno.sa@analog.com>
- Reviewer: Trevor Gamblin <tgamblin@baylibre.com>
- Mailing list: linux-pwm@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml,drivers/pwm/pwm-axi-pwmgen.c
AXIADO SPI DB DRIVER #
- Mail: Vladimir Moravcevic <vmoravcevic@axiado.com>, Tzu-Hao Wei <twei@axiado.com>, Swark Yang <syang@axiado.com>, Prasad Bolisetty <pbolisetty@axiado.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/axiado,ax3000-spi.yaml,drivers/spi/spi-axiado.c,drivers/spi/spi-axiado.h
AYANEO PLATFORM EC DRIVER #
- Mail: Antheas Kapenekakis <lkml@antheas.dev>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-platform-ayaneo,drivers/platform/x86/ayaneo-ec.c
AZ6007 DVB DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/dvb-usb-v2/az6007.c
AZTECH FM RADIO RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-aztech*
B43 WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org
- Status: Orphan
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/b43
- Files:
drivers/net/wireless/broadcom/b43/
B43LEGACY WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org
- Status: Orphan
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/b43
- Files:
drivers/net/wireless/broadcom/b43legacy/
BACKLIGHT CLASS/SUBSYSTEM #
- Mail: Lee Jones <lee@kernel.org>, Daniel Thompson <danielt@kernel.org>, Jingoo Han <jingoohan1@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
- Files:
Documentation/ABI/stable/sysfs-class-backlight,Documentation/ABI/testing/sysfs-class-backlight,Documentation/devicetree/bindings/leds/backlight,drivers/video/backlight/,include/linux/backlight.h,include/linux/pwm_backlight.h
BARCO P50 GPIO DRIVER #
- Mail: Santosh Kumar Yadav <santoshkumar.yadav@barco.com>, Peter Korsgaard <peter.korsgaard@barco.com>
- Status: Maintained
- Files:
drivers/platform/x86/barco-p50-gpio.c
BATMAN ADVANCED #
- Mail: Marek Lindner <marek.lindner@mailbox.org>, Simon Wunderlich <sw@simonwunderlich.de>, Antonio Quartulli <antonio@mandelbit.com>, Sven Eckelmann <sven@narfation.org>
- Mailing list: b.a.t.m.a.n@lists.open-mesh.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: https://www.open-mesh.org/
- Patchwork: https://patchwork.open-mesh.org/project/batman/list/
- bugs: https://www.open-mesh.org/projects/batman-adv/issues
- chat: ircs://irc.hackint.org/batadv
- SCM: git https://git.open-mesh.org/linux-merge.git
- Files:
Documentation/networking/batman-adv.rst,include/uapi/linux/batadv_packet.h,include/uapi/linux/batman_adv.h,net/batman-adv/
BAYCOM/HDLCDRV DRIVERS FOR AX.25 #
- Mail: Thomas Sailer <t.sailer@alumni.ethz.ch>
- Mailing list: linux-hams@vger.kernel.org
- Status: Maintained
- Web-page: http://www.baycom.org/~tom/ham/ham.html
- Files:
drivers/net/hamradio/baycom*
BCACHE (BLOCK LAYER CACHE) #
- Mail: Coly Li <colyli@fnnas.com>, Kent Overstreet <kent.overstreet@linux.dev>
- Mailing list: linux-bcache@vger.kernel.org
- Status: Maintained
- Web-page: http://bcache.evilpiepirate.org
- chat: irc://irc.oftc.net/bcache
- Files:
drivers/md/bcache/
BCACHEFS #
- Mail: Kent Overstreet <kent.overstreet@linux.dev>
- Mailing list: linux-bcachefs@vger.kernel.org
- Status: Externally maintained
- chat: irc://irc.oftc.net/bcache
- SCM: git https://evilpiepirate.org/git/bcachefs.git
BDISP ST MEDIA DRIVER #
- Mail: Fabien Dessenne <fabien.dessenne@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/platform/st/sti/bdisp
BECKHOFF CX5020 ETHERCAT MASTER DRIVER #
- Mail: Dariusz Marcinkiewicz <reksio@newterm.pl>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/ec_bhf.c
BEFS FILE SYSTEM #
- Mail: Luis de Bethencourt <luisbg@kernel.org>, Salah Triki <salah.triki@gmail.com>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/luisbg/linux-befs.git
- Files:
Documentation/filesystems/befs.rst,fs/befs/
BFQ I/O SCHEDULER #
- Mail: Yu Kuai <yukuai@fnnas.com>
- Mailing list: linux-block@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/block/bfq-iosched.rst,block/bfq-*
BFS FILE SYSTEM #
- Mail: "Tigran A. Aivazian" <aivazian.tigran@gmail.com>
- Status: Maintained
- Files:
Documentation/filesystems/bfs.rst,fs/bfs/,include/uapi/linux/bfs_fs.h
BITMAP API #
- Mail: Yury Norov <yury.norov@gmail.com>
- Reviewer: Rasmus Villemoes <linux@rasmusvillemoes.dk>
- Status: Maintained
- Files:
include/linux/bitfield.h,include/linux/bitmap-str.h,include/linux/bitmap.h,include/linux/bits.h,include/linux/cpumask.h,include/linux/cpumask_types.h,include/linux/find.h,include/linux/hw_bitfield.h,include/linux/nodemask.h,include/linux/nodemask_types.h,include/uapi/linux/bits.h,include/vdso/bits.h,lib/bitmap-str.c,lib/bitmap.c,lib/cpumask.c,lib/find_bit.c,lib/find_bit_benchmark.c,lib/test_bitmap.c,lib/tests/cpumask_kunit.c,tools/include/linux/bitfield.h,tools/include/linux/bitmap.h,tools/include/linux/bits.h,tools/include/linux/find.h,tools/include/uapi/linux/bits.h,tools/include/vdso/bits.h,tools/lib/bitmap.c,tools/lib/find_bit.c
BITMAP API BINDINGS [RUST] #
- Mail: Yury Norov <yury.norov@gmail.com>
- Status: Maintained
- Files:
rust/helpers/bitmap.c,rust/helpers/cpumask.c
BITMAP API [RUST] #
- Mail: Alice Ryhl <aliceryhl@google.com>, Burak Emir <bqe@google.com>
- Reviewer: Yury Norov <yury.norov@gmail.com>
- Status: Maintained
- Files:
lib/find_bit_benchmark_rust.rs,rust/kernel/bitmap.rs,rust/kernel/id_pool.rs
BITOPS API #
- Mail: Yury Norov <yury.norov@gmail.com>
- Reviewer: Rasmus Villemoes <linux@rasmusvillemoes.dk>
- Status: Maintained
- Files:
arch/*/include/asm/bitops.h,arch/*/include/asm/bitops_32.h,arch/*/include/asm/bitops_64.h,arch/*/lib/bitops.c,include/asm-generic/bitops,include/asm-generic/bitops.h,include/linux/bitops.h,include/linux/count_zeros.h,lib/hweight.c,lib/test_bitops.c,lib/tests/bitops_kunit.c,tools/*/bitops*
BITOPS API BINDINGS [RUST] #
- Mail: Yury Norov <yury.norov@gmail.com>
- Status: Maintained
- Files:
rust/helpers/bitops.c
BLINKM RGB LED DRIVER #
- Mail: Jan-Simon Moeller <jansimon.moeller@gmx.de>
- Status: Maintained
- Files:
drivers/leds/leds-blinkm.c
BLOCK LAYER #
- Mail: Jens Axboe <axboe@kernel.dk>
- Mailing list: linux-block@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git
- Files:
Documentation/ABI/stable/sysfs-block,Documentation/block/,block/,drivers/block/,include/linux/bio.h,include/linux/blk*,include/uapi/linux/blk*,include/uapi/linux/ioprio.h,kernel/trace/blktrace.c,lib/sbitmap.c
BLOCK LAYER DEVICE DRIVER API [RUST] #
- Mail: Andreas Hindborg <a.hindborg@kernel.org>
- Reviewer: Boqun Feng <boqun@kernel.org>
- Mailing list: linux-block@vger.kernel.org, rust-for-linux@vger.kernel.org
- Status: Supported
- Web-page: https://rust-for-linux.com
- bugs: https://github.com/Rust-for-Linux/linux/issues
- chat: https://rust-for-linux.zulipchat.com/#narrow/stream/Block
- SCM: git https://github.com/Rust-for-Linux/linux.git rust-block-next
- Files:
drivers/block/rnull/,rust/kernel/block.rs,rust/kernel/block/
BLOCK2MTD DRIVER #
- Mail: Joern Engel <joern@lazybastard.org>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/devices/block2mtd.c
BLUETOOTH DRIVERS #
- Mail: Marcel Holtmann <marcel@holtmann.org>, Luiz Augusto von Dentz <luiz.dentz@gmail.com>
- Mailing list: linux-bluetooth@vger.kernel.org
- Status: Supported
- Web-page: http://www.bluez.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git, git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
- Files:
Documentation/devicetree/bindings/net/bluetooth/,drivers/bluetooth/
BLUETOOTH SUBSYSTEM #
- Mail: Marcel Holtmann <marcel@holtmann.org>, Luiz Augusto von Dentz <luiz.dentz@gmail.com>
- Mailing list: linux-bluetooth@vger.kernel.org
- Status: Supported
- Web-page: http://www.bluez.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git, git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
- Files:
Documentation/ABI/stable/sysfs-class-bluetooth,include/net/bluetooth/,net/bluetooth/
BLZP1600 GPIO DRIVER #
- Mail: James Cowgill <james.cowgill@blaize.com>, Matt Redfearn <matt.redfearn@blaize.com>, Neil Jones <neil.jones@blaize.com>, Nikolaos Pasaloukos <nikolaos.pasaloukos@blaize.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/blaize,blzp1600-gpio.yaml,drivers/gpio/gpio-blzp1600.c
BONDING DRIVER #
- Mail: Jay Vosburgh <jv@jvosburgh.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/bonding.rst,drivers/net/bonding/,include/net/bond*,include/uapi/linux/if_bonding.h,tools/testing/selftests/drivers/net/bonding/
BOSCH SENSORTEC BMA220 ACCELEROMETER IIO DRIVER #
- Mail: Petre Rodan <petre.rodan@subdimension.ro>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/accel/bosch,bma220.yaml,drivers/iio/accel/bma220*
BOSCH SENSORTEC BMA400 ACCELEROMETER IIO DRIVER #
- Mail: Dan Robertson <dan@dlrobertson.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/accel/bosch,bma400.yaml,drivers/iio/accel/bma400*
BOSCH SENSORTEC BMI270 IMU IIO DRIVER #
- Mail: Alex Lanzano <lanzano.alex@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/imu/bosch,bmi270.yaml,drivers/iio/imu/bmi270/
BOSCH SENSORTEC BMI323 IMU IIO DRIVER #
- Mail: Jagath Jog J <jagathjog1996@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/imu/bosch,bmi323.yaml,drivers/iio/imu/bmi323/
BPF JIT for ARC #
- Mail: Shahab Vahedi <list+bpf@vahedi.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
arch/arc/net/
BPF JIT for ARM #
- Mail: Russell King <linux@armlinux.org.uk>, Puranjay Mohan <puranjay@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/net/
BPF JIT for ARM64 #
- Mail: Daniel Borkmann <daniel@iogearbox.net>, Alexei Starovoitov <ast@kernel.org>, Puranjay Mohan <puranjay@kernel.org>
- Reviewer: Xu Kuohai <xukuohai@huaweicloud.com>
- Mailing list: bpf@vger.kernel.org
- Status: Supported
- Files:
arch/arm64/net/
BPF JIT for LOONGARCH #
- Mail: Tiezhu Yang <yangtiezhu@loongson.cn>
- Reviewer: Hengqi Chen <hengqi.chen@gmail.com>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
arch/loongarch/net/
BPF JIT for MIPS (32-BIT AND 64-BIT) #
- Mail: Johan Almbladh <johan.almbladh@anyfinetworks.com>, Paul Burton <paulburton@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/net/
BPF JIT for NFP NICs #
- Mail: Jakub Kicinski <kuba@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/net/ethernet/netronome/nfp/bpf/
BPF JIT for POWERPC (32-BIT AND 64-BIT) #
- Mail: Hari Bathini <hbathini@linux.ibm.com>, Christophe Leroy (CS GROUP) <chleroy@kernel.org>
- Reviewer: Naveen N Rao <naveen@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Supported
- Files:
arch/powerpc/net/
BPF JIT for RISC-V (32-bit) #
- Mail: Luke Nelson <luke.r.nels@gmail.com>, Xi Wang <xi.wang@gmail.com>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
arch/riscv/net/ - Excluded:
arch/riscv/net/bpf_jit_comp64.c
BPF JIT for RISC-V (64-bit) #
- Mail: Björn Töpel <bjorn@kernel.org>
- Reviewer: Pu Lehui <pulehui@huawei.com>, Puranjay Mohan <puranjay@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
arch/riscv/net/ - Excluded:
arch/riscv/net/bpf_jit_comp32.c
BPF JIT for S390 #
- Mail: Ilya Leoshkevich <iii@linux.ibm.com>, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>
- Mailing list: bpf@vger.kernel.org
- Status: Supported
- Files:
arch/s390/net/ - Excluded:
arch/s390/net/pnet.c
BPF JIT for SPARC (32-BIT AND 64-BIT) #
- Mail: David S. Miller <davem@davemloft.net>
- Mailing list: bpf@vger.kernel.org
- Status: Odd Fixes
- Files:
arch/sparc/net/
BPF JIT for X86 32-BIT #
- Mail: Wang YanQing <udknight@gmail.com>
- Mailing list: bpf@vger.kernel.org
- Status: Odd Fixes
- Files:
arch/x86/net/bpf_jit_comp32.c
BPF JIT for X86 64-BIT #
- Mail: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>
- Mailing list: bpf@vger.kernel.org
- Status: Supported
- Files:
arch/x86/net/ - Excluded:
arch/x86/net/bpf_jit_comp32.c
BPF [BTF] #
- Mail: Martin KaFai Lau <martin.lau@linux.dev>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
include/linux/btf*,kernel/bpf/btf.c
BPF [CORE] #
- Mail: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>
- Reviewer: John Fastabend <john.fastabend@gmail.com>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
include/linux/bpf*,include/linux/filter.h,include/linux/tnum.h,kernel/bpf/core.c,kernel/bpf/dispatcher.c,kernel/bpf/mprog.c,kernel/bpf/syscall.c,kernel/bpf/tnum.c,kernel/bpf/trampoline.c,kernel/bpf/verifier.c
BPF [CRYPTO] #
- Mail: Vadim Fedorenko <vadim.fedorenko@linux.dev>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
crypto/bpf_crypto_skcipher.c,include/linux/bpf_crypto.h,kernel/bpf/crypto.c
BPF [DOCUMENTATION] (Related to Standardization) #
- Reviewer: David Vernet <void@manifault.com>
- Mailing list: bpf@vger.kernel.org, bpf@ietf.org
- Status: Maintained
- Files:
Documentation/bpf/standardization/
BPF [GENERAL] (Safe Dynamic Programs and Tools) #
- Mail: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>
- Reviewer: Martin KaFai Lau <martin.lau@linux.dev>, Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>, Yonghong Song <yonghong.song@linux.dev>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Supported
- Web-page: https://bpf.io/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/?delegate=121173
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git, git git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
- Files:
Documentation/bpf/,Documentation/networking/filter.rst,Documentation/userspace-api/ebpf/,arch/*/net/*,include/linux/bpf*,include/linux/btf*,include/linux/buildid.h,include/linux/filter.h,include/trace/events/xdp.h,include/uapi/linux/bpf*,include/uapi/linux/btf*,include/uapi/linux/filter.h,kernel/bpf/,kernel/trace/bpf_trace.c,lib/buildid.c,arch/*/include/asm/rqspinlock.h,include/asm-generic/rqspinlock.h,lib/test_bpf.c,net/bpf/,net/core/filter.c,net/sched/act_bpf.c,net/sched/cls_bpf.c,samples/bpf/,scripts/bpf_doc.py,scripts/gen-btf.sh,scripts/Makefile.btf,scripts/pahole-version.sh,tools/bpf/,tools/lib/bpf/,tools/testing/selftests/bpf/
BPF [ITERATOR] #
- Mail: Yonghong Song <yonghong.song@linux.dev>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
kernel/bpf/*iter.c
BPF [L7 FRAMEWORK] (sockmap) #
- Mail: John Fastabend <john.fastabend@gmail.com>, Jakub Sitnicki <jakub@cloudflare.com>
- Mailing list: netdev@vger.kernel.org, bpf@vger.kernel.org
- Status: Maintained
- Files:
include/linux/skmsg.h,net/core/skmsg.c,net/core/sock_map.c,net/ipv4/tcp_bpf.c,net/ipv4/udp_bpf.c,net/unix/unix_bpf.c
BPF [LIBRARY] (libbpf) #
- Mail: Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
tools/lib/bpf/
BPF [MEMORY MANAGEMENT EXTENSIONS] #
- Mail: Roman Gushchin <roman.gushchin@linux.dev>, JP Kobryn <inwardvessel@gmail.com>, Shakeel Butt <shakeel.butt@linux.dev>
- Mailing list: bpf@vger.kernel.org, linux-mm@kvack.org
- Status: Maintained
- Files:
mm/bpf_memcontrol.c
BPF [MISC] #
- Mailing list: bpf@vger.kernel.org
- Status: Odd Fixes
- Content regex:
(?:\b|_)bpf(?:\b|_)
BPF [NETKIT] (BPF-programmable network device) #
- Mail: Daniel Borkmann <daniel@iogearbox.net>, Nikolay Aleksandrov <razor@blackwall.org>
- Mailing list: bpf@vger.kernel.org, netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/netkit.c,include/net/netkit.h
BPF [NETWORKING] (struct_ops, reuseport) #
- Mail: Martin KaFai Lau <martin.lau@linux.dev>
- Mailing list: bpf@vger.kernel.org, netdev@vger.kernel.org
- Status: Maintained
- Files:
kernel/bpf/bpf_struct*
BPF [NETWORKING] (tcx & tc BPF, sock_addr) #
- Mail: Martin KaFai Lau <martin.lau@linux.dev>, Daniel Borkmann <daniel@iogearbox.net>
- Reviewer: John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>
- Mailing list: bpf@vger.kernel.org, netdev@vger.kernel.org
- Status: Maintained
- Files:
include/net/tcx.h,kernel/bpf/tcx.c,net/core/filter.c,net/sched/act_bpf.c,net/sched/cls_bpf.c
BPF [RINGBUF] #
- Mail: Andrii Nakryiko <andrii@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
kernel/bpf/ringbuf.c
BPF [SECURITY & LSM] (Security Audit and Enforcement using BPF) #
- Mail: KP Singh <kpsingh@kernel.org>, Matt Bobrowski <mattbobrowski@google.com>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
Documentation/bpf/prog_lsm.rst,include/linux/bpf_lsm.h,kernel/bpf/bpf_lsm.c,kernel/bpf/bpf_lsm_proto.c,kernel/trace/bpf_trace.c,security/bpf/
BPF [SELFTESTS] (Test Runners & Infrastructure) #
- Mail: Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
tools/testing/selftests/bpf/
BPF [STORAGE & CGROUPS] #
- Mail: Martin KaFai Lau <martin.lau@linux.dev>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
kernel/bpf/*storage.c,kernel/bpf/bpf_lru*,kernel/bpf/cgroup.c
BPF [TOOLING] (bpftool) #
- Mail: Quentin Monnet <qmo@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
kernel/bpf/disasm.*,tools/bpf/bpftool/
BPF [TRACING] #
- Mail: Song Liu <song@kernel.org>
- Reviewer: Jiri Olsa <jolsa@kernel.org>
- Mailing list: bpf@vger.kernel.org
- Status: Maintained
- Files:
kernel/bpf/stackmap.c,kernel/trace/bpf_trace.c,lib/buildid.c
BROADCOM APDS9160 AMBIENT LIGHT SENSOR AND PROXIMITY DRIVER #
- Mail: Mikael Gonella-Bolduc <m.gonella.bolduc@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/brcm,apds9160.yaml,drivers/iio/light/apds9160.c
BROADCOM ASP 2.0 ETHERNET DRIVER #
- Mail: Justin Chen <justin.chen@broadcom.com>, Florian Fainelli <florian.fainelli@broadcom.com>
- Mailing list: bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml,drivers/net/ethernet/broadcom/asp2/
BROADCOM B44 10/100 ETHERNET DRIVER #
- Mail: Michael Chan <michael.chan@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/broadcom/b44.*
BROADCOM B53/SF2 ETHERNET SWITCH DRIVER #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>, Jonas Gorski <jonas.gorski@gmail.com>
- Mailing list: netdev@vger.kernel.org, openwrt-devel@lists.openwrt.org (subscribers-only)
- Status: Supported
- Files:
Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml,drivers/net/dsa/b53/*,drivers/net/dsa/bcm_sf2*,include/linux/dsa/brcm.h,include/linux/platform_data/b53.h,net/dsa/tag_brcm.c
BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers), linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/broadcom/stblinux.git
- Files:
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml,drivers/pci/controller/pcie-brcmstb.c,drivers/platform/raspberrypi/vchiq-*,drivers/staging/vc04_services,include/linux/raspberrypi/vchiq* - Regex:
bcm2711,bcm2712,bcm283*,raspberrypi
BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITECTURE #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Status: Maintained
- SCM: git https://github.com/broadcom/mach-bcm
- Files:
arch/arm/mach-bcm/ - Regex:
bcm281*,bcm113*,bcm216*,kona
BROADCOM BCM2835 CAMERA DRIVERS #
- Mail: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml,drivers/media/platform/broadcom/bcm2835-unicam*
BROADCOM BCM47XX MIPS ARCHITECTURE #
- Mail: Hauke Mehrtens <hauke@hauke-m.de>, Rafał Miłecki <zajec5@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mips/brcm/,arch/mips/bcm47xx/*,arch/mips/include/asm/mach-bcm47xx/*
BROADCOM BCM4908 ETHERNET DRIVER #
- Mail: Rafał Miłecki <rafal@milecki.pl>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml,drivers/net/ethernet/broadcom/bcm4908_enet.*,drivers/net/ethernet/broadcom/unimac.h
BROADCOM BCM4908 PINMUX DRIVER #
- Mail: Rafał Miłecki <rafal@milecki.pl>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml,drivers/pinctrl/bcm/pinctrl-bcm4908.c
BROADCOM BCM5301X ARM ARCHITECTURE #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>, Hauke Mehrtens <hauke@hauke-m.de>, Rafał Miłecki <zajec5@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/broadcom/bcm-ns.dtsi,arch/arm/boot/dts/broadcom/bcm470*,arch/arm/boot/dts/broadcom/bcm5301*,arch/arm/boot/dts/broadcom/bcm953012*,arch/arm/mach-bcm/bcm_5301x.c
BROADCOM BCM53573 ARM ARCHITECTURE #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>, Rafał Miłecki <rafal@milecki.pl>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/boot/dts/broadcom/bcm47189*,arch/arm/boot/dts/broadcom/bcm53573*
BROADCOM BCM63XX/BCM33XX UDC DRIVER #
- Mail: Kevin Cernekee <cernekee@gmail.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/gadget/udc/bcm63xx_udc.*
BROADCOM BCM7XXX ARM ARCHITECTURE #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/broadcom/stblinux.git
- Files:
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml,arch/arm/boot/dts/broadcom/bcm7*.dts*,arch/arm/include/asm/hardware/cache-b15-rac.h,arch/arm/mach-bcm/*brcmstb*,arch/arm/mm/cache-b15-rac.c,drivers/bus/brcmstb_gisb.c,drivers/pci/controller/pcie-brcmstb.c - Regex:
brcmstb,bcm7038,bcm7120
BROADCOM BCMBCA ARM ARCHITECTURE #
- Mail: William Zhang <william.zhang@broadcom.com>, Anand Gore <anand.gore@broadcom.com>, Kursad Oney <kursad.oney@broadcom.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Rafał Miłecki <rafal@milecki.pl>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/broadcom/stblinux.git
- Files:
Documentation/devicetree/bindings/arm/bcm/brcm,bcmbca.yaml,arch/arm64/boot/dts/broadcom/bcmbca/* - Regex:
bcmbca,bcm[9]?47622,bcm[9]?4912,bcm[9]?63138,bcm[9]?63146,bcm[9]?63148,bcm[9]?63158,bcm[9]?63178,bcm[9]?6756,bcm[9]?6813,bcm[9]?6846,bcm[9]?6855,bcm[9]?6856,bcm[9]?6858,bcm[9]?6878
BROADCOM BDC DRIVER #
- Mail: Justin Chen <justin.chen@broadcom.com>, Al Cooper <alcooperx@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/brcm,bdc.yaml,drivers/usb/gadget/udc/bdc/
BROADCOM BMIPS CPUFREQ DRIVER #
- Mail: Markus Mayer <mmayer@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
drivers/cpufreq/bmips-cpufreq.c
BROADCOM BMIPS MIPS ARCHITECTURE #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/broadcom/stblinux.git
- Files:
arch/mips/bmips/*,arch/mips/boot/dts/brcm/bcm*.dts*,arch/mips/include/asm/mach-bmips/*,arch/mips/kernel/*bmips*,drivers/irqchip/irq-bcm63*,drivers/irqchip/irq-bcm7*,drivers/irqchip/irq-brcmstb*,drivers/pmdomain/bcm/bcm63xx-power.c,include/linux/bcm963xx_nvram.h,include/linux/bcm963xx_tag.h
BROADCOM BNX2 GIGABIT ETHERNET DRIVER #
- Mail: Rasesh Mody <rmody@marvell.com>, GR-Linux-NIC-Dev@marvell.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/broadcom/bnx2.*,drivers/net/ethernet/broadcom/bnx2_*
BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER #
- Mail: Saurav Kashyap <skashyap@marvell.com>, Javed Hasan <jhasan@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/bnx2fc/
BROADCOM BNX2I 1/10 GIGABIT iSCSI DRIVER #
- Mail: Nilesh Javali <njavali@marvell.com>, Manish Rangankar <mrangankar@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/bnx2i/
BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER #
- Mail: Sudarsana Kalluru <skalluru@marvell.com>, Manish Chopra <manishc@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/broadcom/bnx2x/
BROADCOM BNXT_EN 50 GIGABIT ETHERNET DRIVER #
- Mail: Michael Chan <michael.chan@broadcom.com>, Pavan Chebbi <pavan.chebbi@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/firmware/broadcom/tee_bnxt_fw.c,drivers/net/ethernet/broadcom/bnxt/,include/linux/firmware/broadcom/tee_bnxt_fw.h
BROADCOM BNG_EN 800 GIGABIT ETHERNET DRIVER #
- Mail: Vikas Gupta <vikas.gupta@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/broadcom/bnge/,include/linux/bnge/hsi.h
BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS #
- Mail: Arend van Spriel <arend.vanspriel@broadcom.com>
- Mailing list: linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com
- Status: Supported
- Files:
drivers/net/wireless/broadcom/brcm80211/,include/linux/platform_data/brcmfmac.h
BROADCOM BRCMSTB GPIO DRIVER #
- Mail: Doug Berger <opendmb@gmail.com>, Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml,drivers/gpio/gpio-brcmstb.c
BROADCOM BRCMSTB I2C DRIVER #
- Mail: Kamal Dasu <kamal.dasu@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/i2c/brcm,brcmstb-i2c.yaml,drivers/i2c/busses/i2c-brcmstb.c
BROADCOM BRCMSTB UART DRIVER #
- Mail: Al Cooper <alcooperx@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/serial/brcm,bcm7271-uart.yaml,drivers/tty/serial/8250/8250_bcm7271.c
BROADCOM BRCMSTB USB EHCI DRIVER #
- Mail: Justin Chen <justin.chen@broadcom.com>, Al Cooper <alcooperx@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/brcm,bcm7445-ehci.yaml,drivers/usb/host/ehci-brcm.*
BROADCOM BRCMSTB USB PIN MAP DRIVER #
- Mail: Al Cooper <alcooperx@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/brcm,usb-pinmap.yaml,drivers/usb/misc/brcmstb-usb-pinmap.c
BROADCOM BRCMSTB USB2 and USB3 PHY DRIVER #
- Mail: Justin Chen <justin.chen@broadcom.com>, Al Cooper <alcooperx@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/phy/broadcom/phy-brcm-usb*
BROADCOM Broadband SoC High Speed SPI Controller DRIVER #
- Mail: William Zhang <william.zhang@broadcom.com>, Kursad Oney <kursad.oney@broadcom.com>, Jonas Gorski <jonas.gorski@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/brcm,bcm63xx-hsspi.yaml,drivers/spi/spi-bcm63xx-hsspi.c,drivers/spi/spi-bcmbca-hsspi.c
BROADCOM BCM6348/BCM6358 SPI controller DRIVER #
- Mail: Jonas Gorski <jonas.gorski@gmail.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/spi/brcm,bcm63xx-spi.yaml,drivers/spi/spi-bcm63xx.c
BROADCOM ETHERNET PHY DRIVERS #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/net/broadcom-bcm87xx.txt,drivers/net/phy/bcm*.[ch],drivers/net/phy/broadcom.c,include/linux/brcmphy.h
BROADCOM GENET ETHERNET DRIVER #
- Mail: Doug Berger <opendmb@gmail.com>, Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/brcm,bcmgenet.yaml,Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml,drivers/net/ethernet/broadcom/genet/,drivers/net/ethernet/broadcom/unimac.h,drivers/net/mdio/mdio-bcm-unimac.c,include/linux/platform_data/mdio-bcm-unimac.h
BROADCOM IPROC ARM ARCHITECTURE #
- Mail: Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/broadcom/stblinux.git
- Files:
arch/arm64/boot/dts/broadcom/northstar2/*,arch/arm64/boot/dts/broadcom/stingray/*,drivers/clk/bcm/clk-ns*,drivers/clk/bcm/clk-sr*,drivers/pinctrl/bcm/pinctrl-ns*,include/dt-bindings/clock/bcm-sr* - Regex:
iproc,cygnus,bcm[-_]nsp,bcm9113*,bcm9583*,bcm9585*,bcm9586*,bcm988312,bcm113*,bcm583*,bcm585*,bcm586*,bcm88312,hr2,stingray
BROADCOM IPROC GBIT ETHERNET DRIVER #
- Mail: Rafał Miłecki <rafal@milecki.pl>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/brcm,amac.yaml,drivers/net/ethernet/broadcom/bgmac*,drivers/net/ethernet/broadcom/unimac.h
BROADCOM KONA GPIO DRIVER #
- Mail: Ray Jui <rjui@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/gpio/brcm,kona-gpio.yaml,drivers/gpio/gpio-bcm-kona.c
BROADCOM MPI3 STORAGE CONTROLLER DRIVER #
- Mail: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>, Kashyap Desai <kashyap.desai@broadcom.com>, Sumit Saxena <sumit.saxena@broadcom.com>, Sreekanth Reddy <sreekanth.reddy@broadcom.com>
- Mailing list: mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: https://www.broadcom.com/support/storage
- Files:
drivers/scsi/mpi3mr/
BROADCOM NETXTREME-E ROCE DRIVER #
- Mail: Selvin Xavier <selvin.xavier@broadcom.com>, Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: http://www.broadcom.com
- Files:
drivers/infiniband/hw/bnxt_re/,include/uapi/rdma/bnxt_re-abi.h
BROADCOM 800 GIGABIT ROCE DRIVER #
- Mail: Siva Reddy Kallam <siva.kallam@broadcom.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: http://www.broadcom.com
- Files:
drivers/infiniband/hw/bng_re/
BROADCOM NVRAM DRIVER #
- Mail: Rafał Miłecki <zajec5@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
drivers/firmware/broadcom/*
BROADCOM PMB (POWER MANAGEMENT BUS) DRIVER #
- Mail: Rafał Miłecki <rafal@milecki.pl>, Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/broadcom/stblinux.git
- Files:
drivers/pmdomain/bcm/bcm-pmb.c,include/dt-bindings/soc/bcm-pmb.h
BROADCOM SPECIFIC AMBA DRIVER (BCMA) #
- Mail: Rafał Miłecki <zajec5@gmail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Files:
drivers/bcma/,include/linux/bcma/
BROADCOM SPI DRIVER #
- Mail: Kamal Dasu <kamal.dasu@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.yaml,drivers/spi/spi-bcm-qspi.*,drivers/spi/spi-brcmstb-qspi.c,drivers/spi/spi-iproc-qspi.c
BROADCOM STB AVS CPUFREQ DRIVER #
- Mail: Markus Mayer <mmayer@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt,drivers/cpufreq/brcmstb*
BROADCOM STB AVS TMON DRIVER #
- Mail: Markus Mayer <mmayer@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/brcm,avs-tmon.yaml,drivers/thermal/broadcom/brcmstb*
BROADCOM STB DPFE DRIVER #
- Mail: Markus Mayer <mmayer@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml,drivers/memory/brcmstb_dpfe.c
BROADCOM STB NAND FLASH DRIVER #
- Mail: Brian Norris <computersforpeace@gmail.com>, Kamal Dasu <kamal.dasu@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/nand/raw/brcmnand/,include/linux/platform_data/brcmnand.h
BROADCOM STB PCIE DRIVER #
- Mail: Jim Quinlan <jim2101024@gmail.com>, Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml,drivers/pci/controller/pcie-brcmstb.c
BROADCOM SYSTEMPORT ETHERNET DRIVER #
- Mail: Florian Fainelli <florian.fainelli@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/brcm,systemport.yaml,drivers/net/ethernet/broadcom/bcmsysport.*,drivers/net/ethernet/broadcom/unimac.h
BROADCOM TG3 GIGABIT ETHERNET DRIVER #
- Mail: Pavan Chebbi <pavan.chebbi@broadcom.com>, Michael Chan <mchan@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/broadcom/tg3.*
BROADCOM VK DRIVER #
- Mail: Scott Branden <scott.branden@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Status: Supported
- Files:
drivers/misc/bcm-vk/,include/uapi/linux/misc/bcm_vk.h
BROCADE BFA FC SCSI DRIVER #
- Mail: Anil Gurumurthy <anil.gurumurthy@qlogic.com>, Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/bfa/
BROCADE BNA 10 GIGABIT ETHERNET DRIVER #
- Mail: Rasesh Mody <rmody@marvell.com>, Sudarsana Kalluru <skalluru@marvell.com>, GR-Linux-NIC-Dev@marvell.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/brocade/bna/
BSG (block layer generic sg v4 driver) #
- Mail: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
block/bsg.c,include/linux/bsg.h,include/uapi/linux/bsg.h
BT87X AUDIO DRIVER #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
Documentation/sound/cards/bt87x.rst,sound/pci/bt87x.c
BT8XXGPIO DRIVER #
- Mail: Michael Buesch <m@bues.ch>
- Status: Maintained
- Web-page: http://bu3sch.de/btgpio.php
- Files:
drivers/gpio/gpio-bt8xx.c
BTRFS FILE SYSTEM #
- Mail: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>
- Mailing list: linux-btrfs@vger.kernel.org
- Status: Maintained
- Web-page: https://btrfs.readthedocs.io
- Patchwork: https://patchwork.kernel.org/project/linux-btrfs/list/
- chat: irc://irc.libera.chat/btrfs
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
- Files:
Documentation/filesystems/btrfs.rst,fs/btrfs/,include/linux/btrfs*,include/trace/events/btrfs.h,include/uapi/linux/btrfs*
BTTV VIDEO4LINUX DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/driver-api/media/drivers/bttv*,drivers/media/pci/bt8xx/bttv*
BUS FREQUENCY DRIVER FOR SAMSUNG EXYNOS #
- Mail: Chanwoo Choi <cw00.choi@samsung.com>
- Mailing list: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
- Files:
Documentation/devicetree/bindings/interconnect/samsung,exynos-bus.yaml,drivers/devfreq/exynos-bus.c
BUSLOGIC SCSI DRIVER #
- Mail: Khalid Aziz <khalid@gonehiking.org>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/BusLogic.*,drivers/scsi/FlashPoint.*
BXCAN CAN NETWORK DRIVER #
- Mail: Dario Binacchi <dario.binacchi@amarulasolutions.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/can/st,stm32-bxcan.yaml,drivers/net/can/bxcan.c
C-MEDIA CMI8788 DRIVER #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
sound/pci/oxygen/
C-SKY ARCHITECTURE #
- Mail: Guo Ren <guoren@kernel.org>
- Mailing list: linux-csky@vger.kernel.org
- Status: Supported
- SCM: git https://github.com/c-sky/csky-linux.git
- Files:
Documentation/devicetree/bindings/csky/,Documentation/devicetree/bindings/interrupt-controller/csky,*,Documentation/devicetree/bindings/timer/csky,*,arch/csky/,drivers/clocksource/timer-gx6605s.c,drivers/clocksource/timer-mp-csky.c,drivers/irqchip/irq-csky-* - Regex:
csky - Content regex:
csky
CA8210 IEEE-802.15.4 RADIO DRIVER #
- Mailing list: linux-wpan@vger.kernel.org
- Status: Orphan
- Web-page: https://github.com/Cascoda/ca8210-linux.git
- Files:
Documentation/devicetree/bindings/net/ieee802154/ca8210.txt,drivers/net/ieee802154/ca8210.c
CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS #
- Mail: David Howells <dhowells@redhat.com>
- Mailing list: netfs@lists.linux.dev
- Status: Supported
- Files:
Documentation/filesystems/caching/cachefiles.rst,fs/cachefiles/
CACHESTAT: PAGE CACHE STATS FOR A FILE #
- Mail: Nhat Pham <nphamcs@gmail.com>, Johannes Weiner <hannes@cmpxchg.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
tools/testing/selftests/cachestat/test_cachestat.c
CADENCE MIPI-CSI2 BRIDGES #
- Mail: Maxime Ripard <mripard@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/cdns,*.txt,Documentation/devicetree/bindings/media/cdns,csi2rx.yaml,drivers/media/platform/cadence/cdns-csi2*,include/media/cadence/cdns-csi2*
CADENCE NAND DRIVER #
- Mailing list: linux-mtd@lists.infradead.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/mtd/cdns,hp-nfc.yaml,drivers/mtd/nand/raw/cadence-nand-controller.c
CADENCE USB3 DRD IP DRIVER #
- Mail: Peter Chen <peter.chen@kernel.org>, Pawel Laszczak <pawell@cadence.com>
- Reviewer: Roger Quadros <rogerq@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
- Files:
Documentation/devicetree/bindings/usb/cdns,usb3.yaml,drivers/usb/cdns3/ - Excluded:
drivers/usb/cdns3/cdnsp*
CADENCE USBHS DRIVER #
- Mail: Pawel Laszczak <pawell@cadence.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/gadget/udc/cdns2
CADENCE USBSSP DRD IP DRIVER #
- Mail: Pawel Laszczak <pawell@cadence.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
- Files:
drivers/usb/cdns3/ - Excluded:
drivers/usb/cdns3/cdns3*
CADET FM/AM RADIO RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-cadet*
CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/cafe_ccic*,drivers/media/platform/marvell/
CAIF NETWORK LAYER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
Documentation/networking/caif/,drivers/net/caif/,include/net/caif/,include/uapi/linux/caif/,net/caif/
CAKE QDISC #
- Mail: Toke Høiland-Jørgensen <toke@toke.dk>
- Mailing list: cake@lists.bufferbloat.net (moderated for non-subscribers)
- Status: Maintained
- Files:
net/sched/sch_cake.c
CAN NETWORK DRIVERS #
- Mail: Marc Kleine-Budde <mkl@pengutronix.de>, Vincent Mailhol <mailhol@kernel.org>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/linux-can
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git, git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
- Files:
Documentation/devicetree/bindings/net/can/,Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml,drivers/net/can/,drivers/phy/phy-can-transceiver.c,include/linux/can/bittiming.h,include/linux/can/dev.h,include/linux/can/length.h,include/linux/can/platform/,include/linux/can/rx-offload.h,include/uapi/linux/can/error.h,include/uapi/linux/can/netlink.h,include/uapi/linux/can/vxcan.h
CAN NETWORK LAYER #
- Mail: Oliver Hartkopp <socketcan@hartkopp.net>, Marc Kleine-Budde <mkl@pengutronix.de>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/linux-can
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git, git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
- Files:
Documentation/networking/can.rst,Documentation/networking/iso15765-2.rst,include/linux/can/can-ml.h,include/linux/can/core.h,include/linux/can/skb.h,include/net/can.h,include/net/netns/can.h,include/uapi/linux/can.h,include/uapi/linux/can/bcm.h,include/uapi/linux/can/gw.h,include/uapi/linux/can/isotp.h,include/uapi/linux/can/raw.h,net/can/,net/sched/em_canid.c,tools/testing/selftests/net/can/
CAN-J1939 NETWORK LAYER #
- Mail: Robin van der Gracht <robin@protonic.nl>, Oleksij Rempel <o.rempel@pengutronix.de>
- Reviewer: kernel@pengutronix.de
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/j1939.rst,include/uapi/linux/can/j1939.h,net/can/j1939/
CANAAN/KENDRYTE K210 SOC FPIOA DRIVER #
- Mail: Damien Le Moal <dlemoal@kernel.org>
- Mailing list: linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org (pinctrl driver)
- Files:
Documentation/devicetree/bindings/pinctrl/canaan,k210-fpioa.yaml,drivers/pinctrl/pinctrl-k210.c
CANAAN/KENDRYTE K210 SOC RESET CONTROLLER DRIVER #
- Mail: Damien Le Moal <dlemoal@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/reset/canaan,k210-rst.yaml,drivers/reset/reset-k210.c
CANAAN/KENDRYTE K210 SOC SYSTEM CONTROLLER DRIVER #
- Mail: Damien Le Moal <dlemoal@kernel.org>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/canaan,k210-sysctl.yaml,drivers/soc/canaan/,include/soc/canaan/
CAPABILITIES #
- Mail: Serge Hallyn <serge@hallyn.com>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Supported
- Files:
include/linux/capability.h,include/trace/events/capability.h,include/uapi/linux/capability.h,kernel/capability.c,security/commoncap.c,security/commoncap_test.c
CAPELLA MICROSYSTEMS LIGHT SENSOR DRIVER #
- Mail: Kevin Tsai <ktsai@capellamicro.com>
- Status: Maintained
- Files:
drivers/iio/light/cm*
CARL9170 LINUX COMMUNITY WIRELESS DRIVER #
- Mail: Christian Lamparter <chunkeey@googlemail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/carl9170
- Files:
drivers/net/wireless/ath/carl9170/
CAVIUM I2C DRIVER #
- Mail: Robert Richter <rric@kernel.org>
- Status: Odd Fixes
- Web-page: http://www.marvell.com
- Files:
drivers/i2c/busses/i2c-octeon*,drivers/i2c/busses/i2c-thunderx*
CAVIUM LIQUIDIO NETWORK DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Web-page: http://www.marvell.com
- Files:
drivers/net/ethernet/cavium/liquidio/
CAVIUM MMC DRIVER #
- Mail: Robert Richter <rric@kernel.org>
- Status: Odd Fixes
- Web-page: http://www.marvell.com
- Files:
drivers/mmc/host/cavium*
CAVIUM OCTEON-TX CRYPTO DRIVER #
- Mail: George Cherian <gcherian@marvell.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Web-page: http://www.marvell.com
- Files:
drivers/crypto/cavium/cpt/
CBS/ETF/TAPRIO QDISCS #
- Mail: Vinicius Costa Gomes <vinicius.gomes@intel.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
net/sched/sch_cbs.c,net/sched/sch_etf.c,net/sched/sch_taprio.c
CC2520 IEEE-802.15.4 RADIO DRIVER #
- Mail: Stefan Schmidt <stefan@datenfreihafen.org>
- Mailing list: linux-wpan@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/net/ieee802154/cc2520.txt,drivers/net/ieee802154/cc2520.c
CCREE ARM TRUSTZONE CRYPTOCELL REE DRIVER #
- Mail: Gilad Ben-Yossef <gilad@benyossef.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Web-page: https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family
- Files:
drivers/crypto/ccree/
CCTRNG ARM TRUSTZONE CRYPTOCELL TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER #
- Mail: Hadar Gat <hadar.gat@arm.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Web-page: https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family
- Files:
Documentation/devicetree/bindings/rng/arm-cctrng.yaml,drivers/char/hw_random/cctrng.c,drivers/char/hw_random/cctrng.h
CEC FRAMEWORK #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: http://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/ABI/testing/debugfs-cec-error-inj,Documentation/devicetree/bindings/media/cec/cec-common.yaml,Documentation/driver-api/media/cec-core.rst,Documentation/userspace-api/media/cec,drivers/media/cec/,drivers/media/rc/keymaps/rc-cec.c,include/media/cec-notifier.h,include/media/cec.h,include/uapi/linux/cec-funcs.h,include/uapi/linux/cec.h
CEC GPIO DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: http://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/cec/cec-gpio.yaml,drivers/media/cec/platform/cec-gpio/
CELL BROADBAND ENGINE ARCHITECTURE #
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
arch/powerpc/include/asm/cell*.h,arch/powerpc/include/asm/spu*.h,arch/powerpc/include/uapi/asm/spu*.h,arch/powerpc/platforms/cell/
CELLWISE CW2015 BATTERY DRIVER #
- Mail: Tobias Schrammm <t.schramm@manjaro.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml,drivers/power/supply/cw2015_battery.c
CEPH COMMON CODE (LIBCEPH) #
- Mail: Ilya Dryomov <idryomov@gmail.com>, Alex Markuze <amarkuze@redhat.com>, Viacheslav Dubeyko <slava@dubeyko.com>
- Mailing list: ceph-devel@vger.kernel.org
- Status: Supported
- Web-page: http://ceph.com/
- bugs: https://tracker.ceph.com/
- SCM: git https://github.com/ceph/ceph-client.git
- Files:
include/linux/ceph/,include/linux/crush/,net/ceph/
CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH) #
- Mail: Ilya Dryomov <idryomov@gmail.com>, Alex Markuze <amarkuze@redhat.com>, Viacheslav Dubeyko <slava@dubeyko.com>
- Mailing list: ceph-devel@vger.kernel.org
- Status: Supported
- Web-page: http://ceph.com/
- bugs: https://tracker.ceph.com/
- SCM: git https://github.com/ceph/ceph-client.git
- Files:
Documentation/filesystems/ceph.rst,fs/ceph/
CERTIFICATE HANDLING #
- Mail: David Howells <dhowells@redhat.com>, David Woodhouse <dwmw2@infradead.org>
- Mailing list: keyrings@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/module-signing.rst,certs/,scripts/sign-file.c,scripts/ssl-common.h,tools/certs/
CFAG12864B LCD DRIVER #
- Mail: Miguel Ojeda <ojeda@kernel.org>
- Status: Maintained
- Files:
drivers/auxdisplay/cfag12864b.c,include/linux/cfag12864b.h
CFAG12864BFB LCD FRAMEBUFFER DRIVER #
- Mail: Miguel Ojeda <ojeda@kernel.org>
- Status: Maintained
- Files:
drivers/auxdisplay/cfag12864bfb.c,include/linux/cfag12864b.h
CHAR and MISC DRIVERS #
- Mail: Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
- Files:
drivers/char/,drivers/misc/,include/linux/miscdevice.h,rust/kernel/miscdevice.rs,samples/rust/rust_misc_device.rs - Excluded:
drivers/char/agp/,drivers/char/hw_random/,drivers/char/ipmi/,drivers/char/random.c,drivers/char/tpm/
CHARGERLAB POWER-Z HARDWARE MONITOR DRIVER #
- Mail: Thomas Weißschuh <linux@weissschuh.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/powerz.rst,drivers/hwmon/powerz.c
CHECKPATCH #
- Mail: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
- Reviewer: Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com>
- Status: Maintained
- Files:
scripts/checkpatch.pl
CHECKPATCH DOCUMENTATION #
- Mail: Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com>
- Reviewer: Joe Perches <joe@perches.com>
- Status: Maintained
- Files:
Documentation/dev-tools/checkpatch.rst
CHINESE DOCUMENTATION #
- Mail: Alex Shi <alexs@kernel.org>, Yanteng Si <si.yanteng@linux.dev>
- Reviewer: Dongliang Mu <dzm91@hust.edu.cn>
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/alexs/linux.git
- Status: Maintained
- Files:
Documentation/translations/zh_CN/
CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER #
- Mail: Peter Chen <peter.chen@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
- Files:
drivers/usb/chipidea/
CHIPONE ICN8318 I2C TOUCHSCREEN DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/chipone,icn8318.yaml,drivers/input/touchscreen/chipone_icn8318.c
CHIPONE ICN8505 I2C TOUCHSCREEN DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/chipone_icn8505.c
CHROME HARDWARE PLATFORM SUPPORT #
- Mail: Benson Leung <bleung@chromium.org>, Tzung-Bi Shih <tzungbi@kernel.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
- Files:
drivers/platform/chrome/
CHROMEOS EC CODEC DRIVER #
- Mail: Cheng-Yi Chiang <cychiang@chromium.org>, Tzung-Bi Shih <tzungbi@kernel.org>
- Reviewer: Guenter Roeck <groeck@chromium.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml,sound/soc/codecs/cros_ec_codec.*
CHROMEOS EC CHARGE CONTROL #
- Mail: Thomas Weißschuh <linux@weissschuh.net>
- Status: Maintained
- Files:
drivers/power/supply/cros_charge-control.c
CHROMEOS EC HARDWARE MONITORING #
- Mail: Thomas Weißschuh <linux@weissschuh.net>
- Mailing list: chrome-platform@lists.linux.dev, linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/cros_ec_hwmon.rst,drivers/hwmon/cros_ec_hwmon.c
CHROMEOS EC LED DRIVER #
- Mail: Thomas Weißschuh <linux@weissschuh.net>
- Status: Maintained
- Files:
drivers/leds/leds-cros_ec.c
CHROMEOS EC SUBDRIVERS #
- Mail: Benson Leung <bleung@chromium.org>
- Reviewer: Guenter Roeck <groeck@chromium.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- Files:
drivers/power/supply/cros_charge-control.c,drivers/power/supply/cros_usbpd-charger.c - Regex:
cros_ec,cros-ec
CHROMEOS EC UART DRIVER #
- Mail: Bhanu Prakash Maiya <bhanumaiya@chromium.org>
- Reviewer: Benson Leung <bleung@chromium.org>, Tzung-Bi Shih <tzungbi@kernel.org>
- Status: Maintained
- Files:
drivers/platform/chrome/cros_ec_uart.c
CHROMEOS EC USB PD NOTIFY DRIVER #
- Mail: Łukasz Bartosik <ukaszb@chromium.org>, Andrei Kuchynski <akuchynski@chromium.org>, Jameson Thies <jthies@google.com>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- Files:
drivers/platform/chrome/cros_usbpd_notify.c,include/linux/platform_data/cros_usbpd_notify.h
CHROMEOS EC USB TYPE-C DRIVER #
- Mail: Benson Leung <bleung@chromium.org>, Abhishek Pandit-Subedi <abhishekpandit@chromium.org>, Jameson Thies <jthies@google.com>, Andrei Kuchynski <akuchynski@chromium.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- Files:
drivers/platform/chrome/cros_ec_typec.*,drivers/platform/chrome/cros_typec_altmode.*,drivers/platform/chrome/cros_typec_switch.c,drivers/platform/chrome/cros_typec_vdm.*
CHROMEOS HPS DRIVER #
- Mail: Dan Callaghan <dcallagh@chromium.org>
- Reviewer: Sami Kyöstilä <skyostil@chromium.org>
- Status: Maintained
- Files:
drivers/platform/chrome/cros_hps_i2c.c
CHROMEOS EC WATCHDOG #
- Mail: Lukasz Majczak <lma@chromium.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- Files:
drivers/watchdog/cros_ec_wdt.c
CHROMEOS UCSI DRIVER #
- Mail: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>, Łukasz Bartosik <ukaszb@chromium.org>, Jameson Thies <jthies@google.com>, Andrei Kuchynski <akuchynski@chromium.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- Files:
drivers/usb/typec/ucsi/cros_ec_ucsi.c
CHRONTEL CH7322 CEC DRIVER #
- Mail: Joe Tessler <jrt@google.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/chrontel,ch7322.yaml,drivers/media/cec/i2c/ch7322.c
CIRRUS LOGIC AUDIO CODEC DRIVERS #
- Mail: David Rhodes <david.rhodes@cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com>
- Mailing list: linux-sound@vger.kernel.org, patches@opensource.cirrus.com
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/cirrus,cs*,Documentation/sound/codecs/cs*,drivers/mfd/cs42l43*,drivers/pinctrl/cirrus/pinctrl-cs42l43*,drivers/spi/spi-cs42l43*,include/dt-bindings/sound/cs*,include/linux/mfd/cs42l43*,include/sound/cs*,sound/hda/codecs/cirrus*,sound/hda/codecs/side-codecs/cs*,sound/hda/codecs/side-codecs/hda_component*,sound/soc/codecs/cs*
CIRRUS LOGIC HAPTIC DRIVERS #
- Mail: James Ogletree <jogletre@opensource.cirrus.com>, Fred Treven <fred.treven@cirrus.com>, Ben Bright <ben.bright@cirrus.com>
- Mailing list: patches@opensource.cirrus.com
- Status: Supported
- Files:
Documentation/devicetree/bindings/input/cirrus,cs40l50.yaml,drivers/input/misc/cs40l*,drivers/mfd/cs40l*,include/linux/mfd/cs40l*,sound/soc/codecs/cs40l*
CIRRUS LOGIC DSP FIRMWARE DRIVER #
- Mail: Simon Trimmer <simont@opensource.cirrus.com>, Charles Keepax <ckeepax@opensource.cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com>
- Mailing list: patches@opensource.cirrus.com
- Status: Supported
- Web-page: https://github.com/CirrusLogic/linux-drivers/wiki
- SCM: git https://github.com/CirrusLogic/linux-drivers.git
- Files:
drivers/firmware/cirrus/,include/linux/firmware/cirrus/
CIRRUS LOGIC EP93XX ETHERNET DRIVER #
- Mail: Hartley Sweeten <hsweeten@visionengravers.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/cirrus/ep93xx_eth.c
CIRRUS LOGIC LOCHNAGAR DRIVER #
- Mail: Charles Keepax <ckeepax@opensource.cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com>
- Mailing list: patches@opensource.cirrus.com
- Status: Supported
- Files:
Documentation/devicetree/bindings/clock/cirrus,lochnagar.yaml,Documentation/devicetree/bindings/hwmon/cirrus,lochnagar.yaml,Documentation/devicetree/bindings/mfd/cirrus,lochnagar.yaml,Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.yaml,Documentation/devicetree/bindings/sound/cirrus,lochnagar.yaml,Documentation/hwmon/lochnagar.rst,drivers/clk/clk-lochnagar.c,drivers/hwmon/lochnagar-hwmon.c,drivers/mfd/lochnagar-i2c.c,drivers/pinctrl/cirrus/pinctrl-lochnagar.c,drivers/regulator/lochnagar-regulator.c,include/dt-bindings/clock/lochnagar.h,include/dt-bindings/pinctrl/lochnagar.h,include/linux/mfd/lochnagar*,sound/soc/codecs/lochnagar-sc.c
CIRRUS LOGIC MADERA CODEC DRIVERS #
- Mail: Charles Keepax <ckeepax@opensource.cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com>
- Mailing list: linux-sound@vger.kernel.org, patches@opensource.cirrus.com
- Status: Supported
- Web-page: https://github.com/CirrusLogic/linux-drivers/wiki
- SCM: git https://github.com/CirrusLogic/linux-drivers.git
- Files:
Documentation/devicetree/bindings/mfd/cirrus,madera.yaml,Documentation/devicetree/bindings/pinctrl/cirrus,madera.yaml,Documentation/devicetree/bindings/sound/cirrus,madera.yaml,drivers/gpio/gpio-madera*,drivers/irqchip/irq-madera*,drivers/mfd/cs47l*,drivers/mfd/madera*,drivers/pinctrl/cirrus/*,include/dt-bindings/sound/madera*,include/linux/irqchip/irq-madera*,include/linux/mfd/madera/*,include/sound/madera*,sound/soc/codecs/cs47l*,sound/soc/codecs/madera*
CISCO FCOE HBA DRIVER #
- Mail: Satish Kharat <satishkh@cisco.com>, Sesidhar Baddela <sebaddel@cisco.com>, Karan Tilak Kumar <kartilak@cisco.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/fnic/
CISCO SCSI HBA DRIVER #
- Mail: Karan Tilak Kumar <kartilak@cisco.com>, Narsimhulu Musini <nmusini@cisco.com>, Sesidhar Baddela <sebaddel@cisco.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/snic/
CISCO VIC ETHERNET NIC DRIVER #
- Mail: Satish Kharat <satishkh@cisco.com>
- Status: Maintained
- Files:
drivers/net/ethernet/cisco/enic/
CISCO VIC LOW LATENCY NIC DRIVER #
- Mail: Nelson Escobar <neescoba@cisco.com>, Satish Kharat <satishkh@cisco.com>
- Status: Supported
- Files:
drivers/infiniband/hw/usnic/
CLANG CONTEXT ANALYSIS #
- Mail: Marco Elver <elver@google.com>
- Reviewer: Bart Van Assche <bvanassche@acm.org>
- Mailing list: llvm@lists.linux.dev
- Status: Maintained
- Files:
Documentation/dev-tools/context-analysis.rst,include/linux/compiler-context-analysis.h,lib/test_context-analysis.c,scripts/Makefile.context-analysis,scripts/context-analysis-suppression.txt
CLANG CONTROL FLOW INTEGRITY SUPPORT #
- Mail: Sami Tolvanen <samitolvanen@google.com>, Kees Cook <kees@kernel.org>
- Reviewer: Nathan Chancellor <nathan@kernel.org>
- Mailing list: llvm@lists.linux.dev
- Status: Supported
- bugs: https://github.com/ClangBuiltLinux/linux/issues
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
include/linux/cfi.h,kernel/cfi.c
CLANG-FORMAT FILE #
- Mail: Miguel Ojeda <ojeda@kernel.org>
- Status: Maintained
- Files:
.clang-format
CLANG/LLVM BUILD SUPPORT #
- Mail: Nathan Chancellor <nathan@kernel.org>
- Reviewer: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>
- Mailing list: llvm@lists.linux.dev
- Status: Supported
- Web-page: https://clangbuiltlinux.github.io/
- bugs: https://github.com/ClangBuiltLinux/linux/issues
- chat: irc://irc.libera.chat/clangbuiltlinux
- Files:
Documentation/kbuild/llvm.rst,include/linux/compiler-clang.h,scripts/Makefile.clang,scripts/clang-tools/ - Content regex:
\b(?i:clang|llvm)\b
CLK API #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-clk@vger.kernel.org
- Status: Maintained
- Files:
include/linux/clk.h
CLOCKSOURCE, CLOCKEVENT DRIVERS #
- Mail: Daniel Lezcano <daniel.lezcano@kernel.org>, Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
- Files:
Documentation/devicetree/bindings/timer/,drivers/clocksource/
CLOSURES #
- Mail: Kent Overstreet <kent.overstreet@linux.dev>
- Mailing list: linux-bcachefs@vger.kernel.org
- Status: Supported
- chat: irc://irc.oftc.net/bcache
- Files:
include/linux/closure.h,lib/closure.c
CMPC ACPI DRIVER #
- Mail: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/x86/classmate-laptop.c
COBALT MEDIA DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/cobalt/
COCCINELLE/Semantic Patches (SmPL) #
- Mail: Julia Lawall <Julia.Lawall@inria.fr>, Nicolas Palix <nicolas.palix@imag.fr>
- Mailing list: cocci@inria.fr (moderated for non-subscribers)
- Status: Supported
- Web-page: https://coccinelle.gitlabpages.inria.fr/website/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git
- Files:
Documentation/dev-tools/coccinelle.rst,scripts/coccicheck,scripts/coccinelle/
CODA FILE SYSTEM #
- Mail: Jan Harkes <jaharkes@cs.cmu.edu>, coda@cs.cmu.edu
- Mailing list: codalist@coda.cs.cmu.edu
- Status: Maintained
- Web-page: http://www.coda.cs.cmu.edu/
- Files:
Documentation/filesystems/coda.rst,fs/coda/,include/linux/coda*.h,include/uapi/linux/coda*.h
CODA V4L2 MEM2MEM DRIVER #
- Mail: Philipp Zabel <p.zabel@pengutronix.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/coda.yaml,drivers/media/platform/chips-media/coda
CODE OF CONDUCT #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Status: Supported
- Files:
Documentation/process/code-of-conduct-interpretation.rst,Documentation/process/code-of-conduct.rst
CODE TAGGING #
- Mail: Suren Baghdasaryan <surenb@google.com>, Kent Overstreet <kent.overstreet@linux.dev>
- Status: Maintained
- Files:
include/asm-generic/codetag.lds.h,include/linux/codetag.h,lib/codetag.c
COMEDI DRIVERS #
- Mail: Ian Abbott <abbotti@mev.co.uk>, H Hartley Sweeten <hsweeten@visionengravers.com>
- Status: Odd Fixes
- Files:
drivers/comedi/,include/linux/comedi/,include/uapi/linux/comedi.h
COMMON CLK FRAMEWORK #
- Mail: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>
- Mailing list: linux-clk@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/linux-clk/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
- Files:
Documentation/devicetree/bindings/clock/,drivers/clk/,include/dt-bindings/clock/,include/linux/clk-pr*,include/linux/clk/,include/linux/of_clk.h,scripts/gdb/linux/clk.py,rust/helpers/clk.c,rust/kernel/clk.rs - Excluded:
drivers/clk/clkdev.c
COMMON INTERNET FILE SYSTEM CLIENT (CIFS and SMB3) #
- Mail: Steve French <sfrench@samba.org>, Steve French <smfrench@gmail.com>
- Reviewer: Paulo Alcantara <pc@manguebit.org> (DFS, global name space), Ronnie Sahlberg <ronniesahlberg@gmail.com> (directory leases, sparse files), Shyam Prasad N <sprasad@microsoft.com> (multichannel), Tom Talpey <tom@talpey.com> (RDMA, smbdirect), Bharath SM <bharathsm@microsoft.com> (deferred close, directory leases)
- Mailing list: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org (moderated for non-subscribers)
- Status: Supported
- Web-page: https://wiki.samba.org/index.php/LinuxCIFS
- SCM: git git://git.samba.org/sfrench/cifs-2.6.git
- Files:
Documentation/admin-guide/cifs/,fs/smb/client/,fs/smb/common/,include/uapi/linux/cifs
COMPACTPCI HOTPLUG CORE #
- Mail: Scott Murray <scott@spiteful.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/hotplug/cpci_hotplug*
COMPACTPCI HOTPLUG GENERIC DRIVER #
- Mail: Scott Murray <scott@spiteful.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/hotplug/cpcihp_generic.c
COMPACTPCI HOTPLUG ZIATECH ZT5550 DRIVER #
- Mail: Scott Murray <scott@spiteful.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/hotplug/cpcihp_zt5550.*
COMPAL LAPTOP SUPPORT #
- Mail: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/compal-laptop.c
COMPILER ATTRIBUTES #
- Mail: Miguel Ojeda <ojeda@kernel.org>
- Status: Maintained
- Files:
include/linux/compiler_attributes.h
COMPUTE EXPRESS LINK (CXL) #
- Mail: Davidlohr Bueso <dave@stgolabs.net>, Jonathan Cameron <jonathan.cameron@huawei.com>, Dave Jiang <dave.jiang@intel.com>, Alison Schofield <alison.schofield@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Ira Weiny <ira.weiny@intel.com>, Dan Williams <dan.j.williams@intel.com>
- Mailing list: linux-cxl@vger.kernel.org
- Status: Maintained
- Files:
Documentation/driver-api/cxl,Documentation/userspace-api/fwctl/fwctl-cxl.rst,drivers/cxl/,include/cxl/,include/uapi/linux/cxl_mem.h,tools/testing/cxl/
COMPUTE EXPRESS LINK PMU (CPMU) #
- Mail: Jonathan Cameron <jonathan.cameron@huawei.com>
- Mailing list: linux-cxl@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/perf/cxl.rst,drivers/perf/cxl_pmu.c
CONEXANT ACCESSRUNNER USB DRIVER #
- Mailing list: accessrunner-general@lists.sourceforge.net
- Status: Orphan
- Web-page: http://accessrunner.sourceforge.net/
- Files:
drivers/usb/atm/cxacru.c
CONFIDENTIAL COMPUTING THREAT MODEL FOR X86 VIRTUALIZATION (SNP/TDX) #
- Mail: Elena Reshetova <elena.reshetova@intel.com>, Carlos Bilbao <carlos.bilbao@kernel.org>
- Status: Maintained
- Files:
Documentation/security/snp-tdx-threat-model.rst
CONFIGFS #
- Mail: Andreas Hindborg <a.hindborg@kernel.org>
- Reviewer: Breno Leitao <leitao@debian.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux.git configfs-next
- Files:
fs/configfs/,include/linux/configfs.h,rust/kernel/configfs.rs,samples/configfs/,samples/rust/rust_configfs.rs
CONGATEC BOARD CONTROLLER MFD DRIVER #
- Mail: Thomas Richard <thomas.richard@bootlin.com>
- Status: Maintained
- Files:
drivers/gpio/gpio-cgbc.c,drivers/hwmon/cgbc-hwmon.c,drivers/i2c/busses/i2c-cgbc.c,drivers/mfd/cgbc-core.c,drivers/watchdog/cgbc_wdt.c,include/linux/mfd/cgbc.h
CONSOLE SUBSYSTEM #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Status: Supported
- Files:
drivers/video/console/,include/linux/console*
CONTAINER BUILD SCRIPT #
- Mail: Guillaume Tucker <gtucker@gtucker.io>
- Status: Maintained
- Files:
Documentation/dev-tools/container.rst,scripts/container
CONTEXT TRACKING #
- Mail: Frederic Weisbecker <frederic@kernel.org>, "Paul E. McKenney" <paulmck@kernel.org>
- Status: Maintained
- Files:
include/linux/context_tracking*,kernel/context_tracking.c
CONTROL GROUP (CGROUP) #
- Mail: Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>, Michal Koutný <mkoutny@suse.com>
- Mailing list: cgroups@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git
- Files:
Documentation/admin-guide/cgroup-v1/,Documentation/admin-guide/cgroup-v2.rst,include/linux/cgroup*,kernel/cgroup/,tools/testing/selftests/cgroup/
CONTROL GROUP - BLOCK IO CONTROLLER (BLKIO) #
- Mail: Tejun Heo <tj@kernel.org>, Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>
- Mailing list: cgroups@vger.kernel.org, linux-block@vger.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git
- Files:
Documentation/admin-guide/cgroup-v1/blkio-controller.rst,block/bfq-cgroup.c,block/blk-cgroup.c,block/blk-iocost.c,block/blk-iolatency.c,block/blk-throttle.c,include/linux/blk-cgroup.h
CONTROL GROUP - CPUSET #
- Mail: Waiman Long <longman@redhat.com>
- Reviewer: Chen Ridong <chenridong@huaweicloud.com>
- Mailing list: cgroups@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git
- Files:
Documentation/admin-guide/cgroup-v1/cpusets.rst,include/linux/cpuset.h,kernel/cgroup/cpuset-internal.h,kernel/cgroup/cpuset-v1.c,kernel/cgroup/cpuset.c,tools/testing/selftests/cgroup/test_cpuset.c,tools/testing/selftests/cgroup/test_cpuset_prs.sh,tools/testing/selftests/cgroup/test_cpuset_v1_base.sh
CONTROL GROUP - DEVICE MEMORY CONTROLLER (DMEM) #
- Mail: Maarten Lankhorst <dev@lankhorst.se>, Maxime Ripard <mripard@kernel.org>, Natalie Vock <natalie.vock@gmx.de>
- Mailing list: cgroups@vger.kernel.org, dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
include/linux/cgroup_dmem.h,kernel/cgroup/dmem.c
CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) #
- Mail: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeel.butt@linux.dev>
- Reviewer: Muchun Song <muchun.song@linux.dev>
- Mailing list: cgroups@vger.kernel.org, linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/memcontrol.h,include/linux/page_counter.h,mm/memcontrol.c,mm/memcontrol-v1.c,mm/memcontrol-v1.h,mm/page_counter.c,mm/swap_cgroup.c,samples/cgroup/*,tools/testing/selftests/cgroup/memcg_protection.m,tools/testing/selftests/cgroup/test_hugetlb_memcg.c,tools/testing/selftests/cgroup/test_kmem.c,tools/testing/selftests/cgroup/test_memcontrol.c
CORETEMP HARDWARE MONITORING DRIVER #
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Orphan
- Files:
Documentation/hwmon/coretemp.rst,drivers/hwmon/coretemp.c
CORSAIR-CPRO HARDWARE MONITOR DRIVER #
- Mail: Marius Zachmann <mail@mariuszachmann.de>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/corsair-cpro.c
CORSAIR-PSU HARDWARE MONITOR DRIVER #
- Mail: Wilken Gottwalt <wilken.gottwalt@posteo.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/corsair-psu.rst,drivers/hwmon/corsair-psu.c
COUNTER SUBSYSTEM #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wbg/counter.git
- Files:
Documentation/ABI/testing/sysfs-bus-counter,Documentation/driver-api/generic-counter.rst,drivers/counter/,include/linux/counter.h,include/uapi/linux/counter.h,tools/counter/
COUNTER WATCH EVENTS TOOL #
- Mail: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
tools/counter/counter_watch_events.c
CP2615 I2C DRIVER #
- Mail: Bence Csókás <bence98@sch.bme.hu>
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-cp2615.c
CPU FREQUENCY DRIVERS - VEXPRESS SPC ARM BIG LITTLE #
- Mail: Viresh Kumar <viresh.kumar@linaro.org>, Sudeep Holla <sudeep.holla@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Web-page: http://www.arm.com/products/processors/technologies/biglittleprocessing.php
- Files:
drivers/cpufreq/vexpress-spc-cpufreq.c
CPU FREQUENCY SCALING FRAMEWORK #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git, git git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git (For ARM Updates)
- Files:
Documentation/admin-guide/pm/cpufreq.rst,Documentation/admin-guide/pm/intel_pstate.rst,Documentation/cpu-freq/,Documentation/devicetree/bindings/cpufreq/,drivers/cpufreq/,include/linux/cpufreq.h,include/linux/sched/cpufreq.h,kernel/sched/cpufreq*.c,rust/kernel/cpufreq.rs,tools/testing/selftests/cpufreq/
CPU FREQUENCY DRIVERS - VIRTUAL MACHINE CPUFREQ #
- Mail: Saravana Kannan <saravanak@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
drivers/cpufreq/virtual-cpufreq.c
CPU HOTPLUG #
- Mail: Thomas Gleixner <tglx@kernel.org>, Peter Zijlstra <peterz@infradead.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp/core
- Files:
include/linux/cpu.h,include/linux/cpuhotplug.h,include/linux/smpboot.h,kernel/cpu.c,kernel/smpboot.*,rust/helpers/cpu.c,rust/kernel/cpu.rs
CPU IDLE TIME MANAGEMENT FRAMEWORK #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@kernel.org>
- Reviewer: Christian Loehle <christian.loehle@arm.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
- Files:
Documentation/admin-guide/pm/cpuidle.rst,Documentation/driver-api/pm/cpuidle.rst,drivers/cpuidle/,include/linux/cpuidle.h
CPU POWER MONITORING SUBSYSTEM #
- Mail: Thomas Renninger <trenn@suse.com>, Shuah Khan <shuah@kernel.org>, Shuah Khan <skhan@linuxfoundation.org>, John B. Wyatt IV <jwyatt@redhat.com>, John B. Wyatt IV <sageofredondo@gmail.com>, John Kacur <jkacur@redhat.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
tools/power/cpupower/
CPUID/MSR DRIVER #
- Mail: "H. Peter Anvin" <hpa@zytor.com>
- Status: Maintained
- Files:
arch/x86/kernel/cpuid.c,arch/x86/kernel/msr.c
CPUIDLE DRIVER - ARM BIG LITTLE #
- Mail: Lorenzo Pieralisi <lpieralisi@kernel.org>, Daniel Lezcano <daniel.lezcano@kernel.org>
- Mailing list: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
- Files:
drivers/cpuidle/cpuidle-big_little.c
CPUIDLE DRIVER - ARM EXYNOS #
- Mail: Daniel Lezcano <daniel.lezcano@kernel.org>, Kukjin Kim <kgene@kernel.org>
- Reviewer: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/mach-exynos/pm.c,drivers/cpuidle/cpuidle-exynos.c,include/linux/platform_data/cpuidle-exynos.h
CPUIDLE DRIVER - ARM PSCI #
- Mail: Lorenzo Pieralisi <lpieralisi@kernel.org>, Sudeep Holla <sudeep.holla@kernel.org>, Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
- Files:
drivers/cpuidle/cpuidle-psci.c
CPUIDLE DRIVER - ARM PSCI PM DOMAIN #
- Mail: Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
- Files:
drivers/cpuidle/cpuidle-psci-domain.c,drivers/cpuidle/cpuidle-psci.h
CPUIDLE DRIVER - DT IDLE PM DOMAIN #
- Mail: Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
- Files:
drivers/cpuidle/dt_idle_genpd.c,drivers/cpuidle/dt_idle_genpd.h
CPUIDLE DRIVER - RISC-V SBI #
- Mail: Anup Patel <anup@brainfault.org>
- Mailing list: linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org
- Status: Maintained
- Files:
drivers/cpuidle/cpuidle-riscv-sbi.c
CPUMASK API [RUST] #
- Mail: Viresh Kumar <viresh.kumar@linaro.org>
- Reviewer: Yury Norov <yury.norov@gmail.com>
- Status: Maintained
- Files:
rust/kernel/cpumask.rs
CRAMFS FILESYSTEM #
- Mail: Nicolas Pitre <nico@fluxnic.net>
- Status: Maintained
- Files:
Documentation/filesystems/cramfs.rst,fs/cramfs/
CRC LIBRARY #
- Mail: Eric Biggers <ebiggers@kernel.org>
- Reviewer: Ard Biesheuvel <ardb@kernel.org>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git crc-next
- Files:
Documentation/staging/crc*,include/linux/crc*,lib/crc/,scripts/gen-crc-consts.py
CREATIVE SB0540 #
- Mail: Bastien Nocera <hadess@hadess.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-creative-sb0540.c
CREDENTIALS #
- Mail: Paul Moore <paul@paul-moore.com>
- Reviewer: Serge Hallyn <sergeh@kernel.org>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Supported
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
- Files:
include/linux/cred.h,kernel/cred.c,rust/kernel/cred.rs,Documentation/security/credentials.rst
INTEL CRPS COMMON REDUNDANT PSU DRIVER #
- Mail: Ninad Palsule <ninad@linux.ibm.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/crps.rst,drivers/hwmon/pmbus/crps.c
CRYPTO API #
- Mail: Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git, git git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git
- Files:
Documentation/crypto/,Documentation/devicetree/bindings/crypto/,arch/*/crypto/,crypto/,drivers/crypto/,include/crypto/,include/linux/crypto*
CRYPTO LIBRARY #
- Mail: Eric Biggers <ebiggers@kernel.org>, Jason A. Donenfeld <Jason@zx2c4.com>, Ard Biesheuvel <ardb@kernel.org>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-next, git https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-fixes
- Files:
lib/crypto/,scripts/crypto/
CRYPTO SPEED TEST COMPARE #
- Mail: Wang Jinchao <wangjinchao@xfusion.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
tools/crypto/tcrypt/tcrypt_speed_compare.py
CRYPTOGRAPHIC RANDOM NUMBER GENERATOR #
- Mail: Neil Horman <nhorman@tuxdriver.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
crypto/rng.c
CS3308 MEDIA DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: http://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/cs3308.c
CS5535 Audio ALSA driver #
- Mail: Jaya Kumar <jayakumar.alsa@gmail.com>
- Status: Maintained
- Files:
sound/pci/cs5535audio/
CTU CAN FD DRIVER #
- Mail: Pavel Pisa <pisa@cmp.felk.cvut.cz>, Ondrej Ille <ondrej.ille@gmail.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/can/ctu,ctucanfd.yaml,drivers/net/can/ctucanfd/
CVE ASSIGNMENT CONTACT #
- Mail: CVE Assignment Team <cve@kernel.org>
- Status: Maintained
- Files:
Documentation/process/cve.rst
CW1200 WLAN driver #
- Status: Orphan
- Mailing list: linux-wireless@vger.kernel.org
- Files:
drivers/net/wireless/st/,include/linux/platform_data/net-cw1200.h
CX18 VIDEO4LINUX DRIVER #
- Mail: Andy Walls <awalls@md.metrocast.net>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/cx18/,include/uapi/linux/ivtv*
CX2341X MPEG ENCODER HELPER MODULE #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/common/cx2341x*,include/media/drv-intf/cx2341x.h
CX24120 MEDIA DRIVER #
- Mail: Jemma Denson <jdenson@gmail.com>, Patrick Boettcher <patrick.boettcher@posteo.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/cx24120*
CX88 VIDEO4LINUX DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/driver-api/media/drivers/cx88*,drivers/media/pci/cx88/
CXD2820R MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/cxd2820r*
CXGB3 ETHERNET DRIVER (CXGB3) #
- Mail: Potnuri Bharat Teja <bharat@chelsio.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.chelsio.com
- Files:
drivers/net/ethernet/chelsio/cxgb3/
CXGB3 ISCSI DRIVER (CXGB3I) #
- Mail: Varun Prakash <varun@chelsio.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.chelsio.com
- Files:
drivers/scsi/cxgbi/cxgb3i
CXGB4 CRYPTO DRIVER (chcr) #
- Mail: Ayush Sawal <ayush.sawal@chelsio.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Web-page: http://www.chelsio.com
- Files:
drivers/crypto/chelsio
CXGB4 ETHERNET DRIVER (CXGB4) #
- Mail: Potnuri Bharat Teja <bharat@chelsio.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.chelsio.com
- Files:
drivers/net/ethernet/chelsio/cxgb4/
CXGB4 INLINE CRYPTO DRIVER #
- Mail: Ayush Sawal <ayush.sawal@chelsio.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.chelsio.com
- Files:
drivers/net/ethernet/chelsio/inline_crypto/
CXGB4 ISCSI DRIVER (CXGB4I) #
- Mail: Varun Prakash <varun@chelsio.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.chelsio.com
- Files:
drivers/scsi/cxgbi/cxgb4i
CXGB4 IWARP RNIC DRIVER (IW_CXGB4) #
- Mail: Potnuri Bharat Teja <bharat@chelsio.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: http://www.openfabrics.org
- Files:
drivers/infiniband/hw/cxgb4/,include/uapi/rdma/cxgb4-abi.h
CXGB4VF ETHERNET DRIVER (CXGB4VF) #
- Mail: Potnuri Bharat Teja <bharat@chelsio.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.chelsio.com
- Files:
drivers/net/ethernet/chelsio/cxgb4vf/
CYBERPRO FB DRIVER #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: http://www.armlinux.org.uk/
- Files:
drivers/video/fbdev/cyber2000fb.*
CYCLADES PC300 DRIVER #
- Status: Orphan
- Files:
drivers/net/wan/pc300*
CYPRESS CY8C95X0 PINCTRL DRIVER #
- Mail: Patrick Rudolph <patrick.rudolph@9elements.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/pinctrl/pinctrl-cy8c95x0.c
CYPRESS CY8CTMA140 TOUCHSCREEN DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/cy8ctma140.c
CYPRESS STREETFIGHTER TOUCHKEYS DRIVER #
- Mail: Yassine Oudjana <y.oudjana@protonmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/cypress-sf.yaml,drivers/input/keyboard/cypress-sf.c
CYPRESS_FIRMWARE MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/common/cypress_firmware*
CYTTSP TOUCHSCREEN DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/cyttsp*
D-LINK DIR-685 TOUCHKEYS DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Supported
- Files:
drivers/input/keyboard/dlink-dir685-touchkeys.c
DALLAS/MAXIM DS1685-FAMILY REAL TIME CLOCK #
- Mail: Joshua Kinard <linux@kumba.dev>
- Status: Maintained
- Files:
drivers/rtc/rtc-ds1685.c,include/linux/rtc/ds1685.h
DAMA SLAVE for AX.25 #
- Mail: Joerg Reuter <jreuter@yaina.de>
- Mailing list: linux-hams@vger.kernel.org
- Status: Maintained
- Web-page: http://yaina.de/jreuter/, http://www.qsl.net/dl1bke/
- Files:
net/ax25/af_ax25.c,net/ax25/ax25_dev.c,net/ax25/ax25_ds_*,net/ax25/ax25_in.c,net/ax25/ax25_out.c,net/ax25/ax25_timer.c,net/ax25/sysctl_net_ax25.c
DASHARO ACPI PLATFORM DRIVER #
- Mail: Michał Kopeć <michal.kopec@3mdeb.com>
- Status: Maintained
- Web-page: https://docs.dasharo.com/
- Files:
drivers/platform/x86/dasharo-acpi.c
DAMON #
- Mail: SeongJae Park <sj@kernel.org>
- Mailing list: damon@lists.linux.dev, linux-mm@kvack.org
- Status: Maintained
- Web-page: https://damonitor.github.io
- Subsystem Profile: Documentation/mm/damon/maintainer-profile.rst
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm, quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new, git git://git.kernel.org/pub/scm/linux/kernel/git/sj/linux.git damon/next
- Files:
Documentation/ABI/testing/sysfs-kernel-mm-damon,Documentation/admin-guide/mm/damon/,Documentation/mm/damon/,include/linux/damon.h,include/trace/events/damon.h,mm/damon/,samples/damon/,tools/testing/selftests/damon/
DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
Documentation/networking/device_drivers/ethernet/dec/dmfe.rst,drivers/net/ethernet/dec/tulip/dmfe.c
DC390/AM53C974 SCSI driver #
- Mail: Hannes Reinecke <hare@suse.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/am53c974.c
DC395x SCSI driver #
- Mail: Oliver Neukum <oliver@neukum.org>, Ali Akcaagac <aliakc@web.de>, Jamie Lenehan <lenehan@twibble.org>
- Status: Maintained
- Files:
Documentation/scsi/dc395x.rst,drivers/scsi/dc395x.*
DEBUGOBJECTS: #
- Mail: Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/debugobjects
- Files:
include/linux/debugobjects.h,lib/debugobjects.c
DECSTATION PLATFORM SUPPORT #
- Mail: "Maciej W. Rozycki" <macro@orcam.me.uk>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/dec/,arch/mips/include/asm/dec/,arch/mips/include/asm/mach-dec/
DEFXX FDDI NETWORK DRIVER #
- Mail: "Maciej W. Rozycki" <macro@orcam.me.uk>
- Status: Maintained
- Files:
drivers/net/fddi/defxx.*
DEFZA FDDI NETWORK DRIVER #
- Mail: "Maciej W. Rozycki" <macro@orcam.me.uk>
- Status: Maintained
- Files:
drivers/net/fddi/defza.*
DEINTERLACE DRIVERS FOR ALLWINNER H3 #
- Mail: Jernej Skrabec <jernej.skrabec@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/allwinner,sun8i-h3-deinterlace.yaml,drivers/media/platform/sunxi/sun8i-di/
DELL LAPTOP DRIVER #
- Mail: Matthew Garrett <mjg59@srcf.ucam.org>, Pali Rohár <pali@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-laptop.c
DELL LAPTOP FREEFALL DRIVER #
- Mail: Pali Rohár <pali@kernel.org>
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-smo8800.c
DELL LAPTOP RBTN DRIVER #
- Mail: Pali Rohár <pali@kernel.org>
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-rbtn.*
DELL LAPTOP SMM DRIVER #
- Mail: Pali Rohár <pali@kernel.org>
- Status: Maintained
- Files:
Documentation/ABI/obsolete/procfs-i8k,drivers/hwmon/dell-smm-hwmon.c,include/uapi/linux/i8k.h
DELL PC DRIVER #
- Mail: Lyndon Sanche <lsanche@lyndeno.ca>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-pc.c
DELL REMOTE BIOS UPDATE DRIVER #
- Mail: Stuart Hayes <stuart.w.hayes@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell_rbu.c
DELL SMBIOS DRIVER #
- Mail: Pali Rohár <pali@kernel.org>
- Mailing list: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-smbios.*
DELL SMBIOS SMM DRIVER #
- Mailing list: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-smbios-smm.c
DELL SMBIOS WMI DRIVER #
- Mailing list: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-smbios-wmi.c,tools/wmi/dell-smbios-example.c
DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas) #
- Mail: Stuart Hayes <stuart.w.hayes@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/userspace-api/dcdbas.rst,drivers/platform/x86/dell/dcdbas.*
DELL WMI DDV DRIVER #
- Mail: Armin Wolf <W_Armin@gmx.de>
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-dell-wmi-ddv,Documentation/ABI/testing/sysfs-platform-dell-wmi-ddv,Documentation/wmi/devices/dell-wmi-ddv.rst,drivers/platform/x86/dell/dell-wmi-ddv.c
DELL WMI DESCRIPTOR DRIVER #
- Mailing list: Dell.Client.Kernel@dell.com
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-wmi-descriptor.c
DELL WMI HARDWARE PRIVACY SUPPORT #
- Mailing list: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-wmi-privacy.c
DELL WMI NOTIFICATIONS DRIVER #
- Mail: Matthew Garrett <mjg59@srcf.ucam.org>, Pali Rohár <pali@kernel.org>
- Status: Maintained
- Files:
drivers/platform/x86/dell/dell-wmi-base.c
DELL WMI SYSMAN DRIVER #
- Mail: Prasanth Ksr <prasanth.ksr@dell.com>
- Mailing list: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-firmware-attributes,drivers/platform/x86/dell/dell-wmi-sysman/
DELTA AHE-50DC FAN CONTROL MODULE DRIVER #
- Mail: Zev Weiss <zev@bewilderbeest.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/pmbus/delta-ahe50dc-fan.c
DELTA DPS920AB PSU DRIVER #
- Mail: Robert Marko <robert.marko@sartura.hr>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/dps920ab.rst,drivers/hwmon/pmbus/dps920ab.c
DELTA NETWORKS TN48M CPLD DRIVERS #
- Mail: Robert Marko <robert.marko@sartura.hr>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml,Documentation/devicetree/bindings/mfd/delta,tn48m-cpld.yaml,Documentation/devicetree/bindings/reset/delta,tn48m-reset.yaml,drivers/gpio/gpio-tn48m.c,include/dt-bindings/reset/delta,tn48m-reset.h
DELTA ST MEDIA DRIVER #
- Mail: Hugues Fruchet <hugues.fruchet@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/platform/st/sti/delta
DENALI NAND DRIVER #
- Mailing list: linux-mtd@lists.infradead.org
- Status: Orphan
- Files:
drivers/mtd/nand/raw/denali*
DESIGNWARE EDMA CORE IP DRIVER #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: dmaengine@vger.kernel.org
- Status: Maintained
- Files:
drivers/dma/dw-edma/,include/linux/dma/edma.h
DESIGNWARE USB2 DRD IP DRIVER #
- Mail: Minas Harutyunyan <hminas@synopsys.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
- Files:
drivers/usb/dwc2/
DESIGNWARE USB3 DRD IP DRIVER #
- Mail: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/dwc3/
DESIGNWARE XDATA IP DRIVER #
- Mailing list: linux-pci@vger.kernel.org
- Status: Orphan
- Files:
Documentation/misc-devices/dw-xdata-pcie.rst,drivers/misc/dw-xdata-pcie.c
DEVANTECH SRF ULTRASONIC RANGER IIO DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-iio-distance-srf08,drivers/iio/proximity/srf*.c
DEVICE COREDUMP (DEV_COREDUMP) #
- Mail: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/base/devcoredump.c,include/linux/devcoredump.h
DEVICE DEPENDENCY HELPER SCRIPT #
- Mail: Saravana Kannan <saravanak@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
scripts/dev-needs.sh
DEVICE DIRECT ACCESS (DAX) #
- Mail: Dan Williams <dan.j.williams@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com>
- Mailing list: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
- Status: Supported
- Files:
drivers/dax/
DEVICE FREQUENCY (DEVFREQ) #
- Mail: MyungJoo Ham <myungjoo.ham@samsung.com>, Kyungmin Park <kyungmin.park@samsung.com>, Chanwoo Choi <cw00.choi@samsung.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
- Files:
Documentation/devicetree/bindings/devfreq/,Documentation/devicetree/bindings/interconnect/mediatek,cci.yaml,drivers/devfreq/,include/linux/devfreq.h,include/trace/events/devfreq.h
DEVICE FREQUENCY EVENT (DEVFREQ-EVENT) #
- Mail: Chanwoo Choi <cw00.choi@samsung.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
- Files:
Documentation/devicetree/bindings/devfreq/event/,drivers/devfreq/devfreq-event.c,drivers/devfreq/event/,include/dt-bindings/pmu/exynos_ppmu.h,include/linux/devfreq-event.h
DEVICE I/O & IRQ [RUST] #
- Mail: Danilo Krummrich <dakr@kernel.org>, Alice Ryhl <aliceryhl@google.com>, Daniel Almeida <daniel.almeida@collabora.com>
- Mailing list: driver-core@lists.linux.dev
- Status: Supported
- Web-page: https://rust-for-linux.com
- bugs: https://github.com/Rust-for-Linux/linux/issues
- chat: https://rust-for-linux.zulipchat.com
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
- Files:
rust/kernel/io.rs,rust/kernel/io/,rust/kernel/irq.rs,rust/kernel/irq/
DEVICE RESOURCE MANAGEMENT HELPERS #
- Mail: Hans de Goede <hansg@kernel.org>
- Reviewer: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Maintained
- Files:
include/linux/devm-helpers.h
DEVICE-MAPPER (LVM) #
- Mail: Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, Mikulas Patocka <mpatocka@redhat.com>, Benjamin Marzinski <bmarzins@redhat.com>
- Mailing list: dm-devel@lists.linux.dev
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/dm-devel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
- Files:
Documentation/admin-guide/device-mapper/,drivers/md/Kconfig,drivers/md/Makefile,drivers/md/dm*,drivers/md/persistent-data/,include/linux/device-mapper.h,include/linux/dm-*.h,include/uapi/linux/dm-*.h
DEVICE-MAPPER VDO TARGET #
- Mail: Matthew Sakai <msakai@redhat.com>
- Mailing list: dm-devel@lists.linux.dev
- Status: Maintained
- Files:
Documentation/admin-guide/device-mapper/vdo*.rst,drivers/md/dm-vdo/
DEVICE-MAPPER PCACHE TARGET #
- Mail: Dongsheng Yang <dongsheng.yang@linux.dev>, Zheng Gu <cengku@gmail.com>
- Mailing list: dm-devel@lists.linux.dev
- Status: Maintained
- Files:
Documentation/admin-guide/device-mapper/dm-pcache.rst,drivers/md/dm-pcache/
DEVLINK #
- Mail: Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/networking/devlink,include/net/devlink.h,include/uapi/linux/devlink.h,net/devlink/
DFROBOT SD2405AL RTC DRIVER #
- Mail: Tóth János <gomba007@gmail.com>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Maintained
- Files:
drivers/rtc/rtc-sd2405al.c
DFROBOT SEN0322 DRIVER #
- Mail: Tóth János <gomba007@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/chemical/sen0322.c
DH ELECTRONICS DHSOM SOM AND BOARD SUPPORT #
- Mail: Christoph Niedermaier <cniedermaier@dh-electronics.com>, Marek Vasut <marex@denx.de>
- Mailing list: kernel@dh-electronics.com
- Status: Maintained
- Regex:
dhcom,dhcor,dhsom
DIALOG SEMICONDUCTOR DRIVERS #
- Mail: Support Opensource <support.opensource@diasemi.com>
- Status: Supported
- Web-page: http://www.dialog-semiconductor.com/products
- Files:
Documentation/devicetree/bindings/input/dlg,da72??.yaml,Documentation/devicetree/bindings/input/dlg,da9062-onkey.yaml,Documentation/devicetree/bindings/mfd/da90*.txt,Documentation/devicetree/bindings/mfd/dlg,da90*.yaml,Documentation/devicetree/bindings/regulator/dlg,da9*.yaml,Documentation/devicetree/bindings/regulator/dlg,slg51000.yaml,Documentation/devicetree/bindings/sound/da[79]*.txt,Documentation/devicetree/bindings/sound/dlg,da7213.yaml,Documentation/devicetree/bindings/thermal/dlg,da9062-thermal.yaml,Documentation/devicetree/bindings/watchdog/dlg,da9062-watchdog.yaml,Documentation/hwmon/da90??.rst,drivers/gpio/gpio-da90??.c,drivers/hwmon/da90??-hwmon.c,drivers/iio/adc/da91??-*.c,drivers/input/misc/da72??.[ch],drivers/input/misc/da90??_onkey.c,drivers/input/touchscreen/da9052_tsi.c,drivers/leds/leds-da90??.c,drivers/mfd/da903x.c,drivers/mfd/da90??-*.c,drivers/mfd/da91??-*.c,drivers/pinctrl/pinctrl-da90??.c,drivers/power/supply/da9052-battery.c,drivers/power/supply/da91??-*.c,drivers/regulator/da9???-regulator.[ch],drivers/regulator/slg51000-regulator.[ch],drivers/rtc/rtc-da90??.c,drivers/thermal/da90??-thermal.c,drivers/video/backlight/da90??_bl.c,drivers/watchdog/da90??_wdt.c,include/dt-bindings/regulator/dlg,da9*-regulator.h,include/linux/mfd/da903x.h,include/linux/mfd/da9052/,include/linux/mfd/da9055/,include/linux/mfd/da9062/,include/linux/mfd/da9063/,include/linux/mfd/da9150/,include/linux/regulator/da9211.h,include/sound/da[79]*.h,sound/soc/codecs/da[79]*.[ch]
DIAMOND SYSTEMS GPIO-MM GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-gpio-mm.c
DIBS (DIRECT INTERNAL BUFFER SHARING) #
- Mail: Alexandra Winter <wintera@linux.ibm.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/dibs/,include/linux/dibs.h
DIGITEQ AUTOMOTIVE MGB4 V4L2 DRIVER #
- Mail: Martin Tuma <martin.tuma@digiteqautomotive.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/mgb4.rst,drivers/media/pci/mgb4/
DIOLAN U2C-12 I2C DRIVER #
- Mail: Guenter Roeck <linux@roeck-us.net>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-diolan-u2c.c
DIRECTORY NOTIFICATION (DNOTIFY) #
- Mail: Jan Kara <jack@suse.cz>
- Reviewer: Amir Goldstein <amir73il@gmail.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/dnotify.rst,fs/notify/dnotify/,include/linux/dnotify.h
DISK GEOMETRY AND PARTITION HANDLING #
- Mail: Andries Brouwer <aeb@cwi.nl>
- Status: Maintained
- Web-page: http://www.win.tue.nl/~aeb/linux/Large-Disk.html, http://www.win.tue.nl/~aeb/linux/zip/zip-1.html, http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
DISKQUOTA #
- Mail: Jan Kara <jack@suse.com>
- Status: Maintained
- Files:
Documentation/filesystems/quota.rst,fs/quota/,include/linux/quota*.h,include/uapi/linux/quota*.h
DISPLAYLINK USB 2.0 FRAMEBUFFER DRIVER (UDLFB) #
- Mail: Bernie Thompson <bernie@plugable.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Web-page: http://plugable.com/category/projects/udlfb/
- Files:
Documentation/fb/udlfb.rst,drivers/video/fbdev/udlfb.c,include/video/udlfb.h
DISTRIBUTED LOCK MANAGER (DLM) #
- Mail: Alexander Aring <aahringo@redhat.com>, David Teigland <teigland@redhat.com>
- Mailing list: gfs2@lists.linux.dev
- Status: Supported
- Web-page: https://pagure.io/dlm
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm.git
- Files:
fs/dlm/
DMA BUFFER SHARING FRAMEWORK #
- Mail: Sumit Semwal <sumit.semwal@linaro.org>, Christian König <christian.koenig@amd.com>
- Mailing list: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/driver-api/dma-buf.rst,Documentation/userspace-api/dma-buf-alloc-exchange.rst,drivers/dma-buf/,include/linux/*fence.h,include/linux/dma-buf.h,include/linux/dma-buf/,include/linux/dma-resv.h - Content regex:
\bdma_(?:buf|fence|resv)\b
DMA GENERIC OFFLOAD ENGINE SUBSYSTEM #
- Mail: Vinod Koul <vkoul@kernel.org>
- Reviewer: Frank Li <Frank.Li@kernel.org>
- Mailing list: dmaengine@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-dmaengine/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git
- Files:
Documentation/devicetree/bindings/dma/,Documentation/driver-api/dmaengine/,drivers/dma/,include/dt-bindings/dma/,include/linux/dma/,include/linux/dmaengine.h,include/linux/of_dma.h
DMA MAPPING BENCHMARK #
- Mail: Barry Song <baohua@kernel.org>, Qinxin Xia <xiaqinxin@huawei.com>
- Mailing list: iommu@lists.linux.dev
- Files:
kernel/dma/map_benchmark.c,tools/dma/
DMA MAPPING HELPERS #
- Mail: Marek Szyprowski <m.szyprowski@samsung.com>
- Reviewer: Robin Murphy <robin.murphy@arm.com>
- Mailing list: iommu@lists.linux.dev
- Status: Supported
- Web-page: http://git.infradead.org/users/hch/dma-mapping.git
- SCM: git git://git.infradead.org/users/hch/dma-mapping.git
- Files:
include/asm-generic/dma-mapping.h,include/linux/dma-direct.h,include/linux/dma-map-ops.h,include/linux/dma-mapping.h,include/linux/swiotlb.h,kernel/dma/
DMA MAPPING & SCATTERLIST API [RUST] #
- Mail: Danilo Krummrich <dakr@kernel.org>
- Reviewer: Abdiel Janulgue <abdiel.janulgue@gmail.com>, Daniel Almeida <daniel.almeida@collabora.com>, Robin Murphy <robin.murphy@arm.com>, Andreas Hindborg <a.hindborg@kernel.org>
- Mailing list: driver-core@lists.linux.dev
- Status: Supported
- Web-page: https://rust-for-linux.com
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
- Files:
rust/helpers/dma.c,rust/helpers/scatterlist.c,rust/kernel/dma.rs,rust/kernel/scatterlist.rs,samples/rust/rust_dma.rs
DMA-BUF HEAPS FRAMEWORK #
- Mail: Sumit Semwal <sumit.semwal@linaro.org>
- Reviewer: Benjamin Gaignard <benjamin.gaignard@collabora.com>, Brian Starkey <Brian.Starkey@arm.com>, John Stultz <jstultz@google.com>, T.J. Mercier <tjmercier@google.com>
- Mailing list: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/userspace-api/dma-buf-heaps.rst,drivers/dma-buf/dma-heap.c,drivers/dma-buf/heaps/*,include/linux/dma-heap.h,include/uapi/linux/dma-heap.h,tools/testing/selftests/dmabuf-heaps/
DMC FREQUENCY DRIVER FOR SAMSUNG EXYNOS5422 #
- Mail: Lukasz Luba <lukasz.luba@arm.com>
- Mailing list: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/samsung,exynos5422-dmc.yaml,drivers/memory/samsung/exynos5422-dmc.c
DME1737 HARDWARE MONITOR DRIVER #
- Mail: Juerg Haefliger <juergh@proton.me>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/dme1737.rst,drivers/hwmon/dme1737.c
DMI/SMBIOS SUPPORT #
- Mail: Jean Delvare <jdelvare@suse.com>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git dmi-for-next
- Files:
Documentation/ABI/testing/sysfs-firmware-dmi-tables,drivers/firmware/dmi-id.c,drivers/firmware/dmi_scan.c,include/linux/dmi.h
DOCUMENTATION #
- Mail: Jonathan Corbet <corbet@lwn.net>
- Reviewer: Shuah Khan <skhan@linuxfoundation.org>
- Mailing list: linux-doc@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/doc-guide/maintainer-profile.rst
- SCM: git git://git.lwn.net/linux.git docs-next
- Files:
Documentation/,tools/lib/python/*,tools/docs/,tools/net/ynl/pyynl/lib/doc_generator.py - Excluded:
Documentation/ABI/,Documentation/admin-guide/media/,Documentation/devicetree/,Documentation/driver-api/media/,Documentation/firmware-guide/acpi/,Documentation/i2c/,Documentation/netlink/,Documentation/power/,Documentation/spi/,Documentation/userspace-api/media/
DOCUMENTATION PROCESS #
- Mail: Jonathan Corbet <corbet@lwn.net>
- Reviewer: Shuah Khan <skhan@linuxfoundation.org>
- Mailing list: workflows@vger.kernel.org
- Status: Maintained
- Files:
Documentation/dev-tools/,Documentation/maintainer/,Documentation/process/
DOCUMENTATION REPORTING ISSUES #
- Mail: Thorsten Leemhuis <linux@leemhuis.info>
- Mailing list: linux-doc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/bug-bisect.rst,Documentation/admin-guide/quickly-build-trimmed-linux.rst,Documentation/admin-guide/reporting-issues.rst,Documentation/admin-guide/verify-bugs-and-bisect-regressions.rst
DOCUMENTATION SCRIPTS #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-doc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/sphinx/,tools/lib/python/*,tools/docs/
DOCUMENTATION/ITALIAN #
- Mail: Federico Vaga <federico.vaga@vaga.pv.it>
- Mailing list: linux-doc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/translations/it_IT
DOCUMENTATION/JAPANESE #
- Reviewer: Akira Yokosawa <akiyks@gmail.com>
- Mailing list: linux-doc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/translations/ja_JP
DONGWOON DW9714 LENS VOICE COIL DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.yaml,drivers/media/i2c/dw9714.c
DONGWOON DW9719 LENS VOICE COIL DRIVER #
- Mail: Daniel Scally <dan.scally@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/dw9719.c
DONGWOON DW9768 LENS VOICE COIL DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml,drivers/media/i2c/dw9768.c
DONGWOON DW9807 LENS VOICE COIL DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml,drivers/media/i2c/dw9807-vcm.c
DOUBLETALK DRIVER #
- Mail: "James R. Van Zandt" <jrv@vanzandt.mv.com>
- Mailing list: blinux-list@redhat.com
- Status: Maintained
- Files:
drivers/char/dtlk.c,include/linux/dtlk.h
DPAA2 DATAPATH I/O (DPIO) DRIVER #
- Mail: Roy Pledge <Roy.Pledge@nxp.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/soc/fsl/dpio
DPAA2 ETHERNET DRIVER #
- Mail: Ioana Ciornei <ioana.ciornei@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/freescale/dpaa2/ethernet-driver.rst,Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst,drivers/net/ethernet/freescale/dpaa2/Kconfig,drivers/net/ethernet/freescale/dpaa2/Makefile,drivers/net/ethernet/freescale/dpaa2/dpaa2-eth*,drivers/net/ethernet/freescale/dpaa2/dpaa2-mac*,drivers/net/ethernet/freescale/dpaa2/dpaa2-xsk*,drivers/net/ethernet/freescale/dpaa2/dpkg.h,drivers/net/ethernet/freescale/dpaa2/dpmac*,drivers/net/ethernet/freescale/dpaa2/dpni*
DPAA2 ETHERNET SWITCH DRIVER #
- Mail: Ioana Ciornei <ioana.ciornei@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/freescale/dpaa2/switch-driver.rst,drivers/net/ethernet/freescale/dpaa2/dpaa2-switch*,drivers/net/ethernet/freescale/dpaa2/dpsw*
DPLL SUBSYSTEM #
- Mail: Vadim Fedorenko <vadim.fedorenko@linux.dev>, Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>, Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/dpll/dpll-device.yaml,Documentation/devicetree/bindings/dpll/dpll-pin.yaml,Documentation/driver-api/dpll.rst,drivers/dpll/,include/linux/dpll.h,include/uapi/linux/dpll.h
DRBD DRIVER #
- Mail: Philipp Reisner <philipp.reisner@linbit.com>, Lars Ellenberg <lars.ellenberg@linbit.com>, Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
- Mailing list: drbd-dev@lists.linbit.com
- Status: Supported
- Web-page: http://www.drbd.org
- SCM: git git://git.linbit.com/linux-drbd.git, git git://git.linbit.com/drbd-8.4.git
- Files:
Documentation/admin-guide/blockdev/,drivers/block/drbd/,include/linux/drbd*,lib/lru_cache.c
DRIVER COMPONENT FRAMEWORK #
- Mailing list: dri-devel@lists.freedesktop.org
- Files:
drivers/base/component.c,include/linux/component.h
DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Danilo Krummrich <dakr@kernel.org>
- Mailing list: driver-core@lists.linux.dev
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
- Files:
Documentation/core-api/kobject.rst,Documentation/driver-api/driver-model/,drivers/base/,fs/debugfs/,fs/sysfs/,include/linux/device/,include/linux/debugfs.h,include/linux/device.h,include/linux/fwnode.h,include/linux/kobj*,include/linux/property.h,include/linux/sysfs.h,lib/kobj*,rust/kernel/debugfs.rs,rust/kernel/debugfs/,rust/kernel/device.rs,rust/kernel/device/,rust/kernel/device_id.rs,rust/kernel/devres.rs,rust/kernel/driver.rs,rust/kernel/faux.rs,rust/kernel/platform.rs,rust/kernel/soc.rs,samples/rust/rust_debugfs.rs,samples/rust/rust_debugfs_scoped.rs,samples/rust/rust_driver_platform.rs,samples/rust/rust_driver_faux.rs,samples/rust/rust_soc.rs
DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS) #
- Mail: Nishanth Menon <nm@ti.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
drivers/soc/ti/smartreflex.c,include/linux/power/smartreflex.h
DRM ACCEL DRIVERS FOR INTEL VPU #
- Mail: Maciej Falkowski <maciej.falkowski@linux.intel.com>, Karol Wachowski <karol.wachowski@linux.intel.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/accel/ivpu/,include/uapi/drm/ivpu_accel.h
DRM ACCEL DRIVER FOR ROCKCHIP NPU #
- Mail: Tomeu Vizoso <tomeu@tomeuvizoso.net>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/accel/rocket/,Documentation/devicetree/bindings/npu/rockchip,rk3588-rknn-core.yaml,drivers/accel/rocket/,include/uapi/drm/rocket_accel.h
DRM COMPUTE ACCELERATORS DRIVERS AND FRAMEWORK #
- Mail: Oded Gabbay <ogabbay@kernel.org>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- chat: irc://irc.oftc.net/dri-devel
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/accel.git
- Files:
Documentation/accel/,drivers/accel/,include/drm/drm_accel.h
DRM DRIVER FOR ALLWINNER DE2 AND DE3 ENGINE #
- Mail: Chen-Yu Tsai <wens@kernel.org>
- Reviewer: Jernej Skrabec <jernej.skrabec@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/sun4i/sun8i*
DRM DRIVER FOR APPLE TOUCH BARS #
- Mail: Aun-Ali Zaidi <admin@kodeit.net>, Aditya Garg <gargaditya08@live.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/tiny/appletbdrm.c
DRM DRIVER FOR ARM PL111 CLCD #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/pl111/
DRM DRIVER FOR ARM VERSATILE TFT PANELS #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/arm,versatile-tft-panel.yaml,drivers/gpu/drm/panel/panel-arm-versatile.c
DRM DRIVER FOR ASPEED BMC GFX #
- Mail: Joel Stanley <joel@jms.id.au>
- Mailing list: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/gpu/aspeed,ast2400-gfx.yaml,drivers/gpu/drm/aspeed/
DRM DRIVER FOR AST SERVER GRAPHICS CHIPS #
- Mail: Dave Airlie <airlied@redhat.com>
- Reviewer: Thomas Zimmermann <tzimmermann@suse.de>, Jocelyn Falempe <jfalempe@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/ast/
DRM DRIVER FOR BOCHS VIRTUAL GPU #
- Mail: Gerd Hoffmann <kraxel@redhat.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/tiny/bochs.c
DRM DRIVER FOR BOE HIMAX8279D PANELS #
- Mail: Jerry Han <hanxu5@huaqin.corp-partner.google.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/boe,himax8279d.yaml,drivers/gpu/drm/panel/panel-boe-himax8279d.c
DRM DRIVER FOR CHIPONE ICN6211 MIPI-DSI to RGB CONVERTER BRIDGE #
- Mail: Jagan Teki <jagan@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml,drivers/gpu/drm/bridge/chipone-icn6211.c
DRM DRIVER FOR EBBG FT8719 PANEL #
- Mail: Joel Selvaraj <jo@jsfamily.in>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/ebbg,ft8719.yaml,drivers/gpu/drm/panel/panel-ebbg-ft8719.c
DRM DRIVER FOR FARADAY TVE200 TV ENCODER #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/tve200/
DRM DRIVER FOR FEIXIN K101 IM2BA02 MIPI-DSI LCD PANELS #
- Mail: Icenowy Zheng <icenowy@aosc.io>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/feixin,k101-im2ba02.yaml,drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
DRM DRIVER FOR FEIYANG FY07024DI26A30-D MIPI-DSI LCD PANELS #
- Mail: Jagan Teki <jagan@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/feiyang,fy07024di26a30d.yaml,drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c
DRM DRIVER FOR FIRMWARE FRAMEBUFFERS #
- Mail: Thomas Zimmermann <tzimmermann@suse.de>, Javier Martinez Canillas <javierm@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/firmware/sysfb*.c,drivers/gpu/drm/sysfb/,drivers/video/aperture.c,drivers/video/nomodeset.c,include/linux/aperture.h,include/linux/sysfb.h,include/video/nomodeset.h
DRM DRIVER FOR GENERIC EDP PANELS #
- Reviewer: Douglas Anderson <dianders@chromium.org>
- Files:
Documentation/devicetree/bindings/display/panel/panel-edp.yaml,drivers/gpu/drm/panel/panel-edp.c
DRM DRIVER FOR GENERIC USB DISPLAY #
- Mail: Ruben Wauters <rubenru09@aol.com>
- Status: Maintained
- Web-page: https://github.com/notro/gud/wiki
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/gud/,include/drm/gud.h
DRM DRIVER FOR GRAIN MEDIA GM12U320 PROJECTORS #
- Mail: Hans de Goede <hansg@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/tiny/gm12u320.c
DRM DRIVER FOR HIMAX HX8394 MIPI-DSI LCD panels #
- Mail: Ondrej Jirman <megi@xff.cz>, Javier Martinez Canillas <javierm@redhat.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/himax,hx8394.yaml,drivers/gpu/drm/panel/panel-himax-hx8394.c
DRM DRIVER FOR HX8357D PANELS #
- Status: Orphan
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/himax,hx8357.yaml,drivers/gpu/drm/tiny/hx8357d.c
DRM DRIVER FOR HYPERV SYNTHETIC VIDEO DEVICE #
- Mail: Dexuan Cui <decui@microsoft.com>, Long Li <longli@microsoft.com>, Saurabh Sengar <ssengar@linux.microsoft.com>
- Mailing list: linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/hyperv
DRM DRIVER FOR ILITEK ILI9225 PANELS #
- Mail: David Lechner <david@lechnology.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/ilitek,ili9225.txt,drivers/gpu/drm/tiny/ili9225.c
DRM DRIVER FOR ILITEK ILI9486 PANELS #
- Mail: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/ilitek,ili9486.yaml,drivers/gpu/drm/tiny/ili9486.c
DRM DRIVER FOR ILITEK ILI9805 PANELS #
- Mail: Michael Trimarchi <michael@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/ilitek,ili9805.yaml,drivers/gpu/drm/panel/panel-ilitek-ili9805.c
DRM DRIVER FOR ILITEK ILI9806E PANELS #
- Mail: Michael Walle <mwalle@kernel.org>
- Status: Maintained
- Files:
drivers/gpu/drm/panel/panel-ilitek-ili9806e.c
DRM DRIVER FOR JADARD JD9365DA-H3 MIPI-DSI LCD PANELS #
- Mail: Jagan Teki <jagan@edgeble.ai>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/jadard,jd9365da-h3.yaml,drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
DRM DRIVER FOR LG SW43408 PANELS #
- Mail: Sumit Semwal <sumit.semwal@linaro.org>, Casey Connolly <casey.connolly@linaro.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/lg,sw43408.yaml,drivers/gpu/drm/panel/panel-lg-sw43408.c
DRM DRIVER FOR LOGICVC DISPLAY CONTROLLER #
- Mail: Paul Kocialkowski <paulk@sys-base.io>
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/logicvc/
DRM DRIVER FOR LVDS PANELS #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/lvds.yaml,Documentation/devicetree/bindings/display/panel/panel-lvds.yaml,drivers/gpu/drm/panel/panel-lvds.c
DRM DRIVER FOR MANTIX MLAF057WE51 PANELS #
- Mail: Guido Günther <agx@sigxcpu.org>
- Reviewer: Purism Kernel Team <kernel@puri.sm>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml,drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c
DRM DRIVER FOR MGA G200 GRAPHICS CHIPS #
- Mail: Dave Airlie <airlied@redhat.com>
- Reviewer: Thomas Zimmermann <tzimmermann@suse.de>, Jocelyn Falempe <jfalempe@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/mgag200/
DRM DRIVER FOR MI0283QT #
- Mail: Alex Lanzano <lanzano.alex@gmail.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt,drivers/gpu/drm/tiny/mi0283qt.c
DRM DRIVER FOR MIPI DBI compatible panels #
- Status: Orphan
- Web-page: https://github.com/notro/panel-mipi-dbi/wiki
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/panel-mipi-dbi-spi.yaml,drivers/gpu/drm/tiny/panel-mipi-dbi.c
DRM DRIVER for Qualcomm Adreno GPUs #
- Mail: Rob Clark <robin.clark@oss.qualcomm.com>
- Reviewer: Sean Paul <sean@poorly.run>, Konrad Dybcio <konradybcio@kernel.org>, Akhil P Oommen <akhilpo@oss.qualcomm.com>
- Mailing list: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org
- Status: Maintained
- bugs: https://gitlab.freedesktop.org/drm/msm/-/issues
- SCM: git https://gitlab.freedesktop.org/drm/msm.git
- Files:
Documentation/devicetree/bindings/display/msm/gpu.yaml,Documentation/devicetree/bindings/display/msm/qcom,adreno-rgmu.yaml,Documentation/devicetree/bindings/opp/opp-v2-qcom-adreno.yaml,drivers/gpu/drm/msm/adreno/,drivers/gpu/drm/msm/msm_gpu.*,drivers/gpu/drm/msm/msm_gpu_devfreq.*,drivers/gpu/drm/msm/msm_ringbuffer.*,drivers/gpu/drm/msm/registers/adreno/,include/uapi/drm/msm_drm.h
DRM DRIVER for Qualcomm display hardware #
- Mail: Rob Clark <robin.clark@oss.qualcomm.com>, Dmitry Baryshkov <lumag@kernel.org>
- Reviewer: Abhinav Kumar <abhinav.kumar@linux.dev>, Jessica Zhang <jesszhan0024@gmail.com>, Sean Paul <sean@poorly.run>, Marijn Suijten <marijn.suijten@somainline.org>
- Mailing list: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org
- Status: Maintained
- bugs: https://gitlab.freedesktop.org/drm/msm/-/issues
- SCM: git https://gitlab.freedesktop.org/drm/msm.git
- Files:
Documentation/devicetree/bindings/display/msm/,drivers/gpu/drm/ci/xfails/msm*,drivers/gpu/drm/msm/,include/dt-bindings/clock/qcom,dsi-phy-28nm.h,include/uapi/drm/msm_drm.h
DRM DRIVER FOR NOVATEK NT35510 PANELS #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml,drivers/gpu/drm/panel/panel-novatek-nt35510.c
DRM DRIVER FOR NOVATEK NT35560 PANELS #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/sony,acx424akp.yaml,drivers/gpu/drm/panel/panel-novatek-nt35560.c
DRM DRIVER FOR NOVATEK NT36523 PANELS #
- Mail: Jianhua Lu <lujianhua000@gmail.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/novatek,nt36523.yaml,drivers/gpu/drm/panel/panel-novatek-nt36523.c
DRM DRIVER FOR NOVATEK NT36672A PANELS #
- Mail: Sumit Semwal <sumit.semwal@linaro.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml,drivers/gpu/drm/panel/panel-novatek-nt36672a.c
DRM DRIVER FOR NOVATEK NT37801 PANELS #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/novatek,nt37801.yaml,drivers/gpu/drm/panel/panel-novatek-nt37801.c
DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS #
- Mail: Lyude Paul <lyude@redhat.com>, Danilo Krummrich <dakr@kernel.org>
- Mailing list: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org
- Status: Supported
- Web-page: https://nouveau.freedesktop.org/
- Patchwork: https://patchwork.freedesktop.org/project/nouveau/, https://gitlab.freedesktop.org/drm/nouveau/-/merge_requests
- bugs: https://gitlab.freedesktop.org/drm/nouveau/-/issues
- chat: irc://irc.oftc.net/nouveau
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/nouveau/,include/uapi/drm/nouveau_drm.h
CORE DRIVER FOR NVIDIA GPUS [RUST] #
- Mail: Danilo Krummrich <dakr@kernel.org>, Alexandre Courbot <acourbot@nvidia.com>
- Mailing list: nouveau@lists.freedesktop.org
- Status: Supported
- Web-page: https://rust-for-linux.com/nova-gpu-driver
- Patchwork: https://patchwork.freedesktop.org/project/nouveau/
- bugs: https://gitlab.freedesktop.org/drm/nova/-/issues
- chat: irc://irc.oftc.net/nouveau
- SCM: git https://gitlab.freedesktop.org/drm/rust/kernel.git drm-rust-next
- Files:
Documentation/gpu/nova/,drivers/gpu/nova-core/
DRM DRIVER FOR NVIDIA GPUS [RUST] #
- Mail: Danilo Krummrich <dakr@kernel.org>
- Mailing list: nouveau@lists.freedesktop.org
- Status: Supported
- Web-page: https://rust-for-linux.com/nova-gpu-driver
- Patchwork: https://patchwork.freedesktop.org/project/nouveau/
- bugs: https://gitlab.freedesktop.org/drm/nova/-/issues
- chat: irc://irc.oftc.net/nouveau
- SCM: git https://gitlab.freedesktop.org/drm/rust/kernel.git drm-rust-next
- Files:
Documentation/gpu/nova/,drivers/gpu/drm/nova/,include/uapi/drm/nova_drm.h
DRM DRIVER FOR OLIMEX LCD-OLINUXINO PANELS #
- Mail: Stefan Mavrodiev <stefan@olimex.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.yaml,drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c
DRM DRIVER FOR PARADE PS8640 BRIDGE CHIP #
- Reviewer: Douglas Anderson <dianders@chromium.org>
- Files:
Documentation/devicetree/bindings/display/bridge/ps8640.yaml,drivers/gpu/drm/bridge/parade-ps8640.c
DRM DRIVER FOR PERVASIVE DISPLAYS REPAPER PANELS #
- Mail: Alex Lanzano <lanzano.alex@gmail.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/repaper.txt,drivers/gpu/drm/tiny/repaper.c
DRM DRIVER FOR PIXPAPER E-INK PANEL #
- Mail: LiangCheng Wang <zaq14760@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/mayqueen,pixpaper.yaml,drivers/gpu/drm/tiny/pixpaper.c
DRM DRIVER FOR QEMU'S CIRRUS DEVICE #
- Mail: Dave Airlie <airlied@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Obsolete
- Web-page: https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/tiny/cirrus-qemu.c
DRM DRIVER FOR QXL VIRTUAL GPU #
- Mail: Dave Airlie <airlied@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
- Mailing list: virtualization@lists.linux.dev, spice-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/qxl/,include/uapi/drm/qxl_drm.h
DRM DRIVER FOR RAYDIUM RM67191 PANELS #
- Mail: Robert Chiras <robert.chiras@nxp.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml,drivers/gpu/drm/panel/panel-raydium-rm67191.c
DRM DRIVER FOR SAMSUNG DB7430 PANELS #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml,drivers/gpu/drm/panel/panel-samsung-db7430.c
DRM DRIVER FOR SAMSUNG MIPI DSIM BRIDGE #
- Mail: Inki Dae <inki.dae@samsung.com>, Jagan Teki <jagan@amarulasolutions.com>, Marek Szyprowski <m.szyprowski@samsung.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/bridge/samsung,mipi-dsim.yaml,drivers/gpu/drm/bridge/samsung-dsim.c,include/drm/bridge/samsung-dsim.h
DRM DRIVER FOR SAMSUNG S6D27A1 PANELS #
- Mail: Markuss Broks <markuss.broks@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/samsung,s6d27a1.yaml,drivers/gpu/drm/panel/panel-samsung-s6d27a1.c
DRM DRIVER FOR SAMSUNG S6D7AA0 PANELS #
- Mail: Artur Weber <aweber.kernel@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml,drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
DRM DRIVER FOR SAMSUNG S6E3FC2X01 DDIC #
- Mail: David Heidelberg <david@ixit.cz>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/samsung,s6e3fc2x01.yaml,drivers/gpu/drm/panel/panel-samsung-s6e3fc2x01.c
DRM DRIVER FOR SAMSUNG S6E3HA8 PANELS #
- Mail: Dzmitry Sankouski <dsankouski@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml,drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c
DRM DRIVER FOR SAMSUNG SOFEF00 DDIC #
- Mail: David Heidelberg <david@ixit.cz>, Casey Connolly <casey.connolly@linaro.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/samsung,sofef00.yaml,drivers/gpu/drm/panel/panel-samsung-sofef00.c
DRM DRIVER FOR SHARP MEMORY LCD #
- Mail: Alex Lanzano <lanzano.alex@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/sharp,ls010b7dh04.yaml,drivers/gpu/drm/tiny/sharp-memory.c
DRM DRIVER FOR SITRONIX ST7586 PANELS #
- Mail: David Lechner <david@lechnology.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/sitronix,st7586.yaml,drivers/gpu/drm/sitronix/st7586.c
DRM DRIVER FOR SITRONIX ST7571 PANELS #
- Mail: Marcus Folkesson <marcus.folkesson@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/sitronix,st7567.yaml,Documentation/devicetree/bindings/display/sitronix,st7571.yaml,drivers/gpu/drm/sitronix/st7571-i2c.c,drivers/gpu/drm/sitronix/st7571-spi.c,drivers/gpu/drm/sitronix/st7571.c,drivers/gpu/drm/sitronix/st7571.h
DRM DRIVER FOR SITRONIX ST7701 PANELS #
- Mail: Jagan Teki <jagan@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/sitronix,st7701.yaml,drivers/gpu/drm/panel/panel-sitronix-st7701.c
DRM DRIVER FOR SITRONIX ST7703 PANELS #
- Mail: Guido Günther <agx@sigxcpu.org>
- Reviewer: Purism Kernel Team <kernel@puri.sm>, Ondrej Jirman <megi@xff.cz>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml,drivers/gpu/drm/panel/panel-sitronix-st7703.c
DRM DRIVER FOR SITRONIX ST7735R PANELS #
- Mail: David Lechner <david@lechnology.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml,drivers/gpu/drm/sitronix/st7735r.c
DRM DRIVER FOR SITRONIX ST7920 LCD DISPLAYS #
- Mail: Iker Pedrosa <ikerpedrosam@gmail.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/sitronix,st7920.yaml,drivers/gpu/drm/sitronix/st7920.c
DRM DRIVER FOR SOLOMON SSD130X OLED DISPLAYS #
- Mail: Javier Martinez Canillas <javierm@redhat.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/solomon,ssd-common.yaml,Documentation/devicetree/bindings/display/solomon,ssd13*.yaml,drivers/gpu/drm/solomon/ssd130x*
DRM DRIVER FOR ST-ERICSSON MCDE #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/ste,mcde.yaml,drivers/gpu/drm/mcde/
DRM DRIVER FOR SYNAPTICS R63353 PANELS #
- Mail: Michael Trimarchi <michael@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/panel/synaptics,r63353.yaml,drivers/gpu/drm/panel/panel-synaptics-r63353.c
DRM DRIVER FOR SYNOPSYS DESIGNWARE DISPLAYPORT BRIDGE #
- Mail: Andy Yan <andy.yan@rock-chips.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-dp.yaml,drivers/gpu/drm/bridge/synopsys/dw-dp.c,include/drm/bridge/dw_dp.h
DRM DRIVER FOR TI DLPC3433 MIPI DSI TO DMD BRIDGE #
- Mail: Jagan Teki <jagan@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/bridge/ti,dlpc3433.yaml,drivers/gpu/drm/bridge/ti-dlpc3433.c
DRM DRIVER FOR TI SN65DSI86 BRIDGE CHIP #
- Reviewer: Douglas Anderson <dianders@chromium.org>
- Files:
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml,drivers/gpu/drm/bridge/ti-sn65dsi86.c
DRM DRIVER FOR TPO TPG110 PANELS #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/tpo,tpg110.yaml,drivers/gpu/drm/panel/panel-tpo-tpg110.c
DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS #
- Mail: Dave Airlie <airlied@redhat.com>
- Reviewer: Sean Paul <sean@poorly.run>, Thomas Zimmermann <tzimmermann@suse.de>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/udl/
DRM DRIVER FOR VIRTUAL KERNEL MODESETTING (VKMS) #
- Mail: Louis Chauvet <louis.chauvet@bootlin.com>
- Reviewer: Haneen Mohammed <hamohammed.sa@gmail.com>, Simona Vetter <simona@ffwll.ch>, Melissa Wen <melissa.srw@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/gpu/vkms.rst,drivers/gpu/drm/ci/xfails/vkms*,drivers/gpu/drm/vkms/
DRM DRIVER FOR VIRTUALBOX VIRTUAL GPU #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/vboxvideo/
DRM DRIVER FOR VMWARE VIRTUAL GPU #
- Mail: Zack Rusin <zack.rusin@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/vmwgfx/,include/uapi/drm/vmwgfx_drm.h
DRM DRIVER FOR WIDECHIPS WS2401 PANELS #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml,drivers/gpu/drm/panel/panel-widechips-ws2401.c
DRM DRIVERS #
- Mail: David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- bugs: https://gitlab.freedesktop.org/drm
- chat: irc://irc.oftc.net/dri-devel
- SCM: git https://gitlab.freedesktop.org/drm/kernel.git
- Files:
Documentation/devicetree/bindings/display/,Documentation/devicetree/bindings/gpu/,Documentation/gpu/,drivers/gpu/,rust/kernel/drm/,include/drm/,include/linux/vga*,include/uapi/drm/
DRM DRIVERS AND MISC GPU PATCHES #
- Mail: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>
- Status: Maintained
- Web-page: https://drm.pages.freedesktop.org/maintainer-tools/drm-misc.html
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/,Documentation/devicetree/bindings/gpu/,Documentation/gpu/,drivers/gpu/drm/,drivers/gpu/vga/,include/drm/drm,include/linux/vga*,include/uapi/drm/ - Excluded:
drivers/gpu/drm/amd/,drivers/gpu/drm/armada/,drivers/gpu/drm/etnaviv/,drivers/gpu/drm/exynos/,drivers/gpu/drm/i915/,drivers/gpu/drm/kmb/,drivers/gpu/drm/mediatek/,drivers/gpu/drm/msm/,drivers/gpu/drm/nova/,drivers/gpu/drm/radeon/,drivers/gpu/drm/tegra/,drivers/gpu/drm/tyr/,drivers/gpu/drm/xe/
DRM DRIVERS AND COMMON INFRASTRUCTURE [RUST] #
- Mail: Danilo Krummrich <dakr@kernel.org>, Alice Ryhl <aliceryhl@google.com>
- Status: Supported
- Web-page: https://drm.pages.freedesktop.org/maintainer-tools/drm-rust.html
- SCM: git https://gitlab.freedesktop.org/drm/rust/kernel.git
- Files:
drivers/gpu/drm/nova/,drivers/gpu/drm/tyr/,drivers/gpu/nova-core/,rust/kernel/drm/
DRM DRIVERS FOR ALLWINNER A10 #
- Mail: Chen-Yu Tsai <wens@kernel.org>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/allwinner*,drivers/gpu/drm/sun4i/
DRM DRIVERS FOR AMLOGIC SOCS #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>
- Mailing list: dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org
- Status: Supported
- Web-page: http://linux-meson.com/
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml,Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml,Documentation/gpu/meson.rst,drivers/gpu/drm/ci/xfails/meson*,drivers/gpu/drm/meson/
DRM DRIVERS FOR ATMEL HLCDC #
- Mail: Manikandan Muralidharan <manikandan.m@microchip.com>, Dharma Balasubiramani <dharma.b@microchip.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/atmel/,drivers/gpu/drm/atmel-hlcdc/
DRM DRIVERS FOR BRIDGE CHIPS #
- Mail: Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>
- Reviewer: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/bridge/,drivers/gpu/drm/bridge/,drivers/gpu/drm/display/drm_bridge_connector.c,drivers/gpu/drm/drm_bridge.c,include/drm/drm_bridge.h,include/drm/drm_bridge_connector.h
DRM DRIVERS FOR EXYNOS #
- Mail: Inki Dae <inki.dae@samsung.com>, Seung-Woo Kim <sw0312.kim@samsung.com>, Kyungmin Park <kyungmin.park@samsung.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
- Files:
Documentation/devicetree/bindings/display/samsung/,drivers/gpu/drm/exynos/,include/uapi/drm/exynos_drm.h
DRM DRIVERS FOR FREESCALE DCU #
- Mail: Stefan Agner <stefan@agner.ch>, Alison Wang <alison.wang@nxp.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/fsl,ls1021a-dcu.yaml,Documentation/devicetree/bindings/display/fsl,vf610-tcon.yaml,drivers/gpu/drm/fsl-dcu/
DRM DRIVERS FOR FREESCALE IMX 5/6 #
- Mail: Philipp Zabel <p.zabel@pengutronix.de>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git, git git://git.pengutronix.de/git/pza/linux
- Files:
Documentation/devicetree/bindings/display/imx/,drivers/gpu/drm/imx/ipuv3/,drivers/gpu/ipu-v3/
DRM DRIVERS FOR FREESCALE IMX8 DISPLAY CONTROLLER #
- Mail: Liu Ying <victor.liu@nxp.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/imx/fsl,imx8qxp-dc*.yaml,drivers/gpu/drm/imx/dc/
DRM DRIVERS FOR FREESCALE IMX BRIDGE #
- Mail: Liu Ying <victor.liu@nxp.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-ldb.yaml,Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml,Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml,Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml,drivers/gpu/drm/bridge/imx/
DRM DRIVERS FOR GMA500 (Poulsbo, Moorestown and derivative chipsets) #
- Mail: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/gma500/
DRM DRIVERS FOR HISILICON #
- Mail: Xinliang Liu <xinliang.liu@linaro.org>, Tian Tao <tiantao6@hisilicon.com>
- Reviewer: Xinwei Kong <kong.kongxinwei@hisilicon.com>, Sumit Semwal <sumit.semwal@linaro.org>, Yongqin Liu <yongqin.liu@linaro.org>, John Stultz <jstultz@google.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/hisilicon/,drivers/gpu/drm/hisilicon/
DRM DRIVERS FOR LIMA #
- Mail: Qiang Yu <yuq825@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/lima/,include/uapi/drm/lima_drm.h
DRM DRIVERS FOR LOONGSON #
- Mail: Jianmin Lv <lvjianmin@loongson.cn>, Qianhai Wu <wuqianhai@loongson.cn>
- Reviewer: Huacai Chen <chenhuacai@kernel.org>, Mingcong Bai <jeffbai@aosc.io>, Xi Ruoyao <xry111@xry111.site>, Icenowy Zheng <zhengxingda@iscas.ac.cn>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/loongson/
DRM DRIVERS FOR MEDIATEK #
- Mail: Chun-Kuang Hu <chunkuang.hu@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>
- Mailing list: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/display/mediatek/,drivers/gpu/drm/ci/xfails/mediatek*,drivers/gpu/drm/mediatek/,drivers/phy/mediatek/phy-mtk-dp.c,drivers/phy/mediatek/phy-mtk-hdmi*,drivers/phy/mediatek/phy-mtk-mipi*
DRM DRIVERS FOR NVIDIA TEGRA #
- Mail: Thierry Reding <thierry.reding@gmail.com>, Mikko Perttunen <mperttunen@nvidia.com>
- Mailing list: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/tegra.git
- Files:
Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml,Documentation/devicetree/bindings/gpu/host1x/,drivers/gpu/drm/tegra/,drivers/gpu/host1x/,include/linux/host1x.h,include/uapi/drm/tegra_drm.h
DRM DRIVERS FOR PRE-DCP APPLE DISPLAY OUTPUT #
- Mail: Sasha Finkelstein <fnkl.kernel@gmail.com>
- Reviewer: Janne Grunau <j@jannau.net>
- Mailing list: dri-devel@lists.freedesktop.org, asahi@lists.linux.dev
- Status: Maintained
- Web-page: https://asahilinux.org
- bugs: https://github.com/AsahiLinux/linux/issues
- chat: irc://irc.oftc.net/asahi-dev
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/apple,h7-display-pipe-mipi.yaml,Documentation/devicetree/bindings/display/apple,h7-display-pipe.yaml,Documentation/devicetree/bindings/display/panel/apple,summit.yaml,drivers/gpu/drm/adp/,drivers/gpu/drm/panel/panel-summit.c
DRM DRIVERS FOR RENESAS R-CAR #
- Mail: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>, Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
- Reviewer: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
- Mailing list: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/bridge/renesas,dsi-csi2-tx.yaml,Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.yaml,Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml,Documentation/devicetree/bindings/display/renesas,du.yaml,drivers/gpu/drm/renesas/rcar-du/
DRM DRIVERS FOR RENESAS RZ #
- Mail: Biju Das <biju.das.jz@bp.renesas.com>
- Mailing list: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/renesas,rzg2l-du.yaml,drivers/gpu/drm/renesas/rz-du/
DRM DRIVERS FOR RENESAS SHMOBILE #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Geert Uytterhoeven <geert+renesas@glider.be>
- Mailing list: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/renesas,shmobile-lcdc.yaml,drivers/gpu/drm/renesas/shmobile/,include/linux/platform_data/shmob_drm.h
DRM DRIVERS FOR ROCKCHIP #
- Mail: Sandy Huang <hjc@rock-chips.com>, Heiko Stübner <heiko@sntech.de>, Andy Yan <andy.yan@rock-chips.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/rockchip/,drivers/gpu/drm/ci/xfails/rockchip*,drivers/gpu/drm/rockchip/
DRM DRIVERS FOR STI #
- Mail: Alain Volmat <alain.volmat@foss.st.com>, Raphael Gallais-Pou <rgallaispou@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/st,stih4xx.txt,drivers/gpu/drm/sti
DRM DRIVERS FOR STM #
- Mail: Yannick Fertre <yannick.fertre@foss.st.com>, Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>, Philippe Cornu <philippe.cornu@foss.st.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/st,stm32-ltdc.yaml,Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml,drivers/gpu/drm/stm
DRM DRIVERS FOR TI KEYSTONE #
- Mail: Jyri Sarha <jyri.sarha@iki.fi>, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/ti/ti,am625-oldi.yaml,Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml,Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml,Documentation/devicetree/bindings/display/ti/ti,k2g-dss.yaml,drivers/gpu/drm/tidss/
DRM DRIVERS FOR TI LCDC #
- Mail: Jyri Sarha <jyri.sarha@iki.fi>, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/tilcdc/,drivers/gpu/drm/tilcdc/
DRM DRIVERS FOR TI OMAP #
- Mail: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/ti/,drivers/gpu/drm/omapdrm/
DRM DRIVERS FOR V3D #
- Mail: Melissa Wen <mwen@igalia.com>, Maíra Canal <mcanal@igalia.com>
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml,drivers/gpu/drm/v3d/,include/uapi/drm/v3d_drm.h
DRM DRIVERS FOR VC4 #
- Mail: Maxime Ripard <mripard@kernel.org>, Dave Stevenson <dave.stevenson@raspberrypi.com>
- Reviewer: Maíra Canal <mcanal@igalia.com>, Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/brcm,bcm2835-*.yaml,drivers/gpu/drm/vc4/,include/uapi/drm/vc4_drm.h
DRM DRIVERS FOR VIVANTE GPU IP #
- Mail: Lucas Stach <l.stach@pengutronix.de>
- Reviewer: Russell King <linux+etnaviv@armlinux.org.uk>, Christian Gmeiner <christian.gmeiner@gmail.com>
- Mailing list: etnaviv@lists.freedesktop.org (moderated for non-subscribers), dri-devel@lists.freedesktop.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpu/vivante,gc.yaml,drivers/gpu/drm/etnaviv/,include/uapi/drm/etnaviv_drm.h
DRM DRIVERS FOR XEN #
- Mail: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
- Mailing list: dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/gpu/xen-front.rst,drivers/gpu/drm/xen/
DRM DRIVERS FOR XILINX #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/xlnx/,Documentation/gpu/zynqmp.rst,drivers/gpu/drm/xlnx/
DRM GPU SCHEDULER #
- Mail: Matthew Brost <matthew.brost@intel.com>, Danilo Krummrich <dakr@kernel.org>, Philipp Stanner <phasta@kernel.org>
- Reviewer: Christian König <ckoenig.leichtzumerken@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/scheduler/,include/drm/gpu_scheduler.h,include/drm/spsc_queue.h
DRM GPUVM #
- Mail: Danilo Krummrich <dakr@kernel.org>
- Reviewer: Matthew Brost <matthew.brost@intel.com>, Thomas Hellström <thomas.hellstrom@linux.intel.com>, Alice Ryhl <aliceryhl@google.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/drm_gpuvm.c,include/drm/drm_gpuvm.h
DRM LOG #
- Mail: Jocelyn Falempe <jfalempe@redhat.com>, Javier Martinez Canillas <javierm@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/clients/drm_log.c
DRM PANEL DRIVERS #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>
- Reviewer: Jessica Zhang <jesszhan0024@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/panel/,drivers/gpu/drm/drm_panel.c,drivers/gpu/drm/panel/,include/drm/drm_panel.h
DRM PANIC #
- Mail: Jocelyn Falempe <jfalempe@redhat.com>, Javier Martinez Canillas <javierm@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/drm_draw.c,drivers/gpu/drm/drm_draw_internal.h,drivers/gpu/drm/drm_panic*.c,drivers/gpu/drm/tests/drm_panic_test.c,include/drm/drm_panic*
DRM PANIC QR CODE #
- Mail: Jocelyn Falempe <jfalempe@redhat.com>, Javier Martinez Canillas <javierm@redhat.com>
- Mailing list: dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/drm_panic_qr.rs
DRM PRIVACY-SCREEN CLASS #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/drm_privacy_screen*,include/drm/drm_privacy_screen*
DRM TTM SUBSYSTEM #
- Mail: Christian Koenig <christian.koenig@amd.com>, Huang Rui <ray.huang@amd.com>
- Reviewer: Matthew Auld <matthew.auld@intel.com>, Matthew Brost <matthew.brost@intel.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/ttm/,include/drm/ttm/
DRM BUDDY ALLOCATOR #
- Mail: Matthew Auld <matthew.auld@intel.com>, Arun Pravin <arunpravin.paneerselvam@amd.com>
- Reviewer: Christian Koenig <christian.koenig@amd.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/drm_buddy.c,drivers/gpu/drm/tests/drm_buddy_test.c,include/drm/drm_buddy.h
DRM AUTOMATED TESTING #
- Mail: Helen Koike <helen.fornazier@gmail.com>, Vignesh Raman <vignesh.raman@collabora.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/gpu/automated_testing.rst,drivers/gpu/drm/ci/
DSBR100 USB FM RADIO DRIVER #
- Mail: Alexey Klimov <alexey.klimov@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/dsbr100.c
DT3155 MEDIA DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/dt3155/
DVB_USB_AF9015 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/af9015*
DVB_USB_AF9035 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/af9035*
DVB_USB_ANYSEE MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/anysee*
DVB_USB_AU6610 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/au6610*
DVB_USB_CE6230 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/ce6230*
DVB_USB_CXUSB MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/dvb-usb/cxusb*
DVB_USB_EC168 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/ec168*
DVB_USB_GL861 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/gl861*
DVB_USB_MXL111SF MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/mxl111sf.git
- Files:
drivers/media/usb/dvb-usb-v2/mxl111sf*
DVB_USB_RTL28XXU MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/rtl28xxu*
DVB_USB_V2 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org, http://palosaari.fi/linux/
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/dvb_usb*,drivers/media/usb/dvb-usb-v2/usb_urb.c
DYNAMIC DEBUG #
- Mail: Jason Baron <jbaron@akamai.com>, Jim Cromie <jim.cromie@gmail.com>
- Status: Maintained
- Files:
include/linux/dynamic_debug.h,lib/dynamic_debug.c,lib/test_dynamic_debug.c
DYNAMIC INTERRUPT MODERATION #
- Mail: Tal Gilboa <talgi@nvidia.com>
- Status: Maintained
- Files:
Documentation/networking/net_dim.rst,include/linux/dim.h,lib/dim/
DYNAMIC THERMAL POWER MANAGEMENT (DTPM) #
- Mail: Daniel Lezcano <daniel.lezcano@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
- Files:
drivers/powercap/dtpm*,include/linux/dtpm.h
DZ DECSTATION DZ11 SERIAL DRIVER #
- Mail: "Maciej W. Rozycki" <macro@orcam.me.uk>
- Status: Maintained
- Files:
drivers/tty/serial/dz.*
E3X0 POWER BUTTON DRIVER #
- Mail: Moritz Fischer <moritz.fischer@ettus.com>
- Mailing list: usrp-users@lists.ettus.com
- Status: Supported
- Web-page: http://www.ettus.com
- Files:
Documentation/devicetree/bindings/input/e3x0-button.txt,drivers/input/misc/e3x0-button.c
E4000 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/e4000*
EARTH_PT1 MEDIA DRIVER #
- Mail: Akihiro Tsukada <tskd08@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/media/pci/pt1/
EARTH_PT3 MEDIA DRIVER #
- Mail: Akihiro Tsukada <tskd08@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/media/pci/pt3/
EC100 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/ec100*
ECONET MIPS PLATFORM #
- Mail: Caleb James DeLisle <cjd@cjdns.fr>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/econet,en751221-intc.yaml,Documentation/devicetree/bindings/mips/econet.yaml,Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml,arch/mips/boot/dts/econet/,arch/mips/econet/,drivers/clocksource/timer-econet-en751221.c,drivers/irqchip/irq-econet-en751221.c
ECRYPT FILE SYSTEM #
- Mail: Tyler Hicks <code@tyhicks.com>
- Mailing list: ecryptfs@vger.kernel.org
- Status: Odd Fixes
- Web-page: http://ecryptfs.org, https://launchpad.net/ecryptfs
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs.git
- Files:
Documentation/filesystems/ecryptfs.rst,fs/ecryptfs/
EDAC-AMD64 #
- Mail: Yazen Ghannam <yazen.ghannam@amd.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Supported
- Files:
drivers/edac/amd64_edac*,drivers/edac/mce_amd*
EDAC-ARMADA #
- Mail: Jan Luebbe <jlu@pengutronix.de>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/marvell,mvebu-sdram-controller.yaml,drivers/edac/armada_xp_*
EDAC-AST2500 #
- Mail: Stefan Schaeckeler <sschaeck@cisco.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/edac/aspeed,ast2400-sdram-edac.yaml,drivers/edac/aspeed_edac.c
EDAC-BLUEFIELD #
- Mail: Shravan Kumar Ramani <shravankr@nvidia.com>, David Thompson <davthompson@nvidia.com>
- Status: Supported
- Files:
drivers/edac/bluefield_edac.c
EDAC-CALXEDA #
- Mail: Andre Przywara <andre.przywara@arm.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/highbank*
EDAC-CAVIUM OCTEON #
- Mail: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- Mailing list: linux-edac@vger.kernel.org, linux-mips@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/octeon_edac*
EDAC-CAVIUM THUNDERX #
- Mail: Robert Richter <rric@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/edac/thunderx_edac*
EDAC-CORE #
- Mail: Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next
- Files:
Documentation/driver-api/edac.rst,drivers/edac/,include/linux/edac.h
EDAC-A72 #
- Mail: Vijay Balakrishna <vijayb@linux.microsoft.com>, Tyler Hicks <code@tyhicks.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Supported
- Files:
drivers/edac/a72_edac.c
EDAC-DMC520 #
- Mail: Lei Wang <lewan@microsoft.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Supported
- Files:
drivers/edac/dmc520_edac.c
EDAC-E752X #
- Mail: Mark Gross <markgross@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/e752x_edac.c
EDAC-E7XXX #
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/e7xxx_edac.c
EDAC-FSL_DDR #
- Reviewer: Frank Li <Frank.Li@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/fsl_ddr_edac.*
EDAC-GHES #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/ghes_edac.c
EDAC-I10NM #
- Mail: Tony Luck <tony.luck@intel.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/i10nm_base.c
EDAC-I3000 #
- Mailing list: linux-edac@vger.kernel.org
- Status: Orphan
- Files:
drivers/edac/i3000_edac.c
EDAC-I5000 #
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/i5000_edac.c
EDAC-I5400 #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/i5400_edac.c
EDAC-I7300 #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/i7300_edac.c
EDAC-I7CORE #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/i7core_edac.c
EDAC-I82975X #
- Mail: "Arvind R." <arvino55@gmail.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/i82975x_edac.c
EDAC-IE31200 #
- Mail: Jason Baron <jbaron@akamai.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/ie31200_edac.c
EDAC-IGEN6 #
- Mail: Tony Luck <tony.luck@intel.com>
- Reviewer: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/igen6_edac.c
EDAC-MPC85XX #
- Mail: Johannes Thumshirn <morbidrsa@gmail.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/mpc85xx_edac.[ch]
EDAC-NPCM #
- Mail: Marvin Lin <kflin@nuvoton.com>, Stanley Chu <yschu@nuvoton.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/nuvoton,npcm-memory-controller.yaml,drivers/edac/npcm_edac.c
EDAC-PASEMI #
- Mail: Egor Martovetsky <egor@pasemi.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/pasemi_edac.c
EDAC-PND2 #
- Mail: Tony Luck <tony.luck@intel.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/pnd2_edac.[ch]
EDAC-QCOM #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org, linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/qcom_edac.c
EDAC-SBRIDGE #
- Mail: Tony Luck <tony.luck@intel.com>
- Reviewer: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/sb_edac.c
EDAC-SKYLAKE #
- Mail: Tony Luck <tony.luck@intel.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/skx_*.[ch]
EDAC-TI #
- Mail: Tero Kristo <kristo@kernel.org>
- Mailing list: linux-edac@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/edac/ti_edac.c
EDIROL UA-101/UA-1000 DRIVER #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
sound/usb/misc/ua101.c
EFI TEST DRIVER #
- Mail: Ivan Hu <ivan.hu@canonical.com>, Ard Biesheuvel <ardb@kernel.org>
- Mailing list: linux-efi@vger.kernel.org
- Status: Maintained
- Files:
drivers/firmware/efi/test/
EFI VARIABLE FILESYSTEM #
- Mail: Jeremy Kerr <jk@ozlabs.org>, Ard Biesheuvel <ardb@kernel.org>
- Mailing list: linux-efi@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
- Files:
fs/efivarfs/
EFIFB FRAMEBUFFER DRIVER #
- Mail: Peter Jones <pjones@redhat.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/efifb.c
EFS FILESYSTEM #
- Status: Orphan
- Web-page: http://aeschi.ch.eu.org/efs/
- Files:
fs/efs/
EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/ethernet/ibm/ehea/
ELM327 CAN NETWORK DRIVER #
- Mail: Max Staudt <max@enpas.org>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/can/can327.rst,drivers/net/can/can327.c
EM28XX VIDEO4LINUX DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/em28xx*,drivers/media/usb/em28xx/
EMMC CMDQ HOST CONTROLLER INTERFACE (CQHCI) DRIVER #
- Mail: Adrian Hunter <adrian.hunter@intel.com>, Asutosh Das <quic_asutoshd@quicinc.com>
- Reviewer: Ritesh Harjani <ritesh.list@gmail.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Supported
- Files:
drivers/mmc/host/cqhci*
EMS CPC-PCI CAN DRIVER #
- Mail: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>, support@ems-wuensche.com
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/can/sja1000/ems_pci.c
EMULEX 10Gbps iSCSI - OneConnect DRIVER #
- Mail: Ketan Mukadam <ketan.mukadam@broadcom.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.broadcom.com
- Files:
drivers/scsi/be2iscsi/
EMULEX 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER (be2net) #
- Mail: Ajit Khaparde <ajit.khaparde@broadcom.com>, Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.emulex.com
- Files:
drivers/net/ethernet/emulex/benet/
EMULEX ONECONNECT ROCE DRIVER #
- Mail: Selvin Xavier <selvin.xavier@broadcom.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Odd Fixes
- Web-page: http://www.broadcom.com
- Files:
drivers/infiniband/hw/ocrdma/,include/uapi/rdma/ocrdma-abi.h
EMULEX/BROADCOM EFCT FC/FCOE SCSI TARGET DRIVER #
- Mail: Ram Vegesna <ram.vegesna@broadcom.com>
- Mailing list: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
- Status: Supported
- Web-page: http://www.broadcom.com
- Files:
drivers/scsi/elx/
EMULEX/BROADCOM LPFC FC/FCOE SCSI DRIVER #
- Mail: Justin Tee <justin.tee@broadcom.com>, Paul Ely <paul.ely@broadcom.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.broadcom.com
- Files:
drivers/scsi/lpfc/
ENE CB710 FLASH CARD READER DRIVER #
- Mail: Michał Mirosław <mirq-linux@rere.qmqm.pl>
- Status: Maintained
- Files:
drivers/misc/cb710/,drivers/mmc/host/cb710-mmc.*,include/linux/cb710.h
ENE KB2426 (ENE0100/ENE020XX) INFRARED RECEIVER #
- Mail: Maxim Levitsky <maximlevitsky@gmail.com>
- Status: Maintained
- Files:
drivers/media/rc/ene_ir.*
ENERGY MODEL #
- Mail: Lukasz Luba <lukasz.luba@arm.com>, "Rafael J. Wysocki" <rafael@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/netlink/specs/dev-energymodel.yaml,Documentation/power/energy-model.rst,include/linux/energy_model.h,include/uapi/linux/dev_energymodel.h,kernel/power/em_netlink*.*,kernel/power/energy_model.c
EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER #
- Mail: Laurentiu Tudor <laurentiu.tudor@nxp.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/tty/ehv_bytechan.c
EPSON S1D13XXX FRAMEBUFFER DRIVER #
- Mail: Kristoffer Ericson <kristoffer.ericson@gmail.com>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kristoffer/linux-hpc.git
- Files:
drivers/video/fbdev/s1d13xxxfb.c,include/video/s1d13xxxfb.h
EROFS FILE SYSTEM #
- Mail: Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>
- Reviewer: Yue Hu <zbestahu@gmail.com>, Jeffle Xu <jefflexu@linux.alibaba.com>, Sandeep Dhavale <dhavale@google.com>, Hongbo Li <lihongbo22@huawei.com>, Chunhai Guo <guochunhai@vivo.com>
- Mailing list: linux-erofs@lists.ozlabs.org
- Status: Maintained
- Web-page: https://erofs.docs.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
- Files:
Documentation/ABI/testing/sysfs-fs-erofs,Documentation/filesystems/erofs.rst,fs/erofs/,include/trace/events/erofs.h
ERRSEQ ERROR TRACKING INFRASTRUCTURE #
- Mail: Jeff Layton <jlayton@kernel.org>
- Status: Maintained
- Files:
include/linux/errseq.h,lib/errseq.c
ESD CAN NETWORK DRIVERS #
- Mail: Stefan Mätje <stefan.maetje@esd.eu>
- Reviewer: socketcan@esd.eu
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/can/esd/
ESD CAN/USB DRIVERS #
- Mail: Frank Jungclaus <frank.jungclaus@esd.eu>
- Reviewer: socketcan@esd.eu
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/can/usb/esd_usb.c
ESWIN DEVICETREES #
- Mail: Min Lin <linmin@eswincomputing.com>, Pinkesh Vaghela <pinkesh.vaghela@einfochips.com>, Pritesh Patel <pritesh.patel@einfochips.com>
- Status: Maintained
- SCM: git https://github.com/eswincomputing/linux-next.git
- Files:
Documentation/devicetree/bindings/riscv/eswin.yaml,arch/riscv/boot/dts/eswin/
ET131X NETWORK DRIVER #
- Mail: Mark Einon <mark.einon@gmail.com>
- Status: Odd Fixes
- Files:
drivers/net/ethernet/agere/
ETAS ES58X CAN/USB DRIVER #
- Mail: Vincent Mailhol <mailhol@kernel.org>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/devlink/etas_es58x.rst,drivers/net/can/usb/etas_es58x/
ETHERNET BRIDGE #
- Mail: Nikolay Aleksandrov <razor@blackwall.org>, Ido Schimmel <idosch@nvidia.com>
- Mailing list: bridge@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
include/linux/if_bridge.h,include/uapi/linux/if_bridge.h,include/linux/netfilter_bridge/,net/bridge/
ETHERNET PHY LIBRARY #
- Mail: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
- Reviewer: Russell King <linux@armlinux.org.uk>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-net-phydev,Documentation/devicetree/bindings/net/ethernet-connector.yaml,Documentation/devicetree/bindings/net/ethernet-phy.yaml,Documentation/devicetree/bindings/net/mdio*,Documentation/devicetree/bindings/net/qca,ar803x.yaml,Documentation/networking/phy-port.rst,Documentation/networking/phy.rst,drivers/net/mdio/,drivers/net/mdio/acpi_mdio.c,drivers/net/mdio/fwnode_mdio.c,drivers/net/mdio/of_mdio.c,drivers/net/pcs/,drivers/net/phy/,include/dt-bindings/net/qca-ar803x.h,include/linux/*mdio*.h,include/linux/linkmode.h,include/linux/mdio/*.h,include/linux/mii.h,include/linux/of_net.h,include/linux/phy.h,include/linux/phy_fixed.h,include/linux/phy_link_topology.h,include/linux/phylib_stubs.h,include/linux/platform_data/mdio-bcm-unimac.h,include/linux/platform_data/mdio-gpio.h,include/net/phy/,include/trace/events/mdio.h,include/uapi/linux/mdio.h,include/uapi/linux/mii.h,net/core/of_net.c
ETHERNET PHY LIBRARY [RUST] #
- Mail: FUJITA Tomonori <fujita.tomonori@gmail.com>
- Reviewer: Trevor Gross <tmgross@umich.edu>
- Mailing list: netdev@vger.kernel.org, rust-for-linux@vger.kernel.org
- Status: Maintained
- Files:
rust/kernel/net/phy.rs,rust/kernel/net/phy/reg.rs
EXEC & BINFMT API, ELF #
- Mail: Kees Cook <kees@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve
- Files:
Documentation/userspace-api/ELF.rst,fs/*binfmt_*.c,fs/Kconfig.binfmt,fs/exec.c,fs/tests/binfmt_*_kunit.c,fs/tests/exec_kunit.c,include/linux/binfmts.h,include/linux/elf.h,include/uapi/linux/auxvec.h,include/uapi/linux/binfmts.h,include/uapi/linux/elf.h,kernel/fork.c,mm/vma_exec.c,tools/testing/selftests/exec/ - Regex:
asm/elf.h,binfmt
EXFAT FILE SYSTEM #
- Mail: Namjae Jeon <linkinjeon@kernel.org>, Sungjong Seo <sj1557.seo@samsung.com>
- Reviewer: Yuezhang Mo <yuezhang.mo@sony.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git
- Files:
fs/exfat/
EXPRESSWIRE PROTOCOL LIBRARY #
- Mail: Duje Mihanović <duje.mihanovic@skole.hr>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
drivers/leds/leds-expresswire.c,include/linux/leds-expresswire.h
EXT2 FILE SYSTEM #
- Mail: Jan Kara <jack@suse.com>
- Mailing list: linux-ext4@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/ext2.rst - SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git
- Files:
fs/ext2/,include/linux/ext2*
EXT4 FILE SYSTEM #
- Mail: "Theodore Ts'o" <tytso@mit.edu>
- Reviewer: Andreas Dilger <adilger.kernel@dilger.ca>, Baokun Li <libaokun@linux.alibaba.com>, Jan Kara <jack@suse.cz>, Ojaswin Mujoo <ojaswin@linux.ibm.com>, Ritesh Harjani (IBM) <ritesh.list@gmail.com>, Zhang Yi <yi.zhang@huawei.com>
- Mailing list: linux-ext4@vger.kernel.org
- Status: Maintained
- Web-page: http://ext4.wiki.kernel.org
- Patchwork: http://patchwork.ozlabs.org/project/linux-ext4/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
- Files:
Documentation/filesystems/ext4/,fs/ext4/,include/trace/events/ext4.h,include/uapi/linux/ext4.h
Extended Verification Module (EVM) #
- Mail: Mimi Zohar <zohar@linux.ibm.com>, Roberto Sassu <roberto.sassu@huawei.com>
- Mailing list: linux-integrity@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
- Files:
security/integrity/,security/integrity/evm/
EXTENSIBLE FIRMWARE INTERFACE (EFI) #
- Mail: Ard Biesheuvel <ardb@kernel.org>
- Reviewer: Ilias Apalodimas <ilias.apalodimas@linaro.org>
- Mailing list: linux-efi@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
- Files:
Documentation/admin-guide/efi-stub.rst,arch/*/include/asm/efi.h,arch/*/kernel/efi.c,arch/arm/boot/compressed/efi-header.S,arch/x86/platform/efi/,drivers/firmware/efi/,include/linux/efi*.h - Excluded:
drivers/firmware/efi/cper*
EXTERNAL CONNECTOR SUBSYSTEM (EXTCON) #
- Mail: MyungJoo Ham <myungjoo.ham@samsung.com>, Chanwoo Choi <cw00.choi@samsung.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git
- Files:
Documentation/devicetree/bindings/extcon/,Documentation/driver-api/extcon.rst,Documentation/firmware-guide/acpi/extcon-intel-int3496.rst,drivers/extcon/,include/linux/extcon.h,include/linux/extcon/
EXTRA BOOT CONFIG #
- Mail: Masami Hiramatsu <mhiramat@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-trace-kernel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
- Files:
Documentation/admin-guide/bootconfig.rst,fs/proc/bootconfig.c,include/linux/bootconfig.h,lib/bootconfig-data.S,lib/bootconfig.c,tools/bootconfig/*,tools/bootconfig/scripts/*
EXTRON DA HD 4K PLUS CEC DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/cec/usb/extron-da-hd-4k-plus/
EXYNOS DP DRIVER #
- Mail: Jingoo Han <jingoohan1@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- Files:
drivers/gpu/drm/exynos/exynos_dp*
EXYNOS SYSMMU (IOMMU) driver #
- Mail: Marek Szyprowski <m.szyprowski@samsung.com>
- Mailing list: iommu@lists.linux.dev
- Status: Maintained
- Files:
drivers/iommu/exynos-iommu.c
F2FS FILE SYSTEM #
- Mail: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>
- Mailing list: linux-f2fs-devel@lists.sourceforge.net
- Status: Maintained
- Web-page: https://f2fs.wiki.kernel.org/
- Patchwork: https://patchwork.kernel.org/project/f2fs/list/
- bugs: https://bugzilla.kernel.org/enter_bug.cgi?product=File%20System&component=f2fs
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
- Files:
Documentation/ABI/testing/sysfs-fs-f2fs,Documentation/filesystems/f2fs.rst,fs/f2fs/,include/linux/f2fs_fs.h,include/trace/events/f2fs.h,include/uapi/linux/f2fs.h
F71805F HARDWARE MONITORING DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/f71805f.rst,drivers/hwmon/f71805f.c
FADDR2LINE #
- Mail: Josh Poimboeuf <jpoimboe@kernel.org>
- Status: Maintained
- Files:
scripts/faddr2line
FAILOVER MODULE #
- Mail: Sridhar Samudrala <sridhar.samudrala@intel.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/networking/failover.rst,include/net/failover.h,net/core/failover.c
FANOTIFY #
- Mail: Jan Kara <jack@suse.cz>
- Reviewer: Amir Goldstein <amir73il@gmail.com>, Matthew Bobrowski <repnop@google.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
fs/notify/fanotify/,include/linux/fanotify.h,include/uapi/linux/fanotify.h
FARADAY FOTG210 USB2 DUAL-ROLE CONTROLLER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/fotg210/
FARSYNC SYNCHRONOUS DRIVER #
- Mail: Kevin Curtis <kevin.curtis@farsite.co.uk>
- Status: Supported
- Web-page: http://www.farsite.co.uk/
- Files:
drivers/net/wan/farsync.*
FAULT INJECTION SUPPORT #
- Mail: Akinobu Mita <akinobu.mita@gmail.com>
- Status: Supported
- Files:
Documentation/fault-injection/,lib/fault-inject.c,tools/testing/fault-injection/
FBTFT Framebuffer drivers #
- Mail: Andy Shevchenko <andy@kernel.org>
- Mailing list: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org
- Status: Odd fixes
- Files:
drivers/staging/fbtft/
FC0011 TUNER DRIVER #
- Mail: Michael Buesch <m@bues.ch>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/tuners/fc0011.c,drivers/media/tuners/fc0011.h
FC2580 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/fc2580*
FCOE SUBSYSTEM (libfc, libfcoe, fcoe) #
- Mail: Hannes Reinecke <hare@suse.de>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: www.Open-FCoE.org
- Files:
drivers/scsi/fcoe/,drivers/scsi/libfc/,include/scsi/fc/,include/scsi/libfc.h,include/scsi/libfcoe.h,include/uapi/scsi/fc/
FILE LOCKING (flock() and fcntl()/lockf()) #
- Mail: Jeff Layton <jlayton@kernel.org>, Chuck Lever <chuck.lever@oracle.com>
- Reviewer: Alexander Aring <alex.aring@gmail.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
fs/fcntl.c,fs/locks.c,include/linux/fcntl.h,include/uapi/linux/fcntl.h
FILESYSTEM DIRECT ACCESS (DAX) #
- Mail: Dan Williams <dan.j.williams@intel.com>
- Reviewer: Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>
- Mailing list: linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev
- Status: Supported
- Files:
fs/dax.c,include/linux/dax.h,include/trace/events/fs_dax.h
FILESYSTEMS (VFS and infrastructure) #
- Mail: Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>
- Reviewer: Jan Kara <jack@suse.cz>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
- Files:
fs/*,include/linux/fs.h,include/linux/fs_types.h,include/uapi/linux/fs.h,include/uapi/linux/openat2.h,rust/kernel/fs.rs,rust/kernel/fs/,rust/kernel/seq_file.rs,rust/kernel/sync/poll.rs,Documentation/driver-api/early-userspace/buffer-format.rst,init/do_mounts*,init/*initramfs*
FILESYSTEMS [EXPORTFS] #
- Mail: Chuck Lever <chuck.lever@oracle.com>, Jeff Layton <jlayton@kernel.org>
- Reviewer: Amir Goldstein <amir73il@gmail.com>
- Mailing list: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org
- Status: Supported
- Files:
Documentation/filesystems/nfs/exporting.rst,fs/exportfs/,fs/fhandle.c,include/linux/exportfs.h
FILESYSTEMS [IDMAPPED MOUNTS] #
- Mail: Christian Brauner <brauner@kernel.org>, Seth Forshee <sforshee@kernel.org>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/idmappings.rst,fs/mnt_idmapping.c,include/linux/mnt_idmapping.*,tools/testing/selftests/mount_setattr/
FILESYSTEMS [IOMAP] #
- Mail: Christian Brauner <brauner@kernel.org>
- Reviewer: Darrick J. Wong <djwong@kernel.org>
- Mailing list: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
- Status: Supported
- Files:
Documentation/filesystems/iomap/*,fs/iomap/,include/linux/iomap.h
FILESYSTEMS [NETFS LIBRARY] #
- Mail: David Howells <dhowells@redhat.com>, Paulo Alcantara <pc@manguebit.org>
- Mailing list: netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org
- Status: Supported
- Files:
Documentation/filesystems/caching/,Documentation/filesystems/netfs_library.rst,fs/netfs/,include/linux/fscache*.h,include/linux/netfs.h,include/trace/events/fscache.h,include/trace/events/netfs.h
FILESYSTEMS [STACKABLE] #
- Mail: Miklos Szeredi <miklos@szeredi.hu>, Amir Goldstein <amir73il@gmail.com>
- Mailing list: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org
- Status: Maintained
- Files:
fs/backing-file.c,include/linux/backing-file.h
FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER #
- Mail: Riku Voipio <riku.voipio@iki.fi>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/f75375s.c,include/linux/f75375s.h
FINTEK F81604 USB to 2xCANBUS DEVICE DRIVER #
- Mail: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/can/usb/f81604.c
FIREWIRE AUDIO DRIVERS and IEC 61883-1/6 PACKET STREAMING ENGINE #
- Mail: Clemens Ladisch <clemens@ladisch.de>, Takashi Sakamoto <o-takashi@sakamocchi.jp>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
include/uapi/sound/firewire.h,sound/firewire/
FIREWIRE MEDIA DRIVERS (firedtv) #
- Mail: Stefan Richter <stefanr@s5r6.in-berlin.de>
- Mailing list: linux-media@vger.kernel.org, linux1394-devel@lists.sourceforge.net
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
- Files:
drivers/media/firewire/
FIREWIRE SBP-2 TARGET #
- Mail: Chris Boot <bootc@bootc.net>
- Mailing list: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux1394-devel@lists.sourceforge.net
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core-2.6.git master
- Files:
drivers/target/sbp/
FIREWIRE SUBSYSTEM #
- Mail: Takashi Sakamoto <o-takashi@sakamocchi.jp>, Takashi Sakamoto <takaswie@kernel.org>
- Mailing list: linux1394-devel@lists.sourceforge.net
- Status: Maintained
- Web-page: http://ieee1394.docs.kernel.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git
- Files:
drivers/firewire/,include/linux/firewire.h,include/uapi/linux/firewire*.h,tools/firewire/
FIRMWARE FRAMEWORK FOR ARMV8-A #
- Mail: Sudeep Holla <sudeep.holla@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/firmware/arm_ffa/,include/linux/arm_ffa.h
FIRMWARE LOADER (request_firmware) #
- Mail: Luis Chamberlain <mcgrof@kernel.org>, Russ Weight <russ.weight@linux.dev>, Danilo Krummrich <dakr@kernel.org>
- Mailing list: driver-core@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
- Files:
Documentation/firmware_class/,drivers/base/firmware_loader/,rust/kernel/firmware.rs,include/linux/firmware.h
FLEXTIMER FTM-QUADDEC DRIVER #
- Mail: Patrick Havelange <patrick.havelange@essensium.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/counter/fsl,ftm-quaddec.yaml,drivers/counter/ftm-quaddec.c
FLOPPY DRIVER #
- Mail: Denis Efremov <efremov@linux.com>
- Mailing list: linux-block@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/block/floppy.c
FLYSKY FSIA6B RC RECEIVER #
- Mail: Markus Koch <markus@notsyncing.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/joystick/fsia6b.c
FOCUSRITE CONTROL PROTOCOL/SCARLETT2 MIXER DRIVERS (Scarlett Gen 2+, Clarett, and Vocaster) #
- Mail: Geoffrey D. Bennett <g@b4.vu>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/geoffreybennett/linux-fcp
- bugs: https://github.com/geoffreybennett/linux-fcp/issues
- SCM: git https://github.com/geoffreybennett/linux-fcp.git
- Files:
include/uapi/sound/fcp.h,include/uapi/sound/scarlett2.h,sound/usb/fcp.c,sound/usb/mixer_scarlett2.c
FORCEDETH GIGABIT ETHERNET DRIVER #
- Mail: Rain River <rain.1986.08.12@gmail.com>, Zhu Yanjun <zyjzyj2000@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/nvidia/*
FORTIFY_SOURCE #
- Mail: Kees Cook <kees@kernel.org>
- Mailing list: linux-hardening@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
include/linux/fortify-string.h,lib/test_fortify/*,lib/tests/fortify_kunit.c,lib/tests/memcpy_kunit.c - Content regex:
\bunsafe_memcpy\b,\b__NO_FORTIFY\b
FOURSEMI AUDIO AMPLIFIER DRIVER #
- Mail: Nick Li <nick.li@foursemi.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/foursemi,fs2105s.yaml,sound/soc/codecs/fs-amp-lib.*,sound/soc/codecs/fs210x.*
FPGA DFL DRIVERS #
- Mail: Xu Yilun <yilun.xu@intel.com>
- Reviewer: Tom Rix <trix@redhat.com>
- Mailing list: linux-fpga@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-dfl*,Documentation/fpga/dfl.rst,drivers/fpga/dfl*,drivers/uio/uio_dfl.c,include/linux/dfl.h,include/uapi/linux/fpga-dfl.h
FPGA MANAGER FRAMEWORK #
- Mail: Moritz Fischer <mdf@kernel.org>, Xu Yilun <yilun.xu@intel.com>
- Reviewer: Tom Rix <trix@redhat.com>
- Mailing list: linux-fpga@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/linux-fpga/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga.git
- Files:
Documentation/devicetree/bindings/fpga/,Documentation/driver-api/fpga/,Documentation/fpga/,drivers/fpga/,include/linux/fpga/
FPU EMULATOR #
- Mail: Bill Metzenthen <billm@melbpc.org.au>
- Status: Maintained
- Web-page: https://floatingpoint.billm.au/
- Files:
arch/x86/math-emu/
FRAMEBUFFER CORE #
- Mail: Simona Vetter <simona@ffwll.ch>
- Status: Odd Fixes
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/video/fbdev/core/
FRAMEBUFFER DRAWING #
- Mail: Zsolt Kajtar <soci@c64.rulez.org>
- Status: Odd Fixes
- Files:
drivers/video/fbdev/core/cfbcopyarea.c,drivers/video/fbdev/core/cfbfillrect.c,drivers/video/fbdev/core/cfbimgblt.c,drivers/video/fbdev/core/cfbmem.h,drivers/video/fbdev/core/fb_copyarea.h,drivers/video/fbdev/core/fb_draw.h,drivers/video/fbdev/core/fb_fillrect.h,drivers/video/fbdev/core/fb_imageblit.h,drivers/video/fbdev/core/syscopyarea.c,drivers/video/fbdev/core/sysfillrect.c,drivers/video/fbdev/core/sysimgblt.c,drivers/video/fbdev/core/sysmem.h
FRAMEBUFFER LAYER #
- Mail: Helge Deller <deller@gmx.de>
- Mailing list: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/linux-fbdev/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev.git
- Files:
Documentation/fb/,drivers/video/,include/linux/fb.h,include/uapi/linux/fb.h,include/uapi/video/,include/video/
FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER #
- Mail: Horia Geantă <horia.geanta@nxp.com>, Pankaj Gupta <pankaj.gupta@nxp.com>, Gaurav Jain <gaurav.jain@nxp.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/fsl,sec-v4.0*,drivers/crypto/caam/
FREESCALE COLDFIRE M5441X MMC DRIVER #
- Mail: Angelo Dureghello <adureghello@baylibre.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-esdhc-mcf.c,include/linux/platform_data/mmc-esdhc-mcf.h
FREESCALE DIU FRAMEBUFFER DRIVER #
- Mail: Timur Tabi <timur@kernel.org>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/fsl-diu-fb.*
FREESCALE DMA DRIVER #
- Mail: Zhang Wei <zw@zh-kernel.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/dma/fsldma.*
FREESCALE DSPI DRIVER #
- Mail: Vladimir Oltean <olteanv@gmail.com>
- Mailing list: linux-spi@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/fsl,dspi*.yaml,drivers/spi/spi-fsl-dspi.c,include/linux/spi/spi-fsl-dspi.h
FREESCALE eDMA DRIVER #
- Mail: Frank Li <Frank.Li@nxp.com>
- Mailing list: imx@lists.linux.dev, dmaengine@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/fsl,edma.yaml,drivers/dma/fsl-edma*.*
FREESCALE ENETC ETHERNET DRIVERS #
- Mail: Claudiu Manoil <claudiu.manoil@nxp.com>, Vladimir Oltean <vladimir.oltean@nxp.com>, Wei Fang <wei.fang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>
- Mailing list: imx@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/fsl,enetc*.yaml,Documentation/devicetree/bindings/net/nxp,netc-blk-ctrl.yaml,drivers/net/ethernet/freescale/enetc/,include/linux/fsl/enetc_mdio.h,include/linux/fsl/netc_global.h,include/linux/fsl/ntmp.h
FREESCALE eTSEC ETHERNET DRIVER (GIANFAR) #
- Mail: Claudiu Manoil <claudiu.manoil@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/fsl-tsec-phy.txt,drivers/net/ethernet/freescale/gianfar*
FREESCALE GPMI NAND DRIVER #
- Mail: Han Xu <han.xu@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/nand/raw/gpmi-nand/*
FREESCALE I2C CPM DRIVER #
- Mail: Jochen Friedrich <jochen@scram.de>
- Mailing list: linuxppc-dev@lists.ozlabs.org, linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-cpm.c
FREESCALE IMX / MXC FEC DRIVER #
- Mail: Wei Fang <wei.fang@nxp.com>
- Reviewer: Frank Li <frank.li@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>
- Mailing list: imx@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/fsl,fec.yaml,drivers/net/ethernet/freescale/fec.h,drivers/net/ethernet/freescale/fec_main.c,drivers/net/ethernet/freescale/fec_ptp.c
FREESCALE IMX / MXC FRAMEBUFFER DRIVER #
- Mail: Sascha Hauer <s.hauer@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Mailing list: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/video/fbdev/imxfb.c
FREESCALE IMX DDR PMU DRIVER #
- Mail: Frank Li <Frank.li@nxp.com>, Xu Yang <xu.yang_2@nxp.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/admin-guide/perf/imx-ddr.rst,Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml,drivers/perf/fsl_imx8_ddr_perf.c,drivers/perf/fsl_imx9_ddr_perf.c,tools/perf/pmu-events/arch/arm64/freescale/
FREESCALE IMX I2C DRIVER #
- Mail: Oleksij Rempel <o.rempel@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/i2c-imx.yaml,drivers/i2c/busses/i2c-imx.c
FREESCALE IMX LPI2C DRIVER #
- Mail: Dong Aisheng <aisheng.dong@nxp.com>
- Mailing list: linux-i2c@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml,drivers/i2c/busses/i2c-imx-lpi2c.c
FREESCALE IMX LPSPI DRIVER #
- Mail: Frank Li <Frank.Li@nxp.com>
- Mailing list: linux-spi@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml,drivers/spi/spi-fsl-lpspi.c
FREESCALE MPC I2C DRIVER #
- Mail: Chris Packham <chris.packham@alliedtelesis.co.nz>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/i2c-mpc.yaml,drivers/i2c/busses/i2c-mpc.c
FREESCALE QORIQ DPAA ETHERNET DRIVER #
- Mail: Madalin Bucur <madalin.bucur@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/freescale/dpaa
FREESCALE QORIQ DPAA FMAN DRIVER #
- Mail: Madalin Bucur <madalin.bucur@nxp.com>
- Reviewer: Sean Anderson <sean.anderson@seco.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/fsl,fman*.yaml,drivers/net/ethernet/freescale/fman
FREESCALE QORIQ PTP CLOCK DRIVER #
- Mail: Yangbo Lu <yangbo.lu@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/ptp/fsl,ptp.yaml,drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp*,drivers/net/ethernet/freescale/dpaa2/dprtc*,drivers/net/ethernet/freescale/enetc/enetc_ptp.c,drivers/ptp/ptp_qoriq.c,include/linux/fsl/ptp_qoriq.h
FREESCALE QUAD SPI DRIVER #
- Mail: Han Xu <han.xu@nxp.com>
- Mailing list: linux-spi@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/fsl,spi-fsl-qspi.yaml,drivers/spi/spi-fsl-qspi.c
FREESCALE QUICC ENGINE LIBRARY #
- Mail: Qiang Zhao <qiang.zhao@nxp.com>, Christophe Leroy (CS GROUP) <chleroy@kernel.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/soc/fsl/qe/,include/soc/fsl/qe/
FREESCALE QUICC ENGINE QMC DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml,Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml,drivers/soc/fsl/qe/qmc.c,include/soc/fsl/qe/qmc.h
FREESCALE QUICC ENGINE QMC HDLC DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/net/wan/fsl_qmc_hdlc.c
FREESCALE QUICC ENGINE TSA DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml,Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml,drivers/soc/fsl/qe/tsa.c,drivers/soc/fsl/qe/tsa.h,include/dt-bindings/soc/cpm1-fsl,tsa.h,include/dt-bindings/soc/qe-fsl,tsa.h
FREESCALE QUICC ENGINE UCC ETHERNET DRIVER #
- Mailing list: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
drivers/net/ethernet/freescale/ucc_geth*
FREESCALE QUICC ENGINE UCC HDLC DRIVER #
- Mail: Zhao Qiang <qiang.zhao@nxp.com>
- Mailing list: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/net/wan/fsl_ucc_hdlc*
FREESCALE QUICC ENGINE UCC UART DRIVER #
- Mail: Timur Tabi <timur@kernel.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/tty/serial/ucc_uart.c
FREESCALE SOC DRIVERS #
- Mail: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml,Documentation/devicetree/bindings/soc/fsl/,drivers/soc/fsl/,include/linux/fsl/,include/soc/fsl/
FREESCALE SOC FS_ENET DRIVER #
- Mail: Pantelis Antoniou <pantelis.antoniou@gmail.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/freescale/fs_enet/
FREESCALE SOC SOUND DRIVERS #
- Mail: Shengjiu Wang <shengjiu.wang@gmail.com>, Xiubo Li <Xiubo.Lee@gmail.com>
- Reviewer: Fabio Estevam <festevam@gmail.com>, Nicolin Chen <nicoleotsuka@gmail.com>
- Mailing list: linux-sound@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
sound/soc/fsl/fsl*,sound/soc/fsl/imx*
FREESCALE SOC LPC32XX SOUND DRIVERS #
- Mail: J.M.B. Downing <jonathan.downing@nautel.com>, Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
- Reviewer: Vladimir Zapolskiy <vz@mleia.com>
- Mailing list: linux-sound@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/nxp,lpc3220-i2s.yaml,sound/soc/fsl/lpc3xxx-*
FREESCALE SOC SOUND QMC DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-sound@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/fsl,qmc-audio.yaml,sound/soc/fsl/fsl_qmc_audio.c
FREESCALE USB PERIPHERAL DRIVERS #
- Mailing list: linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
drivers/usb/gadget/udc/fsl*
FREESCALE USB PHY DRIVER #
- Mailing list: linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
drivers/usb/phy/phy-fsl-usb*
FREEVXFS FILESYSTEM #
- Mail: Christoph Hellwig <hch@infradead.org>
- Status: Maintained
- Web-page: ftp://ftp.openlinux.org/pub/people/hch/vxfs
- Files:
fs/freevxfs/
FREEZER #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Reviewer: Pavel Machek <pavel@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Files:
Documentation/power/freezing-of-tasks.rst,include/linux/freezer.h,kernel/freezer.c
FSCRYPT: FILE SYSTEM LEVEL ENCRYPTION SUPPORT #
- Mail: Eric Biggers <ebiggers@kernel.org>, Theodore Y. Ts'o <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>
- Mailing list: linux-fscrypt@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-fscrypt/list/
- SCM: git https://git.kernel.org/pub/scm/fs/fscrypt/linux.git
- Files:
Documentation/filesystems/fscrypt.rst,fs/crypto/,include/linux/fscrypt.h,include/uapi/linux/fscrypt.h
FSI SUBSYSTEM #
- Mail: Eddie James <eajames@linux.ibm.com>
- Reviewer: Ninad Palsule <ninad@linux.ibm.com>
- Mailing list: linux-fsi@lists.ozlabs.org
- Status: Supported
- Patchwork: http://patchwork.ozlabs.org/project/linux-fsi/list/
- Files:
Documentation/devicetree/bindings/fsi/,drivers/fsi/,include/linux/fsi*.h,include/trace/events/fsi*.h
FSI-ATTACHED I2C DRIVER #
- Mail: Eddie James <eajames@linux.ibm.com>
- Mailing list: linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/ibm,i2c-fsi.yaml,drivers/i2c/busses/i2c-fsi.c
FSI-ATTACHED SPI DRIVER #
- Mail: Eddie James <eajames@linux.ibm.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/fsi/ibm,fsi2spi.yaml,drivers/spi/spi-fsi.c
FSNOTIFY: FILESYSTEM NOTIFICATION INFRASTRUCTURE #
- Mail: Jan Kara <jack@suse.cz>
- Reviewer: Amir Goldstein <amir73il@gmail.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fsnotify
- Files:
fs/notify/,include/linux/fsnotify*.h
FSVERITY: READ-ONLY FILE-BASED AUTHENTICITY PROTECTION #
- Mail: Eric Biggers <ebiggers@kernel.org>, Theodore Y. Ts'o <tytso@mit.edu>
- Mailing list: fsverity@lists.linux.dev
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/fsverity/list/
- SCM: git https://git.kernel.org/pub/scm/fs/fsverity/linux.git
- Files:
Documentation/filesystems/fsverity.rst,fs/verity/,include/linux/fsverity.h,include/trace/events/fsverity.h,include/uapi/linux/fsverity.h
FT260 FTDI USB-HID TO I2C BRIDGE DRIVER #
- Mail: Michael Zaidman <michael.zaidman@gmail.com>
- Mailing list: linux-i2c@vger.kernel.org, linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-ft260.c
FUJITSU LAPTOP EXTRAS #
- Mail: Jonathan Woithe <jwoithe@just42.net>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/fujitsu-laptop.c
FUJITSU TABLET EXTRAS #
- Mail: Robert Gerlach <khnz@gmx.de>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/fujitsu-tablet.c
FUNCTION HOOKS (FTRACE) #
- Mail: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>
- Reviewer: Mark Rutland <mark.rutland@arm.com>
- Mailing list: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-trace-kernel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
- Files:
Documentation/trace/ftrace*,arch/*/*/*/*ftrace*,arch/*/*/*ftrace*,include/*/*ftrace*,kernel/trace/fgraph.c,kernel/trace/ftrace*,samples/ftrace
FUNGIBLE ETHERNET DRIVERS #
- Mail: Dimitris Michailidis <dmichail@fungible.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/fungible/
FUSE: FILESYSTEM IN USERSPACE #
- Mail: Miklos Szeredi <miklos@szeredi.hu>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/libfuse/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git
- Files:
Documentation/filesystems/fuse/*,fs/fuse/,include/uapi/linux/fuse.h,tools/testing/selftests/filesystems/fuse/
FUTEX SUBSYSTEM #
- Mail: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>
- Reviewer: Peter Zijlstra <peterz@infradead.org>, Darren Hart <dvhart@infradead.org>, Davidlohr Bueso <dave@stgolabs.net>, André Almeida <andrealmeid@igalia.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
- Files:
Documentation/locking/*futex*,include/asm-generic/futex.h,include/linux/futex.h,include/uapi/linux/futex.h,kernel/futex/*,tools/perf/bench/futex*,tools/testing/selftests/futex/
FWCTL SUBSYSTEM #
- Mail: Dave Jiang <dave.jiang@intel.com>, Jason Gunthorpe <jgg@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>
- Reviewer: Jonathan Cameron <Jonathan.Cameron@huawei.com>
- Status: Maintained
- Files:
Documentation/userspace-api/fwctl/,drivers/fwctl/,include/linux/fwctl.h,include/uapi/fwctl/
FWCTL MLX5 DRIVER #
- Mail: Saeed Mahameed <saeedm@nvidia.com>
- Reviewer: Itay Avraham <itayavr@nvidia.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/fwctl/mlx5/
FWCTL PDS DRIVER #
- Mail: Brett Creeley <brett.creeley@amd.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/fwctl/pds/
GALAXYCORE GC0308 CAMERA SENSOR DRIVER #
- Mail: Sebastian Reichel <sre@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/galaxycore,gc0308.yaml,drivers/media/i2c/gc0308.c
GALAXYCORE GC0310 CAMERA SENSOR DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/gc0310.c
GALAXYCORE GC05a2 CAMERA SENSOR DRIVER #
- Mail: Zhi Mao <zhi.mao@mediatek.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/galaxycore,gc05a2.yaml,drivers/media/i2c/gc05a2.c
GALAXYCORE GC08A3 CAMERA SENSOR DRIVER #
- Mail: Zhi Mao <zhi.mao@mediatek.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/galaxycore,gc08a3.yaml,drivers/media/i2c/gc08a3.c
GALAXYCORE GC2145 SENSOR DRIVER #
- Mail: Alain Volmat <alain.volmat@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml,drivers/media/i2c/gc2145.c
GATEWORKS SYSTEM CONTROLLER (GSC) DRIVER #
- Mail: Tim Harvey <tharvey@gateworks.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/embedded-controller/gw,gsc.yaml,Documentation/hwmon/gsc-hwmon.rst,drivers/hwmon/gsc-hwmon.c,drivers/mfd/gateworks-gsc.c,include/linux/mfd/gsc.h,include/linux/platform_data/gsc_hwmon.h
GCC PLUGINS #
- Mail: Kees Cook <kees@kernel.org>
- Mailing list: linux-hardening@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
Documentation/kbuild/gcc-plugins.rst,scripts/Makefile.gcc-plugins,scripts/gcc-plugins/
GCOV BASED KERNEL PROFILING #
- Mail: Peter Oberparleiter <oberpar@linux.ibm.com>
- Status: Maintained
- Files:
Documentation/dev-tools/gcov.rst,kernel/gcov/
GDB KERNEL DEBUGGING HELPER SCRIPTS #
- Mail: Jan Kiszka <jan.kiszka@siemens.com>, Kieran Bingham <kbingham@kernel.org>
- Status: Supported
- Files:
scripts/gdb/
GE HEALTHCARE PMC ADC DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/gehc,pmc-adc.yaml,drivers/iio/adc/gehc-pmc-adc.c,include/dt-bindings/iio/adc/gehc,pmc-adc.h
GEMINI CRYPTO DRIVER #
- Mail: Corentin Labbe <clabbe@baylibre.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/gemini/
GEMTEK FM RADIO RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-gemtek*
GENDWARFKSYMS #
- Mail: Sami Tolvanen <samitolvanen@google.com>
- Mailing list: linux-modules@vger.kernel.org, linux-kbuild@vger.kernel.org
- Status: Maintained
- Files:
scripts/gendwarfksyms/
GENERIC ARCHITECTURE TOPOLOGY #
- Mail: Sudeep Holla <sudeep.holla@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/base/arch_topology.c,include/linux/arch_topology.h
GENERIC ENTRY CODE #
- Mail: Thomas Gleixner <tglx@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Andy Lutomirski <luto@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry
- Files:
include/linux/entry-common.h,include/linux/entry-virt.h,include/linux/irq-entry-common.h,kernel/entry/
GENERIC GPIO I2C DRIVER #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Status: Supported
- Files:
drivers/i2c/busses/i2c-gpio.c,include/linux/platform_data/i2c-gpio.h
GENERIC GPIO I2C MULTIPLEXER DRIVER #
- Mail: Peter Korsgaard <peter.korsgaard@barco.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
Documentation/i2c/muxes/i2c-mux-gpio.rst,drivers/i2c/muxes/i2c-mux-gpio.c,include/linux/platform_data/i2c-mux-gpio.h
GENERIC GPIO RESET DRIVER #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Status: Maintained
- Files:
drivers/reset/reset-gpio.c
GENERIC HDLC (WAN) DRIVERS #
- Mail: Krzysztof Halasa <khc@pm.waw.pl>
- Status: Maintained
- Web-page: http://www.kernel.org/pub/linux/utils/net/hdlc/
- Files:
drivers/net/wan/c101.c,drivers/net/wan/hd6457*,drivers/net/wan/hdlc*,drivers/net/wan/n2.c,drivers/net/wan/pc300too.c,drivers/net/wan/pci200syn.c,drivers/net/wan/wanxl*
GENERIC INCLUDE/ASM HEADER FILES #
- Mail: Arnd Bergmann <arnd@arndb.de>
- Mailing list: linux-arch@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git
- Files:
include/asm-generic/,include/uapi/asm-generic/
GENERIC PHY FRAMEWORK #
- Mail: Vinod Koul <vkoul@kernel.org>
- Reviewer: Neil Armstrong <neil.armstrong@linaro.org>
- Mailing list: linux-phy@lists.infradead.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-phy/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
- Files:
Documentation/devicetree/bindings/phy/,drivers/phy/,include/dt-bindings/phy/,include/linux/phy/
GENERIC PINCTRL I2C DEMULTIPLEXER DRIVER #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.yaml,drivers/i2c/muxes/i2c-demux-pinctrl.c
GENERIC PM DOMAINS #
- Mail: Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/power/power?domain* - SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
- Files:
drivers/pmdomain/,include/linux/pm_domain.h
GENERIC RADIX TREE #
- Mail: Kent Overstreet <kent.overstreet@linux.dev>
- Status: Supported
- chat: irc://irc.oftc.net/bcache
- Files:
include/linux/generic-radix-tree.h,lib/generic-radix-tree.c
GENERIC RESISTIVE TOUCHSCREEN ADC DRIVER #
- Mail: Eugen Hristev <eugen.hristev@microchip.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/resistive-adc-touch.c
GENERIC STRING LIBRARY #
- Mail: Kees Cook <kees@kernel.org>
- Reviewer: Andy Shevchenko <andy@kernel.org>
- Mailing list: linux-hardening@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
include/linux/string.h,include/linux/string_choices.h,include/linux/string_helpers.h,lib/string.c,lib/string_helpers.c,lib/tests/string_helpers_kunit.c,lib/tests/string_kunit.c,scripts/coccinelle/api/string_choices.cocci
GENERIC UIO DRIVER FOR PCI DEVICES #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- Files:
drivers/uio/uio_pci_generic.c
GENERIC VDSO LIBRARY #
- Mail: Andy Lutomirski <luto@kernel.org>, Thomas Gleixner <tglx@kernel.org>, Vincenzo Frascino <vincenzo.frascino@arm.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso
- Files:
include/asm-generic/vdso/vsyscall.h,include/vdso/,kernel/time/vsyscall.c,lib/vdso/,tools/testing/selftests/vDSO/
GENWQE (IBM Generic Workqueue Card) #
- Mail: Frank Haverkamp <haver@linux.ibm.com>
- Status: Supported
- Files:
drivers/misc/genwqe/
GET_MAINTAINER SCRIPT #
- Mail: Joe Perches <joe@perches.com>
- Status: Maintained
- Files:
scripts/get_maintainer.pl
GFS2 FILE SYSTEM #
- Mail: Andreas Gruenbacher <agruenba@redhat.com>
- Mailing list: gfs2@lists.linux.dev
- Status: Supported
- bugs: https://bugzilla.kernel.org/enter_bug.cgi?product=File%20System&component=gfs2
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git
- Files:
Documentation/filesystems/gfs2/,fs/gfs2/,include/uapi/linux/gfs2_ondisk.h
GIGABYTE WATERFORCE SENSOR DRIVER #
- Mail: Aleksa Savic <savicaleksa83@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/gigabyte_waterforce.rst,drivers/hwmon/gigabyte_waterforce.c
GIGABYTE WMI DRIVER #
- Mail: Thomas Weißschuh <linux@weissschuh.net>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/gigabyte-wmi.c
GNSS SUBSYSTEM #
- Mail: Johan Hovold <johan@kernel.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss.git
- Files:
Documentation/ABI/testing/sysfs-class-gnss,Documentation/devicetree/bindings/gnss/,drivers/gnss/,include/linux/gnss.h
GO7007 MPEG CODEC #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/usb/go7007/
GOCONTROLL MODULINE MODULE SLOT #
- Mail: Maud Spierings <maudspierings@gocontroll.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/connector/gocontroll,moduline-module-slot.yaml
GOODIX TOUCHSCREEN #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/goodix*
GOOGLE ETHERNET DRIVERS #
- Mail: Joshua Washington <joshwash@google.com>, Harshitha Ramamurthy <hramamurthy@google.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/google/gve.rst,drivers/net/ethernet/google
GOOGLE FIRMWARE DRIVERS #
- Mail: Tzung-Bi Shih <tzungbi@kernel.org>
- Reviewer: Brian Norris <briannorris@chromium.org>, Julius Werner <jwerner@chromium.org>
- Mailing list: chrome-platform@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
- Files:
drivers/firmware/google/
GOOGLE TENSOR SoC SUPPORT #
- Mail: Peter Griffin <peter.griffin@linaro.org>
- Reviewer: André Draszik <andre.draszik@linaro.org>, Tudor Ambarus <tudor.ambarus@linaro.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/process/maintainer-soc-clean-dts.rst
- chat: irc://irc.oftc.net/pixel6-kernel-dev
- Files:
Documentation/devicetree/bindings/clock/google,gs101-clock.yaml,Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml,Documentation/devicetree/bindings/soc/google/google,gs101-pmu-intr-gen.yaml,Documentation/devicetree/bindings/usb/google,lga-dwc3.yaml,arch/arm64/boot/dts/exynos/google/,drivers/clk/samsung/clk-gs101.c,drivers/phy/phy-google-usb.c,drivers/soc/samsung/gs101-pmu.c,drivers/phy/samsung/phy-gs101-ufs.c,drivers/usb/dwc3/dwc3-google.c,include/dt-bindings/clock/google,gs101* - Content regex:
[gG]oogle.?[tT]ensor
GPD FAN DRIVER #
- Mail: Cryolitia PukNgae <cryolitia@uniontech.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/gpd-fan.rst,drivers/hwmon/gpd-fan.c
GPD POCKET FAN DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/gpd-pocket-fan.c
GPIB DRIVERS #
- Mail: Dave Penkler <dpenkler@gmail.com>
- Status: Maintained
- Files:
drivers/gpib/,include/uapi/linux/gpib.h,include/uapi/linux/gpib_ioctl.h
GPIO ACPI SUPPORT #
- Mail: Mika Westerberg <westeri@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>
- Mailing list: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
- Files:
Documentation/firmware-guide/acpi/gpio-properties.rst,drivers/gpio/gpiolib-acpi-*.c,drivers/gpio/gpiolib-acpi.h
GPIO AGGREGATOR #
- Mail: Geert Uytterhoeven <geert+renesas@glider.be>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Supported
- Files:
Documentation/admin-guide/gpio/gpio-aggregator.rst,drivers/gpio/gpio-aggregator.c
GPIO IR Transmitter #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/irled/gpio-ir-tx.yaml,drivers/media/rc/gpio-ir-tx.c
GPIO LINE MUX #
- Mail: Jonas Jelonek <jelonek.jonas@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/gpio-line-mux.yaml,drivers/gpio/gpio-line-mux.c
GPIO MOCKUP DRIVER #
- Mail: Bamvor Jian Zhang <bamv2005@gmail.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-mockup.c,tools/testing/selftests/gpio/
GPIO REGMAP #
- Mail: Michael Walle <mwalle@kernel.org>
- Status: Maintained
- Files:
drivers/gpio/gpio-regmap.c,include/linux/gpio/regmap.h - Content regex:
(devm_)?gpio_regmap_(un)?register
GPIO SLOPPY LOGIC ANALYZER #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Status: Supported
- Files:
Documentation/dev-tools/gpio-sloppy-logic-analyzer.rst,drivers/gpio/gpio-sloppy-logic-analyzer.c,tools/gpio/gpio-sloppy-logic-analyzer.sh
GPIO SUBSYSTEM #
- Mail: Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
- Files:
Documentation/admin-guide/gpio/,Documentation/devicetree/bindings/gpio/,Documentation/driver-api/gpio/,drivers/gpio/,include/dt-bindings/gpio/,include/linux/gpio.h,include/linux/gpio/,include/linux/of_gpio.h - Content regex:
(devm_)?gpio_(request|free|direction|get|set),GPIOD_FLAGS_BIT_NONEXCLUSIVE,devm_gpiod_unhinge
GPIO UAPI #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Reviewer: Kent Gibson <warthog618@gmail.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
- Files:
Documentation/ABI/obsolete/sysfs-gpio,Documentation/ABI/testing/gpio-cdev,Documentation/userspace-api/gpio/,drivers/gpio/gpiolib-cdev.c,include/uapi/linux/gpio.h,tools/gpio/
GRETH 10/100/1G Ethernet MAC device driver #
- Mail: Andreas Larsson <andreas@gaisler.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/aeroflex/
GREYBUS AUDIO PROTOCOLS DRIVERS #
- Mail: Vaibhav Agarwal <vaibhav.sr@gmail.com>, Mark Greer <mgreer@animalcreek.com>
- Status: Maintained
- Files:
drivers/staging/greybus/audio_apbridgea.c,drivers/staging/greybus/audio_apbridgea.h,drivers/staging/greybus/audio_codec.c,drivers/staging/greybus/audio_codec.h,drivers/staging/greybus/audio_gb.c,drivers/staging/greybus/audio_manager.c,drivers/staging/greybus/audio_manager.h,drivers/staging/greybus/audio_manager_module.c,drivers/staging/greybus/audio_manager_private.h,drivers/staging/greybus/audio_manager_sysfs.c,drivers/staging/greybus/audio_module.c,drivers/staging/greybus/audio_topology.c
GREYBUS FW/HID/SPI PROTOCOLS DRIVERS #
- Mail: Viresh Kumar <vireshk@kernel.org>
- Status: Maintained
- Files:
drivers/staging/greybus/authentication.c,drivers/staging/greybus/bootrom.c,drivers/staging/greybus/firmware.h,drivers/staging/greybus/fw-core.c,drivers/staging/greybus/fw-download.c,drivers/staging/greybus/fw-management.c,drivers/staging/greybus/greybus_authentication.h,drivers/staging/greybus/greybus_firmware.h,drivers/staging/greybus/hid.c,drivers/staging/greybus/i2c.c,drivers/staging/greybus/spi.c,drivers/staging/greybus/spilib.c,drivers/staging/greybus/spilib.h
GREYBUS LOOPBACK DRIVER #
- Mail: Bryan O'Donoghue <pure.logic@nexus-software.ie>
- Status: Maintained
- Files:
drivers/staging/greybus/loopback.c
GREYBUS PLATFORM DRIVERS #
- Mail: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
- Status: Maintained
- Files:
drivers/staging/greybus/arche-apb-ctrl.c,drivers/staging/greybus/arche-platform.c,drivers/staging/greybus/arche_platform.h
GREYBUS SDIO/GPIO/SPI PROTOCOLS DRIVERS #
- Mail: Rui Miguel Silva <rmfrfs@gmail.com>
- Status: Maintained
- Files:
drivers/staging/greybus/gpio.c,drivers/staging/greybus/light.c,drivers/staging/greybus/power_supply.c,drivers/staging/greybus/sdio.c,drivers/staging/greybus/spi.c,drivers/staging/greybus/spilib.c
GREYBUS BEAGLEPLAY DRIVERS #
- Mail: Ayush Singh <ayushdevel1325@gmail.com>
- Mailing list: greybus-dev@lists.linaro.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/ti,cc1352p7.yaml,drivers/greybus/gb-beagleplay.c
GREYBUS SUBSYSTEM #
- Mail: Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: greybus-dev@lists.linaro.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/greybus/,drivers/staging/greybus/,include/linux/greybus.h,include/linux/greybus/
GREYBUS UART PROTOCOLS DRIVERS #
- Mail: David Lin <dtwlin@gmail.com>
- Status: Maintained
- Files:
drivers/staging/greybus/log.c,drivers/staging/greybus/uart.c
GS1662 VIDEO SERIALIZER #
- Mail: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/spi/gs1662.c
GSPCA FINEPIX SUBDRIVER #
- Mail: Frank Zago <frank@zago.net>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/finepix.c
GSPCA GL860 SUBDRIVER #
- Mail: Olivier Lorin <o.lorin@laposte.net>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/gl860/
GSPCA M5602 SUBDRIVER #
- Mail: Erik Andren <erik.andren@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/m5602/
GSPCA PAC207 SONIXB SUBDRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/pac207.c
GSPCA SN9C20X SUBDRIVER #
- Mail: Brian Johnson <brijohn@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/sn9c20x.c
GSPCA T613 SUBDRIVER #
- Mail: Leandro Costantino <lcostantino@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/t613.c
GSPCA USB WEBCAM DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/gspca/
GTP (GPRS Tunneling Protocol) #
- Mail: Pablo Neira Ayuso <pablo@netfilter.org>, Harald Welte <laforge@gnumonks.org>
- Mailing list: osmocom-net-gprs@lists.osmocom.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pablo/gtp.git
- Files:
drivers/net/gtp.c
GUID PARTITION TABLE (GPT) #
- Mail: Davidlohr Bueso <dave@stgolabs.net>
- Mailing list: linux-efi@vger.kernel.org
- Status: Maintained
- Files:
block/partitions/efi.*
HABANALABS PCI DRIVER #
- Mail: Koby Elbaz <koby.elbaz@intel.com>, Konstantin Sinyuk <konstantin.sinyuk@intel.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- chat: irc://irc.oftc.net/dri-devel
- SCM: git https://github.com/HabanaAI/drivers.accel.habanalabs.kernel.git
- Files:
Documentation/ABI/testing/debugfs-driver-habanalabs,Documentation/ABI/testing/sysfs-driver-habanalabs,drivers/accel/habanalabs/,include/linux/habanalabs/,include/trace/events/habanalabs.h,include/uapi/drm/habanalabs_accel.h
HACKRF MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/hackrf/
HANDSHAKE UPCALL FOR TRANSPORT LAYER SECURITY #
- Mail: Chuck Lever <chuck.lever@oracle.com>
- Mailing list: kernel-tls-handshake@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/netlink/specs/handshake.yaml,Documentation/networking/tls-handshake.rst,include/net/handshake.h,include/trace/events/handshake.h,net/handshake/
HANTRO VPU CODEC DRIVER #
- Mail: Nicolas Dufresne <nicolas.dufresne@collabora.com>, Benjamin Gaignard <benjamin.gaignard@collabora.com>, Philipp Zabel <p.zabel@pengutronix.de>
- Mailing list: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/nxp,imx8mq-vpu.yaml,Documentation/devicetree/bindings/media/rockchip,rk3568-vepu.yaml,Documentation/devicetree/bindings/media/rockchip-vpu.yaml,drivers/media/platform/verisilicon/
HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER #
- Mail: Frank Seidel <frank@f-seidel.de>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
- Files:
drivers/platform/x86/hdaps.c
HARDWARE MONITORING #
- Mail: Guenter Roeck <linux@roeck-us.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Web-page: http://hwmon.wiki.kernel.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
- Files:
Documentation/ABI/testing/sysfs-class-hwmon,Documentation/devicetree/bindings/hwmon/,Documentation/hwmon/,drivers/hwmon/,include/linux/hwmon*.h,include/trace/events/hwmon*.h - Content regex:
(devm_)?hwmon_device_(un)?register(|_with_groups|_with_info)
HARDWARE RANDOM NUMBER GENERATOR CORE #
- Mail: Olivia Mackall <olivia@selenic.com>, Herbert Xu <herbert@gondor.apana.org.au>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Odd fixes
- Files:
Documentation/admin-guide/hw_random.rst,Documentation/devicetree/bindings/rng/,drivers/char/hw_random/,include/linux/hw_random.h
HARDWARE SPINLOCK CORE #
- Mail: Bjorn Andersson <andersson@kernel.org>
- Reviewer: Baolin Wang <baolin.wang7@gmail.com>
- Mailing list: linux-remoteproc@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc.git hwspinlock-next
- Files:
Documentation/devicetree/bindings/hwlock/,Documentation/locking/hwspinlock.rst,drivers/hwspinlock/,include/linux/hwspinlock.h
HARDWARE TRACING FACILITIES #
- Mail: Alexander Shishkin <alexander.shishkin@linux.intel.com>
- Status: Maintained
- Files:
drivers/hwtracing/
HARMONY SOUND DRIVER #
- Mailing list: linux-parisc@vger.kernel.org
- Status: Maintained
- Files:
sound/parisc/harmony.*
HDPVR USB VIDEO ENCODER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/hdpvr/
HEWLETT PACKARD ENTERPRISE ILO CHIF DRIVER #
- Mail: Keng-Yu Lin <keng-yu.lin@hpe.com>
- Status: Supported
- Files:
drivers/misc/hpilo.[ch]
HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER #
- Mail: Craig Lamparter <craig.lamparter@hpe.com>
- Status: Supported
- Files:
Documentation/watchdog/hpwdt.rst,drivers/watchdog/hpwdt.c
HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa) #
- Mail: Don Brace <don.brace@microchip.com>
- Mailing list: storagedev@microchip.com, linux-scsi@vger.kernel.org
- Status: Supported
- Files:
Documentation/scsi/hpsa.rst,drivers/scsi/hpsa*.[ch],include/linux/cciss*.h,include/uapi/linux/cciss*.h
HFI1 DRIVER #
- Mail: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/hw/hfi1
HFS FILESYSTEM #
- Mail: Viacheslav Dubeyko <slava@dubeyko.com>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, Yangtao Li <frank.li@vivo.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/hfs.git
- Files:
Documentation/filesystems/hfs.rst,fs/hfs/,include/linux/hfs_common.h
HFSPLUS FILESYSTEM #
- Mail: Viacheslav Dubeyko <slava@dubeyko.com>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, Yangtao Li <frank.li@vivo.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/hfs.git
- Files:
Documentation/filesystems/hfsplus.rst,fs/hfsplus/,include/linux/hfs_common.h
HGA FRAMEBUFFER DRIVER #
- Mail: Ferenc Bakonyi <fero@drama.obuda.kando.hu>
- Mailing list: linux-nvidia@lists.surfsouth.com
- Status: Maintained
- Web-page: http://drama.obuda.kando.hu/~fero/cgi-bin/hgafb.shtml
- Files:
drivers/video/fbdev/hgafb.c
HIBERNATION (aka Software Suspend, aka swsusp) #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Reviewer: Pavel Machek <pavel@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- bugs: https://bugzilla.kernel.org
- Files:
arch/*/include/asm/suspend*.h,arch/x86/power/,drivers/base/power/,include/linux/freezer.h,include/linux/pm.h,include/linux/suspend.h,kernel/power/
HID CORE LAYER #
- Mail: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
- Files:
Documentation/hid/,drivers/hid/,include/linux/hid*,include/uapi/linux/hid*,samples/hid/,tools/testing/selftests/hid/
HID LOGITECH DRIVERS #
- Reviewer: Filipe Laíns <lains@riseup.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-logitech-*
HID NVIDIA SHIELD DRIVER #
- Mail: Rahul Rameshbabu <rrameshbabu@nvidia.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-nvidia-shield.c
HID PHOENIX RC FLIGHT CONTROLLER #
- Mail: Marcus Folkesson <marcus.folkesson@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-pxrc.c
HID PLAYSTATION DRIVER #
- Mail: Roderick Colenbrander <roderick.colenbrander@sony.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Supported
- Files:
drivers/hid/hid-playstation.c
HID SENSOR HUB DRIVERS #
- Mail: Jiri Kosina <jikos@kernel.org>, Jonathan Cameron <jic23@kernel.org>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
- Mailing list: linux-input@vger.kernel.org, linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hid/hid-sensor*,drivers/hid/hid-sensor-*,drivers/iio/*/hid-*,include/linux/hid-sensor-*
HID UNIVERSAL PIDFF DRIVER #
- Mail: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>, Oleg Makarenko <oleg@makarenk.ooo>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- bugs: https://github.com/JacKeTUs/universal-pidff/issues
- Files:
drivers/hid/hid-universal-pidff.c
HID VRC-2 CAR CONTROLLER DRIVER #
- Mail: Marcus Folkesson <marcus.folkesson@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-vrc2.c
HID WACOM DRIVER #
- Mail: Ping Cheng <ping.cheng@wacom.com>, Jason Gerecke <jason.gerecke@wacom.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/wacom.h,drivers/hid/wacom_*
HID++ LOGITECH DRIVERS #
- Reviewer: Filipe Laíns <lains@riseup.net>, Bastien Nocera <hadess@hadess.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-logitech-hidpp.c
HIGH-RESOLUTION TIMERS, TIMER WHEEL, CLOCKEVENTS #
- Mail: Anna-Maria Behnsen <anna-maria@linutronix.de>, Frederic Weisbecker <frederic@kernel.org>, Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
- Files:
Documentation/timers/,include/linux/clockchips.h,include/linux/delay.h,include/linux/hrtimer.h,include/linux/timer.h,kernel/time/clockevents.c,kernel/time/hrtimer.c,kernel/time/sleep_timeout.c,kernel/time/timer.c,kernel/time/timer_list.c,kernel/time/timer_migration.*,tools/testing/selftests/timers/
HITRON HAC300S PSU DRIVER #
- Mail: Vasileios Amoiridis <vasileios.amoiridis@cern.ch>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/hac300s.rst,drivers/hwmon/pmbus/hac300s.c
DELAY, SLEEP, TIMEKEEPING, TIMERS [RUST] #
- Mail: Andreas Hindborg <a.hindborg@kernel.org>
- Reviewer: Boqun Feng <boqun@kernel.org>, FUJITA Tomonori <fujita.tomonori@gmail.com>, Frederic Weisbecker <frederic@kernel.org>, Lyude Paul <lyude@redhat.com>, Thomas Gleixner <tglx@kernel.org>, Anna-Maria Behnsen <anna-maria@linutronix.de>, John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Supported
- Web-page: https://rust-for-linux.com
- bugs: https://github.com/Rust-for-Linux/linux/issues
- SCM: git https://github.com/Rust-for-Linux/linux.git timekeeping-next
- Files:
rust/kernel/time.rs,rust/kernel/time/
HIGH-SPEED SCC DRIVER FOR AX.25 #
- Mailing list: linux-hams@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/hamradio/scc.c
HIGHPOINT ROCKETRAID 3xxx RAID DRIVER #
- Mail: HighPoint Linux Team <linux@highpoint-tech.com>
- Status: Supported
- Web-page: http://www.highpoint-tech.com
- Files:
Documentation/scsi/hptiop.rst,drivers/scsi/hptiop.c
HIKEY960 ONBOARD USB GPIO HUB DRIVER #
- Mail: John Stultz <jstultz@google.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/misc/hisi_hikey_usb.c
HIMAX HX83112B TOUCHSCREEN SUPPORT #
- Mail: Job Noorman <job@noorman.info>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/trivial-touch.yaml,drivers/input/touchscreen/himax_hx83112b.c
HIMAX HX852X TOUCHSCREEN DRIVER #
- Mail: Stephan Gerhold <stephan@gerhold.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/himax,hx852es.yaml,drivers/input/touchscreen/himax_hx852x.c
HIRSCHMANN HELLCREEK ETHERNET SWITCH DRIVER #
- Mail: Kurt Kanzenbach <kurt@linutronix.de>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml,drivers/net/dsa/hirschmann/*,include/linux/platform_data/hirschmann-hellcreek.h,net/dsa/tag_hellcreek.c
HISILICON DMA DRIVER #
- Mail: Zhou Wang <wangzhou1@hisilicon.com>, Longfang Liu <liulongfang@huawei.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Maintained
- Files:
drivers/dma/hisi_dma.c
HISILICON GPIO DRIVER #
- Mail: Yang Shen <shenyang39@huawei.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/hisilicon,ascend910-gpio.yaml,drivers/gpio/gpio-hisi.c
HISILICON HIGH PERFORMANCE RSA ENGINE DRIVER (HPRE) #
- Mail: Zhiqi Song <songzhiqi1@huawei.com>, Longfang Liu <liulongfang@huawei.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-hisi-hpre,drivers/crypto/hisilicon/hpre/hpre.h,drivers/crypto/hisilicon/hpre/hpre_crypto.c,drivers/crypto/hisilicon/hpre/hpre_main.c
HISILICON HNS3 PMU DRIVER #
- Mail: Jijie Shao <shaojijie@huawei.com>
- Status: Supported
- Files:
Documentation/admin-guide/perf/hns3-pmu.rst,drivers/perf/hisilicon/hns3_pmu.c
HISILICON I2C CONTROLLER DRIVER #
- Mail: Devyn Liu <liudingyuan@h-partners.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Web-page: https://www.hisilicon.com
- Files:
Documentation/devicetree/bindings/i2c/hisilicon,ascend910-i2c.yaml,drivers/i2c/busses/i2c-hisi.c
HISILICON KUNPENG SOC HCCS DRIVER #
- Mail: Huisong Li <lihuisong@huawei.com>
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-devices-platform-kunpeng_hccs,drivers/soc/hisilicon/kunpeng_hccs.c,drivers/soc/hisilicon/kunpeng_hccs.h
HISILICON SOC HHA DRIVER #
- Mail: Yushan Wang <wangyushan12@huawei.com>
- Status: Maintained
- Files:
drivers/cache/hisi_soc_hha.c
HISILICON LPC BUS DRIVER #
- Mail: Jay Fang <f.fangjian@huawei.com>
- Status: Maintained
- Web-page: http://www.hisilicon.com
- Files:
Documentation/devicetree/bindings/arm/hisilicon/low-pin-count.yaml,drivers/bus/hisi_lpc.c
HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) #
- Mail: Jian Shen <shenjian15@huawei.com>, Salil Mehta <salil.mehta@huawei.com>, Jijie Shao <shaojijie@huawei.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.hisilicon.com
- Files:
drivers/net/ethernet/hisilicon/hns3/
HISILICON NETWORK HIBMCGE DRIVER #
- Mail: Jijie Shao <shaojijie@huawei.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/hisilicon/hibmcge/
HISILICON NETWORK SUBSYSTEM DRIVER #
- Mail: Jian Shen <shenjian15@huawei.com>, Salil Mehta <salil.mehta@huawei.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.hisilicon.com
- Files:
Documentation/devicetree/bindings/net/hisilicon*.txt,drivers/net/ethernet/hisilicon/
HISILICON PMU DRIVER #
- Mail: Jonathan Cameron <jonathan.cameron@huawei.com>
- Status: Supported
- Web-page: http://www.hisilicon.com
- Files:
Documentation/admin-guide/perf/hisi-pcie-pmu.rst,Documentation/admin-guide/perf/hisi-pmu.rst,drivers/perf/hisilicon,tools/perf/pmu-events/arch/arm64/hisilicon/
HISILICON PTT DRIVER #
- Mail: Yicong Yang <yangyicong@hisilicon.com>, Jonathan Cameron <jonathan.cameron@huawei.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-event_source-devices-hisi_ptt,Documentation/trace/hisi-ptt.rst,drivers/hwtracing/ptt/,tools/perf/arch/arm64/util/hisi-ptt.c,tools/perf/util/hisi-ptt*,tools/perf/util/hisi-ptt-decoder/*
HISILICON QM DRIVER #
- Mail: Weili Qian <qianweili@huawei.com>, Zhou Wang <wangzhou1@hisilicon.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/hisilicon/Kconfig,drivers/crypto/hisilicon/Makefile,drivers/crypto/hisilicon/qm.c,drivers/crypto/hisilicon/sgl.c,include/linux/hisi_acc_qm.h
HISILICON ROCE DRIVER #
- Mail: Chengchang Tang <tangchengchang@huawei.com>, Junxian Huang <huangjunxian6@hisilicon.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/infiniband/hisilicon-hns-roce.txt,drivers/infiniband/hw/hns/
HISILICON SAS Controller #
- Mail: Yihang Li <liyihang9@h-partners.com>
- Status: Supported
- Web-page: http://www.hisilicon.com
- Files:
Documentation/devicetree/bindings/scsi/hisilicon-sas.txt,drivers/scsi/hisi_sas/
HISILICON SECURITY ENGINE V2 DRIVER (SEC2) #
- Mail: Longfang Liu <liulongfang@huawei.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-hisi-sec,drivers/crypto/hisilicon/sec2/sec.h,drivers/crypto/hisilicon/sec2/sec_crypto.c,drivers/crypto/hisilicon/sec2/sec_crypto.h,drivers/crypto/hisilicon/sec2/sec_main.c
HISILICON SPI Controller DRIVER FOR KUNPENG SOCS #
- Mail: Yang Shen <shenyang39@huawei.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Web-page: http://www.hisilicon.com
- Files:
drivers/spi/spi-hisi-kunpeng.c
HISILICON SPMI CONTROLLER DRIVER FOR HIKEY 970 #
- Mail: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml,drivers/spmi/hisi-spmi-controller.c
HISILICON SPMI PMIC DRIVER FOR HIKEY 6421v600 #
- Mail: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml,drivers/mfd/hi6421-spmi-pmic.c
HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT #
- Mail: Weili Qian <qianweili@huawei.com>
- Status: Maintained
- Files:
drivers/crypto/hisilicon/trng/trng.c
HISILICON V3XX SPI NOR FLASH Controller Driver #
- Mail: Yang Shen <shenyang39@huawei.com>
- Status: Maintained
- Web-page: http://www.hisilicon.com
- Files:
drivers/spi/spi-hisi-sfc-v3xx.c
HISILICON ZIP Controller DRIVER #
- Mail: Yang Shen <shenyang39@huawei.com>, Zhou Wang <wangzhou1@hisilicon.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-hisi-zip,drivers/crypto/hisilicon/zip/
HMM - Heterogeneous Memory Management #
- Mail: Jason Gunthorpe <jgg@nvidia.com>, Leon Romanovsky <leonro@nvidia.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/mm/hmm.rst,include/linux/hmm*,lib/test_hmm*,mm/hmm*,tools/testing/selftests/mm/*hmm*
HONEYWELL ABP2030PA PRESSURE SENSOR SERIES IIO DRIVER #
- Mail: Petre Rodan <petre.rodan@subdimension.ro>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/pressure/honeywell,abp2030pa.yaml,drivers/iio/pressure/abp2030pa*
HONEYWELL HSC030PA PRESSURE SENSOR SERIES IIO DRIVER #
- Mail: Petre Rodan <petre.rodan@subdimension.ro>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml,drivers/iio/pressure/hsc030pa*
HONEYWELL MPRLS0025PA PRESSURE SENSOR SERIES IIO DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>, Petre Rodan <petre.rodan@subdimension.ro>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/pressure/honeywell,mprls0025pa.yaml,drivers/iio/pressure/mprls0025pa*
HP BIOSCFG DRIVER #
- Mail: Jorge Lopez <jorge.lopez2@hp.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/hp/hp-bioscfg/
HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER #
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Orphan
- Files:
drivers/platform/x86/hp/tc1100-wmi.c
HP WMI HARDWARE MONITOR DRIVER #
- Mail: James Seo <james@equiv.tech>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/hp-wmi-sensors.rst,drivers/hwmon/hp-wmi-sensors.c
HPET: High Precision Event Timers driver #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Status: Maintained
- Files:
Documentation/timers/hpet.rst,drivers/char/hpet.c,include/linux/hpet.h,include/uapi/linux/hpet.h
HPET: x86 #
- Status: Orphan
- Files:
arch/x86/include/asm/hpet.h,arch/x86/kernel/hpet.c
HPFS FILESYSTEM #
- Mail: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
- Status: Maintained
- Web-page: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi
- Files:
fs/hpfs/
HS3001 Hardware Temperature and Humidity Sensor #
- Mail: Andre Werner <andre.werner@systec-electronic.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/hs3001.c
HSI SUBSYSTEM #
- Mail: Sebastian Reichel <sre@kernel.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git
- Files:
Documentation/ABI/testing/sysfs-bus-hsi,Documentation/driver-api/hsi.rst,drivers/hsi/,include/linux/hsi/,include/uapi/linux/hsi/
HSO 3G MODEM DRIVER #
- Mailing list: linux-usb@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/usb/hso.c
HSR NETWORK PROTOCOL #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
net/hsr/,tools/testing/selftests/net/hsr/
HT16K33 LED CONTROLLER DRIVER #
- Mail: Robin van der Gracht <robin@protonic.nl>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/auxdisplay/holtek,ht16k33.yaml,drivers/auxdisplay/ht16k33.c
HTCPEN TOUCHSCREEN DRIVER #
- Mail: Pau Oliva Fora <pof@eslack.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/htcpen.c
HTE SUBSYSTEM #
- Mail: Dipen Patel <dipenp@nvidia.com>
- Mailing list: timestamp@lists.linux.dev
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/timestamp/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux.git
- Files:
Documentation/devicetree/bindings/timestamp/,Documentation/driver-api/hte/,drivers/hte/,include/linux/hte.h
HTS221 TEMPERATURE-HUMIDITY IIO DRIVER #
- Mail: Lorenzo Bianconi <lorenzo@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: http://www.st.com/
- Files:
Documentation/devicetree/bindings/iio/humidity/st,hts221.yaml,drivers/iio/humidity/hts221*
HTU31 Hardware Temperature and Humidity Sensor #
- Mail: Andrei Lalaev <andrey.lalaev@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/htu31.c
HUAWEI ETHERNET DRIVER #
- Mail: Cai Huoqing <cai.huoqing@linux.dev>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/huawei/hinic.rst,drivers/net/ethernet/huawei/hinic/
HUAWEI 3RD GEN ETHERNET DRIVER #
- Mail: Fan Gong <gongfan1@huawei.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/huawei/hinic3.rst,drivers/net/ethernet/huawei/hinic3/
HUAWEI MATEBOOK E GO EMBEDDED CONTROLLER DRIVER #
- Mail: Pengyu Luo <mitltlatltl@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/embedded-controller/huawei,gaokun3-ec.yaml,drivers/platform/arm64/huawei-gaokun-ec.c,drivers/power/supply/huawei-gaokun-battery.c,drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c,include/linux/platform_data/huawei-gaokun-ec.h
HUGETLB SUBSYSTEM #
- Mail: Muchun Song <muchun.song@linux.dev>, Oscar Salvador <osalvador@suse.de>
- Reviewer: David Hildenbrand <david@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-kernel-mm-hugepages,Documentation/admin-guide/mm/hugetlbpage.rst,Documentation/mm/hugetlbfs_reserv.rst,Documentation/mm/vmemmap_dedup.rst,fs/hugetlbfs/,include/linux/hugetlb.h,include/trace/events/hugetlbfs.h,mm/hugetlb.c,mm/hugetlb_cgroup.c,mm/hugetlb_cma.c,mm/hugetlb_cma.h,mm/hugetlb_sysctl.c,mm/hugetlb_sysfs.c,mm/hugetlb_vmemmap.c,mm/hugetlb_vmemmap.h,tools/testing/selftests/cgroup/test_hugetlb_memcg.c
HVA ST MEDIA DRIVER #
- Mail: Jean-Christophe Trotin <jean-christophe.trotin@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/platform/st/sti/hva
HWPOISON MEMORY FAILURE HANDLING #
- Mail: Miaohe Lin <linmiaohe@huawei.com>
- Reviewer: Naoya Horiguchi <nao.horiguchi@gmail.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/memory-failure.h,include/trace/events/memory-failure.h,mm/hwpoison-inject.c,mm/memory-failure.c,tools/testing/selftests/mm/memory-failure.c
HYCON HY46XX TOUCHSCREEN SUPPORT #
- Mail: Giulio Benetti <giulio.benetti@benettiengineering.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/hycon,hy46xx.yaml,drivers/input/touchscreen/hycon-hy46xx.c
HYGON PROCESSOR SUPPORT #
- Mail: Pu Wen <puwen@hygon.cn>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
arch/x86/kernel/cpu/hygon.c
HYNIX HI556 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/hi556.c
HYNIX HI846 SENSOR DRIVER #
- Mail: Martin Kepplinger-Novakovic <martink@posteo.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/hi846.c
HYNIX HI847 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/hi847.c
Hyper-V/Azure CORE AND DRIVERS #
- Mail: "K. Y. Srinivasan" <kys@microsoft.com>, Haiyang Zhang <haiyangz@microsoft.com>, Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>, Long Li <longli@microsoft.com>
- Mailing list: linux-hyperv@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
- Files:
Documentation/ABI/stable/sysfs-bus-vmbus,Documentation/ABI/testing/debugfs-hyperv,Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml,Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst,Documentation/virt/hyperv,arch/arm64/hyperv,arch/arm64/include/asm/mshyperv.h,arch/x86/hyperv,arch/x86/include/asm/mshyperv.h,arch/x86/include/asm/trace/hyperv.h,arch/x86/kernel/cpu/mshyperv.c,drivers/clocksource/hyperv_timer.c,drivers/hid/hid-hyperv.c,drivers/hv/,drivers/input/serio/hyperv-keyboard.c,drivers/iommu/hyperv-iommu.c,drivers/net/ethernet/microsoft/,drivers/net/hyperv/,drivers/pci/controller/pci-hyperv-intf.c,drivers/pci/controller/pci-hyperv.c,drivers/scsi/storvsc_drv.c,drivers/uio/uio_hv_generic.c,include/asm-generic/mshyperv.h,include/clocksource/hyperv_timer.h,include/hyperv/hvgdk.h,include/hyperv/hvgdk_ext.h,include/hyperv/hvgdk_mini.h,include/hyperv/hvhdk.h,include/hyperv/hvhdk_mini.h,include/linux/hyperv.h,include/net/mana,include/uapi/linux/hyperv.h,net/vmw_vsock/hyperv_transport.c,tools/hv/
HYPERBUS SUPPORT #
- Mail: Vignesh Raghavendra <vigneshr@ti.com>
- Reviewer: Tudor Ambarus <tudor.ambarus@linaro.org>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Supported
- Patchwork: http://patchwork.ozlabs.org/project/linux-mtd/list/
- chat: irc://irc.oftc.net/mtd
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git cfi/next
- Files:
Documentation/devicetree/bindings/mtd/ti,am654-hbmc.yaml,drivers/mtd/hyperbus/,include/linux/mtd/hyperbus.h
HYPERVISOR VIRTUAL CONSOLE DRIVER #
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Odd Fixes
- Files:
drivers/tty/hvc/
HUNG TASK DETECTOR #
- Mail: Andrew Morton <akpm@linux-foundation.org>
- Reviewer: Lance Yang <lance.yang@linux.dev>, Masami Hiramatsu <mhiramat@kernel.org>, Petr Mladek <pmladek@suse.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
include/linux/hung_task.h,kernel/hung_task.c
I2C ACPI SUPPORT #
- Mail: Mika Westerberg <westeri@kernel.org>
- Mailing list: linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/i2c-core-acpi.c
I2C ADDRESS TRANSLATOR (ATR) #
- Mail: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
- Reviewer: Luca Ceresoli <luca.ceresoli@bootlin.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/i2c-atr.c,include/linux/i2c-atr.h
I2C CONTROLLER DRIVER FOR NVIDIA GPU #
- Mail: Ajay Gupta <ajayg@nvidia.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/i2c/busses/i2c-nvidia-gpu.rst,drivers/i2c/busses/i2c-nvidia-gpu.c
I2C MUXES #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/i2c-arb*,Documentation/devicetree/bindings/i2c/i2c-gate*,Documentation/devicetree/bindings/i2c/i2c-mux*,Documentation/i2c/i2c-topology.rst,Documentation/i2c/muxes/,drivers/i2c/i2c-mux.c,drivers/i2c/muxes/,include/linux/i2c-mux.h
I2C MV64XXX MARVELL AND ALLWINNER DRIVER #
- Mail: Gregory CLEMENT <gregory.clement@bootlin.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml,drivers/i2c/busses/i2c-mv64xxx.c
I2C OF COMPONENT PROBER #
- Mail: Chen-Yu Tsai <wenst@chromium.org>
- Mailing list: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/i2c-core-of-prober.c,include/linux/i2c-of-prober.h
I2C OVER PARALLEL PORT #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/i2c/busses/i2c-parport.rst,drivers/i2c/busses/i2c-parport.c
I2C SUBSYSTEM #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.ozlabs.org/project/linux-i2c/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
- Files:
Documentation/i2c/,drivers/i2c/*,include/dt-bindings/i2c/i2c.h,include/linux/i2c-dev.h,include/linux/i2c-smbus.h,include/linux/i2c.h,include/uapi/linux/i2c-*.h,include/uapi/linux/i2c.h
I2C SUBSYSTEM [RUST] #
- Mail: Igor Korotin <igor.korotin.linux@gmail.com>
- Reviewer: Danilo Krummrich <dakr@kernel.org>, Daniel Almeida <daniel.almeida@collabora.com>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Maintained
- Files:
rust/kernel/i2c.rs,samples/rust/rust_driver_i2c.rs,samples/rust/rust_i2c_client.rs
I2C SUBSYSTEM HOST DRIVERS #
- Mail: Andi Shyti <andi.shyti@kernel.org>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.ozlabs.org/project/linux-i2c/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
- Files:
Documentation/devicetree/bindings/i2c/,drivers/i2c/algos/,drivers/i2c/busses/,include/dt-bindings/i2c/
I2C-TAOS-EVM DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/i2c/busses/i2c-taos-evm.rst,drivers/i2c/busses/i2c-taos-evm.c
I2C-TINY-USB DRIVER #
- Mail: Till Harbaum <till@harbaum.org>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Web-page: http://www.harbaum.org/till/i2c_tiny_usb
- Files:
drivers/i2c/busses/i2c-tiny-usb.c
I2C/SMBUS CONTROLLER DRIVERS FOR PC #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/i2c/busses/i2c-ali1535.rst,Documentation/i2c/busses/i2c-ali1563.rst,Documentation/i2c/busses/i2c-ali15x3.rst,Documentation/i2c/busses/i2c-amd756.rst,Documentation/i2c/busses/i2c-amd8111.rst,Documentation/i2c/busses/i2c-i801.rst,Documentation/i2c/busses/i2c-nforce2.rst,Documentation/i2c/busses/i2c-piix4.rst,Documentation/i2c/busses/i2c-sis5595.rst,Documentation/i2c/busses/i2c-sis630.rst,Documentation/i2c/busses/i2c-sis96x.rst,Documentation/i2c/busses/i2c-via.rst,Documentation/i2c/busses/i2c-viapro.rst,drivers/i2c/busses/i2c-ali1535.c,drivers/i2c/busses/i2c-ali1563.c,drivers/i2c/busses/i2c-ali15x3.c,drivers/i2c/busses/i2c-amd756.c,drivers/i2c/busses/i2c-amd8111.c,drivers/i2c/busses/i2c-i801.c,drivers/i2c/busses/i2c-isch.c,drivers/i2c/busses/i2c-nforce2.c,drivers/i2c/busses/i2c-piix4.*,drivers/i2c/busses/i2c-sis5595.c,drivers/i2c/busses/i2c-sis630.c,drivers/i2c/busses/i2c-sis96x.c,drivers/i2c/busses/i2c-via.c,drivers/i2c/busses/i2c-viapro.c
I2C/SMBUS INTEL CHT WHISKEY COVE PMIC DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-cht-wc.c
I2C/SMBUS ISMT DRIVER #
- Mail: Neil Horman <nhorman@tuxdriver.com>
- Mailing list: linux-i2c@vger.kernel.org
- Files:
Documentation/i2c/busses/i2c-ismt.rst,drivers/i2c/busses/i2c-ismt.c
I2C/SMBUS ZHAOXIN DRIVER #
- Mail: Hans Hu <hanshu@zhaoxin.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Web-page: https://www.zhaoxin.com
- Files:
drivers/i2c/busses/i2c-viai2c-common.c,drivers/i2c/busses/i2c-viai2c-zhaoxin.c
I2C/SMBUS STUB DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/i2c-stub.c
I3C DRIVER FOR ASPEED AST2600 #
- Mail: Jeremy Kerr <jk@codeconstruct.com.au>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i3c/aspeed,ast2600-i3c.yaml,drivers/i3c/master/ast2600-i3c-master.c
I3C DRIVER FOR ANALOG DEVICES I3C CONTROLLER IP #
- Mail: Jorge Marques <jorge.marques@analog.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i3c/adi,i3c-master.yaml,drivers/i3c/master/adi-i3c-master.c
I3C DRIVER FOR CADENCE I3C MASTER IP #
- Mail: Przemysław Gaj <pgaj@cadence.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i3c/cdns,i3c-master.yaml,drivers/i3c/master/i3c-master-cdns.c
I3C DRIVER FOR RENESAS #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>, Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/i3c/renesas,i3c.yaml,drivers/i3c/master/renesas-i3c.c
I3C DRIVER FOR SYNOPSYS DESIGNWARE #
- Status: Orphan
- Files:
Documentation/devicetree/bindings/i3c/snps,dw-i3c-master.yaml,drivers/i3c/master/dw*
I3C SUBSYSTEM #
- Mail: Alexandre Belloni <alexandre.belloni@bootlin.com>
- Reviewer: Frank Li <Frank.Li@nxp.com>
- Mailing list: linux-i3c@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-i3c/list/
- chat: irc://chat.freenode.net/linux-i3c
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux.git
- Files:
Documentation/ABI/testing/sysfs-bus-i3c,Documentation/devicetree/bindings/i3c/,Documentation/driver-api/i3c,drivers/i3c/,include/dt-bindings/i3c/,include/linux/i3c/
IBM Operation Panel Input Driver #
- Mail: Eddie James <eajames@linux.ibm.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/ibm,op-panel.yaml,drivers/input/misc/ibm-panel.c
IBM Power 842 compression accelerator #
- Mail: Haren Myneni <haren@us.ibm.com>
- Status: Supported
- Files:
crypto/842.c,drivers/crypto/nx/Kconfig,drivers/crypto/nx/Makefile,drivers/crypto/nx/nx-842*,include/linux/sw842.h,lib/842/
IBM Power in-Nest Crypto Acceleration #
- Mail: Breno Leitão <leitao@debian.org>, Nayna Jain <nayna@linux.ibm.com>, Paulo Flabiano Smorigo <pfsmorigo@gmail.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
drivers/crypto/nx/Kconfig,drivers/crypto/nx/Makefile,drivers/crypto/nx/nx-aes*,drivers/crypto/nx/nx-sha*,drivers/crypto/nx/nx.*,drivers/crypto/nx/nx_csbcpb.h,drivers/crypto/nx/nx_debugfs.c
IBM Power IO DLPAR Driver for RPA-compliant PPC64 platform #
- Mail: Tyrel Datwyler <tyreld@linux.ibm.com>
- Mailing list: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Supported
- Files:
drivers/pci/hotplug/rpadlpar*
IBM Power Linux RAID adapter #
- Mail: Brian King <brking@us.ibm.com>
- Status: Supported
- Files:
drivers/scsi/ipr.*
IBM Power PCI Hotplug Driver for RPA-compliant PPC64 platform #
- Mail: Tyrel Datwyler <tyreld@linux.ibm.com>
- Mailing list: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Supported
- Files:
drivers/pci/hotplug/rpaphp*
IBM Power SRIOV Virtual NIC Device Driver #
- Mail: Haren Myneni <haren@linux.ibm.com>, Rick Lindsley <ricklind@linux.ibm.com>
- Reviewer: Nick Child <nnac123@linux.ibm.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/ibm/ibmvnic.*
IBM Power VFIO Support #
- Mail: Timothy Pearson <tpearson@raptorengineering.com>
- Status: Supported
- Files:
drivers/vfio/vfio_iommu_spapr_tce.c
IBM Power Virtual Ethernet Device Driver #
- Mail: Nick Child <nnac123@linux.ibm.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/ibm/ibmveth.*
IBM Power Virtual FC Device Drivers #
- Mail: Tyrel Datwyler <tyreld@linux.ibm.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/ibmvscsi/ibmvfc*
IBM Power Virtual Management Channel Driver #
- Mail: Brad Warrum <bwarrum@linux.ibm.com>, Ritu Agarwal <rituagar@linux.ibm.com>
- Status: Supported
- Files:
drivers/misc/ibmvmc.*
IBM Power Virtual SCSI Device Drivers #
- Mail: Tyrel Datwyler <tyreld@linux.ibm.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/ibmvscsi/ibmvscsi*,include/scsi/viosrp.h
IBM Power Virtual SCSI Device Target Driver #
- Mail: Tyrel Datwyler <tyreld@linux.ibm.com>
- Mailing list: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/ibmvscsi_tgt/
IBM Power VMX Cryptographic instructions #
- Mail: Breno Leitão <leitao@debian.org>, Nayna Jain <nayna@linux.ibm.com>, Paulo Flabiano Smorigo <pfsmorigo@gmail.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
arch/powerpc/crypto/Kconfig,arch/powerpc/crypto/Makefile,arch/powerpc/crypto/aes.c,arch/powerpc/crypto/aes_cbc.c,arch/powerpc/crypto/aes_ctr.c,arch/powerpc/crypto/aes_xts.c,arch/powerpc/crypto/aesp8-ppc.*,arch/powerpc/crypto/ghash.c,arch/powerpc/crypto/ghashp8-ppc.pl,arch/powerpc/crypto/ppc-xlate.pl,arch/powerpc/crypto/vmx.c
IBM ServeRAID RAID DRIVER #
- Status: Orphan
- Files:
drivers/scsi/ips.*
ICH LPC AND GPIO DRIVER #
- Mail: Peter Tyser <ptyser@xes-inc.com>
- Status: Maintained
- Files:
drivers/gpio/gpio-ich.c,drivers/mfd/lpc_ich.c
ICY I2C DRIVER #
- Mail: Max Staudt <max@enpas.org>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-icy.c
IDEAPAD LAPTOP EXTRAS DRIVER #
- Mail: Ike Panhc <ikepanhc@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: http://launchpad.net/ideapad-laptop
- Files:
drivers/platform/x86/lenovo/ideapad-laptop.c
IDEAPAD LAPTOP SLIDEBAR DRIVER #
- Mail: Andrey Moiseev <o2g.org.ru@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/o2genum/ideapad-slidebar
- Files:
drivers/input/misc/ideapad_slidebar.c
IDT VersaClock 5 CLOCK DRIVER #
- Mail: Luca Ceresoli <luca@lucaceresoli.net>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/idt,versaclock5.yaml,drivers/clk/clk-versaclock5.c
IEEE 802.15.4 SUBSYSTEM #
- Mail: Alexander Aring <alex.aring@gmail.com>, Stefan Schmidt <stefan@datenfreihafen.org>, Miquel Raynal <miquel.raynal@bootlin.com>
- Mailing list: linux-wpan@vger.kernel.org
- Status: Maintained
- Web-page: https://linux-wpan.org/
- Patchwork: https://patchwork.kernel.org/project/linux-wpan/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan.git, git git://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan-next.git
- Files:
Documentation/networking/ieee802154.rst,drivers/net/ieee802154/,include/linux/ieee802154.h,include/linux/nl802154.h,include/net/af_ieee802154.h,include/net/cfg802154.h,include/net/ieee802154_netdev.h,include/net/mac802154.h,include/net/nl802154.h,net/ieee802154/,net/mac802154/
Intel VIRTIO DATA PATH ACCELERATOR #
- Mail: Zhu Lingshan <lingshan.zhu@kernel.org>
- Mailing list: virtualization@lists.linux.dev
- Status: Supported
- Files:
drivers/vdpa/ifcvf/
IFE PROTOCOL #
- Mail: Yotam Gigi <yotam.gi@gmail.com>, Jamal Hadi Salim <jhs@mojatatu.com>
- Files:
include/net/ife.h,include/uapi/linux/ife.h,net/ife
IGORPLUG-USB IR RECEIVER #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/rc/igorplugusb.c
IGUANAWORKS USB IR TRANSCEIVER #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/rc/iguanair.c
IIO ADC HELPERS #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/adc/industrialio-adc.c,include/linux/iio/adc-helpers.h
IIO BACKEND FRAMEWORK #
- Mail: Nuno Sa <nuno.sa@analog.com>
- Reviewer: Olivier Moysan <olivier.moysan@foss.st.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-iio-backend,drivers/iio/industrialio-backend.c,include/linux/iio/backend.h
IIO DIGITAL POTENTIOMETER DAC #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac,Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml,drivers/iio/dac/dpot-dac.c
IIO ENVELOPE DETECTOR #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-iio-adc-envelope-detector,Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml,drivers/iio/adc/envelope-detector.c
IIO LIGHT SENSOR GAIN-TIME-SCALE HELPERS #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/industrialio-gts-helper.c,include/linux/iio/iio-gts-helper.h,drivers/iio/test/iio-test-gts.c
IIO MULTIPLEXER #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml,drivers/iio/multiplexer/iio-mux.c
IIO SCMI BASED DRIVER #
- Mail: Jyoti Bhayana <jbhayana@google.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/common/scmi_sensors/scmi_iio.c
IIO SUBSYSTEM AND DRIVERS #
- Mail: Jonathan Cameron <jic23@kernel.org>
- Reviewer: David Lechner <dlechner@baylibre.com>, Nuno Sá <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
- Files:
Documentation/ABI/testing/configfs-iio*,Documentation/ABI/testing/sysfs-bus-iio*,Documentation/devicetree/bindings/iio/,Documentation/iio/,drivers/iio/,drivers/staging/iio/,include/dt-bindings/iio/,include/linux/iio/,tools/iio/
IIO UNIT CONVERTER #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml,Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml,Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml,drivers/iio/afe/iio-rescale.c
IKANOS/ADI EAGLE ADSL USB DRIVER #
- Mail: Matthieu Castet <castet.matthieu@free.fr>, Stanislaw Gruszka <stf_xl@wp.pl>
- Status: Maintained
- Files:
drivers/usb/atm/ueagle-atm.c
IMAGIS TOUCHSCREEN DRIVER #
- Mail: Markuss Broks <markuss.broks@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml,drivers/input/touchscreen/imagis.c
IMGTEC ASCII LCD DRIVER #
- Mail: Paul Burton <paulburton@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/auxdisplay/img,ascii-lcd.yaml,drivers/auxdisplay/img-ascii-lcd.c
IMGTEC JPEG ENCODER DRIVER #
- Mail: Devarsh Thakkar <devarsht@ti.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/img,e5010-jpeg-enc.yaml,drivers/media/platform/imagination/e5010*
IMGTEC IR DECODER DRIVER #
- Status: Orphan
- Files:
drivers/media/rc/img-ir/
IMGTEC POWERVR DRM DRIVER #
- Mail: Frank Binns <frank.binns@imgtec.com>, Matt Coster <matt.coster@imgtec.com>
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/gpu/img,powervr-rogue.yaml,Documentation/devicetree/bindings/gpu/img,powervr-sgx.yaml,Documentation/gpu/imagination/,drivers/gpu/drm/ci/xfails/powervr*,drivers/gpu/drm/imagination/,include/uapi/drm/pvr_drm.h
IMON SOUNDGRAPH USB IR RECEIVER #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/rc/imon.c,drivers/media/rc/imon_raw.c
IMS TWINTURBO FRAMEBUFFER DRIVER #
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/video/fbdev/imsttfb.c
INA233 HARDWARE MONITOR DRIVERS #
- Mail: Leo Yang <leo.yang.sy0@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/ina233.rst,drivers/hwmon/pmbus/ina233.c
INDEX OF FURTHER KERNEL DOCUMENTATION #
- Mail: Carlos Bilbao <carlos.bilbao@kernel.org>
- Status: Maintained
- Files:
Documentation/process/kernel-docs.rst
INDUSTRY PACK SUBSYSTEM (IPACK) #
- Mail: Vaibhav Gupta <vaibhavgupta40@gmail.com>, Jens Taprogge <jens.taprogge@taprogge.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: industrypack-devel@lists.sourceforge.net
- Status: Maintained
- Web-page: http://industrypack.sourceforge.net
- Files:
drivers/ipack/,include/linux/ipack.h
INFINEON DPS310 Driver #
- Mail: Eddie James <eajames@linux.ibm.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/pressure/infineon,dps310.yaml,drivers/iio/pressure/dps310.c
INFINEON PEB2466 ASoC CODEC #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/infineon,peb2466.yaml,sound/soc/codecs/peb2466.c
INFINEON TLV493D Driver #
- Mail: Dixit Parmar <dixitparmar19@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: https://www.infineon.com/part/TLV493D-A1B6
- Files:
Documentation/devicetree/bindings/iio/magnetometer/infineon,tlv493d-a1b6.yaml,drivers/iio/magnetometer/tlv493d.c
INFINIBAND SUBSYSTEM #
- Mail: Jason Gunthorpe <jgg@nvidia.com>, Leon Romanovsky <leonro@nvidia.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: https://github.com/linux-rdma/rdma-core
- Patchwork: http://patchwork.kernel.org/project/linux-rdma/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git
- Files:
Documentation/devicetree/bindings/infiniband/,Documentation/infiniband/,drivers/infiniband/,include/rdma/,include/trace/events/ib_mad.h,include/trace/events/ib_umad.h,include/trace/misc/rdma.h,include/uapi/linux/if_infiniband.h,include/uapi/rdma/,samples/bpf/ibumad_kern.c,samples/bpf/ibumad_user.c
INGENIC JZ4780 NAND DRIVER #
- Mail: Harvey Hunt <harveyhuntnexus@gmail.com>
- Mailing list: linux-mtd@lists.infradead.org, linux-mips@vger.kernel.org
- Status: Maintained
- Files:
drivers/mtd/nand/raw/ingenic/
INGENIC JZ47xx SoCs #
- Mail: Paul Cercueil <paul@crapouillou.net>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/boot/dts/ingenic/,arch/mips/generic/board-ingenic.c,arch/mips/include/asm/mach-ingenic/,arch/mips/ingenic/Kconfig,drivers/clk/ingenic/,drivers/dma/dma-jz4780.c,drivers/gpu/drm/ingenic/,drivers/i2c/busses/i2c-jz4780.c,drivers/iio/adc/ingenic-adc.c,drivers/irqchip/irq-ingenic.c,drivers/memory/jz4780-nemc.c,drivers/mmc/host/jz4740_mmc.c,drivers/mtd/nand/raw/ingenic/,drivers/pinctrl/pinctrl-ingenic.c,drivers/power/supply/ingenic-battery.c,drivers/pwm/pwm-jz4740.c,drivers/remoteproc/ingenic_rproc.c,drivers/rtc/rtc-jz4740.c,drivers/tty/serial/8250/8250_ingenic.c,drivers/usb/musb/jz4740.c,drivers/watchdog/jz4740_wdt.c,include/dt-bindings/iio/adc/ingenic,adc.h,include/linux/mfd/ingenic-tcu.h,sound/soc/codecs/jz47*,sound/soc/jz4740/
INJOINIC IP5xxx POWER BANK IC DRIVER #
- Mail: Samuel Holland <samuel@sholland.org>
- Status: Maintained
- Files:
drivers/power/supply/ip5xxx_power.c
INNOSILICON HDMI BRIDGE DRIVER #
- Mail: Andy Yan <andy.yan@rock-chips.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/bridge/inno-hdmi.c,include/drm/bridge/inno_hdmi.h
INOTIFY #
- Mail: Jan Kara <jack@suse.cz>
- Reviewer: Amir Goldstein <amir73il@gmail.com>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/inotify.rst,fs/notify/inotify/,include/linux/inotify.h,include/uapi/linux/inotify.h
INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS #
- Mail: Dmitry Torokhov <dmitry.torokhov@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/linux-input/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
- Files:
Documentation/devicetree/bindings/input/,Documentation/devicetree/bindings/serio/,Documentation/input/,drivers/input/,include/dt-bindings/input/,include/linux/gameport.h,include/linux/i8042.h,include/linux/input.h,include/linux/input/,include/linux/libps2.h,include/linux/serio.h,include/uapi/linux/gameport.h,include/uapi/linux/input-event-codes.h,include/uapi/linux/input.h,include/uapi/linux/serio.h,include/uapi/linux/uinput.h
INPUT MULTITOUCH (MT) PROTOCOL #
- Mail: Henrik Rydberg <rydberg@bitmath.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Odd fixes
- Files:
Documentation/input/multi-touch-protocol.rst,drivers/input/input-mt.c - Content regex:
\b(ABS|SYN)_MT_
INSIDE SECURE CRYPTO DRIVER #
- Mail: Antoine Tenart <atenart@kernel.org>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/inside-secure/
INSIDE SECURE EIP93 CRYPTO DRIVER #
- Mail: Christian Marangi <ansuelsmth@gmail.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/inside-secure,safexcel-eip93.yaml,drivers/crypto/inside-secure/eip93/
INTEGRITY MEASUREMENT ARCHITECTURE (IMA) #
- Mail: Mimi Zohar <zohar@linux.ibm.com>, Roberto Sassu <roberto.sassu@huawei.com>, Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
- Reviewer: Eric Snowberg <eric.snowberg@oracle.com>
- Mailing list: linux-integrity@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
- Files:
security/integrity/,security/integrity/ima/
INTEGRITY POLICY ENFORCEMENT (IPE) #
- Mail: Fan Wu <wufan@kernel.org>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wufan/ipe.git
- Files:
Documentation/admin-guide/LSM/ipe.rst,Documentation/security/ipe.rst,scripts/ipe/,security/ipe/
INTEL 810/815 FRAMEBUFFER DRIVER #
- Mail: Antonino Daplas <adaplas@gmail.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/i810/
INTEL 8254 COUNTER DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/counter/i8254.c,include/linux/i8254.h
INTEL 8255 GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-i8255.c,drivers/gpio/gpio-i8255.h
INTEL ASoC DRIVERS #
- Mail: Cezary Rojewski <cezary.rojewski@intel.com>, Liam Girdwood <liam.r.girdwood@linux.intel.com>, Peter Ujfalusi <peter.ujfalusi@linux.intel.com>, Bard Liao <yung-chuan.liao@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>
- Reviewer: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- Files:
sound/soc/intel/
INTEL ATOMISP2 DUMMY / POWER-MANAGEMENT DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/intel/atomisp2/pm.c
INTEL ATOMISP2 LED DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/intel/atomisp2/led.c
INTEL BIOS SAR INT1092 DRIVER #
- Mail: Shravan Sudhakar <s.shravan@intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/intel/int1092/
INTEL BROXTON PMC DRIVER #
- Mail: Mika Westerberg <mika.westerberg@linux.intel.com>, Zha Qipeng <qipeng.zha@intel.com>
- Status: Maintained
- Files:
drivers/mfd/intel_pmc_bxt.c,include/linux/mfd/intel_pmc_bxt.h
INTEL C600 SERIES SAS CONTROLLER DRIVER #
- Mailing list: linux-scsi@vger.kernel.org
- Status: Orphan
- SCM: git git://git.code.sf.net/p/intel-sas/isci
- Files:
drivers/scsi/isci/
INTEL CPU family model numbers #
- Mail: Tony Luck <tony.luck@intel.com>, x86@kernel.org
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
arch/x86/include/asm/intel-family.h
INTEL DISCRETE GRAPHICS NVM MTD DRIVER #
- Mail: Alexander Usyskin <alexander.usyskin@intel.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Supported
- Files:
drivers/mtd/devices/mtd_intel_dg.c,include/linux/intel_dg_nvm_aux.h
INTEL DRM DISPLAY FOR XE AND I915 DRIVERS #
- Mail: Jani Nikula <jani.nikula@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>
- Mailing list: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
- Status: Supported
- Files:
drivers/gpu/drm/i915/display/,drivers/gpu/drm/xe/display/,drivers/gpu/drm/xe/compat-i915-headers,include/drm/intel/
INTEL DRM I915 DRIVER (Meteor Lake, DG2 and older excluding Poulsbo, Moorestown and derivative) #
- Mail: Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tursulin@ursulin.net>
- Mailing list: intel-gfx@lists.freedesktop.org
- Status: Supported
- Web-page: https://drm.pages.freedesktop.org/intel-docs/
- Patchwork: http://patchwork.freedesktop.org/project/intel-gfx/
- bugs: https://drm.pages.freedesktop.org/intel-docs/how-to-file-i915-bugs.html
- chat: irc://irc.oftc.net/intel-gfx
- SCM: git https://gitlab.freedesktop.org/drm/i915/kernel.git
- Files:
Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon,Documentation/gpu/i915.rst,drivers/gpu/drm/ci/xfails/i915*,drivers/gpu/drm/i915/,include/drm/intel/,include/uapi/drm/i915_drm.h
INTEL DRM XE DRIVER (Lunar Lake and newer) #
- Mail: Matthew Brost <matthew.brost@intel.com>, Thomas Hellström <thomas.hellstrom@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>
- Mailing list: intel-xe@lists.freedesktop.org
- Status: Supported
- Web-page: https://drm.pages.freedesktop.org/intel-docs/
- Patchwork: http://patchwork.freedesktop.org/project/intel-xe/
- bugs: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues
- chat: irc://irc.oftc.net/xe
- SCM: git https://gitlab.freedesktop.org/drm/xe/kernel.git
- Files:
Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon,Documentation/gpu/xe/,drivers/gpu/drm/xe/,include/drm/intel/,include/uapi/drm/xe_drm.h
INTEL ELKHART LAKE PSE I/O DRIVER #
- Mail: Raag Jadav <raag.jadav@intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/x86/intel/ehl_pse_io.c,include/linux/ehl_pse_io_aux.h
INTEL ETHERNET DRIVERS #
- Mail: Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>
- Mailing list: intel-wired-lan@lists.osuosl.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: https://www.intel.com/content/www/us/en/support.html
- Patchwork: https://patchwork.ozlabs.org/project/intel-wired-lan/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue.git, git git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git
- Files:
Documentation/networking/device_drivers/ethernet/intel/,drivers/net/ethernet/intel/,drivers/net/ethernet/intel/*/,include/linux/avf/virtchnl.h,include/linux/net/intel/*/
INTEL ETHERNET PROTOCOL DRIVER FOR RDMA #
- Mail: Krzysztof Czurylo <krzysztof.czurylo@intel.com>, Tatyana Nikolova <tatyana.e.nikolova@intel.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/hw/irdma/,include/uapi/rdma/irdma-abi.h
INTEL GPIO DRIVERS #
- Mail: Andy Shevchenko <andy@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
- Files:
drivers/gpio/gpio-elkhartlake.c,drivers/gpio/gpio-graniterapids.c,drivers/gpio/gpio-ich.c,drivers/gpio/gpio-merrifield.c,drivers/gpio/gpio-ml-ioh.c,drivers/gpio/gpio-pch.c,drivers/gpio/gpio-sch.c,drivers/gpio/gpio-sodaville.c,drivers/gpio/gpio-tangier.c,drivers/gpio/gpio-tangier.h
INTEL GVT-g DRIVERS (Intel GPU Virtualization) #
- Reviewer: Zhenyu Wang <zhenyuw.linux@gmail.com>, Zhi Wang <zhi.wang.linux@gmail.com>
- Status: Odd Fixes
- Web-page: https://github.com/intel/gvt-linux/wiki
- Files:
drivers/gpu/drm/i915/gvt/
INTEL HID EVENT DRIVER #
- Mail: Alex Hung <alexhung@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/intel/hid.c
INTEL I/OAT DMA DRIVER #
- Mail: Dave Jiang <dave.jiang@intel.com>
- Reviewer: Dan Williams <dan.j.williams@intel.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-dmaengine/list/
- Files:
drivers/dma/ioat*
INTEL IAA CRYPTO DRIVER #
- Mail: Kristen Accardi <kristen.c.accardi@intel.com>, Vinicius Costa Gomes <vinicius.gomes@intel.com>, Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
Documentation/driver-api/crypto/iaa/iaa-crypto.rst,drivers/crypto/intel/iaa/*
INTEL IDLE DRIVER #
- Mail: Rafael J. Wysocki <rafael@kernel.org>, Artem Bityutskiy <artem.bityutskiy@linux.intel.com>, Artem Bityutskiy <dedekind1@gmail.com>
- Reviewer: Len Brown <lenb@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
- Files:
drivers/idle/intel_idle.c
INTEL IDXD DRIVER #
- Mail: Vinicius Costa Gomes <vinicius.gomes@intel.com>
- Reviewer: Dave Jiang <dave.jiang@intel.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Files:
drivers/dma/idxd/*,include/uapi/linux/idxd.h
INTEL IN FIELD SCAN (IFS) DEVICE #
- Mail: Tony Luck <tony.luck@intel.com>
- Reviewer: Ashok Raj <ashok.raj.linux@gmail.com>
- Status: Maintained
- Files:
drivers/platform/x86/intel/ifs,include/trace/events/intel_ifs.h,tools/testing/selftests/drivers/platform/x86/intel/ifs/
INTEL INTEGRATED SENSOR HUB DRIVER #
- Mail: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Jiri Kosina <jikos@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/intel-ish-hid/
INTEL IOMMU (VT-d) #
- Mail: David Woodhouse <dwmw2@infradead.org>, Lu Baolu <baolu.lu@linux.intel.com>
- Mailing list: iommu@lists.linux.dev
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
- Files:
drivers/iommu/intel/
INTEL IPU3 CSI-2 CIO2 DRIVER #
- Mail: Yong Zhi <yong.zhi@intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Bingbu Cao <bingbu.cao@intel.com>, Dan Scally <dan.scally@ideasonboard.com>
- Reviewer: Tianshu Qiu <tian.shu.qiu@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/userspace-api/media/v4l/pixfmt-srggb10-ipu3.rst,drivers/media/pci/intel/ipu3/
INTEL IPU3 CSI-2 IMGU DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Reviewer: Bingbu Cao <bingbu.cao@intel.com>, Tianshu Qiu <tian.shu.qiu@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/ipu3.rst,Documentation/admin-guide/media/ipu3_rcb.svg,Documentation/userspace-api/media/v4l/metafmt-intel-ipu3.rst,drivers/staging/media/ipu3/
INTEL IPU6 INPUT SYSTEM DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>, Bingbu Cao <bingbu.cao@intel.com>
- Reviewer: Tianshu Qiu <tian.shu.qiu@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/ipu6-isys.rst,drivers/media/pci/intel/ipu6/
INTEL IPU7 INPUT SYSTEM DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Reviewer: Bingbu Cao <bingbu.cao@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/staging/media/ipu7/
INTEL ISHTP ECLITE DRIVER #
- Mail: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/x86/intel/ishtp_eclite.c
INTEL IXP4XX CRYPTO SUPPORT #
- Mail: Corentin Labbe <clabbe@baylibre.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
INTEL KEEM BAY DRM DRIVER #
- Mail: Anitha Chrisanthus <anitha.chrisanthus@intel.com>, Edmund Dea <edmund.j.dea@intel.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/intel,keembay-display.yaml,drivers/gpu/drm/kmb/
INTEL KEEM BAY OCS AES/SM4 CRYPTO DRIVER #
- Mail: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/intel,keembay-ocs-aes.yaml,drivers/crypto/intel/keembay/Kconfig,drivers/crypto/intel/keembay/Makefile,drivers/crypto/intel/keembay/keembay-ocs-aes-core.c,drivers/crypto/intel/keembay/ocs-aes.c,drivers/crypto/intel/keembay/ocs-aes.h
INTEL KEEM BAY OCS ECC CRYPTO DRIVER #
- Mail: Daniele Alessandrelli <daniele.alessandrelli@intel.com>, Prabhjot Khurana <prabhjot.khurana@intel.com>, Mark Gross <mgross@linux.intel.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/intel,keembay-ocs-ecc.yaml,drivers/crypto/intel/keembay/Kconfig,drivers/crypto/intel/keembay/Makefile,drivers/crypto/intel/keembay/keembay-ocs-ecc.c
INTEL KEEM BAY OCS HCU CRYPTO DRIVER #
- Mail: Daniele Alessandrelli <daniele.alessandrelli@intel.com>, Declan Murphy <declan.murphy@intel.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/intel,keembay-ocs-hcu.yaml,drivers/crypto/intel/keembay/Kconfig,drivers/crypto/intel/keembay/Makefile,drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c,drivers/crypto/intel/keembay/ocs-hcu.c,drivers/crypto/intel/keembay/ocs-hcu.h
INTEL LA JOLLA COVE ADAPTER (LJCA) USB I/O EXPANDER DRIVERS #
- Mail: Lixu Zhang <lixu.zhang@intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com>
- Status: Maintained
- Files:
drivers/gpio/gpio-ljca.c,drivers/i2c/busses/i2c-ljca.c,drivers/spi/spi-ljca.c,drivers/usb/misc/usb-ljca.c,include/linux/usb/ljca.h
INTEL MANAGEMENT ENGINE (mei) #
- Mail: Alexander Usyskin <alexander.usyskin@intel.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
Documentation/driver-api/mei/*,drivers/misc/mei/,drivers/watchdog/mei_wdt.c,include/linux/mei_aux.h,include/linux/mei_cl_bus.h,include/uapi/linux/mei.h,include/uapi/linux/mei_uuid.h,include/uapi/linux/uuid.h,samples/mei/*
INTEL MAX 10 BMC MFD DRIVER #
- Mail: Xu Yilun <yilun.xu@intel.com>
- Reviewer: Tom Rix <trix@redhat.com>
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-driver-intel-m10-bmc,Documentation/hwmon/intel-m10-bmc-hwmon.rst,drivers/hwmon/intel-m10-bmc-hwmon.c,drivers/mfd/intel-m10-bmc*,include/linux/mfd/intel-m10-bmc.h
INTEL MAX10 BMC SECURE UPDATES #
- Mail: Xu Yilun <yilun.xu@intel.com>
- Mailing list: linux-fpga@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-driver-intel-m10-bmc-sec-update,drivers/fpga/intel-m10-bmc-sec-update.c
INTEL MID (Mobile Internet Device) PLATFORM #
- Mail: Andy Shevchenko <andy@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
arch/x86/include/asm/intel-mid.h,arch/x86/pci/intel_mid.c,arch/x86/platform/intel-mid/,drivers/dma/hsu/,drivers/extcon/extcon-intel-mrfld.c,drivers/gpio/gpio-merrifield.c,drivers/gpio/gpio-tangier.*,drivers/iio/adc/intel_mrfld_adc.c,drivers/mfd/intel_soc_pmic_mrfld.c,drivers/pinctrl/intel/pinctrl-merrifield.c,drivers/pinctrl/intel/pinctrl-moorefield.c,drivers/pinctrl/intel/pinctrl-tangier.*,drivers/platform/x86/intel/mrfld_pwrbtn.c,drivers/platform/x86/intel_scu_*,drivers/staging/media/atomisp/,drivers/tty/serial/8250/8250_mid.c,drivers/watchdog/intel-mid_wdt.c,include/linux/mfd/intel_soc_pmic_mrfld.h,include/linux/platform_data/x86/intel-mid_wdt.h,include/linux/platform_data/x86/intel_scu_ipc.h
INTEL P-Unit IPC DRIVER #
- Mail: Zha Qipeng <qipeng.zha@intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
arch/x86/include/asm/intel_punit_ipc.h,drivers/platform/x86/intel/punit_ipc.c
INTEL PMC CORE DRIVER #
- Mail: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>, David E Box <david.e.box@intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-platform-intel-pmc,drivers/platform/x86/intel/pmc/,include/linux/platform_data/x86/intel_pmc_ipc.h
INTEL PMIC GPIO DRIVERS #
- Mail: Andy Shevchenko <andy@kernel.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
- Files:
drivers/gpio/gpio-*cove.c
INTEL PMIC MULTIFUNCTION DEVICE DRIVERS #
- Mail: Andy Shevchenko <andy@kernel.org>
- Status: Supported
- Files:
drivers/mfd/intel_soc_pmic*,include/linux/mfd/intel_soc_pmic*
INTEL PMT DRIVERS #
- Mail: David E. Box <david.e.box@linux.intel.com>
- Status: Supported
- Files:
Documentation/ABI/testing/sysfs-class-intel_pmt,Documentation/ABI/testing/sysfs-class-intel_pmt-features,drivers/platform/x86/intel/pmt/
INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT #
- Mail: Stanislav Yakovlev <stas.yakovlev@gmail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/wifi/intel/ipw2100.rst,Documentation/networking/device_drivers/wifi/intel/ipw2200.rst,drivers/net/wireless/intel/ipw2x00/
INTEL PSTATE DRIVER #
- Mail: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Len Brown <lenb@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Files:
drivers/cpufreq/intel_pstate.c
INTEL PTP DFL ToD DRIVER #
- Mailing list: linux-fpga@vger.kernel.org, netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/ptp/ptp_dfl_tod.c
INTEL QUADRATURE ENCODER PERIPHERAL DRIVER #
- Mail: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/counter/intel-qep.c
INTEL SCU DRIVERS #
- Mail: Mika Westerberg <mika.westerberg@linux.intel.com>
- Status: Maintained
- Files:
drivers/platform/x86/intel_scu_*,include/linux/platform_data/x86/intel_scu_ipc.h
INTEL SDSI DRIVER #
- Mail: David E. Box <david.e.box@linux.intel.com>
- Status: Supported
- Files:
drivers/platform/x86/intel/sdsi.c,tools/arch/x86/intel_sdsi/,tools/testing/selftests/drivers/sdsi/
INTEL SGX #
- Mail: Jarkko Sakkinen <jarkko@kernel.org>
- Reviewer: Dave Hansen <dave.hansen@linux.intel.com>
- Mailing list: linux-sgx@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/intel-sgx/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sgx
- Files:
Documentation/arch/x86/sgx.rst,arch/x86/entry/vdso/vdso64/vsgx.S,arch/x86/include/asm/sgx.h,arch/x86/include/uapi/asm/sgx.h,arch/x86/kernel/cpu/sgx/*,tools/testing/selftests/sgx/* - Content regex:
\bSGX_
INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER #
- Mail: Daniel Scally <dan.scally@ideasonboard.com>, Sakari Ailus <sakari.ailus@linux.intel.com>
- Status: Maintained
- Files:
drivers/platform/x86/intel/int3472/,include/linux/platform_data/x86/int3472.h
INTEL SPEED SELECT TECHNOLOGY #
- Mail: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/intel/speed_select_if/,include/uapi/linux/isst_if.h,tools/power/x86/intel-speed-select/
INTEL STRATIX10 FIRMWARE DRIVERS #
- Mail: Dinh Nguyen <dinguyen@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
- Files:
Documentation/ABI/testing/sysfs-devices-platform-stratix10-rsu,Documentation/devicetree/bindings/firmware/intel,stratix10-svc.yaml,drivers/firmware/stratix10-rsu.c,drivers/firmware/stratix10-svc.c,include/linux/firmware/intel/stratix10-smc.h,include/linux/firmware/intel/stratix10-svc-client.h
INTEL TELEMETRY DRIVER #
- Mail: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>, "David E. Box" <david.e.box@linux.intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
arch/x86/include/asm/intel_telemetry.h,drivers/platform/x86/intel/telemetry/
INTEL TOUCH HOST CONTROLLER (THC) DRIVER #
- Mail: Even Xu <even.xu@intel.com>, Xinpeng Sun <xinpeng.sun@intel.com>
- Status: Maintained
- Files:
drivers/hid/intel-thc-hid/
INTEL TPMI DRIVER #
- Mail: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-tpmi,drivers/platform/x86/intel/vsec_tpmi.c,include/linux/intel_tpmi.h
INTEL UNCORE FREQUENCY CONTROL #
- Mail: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/pm/intel_uncore_frequency_scaling.rst,drivers/platform/x86/intel/uncore-frequency/
INTEL USBIO USB I/O EXPANDER DRIVERS #
- Mail: Israel Cepeda <israel.a.cepeda.lopez@intel.com>, Hans de Goede <hansg@kernel.org>
- Reviewer: Sakari Ailus <sakari.ailus@linux.intel.com>
- Status: Maintained
- Files:
drivers/gpio/gpio-usbio.c,drivers/i2c/busses/i2c-usbio.c,drivers/usb/misc/usbio.c,include/linux/usb/usbio.h
INTEL VENDOR SPECIFIC EXTENDED CAPABILITIES DRIVER #
- Mail: David E. Box <david.e.box@linux.intel.com>
- Status: Supported
- Files:
drivers/platform/x86/intel/vsec.c,include/linux/intel_vsec.h
INTEL VIRTUAL BUTTON DRIVER #
- Mail: AceLan Kao <acelan.kao@canonical.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/intel/vbtn.c
INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy) #
- Mail: Stanislaw Gruszka <stf_xl@wp.pl>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Files:
drivers/net/wireless/intel/iwlegacy/
INTEL WIRELESS WIFI LINK (iwlwifi) #
- Mail: Miri Korenblit <miriam.rachel.korenblit@intel.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Web-page: https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git/
- Files:
drivers/net/wireless/intel/iwlwifi/
INTEL VISION SENSING CONTROLLER DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Reviewer: Bingbu Cao <bingbu.cao@intel.com>, Lixu Zhang <lixu.zhang@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/intel/ivsc/
INTEL WMI SLIM BOOTLOADER (SBL) FIRMWARE UPDATE DRIVER #
- Status: Orphan
- Web-page: https://slimbootloader.github.io/security/firmware-update.html
- Files:
drivers/platform/x86/intel/wmi/sbl-fw-update.c
INTEL WMI THUNDERBOLT FORCE POWER DRIVER #
- Mailing list: Dell.Client.Kernel@dell.com
- Status: Maintained
- Files:
drivers/platform/x86/intel/wmi/thunderbolt.c
INTEL WWAN IOSM DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wwan/iosm/
INTEL(R) FLEXIBLE RETURN AND EVENT DELIVERY #
- Mail: Xin Li <xin@zytor.com>, "H. Peter Anvin" <hpa@zytor.com>
- Status: Supported
- Files:
Documentation/arch/x86/x86_64/fred.rst,arch/x86/entry/entry_64_fred.S,arch/x86/entry/entry_fred.c,arch/x86/include/asm/fred.h,arch/x86/kernel/fred.c
INTEL(R) TRACE HUB #
- Mail: Alexander Shishkin <alexander.shishkin@linux.intel.com>
- Status: Supported
- Files:
Documentation/trace/intel_th.rst,drivers/hwtracing/intel_th/,include/linux/intel_th.h
INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) #
- Mail: Ning Sun <ning.sun@intel.com>
- Mailing list: tboot-devel@lists.sourceforge.net
- Status: Supported
- Web-page: http://tboot.sourceforge.net
- SCM: hg http://tboot.hg.sourceforge.net:8000/hgroot/tboot/tboot
- Files:
Documentation/arch/x86/intel_txt.rst,arch/x86/kernel/tboot.c,include/linux/tboot.h
INTERCONNECT API #
- Mail: Georgi Djakov <djakov@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc.git
- Files:
Documentation/devicetree/bindings/interconnect/,Documentation/driver-api/interconnect.rst,drivers/interconnect/,include/dt-bindings/interconnect/,include/linux/interconnect-clk.h,include/linux/interconnect-provider.h,include/linux/interconnect.h
INTERRUPT COUNTER DRIVER #
- Mail: Oleksij Rempel <o.rempel@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Mailing list: linux-iio@vger.kernel.org
- Files:
Documentation/devicetree/bindings/counter/interrupt-counter.yaml,drivers/counter/interrupt-cnt.c
INTERSIL ISL7998X VIDEO DECODER DRIVER #
- Mail: Michael Tretter <m.tretter@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/isil,isl79987.yaml,drivers/media/i2c/isl7998x.c
INVENSENSE ICM-426xx IMU DRIVER #
- Mail: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: https://invensense.tdk.com/
- Files:
Documentation/ABI/testing/sysfs-bus-iio-inv_icm42600,Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml,drivers/iio/imu/inv_icm42600/
INVENSENSE ICM-456xx IMU DRIVER #
- Mail: Remi Buisson <remi.buisson@tdk.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: https://invensense.tdk.com/
- Files:
Documentation/devicetree/bindings/iio/imu/invensense,icm45600.yaml,drivers/iio/imu/inv_icm45600/
INVENSENSE MPU-3050 GYROSCOPE DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/gyroscope/invensense,mpu3050.yaml,drivers/iio/gyro/mpu3050*
INVENSENSE MPU-6050 IMU DRIVER #
- Mail: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: https://invensense.tdk.com/
- Files:
Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml,drivers/iio/imu/inv_mpu6050/
IOC3 ETHERNET DRIVER #
- Mail: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/sgi/ioc3-eth.c
IOMMU DMA-API LAYER #
- Mail: Robin Murphy <robin.murphy@arm.com>
- Mailing list: iommu@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
- Files:
drivers/iommu/dma-iommu.c,drivers/iommu/dma-iommu.h,drivers/iommu/iova.c,include/linux/iommu-dma.h,include/linux/iova.h
IOMMU SUBSYSTEM #
- Mail: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
- Reviewer: Robin Murphy <robin.murphy@arm.com>
- Mailing list: iommu@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
- Files:
Documentation/devicetree/bindings/iommu/,drivers/iommu/,include/linux/iommu.h,include/linux/iova.h,include/linux/of_iommu.h,rust/kernel/iommu/
IOMMUFD #
- Mail: Jason Gunthorpe <jgg@nvidia.com>, Kevin Tian <kevin.tian@intel.com>
- Mailing list: iommu@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git
- Files:
Documentation/userspace-api/iommufd.rst,drivers/iommu/iommufd/,include/linux/iommufd.h,include/uapi/linux/iommufd.h,tools/testing/selftests/iommu/
IOSYS-MAP HELPERS #
- Mail: Thomas Zimmermann <tzimmermann@suse.de>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
include/linux/iosys-map.h
IO_URING #
- Mail: Jens Axboe <axboe@kernel.dk>
- Mailing list: io-uring@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git, git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/liburing.git
- Files:
include/linux/io_uring/,include/linux/io_uring.h,include/linux/io_uring_types.h,include/trace/events/io_uring.h,include/uapi/linux/io_uring.h,include/uapi/linux/io_uring/,io_uring/
IO_URING ZCRX #
- Mail: Pavel Begunkov <asml.silence@gmail.com>
- Mailing list: io-uring@vger.kernel.org, netdev@vger.kernel.org
- SCM: git https://github.com/isilence/linux.git zcrx/for-next, git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git
- Status: Maintained
- Files:
io_uring/zcrx.*
IPMI SUBSYSTEM #
- Mail: Corey Minyard <corey@minyard.net>
- Mailing list: openipmi-developer@lists.sourceforge.net (moderated for non-subscribers)
- Status: Supported
- Web-page: http://openipmi.sourceforge.net/
- SCM: git https://github.com/cminyard/linux-ipmi.git for-next
- Files:
Documentation/devicetree/bindings/ipmi/,Documentation/driver-api/ipmi.rst,drivers/char/ipmi/,include/linux/ipmi*,include/uapi/linux/ipmi*
IPS SCSI RAID DRIVER #
- Mail: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Web-page: http://www.adaptec.com/
- Files:
drivers/scsi/ips*
IPVS #
- Mail: Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>
- Mailing list: netdev@vger.kernel.org, lvs-devel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-next.git, git git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git
- Files:
Documentation/networking/ipvs-sysctl.rst,include/net/ip_vs.h,include/uapi/linux/ip_vs.h,net/netfilter/ipvs/
IPWIRELESS DRIVER #
- Mail: Jiri Kosina <jikos@kernel.org>, David Sterba <dsterba@suse.com>
- Status: Odd Fixes
- Files:
drivers/tty/ipwireless/
IRON DEVICE AUDIO CODEC DRIVERS #
- Mail: Kiseok Jo <kiseok.jo@irondevice.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/irondevice,*,sound/soc/codecs/sma*
IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) #
- Mail: Thomas Gleixner <tglx@kernel.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
- Files:
Documentation/core-api/irq/irq-domain.rst,include/linux/irqdomain.h,include/linux/irqdomain_defs.h,kernel/irq/irqdomain.c,kernel/irq/msi.c
IRQ SUBSYSTEM #
- Mail: Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
- Files:
include/linux/group_cpus.h,include/linux/irq.h,include/linux/irqhandler.h,include/linux/irqnr.h,include/linux/irqreturn.h,kernel/irq/,lib/group_cpus.c
IRQCHIP DRIVERS #
- Mail: Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
- Files:
Documentation/devicetree/bindings/interrupt-controller/,drivers/irqchip/,include/linux/irqchip.h
ISA #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Status: Maintained
- Files:
Documentation/driver-api/isa.rst,drivers/base/isa.c,include/linux/isa.h
ISA RADIO MODULE #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-isa*
ISAPNP #
- Mail: Jaroslav Kysela <perex@perex.cz>
- Status: Maintained
- Files:
Documentation/userspace-api/isapnp.rst,drivers/pnp/isapnp/,include/linux/isapnp.h
ISCSI #
- Mail: Lee Duncan <lduncan@suse.com>, Chris Leech <cleech@redhat.com>, Mike Christie <michael.christie@oracle.com>
- Mailing list: open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org
- Status: Maintained
- Web-page: www.open-iscsi.com
- Files:
drivers/scsi/*iscsi*,include/scsi/*iscsi*
iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER #
- Mail: Peter Jones <pjones@redhat.com>, Konrad Rzeszutek Wilk <konrad@kernel.org>
- Status: Maintained
- Files:
drivers/firmware/iscsi_ibft*
ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR #
- Mail: Sagi Grimberg <sagi@grimberg.me>, Max Gurtovoy <mgurtovoy@nvidia.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: http://www.openfabrics.org, www.open-iscsi.org
- Patchwork: http://patchwork.kernel.org/project/linux-rdma/list/
- Files:
drivers/infiniband/ulp/iser/
ISCSI EXTENSIONS FOR RDMA (ISER) TARGET #
- Mail: Sagi Grimberg <sagi@grimberg.me>
- Mailing list: linux-rdma@vger.kernel.org, target-devel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master
- Files:
drivers/infiniband/ulp/isert
ISDN/CMTP OVER BLUETOOTH #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Web-page: http://www.isdn4linux.de
- Files:
Documentation/isdn/,drivers/isdn/capi/,include/linux/isdn/,include/uapi/linux/isdn/,net/bluetooth/cmtp/
ISDN/mISDN SUBSYSTEM #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Web-page: http://www.isdn4linux.de
- Files:
drivers/isdn/Kconfig,drivers/isdn/Makefile,drivers/isdn/hardware/,drivers/isdn/mISDN/
ISL28022 HARDWARE MONITORING DRIVER #
- Mail: Carsten Spieß <mail@carsten-spiess.de>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/renesas,isl28022.yaml,Documentation/hwmon/isl28022.rst,drivers/hwmon/isl28022.c
ISOFS FILESYSTEM #
- Mail: Jan Kara <jack@suse.cz>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/isofs.rst,fs/isofs/
IT87 HARDWARE MONITORING DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/it87.rst,drivers/hwmon/it87.c
IT913X MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/it913x*
ITE IT6263 LVDS TO HDMI BRIDGE DRIVER #
- Mail: Liu Ying <victor.liu@nxp.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/bridge/ite,it6263.yaml,drivers/gpu/drm/bridge/ite-it6263.c
ITE IT66121 HDMI BRIDGE DRIVER #
- Mail: Phong LE <ple@baylibre.com>, Neil Armstrong <neil.armstrong@linaro.org>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml,drivers/gpu/drm/bridge/ite-it66121.c
IVTV VIDEO4LINUX DRIVER #
- Mail: Andy Walls <awalls@md.metrocast.net>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/ivtv*,drivers/media/pci/ivtv/,include/uapi/linux/ivtv*
IX2505V MEDIA DRIVER #
- Mail: Malcolm Priestley <tvboxspy@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/ix2505v*
JAILHOUSE HYPERVISOR INTERFACE #
- Mail: Jan Kiszka <jan.kiszka@siemens.com>
- Mailing list: jailhouse-dev@googlegroups.com
- Status: Maintained
- Files:
arch/x86/include/asm/jailhouse_para.h,arch/x86/kernel/jailhouse.c
JFS FILESYSTEM #
- Mail: Dave Kleikamp <shaggy@kernel.org>
- Mailing list: jfs-discussion@lists.sourceforge.net
- Status: Odd Fixes
- Web-page: http://jfs.sourceforge.net/
- SCM: git https://github.com/kleikamp/linux-shaggy.git
- Files:
Documentation/admin-guide/jfs.rst,fs/jfs/
JME NETWORK DRIVER #
- Mail: Guo-Fu Tseng <cooldavid@cooldavid.org>
- Mailing list: netdev@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/net/ethernet/jme.*
JOURNALLING FLASH FILE SYSTEM V2 (JFFS2) #
- Mail: David Woodhouse <dwmw2@infradead.org>, Richard Weinberger <richard@nod.at>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Odd Fixes
- Web-page: http://www.linux-mtd.infradead.org/doc/jffs2.html
- SCM: git git://git.infradead.org/ubifs-2.6.git
- Files:
fs/jffs2/,include/uapi/linux/jffs2.h
JOURNALLING LAYER FOR BLOCK DEVICES (JBD2) #
- Mail: "Theodore Ts'o" <tytso@mit.edu>, Jan Kara <jack@suse.com>
- Mailing list: linux-ext4@vger.kernel.org
- Status: Maintained
- Files:
fs/jbd2/,include/linux/jbd2.h
JPU V4L2 MEM2MEM DRIVER FOR RENESAS #
- Mail: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/platform/renesas/rcar_jpu.c
JSM Neo PCI based serial card #
- Mailing list: linux-serial@vger.kernel.org
- Status: Orphan
- Files:
drivers/tty/serial/jsm/
K10TEMP HARDWARE MONITORING DRIVER #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/k10temp.rst,drivers/hwmon/k10temp.c
K8TEMP HARDWARE MONITORING DRIVER #
- Mail: Rudolf Marek <r.marek@assembler.cz>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/k8temp.rst,drivers/hwmon/k8temp.c
KASAN #
- Mail: Andrey Ryabinin <ryabinin.a.a@gmail.com>
- Reviewer: Alexander Potapenko <glider@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>
- Mailing list: kasan-dev@googlegroups.com
- Status: Maintained
- bugs: https://bugzilla.kernel.org/buglist.cgi?component=Sanitizers&product=Memory%20Management
- Files:
Documentation/dev-tools/kasan.rst,arch/*/include/asm/*kasan.h,arch/*/mm/kasan_init*,include/linux/kasan*.h,lib/Kconfig.kasan,mm/kasan/,scripts/Makefile.kasan
KCONFIG #
- Mail: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>
- Mailing list: linux-kbuild@vger.kernel.org
- Status: Odd Fixes
- Patchwork: https://patchwork.kernel.org/project/linux-kbuild/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git
- Files:
Documentation/kbuild/kconfig*,scripts/Kconfig.include,scripts/kconfig/
KCORE #
- Mail: Omar Sandoval <osandov@osandov.com>
- Mailing list: linux-debuggers@vger.kernel.org
- Status: Maintained
- Files:
fs/proc/kcore.c,include/linux/kcore.h
KCOV #
- Reviewer: Dmitry Vyukov <dvyukov@google.com>, Andrey Konovalov <andreyknvl@gmail.com>
- Mailing list: kasan-dev@googlegroups.com
- Status: Maintained
- bugs: https://bugzilla.kernel.org/buglist.cgi?component=Sanitizers&product=Memory%20Management
- Files:
Documentation/dev-tools/kcov.rst,include/linux/kcov.h,include/uapi/linux/kcov.h,kernel/kcov.c,scripts/Makefile.kcov
KCSAN #
- Mail: Marco Elver <elver@google.com>
- Reviewer: Dmitry Vyukov <dvyukov@google.com>
- Mailing list: kasan-dev@googlegroups.com
- Status: Maintained
- Files:
Documentation/dev-tools/kcsan.rst,include/linux/kcsan*.h,kernel/kcsan/,lib/Kconfig.kcsan,scripts/Makefile.kcsan
KDUMP #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Baoquan He <bhe@redhat.com>
- Reviewer: Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>
- Mailing list: kexec@lists.infradead.org
- Status: Maintained
- Web-page: http://lse.sourceforge.net/kdump/
- Files:
Documentation/admin-guide/kdump/,fs/proc/vmcore.c,include/linux/crash_core.h,include/linux/crash_dump.h,include/uapi/linux/vmcore.h,kernel/crash_*.c
KEENE FM RADIO TRANSMITTER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-keene*
KERNEL AUTOMOUNTER #
- Mail: Ian Kent <raven@themaw.net>
- Mailing list: autofs@vger.kernel.org
- Status: Maintained
- Files:
fs/autofs/
KERNEL BUILD + files below scripts/ (unless maintained elsewhere) #
- Mail: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>
- Mailing list: linux-kbuild@vger.kernel.org
- Status: Odd Fixes
- Patchwork: https://patchwork.kernel.org/project/linux-kbuild/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git
- Files:
Documentation/kbuild/,Makefile,scripts/*vmlinux*,scripts/Kbuild*,scripts/Makefile*,scripts/bash-completion/,scripts/basic/,scripts/clang-tools/,scripts/container,scripts/dummy-tools/,scripts/include/,scripts/install.sh,scripts/mk*,scripts/mod/,scripts/package/,usr/
KERNEL HARDENING (not covered by other areas) #
- Mail: Kees Cook <kees@kernel.org>
- Reviewer: Gustavo A. R. Silva <gustavoars@kernel.org>
- Mailing list: linux-hardening@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
Documentation/ABI/testing/sysfs-kernel-oops_count,Documentation/ABI/testing/sysfs-kernel-warn_count,arch/*/configs/hardening.config,include/linux/kstack_erase.h,include/linux/overflow.h,include/linux/randomize_kstack.h,include/linux/ucopysize.h,kernel/configs/hardening.config,kernel/kstack_erase.c,lib/tests/randstruct_kunit.c,lib/tests/usercopy_kunit.c,mm/usercopy.c,scripts/Makefile.kstack_erase,scripts/Makefile.randstruct,security/Kconfig.hardening - Content regex:
\b(add|choose)_random_kstack_offset\b,\b__check_(object_size|heap_object)\b,\b__counted_by(_le|_be)?\b
KERNEL JANITORS #
- Mailing list: kernel-janitors@vger.kernel.org
- Status: Odd Fixes
- Web-page: http://kernelnewbies.org/KernelJanitors
KERNEL NFSD, SUNRPC, AND LOCKD SERVERS #
- Mail: Chuck Lever <chuck.lever@oracle.com>, Jeff Layton <jlayton@kernel.org>
- Reviewer: NeilBrown <neil@brown.name>, Olga Kornievskaia <okorniev@redhat.com>, Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
- Mailing list: linux-nfs@vger.kernel.org
- Status: Supported
- Subsystem Profile: Documentation/filesystems/nfs/nfsd-maintainer-entry-profile.rst
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
- Files:
Documentation/filesystems/nfs/,fs/lockd/,fs/nfs_common/,fs/nfsd/,include/linux/lockd/,include/linux/sunrpc/,include/trace/events/rpcgss.h,include/trace/events/rpcrdma.h,include/trace/events/sunrpc.h,include/trace/misc/fs.h,include/trace/misc/nfs.h,include/trace/misc/sunrpc.h,include/uapi/linux/nfsd/,include/uapi/linux/sunrpc/,net/sunrpc/,tools/net/sunrpc/
KERNEL NFSD BLOCK and SCSI LAYOUT DRIVER #
- Reviewer: Christoph Hellwig <hch@lst.de>
- Files:
fs/nfsd/blocklayout*
KERNEL PACMAN PACKAGING (in addition to generic KERNEL BUILD) #
- Mail: Thomas Weißschuh <linux@weissschuh.net>
- Reviewer: Christian Heusel <christian@heusel.eu>, Nathan Chancellor <nathan@kernel.org>
- Status: Maintained
- Files:
scripts/package/PKGBUILD
KERNEL REGRESSIONS #
- Mail: Thorsten Leemhuis <linux@leemhuis.info>
- Mailing list: regressions@lists.linux.dev
- Status: Supported
- Files:
Documentation/admin-guide/reporting-regressions.rst,Documentation/process/handling-regressions.rst
KERNEL SELFTEST FRAMEWORK #
- Mail: Shuah Khan <shuah@kernel.org>, Shuah Khan <skhan@linuxfoundation.org>
- Mailing list: linux-kselftest@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-kselftest/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
- Files:
Documentation/dev-tools/kselftest*,tools/testing/selftests/
KERNEL SMB3 SERVER (KSMBD) #
- Mail: Namjae Jeon <linkinjeon@kernel.org>, Namjae Jeon <linkinjeon@samba.org>, Steve French <smfrench@gmail.com>, Steve French <sfrench@samba.org>
- Reviewer: Sergey Senozhatsky <senozhatsky@chromium.org>, Tom Talpey <tom@talpey.com>
- Mailing list: linux-cifs@vger.kernel.org
- Status: Maintained
- SCM: git git://git.samba.org/ksmbd.git
- Files:
Documentation/filesystems/smb/ksmbd.rst,fs/smb/common/,fs/smb/server/
KERNEL UNIT TESTING FRAMEWORK (KUnit) #
- Mail: Brendan Higgins <brendan.higgins@linux.dev>, David Gow <david@davidgow.net>
- Reviewer: Rae Moar <raemoar63@gmail.com>
- Mailing list: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com
- Status: Maintained
- Web-page: https://google.github.io/kunit-docs/third_party/kernel/docs/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git kunit, git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git kunit-fixes
- Files:
Documentation/dev-tools/kunit/,include/kunit/,lib/kunit/,rust/kernel/kunit.rs,rust/macros/kunit.rs,scripts/rustdoc_test_*,tools/testing/kunit/
KERNEL USERMODE HELPER #
- Mail: Luis Chamberlain <mcgrof@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
include/linux/umh.h,kernel/umh.c
KERNEL VIRTUAL MACHINE (KVM) #
- Mail: Paolo Bonzini <pbonzini@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- Web-page: http://www.linux-kvm.org
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
Documentation/virt/kvm/,include/asm-generic/kvm*,include/kvm/iodev.h,include/linux/kvm*,include/trace/events/kvm.h,include/uapi/asm-generic/kvm*,include/uapi/linux/kvm*,tools/kvm/,tools/testing/selftests/kvm/,virt/kvm/*
KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64) #
- Mail: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>
- Reviewer: Joey Gouly <joey.gouly@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Zenghui Yu <yuzenghui@huawei.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), kvmarm@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git
- Files:
Documentation/virt/kvm/arm/,Documentation/virt/kvm/devices/arm*,arch/arm64/include/asm/kvm*,arch/arm64/include/uapi/asm/kvm*,arch/arm64/kvm/,include/kvm/arm_*,tools/testing/selftests/kvm/*/arm64/,tools/testing/selftests/kvm/arm64/
KERNEL VIRTUAL MACHINE FOR LOONGARCH (KVM/LoongArch) #
- Mail: Tianrui Zhao <zhaotianrui@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Huacai Chen <chenhuacai@kernel.org>
- Mailing list: kvm@vger.kernel.org, loongarch@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
Documentation/virt/kvm/loongarch/,arch/loongarch/include/asm/kvm*,arch/loongarch/include/uapi/asm/kvm*,arch/loongarch/kvm/,tools/testing/selftests/kvm/*/loongarch/,tools/testing/selftests/kvm/lib/loongarch/
KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips) #
- Mail: Huacai Chen <chenhuacai@kernel.org>
- Mailing list: linux-mips@vger.kernel.org, kvm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
arch/mips/include/asm/kvm*,arch/mips/include/uapi/asm/kvm*,arch/mips/kvm/
KERNEL VIRTUAL MACHINE FOR POWERPC (KVM/powerpc) #
- Mail: Madhavan Srinivasan <maddy@linux.ibm.com>
- Reviewer: Nicholas Piggin <npiggin@gmail.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org
- Status: Maintained (Book3S 64-bit HV), Odd fixes (Book3S 64-bit PR), Orphan (Book3E and 32-bit)
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git topic/ppc-kvm
- Files:
arch/powerpc/include/asm/kvm*,arch/powerpc/include/uapi/asm/kvm*,arch/powerpc/kernel/kvm*,arch/powerpc/kvm/
KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv) #
- Mail: Anup Patel <anup@brainfault.org>
- Reviewer: Atish Patra <atish.patra@linux.dev>
- Mailing list: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org
- Status: Maintained
- SCM: git https://github.com/kvm-riscv/linux.git
- Files:
arch/riscv/include/asm/kvm*,arch/riscv/include/uapi/asm/kvm*,arch/riscv/kvm/,tools/testing/selftests/kvm/*/riscv/,tools/testing/selftests/kvm/riscv/
KERNEL VIRTUAL MACHINE for s390 (KVM/s390) #
- Mail: Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>
- Reviewer: David Hildenbrand <david@kernel.org>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
- Files:
Documentation/virt/kvm/s390*,arch/s390/include/asm/gmap_helpers.h,arch/s390/include/asm/kvm*,arch/s390/include/uapi/asm/kvm*,arch/s390/include/uapi/asm/uvdevice.h,arch/s390/kernel/uv.c,arch/s390/kvm/,arch/s390/mm/gmap_helpers.c,drivers/s390/char/uvdevice.c,tools/testing/selftests/drivers/s390x/uvdevice/,tools/testing/selftests/kvm/*/s390/,tools/testing/selftests/kvm/s390/
KERNEL VIRTUAL MACHINE FOR X86 (KVM/x86) #
- Mail: Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- Subsystem Profile: Documentation/process/maintainer-kvm-x86.rst
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
arch/x86/include/asm/kvm*,arch/x86/include/asm/svm.h,arch/x86/include/asm/vmx*.h,arch/x86/include/uapi/asm/kvm*,arch/x86/include/uapi/asm/svm.h,arch/x86/include/uapi/asm/vmx.h,arch/x86/kvm/,arch/x86/kvm/*/,tools/testing/selftests/kvm/*/x86/,tools/testing/selftests/kvm/x86/
KERNFS #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Tejun Heo <tj@kernel.org>
- Mailing list: driver-core@lists.linux.dev
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
- Files:
fs/kernfs/,include/linux/kernfs.h
KEXEC #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Baoquan He <bhe@redhat.com>
- Mailing list: kexec@lists.infradead.org
- Web-page: http://kernel.org/pub/linux/utils/kernel/kexec/
- Files:
include/linux/kexec.h,include/uapi/linux/kexec.h,kernel/kexec*
KEXEC HANDOVER (KHO) #
- Mail: Alexander Graf <graf@amazon.com>, Mike Rapoport <rppt@kernel.org>, Pasha Tatashin <pasha.tatashin@soleen.com>
- Reviewer: Pratyush Yadav <pratyush@kernel.org>
- Mailing list: kexec@lists.infradead.org, linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/admin-guide/mm/kho.rst,Documentation/core-api/kho/*,include/linux/kexec_handover.h,include/linux/kho/,include/linux/kho/abi/,kernel/liveupdate/kexec_handover*,lib/test_kho.c,tools/testing/selftests/kho/
KEYS-ENCRYPTED #
- Mail: Mimi Zohar <zohar@linux.ibm.com>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Supported
- Files:
Documentation/security/keys/trusted-encrypted.rst,include/keys/encrypted-type.h,security/keys/encrypted-keys/
KEYS-TRUSTED #
- Mail: James Bottomley <James.Bottomley@HansenPartnership.com>, Jarkko Sakkinen <jarkko@kernel.org>, Mimi Zohar <zohar@linux.ibm.com>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Supported
- Files:
Documentation/security/keys/trusted-encrypted.rst,include/keys/trusted-type.h,include/keys/trusted_tpm.h,security/keys/trusted-keys/
KEYS-TRUSTED-CAAM #
- Mail: Ahmad Fatoum <a.fatoum@pengutronix.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Maintained
- Files:
include/keys/trusted_caam.h,security/keys/trusted-keys/trusted_caam.c
KEYS-TRUSTED-DCP #
- Mail: David Gstir <david@sigma-star.at>
- Reviewer: sigma star Kernel Team <upstream+dcp@sigma-star.at>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Supported
- Files:
include/keys/trusted_dcp.h,security/keys/trusted-keys/trusted_dcp.c
KEYS-TRUSTED-PLPKS #
- Mail: Srish Srinivasan <ssrish@linux.ibm.com>, Nayna Jain <nayna@linux.ibm.com>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Supported
- Files:
include/keys/trusted_pkwm.h,security/keys/trusted-keys/trusted_pkwm.c
KEYS-TRUSTED-TEE #
- Mail: Sumit Garg <sumit.garg@kernel.org>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Supported
- Files:
include/keys/trusted_tee.h,security/keys/trusted-keys/trusted_tee.c
KEYS/KEYRINGS #
- Mail: David Howells <dhowells@redhat.com>, Jarkko Sakkinen <jarkko@kernel.org>
- Mailing list: keyrings@vger.kernel.org
- Status: Maintained
- Files:
Documentation/security/keys/core.rst,include/keys/,include/linux/key-type.h,include/linux/key.h,include/linux/keyctl.h,include/uapi/linux/keyctl.h,security/keys/
KEYS/KEYRINGS_INTEGRITY #
- Mail: Jarkko Sakkinen <jarkko@kernel.org>, Mimi Zohar <zohar@linux.ibm.com>
- Mailing list: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org
- Status: Supported
- Web-page: https://kernsec.org/wiki/index.php/Linux_Kernel_Integrity
- Files:
security/integrity/platform_certs
KFENCE #
- Mail: Alexander Potapenko <glider@google.com>, Marco Elver <elver@google.com>
- Reviewer: Dmitry Vyukov <dvyukov@google.com>
- Mailing list: kasan-dev@googlegroups.com
- Status: Maintained
- Files:
Documentation/dev-tools/kfence.rst,arch/*/include/asm/kfence.h,include/linux/kfence.h,lib/Kconfig.kfence,mm/kfence/
KFIFO #
- Mail: Stefani Seibold <stefani@seibold.net>
- Status: Maintained
- Files:
include/linux/kfifo.h,lib/kfifo.c,samples/kfifo/
KGDB / KDB /debug_core #
- Mail: Jason Wessel <jason.wessel@windriver.com>, Daniel Thompson <danielt@kernel.org>
- Reviewer: Douglas Anderson <dianders@chromium.org>
- Mailing list: kgdb-bugreport@lists.sourceforge.net
- Status: Maintained
- Web-page: http://kgdb.wiki.kernel.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb.git
- Files:
Documentation/process/debugging/kgdb.rst,drivers/misc/kgdbts.c,drivers/tty/serial/kgdboc.c,include/linux/kdb.h,include/linux/kgdb.h,kernel/debug/,kernel/module/kdb.c
KHADAS MCU MFD DRIVER #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>
- Mailing list: linux-amlogic@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/khadas,mcu.yaml,drivers/mfd/khadas-mcu.c,drivers/thermal/khadas_mcu_fan.c,include/linux/mfd/khadas-mcu.h
KIONIX/ROHM KX022A ACCELEROMETER #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/iio/accel/kionix-kx022a*
KMEMLEAK #
- Mail: Catalin Marinas <catalin.marinas@arm.com>
- Status: Maintained
- Files:
Documentation/dev-tools/kmemleak.rst,include/linux/kmemleak.h,mm/kmemleak.c,samples/kmemleak/kmemleak-test.c
KMSAN #
- Mail: Alexander Potapenko <glider@google.com>
- Reviewer: Marco Elver <elver@google.com>, Dmitry Vyukov <dvyukov@google.com>
- Mailing list: kasan-dev@googlegroups.com
- Status: Maintained
- Files:
Documentation/dev-tools/kmsan.rst,arch/*/include/asm/kmsan.h,arch/*/mm/kmsan_*,include/linux/kmsan*.h,lib/Kconfig.kmsan,mm/kmsan/,scripts/Makefile.kmsan
KPROBES #
- Mail: Naveen N Rao <naveen@kernel.org>, "David S. Miller" <davem@davemloft.net>, Masami Hiramatsu <mhiramat@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-trace-kernel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
- Files:
Documentation/trace/kprobes.rst,include/asm-generic/kprobes.h,include/linux/kprobes.h,kernel/kprobes.c,lib/tests/test_kprobes.c,samples/kprobes
KS0108 LCD CONTROLLER DRIVER #
- Mail: Miguel Ojeda <ojeda@kernel.org>
- Status: Maintained
- Files:
Documentation/admin-guide/auxdisplay/ks0108.rst,drivers/auxdisplay/ks0108.c,include/linux/ks0108.h
KTD253 BACKLIGHT DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/backlight/kinetic,ktd253.yaml,drivers/video/backlight/ktd253-backlight.c
KTD2801 BACKLIGHT DRIVER #
- Mail: Duje Mihanović <duje.mihanovic@skole.hr>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/backlight/kinetic,ktd2801.yaml,drivers/video/backlight/ktd2801-backlight.c
KTEST #
- Mail: Steven Rostedt <rostedt@goodmis.org>, John Hawley <warthog9@eaglescrag.net>
- Status: Maintained
- Files:
tools/testing/ktest
KTZ8866 BACKLIGHT DRIVER #
- Mail: Jianhua Lu <lujianhua000@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml,drivers/video/backlight/ktz8866.c
KVM PARAVIRT (KVM/paravirt) #
- Mail: Paolo Bonzini <pbonzini@redhat.com>
- Reviewer: Vitaly Kuznetsov <vkuznets@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
arch/um/include/asm/kvm_para.h,arch/x86/include/asm/kvm_para.h,arch/x86/include/asm/pvclock-abi.h,arch/x86/include/uapi/asm/kvm_para.h,arch/x86/kernel/kvm.c,arch/x86/kernel/kvmclock.c,include/asm-generic/kvm_para.h,include/linux/kvm_para.h,include/uapi/asm-generic/kvm_para.h,include/uapi/linux/kvm_para.h
KVM X86 HYPER-V (KVM/hyper-v) #
- Mail: Vitaly Kuznetsov <vkuznets@redhat.com>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
arch/x86/kvm/hyperv.*,arch/x86/kvm/kvm_onhyperv.*,arch/x86/kvm/svm/hyperv.*,arch/x86/kvm/svm/svm_onhyperv.*,arch/x86/kvm/vmx/hyperv.*
KVM X86 Xen (KVM/Xen) #
- Mail: David Woodhouse <dwmw2@infradead.org>, Paul Durrant <paul@xen.org>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
- Files:
arch/x86/kvm/xen.*
L3MDEV #
- Mail: David Ahern <dsahern@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
include/net/l3mdev.h,net/l3mdev
LANDLOCK SECURITY MODULE #
- Mail: Mickaël Salaün <mic@digikod.net>
- Reviewer: Günther Noack <gnoack@google.com>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Supported
- Web-page: https://landlock.io
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git
- Files:
Documentation/admin-guide/LSM/landlock.rst,Documentation/security/landlock.rst,Documentation/userspace-api/landlock.rst,fs/ioctl.c,include/uapi/linux/landlock.h,samples/landlock/,security/landlock/,tools/testing/selftests/landlock/ - Content regex:
landlock,LANDLOCK
LANTIQ / MAXLINEAR / INTEL Ethernet DSA drivers #
- Mail: Hauke Mehrtens <hauke@hauke-m.de>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml,drivers/net/dsa/lantiq/*,drivers/net/ethernet/lantiq_xrx200.c,net/dsa/tag_gswip.c,net/dsa/tag_mxl-gsw1xx.c
LANTIQ MIPS ARCHITECTURE #
- Mail: John Crispin <john@phrozen.org>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/lantiq,drivers/soc/lantiq
LANTIQ PEF2256 DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/lantiq,pef2256.yaml,drivers/net/wan/framer/,drivers/pinctrl/pinctrl-pef2256.c,include/linux/framer/
LASI 53c700 driver for PARISC #
- Mail: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/scsi/53c700.rst,drivers/scsi/53c700*
LEAKING_ADDRESSES #
- Mail: Tycho Andersen <tycho@tycho.pizza>
- Reviewer: Kees Cook <kees@kernel.org>
- Mailing list: linux-hardening@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
scripts/leaking_addresses.pl
LED SUBSYSTEM #
- Mail: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git
- Files:
Documentation/devicetree/bindings/leds/,Documentation/leds/,drivers/leds/,include/dt-bindings/leds/,include/linux/leds.h
LEGO MINDSTORMS EV3 #
- Reviewer: David Lechner <david@lechnology.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/supply/lego,ev3-battery.yaml,arch/arm/boot/dts/ti/davinci/da850-lego-ev3.dts,drivers/power/supply/lego_ev3_battery.c
LEGO USB Tower driver #
- Mail: Juergen Stuber <starblue@users.sourceforge.net>
- Mailing list: legousb-devel@lists.sourceforge.net
- Status: Maintained
- Web-page: http://legousb.sourceforge.net/
- Files:
drivers/usb/misc/legousbtower.c
LENOVO drivers #
- Mail: Mark Pearson <mpearson-lenovo@squebb.ca>, Derek J. Clark <derekjohn.clark@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/wmi/devices/lenovo-wmi-gamezone.rst,Documentation/wmi/devices/lenovo-wmi-other.rst,drivers/platform/x86/lenovo/*
LENOVO WMI HOTKEY UTILITIES DRIVER #
- Mail: Jackie Dong <xy-jackie@139.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/lenovo/wmi-hotkey-utilities.c
LETSKETCH HID TABLET DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
- Files:
drivers/hid/hid-letsketch.c
LG LAPTOP EXTRAS #
- Mail: Matan Ziv-Av <matan@svgalib.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-platform-lg-laptop,Documentation/admin-guide/laptops/lg-laptop.rst,drivers/platform/x86/lg-laptop.c
LG2160 MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/tuners.git
- Files:
drivers/media/dvb-frontends/lg2160.*
LGDT3305 MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/tuners.git
- Files:
drivers/media/dvb-frontends/lgdt3305.*
LIBATA PATA ARASAN COMPACT FLASH CONTROLLER #
- Mail: Viresh Kumar <vireshk@kernel.org>
- Mailing list: linux-ide@vger.kernel.org
- Status: Maintained
- Files:
drivers/ata/pata_arasan_cf.c,include/linux/pata_arasan_cf_data.h
LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-ide@vger.kernel.org
- Status: Maintained
- Files:
drivers/ata/pata_ftide010.c,drivers/ata/sata_gemini.c,drivers/ata/sata_gemini.h
LIBATA SATA AHCI PLATFORM devices support #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-ide@vger.kernel.org
- Status: Maintained
- Files:
drivers/ata/ahci_platform.c,drivers/ata/libahci_platform.c,include/linux/ahci_platform.h
LIBATA SATA PROMISE TX2/TX4 CONTROLLER DRIVER #
- Mail: Mikael Pettersson <mikpelinux@gmail.com>
- Mailing list: linux-ide@vger.kernel.org
- Status: Maintained
- Files:
drivers/ata/sata_promise.*
LIBATA SUBSYSTEM (Serial and Parallel ATA drivers) #
- Mail: Damien Le Moal <dlemoal@kernel.org>, Niklas Cassel <cassel@kernel.org>
- Mailing list: linux-ide@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git
- Files:
Documentation/ABI/testing/sysfs-ata,Documentation/devicetree/bindings/ata/,drivers/ata/,include/linux/ata.h,include/linux/libata.h
LIBETH COMMON ETHERNET LIBRARY #
- Mail: Alexander Lobakin <aleksander.lobakin@intel.com>
- Mailing list: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/alobakin/linux.git
- Files:
drivers/net/ethernet/intel/libeth/,include/net/libeth/ - Content regex:
libeth
LIBIE COMMON INTEL ETHERNET LIBRARY #
- Mail: Alexander Lobakin <aleksander.lobakin@intel.com>
- Mailing list: intel-wired-lan@lists.osuosl.org (moderated for non-subscribers), netdev@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/alobakin/linux.git
- Files:
drivers/net/ethernet/intel/libie/,include/linux/net/intel/libie/ - Content regex:
libie
LIBNVDIMM BTT: BLOCK TRANSLATION TABLE #
- Mail: Vishal Verma <vishal.l.verma@intel.com>, Dan Williams <dan.j.williams@intel.com>, Dave Jiang <dave.jiang@intel.com>
- Mailing list: nvdimm@lists.linux.dev
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-nvdimm/list/
- Subsystem Profile: Documentation/nvdimm/maintainer-entry-profile.rst
- Files:
drivers/nvdimm/btt*
LIBNVDIMM PMEM: PERSISTENT MEMORY DRIVER #
- Mail: Dan Williams <dan.j.williams@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com>
- Mailing list: nvdimm@lists.linux.dev
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-nvdimm/list/
- Subsystem Profile: Documentation/nvdimm/maintainer-entry-profile.rst
- Files:
drivers/nvdimm/pmem*
LIBNVDIMM: DEVICETREE BINDINGS #
- Mail: Oliver O'Halloran <oohall@gmail.com>
- Mailing list: nvdimm@lists.linux.dev
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-nvdimm/list/
- Files:
Documentation/devicetree/bindings/pmem/pmem-region.yaml,drivers/nvdimm/of_pmem.c
LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM #
- Mail: Dan Williams <dan.j.williams@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com>, Ira Weiny <ira.weiny@intel.com>
- Mailing list: nvdimm@lists.linux.dev
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-nvdimm/list/
- Subsystem Profile: Documentation/nvdimm/maintainer-entry-profile.rst
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
- Files:
drivers/acpi/nfit/*,drivers/nvdimm/*,include/linux/libnvdimm.h,include/linux/nd.h,include/uapi/linux/ndctl.h,tools/testing/nvdimm/
LIBRARY CODE #
- Mail: Andrew Morton <akpm@linux-foundation.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
- Files:
lib/*
LICENSES and SPDX stuff #
- Mail: Thomas Gleixner <tglx@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: linux-spdx@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx.git
- Files:
COPYING,Documentation/process/license-rules.rst,LICENSES/,scripts/spdxcheck-test.sh,scripts/spdxcheck.py,scripts/spdxexclude
LINEAR RANGES HELPERS #
- Mail: Mark Brown <broonie@kernel.org>
- Reviewer: Matti Vaittinen <mazziesaccount@gmail.com>
- Files:
include/linux/linear_range.h,lib/linear_ranges.c,lib/tests/test_linear_ranges.c
LINUX FOR POWER MACINTOSH #
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
arch/powerpc/platforms/powermac/,drivers/macintosh/ - Excluded:
drivers/macintosh/adb-iop.c,drivers/macintosh/via-macii.c
LINUX FOR POWERPC (32-BIT AND 64-BIT) #
- Mail: Madhavan Srinivasan <maddy@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>
- Reviewer: Nicholas Piggin <npiggin@gmail.com>, Christophe Leroy (CS GROUP) <chleroy@kernel.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Supported
- Web-page: https://github.com/linuxppc/wiki/wiki
- Patchwork: http://patchwork.ozlabs.org/project/linuxppc-dev/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
- Files:
Documentation/ABI/stable/sysfs-firmware-opal-*,Documentation/devicetree/bindings/i2c/i2c-opal.txt,Documentation/devicetree/bindings/powerpc/,Documentation/devicetree/bindings/rtc/rtc-opal.txt,Documentation/arch/powerpc/,arch/powerpc/,drivers/*/*/*pasemi*,drivers/*/*pasemi*,drivers/char/tpm/tpm_ibmvtpm*,drivers/crypto/nx/,drivers/i2c/busses/i2c-opal.c,drivers/net/ethernet/ibm/ibmveth.*,drivers/net/ethernet/ibm/ibmvnic.*,drivers/pci/hotplug/pnv_php.c,drivers/pci/hotplug/rpa*,drivers/rtc/rtc-opal.c,drivers/scsi/ibmvscsi/,drivers/tty/hvc/hvc_opal.c,drivers/watchdog/wdrtas.c,include/linux/papr_scm.h,include/uapi/linux/papr_pdsm.h,tools/testing/selftests/powerpc - Regex:
/pmac,powermac,powernv,[^a-z0-9]ps3,pseries
LINUX FOR POWERPC EMBEDDED MPC5XXX #
- Mail: Anatolij Gustschin <agust@denx.de>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Odd Fixes
- Files:
arch/powerpc/platforms/512x/,arch/powerpc/platforms/52xx/
LINUX FOR POWERPC EMBEDDED PPC4XX #
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
arch/powerpc/platforms/44x/
LINUX FOR POWERPC EMBEDDED PPC85XX #
- Mail: Scott Wood <oss@buserror.net>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Odd fixes
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux.git
- Files:
Documentation/devicetree/bindings/cache/freescale-l2cache.txt,Documentation/devicetree/bindings/powerpc/fsl/,arch/powerpc/platforms/85xx/
LINUX FOR POWERPC EMBEDDED PPC8XX AND PPC83XX #
- Mail: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
arch/powerpc/platforms/8xx/,arch/powerpc/platforms/83xx/
LINUX KERNEL DUMP TEST MODULE (LKDTM) #
- Mail: Kees Cook <kees@kernel.org>
- Status: Maintained
- Files:
drivers/misc/lkdtm/*,tools/testing/selftests/lkdtm/*
LINUX KERNEL MEMORY CONSISTENCY MODEL (LKMM) #
- Mail: Alan Stern <stern@rowland.harvard.edu>, Andrea Parri <parri.andrea@gmail.com>, Will Deacon <will@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Boqun Feng <boqun@kernel.org>, Nicholas Piggin <npiggin@gmail.com>, David Howells <dhowells@redhat.com>, Jade Alglave <j.alglave@ucl.ac.uk>, Luc Maranget <luc.maranget@inria.fr>, "Paul E. McKenney" <paulmck@kernel.org>
- Reviewer: Akira Yokosawa <akiyks@gmail.com>, Daniel Lustig <dlustig@nvidia.com>, Joel Fernandes <joelagnelf@nvidia.com>
- Mailing list: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, lkmm@lists.linux.dev
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
- Files:
Documentation/atomic_bitops.txt,Documentation/atomic_t.txt,Documentation/core-api/refcount-vs-atomic.rst,Documentation/dev-tools/lkmm/,Documentation/litmus-tests/,Documentation/memory-barriers.txt,tools/memory-model/
LINUX-NEXT TREE #
- Mail: Stephen Rothwell <sfr@canb.auug.org.au>, Mark Brown <broonie@kernel.org>
- Mailing list: linux-next@vger.kernel.org
- Status: Supported
- bugs: mailto:linux-next@vger.kernel.org and the appropriate development tree
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/
LIS3LV02D ACCELEROMETER DRIVER #
- Mail: Eric Piel <eric.piel@tremplin-utc.net>
- Status: Maintained
- Files:
Documentation/misc-devices/lis3lv02d.rst,drivers/misc/lis3lv02d/,drivers/platform/x86/hp/hp_accel.c
LIST KUNIT TEST #
- Mail: David Gow <david@davidgow.net>
- Mailing list: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com
- Status: Maintained
- Files:
lib/tests/list-test.c
LITEX PLATFORM #
- Mail: Karol Gugala <kgugala@antmicro.com>, Mateusz Holenko <mholenko@antmicro.com>, Gabriel Somlo <gsomlo@gmail.com>, Joel Stanley <joel@jms.id.au>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/*/litex,*.yaml,arch/openrisc/boot/dts/or1klitex.dts,drivers/mmc/host/litex_mmc.c,drivers/net/ethernet/litex/*,drivers/soc/litex/*,drivers/tty/serial/liteuart.c,include/linux/litex.h - Regex:
litex
LIVE PATCHING #
- Mail: Josh Poimboeuf <jpoimboe@kernel.org>, Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>
- Reviewer: Joe Lawrence <joe.lawrence@redhat.com>
- Mailing list: live-patching@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching.git
- Files:
Documentation/ABI/testing/sysfs-kernel-livepatch,Documentation/livepatch/,arch/powerpc/include/asm/livepatch.h,include/linux/livepatch*.h,kernel/livepatch/,kernel/module/livepatch.c,samples/livepatch/,scripts/livepatch/,tools/testing/selftests/livepatch/
LIVE UPDATE #
- Mail: Pasha Tatashin <pasha.tatashin@soleen.com>, Mike Rapoport <rppt@kernel.org>
- Reviewer: Pratyush Yadav <pratyush@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/core-api/liveupdate.rst,Documentation/mm/memfd_preservation.rst,Documentation/userspace-api/liveupdate.rst,include/linux/kho/abi/,include/linux/liveupdate.h,include/linux/liveupdate/,include/uapi/linux/liveupdate.h,kernel/liveupdate/,lib/tests/liveupdate.c,mm/memfd_luo.c,tools/testing/selftests/liveupdate/
LLC (802.2) #
- Mailing list: netdev@vger.kernel.org
- Status: Odd fixes
- Files:
include/linux/llc.h,include/net/llc*,include/uapi/linux/llc.h,net/llc/
LM73 HARDWARE MONITOR DRIVER #
- Mail: Guillaume Ligneul <guillaume.ligneul@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/lm73.c
LM78 HARDWARE MONITOR DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/lm78.rst,drivers/hwmon/lm78.c
LM83 HARDWARE MONITOR DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/lm83.rst,drivers/hwmon/lm83.c
LM90 HARDWARE MONITOR DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/national,lm90.yaml,Documentation/hwmon/lm90.rst,drivers/hwmon/lm90.c,include/dt-bindings/thermal/lm90.h
LME2510 MEDIA DRIVER #
- Mail: Malcolm Priestley <tvboxspy@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/lmedm04*
LOADPIN SECURITY MODULE #
- Mail: Kees Cook <kees@kernel.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
Documentation/admin-guide/LSM/LoadPin.rst,security/loadpin/
LOCKDOWN SECURITY MODULE #
- Mail: Nicolas Bouchinet <nicolas.bouchinet@oss.cyber.gouv.fr>, Xiu Jianfeng <xiujianfeng@huawei.com>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
- Files:
security/lockdown/
LOCKING PRIMITIVES #
- Mail: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>, Boqun Feng <boqun@kernel.org> (LOCKDEP & RUST)
- Reviewer: Waiman Long <longman@redhat.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
- Files:
Documentation/locking/,arch/*/include/asm/spinlock*.h,include/linux/local_lock*.h,include/linux/lockdep*.h,include/linux/mutex*.h,include/linux/rwlock*.h,include/linux/rwsem*.h,include/linux/seqlock.h,include/linux/spinlock*.h,kernel/locking/,lib/locking*.[ch],rust/helpers/mutex.c,rust/helpers/spinlock.c,rust/kernel/sync/lock.rs,rust/kernel/sync/lock/,rust/kernel/sync/locked_by.rs - Excluded:
kernel/locking/locktorture.c
LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) #
- Mail: "Richard Russon (FlatCap)" <ldm@flatcap.org>
- Mailing list: linux-ntfs-dev@lists.sourceforge.net
- Status: Maintained
- Web-page: http://www.linux-ntfs.org/content/view/19/37/
- Files:
Documentation/admin-guide/ldm.rst,block/partitions/ldm.*
LOGITECH HID GAMING KEYBOARDS #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
- Files:
drivers/hid/hid-lg-g15.c
LONTIUM LT8912B MIPI TO HDMI BRIDGE #
- Mail: Adrien Grassein <adrien.grassein@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml,drivers/gpu/drm/bridge/lontium-lt8912b.c
LOONGARCH #
- Mail: Huacai Chen <chenhuacai@kernel.org>
- Reviewer: WANG Xuerui <kernel@xen0n.name>
- Mailing list: loongarch@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git
- Files:
Documentation/arch/loongarch/,Documentation/translations/zh_CN/arch/loongarch/,arch/loongarch/,drivers/*/*loongarch*,drivers/cpufreq/loongson3_cpufreq.c
LOONGSON GPIO DRIVER #
- Mail: Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/loongson,ls-gpio.yaml,drivers/gpio/gpio-loongson-64bit.c
LOONGSON-2 APB DMA DRIVER #
- Mail: Binbin Zhou <zhoubinbin@loongson.cn>
- Mailing list: dmaengine@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/loongson,ls2x-apbdma.yaml,drivers/dma/loongson2-apb-dma.c
LOONGSON LS2X I2C DRIVER #
- Mail: Binbin Zhou <zhoubinbin@loongson.cn>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/loongson,ls2x-i2c.yaml,drivers/i2c/busses/i2c-ls2x.c
LOONGSON PWM DRIVER #
- Mail: Binbin Zhou <zhoubinbin@loongson.cn>
- Mailing list: linux-pwm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pwm/loongson,ls7a-pwm.yaml,drivers/pwm/pwm-loongson.c
LOONGSON SECURITY ENGINE DRIVERS #
- Mail: Qunqin Zhao <zhaoqunqin@loongson.cn>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/char/tpm/tpm_loongson.c,drivers/crypto/loongson/,drivers/mfd/loongson-se.c,include/linux/mfd/loongson-se.h
LOONGSON-2 SOC SERIES CLOCK DRIVER #
- Mail: Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: linux-clk@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml,drivers/clk/clk-loongson2.c,include/dt-bindings/clock/loongson,ls2k-clk.h
LOONGSON SPI DRIVER #
- Mail: Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml,drivers/spi/spi-loongson-core.c,drivers/spi/spi-loongson-pci.c,drivers/spi/spi-loongson-plat.c,drivers/spi/spi-loongson.h
LOONGSON-2 SOC SERIES GUTS DRIVER #
- Mail: Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: loongarch@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwinfo/loongson,ls2k-chipid.yaml,drivers/soc/loongson/loongson2_guts.c
LOONGSON-2 SOC SERIES MMC/SD/SDIO CONTROLLER DRIVER #
- Mail: Binbin Zhou <zhoubinbin@loongson.cn>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml,drivers/mmc/host/loongson2-mmc.c
LOONGSON-2 SOC SERIES PM DRIVER #
- Mail: Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/soc/loongson/loongson,ls2k-pmc.yaml,drivers/soc/loongson/loongson2_pm.c
LOONGSON-2 SOC SERIES PINCTRL DRIVER #
- Mail: zhanghongchen <zhanghongchen@loongson.cn>, Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/loongson,ls2k-pinctrl.yaml,drivers/pinctrl/pinctrl-loongson2.c
LOONGSON-2 SOC SERIES THERMAL DRIVER #
- Mail: zhanghongchen <zhanghongchen@loongson.cn>, Yinbo Zhu <zhuyinbo@loongson.cn>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/loongson,ls2k-thermal.yaml,drivers/thermal/loongson2_thermal.c
LOONGSON-2K Board Management Controller (BMC) DRIVER #
- Mail: Binbin Zhou <zhoubinbin@loongson.cn>, Chong Qiao <qiaochong@loongson.cn>
- Status: Maintained
- Files:
drivers/char/ipmi/ipmi_si_ls2k.c,drivers/mfd/ls2k-bmc-core.c
LOONGSON EDAC DRIVER #
- Mail: Zhao Qunqin <zhaoqunqin@loongson.cn>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/edac/loongson_edac.c
LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) #
- Mail: Sathya Prakash <sathya.prakash@broadcom.com>, Sreekanth Reddy <sreekanth.reddy@broadcom.com>, Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>, Ranjan Kumar <ranjan.kumar@broadcom.com>
- Mailing list: MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org
- Status: Supported
- Web-page: http://www.avagotech.com/support/
- Files:
drivers/message/fusion/,drivers/scsi/mpt3sas/
LSILOGIC/SYMBIOS/NCR 53C8XX and 53C1010 PCI-SCSI drivers #
- Mail: Matthew Wilcox <willy@infradead.org>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/sym53c8xx_2/
LT3074 HARDWARE MONITOR DRIVER #
- Mail: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml,Documentation/hwmon/lt3074.rst,drivers/hwmon/pmbus/lt3074.c
LTC1660 DAC DRIVER #
- Mail: Marcus Folkesson <marcus.folkesson@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/dac/lltc,ltc1660.yaml,drivers/iio/dac/ltc1660.c
LTC2664 IIO DAC DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>, Kim Seer Paller <kimseer.paller@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/dac/adi,ltc2664.yaml,Documentation/devicetree/bindings/iio/dac/adi,ltc2672.yaml,drivers/iio/dac/ltc2664.c
LTC2688 IIO DAC DRIVER #
- Mail: Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688,Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml,drivers/iio/dac/ltc2688.c
LTC2947 HARDWARE MONITOR DRIVER #
- Mail: Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml,drivers/hwmon/ltc2947-core.c,drivers/hwmon/ltc2947-i2c.c,drivers/hwmon/ltc2947-spi.c,drivers/hwmon/ltc2947.h
LTC2991 HARDWARE MONITOR DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/adi,ltc2991.yaml,drivers/hwmon/ltc2991.c
LTC2983 IIO TEMPERATURE DRIVER #
- Mail: Nuno Sá <nuno.sa@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml,drivers/iio/temperature/ltc2983.c
LTC4282 HARDWARE MONITOR DRIVER #
- Mail: Nuno Sa <nuno.sa@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml,Documentation/hwmon/ltc4282.rst,drivers/hwmon/ltc4282.c
LTC4286 HARDWARE MONITOR DRIVER #
- Mail: Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/lltc,ltc4286.yaml,Documentation/hwmon/ltc4286.rst,drivers/hwmon/pmbus/ltc4286.c
LTC4306 I2C MULTIPLEXER DRIVER #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/i2c/i2c-mux-ltc4306.txt,drivers/i2c/muxes/i2c-mux-ltc4306.c
LTP (Linux Test Project) #
- Mail: Andrea Cervesato <andrea.cervesato@suse.com>, Cyril Hrubis <chrubis@suse.cz>, Jan Stancek <jstancek@redhat.com>, Petr Vorel <pvorel@suse.cz>, Li Wang <liwang@redhat.com>, Yang Xu <xuyang2018.jy@fujitsu.com>, Xiao Yang <yangx.jy@fujitsu.com>
- Mailing list: ltp@lists.linux.it (subscribers-only)
- Status: Maintained
- Web-page: https://linux-test-project.readthedocs.io/
- SCM: git https://github.com/linux-test-project/ltp.git
LTR390 AMBIENT/UV LIGHT SENSOR DRIVER #
- Mail: Anshul Dalal <anshulusr@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/liteon,ltr390.yaml,drivers/iio/light/ltr390.c
LYNX 28G SERDES PHY DRIVER #
- Mail: Ioana Ciornei <ioana.ciornei@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml,drivers/phy/freescale/phy-fsl-lynx-28g.c
LYNX PCS MODULE #
- Mail: Ioana Ciornei <ioana.ciornei@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/pcs/pcs-lynx.c,include/linux/pcs-lynx.h
M68K ARCHITECTURE #
- Mail: Geert Uytterhoeven <geert@linux-m68k.org>
- Mailing list: linux-m68k@lists.linux-m68k.org
- Status: Maintained
- Web-page: http://www.linux-m68k.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git
- Files:
arch/m68k/,drivers/zorro/
M68K ON APPLE MACINTOSH #
- Mail: Joshua Thompson <funaho@jurai.org>
- Mailing list: linux-m68k@lists.linux-m68k.org
- Status: Maintained
- Web-page: http://www.mac.linux-m68k.org/
- Files:
arch/m68k/mac/,drivers/macintosh/adb-iop.c,drivers/macintosh/via-macii.c
M68K ON HP9000/300 #
- Mail: Philip Blundell <philb@gnu.org>
- Status: Maintained
- Web-page: http://www.tazenda.demon.co.uk/phil/linux-hp
- Files:
arch/m68k/hp300/
M88DS3103 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/m88ds3103*
M88RS2000 MEDIA DRIVER #
- Mail: Malcolm Priestley <tvboxspy@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/m88rs2000*
MA901 MASTERKIT USB FM RADIO DRIVER #
- Mail: Alexey Klimov <alexey.klimov@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-ma901.c
MAC80211 #
- Mail: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/
- Patchwork: https://patchwork.kernel.org/project/linux-wireless/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git, git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
- Files:
Documentation/networking/mac80211-injection.rst,Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst,drivers/net/wireless/virtual/mac80211_hwsim.[ch],include/net/mac80211.h,net/mac80211/
MAILBOX API #
- Mail: Jassi Brar <jassisinghbrar@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jassibrar/mailbox.git for-next
- Files:
Documentation/devicetree/bindings/mailbox/,drivers/mailbox/,include/dt-bindings/mailbox/,include/linux/mailbox_client.h,include/linux/mailbox_controller.h
MAILBOX ARM MHUv2 #
- Mail: Viresh Kumar <viresh.kumar@linaro.org>, Tushar Khandelwal <Tushar.Khandelwal@arm.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mailbox/arm,mhuv2.yaml,drivers/mailbox/arm_mhuv2.c,include/linux/mailbox/arm_mhuv2_message.h
MAILBOX ARM MHUv3 #
- Mail: Sudeep Holla <sudeep.holla@kernel.org>, Cristian Marussi <cristian.marussi@arm.com>
- Mailing list: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mailbox/arm,mhuv3.yaml,drivers/mailbox/arm_mhuv3.c
MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7 #
- Mail: Alejandro Colomar <alx@kernel.org>
- Mailing list: linux-man@vger.kernel.org
- Status: Maintained
- Web-page: http://www.kernel.org/doc/man-pages
- SCM: git git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git, git git://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git
MANAGEMENT COMPONENT TRANSPORT PROTOCOL (MCTP) #
- Mail: Jeremy Kerr <jk@codeconstruct.com.au>, Matt Johnston <matt@codeconstruct.com.au>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/mctp.rst,drivers/net/mctp/,include/linux/usb/mctp-usb.h,include/net/mctp.h,include/net/mctpdevice.h,include/net/netns/mctp.h,net/mctp/
MAPLE TREE #
- Mail: Liam R. Howlett <Liam.Howlett@oracle.com>
- Reviewer: Alice Ryhl <aliceryhl@google.com>, Andrew Ballance <andrewjballance@gmail.com>
- Mailing list: maple-tree@lists.infradead.org, linux-mm@kvack.org
- Status: Supported
- Files:
Documentation/core-api/maple_tree.rst,include/linux/maple_tree.h,include/trace/events/maple_tree.h,lib/maple_tree.c,lib/test_maple_tree.c,rust/helpers/maple_tree.c,rust/kernel/maple_tree.rs,tools/testing/radix-tree/maple.c,tools/testing/shared/linux/maple_tree.h
MARDUK (CREATOR CI40) DEVICE TREE SUPPORT #
- Mail: Rahul Bedarkar <rahulbedarkar89@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/boot/dts/img/pistachio*
MARVELL 88E6XXX ETHERNET SWITCH FABRIC DRIVER #
- Mail: Andrew Lunn <andrew@lunn.ch>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/marvell,mv88e6060.yaml,Documentation/devicetree/bindings/net/dsa/marvell,mv88e6xxx.yaml,Documentation/networking/devlink/mv88e6xxx.rst,drivers/net/dsa/mv88e6xxx/,include/linux/dsa/mv88e6xxx.h,include/linux/platform_data/mv88e6xxx.h
MARVELL 88PM886 PMIC DRIVER #
- Mail: Karel Balej <balejk@matfyz.cz>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml,drivers/input/misc/88pm886-onkey.c,drivers/mfd/88pm886.c,drivers/regulator/88pm886-regulator.c,drivers/rtc/rtc-88pm886.c,include/linux/mfd/88pm886.h
MARVELL 88PM886 PMIC GPADC DRIVER #
- Mail: Duje Mihanović <duje@dujemihanovic.xyz>
- Status: Maintained
- Files:
drivers/iio/adc/88pm886-gpadc.c
MARVELL ARMADA 3700 PHY DRIVERS #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/marvell,armada-3700-utmi-phy.yaml,Documentation/devicetree/bindings/phy/marvell,comphy-cp110.yaml,drivers/phy/marvell/phy-mvebu-a3700-comphy.c,drivers/phy/marvell/phy-mvebu-a3700-utmi.c
MARVELL ARMADA 3700 SERIAL DRIVER #
- Mail: Pali Rohár <pali@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/marvell,armada-3700-uart-clock.yaml,Documentation/devicetree/bindings/serial/marvell,armada-3700-uart.yaml,drivers/tty/serial/mvebu-uart.c
MARVELL ARMADA DRM SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Maintained
- SCM: git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-armada-devel, git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-armada-fixes
- Files:
Documentation/devicetree/bindings/display/armada/,drivers/gpu/drm/armada/,include/uapi/drm/armada_drm.h
MARVELL CRYPTO DRIVER #
- Mail: Srujana Challa <schalla@marvell.com>, Bharat Bhushan <bbhushan2@marvell.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/marvell/,include/linux/soc/marvell/octeontx2/
MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/ethernet/marvell/sk*
MARVELL LIBERTAS WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org, libertas-dev@lists.infradead.org
- Status: Orphan
- Files:
drivers/net/wireless/marvell/libertas/,drivers/net/wireless/marvell/libertas_tf/
MARVELL MACCHIATOBIN SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm64/boot/dts/marvell/armada-8040-mcbin.dts
MARVELL MV643XX ETHERNET DRIVER #
- Mail: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/marvell/mv643xx_eth.*
MARVELL MV88X3310 PHY DRIVER #
- Mail: Russell King <linux@armlinux.org.uk>, Marek Behún <kabel@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/marvell10g.c
MARVELL MVEBU THERMAL DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Status: Maintained
- Files:
drivers/thermal/armada_thermal.c
MARVELL MVNETA ETHERNET DRIVER #
- Mail: Marcin Wojtas <marcin.s.wojtas@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/marvell/mvneta*
MARVELL MVPP2 ETHERNET DRIVER #
- Mail: Marcin Wojtas <marcin.s.wojtas@gmail.com>, Russell King <linux@armlinux.org.uk>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/marvell,pp2.yaml,drivers/net/ethernet/marvell/mvpp2/
MARVELL MWIFIEX WIRELESS DRIVER #
- Mail: Brian Norris <briannorris@chromium.org>
- Reviewer: Francesco Dolcini <francesco@dolcini.it>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/net/wireless/marvell/mwifiex/
MARVELL MWL8K WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wireless/marvell/mwl8k.c
MARVELL NAND CONTROLLER DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/nand/raw/marvell_nand.c
MARVELL OCTEON ENDPOINT DRIVER #
- Mail: Veerasenareddy Burru <vburru@marvell.com>, Sathesh Edara <sedara@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/marvell/octeon_ep
MARVELL OCTEON ENDPOINT VF DRIVER #
- Mail: Veerasenareddy Burru <vburru@marvell.com>, Sathesh Edara <sedara@marvell.com>, Shinas Rasheed <srasheed@marvell.com>, Satananda Burla <sburla@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/marvell/octeon_ep_vf
MARVELL OCTEONTX2 PHYSICAL FUNCTION DRIVER #
- Mail: Sunil Goutham <sgoutham@marvell.com>, Geetha sowjanya <gakula@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com>, hariprasad <hkelam@marvell.com>, Bharat Bhushan <bbhushan2@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/marvell/octeontx2/nic/,include/linux/soc/marvell/octeontx2/
MARVELL OCTEONTX2 RVU ADMIN FUNCTION DRIVER #
- Mail: Sunil Goutham <sgoutham@marvell.com>, Linu Cherian <lcherian@marvell.com>, Geetha sowjanya <gakula@marvell.com>, hariprasad <hkelam@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/marvell/octeontx2.rst,drivers/net/ethernet/marvell/octeontx2/af/
MARVELL PEM PMU DRIVER #
- Mail: Linu Cherian <lcherian@marvell.com>, Gowthami Thiagarajan <gthiagarajan@marvell.com>
- Status: Supported
- Files:
drivers/perf/marvell_pem_pmu.c
MARVELL PRESTERA ETHERNET SWITCH DRIVER #
- Mail: Elad Nachman <enachman@marvell.com>
- Status: Supported
- Web-page: https://github.com/Marvell-switching/switchdev-prestera
- Files:
drivers/net/ethernet/marvell/prestera/
MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER #
- Mail: Nicolas Pitre <nico@fluxnic.net>
- Status: Odd Fixes
- Files:
drivers/mmc/host/mvsdio.*
MARVELL USB MDIO CONTROLLER DRIVER #
- Mail: Tobias Waldekranz <tobias@waldekranz.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/marvell,mvusb.yaml,drivers/net/mdio/mdio-mvusb.c
MARVELL XENON MMC/SD/SDIO HOST CONTROLLER DRIVER #
- Mail: Hu Ziji <huziji@marvell.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mmc/marvell,xenon-sdhci.yaml,drivers/mmc/host/sdhci-xenon*
MARVELL OCTEON CN10K DPI DRIVER #
- Mail: Vamsi Attunuru <vattunuru@marvell.com>
- Status: Supported
- Files:
drivers/misc/mrvl_cn10k_dpi.c
MARVELL OCTEON ENDPOINT VIRTIO DATA PATH ACCELERATOR #
- Reviewer: schalla@marvell.com, vattunuru@marvell.com
- Files:
drivers/vdpa/octeon_ep/
MARVELL OCTEON HOTPLUG DRIVER #
- Reviewer: Shijith Thotton <sthotton@marvell.com>, Vamsi Attunuru <vattunuru@marvell.com>
- Status: Supported
- Files:
drivers/pci/hotplug/octep_hp.c
MATROX FRAMEBUFFER DRIVER #
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/video/fbdev/matrox/matroxfb_*,include/uapi/linux/matroxfb.h
MAX14001/MAX14002 IIO ADC DRIVER #
- Mail: Kim Seer Paller <kimseer.paller@analog.com>, Marilene Andrade Garcia <marilene.agarcia@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/adi,max14001.yaml,drivers/iio/adc/max14001.c
MAX15301 DRIVER #
- Mail: Daniel Nilsson <daniel.nilsson@flex.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/max15301.rst,drivers/hwmon/pmbus/max15301.c
MAX17616 HARDWARE MONITOR DRIVER #
- Mail: Kim Seer Paller <kimseer.paller@analog.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/hwmon/pmbus/adi,max17616.yaml,Documentation/hwmon/max17616.rst,drivers/hwmon/pmbus/max17616.c
MAX2175 SDR TUNER DRIVER #
- Mail: Ramesh Shanmugasundaram <rashanmu@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/maxim,max2175.txt,Documentation/userspace-api/media/drivers/max2175.rst,drivers/media/i2c/max2175*,include/uapi/linux/max2175.h
MAX31335 RTC DRIVER #
- Mail: Antoniu Miclaus <antoniu.miclaus@analog.com>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/rtc/adi,max31335.yaml,drivers/rtc/rtc-max31335.c
MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER #
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Orphan
- Files:
Documentation/hwmon/max6650.rst,drivers/hwmon/max6650.c
MAX9286 QUAD GMSL DESERIALIZER DRIVER #
- Mail: Jacopo Mondi <jacopo+renesas@jmondi.org>, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>, Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml,drivers/media/i2c/max9286.c
MAX96712 QUAD GMSL2 DESERIALIZER DRIVER #
- Mail: Niklas Söderlund <niklas.soderlund@ragnatech.se>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/maxim,max96712.yaml,drivers/staging/media/max96712/max96712.c
MAX96714 GMSL2 DESERIALIZER DRIVER #
- Mail: Julien Massot <julien.massot@collabora.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/maxim,max96714.yaml,drivers/media/i2c/max96714.c
MAX96717 GMSL2 SERIALIZER DRIVER #
- Mail: Julien Massot <julien.massot@collabora.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/maxim,max96717.yaml,drivers/media/i2c/max96717.c
MAX9860 MONO AUDIO VOICE CODEC DRIVER #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/max9860.txt,sound/soc/codecs/max9860.*
MAXBOTIX ULTRASONIC RANGER IIO DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/proximity/maxbotix,mb1232.yaml,drivers/iio/proximity/mb1232.c
MAXIM MAX11205 DRIVER #
- Mail: Ramona Bolboaca <ramona.bolboaca@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: https://ez.analog.com/linux-software-drivers
- Files:
Documentation/devicetree/bindings/iio/adc/maxim,max11205.yaml,drivers/iio/adc/max11205.c
MAXIM MAX17040 FAMILY FUEL GAUGE DRIVERS #
- Reviewer: Iskren Chernev <iskren.chernev@gmail.com>, Krzysztof Kozlowski <krzk@kernel.org>, Marek Szyprowski <m.szyprowski@samsung.com>, Matheus Castello <matheus@castello.eng.br>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml,drivers/power/supply/max17040_battery.c
MAXIM MAX17042 FAMILY FUEL GAUGE DRIVERS #
- Reviewer: Hans de Goede <hansg@kernel.org>, Krzysztof Kozlowski <krzk@kernel.org>, Marek Szyprowski <m.szyprowski@samsung.com>, Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>, Purism Kernel Team <kernel@puri.sm>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml,drivers/power/supply/max17042_battery.c
MAXIM MAX20086 CAMERA POWER PROTECTOR DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/regulator/maxim,max20086.yaml,drivers/regulator/max20086-regulator.c
MAXIM MAX30208 TEMPERATURE SENSOR DRIVER #
- Mail: Marcelo Schmitt <marcelo.schmitt@analog.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/iio/temperature/max30208.c
MAXIM MAX7360 KEYPAD LED MFD DRIVER #
- Mail: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/maxim,max7360-gpio.yaml,Documentation/devicetree/bindings/mfd/maxim,max7360.yaml,drivers/gpio/gpio-max7360.c,drivers/input/keyboard/max7360-keypad.c,drivers/input/misc/max7360-rotary.c,drivers/mfd/max7360.c,drivers/pinctrl/pinctrl-max7360.c,drivers/pwm/pwm-max7360.c,include/linux/mfd/max7360.h
MAXIM MAX77650 PMIC MFD DRIVER #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/*/*max77650.yaml,Documentation/devicetree/bindings/*/max77650*.yaml,drivers/gpio/gpio-max77650.c,drivers/input/misc/max77650-onkey.c,drivers/leds/leds-max77650.c,drivers/mfd/max77650.c,drivers/power/supply/max77650-charger.c,drivers/regulator/max77650-regulator.c,include/linux/mfd/max77650.h
MAXIM MAX77714 PMIC MFD DRIVER #
- Mail: Luca Ceresoli <luca@lucaceresoli.net>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/maxim,max77714.yaml,drivers/mfd/max77714.c,include/linux/mfd/max77714.h
MAXIM MAX77759 PMIC MFD DRIVER #
- Mail: André Draszik <andre.draszik@linaro.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/*/maxim,max77759*.yaml,drivers/gpio/gpio-max77759.c,drivers/mfd/max77759.c,drivers/nvmem/max77759-nvmem.c,include/linux/mfd/max77759.h
MAXIM MAX77802 PMIC REGULATOR DEVICE DRIVER #
- Mail: Javier Martinez Canillas <javier@dowhile0.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/*/*max77802.yaml,drivers/regulator/max77802-regulator.c,include/dt-bindings/*/*max77802.h
MAXIM MAX77838 PMIC REGULATOR DEVICE DRIVER #
- Mail: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/regulator/maxim,max77838.yaml,drivers/regulator/max77838-regulator.c
MAXIM MAX77976 BATTERY CHARGER #
- Mail: Luca Ceresoli <luca@lucaceresoli.net>
- Status: Supported
- Files:
Documentation/devicetree/bindings/power/supply/maxim,max77976.yaml,drivers/power/supply/max77976_charger.c
MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- bugs: mailto:linux-samsung-soc@vger.kernel.org
- Files:
Documentation/devicetree/bindings/power/supply/maxim,max14577.yaml,Documentation/devicetree/bindings/power/supply/maxim,max77693.yaml,drivers/power/supply/max14577_charger.c,drivers/power/supply/max77693_charger.c
MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS #
- Mail: Chanwoo Choi <cw00.choi@samsung.com>, Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- bugs: mailto:linux-samsung-soc@vger.kernel.org
- Files:
Documentation/devicetree/bindings/*/maxim,max14577.yaml,Documentation/devicetree/bindings/*/maxim,max77686.yaml,Documentation/devicetree/bindings/*/maxim,max77693.yaml,Documentation/devicetree/bindings/*/maxim,max77705*.yaml,Documentation/devicetree/bindings/*/maxim,max77843.yaml,drivers/leds/leds-max77705.c,drivers/*/*max77843.c,drivers/*/max14577*.c,drivers/*/max77686*.c,drivers/*/max77693*.c,drivers/*/max77705*.c,drivers/clk/clk-max77686.c,drivers/extcon/extcon-max14577.c,drivers/extcon/extcon-max77693.c,drivers/rtc/rtc-max77686.c,include/linux/mfd/max14577*.h,include/linux/mfd/max77686*.h,include/linux/mfd/max77693*.h,include/linux/mfd/max77705*.h
MAXIRADIO FM RADIO RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-maxiradio*
MAXLINEAR ETHERNET PHY DRIVER #
- Mail: Xu Liang <lxu@maxlinear.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/phy/mxl-86110.c,drivers/net/phy/mxl-gpy.c
MAXLINEAR MXL862XX SWITCH DRIVER #
- Mail: Daniel Golle <daniel@makrotopia.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/maxlinear,mxl862xx.yaml,drivers/net/dsa/mxl862xx/,net/dsa/tag_mxl862xx.c
MCAN DEVICE DRIVER #
- Mail: Markus Schneider-Pargmann <msp@baylibre.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/can/bosch,m_can.yaml,drivers/net/can/m_can/
MCBA MICROCHIP CAN BUS ANALYZER TOOL DRIVER #
- Reviewer: Yasushi SHOJI <yashi@spacecubics.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/can/usb/mcba_usb.c
MCP2221A MICROCHIP USB-HID TO I2C BRIDGE DRIVER #
- Mail: Rishi Gupta <gupt21@gmail.com>
- Mailing list: linux-i2c@vger.kernel.org, linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-mcp2221.c
MCP251XFD SPI-CAN NETWORK DRIVER #
- Mail: Marc Kleine-Budde <mkl@pengutronix.de>, Manivannan Sadhasivam <mani@kernel.org>
- Reviewer: Thomas Kopp <thomas.kopp@microchip.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml,drivers/net/can/spi/mcp251xfd/
MCP4018 AND MCP4531 MICROCHIP DIGITAL POTENTIOMETER DRIVERS #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-iio-potentiometer-mcp4531,drivers/iio/potentiometer/mcp4018.c,drivers/iio/potentiometer/mcp4531.c
MCP47FEB02 MICROCHIP DAC DRIVER #
- Mail: Ariana Lazar <ariana.lazar@microchip.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/dac/microchip,mcp47feb02.yaml,drivers/iio/dac/mcp47feb02.c
MCP4821 DAC DRIVER #
- Mail: Anshul Dalal <anshulusr@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/dac/microchip,mcp4821.yaml,drivers/iio/dac/mcp4821.c
MCR20A IEEE-802.15.4 RADIO DRIVER #
- Mail: Stefan Schmidt <stefan@datenfreihafen.org>
- Mailing list: linux-wpan@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://github.com/xueliu/mcr20a-linux
- Files:
Documentation/devicetree/bindings/net/ieee802154/mcr20a.txt,drivers/net/ieee802154/mcr20a.c,drivers/net/ieee802154/mcr20a.h
MDIO REGMAP DRIVER #
- Mail: Maxime Chevallier <maxime.chevallier@bootlin.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/mdio/mdio-regmap.c,include/linux/mdio/mdio-regmap.h
MEASUREMENT COMPUTING CIO-DAC IIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/dac/cio-dac.c
MEDIA CONTROLLER FRAMEWORK #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://www.linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/mc/,include/media/media-*.h,include/uapi/linux/media.h
MEDIA DRIVER FOR FREESCALE IMX PXP #
- Mail: Philipp Zabel <p.zabel@pengutronix.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/platform/nxp/imx-pxp.[ch]
MEDIA DRIVERS FOR ASCOT2E #
- Mail: Abylay Ospan <aospan@amazon.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org, http://netup.tv/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/ascot2e*
MEDIA DRIVERS FOR CXD2099AR CI CONTROLLERS #
- Mail: Jasmin Jessich <jasmin@anw.at>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/cxd2099*
MEDIA DRIVERS FOR CXD2841ER #
- Mail: Abylay Ospan <aospan@amazon.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org, http://netup.tv/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/cxd2841er*
MEDIA DRIVERS FOR CXD2880 #
- Mail: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: http://linuxtv.org/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/cxd2880/*,drivers/media/spi/cxd2880*
MEDIA DRIVERS FOR DIGITAL DEVICES PCIE DEVICES #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/ddbridge/*
MEDIA DRIVERS FOR FREESCALE IMX #
- Mail: Steve Longerbeam <slongerbeam@gmail.com>, Philipp Zabel <p.zabel@pengutronix.de>
- Reviewer: Frank Li <Frank.Li@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/imx.rst,Documentation/devicetree/bindings/media/fsl,imx6-mipi-csi2.yaml,drivers/staging/media/imx/,include/linux/imx-media.h,include/media/imx.h
MEDIA DRIVERS FOR FREESCALE IMX7/8 #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Frank Li <Frank.Li@nxp.com>, Martin Kepplinger-Novakovic <martink@posteo.de>
- Reviewer: Rui Miguel Silva <rmfrfs@gmail.com>, Purism Kernel Team <kernel@puri.sm>
- Mailing list: imx@lists.linux.dev, linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/imx7.rst,Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml,Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml,Documentation/devicetree/bindings/media/nxp,imx8mq-mipi-csi2.yaml,drivers/media/platform/nxp/imx-mipi-csis.c,drivers/media/platform/nxp/imx7-media-csi.c,drivers/media/platform/nxp/imx8mq-mipi-csi2.c
MEDIA DRIVERS FOR HELENE #
- Mail: Abylay Ospan <aospan@amazon.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org, http://netup.tv/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/helene*
MEDIA DRIVERS FOR HORUS3A #
- Mail: Abylay Ospan <aospan@amazon.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org, http://netup.tv/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/horus3a*
MEDIA DRIVERS FOR LNBH25 #
- Mail: Abylay Ospan <aospan@amazon.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org, http://netup.tv/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/lnbh25*
MEDIA DRIVERS FOR MXL5XX TUNER DEMODULATORS #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/mxl5xx*
MEDIA DRIVERS FOR NETUP PCI UNIVERSAL DVB devices #
- Mail: Abylay Ospan <aospan@amazon.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Web-page: https://linuxtv.org, http://netup.tv/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/netup_unidvb/*
MEDIA DRIVERS FOR NVIDIA TEGRA - VDE #
- Mail: Dmitry Osipenko <digetx@gmail.com>
- Mailing list: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/nvidia,tegra-vde.yaml,drivers/media/platform/nvidia/tegra-vde/
MEDIA DRIVERS FOR RENESAS - CEU #
- Mail: Jacopo Mondi <jacopo@jmondi.org>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/renesas,ceu.yaml,drivers/media/platform/renesas/renesas-ceu.c,include/media/drv-intf/renesas-ceu.h
MEDIA DRIVERS FOR RENESAS - DRIF #
- Mail: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/renesas,drif.yaml,drivers/media/platform/renesas/rcar_drif.c
MEDIA DRIVERS FOR RENESAS - FCP #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/renesas,fcp.yaml,drivers/media/platform/renesas/rcar-fcp.c,include/media/rcar-fcp.h
MEDIA DRIVERS FOR RENESAS - FDP1 #
- Mail: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/renesas,fdp1.yaml,drivers/media/platform/renesas/rcar_fdp1.c
MEDIA DRIVERS FOR RENESAS - VIN #
- Mail: Niklas Söderlund <niklas.soderlund@ragnatech.se>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/renesas,csi2.yaml,Documentation/devicetree/bindings/media/renesas,isp.yaml,Documentation/devicetree/bindings/media/renesas,vin.yaml,drivers/media/platform/renesas/rcar-csi2.c,drivers/media/platform/renesas/rcar-isp/,drivers/media/platform/renesas/rcar-vin/
MEDIA DRIVERS FOR RENESAS - VSP1 #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/renesas,vsp1.yaml,drivers/media/platform/renesas/vsp1/
MEDIA DRIVERS FOR ST STV0910 DEMODULATOR ICs #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/stv0910*
MEDIA DRIVERS FOR ST STV6111 TUNER ICs #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/dvb-frontends/stv6111*
MEDIA DRIVERS FOR STM32 - CSI #
- Mail: Alain Volmat <alain.volmat@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media_tree.git
- Files:
Documentation/devicetree/bindings/media/st,stm32mp25-csi.yaml,drivers/media/platform/st/stm32/stm32-csi.c
MEDIA DRIVERS FOR STM32 - DCMI / DCMIPP #
- Mail: Hugues Fruchet <hugues.fruchet@foss.st.com>, Alain Volmat <alain.volmat@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml,Documentation/devicetree/bindings/media/st,stm32-dcmipp.yaml,drivers/media/platform/st/stm32/stm32-dcmi.c,drivers/media/platform/st/stm32/stm32-dcmipp/*
MEDIA INPUT INFRASTRUCTURE (V4L/DVB) #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.kernel.org/project/linux-media/list/
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/admin-guide/media/,Documentation/devicetree/bindings/media/,Documentation/driver-api/media/,Documentation/userspace-api/media/,drivers/media/,drivers/staging/media/,include/dt-bindings/media/,include/linux/platform_data/media/,include/media/,include/uapi/linux/dvb/,include/uapi/linux/ivtv*,include/uapi/linux/media.h,include/uapi/linux/uvcvideo.h,include/uapi/linux/v4l2-*,include/uapi/linux/videodev2.h
MEDIATEK BLUETOOTH DRIVER #
- Mail: Sean Wang <sean.wang@mediatek.com>
- Mailing list: linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/bluetooth/mediatek,bluetooth.txt,Documentation/devicetree/bindings/net/bluetooth/mediatek,mt7921s-bluetooth.yaml,drivers/bluetooth/btmtkuart.c
MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS #
- Mail: Sen Chu <sen.chu@mediatek.com>, Sean Wang <sean.wang@mediatek.com>, Macpaul Lin <macpaul.lin@mediatek.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml,drivers/power/reset/mt6323-poweroff.c
MEDIATEK CIR DRIVER #
- Mail: Sean Wang <sean.wang@mediatek.com>
- Status: Maintained
- Files:
drivers/media/rc/mtk-cir.c
MEDIATEK DMA DRIVER #
- Mail: Sean Wang <sean.wang@mediatek.com>
- Mailing list: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/mediatek,*,drivers/dma/mediatek/
MEDIATEK ETHERNET DRIVER #
- Mail: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/mediatek/
MEDIATEK ETHERNET PCS DRIVER #
- Mail: Alexander Couzens <lynxis@fe80.eu>, Daniel Golle <daniel@makrotopia.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/pcs/pcs-mtk-lynxi.c,include/linux/pcs/pcs-mtk-lynxi.h
MEDIATEK ETHERNET PHY DRIVERS #
- Mail: Daniel Golle <daniel@makrotopia.org>, Qingfang Deng <dqfext@gmail.com>, SkyLake Huang <SkyLake.Huang@mediatek.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/mediatek/mtk-2p5ge.c,drivers/net/phy/mediatek/mtk-ge-soc.c,drivers/net/phy/mediatek/mtk-phy-lib.c,drivers/net/phy/mediatek/mtk-ge.c,drivers/net/phy/mediatek/mtk.h,drivers/phy/mediatek/phy-mtk-xfi-tphy.c
MEDIATEK I2C CONTROLLER DRIVER #
- Mail: Qii Wang <qii.wang@mediatek.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml,drivers/i2c/busses/i2c-mt65xx.c
MEDIATEK IOMMU DRIVER #
- Mail: Yong Wu <yong.wu@mediatek.com>
- Mailing list: iommu@lists.linux.dev, linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/iommu/mediatek*,drivers/iommu/mtk_iommu*,include/dt-bindings/memory/mediatek,mt*-port.h,include/dt-bindings/memory/mt*-port.h
MEDIATEK JPEG DRIVER #
- Mail: Bin Liu <bin.liu@mediatek.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/mediatek-jpeg-*.yaml,drivers/media/platform/mediatek/jpeg/
MEDIATEK KEYPAD DRIVER #
- Mail: Mattijs Korpershoek <mkorpershoek@kernel.org>
- Status: Supported
- Files:
Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml,drivers/input/keyboard/mt6779-keypad.c
MEDIATEK MDP DRIVER #
- Mail: Minghsiu Tsai <minghsiu.tsai@mediatek.com>, Houlong Wei <houlong.wei@mediatek.com>, Andrew-CT Chen <andrew-ct.chen@mediatek.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/mediatek,mt8173-mdp.yaml,drivers/media/platform/mediatek/mdp/,drivers/media/platform/mediatek/vpu/
MEDIATEK MEDIA DRIVER #
- Mail: Tiffany Lin <tiffany.lin@mediatek.com>, Andrew-CT Chen <andrew-ct.chen@mediatek.com>, Yunfei Dong <yunfei.dong@mediatek.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/mediatek,vcodec*.yaml,Documentation/devicetree/bindings/media/mediatek,mt8173-vpu.yaml,drivers/media/platform/mediatek/vcodec/,drivers/media/platform/mediatek/vpu/
MEDIATEK MIPI-CSI CDPHY DRIVER #
- Mail: Julien Stephan <jstephan@baylibre.com>, Andy Hsieh <andy.hsieh@mediatek.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/phy/mediatek,mt8365-csi-rx.yaml,drivers/phy/mediatek/phy-mtk-mipi-csi-0-5*
MEDIATEK MMC/SD/SDIO DRIVER #
- Mail: Chaotian Jing <chaotian.jing@mediatek.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mmc/mtk-sd.yaml,drivers/mmc/host/mtk-sd.c
MEDIATEK MT6735 CLOCK & RESET DRIVERS #
- Mail: Yassine Oudjana <y.oudjana@protonmail.com>
- Mailing list: linux-clk@vger.kernel.org, linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/clk/mediatek/clk-mt6735-apmixedsys.c,drivers/clk/mediatek/clk-mt6735-imgsys.c,drivers/clk/mediatek/clk-mt6735-infracfg.c,drivers/clk/mediatek/clk-mt6735-mfgcfg.c,drivers/clk/mediatek/clk-mt6735-pericfg.c,drivers/clk/mediatek/clk-mt6735-topckgen.c,drivers/clk/mediatek/clk-mt6735-vdecsys.c,drivers/clk/mediatek/clk-mt6735-vencsys.c,include/dt-bindings/clock/mediatek,mt6735-apmixedsys.h,include/dt-bindings/clock/mediatek,mt6735-imgsys.h,include/dt-bindings/clock/mediatek,mt6735-infracfg.h,include/dt-bindings/clock/mediatek,mt6735-mfgcfg.h,include/dt-bindings/clock/mediatek,mt6735-pericfg.h,include/dt-bindings/clock/mediatek,mt6735-topckgen.h,include/dt-bindings/clock/mediatek,mt6735-vdecsys.h,include/dt-bindings/clock/mediatek,mt6735-vencsys.h,include/dt-bindings/reset/mediatek,mt6735-infracfg.h,include/dt-bindings/reset/mediatek,mt6735-mfgcfg.h,include/dt-bindings/reset/mediatek,mt6735-pericfg.h,include/dt-bindings/reset/mediatek,mt6735-vdecsys.h
MEDIATEK MT76 WIRELESS LAN DRIVER #
- Mail: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo@kernel.org>, Ryder Lee <ryder.lee@mediatek.com>
- Reviewer: Shayne Chen <shayne.chen@mediatek.com>, Sean Wang <sean.wang@mediatek.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/nbd168/wireless
- Files:
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml,drivers/net/wireless/mediatek/mt76/
MEDIATEK MT7601U WIRELESS LAN DRIVER #
- Mail: Jakub Kicinski <kuba@kernel.org>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/wireless/mediatek/mt7601u/
MEDIATEK MT7621 CLOCK DRIVER #
- Mail: Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/mediatek,mt7621-sysc.yaml,drivers/clk/ralink/clk-mt7621.c
MEDIATEK MT7621 PCIE CONTROLLER DRIVER #
- Mail: Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/mediatek,mt7621-pcie.yaml,drivers/pci/controller/pcie-mt7621.c
MEDIATEK MT7621 PHY PCI DRIVER #
- Mail: Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.yaml,drivers/phy/ralink/phy-mt7621-pci.c
MEDIATEK MT7621/28/88 I2C DRIVER #
- Mail: Stefan Roese <sr@denx.de>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/mediatek,mt7621-i2c.yaml,drivers/i2c/busses/i2c-mt7621.c
MEDIATEK MTMIPS CLOCK DRIVER #
- Mail: Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/mediatek,mtmips-sysc.yaml,drivers/clk/ralink/clk-mtmips.c
MEDIATEK NAND CONTROLLER DRIVER #
- Mailing list: linux-mtd@lists.infradead.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml,drivers/mtd/nand/raw/mtk_*
MEDIATEK PMIC LED DRIVER #
- Mail: Sen Chu <sen.chu@mediatek.com>, Sean Wang <sean.wang@mediatek.com>, Macpaul Lin <macpaul.lin@mediatek.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml,drivers/leds/leds-mt6323.c
MEDIATEK RANDOM NUMBER GENERATOR SUPPORT #
- Mail: Sean Wang <sean.wang@mediatek.com>
- Status: Maintained
- Files:
drivers/char/hw_random/mtk-rng.c
MEDIATEK SMI DRIVER #
- Mail: Yong Wu <yong.wu@mediatek.com>
- Mailing list: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/memory-controllers/mediatek,smi*,drivers/memory/mtk-smi.c,include/soc/mediatek/smi.h
MEDIATEK SWITCH DRIVER #
- Mail: Chester A. Unal <chester.a.unal@arinc9.com>, Daniel Golle <daniel@makrotopia.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/dsa/mt7530-mdio.c,drivers/net/dsa/mt7530-mmio.c,drivers/net/dsa/mt7530.*,net/dsa/tag_mtk.c
MEDIATEK T7XX 5G WWAN MODEM DRIVER #
- Mail: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
- Reviewer: Liu Haijun <haijun.liu@mediatek.com>, Ricardo Martinez <ricardo.martinez@linux.intel.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/wwan/t7xx/
MEDIATEK USB3 DRD IP DRIVER #
- Mail: Chunfeng Yun <chunfeng.yun@mediatek.com>
- Mailing list: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/mediatek,*,drivers/usb/host/xhci-mtk*,drivers/usb/mtu3/
MEGACHIPS STDPXXXX-GE-B850V3-FW LVDS/DP++ BRIDGES #
- Mail: Peter Senna Tschudin <peter.senna@gmail.com>, Ian Ray <ian.ray@ge.com>, Martyn Welch <martyn.welch@collabora.co.uk>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/bridge/megachips-stdpxxxx-ge-b850v3-fw.txt,drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
MEGARAID SCSI/SAS DRIVERS #
- Mail: Kashyap Desai <kashyap.desai@broadcom.com>, Sumit Saxena <sumit.saxena@broadcom.com>, Shivasharan S <shivasharan.srikanteshwara@broadcom.com>, Chandrakanth patil <chandrakanth.patil@broadcom.com>
- Mailing list: megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org
- Status: Maintained
- Web-page: http://www.avagotech.com/support/
- Files:
Documentation/scsi/megaraid.rst,drivers/scsi/megaraid.*,drivers/scsi/megaraid/
MELEXIS MLX90614 DRIVER #
- Mail: Crt Mori <cmo@melexis.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: http://www.melexis.com
- Files:
drivers/iio/temperature/mlx90614.c
MELEXIS MLX90632 DRIVER #
- Mail: Crt Mori <cmo@melexis.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: http://www.melexis.com
- Files:
drivers/iio/temperature/mlx90632.c
MELEXIS MLX90635 DRIVER #
- Mail: Crt Mori <cmo@melexis.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Web-page: http://www.melexis.com
- Files:
drivers/iio/temperature/mlx90635.c
MELLANOX BLUEFIELD I2C DRIVER #
- Mail: Khalil Blaiech <kblaiech@nvidia.com>, Asmaa Mnebhi <asmaa@nvidia.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
drivers/i2c/busses/i2c-mlxbf.c
MELLANOX ETHERNET DRIVER (mlx4_en) #
- Mail: Tariq Toukan <tariqt@nvidia.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
drivers/net/ethernet/mellanox/mlx4/en_*
MELLANOX ETHERNET DRIVER (mlx5e) #
- Mail: Saeed Mahameed <saeedm@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
drivers/net/ethernet/mellanox/mlx5/core/en_*
MELLANOX ETHERNET INNOVA DRIVERS #
- Reviewer: Boris Pismenny <borisp@nvidia.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/*,drivers/net/ethernet/mellanox/mlx5/core/fpga/*,include/linux/mlx5/mlx5_ifc_fpga.h
MELLANOX ETHERNET SWITCH DRIVERS #
- Mail: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
drivers/net/ethernet/mellanox/mlxsw/,tools/testing/selftests/drivers/net/mlxsw/
MELLANOX FIRMWARE FLASH LIBRARY (mlxfw) #
- Mail: mlxsw@nvidia.com
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
drivers/net/ethernet/mellanox/mlxfw/
MELLANOX HARDWARE PLATFORM SUPPORT #
- Mail: Hans de Goede <hansg@kernel.org>, Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>, Vadim Pasternak <vadimp@nvidia.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
Documentation/ABI/stable/sysfs-driver-mlxreg-io,Documentation/ABI/testing/sysfs-platform-mellanox-bootctl,drivers/platform/mellanox/,include/linux/platform_data/mlxreg.h
MELLANOX MLX4 core VPI driver #
- Mail: Tariq Toukan <tariqt@nvidia.com>
- Mailing list: netdev@vger.kernel.org, linux-rdma@vger.kernel.org
- Status: Maintained
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
drivers/net/ethernet/mellanox/mlx4/,include/linux/mlx4/
MELLANOX MLX4 IB driver #
- Mail: Yishai Hadas <yishaih@nvidia.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: https://www.nvidia.com/networking/
- Patchwork: http://patchwork.kernel.org/project/linux-rdma/list/
- Files:
drivers/infiniband/hw/mlx4/,include/linux/mlx4/,include/uapi/rdma/mlx4-abi.h
MELLANOX MLX5 core VPI driver #
- Mail: Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leonro@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>
- Mailing list: netdev@vger.kernel.org, linux-rdma@vger.kernel.org
- Status: Maintained
- Web-page: https://www.nvidia.com/networking/
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
Documentation/networking/device_drivers/ethernet/mellanox/,drivers/net/ethernet/mellanox/mlx5/core/,include/linux/mlx5/
MELLANOX MLX5 IB driver #
- Mail: Leon Romanovsky <leonro@nvidia.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Web-page: https://www.nvidia.com/networking/
- Patchwork: http://patchwork.kernel.org/project/linux-rdma/list/
- Files:
drivers/infiniband/hw/mlx5/,include/linux/mlx5/,include/uapi/rdma/mlx5-abi.h
MELLANOX MLX5 VDPA DRIVER #
- Mail: Dragos Tatulea <dtatulea@nvidia.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Supported
- Files:
drivers/vdpa/mlx5/
MELLANOX MLXCPLD I2C AND MUX DRIVER #
- Mail: Vadim Pasternak <vadimp@nvidia.com>, Michael Shych <michaelsh@nvidia.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
Documentation/i2c/busses/i2c-mlxcpld.rst,drivers/i2c/busses/i2c-mlxcpld.c,drivers/i2c/muxes/i2c-mux-mlxcpld.c
MELLANOX MLXCPLD LED DRIVER #
- Mail: Vadim Pasternak <vadimp@nvidia.com>
- Mailing list: linux-leds@vger.kernel.org
- Status: Supported
- Files:
Documentation/leds/leds-mlxcpld.rst,drivers/leds/leds-mlxcpld.c,drivers/leds/leds-mlxreg.c
MEMBARRIER SUPPORT #
- Mail: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, "Paul E. McKenney" <paulmck@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
Documentation/scheduler/membarrier.rst,arch/*/include/asm/membarrier.h,arch/*/include/asm/sync_core.h,include/uapi/linux/membarrier.h,kernel/sched/membarrier.c
MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION #
- Mail: Mike Rapoport <rppt@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git for-next, git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git fixes
- Files:
Documentation/core-api/boot-time-mm.rst,include/linux/kho/abi/memblock.h,include/linux/memblock.h,mm/bootmem_info.c,mm/memblock.c,mm/memtest.c,mm/mm_init.c,mm/rodata_test.c,tools/testing/memblock/
MEMORY ALLOCATION PROFILING #
- Mail: Suren Baghdasaryan <surenb@google.com>, Kent Overstreet <kent.overstreet@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/mm/allocation-profiling.rst,include/linux/alloc_tag.h,include/linux/pgalloc_tag.h,lib/alloc_tag.c
MEMORY CONTROLLER DRIVERS #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- bugs: mailto:krzk@kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl.git
- Files:
Documentation/devicetree/bindings/memory-controllers/,drivers/memory/,include/dt-bindings/memory/,include/memory/
MEMORY FREQUENCY SCALING DRIVERS FOR NVIDIA TEGRA #
- Mail: Dmitry Osipenko <digetx@gmail.com>
- Mailing list: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
- Files:
drivers/devfreq/tegra30-devfreq.c
MEMORY HOT(UN)PLUG #
- Mail: David Hildenbrand <david@kernel.org>, Oscar Salvador <osalvador@suse.de>
- Mailing list: linux-mm@kvack.org, linux-cxl@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/mm/memory-hotplug.rst,Documentation/core-api/memory-hotplug.rst,drivers/base/memory.c,include/linux/memory_hotplug.h,include/linux/memremap.h,mm/memremap.c,mm/memory_hotplug.c,tools/testing/selftests/memory-hotplug/
MEMORY MANAGEMENT #
- Mail: Andrew Morton <akpm@linux-foundation.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm, quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
- Files:
mm/,tools/mm/
MEMORY MANAGEMENT - BALLOON #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>
- Mailing list: linux-mm@kvack.org, virtualization@lists.linux.dev
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
include/linux/balloon.h,mm/balloon.c
MEMORY MANAGEMENT - CORE #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>
- Reviewer: Lorenzo Stoakes <ljs@kernel.org>, Liam R. Howlett <Liam.Howlett@oracle.com>, Vlastimil Babka <vbabka@kernel.org>, Mike Rapoport <rppt@kernel.org>, Suren Baghdasaryan <surenb@google.com>, Michal Hocko <mhocko@suse.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
include/linux/gfp.h,include/linux/gfp_types.h,include/linux/highmem.h,include/linux/leafops.h,include/linux/memory.h,include/linux/mm.h,include/linux/mm_*.h,include/linux/mmzone.h,include/linux/mmdebug.h,include/linux/mmu_notifier.h,include/linux/pagewalk.h,include/linux/pgalloc.h,include/linux/pgtable.h,include/linux/ptdump.h,include/linux/vmpressure.h,include/linux/vmstat.h,kernel/fork.c,mm/Kconfig,mm/debug.c,mm/folio-compat.c,mm/highmem.c,mm/init-mm.c,mm/internal.h,mm/maccess.c,mm/memory.c,mm/mmu_notifier.c,mm/mmzone.c,mm/pagewalk.c,mm/pgtable-generic.c,mm/ptdump.c,mm/sparse-vmemmap.c,mm/sparse.c,mm/util.c,mm/vmpressure.c,mm/vmstat.c - Regex:
include/linux/page[-_]*
MEMORY MANAGEMENT - EXECMEM #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Mike Rapoport <rppt@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/execmem.h,mm/execmem.c
MEMORY MANAGEMENT - GUP (GET USER PAGES) #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>
- Reviewer: Jason Gunthorpe <jgg@nvidia.com>, John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
mm/gup.c,mm/gup_test.c,mm/gup_test.h,tools/testing/selftests/mm/gup_longterm.c,tools/testing/selftests/mm/gup_test.c
MEMORY MANAGEMENT - KSM (Kernel Samepage Merging) #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>
- Reviewer: Xu Xin <xu.xin16@zte.com.cn>, Chengming Zhou <chengming.zhou@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
Documentation/admin-guide/mm/ksm.rst,Documentation/mm/ksm.rst,include/linux/ksm.h,include/trace/events/ksm.h,mm/ksm.c,mm/mm_slot.h
MEMORY MANAGEMENT - MEMORY POLICY AND MIGRATION #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>
- Reviewer: Zi Yan <ziy@nvidia.com>, Matthew Brost <matthew.brost@intel.com>, Joshua Hahn <joshua.hahnjy@gmail.com>, Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>, Gregory Price <gourry@gourry.net>, Ying Huang <ying.huang@linux.alibaba.com>, Alistair Popple <apopple@nvidia.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
include/linux/mempolicy.h,include/uapi/linux/mempolicy.h,include/linux/migrate.h,include/linux/migrate_mode.h,mm/mempolicy.c,mm/migrate.c,mm/migrate_device.c
MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU) #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Axel Rasmussen <axelrasmussen@google.com>, Yuanchu Xie <yuanchu@google.com>
- Reviewer: Wei Xu <weixugc@google.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
Documentation/admin-guide/mm/multigen_lru.rst,Documentation/mm/multigen_lru.rst,include/linux/mm_inline.h,include/linux/mmzone.h,mm/swap.c,mm/vmscan.c,mm/workingset.c
MEMORY MANAGEMENT - MISC #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>
- Reviewer: Lorenzo Stoakes <ljs@kernel.org>, Liam R. Howlett <Liam.Howlett@oracle.com>, Vlastimil Babka <vbabka@kernel.org>, Mike Rapoport <rppt@kernel.org>, Suren Baghdasaryan <surenb@google.com>, Michal Hocko <mhocko@suse.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
Documentation/admin-guide/mm/,Documentation/mm/,include/linux/cma.h,include/linux/dmapool.h,include/linux/ioremap.h,include/linux/memory-tiers.h,include/linux/page_idle.h,mm/backing-dev.c,mm/cma.c,mm/cma_debug.c,mm/cma_sysfs.c,mm/dmapool.c,mm/dmapool_test.c,mm/early_ioremap.c,mm/fadvise.c,mm/ioremap.c,mm/mapping_dirty_helpers.c,mm/memory-tiers.c,mm/page_idle.c,mm/pgalloc-track.h,mm/process_vm_access.c,tools/testing/selftests/mm/
MEMORY MANAGEMENT - NUMA MEMBLOCKS AND NUMA EMULATION #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Mike Rapoport <rppt@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git
- Files:
include/linux/numa_memblks.h,mm/numa.c,mm/numa_emulation.c,mm/numa_memblks.c
MEMORY MANAGEMENT - OOM KILLER #
- Mail: Michal Hocko <mhocko@suse.com>
- Reviewer: David Rientjes <rientjes@google.com>, Shakeel Butt <shakeel.butt@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/oom.h,include/trace/events/oom.h,include/uapi/linux/oom.h,mm/oom_kill.c
MEMORY MANAGEMENT - PAGE ALLOCATOR #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Vlastimil Babka <vbabka@kernel.org>
- Reviewer: Suren Baghdasaryan <surenb@google.com>, Michal Hocko <mhocko@suse.com>, Brendan Jackman <jackmanb@google.com>, Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/compaction.h,include/linux/gfp.h,include/linux/page-isolation.h,mm/compaction.c,mm/debug_page_alloc.c,mm/debug_page_ref.c,mm/fail_page_alloc.c,mm/page_alloc.c,mm/page_ext.c,mm/page_frag_cache.c,mm/page_isolation.c,mm/page_owner.c,mm/page_poison.c,mm/page_reporting.c,mm/page_reporting.h,mm/show_mem.c,mm/shuffle.c,mm/shuffle.h
MEMORY MANAGEMENT - RECLAIM #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Johannes Weiner <hannes@cmpxchg.org>
- Reviewer: David Hildenbrand <david@kernel.org>, Michal Hocko <mhocko@kernel.org>, Qi Zheng <zhengqi.arch@bytedance.com>, Shakeel Butt <shakeel.butt@linux.dev>, Lorenzo Stoakes <ljs@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
mm/vmscan.c,mm/workingset.c
MEMORY MANAGEMENT - RMAP (REVERSE MAPPING) #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>, Lorenzo Stoakes <ljs@kernel.org>
- Reviewer: Rik van Riel <riel@surriel.com>, Liam R. Howlett <Liam.Howlett@oracle.com>, Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>, Jann Horn <jannh@google.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/rmap.h,mm/page_vma_mapped.c,mm/rmap.c,tools/testing/selftests/mm/rmap.c
MEMORY MANAGEMENT - SECRETMEM #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Mike Rapoport <rppt@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/secretmem.h,mm/secretmem.c
MEMORY MANAGEMENT - SWAP #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>
- Reviewer: Kemeng Shi <shikemeng@huaweicloud.com>, Nhat Pham <nphamcs@gmail.com>, Baoquan He <bhe@redhat.com>, Barry Song <baohua@kernel.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/mm/swap-table.rst,include/linux/swap.h,include/linux/swapfile.h,include/linux/swapops.h,mm/page_io.c,mm/swap.c,mm/swap.h,mm/swap_table.h,mm/swap_state.c,mm/swapfile.c
MEMORY MANAGEMENT - THP (TRANSPARENT HUGE PAGE) #
- Mail: Andrew Morton <akpm@linux-foundation.org>, David Hildenbrand <david@kernel.org>, Lorenzo Stoakes <ljs@kernel.org>
- Reviewer: Zi Yan <ziy@nvidia.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Liam R. Howlett <Liam.Howlett@oracle.com>, Nico Pache <npache@redhat.com>, Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>, Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
Documentation/admin-guide/mm/transhuge.rst,include/linux/huge_mm.h,include/linux/khugepaged.h,include/trace/events/huge_memory.h,mm/huge_memory.c,mm/khugepaged.c,mm/mm_slot.h,tools/testing/selftests/mm/khugepaged.c,tools/testing/selftests/mm/split_huge_page_test.c,tools/testing/selftests/mm/transhuge-stress.c
MEMORY MANAGEMENT - USERFAULTFD #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Mike Rapoport <rppt@kernel.org>
- Reviewer: Peter Xu <peterx@redhat.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/admin-guide/mm/userfaultfd.rst,fs/userfaultfd.c,include/asm-generic/pgtable_uffd.h,include/linux/userfaultfd_k.h,include/uapi/linux/userfaultfd.h,mm/userfaultfd.c,tools/testing/selftests/mm/uffd-*.[ch]
MEMORY MANAGEMENT - RUST #
- Mail: Alice Ryhl <aliceryhl@google.com>
- Reviewer: Lorenzo Stoakes <ljs@kernel.org>, Liam R. Howlett <Liam.Howlett@oracle.com>
- Mailing list: linux-mm@kvack.org, rust-for-linux@vger.kernel.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
rust/helpers/mm.c,rust/helpers/page.c,rust/kernel/mm.rs,rust/kernel/mm/,rust/kernel/page.rs
MEMORY MAPPING #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Liam R. Howlett <Liam.Howlett@oracle.com>, Lorenzo Stoakes <ljs@kernel.org>
- Reviewer: Vlastimil Babka <vbabka@kernel.org>, Jann Horn <jannh@google.com>, Pedro Falcato <pfalcato@suse.de>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
include/trace/events/mmap.h,mm/interval_tree.c,mm/mincore.c,mm/mlock.c,mm/mmap.c,mm/mprotect.c,mm/mremap.c,mm/mseal.c,mm/msync.c,mm/nommu.c,mm/vma.c,mm/vma.h,mm/vma_exec.c,mm/vma_init.c,mm/vma_internal.h,tools/testing/selftests/mm/merge.c,tools/testing/vma/
MEMORY MAPPING - LOCKING #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Suren Baghdasaryan <surenb@google.com>, Liam R. Howlett <Liam.Howlett@oracle.com>, Lorenzo Stoakes <ljs@kernel.org>
- Reviewer: Vlastimil Babka <vbabka@kernel.org>, Shakeel Butt <shakeel.butt@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
Documentation/mm/process_addrs.rst,include/linux/mmap_lock.h,include/trace/events/mmap_lock.h,mm/mmap_lock.c
MEMORY MAPPING - MADVISE (MEMORY ADVICE) #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Liam R. Howlett <Liam.Howlett@oracle.com>, Lorenzo Stoakes <ljs@kernel.org>, David Hildenbrand <david@kernel.org>
- Reviewer: Vlastimil Babka <vbabka@kernel.org>, Jann Horn <jannh@google.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
include/uapi/asm-generic/mman-common.h,mm/madvise.c
MEMORY TECHNOLOGY DEVICES (MTD) #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Web-page: http://www.linux-mtd.infradead.org/
- Patchwork: http://patchwork.ozlabs.org/project/linux-mtd/list/
- chat: irc://irc.oftc.net/mtd
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
- Files:
Documentation/devicetree/bindings/mtd/,drivers/mtd/,include/linux/mtd/,include/uapi/mtd/
MEN A21 WATCHDOG DRIVER #
- Mail: Johannes Thumshirn <morbidrsa@gmail.com>
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Maintained
- Files:
drivers/watchdog/mena21_wdt.c
MEN CHAMELEON BUS (mcb) #
- Mail: Johannes Thumshirn <morbidrsa@gmail.com>
- Status: Maintained
- Files:
Documentation/driver-api/men-chameleon-bus.rst,drivers/mcb/,include/linux/mcb.h
MEN F21BMC (Board Management Controller) #
- Mail: Andreas Werner <andreas.werner@men.de>
- Status: Supported
- Files:
Documentation/hwmon/menf21bmc.rst,drivers/hwmon/menf21bmc_hwmon.c,drivers/leds/leds-menf21bmc.c,drivers/mfd/menf21bmc.c,drivers/watchdog/menf21bmc_wdt.c
MEN Z069 WATCHDOG DRIVER #
- Mail: Johannes Thumshirn <jth@kernel.org>
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Maintained
- Files:
drivers/watchdog/menz69_wdt.c
MESON AO CEC DRIVER FOR AMLOGIC SOCS #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>
- Mailing list: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org
- Status: Supported
- Web-page: http://linux-meson.com/
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/cec/amlogic,meson-gx-ao-cec.yaml,drivers/media/cec/platform/meson/ao-cec-g12a.c,drivers/media/cec/platform/meson/ao-cec.c
MESON GE2D DRIVER FOR AMLOGIC SOCS #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>
- Mailing list: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/amlogic,axg-ge2d.yaml,drivers/media/platform/amlogic/meson-ge2d/
MESON NAND CONTROLLER DRIVER FOR AMLOGIC SOCS #
- Mail: Liang Yang <liang.yang@amlogic.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml,drivers/mtd/nand/raw/meson_*
MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS #
- Mail: Neil Armstrong <neil.armstrong@linaro.org>
- Mailing list: linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/amlogic,gx-vdec.yaml,drivers/staging/media/meson/vdec/
META ETHERNET DRIVERS #
- Mail: Alexander Duyck <alexanderduyck@fb.com>, Jakub Kicinski <kuba@kernel.org>
- Reviewer: kernel-team@meta.com
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/meta/,drivers/net/ethernet/meta/
METHODE UDPU SUPPORT #
- Mail: Robert Marko <robert.marko@sartura.hr>
- Status: Maintained
- Files:
arch/arm64/boot/dts/marvell/armada-3720-eDPU.dts,arch/arm64/boot/dts/marvell/armada-3720-uDPU.*
MHI BUS #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git
- Files:
Documentation/ABI/stable/sysfs-bus-mhi,Documentation/mhi/,drivers/bus/mhi/,drivers/pci/endpoint/functions/pci-epf-mhi.c,include/linux/mhi.h
MICROBLAZE ARCHITECTURE #
- Mail: Michal Simek <monstr@monstr.eu>
- Status: Supported
- Web-page: http://www.monstr.eu/fdt/
- SCM: git git://git.monstr.eu/linux-2.6-microblaze.git
- Files:
arch/microblaze/
MICROBLAZE TMR INJECT #
- Mail: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/misc/xlnx,tmr-inject.yaml,drivers/misc/xilinx_tmr_inject.c
MICROBLAZE TMR MANAGER #
- Mail: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
- Status: Supported
- Files:
Documentation/ABI/testing/sysfs-driver-xilinx-tmr-manager,Documentation/devicetree/bindings/misc/xlnx,tmr-manager.yaml,drivers/misc/xilinx_tmr_manager.c
MICROCHIP AT91 DMA DRIVERS #
- Mail: Ludovic Desroches <ludovic.desroches@microchip.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), dmaengine@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/dma/atmel,at91sam9g45-dma.yaml,drivers/dma/at_hdmac.c,drivers/dma/at_xdmac.c,include/dt-bindings/dma/at91.h
MICROCHIP AT91 SERIAL DRIVER #
- Mail: Richard Genoud <richard.genoud@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml,drivers/tty/serial/atmel_serial.c,drivers/tty/serial/atmel_serial.h
MICROCHIP AT91 USART MFD DRIVER #
- Mail: Radu Pirea <radu_nicolae.pirea@upb.ro>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml,drivers/mfd/at91-usart.c,include/dt-bindings/mfd/at91-usart.h
MICROCHIP AT91 USART SPI DRIVER #
- Mail: Radu Pirea <radu_nicolae.pirea@upb.ro>
- Mailing list: linux-spi@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml,drivers/spi/spi-at91-usart.c
MICROCHIP AUDIO ASOC DRIVERS #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>, Andrei Simion <andrei.simion@microchip.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/sound/atmel*,Documentation/devicetree/bindings/sound/axentia,tse850-pcm5142.txt,Documentation/devicetree/bindings/sound/microchip,sama7g5-*,Documentation/devicetree/bindings/sound/mikroe,mikroe-proto.txt,sound/soc/atmel
MICROCHIP CSI2DC DRIVER #
- Mail: Eugen Hristev <eugen.hristev@microchip.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/microchip,csi2dc.yaml,drivers/media/platform/microchip/microchip-csi2dc.c
MICROCHIP ECC DRIVER #
- Mailing list: linux-crypto@vger.kernel.org
- Status: Orphan
- Files:
drivers/crypto/atmel-ecc.*
MICROCHIP EIC DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/interrupt-controller/microchip,sama7g5-eic.yaml,drivers/irqchip/irq-mchp-eic.c
MICROCHIP I2C DRIVER #
- Mail: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
drivers/i2c/busses/i2c-at91-*.c,drivers/i2c/busses/i2c-at91.h
MICROCHIP ISC DRIVER #
- Mail: Eugen Hristev <eugen.hristev@microchip.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/atmel,isc.yaml,Documentation/devicetree/bindings/media/microchip,xisc.yaml,drivers/media/platform/microchip/microchip-isc*,drivers/media/platform/microchip/microchip-sama*-isc*,drivers/staging/media/deprecated/atmel/atmel-isc*,drivers/staging/media/deprecated/atmel/atmel-sama*-isc*,include/linux/atmel-isc-media.h
MICROCHIP ISI DRIVER #
- Mail: Eugen Hristev <eugen.hristev@microchip.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
drivers/media/platform/atmel/atmel-isi.c,drivers/media/platform/atmel/atmel-isi.h
MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER #
- Mail: Woojung Huh <woojung.huh@microchip.com>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml,Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml,drivers/net/dsa/microchip/*,include/linux/dsa/ksz_common.h,include/linux/platform_data/microchip-ksz.h,net/dsa/tag_ksz.c
MICROCHIP LAN743X ETHERNET DRIVER #
- Mail: Bryan Whitehead <bryan.whitehead@microchip.com>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/microchip/lan743x_*
MICROCHIP LAN8650/1 10BASE-T1S MACPHY ETHERNET DRIVER #
- Mail: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/microchip,lan8650.yaml,drivers/net/ethernet/microchip/lan865x/lan865x.c
MICROCHIP LAN87xx/LAN937x T1 PHY DRIVER #
- Mail: Arun Ramadoss <arun.ramadoss@microchip.com>
- Reviewer: UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/microchip_t1.c
MICROCHIP LAN966X ETHERNET DRIVER #
- Mail: Horatiu Vultur <horatiu.vultur@microchip.com>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/microchip/lan966x/*
MICROCHIP LAN966X OIC DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/microchip,lan966x-oic.yaml,drivers/irqchip/irq-lan966x-oic.c
MICROCHIP LAN966X PCI DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Status: Maintained
- Files:
drivers/misc/lan966x_pci.c,drivers/misc/lan966x_pci.dtso
MICROCHIP LAN969X ETHERNET DRIVER #
- Mail: Daniel Machon <daniel.machon@microchip.com>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/microchip/sparx5/lan969x/*
MICROCHIP LCDFB DRIVER #
- Mail: Nicolas Ferre <nicolas.ferre@microchip.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/atmel_lcdfb.c,include/video/atmel_lcdc.h
MICROCHIP MCP16502 PMIC DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>, Andrei Simion <andrei.simion@microchip.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/regulator/microchip,mcp16502.yaml,drivers/regulator/mcp16502.c
MICROCHIP MCP3564 ADC DRIVER #
- Mail: Marius Cristea <marius.cristea@microchip.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/ABI/testing/sysfs-bus-iio-adc-mcp3564,Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml,drivers/iio/adc/mcp3564.c
MICROCHIP MCP3911 ADC DRIVER #
- Mail: Marcus Folkesson <marcus.folkesson@gmail.com>, Kent Gustavsson <kent@minoris.se>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/microchip,mcp3911.yaml,drivers/iio/adc/mcp3911.c
MICROCHIP MMC/SD/SDIO MCI DRIVER #
- Mail: Aubin Constans <aubin.constans@microchip.com>
- Status: Maintained
- Files:
drivers/mmc/host/atmel-mci.c
MICROCHIP NAND DRIVER #
- Mailing list: linux-mtd@lists.infradead.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/mtd/atmel-nand.txt,drivers/mtd/nand/raw/atmel/*
MICROCHIP OTPC DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml,drivers/nvmem/microchip-otpc.c,include/dt-bindings/nvmem/microchip,sama7g5-otpc.h
MICROCHIP PAC1921 POWER/CURRENT MONITOR DRIVER #
- Mail: Matteo Martelli <matteomartelli3@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/microchip,pac1921.yaml,drivers/iio/adc/pac1921.c
MICROCHIP PAC1934 POWER/ENERGY MONITOR DRIVER #
- Mail: Marius Cristea <marius.cristea@microchip.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/microchip,pac1934.yaml,drivers/iio/adc/pac1934.c
MICROCHIP PCI1XXXX GP DRIVER #
- Mail: Vaibhaav Ram T.L <vaibhaavram.tl@microchip.com>, Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Supported
- Files:
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.c,drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gp.h,drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c,drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c
MICROCHIP PCI1XXXX I2C DRIVER #
- Mail: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>, Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-mchp-pci1xxxx.c
MICROCHIP PCIe UART DRIVER #
- Mail: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- Files:
drivers/tty/serial/8250/8250_pci1xxxx.c
MICROCHIP POLARFIRE FPGA DRIVERS #
- Mail: Conor Dooley <conor.dooley@microchip.com>
- Mailing list: linux-fpga@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml,drivers/fpga/microchip-spi.c
MICROCHIP PWM DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-pwm@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml,drivers/pwm/pwm-atmel.c
MICROCHIP SAM9x7-COMPATIBLE LVDS CONTROLLER #
- Mail: Manikandan Muralidharan <manikandan.m@microchip.com>, Dharma Balasubiramani <dharma.b@microchip.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-lvds.yaml,drivers/gpu/drm/bridge/microchip-lvds.c
MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER #
- Mail: Eugen Hristev <eugen.hristev@microchip.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.yaml,drivers/iio/adc/at91-sama5d2_adc.c,include/dt-bindings/iio/adc/at91-sama5d2_adc.h
MICROCHIP SAMA5D2-COMPATIBLE SHUTDOWN CONTROLLER #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Status: Supported
- Files:
Documentation/devicetree/bindings/power/reset/atmel,sama5d2-shdwc.yaml,drivers/power/reset/at91-sama5d2_shdwc.c
MICROCHIP SOC DRIVERS #
- Mail: Conor Dooley <conor@kernel.org>
- Status: Supported
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
- Files:
Documentation/devicetree/bindings/soc/microchip/,drivers/soc/microchip/
MICROCHIP SPI DRIVER #
- Mail: Ryan Wanner <ryan.wanner@microchip.com>
- Status: Supported
- Files:
drivers/spi/spi-atmel.*
MICROCHIP SSC DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea@tuxon.dev>, Andrei Simion <andrei.simion@microchip.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/sound/atmel,at91-ssc.yaml,drivers/misc/atmel-ssc.c,include/linux/atmel-ssc.h
Microchip Timer Counter Block (TCB) Capture Driver #
- Mail: Kamel Bouhara <kamel.bouhara@bootlin.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/counter/microchip-tcb-capture.c,include/uapi/linux/counter/microchip-tcb-capture.h
MICROCHIP USB251XB DRIVER #
- Mail: Richard Leitner <richard.leitner@skidata.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/usb251xb.yaml,drivers/usb/misc/usb251xb.c
MICROCHIP USBA UDC DRIVER #
- Mail: Cristian Birsan <cristian.birsan@microchip.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
drivers/usb/gadget/udc/atmel_usba_udc.*
MICROCHIP WILC1000 WIFI DRIVER #
- Mail: Ajay Singh <ajay.kathat@microchip.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Files:
drivers/net/wireless/microchip/
MICROCHIP ZL3073X DRIVER #
- Mail: Ivan Vecera <ivecera@redhat.com>, Prathosh Satish <Prathosh.Satish@microchip.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/dpll/microchip,zl30731.yaml,drivers/dpll/zl3073x/
MICROSEMI MIPS SOCS #
- Mail: Alexandre Belloni <alexandre.belloni@bootlin.com>, UNGLinuxDriver@microchip.com
- Mailing list: linux-mips@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mips/mscc.txt,Documentation/devicetree/bindings/phy/mscc,vsc7514-serdes.yaml,Documentation/devicetree/bindings/power/reset/ocelot-reset.txt,arch/mips/boot/dts/mscc/,arch/mips/configs/generic/board-ocelot.config,arch/mips/generic/board-ocelot.c
MICROSEMI SMART ARRAY SMARTPQI DRIVER (smartpqi) #
- Mail: Don Brace <don.brace@microchip.com>
- Mailing list: storagedev@microchip.com, linux-scsi@vger.kernel.org
- Status: Supported
- Files:
Documentation/scsi/smartpqi.rst,drivers/scsi/smartpqi/Kconfig,drivers/scsi/smartpqi/Makefile,drivers/scsi/smartpqi/smartpqi*.[ch],include/linux/cciss*.h,include/uapi/linux/cciss*.h
MICROSOFT MANA RDMA DRIVER #
- Mail: Long Li <longli@microsoft.com>, Konstantin Taranov <kotaranov@microsoft.com>
- Mailing list: linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/hw/mana/,include/net/mana,include/uapi/rdma/mana-abi.h
MICROSOFT SURFACE AGGREGATOR TABLET-MODE SWITCH #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/surface/surface_aggregator_tabletsw.c
MICROSOFT SURFACE BATTERY AND AC DRIVERS #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: linux-pm@vger.kernel.org, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/power/supply/surface_battery.c,drivers/power/supply/surface_charger.c
MICROSOFT SURFACE DTX DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/driver-api/surface_aggregator/clients/dtx.rst,drivers/platform/surface/surface_dtx.c,include/uapi/linux/surface_aggregator/dtx.h
MICROSOFT SURFACE SENSOR FAN DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>, Ivor Wanders <ivor@iwanders.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/surface_fan.rst,drivers/hwmon/surface_fan.c
MICROSOFT SURFACE SENSOR THERMAL DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/surface_temp.c
MICROSOFT SURFACE GPE LID SUPPORT DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/surface/surface_gpe.c
MICROSOFT SURFACE HARDWARE PLATFORM SUPPORT #
- Mail: Hans de Goede <hansg@kernel.org>, Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>, Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
- Files:
drivers/platform/surface/
MICROSOFT SURFACE HID TRANSPORT DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/surface-hid/
MICROSOFT SURFACE HOT-PLUG DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/surface/surface_hotplug.c
MICROSOFT SURFACE PLATFORM PROFILE DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/surface/surface_platform_profile.c
MICROSOFT SURFACE PRO 3 BUTTON DRIVER #
- Mail: Chen Yu <yu.c.chen@intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/surface/surfacepro3_button.c
MICROSOFT SURFACE SYSTEM AGGREGATOR HUB DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/surface/surface_aggregator_hub.c
MICROSOFT SURFACE SYSTEM AGGREGATOR SUBSYSTEM #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/linux-surface/surface-aggregator-module
- chat: irc://irc.libera.chat/linux-surface
- Files:
Documentation/driver-api/surface_aggregator/,drivers/platform/surface/aggregator/,drivers/platform/surface/surface_acpi_notify.c,drivers/platform/surface/surface_aggregator_cdev.c,drivers/platform/surface/surface_aggregator_registry.c,include/linux/surface_acpi_notify.h,include/linux/surface_aggregator/,include/uapi/linux/surface_aggregator/
MICROTEK X6 SCANNER #
- Mail: Oliver Neukum <oliver@neukum.org>
- Status: Maintained
- Files:
drivers/usb/image/microtek.*
MIKROTIK CRS3XX 98DX3236 BOARD SUPPORT #
- Mail: Luka Kovacic <luka.kovacic@sartura.hr>, Luka Perkov <luka.perkov@sartura.hr>
- Status: Maintained
- Files:
arch/arm/boot/dts/marvell/armada-xp-crs305-1g-4s-bit.dts,arch/arm/boot/dts/marvell/armada-xp-crs305-1g-4s.dts,arch/arm/boot/dts/marvell/armada-xp-crs326-24g-2s-bit.dts,arch/arm/boot/dts/marvell/armada-xp-crs326-24g-2s.dts,arch/arm/boot/dts/marvell/armada-xp-crs328-4c-20s-4s-bit.dts,arch/arm/boot/dts/marvell/armada-xp-crs328-4c-20s-4s.dts
MIN HEAP #
- Mail: Kuan-Wei Chiu <visitorckw@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/core-api/min_heap.rst,include/linux/min_heap.h,lib/min_heap.c,lib/tests/min_heap_kunit.c
MIPI CCS, SMIA AND SMIA++ IMAGE SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/mipi-ccs.yaml,Documentation/driver-api/media/drivers/ccs/,Documentation/userspace-api/media/drivers/ccs.rst,drivers/media/i2c/ccs-pll.c,drivers/media/i2c/ccs-pll.h,drivers/media/i2c/ccs/,include/uapi/linux/ccs.h,include/uapi/linux/smiapp.h
MIPS #
- Mail: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-mips/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git
- Files:
Documentation/devicetree/bindings/mips/,Documentation/arch/mips/,arch/mips/,drivers/platform/mips/,include/dt-bindings/mips/,include/linux/platform_data/pic32.h
MIPS BOSTON DEVELOPMENT BOARD #
- Mail: Paul Burton <paulburton@kernel.org>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/img,boston-clock.txt,arch/mips/boot/dts/img/boston.dts,arch/mips/configs/generic/board-boston.config,drivers/clk/imgtec/clk-boston.c,include/dt-bindings/clock/boston-clock.h
MIPS CORE DRIVERS #
- Mail: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- Mailing list: linux-mips@vger.kernel.org
- Status: Supported
- Files:
drivers/bus/mips_cdmm.c,drivers/clocksource/mips-gic-timer.c,drivers/cpuidle/cpuidle-cps.c,drivers/irqchip/irq-mips-cpu.c,drivers/irqchip/irq-mips-gic.c
MIPS GENERIC PLATFORM #
- Mail: Paul Burton <paulburton@kernel.org>
- Mailing list: linux-mips@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/power/mti,mips-cpc.yaml,arch/mips/generic/,arch/mips/tools/generic-board-config.sh
MIPS RINT INSTRUCTION EMULATION #
- Mail: Aleksandar Markovic <aleksandar.markovic@mips.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Supported
- Files:
arch/mips/math-emu/dp_rint.c,arch/mips/math-emu/sp_rint.c
MIPS/LOONGSON1 ARCHITECTURE #
- Mail: Keguang Zhang <keguang.zhang@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/*/loongson,ls1*.yaml,arch/mips/boot/dts/loongson/loongson1*,arch/mips/configs/loongson1_defconfig,arch/mips/loongson32/,drivers/*/*loongson1*,drivers/mtd/nand/raw/loongson-nand-controller.c,drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c,sound/soc/loongson/loongson1_ac97.c
MIPS/LOONGSON2EF ARCHITECTURE #
- Mail: Jiaxun Yang <jiaxun.yang@flygoat.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/include/asm/mach-loongson2ef/,arch/mips/loongson2ef/,drivers/cpufreq/loongson2_cpufreq.c
MIPS/LOONGSON64 ARCHITECTURE #
- Mail: Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/include/asm/mach-loongson64/,arch/mips/loongson64/,drivers/irqchip/irq-loongson*,drivers/platform/mips/cpu_hwmon.c
MIROSOUND PCM20 FM RADIO RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-miropcm20*
MITSUMI MM8013 FG DRIVER #
- Mail: Konrad Dybcio <konradybcio@kernel.org>
- Files:
Documentation/devicetree/bindings/power/supply/mitsumi,mm8013.yaml,drivers/power/supply/mm8013.c
MMP SUPPORT #
- Reviewer: Lubomir Rintel <lkundrak@v3.sk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp.git
- Files:
arch/arm/boot/dts/marvell/mmp*,arch/arm/mach-mmp/,include/linux/soc/mmp/
MMP USB PHY DRIVERS #
- Reviewer: Lubomir Rintel <lkundrak@v3.sk>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/phy/marvell/phy-mmp3-usb.c,drivers/phy/marvell/phy-pxa-usb.c
MMU GATHER AND TLB INVALIDATION #
- Mail: Will Deacon <will@kernel.org>, "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Nick Piggin <npiggin@gmail.com>, Peter Zijlstra <peterz@infradead.org>
- Mailing list: linux-arch@vger.kernel.org, linux-mm@kvack.org
- Status: Maintained
- Files:
arch/*/include/asm/tlb.h,include/asm-generic/tlb.h,include/trace/events/tlb.h,mm/mmu_gather.c
MN88472 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/mn88472*
MN88473 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/mn88473*
MOBILEYE MIPS SOCS #
- Mail: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>, Gregory CLEMENT <gregory.clement@bootlin.com>, Théo Lebrun <theo.lebrun@bootlin.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mips/mobileye.yaml,Documentation/devicetree/bindings/soc/mobileye/,arch/mips/boot/dts/mobileye/,arch/mips/configs/eyeq5_defconfig,arch/mips/mobileye/board-epm5.its.S,drivers/clk/clk-eyeq.c,drivers/pinctrl/pinctrl-eyeq5.c,drivers/reset/reset-eyeq.c,include/dt-bindings/clock/mobileye,eyeq5-clk.h
MODULE SUPPORT #
- Mail: Luis Chamberlain <mcgrof@kernel.org>, Petr Pavlu <petr.pavlu@suse.com>, Daniel Gomez <da.gomez@kernel.org>, Sami Tolvanen <samitolvanen@google.com>
- Reviewer: Aaron Tomlin <atomlin@atomlin.com>
- Mailing list: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux.git modules-next
- Files:
include/linux/kmod.h,include/linux/module*.h,kernel/module/,lib/test_kmod.c,lib/tests/module/,rust/kernel/module_param.rs,rust/macros/module.rs,scripts/module*,tools/testing/selftests/kmod/,tools/testing/selftests/module/
MONOLITHIC POWER SYSTEM PMIC DRIVER #
- Mail: Saravanan Sekar <sravanhome@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/mps,mp2629.yaml,Documentation/devicetree/bindings/regulator/mps,mp*.yaml,drivers/hwmon/pmbus/mpq7932.c,drivers/iio/adc/mp2629_adc.c,drivers/mfd/mp2629.c,drivers/power/supply/mp2629_charger.c,drivers/regulator/mp5416.c,drivers/regulator/mpq7920.c,drivers/regulator/mpq7920.h,include/linux/mfd/mp2629.h
MOST(R) TECHNOLOGY DRIVER #
- Mail: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>, Christian Gromm <christian.gromm@microchip.com>
- Status: Maintained
- Files:
Documentation/ABI/testing/configfs-most,Documentation/ABI/testing/sysfs-bus-most,drivers/most/,drivers/staging/most/,include/linux/most.h
MOTORCOMM DWMAC GLUE DRIVER #
- Mail: Yao Zi <me@ziyao.cc>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/stmicro/stmmac/dwmac-motorcomm.c
MOTORCOMM PHY DRIVER #
- Mail: Frank <Frank.Sae@motor-comm.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/motorcomm,yt8xxx.yaml,drivers/net/phy/motorcomm.c
MOTORCOMM YT921X ETHERNET SWITCH DRIVER #
- Mail: David Yang <mmyangfl@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml,drivers/net/dsa/yt921x.*,net/dsa/tag_yt921x.c
MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD #
- Mail: Jiri Slaby <jirislaby@kernel.org>
- Status: Maintained
- Files:
Documentation/driver-api/tty/moxa-smartio.rst,drivers/tty/mxser.*
MP3309C BACKLIGHT DRIVER #
- Mail: Flavio Suligoi <f.suligoi@asem.it>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/backlight/mps,mp3309c.yaml,drivers/video/backlight/mp3309c.c
MPAM DRIVER #
- Mail: James Morse <james.morse@arm.com>, Ben Horgan <ben.horgan@arm.com>
- Reviewer: Reinette Chatre <reinette.chatre@intel.com>, Fenghua Yu <fenghuay@nvidia.com>
- Status: Maintained
- Files:
drivers/resctrl/mpam_*,drivers/resctrl/test_mpam_*,include/linux/arm_mpam.h
MPS MP2869 DRIVER #
- Mail: Wensheng Wang <wenswang@yeah.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp2869.rst,drivers/hwmon/pmbus/mp2869.c
MPS MP2891 DRIVER #
- Mail: Noah Wang <noahwang.wang@outlook.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp2891.rst,drivers/hwmon/pmbus/mp2891.c
MPS MP2925 DRIVER #
- Mail: Noah Wang <wenswang@yeah.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp2925.rst,drivers/hwmon/pmbus/mp2925.c
MPS MP29502 DRIVER #
- Mail: Wensheng Wang <wenswang@yeah.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp29502.rst,drivers/hwmon/pmbus/mp29502.c
MPS MP2993 DRIVER #
- Mail: Noah Wang <noahwang.wang@outlook.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp2993.rst,drivers/hwmon/pmbus/mp2993.c
MPS MP5926 DRIVER #
- Mail: Yuxi Wang <Yuxi.Wang@monolithicpower.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp5926.rst,drivers/hwmon/pmbus/mp5926.c
MPS MP9941 DRIVER #
- Mail: Noah Wang <noahwang.wang@outlook.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp9941.rst,drivers/hwmon/pmbus/mp9941.c
MPS MP9945 DRIVER #
- Mail: Cosmo Chou <chou.cosmo@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/mp9945.rst,drivers/hwmon/pmbus/mp9945.c
MR800 AVERMEDIA USB FM RADIO DRIVER #
- Mail: Alexey Klimov <alexey.klimov@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-mr800.c
MRF24J40 IEEE 802.15.4 RADIO DRIVER #
- Mail: Stefan Schmidt <stefan@datenfreihafen.org>
- Mailing list: linux-wpan@vger.kernel.org
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/net/ieee802154/mrf24j40.txt,drivers/net/ieee802154/mrf24j40.c
MSI EC DRIVER #
- Mail: Nikita Kravets <teackot@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/BeardOverflow/msi-ec
- Files:
drivers/platform/x86/msi-ec.*
MSI LAPTOP SUPPORT #
- Mail: "Lee, Chun-Yi" <jlee@suse.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/msi-laptop.c
MSI WMI SUPPORT #
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Orphan
- Files:
drivers/platform/x86/msi-wmi.c
MSI WMI PLATFORM FEATURES #
- Mail: Armin Wolf <W_Armin@gmx.de>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/debugfs-msi-wmi-platform,Documentation/wmi/devices/msi-wmi-platform.rst,drivers/platform/x86/msi-wmi-platform.c
MSI001 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/msi001*
MSI2500 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/msi2500/
MSTAR INTERRUPT CONTROLLER DRIVER #
- Mail: Mark-PK Tsai <mark-pk.tsai@mediatek.com>, Daniel Palmer <daniel@thingy.jp>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/mstar,mst-intc.yaml,drivers/irqchip/irq-mst-intc.c
MSYSTEMS DISKONCHIP G3 MTD DRIVER #
- Mail: Robert Jarzmik <robert.jarzmik@free.fr>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/devices/docg3*
MT9M114 ONSEMI SENSOR DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/onnn,mt9m114.yaml,drivers/media/i2c/mt9m114.c
MT9P031 APTINA CAMERA SENSOR #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/aptina,mt9p031.yaml,drivers/media/i2c/mt9p031.c
MT9T112 APTINA CAMERA SENSOR #
- Mail: Jacopo Mondi <jacopo@jmondi.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/mt9t112.c,include/media/i2c/mt9t112.h
MT9V032 APTINA CAMERA SENSOR #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/aptina,mt9v032.txt,drivers/media/i2c/mt9v032.c
MT9V111 APTINA CAMERA SENSOR #
- Mail: Jacopo Mondi <jacopo@jmondi.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/aptina,mt9v111.yaml,drivers/media/i2c/mt9v111.c
MUCSE ETHERNET DRIVER #
- Mail: Yibo Dong <dong100@mucse.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://www.mucse.com/en/
- Files:
Documentation/networking/device_drivers/ethernet/mucse/,drivers/net/ethernet/mucse/
MULTIFUNCTION DEVICES (MFD) #
- Mail: Lee Jones <lee@kernel.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
- Files:
Documentation/devicetree/bindings/mfd/,drivers/mfd/,include/dt-bindings/mfd/,include/linux/mfd/
MULTIMEDIA CARD (MMC) ETC. OVER SPI #
- Status: Orphan
- Files:
drivers/mmc/host/mmc_spi.c,include/linux/spi/mmc_spi.h
MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM #
- Mail: Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
- Files:
Documentation/devicetree/bindings/mmc/,drivers/mmc/,include/linux/mmc/,include/uapi/linux/mmc/
MULTIPLEXER SUBSYSTEM #
- Mail: Peter Rosin <peda@axentia.se>
- Status: Odd Fixes
- Files:
Documentation/ABI/testing/sysfs-class-mux*,Documentation/devicetree/bindings/mux/,drivers/mux/,include/dt-bindings/mux/,include/linux/mux/
MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER #
- Mail: Bin Liu <b-liu@ti.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/musb/
MXL301RF MEDIA DRIVER #
- Mail: Akihiro Tsukada <tskd08@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/media/tuners/mxl301rf*
MXL5007T MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/tuners.git
- Files:
drivers/media/tuners/mxl5007t.*
MXSFB DRM DRIVER #
- Mail: Marek Vasut <marex@denx.de>, Stefan Agner <stefan@agner.ch>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/fsl,lcdif.yaml,drivers/gpu/drm/mxsfb/
MYLEX DAC960 PCI RAID Controller #
- Mail: Hannes Reinecke <hare@kernel.org>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/myrb.*,drivers/scsi/myrs.*
MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Web-page: https://www.cspi.com/ethernet-products/support/downloads/
- Files:
drivers/net/ethernet/myricom/myri10ge/
NAND FLASH SUBSYSTEM #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Reviewer: Richard Weinberger <richard@nod.at>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Web-page: http://www.linux-mtd.infradead.org/
- Patchwork: http://patchwork.ozlabs.org/project/linux-mtd/list/
- chat: irc://irc.oftc.net/mtd
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
- Files:
drivers/mtd/nand/,include/linux/mtd/*nand*.h
NATIONAL INSTRUMENTS SERIAL DRIVER #
- Mail: Chaitanya Vadrevu <chaitanya.vadrevu@emerson.com>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- Files:
drivers/tty/serial/8250/8250_ni.c
NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER #
- Mail: Daniel Mack <zonque@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Web-page: http://www.native-instruments.com
- Files:
sound/usb/caiaq/
NATSEMI ETHERNET DRIVER (DP8381x) #
- Status: Orphan
- Files:
drivers/net/ethernet/natsemi/natsemi.c
NCR 5380 SCSI DRIVERS #
- Mail: Finn Thain <fthain@linux-m68k.org>, Michael Schmitz <schmitzmic@gmail.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/scsi/g_NCR5380.rst,drivers/scsi/NCR5380.*,drivers/scsi/arm/cumana_1.c,drivers/scsi/arm/oak.c,drivers/scsi/atari_scsi.*,drivers/scsi/dmx3191d.c,drivers/scsi/g_NCR5380.*,drivers/scsi/mac_scsi.*,drivers/scsi/sun3_scsi.*,drivers/scsi/sun3_scsi_vme.c
NCSI LIBRARY #
- Mail: Samuel Mendoza-Jonas <sam@mendozajonas.com>
- Reviewer: Paul Fertser <fercerpav@gmail.com>
- Status: Maintained
- Files:
net/ncsi/
NCT6775 HARDWARE MONITOR DRIVER - I2C DRIVER #
- Mail: Zev Weiss <zev@bewilderbeest.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/nuvoton,nct6775.yaml,drivers/hwmon/nct6775-i2c.c
NCT7363 HARDWARE MONITOR DRIVER #
- Mail: Ban Feng <kcfeng0@nuvoton.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/nuvoton,nct7363.yaml,Documentation/hwmon/nct7363.rst,drivers/hwmon/nct7363.c
NETCONSOLE #
- Mail: Breno Leitao <leitao@debian.org>
- Status: Maintained
- Files:
Documentation/networking/netconsole.rst,drivers/net/netconsole.c,tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh,tools/testing/selftests/drivers/net/netconsole/
NETDEVSIM #
- Mail: Jakub Kicinski <kuba@kernel.org>
- Status: Maintained
- Files:
drivers/net/netdevsim/*,tools/testing/selftests/drivers/net/netdevsim/*
NETEM NETWORK EMULATOR #
- Mail: Stephen Hemminger <stephen@networkplumber.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
net/sched/sch_netem.c
NETFILTER #
- Mail: Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>
- Reviewer: Phil Sutter <phil@nwl.cc>
- Mailing list: netfilter-devel@vger.kernel.org, coreteam@netfilter.org
- Status: Maintained
- Web-page: http://www.netfilter.org/, http://www.iptables.org/, http://www.nftables.org/
- Patchwork: http://patchwork.ozlabs.org/project/netfilter-devel/list/
- chat: irc://irc.libera.chat/netfilter
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git, git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git
- Files:
include/linux/netfilter*,include/linux/netfilter/,include/net/netfilter/,include/uapi/linux/netfilter*,include/uapi/linux/netfilter/,net/*/netfilter.c,net/*/netfilter/,net/bridge/br_netfilter*.c,net/netfilter/,tools/testing/selftests/net/netfilter/
NETROM NETWORK LAYER #
- Mailing list: linux-hams@vger.kernel.org
- Status: Orphan
- Web-page: https://linux-ax25.in-berlin.de
- Files:
include/net/netrom.h,include/uapi/linux/netrom.h,net/netrom/
NETRONIX EMBEDDED CONTROLLER #
- Mail: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml,drivers/mfd/ntxec.c,drivers/pwm/pwm-ntxec.c,drivers/rtc/rtc-ntxec.c,include/linux/mfd/ntxec.h
NETRONOME ETHERNET DRIVERS #
- Reviewer: Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>
- Mailing list: oss-drivers@corigine.com
- Status: Odd Fixes
- Files:
drivers/net/ethernet/netronome/
NETWORK BLOCK DEVICE (NBD) #
- Mail: Josef Bacik <josef@toxicpanda.com>
- Mailing list: linux-block@vger.kernel.org, nbd@other.debian.org
- Status: Maintained
- Files:
Documentation/admin-guide/blockdev/nbd.rst,drivers/block/nbd.c,include/trace/events/nbd.h,include/uapi/linux/nbd.h
NETWORK DROP MONITOR #
- Mail: Neil Horman <nhorman@tuxdriver.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://fedorahosted.org/dropwatch/
- Files:
include/uapi/linux/net_dropmon.h,net/core/drop_monitor.c
NETWORKING DRIVERS #
- Mail: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/process/maintainer-netdev.rst
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git, git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
- Files:
Documentation/devicetree/bindings/net/,Documentation/networking/net_cachelines/net_device.rst,drivers/connector/,drivers/net/,drivers/ptp/,drivers/s390/net/,include/dt-bindings/net/,include/linux/cn_proc.h,include/linux/etherdevice.h,include/linux/ethtool_netlink.h,include/linux/fcdevice.h,include/linux/fddidevice.h,include/linux/if_*,include/linux/inetdevice.h,include/linux/netdev*,include/linux/platform_data/wiznet.h,include/uapi/linux/cn_proc.h,include/uapi/linux/ethtool_netlink*,include/uapi/linux/if_*,include/uapi/linux/net_shaper.h,include/uapi/linux/netdev*,tools/testing/selftests/drivers/net/ - Excluded:
Documentation/devicetree/bindings/net/bluetooth/,Documentation/devicetree/bindings/net/can/,Documentation/devicetree/bindings/net/wireless/,drivers/net/can/,drivers/net/wireless/
NETWORKING DRIVERS (WIRELESS) #
- Mail: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/
- Patchwork: https://patchwork.kernel.org/project/linux-wireless/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git, git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
- Files:
Documentation/devicetree/bindings/net/wireless/,drivers/net/wireless/ - Excluded:
drivers/net/wireless/ath/,drivers/net/wireless/broadcom/,drivers/net/wireless/intel/,drivers/net/wireless/intersil/,drivers/net/wireless/marvell/,drivers/net/wireless/mediatek/mt76/,drivers/net/wireless/mediatek/mt7601u/,drivers/net/wireless/microchip/,drivers/net/wireless/purelifi/,drivers/net/wireless/quantenna/,drivers/net/wireless/ralink/,drivers/net/wireless/realtek/,drivers/net/wireless/rsi/,drivers/net/wireless/silabs/,drivers/net/wireless/st/,drivers/net/wireless/ti/,drivers/net/wireless/zydas/
NETWORKING [DSA] #
- Mail: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/,Documentation/devicetree/bindings/net/ethernet-switch-port.yaml,Documentation/devicetree/bindings/net/ethernet-switch.yaml,drivers/net/dsa/,include/linux/dsa/,include/linux/platform_data/dsa.h,include/net/dsa.h,net/dsa/,tools/testing/selftests/drivers/net/dsa/
NETWORKING [ETHTOOL] #
- Mail: Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>
- Files:
Documentation/netlink/specs/ethtool.yaml,Documentation/networking/ethtool-netlink.rst,include/linux/ethtool*,include/uapi/linux/ethtool*,net/ethtool/,tools/testing/selftests/drivers/net/*/ethtool*
NETWORKING [ETHTOOL CABLE TEST] #
- Mail: Andrew Lunn <andrew@lunn.ch>
- Files:
net/ethtool/cabletest.c,tools/testing/selftests/drivers/net/*/ethtool* - Content regex:
cable_test
NETWORKING [ETHTOOL MAC MERGE] #
- Mail: Vladimir Oltean <vladimir.oltean@nxp.com>
- Files:
net/ethtool/mm.c,tools/testing/selftests/drivers/net/hw/ethtool_mm.sh - Content regex:
ethtool_mm
NETWORKING [ETHTOOL PHY TOPOLOGY] #
- Mail: Maxime Chevallier <maxime.chevallier@bootlin.com>
- Files:
Documentation/networking/phy-link-topology.rst,drivers/net/phy/phy_link_topology.c,include/linux/phy_link_topology.h,net/ethtool/phy.c
NETWORKING [ETHTOOL PHY PORT] #
- Mail: Maxime Chevallier <maxime.chevallier@bootlin.com>
- Files:
Documentation/devicetree/bindings/net/ethernet-connector.yaml,Documentation/networking/phy-port.rst,drivers/net/phy/phy_port.c,include/linux/phy_port.h - Content regex:
struct\s+phy_port|phy_port_
NETWORKING [GENERAL] #
- Mail: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
- Reviewer: Simon Horman <horms@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/process/maintainer-netdev.rst
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- bugs: mailto:netdev@vger.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git, git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
- Files:
Documentation/core-api/netlink.rst,Documentation/netlink/,Documentation/networking/,Documentation/networking/net_cachelines/,Documentation/process/maintainer-netdev.rst,Documentation/userspace-api/netlink/,include/linux/ethtool.h,include/linux/framer/framer-provider.h,include/linux/framer/framer.h,include/linux/in.h,include/linux/in6.h,include/linux/indirect_call_wrapper.h,include/linux/inet.h,include/linux/inet_diag.h,include/linux/net.h,include/linux/netdev*,include/linux/netlink.h,include/linux/netpoll.h,include/linux/rtnetlink.h,include/linux/sctp.h,include/linux/seq_file_net.h,include/linux/skbuff*,include/net/,include/uapi/linux/ethtool.h,include/uapi/linux/genetlink.h,include/uapi/linux/hsr_netlink.h,include/uapi/linux/in.h,include/uapi/linux/inet_diag.h,include/uapi/linux/nbd-netlink.h,include/uapi/linux/net.h,include/uapi/linux/net_namespace.h,include/uapi/linux/netconf.h,include/uapi/linux/netdev*,include/uapi/linux/netlink.h,include/uapi/linux/netlink_diag.h,include/uapi/linux/rtnetlink.h,include/uapi/linux/sctp.h,lib/net_utils.c,lib/random32.c,net/,samples/pktgen/,tools/net/,tools/testing/selftests/net/ - Excluded:
Documentation/networking/mac80211-injection.rst,Documentation/networking/mac80211_hwsim/,Documentation/networking/regulatory.rst,include/net/cfg80211.h,include/net/ieee80211_radiotap.h,include/net/iw_handler.h,include/net/mac80211.h,include/net/wext.h,net/9p/,net/bluetooth/,net/can/,net/ceph/,net/mac80211/,net/rfkill/,net/wireless/,tools/testing/selftests/net/can/
NETWORKING [IOAM] #
- Mail: Justin Iurman <justin.iurman@gmail.com>
- Status: Maintained
- Files:
Documentation/networking/ioam6*,include/linux/ioam6*,include/net/ioam6*,include/uapi/linux/ioam6*,net/ipv6/ioam6*,tools/testing/selftests/net/ioam6*
NETWORKING [IPSEC] #
- Mail: Steffen Klassert <steffen.klassert@secunet.com>, Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git, git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
- Files:
Documentation/networking/xfrm/,include/net/xfrm.h,include/uapi/linux/xfrm.h,net/ipv4/ah4.c,net/ipv4/esp4*,net/ipv4/ip_vti.c,net/ipv4/ipcomp.c,net/ipv4/xfrm*,net/ipv6/ah6.c,net/ipv6/esp6*,net/ipv6/ip6_vti.c,net/ipv6/ipcomp6.c,net/ipv6/xfrm*,net/key/,net/xfrm/,tools/testing/selftests/net/ipsec.c
NETWORKING [IPv4/IPv6] #
- Mail: "David S. Miller" <davem@davemloft.net>, David Ahern <dsahern@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
- Files:
arch/x86/net/*,include/linux/ip.h,include/linux/ipv6*,include/net/fib*,include/net/ip*,include/net/route.h,net/ipv4/,net/ipv6/
NETWORKING [LABELED] (NetLabel, Labeled IPsec, SECMARK) #
- Mail: Paul Moore <paul@paul-moore.com>
- Mailing list: netdev@vger.kernel.org, linux-security-module@vger.kernel.org
- Status: Supported
- Web-page: https://github.com/netlabel
- Files:
Documentation/netlabel/,include/net/calipso.h,include/net/cipso_ipv4.h,include/net/netlabel.h,include/uapi/linux/netfilter/xt_CONNSECMARK.h,include/uapi/linux/netfilter/xt_SECMARK.h,net/ipv4/cipso_ipv4.c,net/ipv6/calipso.c,net/netfilter/xt_CONNSECMARK.c,net/netfilter/xt_SECMARK.c,net/netlabel/
NETWORKING [MACSEC] #
- Mail: Sabrina Dubroca <sd@queasysnail.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/macsec.c,include/net/macsec.h,include/uapi/linux/if_macsec.h - Content regex:
macsec,\bmdo_
NETWORKING [MPTCP] #
- Mail: Matthieu Baerts <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>
- Reviewer: Geliang Tang <geliang@kernel.org>
- Mailing list: netdev@vger.kernel.org, mptcp@lists.linux.dev
- Status: Maintained
- Web-page: https://github.com/multipath-tcp/mptcp_net-next/wiki
- bugs: https://github.com/multipath-tcp/mptcp_net-next/issues
- SCM: git https://github.com/multipath-tcp/mptcp_net-next.git export-net, git https://github.com/multipath-tcp/mptcp_net-next.git export
- Files:
Documentation/netlink/specs/mptcp_pm.yaml,Documentation/networking/mptcp*.rst,include/net/mptcp.h,include/trace/events/mptcp.h,include/uapi/linux/mptcp*.h,net/mptcp/,tools/testing/selftests/bpf/*/*mptcp*.[ch],tools/testing/selftests/net/mptcp/
NETWORKING [SRv6] #
- Mail: Andrea Mayer <andrea.mayer@uniroma2.it>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
- Files:
include/linux/seg6*,include/net/seg6*,include/uapi/linux/seg6*,net/ipv6/seg6*,tools/testing/selftests/net/srv6*
NETWORKING [TCP] #
- Mail: Eric Dumazet <edumazet@google.com>, Neal Cardwell <ncardwell@google.com>
- Reviewer: Kuniyuki Iwashima <kuniyu@google.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/net_cachelines/tcp_sock.rst,include/linux/tcp.h,include/net/tcp.h,include/trace/events/tcp.h,include/uapi/linux/tcp.h,net/ipv4/inet_connection_sock.c,net/ipv4/inet_hashtables.c,net/ipv4/inet_timewait_sock.c,net/ipv4/syncookies.c,net/ipv4/tcp*.c,net/ipv6/inet6_connection_sock.c,net/ipv6/inet6_hashtables.c,net/ipv6/syncookies.c,net/ipv6/tcp*.c
NETWORKING [TLS] #
- Mail: John Fastabend <john.fastabend@gmail.com>, Jakub Kicinski <kuba@kernel.org>, Sabrina Dubroca <sd@queasysnail.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/tls*,include/net/tls.h,include/uapi/linux/tls.h,net/tls/,tools/testing/selftests/net/tls.c
NETWORKING [SOCKETS] #
- Mail: Eric Dumazet <edumazet@google.com>, Kuniyuki Iwashima <kuniyu@google.com>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemb@google.com>
- Status: Maintained
- Files:
include/linux/sock_diag.h,include/linux/socket.h,include/linux/sockptr.h,include/net/sock.h,include/net/sock_reuseport.h,include/uapi/linux/socket.h,net/core/*sock*,net/core/scm.c,net/socket.c
NETWORKING [UNIX SOCKETS] #
- Mail: Kuniyuki Iwashima <kuniyu@google.com>
- Status: Maintained
- Files:
include/net/af_unix.h,include/net/netns/unix.h,include/uapi/linux/unix_diag.h,net/unix/,tools/testing/selftests/net/af_unix/
NETXEN (1/10) GbE SUPPORT #
- Mail: Manish Chopra <manishc@marvell.com>, Rahul Verma <rahulv@marvell.com>, GR-Linux-NIC-Dev@marvell.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/qlogic/netxen/
NET_FAILOVER MODULE #
- Mail: Sridhar Samudrala <sridhar.samudrala@intel.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/networking/net_failover.rst,drivers/net/net_failover.c,include/net/net_failover.h
NEXTHOP #
- Mail: David Ahern <dsahern@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
include/net/netns/nexthop.h,include/net/nexthop.h,include/uapi/linux/nexthop.h,net/ipv4/nexthop.c
NFC SUBSYSTEM #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/net/nfc/,drivers/nfc/,include/net/nfc/,include/uapi/linux/nfc.h,net/nfc/
NFC VIRTUAL NCI DEVICE DRIVER #
- Mail: Bongsu Jeon <bongsu.jeon@samsung.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/nfc/virtual_ncidev.c,tools/testing/selftests/nci/
NFS, SUNRPC, AND LOCKD CLIENTS #
- Mail: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
- Mailing list: linux-nfs@vger.kernel.org
- Status: Maintained
- Web-page: http://client.linux-nfs.org
- SCM: git git://git.linux-nfs.org/projects/trondmy/linux-nfs.git
- Files:
Documentation/filesystems/nfs/,fs/lockd/,fs/nfs/,fs/nfs_common/,include/linux/lockd/,include/linux/nfs*,include/linux/sunrpc/,include/uapi/linux/nfs*,include/uapi/linux/sunrpc/,net/sunrpc/
NILFS2 FILESYSTEM #
- Mail: Ryusuke Konishi <konishi.ryusuke@gmail.com>, Viacheslav Dubeyko <slava@dubeyko.com>
- Mailing list: linux-nilfs@vger.kernel.org
- Status: Maintained
- Web-page: https://nilfs.sourceforge.io/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/nilfs2.git
- Files:
Documentation/filesystems/nilfs2.rst,fs/nilfs2/,include/trace/events/nilfs2.h,include/uapi/linux/nilfs2_api.h,include/uapi/linux/nilfs2_ondisk.h
NINJA SCSI-3 / NINJA SCSI-32Bi (16bit/CardBus) PCMCIA SCSI HOST ADAPTER DRIVER #
- Mail: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
- Status: Maintained
- Web-page: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/
- Files:
Documentation/scsi/NinjaSCSI.rst,drivers/scsi/pcmcia/nsp_*
NINJA SCSI-32Bi/UDE PCI/CARDBUS SCSI HOST ADAPTER DRIVER #
- Mail: GOTO Masanori <gotom@debian.or.jp>, YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
- Status: Maintained
- Web-page: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/
- Files:
Documentation/scsi/NinjaSCSI.rst,drivers/scsi/nsp32*
NINTENDO HID DRIVER #
- Mail: Daniel J. Ogorchock <djogorchock@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-nintendo*
NIOS2 ARCHITECTURE #
- Mail: Dinh Nguyen <dinguyen@kernel.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
- Files:
arch/nios2/
NITRO ENCLAVES (NE) #
- Mail: Alexandru Ciobotaru <alcioa@amazon.com>
- Reviewer: The AWS Nitro Enclaves Team <aws-nitro-enclaves-devel@amazon.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Web-page: https://aws.amazon.com/ec2/nitro/nitro-enclaves/
- Files:
Documentation/virt/ne_overview.rst,drivers/virt/nitro_enclaves/,include/linux/nitro_enclaves.h,include/uapi/linux/nitro_enclaves.h,samples/nitro_enclaves/
NITRO SECURE MODULE (NSM) #
- Mail: Alexander Graf <graf@amazon.com>
- Reviewer: The AWS Nitro Enclaves Team <aws-nitro-enclaves-devel@amazon.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Web-page: https://aws.amazon.com/ec2/nitro/nitro-enclaves/
- Files:
drivers/misc/nsm.c,include/uapi/linux/nsm.h
NOHZ, DYNTICKS SUPPORT #
- Mail: Anna-Maria Behnsen <anna-maria@linutronix.de>, Frederic Weisbecker <frederic@kernel.org>, Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/nohz
- Files:
include/linux/sched/nohz.h,include/linux/tick.h,kernel/time/tick*.*
NOKIA N900 CAMERA SUPPORT (ET8EK8 SENSOR, AD5820 FOCUS) #
- Mail: Pavel Machek <pavel@kernel.org>, Sakari Ailus <sakari.ailus@iki.fi>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/adi,ad5820.yaml,Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.yaml,drivers/media/i2c/ad5820.c,drivers/media/i2c/et8ek8
NOKIA N900 POWER SUPPLY DRIVERS #
- Reviewer: Pali Rohár <pali@kernel.org>
- Files:
drivers/power/supply/bq2415x_charger.c,drivers/power/supply/bq27xxx_battery.c,drivers/power/supply/bq27xxx_battery_i2c.c,drivers/power/supply/isp1704_charger.c,drivers/power/supply/rx51_battery.c,include/linux/power/bq2415x_charger.h,include/linux/power/bq27xxx_battery.h
NOLIBC HEADER FILE #
- Mail: Willy Tarreau <w@1wt.eu>, Thomas Weißschuh <linux@weissschuh.net>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc.git
- Files:
tools/include/nolibc/,tools/testing/selftests/nolibc/
NOVATEK NVT-TS I2C TOUCHSCREEN DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml,drivers/input/touchscreen/novatek-nvt-ts.c
NSDEPS #
- Mail: Matthias Maennich <maennich@google.com>
- Status: Maintained
- Files:
Documentation/core-api/symbol-namespaces.rst,scripts/nsdeps
NTB AMD DRIVER #
- Mail: Basavaraj Natikar <Basavaraj.Natikar@amd.com>, Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
- Mailing list: ntb@lists.linux.dev
- Status: Supported
- Files:
drivers/ntb/hw/amd/
NTB DRIVER CORE #
- Mail: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>, Allen Hubbe <allenbh@gmail.com>
- Mailing list: ntb@lists.linux.dev
- Status: Supported
- Web-page: https://github.com/jonmason/ntb/wiki
- SCM: git https://github.com/jonmason/ntb.git
- Files:
drivers/net/ntb_netdev.c,drivers/ntb/,drivers/pci/endpoint/functions/pci-epf-*ntb.c,include/linux/ntb.h,include/linux/ntb_transport.h,tools/testing/selftests/ntb/
NTB INTEL DRIVER #
- Mail: Dave Jiang <dave.jiang@intel.com>
- Mailing list: ntb@lists.linux.dev
- Status: Supported
- Web-page: https://github.com/davejiang/linux/wiki
- SCM: git https://github.com/davejiang/linux.git
- Files:
drivers/ntb/hw/intel/
NTFS3 FILESYSTEM #
- Mail: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
- Mailing list: ntfs3@lists.linux.dev
- Status: Supported
- Web-page: http://www.paragon-software.com/
- SCM: git https://github.com/Paragon-Software-Group/linux-ntfs3.git
- Files:
Documentation/filesystems/ntfs3.rst,fs/ntfs3/
NTSYNC SYNCHRONIZATION PRIMITIVE DRIVER #
- Mail: Elizabeth Figura <zfigura@codeweavers.com>
- Mailing list: wine-devel@winehq.org
- Status: Supported
- Files:
Documentation/userspace-api/ntsync.rst,drivers/misc/ntsync.c,include/uapi/linux/ntsync.h,tools/testing/selftests/drivers/ntsync/
NUBUS SUBSYSTEM #
- Mail: Finn Thain <fthain@linux-m68k.org>
- Mailing list: linux-m68k@lists.linux-m68k.org
- Status: Maintained
- Files:
arch/*/include/asm/nubus.h,drivers/nubus/,include/linux/nubus.h,include/uapi/linux/nubus.h
NUVOTON NCT6694 MFD DRIVER #
- Mail: Ming Yu <tmyu0@nuvoton.com>
- Status: Supported
- Files:
drivers/gpio/gpio-nct6694.c,drivers/hwmon/nct6694-hwmon.c,drivers/i2c/busses/i2c-nct6694.c,drivers/mfd/nct6694.c,drivers/net/can/usb/nct6694_canfd.c,drivers/rtc/rtc-nct6694.c,drivers/watchdog/nct6694_wdt.c,include/linux/mfd/nct6694.h
NUVOTON NCT7201 IIO DRIVER #
- Mail: Eason Yang <j2anfernee@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/nuvoton,nct7201.yaml,drivers/iio/adc/nct7201.c
NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER #
- Mail: Antonino Daplas <adaplas@gmail.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/nvidia/,drivers/video/fbdev/riva/
NVIDIA VRS RTC DRIVER #
- Mail: Shubhi Garg <shgarg@nvidia.com>
- Mailing list: linux-tegra@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rtc/nvidia,vrs-10.yaml,drivers/rtc/rtc-nvidia-vrs10.c
NVIDIA WMI EC BACKLIGHT DRIVER #
- Mail: Daniel Dadap <ddadap@nvidia.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/x86/nvidia-wmi-ec-backlight.c,include/linux/platform_data/x86/nvidia-wmi-ec-backlight.h
NVM EXPRESS DRIVER #
- Mail: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
- Mailing list: linux-nvme@lists.infradead.org
- Status: Supported
- Web-page: http://git.infradead.org/nvme.git
- SCM: git git://git.infradead.org/nvme.git
- Files:
Documentation/nvme/,drivers/nvme/common/,drivers/nvme/host/,include/linux/nvme-*.h,include/linux/nvme.h,include/uapi/linux/nvme_ioctl.h
NVM EXPRESS FABRICS AUTHENTICATION #
- Mail: Hannes Reinecke <hare@suse.de>
- Mailing list: linux-nvme@lists.infradead.org
- Status: Supported
- Files:
drivers/nvme/host/auth.c,drivers/nvme/target/auth.c,drivers/nvme/target/fabrics-cmd-auth.c,include/linux/nvme-auth.h
NVM EXPRESS FC TRANSPORT DRIVERS #
- Mail: Justin Tee <justin.tee@broadcom.com>, Naresh Gottumukkala <nareshgottumukkala83@gmail.com>, Paul Ely <paul.ely@broadcom.com>
- Mailing list: linux-nvme@lists.infradead.org
- Status: Supported
- Files:
drivers/nvme/host/fc.c,drivers/nvme/target/fc.c,drivers/nvme/target/fcloop.c,include/linux/nvme-fc-driver.h,include/linux/nvme-fc.h
NVM EXPRESS HARDWARE MONITORING SUPPORT #
- Mail: Guenter Roeck <linux@roeck-us.net>
- Mailing list: linux-nvme@lists.infradead.org
- Status: Supported
- Files:
drivers/nvme/host/hwmon.c
NVM EXPRESS TARGET DRIVER #
- Mail: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, Chaitanya Kulkarni <kch@nvidia.com>
- Mailing list: linux-nvme@lists.infradead.org
- Status: Supported
- Web-page: http://git.infradead.org/nvme.git
- SCM: git git://git.infradead.org/nvme.git
- Files:
drivers/nvme/target/
NVMEM FRAMEWORK #
- Mail: Srinivas Kandagatla <srini@kernel.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/srini/nvmem.git
- Files:
Documentation/ABI/stable/sysfs-bus-nvmem,Documentation/devicetree/bindings/nvmem/,drivers/nvmem/,include/dt-bindings/nvmem/,include/linux/nvmem-consumer.h,include/linux/nvmem-provider.h
NXP BLUETOOTH WIRELESS DRIVERS #
- Mail: Amitkumar Karwar <amitkumar.karwar@nxp.com>, Neeraj Kale <neeraj.sanjaykale@nxp.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/bluetooth/nxp,88w8987-bt.yaml,drivers/bluetooth/btnxpuart.c
NXP C45 TJA11XX PHY DRIVER #
- Mail: Andrei Botila <andrei.botila@oss.nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/nxp-c45-tja11xx*
NXP FSPI DRIVER #
- Mail: Han Xu <han.xu@nxp.com>, Haibo Chen <haibo.chen@nxp.com>
- Reviewer: Yogesh Gaur <yogeshgaur.83@gmail.com>
- Mailing list: linux-spi@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/spi-nxp-fspi.yaml,drivers/spi/spi-nxp-fspi.c
NXP FXAS21002C DRIVER #
- Mail: Rui Miguel Silva <rmfrfs@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml,drivers/iio/gyro/fxas21002c.h,drivers/iio/gyro/fxas21002c_core.c,drivers/iio/gyro/fxas21002c_i2c.c,drivers/iio/gyro/fxas21002c_spi.c
NXP i.MX 7D/6SX/6UL/93 AND VF610 ADC DRIVER #
- Mail: Haibo Chen <haibo.chen@nxp.com>
- Mailing list: linux-iio@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/fsl,imx7d-adc.yaml,Documentation/devicetree/bindings/iio/adc/fsl,vf610-adc.yaml,Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml,drivers/iio/adc/imx7d_adc.c,drivers/iio/adc/imx93_adc.c,drivers/iio/adc/vf610_adc.c
NXP i.MX 8M ISI DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/fsl,imx8*-isi.yaml,Documentation/devicetree/bindings/media/nxp,imx8-isi.yaml,drivers/media/platform/nxp/imx8-isi/
NXP i.MX 8MP DW100 V4L2 DRIVER #
- Mail: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/nxp,dw100.yaml,Documentation/userspace-api/media/drivers/dw100.rst,drivers/media/platform/nxp/dw100/,include/uapi/linux/dw100.h
NXP i.MX 8MQ DCSS DRIVER #
- Mail: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
- Reviewer: Lucas Stach <l.stach@pengutronix.de>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/devicetree/bindings/display/imx/nxp,imx8mq-dcss.yaml,drivers/gpu/drm/imx/dcss/
NXP i.MX 8QXP ADC DRIVER #
- Mail: Cai Huoqing <cai.huoqing@linux.dev>, Haibo Chen <haibo.chen@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/nxp,imx8qxp-adc.yaml,drivers/iio/adc/imx8qxp-adc.c
NXP i.MX 8QXP/8QM JPEG V4L2 DRIVER #
- Mail: Mirela Rabulea <mirela.rabulea@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/nxp,imx8-jpeg.yaml,drivers/media/platform/nxp/imx-jpeg
NXP i.MX CLOCK DRIVERS #
- Mail: Abel Vesa <abelvesa@kernel.org>
- Reviewer: Peng Fan <peng.fan@nxp.com>
- Mailing list: linux-clk@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux.git clk/imx
- Files:
Documentation/devicetree/bindings/clock/*imx*,drivers/clk/imx/,include/dt-bindings/clock/*imx*
NXP NETC TIMER PTP CLOCK DRIVER #
- Mail: Wei Fang <wei.fang@nxp.com>, Clark Wang <xiaoning.wang@nxp.com>
- Mailing list: imx@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/ptp/nxp,ptp-netc.yaml,drivers/ptp/ptp_netc.c
NXP PF5300/PF5301/PF5302 PMIC REGULATOR DEVICE DRIVER #
- Mail: Woodrow Douglass <wdouglass@carnegierobotics.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml,drivers/regulator/pf530x-regulator.c
NXP PF1550 PMIC MFD DRIVER #
- Mail: Samuel Kayode <samkay014@gmail.com>
- Mailing list: imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mfd/nxp,pf1550.yaml,drivers/input/misc/pf1550-onkey.c,drivers/mfd/pf1550.c,drivers/power/supply/pf1550-charger.c,drivers/regulator/pf1550-regulator.c,include/linux/mfd/pf1550.h
NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER #
- Mail: Jagan Teki <jagan@amarulasolutions.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml,drivers/regulator/pf8x00-regulator.c
NXP PTN5150A CC LOGIC AND EXTCON DRIVER #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/extcon/extcon-ptn5150.yaml,drivers/extcon/extcon-ptn5150.c
NXP SGTL5000 DRIVER #
- Mail: Fabio Estevam <festevam@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/fsl,sgtl5000.yaml,sound/soc/codecs/sgtl5000*
NXP SJA1105 ETHERNET SWITCH DRIVER #
- Mail: Vladimir Oltean <olteanv@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/dsa/sja1105,drivers/net/pcs/pcs-xpcs-nxp.c
NXP TDA998X DRM DRIVER #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Maintained
- SCM: git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-tda998x-devel, git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-tda998x-fixes
- Files:
drivers/gpu/drm/bridge/tda998x_drv.c,include/dt-bindings/display/tda998x.h - Content regex:
"nxp,tda998x"
NXP TFA9879 DRIVER #
- Mail: Peter Rosin <peda@axentia.se>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/trivial-codec.yaml,sound/soc/codecs/tfa9879*
NXP XSPI DRIVER #
- Mail: Han Xu <han.xu@nxp.com>, Haibo Chen <haibo.chen@nxp.com>
- Mailing list: linux-spi@vger.kernel.org, imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/nxp,imx94-xspi.yaml,drivers/spi/spi-nxp-xspi.c
NXP-NCI NFC DRIVER #
- Status: Orphan
- Files:
Documentation/devicetree/bindings/net/nfc/nxp,nci.yaml,drivers/nfc/nxp-nci
NXP/Goodix TFA989X (TFA1) DRIVER #
- Mail: Stephan Gerhold <stephan@gerhold.net>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml,sound/soc/codecs/tfa989x.c
NZXT-KRAKEN2 HARDWARE MONITORING DRIVER #
- Mail: Jonas Malaco <jonas@protocubo.io>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/nzxt-kraken2.rst,drivers/hwmon/nzxt-kraken2.c
NZXT-KRAKEN3 HARDWARE MONITORING DRIVER #
- Mail: Jonas Malaco <jonas@protocubo.io>, Aleksa Savic <savicaleksa83@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/nzxt-kraken3.rst,drivers/hwmon/nzxt-kraken3.c
OBJAGG #
- Mail: Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
include/linux/objagg.h,lib/objagg.c,lib/test_objagg.c
OBJPOOL #
- Mail: Matt Wu <wuqiang.matt@bytedance.com>
- Status: Supported
- Files:
include/linux/objpool.h,lib/objpool.c,lib/test_objpool.c
OBJTOOL #
- Mail: Josh Poimboeuf <jpoimboe@kernel.org>, Peter Zijlstra <peterz@infradead.org>
- Status: Supported
- Files:
include/linux/objtool*.h,tools/objtool/
OCELOT ETHERNET SWITCH DRIVER #
- Mail: Vladimir Oltean <vladimir.oltean@nxp.com>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/dsa/ocelot/*,drivers/net/ethernet/mscc/,include/soc/mscc/ocelot*,net/dsa/tag_ocelot.c,net/dsa/tag_ocelot_8021q.c,tools/testing/selftests/drivers/net/ocelot/*
OCELOT EXTERNAL SWITCH CONTROL #
- Mail: Colin Foster <colin.foster@in-advantage.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml,drivers/mfd/ocelot*,drivers/net/dsa/ocelot/ocelot_ext.c,include/linux/mfd/ocelot.h
OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER #
- Mail: Frederic Barrat <fbarrat@linux.ibm.com>, Andrew Donnellan <ajd@linux.ibm.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Odd Fixes
- Files:
Documentation/userspace-api/accelerators/ocxl.rst,arch/powerpc/include/asm/pnv-ocxl.h,arch/powerpc/platforms/powernv/ocxl.c,drivers/misc/ocxl/,include/misc/ocxl*,include/uapi/misc/ocxl.h
OMAP AUDIO SUPPORT #
- Mail: Peter Ujfalusi <peter.ujfalusi@gmail.com>, Jarkko Nikula <jarkko.nikula@bitmer.com>
- Mailing list: linux-sound@vger.kernel.org, linux-omap@vger.kernel.org
- Status: Maintained
- Files:
sound/soc/ti/n810.c,sound/soc/ti/omap*,sound/soc/ti/rx51.c,sound/soc/ti/sdma-pcm.*
OMAP CLOCK FRAMEWORK SUPPORT #
- Mail: Paul Walmsley <paul@pwsan.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/*omap*/*clock*
OMAP DEVICE TREE SUPPORT #
- Mail: Aaro Koskinen <aaro.koskinen@iki.fi>, Andreas Kemnade <andreas@kemnade.info>, Kevin Hilman <khilman@baylibre.com>, Roger Quadros <rogerq@kernel.org>, Tony Lindgren <tony@atomide.com>
- Mailing list: linux-omap@vger.kernel.org, devicetree@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/boot/dts/ti/omap/
OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2) #
- Mailing list: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
- Status: Orphan
- Files:
Documentation/arch/arm/omap/dss.rst,drivers/video/fbdev/omap2/
OMAP FRAMEBUFFER SUPPORT #
- Mailing list: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org
- Status: Orphan
- Files:
drivers/video/fbdev/omap/
OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT #
- Mail: Roger Quadros <rogerq@kernel.org>, Tony Lindgren <tony@atomide.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/mach-omap2/*gpmc*,drivers/memory/omap-gpmc.c
OMAP GPIO DRIVER #
- Mail: Grygorii Strashko <grygorii.strashko@ti.com>, Santosh Shilimkar <ssantosh@kernel.org>, Kevin Hilman <khilman@kernel.org>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/ti,omap-gpio.yaml,drivers/gpio/gpio-omap.c
OMAP HARDWARE SPINLOCK SUPPORT #
- Mailing list: linux-omap@vger.kernel.org
- Status: Orphan
- Files:
drivers/hwspinlock/omap_hwspinlock.c
OMAP HS MMC SUPPORT #
- Mailing list: linux-mmc@vger.kernel.org, linux-omap@vger.kernel.org
- Status: Orphan
- Files:
drivers/mmc/host/omap_hsmmc.c
OMAP HWMOD DATA #
- Mail: Paul Walmsley <paul@pwsan.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/mach-omap2/omap_hwmod*data*
OMAP HWMOD SUPPORT #
- Mail: Paul Walmsley <paul@pwsan.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/mach-omap2/omap_hwmod.*
OMAP I2C DRIVER #
- Mail: Vignesh R <vigneshr@ti.com>
- Mailing list: linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/ti,omap4-i2c.yaml,drivers/i2c/busses/i2c-omap.c
OMAP MMC SUPPORT #
- Mail: Aaro Koskinen <aaro.koskinen@iki.fi>
- Mailing list: linux-omap@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/mmc/host/omap.c
OMAP POWER MANAGEMENT SUPPORT #
- Mail: Kevin Hilman <khilman@kernel.org>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/*omap*/*pm*
OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT #
- Mail: Paul Walmsley <paul@pwsan.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/mach-omap2/prm*
OMAP RANDOM NUMBER GENERATOR SUPPORT #
- Mail: Deepak Saxena <dsaxena@plexity.net>
- Status: Maintained
- Files:
drivers/char/hw_random/omap-rng.c
OMAP USB SUPPORT #
- Mailing list: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org
- Status: Orphan
- Files:
arch/arm/*omap*/usb*,drivers/usb/*/*omap*
OMAP/NEWFLOW NANOBONE MACHINE SUPPORT #
- Mail: Mark Jackson <mpfj@newflow.co.uk>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Files:
arch/arm/boot/dts/ti/omap/am335x-nano.dts
OMAP1 SUPPORT #
- Mail: Aaro Koskinen <aaro.koskinen@iki.fi>, Janusz Krzysztofik <jmkrzyszt@gmail.com>
- Reviewer: Tony Lindgren <tony@atomide.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/linux-omap/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
- Files:
arch/arm/configs/omap1_defconfig,arch/arm/mach-omap1/,drivers/i2c/busses/i2c-omap.c,include/linux/platform_data/ams-delta-fiq.h,include/linux/platform_data/i2c-omap.h
OMAP2+ SUPPORT #
- Mail: Aaro Koskinen <aaro.koskinen@iki.fi>, Andreas Kemnade <andreas@kemnade.info>, Kevin Hilman <khilman@baylibre.com>, Roger Quadros <rogerq@kernel.org>, Tony Lindgren <tony@atomide.com>
- Mailing list: linux-omap@vger.kernel.org
- Status: Maintained
- Web-page: http://linux.omap.com/
- Patchwork: http://patchwork.kernel.org/project/linux-omap/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
- Files:
Documentation/devicetree/bindings/arm/ti/omap.yaml,arch/arm/configs/omap2plus_defconfig,arch/arm/mach-omap2/,drivers/bus/omap*.[ch],drivers/bus/ti-sysc.c,drivers/gpio/gpio-tps65219.c,drivers/i2c/busses/i2c-omap.c,drivers/irqchip/irq-omap-intc.c,drivers/mfd/*omap*.c,drivers/mfd/menelaus.c,drivers/mfd/palmas.c,drivers/mfd/tps65217.c,drivers/mfd/tps65218.c,drivers/mfd/tps65219.c,drivers/mfd/tps65910.c,drivers/mfd/twl-core.[ch],drivers/mfd/twl4030*.c,drivers/mfd/twl6030*.c,drivers/mfd/twl6040*.c,drivers/regulator/palmas-regulator*.c,drivers/regulator/pbias-regulator.c,drivers/regulator/tps65217-regulator.c,drivers/regulator/tps65218-regulator.c,drivers/regulator/tps65219-regulator.c,drivers/regulator/tps65910-regulator.c,drivers/regulator/twl-regulator.c,drivers/regulator/twl6030-regulator.c,include/linux/platform_data/i2c-omap.h,include/linux/platform_data/ti-sysc.h
OMFS FILESYSTEM #
- Mail: Bob Copeland <me@bobcopeland.com>
- Mailing list: linux-karma-devel@lists.sourceforge.net
- Status: Maintained
- Files:
Documentation/filesystems/omfs.rst,fs/omfs/
OMNIVISION OG01A1B SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,og01a1b.yaml,drivers/media/i2c/og01a1b.c
OMNIVISION OG0VE1B SENSOR DRIVER #
- Mail: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media_tree.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,og0ve1b.yaml,drivers/media/i2c/og0ve1b.c
OMNIVISION OS05B10 SENSOR DRIVER #
- Mail: Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>, Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,os05b10.yaml,drivers/media/i2c/os05b10.c
OMNIVISION OV01A10 SENSOR DRIVER #
- Mail: Bingbu Cao <bingbu.cao@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov01a10.c
OMNIVISION OV02A10 SENSOR DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov02a10.yaml,drivers/media/i2c/ov02a10.c
OMNIVISION OV02C10 SENSOR DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Reviewer: Bryan O'Donoghue <bod@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov02c10.c
OMNIVISION OV02E10 SENSOR DRIVER #
- Mail: Bryan O'Donoghue <bod@kernel.org>, Hans de Goede <hansg@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov02e10.yaml,drivers/media/i2c/ov02e10.c
OMNIVISION OV08D10 SENSOR DRIVER #
- Mail: Jimmy Su <jimmy.su@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov08d10.c
OMNIVISION OV08X40 SENSOR DRIVER #
- Mail: Jimmy Su <jimmy.su@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/ov08x40.c,Documentation/devicetree/bindings/media/i2c/ovti,ov08x40.yaml
OMNIVISION OV13858 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov13858.c
OMNIVISION OV13B10 SENSOR DRIVER #
- Mail: Arec Kao <arec.kao@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov13b10.c
OMNIVISION OV2680 SENSOR DRIVER #
- Mail: Rui Miguel Silva <rmfrfs@gmail.com>, Hans de Goede <hansg@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov2680.yaml,drivers/media/i2c/ov2680.c
OMNIVISION OV2685 SENSOR DRIVER #
- Mail: Shunqian Zheng <zhengsq@rock-chips.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov2685.yaml,drivers/media/i2c/ov2685.c
OMNIVISION OV2735 SENSOR DRIVER #
- Mail: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>, Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov2735.yaml,drivers/media/i2c/ov2735.c
OMNIVISION OV2740 SENSOR DRIVER #
- Mail: Tianshu Qiu <tian.shu.qiu@intel.com>
- Reviewer: Sakari Ailus <sakari.ailus@linux.intel.com>, Bingbu Cao <bingbu.cao@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov2740.c
OMNIVISION OV4689 SENSOR DRIVER #
- Mail: Mikhail Rudenko <mike.rudenko@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov4689.yaml,drivers/media/i2c/ov4689.c
OMNIVISION OV5640 SENSOR DRIVER #
- Mail: Steve Longerbeam <slongerbeam@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov5640.c
OMNIVISION OV5647 SENSOR DRIVER #
- Mail: Dave Stevenson <dave.stevenson@raspberrypi.com>, Jacopo Mondi <jacopo@jmondi.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov5647.yaml,drivers/media/i2c/ov5647.c
OMNIVISION OV5670 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov5670.yaml,drivers/media/i2c/ov5670.c
OMNIVISION OV5675 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov5675.yaml,drivers/media/i2c/ov5675.c
OMNIVISION OV5693 SENSOR DRIVER #
- Mail: Daniel Scally <dan.scally@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml,drivers/media/i2c/ov5693.c
OMNIVISION OV5695 SENSOR DRIVER #
- Mail: Shunqian Zheng <zhengsq@rock-chips.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov5695.c
OMNIVISION OV6211 SENSOR DRIVER #
- Mail: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media_tree.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov6211.yaml,drivers/media/i2c/ov6211.c
OMNIVISION OV64A40 SENSOR DRIVER #
- Mail: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov64a40.yaml,drivers/media/i2c/ov64a40.c
OMNIVISION OV7670 SENSOR DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov7670.txt,drivers/media/i2c/ov7670.c
OMNIVISION OV772x SENSOR DRIVER #
- Mail: Jacopo Mondi <jacopo@jmondi.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov772x.yaml,drivers/media/i2c/ov772x.c,include/media/i2c/ov772x.h
OMNIVISION OV7740 SENSOR DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov7740.txt,drivers/media/i2c/ov7740.c
OMNIVISION OV8856 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml,drivers/media/i2c/ov8856.c
OMNIVISION OV8858 SENSOR DRIVER #
- Mail: Jacopo Mondi <jacopo.mondi@ideasonboard.com>, Nicholas Roth <nicholas@rothemail.net>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov8858.yaml,drivers/media/i2c/ov8858.c
OMNIVISION OV9282 SENSOR DRIVER #
- Mail: Dave Stevenson <dave.stevenson@raspberrypi.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml,drivers/media/i2c/ov9282.c
OMNIVISION OV9640 SENSOR DRIVER #
- Mail: Petr Cvek <petrcvekcz@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/ov9640.*
OMNIVISION OV9650 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Reviewer: Akinobu Mita <akinobu.mita@gmail.com>, Sylwester Nawrocki <s.nawrocki@samsung.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov9650.txt,drivers/media/i2c/ov9650.c
OMNIVISION OV9734 SENSOR DRIVER #
- Mail: Tianshu Qiu <tian.shu.qiu@intel.com>
- Reviewer: Bingbu Cao <bingbu.cao@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/ov9734.c
ONBOARD USB HUB DRIVER #
- Mail: Matthias Kaehlcke <mka@chromium.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-platform-onboard-usb-dev,drivers/usb/misc/onboard_usb_dev.c
ONENAND FLASH DRIVER #
- Mail: Kyungmin Park <kyungmin.park@samsung.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/nand/onenand/,include/linux/mtd/onenand*.h
ONEXPLAYER PLATFORM EC DRIVER #
- Mail: Antheas Kapenekakis <lkml@antheas.dev>, Derek John Clark <derekjohn.clark@gmail.com>, Joaquín Ignacio Aramendía <samsagax@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/oxpec.c
ONIE TLV NVMEM LAYOUT DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml,drivers/nvmem/layouts/onie-tlv.c
ONION OMEGA2+ BOARD #
- Mail: Harvey Hunt <harveyhuntnexus@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/boot/dts/ralink/omega2p.dts
ONSEMI ETHERNET PHY DRIVERS #
- Mail: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Web-page: http://www.onsemi.com
- Files:
drivers/net/phy/ncn*
OP-TEE DRIVER #
- Mail: Jens Wiklander <jens.wiklander@linaro.org>
- Mailing list: op-tee@lists.trustedfirmware.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-optee-devices,drivers/tee/optee/
OP-TEE RANDOM NUMBER GENERATOR (RNG) DRIVER #
- Mail: Sumit Garg <sumit.garg@kernel.org>
- Mailing list: op-tee@lists.trustedfirmware.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/char/hw_random/optee-rng.c
OP-TEE RTC DRIVER #
- Mail: Clément Léger <clement.leger@bootlin.com>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Maintained
- Files:
drivers/rtc/rtc-optee.c
OPA-VNIC DRIVER #
- Mail: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/ulp/opa_vnic
OPEN ALLIANCE 10BASE-T1S MACPHY SERIAL INTERFACE FRAMEWORK #
- Mail: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/oa-tc6-framework.rst,drivers/net/ethernet/oa_tc6.c,include/linux/oa_tc6.h
OPEN FIRMWARE AND FLATTENED DEVICE TREE #
- Mail: Rob Herring <robh@kernel.org>, Saravana Kannan <saravanak@kernel.org>
- Mailing list: devicetree@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/devicetree/list/
- Web-page: http://www.devicetree.org/
- chat: irc://irc.libera.chat/devicetree
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
- Files:
Documentation/ABI/testing/sysfs-firmware-ofw,drivers/of/,include/linux/of*.h,rust/helpers/of.c,rust/kernel/of.rs,scripts/dtc/,scripts/Makefile.dtb*,tools/testing/selftests/dt/ - Content regex:
of_overlay_notifier_,of_overlay_fdt_apply,of_overlay_remove
OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS #
- Mail: Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>
- Mailing list: devicetree@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/devicetree/list/
- chat: irc://irc.libera.chat/devicetree
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
- Files:
Documentation/devicetree/,arch/*/boot/dts/,include/dt-bindings/
OPENCOMPUTE PTP CLOCK DRIVER #
- Mail: Vadim Fedorenko <vadim.fedorenko@linux.dev>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/ptp/ptp_ocp.c
OPENCORES I2C BUS DRIVER #
- Mail: Peter Korsgaard <peter@korsgaard.com>, Andrew Lunn <andrew@lunn.ch>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/opencores,i2c-ocores.yaml,Documentation/i2c/busses/i2c-ocores.rst,drivers/i2c/busses/i2c-ocores.c,include/linux/platform_data/i2c-ocores.h
OPENRISC ARCHITECTURE #
- Mail: Jonas Bonn <jonas@southpole.se>, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>, Stafford Horne <shorne@gmail.com>
- Mailing list: linux-openrisc@vger.kernel.org
- Status: Maintained
- Web-page: http://openrisc.io
- SCM: git https://github.com/openrisc/linux.git
- Files:
Documentation/arch/openrisc/,Documentation/devicetree/bindings/openrisc/,arch/openrisc/,drivers/irqchip/irq-ompic.c,drivers/irqchip/irq-or1k-*
OPENVPN DATA CHANNEL OFFLOAD #
- Mail: Antonio Quartulli <antonio@openvpn.net>
- Reviewer: Sabrina Dubroca <sd@queasysnail.net>
- Mailing list: openvpn-devel@lists.sourceforge.net (subscribers-only), netdev@vger.kernel.org
- Status: Supported
- SCM: git https://github.com/OpenVPN/ovpn-net-next.git
- Files:
Documentation/netlink/specs/ovpn.yaml,drivers/net/ovpn/,include/uapi/linux/ovpn.h,tools/testing/selftests/net/ovpn/
OPENVSWITCH #
- Mail: Aaron Conole <aconole@redhat.com>, Eelco Chaudron <echaudro@redhat.com>, Ilya Maximets <i.maximets@ovn.org>
- Mailing list: netdev@vger.kernel.org, dev@openvswitch.org
- Status: Maintained
- Web-page: http://openvswitch.org
- Files:
Documentation/networking/openvswitch.rst,include/uapi/linux/openvswitch.h,net/openvswitch/,tools/testing/selftests/net/openvswitch/
OPERATING PERFORMANCE POINTS (OPP) #
- Mail: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>, Stephen Boyd <sboyd@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git
- Files:
Documentation/devicetree/bindings/opp/,Documentation/power/opp.rst,drivers/opp/,include/linux/pm_opp.h,rust/kernel/opp.rs
OPL4 DRIVER #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
sound/drivers/opl4/
ORACLE CLUSTER FILESYSTEM 2 (OCFS2) #
- Mail: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>, Joseph Qi <joseph.qi@linux.alibaba.com>
- Mailing list: ocfs2-devel@lists.linux.dev
- Status: Supported
- Web-page: http://ocfs2.wiki.kernel.org
- Files:
Documentation/filesystems/dlmfs.rst,Documentation/filesystems/ocfs2.rst,fs/ocfs2/
ORANGEFS FILESYSTEM #
- Mail: Mike Marshall <hubcap@omnibond.com>
- Reviewer: Martin Brandenburg <martin@omnibond.com>
- Mailing list: devel@lists.orangefs.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux.git
- Files:
Documentation/filesystems/orangefs.rst,fs/orangefs/
OV2659 OMNIVISION SENSOR DRIVER #
- Mail: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
- Files:
Documentation/devicetree/bindings/media/i2c/ovti,ov2659.txt,drivers/media/i2c/ov2659.c,include/media/i2c/ov2659.h
OVERLAY FILESYSTEM #
- Mail: Miklos Szeredi <miklos@szeredi.hu>, Amir Goldstein <amir73il@gmail.com>
- Mailing list: linux-unionfs@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/overlayfs/vfs.git
- Files:
Documentation/filesystems/overlayfs.rst,fs/overlayfs/
P54 WIRELESS DRIVER #
- Mail: Christian Lamparter <chunkeey@googlemail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/p54
- Files:
drivers/net/wireless/intersil/
PACKET SOCKETS #
- Mail: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
- Status: Maintained
- Files:
include/uapi/linux/if_packet.h,net/packet/af_packet.c
PACKING #
- Mail: Vladimir Oltean <olteanv@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/core-api/packing.rst,include/linux/packing.h,lib/packing.c,lib/packing_test.c,scripts/gen_packed_field_checks.c
PADATA PARALLEL EXECUTION MECHANISM #
- Mail: Steffen Klassert <steffen.klassert@secunet.com>, Daniel Jordan <daniel.m.jordan@oracle.com>
- Mailing list: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/core-api/padata.rst,include/linux/padata.h,kernel/padata.c
PAGE CACHE #
- Mail: Matthew Wilcox (Oracle) <willy@infradead.org>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Supported
- SCM: git git://git.infradead.org/users/willy/pagecache.git
- Files:
Documentation/filesystems/locking.rst,Documentation/filesystems/vfs.rst,include/linux/pagemap.h,mm/filemap.c,mm/page-writeback.c,mm/readahead.c,mm/truncate.c
PAGE POOL #
- Mail: Jesper Dangaard Brouer <hawk@kernel.org>, Ilias Apalodimas <ilias.apalodimas@linaro.org>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/networking/page_pool.rst,include/net/page_pool/,include/trace/events/page_pool.h,net/core/page_pool.c
PAGE TABLE CHECK #
- Mail: Pasha Tatashin <pasha.tatashin@soleen.com>, Andrew Morton <akpm@linux-foundation.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/mm/page_table_check.rst,include/linux/page_table_check.h,mm/page_table_check.c
PAGE STATE DEBUG SCRIPT #
- Mail: Ye Liu <liuye@kylinos.cn>
- Status: Maintained
- Files:
tools/mm/show_page_info.py
PANASONIC LAPTOP ACPI EXTRAS DRIVER #
- Mail: Kenneth Chan <kenneth.t.chan@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/panasonic-laptop.c
PARALLAX PING IIO SENSOR DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/proximity/parallax-ping.yaml,drivers/iio/proximity/ping.c
PARALLEL LCD/KEYPAD PANEL DRIVER #
- Mail: Willy Tarreau <willy@haproxy.com>, Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
- Status: Odd Fixes
- Files:
Documentation/admin-guide/lcd-panel-cgram.rst,drivers/auxdisplay/panel.c
PARALLEL PORT SUBSYSTEM #
- Mail: Sudip Mukherjee <sudipm.mukherjee@gmail.com>, Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
- Mailing list: linux-parport@lists.infradead.org (subscribers-only)
- Status: Maintained
- Files:
Documentation/driver-api/parport*.rst,drivers/char/ppdev.c,drivers/parport/,include/linux/parport*.h,include/uapi/linux/ppdev.h
PARAVIRT_OPS INTERFACE #
- Mail: Juergen Gross <jgross@suse.com>
- Reviewer: Ajay Kaher <ajay.kaher@broadcom.com>, Alexey Makhalov <alexey.makhalov@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: virtualization@lists.linux.dev, x86@kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
- Files:
Documentation/virt/paravirt_ops.rst,arch/*/include/asm/paravirt*.h,arch/*/kernel/paravirt*,include/linux/hypervisor.h
PARISC ARCHITECTURE #
- Mail: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>, Helge Deller <deller@gmx.de>
- Mailing list: linux-parisc@vger.kernel.org
- Status: Maintained
- Web-page: https://parisc.wiki.kernel.org
- Patchwork: http://patchwork.kernel.org/project/linux-parisc/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6.git, git git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git
- Files:
Documentation/arch/parisc/,arch/parisc/,drivers/char/agp/parisc-agp.c,drivers/input/misc/hp_sdc_rtc.c,drivers/input/serio/gscps2.c,drivers/input/serio/hp_sdc*,drivers/parisc/,drivers/parport/parport_gsc.*,drivers/tty/serial/8250/8250_parisc.c,drivers/video/console/sti*,drivers/video/fbdev/sti*,drivers/video/logo/logo_parisc*,include/linux/hp_sdc.h
PARMAN #
- Mail: Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
include/linux/parman.h,lib/parman.c,lib/test_parman.c
PC ENGINES APU BOARD DRIVER #
- Mail: Enrico Weigelt, metux IT consult <info@metux.net>
- Status: Maintained
- Files:
drivers/platform/x86/pcengines-apuv2.c
PC87360 HARDWARE MONITORING DRIVER #
- Mail: Jim Cromie <jim.cromie@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/pc87360.rst,drivers/hwmon/pc87360.c
PC8736x GPIO DRIVER #
- Mail: Jim Cromie <jim.cromie@gmail.com>
- Status: Maintained
- Files:
drivers/char/pc8736x_gpio.c
PC87427 HARDWARE MONITORING DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/pc87427.rst,drivers/hwmon/pc87427.c
MAX77705 HARDWARE MONITORING DRIVER #
- Mail: Dzmitry Sankouski <dsankouski@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/max77705.rst,drivers/hwmon/max77705-hwmon.c
PCA9532 LED DRIVER #
- Mail: Riku Voipio <riku.voipio@iki.fi>
- Status: Maintained
- Files:
drivers/leds/leds-pca9532.c,include/linux/leds-pca9532.h
PCI DRIVER FOR AARDVARK (Marvell Armada 3700) #
- Mail: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, Pali Rohár <pali@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/marvell,armada-3700-pcie.yaml,drivers/pci/controller/pci-aardvark.c
PCI DRIVER FOR ALTERA PCIE IP #
- Mailing list: linux-pci@vger.kernel.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/pci/altr,pcie-root-port.yaml,drivers/pci/controller/pcie-altera.c
PCI DRIVER FOR APPLIEDMICRO XGENE #
- Mail: Toan Le <toan@os.amperecomputing.com>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/apm,xgene-pcie.yaml,drivers/pci/controller/pci-xgene.c
PCI DRIVER FOR ARM VERSATILE PLATFORM #
- Mail: Rob Herring <robh@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/versatile.yaml,drivers/pci/controller/pci-versatile.c
PCI DRIVER FOR ARMADA 8K #
- Mail: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/marvell,armada8k-pcie.yaml,drivers/pci/controller/dwc/pcie-armada8k.c
PCI DRIVER FOR CADENCE PCIE IP #
- Mailing list: linux-pci@vger.kernel.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/pci/cdns,*,drivers/pci/controller/cadence/*cadence*
PCI DRIVER FOR CIX Sky1 #
- Mail: Hans Zhang <hans.zhang@cixtech.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/cix,sky1-pcie-*.yaml,drivers/pci/controller/cadence/*sky1*
PCI DRIVER FOR FREESCALE LAYERSCAPE #
- Mail: Minghuan Lian <minghuan.Lian@nxp.com>, Mingkai Hu <mingkai.hu@nxp.com>, Roy Zang <roy.zang@nxp.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), imx@lists.linux.dev
- Status: Maintained
- Files:
drivers/pci/controller/dwc/*layerscape*
PCI DRIVER FOR FU740 #
- Mail: Paul Walmsley <pjw@kernel.org>, Greentime Hu <greentime.hu@sifive.com>, Samuel Holland <samuel.holland@sifive.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/sifive,fu740-pcie.yaml,drivers/pci/controller/dwc/pcie-fu740.c
PCI DRIVER FOR GENERIC OF HOSTS #
- Mail: Will Deacon <will@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/host-generic-pci.yaml,drivers/pci/controller/pci-host-common.c,drivers/pci/controller/pci-host-generic.c
PCI DRIVER FOR IMX6 #
- Mail: Richard Zhu <hongxing.zhu@nxp.com>, Lucas Stach <l.stach@pengutronix.de>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-common.yaml,Documentation/devicetree/bindings/pci/fsl,imx6q-pcie-ep.yaml,Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml,drivers/pci/controller/dwc/*imx6*
PCI DRIVER FOR INTEL IXP4XX #
- Mail: Linus Walleij <linusw@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/intel,ixp4xx-pci.yaml,drivers/pci/controller/pci-ixp4xx.c
PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) #
- Mail: Nirmal Patel <nirmal.patel@linux.intel.com>
- Reviewer: Jonathan Derrick <jonathan.derrick@linux.dev>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Files:
drivers/pci/controller/vmd.c
PCI DRIVER FOR MICROSEMI SWITCHTEC #
- Mail: Kurt Schwemmer <kurt.schwemmer@microsemi.com>, Logan Gunthorpe <logang@deltatee.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-switchtec,Documentation/driver-api/switchtec.rst,drivers/ntb/hw/mscc/,drivers/pci/switch/switchtec*,include/linux/switchtec.h,include/uapi/linux/switchtec_ioctl.h
PCI DRIVER FOR MOBIVEIL PCIE IP #
- Mail: Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>, Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/mbvl,gpex40-pcie.yaml,drivers/pci/controller/mobiveil/pcie-mobiveil*
PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support) #
- Mail: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, Pali Rohár <pali@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/pci/controller/*mvebu*
PCI DRIVER FOR NVIDIA TEGRA #
- Mail: Thierry Reding <thierry.reding@gmail.com>
- Mailing list: linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt,drivers/pci/controller/pci-tegra.c
PCI DRIVER FOR NXP LAYERSCAPE GEN4 CONTROLLER #
- Mail: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
PCI DRIVER FOR PLDA PCIE IP #
- Mail: Daire McNamara <daire.mcnamara@microchip.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/plda,xpressrich3-axi-common.yaml,drivers/pci/controller/plda/pcie-plda-host.c,drivers/pci/controller/plda/pcie-plda.h
PCI DRIVER FOR RENESAS R-CAR #
- Mail: Marek Vasut <marek.vasut+renesas@gmail.com>, Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
- Mailing list: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/PCI/controller/rcar-pcie-firmware.rst,Documentation/devicetree/bindings/pci/*rcar*,drivers/pci/controller/*rcar*,drivers/pci/controller/dwc/*rcar*
PCI DRIVER FOR SAMSUNG EXYNOS #
- Mail: Jingoo Han <jingoohan1@gmail.com>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/controller/dwc/pci-exynos.c
PCI DRIVER FOR STM32MP25 #
- Mail: Christian Bruel <christian.bruel@foss.st.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/st,stm32-pcie-*.yaml,drivers/pci/controller/dwc/*stm32*
PCI DRIVER FOR SYNOPSYS DESIGNWARE #
- Mail: Jingoo Han <jingoohan1@gmail.com>, Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml,Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml,drivers/pci/controller/dwc/*designware*,include/linux/pcie-dwc.h
PCI DRIVER FOR TI DRA7XX/J721E #
- Mail: Vignesh Raghavendra <vigneshr@ti.com>
- Reviewer: Siddharth Vadapalli <s-vadapalli@ti.com>
- Mailing list: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/ti-pci.txt,drivers/pci/controller/cadence/pci-j721e.c,drivers/pci/controller/dwc/pci-dra7xx.c
PCI DRIVER FOR V3 SEMICONDUCTOR V360EPC #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/v3,v360epc-pci.yaml,drivers/pci/controller/pci-v3-semi.c
PCI DRIVER FOR XILINX VERSAL CPM #
- Mail: Bharat Kumar Gogada <bharat.kumar.gogada@amd.com>, Michal Simek <michal.simek@amd.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml,drivers/pci/controller/pcie-xilinx-cpm.c
PCI ENDPOINT SUBSYSTEM #
- Mail: Manivannan Sadhasivam <mani@kernel.org>, Krzysztof Wilczyński <kwilczynski@kernel.org>
- Reviewer: Kishon Vijay Abraham I <kishon@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-pci/list/
- bugs: https://bugzilla.kernel.org
- chat: irc://irc.oftc.net/linux-pci
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- Files:
Documentation/PCI/endpoint/*,Documentation/misc-devices/pci-endpoint-test.rst,drivers/misc/pci_endpoint_test.c,drivers/pci/endpoint/,tools/testing/selftests/pci_endpoint/
PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC #
- Mail: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
- Reviewer: Oliver O'Halloran <oohall@gmail.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Supported
- Files:
Documentation/PCI/pci-error-recovery.rst,Documentation/arch/powerpc/eeh-pci-error-recovery.rst,arch/powerpc/include/*/eeh*.h,arch/powerpc/kernel/eeh*.c,arch/powerpc/platforms/*/eeh*.c,drivers/pci/pcie/aer.c,drivers/pci/pcie/dpc.c,drivers/pci/pcie/err.c
PCI ERROR RECOVERY #
- Mail: Linas Vepstas <linasvepstas@gmail.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Files:
Documentation/PCI/pci-error-recovery.rst
PCI MSI DRIVER FOR ALTERA MSI IP #
- Mailing list: linux-pci@vger.kernel.org
- Status: Orphan
- Files:
Documentation/devicetree/bindings/interrupt-controller/altr,msi-controller.yaml,drivers/pci/controller/pcie-altera-msi.c
PCI MSI DRIVER FOR APPLIEDMICRO XGENE #
- Mail: Toan Le <toan@os.amperecomputing.com>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/apm,xgene1-msi.yaml,drivers/pci/controller/pci-xgene-msi.c
PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS #
- Mail: Lorenzo Pieralisi <lpieralisi@kernel.org>, Krzysztof Wilczyński <kwilczynski@kernel.org>, Manivannan Sadhasivam <mani@kernel.org>
- Reviewer: Rob Herring <robh@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-pci/list/
- bugs: https://bugzilla.kernel.org
- chat: irc://irc.oftc.net/linux-pci
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- Files:
Documentation/ABI/testing/debugfs-pcie-ptm,Documentation/devicetree/bindings/pci/,drivers/pci/controller/,drivers/pci/pci-bridge-emul.c,drivers/pci/pci-bridge-emul.h
PCI PEER-TO-PEER DMA (P2PDMA) #
- Mail: Bjorn Helgaas <bhelgaas@google.com>, Logan Gunthorpe <logang@deltatee.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-pci/list/
- bugs: https://bugzilla.kernel.org
- chat: irc://irc.oftc.net/linux-pci
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- Files:
Documentation/driver-api/pci/p2pdma.rst,drivers/pci/p2pdma.c,include/linux/pci-p2pdma.h
PCI POWER CONTROL #
- Mail: Bartosz Golaszewski <brgl@kernel.org>, Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- Files:
drivers/pci/pwrctrl/*,include/linux/pci-pwrctrl.h
PCI SUBSYSTEM #
- Mail: Bjorn Helgaas <bhelgaas@google.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-pci/list/
- bugs: https://bugzilla.kernel.org
- chat: irc://irc.oftc.net/linux-pci
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- Files:
Documentation/ABI/testing/sysfs-devices-pci-host-bridge,Documentation/PCI/,Documentation/devicetree/bindings/pci/,arch/x86/kernel/early-quirks.c,arch/x86/kernel/quirks.c,arch/x86/pci/,drivers/acpi/pci*,drivers/pci/,include/asm-generic/pci*,include/linux/of_pci.h,include/linux/pci*,include/uapi/linux/pci*
PCI SUBSYSTEM [RUST] #
- Mail: Danilo Krummrich <dakr@kernel.org>
- Reviewer: Bjorn Helgaas <bhelgaas@google.com>, Krzysztof Wilczyński <kwilczynski@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- chat: irc://irc.oftc.net/linux-pci
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- Files:
rust/helpers/pci.c,rust/kernel/pci.rs,rust/kernel/pci/,samples/rust/rust_driver_pci.rs
PCIE BANDWIDTH CONTROLLER #
- Mail: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Files:
drivers/pci/pcie/bwctrl.c,drivers/thermal/pcie_cooling.c,include/linux/pci-bwctrl.h,tools/testing/selftests/pcie_bwctrl/
PCIE DRIVER FOR AMAZON ANNAPURNA LABS #
- Mail: Jonathan Chocron <jonnyc@amazon.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/amazon,al-alpine-v3-pcie.yaml,drivers/pci/controller/dwc/pcie-al.c
PCIE DRIVER FOR AMLOGIC MESON #
- Mail: Yue Wang <yue.wang@Amlogic.com>
- Mailing list: linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org
- Status: Maintained
- Files:
drivers/pci/controller/dwc/pci-meson.c
PCIE DRIVER FOR AXIS ARTPEC #
- Mail: Jesper Nilsson <jesper.nilsson@axis.com>
- Mailing list: linux-arm-kernel@axis.com, linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/axis,artpec*,drivers/pci/controller/dwc/*artpec*
PCIE DRIVER FOR CAVIUM THUNDERX #
- Mail: Robert Richter <rric@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Odd Fixes
- Files:
drivers/pci/controller/pci-thunder-*
PCIE DRIVER FOR HISILICON #
- Mail: Zhou Wang <wangzhou1@hisilicon.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/controller/dwc/pcie-hisi.c
PCIE DRIVER FOR HISILICON KIRIN #
- Mail: Xiaowei Song <songxiaowei@hisilicon.com>, Binghui Wang <wangbinghui@hisilicon.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml,drivers/pci/controller/dwc/pcie-kirin.c
PCIE DRIVER FOR HISILICON STB #
- Mail: Shawn Guo <shawnguo@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/hisilicon-histb-pcie.txt,drivers/pci/controller/dwc/pcie-histb.c
PCIE DRIVER FOR INTEL KEEM BAY #
- Mail: Srikanth Thokala <srikanth.thokala@intel.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/intel,keembay-pcie*,drivers/pci/controller/dwc/pcie-keembay.c
PCIE DRIVER FOR INTEL LGM GW SOC #
- Mail: Chuanhua Lei <lchuanhua@maxlinear.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml,drivers/pci/controller/dwc/pcie-intel-gw.c
PCIE DRIVER FOR MEDIATEK #
- Mail: Ryder Lee <ryder.lee@mediatek.com>, Jianjun Wang <jianjun.wang@mediatek.com>
- Mailing list: linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/mediatek*,drivers/pci/controller/*mediatek*
PCIE DRIVER FOR MICROCHIP #
- Mail: Daire McNamara <daire.mcnamara@microchip.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/microchip*,drivers/pci/controller/plda/*microchip*
PCIE DRIVER FOR QUALCOMM MSM #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/controller/dwc/pcie-qcom-common.c,drivers/pci/controller/dwc/pcie-qcom.c
PCIE DRIVER FOR RENESAS RZ/G3S SERIES #
- Mail: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
- Mailing list: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/pci/renesas,r9a08g045-pcie.yaml,drivers/pci/controller/pcie-rzg3s-host.c
PCIE DRIVER FOR ROCKCHIP #
- Mail: Shawn Lin <shawn.lin@rock-chips.com>
- Mailing list: linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie*,drivers/pci/controller/pcie-rockchip*
PCIE DRIVER FOR SOCIONEXT UNIPHIER #
- Mail: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/socionext,uniphier-pcie*,drivers/pci/controller/dwc/pcie-uniphier*
PCIE DRIVER FOR ST SPEAR13XX #
- Mail: Pratyush Anand <pratyush.anand@gmail.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
drivers/pci/controller/dwc/*spear*
PCIE DRIVER FOR STARFIVE JH71x0 #
- Mail: Kevin Xie <kevin.xie@starfivetech.com>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml,drivers/pci/controller/plda/pcie-starfive.c
PCIE ENDPOINT DRIVER FOR QUALCOMM #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml,Documentation/devicetree/bindings/pci/qcom,sa8255p-pcie-ep.yaml,drivers/pci/controller/dwc/pcie-qcom-common.c,drivers/pci/controller/dwc/pcie-qcom-ep.c
PCMCIA SUBSYSTEM #
- Mail: Dominik Brodowski <linux@dominikbrodowski.net>
- Status: Odd Fixes
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux.git
- Files:
Documentation/pcmcia/,drivers/pcmcia/,include/pcmcia/,tools/pcmcia/
PCNET32 NETWORK DRIVER #
- Mail: Don Fry <pcnet32@frontier.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/amd/pcnet32.c
PCRYPT PARALLEL CRYPTO ENGINE #
- Mail: Steffen Klassert <steffen.klassert@secunet.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
crypto/pcrypt.c,include/crypto/pcrypt.h
PDS DSC VIRTIO DATA PATH ACCELERATOR #
- Reviewer: Brett Creeley <brett.creeley@amd.com>
- Files:
drivers/vdpa/pds/
PECI HARDWARE MONITORING DRIVERS #
- Mail: Iwona Winiarska <iwona.winiarska@intel.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Files:
Documentation/hwmon/peci-cputemp.rst,Documentation/hwmon/peci-dimmtemp.rst,drivers/hwmon/peci/
PECI SUBSYSTEM #
- Mail: Iwona Winiarska <iwona.winiarska@intel.com>
- Mailing list: openbmc@lists.ozlabs.org (moderated for non-subscribers)
- Status: Supported
- Files:
Documentation/devicetree/bindings/peci/,Documentation/peci/,drivers/peci/,include/linux/peci-cpu.h,include/linux/peci.h
PEIOS KERNEL EXTENSIONS #
- Mail: Jack Palfrey <jackgpalfrey@outlook.com>
- Status: Maintained
- Files:
fs/stratafs/,include/linux/kacs_mntns.h,include/linux/kacs_stratafs.h,include/linux/peios_ntfe.h,include/trace/events/kacs.h,include/trace/events/kmes.h,include/trace/events/lcs.h,include/trace/events/stratafs.h,include/uapi/pkm/,net/ntfe/,peios/,security/pkm/
PENSANDO ETHERNET DRIVERS #
- Mail: Brett Creeley <brett.creeley@amd.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/pensando/ionic.rst,drivers/net/ethernet/pensando/
PER-CPU MEMORY ALLOCATOR #
- Mail: Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@gentwo.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu.git
- Files:
arch/*/include/asm/percpu.h,include/linux/percpu*.h,lib/percpu*.c,mm/percpu*.c,mm/percpu-internal.h
PER-TASK DELAY ACCOUNTING #
- Mail: Balbir Singh <bsingharora@gmail.com>, Yang Yang <yang.yang29@zte.com.cn>
- Status: Maintained
- Files:
include/linux/delayacct.h,kernel/delayacct.c
TASK DELAY MONITORING TOOLS #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Wang Yaxin <wang.yaxin@zte.com.cn>, Fan Yu <fan.yu9@zte.com.cn>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/accounting/delay-accounting.rst,tools/accounting/delaytop.c,tools/accounting/getdelays.c
PERFORMANCE EVENTS SUBSYSTEM #
- Mail: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org>
- Reviewer: Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, James Clark <james.clark@linaro.org>
- Mailing list: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
- Status: Supported
- Web-page: https://perf.wiki.kernel.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core, git git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git perf-tools, git git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git perf-tools-next
- Files:
arch/*/events/*,arch/*/events/*/*,arch/*/include/asm/perf_event.h,arch/*/kernel/*/*/perf_event*.c,arch/*/kernel/*/perf_event*.c,arch/*/kernel/perf_callchain.c,arch/*/kernel/perf_event*.c,include/linux/perf_event.h,include/uapi/linux/perf_event.h,kernel/events/*,tools/lib/perf/,tools/perf/
PERFORMANCE EVENTS TOOLING ARM64 #
- Reviewer: John Garry <john.g.garry@oracle.com>, Will Deacon <will@kernel.org>, James Clark <james.clark@linaro.org>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linux.dev>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Supported
- Files:
tools/build/feature/test-libopencsd.c,tools/perf/arch/arm*/,tools/perf/pmu-events/arch/arm64/,tools/perf/util/arm-spe*,tools/perf/util/cs-etm*
PERSONALITY HANDLING #
- Mail: Christoph Hellwig <hch@infradead.org>
- Mailing list: linux-abi-devel@lists.sourceforge.net
- Status: Maintained
- Files:
include/linux/personality.h,include/uapi/linux/personality.h
PHOENIX RC FLIGHT CONTROLLER ADAPTER #
- Mail: Marcus Folkesson <marcus.folkesson@gmail.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/input/devices/pxrc.rst,drivers/input/joystick/pxrc.c
PHONET PROTOCOL #
- Mail: Remi Denis-Courmont <courmisch@gmail.com>
- Status: Supported
- Files:
Documentation/networking/phonet.rst,include/linux/phonet.h,include/net/phonet/,include/uapi/linux/phonet.h,net/phonet/
PHRAM MTD DRIVER #
- Mail: Joern Engel <joern@lazybastard.org>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Files:
drivers/mtd/devices/phram.c
PHY COMMON PROPERTIES #
- Mail: Vladimir Oltean <vladimir.oltean@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/netdevbpf/list/
- Files:
Documentation/devicetree/bindings/phy/phy-common-props.yaml,drivers/phy/phy-common-props-test.c,drivers/phy/phy-common-props.c,include/linux/phy/phy-common-props.h
PICOLCD HID DRIVER #
- Mail: Bruno Prémont <bonbons@linux-vserver.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-picolcd*
PIDFD API #
- Mail: Christian Brauner <christian@brauner.io>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
- Files:
rust/kernel/pid_namespace.rs,samples/pidfd/,tools/testing/selftests/clone3/,tools/testing/selftests/pid_namespace/,tools/testing/selftests/pidfd/ - Content regex:
(?i)pidfd,(?i)clone3,\b(clone_args|kernel_clone_args)\b
PIN CONTROL SUBSYSTEM #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git
- Files:
Documentation/devicetree/bindings/pinctrl/,Documentation/driver-api/pin-control.rst,drivers/pinctrl/,include/dt-bindings/pinctrl/,include/linux/pinctrl/
PIN CONTROLLER - AIROHA #
- Mail: Lorenzo Bianconi <lorenzo@kernel.org>
- Mailing list: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/airoha,en7581-pinctrl.yaml,drivers/pinctrl/mediatek/pinctrl-airoha.c
PIN CONTROLLER - AMD #
- Mail: Basavaraj Natikar <Basavaraj.Natikar@amd.com>, Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
- Status: Maintained
- Files:
drivers/pinctrl/pinctrl-amd.c
PIN CONTROLLER - FREESCALE #
- Mail: Dong Aisheng <aisheng.dong@nxp.com>, Fabio Estevam <festevam@gmail.com>, Frank Li <Frank.Li@nxp.com>, Jacky Bai <ping.bai@nxp.com>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>, NXP S32 Linux Team <s32@nxp.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/fsl,*,Documentation/devicetree/bindings/pinctrl/nxp,s32*,drivers/pinctrl/freescale/,drivers/pinctrl/nxp/
PIN CONTROLLER - INTEL #
- Mail: Mika Westerberg <mika.westerberg@linux.intel.com>, Andy Shevchenko <andy@kernel.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git
- Files:
drivers/pinctrl/intel/
PIN CONTROLLER - KEEMBAY #
- Status: Orphan
- Files:
drivers/pinctrl/pinctrl-keembay*
PIN CONTROLLER - MEDIATEK #
- Mail: Sean Wang <sean.wang@kernel.org>
- Mailing list: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/mediatek,mt6779-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/mediatek,mt8183-pinctrl.yaml,drivers/pinctrl/mediatek/
PIN CONTROLLER - MEDIATEK MIPS #
- Mail: Chester A. Unal <chester.a.unal@arinc9.com>, Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Mailing list: linux-mediatek@lists.infradead.org (moderated for non-subscribers), linux-mips@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/mediatek,mt7620-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/mediatek,mt7621-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/mediatek,mt76x8-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/ralink,rt2880-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/ralink,rt305x-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/ralink,rt3352-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/ralink,rt3883-pinctrl.yaml,Documentation/devicetree/bindings/pinctrl/ralink,rt5350-pinctrl.yaml,drivers/pinctrl/mediatek/pinctrl-mt7620.c,drivers/pinctrl/mediatek/pinctrl-mt7621.c,drivers/pinctrl/mediatek/pinctrl-mt76x8.c,drivers/pinctrl/mediatek/pinctrl-mtmips.*,drivers/pinctrl/mediatek/pinctrl-rt2880.c,drivers/pinctrl/mediatek/pinctrl-rt305x.c,drivers/pinctrl/mediatek/pinctrl-rt3883.c
PIN CONTROLLER - MICROCHIP AT91 #
- Mail: Ludovic Desroches <ludovic.desroches@microchip.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-gpio@vger.kernel.org
- Status: Supported
- Files:
drivers/gpio/gpio-sama5d2-piobu.c,drivers/pinctrl/pinctrl-at91*
PIN CONTROLLER - QUALCOMM #
- Mail: Bjorn Andersson <andersson@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- chat: irc://irc.oftc.net/linux-msm
- Files:
Documentation/devicetree/bindings/pinctrl/qcom,*,drivers/pinctrl/qcom/
PIN CONTROLLER - RENESAS #
- Mail: Geert Uytterhoeven <geert+renesas@glider.be>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git renesas-pinctrl
- Files:
Documentation/devicetree/bindings/pinctrl/renesas,*,drivers/pinctrl/renesas/
PIN CONTROLLER - SAMSUNG #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>, Sylwester Nawrocki <s.nawrocki@samsung.com>
- Reviewer: Alim Akhtar <alim.akhtar@samsung.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-samsung-soc/list/
- bugs: mailto:linux-samsung-soc@vger.kernel.org
- chat: irc://irc.libera.chat/linux-exynos
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git
- Files:
Documentation/devicetree/bindings/pinctrl/samsung,pinctrl*yaml,drivers/pinctrl/samsung/
PIN CONTROLLER - SINGLE #
- Mail: Tony Lindgren <tony@atomide.com>, Haojian Zhuang <haojian.zhuang@linaro.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-omap@vger.kernel.org
- Status: Maintained
- Files:
drivers/pinctrl/pinctrl-single.c
PIN CONTROLLER - SUNPLUS / TIBBO #
- Mail: Dvorkin Dmitry <dvorkin@tibbo.com>, Wells Lu <wellslutw@gmail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Web-page: https://sunplus.atlassian.net/wiki/spaces/doc/overview
- Files:
Documentation/devicetree/bindings/pinctrl/sunplus,*,drivers/pinctrl/sunplus/,include/dt-bindings/pinctrl/sppctl*.h
PINE64 PINEPHONE KEYBOARD DRIVER #
- Mail: Samuel Holland <samuel@sholland.org>
- Status: Supported
- Files:
Documentation/devicetree/bindings/input/pine64,pinephone-keyboard.yaml,drivers/input/keyboard/pinephone-keyboard.c
PLANTOWER PMS7003 AIR POLLUTION SENSOR DRIVER #
- Mail: Tomasz Duszynski <tduszyns@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml,drivers/iio/chemical/pms7003.c
PLCA RECONCILIATION SUBLAYER (IEEE802.3 Clause 148) #
- Mail: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/phy/mdio-open-alliance.h,net/ethtool/plca.c
PLDMFW LIBRARY #
- Mail: Jacob Keller <jacob.e.keller@intel.com>
- Status: Maintained
- Files:
Documentation/driver-api/pldmfw/,include/linux/pldmfw.h,lib/pldmfw/
PLX DMA DRIVER #
- Mail: Logan Gunthorpe <logang@deltatee.com>
- Status: Maintained
- Files:
drivers/dma/plx_dma.c
PM-GRAPH UTILITY #
- Mail: "Todd E Brandt" <todd.e.brandt@linux.intel.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Web-page: https://01.org/pm-graph
- bugs: https://bugzilla.kernel.org/buglist.cgi?component=pm-graph&product=Tools
- SCM: git https://github.com/intel/pm-graph.git
- Files:
tools/power/pm-graph
PM6764TR DRIVER #
- Mail: Charles Hsu <hsu.yungteng@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/pm6764tr.rst,drivers/hwmon/pmbus/pm6764tr.c
PMC SIERRA MaxRAID DRIVER #
- Mailing list: linux-scsi@vger.kernel.org
- Status: Orphan
- Web-page: http://www.pmc-sierra.com/
- Files:
drivers/scsi/pmcraid.*
PMC SIERRA PM8001 DRIVER #
- Mail: Jack Wang <jinpu.wang@cloud.ionos.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/pm8001/
PNI RM3100 IIO DRIVER #
- Mail: Song Qiang <songqiang1304521@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/magnetometer/pni,rm3100.yaml,drivers/iio/magnetometer/rm3100*
PNP SUPPORT #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Mailing list: linux-acpi@vger.kernel.org
- Status: Maintained
- Files:
drivers/pnp/,include/linux/pnp.h
PORTWELL EC DRIVER #
- Mail: Yen-Chi Huang <jesse.huang@portwell.com.tw>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/portwell-ec.c
POSIX CLOCKS and TIMERS #
- Mail: Anna-Maria Behnsen <anna-maria@linutronix.de>, Frederic Weisbecker <frederic@kernel.org>, Thomas Gleixner <tglx@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
- Files:
fs/timerfd.c,include/linux/time_namespace.h,include/linux/timerfd.h,include/uapi/linux/time.h,include/uapi/linux/timerfd.h,include/trace/events/timer*,kernel/time/itimer.c,kernel/time/posix-*,kernel/time/namespace.c
POWER MANAGEMENT CORE #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
- Files:
drivers/base/power/,drivers/powercap/,include/linux/intel_rapl.h,include/linux/pm.h,include/linux/pm_*,include/linux/powercap.h,kernel/configs/nopm.config
POWER SEQUENCING #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
- Files:
Documentation/driver-api/pwrseq.rst,drivers/power/sequencing/,include/linux/pwrseq/
PCIE M.2 POWER SEQUENCING #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-pci@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/connector/pcie-m2-m-connector.yaml,drivers/power/sequencing/pwrseq-pcie-m2.c
POWER STATE COORDINATION INTERFACE (PSCI) #
- Mail: Mark Rutland <mark.rutland@arm.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/psci.yaml,drivers/firmware/psci/,include/linux/psci.h,include/uapi/linux/psci.h
POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS #
- Mail: Sebastian Reichel <sre@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
- Files:
Documentation/ABI/testing/sysfs-class-power,Documentation/devicetree/bindings/power/supply/,drivers/power/supply/,include/linux/power/,include/linux/power_supply.h,tools/testing/selftests/power_supply/
POWERNV OPERATOR PANEL LCD DISPLAY DRIVER #
- Mail: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/char/powernv-op-panel.c
PPP OVER ATM (RFC 2364) #
- Mail: Mitchell Blank Jr <mitch@sfgoth.com>
- Status: Maintained
- Files:
include/uapi/linux/atmppp.h,net/atm/pppoatm.c
PPP OVER ETHERNET #
- Status: Orphan
- Files:
drivers/net/ppp/pppoe.c,drivers/net/ppp/pppox.c
PPP OVER L2TP #
- Mail: James Chapman <jchapman@katalix.com>
- Status: Maintained
- Files:
include/linux/if_pppol2tp.h,include/uapi/linux/if_pppol2tp.h,net/l2tp/l2tp_ppp.c
PPP PROTOCOL DRIVERS AND COMPRESSORS #
- Mailing list: linux-ppp@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/ppp/ppp_*
PPS SUPPORT #
- Mail: Rodolfo Giometti <giometti@enneenne.com>
- Mailing list: linuxpps@ml.enneenne.com (subscribers-only)
- Status: Maintained
- Web-page: http://wiki.enneenne.com/index.php/LinuxPPS_support
- Files:
Documentation/ABI/testing/sysfs-pps,Documentation/ABI/testing/sysfs-pps-gen,Documentation/ABI/testing/sysfs-pps-gen-tio,Documentation/devicetree/bindings/pps/pps-gpio.yaml,Documentation/driver-api/pps.rst,drivers/pps/,include/linux/pps*.h,include/uapi/linux/pps.h,include/uapi/linux/pps_gen.h
PRESSURE STALL INFORMATION (PSI) #
- Mail: Johannes Weiner <hannes@cmpxchg.org>, Suren Baghdasaryan <surenb@google.com>
- Reviewer: Peter Ziljstra <peterz@infradead.org>
- Status: Maintained
- Files:
include/linux/psi*,kernel/sched/psi.c
PROPELLER BUILD #
- Mail: Rong Xu <xur@google.com>, Han Shen <shenhan@google.com>
- Status: Supported
- Files:
Documentation/dev-tools/propeller.rst,scripts/Makefile.propeller
PRINTK #
- Mail: Petr Mladek <pmladek@suse.com>
- Reviewer: Steven Rostedt <rostedt@goodmis.org>, John Ogness <john.ogness@linutronix.de>, Sergey Senozhatsky <senozhatsky@chromium.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
- Files:
Documentation/core-api/printk-basics.rst,include/linux/printk.h,kernel/printk/
PRINTK INDEXING #
- Reviewer: Chris Down <chris@chrisdown.name>
- Status: Maintained
- Files:
Documentation/core-api/printk-index.rst,kernel/printk/index.c - Content regex:
printk_index
PROC FILESYSTEM #
- Mailing list: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/proc.rst,fs/proc/,include/linux/proc_fs.h,tools/testing/selftests/proc/
PROC SYSCTL #
- Mail: Kees Cook <kees@kernel.org>, Joel Granados <joel.granados@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl.git sysctl-next
- Files:
fs/proc/proc_sysctl.c,include/linux/sysctl.h,kernel/sysctl*,tools/testing/selftests/sysctl/*,lib/test_sysctl.c,scripts/check-sysctl-docs
PS3 NETWORK SUPPORT #
- Mail: Geoff Levand <geoff@infradead.org>
- Mailing list: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/net/ethernet/toshiba/ps3_gelic_net.*
PS3 PLATFORM SUPPORT #
- Mail: Geoff Levand <geoff@infradead.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
arch/powerpc/boot/ps3*,arch/powerpc/include/asm/lv1call.h,arch/powerpc/include/asm/ps3*.h,arch/powerpc/platforms/ps3/,drivers/*/ps3*,drivers/ps3/,drivers/rtc/rtc-ps3.c,drivers/usb/host/*ps3.c,sound/ppc/snd_ps3*
PS3VRAM DRIVER #
- Mail: Jim Paris <jim@jtan.com>, Geoff Levand <geoff@infradead.org>
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Maintained
- Files:
drivers/block/ps3vram.c
PSAMPLE PACKET SAMPLING SUPPORT #
- Mail: Yotam Gigi <yotam.gi@gmail.com>
- Status: Maintained
- Files:
include/net/psample.h,include/uapi/linux/psample.h,net/psample
PSE NETWORK DRIVER #
- Mail: Oleksij Rempel <o.rempel@pengutronix.de>, Kory Maincent <kory.maincent@bootlin.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/pse-pd/,drivers/net/pse-pd/,net/ethtool/pse-pd.c
PSP SECURITY PROTOCOL #
- Mail: Daniel Zahka <daniel.zahka@gmail.com>, Jakub Kicinski <kuba@kernel.org>, Willem de Bruijn <willemdebruijn.kernel@gmail.com>
- Files:
Documentation/netlink/specs/psp.yaml,Documentation/networking/psp.rst,include/net/psp/,include/net/psp.h,include/uapi/linux/psp.h,net/psp/ - Content regex:
struct\ psp(_assoc|_dev|hdr)\b
PSTORE FILESYSTEM #
- Mail: Kees Cook <kees@kernel.org>
- Reviewer: Tony Luck <tony.luck@intel.com>, Guilherme G. Piccoli <gpiccoli@igalia.com>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore
- Files:
Documentation/admin-guide/pstore-blk.rst,Documentation/admin-guide/ramoops.rst,Documentation/devicetree/bindings/reserved-memory/ramoops.yaml,drivers/acpi/apei/erst.c,drivers/firmware/efi/efi-pstore.c,fs/pstore/,include/linux/pstore* - Content regex:
\b(pstore|ramoops)
PT5161L HARDWARE MONITOR DRIVER #
- Mail: Cosmo Chou <cosmo.chou@quantatw.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/pt5161l.rst,drivers/hwmon/pt5161l.c
PTP HARDWARE CLOCK SUPPORT #
- Mail: Richard Cochran <richardcochran@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://linuxptp.sourceforge.net/
- Files:
Documentation/ABI/testing/sysfs-ptp,Documentation/driver-api/ptp.rst,drivers/net/phy/dp83640*,drivers/ptp/*,include/linux/ptp_cl* - Content regex:
(?:\b|_)ptp(?:\b|_)
PTP MOCKUP CLOCK SUPPORT #
- Mail: Vladimir Oltean <vladimir.oltean@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/ptp/ptp_mock.c,include/linux/ptp_mock.h
PTP VIRTUAL CLOCK SUPPORT #
- Mail: Yangbo Lu <yangbo.lu@nxp.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/ptp/ptp_vclock.c,net/ethtool/phc_vclocks.c
PTP VMCLOCK SUPPORT #
- Mail: David Woodhouse <dwmw2@infradead.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml,drivers/ptp/ptp_vmclock.c,include/uapi/linux/vmclock-abi.h
PTRACE SUPPORT #
- Mail: Oleg Nesterov <oleg@redhat.com>
- Status: Maintained
- Files:
arch/*/*/ptrace*.c,arch/*/include/asm/ptrace*.h,arch/*/ptrace*.c,include/asm-generic/syscall.h,include/linux/ptrace.h,include/linux/regset.h,include/uapi/linux/ptrace.h,kernel/ptrace.c
PULSE8-CEC DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/cec/usb/pulse8/
PURELIFI PLFXLC DRIVER #
- Mail: Srinivasan Raju <srini.raju@purelifi.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Files:
drivers/net/wireless/purelifi/
PVRUSB2 VIDEO4LINUX DRIVER #
- Mail: Mike Isely <isely@pobox.com>
- Mailing list: pvrusb2@isely.net (subscribers-only), linux-media@vger.kernel.org
- Status: Maintained
- Web-page: http://www.isely.net/pvrusb2/
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/driver-api/media/drivers/pvrusb2*,drivers/media/usb/pvrusb2/
PWC WEBCAM DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/pwc/*,include/trace/events/pwc.h
PWM IR Transmitter #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/irled/pwm-ir-tx.yaml,drivers/media/rc/pwm-ir-tx.c
PWM SUBSYSTEM #
- Mail: Uwe Kleine-König <ukleinek@kernel.org>
- Mailing list: linux-pwm@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.ozlabs.org/project/linux-pwm/list/
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git
- Files:
Documentation/devicetree/bindings/pwm/,Documentation/driver-api/pwm.rst,drivers/pwm/,include/dt-bindings/pwm/,include/linux/pwm.h - Content regex:
pwm_(config|apply_might_sleep|apply_atomic|ops),(devm_)?pwmchip_(add|alloc|remove),pwm_(round|get|set)_waveform
PWM SUBSYSTEM BINDINGS [RUST] #
- Mail: Michal Wilczynski <m.wilczynski@samsung.com>
- Mailing list: linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org
- Status: Maintained
- Files:
rust/helpers/pwm.c,rust/kernel/pwm.rs
PWM SUBSYSTEM DRIVERS [RUST] #
- Reviewer: Michal Wilczynski <m.wilczynski@samsung.com>
- Files:
drivers/pwm/*.rs
PXA GPIO DRIVER #
- Mail: Robert Jarzmik <robert.jarzmik@free.fr>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-pxa.c
PXA MMCI DRIVER #
- Status: Orphan
PXA RTC DRIVER #
- Mail: Robert Jarzmik <robert.jarzmik@free.fr>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Maintained
PXA2xx/PXA3xx SUPPORT #
- Mail: Daniel Mack <daniel@zonque.org>, Haojian Zhuang <haojian.zhuang@gmail.com>, Robert Jarzmik <robert.jarzmik@free.fr>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git https://github.com/hzhuang1/linux.git, git https://github.com/rjarzmik/linux.git
- Files:
arch/arm/boot/dts/intel/pxa/,arch/arm/mach-pxa/,drivers/dma/pxa*,drivers/pcmcia/pxa2xx*,drivers/pinctrl/pxa/,drivers/spi/spi-pxa2xx*,drivers/usb/gadget/udc/pxa2*,include/sound/pxa2xx-lib.h,sound/arm/pxa*,sound/soc/pxa/
QAT DRIVER #
- Mail: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
- Mailing list: qat-linux@intel.com
- Status: Supported
- Files:
drivers/crypto/intel/qat/
QCOM AUDIO (ASoC) DRIVERS #
- Mail: Srinivas Kandagatla <srini@kernel.org>
- Mailing list: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/soc/qcom/qcom,apr*,Documentation/devicetree/bindings/sound/qcom,*,drivers/soc/qcom/apr.c,drivers/soundwire/qcom.c,include/dt-bindings/sound/qcom,wcd93*,sound/soc/codecs/lpass-*.*,sound/soc/codecs/msm8916-wcd-analog.c,sound/soc/codecs/msm8916-wcd-digital.c,sound/soc/codecs/pm4125-sdw.c,sound/soc/codecs/pm4125.*,sound/soc/codecs/wcd-clsh-v2.*,sound/soc/codecs/wcd-mbhc-v2.*,sound/soc/codecs/wcd93*.*,sound/soc/codecs/wsa88*.*,sound/soc/qcom/
QCOM EMBEDDED USB DEBUGGER (EUD) #
- Mail: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-driver-eud,Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml,drivers/usb/misc/qcom_eud.c
QCOM IPA DRIVER #
- Mail: Alex Elder <elder@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ipa/
QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT #
- Mail: Gabriel Somlo <somlo@cmu.edu>, "Michael S. Tsirkin" <mst@redhat.com>
- Mailing list: qemu-devel@nongnu.org
- Status: Maintained
- Files:
drivers/firmware/qemu_fw_cfg.c,include/uapi/linux/qemu_fw_cfg.h
QLOGIC QL41xxx FCOE DRIVER #
- Mail: Saurav Kashyap <skashyap@marvell.com>, Javed Hasan <jhasan@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/qedf/
QLOGIC QL41xxx ISCSI DRIVER #
- Mail: Nilesh Javali <njavali@marvell.com>, Manish Rangankar <mrangankar@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/qedi/
QLOGIC QL4xxx ETHERNET DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/ethernet/qlogic/qed/,drivers/net/ethernet/qlogic/qede/,include/linux/qed/
QLOGIC QL4xxx RDMA DRIVER #
- Mail: Michal Kalderon <mkalderon@marvell.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/hw/qedr/,include/uapi/rdma/qedr-abi.h
QLOGIC QLA1280 SCSI DRIVER #
- Mail: Michael Reed <mdr@sgi.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/scsi/qla1280.[ch]
QLOGIC QLA2XXX FC-SCSI DRIVER #
- Mail: Nilesh Javali <njavali@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/qla2xxx/
QLOGIC QLA3XXX NETWORK DRIVER #
- Mail: GR-Linux-NIC-Dev@marvell.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/qlogic/qla3xxx.*
QLOGIC QLA4XXX iSCSI DRIVER #
- Mail: Nilesh Javali <njavali@marvell.com>, Manish Rangankar <mrangankar@marvell.com>, GR-QLogic-Storage-Upstream@marvell.com
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/qla4xxx/
QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER #
- Mail: Shahed Shaikh <shshaikh@marvell.com>, Manish Chopra <manishc@marvell.com>, GR-Linux-NIC-Dev@marvell.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/qlogic/qlcnic/
QM1D1B0004 MEDIA DRIVER #
- Mail: Akihiro Tsukada <tskd08@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/media/tuners/qm1d1b0004*
QM1D1C0042 MEDIA DRIVER #
- Mail: Akihiro Tsukada <tskd08@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/media/tuners/qm1d1c0042*
QNAP MCU DRIVER #
- Mail: Heiko Stuebner <heiko@sntech.de>
- Status: Maintained
- Files:
drivers/hwmon/qnap-mcu-hwmon.c,drivers/input/misc/qnap-mcu-input.c,drivers/leds/leds-qnap-mcu.c,drivers/mfd/qnap-mcu.c,include/linux/mfd/qnap-mcu.h
QNX4 FILESYSTEM #
- Mail: Anders Larsen <al@alarsen.net>
- Status: Maintained
- Web-page: http://www.alarsen.net/linux/qnx4fs/
- Files:
fs/qnx4/,include/uapi/linux/qnx4_fs.h,include/uapi/linux/qnxtypes.h
QNX6 FILESYSTEM #
- Status: Orphan
- Files:
Documentation/filesystems/qnx6.rst,fs/qnx6/,include/linux/qnx6_fs.h
QORIQ DPAA2 FSL-MC BUS DRIVER #
- Mail: Ioana Ciornei <ioana.ciornei@nxp.com>
- Mailing list: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/stable/sysfs-bus-fsl-mc,Documentation/devicetree/bindings/misc/fsl,qoriq-mc.yaml,Documentation/networking/device_drivers/ethernet/freescale/dpaa2/overview.rst,drivers/bus/fsl-mc/,include/uapi/linux/fsl_mc.h
QT1010 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/qt1010*
QUALCOMM ATH12K WIRELESS DRIVER #
- Mail: Jeff Johnson <jjohnson@kernel.org>
- Mailing list: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org
- Status: Supported
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/ath12k
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git
- Files:
drivers/net/wireless/ath/ath12k/ - Regex:
ath12k
QUALCOMM ATHEROS ATH10K WIRELESS DRIVER #
- Mail: Jeff Johnson <jjohnson@kernel.org>
- Mailing list: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org
- Status: Supported
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git
- Files:
drivers/net/wireless/ath/ath10k/ - Regex:
ath10k
QUALCOMM ATHEROS ATH11K WIRELESS DRIVER #
- Mail: Jeff Johnson <jjohnson@kernel.org>
- Mailing list: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org
- Status: Supported
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/ath11k
- bugs: https://wireless.wiki.kernel.org/en/users/Drivers/ath11k/bugreport
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git
- Files:
drivers/net/wireless/ath/ath11k/ - Regex:
ath11k
QUALCOMM ATHEROS ATH9K WIRELESS DRIVER #
- Mail: Toke Høiland-Jørgensen <toke@toke.dk>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/ath9k
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git
- Files:
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml,drivers/net/wireless/ath/ath9k/
QUALCOMM ATHEROS QCA7K ETHERNET DRIVER #
- Mail: Stefan Wahren <wahrenst@gmx.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/qca,qca7000.yaml,drivers/net/ethernet/qualcomm/qca*
QUALCOMM BAM-DMUX WWAN NETWORK DRIVER #
- Mail: Stephan Gerhold <stephan@gerhold.net>
- Mailing list: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/qcom,bam-dmux.yaml,drivers/net/wwan/qcom_bam_dmux.c
QUALCOMM BLUETOOTH DRIVER #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/bluetooth/qcom,*,drivers/bluetooth/btqca.[ch],drivers/bluetooth/btqcomsmd.c,drivers/bluetooth/hci_qca.c
QUALCOMM CAMERA SUBSYSTEM DRIVER #
- Mail: Robert Foss <rfoss@kernel.org>, Todor Tomov <todor.too@gmail.com>, Bryan O'Donoghue <bryan.odonoghue@linaro.org>
- Reviewer: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/qcom_camss.rst,Documentation/devicetree/bindings/media/qcom,*camss*,drivers/media/platform/qcom/camss/
QUALCOMM CLOCK DRIVERS #
- Mail: Bjorn Andersson <andersson@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git
- Files:
Documentation/devicetree/bindings/clock/qcom,*,drivers/clk/qcom/,include/dt-bindings/clock/qcom,*
QUALCOMM CLOUD AI (QAIC) DRIVER #
- Mail: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
- Reviewer: Carl Vanderlip <carl.vanderlip@oss.qualcomm.com>
- Mailing list: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org
- Status: Supported
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/ABI/testing/sysfs-driver-qaic,Documentation/accel/qaic/,drivers/accel/qaic/,include/uapi/drm/qaic_accel.h
QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER #
- Mail: Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konradybcio@kernel.org>
- Mailing list: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/avs/qcom,cpr.yaml,drivers/pmdomain/qcom/cpr.c
QUALCOMM CPUCP MAILBOX DRIVER #
- Mail: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mailbox/qcom,cpucp-mbox.yaml,drivers/mailbox/qcom-cpucp-mbox.c
QUALCOMM CPUFREQ DRIVER MSM8996/APQ8096 #
- Mail: Ilia Lin <ilia.lin@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml,Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml,drivers/cpufreq/qcom-cpufreq-nvmem.c
QUALCOMM CRYPTO DRIVERS #
- Mail: Thara Gopinath <thara.gopinath@gmail.com>
- Mailing list: linux-crypto@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/qcom-qce.yaml,drivers/crypto/qce/
QUALCOMM EMAC GIGABIT ETHERNET DRIVER #
- Mail: Timur Tabi <timur@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/qualcomm/emac/
QUALCOMM ETHQOS ETHERNET DRIVER #
- Mail: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
- Mailing list: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/qcom,ethqos.yaml,drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
QUALCOMM FASTRPC DRIVER #
- Mail: Srinivas Kandagatla <srini@kernel.org>, Amol Maheshwari <amahesh@qti.qualcomm.com>
- Mailing list: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/misc/qcom,fastrpc.yaml,drivers/misc/fastrpc.c,include/uapi/misc/fastrpc.h
QUALCOMM HEXAGON ARCHITECTURE #
- Mail: Brian Cain <brian.cain@oss.qualcomm.com>
- Mailing list: linux-hexagon@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/bcain/linux.git
- Files:
arch/hexagon/
QUALCOMM HIDMA DRIVER #
- Mail: Sinan Kaya <okaya@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org
- Status: Supported
- Files:
drivers/dma/qcom/hidma*
QUALCOMM I2C QCOM GENI DRIVER #
- Mail: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>, Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
- Mailing list: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml,drivers/i2c/busses/i2c-qcom-geni.c
QUALCOMM I2C CCI DRIVER #
- Mail: Loic Poulain <loic.poulain@oss.qualcomm.com>, Robert Foss <rfoss@kernel.org>
- Mailing list: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml,drivers/i2c/busses/i2c-qcom-cci.c
QUALCOMM INTERCONNECT BWMON DRIVER #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interconnect/qcom,msm8998-bwmon.yaml,drivers/soc/qcom/icc-bwmon.c,drivers/soc/qcom/trace_icc-bwmon.h
QUALCOMM IOMMU #
- Mail: Rob Clark <robin.clark@oss.qualcomm.com>
- Mailing list: iommu@lists.linux.dev, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
drivers/iommu/arm/arm-smmu/qcom_iommu.c,drivers/iommu/arm/arm-smmu/arm-smmu-qcom*,drivers/iommu/msm_iommu*
QUALCOMM IPC ROUTER (QRTR) DRIVER #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
include/trace/events/qrtr.h,include/uapi/linux/qrtr.h,net/qrtr/
QUALCOMM IPCC MAILBOX DRIVER #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml,drivers/mailbox/qcom-ipcc.c,include/dt-bindings/mailbox/qcom-ipcc.h
QUALCOMM IPQ4019 USB PHY DRIVER #
- Mail: Robert Marko <robert.marko@sartura.hr>, Luka Perkov <luka.perkov@sartura.hr>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/qcom-usb-ipq4019-phy.yaml,drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER #
- Mail: Robert Marko <robert.marko@sartura.hr>, Luka Perkov <luka.perkov@sartura.hr>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml,drivers/regulator/vqmmc-ipq4019-regulator.c
QUALCOMM IRIS VIDEO ACCELERATOR DRIVER #
- Mail: Vikash Garodia <vikash.garodia@oss.qualcomm.com>, Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
- Reviewer: Abhinav Kumar <abhinav.kumar@linux.dev>
- Mailing list: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/qcom,*-iris.yaml,drivers/media/platform/qcom/iris/
QUALCOMM NAND CONTROLLER DRIVER #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-mtd@lists.infradead.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mtd/qcom,nandc.yaml,drivers/mtd/nand/raw/qcom_nandc.c
QUALCOMM MEDIA PLATFORM #
- Mail: Bryan O'Donoghue <bod@kernel.org>
- Mailing list: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.linuxtv.org/project/linux-media/list
- SCM: git https://gitlab.freedesktop.org/linux-media/media-committers.git
- Files:
Documentation/devicetree/bindings/media/*qcom*,drivers/media/platform/qcom,include/dt-bindings/media/*qcom*
QUALCOMM SMB CHARGER DRIVER #
- Mail: Casey Connolly <casey.connolly@linaro.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/supply/qcom,pmi8998-charger.yaml,drivers/power/supply/qcom_smbx.c
QUALCOMM PPE DRIVER #
- Mail: Luo Jie <quic_luoj@quicinc.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/net/qcom,ipq9574-ppe.yaml,Documentation/networking/device_drivers/ethernet/qualcomm/ppe/ppe.rst,drivers/net/ethernet/qualcomm/ppe/
QUALCOMM QSEECOM DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
drivers/firmware/qcom/qcom_qseecom.c
QUALCOMM QSEECOM UEFISECAPP DRIVER #
- Mail: Maximilian Luz <luzmaximilian@gmail.com>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
QUALCOMM RMNET DRIVER #
- Mail: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>, Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst,drivers/net/ethernet/qualcomm/rmnet/,include/linux/if_rmnet.h
QUALCOMM TEE (QCOMTEE) DRIVER #
- Mail: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/tee/qtee.rst,drivers/tee/qcomtee/
QUALCOMM TRUST ZONE MEMORY ALLOCATOR #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
drivers/firmware/qcom/qcom_tzmem.c,drivers/firmware/qcom/qcom_tzmem.h,include/linux/firmware/qcom/qcom_tzmem.h
QUALCOMM TSENS THERMAL DRIVER #
- Mail: Amit Kucheria <amitk@kernel.org>, Thara Gopinath <thara.gopinath@gmail.com>
- Mailing list: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml,drivers/thermal/qcom/
QUALCOMM TYPEC PORT MANAGER DRIVER #
- Mail: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
- Mailing list: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/qcom,pmic-*.yaml,drivers/usb/typec/tcpm/qcom/
QUALCOMM VENUS VIDEO ACCELERATOR DRIVER #
- Mail: Vikash Garodia <vikash.garodia@oss.qualcomm.com>, Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
- Mailing list: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/*venus*,drivers/media/platform/qcom/venus/
QUALCOMM WCN36XX WIRELESS DRIVER #
- Mail: Loic Poulain <loic.poulain@oss.qualcomm.com>
- Mailing list: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org
- Status: Supported
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx
- Files:
drivers/net/wireless/ath/wcn36xx/
QUANTENNA QTNFMAC WIRELESS DRIVER #
- Mail: Igor Mitsyanko <imitsyanko@quantenna.com>
- Reviewer: Sergey Matyukevich <geomatsi@gmail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/wireless/quantenna/
RADEON and AMDGPU DRM DRIVERS #
- Mail: Alex Deucher <alexander.deucher@amd.com>, Christian König <christian.koenig@amd.com>
- Mailing list: amd-gfx@lists.freedesktop.org
- Status: Supported
- bugs: https://gitlab.freedesktop.org/drm/amd/-/issues
- chat: irc://irc.oftc.net/radeon
- SCM: git https://gitlab.freedesktop.org/agd5f/linux.git
- Files:
Documentation/gpu/amdgpu/,drivers/gpu/drm/amd/,drivers/gpu/drm/ci/xfails/amd*,drivers/gpu/drm/radeon/,include/uapi/drm/amdgpu_drm.h,include/uapi/drm/radeon_drm.h
RADEON FRAMEBUFFER DISPLAY DRIVER #
- Mail: Benjamin Herrenschmidt <benh@kernel.crashing.org>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/aty/radeon*,include/uapi/linux/radeonfb.h
RADIOSHARK RADIO DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-shark.c
RADIOSHARK2 RADIO DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-shark2.c,drivers/media/radio/radio-tea5777.c
RADOS BLOCK DEVICE (RBD) #
- Mail: Ilya Dryomov <idryomov@gmail.com>
- Reviewer: Dongsheng Yang <dongsheng.yang@linux.dev>
- Mailing list: ceph-devel@vger.kernel.org
- Status: Supported
- Web-page: http://ceph.com/
- bugs: https://tracker.ceph.com/
- SCM: git https://github.com/ceph/ceph-client.git
- Files:
Documentation/ABI/testing/sysfs-bus-rbd,drivers/block/rbd.c,drivers/block/rbd_types.h
RAGE128 FRAMEBUFFER DISPLAY DRIVER #
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/video/fbdev/aty/aty128fb.c
RAINSHADOW-CEC DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/cec/usb/rainshadow/
RALINK MIPS ARCHITECTURE #
- Mail: John Crispin <john@phrozen.org>, Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/ralink
RALINK MT7621 MIPS ARCHITECTURE #
- Mail: Chester A. Unal <chester.a.unal@arinc9.com>, Sergio Paracuellos <sergio.paracuellos@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/boot/dts/ralink/mt7621*
RALINK RT2X00 WIRELESS LAN DRIVER #
- Mail: Stanislaw Gruszka <stf_xl@wp.pl>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/wireless/ralink/
RAMDISK RAM BLOCK DEVICE DRIVER #
- Mail: Jens Axboe <axboe@kernel.dk>
- Status: Maintained
- Files:
Documentation/admin-guide/blockdev/ramdisk.rst,drivers/block/brd.c
RANCHU VIRTUAL BOARD FOR MIPS #
- Mail: Miodrag Dinic <miodrag.dinic@mips.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Supported
- Files:
arch/mips/configs/generic/board-ranchu.config,arch/mips/generic/board-ranchu.c
RANDOM NUMBER DRIVER #
- Mail: "Theodore Ts'o" <tytso@mit.edu>, Jason A. Donenfeld <Jason@zx2c4.com>
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git
- Files:
Documentation/devicetree/bindings/rng/microsoft,vmgenid.yaml,drivers/char/random.c,include/linux/random.h,include/uapi/linux/random.h,drivers/virt/vmgenid.c - Regex:
^.*/vdso/[^/]*getrandom[^/]+$
RAPIDIO SUBSYSTEM #
- Mail: Matt Porter <mporter@kernel.crashing.org>, Alexandre Bounine <alex.bou9@gmail.com>
- Status: Maintained
- Files:
drivers/rapidio/
RAS INFRASTRUCTURE #
- Mail: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/RAS,drivers/ras/,include/linux/ras.h,include/ras/ras_event.h
RAS FRU MEMORY POISON MANAGER (FMPM) #
- Mail: Yazen Ghannam <Yazen.Ghannam@amd.com>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
drivers/ras/amd/fmpm.c
RASPBERRY PI PISP BACK END #
- Mail: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
- Reviewer: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/raspberrypi,pispbe.yaml,drivers/media/platform/raspberrypi/pisp_be/,include/uapi/linux/media/raspberrypi/
RASPBERRY PI PISP CAMERA FRONT END #
- Mail: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>, Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/raspberrypi,rp1-cfe.yaml,drivers/media/platform/raspberrypi/rp1-cfe/
RASPBERRY PI RP1 PCI DRIVER #
- Mail: Andrea della Porta <andrea.porta@suse.com>
- Status: Maintained
- Files:
arch/arm64/boot/dts/broadcom/rp1*.dts*,drivers/clk/clk-rp1.c,drivers/misc/rp1/,drivers/pinctrl/pinctrl-rp1.c
RC-CORE / LIRC FRAMEWORK #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: http://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/driver-api/media/rc-core.rst,Documentation/userspace-api/media/rc/,drivers/media/rc/,include/media/rc-core.h,include/media/rc-map.h,include/uapi/linux/lirc.h
RCMM REMOTE CONTROLS DECODER #
- Mail: Patrick Lerda <patrick9876@free.fr>
- Status: Maintained
- Files:
drivers/media/rc/ir-rcmm-decoder.c
RCUTORTURE TEST FRAMEWORK #
- Mail: "Paul E. McKenney" <paulmck@kernel.org>, Josh Triplett <josh@joshtriplett.org>
- Reviewer: Steven Rostedt <rostedt@goodmis.org>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Lai Jiangshan <jiangshanlai@gmail.com>
- Mailing list: rcu@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
- Files:
tools/testing/selftests/rcutorture
RDACM20 Camera Sensor #
- Mail: Jacopo Mondi <jacopo+renesas@jmondi.org>, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>, Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/imi,rdacm2x-gmsl.yaml,drivers/media/i2c/max9271.c,drivers/media/i2c/max9271.h,drivers/media/i2c/rdacm20.c
RDACM21 Camera Sensor #
- Mail: Jacopo Mondi <jacopo+renesas@jmondi.org>, Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>, Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/imi,rdacm2x-gmsl.yaml,drivers/media/i2c/max9271.c,drivers/media/i2c/max9271.h,drivers/media/i2c/rdacm21.c
RDC R-321X SoC #
- Mail: Florian Fainelli <florian@openwrt.org>
- Status: Maintained
RDC R6040 FAST ETHERNET DRIVER #
- Mail: Florian Fainelli <f.fainelli@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/rdc/r6040.c
RDMAVT - RDMA verbs software #
- Mail: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/sw/rdmavt
RDS - RELIABLE DATAGRAM SOCKETS #
- Mail: Allison Henderson <achender@kernel.org>
- Mailing list: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com (moderated for non-subscribers)
- Status: Supported
- Web-page: https://oss.oracle.com/projects/rds/
- Files:
Documentation/networking/rds.rst,net/rds/,tools/testing/selftests/net/rds/
RDT - RESOURCE ALLOCATION #
- Mail: Tony Luck <tony.luck@intel.com>, Reinette Chatre <reinette.chatre@intel.com>
- Reviewer: Dave Martin <Dave.Martin@arm.com>, James Morse <james.morse@arm.com>, Babu Moger <babu.moger@amd.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
Documentation/filesystems/resctrl.rst,arch/x86/include/asm/resctrl.h,arch/x86/kernel/cpu/resctrl/,fs/resctrl/,include/linux/resctrl*.h,tools/testing/selftests/resctrl/
READ-COPY UPDATE (RCU) #
- Mail: "Paul E. McKenney" <paulmck@kernel.org>, Frederic Weisbecker <frederic@kernel.org> (kernel/rcu/tree_nocb.h), Neeraj Upadhyay <neeraj.upadhyay@kernel.org> (kernel/rcu/tasks.h), Joel Fernandes <joelagnelf@nvidia.com>, Josh Triplett <josh@joshtriplett.org>, Boqun Feng <boqun@kernel.org>, Uladzislau Rezki <urezki@gmail.com>
- Reviewer: Steven Rostedt <rostedt@goodmis.org>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Lai Jiangshan <jiangshanlai@gmail.com>, Zqiang <qiang.zhang@linux.dev>
- Mailing list: rcu@vger.kernel.org
- Status: Supported
- Web-page: http://www.rdrop.com/users/paulmck/RCU/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
- Files:
Documentation/RCU/,include/linux/rcu*,kernel/rcu/,rust/kernel/sync/rcu.rs - Excluded:
Documentation/RCU/torture.rst,include/linux/srcu*.h,kernel/rcu/srcu*.c
REAL TIME CLOCK (RTC) SUBSYSTEM #
- Mail: Alexandre Belloni <alexandre.belloni@bootlin.com>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.ozlabs.org/project/rtc-linux/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git
- Files:
Documentation/admin-guide/rtc.rst,Documentation/devicetree/bindings/rtc/,drivers/rtc/,include/linux/rtc.h,include/linux/rtc/,include/uapi/linux/rtc.h,tools/testing/selftests/rtc/
Real-time Linux Analysis (RTLA) tools #
- Mail: Steven Rostedt <rostedt@goodmis.org>, Tomas Glozar <tglozar@redhat.com>
- Mailing list: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-trace-kernel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
- Files:
Documentation/tools/rtla/,tools/tracing/rtla/
Real-time Linux (PREEMPT_RT) #
- Mail: Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Clark Williams <clrkwllms@kernel.org>, Steven Rostedt <rostedt@goodmis.org>
- Mailing list: linux-rt-devel@lists.linux.dev
- Status: Supported
- Files:
Documentation/core-api/real-time/ - Content regex:
PREEMPT_RT
REALTEK AUDIO CODECS #
- Mail: Oder Chiou <oder_chiou@realtek.com>
- Status: Maintained
- Files:
include/sound/rt*.h,sound/soc/codecs/rt*
REALTEK OTTO WATCHDOG #
- Mail: Sander Vanheule <sander@svanheule.net>
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml,drivers/watchdog/realtek_otto_wdt.c
REALTEK RTL83xx SMI DSA ROUTER CHIPS #
- Mail: Linus Walleij <linusw@kernel.org>, Alvin Šipraga <alsi@bang-olufsen.dk>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/realtek.yaml,drivers/net/dsa/realtek/*
REALTEK SPI-NAND #
- Mail: Chris Packham <chris.packham@alliedtelesis.co.nz>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/realtek,rtl9301-snand.yaml,drivers/spi/spi-realtek-rtl-snand.c
REALTEK SYSTIMER DRIVER #
- Mail: Hao-Wen Ting <haowen.ting@realtek.com>
- Status: Maintained
- Files:
drivers/clocksource/timer-realtek.c
REALTEK WIRELESS DRIVER (rtlwifi family) #
- Mail: Ping-Ke Shih <pkshih@realtek.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/pkshih/rtw.git
- Files:
drivers/net/wireless/realtek/rtlwifi/
REALTEK WIRELESS DRIVER (rtw88) #
- Mail: Ping-Ke Shih <pkshih@realtek.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/pkshih/rtw.git
- Files:
drivers/net/wireless/realtek/rtw88/
REALTEK WIRELESS DRIVER (rtw89) #
- Mail: Ping-Ke Shih <pkshih@realtek.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/pkshih/rtw.git
- Files:
drivers/net/wireless/realtek/rtw89/
REDMIBOOK WMI DRIVERS #
- Mail: Gladyshev Ilya <foxido@foxido.dev>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/redmi-wmi.c
REDPINE WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wireless/rsi/
RELAY #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Jens Axboe <axboe@kernel.dk>, Jason Xing <kernelxing@tencent.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/filesystems/relay.rst,include/linux/relay.h,kernel/relay.c
REGISTER MAP ABSTRACTION #
- Mail: Mark Brown <broonie@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
- Files:
Documentation/devicetree/bindings/regmap/,drivers/base/regmap/,include/linux/regmap.h
REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM #
- Mail: Bjorn Andersson <andersson@kernel.org>, Mathieu Poirier <mathieu.poirier@linaro.org>
- Mailing list: linux-remoteproc@vger.kernel.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
- Files:
Documentation/ABI/testing/sysfs-class-remoteproc,Documentation/devicetree/bindings/remoteproc/,Documentation/staging/remoteproc.rst,drivers/remoteproc/,include/linux/remoteproc.h,include/linux/remoteproc/
REMOTE PROCESSOR MESSAGING (RPMSG) SUBSYSTEM #
- Mail: Bjorn Andersson <andersson@kernel.org>, Mathieu Poirier <mathieu.poirier@linaro.org>
- Mailing list: linux-remoteproc@vger.kernel.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rpmsg-next
- Files:
Documentation/ABI/testing/sysfs-bus-rpmsg,Documentation/staging/rpmsg.rst,drivers/rpmsg/,include/linux/rpmsg.h,include/linux/rpmsg/,include/uapi/linux/rpmsg.h,samples/rpmsg/
REMOTE PROCESSOR MESSAGING (RPMSG) WWAN CONTROL DRIVER #
- Mail: Stephan Gerhold <stephan@gerhold.net>
- Mailing list: netdev@vger.kernel.org, linux-remoteproc@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/wwan/rpmsg_wwan_ctrl.c
RENESAS CLOCK DRIVERS #
- Mail: Geert Uytterhoeven <geert+renesas@glider.be>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git renesas-clk
- Files:
Documentation/devicetree/bindings/clock/renesas,*,drivers/clk/renesas/
RENESAS EMEV2 I2C DRIVER #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/i2c/renesas,iic-emev2.yaml,drivers/i2c/busses/i2c-emev2.c
RENESAS ETHERNET AVB DRIVER #
- Mail: Niklas Söderlund <niklas.soderlund@ragnatech.se>
- Reviewer: Paul Barker <paul@pbarker.dev>
- Mailing list: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/renesas,etheravb.yaml,drivers/net/ethernet/renesas/Kconfig,drivers/net/ethernet/renesas/Makefile,drivers/net/ethernet/renesas/ravb*
RENESAS ETHERNET SWITCH DRIVER #
- Reviewer: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
- Mailing list: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Files:
Documentation/devicetree/bindings/net/renesas,*ether-switch.yaml,drivers/net/ethernet/renesas/Kconfig,drivers/net/ethernet/renesas/Makefile,drivers/net/ethernet/renesas/rcar_gen4*,drivers/net/ethernet/renesas/rswitch*
RENESAS ETHERNET TSN DRIVER #
- Mail: Niklas Söderlund <niklas.soderlund@ragnatech.se>
- Mailing list: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/renesas,ethertsn.yaml,drivers/net/ethernet/renesas/rtsn.*
RENESAS IDT821034 ASoC CODEC #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/renesas,idt821034.yaml,sound/soc/codecs/idt821034.c
RENESAS R-CAR & FSI AUDIO (ASoC) DRIVERS #
- Mail: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
- Mailing list: linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/sound/renesas,rsnd.*,Documentation/devicetree/bindings/sound/renesas,fsi.yaml,sound/soc/renesas/rcar/,sound/soc/renesas/fsi.c,include/sound/sh_fsi.h
RENESAS R-CAR GEN3 & RZ/N1 NAND CONTROLLER DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Mailing list: linux-mtd@lists.infradead.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mtd/renesas-nandc.yaml,drivers/mtd/nand/raw/renesas-nand-controller.c
RENESAS R-CAR GYROADC DRIVER #
- Mail: Marek Vasut <marek.vasut@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml,drivers/iio/adc/rcar-gyroadc.c
RENESAS R-CAR I2C DRIVERS #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/i2c/renesas,rcar-i2c.yaml,Documentation/devicetree/bindings/i2c/renesas,rmobile-iic.yaml,drivers/i2c/busses/i2c-rcar.c,drivers/i2c/busses/i2c-sh_mobile.c
RENESAS R-CAR SATA DRIVER #
- Mail: Geert Uytterhoeven <geert+renesas@glider.be>
- Mailing list: linux-ide@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/ata/renesas,rcar-sata.yaml,drivers/ata/sata_rcar.c
RENESAS R-CAR THERMAL DRIVERS #
- Mail: Niklas Söderlund <niklas.soderlund@ragnatech.se>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.yaml,Documentation/devicetree/bindings/thermal/rcar-thermal.yaml,drivers/thermal/renesas/rcar_gen3_thermal.c,drivers/thermal/renesas/rcar_thermal.c
RENESAS RIIC DRIVER #
- Mail: Chris Brandt <chris.brandt@renesas.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/i2c/renesas,riic.yaml,drivers/i2c/busses/i2c-riic.c
RENESAS RZ AUDIO (ASoC) DRIVER #
- Mail: Biju Das <biju.das.jz@bp.renesas.com>, Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
- Mailing list: linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/sound/renesas,rz-ssi.yaml,sound/soc/renesas/rz-ssi.c
RENESAS RZ/G2L A/D DRIVER #
- Mail: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
- Mailing list: linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml,drivers/iio/adc/rzg2l_adc.c
RENESAS RZ/G2L MTU3a COUNTER DRIVER #
- Mail: Biju Das <biju.das.jz@bp.renesas.com>
- Mailing list: linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/timer/renesas,rz-mtu3.yaml,drivers/counter/rz-mtu3-cnt.c
RENESAS RZ/T2H / RZ/N2H A/D DRIVER #
- Mail: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
- Mailing list: linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/renesas,r9a09g077-adc.yaml,drivers/iio/adc/rzt2h_adc.c
RENESAS RTCA-3 RTC DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
- Mailing list: linux-rtc@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/rtc/renesas,rz-rtca3.yaml,drivers/rtc/rtc-renesas-rtca3.c
RENESAS RZ/N1 A5PSW SWITCH DRIVER #
- Mail: Clément Léger <clement.leger@bootlin.com>
- Mailing list: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml,Documentation/devicetree/bindings/net/pcs/renesas,rzn1-miic.yaml,drivers/net/dsa/rzn1_a5psw*,drivers/net/pcs/pcs-rzn1-miic.c,include/dt-bindings/net/pcs-rzn1-miic.h,include/linux/pcs-rzn1-miic.h,net/dsa/tag_rzn1_a5psw.c
RENESAS RZ/N1 ADC DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml,drivers/iio/adc/rzn1-adc.c
RENESAS RZ/N1 DWMAC GLUE LAYER #
- Mail: Romain Gantois <romain.gantois@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml,drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
RENESAS RZ/N1 RTC CONTROLLER DRIVER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>
- Mailing list: linux-rtc@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rtc/renesas,rzn1-rtc.yaml,drivers/rtc/rtc-rzn1.c
RENESAS RZ/N1 USBF CONTROLLER DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/renesas,rzn1-usbf.yaml,drivers/usb/gadget/udc/renesas_usbf.c
RENESAS RZ/V2H(P) DWMAC GBETH GLUE LAYER DRIVER #
- Mail: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
- Mailing list: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/renesas,rzv2h-gbeth.yaml,drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c
RENESAS RZ/V2H(P) INPUT VIDEO CONTROL BLOCK DRIVER #
- Mail: Daniel Scally <dan.scally@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/renesas,r9a09g057-ivc.yaml,drivers/media/platform/renesas/rzv2h-ivc/
RENESAS RZ/V2H(P) RSPI DRIVER #
- Mail: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
- Mailing list: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml,drivers/spi/spi-rzv2h-rspi.c
RENESAS RZ/V2H(P) USB2PHY PORT RESET DRIVER #
- Mail: Fabrizio Castro <fabrizio.castro.jz@renesas.com>, Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/reset/renesas,rzv2h-usb2phy-reset.yaml,drivers/reset/reset-rzv2h-usb2phy.c
RENESAS RZ/V2M I2C DRIVER #
- Mail: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
- Mailing list: linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml,drivers/i2c/busses/i2c-rzv2m.c
RENESAS SUPERH ETHERNET DRIVER #
- Mail: Niklas Söderlund <niklas.soderlund@ragnatech.se>
- Mailing list: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/renesas,ether.yaml,drivers/net/ethernet/renesas/Kconfig,drivers/net/ethernet/renesas/Makefile,drivers/net/ethernet/renesas/sh_eth*,include/linux/sh_eth.h
RENESAS USB PHY DRIVER #
- Mail: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
- Mailing list: linux-renesas-soc@vger.kernel.org
- Status: Maintained
- Files:
drivers/phy/renesas/phy-rcar-gen3-usb*.c
RENESAS VERSACLOCK 7 CLOCK DRIVER #
- Mail: Alex Helms <alexander.helms.jy@renesas.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/renesas,versaclock7.yaml,drivers/clk/clk-versaclock7.c
RENESAS X9250 DIGITAL POTENTIOMETERS DRIVER #
- Mail: Herve Codina <herve.codina@bootlin.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/potentiometer/renesas,x9250.yaml,drivers/iio/potentiometer/x9250.c
RENESAS RZ/G3E THERMAL SENSOR UNIT DRIVER #
- Mail: John Madieu <john.madieu.xa@bp.renesas.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/renesas,r9a09g047-tsu.yaml,drivers/thermal/renesas/rzg3e_thermal.c
RENESAS RZ/G3S THERMAL SENSOR UNIT DRIVER #
- Mail: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/renesas,r9a08g045-tsu.yaml,drivers/thermal/renesas/rzg3s_thermal.c
RESET CONTROLLER FRAMEWORK #
- Mail: Philipp Zabel <p.zabel@pengutronix.de>
- Status: Maintained
- SCM: git https://git.pengutronix.de/git/pza/linux.git
- Files:
Documentation/devicetree/bindings/reset/,Documentation/driver-api/reset.rst,drivers/reset/,include/dt-bindings/reset/,include/linux/reset-controller.h,include/linux/reset.h,include/linux/reset/ - Content regex:
\b(?:devm_|of_)?reset_control(?:ler_[a-z]+|_[a-z_]+)?\b
RESTARTABLE SEQUENCES SUPPORT #
- Mail: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Peter Zijlstra <peterz@infradead.org>, "Paul E. McKenney" <paulmck@kernel.org>, Boqun Feng <boqun@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
include/trace/events/rseq.h,include/uapi/linux/rseq.h,kernel/rseq.c,tools/testing/selftests/rseq/
RFKILL #
- Mail: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Web-page: https://wireless.wiki.kernel.org/
- Patchwork: https://patchwork.kernel.org/project/linux-wireless/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git, git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
- Files:
Documentation/ABI/stable/sysfs-class-rfkill,Documentation/driver-api/rfkill.rst,include/linux/rfkill.h,include/uapi/linux/rfkill.h,net/rfkill/
RHASHTABLE #
- Mail: Thomas Graf <tgraf@suug.ch>, Herbert Xu <herbert@gondor.apana.org.au>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
include/linux/rhashtable-types.h,include/linux/rhashtable.h,lib/rhashtable.c,lib/test_rhashtable.c
RICOH R5C592 MEMORYSTICK DRIVER #
- Mail: Maxim Levitsky <maximlevitsky@gmail.com>
- Status: Maintained
- Files:
drivers/memstick/host/r592.*
RICOH SMARTMEDIA/XD DRIVER #
- Mail: Maxim Levitsky <maximlevitsky@gmail.com>
- Status: Maintained
- Files:
drivers/mtd/nand/raw/r852.c,drivers/mtd/nand/raw/r852.h
RISC-V AIA DRIVERS #
- Mail: Anup Patel <anup@brainfault.org>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/interrupt-controller/riscv,aplic.yaml,Documentation/devicetree/bindings/interrupt-controller/riscv,imsics.yaml,drivers/irqchip/irq-riscv-aplic-*.c,drivers/irqchip/irq-riscv-aplic-*.h,drivers/irqchip/irq-riscv-imsic-*.c,drivers/irqchip/irq-riscv-imsic-*.h,drivers/irqchip/irq-riscv-intc.c,include/linux/irqchip/riscv-aplic.h,include/linux/irqchip/riscv-imsic.h
RISC-V ANDES SoC Support #
- Mail: Ben Zong-You Xie <ben717@andestech.com>
- Status: Maintained
- SCM: git: https://github.com/ben717-linux/linux
- Files:
Documentation/devicetree/bindings/interrupt-controller/andestech,plicsw.yaml,Documentation/devicetree/bindings/riscv/andes.yaml,Documentation/devicetree/bindings/timer/andestech,plmt0.yaml,arch/riscv/boot/dts/andes/
RISC-V ANLOGIC SoC SUPPORT #
- Mail: Conor Dooley <conor@kernel.org>
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
- Mailing list: linux-riscv@lists.infradead.org
- Status: Odd Fixes
- Files:
Documentation/devicetree/bindings/riscv/anlogic.yaml,arch/riscv/boot/dts/anlogic/
RISC-V ARCHITECTURE #
- Mail: Paul Walmsley <pjw@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>
- Reviewer: Alexandre Ghiti <alex@ghiti.fr>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-riscv/list/
- chat: irc://irc.libera.chat/riscv
- Subsystem Profile: Documentation/arch/riscv/patch-acceptance.rst
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git
- Files:
arch/riscv/ - Regex:
riscv - Content regex:
riscv
RISC-V IOMMU #
- Mail: Tomasz Jeznach <tjeznach@rivosinc.com>
- Mailing list: iommu@lists.linux.dev, linux-riscv@lists.infradead.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
- Files:
Documentation/devicetree/bindings/iommu/riscv,iommu.yaml,drivers/iommu/riscv/
RISC-V MICROCHIP SUPPORT #
- Mail: Conor Dooley <conor.dooley@microchip.com>, Daire McNamara <daire.mcnamara@microchip.com>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Supported
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/ (dts, soc, firmware)
- Files:
Documentation/devicetree/bindings/clock/microchip,mpfs*.yaml,Documentation/devicetree/bindings/gpio/microchip,mpfs-gpio.yaml,Documentation/devicetree/bindings/i2c/microchip,corei2c.yaml,Documentation/devicetree/bindings/mailbox/microchip,mpfs-mailbox.yaml,Documentation/devicetree/bindings/net/can/microchip,mpfs-can.yaml,Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-iomux0.yaml,Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml,Documentation/devicetree/bindings/pinctrl/microchip,pic64gx-pinctrl-gpio2.yaml,Documentation/devicetree/bindings/pwm/microchip,corepwm.yaml,Documentation/devicetree/bindings/riscv/microchip.yaml,Documentation/devicetree/bindings/soc/microchip/microchip,mpfs-sys-controller.yaml,Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml,Documentation/devicetree/bindings/usb/microchip,mpfs-musb.yaml,arch/riscv/boot/dts/microchip/,drivers/char/hw_random/mpfs-rng.c,drivers/clk/microchip/clk-mpfs*.c,drivers/firmware/microchip/mpfs-auto-update.c,drivers/gpio/gpio-mpfs.c,drivers/i2c/busses/i2c-microchip-corei2c.c,drivers/mailbox/mailbox-mpfs.c,drivers/pci/controller/plda/pcie-microchip-host.c,drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c,drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c,drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c,drivers/pwm/pwm-microchip-core.c,drivers/reset/reset-mpfs.c,drivers/rtc/rtc-mpfs.c,drivers/soc/microchip/mpfs-control-scb.c,drivers/soc/microchip/mpfs-mss-top-sysreg.c,drivers/soc/microchip/mpfs-sys-controller.c,drivers/spi/spi-microchip-core-qspi.c,drivers/spi/spi-mpfs.c,drivers/usb/musb/mpfs.c,include/soc/microchip/mpfs.h
RISC-V MISC SOC SUPPORT #
- Mail: Conor Dooley <conor@kernel.org>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Odd Fixes
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
- Files:
arch/riscv/boot/dts/canaan/,arch/riscv/boot/dts/sifive/
RISC-V PMU DRIVERS #
- Mail: Atish Patra <atish.patra@linux.dev>
- Reviewer: Anup Patel <anup@brainfault.org>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Supported
- Files:
drivers/perf/riscv_pmu.c,drivers/perf/riscv_pmu_legacy.c,drivers/perf/riscv_pmu_sbi.c
RISC-V RPMI AND MPXY DRIVERS #
- Mail: Rahul Pathak <rahul@summations.net>, Anup Patel <anup@brainfault.org>
- Mailing list: linux-riscv@lists.infradead.org
- Files:
Documentation/devicetree/bindings/clock/riscv,rpmi-clock.yaml,Documentation/devicetree/bindings/clock/riscv,rpmi-mpxy-clock.yaml,Documentation/devicetree/bindings/interrupt-controller/riscv,rpmi-mpxy-system-msi.yaml,Documentation/devicetree/bindings/interrupt-controller/riscv,rpmi-system-msi.yaml,Documentation/devicetree/bindings/mailbox/riscv,rpmi-shmem-mbox.yaml,Documentation/devicetree/bindings/mailbox/riscv,sbi-mpxy-mbox.yaml,drivers/clk/clk-rpmi.c,drivers/irqchip/irq-riscv-rpmi-sysmsi.c,drivers/mailbox/riscv-sbi-mpxy-mbox.c,include/linux/mailbox/riscv-rpmi-message.h
RISC-V SPACEMIT SoC Support #
- Mail: Yixun Lan <dlan@kernel.org>
- Mailing list: linux-riscv@lists.infradead.org, spacemit@lists.linux.dev
- Status: Maintained
- Web-page: https://github.com/spacemit-com/linux/wiki
- chat: irc://irc.libera.chat/spacemit
- SCM: git https://github.com/spacemit-com/linux
- Files:
arch/riscv/boot/dts/spacemit/ - Regex:
spacemit - Content regex:
spacemit
RISC-V TENSTORRENT SoC SUPPORT #
- Mail: Drew Fustini <dfustini@oss.tenstorrent.com>, Joel Stanley <jms@oss.tenstorrent.com>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Maintained
- SCM: git https://github.com/tenstorrent/linux.git
- Files:
Documentation/devicetree/bindings/riscv/tenstorrent.yaml,arch/riscv/boot/dts/tenstorrent/
RISC-V THEAD SoC SUPPORT #
- Mail: Drew Fustini <fustini@kernel.org>, Guo Ren <guoren@kernel.org>, Fu Wei <wefu@redhat.com>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/riscv-thead/list/
- SCM: git https://github.com/pdp7/linux.git
- Files:
Documentation/devicetree/bindings/clock/thead,th1520-clk-ap.yaml,Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml,Documentation/devicetree/bindings/mailbox/thead,th1520-mbox.yaml,Documentation/devicetree/bindings/net/thead,th1520-gmac.yaml,Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml,Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml,Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml,arch/riscv/boot/dts/thead/,drivers/clk/thead/clk-th1520-ap.c,drivers/firmware/thead,th1520-aon.c,drivers/mailbox/mailbox-th1520.c,drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c,drivers/pinctrl/pinctrl-th1520.c,drivers/pmdomain/thead/,drivers/power/reset/th1520-aon-reboot.c,drivers/power/sequencing/pwrseq-thead-gpu.c,drivers/pwm/pwm_th1520.rs,drivers/reset/reset-th1520.c,include/dt-bindings/clock/thead,th1520-clk-ap.h,include/dt-bindings/power/thead,th1520-power.h,include/dt-bindings/reset/thead,th1520-reset.h,include/linux/firmware/thead/thead,th1520-aon.h
RNBD BLOCK DRIVERS #
- Mail: Md. Haris Iqbal <haris.iqbal@ionos.com>, Jack Wang <jinpu.wang@ionos.com>
- Mailing list: linux-block@vger.kernel.org
- Status: Maintained
- Files:
drivers/block/rnbd/
ROCCAT DRIVERS #
- Mail: Stefan Achatz <erazor_de@users.sourceforge.net>
- Status: Maintained
- Web-page: http://sourceforge.net/projects/roccat/
- Files:
Documentation/ABI/*/sysfs-driver-hid-roccat*,drivers/hid/hid-roccat*,include/linux/hid-roccat*
ROCKCHIP CAN-FD DRIVER #
- Mail: Marc Kleine-Budde <mkl@pengutronix.de>
- Reviewer: kernel@pengutronix.de
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/can/rockchip,rk3568v2-canfd.yaml,drivers/net/can/rockchip/
ROCKCHIP CAMERA INTERFACE (RKCIF) DRIVER #
- Mail: Mehdi Djait <mehdi.djait@linux.intel.com>, Michael Riesch <michael.riesch@collabora.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/rkcif*,Documentation/devicetree/bindings/media/rockchip,px30-vip.yaml,Documentation/devicetree/bindings/media/rockchip,rk3568-vicap.yaml,drivers/media/platform/rockchip/rkcif/
ROCKCHIP CRYPTO DRIVERS #
- Mail: Corentin Labbe <clabbe@baylibre.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml,drivers/crypto/rockchip/
ROCKCHIP I2S TDM DRIVER #
- Mail: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
- Mailing list: linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml,sound/soc/rockchip/rockchip_i2s_tdm.*
ROCKCHIP ISP V1 DRIVER #
- Mail: Dafna Hirschfeld <dafna@fastmail.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/rkisp1.rst,Documentation/devicetree/bindings/media/rockchip-isp1.yaml,Documentation/userspace-api/media/v4l/metafmt-rkisp1.rst,drivers/media/platform/rockchip/rkisp1,include/uapi/linux/rkisp1-config.h
ROCKCHIP RK3568 RANDOM NUMBER GENERATOR SUPPORT #
- Mail: Daniel Golle <daniel@makrotopia.org>, Aurelien Jarno <aurelien@aurel32.net>, Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rng/rockchip,rk3568-rng.yaml,Documentation/devicetree/bindings/rng/rockchip,rk3588-rng.yaml,drivers/char/hw_random/rockchip-rng.c
ROCKCHIP RASTER 2D GRAPHIC ACCELERATION UNIT DRIVER #
- Mail: Jacob Chen <jacob-chen@iotwrt.com>, Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
- Mailing list: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/rockchip-rga.yaml,drivers/media/platform/rockchip/rga/
ROCKCHIP RKVDEC VIDEO DECODER DRIVER #
- Mail: Detlev Casanova <detlev.casanova@collabora.com>, Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
- Mailing list: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/rockchip,vdec.yaml,drivers/media/platform/rockchip/rkvdec/
ROCKCHIP RK3308 INTERNAL AUDIO CODEC #
- Mail: Luca Ceresoli <luca.ceresoli@bootlin.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/rockchip,rk3308-codec.yaml,sound/soc/codecs/rk3308_codec.c,sound/soc/codecs/rk3308_codec.h
ROCKCHIP SAI DRIVER #
- Mail: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
- Mailing list: linux-rockchip@lists.infradead.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/rockchip,rk3576-sai.yaml,sound/soc/rockchip/rockchip_sai.*
ROCKER DRIVER #
- Mail: Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/ethernet/rocker/
ROCKETPORT EXPRESS/INFINITY DRIVER #
- Mail: Kevin Cernekee <cernekee@gmail.com>
- Mailing list: linux-serial@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/tty/serial/rp2.*
ROHM BD71828 CHARGER #
- Mail: Andreas Kemnade <andreas@kemnade.info>, Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Maintained
- Files:
drivers/power/supply/bd71828-power.c
ROHM BD79703 DAC #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Supported
- Files:
drivers/iio/dac/rohm-bd79703.c
ROHM BD99954 CHARGER IC #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Supported
- Files:
drivers/power/supply/bd99954-charger.c,drivers/power/supply/bd99954-charger.h
ROHM BD791xx ADC / GPO IC #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Supported
- Files:
drivers/iio/adc/rohm-bd79112.c,drivers/iio/adc/rohm-bd79124.c
ROHM BH1745 COLOUR SENSOR #
- Mail: Mudit Sharma <muditsharma.info@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
drivers/iio/light/bh1745.c
ROHM BH1750 AMBIENT LIGHT SENSOR DRIVER #
- Mail: Tomasz Duszynski <tduszyns@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/bh1750.yaml,drivers/iio/light/bh1750.c
ROHM BM1390 PRESSURE SENSOR DRIVER #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/iio/pressure/rohm-bm1390.c
ROHM BU270xx LIGHT SENSOR DRIVERs #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
drivers/iio/light/rohm-bu27034.c
ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS #
- Mail: Marek Vasut <marek.vasut+renesas@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mfd/rohm,bd9571mwv.yaml,drivers/gpio/gpio-bd9571mwv.c,drivers/mfd/bd9571mwv.c,drivers/regulator/bd9571mwv-regulator.c,include/linux/mfd/bd9571mwv.h
ROHM POWER MANAGEMENT IC DEVICE DRIVERS #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Supported
- Files:
drivers/clk/clk-bd718x7.c,drivers/gpio/gpio-bd71815.c,drivers/gpio/gpio-bd71828.c,drivers/gpio/gpio-bd72720.c,drivers/mfd/rohm-bd71828.c,drivers/mfd/rohm-bd718x7.c,drivers/mfd/rohm-bd9576.c,drivers/mfd/rohm-bd96801.c,drivers/regulator/bd71815-regulator.c,drivers/regulator/bd71828-regulator.c,drivers/regulator/bd718x7-regulator.c,drivers/regulator/bd9576-regulator.c,drivers/regulator/bd96801-regulator.c,drivers/regulator/rohm-regulator.c,drivers/rtc/rtc-bd70528.c,drivers/watchdog/bd9576_wdt.c,drivers/watchdog/bd96801_wdt.c,include/linux/mfd/rohm-bd71815.h,include/linux/mfd/rohm-bd71828.h,include/linux/mfd/rohm-bd718x7.h,include/linux/mfd/rohm-bd72720.h,include/linux/mfd/rohm-bd957x.h,include/linux/mfd/rohm-bd96801.h,include/linux/mfd/rohm-bd96802.h,include/linux/mfd/rohm-generic.h,include/linux/mfd/rohm-shared.h
ROSE NETWORK LAYER #
- Mailing list: linux-hams@vger.kernel.org
- Status: Orphan
- Web-page: https://linux-ax25.in-berlin.de
- Files:
include/net/rose.h,include/uapi/linux/rose.h,net/rose/
ROTATION DRIVER FOR ALLWINNER A83T #
- Mail: Jernej Skrabec <jernej.skrabec@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yaml,drivers/media/platform/sunxi/sun8i-rotate/
RPMB SUBSYSTEM #
- Mail: Jens Wiklander <jens.wiklander@linaro.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
drivers/misc/rpmb-core.c,include/linux/rpmb.h
RPMSG TTY DRIVER #
- Mail: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
- Mailing list: linux-remoteproc@vger.kernel.org
- Status: Maintained
- Files:
drivers/tty/rpmsg_tty.c
RTASE ETHERNET DRIVER #
- Mail: Justin Lai <justinlai0215@realtek.com>, Larry Chiu <larry.chiu@realtek.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/realtek/rtase/
RTL2830 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/rtl2830*
RTL2832 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/rtl2832*
RTL2832_SDR MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/rtl2832_sdr*
RTL8180 WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wireless/realtek/rtl818x/rtl8180/
RTL8187 WIRELESS DRIVER #
- Mail: Hin-Tak Leung <hintak.leung@gmail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/pkshih/rtw.git
- Files:
drivers/net/wireless/realtek/rtl818x/rtl8187/
RTL8XXXU WIRELESS DRIVER (rtl8xxxu) #
- Mail: Jes Sorensen <Jes.Sorensen@gmail.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/pkshih/rtw.git
- Files:
drivers/net/wireless/realtek/rtl8xxxu/
RTL9300 I2C DRIVER (rtl9300-i2c) #
- Mail: Chris Packham <chris.packham@alliedtelesis.co.nz>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml,drivers/i2c/busses/i2c-rtl9300.c
RTRS TRANSPORT DRIVERS #
- Mail: Md. Haris Iqbal <haris.iqbal@ionos.com>, Jack Wang <jinpu.wang@ionos.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Maintained
- Files:
drivers/infiniband/ulp/rtrs/
RUNTIME VERIFICATION (RV) #
- Mail: Steven Rostedt <rostedt@goodmis.org>, Gabriele Monaco <gmonaco@redhat.com>
- Mailing list: linux-trace-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/trace/rv/,include/linux/rv.h,include/rv/,kernel/trace/rv/,tools/testing/selftests/verification/,tools/verification/
RUST #
- Mail: Miguel Ojeda <ojeda@kernel.org>
- Reviewer: Boqun Feng <boqun@kernel.org>, Gary Guo <gary@garyguo.net>, Björn Roy Baron <bjorn3_gh@protonmail.com>, Benno Lossin <lossin@kernel.org>, Andreas Hindborg <a.hindborg@kernel.org>, Alice Ryhl <aliceryhl@google.com>, Trevor Gross <tmgross@umich.edu>, Danilo Krummrich <dakr@kernel.org>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Supported
- Web-page: https://rust-for-linux.com
- bugs: https://github.com/Rust-for-Linux/linux/issues
- chat: zulip://rust-for-linux.zulipchat.com
- Subsystem Profile: https://rust-for-linux.com/contributing
- SCM: git https://github.com/Rust-for-Linux/linux.git rust-next
- Files:
.clippy.toml,Documentation/rust/,include/trace/events/rust_sample.h,rust/,samples/rust/,scripts/*rust*,tools/testing/selftests/rust/ - Content regex:
\b(?i:rust)\b
RUST [ALLOC] #
- Mail: Danilo Krummrich <dakr@kernel.org>
- Reviewer: Lorenzo Stoakes <ljs@kernel.org>, Vlastimil Babka <vbabka@kernel.org>, Liam R. Howlett <Liam.Howlett@oracle.com>, Uladzislau Rezki <urezki@gmail.com>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/Rust-for-Linux/linux.git alloc-next
- Files:
rust/kernel/alloc.rs,rust/kernel/alloc/
RUST [NUM] #
- Mail: Alexandre Courbot <acourbot@nvidia.com>
- Reviewer: Yury Norov <yury.norov@gmail.com>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Maintained
- Files:
rust/kernel/num.rs,rust/kernel/num/
RUST [PIN-INIT] #
- Mail: Benno Lossin <lossin@kernel.org>, Gary Guo <gary@garyguo.net>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Maintained
- Web-page: https://rust-for-linux.com/pin-init
- bugs: https://github.com/Rust-for-Linux/pin-init/issues
- chat: zulip://rust-for-linux.zulipchat.com
- Subsystem Profile: rust/pin-init/CONTRIBUTING.md
- SCM: git https://github.com/Rust-for-Linux/linux.git pin-init-next
- Files:
rust/kernel/init.rs,rust/pin-init/ - Content regex:
\bpin-init\b|pin_init\b|PinInit
RUST [RUST-ANALYZER] #
- Mail: Tamir Duberstein <tamird@kernel.org>
- Reviewer: Jesung Yang <y.j3ms.n@gmail.com>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/Rust-for-Linux/linux.git rust-analyzer-next
- Files:
scripts/generate_rust_analyzer.py
RXRPC SOCKETS (AF_RXRPC) #
- Mail: David Howells <dhowells@redhat.com>, Marc Dionne <marc.dionne@auristor.com>
- Mailing list: linux-afs@lists.infradead.org
- Status: Supported
- Web-page: https://www.infradead.org/~dhowells/kafs/
- Files:
Documentation/networking/rxrpc.rst,include/keys/rxrpc-type.h,include/net/af_rxrpc.h,include/trace/events/rxrpc.h,include/uapi/linux/rxrpc.h,net/rxrpc/
S3 SAVAGE FRAMEBUFFER DRIVER #
- Mail: Antonino Daplas <adaplas@gmail.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/savage/
S390 ARCHITECTURE #
- Mail: Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>
- Reviewer: Christian Borntraeger <borntraeger@linux.ibm.com>, Sven Schnelle <svens@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git
- Files:
Documentation/driver-api/s390-drivers.rst,Documentation/arch/s390/,arch/s390/,drivers/s390/,drivers/watchdog/diag288_wdt.c
S390 COMMON I/O LAYER #
- Mail: Vineeth Vijayan <vneethv@linux.ibm.com>, Peter Oberparleiter <oberpar@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
drivers/s390/cio/
S390 CRYPTO MODULES, PRNG DRIVER, ARCH RANDOM #
- Mail: Harald Freudenberger <freude@linux.ibm.com>, Holger Dengler <dengler@linux.ibm.com>
- Mailing list: linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org
- Status: Supported
- Files:
arch/s390/crypto/,arch/s390/include/asm/archrandom.h,arch/s390/include/asm/cpacf.h
S390 DASD DRIVER #
- Mail: Stefan Haberland <sth@linux.ibm.com>, Jan Hoeppner <hoeppner@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
block/partitions/ibm.c,drivers/s390/block/dasd*,include/linux/dasd_mod.h
S390 HWRANDOM TRNG DRIVER #
- Mail: Harald Freudenberger <freude@linux.ibm.com>, Holger Dengler <dengler@linux.ibm.com>
- Mailing list: linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org
- Status: Supported
- Files:
drivers/char/hw_random/s390-trng.c
S390 IOMMU (PCI) #
- Mail: Niklas Schnelle <schnelle@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>
- Reviewer: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
drivers/iommu/s390-iommu.c
S390 IUCV NETWORK LAYER #
- Mail: Alexandra Winter <wintera@linux.ibm.com>, Thorsten Winkler <twinkler@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org, netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/s390/net/*iucv*,include/net/iucv/,net/iucv/
S390 MM #
- Mail: Alexander Gordeev <agordeev@linux.ibm.com>, Gerald Schaefer <gerald.schaefer@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git
- Files:
arch/s390/include/asm/pgtable.h,arch/s390/mm
S390 NETWORK DRIVERS #
- Mail: Alexandra Winter <wintera@linux.ibm.com>, Aswin Karuvally <aswin@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org, netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/s390/net/
S390 PCI SUBSYSTEM #
- Mail: Niklas Schnelle <schnelle@linux.ibm.com>, Gerald Schaefer <gerald.schaefer@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
Documentation/arch/s390/pci.rst,arch/s390/pci/,drivers/pci/hotplug/s390_pci_hpc.c
S390 PTP DRIVER #
- Mail: Sven Schnelle <svens@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
drivers/ptp/ptp_s390.c
S390 SCM DRIVER #
- Mail: Vineeth Vijayan <vneethv@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
drivers/s390/block/scm*,drivers/s390/cio/scm.c
S390 VFIO AP DRIVER #
- Mail: Tony Krowiak <akrowiak@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
Documentation/arch/s390/vfio-ap*,drivers/s390/crypto/vfio_ap*
S390 VFIO-CCW DRIVER #
- Mail: Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>
- Reviewer: Halil Pasic <pasic@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org, kvm@vger.kernel.org
- Status: Supported
- Files:
Documentation/arch/s390/vfio-ccw.rst,drivers/s390/cio/vfio_ccw*,include/uapi/linux/vfio_ccw.h
S390 VFIO-PCI DRIVER #
- Mail: Matthew Rosato <mjrosato@linux.ibm.com>, Farhan Ali <alifm@linux.ibm.com>
- Reviewer: Eric Farman <farman@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org, kvm@vger.kernel.org
- Status: Supported
- Files:
arch/s390/kvm/pci*,drivers/vfio/pci/vfio_pci_zdev.c,include/uapi/linux/vfio_zdev.h
S390 ZCRYPT AND PKEY DRIVER AND AP BUS #
- Mail: Harald Freudenberger <freude@linux.ibm.com>, Holger Dengler <dengler@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
arch/s390/include/asm/ap.h,arch/s390/include/asm/pkey.h,arch/s390/include/asm/trace/zcrypt.h,arch/s390/include/uapi/asm/pkey.h,arch/s390/include/uapi/asm/zcrypt.h,drivers/s390/crypto/
S390 ZFCP DRIVER #
- Mail: Nihar Panda <niharp@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org
- Status: Supported
- Files:
drivers/s390/scsi/zfcp_*
SAA6588 RDS RECEIVER DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/saa6588*
SAA7134 VIDEO4LINUX DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/driver-api/media/drivers/saa7134*,drivers/media/pci/saa7134/
SAA7146 VIDEO4LINUX-2 DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/common/saa7146/,drivers/media/pci/saa7146/,include/media/drv-intf/saa7146*
SAFESETID SECURITY MODULE #
- Mail: Micah Morton <mortonm@chromium.org>
- Status: Supported
- Files:
Documentation/admin-guide/LSM/SafeSetID.rst,security/safesetid/
SAMSUNG AUDIO (ASoC) DRIVERS #
- Mail: Sylwester Nawrocki <s.nawrocki@samsung.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- bugs: mailto:linux-samsung-soc@vger.kernel.org
- Files:
Documentation/devicetree/bindings/sound/samsung*,sound/soc/samsung/
SAMSUNG EXYNOS2200 SoC SUPPORT #
- Mail: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/samsung,exynos2200-cmu.yaml,arch/arm64/boot/dts/exynos/exynos2200*,drivers/clk/samsung/clk-exynos2200.c,include/dt-bindings/clock/samsung,exynos2200-cmu.h
SAMSUNG EXYNOS850 SoC SUPPORT #
- Mail: Sam Protsenko <semen.protsenko@linaro.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/samsung,exynos850-clock.yaml,arch/arm64/boot/dts/exynos/exynos850*,drivers/clk/samsung/clk-exynos850.c,include/dt-bindings/clock/exynos850.h
SAMSUNG EXYNOS ACPM MAILBOX PROTOCOL #
- Mail: Tudor Ambarus <tudor.ambarus@linaro.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml,drivers/clk/samsung/clk-acpm.c,drivers/firmware/samsung/exynos-acpm*,include/linux/firmware/samsung/exynos-acpm-protocol.h
SAMSUNG EXYNOS MAILBOX DRIVER #
- Mail: Tudor Ambarus <tudor.ambarus@linaro.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml,drivers/mailbox/exynos-mailbox.c,include/linux/mailbox/exynos-message.h
SAMSUNG EXYNOS PSEUDO RANDOM NUMBER GENERATOR (RNG) DRIVER #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rng/samsung,exynos4-rng.yaml,drivers/crypto/exynos-rng.c
SAMSUNG EXYNOS TRUE RANDOM NUMBER GENERATOR (TRNG) DRIVER #
- Mail: Łukasz Stelmach <l.stelmach@samsung.com>
- Mailing list: linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml,drivers/char/hw_random/exynos-trng.c
SAMSUNG FRAMEBUFFER DRIVER #
- Mail: Jingoo Han <jingoohan1@gmail.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/s3c-fb.c
SAMSUNG GALAXY BOOK DRIVER #
- Mail: Joshua Grisham <josh@joshuagrisham.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/laptops/samsung-galaxybook.rst,drivers/platform/x86/samsung-galaxybook.c
SAMSUNG INTERCONNECT DRIVERS #
- Mail: Sylwester Nawrocki <s.nawrocki@samsung.com>, Artur Świgoń <a.swigon@samsung.com>
- Mailing list: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Supported
- Files:
drivers/interconnect/samsung/
SAMSUNG LAPTOP DRIVER #
- Mail: Corentin Chary <corentin.chary@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/samsung-laptop.c
SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Reviewer: André Draszik <andre.draszik@linaro.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- bugs: mailto:linux-samsung-soc@vger.kernel.org
- Files:
Documentation/devicetree/bindings/clock/samsung,s2mps11.yaml,Documentation/devicetree/bindings/mfd/samsung,s2*.yaml,Documentation/devicetree/bindings/mfd/samsung,s5m*.yaml,Documentation/devicetree/bindings/regulator/samsung,s2m*.yaml,Documentation/devicetree/bindings/regulator/samsung,s5m*.yaml,drivers/clk/clk-s2mps11.c,drivers/mfd/sec*.[ch],drivers/regulator/s2*.c,drivers/regulator/s5m*.c,drivers/rtc/rtc-s5m.c,include/dt-bindings/regulator/samsung,s2m*.h,include/linux/mfd/samsung/
SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER #
- Mail: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
- Mailing list: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/platform/samsung/s3c-camif/,include/media/drv-intf/s3c_camif.h
SAMSUNG S3FWRN5 NFC DRIVER #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml,drivers/nfc/s3fwrn5
SAMSUNG S5C73M3 CAMERA DRIVER #
- Mail: Sylwester Nawrocki <s.nawrocki@samsung.com>, Andrzej Hajda <andrzej.hajda@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/media/samsung,s5c73m3.yaml,drivers/media/i2c/s5c73m3/*
SAMSUNG S5K3M5 CAMERA DRIVER #
- Mail: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media_tree.git
- Files:
Documentation/devicetree/bindings/media/i2c/samsung,s5k3m5.yaml,drivers/media/i2c/s5k3m5.c
SAMSUNG S5K5BAF CAMERA DRIVER #
- Mail: Sylwester Nawrocki <s.nawrocki@samsung.com>, Andrzej Hajda <andrzej.hajda@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
drivers/media/i2c/s5k5baf.c
SAMSUNG S5KJN1 CAMERA DRIVER #
- Mail: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media_tree.git
- Files:
Documentation/devicetree/bindings/media/i2c/samsung,s5kjn1.yaml,drivers/media/i2c/s5kjn1.c
SAMSUNG S5P Security SubSystem (SSS) DRIVER #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>, Vladimir Zapolskiy <vz@mleia.com>
- Mailing list: linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/crypto/samsung-slimsss.yaml,Documentation/devicetree/bindings/crypto/samsung-sss.yaml,drivers/crypto/s5p-sss.c
SAMSUNG S5P/EXYNOS4 SOC SERIES CAMERA SUBSYSTEM DRIVERS #
- Mail: Sylwester Nawrocki <s.nawrocki@samsung.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.linuxtv.org/project/linux-media/list/
- Files:
Documentation/devicetree/bindings/media/samsung,exynos4210-csis.yaml,Documentation/devicetree/bindings/media/samsung,exynos4210-fimc.yaml,Documentation/devicetree/bindings/media/samsung,exynos4212-fimc-is.yaml,Documentation/devicetree/bindings/media/samsung,exynos4212-fimc-lite.yaml,Documentation/devicetree/bindings/media/samsung,fimc.yaml,drivers/media/platform/samsung/exynos4-is/
SAMSUNG SOC CLOCK DRIVERS #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>, Sylwester Nawrocki <s.nawrocki@samsung.com>, Chanwoo Choi <cw00.choi@samsung.com>
- Reviewer: Alim Akhtar <alim.akhtar@samsung.com>
- Mailing list: linux-samsung-soc@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git
- Files:
Documentation/devicetree/bindings/clock/samsung,*.yaml,Documentation/devicetree/bindings/clock/samsung,s3c*,drivers/clk/samsung/,include/dt-bindings/clock/exynos*.h,include/dt-bindings/clock/s5p*.h,include/dt-bindings/clock/samsung,*.h,include/linux/clk/samsung.h
SAMSUNG SPI DRIVERS #
- Mail: Andi Shyti <andi.shyti@kernel.org>
- Reviewer: Tudor Ambarus <tudor.ambarus@linaro.org>
- Mailing list: linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/samsung,spi*.yaml,drivers/spi/spi-s3c*,include/linux/platform_data/spi-s3c64xx.h
SAMSUNG SXGBE DRIVERS #
- Mail: Byungho An <bh74.an@samsung.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/samsung/sxgbe/
SAMSUNG THERMAL DRIVER #
- Mail: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>, Krzysztof Kozlowski <krzk@kernel.org>
- Mailing list: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/thermal/samsung,exynos-thermal.yaml,drivers/thermal/samsung/
SAMSUNG USB2 PHY DRIVER #
- Mail: Sylwester Nawrocki <s.nawrocki@samsung.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/phy/samsung,usb2-phy.yaml,Documentation/driver-api/phy/samsung-usb2.rst,drivers/phy/samsung/phy-exynos4210-usb2.c,drivers/phy/samsung/phy-exynos4x12-usb2.c,drivers/phy/samsung/phy-exynos5250-usb2.c,drivers/phy/samsung/phy-s5pv210-usb2.c,drivers/phy/samsung/phy-samsung-usb2.c,drivers/phy/samsung/phy-samsung-usb2.h
SANCLOUD BEAGLEBONE ENHANCED DEVICE TREE #
- Mail: Paul Barker <paul.barker@sancloud.com>
- Reviewer: Marc Murphy <marc.murphy@sancloud.com>
- Status: Supported
- Files:
arch/arm/boot/dts/ti/omap/am335x-sancloud*
SC1200 WDT DRIVER #
- Mail: Zwane Mwaikambo <zwanem@gmail.com>
- Status: Maintained
- Files:
drivers/watchdog/sc1200wdt.c
SCHEDULER #
- Mail: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Juri Lelli <juri.lelli@redhat.com> (SCHED_DEADLINE), Vincent Guittot <vincent.guittot@linaro.org> (SCHED_NORMAL)
- Reviewer: Dietmar Eggemann <dietmar.eggemann@arm.com> (SCHED_NORMAL), Steven Rostedt <rostedt@goodmis.org> (SCHED_FIFO/SCHED_RR), Ben Segall <bsegall@google.com> (CONFIG_CFS_BANDWIDTH), Mel Gorman <mgorman@suse.de> (CONFIG_NUMA_BALANCING), Valentin Schneider <vschneid@redhat.com> (TOPOLOGY)
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
- Files:
include/linux/preempt.h,include/linux/sched.h,include/linux/wait.h,include/uapi/linux/sched.h,kernel/fork.c,kernel/sched/,tools/sched/
SCHEDULER - SCHED_EXT #
- Reviewer: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>, Andrea Righi <arighi@nvidia.com>, Changwoo Min <changwoo@igalia.com>
- Mailing list: sched-ext@lists.linux.dev
- Status: Maintained
- Web-page: https://github.com/sched-ext/scx
- SCM: git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
- Files:
include/linux/sched/ext.h,kernel/sched/ext*,tools/sched_ext/,tools/testing/selftests/sched_ext
SCIOSENSE ENS160 MULTI-GAS SENSOR DRIVER #
- Mail: Gustavo Silva <gustavograzs@gmail.com>
- Status: Maintained
- Files:
drivers/iio/chemical/ens160_core.c,drivers/iio/chemical/ens160_i2c.c,drivers/iio/chemical/ens160_spi.c,drivers/iio/chemical/ens160.h
SCSI LIBSAS SUBSYSTEM #
- Reviewer: John Garry <john.g.garry@oracle.com>, Jason Yan <yanaijie@huawei.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
Documentation/scsi/libsas.rst,drivers/scsi/libsas/,include/scsi/libsas.h,include/scsi/sas_ata.h
SCSI RDMA PROTOCOL (SRP) INITIATOR #
- Mail: Bart Van Assche <bvanassche@acm.org>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Patchwork: http://patchwork.kernel.org/project/linux-rdma/list/
- Files:
drivers/infiniband/ulp/srp/,include/scsi/srp.h
SCSI RDMA PROTOCOL (SRP) TARGET #
- Mail: Bart Van Assche <bvanassche@acm.org>
- Mailing list: linux-rdma@vger.kernel.org, target-devel@vger.kernel.org
- Status: Supported
- Patchwork: http://patchwork.kernel.org/project/linux-rdma/list/
- Files:
drivers/infiniband/ulp/srpt/
SCSI SG DRIVER #
- Mail: Doug Gilbert <dgilbert@interlog.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Web-page: http://sg.danny.cz/sg
- Files:
Documentation/scsi/scsi-generic.rst,drivers/scsi/sg.c,include/scsi/sg.h
SCSI SUBSYSTEM #
- Mail: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>, "Martin K. Petersen" <martin.petersen@oracle.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-scsi/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git, git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
- Files:
Documentation/devicetree/bindings/scsi/,drivers/scsi/,drivers/ufs/,include/scsi/,include/uapi/scsi/,include/ufs/
SCSI TAPE DRIVER #
- Mail: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/scsi/st.rst,drivers/scsi/st.*,drivers/scsi/st_*.h
SCSI TARGET CORE USER DRIVER #
- Mail: Bodo Stroesser <bostroesser@gmail.com>
- Mailing list: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
- Status: Supported
- Files:
Documentation/target/tcmu-design.rst,drivers/target/target_core_user.c,include/uapi/linux/target_core_user.h
SCSI TARGET SUBSYSTEM #
- Mail: "Martin K. Petersen" <martin.petersen@oracle.com>
- Mailing list: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/target-devel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
- Files:
Documentation/target/,drivers/target/,include/target/
SCTP PROTOCOL #
- Mail: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>, Xin Long <lucien.xin@gmail.com>
- Mailing list: linux-sctp@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/sctp/lksctp-tools/wiki
- Files:
Documentation/networking/sctp.rst,include/linux/sctp.h,include/net/sctp/,include/uapi/linux/sctp.h,net/sctp/
SCx200 CPU SUPPORT #
- Mail: Jim Cromie <jim.cromie@gmail.com>
- Status: Odd Fixes
- Files:
Documentation/i2c/busses/scx200_acb.rst,arch/x86/platform/scx200/,drivers/i2c/busses/scx200*,drivers/mtd/maps/scx200_docflash.c,drivers/watchdog/scx200_wdt.c,include/linux/scx200.h
SCx200 GPIO DRIVER #
- Mail: Jim Cromie <jim.cromie@gmail.com>
- Status: Maintained
- Files:
drivers/char/scx200_gpio.c,include/linux/scx200_gpio.h
SCx200 HRT CLOCKSOURCE DRIVER #
- Mail: Jim Cromie <jim.cromie@gmail.com>
- Status: Maintained
- Files:
drivers/clocksource/scx200_hrt.c
SDCA LIBRARY AND CLASS DRIVER #
- Mail: Charles Keepax <ckeepax@opensource.cirrus.com>, Maciej Strozek <mstrozek@opensource.cirrus.com>
- Reviewer: Bard Liao <yung-chuan.liao@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
- Mailing list: linux-sound@vger.kernel.org, patches@opensource.cirrus.com
- Status: Maintained
- Files:
include/sound/sdca*,sound/soc/sdca/*
SDRICOH_CS MMC/SD HOST CONTROLLER INTERFACE DRIVER #
- Mail: Sascha Sommer <saschasommer@freenet.de>
- Mailing list: sdricohcs-devel@lists.sourceforge.net (subscribers-only)
- Status: Maintained
- Files:
drivers/mmc/host/sdricoh_cs.c
SECO BOARDS CEC DRIVER #
- Mail: Ettore Chimenti <ek5.chimenti@gmail.com>
- Status: Maintained
- Files:
drivers/media/cec/platform/seco/seco-cec.c,drivers/media/cec/platform/seco/seco-cec.h
SECURE COMPUTING #
- Mail: Kees Cook <kees@kernel.org>
- Reviewer: Andy Lutomirski <luto@amacapital.net>, Will Drewry <wad@chromium.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/seccomp
- Files:
Documentation/userspace-api/seccomp_filter.rst,include/linux/seccomp.h,include/uapi/linux/seccomp.h,kernel/seccomp.c,tools/testing/selftests/kselftest_harness.h,tools/testing/selftests/kselftest_harness/,tools/testing/selftests/seccomp/* - Content regex:
\bsecure_computing,\bTIF_SECCOMP\b
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) Broadcom BRCMSTB DRIVER #
- Mail: Kamal Dasu <kamal.dasu@broadcom.com>, Al Cooper <alcooperx@gmail.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-brcmstb*
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER #
- Mail: Adrian Hunter <adrian.hunter@intel.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/mmc/sdhci-common.yaml,drivers/mmc/host/sdhci*
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) MICROCHIP DRIVER #
- Mail: Aubin Constans <aubin.constans@microchip.com>
- Reviewer: Eugen Hristev <eugen.hristev@collabora.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Supported
- Files:
drivers/mmc/host/sdhci-of-at91.c
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) NXP i.MX DRIVER #
- Mail: Haibo Chen <haibo.chen@nxp.com>
- Mailing list: imx@lists.linux.dev, linux-mmc@vger.kernel.org, s32@nxp.com
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-esdhc-imx.c
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER #
- Mail: Ben Dooks <ben-linux@fluff.org>, Jaehoon Chung <jh80.chung@samsung.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-s3c*
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER #
- Mail: Viresh Kumar <vireshk@kernel.org>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-spear.c
SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) TI OMAP DRIVER #
- Mail: Vignesh Raghavendra <vigneshr@ti.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-omap.c
SECURE ENCRYPTING DEVICE (SED) OPAL DRIVER #
- Mail: Jonathan Derrick <jonathan.derrick@linux.dev>
- Mailing list: linux-block@vger.kernel.org
- Status: Supported
- Files:
block/opal_proto.h,block/sed*,include/linux/sed*,include/uapi/linux/sed*
SECURE MONITOR CALL(SMC) CALLING CONVENTION (SMCCC) #
- Mail: Mark Rutland <mark.rutland@arm.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>, Sudeep Holla <sudeep.holla@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/firmware/smccc/,include/linux/arm-smccc.h
SECURITY CONTACT #
- Mail: Security Officers <security@kernel.org>
- Status: Supported
- Files:
Documentation/process/security-bugs.rst
SECURITY SUBSYSTEM #
- Mail: Paul Moore <paul@paul-moore.com>, James Morris <jmorris@namei.org>, "Serge E. Hallyn" <serge@hallyn.com>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-security-module/list
- bugs: mailto:linux-security-module@vger.kernel.org
- Subsystem Profile: https://github.com/LinuxSecurityModule/kernel/blob/main/README.md
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git
- Files:
include/linux/lsm/,include/linux/lsm_audit.h,include/linux/lsm_hook_defs.h,include/linux/lsm_hooks.h,include/linux/security.h,include/uapi/linux/lsm.h,security/,tools/testing/selftests/lsm/,rust/kernel/security.rs - Excluded:
security/selinux/ - Content regex:
\bsecurity_[a-z_0-9]\+\b
SELINUX SECURITY MODULE #
- Mail: Paul Moore <paul@paul-moore.com>, Stephen Smalley <stephen.smalley.work@gmail.com>
- Reviewer: Ondrej Mosnacek <omosnace@redhat.com>
- Mailing list: selinux@vger.kernel.org
- Status: Supported
- Web-page: https://github.com/SELinuxProject
- Patchwork: https://patchwork.kernel.org/project/selinux/list
- bugs: mailto:selinux@vger.kernel.org
- Subsystem Profile: https://github.com/SELinuxProject/selinux-kernel/blob/main/README.md
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git
- Files:
Documentation/ABI/removed/sysfs-selinux-checkreqprot,Documentation/ABI/removed/sysfs-selinux-disable,Documentation/admin-guide/LSM/SELinux.rst,include/trace/events/avc.h,include/uapi/linux/selinux_netlink.h,scripts/selinux/,security/selinux/
SENSABLE PHANTOM #
- Mail: Jiri Slaby <jirislaby@kernel.org>
- Status: Maintained
- Files:
drivers/misc/phantom.c,include/uapi/linux/phantom.h
SENSEAIR SUNRISE 006-0-0007 #
- Mail: Jacopo Mondi <jacopo@jmondi.org>
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-iio-chemical-sunrise-co2,Documentation/devicetree/bindings/iio/chemical/senseair,sunrise.yaml,drivers/iio/chemical/sunrise_co2.c
SENSIRION SCD30 CARBON DIOXIDE SENSOR DRIVER #
- Mail: Tomasz Duszynski <tomasz.duszynski@octakon.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/chemical/sensirion,scd30.yaml,drivers/iio/chemical/scd30.h,drivers/iio/chemical/scd30_core.c,drivers/iio/chemical/scd30_i2c.c,drivers/iio/chemical/scd30_serial.c
SENSIRION SCD4X CARBON DIOXIDE SENSOR DRIVER #
- Mail: Roan van Dijk <roan@protonic.nl>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/chemical/sensirion,scd4x.yaml,drivers/iio/chemical/scd4x.c
SENSIRION SDP500 DIFFERENTIAL PRESSURE SENSOR DRIVER #
- Mail: Petar Stoykov <petar.stoykov@prodrive-technologies.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/pressure/sensirion,sdp500.yaml,drivers/iio/pressure/sdp500.c
SENSIRION SGP40 GAS SENSOR DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-iio-chemical-sgp40,drivers/iio/chemical/sgp40.c
SENSIRION SPS30 AIR POLLUTION SENSOR DRIVER #
- Mail: Tomasz Duszynski <tduszyns@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/chemical/sensirion,sps30.yaml,drivers/iio/chemical/sps30.c,drivers/iio/chemical/sps30_i2c.c,drivers/iio/chemical/sps30_serial.c
SERIAL DEVICE BUS #
- Mail: Rob Herring <robh@kernel.org>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/serial/serial.yaml,drivers/tty/serdev/,include/linux/serdev.h
SERIAL IR RECEIVER #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/rc/serial_ir.c
SERIAL LOW-POWER INTER-CHIP MEDIA BUS (SLIMbus) #
- Mail: Srinivas Kandagatla <srini@kernel.org>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/slimbus/,Documentation/driver-api/slimbus.rst,drivers/slimbus/,include/linux/slimbus.h
SFC NETWORK DRIVER #
- Mail: Edward Cree <ecree.xilinx@gmail.com>
- Mailing list: netdev@vger.kernel.org, linux-net-drivers@amd.com
- Status: Maintained
- Files:
Documentation/networking/devlink/sfc.rst,drivers/net/ethernet/sfc/
SFCTEMP HWMON DRIVER #
- Mail: Emil Renner Berthing <kernel@esmil.dk>, Hal Feng <hal.feng@starfivetech.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml,Documentation/hwmon/sfctemp.rst,drivers/hwmon/sfctemp.c
SFF/SFP/SFP+ MODULE SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/sff,sfp.yaml,drivers/net/phy/phylink.c,drivers/net/phy/sfp*,include/linux/mdio/mdio-i2c.h,include/linux/phylink.h,include/linux/sfp.h - Content regex:
phylink\.h|struct\s+phylink|\.phylink|>phylink_|phylink_(autoneg|clear|connect|create|destroy|disconnect|ethtool|helper|mac|mii|of|set|start|stop|test|validate)
SGI GRU DRIVER #
- Mail: Dimitri Sivanich <dimitri.sivanich@hpe.com>
- Status: Maintained
- Files:
drivers/misc/sgi-gru/
SGI XP/XPC/XPNET DRIVER #
- Mail: Robin Holt <robinmholt@gmail.com>, Steve Wahl <steve.wahl@hpe.com>
- Status: Maintained
- Files:
drivers/misc/sgi-xp/
SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS #
- Mail: D. Wythe <alibuda@linux.alibaba.com>, Dust Li <dust.li@linux.alibaba.com>, Sidraya Jayagond <sidraya@linux.ibm.com>, Wenjia Zhang <wenjia@linux.ibm.com>
- Reviewer: Mahanta Jambigi <mjambigi@linux.ibm.com>, Tony Lu <tonylu@linux.alibaba.com>, Wen Gu <guwen@linux.alibaba.com>
- Mailing list: linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org
- Status: Supported
- Files:
net/smc/
SHARP GP2AP002A00F/GP2AP002S00F SENSOR DRIVER #
- Mail: Linus Walleij <linusw@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
- Files:
Documentation/devicetree/bindings/iio/light/sharp,gp2ap002.yaml,drivers/iio/light/gp2ap002.c
SHARP RJ54N1CB0C SENSOR DRIVER #
- Mail: Jacopo Mondi <jacopo@jmondi.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/rj54n1cb0c.c,include/media/i2c/rj54n1cb0c.h
SHRINKER #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Dave Chinner <david@fromorbit.com>
- Reviewer: Qi Zheng <zhengqi.arch@bytedance.com>, Roman Gushchin <roman.gushchin@linux.dev>, Muchun Song <muchun.song@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/admin-guide/mm/shrinker_debugfs.rst,include/linux/list_lru.h,include/linux/shrinker.h,mm/list_lru.c,mm/shrinker.c,mm/shrinker_debug.c
SH_VOU V4L2 OUTPUT DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Files:
drivers/media/platform/renesas/sh_vou.c,include/media/drv-intf/sh_vou.h
SI2157 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/si2157*
SI2165 MEDIA DRIVER #
- Mail: Matthias Schwarzott <zzam@gentoo.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/si2165*
SI2168 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/si2168*
SI470X FM RADIO RECEIVER I2C DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/silabs,si470x.yaml,drivers/media/radio/si470x/radio-si470x-i2c.c
SI470X FM RADIO RECEIVER USB DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/si470x/radio-si470x-common.c,drivers/media/radio/si470x/radio-si470x-usb.c,drivers/media/radio/si470x/radio-si470x.h
SI4713 FM RADIO TRANSMITTER I2C DRIVER #
- Mail: Eduardo Valentin <edubezval@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/si4713/si4713.?
SI4713 FM RADIO TRANSMITTER PLATFORM DRIVER #
- Mail: Eduardo Valentin <edubezval@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/si4713/radio-platform-si4713.c
SI4713 FM RADIO TRANSMITTER USB DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/si4713/radio-usb-si4713.c
SIANO DVB DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/common/siano/,drivers/media/mmc/siano/,drivers/media/usb/siano/,drivers/media/usb/siano/
SIEMENS IPC LED DRIVERS #
- Mail: Bao Cheng Su <baocheng.su@siemens.com>, Benedikt Niedermayr <benedikt.niedermayr@siemens.com>, Tobias Schaffner <tobias.schaffner@siemens.com>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
drivers/leds/simatic/
SIEMENS IPC PLATFORM DRIVERS #
- Mail: Bao Cheng Su <baocheng.su@siemens.com>, Benedikt Niedermayr <benedikt.niedermayr@siemens.com>, Tobias Schaffner <tobias.schaffner@siemens.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/siemens/,include/linux/platform_data/x86/simatic-ipc-base.h,include/linux/platform_data/x86/simatic-ipc.h
SIEMENS IPC WATCHDOG DRIVERS #
- Mail: Bao Cheng Su <baocheng.su@siemens.com>, Benedikt Niedermayr <benedikt.niedermayr@siemens.com>, Tobias Schaffner <tobias.schaffner@siemens.com>
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Maintained
- Files:
drivers/watchdog/simatic-ipc-wdt.c
SIFIVE DRIVERS #
- Mail: Paul Walmsley <pjw@kernel.org>, Samuel Holland <samuel.holland@sifive.com>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Supported
- Files:
drivers/dma/sf-pdma/ - Regex:
sifive - Content regex:
fu[57]40,[^@]sifive
SILEAD TOUCHSCREEN DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touchscreen/silead.c,drivers/platform/x86/touchscreen_dmi.c
SILICON LABS WIRELESS DRIVERS (for WFxxx series) #
- Mail: Jérôme Pouiller <jerome.pouiller@silabs.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml,drivers/net/wireless/silabs/
SILICON MOTION SM712 FRAME BUFFER DRIVER #
- Mail: Sudip Mukherjee <sudipm.mukherjee@gmail.com>, Teddy Wang <teddy.wang@siliconmotion.com>, Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/fb/sm712fb.rst,drivers/video/fbdev/sm712*
SILVACO I3C DUAL-ROLE MASTER #
- Mail: Miquel Raynal <miquel.raynal@bootlin.com>, Frank Li <Frank.Li@nxp.com>
- Mailing list: linux-i3c@lists.infradead.org (moderated for non-subscribers), imx@lists.linux.dev
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i3c/silvaco,i3c-master.yaml,drivers/i3c/master/svc-i3c-master.c
SIMPLEFB FB DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/simple-framebuffer.yaml,drivers/video/fbdev/simplefb.c,include/linux/platform_data/simplefb.h
SIOX #
- Mail: Thorsten Scherer <t.scherer@eckelmann.de>
- Reviewer: Pengutronix Kernel Team <kernel@pengutronix.de>
- Status: Supported
- Files:
drivers/gpio/gpio-siox.c,drivers/siox/*,include/trace/events/siox.h
SIPHASH PRF ROUTINES #
- Mail: Jason A. Donenfeld <Jason@zx2c4.com>
- Status: Maintained
- Files:
include/linux/siphash.h,lib/siphash.c,lib/tests/siphash_kunit.c
SIS 190 ETHERNET DRIVER #
- Mail: Francois Romieu <romieu@fr.zoreil.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/sis/sis190.c
SIS 900/7016 FAST ETHERNET DRIVER #
- Mail: Daniele Venzano <venza@brownhat.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.brownhat.org/sis900.html
- Files:
drivers/net/ethernet/sis/sis900.*
SIS FRAMEBUFFER DRIVER #
- Status: Orphan
- Files:
Documentation/fb/sisfb.rst,drivers/video/fbdev/sis/,include/video/sisfb.h
SIS I2C TOUCHSCREEN DRIVER #
- Mail: Mika Penttilä <mpenttil@redhat.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/touchscreen/sis_i2c.txt,drivers/input/touchscreen/sis_i2c.c
SIS USB2VGA DRIVER #
- Mail: Thomas Winischhofer <thomas@winischhofer.net>
- Status: Maintained
- Web-page: http://www.winischhofer.at/linuxsisusbvga.shtml
- Files:
drivers/usb/misc/sisusbvga/
SL28 CPLD MFD DRIVER #
- Mail: Michael Walle <mwalle@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/embedded-controller/kontron,sl28cpld.yaml,Documentation/devicetree/bindings/gpio/kontron,sl28cpld-gpio.yaml,Documentation/devicetree/bindings/hwmon/kontron,sl28cpld-hwmon.yaml,Documentation/devicetree/bindings/interrupt-controller/kontron,sl28cpld-intc.yaml,Documentation/devicetree/bindings/pwm/kontron,sl28cpld-pwm.yaml,Documentation/devicetree/bindings/watchdog/kontron,sl28cpld-wdt.yaml,drivers/gpio/gpio-sl28cpld.c,drivers/hwmon/sl28cpld-hwmon.c,drivers/irqchip/irq-sl28cpld.c,drivers/pwm/pwm-sl28cpld.c,drivers/watchdog/sl28cpld_wdt.c
SL28 VPD NVMEM LAYOUT DRIVER #
- Mail: Michael Walle <mwalle@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml,drivers/nvmem/layouts/sl28vpd.c
SLAB ALLOCATOR #
- Mail: Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>, Andrew Morton <akpm@linux-foundation.org>
- Reviewer: Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>, David Rientjes <rientjes@google.com>, Roman Gushchin <roman.gushchin@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git
- Files:
Documentation/admin-guide/mm/slab.rst,Documentation/mm/slab.rst,include/linux/mempool.h,include/linux/slab.h,mm/failslab.c,mm/mempool.c,mm/slab.h,mm/slab_common.c,mm/slub.c
SLCAN CAN NETWORK DRIVER #
- Mail: Dario Binacchi <dario.binacchi@amarulasolutions.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/can/slcan/
SLEEPABLE READ-COPY UPDATE (SRCU) #
- Mail: Lai Jiangshan <jiangshanlai@gmail.com>, "Paul E. McKenney" <paulmck@kernel.org>, Josh Triplett <josh@joshtriplett.org>
- Reviewer: Steven Rostedt <rostedt@goodmis.org>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- Mailing list: rcu@vger.kernel.org
- Status: Supported
- Web-page: http://www.rdrop.com/users/paulmck/RCU/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
- Files:
include/linux/srcu*.h,kernel/rcu/srcu*.c
SMACK SECURITY MODULE #
- Mail: Casey Schaufler <casey@schaufler-ca.com>
- Mailing list: linux-security-module@vger.kernel.org
- Status: Maintained
- Web-page: http://schaufler-ca.com
- SCM: git https://github.com/cschaufler/smack-next.git
- Files:
Documentation/admin-guide/LSM/Smack.rst,security/smack/
SMC91x ETHERNET DRIVER #
- Mail: Nicolas Pitre <nico@fluxnic.net>
- Status: Odd Fixes
- Files:
drivers/net/ethernet/smsc/smc91x.*
SMSC EMC2103 HARDWARE MONITOR DRIVER #
- Mail: Steve Glendinning <steve.glendinning@shawell.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/emc2103.rst,drivers/hwmon/emc2103.c
SMSC SCH5627 HARDWARE MONITOR DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Supported
- Files:
Documentation/hwmon/sch5627.rst,drivers/hwmon/sch5627.c
SMSC UFX6000 and UFX7000 USB to VGA DRIVER #
- Mail: Steve Glendinning <steve.glendinning@shawell.net>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/smscufx.c
SMSC47B397 HARDWARE MONITOR DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/smsc47b397.rst,drivers/hwmon/smsc47b397.c
SMSC911x ETHERNET DRIVER #
- Mail: Steve Glendinning <steve.glendinning@shawell.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/smsc/smsc911x.*,include/linux/smsc911x.h
SMSC9420 PCI ETHERNET DRIVER #
- Mail: Steve Glendinning <steve.glendinning@shawell.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/smsc/smsc9420.*
SNET DPU VIRTIO DATA PATH ACCELERATOR #
- Reviewer: Alvaro Karsz <alvaro.karsz@solid-run.com>
- Files:
drivers/vdpa/solidrun/
SOCIONEXT (SNI) AVE NETWORK DRIVER #
- Mail: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/socionext,uniphier-ave4.yaml,drivers/net/ethernet/socionext/sni_ave.c
SOCIONEXT (SNI) NETSEC NETWORK DRIVER #
- Mail: Ilias Apalodimas <ilias.apalodimas@linaro.org>, Masahisa Kojima <kojima.masahisa@socionext.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/socionext,synquacer-netsec.yaml,drivers/net/ethernet/socionext/netsec.c
SOCIONEXT (SNI) Synquacer SPI DRIVER #
- Mail: Masahisa Kojima <masahisa.kojima@linaro.org>, Jassi Brar <jaswinder.singh@linaro.org>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/socionext,synquacer-spi.yaml,drivers/spi/spi-synquacer.c
SOCIONEXT SYNQUACER I2C DRIVER #
- Mail: Ard Biesheuvel <ardb@kernel.org>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/socionext,synquacer-i2c.yaml,drivers/i2c/busses/i2c-synquacer.c
SOCIONEXT UNIPHIER SOUND DRIVER #
- Mailing list: linux-sound@vger.kernel.org
- Status: Orphan
- Files:
sound/soc/uniphier/
SOCKET TIMESTAMPING #
- Mail: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
- Reviewer: Jason Xing <kernelxing@tencent.com>
- Status: Maintained
- Files:
Documentation/networking/timestamping.rst,include/linux/net_tstamp.h,include/uapi/linux/net_tstamp.h,tools/testing/selftests/bpf/*/net_timestamping*,tools/testing/selftests/net/*timestamp*,tools/testing/selftests/net/so_txtime.c
SOEKRIS NET48XX LED SUPPORT #
- Mail: Chris Boot <bootc@bootc.net>
- Status: Maintained
- Files:
drivers/leds/leds-net48xx.c
SOFT-IWARP DRIVER (siw) #
- Mail: Bernard Metzler <bernard.metzler@linux.dev>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/sw/siw/,include/uapi/rdma/siw-abi.h
SOFT-ROCE DRIVER (rxe) #
- Mail: Zhu Yanjun <zyjzyj2000@gmail.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/sw/rxe/,include/uapi/rdma/rdma_user_rxe.h
SOFTLOGIC 6x10 MPEG CODEC #
- Mail: Bluecherry Maintainers <maintainers@bluecherrydvr.com>, Andrey Utkin <andrey_utkin@fastmail.com>, Ismael Luceno <ismael@iodev.co.uk>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
drivers/media/pci/solo6x10/
SOFTWARE DELEGATED EXCEPTION INTERFACE (SDEI) #
- Mail: James Morse <james.morse@arm.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/firmware/sdei.txt,drivers/firmware/arm_sdei.c,include/linux/arm_sdei.h,include/uapi/linux/arm_sdei.h
SOFTWARE NODES AND DEVICE PROPERTIES #
- Reviewer: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Daniel Scally <djrscally@gmail.com>, Heikki Krogerus <heikki.krogerus@linux.intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-acpi@vger.kernel.org
- Status: Maintained
- Files:
drivers/base/property.c,drivers/base/swnode.c,include/linux/fwnode.h,include/linux/property.h
SOFTWARE RAID (Multiple Disks) SUPPORT #
- Mail: Song Liu <song@kernel.org>, Yu Kuai <yukuai@fnnas.com>
- Reviewer: Li Nan <linan122@huawei.com>
- Mailing list: linux-raid@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-raid/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux.git
- Files:
drivers/md/Kconfig,drivers/md/Makefile,drivers/md/md*,drivers/md/raid*,include/linux/raid/,include/uapi/linux/raid/,lib/raid6/
SOLIDRUN CLEARFOG SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Maintained
- Files:
arch/arm/boot/dts/marvell/armada-388-clearfog*,arch/arm/boot/dts/marvell/armada-38x-solidrun-*
SOLIDRUN CUBOX-I/HUMMINGBOARD SUPPORT #
- Mail: Russell King <linux@armlinux.org.uk>
- Status: Maintained
- Files:
arch/arm/boot/dts/nxp/imx/imx6*-cubox-i*,arch/arm/boot/dts/nxp/imx/imx6*-hummingboard*,arch/arm/boot/dts/nxp/imx/imx6*-sr-*
SONIC NETWORK DRIVER #
- Mail: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/natsemi/sonic.*
SONICS SILICON BACKPLANE DRIVER (SSB) #
- Mail: Michael Buesch <m@bues.ch>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Maintained
- Files:
drivers/ssb/,include/linux/ssb/
SONY IMX208 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/imx208.c
SONY IMX214 SENSOR DRIVER #
- Mail: Ricardo Ribalda <ribalda@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx214.yaml,drivers/media/i2c/imx214.c
SONY IMX219 SENSOR DRIVER #
- Mail: Dave Stevenson <dave.stevenson@raspberrypi.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx219.yaml,drivers/media/i2c/imx219.c
SONY IMX258 SENSOR DRIVER #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx258.yaml,drivers/media/i2c/imx258.c
SONY IMX274 SENSOR DRIVER #
- Mail: Leon Luo <leonl@leopardimaging.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml,drivers/media/i2c/imx274.c
SONY IMX283 SENSOR DRIVER #
- Mail: Kieran Bingham <kieran.bingham@ideasonboard.com>
- Reviewer: Umang Jain <uajain@igalia.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx283.yaml,drivers/media/i2c/imx283.c
SONY IMX290 SENSOR DRIVER #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx290.yaml,drivers/media/i2c/imx290.c
SONY IMX296 SENSOR DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx296.yaml,drivers/media/i2c/imx296.c
SONY IMX319 SENSOR DRIVER #
- Mail: Bingbu Cao <bingbu.cao@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/imx319.c
SONY IMX334 SENSOR DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx334.yaml,drivers/media/i2c/imx334.c
SONY IMX335 SENSOR DRIVER #
- Mail: Kieran Bingham <kieran.bingham@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml,drivers/media/i2c/imx335.c
SONY IMX355 SENSOR DRIVER #
- Mail: Tianshu Qiu <tian.shu.qiu@intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/imx355.c
SONY IMX412 SENSOR DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml,drivers/media/i2c/imx412.c
SONY IMX415 SENSOR DRIVER #
- Mail: Michael Riesch <michael.riesch@collabora.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml,drivers/media/i2c/imx415.c
SONY MEMORYSTICK SUBSYSTEM #
- Mail: Maxim Levitsky <maximlevitsky@gmail.com>, Alex Dubov <oakad@yahoo.com>, Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
- Files:
drivers/memstick/,include/linux/memstick.h
SONY VAIO CONTROL DEVICE DRIVER #
- Mail: Mattia Dongili <malattia@linux.it>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
- Files:
Documentation/admin-guide/laptops/sony-laptop.rst,drivers/char/sonypi.c,drivers/platform/x86/sony-laptop.c
SOPHGO DEVICETREES and DRIVERS #
- Mail: Chen Wang <unicorn_wang@outlook.com>, Inochi Amaoto <inochiama@gmail.com>
- Mailing list: sophgo@lists.linux.dev
- Web-page: https://github.com/sophgo/linux/wiki
- SCM: git https://github.com/sophgo/linux.git
- Status: Maintained
- Regex:
sophgo - Content regex:
sophgo
SOUND #
- Mail: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Web-page: http://www.alsa-project.org/
- Patchwork: http://patchwork.kernel.org/project/alsa-devel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
Documentation/sound/,include/sound/,include/uapi/sound/,sound/,tools/testing/selftests/alsa
SOUND - ALSA SELFTESTS #
- Mail: Mark Brown <broonie@kernel.org>
- Mailing list: linux-sound@vger.kernel.org, linux-kselftest@vger.kernel.org
- Status: Supported
- Files:
tools/testing/selftests/alsa
SOUND - COMPRESSED AUDIO #
- Mail: Vinod Koul <vkoul@kernel.org>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
Documentation/sound/designs/compress-offload.rst,include/sound/compress_driver.h,include/uapi/sound/compress_*,sound/core/compress_offload.c,sound/soc/soc-compress.c
SOUND - CORE KUNIT TEST #
- Mail: Ivan Orlov <ivan.orlov0322@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- Files:
sound/core/sound_kunit.c
SOUND - DMAENGINE HELPERS #
- Mail: Lars-Peter Clausen <lars@metafoo.de>
- Status: Supported
- Files:
include/sound/dmaengine_pcm.h,sound/core/pcm_dmaengine.c,sound/soc/soc-generic-dmaengine-pcm.c
SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) #
- Mail: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- Web-page: http://alsa-project.org/main/index.php/ASoC
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
- Files:
Documentation/devicetree/bindings/sound/,Documentation/sound/soc/,include/dt-bindings/sound/,include/sound/cs* - Excluded:
include/sound/cs4231-regs.h,include/sound/cs8403.h,include/sound/cs8427.h - Files:
include/sound/madera-pdata.h,include/sound/soc*,include/sound/sof.h,include/sound/sof/,include/sound/wm*.h,include/trace/events/sof*.h,include/uapi/sound/asoc.h,sound/soc/
SOUND - SOC LAYER / dapm-graph #
- Mail: Luca Ceresoli <luca.ceresoli@bootlin.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
tools/sound/dapm-graph
SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS #
- Mail: Liam Girdwood <lgirdwood@gmail.com>, Peter Ujfalusi <peter.ujfalusi@linux.intel.com>, Bard Liao <yung-chuan.liao@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Daniel Baluta <daniel.baluta@nxp.com>
- Reviewer: Kai Vehmanen <kai.vehmanen@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
- Mailing list: sound-open-firmware@alsa-project.org (moderated for non-subscribers)
- Status: Supported
- Web-page: https://github.com/thesofproject/linux/
- Files:
sound/soc/sof/
SOUND - GENERIC SOUND CARD (Simple-Audio-Card, Audio-Graph-Card) #
- Mail: Mark Brown <broonie@kernel.org>, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
- Status: Supported
- Mailing list: linux-sound@vger.kernel.org
- Files:
sound/soc/generic/,include/sound/simple_card*,Documentation/devicetree/bindings/sound/simple-card.yaml,Documentation/devicetree/bindings/sound/audio-graph*.yaml
SOUNDWIRE SUBSYSTEM #
- Mail: Vinod Koul <vkoul@kernel.org>, Bard Liao <yung-chuan.liao@linux.intel.com>
- Reviewer: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
- Mailing list: linux-sound@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git
- Files:
Documentation/driver-api/soundwire/,drivers/soundwire/,include/linux/soundwire/
SP2 MEDIA DRIVER #
- Mail: Olli Salonen <olli.salonen@iki.fi>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/sp2*
SPACEMIT K1 I2C DRIVER #
- Mail: Troy Mitchell <troy.mitchell@linux.spacemit.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml,drivers/i2c/busses/i2c-k1.c
SPANISH DOCUMENTATION #
- Mail: Carlos Bilbao <carlos.bilbao@kernel.org>
- Reviewer: Avadhut Naik <avadhut.naik@amd.com>
- Status: Maintained
- Files:
Documentation/translations/sp_SP/
SPARC + UltraSPARC (sparc/sparc64) #
- Mail: "David S. Miller" <davem@davemloft.net>, Andreas Larsson <andreas@gaisler.com>
- Mailing list: sparclinux@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.ozlabs.org/project/sparclinux/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git, git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git
- Files:
arch/sparc/,drivers/sbus/
SPARC SERIAL DRIVERS #
- Mail: "David S. Miller" <davem@davemloft.net>
- Mailing list: sparclinux@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git, git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git
- Files:
drivers/tty/serial/suncore.c,drivers/tty/serial/sunhv.c,drivers/tty/serial/sunsab.c,drivers/tty/serial/sunsab.h,drivers/tty/serial/sunsu.c,drivers/tty/serial/sunzilog.c,drivers/tty/serial/sunzilog.h,drivers/tty/vcc.c,include/linux/sunserialcore.h
SPARSE CHECKER #
- Mail: Chris Li <sparse@chrisli.org>
- Mailing list: linux-sparse@vger.kernel.org
- Status: Maintained
- Web-page: https://sparse.docs.kernel.org/
- Patchwork: https://patchwork.kernel.org/project/linux-sparse/list/
- bugs: https://bugzilla.kernel.org/enter_bug.cgi?component=Sparse&product=Tools
- SCM: git git://git.kernel.org/pub/scm/devel/sparse/sparse.git
- Files:
include/linux/compiler.h
SPEAKUP CONSOLE SPEECH DRIVER #
- Mail: William Hubbs <w.d.hubbs@gmail.com>, Chris Brannon <chris@the-brannons.com>, Kirk Reiser <kirk@reisers.ca>, Samuel Thibault <samuel.thibault@ens-lyon.org>
- Mailing list: speakup@linux-speakup.org
- Status: Odd Fixes
- Web-page: http://www.linux-speakup.org/, https://github.com/linux-speakup/speakup
- bugs: https://github.com/linux-speakup/speakup/issues
- Files:
drivers/accessibility/speakup/
SPEAR PLATFORM/CLOCK/PINCTRL SUPPORT #
- Mail: Viresh Kumar <vireshk@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), soc@lists.linux.dev
- Status: Maintained
- Web-page: http://www.st.com/spear
- Files:
arch/arm/boot/dts/st/spear*,arch/arm/mach-spear/,drivers/clk/spear/,drivers/pinctrl/spear/
SPI NOR SUBSYSTEM #
- Mail: Pratyush Yadav <pratyush@kernel.org>, Michael Walle <mwalle@kernel.org>
- Reviewer: Takahiro Kuwano <takahiro.kuwano@infineon.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Maintained
- Web-page: http://www.linux-mtd.infradead.org/
- Patchwork: http://patchwork.ozlabs.org/project/linux-mtd/list/
- chat: irc://irc.oftc.net/mtd
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-nor/next
- Files:
Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml,drivers/mtd/spi-nor/,include/linux/mtd/spi-nor.h
SPI OFFLOAD #
- Reviewer: David Lechner <dlechner@baylibre.com>
- Files:
drivers/spi/spi-offload-trigger-*.c,drivers/spi/spi-offload.c,include/linux/spi/offload/ - Content regex:
spi_offload
SPI SUBSYSTEM #
- Mail: Mark Brown <broonie@kernel.org>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/spi-devel-general/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
- Files:
Documentation/devicetree/bindings/spi/,Documentation/spi/,drivers/spi/,include/trace/events/spi*,include/linux/spi/,include/uapi/linux/spi/,tools/spi/
SPMI SUBSYSTEM #
- Mail: Stephen Boyd <sboyd@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git
- Files:
Documentation/devicetree/bindings/spmi/,drivers/spmi/,include/dt-bindings/spmi/spmi.h,include/linux/spmi.h,include/trace/events/spmi.h
SPU FILE SYSTEM #
- Mailing list: linuxppc-dev@lists.ozlabs.org
- Status: Orphan
- Files:
Documentation/filesystems/spufs/spufs.rst,arch/powerpc/platforms/cell/spufs/
SQUASHFS FILE SYSTEM #
- Mail: Phillip Lougher <phillip@squashfs.org.uk>
- Mailing list: squashfs-devel@lists.sourceforge.net (subscribers-only)
- Status: Maintained
- Web-page: http://squashfs.org.uk
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next.git
- Files:
Documentation/filesystems/squashfs.rst,fs/squashfs/
SRM (Alpha) environment access #
- Mail: Jan-Benedict Glaw <jbglaw@lug-owl.de>
- Status: Maintained
- Files:
arch/alpha/kernel/srm_env.c
ST LSM6DSx IMU IIO DRIVER #
- Mail: Lorenzo Bianconi <lorenzo@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Web-page: http://www.st.com/
- Files:
Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml,drivers/iio/imu/st_lsm6dsx/
ST MIPID02 CSI-2 TO PARALLEL BRIDGE DRIVER #
- Mail: Benjamin Mugnier <benjamin.mugnier@foss.st.com>, Sylvain Petinot <sylvain.petinot@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/st,st-mipid02.yaml,drivers/media/i2c/st-mipid02.c
ST STC3117 FUEL GAUGE DRIVER #
- Mail: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io>, Bhavin Sharma <bhavin.sharma@siliconsignals.io>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/supply/st,stc3117.yaml,drivers/power/supply/stc3117_fuel_gauge.c
ST STEF48H28 DRIVER #
- Mail: Charles Hsu <hsu.yungteng@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/stef48h28.rst,drivers/hwmon/pmbus/stef48h28.c
ST STM32 FIREWALL #
- Mail: Gatien Chevallier <gatien.chevallier@foss.st.com>
- Status: Maintained
- Files:
drivers/bus/stm32_etzpc.c,drivers/bus/stm32_firewall.c,drivers/bus/stm32_rifsc.c
ST STM32 HDP PINCTRL DRIVER #
- Mail: Clément Le Goffic <legoffic.clement@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/st,stm32-hdp.yaml,drivers/pinctrl/stm32/pinctrl-stm32-hdp.c
ST STM32 I2C/SMBUS DRIVER #
- Mail: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>, Alain Volmat <alain.volmat@foss.st.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-stm32*
ST STM32 OCTO MEMORY MANAGER #
- Mail: Patrice Chotard <patrice.chotard@foss.st.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/st,stm32mp25-omm.yaml,drivers/memory/stm32_omm.c
ST STM32 PINCTRL DRIVER #
- Mail: Antonio Borneo <antonio.borneo@foss.st.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml,drivers/pinctrl/stm32/,include/dt-bindings/pinctrl/stm32-pinfunc.h - Excluded:
drivers/pinctrl/stm32/pinctrl-stm32-hdp.c
ST STM32 SPI DRIVER #
- Mail: Alain Volmat <alain.volmat@foss.st.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
drivers/spi/spi-stm32.c
ST STPDDC60 DRIVER #
- Mail: Daniel Nilsson <daniel.nilsson@flex.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/stpddc60.rst,drivers/hwmon/pmbus/stpddc60.c
ST TSC1641 DRIVER #
- Mail: Igor Reznichenko <igor@reznichenko.net>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml,Documentation/hwmon/tsc1641.rst,drivers/hwmon/tsc1641.c
ST VD55G1 DRIVER #
- Mail: Benjamin Mugnier <benjamin.mugnier@foss.st.com>, Sylvain Petinot <sylvain.petinot@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/st,vd55g1.yaml,drivers/media/i2c/vd55g1.c
ST VD56G3 IMAGE SENSOR DRIVER #
- Mail: Benjamin Mugnier <benjamin.mugnier@foss.st.com>, Sylvain Petinot <sylvain.petinot@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/st,vd56g3.yaml,drivers/media/i2c/vd56g3.c
ST VGXY61 DRIVER #
- Mail: Benjamin Mugnier <benjamin.mugnier@foss.st.com>, Sylvain Petinot <sylvain.petinot@foss.st.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/st,st-vgxy61.yaml,Documentation/userspace-api/media/drivers/vgxy61.rst,drivers/media/i2c/vgxy61.c
ST VL53L0X ToF RANGER(I2C) IIO DRIVER #
- Mail: Song Qiang <songqiang1304521@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/proximity/st,vl53l0x.yaml,drivers/iio/proximity/vl53l0x-i2c.c
STABLE BRANCH #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
- Mailing list: stable@vger.kernel.org
- Status: Supported
- Files:
Documentation/process/stable-kernel-rules.rst
STAGING - ATOMISP DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>, Mauro Carvalho Chehab <mchehab@kernel.org>
- Reviewer: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/staging/media/atomisp/
STAGING - INDUSTRIAL IO #
- Mail: Jonathan Cameron <jic23@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/staging/iio/
STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec) #
- Mail: Marc Dietrich <marvin24@gmx.de>
- Mailing list: ac100@lists.launchpad.net (moderated for non-subscribers), linux-tegra@vger.kernel.org
- Status: Maintained
- Files:
drivers/staging/nvec/
STAGING - SEPS525 LCD CONTROLLER DRIVERS #
- Mail: Michael Hennerich <michael.hennerich@analog.com>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Supported
- Files:
drivers/staging/fbtft/fb_seps525.c
STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER #
- Mail: Sudip Mukherjee <sudipm.mukherjee@gmail.com>, Teddy Wang <teddy.wang@siliconmotion.com>, Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/staging/sm750fb/
STAGING SUBSYSTEM #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: linux-staging@lists.linux.dev
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
- Files:
drivers/staging/
STANDALONE CACHE CONTROLLER DRIVERS #
- Mail: Conor Dooley <conor@kernel.org>, Jonathan Cameron <jonathan.cameron@huawei.com>
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
- Files:
Documentation/devicetree/bindings/cache/,drivers/cache,include/linux/cache_coherency.h,lib/cache_maint.c
STARFIRE/DURALAN NETWORK DRIVER #
- Mail: Ion Badulescu <ionut@badula.org>
- Status: Odd Fixes
- Files:
drivers/net/ethernet/adaptec/starfire*
STARFIVE CAMERA SUBSYSTEM DRIVER #
- Mail: Jack Zhu <jack.zhu@starfivetech.com>, Changhuang Liang <changhuang.liang@starfivetech.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/media/starfive_camss.rst,Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml,drivers/staging/media/starfive/camss
STARFIVE CRYPTO DRIVER #
- Mail: Jia Jie Ho <jiajie.ho@starfivetech.com>, William Qiu <william.qiu@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/crypto/starfive*,drivers/crypto/starfive/
STARFIVE DEVICETREES #
- Mail: Emil Renner Berthing <kernel@esmil.dk>, Conor Dooley <conor@kernel.org>
- Mailing list: linux-riscv@lists.infradead.org
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
- Files:
arch/riscv/boot/dts/starfive/
STARFIVE DWMAC GLUE LAYER #
- Mail: Emil Renner Berthing <kernel@esmil.dk>, Minda Chen <minda.chen@starfivetech.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml,drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
STARFIVE JH7110 DPHY RX DRIVER #
- Mail: Jack Zhu <jack.zhu@starfivetech.com>, Changhuang Liang <changhuang.liang@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-rx.yaml,drivers/phy/starfive/phy-jh7110-dphy-rx.c
STARFIVE JH7110 DPHY TX DRIVER #
- Mail: Keith Zhao <keith.zhao@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml,drivers/phy/starfive/phy-jh7110-dphy-tx.c
STARFIVE JH7110 MMC/SD/SDIO DRIVER #
- Mail: William Qiu <william.qiu@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/mmc/starfive*,drivers/mmc/host/dw_mmc-starfive.c
STARFIVE JH7110 PLL CLOCK DRIVER #
- Mail: Xingyu Wu <xingyu.wu@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/clock/starfive,jh7110-pll.yaml,drivers/clk/starfive/clk-starfive-jh7110-pll.c
STARFIVE JH7110 PWMDAC DRIVER #
- Mail: Hal Feng <hal.feng@starfivetech.com>, Xingyu Wu <xingyu.wu@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/sound/starfive,jh7110-pwmdac.yaml,sound/soc/starfive/jh7110_pwmdac.c
STARFIVE JH7110 SYSCON #
- Mail: William Qiu <william.qiu@starfivetech.com>, Xingyu Wu <xingyu.wu@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
STARFIVE JH7110 TDM DRIVER #
- Mail: Walker Chen <walker.chen@starfivetech.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/starfive,jh7110-tdm.yaml,sound/soc/starfive/jh7110_tdm.c
STARFIVE JH71X0 CLOCK DRIVERS #
- Mail: Emil Renner Berthing <kernel@esmil.dk>, Hal Feng <hal.feng@starfivetech.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/starfive,jh71*.yaml,drivers/clk/starfive/clk-starfive-jh71*,include/dt-bindings/clock/starfive?jh71*.h
STARFIVE JH71X0 PINCTRL DRIVERS #
- Mail: Emil Renner Berthing <kernel@esmil.dk>, Hal Feng <hal.feng@starfivetech.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pinctrl/starfive,jh71*.yaml,drivers/pinctrl/starfive/pinctrl-starfive-jh71*,include/dt-bindings/pinctrl/pinctrl-starfive-jh7100.h,include/dt-bindings/pinctrl/starfive,jh7110-pinctrl.h
STARFIVE JH71X0 RESET CONTROLLER DRIVERS #
- Mail: Emil Renner Berthing <kernel@esmil.dk>, Hal Feng <hal.feng@starfivetech.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/reset/starfive,jh7100-reset.yaml,drivers/reset/starfive/reset-starfive-jh71*,include/dt-bindings/reset/starfive?jh71*.h
STARFIVE JH71X0 USB DRIVERS #
- Mail: Minda Chen <minda.chen@starfivetech.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/starfive,jh7110-usb.yaml,drivers/usb/cdns3/cdns3-starfive.c
STARFIVE JH71XX PMU CONTROLLER DRIVER #
- Mail: Walker Chen <walker.chen@starfivetech.com>, Changhuang Liang <changhuang.liang@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/power/starfive*,drivers/pmdomain/starfive/,include/dt-bindings/power/starfive,jh7110-pmu.h
STARFIVE SOC DRIVERS #
- Mail: Conor Dooley <conor@kernel.org>
- Status: Maintained
- SCM: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/
- Files:
Documentation/devicetree/bindings/soc/starfive/
STARFIVE STARLINK PMU DRIVER #
- Mail: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
- Status: Maintained
- Files:
Documentation/admin-guide/perf/starfive_starlink_pmu.rst,Documentation/devicetree/bindings/perf/starfive,jh8100-starlink-pmu.yaml,drivers/perf/starfive_starlink_pmu.c
STARFIVE TRNG DRIVER #
- Mail: Jia Jie Ho <jiajie.ho@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/rng/starfive*,drivers/char/hw_random/jh7110-trng.c
STARFIVE WATCHDOG DRIVER #
- Mail: Xingyu Wu <xingyu.wu@starfivetech.com>, Ziv Xu <ziv.xu@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/watchdog/starfive*,drivers/watchdog/starfive-wdt.c
STARFIVE JH71X0 PCIE AND USB PHY DRIVER #
- Mail: Minda Chen <minda.chen@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/phy/starfive,jh7110-pcie-phy.yaml,Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml,drivers/phy/starfive/phy-jh7110-pcie.c,drivers/phy/starfive/phy-jh7110-usb.c
STARFIVE JH8100 EXTERNAL INTERRUPT CONTROLLER DRIVER #
- Mail: Changhuang Liang <changhuang.liang@starfivetech.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/interrupt-controller/starfive,jh8100-intc.yaml,drivers/irqchip/irq-starfive-jh8100-intc.c
STATIC BRANCH/CALL #
- Mail: Peter Zijlstra <peterz@infradead.org>, Josh Poimboeuf <jpoimboe@kernel.org>, Jason Baron <jbaron@akamai.com>, Alice Ryhl <aliceryhl@google.com>
- Reviewer: Steven Rostedt <rostedt@goodmis.org>, Ard Biesheuvel <ardb@kernel.org>
- Status: Supported
- Files:
arch/*/include/asm/jump_label*.h,arch/*/include/asm/static_call*.h,arch/*/kernel/jump_label.c,arch/*/kernel/static_call.c,include/linux/jump_label*.h,include/linux/static_call*.h,kernel/jump_label.c,kernel/static_call*.c,rust/helpers/jump_label.c,rust/kernel/generated_arch_static_branch_asm.rs.S,rust/kernel/jump_label.rs
STI AUDIO (ASoC) DRIVERS #
- Mail: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt,sound/soc/sti/
STI CEC DRIVER #
- Mail: Alain Volmat <alain.volmat@foss.st.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/cec/st,stih-cec.yaml,drivers/media/cec/platform/sti/
STK1160 USB VIDEO CAPTURE DRIVER #
- Mail: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/usb/stk1160/
STM32 AUDIO (ASoC) DRIVERS #
- Mail: Olivier Moysan <olivier.moysan@foss.st.com>, Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml,Documentation/devicetree/bindings/sound/st,stm32-*.yaml,sound/soc/stm/
STM32 DMA DRIVERS #
- Mail: Amélie Delaunay <amelie.delaunay@foss.st.com>
- Mailing list: dmaengine@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/arch/arm/stm32/stm32-dma-mdma-chaining.rst,Documentation/devicetree/bindings/dma/stm32/,drivers/dma/stm32/
STM32 TIMER/LPTIMER DRIVERS #
- Mail: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
- Status: Maintained
- Files:
Documentation/ABI/testing/*timer-stm32,Documentation/devicetree/bindings/*/*stm32-*timer*,drivers/*/stm32-*timer*,drivers/pwm/pwm-stm32*,include/linux/*/stm32-*tim*
STM32MP25 USB3/PCIE COMBOPHY DRIVER #
- Mail: Christian Bruel <christian.bruel@foss.st.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/st,stm32mp25-combophy.yaml,drivers/phy/st/phy-stm32-combophy.c
STMMAC ETHERNET DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
Documentation/networking/device_drivers/ethernet/stmicro/,drivers/net/ethernet/stmicro/stmmac/
SUN HAPPY MEAL ETHERNET DRIVER #
- Mail: Sean Anderson <seanga2@gmail.com>
- Status: Maintained
- Files:
drivers/net/ethernet/sun/sunhme.*
SUN3/3X #
- Mail: Sam Creasey <sammy@sammy.net>
- Status: Maintained
- Web-page: http://sammy.net/sun3/
- Files:
arch/m68k/include/asm/sun3*,arch/m68k/kernel/*sun3*,arch/m68k/sun3*/,drivers/net/ethernet/i825xx/sun3*
SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml,drivers/input/keyboard/sun4i-lradc-keys.c
SUNDANCE NETWORK DRIVER #
- Mail: Denis Kirjanov <kirjanov@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/dlink/sundance.c
SUNPLUS ETHERNET DRIVER #
- Mail: Wells Lu <wellslutw@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://sunplus.atlassian.net/wiki/spaces/doc/overview
- Files:
Documentation/devicetree/bindings/net/sunplus,sp7021-emac.yaml,drivers/net/ethernet/sunplus/
SUNPLUS MMC DRIVER #
- Mail: Tony Huang <tonyhuang.sunplus@gmail.com>, Li-hao Kuo <lhjeff911@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mmc/sunplus,mmc.yaml,drivers/mmc/host/sunplus-mmc.c
SUNPLUS OCOTP DRIVER #
- Mail: Vincent Shih <vincent.sunplus@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/nvmem/sunplus,sp7021-ocotp.yaml,drivers/nvmem/sunplus-ocotp.c
SUNPLUS PWM DRIVER #
- Mail: Hammer Hsieh <hammerh0314@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml,drivers/pwm/pwm-sunplus.c
SUNPLUS RTC DRIVER #
- Mail: Vincent Shih <vincent.sunplus@gmail.com>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/rtc/sunplus,sp7021-rtc.yaml,drivers/rtc/rtc-sunplus.c
SUNPLUS SPI CONTROLLER INTERFACE DRIVER #
- Mail: Li-hao Kuo <lhjeff911@gmail.com>
- Mailing list: linux-spi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/spi/spi-sunplus-sp7021.yaml,drivers/spi/spi-sunplus-sp7021.c
SUNPLUS UART DRIVER #
- Mail: Hammer Hsieh <hammerh0314@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/serial/sunplus,sp7021-uart.yaml,drivers/tty/serial/sunplus-uart.c
SUNPLUS USB2 PHY DRIVER #
- Mail: Vincent Shih <vincent.sunplus@gmail.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/sunplus,sp7021-usb2-phy.yaml,drivers/phy/sunplus/Kconfig,drivers/phy/sunplus/Makefile,drivers/phy/sunplus/phy-sunplus-usb2.c
SUNPLUS WATCHDOG DRIVER #
- Mail: Xiantao Hu <xt.hu@cqplus1.com>
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/watchdog/sunplus,sp7021-wdt.yaml,drivers/watchdog/sunplus_wdt.c
SUPERH #
- Mail: Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
- Mailing list: linux-sh@vger.kernel.org
- Status: Maintained
- Patchwork: http://patchwork.kernel.org/project/linux-sh/list/
- Files:
Documentation/arch/sh/,arch/sh/,drivers/sh/
SUSPEND TO RAM #
- Mail: "Rafael J. Wysocki" <rafael@kernel.org>
- Reviewer: Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- bugs: https://bugzilla.kernel.org
- Files:
Documentation/power/,arch/x86/kernel/acpi/sleep*,arch/x86/kernel/acpi/wakeup*,drivers/base/power/,include/linux/freezer.h,include/linux/pm.h,include/linux/suspend.h,kernel/power/
SVGA HANDLING #
- Mail: Martin Mares <mj@ucw.cz>
- Mailing list: linux-video@atrey.karlin.mff.cuni.cz
- Status: Maintained
- Files:
Documentation/admin-guide/svga.rst,arch/x86/boot/video*
SWITCHDEV #
- Mail: Jiri Pirko <jiri@resnulli.us>, Ivan Vecera <ivecera@redhat.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
include/net/switchdev.h,net/switchdev/
SY8106A REGULATOR DRIVER #
- Mail: Icenowy Zheng <icenowy@aosc.io>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/regulator/silergy,sy8106a.yaml,drivers/regulator/sy8106a-regulator.c
SYNC FILE FRAMEWORK #
- Mail: Sumit Semwal <sumit.semwal@linaro.org>
- Mailing list: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/driver-api/sync_file.rst,drivers/dma-buf/dma-fence*,drivers/dma-buf/sw_sync.c,drivers/dma-buf/sync_*,include/linux/sync_file.h,include/uapi/linux/sync_file.h
SYNOPSYS ARC ARCHITECTURE #
- Mail: Vineet Gupta <vgupta@kernel.org>
- Mailing list: linux-snps-arc@lists.infradead.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git
- Files:
Documentation/arch/arc,Documentation/devicetree/bindings/arc/*,Documentation/devicetree/bindings/interrupt-controller/snps,arc*,arch/arc/,drivers/clocksource/arc_timer.c,drivers/tty/serial/arc_uart.c
SYNOPSYS ARC HSDK SDP pll clock driver #
- Mail: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/clock/snps,hsdk-pll-clock.txt,drivers/clk/clk-hsdk-pll.c
SYNOPSYS ARC SDP clock driver #
- Mail: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/clock/snps,pll-clock.txt,drivers/clk/axs10x/*
SYNOPSYS ARC SDP platform support #
- Mail: Alexey Brodkin <abrodkin@synopsys.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/arc/axs10*,arch/arc/boot/dts/ax*,arch/arc/plat-axs10x
SYNOPSYS AXS10x RESET CONTROLLER DRIVER #
- Mail: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/reset/snps,axs10x-reset.yaml,drivers/reset/reset-axs10x.c
SYNOPSYS CREG GPIO DRIVER #
- Mail: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
- Status: Maintained
- Files:
drivers/gpio/gpio-creg-snps.c
SYNOPSYS DESIGNWARE 8250 UART DRIVER #
- Mail: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
- Reviewer: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
- Status: Supported
- Files:
drivers/tty/serial/8250/8250_dw.c,drivers/tty/serial/8250/8250_dwlib.*,drivers/tty/serial/8250/8250_lpss.c
SYNOPSYS DESIGNWARE APB GPIO DRIVER #
- Mail: Hoan Tran <hoan@os.amperecomputing.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/snps,dw-apb-gpio.yaml,drivers/gpio/gpio-dwapb.c
SYNOPSYS DESIGNWARE AXI DMAC DRIVER #
- Mail: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/snps,dw-axi-dmac.yaml,drivers/dma/dw-axi-dmac/
SYNOPSYS DESIGNWARE DMAC DRIVER #
- Mail: Viresh Kumar <vireshk@kernel.org>
- Reviewer: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/renesas,rzn1-dmamux.yaml,Documentation/devicetree/bindings/dma/snps,dma-spear1340.yaml,drivers/dma/dw/,include/dt-bindings/dma/dw-dmac.h,include/linux/dma/dw.h,include/linux/platform_data/dma-dw.h
SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER #
- Mail: Jose Abreu <Jose.Abreu@synopsys.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/synopsys/
SYNOPSYS DESIGNWARE ETHERNET XPCS DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/pcs/pcs-xpcs.c,drivers/net/pcs/pcs-xpcs.h,include/linux/pcs/pcs-xpcs.h
SYNOPSYS DESIGNWARE HDMI RX CONTROLLER DRIVER #
- Mail: Dmitry Osipenko <dmitry.osipenko@collabora.com>
- Mailing list: linux-media@vger.kernel.org, kernel@collabora.com
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml,drivers/media/platform/synopsys/hdmirx/*
SYNOPSYS DESIGNWARE I2C DRIVER #
- Mail: Mika Westerberg <mika.westerberg@linux.intel.com>
- Reviewer: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Jan Dabros <jsd@semihalf.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Files:
drivers/i2c/busses/i2c-designware-*
SYNOPSYS DESIGNWARE I2C DRIVER - AMDISP #
- Mail: Nirujogi Pratap <pratap.nirujogi@amd.com>, Bin Du <bin.du@amd.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-designware-amdisp.c,include/linux/soc/amd/isp4_misc.h
SYNOPSYS DESIGNWARE MIPI CSI-2 RECEIVER DRIVER #
- Mail: Michael Riesch <michael.riesch@collabora.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/rockchip,rk3568-mipi-csi2.yaml,drivers/media/platform/synopsys/dw-mipi-csi2rx.c
SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER #
- Mail: Jaehoon Chung <jh80.chung@samsung.com>, Shawn Lin <shawn.lin@rock-chips.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/dw_mmc*
SYNOPSYS DESIGNWARE PCIE PMU DRIVER #
- Mail: Shuai Xue <xueshuai@linux.alibaba.com>, Jing Zhang <renyu.zj@linux.alibaba.com>
- Status: Supported
- Files:
Documentation/admin-guide/perf/dwc_pcie_pmu.rst,drivers/perf/dwc_pcie_pmu.c
SYNOPSYS HSDK RESET CONTROLLER DRIVER #
- Mail: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
- Status: Supported
- Files:
Documentation/devicetree/bindings/reset/snps,hsdk-reset.txt,drivers/reset/reset-hsdk.c,include/dt-bindings/reset/snps,hsdk-reset.h
SYNOPSYS SDHCI COMPLIANT DWC MSHC DRIVER #
- Mail: Prabu Thangamuthu <prabu.t@synopsys.com>, Manjunath M B <manjumb@synopsys.com>
- Mailing list: linux-mmc@vger.kernel.org
- Status: Maintained
- Files:
drivers/mmc/host/sdhci-pci-dwc-mshc.c
SYSTEM CONFIGURATION (SYSCON) #
- Mail: Lee Jones <lee@kernel.org>, Arnd Bergmann <arnd@arndb.de>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
- Files:
drivers/mfd/syscon.c
SYSTEM CONTROL & POWER/MANAGEMENT INTERFACE (SCPI/SCMI) Message Protocol drivers #
- Mail: Sudeep Holla <sudeep.holla@kernel.org>
- Reviewer: Cristian Marussi <cristian.marussi@arm.com>
- Mailing list: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/firmware/arm,sc[mp]i.yaml,drivers/clk/clk-sc[mp]i.c,drivers/cpufreq/sc[mp]i-cpufreq.c,drivers/firmware/arm_scmi/,drivers/firmware/arm_scpi.c,drivers/hwmon/scmi-hwmon.c,drivers/pinctrl/pinctrl-scmi.c,drivers/pmdomain/arm/,drivers/powercap/arm_scmi_powercap.c,drivers/regulator/scmi-regulator.c,drivers/reset/reset-scmi.c,include/linux/sc[mp]i_protocol.h,include/trace/events/scmi.h,include/uapi/linux/virtio_scmi.h
SYSTEM CONTROL MANAGEMENT INTERFACE (SCMI) i.MX Extension Message Protocol drivers #
- Mail: Peng Fan <peng.fan@nxp.com>
- Mailing list: arm-scmi@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/firmware/nxp,*scmi.yaml,drivers/firmware/arm_scmi/vendors/imx/
SYSTEM RESET/SHUTDOWN DRIVERS #
- Mail: Sebastian Reichel <sre@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
- Files:
Documentation/devicetree/bindings/power/reset/,drivers/power/reset/
SYSTEM TRACE MODULE CLASS #
- Mail: Alexander Shishkin <alexander.shishkin@linux.intel.com>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git
- Files:
Documentation/trace/stm.rst,drivers/hwtracing/stm/,include/linux/stm.h,include/uapi/linux/stm.h
SYSTEM76 ACPI DRIVER #
- Mail: Jeremy Soller <jeremy@system76.com>, System76 Product Development <productdev@system76.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/system76_acpi.c
TASKSTATS STATISTICS INTERFACE #
- Mail: Balbir Singh <bsingharora@gmail.com>
- Status: Maintained
- Files:
Documentation/accounting/taskstats*,include/linux/taskstats*,kernel/taskstats.c
TC subsystem #
- Mail: Jamal Hadi Salim <jhs@mojatatu.com>, Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
include/net/pkt_cls.h,include/net/pkt_sched.h,include/net/sch_priv.h,include/net/tc_act/,include/net/tc_wrapper.h,include/uapi/linux/pkt_cls.h,include/uapi/linux/pkt_sched.h,include/uapi/linux/tc_act/,include/uapi/linux/tc_ematch/,net/sched/,tools/testing/selftests/tc-testing
TC90522 MEDIA DRIVER #
- Mail: Akihiro Tsukada <tskd08@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/media/dvb-frontends/tc90522*
TCP LOW PRIORITY MODULE #
- Mail: "Wong Hoi Sing, Edison" <hswong3i@gmail.com>, "Hung Hing Lun, Mike" <hlhung3i@gmail.com>
- Status: Maintained
- Web-page: http://tcp-lp-mod.sourceforge.net/
- Files:
net/ipv4/tcp_lp.c
TDA10071 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/tda10071*
TDA18212 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/tda18212*
TDA18218 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/tda18218*
TDA18250 MEDIA DRIVER #
- Mail: Olli Salonen <olli.salonen@iki.fi>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/tuners/tda18250*
TDA18271 MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/tuners.git
- Files:
drivers/media/tuners/tda18271*
TDA1997x MEDIA DRIVER #
- Mail: Tim Harvey <tharvey@gateworks.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
Documentation/devicetree/bindings/media/i2c/nxp,tda19971.yaml,drivers/media/i2c/tda1997x.*
TDA827x MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/tuners.git
- Files:
drivers/media/tuners/tda8290.*
TDA8290 MEDIA DRIVER #
- Mail: Michael Krufky <mkrufky@linuxtv.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org, http://github.com/mkrufky
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mkrufky/tuners.git
- Files:
drivers/media/tuners/tda8290.*
TDA9840 MEDIA DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/tda9840*
TEA5761 TUNER DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/tuners/tea5761.*
TEA5767 TUNER DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/tuners/tea5767.*
TEA6415C MEDIA DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/tea6415c*
TEA6420 MEDIA DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/i2c/tea6420*
TEAM DRIVER #
- Mail: Jiri Pirko <jiri@resnulli.us>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
Documentation/netlink/specs/team.yaml,drivers/net/team/,include/linux/if_team.h,include/uapi/linux/if_team.h,tools/testing/selftests/drivers/net/team/
TECHNICAL ADVISORY BOARD PROCESS DOCS #
- Mail: "Theodore Ts'o" <tytso@mit.edu>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: tech-board-discuss@lists.linux.dev
- Status: Maintained
- Files:
Documentation/process/contribution-maturity-model.rst,Documentation/process/researcher-guidelines.rst
TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT #
- Mail: "Savoir-faire Linux Inc." <kernel@savoirfairelinux.com>
- Status: Maintained
- Files:
arch/x86/platform/ts5500/
TECHNOTREND USB IR RECEIVER #
- Mail: Sean Young <sean@mess.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/rc/ttusbir.c
TECHWELL TW9900 VIDEO DECODER #
- Mail: Mehdi Djait <mehdi.djait@bootlin.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/tw9900.c
TECHWELL TW9910 VIDEO DECODER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Files:
drivers/media/i2c/tw9910.c,include/media/i2c/tw9910.h
TEE SUBSYSTEM #
- Mail: Jens Wiklander <jens.wiklander@linaro.org>
- Reviewer: Sumit Garg <sumit.garg@kernel.org>
- Mailing list: op-tee@lists.trustedfirmware.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-tee,Documentation/driver-api/tee.rst,Documentation/tee/,Documentation/userspace-api/tee.rst,drivers/tee/,include/linux/tee_core.h,include/linux/tee_drv.h,include/uapi/linux/tee.h
TEGRA ARCHITECTURE SUPPORT #
- Mail: Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>
- Mailing list: linux-tegra@vger.kernel.org
- Status: Supported
- Patchwork: http://patchwork.ozlabs.org/project/linux-tegra/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git
- Regex:
[^a-z]tegra
TEGRA CLOCK DRIVER #
- Mail: Peter De Schrijver <pdeschrijver@nvidia.com>, Prashant Gaikwad <pgaikwad@nvidia.com>
- Status: Supported
- Files:
drivers/clk/tegra/
TEGRA CRYPTO DRIVERS #
- Mail: Akhil R <akhilrajeev@nvidia.com>
- Status: Supported
- Files:
drivers/crypto/tegra/*
TEGRA DMA DRIVERS #
- Mail: Laxman Dewangan <ldewangan@nvidia.com>, Jon Hunter <jonathanh@nvidia.com>
- Status: Supported
- Files:
drivers/dma/tegra*
TEGRA I2C DRIVER #
- Mail: Laxman Dewangan <ldewangan@nvidia.com>
- Reviewer: Dmitry Osipenko <digetx@gmail.com>
- Status: Supported
- Files:
drivers/i2c/busses/i2c-tegra.c
TEGRA IOMMU DRIVERS #
- Mail: Thierry Reding <thierry.reding@gmail.com>
- Reviewer: Krishna Reddy <vdumpa@nvidia.com>
- Mailing list: linux-tegra@vger.kernel.org
- Status: Supported
- Files:
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c,drivers/iommu/arm/arm-smmu/arm-smmu-nvidia.c,drivers/iommu/tegra*
TEGRA KBC DRIVER #
- Mail: Laxman Dewangan <ldewangan@nvidia.com>
- Status: Supported
- Files:
drivers/input/keyboard/tegra-kbc.c
TEGRA NAND DRIVER #
- Mail: Stefan Agner <stefan@agner.ch>, Lucas Stach <dev@lynxeye.de>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/mtd/nvidia,tegra20-nand.yaml,drivers/mtd/nand/raw/tegra_nand.c
TEGRA PWM DRIVER #
- Mail: Thierry Reding <thierry.reding@gmail.com>
- Status: Supported
- Files:
drivers/pwm/pwm-tegra.c
TEGRA QUAD SPI DRIVER #
- Mail: Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>, Sowjanya Komatineni <skomatineni@nvidia.com>
- Mailing list: linux-tegra@vger.kernel.org
- Status: Maintained
- Files:
drivers/spi/spi-tegra210-quad.c
TEGRA SERIAL DRIVER #
- Mail: Laxman Dewangan <ldewangan@nvidia.com>
- Status: Supported
- Files:
drivers/tty/serial/serial-tegra.c
TEGRA SPI DRIVER #
- Mail: Laxman Dewangan <ldewangan@nvidia.com>
- Status: Supported
- Files:
drivers/spi/spi-tegra*
TEGRA VIDEO DRIVER #
- Mail: Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>, Sowjanya Komatineni <skomatineni@nvidia.com>, Luca Ceresoli <luca.ceresoli@bootlin.com>
- Mailing list: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.yaml,Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-vi.yaml,Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-vip.yaml,drivers/staging/media/tegra-video/
TEGRA XUSB PADCTL DRIVER #
- Mail: JC Kuo <jckuo@nvidia.com>
- Status: Supported
- Files:
drivers/phy/tegra/xusb*
TEHUTI ETHERNET DRIVER #
- Mail: Andy Gospodarek <andy@greyhouse.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/tehuti/tehuti.*
TEHUTI TN40XX ETHERNET DRIVER #
- Mail: FUJITA Tomonori <fujita.tomonori@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/tehuti/tn40*
TELECOM CLOCK DRIVER FOR MCPL0010 #
- Mail: Mark Gross <markgross@kernel.org>
- Status: Supported
- Files:
drivers/char/tlclk.c
TEMPO SEMICONDUCTOR DRIVERS #
- Mail: Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/tscs*.txt,sound/soc/codecs/tscs*.c,sound/soc/codecs/tscs*.h
TENSILICA XTENSA PORT (xtensa) #
- Mail: Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>
- Status: Maintained
- SCM: git https://github.com/jcmvbkbc/linux-xtensa.git
- Files:
arch/xtensa/,drivers/irqchip/irq-xtensa-*
TEXAS INSTRUMENTS ASoC DRIVERS #
- Mail: Peter Ujfalusi <peter.ujfalusi@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/davinci-mcasp-audio.yaml,sound/soc/ti/
TEXAS INSTRUMENTS AUDIO (ASoC/HDA) DRIVERS #
- Mail: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>, Baojun Xu <baojun.xu@ti.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/ti,tas2552.yaml,Documentation/devicetree/bindings/sound/ti,tas2562.yaml,Documentation/devicetree/bindings/sound/ti,tas2770.yaml,Documentation/devicetree/bindings/sound/ti,tas27xx.yaml,Documentation/devicetree/bindings/sound/ti,tpa6130a2.yaml,Documentation/devicetree/bindings/sound/ti,pcm1681.yaml,Documentation/devicetree/bindings/sound/ti,pcm3168a.yaml,Documentation/devicetree/bindings/sound/ti,tlv320*.yaml,Documentation/devicetree/bindings/sound/ti,tlv320adcx140.yaml,include/sound/tas2*.h,include/sound/tlv320*.h,sound/hda/codecs/side-codecs/tas2781_hda_i2c.c,sound/soc/codecs/pcm1681.c,sound/soc/codecs/pcm1789*.*,sound/soc/codecs/pcm179x*.*,sound/soc/codecs/pcm186x*.*,sound/soc/codecs/pcm3008.*,sound/soc/codecs/pcm3060*.*,sound/soc/codecs/pcm3168a*.*,sound/soc/codecs/pcm5102a.c,sound/soc/codecs/pcm512x*.*,sound/soc/codecs/tas2*.*,sound/soc/codecs/tlv320*.*,sound/soc/codecs/tpa6130a2.*
TEXAS INSTRUMENTS DMA DRIVERS #
- Mail: Peter Ujfalusi <peter.ujfalusi@gmail.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt,Documentation/devicetree/bindings/dma/ti-edma.txt,Documentation/devicetree/bindings/dma/ti/,drivers/dma/ti/,include/linux/dma/k3-psil.h,include/linux/dma/k3-udma-glue.h,include/linux/dma/ti-cppi5.h - Excluded:
drivers/dma/ti/cppi41.c
TEXAS INSTRUMENTS TPS25990 HARDWARE MONITOR DRIVER #
- Mail: Jerome Brunet <jbrunet@baylibre.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml,Documentation/hwmon/tps25990.rst,drivers/hwmon/pmbus/tps25990.c
TEXAS INSTRUMENTS TPS23861 PoE PSE DRIVER #
- Mail: Robert Marko <robert.marko@sartura.hr>, Luka Perkov <luka.perkov@sartura.hr>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/hwmon/ti,tps23861.yaml,Documentation/hwmon/tps23861.rst,drivers/hwmon/tps23861.c
TEXAS INSTRUMENTS TPS6131X FLASH LED DRIVER #
- Mail: Matthias Fend <matthias.fend@emfend.at>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/ti,tps61310.yaml,drivers/leds/flash/leds-tps6131x.c
TEXAS INSTRUMENTS' DAC7612 DAC DRIVER #
- Mail: Ricardo Ribalda <ribalda@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/dac/ti,dac7612.yaml,drivers/iio/dac/ti-dac7612.c
TEXAS INSTRUMENTS' LP5812 RGB LED DRIVER #
- Mail: Nam Tran <trannamatk@gmail.com>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/ti,lp5812.yaml,Documentation/leds/leds-lp5812.rst,drivers/leds/rgb/Kconfig,drivers/leds/rgb/Makefile,drivers/leds/rgb/leds-lp5812.c,drivers/leds/rgb/leds-lp5812.h
TEXAS INSTRUMENTS' LB8864 LED BACKLIGHT DRIVER #
- Mail: Alexander Sverdlin <alexander.sverdlin@siemens.com>
- Mailing list: linux-leds@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/leds/backlight/ti,lp8864.yaml,drivers/leds/leds-lp8864.c
TEXAS INSTRUMENTS' SYSTEM CONTROL INTERFACE (TISCI) PROTOCOL DRIVER #
- Mail: Nishanth Menon <nm@ti.com>, Tero Kristo <kristo@kernel.org>, Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
Documentation/devicetree/bindings/arm/keystone/ti,k3-sci-common.yaml,Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml,Documentation/devicetree/bindings/clock/ti,sci-clk.yaml,Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml,Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.yaml,Documentation/devicetree/bindings/reset/ti,sci-reset.yaml,Documentation/devicetree/bindings/soc/ti/sci-pm-domain.yaml,drivers/clk/keystone/sci-clk.c,drivers/firmware/ti_sci*,drivers/irqchip/irq-ti-sci-inta.c,drivers/irqchip/irq-ti-sci-intr.c,drivers/reset/reset-ti-sci.c,drivers/soc/ti/ti_sci_inta_msi.c,drivers/pmdomain/ti/ti_sci_pm_domains.c,include/dt-bindings/soc/ti,sci_pm_domain.h,include/linux/soc/ti/ti_sci_inta_msi.h,include/linux/soc/ti/ti_sci_protocol.h
TEXAS INSTRUMENTS' TMP117 TEMPERATURE SENSOR DRIVER #
- Mail: Puranjay Mohan <puranjay@kernel.org>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/temperature/ti,tmp117.yaml,drivers/iio/temperature/tmp117.c
THANKO'S RAREMONO AM/FM/SW RADIO RECEIVER USB DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/radio/radio-raremono.c
THERMAL #
- Mail: Rafael J. Wysocki <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@kernel.org>
- Reviewer: Zhang Rui <rui.zhang@intel.com>, Lukasz Luba <lukasz.luba@arm.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-pm/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal
- Files:
Documentation/ABI/testing/sysfs-class-thermal,Documentation/admin-guide/thermal/,Documentation/devicetree/bindings/thermal/,Documentation/driver-api/thermal/,drivers/thermal/,include/dt-bindings/thermal/,include/linux/cpu_cooling.h,include/linux/thermal.h,include/uapi/linux/thermal.h,tools/lib/thermal/,tools/thermal/
THERMAL DRIVER FOR AMLOGIC SOCS #
- Mail: Guillaume La Roque <glaroque@baylibre.com>
- Mailing list: linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org
- Status: Supported
- Web-page: http://linux-meson.com/
- Files:
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml,drivers/thermal/amlogic_thermal.c
THERMAL/CPU_COOLING #
- Mail: Amit Daniel Kachhap <amit.kachhap@gmail.com>, Daniel Lezcano <daniel.lezcano@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org>
- Reviewer: Lukasz Luba <lukasz.luba@arm.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Files:
Documentation/driver-api/thermal/cpu-cooling-api.rst,Documentation/driver-api/thermal/cpu-idle-cooling.rst,drivers/thermal/cpufreq_cooling.c,drivers/thermal/cpuidle_cooling.c,include/linux/cpu_cooling.h
THERMAL/POWER_ALLOCATOR #
- Mail: Lukasz Luba <lukasz.luba@arm.com>
- Mailing list: linux-pm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/driver-api/thermal/power_allocator.rst,drivers/thermal/gov_power_allocator.c,drivers/thermal/thermal_trace_ipa.h
THINKPAD ACPI EXTRAS DRIVER #
- Mail: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
- Mailing list: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org
- Status: Maintained
- Web-page: http://ibm-acpi.sourceforge.net, http://thinkwiki.org/wiki/Ibm-acpi
- SCM: git git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
- Files:
drivers/platform/x86/lenovo/thinkpad_acpi.c
THINKPAD T14S EMBEDDED CONTROLLER DRIVER #
- Mail: Sebastian Reichel <sre@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/embedded-controller/lenovo,thinkpad-t14s-ec.yaml,drivers/platform/arm64/lenovo-thinkpad-t14s.c
THINKPAD LMI DRIVER #
- Mail: Mark Pearson <mpearson-lenovo@squebb.ca>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-firmware-attributes,drivers/platform/x86/lenovo/think-lmi.?
THP7312 ISP DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Paul Elder <paul.elder@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml,Documentation/userspace-api/media/drivers/thp7312.rst,drivers/media/i2c/thp7312.c,include/uapi/linux/thp7312.h
THUNDERBOLT DMA TRAFFIC TEST DRIVER #
- Mail: Isaac Hazan <isaac.hazan@intel.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/thunderbolt/dma_test.c
THUNDERBOLT DRIVER #
- Mail: Andreas Noever <andreas.noever@gmail.com>, Mika Westerberg <westeri@kernel.org>, Yehezkel Bernat <YehezkelShB@gmail.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt.git
- Files:
Documentation/admin-guide/thunderbolt.rst,drivers/thunderbolt/,include/linux/thunderbolt.h
THUNDERBOLT NETWORK DRIVER #
- Mail: Mika Westerberg <westeri@kernel.org>, Yehezkel Bernat <YehezkelShB@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/thunderbolt/
THUNDERX GPIO DRIVER #
- Mail: Robert Richter <rric@kernel.org>
- Status: Odd Fixes
- Files:
drivers/gpio/gpio-thunderx.c
TI ADC12xs and ROHM BD79104 ADC driver #
- Mail: Matti Vaittinen <mazziesaccount@gmail.com>
- Status: Maintained
- Files:
drivers/iio/adc/ti-adc128s052.c - Mailing list: linux-iio@vger.kernel.org
TI ADS1119 ADC DRIVER #
- Mail: Francesco Dolcini <francesco@dolcini.it>, João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml,drivers/iio/adc/ti-ads1119.c
TI ADS1018 ADC DRIVER #
- Mail: Kurt Borja <kuurtb@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/ti,ads1018.yaml,drivers/iio/adc/ti-ads1018.c
TI ADS7924 ADC DRIVER #
- Mail: Hugo Villeneuve <hvilleneuve@dimonoff.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/iio/adc/ti,ads7924.yaml,drivers/iio/adc/ti-ads7924.c
TI AM437X VPFE DRIVER #
- Mail: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
- Files:
drivers/media/platform/ti/am437x/
TI BANDGAP AND THERMAL DRIVER #
- Mail: Eduardo Valentin <edubezval@gmail.com>, Keerthy <j-keerthy@ti.com>
- Mailing list: linux-pm@vger.kernel.org, linux-omap@vger.kernel.org
- Status: Maintained
- Files:
drivers/thermal/ti-soc-thermal/
TI BQ27XXX POWER SUPPLY DRIVER #
- Files:
drivers/power/supply/bq27xxx_battery.c,drivers/power/supply/bq27xxx_battery_i2c.c,include/linux/power/bq27xxx_battery.h
TI CDCE706 CLOCK DRIVER #
- Mail: Max Filippov <jcmvbkbc@gmail.com>
- Status: Maintained
- Files:
drivers/clk/clk-cdce706.c
TI CLOCK DRIVER #
- Mail: Tero Kristo <kristo@kernel.org>
- Mailing list: linux-omap@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/clk/ti/,include/linux/clk/ti.h
TI DATA TRANSFORM AND HASHING ENGINE (DTHE) V2 CRYPTO DRIVER #
- Mail: T Pratham <t-pratham@ti.com>
- Mailing list: linux-crypto@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/crypto/ti,am62l-dthev2.yaml,drivers/crypto/ti/
TI DAVINCI MACHINE SUPPORT #
- Mail: Bartosz Golaszewski <brgl@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
- Files:
Documentation/devicetree/bindings/i2c/i2c-davinci.txt,arch/arm/boot/dts/ti/davinci/,arch/arm/mach-davinci/,drivers/i2c/busses/i2c-davinci.c
TI DAVINCI SERIES CLOCK DRIVER #
- Mail: David Lechner <david@lechnology.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/clock/ti/davinci/,drivers/clk/davinci/,include/linux/clk/davinci.h
TI DAVINCI SERIES GPIO DRIVER #
- Mail: Keerthy <j-keerthy@ti.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/gpio-davinci.yaml,drivers/gpio/gpio-davinci.c
TI DAVINCI SERIES MEDIA DRIVER #
- Mail: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- SCM: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
- Files:
drivers/media/platform/ti/davinci/,include/media/davinci/
TI ENHANCED CAPTURE (eCAP) DRIVER #
- Mail: Vignesh Raghavendra <vigneshr@ti.com>
- Reviewer: Julien Panis <jpanis@baylibre.com>
- Mailing list: linux-iio@vger.kernel.org, linux-omap@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/counter/ti,am62-ecap-capture.yaml,drivers/counter/ti-ecap-capture.c
TI ENHANCED QUADRATURE ENCODER PULSE (eQEP) DRIVER #
- Reviewer: David Lechner <david@lechnology.com>
- Mailing list: linux-iio@vger.kernel.org
- Files:
Documentation/devicetree/bindings/counter/ti-eqep.yaml,drivers/counter/ti-eqep.c
TI ETHERNET SWITCH DRIVER (CPSW) #
- Reviewer: Siddharth Vadapalli <s-vadapalli@ti.com>, Roger Quadros <rogerq@kernel.org>
- Mailing list: linux-omap@vger.kernel.org, netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/ti/cpsw*,drivers/net/ethernet/ti/davinci*
TI FLASH MEDIA MEMORYSTICK/MMC DRIVERS #
- Mail: Alex Dubov <oakad@yahoo.com>
- Status: Maintained
- Web-page: http://tifmxx.berlios.de/
- Files:
drivers/memstick/host/tifm_ms.c,drivers/misc/tifm*,drivers/mmc/host/tifm_sd.c,include/linux/tifm.h
TI FPC202 DUAL PORT CONTROLLER #
- Mail: Romain Gantois <romain.gantois@bootlin.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/misc/ti,fpc202.yaml,drivers/misc/ti_fpc202.c
TI FPD-LINK DRIVERS #
- Mail: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/ti,ds90*,drivers/media/i2c/ds90*,include/media/i2c/ds90*
TI HDC302X HUMIDITY DRIVER #
- Mail: Javier Carrasco <javier.carrasco.cruz@gmail.com>, Li peiyu <579lpy@gmail.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml,drivers/iio/humidity/hdc3020.c
TI ICSSG ETHERNET DRIVER (ICSSG) #
- Reviewer: MD Danish Anwar <danishanwar@ti.com>, Roger Quadros <rogerq@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/ti,icss*.yaml,drivers/net/ethernet/ti/icssg/*
TI ICSSM ETHERNET DRIVER (ICSSM) #
- Mail: MD Danish Anwar <danishanwar@ti.com>, Parvathi Pudi <parvathi@couthit.com>
- Reviewer: Roger Quadros <rogerq@kernel.org>, Mohan Reddy Putluru <pmohan@couthit.com>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/ti,icssm*.yaml,Documentation/devicetree/bindings/net/ti,pruss-ecap.yaml,drivers/net/ethernet/ti/icssm/*
TI J721E CSI2RX DRIVER #
- Mail: Jai Luthra <jai.luthra@linux.dev>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/ti,j721e-csi2rx-shim.yaml,drivers/media/platform/ti/j721e-csi2rx/
TI KEYSTONE MULTICORE NAVIGATOR DRIVERS #
- Mail: Nishanth Menon <nm@ti.com>, Santosh Shilimkar <ssantosh@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
- Files:
Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml,drivers/pmdomain/ti/omap_prm.c,drivers/soc/ti/*,include/linux/pruss_driver.h
TI LM49xxx FAMILY ASoC CODEC DRIVERS #
- Mail: M R Swami Reddy <mr.swami.reddy@ti.com>, Vishwas A Deshpande <vishwas.a.deshpande@ti.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
sound/soc/codecs/isabelle*,sound/soc/codecs/lm49453*
TI LMP92064 ADC DRIVER #
- Mail: Leonard Göhrs <l.goehrs@pengutronix.de>
- Reviewer: kernel@pengutronix.de
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/ti,lmp92064.yaml,drivers/iio/adc/ti-lmp92064.c
TI PCM3060 ASoC CODEC DRIVER #
- Mail: Kirill Marinushkin <k.marinushkin@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/pcm3060.txt,sound/soc/codecs/pcm3060*
TI TAS571X FAMILY ASoC CODEC DRIVER #
- Mail: Kevin Cernekee <cernekee@chromium.org>
- Mailing list: linux-sound@vger.kernel.org
- Status: Odd Fixes
- Files:
sound/soc/codecs/tas571x*
TI TMAG5273 MAGNETOMETER DRIVER #
- Mail: Gerald Loacker <gerald.loacker@wolfvision.net>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/magnetometer/ti,tmag5273.yaml,drivers/iio/magnetometer/tmag5273.c
TI TRF7970A NFC DRIVER #
- Mail: Mark Greer <mgreer@animalcreek.com>
- Mailing list: linux-wireless@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/net/nfc/ti,trf7970a.yaml,drivers/nfc/trf7970a.c
TI TSC2046 ADC DRIVER #
- Mail: Oleksij Rempel <o.rempel@pengutronix.de>
- Reviewer: kernel@pengutronix.de
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/ti,tsc2046.yaml,drivers/iio/adc/ti-tsc2046.c
TI TWL4030 SERIES SOC CODEC DRIVER #
- Mail: Peter Ujfalusi <peter.ujfalusi@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
sound/soc/codecs/twl4030*
TI VPE/CAL DRIVERS #
- Mail: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: http://linuxtv.org/
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
Documentation/devicetree/bindings/media/ti,cal.yaml,Documentation/devicetree/bindings/media/ti,vip.yaml,Documentation/devicetree/bindings/media/ti,vpe.yaml,drivers/media/platform/ti/cal/,drivers/media/platform/ti/vpe/
TI WILINK WIRELESS DRIVERS #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/wl12xx, https://wireless.wiki.kernel.org/en/users/Drivers/wl1251
- Files:
drivers/net/wireless/ti/
TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER #
- Mail: John Stultz <jstultz@google.com>, Thomas Gleixner <tglx@kernel.org>
- Reviewer: Stephen Boyd <sboyd@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
- Files:
include/linux/clocksource.h,include/linux/time.h,include/linux/timekeeper_internal.h,include/linux/timekeeping.h,include/linux/timex.h,include/uapi/linux/time.h,include/uapi/linux/timex.h,kernel/time/alarmtimer.c,kernel/time/clocksource*,kernel/time/ntp*,kernel/time/time.c,kernel/time/timeconst.bc,kernel/time/timeconv.c,kernel/time/timecounter.c,kernel/time/timekeeping*,kernel/time/time_test.c,tools/testing/selftests/timers/
TIPC NETWORK LAYER #
- Mail: Jon Maloy <jmaloy@redhat.com>
- Mailing list: netdev@vger.kernel.org (core kernel code), tipc-discussion@lists.sourceforge.net (user apps, general discussion)
- Status: Maintained
- Web-page: http://tipc.sourceforge.net/
- Files:
include/uapi/linux/tipc*.h,net/tipc/
TLAN NETWORK DRIVER #
- Mail: Samuel Chessman <chessman@tux.org>
- Mailing list: tlan-devel@lists.sourceforge.net (subscribers-only)
- Status: Maintained
- Web-page: http://sourceforge.net/projects/tlan/
- Files:
Documentation/networking/device_drivers/ethernet/ti/tlan.rst,drivers/net/ethernet/ti/tlan.*
TMIO/SDHI MMC DRIVER #
- Mail: Wolfram Sang <wsa+renesas@sang-engineering.com>
- Mailing list: linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org
- Status: Supported
- Files:
drivers/mmc/host/renesas_sdhi*,drivers/mmc/host/tmio_mmc*,include/linux/platform_data/tmio.h
TMP513 HARDWARE MONITOR DRIVER #
- Mail: Eric Tremblay <etremblay@distech-controls.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/tmp513.rst,drivers/hwmon/tmp513.c
TMPFS (SHMEM FILESYSTEM) #
- Mail: Hugh Dickins <hughd@google.com>
- Reviewer: Baolin Wang <baolin.wang@linux.alibaba.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
include/linux/memfd.h,include/linux/shmem_fs.h,mm/memfd.c,mm/shmem.c,mm/shmem_quota.c
TOMOYO SECURITY MODULE #
- Mail: Kentaro Takeda <takedakn@nttdata.co.jp>, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
- Mailing list: tomoyo-users_en@lists.sourceforge.net (subscribers-only, English language), tomoyo-users_ja@lists.sourceforge.net (subscribers-only, Japanese language)
- Status: Maintained
- Web-page: https://tomoyo.sourceforge.net/
- Files:
security/tomoyo/
TOPSTAR LAPTOP EXTRAS DRIVER #
- Mail: Herton Ronaldo Krzesinski <herton@canonical.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/topstar-laptop.c
TORADEX EMBEDDED CONTROLLER DRIVER #
- Mail: Emanuele Ghidoli <ghidoliemanuele@gmail.com>, Francesco Dolcini <francesco@dolcini.it>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/power/reset/toradex,smarc-ec.yaml,drivers/power/reset/tdx-ec-poweroff.c
TORTURE-TEST MODULES #
- Mail: Davidlohr Bueso <dave@stgolabs.net>, "Paul E. McKenney" <paulmck@kernel.org>, Josh Triplett <josh@joshtriplett.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
- Files:
Documentation/RCU/torture.rst,kernel/locking/locktorture.c,kernel/rcu/rcuscale.c,kernel/rcu/rcutorture.c,kernel/rcu/refscale.c,kernel/torture.c
TOSHIBA ACPI EXTRAS DRIVER #
- Mail: Azael Avalos <coproscefalo@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/toshiba_acpi.c
TOSHIBA BLUETOOTH DRIVER #
- Mail: Azael Avalos <coproscefalo@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/toshiba_bluetooth.c
TOSHIBA HDD ACTIVE PROTECTION SENSOR DRIVER #
- Mail: Azael Avalos <coproscefalo@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/toshiba_haps.c
TOSHIBA SMM DRIVER #
- Mail: Jonathan Buzzard <jonathan@buzzard.org.uk>
- Status: Maintained
- Web-page: http://www.buzzard.org.uk/toshiba/
- Files:
drivers/char/toshiba.c,include/linux/toshiba.h,include/uapi/linux/toshiba.h
TOSHIBA TC358743 DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/i2c/toshiba,tc358743.txt,drivers/media/i2c/tc358743*,include/media/i2c/tc358743.h
TOSHIBA WMI HOTKEYS DRIVER #
- Mail: Azael Avalos <coproscefalo@gmail.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/toshiba-wmi.c
TOUCH OVERLAY #
- Mail: Javier Carrasco <javier.carrasco@wolfvision.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/touch-overlay.c,include/linux/input/touch-overlay.h
TPM DEVICE DRIVER #
- Mail: Peter Huewe <peterhuewe@gmx.de>, Jarkko Sakkinen <jarkko@kernel.org>
- Reviewer: Jason Gunthorpe <jgg@ziepe.ca>
- Mailing list: linux-integrity@vger.kernel.org
- Status: Maintained
- Web-page: https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd-test.git/about/
- Patchwork: https://patchwork.kernel.org/project/linux-integrity/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git
- Files:
Documentation/devicetree/bindings/tpm/,drivers/char/tpm/,include/linux/tpm*.h,include/uapi/linux/vtpm_proxy.h,tools/testing/selftests/tpm2/
TPS546D24 DRIVER #
- Mail: Duke Du <dukedu83@gmail.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/tps546d24.rst,drivers/hwmon/pmbus/tps546d24.c
TQ SYSTEMS BOARD & DRIVER SUPPORT #
- Mailing list: linux@ew.tq-group.com
- Status: Supported
- Web-page: https://www.tq-group.com/en/products/tq-embedded/
- Files:
arch/arm/boot/dts/nxp/imx/*mba*.dts*,arch/arm/boot/dts/nxp/imx/*tqma*.dts*,arch/arm/boot/dts/ti/omap/*mba*.dts*,arch/arm/boot/dts/ti/omap/*tqma*.dts*,arch/arm64/boot/dts/freescale/fsl-*tqml*.dts*,arch/arm64/boot/dts/freescale/imx*mba*.dts*,arch/arm64/boot/dts/freescale/imx*tqma*.dts*,arch/arm64/boot/dts/freescale/mba*.dtsi,arch/arm64/boot/dts/freescale/tqma8*.dtsi,arch/arm64/boot/dts/freescale/tqml*.dts*,drivers/gpio/gpio-tqmx86.c,drivers/mfd/tqmx86.c,drivers/watchdog/tqmx86_wdt.c
TRACING #
- Mail: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>
- Reviewer: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- Mailing list: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-trace-kernel/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
- Files:
Documentation/core-api/tracepoint.rst,Documentation/trace/*,fs/tracefs/,include/linux/trace*.h,include/trace/,kernel/trace/,kernel/tracepoint.c,scripts/tracing/,scripts/tracepoint-update.c,tools/testing/selftests/ftrace/
TRACING [RUST] #
- Mail: Alice Ryhl <aliceryhl@google.com>, Steven Rostedt <rostedt@goodmis.org>
- Reviewer: Masami Hiramatsu <mhiramat@kernel.org>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- Mailing list: linux-trace-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
- Files:
rust/kernel/tracepoint.rs
TRACING MMIO ACCESSES (MMIOTRACE) #
- Mail: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>
- Reviewer: Pekka Paalanen <ppaalanen@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org
- Status: Maintained
- Files:
arch/x86/mm/kmmio.c,arch/x86/mm/mmio-mod.c,arch/x86/mm/testmmiotrace.c,include/linux/mmiotrace.h,kernel/trace/trace_mmiotrace.c
TRACING OS NOISE / LATENCY TRACERS #
- Mail: Steven Rostedt <rostedt@goodmis.org>
- Status: Maintained
- Files:
Documentation/trace/hwlat_detector.rst,Documentation/trace/osnoise-tracer.rst,Documentation/trace/timerlat-tracer.rst,arch/*/kernel/trace.c,include/trace/events/osnoise.h,kernel/trace/trace_hwlat.c,kernel/trace/trace_irqsoff.c,kernel/trace/trace_osnoise.c,kernel/trace/trace_sched_wakeup.c
TRADITIONAL CHINESE DOCUMENTATION #
- Mail: Hu Haowen <2023002089@link.tyut.edu.cn>
- Status: Maintained
- Web-page: https://github.com/srcres258/linux-doc
- SCM: git https://github.com/srcres258/linux-doc.git doc-zh-tw
- Files:
Documentation/translations/zh_TW/
TRIGGER SOURCE #
- Mail: David Lechner <dlechner@baylibre.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/trigger-source/*
TRUSTED EXECUTION ENVIRONMENT SECURITY MANAGER (TSM) #
- Mail: Dan Williams <dan.j.williams@intel.com>
- Mailing list: linux-coco@lists.linux.dev
- Status: Maintained
- Files:
Documentation/ABI/testing/configfs-tsm-report,Documentation/driver-api/coco/,Documentation/driver-api/pci/tsm.rst,drivers/pci/tsm.c,drivers/virt/coco/guest/,include/linux/*tsm*.h,samples/tsm-mr/
TRUSTED SERVICES TEE DRIVER #
- Mail: Balint Dobszay <balint.dobszay@arm.com>, Sudeep Holla <sudeep.holla@kernel.org>
- Mailing list: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers), trusted-services@lists.trustedfirmware.org
- Status: Maintained
- Files:
Documentation/tee/ts-tee.rst,drivers/tee/tstee/
TTY LAYER AND SERIAL DRIVERS #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
- Files:
Documentation/devicetree/bindings/serial/,Documentation/driver-api/serial/,drivers/tty/,include/linux/selection.h,include/linux/serial.h,include/linux/serial_core.h,include/linux/sysrq.h,include/linux/tty*.h,include/linux/vt.h,include/linux/vt_*.h,include/uapi/linux/serial.h,include/uapi/linux/serial_core.h,include/uapi/linux/tty.h
TUA9001 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org
- Patchwork: http://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/tuners/tua9001*
TULIP NETWORK DRIVERS #
- Mailing list: netdev@vger.kernel.org, linux-parisc@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/ethernet/dec/tulip/
TUN/TAP DRIVER #
- Mail: Willem de Bruijn <willemdebruijn.kernel@gmail.com>, Jason Wang <jasowang@redhat.com>
- Status: Maintained
- Web-page: http://vtun.sourceforge.net/tun
- Files:
Documentation/networking/tuntap.rst,drivers/net/tap.c,drivers/net/tun*
TURBOCHANNEL SUBSYSTEM #
- Mail: "Maciej W. Rozycki" <macro@orcam.me.uk>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/linux-mips/list/
- Files:
drivers/tc/,include/linux/tc.h
TURBOSTAT UTILITY #
- Mail: "Len Brown" <lenb@kernel.org>
- Mailing list: linux-pm@vger.kernel.org
- Status: Supported
- Patchwork: https://patchwork.kernel.org/project/linux-pm/list/
- bugs: https://bugzilla.kernel.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git turbostat
- Files:
tools/power/x86/turbostat/,tools/testing/selftests/turbostat/
TUXEDO DRIVERS #
- Mail: Werner Sembach <wse@tuxedocomputers.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Supported
- Files:
drivers/platform/x86/tuxedo/
TW5864 VIDEO4LINUX DRIVER #
- Mail: Bluecherry Maintainers <maintainers@bluecherrydvr.com>, Andrey Utkin <andrey.utkin@corp.bluecherry.net>, Andrey Utkin <andrey_utkin@fastmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
drivers/media/pci/tw5864/
TW68 VIDEO4LINUX DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Odd Fixes
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/tw68/
TW686X VIDEO4LINUX DRIVER #
- Mail: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: http://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/pci/tw686x/
U-BOOT ENVIRONMENT VARIABLES #
- Mail: Rafał Miłecki <rafal@milecki.pl>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml,drivers/nvmem/layouts/u-boot-env.c,drivers/nvmem/u-boot-env.c
UACCE ACCELERATOR FRAMEWORK #
- Mail: Zhangfei Gao <zhangfei.gao@linaro.org>, Zhou Wang <wangzhou1@hisilicon.com>
- Mailing list: linux-accelerators@lists.ozlabs.org, linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-driver-uacce,Documentation/misc-devices/uacce.rst,drivers/misc/uacce/,include/linux/uacce.h,include/uapi/misc/uacce/
UBI FILE SYSTEM (UBIFS) #
- Mail: Richard Weinberger <richard@nod.at>
- Reviewer: Zhihao Cheng <chengzhihao1@huawei.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Supported
- Web-page: http://www.linux-mtd.infradead.org/doc/ubifs.html
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git next, git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git fixes
- Files:
Documentation/ABI/testing/sysfs-fs-ubifs,Documentation/filesystems/ubifs-authentication.rst,Documentation/filesystems/ubifs.rst,fs/ubifs/
UBLK USERSPACE BLOCK DRIVER #
- Mail: Ming Lei <ming.lei@redhat.com>
- Mailing list: linux-block@vger.kernel.org
- Status: Maintained
- Files:
Documentation/block/ublk.rst,drivers/block/ublk_drv.c,include/uapi/linux/ublk_cmd.h,tools/testing/selftests/ublk/
UBSAN #
- Mail: Kees Cook <kees@kernel.org>
- Reviewer: Marco Elver <elver@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Andrey Ryabinin <ryabinin.a.a@gmail.com>
- Mailing list: kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
Documentation/dev-tools/ubsan.rst,include/linux/ubsan.h,lib/Kconfig.ubsan,lib/test_ubsan.c,lib/ubsan.c,lib/ubsan.h,scripts/Makefile.ubsan - Content regex:
\bARCH_HAS_UBSAN\b
UCLINUX (M68KNOMMU AND COLDFIRE) #
- Mail: Greg Ungerer <gerg@linux-m68k.org>
- Mailing list: linux-m68k@lists.linux-m68k.org
- Status: Maintained
- Web-page: http://www.linux-m68k.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git
- Files:
arch/m68k/*/*_no.*,arch/m68k/68*/,arch/m68k/coldfire/,arch/m68k/include/asm/*_no.*
UDF FILESYSTEM #
- Mail: Jan Kara <jack@suse.com>
- Status: Maintained
- Files:
Documentation/filesystems/udf.rst,fs/udf/
UDRAW TABLET #
- Mail: Bastien Nocera <hadess@hadess.net>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-udraw-ps3.c
UHID USERSPACE HID IO DRIVER #
- Mail: David Rheinsberg <david@readahead.eu>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/uhid.c,include/uapi/linux/uhid.h
ULPI BUS #
- Mail: Heikki Krogerus <heikki.krogerus@linux.intel.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/common/ulpi.c,include/linux/ulpi/
ULTRATRONIK BOARD SUPPORT #
- Mail: Goran Rađenović <goran.radni@gmail.com>, Börge Strümpfel <boerge.struempfel@gmail.com>
- Status: Maintained
- Files:
arch/arm/boot/dts/st/stm32mp157c-ultra-fly-sbc.dts,arch/arm64/boot/dts/freescale/imx8mp-ultra-mach-sbc.dts
UNICODE SUBSYSTEM #
- Mail: Gabriel Krisman Bertazi <krisman@kernel.org>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/krisman/unicode.git
- Files:
fs/unicode/
UNIFDEF #
- Mail: Tony Finch <dot@dotat.at>
- Status: Maintained
- Web-page: http://dotat.at/prog/unifdef
- Files:
scripts/unifdef.c
UNIFORM CDROM DRIVER #
- Mail: Phillip Potter <phil@philpotter.co.uk>
- Status: Maintained
- Files:
Documentation/cdrom/,drivers/cdrom/cdrom.c,include/linux/cdrom.h,include/uapi/linux/cdrom.h
UNION-FIND #
- Mail: Xavier <xavier_qy@163.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/core-api/union_find.rst,Documentation/translations/zh_CN/core-api/union_find.rst,include/linux/union_find.h,lib/union_find.c
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER #
- Reviewer: Alim Akhtar <alim.akhtar@samsung.com>, Avri Altman <avri.altman@wdc.com>, Bart Van Assche <bvanassche@acm.org>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/ufs/,Documentation/scsi/ufs.rst,drivers/ufs/core/,include/ufs/
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER AMD VERSAL2 #
- Mail: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>, Ajay Neeli <ajay.neeli@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/ufs/amd,versal2-ufs.yaml,drivers/ufs/host/ufs-amd-versal2.c
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER DWC HOOKS #
- Mail: Pedro Sousa <pedrom.sousa@synopsys.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/ufs/host/*dwc*
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER EXYNOS HOOKS #
- Mail: Alim Akhtar <alim.akhtar@samsung.com>
- Reviewer: Peter Griffin <peter.griffin@linaro.org>
- Mailing list: linux-scsi@vger.kernel.org, linux-samsung-soc@vger.kernel.org
- Status: Maintained
- Files:
drivers/ufs/host/ufs-exynos*
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER MEDIATEK HOOKS #
- Mail: Peter Wang <peter.wang@mediatek.com>, Chaotian Jing <chaotian.jing@mediatek.com>
- Reviewer: Stanley Jhu <chu.stanley@gmail.com>
- Mailing list: linux-scsi@vger.kernel.org, linux-mediatek@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/ufs/host/ufs-mediatek*
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER QUALCOMM HOOKS #
- Mail: Manivannan Sadhasivam <mani@kernel.org>
- Mailing list: linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/ufs/qcom*,drivers/ufs/host/ufs-qcom*
UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER RENESAS HOOKS #
- Mail: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
- Mailing list: linux-renesas-soc@vger.kernel.org, linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/ufs/host/ufs-renesas.c
UNIWILL LAPTOP DRIVER #
- Mail: Armin Wolf <W_Armin@gmx.de>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-driver-uniwill-laptop,Documentation/admin-guide/laptops/uniwill-laptop.rst,Documentation/wmi/devices/uniwill-laptop.rst,drivers/platform/x86/uniwill/uniwill-acpi.c,drivers/platform/x86/uniwill/uniwill-wmi.c,drivers/platform/x86/uniwill/uniwill-wmi.h
UNSORTED BLOCK IMAGES (UBI) #
- Mail: Richard Weinberger <richard@nod.at>
- Reviewer: Zhihao Cheng <chengzhihao1@huawei.com>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Supported
- Web-page: http://www.linux-mtd.infradead.org/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git next, git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git fixes
- Files:
drivers/mtd/ubi/,include/linux/mtd/ubi.h,include/uapi/mtd/ubi-user.h
UPROBES #
- Mail: Masami Hiramatsu <mhiramat@kernel.org>, Oleg Nesterov <oleg@redhat.com>, Peter Zijlstra <peterz@infradead.org>
- Mailing list: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
- Status: Maintained
- Files:
arch/*/include/asm/uprobes.h,arch/*/kernel/probes/uprobes.c,arch/*/kernel/uprobes.c,include/linux/uprobes.h,kernel/events/uprobes.c
USB "USBNET" DRIVER FRAMEWORK #
- Mail: Oliver Neukum <oneukum@suse.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.linux-usb.org/usbnet
- Files:
drivers/net/usb/usbnet.c,include/linux/usb/usbnet.h
USB ACM DRIVER #
- Mail: Oliver Neukum <oneukum@suse.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/usb/acm.rst,drivers/usb/class/cdc-acm.*
USB APPLE MFI FASTCHARGE DRIVER #
- Mail: Bastien Nocera <hadess@hadess.net>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/misc/apple-mfi-fastcharge.c
USB AR5523 WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wireless/ath/ar5523/
USB ATTACHED SCSI #
- Mail: Oliver Neukum <oneukum@suse.com>
- Mailing list: linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/storage/uas.c
USB CDC ETHERNET DRIVER #
- Mail: Oliver Neukum <oliver@neukum.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/usb/cdc_*.c,include/uapi/linux/usb/cdc.h
USB CHAOSKEY DRIVER #
- Mail: Keith Packard <keithp@keithp.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/misc/chaoskey.c
USB CYPRESS C67X00 DRIVER #
- Mailing list: linux-usb@vger.kernel.org
- Status: Orphan
- Files:
drivers/usb/c67x00/
USB DAVICOM DM9601 DRIVER #
- Mail: Peter Korsgaard <peter@korsgaard.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: http://www.linux-usb.org/usbnet
- Files:
drivers/net/usb/dm9601.c
USB EHCI DRIVER #
- Mail: Alan Stern <stern@rowland.harvard.edu>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/usb/ehci.rst,drivers/usb/host/ehci*
USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) #
- Mail: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
- Files:
Documentation/hid/hiddev.rst,drivers/hid/usbhid/
USB INTEL XHCI ROLE MUX DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/roles/intel-xhci-usb-role-switch.c
USB IP DRIVER FOR HISILICON KIRIN 960 #
- Mail: Yu Chen <chenyu56@huawei.com>, Binghui Wang <wangbinghui@hisilicon.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/hisilicon,hi3660-usb3.yaml,drivers/phy/hisilicon/phy-hi3660-usb3.c
USB IP DRIVER FOR HISILICON KIRIN 970 #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml,drivers/phy/hisilicon/phy-hi3670-usb3.c
USB ISP116X DRIVER #
- Mail: Olav Kongas <ok@artecdesign.ee>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/host/isp116x*,include/linux/usb/isp116x.h
USB ISP1760 DRIVER #
- Mail: Rui Miguel Silva <rui.silva@linaro.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/nxp,isp1760.yaml,drivers/usb/isp1760/*
USB LAN78XX ETHERNET DRIVER #
- Mail: Thangaraj Samynathan <Thangaraj.S@microchip.com>, Rengarajan Sundararajan <Rengarajan.S@microchip.com>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/microchip,lan78xx.txt,drivers/net/usb/lan78xx.*,include/dt-bindings/net/microchip-lan78xx.h
USB MASS STORAGE DRIVER #
- Mail: Alan Stern <stern@rowland.harvard.edu>
- Mailing list: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net
- Status: Maintained
- Files:
drivers/usb/storage/
USB MIDI DRIVER #
- Mail: Clemens Ladisch <clemens@ladisch.de>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
sound/usb/midi.*
USB NETWORKING DRIVERS #
- Mailing list: linux-usb@vger.kernel.org
- Status: Odd Fixes
- Files:
drivers/net/usb/
USB OHCI DRIVER #
- Mail: Alan Stern <stern@rowland.harvard.edu>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/usb/ohci.rst,drivers/usb/host/ohci*
USB OTG FSM (Finite State Machine) #
- Mail: Peter Chen <peter.chen@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
- Files:
drivers/usb/common/usb-otg-fsm.c
USB OVER IP DRIVER #
- Mail: Valentina Manea <valentina.manea.m@gmail.com>, Shuah Khan <shuah@kernel.org>, Shuah Khan <skhan@linuxfoundation.org>
- Reviewer: Hongren Zheng <i@zenithal.me>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/usb/usbip_protocol.rst,drivers/usb/usbip/,tools/testing/selftests/drivers/usb/usbip/,tools/usb/usbip/
USB PEGASUS DRIVER #
- Mail: Petko Manolov <petkan@nucleusys.com>
- Mailing list: linux-usb@vger.kernel.org, netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/petkan/pegasus
- SCM: git https://github.com/petkan/pegasus.git
- Files:
drivers/net/usb/pegasus.*
USB PRINTER DRIVER (usblp) #
- Mail: Pete Zaitcev <zaitcev@redhat.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Supported
- Files:
drivers/usb/class/usblp.c
USB QMI WWAN NETWORK DRIVER #
- Mail: Bjørn Mork <bjorn@mork.no>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-net-qmi,drivers/net/usb/qmi_wwan.c
USB RAW GADGET DRIVER #
- Reviewer: Andrey Konovalov <andreyknvl@gmail.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- bugs: https://github.com/xairy/raw-gadget/issues
- Files:
Documentation/usb/raw-gadget.rst,drivers/usb/gadget/legacy/raw_gadget.c,include/uapi/linux/usb/raw_gadget.h
USB RTL8150 DRIVER #
- Mail: Petko Manolov <petkan@nucleusys.com>
- Mailing list: linux-usb@vger.kernel.org, netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/petkan/rtl8150
- SCM: git https://github.com/petkan/rtl8150.git
- Files:
drivers/net/usb/rtl8150.c
USB SERIAL SUBSYSTEM #
- Mail: Johan Hovold <johan@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git
- Files:
Documentation/usb/usb-serial.rst,drivers/usb/serial/,include/linux/usb/serial.h
USB SMSC75XX ETHERNET DRIVER #
- Mail: Steve Glendinning <steve.glendinning@shawell.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/usb/smsc75xx.*
USB SMSC95XX ETHERNET DRIVER #
- Mail: Steve Glendinning <steve.glendinning@shawell.net>, UNGLinuxDriver@microchip.com
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/usb/smsc95xx.*
USB SUBSYSTEM #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Supported
- Web-page: http://www.linux-usb.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
- Files:
Documentation/devicetree/bindings/usb/,Documentation/usb/,drivers/usb/,include/dt-bindings/usb/,include/linux/usb.h,include/linux/usb/,include/uapi/linux/usb/
USB TYPEC BUS FOR ALTERNATE MODES #
- Mail: Heikki Krogerus <heikki.krogerus@linux.intel.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-typec,Documentation/driver-api/usb/typec_bus.rst,drivers/usb/typec/altmodes/,include/linux/usb/typec_altmode.h
USB TYPEC CLASS #
- Mail: Heikki Krogerus <heikki.krogerus@linux.intel.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-class-typec,Documentation/driver-api/usb/typec.rst,drivers/usb/typec/,include/linux/usb/typec.h
USB TYPEC INTEL PMC MUX DRIVER #
- Mail: Heikki Krogerus <heikki.krogerus@linux.intel.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/firmware-guide/acpi/intel-pmc-mux.rst,drivers/usb/typec/mux/intel_pmc_mux.c
USB TYPEC PI3USB30532 MUX DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/typec/mux/pi3usb30532.c
USB TYPEC PORT CONTROLLER DRIVERS #
- Mail: Badhri Jagan Sridharan <badhri@google.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/typec/tcpm/tcpci.c,drivers/usb/typec/tcpm/tcpm.c,include/linux/usb/tcpci.h,include/linux/usb/tcpm.h
USB TYPEC TUSB1046 MUX DRIVER #
- Mail: Romain Gantois <romain.gantois@bootlin.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/usb/ti,tusb1046.yaml,drivers/usb/typec/mux/tusb1046.c
USB UHCI DRIVER #
- Mail: Alan Stern <stern@rowland.harvard.edu>
- Mailing list: linux-usb@vger.kernel.org
- Status: Maintained
- Files:
drivers/usb/host/uhci*
USB VIDEO CLASS #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Hans de Goede <hansg@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: http://www.ideasonboard.org/uvc/
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/userspace-api/media/drivers/uvcvideo.rst,Documentation/userspace-api/media/v4l/metafmt-uvc-msxu-1-5.rst,Documentation/userspace-api/media/v4l/metafmt-uvc.rst,drivers/media/common/uvc.c,drivers/media/usb/uvc/,include/linux/usb/uvc.h,include/uapi/linux/uvcvideo.h
USB WEBCAM GADGET #
- Mailing list: linux-usb@vger.kernel.org
- Status: Orphan
- Files:
drivers/usb/gadget/function/*uvc*,drivers/usb/gadget/legacy/webcam.c,include/uapi/linux/usb/g_uvc.h
USB XHCI DRIVER #
- Mail: Mathias Nyman <mathias.nyman@intel.com>
- Mailing list: linux-usb@vger.kernel.org
- Status: Supported
- Files:
drivers/usb/host/pci-quirks*,drivers/usb/host/xhci*
USER DATAGRAM PROTOCOL (UDP) #
- Mail: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
include/linux/udp.h,include/net/udp.h,include/trace/events/udp.h,include/uapi/linux/udp.h,net/ipv4/udp.c,net/ipv6/udp.c
USER-MODE LINUX (UML) #
- Mail: Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, Johannes Berg <johannes@sipsolutions.net>
- Mailing list: linux-um@lists.infradead.org
- Status: Maintained
- Web-page: http://user-mode-linux.sourceforge.net
- Patchwork: https://patchwork.ozlabs.org/project/linux-um/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux.git next, git git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux.git fixes
- Files:
Documentation/virt/uml/,arch/um/,arch/x86/um/,fs/hostfs/
USERSPACE COPYIN/COPYOUT (UIOVEC) #
- Mail: Alexander Viro <viro@zeniv.linux.org.uk>
- Mailing list: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
include/linux/uio.h,lib/iov_iter.c
USERSPACE DMA BUFFER DRIVER #
- Mail: Gerd Hoffmann <kraxel@redhat.com>, Vivek Kasireddy <vivek.kasireddy@intel.com>
- Mailing list: dri-devel@lists.freedesktop.org
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/dma-buf/udmabuf.c,include/uapi/linux/udmabuf.h
USERSPACE I/O (UIO) #
- Mail: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
- Files:
Documentation/driver-api/uio-howto.rst,drivers/uio/,include/linux/uio_driver.h
USERSPACE STACK UNWINDING #
- Mail: Josh Poimboeuf <jpoimboe@kernel.org>, Steven Rostedt <rostedt@goodmis.org>
- Status: Maintained
- Files:
include/linux/unwind*.h,kernel/unwind/
UTIL-LINUX PACKAGE #
- Mail: Karel Zak <kzak@redhat.com>
- Mailing list: util-linux@vger.kernel.org
- Status: Maintained
- Web-page: http://en.wikipedia.org/wiki/Util-linux
- SCM: git git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
UUID HELPERS #
- Reviewer: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
include/linux/uuid.h,lib/tests/uuid_kunit.c,lib/uuid.c
UV SYSFS DRIVER #
- Mail: Justin Ernst <justin.ernst@hpe.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
drivers/platform/x86/uv_sysfs.c
UVESAFB DRIVER #
- Mail: Michal Januszewski <spock@gentoo.org>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Web-page: https://github.com/mjanusz/v86d
- Files:
Documentation/fb/uvesafb.rst,drivers/video/fbdev/uvesafb.*
Ux500 CLOCK DRIVERS #
- Mail: Ulf Hansson <ulfh@kernel.org>
- Mailing list: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
- Status: Maintained
- Files:
drivers/clk/ux500/
V4L2 ASYNC AND FWNODE FRAMEWORKS #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/v4l2-core/v4l2-async.c,drivers/media/v4l2-core/v4l2-fwnode.c,include/media/v4l2-async.h,include/media/v4l2-fwnode.h
V4L2 LENS DRIVERS #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/ak*,drivers/media/i2c/dw*,drivers/media/i2c/lm*
V4L2 CAMERA SENSOR DRIVERS #
- Mail: Sakari Ailus <sakari.ailus@linux.intel.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/driver-api/media/camera-sensor.rst,Documentation/driver-api/media/tx-rx.rst,drivers/media/i2c/ar*,drivers/media/i2c/gc*,drivers/media/i2c/hi*,drivers/media/i2c/imx*,drivers/media/i2c/mt*,drivers/media/i2c/og*,drivers/media/i2c/ov*,drivers/media/i2c/s5*,drivers/media/i2c/vd55g1.c,drivers/media/i2c/vd56g3.c,drivers/media/i2c/vgxy61.c
V4L2 GENERIC ISP PARAMETERS AND STATISTIC FORMATS #
- Mail: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/driver-api/media/v4l2-isp.rst,Documentation/userspace-api/media/v4l/v4l2-isp.rst,drivers/media/v4l2-core/v4l2-isp.c,include/media/v4l2-isp.h,include/uapi/linux/media/v4l2-isp.h
VF610 NAND DRIVER #
- Mail: Stefan Agner <stefan@agner.ch>
- Mailing list: linux-mtd@lists.infradead.org
- Status: Supported
- Files:
drivers/mtd/nand/raw/vf610_nfc.c
VFAT/FAT/MSDOS FILESYSTEM #
- Mail: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
- Status: Maintained
- Files:
Documentation/filesystems/vfat.rst,fs/fat/,tools/testing/selftests/filesystems/fat/
VFIO CDX DRIVER #
- Mail: Nipun Gupta <nipun.gupta@amd.com>, Nikhil Agarwal <nikhil.agarwal@amd.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
drivers/vfio/cdx/*
VFIO DRIVER #
- Mail: Alex Williamson <alex@shazbot.org>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- SCM: git https://github.com/awilliam/linux-vfio.git
- Files:
Documentation/ABI/testing/debugfs-vfio,Documentation/ABI/testing/sysfs-devices-vfio-dev,Documentation/driver-api/vfio.rst,drivers/vfio/,include/linux/vfio.h,include/linux/vfio_pci_core.h,include/uapi/linux/vfio.h,tools/testing/selftests/vfio/
VFIO FSL-MC DRIVER #
- Mail: Ioana Ciornei <ioana.ciornei@nxp.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
drivers/vfio/fsl-mc/
VFIO HISILICON PCI DRIVER #
- Mail: Longfang Liu <liulongfang@huawei.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
drivers/vfio/pci/hisilicon/
VFIO MEDIATED DEVICE DRIVERS #
- Mail: Kirti Wankhede <kwankhede@nvidia.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/driver-api/vfio-mediated-device.rst,drivers/vfio/mdev/,include/linux/mdev.h,samples/vfio-mdev/
VFIO MLX5 PCI DRIVER #
- Mail: Yishai Hadas <yishaih@nvidia.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
drivers/vfio/pci/mlx5/
VFIO NVIDIA GRACE GPU DRIVER #
- Mail: Ankit Agrawal <ankita@nvidia.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- Files:
drivers/vfio/pci/nvgrace-gpu/
VFIO PCI DEVICE SPECIFIC DRIVERS #
- Reviewer: Jason Gunthorpe <jgg@nvidia.com>, Yishai Hadas <yishaih@nvidia.com>, Shameer Kolothum <skolothumtho@nvidia.com>, Kevin Tian <kevin.tian@intel.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Subsystem Profile: Documentation/driver-api/vfio-pci-device-specific-driver-acceptance.rst
- Files:
drivers/vfio/pci/*/
VFIO PDS PCI DRIVER #
- Mail: Brett Creeley <brett.creeley@amd.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/device_drivers/ethernet/amd/pds_vfio_pci.rst,drivers/vfio/pci/pds/
VFIO PLATFORM DRIVER #
- Mail: Eric Auger <eric.auger@redhat.com>
- Reviewer: Mostafa Saleh <smostafa@google.com>, Pranjal Shrivastava <praan@google.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
drivers/vfio/platform/
VFIO QAT PCI DRIVER #
- Mail: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
- Mailing list: kvm@vger.kernel.org, qat-linux@intel.com
- Status: Supported
- Files:
drivers/vfio/pci/qat/
VFIO SELFTESTS #
- Mail: David Matlack <dmatlack@google.com>
- Mailing list: kvm@vger.kernel.org
- Status: Maintained
- Files:
tools/testing/selftests/vfio/
VFIO VIRTIO PCI DRIVER #
- Mail: Yishai Hadas <yishaih@nvidia.com>
- Mailing list: kvm@vger.kernel.org, virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/vfio/pci/virtio
VFIO XE PCI DRIVER #
- Mail: Michał Winiarski <michal.winiarski@intel.com>
- Mailing list: kvm@vger.kernel.org, intel-xe@lists.freedesktop.org
- Status: Supported
- Files:
drivers/vfio/pci/xe
VGA_SWITCHEROO #
- Reviewer: Lukas Wunner <lukas@wunner.de>
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
Documentation/gpu/vga-switcheroo.rst,drivers/gpu/vga/vga_switcheroo.c,include/linux/vga_switcheroo.h
VIA RHINE NETWORK DRIVER #
- Mail: Kevin Brace <kevinbrace@bracecomputerlab.com>
- Status: Maintained
- Files:
drivers/net/ethernet/via/via-rhine.c
VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER #
- Mail: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
- Mailing list: linux-fbdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/video/fbdev/via/,include/linux/via-core.h,include/linux/via_i2c.h
VIA VELOCITY NETWORK DRIVER #
- Mail: Francois Romieu <romieu@fr.zoreil.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/ethernet/via/via-velocity.*
VICODEC VIRTUAL CODEC DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/test-drivers/vicodec/*
VIDEO I2C POLLING DRIVER #
- Mail: Matt Ranostay <matt.ranostay@konsulko.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/i2c/video-i2c.c
VIDEO MULTIPLEXER DRIVER #
- Mail: Philipp Zabel <p.zabel@pengutronix.de>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/platform/video-mux.c
VIDEOBUF2 FRAMEWORK #
- Mail: Tomasz Figa <tfiga@chromium.org>, Marek Szyprowski <m.szyprowski@samsung.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
drivers/media/common/videobuf2/*,include/media/videobuf2-*
VIDTV VIRTUAL DIGITAL TV DRIVER #
- Mail: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/test-drivers/vidtv/*
VIMC VIRTUAL MEDIA CONTROLLER DRIVER #
- Mail: Shuah Khan <skhan@linuxfoundation.org>
- Reviewer: Kieran Bingham <kieran.bingham@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/test-drivers/vimc/*
VIRT LIB #
- Mail: Alex Williamson <alex@shazbot.org>, Paolo Bonzini <pbonzini@redhat.com>
- Mailing list: kvm@vger.kernel.org
- Status: Supported
- Files:
virt/lib/
VIRTIO AND VHOST VSOCK DRIVER #
- Mail: Stefan Hajnoczi <stefanha@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>
- Mailing list: kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/vhost/vsock.c,include/linux/virtio_vsock.h,include/net/netns/vsock.h,include/uapi/linux/virtio_vsock.h,net/vmw_vsock/virtio_transport.c,net/vmw_vsock/virtio_transport_common.c
VIRTIO BALLOON #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>, David Hildenbrand <david@kernel.org>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/virtio/virtio_balloon.c,include/uapi/linux/virtio_balloon.h
VIRTIO BLOCK AND SCSI DRIVERS #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
- Reviewer: Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Eugenio Pérez <eperezma@redhat.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/block/virtio_blk.c,drivers/scsi/virtio_scsi.c,include/uapi/linux/virtio_blk.h,include/uapi/linux/virtio_scsi.h
VIRTIO CONSOLE DRIVER #
- Mail: Amit Shah <amit@kernel.org>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/char/virtio_console.c,include/uapi/linux/virtio_console.h
VIRTIO CORE #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
- Reviewer: Xuan Zhuo <xuanzhuo@linux.alibaba.com>, Eugenio Pérez <eperezma@redhat.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-bus-vdpa,Documentation/ABI/testing/sysfs-class-vduse,Documentation/devicetree/bindings/virtio/,Documentation/driver-api/virtio/,drivers/block/virtio_blk.c,drivers/crypto/virtio/,drivers/vdpa/,drivers/virtio/,include/linux/vdpa.h,include/linux/virtio*.h,include/linux/vringh.h,include/uapi/linux/virtio_*.h,net/vmw_vsock/virtio*,tools/virtio/
VIRTIO CRYPTO DRIVER #
- Mail: Gonglei <arei.gonglei@huawei.com>
- Mailing list: virtualization@lists.linux.dev, linux-crypto@vger.kernel.org
- Status: Maintained
- Files:
drivers/crypto/virtio/,include/uapi/linux/virtio_crypto.h
VIRTIO DRIVERS FOR S390 #
- Mail: Cornelia Huck <cohuck@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>
- Mailing list: linux-s390@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org
- Status: Supported
- Files:
arch/s390/include/uapi/asm/virtio-ccw.h,drivers/s390/virtio/
VIRTIO FILE SYSTEM #
- Mail: German Maglione <gmaglione@redhat.com>, Vivek Goyal <vgoyal@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Miklos Szeredi <miklos@szeredi.hu>
- Reviewer: Eugenio Pérez <eperezma@redhat.com>
- Mailing list: virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org
- Status: Supported
- Web-page: https://virtio-fs.gitlab.io/
- Files:
Documentation/filesystems/virtiofs.rst,fs/fuse/virtio_fs.c,include/uapi/linux/virtio_fs.h
VIRTIO GPIO DRIVER #
- Mail: Enrico Weigelt, metux IT consult <info@metux.net>, Viresh Kumar <vireshk@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org, virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/gpio/gpio-virtio.c,include/uapi/linux/virtio_gpio.h
VIRTIO GPU DRIVER #
- Mail: David Airlie <airlied@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, Dmitry Osipenko <dmitry.osipenko@collabora.com>
- Reviewer: Gurchetan Singh <gurchetansingh@chromium.org>, Chia-I Wu <olvaffe@gmail.com>
- Mailing list: dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev
- Status: Maintained
- SCM: git https://gitlab.freedesktop.org/drm/misc/kernel.git
- Files:
drivers/gpu/drm/ci/xfails/virtio*,drivers/gpu/drm/virtio/,include/uapi/linux/virtio_gpu.h
VIRTIO HOST (VHOST) #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
- Reviewer: Eugenio Pérez <eperezma@redhat.com>
- Mailing list: kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git
- Files:
drivers/vhost/,include/linux/sched/vhost_task.h,include/linux/vhost_iotlb.h,include/uapi/linux/vhost.h,kernel/vhost_task.c
VIRTIO HOST (VHOST-SCSI) #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, Mike Christie <michael.christie@oracle.com>
- Reviewer: Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/vhost/scsi.c
VIRTIO I2C DRIVER #
- Mail: Viresh Kumar <viresh.kumar@linaro.org>
- Reviewer: "Chen, Jian Jun" <jian.jun.chen@intel.com>
- Mailing list: linux-i2c@vger.kernel.org, virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/i2c/busses/i2c-virtio.c,include/uapi/linux/virtio_i2c.h
VIRTIO INPUT DRIVER #
- Mail: Gerd Hoffmann <kraxel@redhat.com>
- Status: Maintained
- Files:
drivers/virtio/virtio_input.c,include/uapi/linux/virtio_input.h
VIRTIO IOMMU DRIVER #
- Mail: Jean-Philippe Brucker <jpb@kernel.org>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/iommu/virtio-iommu.c,include/uapi/linux/virtio_iommu.h
VIRTIO MEM DRIVER #
- Mail: David Hildenbrand <david@kernel.org>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Web-page: https://virtio-mem.gitlab.io/
- Files:
drivers/virtio/virtio_mem.c,include/uapi/linux/virtio_mem.h
VIRTIO NET DRIVER #
- Mail: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
- Reviewer: Xuan Zhuo <xuanzhuo@linux.alibaba.com>, Eugenio Pérez <eperezma@redhat.com>
- Mailing list: netdev@vger.kernel.org, virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/net/virtio_net.c,include/linux/virtio_net.h,include/uapi/linux/virtio_net.h,tools/testing/selftests/drivers/net/virtio_net/
VIRTIO PMEM DRIVER #
- Mail: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/nvdimm/nd_virtio.c,drivers/nvdimm/virtio_pmem.c
VIRTIO RTC DRIVER #
- Mail: Peter Hilber <peter.hilber@oss.qualcomm.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/virtio/virtio_rtc_*,include/uapi/linux/virtio_rtc.h
VIRTIO SOUND DRIVER #
- Mail: Anton Yakovlev <anton.yakovlev@opensynergy.com>, "Michael S. Tsirkin" <mst@redhat.com>
- Mailing list: virtualization@lists.linux.dev, linux-sound@vger.kernel.org
- Status: Maintained
- Files:
include/uapi/linux/virtio_snd.h,sound/virtio/*
VIRTIO SPI DRIVER #
- Mail: Haixu Cui <quic_haixcui@quicinc.com>
- Mailing list: virtualization@lists.linux.dev
- Status: Maintained
- Files:
drivers/spi/spi-virtio.c,include/uapi/linux/virtio_spi.h
VIRTUAL BOX GUEST DEVICE DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Status: Maintained
- Files:
drivers/virt/vboxguest/,include/linux/vbox_utils.h,include/uapi/linux/vbox*.h
VIRTUAL BOX SHARED FOLDER VFS DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- Files:
fs/vboxsf/*
VIRTUAL PCM TEST DRIVER #
- Mail: Ivan Orlov <ivan.orlov0322@gmail.com>
- Mailing list: linux-sound@vger.kernel.org
- Status: Maintained
- Files:
Documentation/sound/cards/pcmtest.rst,sound/drivers/pcmtest.c,tools/testing/selftests/alsa/test-pcmtest-driver.c
VIRTUAL SERIO DEVICE DRIVER #
- Mail: Stephen Chandler Paul <thatslyude@gmail.com>
- Status: Maintained
- Files:
drivers/input/serio/userio.c,include/uapi/linux/userio.h
VISHAY VEML3235 AMBIENT LIGHT SENSOR DRIVER #
- Mail: Javier Carrasco <javier.carrasco.cruz@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/vishay,veml6030.yaml,drivers/iio/light/veml3235.c
VISHAY VEML6030 AMBIENT LIGHT SENSOR DRIVER #
- Mail: Javier Carrasco <javier.carrasco.cruz@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/vishay,veml6030.yaml,drivers/iio/light/veml6030.c
VISHAY VEML6046X00 RGBIR COLOR SENSOR DRIVER #
- Mail: Andreas Klinger <ak@it-klinger.de>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/vishay,veml6046x00.yaml,drivers/iio/light/veml6046x00.c
VISHAY VEML6075 UVA AND UVB LIGHT SENSOR DRIVER #
- Mail: Javier Carrasco <javier.carrasco.cruz@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml,drivers/iio/light/veml6075.c
VISL VIRTUAL STATELESS DECODER DRIVER #
- Mail: Daniel Almeida <daniel.almeida@collabora.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- Files:
drivers/media/test-drivers/visl
VIVID VIRTUAL VIDEO DRIVER #
- Mail: Hans Verkuil <hverkuil@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/test-drivers/vivid/*
VM SOCKETS (AF_VSOCK) #
- Mail: Stefano Garzarella <sgarzare@redhat.com>
- Mailing list: virtualization@lists.linux.dev, netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/vsockmon.c,include/net/af_vsock.h,include/uapi/linux/vm_sockets.h,include/uapi/linux/vm_sockets_diag.h,include/uapi/linux/vsockmon.h,net/vmw_vsock/,tools/testing/selftests/vsock/,tools/testing/vsock/
VMALLOC #
- Mail: Andrew Morton <akpm@linux-foundation.org>, Uladzislau Rezki <urezki@gmail.com>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Web-page: http://www.linux-mm.org
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
- Files:
include/linux/vmalloc.h,mm/vmalloc.c,lib/test_vmalloc.c
VME SUBSYSTEM #
- Mailing list: linux-kernel@vger.kernel.org
- Status: Orphan
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
- Files:
Documentation/driver-api/vme.rst,drivers/staging/vme_user/
VMWARE BALLOON DRIVER #
- Mail: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
drivers/misc/vmw_balloon.c
VMWARE HYPERVISOR INTERFACE #
- Mail: Ajay Kaher <ajay.kaher@broadcom.com>, Alexey Makhalov <alexey.makhalov@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: virtualization@lists.linux.dev, x86@kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/vmware
- Files:
arch/x86/include/asm/vmware.h,arch/x86/kernel/cpu/vmware.c
VMWARE PVRDMA DRIVER #
- Mail: Bryan Tan <bryan-bt.tan@broadcom.com>, Vishnu Dasa <vishnu.dasa@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-rdma@vger.kernel.org
- Status: Supported
- Files:
drivers/infiniband/hw/vmw_pvrdma/
VMWARE PVSCSI DRIVER #
- Mail: Vishal Bhakta <vishal.bhakta@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/vmw_pvscsi.c,drivers/scsi/vmw_pvscsi.h
VMWARE VIRTUAL PTP CLOCK DRIVER #
- Mail: Nick Shi <nick.shi@broadcom.com>
- Reviewer: Ajay Kaher <ajay.kaher@broadcom.com>, Alexey Makhalov <alexey.makhalov@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/ptp/ptp_vmw.c
VMWARE VMCI DRIVER #
- Mail: Bryan Tan <bryan-bt.tan@broadcom.com>, Vishnu Dasa <vishnu.dasa@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
drivers/misc/vmw_vmci/,include/linux/vmw_vmci*
VMWARE VMMOUSE SUBDRIVER #
- Mail: Zack Rusin <zack.rusin@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-input@vger.kernel.org
- Status: Supported
- Files:
drivers/input/mouse/vmmouse.c,drivers/input/mouse/vmmouse.h
VMWARE VMXNET3 ETHERNET DRIVER #
- Mail: Ronak Doshi <ronak.doshi@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/vmxnet3/
VMWARE VSOCK VMCI TRANSPORT DRIVER #
- Mail: Bryan Tan <bryan-bt.tan@broadcom.com>, Vishnu Dasa <vishnu.dasa@broadcom.com>
- Reviewer: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
net/vmw_vsock/vmci_transport*
VOCORE VOCORE2 BOARD #
- Mail: Harvey Hunt <harveyhuntnexus@gmail.com>
- Mailing list: linux-mips@vger.kernel.org
- Status: Maintained
- Files:
arch/mips/boot/dts/ralink/vocore2.dts
VOLTAGE AND CURRENT REGULATOR FRAMEWORK #
- Mail: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Web-page: http://www.slimlogic.co.uk/?p=48
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git
- Files:
Documentation/devicetree/bindings/regulator/,Documentation/power/regulator/,drivers/regulator/,rust/kernel/regulator.rs,include/dt-bindings/regulator/,include/linux/regulator/,include/uapi/regulator/ - Content regex:
regulator_get_optional
VOLTAGE AND CURRENT REGULATOR IRQ HELPERS #
- Reviewer: Matti Vaittinen <mazziesaccount@gmail.com>
- Files:
drivers/regulator/irq_helpers.c
VRF #
- Mail: David Ahern <dsahern@kernel.org>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/vrf.rst,drivers/net/vrf.c
VSPRINTF #
- Mail: Petr Mladek <pmladek@suse.com>, Steven Rostedt <rostedt@goodmis.org>
- Reviewer: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, Sergey Senozhatsky <senozhatsky@chromium.org>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git
- Files:
Documentation/core-api/printk-formats.rst,lib/tests/printf_kunit.c,lib/tests/scanf_kunit.c,lib/vsprintf.c
VT1211 HARDWARE MONITOR DRIVER #
- Mail: Juerg Haefliger <juergh@proton.me>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/vt1211.rst,drivers/hwmon/vt1211.c
VT8231 HARDWARE MONITOR DRIVER #
- Mail: Roger Lucas <vt8231@hiddenengine.co.uk>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/vt8231.c
VUB300 USB to SDIO/SD/MMC bridge chip #
- Mailing list: linux-mmc@vger.kernel.org
- Status: Orphan
- Files:
drivers/mmc/host/vub300.c
W1 DALLAS'S 1-WIRE BUS #
- Mail: Krzysztof Kozlowski <krzk@kernel.org>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/w1/,Documentation/w1/,drivers/w1/,include/linux/w1.h
W83791D HARDWARE MONITORING DRIVER #
- Mail: Marc Hulsman <m.hulsman@tudelft.nl>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/w83791d.rst,drivers/hwmon/w83791d.c
W83793 HARDWARE MONITORING DRIVER #
- Mail: Rudolf Marek <r.marek@assembler.cz>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
Documentation/hwmon/w83793.rst,drivers/hwmon/w83793.c
W83795 HARDWARE MONITORING DRIVER #
- Mail: Jean Delvare <jdelvare@suse.com>
- Mailing list: linux-hwmon@vger.kernel.org
- Status: Maintained
- Files:
drivers/hwmon/w83795.c
W83L51xD SD/MMC CARD INTERFACE DRIVER #
- Mail: Pierre Ossman <pierre@ossman.eu>
- Status: Maintained
- Files:
drivers/mmc/host/wbsd.*
WACOM PROTOCOL 4 SERIAL TABLETS #
- Mail: Julian Squires <julian@cipht.net>, Hans de Goede <hansg@kernel.org>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/input/tablet/wacom_serial4.c
WANGXUN ETHERNET DRIVER #
- Mail: Jiawen Wu <jiawenwu@trustnetic.com>, Mengyuan Lou <mengyuanlou@net-swift.com>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Web-page: https://www.net-swift.com
- Files:
Documentation/networking/device_drivers/ethernet/wangxun/*,drivers/net/ethernet/wangxun/,drivers/net/pcs/pcs-xpcs-wx.c
WATCHDOG DEVICE DRIVERS #
- Mail: Wim Van Sebroeck <wim@linux-watchdog.org>, Guenter Roeck <linux@roeck-us.net>
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Maintained
- Web-page: http://www.linux-watchdog.org/
- SCM: git git://www.linux-watchdog.org/linux-watchdog.git
- Files:
Documentation/devicetree/bindings/watchdog/,Documentation/watchdog/,drivers/watchdog/,include/linux/watchdog.h,include/trace/events/watchdog.h,include/uapi/linux/watchdog.h
WAVE5 VPU CODEC DRIVER #
- Mail: Nas Chung <nas.chung@chipsnmedia.com>, Jackson Lee <jackson.lee@chipsnmedia.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/media/cnm,wave521c.yaml,drivers/media/platform/chips-media/wave5/
WHISKEYCOVE PMIC GPIO DRIVER #
- Mail: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-wcove.c
WHWAVE RTC DRIVER #
- Mail: Dianlong Li <long17.cool@163.com>
- Mailing list: linux-rtc@vger.kernel.org
- Status: Maintained
- Files:
drivers/rtc/rtc-sd3078.c
WIIMOTE HID DRIVER #
- Mail: David Rheinsberg <david@readahead.eu>
- Mailing list: linux-input@vger.kernel.org
- Status: Maintained
- Files:
drivers/hid/hid-wiimote*
WILOCITY WIL6210 WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Web-page: https://wireless.wiki.kernel.org/en/users/Drivers/wil6210
- Files:
drivers/net/wireless/ath/wil6210/
WINBOND CIR DRIVER #
- Mail: David Härdeman <david@hardeman.nu>
- Status: Maintained
- Files:
drivers/media/rc/winbond-cir.c
WINSEN MHZ19B #
- Mail: Gyeyoung Baek <gye976@gmail.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml,drivers/iio/chemical/mhz19b.c
WINSYSTEMS EBC-C384 WATCHDOG DRIVER #
- Mailing list: linux-watchdog@vger.kernel.org
- Status: Orphan
- Files:
drivers/watchdog/ebc-c384_wdt.c
WINSYSTEMS WS16C48 GPIO DRIVER #
- Mail: William Breathitt Gray <wbg@kernel.org>
- Mailing list: linux-gpio@vger.kernel.org
- Status: Maintained
- Files:
drivers/gpio/gpio-ws16c48.c
WIREGUARD SECURE NETWORK TUNNEL #
- Mail: Jason A. Donenfeld <Jason@zx2c4.com>
- Mailing list: wireguard@lists.zx2c4.com, netdev@vger.kernel.org
- Status: Maintained
- Files:
Documentation/netlink/specs/wireguard.yaml,drivers/net/wireguard/,tools/testing/selftests/wireguard/
WISTRON LAPTOP BUTTON DRIVER #
- Mail: Miloslav Trmac <mitr@volny.cz>
- Status: Maintained
- Files:
drivers/input/misc/wistron_btns.c
WMI BINARY MOF DRIVER #
- Mail: Armin Wolf <W_Armin@gmx.de>
- Reviewer: Thomas Weißschuh <linux@weissschuh.net>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/stable/sysfs-platform-wmi-bmof,Documentation/wmi/devices/wmi-bmof.rst,drivers/platform/x86/wmi-bmof.c
WOLFSON MICROELECTRONICS DRIVERS #
- Mailing list: patches@opensource.cirrus.com
- Status: Supported
- Web-page: https://github.com/CirrusLogic/linux-drivers/wiki
- SCM: git https://github.com/CirrusLogic/linux-drivers.git
- Files:
Documentation/devicetree/bindings/extcon/wlf,arizona.yaml,Documentation/devicetree/bindings/mfd/wlf,arizona.yaml,Documentation/devicetree/bindings/mfd/wm831x.txt,Documentation/devicetree/bindings/regulator/wlf,arizona.yaml,Documentation/devicetree/bindings/sound/trivial-codec.yaml,Documentation/devicetree/bindings/sound/wlf,*.yaml,Documentation/devicetree/bindings/sound/wm*,Documentation/hwmon/wm83??.rst,arch/arm/mach-s3c/mach-crag6410*,drivers/clk/clk-wm83*.c,drivers/gpio/gpio-*wm*.c,drivers/gpio/gpio-arizona.c,drivers/hwmon/wm83??-hwmon.c,drivers/input/misc/wm831x-on.c,drivers/input/touchscreen/wm831x-ts.c,drivers/input/touchscreen/wm97*.c,drivers/leds/leds-wm83*.c,drivers/mfd/arizona*,drivers/mfd/cs47l24*,drivers/mfd/wm*.c,drivers/power/supply/wm83*.c,drivers/regulator/arizona*,drivers/regulator/wm8*.c,drivers/rtc/rtc-wm83*.c,drivers/video/backlight/wm83*_bl.c,drivers/watchdog/wm83*_wdt.c,include/linux/mfd/arizona/,include/linux/mfd/wm831x/,include/linux/mfd/wm8350/,include/linux/mfd/wm8400*,include/linux/regulator/arizona*,include/linux/wm97xx.h,include/sound/wm????.h,sound/soc/codecs/arizona*,sound/soc/codecs/cs47l24*,sound/soc/codecs/wm*
WORKQUEUE #
- Mail: Tejun Heo <tj@kernel.org>
- Reviewer: Lai Jiangshan <jiangshanlai@gmail.com>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git
- Files:
Documentation/core-api/workqueue.rst,include/linux/workqueue.h,kernel/workqueue.c,kernel/workqueue_internal.h
WWAN DRIVERS #
- Mail: Loic Poulain <loic.poulain@oss.qualcomm.com>, Sergey Ryazanov <ryazanov.s.a@gmail.com>
- Reviewer: Johannes Berg <johannes@sipsolutions.net>
- Mailing list: netdev@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/wwan/,include/linux/wwan.h,include/uapi/linux/wwan.h
X-POWERS AXP288 PMIC DRIVERS #
- Mail: Hans de Goede <hansg@kernel.org>
- Status: Maintained
- Files:
drivers/acpi/pmic/intel_pmic_xpower.c - Regex:
axp288
X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS #
- Mail: Chen-Yu Tsai <wens@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Regex:
axp[128]
X.25 STACK #
- Mail: Martin Schiller <ms@dev.tdt.de>
- Mailing list: linux-x25@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/lapb-module.rst,Documentation/networking/x25*,drivers/net/wan/hdlc_x25.c,drivers/net/wan/lapbether.c,include/*/lapb.h,include/net/x25*,include/uapi/linux/x25.h,net/lapb/,net/x25/
X86 ARCHITECTURE (32-BIT AND 64-BIT) #
- Mail: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org
- Reviewer: "H. Peter Anvin" <hpa@zytor.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
- Files:
Documentation/arch/x86/,Documentation/devicetree/bindings/x86/,arch/x86/,tools/testing/selftests/x86
X86 CPUID DATABASE #
- Mail: Borislav Petkov <bp@alien8.de>, Thomas Gleixner <tglx@kernel.org>, x86@kernel.org
- Reviewer: Ahmed S. Darwish <darwi@linutronix.de>
- Mailing list: x86-cpuid@lists.linux.dev
- Status: Maintained
- Web-page: https://x86-cpuid.org
- Files:
tools/arch/x86/kcpuid/
X86 ENTRY CODE #
- Mail: Andy Lutomirski <luto@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
- Files:
arch/x86/entry/
X86 HARDWARE VULNERABILITIES #
- Mail: Thomas Gleixner <tglx@kernel.org>, Borislav Petkov <bp@alien8.de>, Peter Zijlstra <peterz@infradead.org>, Josh Poimboeuf <jpoimboe@kernel.org>
- Reviewer: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
- Status: Maintained
- Files:
Documentation/admin-guide/hw-vuln/,arch/x86/include/asm/nospec-branch.h,arch/x86/kernel/cpu/bugs.c
X86 MCE INFRASTRUCTURE #
- Mail: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>
- Mailing list: linux-edac@vger.kernel.org
- Status: Maintained
- Files:
Documentation/ABI/testing/sysfs-mce,Documentation/arch/x86/x86_64/machinecheck.rst,arch/x86/kernel/cpu/mce/*
X86 MICROCODE UPDATE SUPPORT #
- Mail: Borislav Petkov <bp@alien8.de>
- Status: Maintained
- Files:
arch/x86/kernel/cpu/microcode/*
X86 MM #
- Mail: Dave Hansen <dave.hansen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <peterz@infradead.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
- Files:
arch/x86/mm/
X86 PLATFORM ANDROID TABLETS DSDT FIXUP DRIVER #
- Mail: Hans de Goede <hansg@kernel.org>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
- Files:
drivers/platform/x86/x86-android-tablets/
X86 PLATFORM DRIVERS #
- Mail: Hans de Goede <hansg@kernel.org>, Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
- Mailing list: platform-driver-x86@vger.kernel.org
- Status: Maintained
- Patchwork: https://patchwork.kernel.org/project/platform-driver-x86/list/
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
- Files:
drivers/platform/olpc/,drivers/platform/x86/,include/linux/platform_data/x86/
X86 PLATFORM UV HPE SUPERDOME FLEX #
- Mail: Steve Wahl <steve.wahl@hpe.com>
- Reviewer: Justin Ernst <justin.ernst@hpe.com>, Kyle Meyer <kyle.meyer@hpe.com>, Dimitri Sivanich <dimitri.sivanich@hpe.com>, Russ Anderson <russ.anderson@hpe.com>
- Status: Supported
- Files:
arch/x86/include/asm/uv/,arch/x86/kernel/apic/x2apic_uv_x.c,arch/x86/platform/uv/
X86 STACK UNWINDING #
- Mail: Josh Poimboeuf <jpoimboe@kernel.org>, Peter Zijlstra <peterz@infradead.org>
- Status: Supported
- Files:
arch/x86/include/asm/unwind*.h,arch/x86/kernel/dumpstack.c,arch/x86/kernel/stacktrace.c,arch/x86/kernel/unwind_*.c
X86 TRUST DOMAIN EXTENSIONS (TDX) #
- Mail: Kiryl Shutsemau <kas@kernel.org>
- Reviewer: Dave Hansen <dave.hansen@linux.intel.com>, Rick Edgecombe <rick.p.edgecombe@intel.com>
- Mailing list: x86@kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/tdx
- Regex:
tdx - Content regex:
\b(tdx)
X86 VDSO #
- Mail: Andy Lutomirski <luto@kernel.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/vdso
- Files:
arch/x86/entry/vdso/
XARRAY #
- Mail: Matthew Wilcox <willy@infradead.org>
- Mailing list: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
- Status: Supported
- Files:
Documentation/core-api/idr.rst,Documentation/core-api/xarray.rst,include/linux/idr.h,include/linux/xarray.h,lib/idr.c,lib/test_xarray.c,lib/xarray.c,tools/testing/radix-tree
XARRAY API [RUST] #
- Mail: Tamir Duberstein <tamird@kernel.org>, Andreas Hindborg <a.hindborg@kernel.org>
- Mailing list: rust-for-linux@vger.kernel.org
- Status: Supported
- Web-page: https://rust-for-linux.com
- bugs: https://github.com/Rust-for-Linux/linux/issues
- chat: https://rust-for-linux.zulipchat.com
- SCM: git https://github.com/Rust-for-Linux/linux.git xarray-next
- Files:
rust/kernel/xarray.rs
XBOX DVD IR REMOTE #
- Mail: Benjamin Valentin <benpicco@googlemail.com>
- Status: Maintained
- Files:
drivers/media/rc/keymaps/rc-xbox-dvd.c,drivers/media/rc/xbox_remote.c
XC2028/3028 TUNER DRIVER #
- Mail: Mauro Carvalho Chehab <mchehab@kernel.org>
- Mailing list: linux-media@vger.kernel.org
- Status: Maintained
- Web-page: https://linuxtv.org
- SCM: git git://linuxtv.org/media.git
- Files:
drivers/media/tuners/xc2028.*
XDP (eXpress Data Path) #
- Mail: Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, David S. Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>
- Reviewer: Stanislav Fomichev <sdf@fomichev.me>
- Mailing list: netdev@vger.kernel.org, bpf@vger.kernel.org
- Status: Supported
- Files:
drivers/net/ethernet/*/*/*/*/*xdp*,drivers/net/ethernet/*/*/*xdp*,include/net/xdp.h,include/net/xdp_priv.h,include/trace/events/xdp.h,kernel/bpf/cpumap.c,kernel/bpf/devmap.c,net/core/xdp.c,samples/bpf/xdp*,tools/testing/selftests/bpf/*/*xdp*,tools/testing/selftests/bpf/*xdp* - Content regex:
(?:\b|_)xdp(?:\b|_)
XDP SOCKETS (AF_XDP) #
- Mail: Magnus Karlsson <magnus.karlsson@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>
- Reviewer: Stanislav Fomichev <sdf@fomichev.me>
- Mailing list: netdev@vger.kernel.org, bpf@vger.kernel.org
- Status: Maintained
- Files:
Documentation/networking/af_xdp.rst,include/net/netns/xdp.h,include/net/xdp_sock*,include/net/xsk_buff_pool.h,include/uapi/linux/if_xdp.h,include/uapi/linux/xdp_diag.h,net/xdp/,tools/testing/selftests/bpf/*xsk*
XEN BLOCK SUBSYSTEM #
- Mail: Roger Pau Monné <roger.pau@citrix.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Supported
- Files:
drivers/block/xen*,drivers/block/xen-blkback/*
XEN HYPERVISOR ARM #
- Mail: Stefano Stabellini <sstabellini@kernel.org>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm/include/asm/xen/,arch/arm/xen/
XEN HYPERVISOR ARM64 #
- Mail: Stefano Stabellini <sstabellini@kernel.org>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Maintained
- Files:
arch/arm64/include/asm/xen/,arch/arm64/xen/
XEN HYPERVISOR INTERFACE #
- Mail: Juergen Gross <jgross@suse.com>, Stefano Stabellini <sstabellini@kernel.org>
- Reviewer: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git
- Files:
Documentation/ABI/stable/sysfs-hypervisor-xen,Documentation/ABI/testing/sysfs-hypervisor-xen,drivers/*/xen-*front.c,drivers/xen/,include/uapi/xen/,include/xen/,kernel/configs/xen.config
XEN HYPERVISOR X86 #
- Mail: Juergen Gross <jgross@suse.com>
- Reviewer: Boris Ostrovsky <boris.ostrovsky@oracle.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Supported
- Files:
arch/x86/configs/xen.config,arch/x86/include/asm/pvclock-abi.h,arch/x86/include/asm/xen/,arch/x86/platform/pvh/,arch/x86/xen/
XEN NETWORK BACKEND DRIVER #
- Mail: Wei Liu <wei.liu@kernel.org>, Paul Durrant <paul@xen.org>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers), netdev@vger.kernel.org
- Status: Supported
- Files:
drivers/net/xen-netback/*
XEN PCI SUBSYSTEM #
- Mail: Juergen Gross <jgross@suse.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers)
- Status: Supported
- Files:
arch/x86/pci/*xen*,drivers/pci/*xen*
XEN PVSCSI DRIVERS #
- Mail: Juergen Gross <jgross@suse.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers), linux-scsi@vger.kernel.org
- Status: Supported
- Files:
drivers/scsi/xen-scsifront.c,drivers/xen/xen-scsiback.c,include/xen/interface/io/vscsiif.h
XEN PVUSB DRIVER #
- Mail: Juergen Gross <jgross@suse.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers), linux-usb@vger.kernel.org
- Status: Supported
- Files:
drivers/usb/host/xen*,include/xen/interface/io/usbif.h
XEN SOUND FRONTEND DRIVER #
- Mail: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers), linux-sound@vger.kernel.org
- Status: Supported
- Files:
sound/xen/*
XEN SWIOTLB SUBSYSTEM #
- Mail: Juergen Gross <jgross@suse.com>, Stefano Stabellini <sstabellini@kernel.org>
- Mailing list: xen-devel@lists.xenproject.org (moderated for non-subscribers), iommu@lists.linux.dev
- Status: Supported
- Files:
arch/*/include/asm/xen/swiotlb-xen.h,drivers/xen/swiotlb-xen.c,include/xen/arm/swiotlb-xen.h,include/xen/swiotlb-xen.h
XFS FILESYSTEM #
- Mail: Carlos Maiolino <cem@kernel.org>
- Mailing list: linux-xfs@vger.kernel.org
- Status: Supported
- Web-page: http://xfs.org/
- chat: irc://irc.oftc.net/xfs
- SCM: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
- Subsystem Profile: Documentation/filesystems/xfs/xfs-maintainer-entry-profile.rst
- Files:
Documentation/ABI/testing/sysfs-fs-xfs,Documentation/admin-guide/xfs.rst,Documentation/filesystems/xfs/*,fs/xfs/,include/uapi/linux/dqblk_xfs.h,include/uapi/linux/fsmap.h
XILINX AMS DRIVER #
- Mail: Salih Erim <salih.erim@amd.com>, Conall O'Griofa <conall.ogriofa@amd.com>
- Mailing list: linux-iio@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/iio/adc/xlnx,zynqmp-ams.yaml,drivers/iio/adc/xilinx-ams.c
XILINX AXI ETHERNET DRIVER #
- Mail: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml,drivers/net/ethernet/xilinx/xilinx_axienet*
XILINX CAN DRIVER #
- Mail: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
- Mailing list: linux-can@vger.kernel.org
- Status: Maintained
- Files:
Documentation/devicetree/bindings/net/can/xilinx,can.yaml,drivers/net/can/xilinx_can.c
XILINX EVENT MANAGEMENT DRIVER #
- Mail: Michal Simek <michal.simek@amd.com>
- Status: Maintained
- Files:
drivers/soc/xilinx/xlnx_event_manager.c,include/linux/firmware/xlnx-event-manager.h
XILINX GPIO DRIVER #
- Mail: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
- Reviewer: Srinivas Neeli <srinivas.neeli@amd.com>, Michal Simek <michal.simek@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/gpio/gpio-zynq.yaml,Documentation/devicetree/bindings/gpio/xlnx,gpio-xilinx.yaml,drivers/gpio/gpio-xilinx.c,drivers/gpio/gpio-zynq.c
XILINX LL TEMAC ETHERNET DRIVER #
- Mailing list: netdev@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/ethernet/xilinx/ll_temac*
XILINX PWM DRIVER #
- Mail: Sean Anderson <sean.anderson@seco.com>
- Status: Maintained
- Files:
drivers/pwm/pwm-xilinx.c,include/clocksource/timer-xilinx.h
XILINX SOUND DRIVERS #
- Mail: Vincenzo Frascino <vincenzo.frascino@arm.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/sound/xlnx,i2s.yaml,Documentation/devicetree/bindings/sound/xlnx,audio-formatter.yaml,Documentation/devicetree/bindings/sound/xlnx,spdif.yaml,sound/soc/xilinx/*
XILINX SD-FEC IP CORES #
- Mail: Derek Kiernan <derek.kiernan@amd.com>, Dragan Cvetic <dragan.cvetic@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/misc/xlnx,sd-fec.yaml,Documentation/misc-devices/xilinx_sdfec.rst,drivers/misc/xilinx_sdfec.c,include/uapi/misc/xilinx_sdfec.h
XILINX TRNG DRIVER #
- Mail: Mounika Botcha <mounika.botcha@amd.com>, Harsh Jain <h.jain@amd.com>
- Status: Maintained
- Files:
drivers/crypto/xilinx/xilinx-trng.c
XILINX UARTLITE SERIAL DRIVER #
- Mail: Peter Korsgaard <jacmet@sunsite.dk>
- Mailing list: linux-serial@vger.kernel.org
- Status: Maintained
- Files:
drivers/tty/serial/uartlite.c
XILINX VIDEO IP CORES #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-media@vger.kernel.org
- Status: Supported
- SCM: git git://linuxtv.org/media.git
- Files:
Documentation/devicetree/bindings/media/xilinx/,drivers/media/platform/xilinx/,include/uapi/linux/xilinx-v4l2-controls.h
XILINX VERSAL EDAC DRIVER #
- Mail: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>, Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/xlnx,versal-ddrmc-edac.yaml,drivers/edac/versal_edac.c
XILINX VERSALNET EDAC DRIVER #
- Mail: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/xlnx,versal-net-ddrmc5.yaml,drivers/edac/versalnet_edac.c,include/linux/cdx/edac_cdx_pcol.h
XILINX WATCHDOG DRIVER #
- Mail: Srinivas Neeli <srinivas.neeli@amd.com>
- Reviewer: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>, Michal Simek <michal.simek@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/watchdog/xlnx,versal-wwdt.yaml,Documentation/devicetree/bindings/watchdog/xlnx,xps-timebase-wdt.yaml,drivers/watchdog/of_xilinx_wdt.c,drivers/watchdog/xilinx_wwdt.c
XILINX XDMA DRIVER #
- Mail: Lizhi Hou <lizhi.hou@amd.com>, Brian Xu <brian.xu@amd.com>, Raj Kumar Rampelli <raj.kumar.rampelli@amd.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Files:
drivers/dma/xilinx/xdma-regs.h,drivers/dma/xilinx/xdma.c,include/linux/dma/amd_xdma.h,include/linux/platform_data/amd_xdma.h
XILINX ZYNQMP DPDMA DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: dmaengine@vger.kernel.org
- Status: Supported
- Files:
Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dpdma.yaml,drivers/dma/xilinx/xilinx_dpdma.c,include/dt-bindings/dma/xlnx-zynqmp-dpdma.h
XILINX ZYNQMP OCM EDAC DRIVER #
- Mail: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>, Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/memory-controllers/xlnx,zynqmp-ocmc-1.0.yaml,drivers/edac/zynqmp_edac.c
XILINX ZYNQMP PSGTR PHY DRIVER #
- Mail: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- SCM: git https://github.com/Xilinx/linux-xlnx.git
- Files:
Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml,drivers/phy/xilinx/phy-zynqmp.c
XILINX ZYNQMP SHA3 DRIVER #
- Mail: Harsha <harsha.harsha@amd.com>
- Status: Maintained
- Files:
drivers/crypto/xilinx/zynqmp-sha.c
XILINX ZYNQMP NVMEM DRIVER #
- Mail: Praveen Teja Kundanala <praveen.teja.kundanala@amd.com>, Kalyani Akula <kalyani.akula@amd.com>
- Reviewer: Michal Simek <michal.simek@amd.com>
- Status: Maintained
- Files:
Documentation/devicetree/bindings/nvmem/xlnx,zynqmp-nvmem.yaml,drivers/nvmem/zynqmp_nvmem.c
XILLYBUS DRIVER #
- Mail: Eli Billauer <eli.billauer@gmail.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Supported
- Files:
drivers/char/xillybus/
XLP9XX I2C DRIVER #
- Mail: George Cherian <gcherian@marvell.com>
- Mailing list: linux-i2c@vger.kernel.org
- Status: Supported
- Web-page: http://www.marvell.com
- Files:
drivers/i2c/busses/i2c-xlp9xx.c
XTENSA XTFPGA PLATFORM SUPPORT #
- Mail: Max Filippov <jcmvbkbc@gmail.com>
- Status: Maintained
- Files:
drivers/spi/spi-xtensa-xtfpga.c,sound/soc/xtensa/xtfpga-i2s.c
XZ EMBEDDED #
- Mail: Lasse Collin <lasse.collin@tukaani.org>
- Status: Maintained
- Web-page: https://tukaani.org/xz/embedded.html
- bugs: https://github.com/tukaani-project/xz-embedded/issues
- chat: irc://irc.libera.chat/tukaani
- Files:
Documentation/staging/xz.rst,include/linux/decompress/unxz.h,include/linux/xz.h,lib/decompress_unxz.c,lib/xz/,scripts/xz_wrap.sh
YAM DRIVER FOR AX.25 #
- Mail: Jean-Paul Roubelat <jpr@f6fbb.org>
- Mailing list: linux-hams@vger.kernel.org
- Status: Maintained
- Files:
drivers/net/hamradio/yam*,include/linux/yam.h
YAMA SECURITY MODULE #
- Mail: Kees Cook <kees@kernel.org>
- Status: Supported
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
- Files:
Documentation/admin-guide/LSM/Yama.rst,security/yama/
YAML NETLINK (YNL) #
- Mail: Donald Hunter <donald.hunter@gmail.com>, Jakub Kicinski <kuba@kernel.org>
- Files:
Documentation/netlink/,Documentation/userspace-api/netlink/intro-specs.rst,Documentation/userspace-api/netlink/specs.rst,tools/net/ynl/
YEALINK PHONE DRIVER #
- Mail: Henk Vergonet <Henk.Vergonet@gmail.com>
- Status: Maintained
- Files:
Documentation/input/devices/yealink.rst,drivers/input/misc/yealink.*
Z8530 DRIVER FOR AX.25 #
- Mail: Joerg Reuter <jreuter@yaina.de>
- Mailing list: linux-hams@vger.kernel.org
- Status: Maintained
- Web-page: http://yaina.de/jreuter/, http://www.qsl.net/dl1bke/
- Files:
Documentation/networking/device_drivers/hamradio/z8530drv.rst,drivers/net/hamradio/*scc.c,drivers/net/hamradio/z8530.h
ZD1211RW WIRELESS DRIVER #
- Mailing list: linux-wireless@vger.kernel.org
- Status: Orphan
- Files:
drivers/net/wireless/zydas/
ZD1301 MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org/
- Patchwork: https://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/usb/dvb-usb-v2/zd1301*
ZD1301_DEMOD MEDIA DRIVER #
- Mailing list: linux-media@vger.kernel.org
- Status: Orphan
- Web-page: https://linuxtv.org/
- Patchwork: https://patchwork.linuxtv.org/project/linux-media/list/
- Files:
drivers/media/dvb-frontends/zd1301_demod*
ZHAOXIN PROCESSOR SUPPORT #
- Mail: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
arch/x86/kernel/cpu/zhaoxin.c
ZONED BLOCK DEVICE (BLOCK LAYER) #
- Mail: Damien Le Moal <dlemoal@kernel.org>
- Mailing list: linux-block@vger.kernel.org
- Status: Maintained
- Files:
block/blk-zoned.c,include/uapi/linux/blkzoned.h
ZONED LOOP DEVICE #
- Mail: Damien Le Moal <dlemoal@kernel.org>
- Reviewer: Christoph Hellwig <hch@lst.de>
- Mailing list: linux-block@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/blockdev/zoned_loop.rst,drivers/block/zloop.c
ZONEFS FILESYSTEM #
- Mail: Damien Le Moal <dlemoal@kernel.org>, Naohiro Aota <naohiro.aota@wdc.com>
- Reviewer: Johannes Thumshirn <jth@kernel.org>
- Mailing list: linux-fsdevel@vger.kernel.org
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs.git
- Files:
Documentation/filesystems/zonefs.rst,fs/zonefs/
ZR36067 VIDEO FOR LINUX DRIVER #
- Mail: Corentin Labbe <clabbe@baylibre.com>
- Mailing list: mjpeg-users@lists.sourceforge.net, linux-media@vger.kernel.org
- Status: Maintained
- Web-page: http://mjpeg.sourceforge.net/driver-zoran/
- Patchwork: https://patchwork.linuxtv.org/project/linux-media/list/
- Files:
Documentation/driver-api/media/drivers/zoran.rst,drivers/media/pci/zoran/
ZRAM COMPRESSED RAM BLOCK DEVICE DRVIER #
- Mail: Minchan Kim <minchan@kernel.org>, Sergey Senozhatsky <senozhatsky@chromium.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Maintained
- Files:
Documentation/admin-guide/blockdev/zram.rst,drivers/block/zram/
ZS DECSTATION Z85C30 SERIAL DRIVER #
- Mail: "Maciej W. Rozycki" <macro@orcam.me.uk>
- Status: Maintained
- Files:
drivers/tty/serial/zs.*
ZSMALLOC COMPRESSED SLAB MEMORY ALLOCATOR #
- Mail: Minchan Kim <minchan@kernel.org>, Sergey Senozhatsky <senozhatsky@chromium.org>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/mm/zsmalloc.rst,include/linux/zsmalloc.h,mm/zpdesc.h,mm/zsmalloc.c
ZSTD #
- Mail: Nick Terrell <terrelln@fb.com>, David Sterba <dsterba@suse.com>
- Status: Maintained
- bugs: https://github.com/facebook/zstd/issues
- SCM: git https://github.com/terrelln/linux.git
- Files:
crypto/zstd.c,include/linux/zstd*,lib/decompress_unzstd.c,lib/zstd/ - Regex:
zstd - Content regex:
zstd
ZSWAP COMPRESSED SWAP CACHING #
- Mail: Johannes Weiner <hannes@cmpxchg.org>, Yosry Ahmed <yosry@kernel.org>, Nhat Pham <nphamcs@gmail.com>
- Reviewer: Chengming Zhou <chengming.zhou@linux.dev>
- Mailing list: linux-mm@kvack.org
- Status: Maintained
- Files:
Documentation/admin-guide/mm/zswap.rst,include/linux/zswap.h,mm/zswap.c,tools/testing/selftests/cgroup/test_zswap.c
SENARYTECH AUDIO CODEC DRIVER #
- Mail: bo liu <bo.liu@senarytech.com>
- Status: Maintained
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
- Files:
sound/hda/codecs/senarytech.c
THE REST #
- Mail: Linus Torvalds <torvalds@linux-foundation.org>
- Mailing list: linux-kernel@vger.kernel.org
- Status: Buried alive in reporters
- SCM: git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- Files:
*,*/
Linux kernel management style
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This is a short document describing the preferred (or made up, depending on who you ask) management style for the linux kernel. It's meant to mirror the process/coding-style.rst document to some degree, and mainly written to avoid answering 1 the same (or similar) questions over and over again.
Management style is very personal and much harder to quantify than simple coding style rules, so this document may or may not have anything to do with reality. It started as a lark, but that doesn't mean that it might not actually be true. You'll have to decide for yourself.
Btw, when talking about "kernel manager", it's all about the technical lead persons, not the people who do traditional management inside companies. If you sign purchase orders or you have any clue about the budget of your group, you're almost certainly not a kernel manager. These suggestions may or may not apply to you.
First off, I'd suggest buying "Seven Habits of Highly Effective People", and NOT read it. Burn it, it's a great symbolic gesture.
[1] This document does so not so much by answering the question, but by making it painfully obvious to the questioner that we don't have a clue to what the answer is.
Anyway, here goes:
1) Decisions #
Everybody thinks managers make decisions, and that decision-making is important. The bigger and more painful the decision, the bigger the manager must be to make it. That's very deep and obvious, but it's not actually true.
The name of the game is to avoid having to make a decision. In particular, if somebody tells you "choose (a) or (b), we really need you to decide on this", you're in trouble as a manager. The people you manage had better know the details better than you, so if they come to you for a technical decision, you're screwed. You're clearly not competent to make that decision for them.
(Corollary:if the people you manage don't know the details better than you, you're also screwed, although for a totally different reason. Namely that you are in the wrong job, and that they should be managing your brilliance instead).
So the name of the game is to avoid decisions, at least the big and painful ones. Making small and non-consequential decisions is fine, and makes you look like you know what you're doing, so what a kernel manager needs to do is to turn the big and painful ones into small things where nobody really cares.
It helps to realize that the key difference between a big decision and a small one is whether you can fix your decision afterwards. Any decision can be made small by just always making sure that if you were wrong (and you will be wrong), you can always undo the damage later by backtracking. Suddenly, you get to be doubly managerial for making two inconsequential decisions - the wrong one and the right one.
And people will even see that as true leadership (cough bullshit cough).
Thus the key to avoiding big decisions becomes to just avoiding to do things that can't be undone. Don't get ushered into a corner from which you cannot escape. A cornered rat may be dangerous - a cornered manager is just pitiful.
It turns out that since nobody would be stupid enough to ever really let a kernel manager have huge fiscal responsibility anyway, it's usually fairly easy to backtrack. Since you're not going to be able to waste huge amounts of money that you might not be able to repay, the only thing you can backtrack on is a technical decision, and there back-tracking is very easy: just tell everybody that you were an incompetent nincompoop, say you're sorry, and undo all the worthless work you had people work on for the last year. Suddenly the decision you made a year ago wasn't a big decision after all, since it could be easily undone.
It turns out that some people have trouble with this approach, for two reasons:
admitting you were an idiot is harder than it looks. We all like to maintain appearances, and coming out in public to say that you were wrong is sometimes very hard indeed.
having somebody tell you that what you worked on for the last year wasn't worthwhile after all can be hard on the poor lowly engineers too, and while the actual work was easy enough to undo by just deleting it, you may have irrevocably lost the trust of that engineer. And remember: "irrevocable" was what we tried to avoid in the first place, and your decision ended up being a big one after all.
Happily, both of these reasons can be mitigated effectively by just admitting up-front that you don't have a friggin' clue, and telling people ahead of the fact that your decision is purely preliminary, and might be the wrong thing. You should always reserve the right to change your mind, and make people very aware of that. And it's much easier to admit that you are stupid when you haven't yet done the really stupid thing.
Then, when it really does turn out to be stupid, people just roll their eyes and say "Oops, not again".
This preemptive admission of incompetence might also make the people who actually do the work also think twice about whether it's worth doing or not. After all, if they aren't certain whether it's a good idea, you sure as hell shouldn't encourage them by promising them that what they work on will be included. Make them at least think twice before they embark on a big endeavor.
Remember: they'd better know more about the details than you do, and they usually already think they have the answer to everything. The best thing you can do as a manager is not to instill confidence, but rather a healthy dose of critical thinking on what they do.
Btw, another way to avoid a decision is to plaintively just whine "can't we just do both?" and look pitiful. Trust me, it works. If it's not clear which approach is better, they'll eventually figure it out. The answer may end up being that both teams get so frustrated by the situation that they just give up.
That may sound like a failure, but it's usually a sign that there was something wrong with both projects, and the reason the people involved couldn't decide was that they were both wrong. You end up coming up smelling like roses, and you avoided yet another decision that you could have screwed up on.
2) People #
Most people are idiots, and being a manager means you'll have to deal with it, and perhaps more importantly, that they have to deal with you.
It turns out that while it's easy to undo technical mistakes, it's not as easy to undo personality disorders. You just have to live with theirs - and yours.
However, in order to prepare yourself as a kernel manager, it's best to remember not to burn any bridges, bomb any innocent villagers, or alienate too many kernel developers. It turns out that alienating people is fairly easy, and un-alienating them is hard. Thus "alienating" immediately falls under the heading of "not reversible", and becomes a no-no according to 1) Decisions.
There's just a few simple rules here:
don't call people d*ckheads (at least not in public)
learn how to apologize when you forgot rule (1)
The problem with #1 is that it's very easy to do, since you can say "you're a d*ckhead" in millions of different ways 2, sometimes without even realizing it, and almost always with a white-hot conviction that you are right.
And the more convinced you are that you are right (and let's face it, you can call just about anybody a d*ckhead, and you often will be right), the harder it ends up being to apologize afterwards.
To solve this problem, you really only have two options:
get really good at apologies
spread the "love" out so evenly that nobody really ends up feeling like they get unfairly targeted. Make it inventive enough, and they might even be amused.
The option of being unfailingly polite really doesn't exist. Nobody will trust somebody who is so clearly hiding their true character.
[2] Paul Simon sang "Fifty Ways to Leave Your Lover", because quite frankly, "A Million Ways to Tell a Developer They're a D*ckhead" doesn't scan nearly as well. But I'm sure he thought about it.
3) People II - the Good Kind #
While it turns out that most people are idiots, the corollary to that is sadly that you are one too, and that while we can all bask in the secure knowledge that we're better than the average person (let's face it, nobody ever believes that they're average or below-average), we should also admit that we're not the sharpest knife around, and there will be other people that are less of an idiot than you are.
Some people react badly to smart people. Others take advantage of them.
Make sure that you, as a kernel maintainer, are in the second group. Suck up to them, because they are the people who will make your job easier. In particular, they'll be able to make your decisions for you, which is what the game is all about.
So when you find somebody smarter than you are, just coast along. Your management responsibilities largely become ones of saying "Sounds like a good idea - go wild", or "That sounds good, but what about xxx?". The second version in particular is a great way to either learn something new about "xxx" or seem extra managerial by pointing out something the smarter person hadn't thought about. In either case, you win.
One thing to look out for is to realize that greatness in one area does not necessarily translate to other areas. So you might prod people in specific directions, but let's face it, they might be good at what they do, and suck at everything else. The good news is that people tend to naturally gravitate back to what they are good at, so it's not like you are doing something irreversible when you do prod them in some direction, just don't push too hard.
4) Placing blame #
Things will go wrong, and people want somebody to blame. Tag, you're it.
It's not actually that hard to accept the blame, especially if people kind of realize that it wasn't all your fault. Which brings us to the best way of taking the blame: do it for someone else. You'll feel good for taking the fall, they'll feel good about not getting blamed, and the person who lost their whole 36GB porn-collection because of your incompetence will grudgingly admit that you at least didn't try to weasel out of it.
Then make the developer who really screwed up (if you can find them) know in private that they screwed up. Not just so they can avoid it in the future, but so that they know they owe you one. And, perhaps even more importantly, they're also likely the person who can fix it. Because, let's face it, it sure ain't you.
Taking the blame is also why you get to be manager in the first place. It's part of what makes people trust you, and allow you the potential glory, because you're the one who gets to say "I screwed up". And if you've followed the previous rules, you'll be pretty good at saying that by now.
5) Things to avoid #
There's one thing people hate even more than being called "d*ckhead", and that is being called a "d*ckhead" in a sanctimonious voice. The first you can apologize for, the second one you won't really get the chance. They likely will no longer be listening even if you otherwise do a good job.
We all think we're better than anybody else, which means that when somebody else puts on airs, it really rubs us the wrong way. You may be morally and intellectually superior to everybody around you, but don't try to make it too obvious unless you really intend to irritate somebody 3.
Similarly, don't be too polite or subtle about things. Politeness easily ends up going overboard and hiding the problem, and as they say, "On the internet, nobody can hear you being subtle". Use a big blunt object to hammer the point in, because you can't really depend on people getting your point otherwise.
Some humor can help pad both the bluntness and the moralizing. Going overboard to the point of being ridiculous can drive a point home without making it painful to the recipient, who just thinks you're being silly. It can thus help get through the personal mental block we all have about criticism.
[3] Hint: internet newsgroups that are not directly related to your work are great ways to take out your frustrations at other people. Write insulting posts with a sneer just to get into a good flame every once in a while, and you'll feel cleansed. Just don't crap too close to home.
6) Why me? #
Since your main responsibility seems to be to take the blame for other peoples mistakes, and make it painfully obvious to everybody else that you're incompetent, the obvious question becomes one of why do it in the first place?
First off, while you may or may not get screaming teenage girls (or boys, let's not be judgmental or sexist here) knocking on your dressing room door, you will get an immense feeling of personal accomplishment for being "in charge". Never mind the fact that you're really leading by trying to keep up with everybody else and running after them as fast as you can. Everybody will still think you're the person in charge.
It's a great job if you can hack it.
Programming Language
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The Linux kernel is written in the C programming language c-language. More precisely, it is typically compiled with gcc gcc under -std=gnu11 gcc-c-dialect-options: the GNU dialect of ISO C11. clang clang is also supported; see documentation on Building Linux with Clang/LLVM.
This dialect contains many extensions to the language gnu-extensions, and many of them are used within the kernel as a matter of course.
Attributes #
One of the common extensions used throughout the kernel are attributes gcc-attribute-syntax. Attributes allow to introduce implementation-defined semantics to language entities (like variables, functions or types) without having to make significant syntactic changes to the language (e.g. adding a new keyword) n2049.
In some cases, attributes are optional (i.e. a compiler not supporting them should still produce proper code, even if it is slower or does not perform as many compile-time checks/diagnostics).
The kernel defines pseudo-keywords (e.g. __pure) instead of using directly the GNU attribute syntax (e.g. __attribute__((__pure__))) in order to feature detect which ones can be used and/or to shorten the code.
Please refer to include/linux/compiler_attributes.h for more information.
Rust #
The kernel has support for the Rust programming language rust-language under CONFIG_RUST. It is compiled with rustc rustc under --edition=2021 rust-editions. Editions are a way to introduce small changes to the language that are not backwards compatible.
On top of that, some unstable features rust-unstable-features are used in the kernel. Unstable features may change in the future, thus it is an important goal to reach a point where only stable features are used.
Please refer to Documentation/rust/index.rst for more information.
[c-language] http://www.open-std.org/jtc1/sc22/wg14/www/standards
[gcc] https://gcc.gnu.org
[clang] https://clang.llvm.org
[gcc-c-dialect-options] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
[gnu-extensions] https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
[gcc-attribute-syntax] https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
[n2049] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2049.pdf
[rust-language] https://www.rust-lang.org
[rustc] https://doc.rust-lang.org/rustc/
[rust-editions] https://doc.rust-lang.org/edition-guide/editions/
[rust-unstable-features] https://github.com/Rust-for-Linux/linux/issues/2
Researcher Guidelines
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The Linux kernel community welcomes transparent research on the Linux kernel, the activities involved in producing it, and any other byproducts of its development. Linux benefits greatly from this kind of research, and most aspects of Linux are driven by research in one form or another.
The community greatly appreciates if researchers can share preliminary findings before making their results public, especially if such research involves security. Getting involved early helps both improve the quality of research and ability for Linux to improve from it. In any case, sharing open access copies of the published research with the community is recommended.
This document seeks to clarify what the Linux kernel community considers acceptable and non-acceptable practices when conducting such research. At the very least, such research and related activities should follow standard research ethics rules. For more background on research ethics generally, ethics in technology, and research of developer communities in particular, see:
The Linux kernel community expects that everyone interacting with the project is participating in good faith to make Linux better. Research on any publicly-available artifact (including, but not limited to source code) produced by the Linux kernel community is welcome, though research on developers must be distinctly opt-in.
Passive research that is based entirely on publicly available sources, including posts to public mailing lists and commits to public repositories, is clearly permissible. Though, as with any research, standard ethics must still be followed.
Active research on developer behavior, however, must be done with the explicit agreement of, and full disclosure to, the individual developers involved. Developers cannot be interacted with/experimented on without consent; this, too, is standard research ethics.
Surveys #
Research often takes the form of surveys sent to maintainers or contributors. As a general rule, though, the kernel community derives little value from these surveys. The kernel development process works because every developer benefits from their participation, even working with others who have different goals. Responding to a survey, though, is a one-way demand placed on busy developers with no corresponding benefit to themselves or to the kernel community as a whole. For this reason, this method of research is discouraged.
Kernel community members already receive far too much email and are likely to perceive survey requests as just another demand on their time. Sending such requests deprives the community of valuable contributor time and is unlikely to yield a statistically useful response.
As an alternative, researchers should consider attending developer events, hosting sessions where the research project and its benefits to the participants can be explained, and interacting directly with the community there. The information received will be far richer than that obtained from an email survey, and the community will gain from the ability to learn from your insights as well.
Patches #
To help clarify: sending patches to developers is interacting with them, but they have already consented to receiving good faith contributions. Sending intentionally flawed/vulnerable patches or contributing misleading information to discussions is not consented to. Such communication can be damaging to the developer (e.g. draining time, effort, and morale) and damaging to the project by eroding the entire developer community's trust in the contributor (and the contributor's organization as a whole), undermining efforts to provide constructive feedback to contributors, and putting end users at risk of software flaws.
Participation in the development of Linux itself by researchers, as with anyone, is welcomed and encouraged. Research into Linux code is a common practice, especially when it comes to developing or running analysis tools that produce actionable results.
When engaging with the developer community, sending a patch has traditionally been the best way to make an impact. Linux already has plenty of known bugs -- what's much more helpful is having vetted fixes. Before contributing, carefully read the appropriate documentation:
Then send a patch (including a commit log with all the details listed below) and follow up on any feedback from other developers.
When sending patches produced from research, the commit logs should contain at least the following details, so that developers have appropriate context for understanding the contribution. Answer:
-
What is the specific problem that has been found?
-
How could the problem be reached on a running system?
-
What effect would encountering the problem have on the system?
-
How was the problem found? Specifically include details about any testing, static or dynamic analysis programs, and any other tools or methods used to perform the work.
-
Which version of Linux was the problem found on? Using the most recent release or a recent linux-next branch is strongly preferred (see Documentation/process/howto.rst).
-
What was changed to fix the problem, and why it is believed to be correct?
-
How was the change build tested and run-time tested?
-
What prior commit does this change fix? This should go in a "Fixes:" tag as the documentation describes.
-
Who else has reviewed this patch? This should go in appropriate "Reviewed-by:" tags; see below.
For example:
From: Author <author@email>
Subject: [PATCH] drivers/foo_bar: Add missing kfree()
The error path in foo_bar driver does not correctly free the allocated
struct foo_bar_info. This can happen if the attached foo_bar device
rejects the initialization packets sent during foo_bar_probe(). This
would result in a 64 byte slab memory leak once per device attach,
wasting memory resources over time.
This flaw was found using an experimental static analysis tool we are
developing, LeakMagic[1], which reported the following warning when
analyzing the v5.15 kernel release:
path/to/foo_bar.c:187: missing kfree() call?
Add the missing kfree() to the error path. No other references to
this memory exist outside the probe function, so this is the only
place it can be freed.
x86_64 and arm64 defconfig builds with CONFIG_FOO_BAR=y using GCC
11.2 show no new warnings, and LeakMagic no longer warns about this
code path. As we don't have a FooBar device to test with, no runtime
testing was able to be performed.
[1] https://url/to/leakmagic/details
Reported-by: Researcher <researcher@email>
Fixes: aaaabbbbccccdddd ("Introduce support for FooBar")
Signed-off-by: Author <author@email>
Reviewed-by: Reviewer <reviewer@email>
If you are a first time contributor it is recommended that the patch itself be vetted by others privately before being posted to public lists. (This is required if you have been explicitly told your patches need more careful internal review.) These people are expected to have their "Reviewed-by" tag included in the resulting patch. Finding another developer familiar with Linux contribution, especially within your own organization, and having them help with reviews before sending them to the public mailing lists tends to significantly improve the quality of the resulting patches, and there by reduces the burden on other developers.
If no one can be found to internally review patches and you need help finding such a person, or if you have any other questions related to this document and the developer community's expectations, please reach out to the private Technical Advisory Board mailing list: <tech-board@groups.linuxfoundation.org>.
Security bugs
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
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 disclosed as quickly as possible.
Preparing your report #
Like with any bug report, a security bug report requires a lot of analysis work from the developers, so the more information you can share about the issue, the better. Please review the procedure outlined in Documentation/admin-guide/reporting-issues.rst if you are unclear about what information is helpful. The following information are absolutely necessary in any security bug report:
affected kernel version range: with no version indication, your report will not be processed. A significant part of reports are for bugs that have already been fixed, so it is extremely important that vulnerabilities are verified on recent versions (development tree or latest stable version), at least by verifying that the code has not changed since the version where it was detected.
description of the problem: a detailed description of the problem, with traces showing its manifestation, and why you consider that the observed behavior as a problem in the kernel, is necessary.
reproducer: developers will need to be able to reproduce the problem to consider a fix as effective. This includes both a way to trigger the issue and a way to confirm it happens. A reproducer with low complexity dependencies will be needed (source code, shell script, sequence of instructions, file-system image etc). Binary-only executables are not accepted. Working exploits are extremely helpful and will not be released without consent from the reporter, unless they are already public. By definition if an issue cannot be reproduced, it is not exploitable, thus it is not a security bug.
conditions: if the bug depends on certain configuration options, sysctls, permissions, timing, code modifications etc, these should be indicated.
In addition, the following information are highly desirable:
suspected location of the bug: the file names and functions where the bug is suspected to be present are very important, at least to help forward the report to the appropriate maintainers. When not possible (for example, "system freezes each time I run this command"), the security team will help identify the source of the bug.
a proposed fix: bug reporters who have analyzed the cause of a bug in the source code almost always have an accurate idea on how to fix it, because they spent a long time studying it and its implications. Proposing a tested fix will save maintainers a lot of time, even if the fix ends up not being the right one, because it helps understand the bug. When proposing a tested fix, please always format it in a way that can be immediately merged (see Documentation/process/submitting-patches.rst). This will save some back-and-forth exchanges if it is accepted, and you will be credited for finding and fixing this issue. Note that in this case only a
Signed-off-by:tag is needed, withoutReported-by:when the reporter and author are the same.mitigations: very often during a bug analysis, some ways of mitigating the issue appear. It is useful to share them, as they can be helpful to keep end users protected during the time it takes them to apply the fix.
Identifying contacts #
The most effective way to report a security bug is to send it directly to the affected subsystem's maintainers and Cc: the Linux kernel security team. Do not send it to a public list at this stage, unless you have good reasons to consider the issue as being public or trivial to discover (e.g. result of a widely available automated vulnerability scanning tool that can be repeated by anyone).
If you're sending a report for issues affecting multiple parts in the kernel, even if they're fairly similar issues, please send individual messages (think that maintainers will not all work on the issues at the same time). The only exception is when an issue concerns closely related parts maintained by the exact same subset of maintainers, and these parts are expected to be fixed all at once by the same commit, then it may be acceptable to report them at once.
One difficulty for most first-time reporters is to figure the right list of recipients to send a report to. In the Linux kernel, all official maintainers are trusted, so the consequences of accidentally including the wrong maintainer are essentially a bit more noise for that person, i.e. nothing dramatic. As such, a suitable method to figure the list of maintainers (which kernel security officers use) is to rely on the get_maintainer.pl script, tuned to only report maintainers. This script, when passed a file name, will look for its path in the MAINTAINERS file to figure a hierarchical list of relevant maintainers. Calling it a first time with the finest level of filtering will most of the time return a short list of this specific file's maintainers:
$ ./scripts/get_maintainer.pl --no-l --no-r --pattern-depth 1 \
drivers/example.c
Developer One <dev1@example.com> (maintainer:example driver)
Developer Two <dev2@example.org> (maintainer:example driver)
These two maintainers should then receive the message. If the command does not return anything, it means the affected file is part of a wider subsystem, so we should be less specific:
$ ./scripts/get_maintainer.pl --no-l --no-r drivers/example.c
Developer One <dev1@example.com> (maintainer:example subsystem)
Developer Two <dev2@example.org> (maintainer:example subsystem)
Developer Three <dev3@example.com> (maintainer:example subsystem [GENERAL])
Developer Four <dev4@example.org> (maintainer:example subsystem [GENERAL])
Here, picking the first, most specific ones, is sufficient. When the list is long, it is possible to produce a comma-delimited e-mail address list on a single line suitable for use in the To: field of a mailer like this:
$ ./scripts/get_maintainer.pl --no-tree --no-l --no-r --no-n --m \
--no-git-fallback --no-substatus --no-rolestats --no-multiline \
--pattern-depth 1 drivers/example.c
dev1@example.com, dev2@example.org
or this for the wider list:
$ ./scripts/get_maintainer.pl --no-tree --no-l --no-r --no-n --m \
--no-git-fallback --no-substatus --no-rolestats --no-multiline \
drivers/example.c
dev1@example.com, dev2@example.org, dev3@example.com, dev4@example.org
If at this point you're still facing difficulties spotting the right maintainers, and only in this case, it's possible to send your report to the Linux kernel security team only. Your message will be triaged, and you will receive instructions about whom to contact, if needed. Your message may equally be forwarded as-is to the relevant maintainers.
Sending the report #
Reports are to be sent over e-mail exclusively. Please use a working e-mail address, preferably the same that you want to appear in Reported-by tags if any. If unsure, send your report to yourself first.
The security team and maintainers almost always require additional information beyond what was initially provided in a report and rely on active and efficient collaboration with the reporter to perform further testing (e.g., verifying versions, configuration options, mitigations, or patches). Before contacting the security team, the reporter must ensure they are available to explain their findings, engage in discussions, and run additional tests. Reports where the reporter does not respond promptly or cannot effectively discuss their findings may be abandoned if the communication does not quickly improve.
The report must be sent to maintainers, with the security team in Cc:. The Linux kernel security team can be contacted by email at <security@kernel.org>. This is a private list of security officers who will help verify the bug report and assist developers working on a fix. It is possible that the security team will bring in extra help from area maintainers to understand and fix the security vulnerability.
Please send plain text emails without attachments where possible. It is much harder to have a context-quoted discussion about a complex issue if all the details are hidden away in attachments. Think of it like a regular patch submission (even if you don't have a patch yet): describe the problem and impact, list reproduction steps, and follow it with a proposed fix, all in plain text. Markdown, HTML and RST formatted reports are particularly frowned upon since they're quite hard to read for humans and encourage to use dedicated viewers, sometimes online, which by definition is not acceptable for a confidential security report. Note that some mailers tend to mangle formatting of plain text by default, please consult Documentation/process/email-clients.rst for more info.
Disclosure and embargoed information #
The security list is not a disclosure channel. For that, see Coordination below.
Once a robust fix has been developed, the release process starts. Fixes for publicly known bugs are released immediately.
Although our preference is to release fixes for publicly undisclosed bugs as soon as they become available, this may be postponed at the request of the reporter or an affected party for up to 7 calendar days from the start of the release process, with an exceptional extension to 14 calendar days if it is agreed that the criticality of the bug requires more time. The only valid reason for deferring the publication of a fix is to accommodate the logistics of QA and large scale rollouts which require release coordination.
While embargoed information may be shared with trusted individuals in order to develop a fix, such information will not be published alongside the fix or on any other disclosure channel without the permission of the reporter. This includes but is not limited to the original bug report and followup discussions (if any), exploits, CVE information or the identity of the reporter.
In other words our only interest is in getting bugs fixed. All other information submitted to the security list and any followup discussions of the report are treated confidentially even after the embargo has been lifted, in perpetuity.
Coordination with other groups #
While the kernel security team solely focuses on getting bugs fixed, other groups focus on fixing issues in distros and coordinating disclosure between operating system vendors. Coordination is usually handled by the "linux-distros" mailing list and disclosure by the public "oss-security" mailing list, both of which are closely related and presented in the linux-distros wiki: <https://oss-security.openwall.org/wiki/mailing-lists/distros>
Please note that the respective policies and rules are different since the 3 lists pursue different goals. Coordinating between the kernel security team and other teams is difficult since for the kernel security team occasional embargoes (as subject to a maximum allowed number of days) start from the availability of a fix, while for "linux-distros" they start from the initial post to the list regardless of the availability of a fix.
As such, the kernel security team strongly recommends that as a reporter of a potential security issue you DO NOT contact the "linux-distros" mailing list UNTIL a fix is accepted by the affected code's maintainers and you have read the distros wiki page above and you fully understand the requirements that contacting "linux-distros" will impose on you and the kernel community. This also means that in general it doesn't make sense to Cc: both lists at once, except maybe for coordination if and while an accepted fix has not yet been merged. In other words, until a fix is accepted do not Cc: "linux-distros", and after it's merged do not Cc: the kernel security team.
CVE assignment #
The security team does not assign CVEs, nor do we require them for reports or fixes, as this can needlessly complicate the process and may delay the bug handling. If a reporter wishes to have a CVE identifier assigned for a confirmed issue, they can contact the kernel CVE assignment team to obtain one.
Non-disclosure agreements #
The Linux kernel security team is not a formal body and therefore unable to enter any non-disclosure agreements.
The Linux Kernel Driver Interface
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
(all of your questions answered and then some)
Greg Kroah-Hartman <greg@kroah.com>
This is being written to try to explain why Linux does not have a binary kernel interface, nor does it have a stable kernel interface.
Executive Summary #
You think you want a stable kernel interface, but you really do not, and you don't even know it. What you want is a stable running driver, and you get that only if your driver is in the main kernel tree. You also get lots of other good benefits if your driver is in the main kernel tree, all of which has made Linux into such a strong, stable, and mature operating system which is the reason you are using it in the first place.
Intro #
It's only the odd person who wants to write a kernel driver that needs to worry about the in-kernel interfaces changing. For the majority of the world, they neither see this interface, nor do they care about it at all.
First off, I'm not going to address any legal issues about closed source, hidden source, binary blobs, source wrappers, or any other term that describes kernel drivers that do not have their source code released under the GPL. Please consult a lawyer if you have any legal questions, I'm a programmer and hence, I'm just going to be describing the technical issues here (not to make light of the legal issues, they are real, and you do need to be aware of them at all times.)
So, there are two main topics here, binary kernel interfaces and stable kernel source interfaces. They both depend on each other, but we will discuss the binary stuff first to get it out of the way.
Binary Kernel Interface #
Assuming that we had a stable kernel source interface for the kernel, a binary interface would naturally happen too, right? Wrong. Please consider the following facts about the Linux kernel:
Depending on the version of the C compiler you use, different kernel data structures will contain different alignment of structures, and possibly include different functions in different ways (putting functions inline or not.) The individual function organization isn't that important, but the different data structure padding is very important.
Depending on what kernel build options you select, a wide range of different things can be assumed by the kernel:
different structures can contain different fields
Some functions may not be implemented at all, (i.e. some locks compile away to nothing for non-SMP builds.)
Memory within the kernel can be aligned in different ways, depending on the build options.
Linux runs on a wide range of different processor architectures. There is no way that binary drivers from one architecture will run on another architecture properly.
Now a number of these issues can be addressed by simply compiling your module for the exact specific kernel configuration, using the same exact C compiler that the kernel was built with. This is sufficient if you want to provide a module for a specific release version of a specific Linux distribution. But multiply that single build by the number of different Linux distributions and the number of different supported releases of the Linux distribution and you quickly have a nightmare of different build options on different releases. Also realize that each Linux distribution release contains a number of different kernels, all tuned to different hardware types (different processor types and different options), so for even a single release you will need to create multiple versions of your module.
Trust me, you will go insane over time if you try to support this kind of release, I learned this the hard way a long time ago...
Stable Kernel Source Interfaces #
This is a much more "volatile" topic if you talk to people who try to keep a Linux kernel driver that is not in the main kernel tree up to date over time.
Linux kernel development is continuous and at a rapid pace, never stopping to slow down. As such, the kernel developers find bugs in current interfaces, or figure out a better way to do things. If they do that, they then fix the current interfaces to work better. When they do so, function names may change, structures may grow or shrink, and function parameters may be reworked. If this happens, all of the instances of where this interface is used within the kernel are fixed up at the same time, ensuring that everything continues to work properly.
As a specific examples of this, the in-kernel USB interfaces have undergone at least three different reworks over the lifetime of this subsystem. These reworks were done to address a number of different issues:
A change from a synchronous model of data streams to an asynchronous one. This reduced the complexity of a number of drivers and increased the throughput of all USB drivers such that we are now running almost all USB devices at their maximum speed possible.
A change was made in the way data packets were allocated from the USB core by USB drivers so that all drivers now needed to provide more information to the USB core to fix a number of documented deadlocks.
This is in stark contrast to a number of closed source operating systems which have had to maintain their older USB interfaces over time. This provides the ability for new developers to accidentally use the old interfaces and do things in improper ways, causing the stability of the operating system to suffer.
In both of these instances, all developers agreed that these were important changes that needed to be made, and they were made, with relatively little pain. If Linux had to ensure that it will preserve a stable source interface, a new interface would have been created, and the older, broken one would have had to be maintained over time, leading to extra work for the USB developers. Since all Linux USB developers do their work on their own time, asking programmers to do extra work for no gain, for free, is not a possibility.
Security issues are also very important for Linux. When a security issue is found, it is fixed in a very short amount of time. A number of times this has caused internal kernel interfaces to be reworked to prevent the security problem from occurring. When this happens, all drivers that use the interfaces were also fixed at the same time, ensuring that the security problem was fixed and could not come back at some future time accidentally. If the internal interfaces were not allowed to change, fixing this kind of security problem and insuring that it could not happen again would not be possible.
Kernel interfaces are cleaned up over time. If there is no one using a current interface, it is deleted. This ensures that the kernel remains as small as possible, and that all potential interfaces are tested as well as they can be (unused interfaces are pretty much impossible to test for validity.)
What to do #
So, if you have a Linux kernel driver that is not in the main kernel tree, what are you, a developer, supposed to do? Releasing a binary driver for every different kernel version for every distribution is a nightmare, and trying to keep up with an ever changing kernel interface is also a rough job.
Simple, get your kernel driver into the main kernel tree (remember we are talking about drivers released under a GPL-compatible license here, if your code doesn't fall under this category, good luck, you are on your own here, you leech). If your driver is in the tree, and a kernel interface changes, it will be fixed up by the person who did the kernel change in the first place. This ensures that your driver is always buildable, and works over time, with very little effort on your part.
The very good side effects of having your driver in the main kernel tree are:
The quality of the driver will rise as the maintenance costs (to the original developer) will decrease.
Other developers will add features to your driver.
Other people will find and fix bugs in your driver.
Other people will find tuning opportunities in your driver.
Other people will update the driver for you when external interface changes require it.
The driver automatically gets shipped in all Linux distributions without having to ask the distros to add it.
As Linux supports a larger number of different devices "out of the box" than any other operating system, and it supports these devices on more different processor architectures than any other operating system, this proven type of development model must be doing something right :)
Thanks to Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder, Robert Love, and Nishanth Aravamudan for their review and comments on early drafts of this paper.
Everything you ever wanted to know about Linux -stable releases
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Rules on what kind of patches are accepted, and which ones are not, into the "-stable" tree:
-
It or an equivalent fix must already exist in Linux mainline (upstream).
-
It must be obviously correct and tested.
-
It cannot be bigger than 100 lines, with context.
-
It must follow the Documentation/process/submitting-patches.rst rules.
-
It must either fix a real bug that bothers people or just add a device ID. To elaborate on the former:
-
It fixes a problem like an oops, a hang, data corruption, a real security issue, a hardware quirk, a build error (but not for things marked CONFIG_BROKEN), or some "oh, that's not good" issue.
-
Serious issues as reported by a user of a distribution kernel may also be considered if they fix a notable performance or interactivity issue. As these fixes are not as obvious and have a higher risk of a subtle regression they should only be submitted by a distribution kernel maintainer and include an addendum linking to a bugzilla entry if it exists and additional information on the user-visible impact.
-
No "This could be a problem..." type of things like a "theoretical race condition", unless an explanation of how the bug can be exploited is also provided.
-
No "trivial" fixes without benefit for users (spelling changes, whitespace cleanups, etc).
-
Procedure for submitting patches to the -stable tree #
There are three options to submit a change to -stable trees:
-
Add a 'stable tag' to the description of a patch you then submit for mainline inclusion.
-
Ask the stable team to pick up a patch already mainlined.
-
Submit a patch to the stable team that is equivalent to a change already mainlined.
The sections below describe each of the options in more detail.
Option 1 is strongly preferred, it is the easiest and most common. Option 2 is mainly meant for changes where backporting was not considered at the time of submission. Option 3 is an alternative to the two earlier options for cases where a mainlined patch needs adjustments to apply in older series (for example due to API changes).
When using option 2 or 3 you can ask for your change to be included in specific stable series. When doing so, ensure the fix or an equivalent is applicable, submitted, or already present in all newer stable trees still supported. This is meant to prevent regressions that users might later encounter on updating, if e.g. a fix merged for 5.19-rc1 would be backported to 5.10.y, but not to 5.15.y.
Option 1 #
To have a patch you submit for mainline inclusion later automatically picked up for stable trees, add this tag in the sign-off area:
Cc: stable@vger.kernel.org
Use Cc: stable@kernel.org instead when fixing unpublished vulnerabilities: it reduces the chance of accidentally exposing the fix to the public by way of 'git send-email', as mails sent to that address are not delivered anywhere.
Once the patch is mainlined it will be applied to the stable tree without anything else needing to be done by the author or subsystem maintainer.
To send additional instructions to the stable team, use a shell-style inline comment to pass arbitrary or predefined notes:
-
Specify any additional patch prerequisites for cherry picking:
Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle Cc: <stable@vger.kernel.org> # 3.3.x: 1b9508f: sched: Rate-limit newidle Cc: <stable@vger.kernel.org> # 3.3.x: fd21073: sched: Fix affinity logic Cc: <stable@vger.kernel.org> # 3.3.x Signed-off-by: Ingo Molnar <mingo@elte.hu>The tag sequence has the meaning of:
git cherry-pick a1f84a3 git cherry-pick 1b9508f git cherry-pick fd21073 git cherry-pick <this commit>Note that for a patch series, you do not have to list as prerequisites the patches present in the series itself. For example, if you have the following patch series:
patch1 patch2where patch2 depends on patch1, you do not have to list patch1 as prerequisite of patch2 if you have already marked patch1 for stable inclusion.
-
Point out kernel version prerequisites:
Cc: <stable@vger.kernel.org> # 3.3.xThe tag has the meaning of:
git cherry-pick <this commit>For each "-stable" tree starting with the specified version.
Note, such tagging is unnecessary if the stable team can derive the appropriate versions from Fixes: tags.
-
Delay pick up of patches:
Cc: <stable@vger.kernel.org> # after -rc3 -
Point out known problems:
Cc: <stable@vger.kernel.org> # see patch description, needs adjustments for <= 6.3
There furthermore is a variant of the stable tag you can use to make the stable team's backporting tools (e.g AUTOSEL or scripts that look for commits containing a 'Fixes:' tag) ignore a change:
Cc: <stable+noautosel@kernel.org> # reason goes here, and must be present
Option 2 #
If the patch already has been merged to mainline, send an email to stable@vger.kernel.org containing the subject of the patch, the commit ID, why you think it should be applied, and what kernel versions you wish it to be applied to.
Option 3 #
Send the patch, after verifying that it follows the above rules, to stable@vger.kernel.org and mention the kernel versions you wish it to be applied to. When doing so, you must note the upstream commit ID in the changelog of your submission with a separate line above the commit text, like this:
commit <sha1> upstream.
Or alternatively:
[ Upstream commit <sha1> ]
If the submitted patch deviates from the original upstream patch (for example because it had to be adjusted for the older API), this must be very clearly documented and justified in the patch description.
Following the submission #
The sender will receive an ACK when the patch has been accepted into the queue, or a NAK if the patch is rejected. This response might take a few days, according to the schedules of the stable team members.
If accepted, the patch will be added to the -stable queue, for review by other developers and by the relevant subsystem maintainer.
Review cycle #
-
When the -stable maintainers decide for a review cycle, the patches will be sent to the review committee, and the maintainer of the affected area of the patch (unless the submitter is the maintainer of the area) and CC: to the linux-kernel mailing list.
-
The review committee has 48 hours in which to ACK or NAK the patch.
-
If the patch is rejected by a member of the committee, or linux-kernel members object to the patch, bringing up issues that the maintainers and members did not realize, the patch will be dropped from the queue.
-
The ACKed patches will be posted again as part of release candidate (-rc) to be tested by developers and testers.
-
Usually only one -rc release is made, however if there are any outstanding issues, some patches may be modified or dropped or additional patches may be queued. Additional -rc releases are then released and tested until no issues are found.
-
Responding to the -rc releases can be done on the mailing list by sending a "Tested-by:" email with any testing information desired. The "Tested-by:" tags will be collected and added to the release commit.
-
At the end of the review cycle, the new -stable release will be released containing all the queued and tested patches.
-
Security patches will be accepted into the -stable tree directly from the security kernel team, and not go through the normal review cycle. Contact the kernel security team for more details on this procedure.
Trees #
-
The queues of patches, for both completed versions and in progress versions can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
-
The finalized and tagged releases of all stable kernels can be found in separate branches per version at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
-
The release candidate of all stable kernel versions can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/
Review committee #
- This is made up of a number of kernel developers who have volunteered for this task, and a few that haven't.
Linux Kernel patch submission checklist
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Here are some basic things that developers should do if they want to see their kernel patch submissions accepted more quickly.
These are all above and beyond the documentation that is provided in Documentation/process/submitting-patches.rst and elsewhere regarding submitting Linux kernel patches.
Review your code #
-
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 you use.
-
Check your patch for general style as detailed in Documentation/process/coding-style.rst.
-
All memory barriers {e.g.,
barrier(),rmb(),wmb()} need a comment in the source code that explains the logic of what they are doing and why.
Review Kconfig changes #
-
Any new or modified
CONFIGoptions do not muck up the config menu and default to off unless they meet the exception criteria documented inDocumentation/kbuild/kconfig-language.rstMenu attributes: default value. -
All new
Kconfigoptions have help text. -
Has been carefully reviewed with respect to relevant
Kconfigcombinations. This is very hard to get right with testing---brainpower pays off here.
Provide documentation #
-
Include kernel-doc to document global kernel APIs. (Not required for static functions, but OK there also.)
-
All new
/procentries are documented underDocumentation/ -
All new kernel boot parameters are documented in
Documentation/admin-guide/kernel-parameters.rst. -
All new module parameters are documented with
MODULE_PARM_DESC() -
All new userspace interfaces are documented in
Documentation/ABI/. See Documentation/admin-guide/abi.rst (orDocumentation/ABI/README) for more information. Patches that change userspace interfaces should be CCed to linux-api@vger.kernel.org. -
If any ioctl's are added by the patch, then also update
Documentation/userspace-api/ioctl/ioctl-number.rst.
Check your code with tools #
-
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 your patch. -
Check cleanly with sparse.
-
Use
make checkstackand fix any problems that it finds. Note thatcheckstackdoes not point out problems explicitly, but any one function that uses more than 512 bytes on the stack is a candidate for change.
Build your code #
- Builds cleanly:
a) with applicable or modified
CONFIGoptions=y,=m, and=n. Nogccwarnings/errors, no linker warnings/errors.b) Passes
allnoconfig,allmodconfigc) Builds successfully when using
O=builddird) Any Documentation/ changes build successfully without new warnings/errors. Use
make htmldocsormake pdfdocsto check the build and fix any issues.
-
Builds on multiple CPU architectures by using local cross-compile tools or some other build farm. Note that testing against architectures of different word sizes (32- and 64-bit) and different endianness (big- and little-) is effective in catching various portability issues due to false assumptions on representable quantity range, data alignment, or endianness, among others.
-
Newly-added code has been compiled with
gcc -W(usemake KCFLAGS=-W). This will generate lots of noise, but is good for finding bugs like "warning: comparison between signed and unsigned". -
If your modified source code depends on or uses any of the kernel APIs or features that are related to the following
Kconfigsymbols, then test multiple builds with the relatedKconfigsymbols disabled and/or=m(if that option is available) [not all of these at the same time, just various/random combinations of them]:CONFIG_SMP,CONFIG_SYSFS,CONFIG_PROC_FS,CONFIG_INPUT,CONFIG_PCI,CONFIG_BLOCK,CONFIG_PM,CONFIG_MAGIC_SYSRQ,CONFIG_NET,CONFIG_INET=n(but latter withCONFIG_NET=y).
Test your code #
-
Has been tested with
CONFIG_PREEMPT,CONFIG_DEBUG_PREEMPT,CONFIG_SLUB_DEBUG,CONFIG_DEBUG_PAGEALLOC,CONFIG_DEBUG_MUTEXES,CONFIG_DEBUG_SPINLOCK,CONFIG_DEBUG_ATOMIC_SLEEP,CONFIG_PROVE_RCUandCONFIG_DEBUG_OBJECTS_RCU_HEADall simultaneously enabled. -
Has been build- and runtime tested with and without
CONFIG_SMPandCONFIG_PREEMPT. -
All codepaths have been exercised with all lockdep features enabled.
-
Has been checked with injection of at least slab and page-allocation failures. See
Documentation/fault-injection/. If the new code is substantial, addition of subsystem-specific fault injection might be appropriate. -
Tested with the most recent tag of linux-next to make sure that it still works with all of the other queued patches and various changes in the VM, VFS, and other subsystems.
Submitting patches: the essential guide to getting your code into the kernel
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
For a person or company who wishes to submit a change to the Linux kernel, the process can sometimes be daunting if you're not familiar with "the system." This text is a collection of suggestions which can greatly increase the chances of your change being accepted.
This document contains a large number of suggestions in a relatively terse format. For detailed information on how the kernel development process works, see Documentation/process/development-process.rst. Also, read Documentation/process/submit-checklist.rst for a list of items to check before submitting code. For device tree binding patches, read Documentation/devicetree/bindings/submitting-patches.rst.
This documentation assumes that you're using git to prepare your patches. If you're unfamiliar with git, you would be well-advised to learn how to use it, it will make your life as a kernel developer and in general much easier.
Some subsystems and maintainer trees have additional information about their workflow and expectations, see Documentation/process/maintainer-handbooks.rst.
Obtain a current source tree #
If you do not have a repository with the current kernel source handy, use git to obtain one. You'll want to start with the mainline repository, which can be grabbed with:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Note, however, that you may not want to develop against the mainline tree directly. Most subsystem maintainers run their own trees and want to see patches prepared against those trees. See the T: entry for the subsystem in the MAINTAINERS file to find that tree, or simply ask the maintainer if the tree is not listed there.
Describe your changes #
Describe your problem. Whether your patch is a one-line bug fix or 5000 lines of a new feature, there must be an underlying problem that motivated you to do this work. Convince the reviewer that there is a problem worth fixing and that it makes sense for them to read past the first paragraph.
Describe user-visible impact. Straight up crashes and lockups are pretty convincing, but not all bugs are that blatant. Even if the problem was spotted during code review, describe the impact you think it can have on users. Keep in mind that the majority of Linux installations run kernels from secondary stable trees or vendor/product-specific trees that cherry-pick only specific patches from upstream, so include anything that could help route your change downstream: provoking circumstances, excerpts from dmesg, crash descriptions, performance regressions, latency spikes, lockups, etc.
Quantify optimizations and trade-offs. If you claim improvements in performance, memory consumption, stack footprint, or binary size, include numbers that back them up. But also describe non-obvious costs. Optimizations usually aren't free but trade-offs between CPU, memory, and readability; or, when it comes to heuristics, between different workloads. Describe the expected downsides of your optimization so that the reviewer can weigh costs against benefits.
Once the problem is established, describe what you are actually doing about it in technical detail. It's important to describe the change in plain English for the reviewer to verify that the code is behaving as you intend it to.
The maintainer will thank you if you write your patch description in a form which can be easily pulled into Linux's source code management system, git, as a "commit log". See The canonical patch format.
Solve only one problem per patch. If your description starts to get long, that's a sign that you probably need to split up your patch. See Separate your changes.
When you submit or resubmit a patch or patch series, include the complete patch description and justification for it. Don't just say that this is version N of the patch (series). Don't expect the subsystem maintainer to refer back to earlier patch versions or referenced URLs to find the patch description and put that into the patch. I.e., the patch (series) and its description should be self-contained. This benefits both the maintainers and reviewers. Some reviewers probably didn't even receive earlier versions of the patch.
Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour.
If you want to refer to a specific commit, don't just refer to the SHA-1 ID of the commit. Please also include the oneline summary of the commit, to make it easier for reviewers to know what it is about. Example:
Commit e21d2170f36602ae2708 ("video: remove unnecessary
platform_set_drvdata()") removed the unnecessary
platform_set_drvdata(), but left the variable "dev" unused,
delete it.
You should also be sure to use at least the first twelve characters of the SHA-1 ID. The kernel repository holds a lot of objects, making collisions with shorter IDs a real possibility. Bear in mind that, even if there is no collision with your six-character ID now, that condition may change five years from now.
If related discussions or any other background information behind the change can be found on the web, add 'Link:' tags pointing to it. If the patch is a result of some earlier mailing list discussions or something documented on the web, point to it.
When linking to mailing list archives, preferably use the lore.kernel.org message archiver service. To create the link URL, use the contents of the Message-ID header of the message without the surrounding angle brackets. For example:
Link: https://lore.kernel.org/30th.anniversary.repost@klaava.Helsinki.FI
Please check the link to make sure that it is actually working and points to the relevant message.
However, try to make your explanation understandable without external resources. In addition to giving a URL to a mailing list archive or bug, summarize the relevant points of the discussion that led to the patch as submitted.
In case your patch fixes a bug, use the 'Closes:' tag with a URL referencing the report in the mailing list archives or a public bug tracker. For example:
Closes: https://example.com/issues/1234
Some bug trackers have the ability to close issues automatically when a commit with such a tag is applied. Some bots monitoring mailing lists can also track such tags and take certain actions. Private bug trackers and invalid URLs are forbidden.
If your patch fixes a bug in a specific commit, e.g. you found an issue using git bisect, please use the 'Fixes:' tag with at least the first 12 characters of the SHA-1 ID, and the one line summary. Do not split the tag across multiple lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify parsing scripts. For example:
Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed")
The following git config settings can be used to add a pretty format for outputting the above style in the git log or git show commands:
[core]
abbrev = 12
[pretty]
fixes = Fixes: %h (\"%s\")
An example call:
$ git log -1 --pretty=fixes 54a4f0239f2e
Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the number of pages it actually freed")
Separate your changes #
Separate each logical change into a separate patch.
For example, if your changes include both bug fixes and performance enhancements for a single driver, separate those changes into two or more patches. If your changes include an API update, and a new driver which uses that new API, separate those into two patches.
On the other hand, if you make a single change to numerous files, group those changes into a single patch. Thus a single logical change is contained within a single patch.
The point to remember is that each patch should make an easily understood change that can be verified by reviewers. Each patch should be justifiable on its own merits.
If one patch depends on another patch in order for a change to be complete, that is OK. Simply note "this patch depends on patch X" in your patch description.
When dividing your change into a series of patches, take special care to ensure that the kernel builds and runs properly after each patch in the series. Developers using git bisect to track down a problem can end up splitting your patch series at any point; they will not thank you if you introduce bugs in the middle.
If you cannot condense your patch set into a smaller set of patches, then only post say 15 or so at a time and wait for review and integration.
Style-check your changes #
Check your patch for basic style violations, details of which can be found in Documentation/process/coding-style.rst. Failure to do so simply wastes the reviewers time and will get your patch rejected, probably without even being read.
One significant exception is when moving code from one file to another -- in this case you should not modify the moved code at all in the same patch which moves it. This clearly delineates the act of moving the code and your changes. This greatly aids review of the actual differences and allows tools to better track the history of the code itself.
Check your patches with the patch style checker prior to submission (scripts/checkpatch.pl). Note, though, that the style checker should be viewed as a guide, not as a replacement for human judgment. If your code looks better with a violation then its probably best left alone.
-
The checker reports at three levels:
-
ERROR: things that are very likely to be wrong
-
WARNING: things requiring careful review
-
CHECK: things requiring thought
-
You should be able to justify all violations that remain in your patch.
Select the recipients for your patch #
You should always copy the appropriate subsystem maintainer(s) and list(s) on any patch to code that they maintain; look through the MAINTAINERS file and the source code revision history to see who those maintainers are. The script scripts/get_maintainer.pl can be very useful at this step (pass paths to your patches as arguments to scripts/get_maintainer.pl). If you cannot find a maintainer for the subsystem you are working on, Andrew Morton (akpm@linux-foundation.org) serves as a maintainer of last resort.
linux-kernel@vger.kernel.org should be used by default for all patches, but the volume on that list has caused a number of developers to tune it out. Please do not spam unrelated lists and unrelated people, though.
Many kernel-related lists are hosted at kernel.org; you can find a list of them at https://subspace.kernel.org. There are kernel-related lists hosted elsewhere as well, though.
Linus Torvalds is the final arbiter of all changes accepted into the Linux kernel. His e-mail address is <torvalds@linux-foundation.org>. He gets a lot of e-mail, and, at this point, very few patches go through Linus directly, so typically you should do your best to -avoid- sending him e-mail.
If you have a patch that fixes an exploitable security bug, send that patch to security@kernel.org. For severe bugs, a short embargo may be considered to allow distributors to get the patch out to users; in such cases, obviously, the patch should not be sent to any public lists. See also Documentation/process/security-bugs.rst.
Patches that fix a severe bug in a released kernel should be directed toward the stable maintainers by putting a line like this:
Cc: stable@vger.kernel.org
into the sign-off area of your patch (note, NOT an email recipient). You should also read Documentation/process/stable-kernel-rules.rst in addition to this document.
If changes affect userland-kernel interfaces, please send the MAN-PAGES maintainer (as listed in the MAINTAINERS file) a man-pages patch, or at least a notification of the change, so that some information makes its way into the manual pages. User-space API changes should also be copied to linux-api@vger.kernel.org.
No MIME, no links, no compression, no attachments. Just plain text #
Linus and other kernel developers need to be able to read and comment on the changes you are submitting. It is important for a kernel developer to be able to "quote" your changes, using standard e-mail tools, so that they may comment on specific portions of your code.
For this reason, all patches should be submitted by e-mail "inline". The easiest way to do this is with git send-email, which is strongly recommended. An interactive tutorial for git send-email is available at https://git-send-email.io.
If you choose not to use git send-email:
Do not attach the patch as a MIME attachment, compressed or not. Many popular e-mail applications will not always transmit a MIME attachment as plain text, making it impossible to comment on your code. A MIME attachment also takes Linus a bit more time to process, decreasing the likelihood of your MIME-attached change being accepted.
Exception: If your mailer is mangling patches then someone may ask you to re-send them using MIME.
See Documentation/process/email-clients.rst for hints about configuring your e-mail client so that it sends your patches untouched.
Respond to review comments #
Your patch will almost certainly get comments from reviewers on ways in which the patch can be improved, in the form of a reply to your email. You must respond to those comments; ignoring reviewers is a good way to get ignored in return. You can simply reply to their emails to answer their comments. Review comments or questions that do not lead to a code change should almost certainly bring about a comment or changelog entry so that the next reviewer better understands what is going on.
Be sure to tell the reviewers what changes you are making and to thank them for their time. Code review is a tiring and time-consuming process, and reviewers sometimes get grumpy. Even in that case, though, respond politely and address the problems they have pointed out. When sending a next version, add a patch changelog to the cover letter or to individual patches explaining difference against previous submission (see The canonical patch format). Notify people that commented on your patch about new versions by adding them to the patches CC list.
See Documentation/process/email-clients.rst for recommendations on email clients and mailing list etiquette.
Use trimmed interleaved replies in email discussions #
Top-posting is strongly discouraged in Linux kernel development discussions. Interleaved (or "inline") replies make conversations much easier to follow. For more details see: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
As is frequently quoted on the mailing list:
A: http://en.wikipedia.org/wiki/Top_post
Q: Where do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
Similarly, please trim all unneeded quotations that aren't relevant to your reply. This makes responses easier to find, and saves time and space. For more details see: http://daringfireball.net/2007/07/on_top
A: No.
Q: Should I include quotations after my reply?
Don't get discouraged - or impatient #
After you have submitted your change, be patient and wait. Reviewers are busy people and may not get to your patch right away.
Once upon a time, patches used to disappear into the void without comment, but the development process works more smoothly than that now. You should receive comments within a few weeks (typically 2-3); if that does not happen, make sure that you have sent your patches to the right place. Wait for a minimum of one week before resubmitting or pinging reviewers - possibly longer during busy times like merge windows.
It's also ok to resend the patch or the patch series after a couple of weeks with the word "RESEND" added to the subject line:
[PATCH Vx RESEND] sub/sys: Condensed patch summary
Don't add "RESEND" when you are submitting a modified version of your patch or patch series - "RESEND" only applies to resubmission of a patch or patch series which have not been modified in any way from the previous submission.
Include PATCH in the subject #
Due to high e-mail traffic to Linus, and to linux-kernel, it is common convention to prefix your subject line with [PATCH]. This lets Linus and other kernel developers more easily distinguish patches from other e-mail discussions.
git send-email will do this for you automatically.
Sign your work - the Developer's Certificate of Origin #
To improve tracking of who did what, especially with patches that can percolate to their final resting place in the kernel through several layers of maintainers, we've introduced a "sign-off" procedure on patches that are being emailed around.
The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below:
Developer's Certificate of Origin 1.1 #
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
then you just add a line saying:
Signed-off-by: Random J Developer <random@developer.example.org>
using a known identity (sorry, no anonymous contributions.) This will be done for you automatically if you use git commit -s. Reverts should also include "Signed-off-by". git revert -s does that for you.
Some people also put extra tags at the end. They'll just be ignored for now, but you can do this to mark internal company procedures or just point out some special detail about the sign-off.
Any further SoBs (Signed-off-by:'s) following the author's SoB are from people handling and transporting the patch, but were not involved in its development. SoB chains should reflect the real route a patch took as it was propagated to the maintainers and ultimately to Linus, with the first SoB entry signalling primary authorship of a single author.
When to use Acked-by:, Cc:, and Co-developed-by: #
The Signed-off-by: tag indicates that the signer was involved in the development of the patch, or that he/she was in the patch's delivery path.
If a person was not directly involved in the preparation or handling of a patch but wishes to signify and record their approval of it then they can ask to have an Acked-by: line added to the patch's changelog.
Acked-by: is meant to be used by those responsible for or involved with the affected code in one way or another. Most commonly, the maintainer when that maintainer neither contributed to nor forwarded the patch.
Acked-by: may also be used by other stakeholders, such as people with domain knowledge (e.g. the original author of the code being modified), userspace-side reviewers for a kernel uAPI patch or key users of a feature. Optionally, in these cases, it can be useful to add a "# Suffix" to clarify its meaning:
Acked-by: The Stakeholder <stakeholder@example.org> # As primary user
Acked-by: is not as formal as Signed-off-by:. It is a record that the acker has at least reviewed the patch and has indicated acceptance. Hence patch mergers will sometimes manually convert an acker's "yep, looks good to me" into an Acked-by: (but note that it is usually better to ask for an explicit ack).
Acked-by: is also less formal than Reviewed-by:. For instance, maintainers may use it to signify that they are OK with a patch landing, but they may not have reviewed it as thoroughly as if a Reviewed-by: was provided. Similarly, a key user may not have carried out a technical review of the patch, yet they may be satisfied with the general approach, the feature or the user-facing interface.
Acked-by: does not necessarily indicate acknowledgement of the entire patch. For example, if a patch affects multiple subsystems and has an Acked-by: from one subsystem maintainer then this usually indicates acknowledgement of just the part which affects that maintainer's code. Judgement should be used here. When in doubt people should refer to the original discussion in the mailing list archives. A "# Suffix" may also be used in this case to clarify.
If a person has had the opportunity to comment on a patch, but has not provided such comments, you may optionally add a Cc: tag to the patch. This tag documents that potentially interested parties have been included in the discussion. Note, this is one of only three tags you might be able to use without explicit permission of the person named (see 'Tagging people requires permission' below for details).
Co-developed-by: states that the patch was co-created by multiple developers; it is used to give attribution to co-authors (in addition to the author attributed by the From: tag) when several people work on a single patch. Since Co-developed-by: denotes authorship, every Co-developed-by: must be immediately followed by a Signed-off-by: of the associated co-author. Standard sign-off procedure applies, i.e. the ordering of Signed-off-by: tags should reflect the chronological history of the patch insofar as possible, regardless of whether the author is attributed via From: or Co-developed-by:. Notably, the last Signed-off-by: must always be that of the developer submitting the patch.
Note, the From: tag is optional when the From: author is also the person (and email) listed in the From: line of the email header.
Example of a patch submitted by the From: author:
<changelog>
Co-developed-by: First Co-Author <first@coauthor.example.org>
Signed-off-by: First Co-Author <first@coauthor.example.org>
Co-developed-by: Second Co-Author <second@coauthor.example.org>
Signed-off-by: Second Co-Author <second@coauthor.example.org>
Signed-off-by: From Author <from@author.example.org>
Example of a patch submitted by a Co-developed-by: author:
From: From Author <from@author.example.org>
<changelog>
Co-developed-by: Random Co-Author <random@coauthor.example.org>
Signed-off-by: Random Co-Author <random@coauthor.example.org>
Signed-off-by: From Author <from@author.example.org>
Co-developed-by: Submitting Co-Author <sub@coauthor.example.org>
Signed-off-by: Submitting Co-Author <sub@coauthor.example.org>
Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: #
The Reported-by tag gives credit to people who find bugs and report them and it hopefully inspires them to help us again in the future. The tag is intended for bugs; please do not use it to credit feature requests. The tag should be followed by a Closes: tag pointing to the report, unless the report is not available on the web. The Link: tag can be used instead of Closes: if the patch fixes a part of the issue(s) being reported. Note, the Reported-by tag is one of only three tags you might be able to use without explicit permission of the person named (see 'Tagging people requires permission' below for details).
A Tested-by: tag indicates that the patch has been successfully tested (in some environment) by the person named. This tag informs maintainers that some testing has been performed, provides a means to locate testers for future patches, and ensures credit for the testers.
Reviewed-by:, instead, indicates that the patch has been reviewed and found acceptable according to the Reviewer's Statement:
Reviewer's statement of oversight #
By offering my Reviewed-by: tag, I state that:
(a) I have carried out a technical review of this patch to evaluate its appropriateness and readiness for inclusion into the mainline kernel.
(b) Any problems, concerns, or questions relating to the patch have been communicated back to the submitter. I am satisfied with the submitter's response to my comments.
(c) While there may be things that could be improved with this submission, I believe that it is, at this time, (1) a worthwhile modification to the kernel, and (2) free of known issues which would argue against its inclusion.
(d) While I have reviewed the patch and believe it to be sound, I do not (unless explicitly stated elsewhere) make any warranties or guarantees that it will achieve its stated purpose or function properly in any given situation.
A Reviewed-by tag is a statement of opinion that the patch is an appropriate modification of the kernel without any remaining serious technical issues. Any interested reviewer (who has done the work) can offer a Reviewed-by tag for a patch. This tag serves to give credit to reviewers and to inform maintainers of the degree of review which has been done on the patch. Reviewed-by: tags, when supplied by reviewers known to understand the subject area and to perform thorough reviews, will normally increase the likelihood of your patch getting into the kernel.
Both Tested-by and Reviewed-by tags, once received on mailing list from tester or reviewer, should be added by author to the applicable patches when sending next versions. However if the patch has changed substantially in following version, these tags might not be applicable anymore and thus should be removed. Usually removal of someone's Acked-by, Tested-by or Reviewed-by tags should be mentioned in the patch changelog with an explanation (after the '---' separator).
A Suggested-by: tag indicates that the patch idea is suggested by the person named and ensures credit to the person for the idea: if we diligently credit our idea reporters, they will, hopefully, be inspired to help us again in the future. Note, this is one of only three tags you might be able to use without explicit permission of the person named (see 'Tagging people requires permission' below for details).
A Fixes: tag indicates that the patch fixes a bug in a previous commit. It is used to make it easy to determine where an issue originated, which can help review a bug fix. This tag also assists the stable kernel team in determining which stable kernel versions should receive your fix. This is the preferred method for indicating a bug fixed by the patch. See Describe your changes for more details.
Note: Attaching a Fixes: tag does not subvert the stable kernel rules process nor the requirement to Cc: stable@vger.kernel.org on all stable patch candidates. For more information, please read Documentation/process/stable-kernel-rules.rst.
Finally, while providing tags is welcome and typically very appreciated, please note that signers (i.e. submitters and maintainers) may use their discretion in applying offered tags.
Tagging people requires permission #
Be careful in the addition of the aforementioned tags to your patches, as all except for Cc:, Reported-by:, and Suggested-by: need explicit permission of the person named. For those three implicit permission is sufficient if the person contributed to the Linux kernel using that name and email address according to the lore archives or the commit history -- and in case of Reported-by: and Suggested-by: did the reporting or suggestion in public. Note, bugzilla.kernel.org is a public place in this sense, but email addresses used there are private; so do not expose them in tags, unless the person used them in earlier contributions.
The canonical patch format #
This section describes how the patch itself should be formatted. Note that, if you have your patches stored in a git repository, proper patch formatting can be had with git format-patch. The tools cannot create the necessary text, though, so read the instructions below anyway.
Subject Line #
The canonical patch subject line is:
Subject: [PATCH 001/123] subsystem: summary phrase
The canonical patch message body contains the following:
A
fromline specifying the patch author, followed by an empty line (only needed if the person sending the patch is not the author).The body of the explanation, line wrapped at 75 columns, which will be copied to the permanent changelog to describe this patch.
An empty line.
The
Signed-off-by:lines, described above, which will also go in the changelog.A marker line containing simply
---.Any additional comments not suitable for the changelog.
The actual patch (
diffoutput).
The Subject line format makes it very easy to sort the emails alphabetically by subject line - pretty much any email reader will support that - since because the sequence number is zero-padded, the numerical and alphabetic sort is the same.
The subsystem in the email's Subject should identify which area or subsystem of the kernel is being patched.
The summary phrase in the email's Subject should concisely describe the patch which that email contains. The summary phrase should not be a filename. Do not use the same summary phrase for every patch in a whole patch series (where a patch series is an ordered sequence of multiple, related patches).
Bear in mind that the summary phrase of your email becomes a globally-unique identifier for that patch. It propagates all the way into the git changelog. The summary phrase may later be used in developer discussions which refer to the patch. People will want to google for the summary phrase to read discussion regarding that patch. It will also be the only thing that people may quickly see when, two or three months later, they are going through perhaps thousands of patches using tools such as gitk or git log --oneline.
For these reasons, the summary must be no more than 70-75 characters, and it must describe both what the patch changes, as well as why the patch might be necessary. It is challenging to be both succinct and descriptive, but that is what a well-written summary should do.
The summary phrase may be prefixed by tags enclosed in square brackets: "Subject: [PATCH <tag>...] <summary phrase>". The tags are not considered part of the summary phrase, but describe how the patch should be treated. Common tags might include a version descriptor if the multiple versions of the patch have been sent out in response to comments (i.e., "v1, v2, v3"), or "RFC" to indicate a request for comments.
If there are four patches in a patch series the individual patches may be numbered like this: 1/4, 2/4, 3/4, 4/4. This assures that developers understand the order in which the patches should be applied and that they have reviewed or applied all of the patches in the patch series.
Here are some good example Subjects:
Subject: [PATCH 2/5] ext2: improve scalability of bitmap searching
Subject: [PATCH v2 01/27] x86: fix eflags tracking
Subject: [PATCH v2] sub/sys: Condensed patch summary
Subject: [PATCH v2 M/N] sub/sys: Condensed patch summary
From Line #
The from line must be the very first line in the message body, and has the form:
From: Patch Author <author@example.com>
The from line specifies who will be credited as the author of the patch in the permanent changelog. If the from line is missing, then the From: line from the email header will be used to determine the patch author in the changelog.
The author may indicate their affiliation or the sponsor of the work by adding the name of an organization to the from and SoB lines, e.g.:
From: Patch Author (Company) <author@example.com>
Explanation Body #
The explanation body will be committed to the permanent source changelog, so should make sense to a competent reader who has long since forgotten the immediate details of the discussion that might have led to this patch. Including symptoms of the failure which the patch addresses (kernel log messages, oops messages, etc.) are especially useful for people who might be searching the commit logs looking for the applicable patch. The text should be written in such detail so that when read weeks, months or even years later, it can give the reader the needed details to grasp the reasoning for why the patch was created.
If a patch fixes a compile failure, it may not be necessary to include _all_ of the compile failures; just enough that it is likely that someone searching for the patch can find it. As in the summary phrase, it is important to be both succinct as well as descriptive.
Backtraces in commit messages #
Backtraces help document the call chain leading to a problem. However, not all backtraces are helpful. For example, early boot call chains are unique and obvious. Copying the full dmesg output verbatim, however, adds distracting information like timestamps, module lists, register and stack dumps.
Therefore, the most useful backtraces should distill the relevant information from the dump, which makes it easier to focus on the real issue. Here is an example of a well-trimmed backtrace:
unchecked MSR access error: WRMSR to 0xd51 (tried to write 0x0000000000000064)
at rIP: 0xffffffffae059994 (native_write_msr+0x4/0x20)
Call Trace:
mba_wrmsr
update_domains
rdtgroup_mkdir
Commentary #
The --- marker line serves the essential purpose of marking for patch handling tools where the changelog message ends.
One good use for the additional comments after the --- marker is for a diffstat, to show what files have changed, and the number of inserted and deleted lines per file. A diffstat is especially useful on bigger patches. If you are going to include a diffstat after the --- marker, please use diffstat options -p 1 -w 70 so that filenames are listed from the top of the kernel source tree and don't use too much horizontal space (easily fit in 80 columns, maybe with some indentation). (git generates appropriate diffstats by default.)
Other comments relevant only to the moment or the maintainer, not suitable for the permanent changelog, should also go here. A good example of such comments might be patch changelogs which describe what has changed between the v1 and v2 version of the patch.
Please put this information after the --- line which separates the changelog from the rest of the patch. The version information is not part of the changelog which gets committed to the git tree. It is additional information for the reviewers. If it's placed above the commit tags, it needs manual interaction to remove it. If it is below the separator line, it gets automatically stripped off when applying the patch. If available, adding links to previous versions of the patch (e.g., lore.kernel.org archive link) is recommended to help reviewers:
<commit message>
...
Signed-off-by: Author <author@mail>
---
V2 -> V3: Removed redundant helper function
V1 -> V2: Cleaned up coding style and addressed review comments
v2: https://lore.kernel.org/bar
v1: https://lore.kernel.org/foo
path/to/file | 5+++--
...
See more details on the proper patch format in the following references.
Explicit In-Reply-To headers #
It can be helpful to manually add In-Reply-To: headers to a patch (e.g., when using git send-email) to associate the patch with previous relevant discussion, e.g. to link a bug fix to the email with the bug report. However, for a multi-patch series, it is generally best to avoid using In-Reply-To: to link to older versions of the series. This way multiple versions of the patch don't become an unmanageable forest of references in email clients. If a link is helpful, you can use the https://lore.kernel.org/ redirector (e.g., in the cover email text) to link to an earlier version of the patch series.
Providing base tree information #
When other developers receive your patches and start the review process, it is absolutely necessary for them to know what is the base commit/branch your work applies on, considering the sheer amount of maintainer trees present nowadays. Note again the T: entry in the MAINTAINERS file explained above.
This is even more important for automated CI processes that attempt to run a series of tests in order to establish the quality of your submission before the maintainer starts the review.
If you are using git format-patch to generate your patches, you can automatically include the base tree information in your submission by using the --base flag. The easiest and most convenient way to use this option is with topical branches:
$ git checkout -t -b my-topical-branch master
Branch 'my-topical-branch' set up to track local branch 'master'.
Switched to a new branch 'my-topical-branch'
[perform your edits and commits]
$ git format-patch --base=auto --cover-letter -o outgoing/ master
outgoing/0000-cover-letter.patch
outgoing/0001-First-Commit.patch
outgoing/...
When you open outgoing/0000-cover-letter.patch for editing, you will notice that it will have the base-commit: trailer at the very bottom, which provides the reviewer and the CI tools enough information to properly perform git am without worrying about conflicts:
$ git checkout -b patch-review [base-commit-id]
Switched to a new branch 'patch-review'
$ git am patches.mbox
Applying: First Commit
Applying: ...
Please see man git-format-patch for more information about this option.
If you are not using git to format your patches, you can still include the same base-commit trailer to indicate the commit hash of the tree on which your work is based. You should add it either in the cover letter or in the first patch of the series and it should be placed either below the --- line or at the very bottom of all other content, right before your email signature.
Make sure that base commit is in an official maintainer/mainline tree and not in some internal, accessible only to you tree - otherwise it would be worthless.
Tooling #
Many of the technical aspects of this process can be automated using b4, documented at <https://b4.docs.kernel.org/en/latest/>. This can help with things like tracking dependencies, running checkpatch and with formatting and sending mails.
References #
-
Andrew Morton, "The perfect patch" (tpp).
-
Jeff Garzik, "Linux kernel patch submission format".
<https://web.archive.org/web/20180829112450/http://linux.yyz.us/patch-format.html>
-
Greg Kroah-Hartman, "How to piss off a kernel subsystem maintainer".
<http://www.kroah.com/log/linux/maintainer.html>
<http://www.kroah.com/log/linux/maintainer-02.html>
<http://www.kroah.com/log/linux/maintainer-03.html>
<http://www.kroah.com/log/linux/maintainer-04.html>
Kernel Documentation/process/coding-style.rst
-
Linus Torvalds's mail on the canonical patch format:
<https://lore.kernel.org/r/Pine.LNX.4.58.0504071023190.28951@ppc970.osdl.org>
-
Andi Kleen, "On submitting kernel patches"
Some strategies to get difficult or controversial changes in.
Why the "volatile" type class should not be used
Peios Kernel / Kernel development / Development process
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
C programmers have often taken volatile to mean that the variable could be changed outside of the current thread of execution; as a result, they are sometimes tempted to use it in kernel code when shared data structures are being used. In other words, they have been known to treat volatile types as a sort of easy atomic variable, which they are not. The use of volatile in kernel code is almost never correct; this document describes why.
The key point to understand with regard to volatile is that its purpose is to suppress optimization, which is almost never what one really wants to do. In the kernel, one must protect shared data structures against unwanted concurrent access, which is very much a different task. The process of protecting against unwanted concurrency will also avoid almost all optimization-related problems in a more efficient way.
Like volatile, the kernel primitives which make concurrent access to data safe (spinlocks, mutexes, memory barriers, etc.) are designed to prevent unwanted optimization. If they are being used properly, there will be no need to use volatile as well. If volatile is still necessary, there is almost certainly a bug in the code somewhere. In properly-written kernel code, volatile can only serve to slow things down.
Consider a typical block of kernel code:
spin_lock(&the_lock);
do_something_on(&shared_data);
do_something_else_with(&shared_data);
spin_unlock(&the_lock);
If all the code follows the locking rules, the value of shared_data cannot change unexpectedly while the_lock is held. Any other code which might want to play with that data will be waiting on the lock. The spinlock primitives act as memory barriers - they are explicitly written to do so - meaning that data accesses will not be optimized across them. So the compiler might think it knows what will be in shared_data, but the spin_lock() call, since it acts as a memory barrier, will force it to forget anything it knows. There will be no optimization problems with accesses to that data.
If shared_data were declared volatile, the locking would still be necessary. But the compiler would also be prevented from optimizing access to shared_data _within_ the critical section, when we know that nobody else can be working with it. While the lock is held, shared_data is not volatile. When dealing with shared data, proper locking makes volatile unnecessary - and potentially harmful.
The volatile storage class was originally meant for memory-mapped I/O registers. Within the kernel, register accesses, too, should be protected by locks, but one also does not want the compiler "optimizing" register accesses within a critical section. But, within the kernel, I/O memory accesses are always done through accessor functions; accessing I/O memory directly through pointers is frowned upon and does not work on all architectures. Those accessors are written to prevent unwanted optimization, so, once again, volatile is unnecessary.
Another situation where one might be tempted to use volatile is when the processor is busy-waiting on the value of a variable. The right way to perform a busy wait is:
while (my_variable != what_i_want)
cpu_relax();
The cpu_relax() call can lower CPU power consumption or yield to a hyperthreaded twin processor; it also happens to serve as a compiler barrier, so, once again, volatile is unnecessary. Of course, busy- waiting is generally an anti-social act to begin with.
There are still a few rare situations where volatile makes sense in the kernel:
The above-mentioned accessor functions might use volatile on architectures where direct I/O memory access does work. Essentially, each accessor call becomes a little critical section on its own and ensures that the access happens as expected by the programmer.
Inline assembly code which changes memory, but which has no other visible side effects, risks being deleted by GCC. Adding the volatile keyword to asm statements will prevent this removal.
The jiffies variable is special in that it can have a different value every time it is referenced, but it can be read without any special locking. So jiffies can be volatile, but the addition of other variables of this type is strongly frowned upon. Jiffies is considered to be a "stupid legacy" issue (Linus's words) in this regard; fixing it would be more trouble than it is worth.
Pointers to data structures in coherent memory which might be modified by I/O devices can, sometimes, legitimately be volatile. A ring buffer used by a network adapter, where that adapter changes pointers to indicate which descriptors have been processed, is an example of this type of situation.
For most code, none of the above justifications for volatile apply. As a result, the use of volatile is likely to be seen as a bug and will bring additional scrutiny to the code. Developers who are tempted to use volatile should take a step back and think about what they are truly trying to accomplish.
Patches to remove volatile variables are generally welcome - as long as they come with a justification which shows that the concurrency issues have been properly thought through.
References #
[1] https://lwn.net/Articles/233481/
[2] https://lwn.net/Articles/233482/
Credits #
Original impetus and research by Randy Dunlap
Written by Jonathan Corbet
Improvements via comments from Satyam Sharma, Johannes Stezenbach, Jesper Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan Richter.
Debugging advice for Linux Kernel developers
Peios Kernel / Kernel development / Development process / debugging
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
general guides #
- Debugging advice for driver development
- Debugging kernel and modules via gdb
- Using kgdb, kdb and the kernel debugger internals
- Userspace debugging advice
subsystem specific guides #
General debugging advice #
Depending on the issue, a different set of tools is available to track down the problem or even to realize whether there is one in the first place.
As a first step you have to figure out what kind of issue you want to debug. Depending on the answer, your methodology and choice of tools may vary.
Do I need to debug with limited access? #
Do you have limited access to the machine or are you unable to stop the running execution?
In this case your debugging capability depends on built-in debugging support of provided distribution kernel. The Userspace debugging advice provides a brief overview over a range of possible debugging tools in that situation. You can check the capability of your kernel, in most cases, by looking into config file within the /boot directory.
Do I have root access to the system? #
Are you easily able to replace the module in question or to install a new kernel?
In that case your range of available tools is a lot bigger, you can find the tools in the Debugging advice for driver development.
Is timing a factor? #
It is important to understand if the problem you want to debug manifests itself consistently (i.e. given a set of inputs you always get the same, incorrect output), or inconsistently. If it manifests itself inconsistently, some timing factor might be at play. If inserting delays into the code does change the behavior, then quite likely timing is a factor.
When timing does alter the outcome of the code execution using a simple printk() for debugging purposes may not work, a similar alternative is to use trace_printk() , which logs the debug messages to the trace file instead of the kernel log.
Copyright ©2024 : Collabora
Debugging advice for driver development
Peios Kernel / Kernel development / Development process / debugging
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This document serves as a general starting point and lookup for debugging device drivers. While this guide focuses on debugging that requires re-compiling the module/kernel, the userspace debugging guide will guide you through tools like dynamic debug, ftrace and other tools useful for debugging issues and behavior. For general debugging advice, see the general advice document.
The following sections show you the available tools.
printk() & friends #
These are derivatives of printf() with varying destinations and support for being dynamically turned on or off, or lack thereof.
Simple printk() #
The classic, can be used to great effect for quick and dirty development of new modules or to extract arbitrary necessary data for troubleshooting.
Prerequisite: CONFIG_PRINTK (usually enabled by default)
Pros:
-
No need to learn anything, simple to use
-
Easy to modify exactly to your needs (formatting of the data (See: How to get printk format specifiers right), visibility in the log)
-
Can cause delays in the execution of the code (beneficial to confirm whether timing is a factor)
Cons:
-
Requires rebuilding the kernel/module
-
Can cause delays in the execution of the code (which can cause issues to be not reproducible)
For the full documentation see Message logging with printk
Trace_printk #
Prerequisite: CONFIG_DYNAMIC_FTRACE & #include <linux/ftrace.h>
It is a tiny bit less comfortable to use than printk(), because you will have to read the messages from the trace file (See: Reading the ftrace log instead of from the kernel log, but very useful when printk() adds unwanted delays into the code execution, causing issues to be flaky or hidden.)
If the processing of this still causes timing issues then you can try trace_puts().
For the full Documentation see trace_printk()
dev_dbg #
Print statement, which can be targeted by Dynamic debug that contains additional information about the device used within the context.
When is it appropriate to leave a debug print in the code?
Permanent debug statements have to be useful for a developer to troubleshoot driver misbehavior. Judging that is a bit more of an art than a science, but some guidelines are in the Coding style guidelines. In almost all cases the debug statements shouldn't be upstreamed, as a working driver is supposed to be silent.
Custom printk #
Example:
#define core_dbg(fmt, arg...) do { \
if (core_debug) \
printk(KERN_DEBUG pr_fmt("core: " fmt), ## arg); \
} while (0)
When should you do this?
It is better to just use a pr_debug(), which can later be turned on/off with dynamic debug. Additionally, a lot of drivers activate these prints via a variable like core_debug set by a module parameter. However, Module parameters are not recommended anymore.
Ftrace #
Creating a custom Ftrace tracepoint #
A tracepoint adds a hook into your code that will be called and logged when the tracepoint is enabled. This can be used, for example, to trace hitting a conditional branch or to dump the internal state at specific points of the code flow during a debugging session.
Here is a basic description of how to implement new tracepoints.
For the full event tracing documentation see Event Tracing
For the full Ftrace documentation see ftrace - Function Tracer
DebugFS #
Prerequisite: CONFIG_DEBUG_FS` & `#include <linux/debugfs.h>
DebugFS differs from the other approaches of debugging, as it doesn't write messages to the kernel log nor add traces to the code. Instead it allows the developer to handle a set of files. With these files you can either store values of variables or make register/memory dumps or you can make these files writable and modify values/settings in the driver.
Possible use-cases among others:
-
Store register values
-
Keep track of variables
-
Store errors
-
Store settings
-
Toggle a setting like debug on/off
-
Error injection
This is especially useful, when the size of a data dump would be hard to digest as part of the general kernel log (for example when dumping raw bitstream data) or when you are not interested in all the values all the time, but with the possibility to inspect them.
The general idea is:
-
Create a directory during probe (
struct dentry *parent = debugfs_create_dir("my_driver", NULL);) -
Create a file (
debugfs_create_u32("my_value", 444, parent, &my_variable);)-
In this example the file is found in
/sys/kernel/debug/my_driver/my_value(with read permissions for user/group/all) -
any read of the file will return the current contents of the variable
my_variable
-
-
Clean up the directory when removing the device (
debugfs_remove(parent);)
For the full documentation see DebugFS.
KASAN, UBSAN, lockdep and other error checkers #
KASAN (Kernel Address Sanitizer) #
Prerequisite: CONFIG_KASAN
KASAN is a dynamic memory error detector that helps to find use-after-free and out-of-bounds bugs. It uses compile-time instrumentation to check every memory access.
For the full documentation see Kernel Address Sanitizer (KASAN).
UBSAN (Undefined Behavior Sanitizer) #
Prerequisite: CONFIG_UBSAN
UBSAN relies on compiler instrumentation and runtime checks to detect undefined behavior. It is designed to find a variety of issues, including signed integer overflow, array index out of bounds, and more.
For the full documentation see Undefined Behavior Sanitizer - UBSAN
lockdep (Lock Dependency Validator) #
Prerequisite: CONFIG_DEBUG_LOCKDEP
lockdep is a runtime lock dependency validator that detects potential deadlocks and other locking-related issues in the kernel. It tracks lock acquisitions and releases, building a dependency graph that is analyzed for potential deadlocks. lockdep is especially useful for validating the correctness of lock ordering in the kernel.
PSI (Pressure stall information tracking) #
Prerequisite: CONFIG_PSI
PSI is a measurement tool to identify excessive overcommits on hardware resources, that can cause performance disruptions or even OOM kills.
device coredump #
Prerequisite: CONFIG_DEV_COREDUMP & #include <linux/devcoredump.h>
Provides the infrastructure for a driver to provide arbitrary data to userland. It is most often used in conjunction with udev or similar userland application to listen for kernel uevents, which indicate that the dump is ready. Udev has rules to copy that file somewhere for long-term storage and analysis, as by default, the data for the dump is automatically cleaned up after a default 5 minutes. That data is analyzed with driver-specific tools or GDB.
A device coredump can be created with a vmalloc area, with read/free methods, or as a scatter/gather list.
You can find an example implementation at: drivers/media/platform/qcom/venus/core.c, in the Bluetooth HCI layer, in several wireless drivers, and in several DRM drivers.
devcoredump interfaces #
dev_coredumpm() #
void create device coredump with read/free methods
Parameters
struct device *dev: the struct device for the crashed devicestruct module *owner: the module that contains the read/free functions, useTHIS_MODULEvoid *data: data cookie for the read/free functionssize_t datalen: length of the datagfp_t gfp: allocation flagsssize_t (*read)(char *buffer, loff_t offset, size_t count, void *data, size_t datalen): function to read from the given buffervoid (*free)(void *data): function to free the given buffer
Description
Creates a new device coredump for the given device. If a previous one hasn't been read yet, the new coredump is discarded. The data lifetime is determined by the device coredump framework and when it is no longer needed the free function will be called to free the data.
dev_coredumpv() #
void create device coredump with vmalloc data
Parameters
struct device *dev: the struct device for the crashed devicevoid *data: vmalloc data containing the device coredumpsize_t datalen: length of the datagfp_t gfp: allocation flags
Description
This function takes ownership of the vmalloc'ed data and will free
it when it is no longer used. See dev_coredumpm() for more information.
devcd_free_sgtable() #
void free all the memory of the given scatterlist table (i.e. both pages and scatterlist instances)
Parameters
void *data: pointer to sg_table to free
NOTE
if two tables allocated with devcd_alloc_sgtable and then chained using the sg_chain function then that function should be called only once on the chained table
devcd_read_from_sgtable() #
ssize_t copy data from sg_table to a given buffer and return the number of bytes read
Parameters
char *buffer: the buffer to copy the data to itloff_t offset: start copy from offset@ bytes from the head of the data in the given scatterlistsize_t buf_len: the length of the buffervoid *data: the scatterlist table to copy fromsize_t data_len: the length of the data in the sg_table
Return
the number of bytes copied
dev_coredump_put() #
void remove device coredump
Parameters
struct device *dev: the struct device for the crashed device
Description
dev_coredump_put() removes coredump, if exists, for a given device from
the file system and free its associated data otherwise, does nothing.
It is useful for modules that do not want to keep coredump available after its unload.
dev_coredumpm_timeout() #
void create device coredump with read/free methods with a custom timeout.
Parameters
struct device *dev: the struct device for the crashed devicestruct module *owner: the module that contains the read/free functions, useTHIS_MODULEvoid *data: data cookie for the read/free functionssize_t datalen: length of the datagfp_t gfp: allocation flagsssize_t (*read)(char *buffer, loff_t offset, size_t count, void *data, size_t datalen): function to read from the given buffervoid (*free)(void *data): function to free the given bufferunsigned long timeout: time in jiffies to remove coredump
Description
Creates a new device coredump for the given device. If a previous one hasn't been read yet, the new coredump is discarded. The data lifetime is determined by the device coredump framework and when it is no longer needed the free function will be called to free the data.
dev_coredumpsg() #
void create device coredump that uses scatterlist as data parameter
Parameters
struct device *dev: the struct device for the crashed devicestruct scatterlist *table: the dump datasize_t datalen: length of the datagfp_t gfp: allocation flags
Description
Creates a new device coredump for the given device. If a previous one hasn't been read yet, the new coredump is discarded. The data lifetime is determined by the device coredump framework and when it is no longer needed it will free the data.
Copyright ©2024 : Collabora
Debugging kernel and modules via gdb
Peios Kernel / Kernel development / Development process / debugging
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
The kernel debugger kgdb, hypervisors like QEMU or JTAG-based hardware interfaces allow to debug the Linux kernel and its modules during runtime using gdb. Gdb comes with a powerful scripting interface for python. The kernel provides a collection of helper scripts that can simplify typical kernel debugging steps. This is a short tutorial about how to enable and use them. It focuses on QEMU/KVM virtual machines as target, but the examples can be transferred to the other gdb stubs as well.
Requirements #
- gdb 7.2+ (recommended: 7.4+) with python support enabled (typically true for distributions)
Setup #
-
Create a virtual Linux machine for QEMU/KVM (see www.linux-kvm.org and www.qemu.org for more details). For cross-development, https://landley.net/aboriginal/bin keeps a pool of machine images and toolchains that can be helpful to start from.
-
Build the kernel with CONFIG_GDB_SCRIPTS enabled, but leave CONFIG_DEBUG_INFO_REDUCED off. If your architecture supports CONFIG_FRAME_POINTER, keep it enabled.
-
Install that kernel on the guest, turn off KASLR if necessary by adding "nokaslr" to the kernel command line. 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. In this case, you should build the kernel with CONFIG_RANDOMIZE_BASE disabled if the architecture supports KASLR.
-
Build the gdb scripts (required on kernels v5.1 and above):
make scripts_gdb -
Enable the gdb stub of QEMU/KVM, either
- at VM startup time by appending "-s" to the QEMU command line
or
- during runtime by issuing "gdbserver" from the QEMU monitor console
-
cd /path/to/linux-build
-
Start gdb: gdb vmlinux
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:
add-auto-load-safe-path /path/to/linux-buildto ~/.gdbinit. See gdb help for more details.
-
Attach to the booted guest:
(gdb) target remote :1234
Examples of using the Linux-provided gdb helpers #
-
Load module (and main kernel) symbols:
(gdb) lx-symbols loading vmlinux scanning for modules in /home/user/linux/build loading @0xffffffffa0020000: /home/user/linux/build/net/netfilter/xt_tcpudp.ko loading @0xffffffffa0016000: /home/user/linux/build/net/netfilter/xt_pkttype.ko loading @0xffffffffa0002000: /home/user/linux/build/net/netfilter/xt_limit.ko loading @0xffffffffa00ca000: /home/user/linux/build/net/packet/af_packet.ko loading @0xffffffffa003c000: /home/user/linux/build/fs/fuse/fuse.ko ... loading @0xffffffffa0000000: /home/user/linux/build/drivers/ata/ata_generic.ko -
Set a breakpoint on some not yet loaded module function, e.g.:
(gdb) b btrfs_init_sysfs Function "btrfs_init_sysfs" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (btrfs_init_sysfs) pending. -
Continue the target:
(gdb) c -
Load the module on the target and watch the symbols being loaded as well as the breakpoint hit:
loading @0xffffffffa0034000: /home/user/linux/build/lib/libcrc32c.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 @0xffffffffa01b1000: /home/user/linux/build/fs/btrfs/btrfs.ko 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); -
Dump the log buffer of the target kernel:
(gdb) lx-dmesg [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 3.8.0-rc4-dbg+ (... [ 0.000000] Command line: root=/dev/sda2 resume=/dev/sda1 vga=0x314 [ 0.000000] e820: BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved .... -
Examine fields of the current task struct(supported by x86 and arm64 only):
(gdb) p $lx_current().pid $1 = 4998 (gdb) p $lx_current().comm $2 = "modprobe\000\000\000\000\000\000\000" -
Make use of the per-cpu function for the current or a specified CPU:
(gdb) p $lx_per_cpu(runqueues).nr_running $3 = 1 (gdb) p $lx_per_cpu(runqueues, 2).nr_running $4 = 0 -
Dig into hrtimers using the container_of helper:
(gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost (gdb) p *$container_of($leftmost, "struct hrtimer", "node") $5 = { node = { node = { __rb_parent_color = 18446612686384860673, rb_right = 0xffff888231da8b00, rb_left = 0x0 }, expires = 1228461000000 }, _softexpires = 1228461000000, function = 0xffffffff8137ab20 <tick_nohz_handler>, base = 0xffff888231d9b4c0, state = 1 '\001', is_rel = 0 '\000', is_soft = 0 '\000', is_hard = 1 '\001' }
List of commands and functions #
The number of commands and convenience functions may evolve over the time, this is just a snapshot of the initial version:
(gdb) apropos lx
function lx_current -- Return current task
function lx_module -- Find module by name and return the module variable
function lx_per_cpu -- Return per-cpu variable
function lx_task_by_pid -- Find Linux task by PID and return the task_struct variable
function lx_thread_info -- Calculate Linux thread_info from task variable
lx-dmesg -- Print Linux kernel log buffer
lx-lsmod -- List currently loaded modules
lx-symbols -- (Re-)load symbols of Linux kernel and currently loaded modules
Detailed help can be obtained via "help <command-name>" for commands and "help function <function-name>" for convenience functions.
Using kgdb, kdb and the kernel debugger internals
Peios Kernel / Kernel development / Development process / debugging
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
Author: Jason Wessel
Introduction #
The kernel has two different debugger front ends (kdb and kgdb) which interface to the debug core. It is possible to use either of the debugger front ends and dynamically transition between them if you configure the kernel properly at compile and runtime.
Kdb is simplistic shell-style interface which you can use on a system console with a keyboard or serial console. You can use it to inspect memory, registers, process lists, dmesg, and even set breakpoints to stop in a certain location. Kdb is not a source level debugger, although you can set breakpoints and execute some basic kernel run control. Kdb is mainly aimed at doing some analysis to aid in development or diagnosing kernel problems. You can access some symbols by name in kernel built-ins or in kernel modules if the code was built with CONFIG_KALLSYMS.
Kgdb is intended to be used as a source level debugger for the Linux kernel. It is used along with gdb to debug a Linux kernel. The expectation is that gdb can be used to "break in" to the kernel to inspect memory, variables and look through call stack information similar to the way an application developer would use gdb to debug an application. It is possible to place breakpoints in kernel code and perform some limited execution stepping.
Two machines are required for using kgdb. One of these machines is a development machine and the other is the target machine. The kernel to be debugged runs on the target machine. The development machine runs an instance of gdb against the vmlinux file which contains the symbols (not a boot image such as bzImage, zImage, uImage...). In gdb the developer specifies the connection parameters and connects to kgdb. The type of connection a developer makes with gdb depends on the availability of kgdb I/O modules compiled as built-ins or loadable kernel modules in the test machine's kernel.
Compiling a kernel #
-
In order to enable compilation of kdb, you must first enable kgdb.
-
The kgdb test compile options are described in the kgdb test suite chapter.
Kernel config options for kgdb #
To enable CONFIG_KGDB you should look under Kernel hacking --> Kernel debugging and select KGDB: kernel debugger.
While it is not a hard requirement that you have symbols in your vmlinux file, gdb tends not to be very useful without the symbolic data, so you will want to turn on CONFIG_DEBUG_INFO which is called Compile the kernel with debug info in the config menu.
It is advised, but not required, that you turn on the CONFIG_FRAME_POINTER kernel option which is called Compile the kernel with frame pointers in the config menu. This option inserts code into the compiled executable which saves the frame information in registers or on the stack at different points which allows a debugger such as gdb to more accurately construct stack back traces while debugging the kernel.
If the architecture that you are using supports the kernel option CONFIG_STRICT_KERNEL_RWX, you should consider turning it off. This option will prevent the use of software breakpoints because it marks certain regions of the kernel's memory space as read-only. If kgdb supports it for the architecture you are using, you can use hardware breakpoints if you desire to run with the CONFIG_STRICT_KERNEL_RWX option turned on, else you need to turn off this option.
Next you should choose one or more I/O drivers to interconnect the debugging host and debugged target. Early boot debugging requires a KGDB I/O driver that supports early debugging and the driver must be built into the kernel directly. Kgdb I/O driver configuration takes place via kernel or module parameters which you can learn more about in the section that describes the parameter kgdboc.
Here is an example set of .config symbols to enable or disable for kgdb:
# CONFIG_STRICT_KERNEL_RWX is not set
CONFIG_FRAME_POINTER=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
Kernel config options for kdb #
Kdb is quite a bit more complex than the simple gdbstub sitting on top of the kernel's debug core. Kdb must implement a shell, and also adds some helper functions in other parts of the kernel, responsible for printing out interesting data such as what you would see if you ran lsmod, or ps. In order to build kdb into the kernel you follow the same steps as you would for kgdb.
The main config option for kdb is CONFIG_KGDB_KDB which is called KGDB_KDB: include kdb frontend for kgdb in the config menu. In theory you would have already also selected an I/O driver such as the CONFIG_KGDB_SERIAL_CONSOLE interface if you plan on using kdb on a serial port, when you were configuring kgdb.
If you want to use a PS/2-style keyboard with kdb, you would select CONFIG_KDB_KEYBOARD which is called KGDB_KDB: keyboard as input device in the config menu. The CONFIG_KDB_KEYBOARD option is not used for anything in the gdb interface to kgdb. The CONFIG_KDB_KEYBOARD option only works with kdb.
Here is an example set of .config symbols to enable/disable kdb:
# CONFIG_STRICT_KERNEL_RWX is not set
CONFIG_FRAME_POINTER=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_KGDB_KDB=y
CONFIG_KDB_KEYBOARD=y
Kernel Debugger Boot Arguments #
This section describes the various runtime kernel parameters that affect the configuration of the kernel debugger. The following chapter covers using kdb and kgdb as well as providing some examples of the configuration parameters.
Kernel parameter: kgdboc #
The kgdboc driver was originally an abbreviation meant to stand for "kgdb over console". Today it is the primary mechanism to configure how to communicate from gdb to kgdb as well as the devices you want to use to interact with the kdb shell.
For kgdb/gdb, kgdboc is designed to work with a single serial port. It is intended to cover the circumstance where you want to use a serial console as your primary console as well as using it to perform kernel debugging. It is also possible to use kgdb on a serial port which is not designated as a system console. Kgdboc may be configured as a kernel built-in or a kernel loadable module. You can only make use of kgdbwait and early debugging if you build kgdboc into the kernel as a built-in.
Optionally you can elect to activate kms (Kernel Mode Setting) integration. When you use kms with kgdboc and you have a video driver that has atomic mode setting hooks, it is possible to enter the debugger on the graphics console. When the kernel execution is resumed, the previous graphics mode will be restored. This integration can serve as a useful tool to aid in diagnosing crashes or doing analysis of memory with kdb while allowing the full graphics console applications to run.
kgdboc arguments #
Usage:
kgdboc=[kms][[,]kbd][[,]serial_device][,baud]
The order listed above must be observed if you use any of the optional configurations together.
Abbreviations:
-
kms = Kernel Mode Setting
-
kbd = Keyboard
You can configure kgdboc to use the keyboard, and/or a serial device depending on if you are using kdb and/or kgdb, in one of the following scenarios. The order listed above must be observed if you use any of the optional configurations together. Using kms + only gdb is generally not a useful combination.
Using loadable module or built-in #
-
As a kernel built-in:
Use the kernel boot argument:
kgdboc=<tty-device>,[baud] -
As a kernel loadable module:
Use the command:
modprobe kgdboc kgdboc=<tty-device>,[baud]Here are two examples of how you might format the kgdboc string. The first is for an x86 target using the first serial port. The second example is for the ARM Versatile AB using the second serial port.
-
kgdboc=ttyS0,115200 -
kgdboc=ttyAMA1,115200
-
Configure kgdboc at runtime with sysfs #
At run time you can enable or disable kgdboc by writing parameters into sysfs. Here are two examples:
-
Enable kgdboc on ttyS0:
echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc -
Disable kgdboc:
echo "" > /sys/module/kgdboc/parameters/kgdboc
More examples #
You can configure kgdboc to use the keyboard, and/or a serial device depending on if you are using kdb and/or kgdb, in one of the following scenarios.
-
kdb and kgdb over only a serial port:
kgdboc=<serial_device>[,baud]Example:
kgdboc=ttyS0,115200 -
kdb and kgdb with keyboard and a serial port:
kgdboc=kbd,<serial_device>[,baud]Example:
kgdboc=kbd,ttyS0,115200 -
kdb with a keyboard:
kgdboc=kbd -
kdb with kernel mode setting:
kgdboc=kms,kbd -
kdb with kernel mode setting and kgdb over a serial port:
kgdboc=kms,kbd,ttyS0,115200
When using kgdboc with no debugger proxy, you can end up connecting the debugger at one of two entry points. If an exception occurs after you have loaded kgdboc, a message should print on the console stating it is waiting for the debugger. In this case you disconnect your terminal program and then connect the debugger in its place. If you want to interrupt the target system and forcibly enter a debug session you have to issue a Sysrq sequence and then type the letter g. Then you disconnect the terminal session and connect gdb. Your options if you don't like this are to hack gdb to send the SysRq-G for you as well as on the initial connect, or to use a debugger proxy that allows an unmodified gdb to do the debugging.
Kernel parameter: kgdboc_earlycon #
If you specify the kernel parameter kgdboc_earlycon and your serial driver registers a boot console that supports polling (doesn't need interrupts and implements a nonblocking read() function) kgdb will attempt to work using the boot console until it can transition to the regular tty driver specified by the kgdboc parameter.
Normally there is only one boot console (especially that implements the read() function) so just adding kgdboc_earlycon on its own is sufficient to make this work. If you have more than one boot console you can add the boot console's name to differentiate. Note that names that are registered through the boot console layer and the tty layer are not the same for the same port.
For instance, on one board to be explicit you might do:
kgdboc_earlycon=qcom_geni kgdboc=ttyMSM0
If the only boot console on the device was "qcom_geni", you could simplify:
kgdboc_earlycon kgdboc=ttyMSM0
Kernel parameter: kgdbwait #
The Kernel command line option kgdbwait makes kgdb wait for a debugger connection during booting of a kernel. You can only use this option if you compiled a kgdb I/O driver into the kernel and you specified the I/O driver configuration as a kernel command line option. The kgdbwait parameter should always follow the configuration parameter for the kgdb I/O driver in the kernel command line else the I/O driver will not be configured prior to asking the kernel to use it to wait.
The kernel will stop and wait as early as the I/O driver and architecture allows when you use this option. If you build the kgdb I/O driver as a loadable kernel module kgdbwait will not do anything.
Kernel parameter: kgdbcon #
The kgdbcon feature allows you to see printk() messages inside gdb while gdb is connected to the kernel. Kdb does not make use of the kgdbcon feature.
Kgdb supports using the gdb serial protocol to send console messages to the debugger when the debugger is connected and running. There are two ways to activate this feature.
-
Activate with the kernel command line option:
kgdbcon -
Use sysfs before configuring an I/O driver:
echo 1 > /sys/module/debug_core/parameters/kgdb_use_con
It is possible to use this option with kgdboc on a tty that is not a system console.
Run time parameter: kgdbreboot #
The kgdbreboot feature allows you to change how the debugger deals with the reboot notification. You have 3 choices for the behavior. The default behavior is always set to 0.
|
1 |
|
Ignore the reboot notification entirely. |
|
2 |
|
Send the detach message to any attached debugger client. |
|
3 |
|
Enter the debugger on reboot notify. |
Kernel parameter: nokaslr #
If the architecture that you are using enables KASLR by default, you should consider turning it off. KASLR randomizes the virtual address where the kernel image is mapped and confuses gdb which resolves addresses of kernel symbols from the symbol table of vmlinux.
Kernel parameter: rodata #
CONFIG_STRICT_KERNEL_RWX is turned on by default and is not visible to menuconfig on some architectures (arm64 for example), you can pass rodata=off to the kernel in this case.
Using kdb #
Quick start for kdb on a serial port #
This is a quick example of how to use kdb.
-
Configure kgdboc at boot using kernel parameters:
console=ttyS0,115200 kgdboc=ttyS0,115200 nokaslrOR
Configure kgdboc after the kernel has booted; assuming you are using a serial port console:
echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc -
Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the
SysRq-G, which means you must have enabledCONFIG_MAGIC_SYSRQ=yin your kernel config.-
When logged in as root or with a super user session you can run:
echo g > /proc/sysrq-trigger -
Example using minicom 2.2
Press:
CTRL-Afg -
When you have telneted to a terminal server that supports sending a remote break
Press:
CTRL-]Type in:
send breakPress:
Enterg
-
-
From the kdb prompt you can run the
helpcommand to see a complete list of the commands that are available.Some useful commands in kdb include:
lsmodShows where kernel modules are loaded
psDisplays only the active processes
ps AShows all the processes
summaryShows kernel version info and memory usage
btGet a backtrace of the current process using dump_stack()
dmesgView the kernel syslog buffer
goContinue the system
-
When you are done using kdb you need to consider rebooting the system or using the
gocommand to resuming normal kernel execution. If you have paused the kernel for a lengthy period of time, applications that rely on timely networking or anything to do with real wall clock time could be adversely affected, so you should take this into consideration when using the kernel debugger.
Quick start for kdb using a keyboard connected console #
This is a quick example of how to use kdb with a keyboard.
-
Configure kgdboc at boot using kernel parameters:
kgdboc=kbdOR
Configure kgdboc after the kernel has booted:
echo kbd > /sys/module/kgdboc/parameters/kgdboc -
Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the
SysRq-G, which means you must have enabledCONFIG_MAGIC_SYSRQ=yin your kernel config.-
When logged in as root or with a super user session you can run:
echo g > /proc/sysrq-trigger -
Example using a laptop keyboard:
Press and hold down:
AltPress and hold down:
FnPress and release the key with the label:
SysRqRelease:
FnPress and release:
gRelease:
Alt -
Example using a PS/2 101-key keyboard
Press and hold down:
AltPress and release the key with the label:
SysRqPress and release:
gRelease:
Alt
-
-
Now type in a kdb command such as
help,dmesg,btorgoto continue kernel execution.
Using kgdb / gdb #
In order to use kgdb you must activate it by passing configuration information to one of the kgdb I/O drivers. If you do not pass any configuration information kgdb will not do anything at all. Kgdb will only actively hook up to the kernel trap hooks if a kgdb I/O driver is loaded and configured. If you unconfigure a kgdb I/O driver, kgdb will unregister all the kernel hook points.
All kgdb I/O drivers can be reconfigured at run time, if CONFIG_SYSFS and CONFIG_MODULES are enabled, by echo'ing a new config string to /sys/module/<driver>/parameter/<option>. The driver can be unconfigured by passing an empty string. You cannot change the configuration while the debugger is attached. Make sure to detach the debugger with the detach command prior to trying to unconfigure a kgdb I/O driver.
Connecting with gdb to a serial port #
-
Configure kgdboc
Configure kgdboc at boot using kernel parameters:
kgdboc=ttyS0,115200OR
Configure kgdboc after the kernel has booted:
echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc -
Stop kernel execution (break into the debugger)
In order to connect to gdb via kgdboc, the kernel must first be stopped. There are several ways to stop the kernel which include using kgdbwait as a boot argument, via a
SysRq-G, or running the kernel until it takes an exception where it waits for the debugger to attach.-
When logged in as root or with a super user session you can run:
echo g > /proc/sysrq-trigger -
Example using minicom 2.2
Press:
CTRL-Afg -
When you have telneted to a terminal server that supports sending a remote break
Press:
CTRL-]Type in:
send breakPress:
Enterg
-
-
Connect from gdb
Example (using a directly connected port):
% gdb ./vmlinux (gdb) set serial baud 115200 (gdb) target remote /dev/ttyS0Example (kgdb to a terminal server on TCP port 2012):
% gdb ./vmlinux (gdb) target remote 192.168.2.2:2012Once connected, you can debug a kernel the way you would debug an application program.
If you are having problems connecting or something is going seriously wrong while debugging, it will most often be the case that you want to enable gdb to be verbose about its target communications. You do this prior to issuing the
target remotecommand by typing in:set debug remote 1
Remember if you continue in gdb, and need to "break in" again, you need to issue an other SysRq-G. It is easy to create a simple entry point by putting a breakpoint at sys_sync and then you can run sync from a shell or script to break into the debugger.
kgdb and kdb interoperability #
It is possible to transition between kdb and kgdb dynamically. The debug core will remember which you used the last time and automatically start in the same mode.
Switching between kdb and kgdb #
Switching from kgdb to kdb #
There are two ways to switch from kgdb to kdb: you can use gdb to issue a maintenance packet, or you can blindly type the command $3#33. Whenever the kernel debugger stops in kgdb mode it will print the message KGDB or $3#33 for KDB. It is important to note that you have to type the sequence correctly in one pass. You cannot type a backspace or delete because kgdb will interpret that as part of the debug stream.
-
Change from kgdb to kdb by blindly typing:
$3#33 -
Change from kgdb to kdb with gdb:
maintenance packet 3
Change from kdb to kgdb #
There are two ways you can change from kdb to kgdb. You can manually enter kgdb mode by issuing the kgdb command from the kdb shell prompt, or you can connect gdb while the kdb shell prompt is active. The kdb shell looks for the typical first commands that gdb would issue with the gdb remote protocol and if it sees one of those commands it automatically changes into kgdb mode.
-
From kdb issue the command:
kgdb -
At the kdb prompt, disconnect the terminal program and connect gdb in its place.
Running kdb commands from gdb #
It is possible to run a limited set of kdb commands from gdb, using the gdb monitor command. You don't want to execute any of the run control or breakpoint operations, because it can disrupt the state of the kernel debugger. You should be using gdb for breakpoints and run control operations if you have gdb connected. The more useful commands to run are things like lsmod, dmesg, ps or possibly some of the memory information commands. To see all the kdb commands you can run monitor help.
Example:
(gdb) monitor ps
1 idle process (state I) and
27 sleeping system daemon (state M) processes suppressed,
use 'ps A' to see all.
Task Addr Pid Parent [*] cpu State Thread Command
0xc78291d0 1 0 0 0 S 0xc7829404 init
0xc7954150 942 1 0 0 S 0xc7954384 dropbear
0xc78789c0 944 1 0 0 S 0xc7878bf4 sh
(gdb)
kgdb Test Suite #
When kgdb is enabled in the kernel config you can also elect to enable the config parameter KGDB_TESTS. Turning this on will enable a special kgdb I/O module which is designed to test the kgdb internal functions.
The kgdb tests are mainly intended for developers to test the kgdb internals as well as a tool for developing a new kgdb architecture specific implementation. These tests are not really for end users of the Linux kernel. The primary source of documentation would be to look in the drivers/misc/kgdbts.c file.
The kgdb test suite can also be configured at compile time to run the core set of tests by setting the kernel config parameter KGDB_TESTS_ON_BOOT. This particular option is aimed at automated regression testing and does not require modifying the kernel boot config arguments. If this is turned on, the kgdb test suite can be disabled by specifying kgdbts= as a kernel boot argument.
Kernel Debugger Internals #
Architecture Specifics #
The kernel debugger is organized into a number of components:
-
The debug core
The debug core is found in
kernel/debugger/debug_core.c. It contains:-
A generic OS exception handler which includes sync'ing the processors into a stopped state on an multi-CPU system.
-
The API to talk to the kgdb I/O drivers
-
The API to make calls to the arch-specific kgdb implementation
-
The logic to perform safe memory reads and writes to memory while using the debugger
-
A full implementation for software breakpoints unless overridden by the arch
-
The API to invoke either the kdb or kgdb frontend to the debug core.
-
The structures and callback API for atomic kernel mode setting.
-
-
kgdb arch-specific implementation
This implementation is generally found in
arch/*/kernel/kgdb.c. As an example,arch/x86/kernel/kgdb.ccontains the specifics to implement HW breakpoint as well as the initialization to dynamically register and unregister for the trap handlers on this architecture. The arch-specific portion implements:-
contains an arch-specific trap catcher which invokes kgdb_handle_exception() to start kgdb about doing its work
-
translation to and from gdb specific packet format to struct pt_regs
-
Registration and unregistration of architecture specific trap hooks
-
Any special exception handling and cleanup
-
NMI exception handling and cleanup
-
(optional) HW breakpoints
-
-
gdbstub frontend (aka kgdb)
The gdbstub is located in
kernel/debug/gdbstub.c. It contains:- All the logic to implement the gdb serial protocol
-
kdb frontend
The kdb debugger shell is broken down into a number of components. The kdb core is located in kernel/debug/kdb. There are a number of helper functions in some of the other kernel components to make it possible for kdb to examine and report information about the kernel without taking locks that could cause a kernel deadlock. The kdb core implements the following functionality.
-
A simple shell
-
The kdb core command set
-
A registration API to register additional kdb shell commands.
-
A good example of a self-contained kdb module is the
ftdumpcommand for dumping the ftrace buffer. See:kernel/trace/trace_kdb.c -
For an example of how to dynamically register a new kdb command you can build the kdb_hello.ko kernel module from
samples/kdb/kdb_hello.c. To build this example you can setCONFIG_SAMPLES=yandCONFIG_SAMPLE_KDB=min your kernel config. Later runmodprobe kdb_helloand the next time you enter the kdb shell, you can run thehellocommand.
-
-
The implementation for kdb_printf() which emits messages directly to I/O drivers, bypassing the kernel log.
-
SW / HW breakpoint management for the kdb shell
-
-
kgdb I/O driver
Each kgdb I/O driver has to provide an implementation for the following:
-
configuration via built-in or module
-
dynamic configuration and kgdb hook registration calls
-
read and write character interface
-
A cleanup handler for unconfiguring from the kgdb core
-
(optional) Early debug methodology
Any given kgdb I/O driver has to operate very closely with the hardware and must do it in such a way that does not enable interrupts or change other parts of the system context without completely restoring them. The kgdb core will repeatedly "poll" a kgdb I/O driver for characters when it needs input. The I/O driver is expected to return immediately if there is no data available. Doing so allows for the future possibility to touch watchdog hardware in such a way as to have a target system not reset when these are enabled.
-
If you are intent on adding kgdb architecture specific support for a new architecture, the architecture should define HAVE_ARCH_KGDB in the architecture specific Kconfig file. This will enable kgdb for the architecture, and at that point you must create an architecture specific kgdb implementation.
There are a few flags which must be set on every architecture in their asm/kgdb.h file. These are:
-
-
NUMREGBYTES:The size in bytes of all of the registers, so that we can ensure they will all fit into a packet.
-
-
-
BUFMAX:The size in bytes of the buffer GDB will read into. This must be larger than NUMREGBYTES.
-
-
-
CACHE_FLUSH_IS_SAFE:Set to 1 if it is always safe to call flush_cache_range or flush_icache_range. On some architectures, these functions may not be safe to call on SMP since we keep other CPUs in a holding pattern.
-
There are also the following functions for the common backend, found in kernel/kgdb.c, that must be supplied by the architecture-specific backend unless marked as (optional), in which case a default function maybe used if the architecture does not need to provide a specific implementation.
kgdb_skipexception() #
int (optional) exit kgdb_handle_exception early
Parameters
int exception: Exception vector numberstruct pt_regs *regs: Currentstruct pt_regs.
Description
On some architectures it is required to skip a breakpoint exception when it occurs after a breakpoint has been removed. This can be implemented in the architecture specific portion of kgdb.
kgdb_breakpoint() #
void compiled in breakpoint
Parameters
void: no arguments
Description
This will be implemented as a static inline per architecture. This function is called by the kgdb core to execute an architecture specific trap to cause kgdb to enter the exception processing.
kgdb_arch_init() #
int Perform any architecture specific initialization.
Parameters
void: no arguments
Description
This function will handle the initialization of any architecture specific callbacks.
kgdb_arch_exit() #
void Perform any architecture specific uninitalization.
Parameters
void: no arguments
Description
This function will handle the uninitalization of any architecture specific callbacks, for dynamic registration and unregistration.
pt_regs_to_gdb_regs() #
void Convert ptrace regs to GDB regs
Parameters
unsigned long *gdb_regs: A pointer to hold the registers in the order GDB wants.struct pt_regs *regs: Thestruct pt_regsof the current process.
Description
Convert the pt_regs in regs into the format for registers that GDB expects, stored in gdb_regs.
sleeping_thread_to_gdb_regs() #
void Convert ptrace regs to GDB regs
Parameters
unsigned long *gdb_regs: A pointer to hold the registers in the order GDB wants.struct task_struct *p: Thestruct task_structof the desired process.
Description
Convert the register values of the sleeping process in p to
the format that GDB expects.
This function is called when kgdb does not have access to the
struct pt_regs and therefore it should fill the gdb registers
gdb_regs with what has been saved in struct thread_struct
thread field during switch_to.
gdb_regs_to_pt_regs() #
void Convert GDB regs to ptrace regs.
Parameters
unsigned long *gdb_regs: A pointer to hold the registers we've received from GDB.struct pt_regs *regs: A pointer to astruct pt_regsto hold these values in.
Description
Convert the GDB regs in gdb_regs into the pt_regs, and store them in regs.
kgdb_arch_handle_exception() #
int Handle architecture specific GDB packets.
Parameters
int vector: The error vector of the exception that happened.int signo: The signal number of the exception that happened.int err_code: The error code of the exception that happened.char *remcom_in_buffer: The buffer of the packet we have read.char *remcom_out_buffer: The buffer ofBUFMAXbytes to write a packet into.struct pt_regs *regs: Thestruct pt_regsof the current process.
Description
This function MUST handle the 'c' and 's' command packets,
as well packets to set / remove a hardware breakpoint, if used.
If there are additional packets which the hardware needs to handle,
they are handled here. The code should return -1 if it wants to
process more packets, and a 0 or 1 if it wants to exit from the
kgdb callback.
kgdb_arch_handle_qxfer_pkt() #
void Handle architecture specific GDB XML packets.
Parameters
char *remcom_in_buffer: The buffer of the packet we have read.char *remcom_out_buffer: The buffer ofBUFMAXbytes to write a packet into.
kgdb_call_nmi_hook() #
void Call kgdb_nmicallback() on the current CPU
Parameters
void *ignored: This parameter is only here to match the prototype.
Description
If you're using the default implementation of kgdb_roundup_cpus()
this function will be called per CPU. If you don't implement
kgdb_call_nmi_hook() a default will be used.
kgdb_roundup_cpus() #
void Get other CPUs into a holding pattern
Parameters
void: no arguments
Description
On SMP systems, we need to get the attention of the other CPUs
and get them into a known state. This should do what is needed
to get the other CPUs to call kgdb_wait(). Note that on some arches,
the NMI approach is not used for rounding up all the CPUs. Normally
those architectures can just not implement this and get the default.
On non-SMP systems, this is not called.
kgdb_arch_set_pc() #
void Generic call back to the program counter
Parameters
struct pt_regs *regs: Currentstruct pt_regs.unsigned long pc: The new value for the program counter
Description
This function handles updating the program counter and requires an architecture specific implementation.
kgdb_arch_late() #
void Perform any architecture specific initialization.
Parameters
void: no arguments
Description
This function will handle the late initialization of any architecture specific callbacks. This is an optional function for handling things like late initialization of hw breakpoints. The default implementation does nothing.
struct kgdb_arch #
Describe architecture specific values.
Definition
;
Members
gdb_bpt_instr: The instruction to trigger a breakpoint.flags: Flags for the breakpoint, currently justKGDB_HW_BREAKPOINT.set_breakpoint: Allow an architecture to specify how to set a software breakpoint.remove_breakpoint: Allow an architecture to specify how to remove a software breakpoint.set_hw_breakpoint: Allow an architecture to specify how to set a hardware breakpoint.remove_hw_breakpoint: Allow an architecture to specify how to remove a hardware breakpoint.disable_hw_break: Allow an architecture to specify how to disable hardware breakpoints for a single cpu.remove_all_hw_break: Allow an architecture to specify how to remove all hardware breakpoints.correct_hw_break: Allow an architecture to specify how to correct the hardware debug registers.
struct kgdb_io #
Describe the interface for an I/O driver to talk with KGDB.
Definition
;
Members
name: Name of the I/O driver.read_char: Pointer to a function that will return one char.write_char: Pointer to a function that will write one char.flush: Pointer to a function that will flush any pending writes.init: Pointer to a function that will initialize the device.deinit: Pointer to a function that will deinit the device. Implies that this I/O driver is temporary and expects to be replaced. Called when an I/O driver is replaced or explicitly unregistered.pre_exception: Pointer to a function that will do any prep work for the I/O driver.post_exception: Pointer to a function that will do any cleanup work for the I/O driver.cons: valid if the I/O device is a console; else NULL.
kgdboc internals #
kgdboc and uarts #
The kgdboc driver is actually a very thin driver that relies on the underlying low level to the hardware driver having "polling hooks" to which the tty driver is attached. In the initial implementation of kgdboc the serial_core was changed to expose a low level UART hook for doing polled mode reading and writing of a single character while in an atomic context. When kgdb makes an I/O request to the debugger, kgdboc invokes a callback in the serial core which in turn uses the callback in the UART driver.
When using kgdboc with a UART, the UART driver must implement two callbacks in the struct uart_ops. Example from drivers/8250.c:
#ifdef CONFIG_CONSOLE_POLL
.poll_get_char = serial8250_get_poll_char,
.poll_put_char = serial8250_put_poll_char,
#endif
Any implementation specifics around creating a polling driver use the #ifdef CONFIG_CONSOLE_POLL, as shown above. Keep in mind that polling hooks have to be implemented in such a way that they can be called from an atomic context and have to restore the state of the UART chip on return such that the system can return to normal when the debugger detaches. You need to be very careful with any kind of lock you consider, because failing here is most likely going to mean pressing the reset button.
kgdboc and keyboards #
The kgdboc driver contains logic to configure communications with an attached keyboard. The keyboard infrastructure is only compiled into the kernel when CONFIG_KDB_KEYBOARD=y is set in the kernel configuration.
The core polled keyboard driver for PS/2 type keyboards is in drivers/char/kdb_keyboard.c. This driver is hooked into the debug core when kgdboc populates the callback in the array called kdb_poll_funcs[]. The kdb_get_kbd_char() is the top-level function which polls hardware for single character input.
kgdboc and kms #
The kgdboc driver contains logic to request the graphics display to switch to a text context when you are using kgdboc=kms,kbd, provided that you have a video driver which has a frame buffer console and atomic kernel mode setting support.
Every time the kernel debugger is entered it calls kgdboc_pre_exp_handler() which in turn calls con_debug_enter() in the virtual console layer. On resuming kernel execution, the kernel debugger calls kgdboc_post_exp_handler() which in turn calls con_debug_leave().
Credits #
The following people have contributed to this document:
-
Amit Kale <amitkale@linsyssoft.com>
-
Tom Rini <trini@kernel.crashing.org>
In March 2008 this document was completely rewritten by:
- Jason Wessel <jason.wessel@windriver.com>
In Jan 2010 this document was updated to include kdb.
- Jason Wessel <jason.wessel@windriver.com>
Debugging and tracing in the media subsystem
Peios Kernel / Kernel development / Development process / debugging
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This document serves as a starting point and lookup for debugging device drivers in the media subsystem and to debug these drivers from userspace.
General debugging advice #
For general advice see the general advice document.
The following sections show you some of the available tools.
dev_debug module parameter #
Every video device provides a dev_debug parameter, which allows to get further insights into the IOCTLs in the background.:
# cat /sys/class/video4linux/video3/name
rkvdec
# echo 0xff > /sys/class/video4linux/video3/dev_debug
# dmesg -wH
[...] videodev: v4l2_open: video3: open (0)
[ +0.000036] video3: VIDIOC_QUERYCAP: driver=rkvdec, card=rkvdec,
bus=platform:rkvdec, version=0x00060900, capabilities=0x84204000,
device_caps=0x04204000
For the full documentation see video device debugging
dev_dbg() / v4l2_dbg() #
Two debug print statements, which are specific for devices and for the v4l2 subsystem, avoid adding these to your final submission unless they have long-term value for investigations.
For a general overview please see the printk() & friends guide.
-
Difference between both?
-
v4l2_dbg() utilizes v4l2_printk() under the hood, which further uses printk() directly, thus it cannot be targeted by dynamic debug
-
dev_dbg() can be targeted by dynamic debug
-
v4l2_dbg() has a more specific prefix format for the media subsystem, while dev_dbg only highlights the driver name and the location of the log
-
Dynamic debug #
A method to trim down the debug output to your needs.
For general advice see the Dynamic debug guide.
Here is one example, that enables all available pr_debug()'s within the file:
$ alias ddcmd='echo $* > /proc/dynamic_debug/control'
$ ddcmd '-p; file v4l2-h264.c +p'
$ grep =p /proc/dynamic_debug/control
drivers/media/v4l2-core/v4l2-h264.c:372 [v4l2_h264]print_ref_list_b =p
"ref_pic_list_b%u (cur_poc %u%c) %s"
drivers/media/v4l2-core/v4l2-h264.c:333 [v4l2_h264]print_ref_list_p =p
"ref_pic_list_p (cur_poc %u%c) %s\n"
Ftrace #
An internal kernel tracer that can trace static predefined events, function calls, etc. Very useful for debugging problems without changing the kernel and understanding the behavior of subsystems.
For general advice see the Ftrace guide.
DebugFS #
This tool allows you to dump or modify internal values of your driver to files in a custom filesystem.
For general advice see the DebugFS guide.
Perf & alternatives #
Tools to measure the various stats on a running system to diagnose issues.
For general advice see the Perf & alternatives guide.
Example for media devices:
Gather statistics data for a decoding job: (This example is on a RK3399 SoC with the rkvdec codec driver using the fluster test suite):
perf stat -d python3 fluster.py run -d GStreamer-H.264-V4L2SL-Gst1.0 -ts
JVT-AVC_V1 -tv AUD_MW_E -j1
...
Performance counter stats for 'python3 fluster.py run -d
GStreamer-H.264-V4L2SL-Gst1.0 -ts JVT-AVC_V1 -tv AUD_MW_E -j1 -v':
7794.23 msec task-clock:u # 0.697 CPUs utilized
0 context-switches:u # 0.000 /sec
0 cpu-migrations:u # 0.000 /sec
11901 page-faults:u # 1.527 K/sec
882671556 cycles:u # 0.113 GHz (95.79%)
711708695 instructions:u # 0.81 insn per cycle (95.79%)
10581935 branches:u # 1.358 M/sec (15.13%)
6871144 branch-misses:u # 64.93% of all branches (95.79%)
281716547 L1-dcache-loads:u # 36.144 M/sec (95.79%)
9019581 L1-dcache-load-misses:u # 3.20% of all L1-dcache accesses (95.79%)
<not supported> LLC-loads:u
<not supported> LLC-load-misses:u
11.180830431 seconds time elapsed
1.502318000 seconds user
6.377221000 seconds sys
The availability of events and metrics depends on the system you are running.
Error checking & panic analysis #
Various Kernel configuration options to enhance error detection of the Linux Kernel with the cost of lowering performance.
For general advice see the KASAN, UBSAN, lockdep and other error checkers guide.
Driver verification with v4l2-compliance #
To verify, that a driver adheres to the v4l2 API, the tool v4l2-compliance is used, which is part of the v4l_utils, a suite of userspace tools to work with the media subsystem.
To see the detailed media topology (and check it) use:
v4l2-compliance -M /dev/mediaX --verbose
You can also run a full compliance check for all devices referenced in the media topology with:
v4l2-compliance -m /dev/mediaX
Debugging problems with receiving video #
Implementing vidioc_log_status in the driver: this can log the current status to the kernel log. It's called by v4l2-ctl --log-status. Very useful for debugging problems with receiving video (TV/S-Video/HDMI/etc) since the video signal is external (so unpredictable). Less useful with camera sensor inputs since you have control over what the camera sensor does.
Usually you can just assign the default:
.vidioc_log_status = v4l2_ctrl_log_status,
But you can also create your own callback, to create a custom status log.
You can find an example in the cobalt driver (drivers/media/pci/cobalt/cobalt-v4l2.c).
Copyright ©2024 : Collabora
Userspace debugging advice
Peios Kernel / Kernel development / Development process / debugging
Peios: This is inherited Linux development and upstream contribution guidance. For Peios repository changes, follow Peios Standards and Conventions and use Building Peios. Upstream mailing lists, maintainer roles and release processes below apply when contributing to Linux upstream.
This document provides a brief overview of common tools to debug the Linux Kernel from userspace. For debugging advice aimed at driver developers go here. For general debugging advice, see general advice document.
The following sections show you the available tools.
Dynamic debug #
Mechanism to filter what ends up in the kernel log by dis-/en-abling log messages.
Prerequisite: CONFIG_DYNAMIC_DEBUG
Dynamic debug is only able to target:
-
pr_debug()
-
dev_dbg()
-
print_hex_dump_debug()
-
print_hex_dump_bytes()
Therefore the usability of this tool is, as of now, quite limited as there is no uniform rule for adding debug prints to the codebase, resulting in a variety of ways these prints are implemented.
Also, note that most debug statements are implemented as a variation of dprintk(), which have to be activated via a parameter in respective module, dynamic debug is unable to do that step for you.
Here is one example, that enables all available pr_debug()'s within the file:
$ alias ddcmd='echo $* > /proc/dynamic_debug/control'
$ ddcmd '-p; file v4l2-h264.c +p'
$ grep =p /proc/dynamic_debug/control
drivers/media/v4l2-core/v4l2-h264.c:372 [v4l2_h264]print_ref_list_b =p
"ref_pic_list_b%u (cur_poc %u%c) %s"
drivers/media/v4l2-core/v4l2-h264.c:333 [v4l2_h264]print_ref_list_p =p
"ref_pic_list_p (cur_poc %u%c) %s\n"
When should you use this over Ftrace ?
-
When the code contains one of the valid print statements (see above) or when you have added multiple pr_debug() statements during development
-
When timing is not an issue, meaning if multiple pr_debug() statements in the code won't cause delays
-
When you care more about receiving specific log messages than tracing the pattern of how a function is called
For the full documentation see Dynamic debug
Ftrace #
Prerequisite: CONFIG_DYNAMIC_FTRACE
This tool uses the tracefs file system for the control files and output files. That file system will be mounted as a tracing directory, which can be found in either /sys/kernel/ or /sys/debug/kernel/.
Some of the most important operations for debugging are:
-
You can perform a function trace by adding a function name to the
set_ftrace_filterfile (which accepts any function name found within theavailable_filter_functionsfile) or you can specifically disable certain functions by adding their names to theset_ftrace_notracefile (more info at: dynamic ftrace). -
In order to find out where calls originate from you can activate the
func_stack_traceoption underoptions/func_stack_trace. -
Tracing the children of a function call and showing the return values are possible by adding the desired function in the
set_graph_functionfile (requires configFUNCTION_GRAPH_RETVAL); more info at dynamic ftrace with the function graph tracer.
For the full Ftrace documentation see ftrace - Function Tracer
Or you could also trace for specific events by using event tracing, which can be defined as described here: Creating a custom Ftrace tracepoint.
For the full Ftrace event tracing documentation see Event Tracing
Reading the ftrace log #
The trace file can be read just like any other file (cat, tail, head, vim, etc.), the size of the file is limited by the buffer_size_kb (echo 1000 > buffer_size_kb). The trace_pipe will behave similarly to the trace file, but whenever you read from the file the content is consumed.
Kernelshark #
A GUI interface to visualize the traces as a graph and list view from the output of the trace-cmd application.
For the full documentation see https://kernelshark.org/Documentation.html
Perf & alternatives #
The tools mentioned above provide ways to inspect kernel code, results, variable values, etc. Sometimes you have to find out first where to look and for those cases, a box of performance tracking tools can help you to frame the issue.
Why should you do a performance analysis? #
A performance analysis is a good first step when among other reasons:
-
you cannot define the issue
-
you do not know where it occurs
-
the running system should not be interrupted or it is a remote system, where you cannot install a new module/kernel
How to do a simple analysis with linux tools? #
For the start of a performance analysis, you can start with the usual tools like:
-
top/htop/atop(get an overview of the system load, see spikes on specific processes) -
mpstat -P ALL(look at the load distribution among CPUs) -
iostat -x(observe input and output devices utilization and performance) -
vmstat(overview of memory usage on the system) -
pidstat(similar tovmstatbut per process, to dial it down to the target) -
strace -tp $PID(once you know the process, you can figure out how it communicates with the Kernel)
These should help to narrow down the areas to look at sufficiently.
Diving deeper with perf #
The perf tool provides a series of metrics and events to further dial down on issues.
Prerequisite: build or install perf on your system
Gather statistics data for finding all files starting with gcc in /usr:
# perf stat -d find /usr -name 'gcc*' | wc -l
Performance counter stats for 'find /usr -name gcc*':
1277.81 msec task-clock # 0.997 CPUs utilized
9 context-switches # 7.043 /sec
1 cpu-migrations # 0.783 /sec
704 page-faults # 550.943 /sec
766548897 cycles # 0.600 GHz (97.15%)
798285467 instructions # 1.04 insn per cycle (97.15%)
57582731 branches # 45.064 M/sec (2.85%)
3842573 branch-misses # 6.67% of all branches (97.15%)
281616097 L1-dcache-loads # 220.390 M/sec (97.15%)
4220975 L1-dcache-load-misses # 1.50% of all L1-dcache accesses (97.15%)
<not supported> LLC-loads
<not supported> LLC-load-misses
1.281746009 seconds time elapsed
0.508796000 seconds user
0.773209000 seconds sys
52
The availability of events and metrics depends on the system you are running.
For the full documentation see https://perf.wiki.kernel.org/index.php/Main_Page
Perfetto #
A set of tools to measure and analyze how well applications and systems perform. You can use it to:
-
identify bottlenecks
-
optimize code
-
make software run faster and more efficiently.
What is the difference between perfetto and perf?
-
perf is tool as part of and specialized for the Linux Kernel and has CLI user interface.
-
perfetto cross-platform performance analysis stack, has extended functionality into userspace and provides a WEB user interface.
For the full documentation see https://perfetto.dev/docs/
Kernel panic analysis tools #
To capture the crash dump please use
Kdump&Kexec. Below you can find some advice for analysing the data.For the full documentation see the Documentation for Kdump - The kexec-based Crash Dumping Solution
In order to find the corresponding line in the code you can use faddr2line; note that you need to enable
CONFIG_DEBUG_INFOfor that to work.An alternative to using
faddr2lineis the use ofobjdump(and its derivatives for the different platforms likeaarch64-linux-gnu-objdump). Take this line as an example:
[ +0.000240] rkvdec_device_run+0x50/0x138 [rockchip_vdec].We can find the corresponding line of code by executing:
aarch64-linux-gnu-objdump -dS drivers/staging/media/rkvdec/rockchip-vdec.ko | grep rkvdec_device_run\>: -A 40 0000000000000ac8 <rkvdec_device_run>: ac8: d503201f nop acc: d503201f nop { ad0: d503233f paciasp ad4: a9bd7bfd stp x29, x30, [sp, #-48]! ad8: 910003fd mov x29, sp adc: a90153f3 stp x19, x20, [sp, #16] ae0: a9025bf5 stp x21, x22, [sp, #32] const struct rkvdec_coded_fmt_desc *desc = ctx->coded_fmt_desc; ae4: f9411814 ldr x20, [x0, #560] struct rkvdec_dev *rkvdec = ctx->dev; ae8: f9418015 ldr x21, [x0, #768] if (WARN_ON(!desc)) aec: b4000654 cbz x20, bb4 <rkvdec_device_run+0xec> ret = pm_runtime_resume_and_get(rkvdec->dev); af0: f943d2b6 ldr x22, [x21, #1952] ret = __pm_runtime_resume(dev, RPM_GET_PUT); af4: aa0003f3 mov x19, x0 af8: 52800081 mov w1, #0x4 // #4 afc: aa1603e0 mov x0, x22 b00: 94000000 bl 0 <__pm_runtime_resume> if (ret < 0) { b04: 37f80340 tbnz w0, #31, b6c <rkvdec_device_run+0xa4> dev_warn(rkvdec->dev, "Not good\n"); b08: f943d2a0 ldr x0, [x21, #1952] b0c: 90000001 adrp x1, 0 <rkvdec_try_ctrl-0x8> b10: 91000021 add x1, x1, #0x0 b14: 94000000 bl 0 <_dev_warn> *bad = 1; b18: d2800001 mov x1, #0x0 // #0 ...Meaning, in this line from the crash dump:
[ +0.000240] rkvdec_device_run+0x50/0x138 [rockchip_vdec]I can take the
0x50as offset, which I have to add to the base address of the corresponding function, which I find in this line:0000000000000ac8 <rkvdec_device_run>:The result of
0xac8 + 0x50 = 0xb18And when I search for that address within the function I get the following line:*bad = 1; b18: d2800001 mov x1, #0x0
Copyright ©2024 : Collabora