# nvidia/nv-kernels architecture

> Architecture diagram of the GitHub repository nvidia/nv-kernels, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvidia/nv-kernels
- Repository: https://github.com/nvidia/nv-kernels

## Overview

1. This repository is not kernel source itself; it is the CI/orchestration layer for the NV-Kernels project. Its purpose is to automate branch rebases, patch validation, and kernel build/test verification using GitHub Actions.

2. The repo’s core boundary is branch separation:
   - `linux`: pristine upstream Linux mirror
   - `linux-nvidia-*`: NVIDIA kernel branches with patches on top of stable releases
   - `github-actions`: a dedicated control branch that stores only workflow logic and helper scripts
   This separation exists because `linux` is periodically reset to upstream and must not carry repo-owned automation files.

3. `update-and-rebase.yml` is the synchronization subsystem. It runs on a schedule and manually, rebasing the NVIDIA kernel branches onto the latest stable tags from Greg KH’s `linux.git`. Its output is new rebased branch tips named by kernel version, which then become inputs to downstream build validation.

4. `kernel-build.yml` is the validation subsystem. It builds kernels across a matrix of targets:
   - x86_64 defconfig
   - ARM64 with 4K pages
   - ARM64 with 64K pages
   It also performs QEMU boot tests and kselftests for selected kernel areas, so this workflow acts as the main quality gate after rebases or manual build requests.

5. `patchscan.yml` is the patch correctness subsystem. On pull requests targeting `24.04_linux-nvidia-6.17-next`, it checks whether cherry-picked commits are missing upstream `Fixes:` patches. The workflow fails if it finds gaps and comments the results back on the PR, using `origin/linux` as the upstream reference point.

6. The `.github/scripts/` directory contains reusable automation used by the workflows. Based on the README and filenames, it holds the patch scanning logic and PR validation helpers, plus Python dependencies (`requirements.txt`) needed to run those checks in GitHub Actions without relying on target branches.

7. The workflow inputs and outputs form a simple pipeline:
   - upstream stable/Linux sources feed the rebase workflow
   - rebased NVIDIA branches feed the build/test workflow
   - pull requests feed the patch scan workflow
   - workflow results are surfaced through GitHub Actions statuses and PR comments
   This makes GitHub Actions the central control plane for branch maintenance.

8. The `config_4k` and `config_64k` workflow files are likely build configuration assets for the ARM64 matrix entries. They represent a repository-owned boundary around platform-specific kernel configuration needed by the build job.

9. Operationally, the repository relies on GitHub Actions features more than application code: scheduled cron execution, manual dispatch, PR triggers, and branch-scoped workflow behavior. The default branch being `github-actions` is an architectural choice required because scheduled workflows only run from the default branch.

10. The main external dependencies are:
   - GitHub Actions as the execution environment
   - upstream Linux kernel sources/tags (`linux.git` / `origin/linux`)
   - kernel build/test tooling, including QEMU and kselftests
   The repo’s architecture is therefore best drawn as a small automation hub coordinating external kernel branches and CI validation rather than a traditional software service.

Main entry points: [`.github/workflows/patchscan.yml`](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/patchscan.yml) (patchscan), [`.github/workflows/kernel-build.yml`](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/kernel-build.yml) (kernel-build), [`.github/workflows/update-and-rebase.yml`](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/update-and-rebase.yml) (update-and-rebase), [`.github/workflows/config_4k`](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/config_4k) (config_4k)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control plane"]
  node_github_actions_branch[("github-actions<br/>control branch")]
  node_linux_branch[("linux<br/>upstream mirror")]
  node_nvidia_branches[("linux-nvidia-*<br/>kernel branches")]
end

subgraph group_sync["Rebase flow"]
  node_update_rebase["update-and-rebase<br/>workflow"]
end

subgraph group_build["Build validation"]
  node_kernel_build["kernel-build<br/>workflow<br/>[kernel-build.yml]"]
  node_config_4k["config_4k<br/>arm64 config<br/>[config_4k]"]
  node_config_64k["config_64k<br/>arm64 config<br/>[config_64k]"]
end

subgraph group_patch["Patch scan"]
  node_patchscan_wf["patchscan<br/>workflow<br/>[patchscan.yml]"]
end

subgraph group_shared["Shared automation"]
  node_patchscan_script["patchscan logic<br/>script<br/>[patchscan]"]
  node_validate_pr_script["PR helpers<br/>script<br/>[validate-pr]"]
  node_requirements["Python deps<br/>dependencies<br/>[requirements.txt]"]
end

subgraph group_externals["External systems"]
  node_gh_actions["GitHub Actions<br/>CI runtime"]
  node_upstream_linux[("linux.git<br/>upstream source")]
  node_pull_requests["Pull requests<br/>repo events"]
  node_qemu["QEMU<br/>boot test"]
  node_kselftests["kselftests<br/>kernel tests"]
end

node_gh_actions -->|"runs"| node_update_rebase
node_gh_actions -->|"runs"| node_kernel_build
node_gh_actions -->|"runs"| node_patchscan_wf
node_github_actions_branch -->|"hosts"| node_update_rebase
node_github_actions_branch -->|"hosts"| node_kernel_build
node_github_actions_branch -->|"hosts"| node_patchscan_wf
node_upstream_linux -->|"inputs"| node_update_rebase
node_update_rebase -->|"rebases"| node_nvidia_branches
node_update_rebase -.->|"keeps mirror"| node_linux_branch
node_nvidia_branches -->|"inputs"| node_kernel_build
node_kernel_build -->|"uses"| node_config_4k
node_kernel_build -->|"uses"| node_config_64k
node_kernel_build -->|"boots"| node_qemu
node_kernel_build -->|"runs"| node_kselftests
node_pull_requests -->|"triggers"| node_patchscan_wf
node_patchscan_wf -->|"uses"| node_patchscan_script
node_patchscan_wf -->|"uses"| node_validate_pr_script
node_patchscan_wf -->|"installs"| node_requirements
node_patchscan_wf -->|"compares to"| node_linux_branch
node_patchscan_wf -->|"comments"| node_pull_requests
node_patchscan_wf -.->|"status"| node_gh_actions
node_kernel_build -.->|"status"| node_gh_actions
node_update_rebase -.->|"status"| node_gh_actions

