Skip to content

context: skip shutdown eventfd without REST endpoint - #112

Draft
jasonthird wants to merge 1 commit into
libkrun:mainfrom
jasonthird:agent/skip-unused-shutdown-eventfd
Draft

context: skip shutdown eventfd without REST endpoint#112
jasonthird wants to merge 1 commit into
libkrun:mainfrom
jasonthird:agent/skip-unused-shutdown-eventfd

Conversation

@jasonthird

Copy link
Copy Markdown

Summary

Only request libkrun's shutdown eventfd when krunkit is configured with a TCP or Unix REST endpoint.

When --restful-uri none:// is used, no status listener exists and the shutdown eventfd cannot be signalled. Avoiding the request also prevents libkrun from exposing an unused GPIO shutdown device to the guest.

TCP and Unix REST endpoints retain their existing orderly-shutdown behavior.

Depends on: libkrun/libkrun#802

Testing

  • cargo test --locked — 36 tests passed
  • cargo clippy --locked -- -D warnings
  • Release build against patched libkrun 1.19.4
  • Disposable Colima VM using krunkit, 2 CPUs, 4 GiB, and virtiofs
  • Confirmed no /dev/input/event0 or GPIO platform device
  • Confirmed systemd-logind remained at 0.0% CPU
  • Confirmed Docker image pull and outbound container networking
  • Confirmed the running VM loaded the locally patched krunkit and libkrun

Signed-off-by: Iason Malkotsis <imalkotsis@gmail.com>
@jasonthird
jasonthird marked this pull request as ready for review July 28, 2026 21:26
Copilot AI review requested due to automatic review settings July 28, 2026 21:26
@jasonthird
jasonthird requested a review from slp as a code owner July 28, 2026 21:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates KrunContext::run() to only request libkrun’s shutdown eventfd when a REST status/shutdown listener is actually configured, avoiding an un-signalable shutdown fd and preventing an unnecessary shutdown device from being exposed to guests when --restful-uri none:// is used.

Changes:

  • Gate creation of the libkrun shutdown eventfd behind the presence of a TCP or Unix REST endpoint.
  • Keep existing listener-thread behavior for TCP/Unix REST endpoints while skipping it for none:// (and unset) configurations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/context.rs

// Only spawn a listener thread if the user specified unix:// or tcp://
// Only create a shutdown eventfd and listener for unix:// or tcp:// endpoints.
if uri.as_ref().is_some_and(|u| *u != RestfulUri::None) {
@tylerfanelli
tylerfanelli marked this pull request as draft July 29, 2026 04:19
@tylerfanelli

tylerfanelli commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Marked this as draft until libkrun/libkrun#802 is merged in order to effectively gate this behind that change.

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.

3 participants