Skip to content

integration: liquescent (CI only — do not merge) - #4

Closed
richardkiene wants to merge 5 commits into
mainfrom
liquescent
Closed

integration: liquescent (CI only — do not merge)#4
richardkiene wants to merge 5 commits into
mainfrom
liquescent

Conversation

@richardkiene

Copy link
Copy Markdown

Merge of #1, #2 and #3. Exists only so CI compiles the combined tree; the fork's main stays identical to upstream. Close after the run.

nvfd only needs NVML, and NVML ships with every NVIDIA driver as
libnvidia-ml.so.1. The only reason the CUDA toolkit was required was
nvml.h, and installing the toolkit through a distribution package
(nvidia-cuda-toolkit on Debian/Ubuntu) can replace or pin the driver on
the host.

- Add include/nvml_api.h declaring the 17 NVML entry points nvfd calls,
  with the enum values and struct layouts from nvml.h. Signatures are
  part of the versioned ABI (_v2 suffixes), so this is stable.
- Link by SONAME (-l:libnvidia-ml.so.1) so no libnvidia-ml.so dev
  symlink is needed either. Compile with
  -Werror=implicit-function-declaration so an undeclared NVML call is a
  build error, not a silent implicit int.
- nvmlDeviceSetFanControlPolicy is now always compiled in and its result
  checked, instead of being #ifdef'd on whatever header happened to be
  installed. Minimum driver is R520.
- install.sh: stop installing nvidia-cuda-toolkit; refuse to build if
  libnvidia-ml.so.1 is not in the linker cache; run the post-install
  `nvfd list` visibly so an NVML init failure aborts the install
  instead of being swallowed by `|| true`.
- CI: build without the toolkit.
daemon_loop, the dashboard and the editor keep per-GPU state in arrays
sized by MAX_GPU_COUNT (8) but indexed by device_count, so a host with
nine or more GPUs overran them. Fail at gpu_init with a message naming
the limit instead.
The daemon used to swallow every error: an unparseable config was
treated as "all GPUs auto", a missing or corrupt curve fell back to a
hardcoded default, an unknown mode fell back to that default too, and a
failed nvmlDeviceSetFanSpeed_v2 was ignored so the service sat "active"
while logging to stderr every 5 s. A daemon that hung inside NVML was
never restarted, leaving the fans pinned at the last speed it set.

Daemon:
- Every error is fatal. The reason goes to syslog, the fans are reset to
  auto, and the process exits non-zero so Restart=on-failure takes over.
  This covers: unreadable config or curve file, manual mode without a
  valid speed, unknown mode, temperature read failure, and any fan
  command NVML rejects.
- The curve file is re-read every poll, like config.json already was, so
  `nvfd curve <temp> <speed>` takes effect within 5 s. SIGHUP is kept as
  a no-op so a stray HUP does not kill the daemon; ExecReload is gone.
- sd_notify READY=1 / WATCHDOG=1 / STOPPING=1 via a 40-line AF_UNIX
  datagram shim (src/notify.c), no libsystemd dependency. The unit is
  Type=notify with WatchdogSec=30 against a 5 s poll.
- StartLimitIntervalSec=60 / StartLimitBurst=5 so persistent failure
  parks the unit in "failed" instead of restarting forever.

Readers:
- config_read() distinguishes "no file yet" (empty object) from "file
  exists but is unusable" (NULL + config_last_error()). config_write_gpu
  refuses to overwrite a config it could not parse.
- curve_load() validates the file: object at top level, integer keys
  0-100, integer values 0-100, no duplicate temperatures (which divided
  by zero in curve_interpolate), at most MAX_CURVE_POINTS, at least one
  point. curve_read() stays as a wrapper for the TUI.
- curve_edit/curve_reset return status instead of void; curve_edit
  refuses to overwrite an invalid file.

CLI:
- `nvfd curve` and `nvfd <n> curve` verify the curve loads before
  switching a GPU into curve mode, so the daemon is never handed a
  config it will immediately die on.
- Exit status is non-zero when a command fails.
- The TUI and `nvfd status` exit with the parse error instead of
  showing a blank config; the curve editor refuses to open on an
  invalid file rather than overwriting it from the default on save.
@richardkiene

Copy link
Copy Markdown
Author

CI passed on 9188894 (run 33522913001: compile + shellcheck). Closing — this branch is deployed directly, never merged into main.

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