click node_update_rebase "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/update-and-rebase.yml"
click node_kernel_build "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/kernel-build.yml"
click node_patchscan_wf "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/patchscan.yml"
click node_patchscan_script "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/scripts/patchscan"
click node_validate_pr_script "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/scripts/validate-pr"
click node_requirements "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/scripts/requirements.txt"
click node_config_4k "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/config_4k"
click node_config_64k "https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/config_64k"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_github_actions_branch,node_linux_branch,node_nvidia_branches toneBlue
class node_update_rebase toneAmber
class node_kernel_build,node_config_4k,node_config_64k toneMint
class node_patchscan_wf toneRose
class node_patchscan_script,node_validate_pr_script,node_requirements toneIndigo
class node_gh_actions,node_upstream_linux,node_pull_requests,node_qemu,node_kselftests toneTeal
```

## Components

### Control plane

Branch and workflow orchestration

- **github-actions**: control branch · Default branch that hosts repo-owned workflows and scripts
- **linux**: upstream mirror · Pristine upstream Linux mirror branch reset from upstream
- **linux-nvidia-***: kernel branches · NVIDIA patch series branches rebased on stable Linux tags

### Rebase flow

Keeping NVIDIA branches aligned with upstream stable Linux

- [update-and-rebase](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/update-and-rebase.yml): workflow · Scheduled/manual rebase workflow for NVIDIA branches · `.github/workflows/update-and-rebase.yml`

### Build validation

Kernel build and boot verification

- [kernel-build](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/kernel-build.yml): workflow · Matrix build, boot, and selftest validation workflow · `.github/workflows/kernel-build.yml`
- [config_4k](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/config_4k): arm64 config · ARM64 4K page build configuration asset · `.github/workflows/config_4k`
- [config_64k](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/config_64k): arm64 config · ARM64 64K page build configuration asset · `.github/workflows/config_64k`

### Patch scan

PR-time correctness checks for missing fixes

- [patchscan](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/workflows/patchscan.yml): workflow · PR workflow that checks for missing upstream fixes · `.github/workflows/patchscan.yml`

### Shared automation

Reusable scripts and workflow assets

- [patchscan logic](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/scripts/patchscan): script · Reusable patch scanning implementation · `.github/scripts/patchscan`
- [PR helpers](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/scripts/validate-pr): script · Reusable pull-request validation helpers · `.github/scripts/validate-pr`
- [Python deps](https://github.com/nvidia/nv-kernels/blob/github-actions/.github/scripts/requirements.txt): dependencies · Python requirements for GitHub Actions scripts · `.github/scripts/requirements.txt`

### External systems

GitHub and upstream kernel dependencies

- **GitHub Actions**: CI runtime · Execution environment and control plane for scheduled and PR workflows
- **linux.git**: upstream source · Greg KH stable Linux repository and tags used as rebase targets
- **Pull requests**: repo events · Incoming PRs that trigger patch scanning
- **QEMU**: boot test · Emulated boot target used by kernel-build validation
- **kselftests**: kernel tests · Selected kernel selftest suites run after builds

## Connections

- GitHub Actions → update-and-rebase: runs · Schedules and dispatches the rebase workflow
- GitHub Actions → kernel-build: runs · Executes the build validation workflow
- GitHub Actions → patchscan: runs · Triggers patch scanning on PR events
- github-actions → update-and-rebase: hosts · Default branch contains the workflow definition
- github-actions → kernel-build: hosts · Default branch contains the workflow definition
- github-actions → patchscan: hosts · Default branch contains the workflow definition
- linux.git → update-and-rebase: inputs · Stable tags and upstream source feed rebasing
- update-and-rebase → linux-nvidia-*: rebases · Produces refreshed NVIDIA branch tips
- update-and-rebase → linux: keeps mirror · Maintains the pristine upstream mirror branch
- linux-nvidia-* → kernel-build: inputs · Rebased branch tips are validated by builds
- kernel-build → config_4k: uses · ARM64 4K configuration matrix entry
- kernel-build → config_64k: uses · ARM64 64K configuration matrix entry
- kernel-build → QEMU: boots · Runs boot verification in emulation
- kernel-build → kselftests: runs · Executes selected kernel selftests
- Pull requests → patchscan: triggers · PRs targeting the next branch invoke patch scanning
- patchscan → patchscan logic: uses · Workflow delegates to shared scan logic
- patchscan → PR helpers: uses · Workflow delegates to PR validation helpers
- patchscan → Python deps: installs · Workflow installs Python dependencies for checks
- patchscan → linux: compares to · Uses origin/linux as upstream reference for Fixes coverage
- patchscan → Pull requests: comments · Reports findings back on the pull request
- patchscan → GitHub Actions: status · Surface pass/fail status through GitHub Actions
- kernel-build → GitHub Actions: status · Surface build/test results through GitHub Actions
- update-and-rebase → GitHub Actions: status · Surface rebase results through GitHub Actions
