Linux Kernel Spinlock Implementation with Interrupt State Management
In Linux kernel development, spinlocks are essential synchronization primitives for protecting shared resources in interrupt contexts. This article demonstrates how to implement interrupt-safe spinlocks in a character device driver for controlling GPIO-based LEDs. We'll explore the use of spinlock functions that save and restore interrupt state ...
Posted on Mon, 28 Sep 2026 16:38:52 +0000 by Thunderfunk
Tracing Applications with SystemTap
Introduction to SystemTap
SystemTap is a powerful dynamic tracing tool that allows developers and system administrators to monitor and analyze the behavior of both the Linux kernel and user-space applications without modifying the code or restarting the process. By defining custom probes, users can track various aspects such as function calls, ...
Posted on Thu, 24 Sep 2026 16:41:05 +0000 by opticmike
STM32MP157 Linux Character Device Driver Development Guide
Project Directory Structure
Key project directories for STM32MP157 development:
Buildroot root filesystem: /home/developer/projects/stm32mp157/rootfs
NFS root fliesystem: /home/developer/projects/nfs/rootfs
Linux source code: /home/developer/projects/linux-5.4.31
Device tree: /home/developer/projects/linux-5.4.31/arch/arm/boot/dts/stm32mp157-a ...
Posted on Thu, 17 Sep 2026 16:09:48 +0000 by shane07
Understanding Linux Reserved Memory Mechanism
As the kernel runs, physical memory becomes increasingly fragmented. Certain devices, such as those using DMA, require large contiguous physical memory blocks. When such memory is unavailable at runtime, the device may fail to operate. To address this, Linux provides a mechanism to reserve a dedicated region of physical memory for specific devi ...
Posted on Sun, 06 Sep 2026 16:43:19 +0000 by raker7
Understanding the current Pointer in the Linux Kernel
In the Linux kernel, the current macro provides a convenient way to access the task_struct instance representing the currently executing process or thread on a given CPU. This mechanism is essential for kernel code that needs to inspect or modify attributes of the running task.
The task_struct is a central data structure in the kernel, encapsul ...
Posted on Sun, 16 Aug 2026 17:03:53 +0000 by gabeanderson
Linux Buddy Allocator Architecture and Page State Analysis
Binary Decomposition PrincipleAny positive integer can be decomposed into a sum of distinct powers of two (2n, where n ≥ 0). This mathematical property, which forms the foundation of binary representation, is the core mechanism leveraged by the Buddy allocation system.Kernel Buddy System Data Structure HierarchyThe architecture of the Buddy sys ...
Posted on Mon, 03 Aug 2026 16:25:41 +0000 by wobbit
Analyzing eventfd System Call Implementation with select
eventfd(2) Combined with seelect(2) Source Code Analysis
The code examples are from Linux kernel 4.17
eventfd(2) - Creates a file descriptor for event notification.
Usage
Source Code Analysis
References
#include <sys/eventfd.h>
int eventfd(unsigned int initval, int flags);
int eventfd2(unsigned int initval, int flags);
Parameters
- \ ...
Posted on Sat, 01 Aug 2026 16:33:13 +0000 by Fredric
Platform Bus Driver Implementation in Linux
Understanding the Platform Bus
The platform bus is a virtual bus within the Linux kernel architecture, designed to unify the device and driver model. Unlike physical buses such as PCI or USB, the platform bus does not correspond to any physical hardware. It exists to manage devices that do not naturally fit into other bus models, ensuring a con ...
Posted on Sun, 26 Jul 2026 16:17:08 +0000 by dasding
Linux RCU Implementation Deep Dive
This analysis is based on Linux kernel 4.19.195.
Software Implementation Principles
The RCU implementation in software revolves around idnetifying the beginning of a Grace Period (GP), detecting Quiescent States (QS), determining when a grace period ends, handling post-grace-period cleanup, and initiating the next grace period—a large state mac ...
Posted on Sat, 25 Jul 2026 16:55:07 +0000 by jiayanhuang
Linux LED Driver Framework with Hardware Abstraction
Character Device Driver Foundations
Developing a Linux character device driver generally follows a standard sequence of operations:
Acquire a major device number, either statically assigned or dynamically allocated by the kernel.
Declare a file_operations structure to define the driver's supported interactions.
Implement the requisite handlers ...
Posted on Mon, 06 Jul 2026 17:19:02 +0000 by Stressed