{"id":51319532,"url":"https://github.com/manishklach/cpuopt-kernel","last_synced_at":"2026-07-04T14:00:41.083Z","repository":{"id":367979343,"uuid":"1282963585","full_name":"manishklach/cpuopt-kernel","owner":"manishklach","description":"Safe, reversible Linux CPU performance profiles across CPUFreq, intel_pstate, amd-pstate, cpuidle, thermal, hwmon, and future Intel/AMD/ARM backends.","archived":false,"fork":false,"pushed_at":"2026-06-29T12:33:47.000Z","size":105,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-01T11:36:54.880Z","etag":null,"topics":["amd","amd-pstate","arm64","cpu","cpu-performance","cpufreq","cpuidle","energy-efficiency","hwmon","intel","intel-pstate","kernel-module","latency","linux","linux-kernel","performance-tuning","power-management","sysfs","systems-programming","thermal-management"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manishklach.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":"docs/ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-28T11:56:25.000Z","updated_at":"2026-06-29T12:33:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/manishklach/cpuopt-kernel","commit_stats":null,"previous_names":["manishklach/cpuopt-kernel"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/manishklach/cpuopt-kernel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manishklach%2Fcpuopt-kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manishklach%2Fcpuopt-kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manishklach%2Fcpuopt-kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manishklach%2Fcpuopt-kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manishklach","download_url":"https://codeload.github.com/manishklach/cpuopt-kernel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manishklach%2Fcpuopt-kernel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35045926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amd","amd-pstate","arm64","cpu","cpu-performance","cpufreq","cpuidle","energy-efficiency","hwmon","intel","intel-pstate","kernel-module","latency","linux","linux-kernel","performance-tuning","power-management","sysfs","systems-programming","thermal-management"],"created_at":"2026-07-01T11:31:29.246Z","updated_at":"2026-07-02T12:01:16.777Z","avatar_url":"https://github.com/manishklach.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPUOpt-Kernel\n\n\u003e Safe, workload-aware CPU performance profiles for Linux — no overclocking, no register\n\u003e hacks, no guessing.\n\n[![tests](https://github.com/manishklach/cpuopt-kernel/actions/workflows/tests.yml/badge.svg)](https://github.com/manishklach/cpuopt-kernel/actions/workflows/tests.yml)\n[![python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)\n[![license](https://img.shields.io/badge/license-GPL--2.0--only-blue.svg)](LICENSE)\n[![version](https://img.shields.io/badge/version-v0.2.0-informational.svg)](https://github.com/manishklach/cpuopt-kernel/blob/main/CHANGELOG.md)\n\n---\n\n\u003c!-- INSERT: animated terminal GIF here — record with vhs or asciinema --\u003e\n\u003c!-- Suggested flow: doctor → recommend --workload llama-inference → profile ai-inference --dry-run --diff → monitor → restore --\u003e\n\n---\n\nLinux CPU performance policy is **shattered across six kernel interfaces**:\n\n```text\ncpufreq  ·  intel_pstate  ·  amd-pstate  ·  EPP/EPB  ·  cpuidle  ·  thermal zones\n```\n\nEvery tool speaks one dialect. CPUOpt-Kernel speaks all of them — and exposes a single\nprofile-driven API that is **safe by default**, **reversible on demand**, and\n**workload-aware**.\n\n---\n\n## Quick Start\n\n```bash\n# Install (requires Python 3.10+)\npipx install .\n# or: pip install .\n\n# No root needed to inspect\ncpuoptctl doctor\ncpuoptctl recommend\ncpuoptctl explain performance\n\n# Root needed to apply\nsudo cpuoptctl profile balanced\nsudo cpuoptctl profile ai-inference --dry-run --diff\nsudo cpuoptctl restore\n```\n\nThat is the intended flow: inspect first, preview second, apply only when comfortable.\n\n---\n\n## Why Not Just Use X?\n\n| | CPUOpt-Kernel | cpupower | tuned | TLP | powertop |\n|---|---|---|---|---|---|\n| Workload-aware profiles | yes | no | partial | no | no |\n| Dry-run + diff preview | yes | no | no | no | no |\n| Snapshot/restore | yes | no | no | no | no |\n| No raw MSR writes | yes | partial | partial | yes | partial |\n| Unified Intel/AMD/ARM roadmap | yes | partial | partial | partial | partial |\n| Advisory mode with no writes | yes | no | no | no | partial |\n| Fixture-backed tests | yes | no | no | no | no |\n| JSON output | yes | limited | no | no | no |\n\n---\n\n## How It Works\n\n```text\n                    ┌─────────────────────────────────────────┐\n                    │           CPUOpt-Kernel                  │\n                    │                                          │\n  sysfs ──────────▶│  Discover ──▶ CapabilityMap ──▶ Profile  │\n  /sys/devices/    │                                   │       │\n  /sys/class/      │             ProposedWrite ◀───────┘       │\n  /dev/cpu/*/msr   │             (read-only check)             │\n  (read-only)      │                    │                      │\n                   │            Validate ──▶ Snapshot          │\n                   │                    │                      │\n                   │             Apply (or Dry-run)            │\n                   └─────────────────────────────────────────┘\n                            │                    │\n                       last_state.json     zero writes\n                       (before state)      (--dry-run)\n```\n\nEvery sysfs path is validated for existence and writability before a single byte changes.\nUnknown paths are skipped, not guessed. The snapshot taken before `apply` is what `restore`\nreplays.\n\n---\n\n## Commands\n\n### Discovery \u0026 inspection\n\n```bash\ncpuoptctl status\ncpuoptctl discover --json\ncpuoptctl doctor\ncpuoptctl intel-hwp\ncpuoptctl msr-read --intel --safe\n```\n\n### Advisory\n\n```bash\ncpuoptctl recommend\ncpuoptctl recommend --workload kernel-build\ncpuoptctl recommend --workload llama-inference\ncpuoptctl recommend --workload low-latency\ncpuoptctl explain performance\n```\n\n### Apply \u0026 restore\n\n```bash\nsudo cpuoptctl profile performance\nsudo cpuoptctl profile balanced\nsudo cpuoptctl profile latency --allow-idle-tuning\nsudo cpuoptctl profile quiet\nsudo cpuoptctl profile ai-inference\nsudo cpuoptctl profile performance --dry-run --diff\nsudo cpuoptctl restore\n```\n\n### Observe\n\n```bash\nsudo cpuoptctl monitor --interval 2\ncpuoptctl compare balanced performance --benchmark stress-ng --duration 30\ncpuoptctl export-json\n```\n\n---\n\n## Example Output\n\n```text\n## CPUOpt Status\n\nVendor:         GenuineIntel\nModel:          Intel(R) Core(TM) i7-1280P\nKernel:         Linux 6.8.0\nScaling driver: intel_pstate\nHWP/EPP:        exposed\nTurbo:          intel_pstate/no_turbo = 0 (turbo enabled)\n\nPolicies:\n  policy0  CPUs=0-7   governor=powersave  epp=balance_performance\n\nThermals:\n  x86_pkg_temp  51 C\n```\n\n---\n\n## Safety Model\n\nCPUOpt-Kernel is **not** an overclocking tool. Every design decision biases toward\nreversibility and kernel-interface compliance:\n\n- Prefers existing kernel interfaces over raw register writes\n- Every sysfs write validates path existence and candidate value before touching the file\n- `--dry-run` performs **zero filesystem modifications**\n- Unknown sysfs paths are skipped, not guessed\n- Failed writes are logged and non-fatal\n- Modified values are snapshotted to `last_state.json` before any `apply` run\n- `msr-read` is read-only telemetry only\n- Fan writes are intentionally unimplemented in v0.x\n- No thermal protection bypass, no voltage manipulation, no BIOS or BMC writes\n\nSee [docs/SAFETY.md](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\docs\\SAFETY.md) for the full model.\n\n---\n\n## Architecture\n\nSee [docs/ARCHITECTURE.md](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\docs\\ARCHITECTURE.md) for the layered pipeline design, the\n`--sysfs-root` abstraction, and the planned backend/plugin direction.\n\n---\n\n## Demo\n\n```bash\ncpuoptctl doctor\ncpuoptctl recommend --workload llama-inference\ncpuoptctl profile performance --dry-run --diff\ncpuoptctl monitor\n```\n\nDemo assets:\n\n- [assets/cpuopt-status-demo.txt](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\assets\\cpuopt-status-demo.txt)\n- [assets/cpuopt-doctor-demo.txt](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\assets\\cpuopt-doctor-demo.txt)\n- [assets/cpuopt-dry-run-demo.txt](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\assets\\cpuopt-dry-run-demo.txt)\n- [assets/cpuopt-monitor-demo.txt](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\assets\\cpuopt-monitor-demo.txt)\n- [assets/cpuopt-recommend-demo.txt](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\assets\\cpuopt-recommend-demo.txt)\n\n---\n\n## Testing Without Root\n\nAll discovery and profile-decision paths can be exercised against fake sysfs fixtures:\n\n```bash\npython cpuoptctl/cpuoptctl.py status --sysfs-root tests/fixtures/intel_hwp\npython cpuoptctl/cpuoptctl.py profile performance --dry-run --sysfs-root tests/fixtures/intel_hwp\npython -m unittest\n```\n\nIf you install the optional test extras from `pyproject.toml`, you can also run:\n\n```bash\npytest\n```\n\n---\n\n## Repository Layout\n\n```text\ncpuopt-kernel/\n├── cpuoptctl/\n├── docs/\n├── examples/\n├── kernel/\n├── scripts/\n├── tests/\n├── assets/\n├── pyproject.toml\n└── CHANGELOG.md\n```\n\n---\n\n## Roadmap\n\n| Milestone | Target |\n|---|---|\n| v0.1.0 | Intel MVP foundation |\n| v0.2.0 | Doctor, recommend, explain, read-only MSR telemetry |\n| v0.3.0 | AMD `amd-pstate` backend depth |\n| v0.4.0 | ARM SCMI and heterogeneous-topology handling |\n| v1.0.0 | Multi-backend plugin protocol and optional kernel module |\n\n---\n\n## Contributing\n\nCPUOpt-Kernel is a safety-first project. See [CONTRIBUTING.md](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\CONTRIBUTING.md) for the\ndevelopment flow, required checks, and expectations for backend/profile changes.\n\n---\n\n## License\n\nGPL-2.0-only — see [LICENSE](C:\\Users\\ManishKL\\Documents\\Playground\\cpuopt-kernel\\LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanishklach%2Fcpuopt-kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanishklach%2Fcpuopt-kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanishklach%2Fcpuopt-kernel/lists"}