diff --git a/.greptile/config.json b/.greptile/config.json new file mode 100644 index 00000000..278a52bc --- /dev/null +++ b/.greptile/config.json @@ -0,0 +1,7 @@ +{ + "strictness": 2, + "commentTypes": ["logic", "syntax"], + "autoReview": [], + "triggerOnDrafts": false, + "ignorePatterns": "reports/**\ncaptures/**\nanalysis/**\nlicenses/**\nHANDOFF.md" +} diff --git a/.greptile/rules.md b/.greptile/rules.md new file mode 100644 index 00000000..ee071e07 --- /dev/null +++ b/.greptile/rules.md @@ -0,0 +1,27 @@ +# Greptile Review Rules (`nvdriver`) + +This repository is a clean-room Rust NVIDIA GPU kernel driver targeting exact behavioral parity with NVIDIA 580.178.04. Focus reviews on correctness, kernel safety, ABI/hardware parity, and regression risks rather than cosmetic style nits. + +## 1. Exact 580.178.04 Parity +- Flag guessed struct layouts, field offsets, bitmasks, register sequences, or status codes that contradict adjacent RM/UVM/HAL definitions or break error-ordering parity. +- Flag silent placeholder stubs or partial no-ops presented as complete implementations. + +## 2. Kernel Module & ABI Gate Constraints +- Kernel code must remain compatible with `tools/check_kernel_module.py`: + - No SIMD / floating-point instructions in kernel builds. + - No emitted calls to `memcpy`, `memset`, or `memmove` symbols. + - Keep kernel stack frames <= 1,024 bytes (flag large stack arrays/structs passed or allocated by value). + - No GOT relocations; preserve IBT-valid indirect function targets. +- Check kernel-version compatibility guards against `docs/KERNEL_COMPAT.md` when touching `kernel-open` or C FFI shims. + +## 3. Concurrency, Memory, and Teardown Safety +- Verify every acquired lock, RM/UVM handle, refcount, DMA buffer, IOMMU mapping, and allocated resource is released on all error and teardown paths. +- Check all user-supplied ioctl/RM/UVM sizes, counts, offsets, and indices for integer overflow, underflow, out-of-bounds access, and unchecked casts. +- Verify ring-buffer, MMIO, and GSP/Falcon transport paths handle partial failures, timeouts, and wraparound cleanly without hanging or corrupting state. + +## 4. Hardware & Machine Safety +- Flag any introduction of PCI sysfs resets (`.../reset`, `.../remove` + rescan), `setpci` bridge resets, unguarded `mmiotrace` across workloads, or automated host reboot commands. +- Scripts or tools that open `/dev/nvidia*` should enforce explicit timeouts and fail closed on errors. + +## 5. Tooling & Tests +- Python tools and oracles must be `-O` safe (never rely on `assert` for required side effects or runtime validation) and portable (no hardcoded host-specific paths). diff --git a/AGENTS.md b/AGENTS.md index dd92e106..ef15a74d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -103,5 +103,6 @@ Do not change, disarm or work around any of these. If one of them fires, the fir ## 3. PR review and merge gate -- **CodeRabbit approval is required before merging code changes.** Agents are only allowed to merge PRs containing code changes after CodeRabbit has reviewed and approved them (no unresolved actionable findings, and never while CodeRabbit is `Review rate limited`, `Review in progress`, or unreviewed). -- Do not bypass this gate when rate-limited: wait for quota to refill or trigger `@coderabbitai review` once capacity is available, resolve any findings, and confirm CodeRabbit approval on the latest head commit before merging. +- **Automated review approval is required before merging code changes.** Agents are only allowed to merge PRs containing code changes after an approved automated review on the latest head commit with no unresolved actionable findings. +- **Primary reviewer (CodeRabbit):** Wait for CodeRabbit to complete its review (never merge while CodeRabbit is `Review in progress`, unreviewed, or has unresolved actionable findings). +- **Rate-limit fallback (Greptile):** When CodeRabbit is `Review rate limited`, do not merge unreviewed — either wait for CodeRabbit quota to refill (`@coderabbitai review`) **or** trigger `@greptileai` and confirm a completed Greptile review on the latest head commit with all actionable findings resolved before merging.