Skip to content

Add DMA, block, and network driver examples#370

Merged
jserv merged 1 commit into
masterfrom
extended
Apr 24, 2026
Merged

Add DMA, block, and network driver examples#370
jserv merged 1 commit into
masterfrom
extended

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented Apr 24, 2026

This introduces new kernel module examples (dma.c, blkram.c, vnetloop.c) and corresponding book sections covering memory/time/data-movement, PCI, USB, block, and network driver subsystems.

It also adds poll/select/epoll, async notification, MMIO, DMA/mmap, scatter-gather, and modern-interface-choices sections to the book text, and updates the version baseline statement to reflect 5.10 minimum.


Summary by cubic

Adds three kernel module examples (DMA demo, RAM-backed blk‑mq block device, and virtual loopback Ethernet) and expands the book with modern DMA/MMIO, poll/epoll, and PCI/USB/block/network chapters. Sets Linux v5.10 as the minimum baseline and embeds the new samples in the text.

  • New Features
    • Examples: examples/dma.c (sets DMA mask, coherent + streaming DMA via synthetic platform_device, version-aware .remove for 5.10–6.11), examples/blkram.c (RAM disk using blk‑mq with guards for 5.10–6.9+, kmap and queue helper transitions), examples/vnetloop.c (virtual net_device looping TX→RX with 64‑bit stats). Updated examples/Makefile to build dma.o, blkram.o, vnetloop.o.
    • Book (lkmpg.tex): Added poll/select/epoll and fasync; a Memory/Time/Data Movement chapter (timekeeping, allocation, user–kernel copies); MMIO; DMA + mmap with scatter‑gather and debugging; modern interface choices; and subsystem chapters for PCI, USB, block, and network with sample embeds. Baseline set to Linux v5.10.

Written for commit 563b6db. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="examples/vnetloop.c">

<violation number="1" location="examples/vnetloop.c:27">
P2: `u64` packet/byte counters are updated and read without synchronization, which can yield inconsistent stats under concurrent access (especially on 32-bit builds).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread examples/vnetloop.c Outdated
This introduces new kernel module examples (dma.c, blkram.c, vnetloop.c)
and corresponding book sections covering memory/time/data-movement, PCI,
USB, block, and network driver subsystems.

It also adds poll/select/epoll, async notification, MMIO, DMA/mmap,
scatter-gather, and modern-interface-choices sections to the book text,
and updates the version baseline statement to reflect 5.10 minimum.
@jserv jserv merged commit 10b4869 into master Apr 24, 2026
6 checks passed
@jserv jserv deleted the extended branch April 24, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant