Skip to content

perf(mshv): skip RIP advance on VmAction::Halt fast path#1476

Open
ludfjig wants to merge 1 commit into
hyperlight-dev:mainfrom
ludfjig:fix_mshv_extra_ioctl
Open

perf(mshv): skip RIP advance on VmAction::Halt fast path#1476
ludfjig wants to merge 1 commit into
hyperlight-dev:mainfrom
ludfjig:fix_mshv_extra_ioctl

Conversation

@ludfjig
Copy link
Copy Markdown
Contributor

@ludfjig ludfjig commented May 27, 2026

Fixes an issue where we did an extra IOCTL when it wasn't needed (regs gets set anyway on next guest call).

Note that the perf regressions were mostly fixed by #1366 due to using VP page for setting registers instead of IOCTL, so the impact of this PR is minor. But it's still good to have

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label May 27, 2026
@ludfjig ludfjig marked this pull request as ready for review May 27, 2026 21:08
@ludfjig ludfjig requested a review from danbugs as a code owner May 27, 2026 21:08
Copilot AI review requested due to automatic review settings May 27, 2026 21:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Moves the VmAction::Halt fast-path check before MSHV's manual RIP advancement in MshvVm::run_vcpu()'s I/O port intercept handler. Since the next guest dispatch sets RIP via set_regs() anyway, skipping the RIP advance (either VP register page dirtying or a set_reg IOCTL fallback) on halt avoids unnecessary work on a hot path.

Changes:

  • Reorder the VmAction::Halt short-circuit to occur before RIP advancement in the MSHV I/O port intercept path.

Copy link
Copy Markdown
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants