Skip to content

vmop: add VMOP_KILL_THREAD and VMOP_KILL_CHILD#65

Draft
Erich Plondke (eplondke) wants to merge 1 commit into
masterfrom
dev/ejp/vmop_kill
Draft

vmop: add VMOP_KILL_THREAD and VMOP_KILL_CHILD#65
Erich Plondke (eplondke) wants to merge 1 commit into
masterfrom
dev/ejp/vmop_kill

Conversation

@eplondke

Copy link
Copy Markdown
Contributor

Wires up the dormant H2K_VMSTATUS_KILL bit into a cross-thread kill API. KILL_THREAD sets KILL+VMWORK on the target and forces it out of any state (VMWAIT / RUNNING / INTBLOCKED / BLOCKED / READY), ignoring guest IE so a target with interrupts disabled still terminates. KILL_CHILD iterates a child VM's contexts[] under a single BKL critical section. Permission mirrors vmop_status (self or child) for kill_thread and vmop_free (parent-only) for kill_child; the natural H2K_thread_stop teardown signals the parent and frees the vmblock when the last vcpu drains.

The state-switch is duplicated from H2K_vm_int_deliver_locked rather than factored out, since unifying the two paths would require touching vmint.v4opt.S. A FIXME marks that refactor as future work.

Test exercises every state, the kill-ignores-IE invariant, self-kill through KILL_THREAD, both permission denials for KILL_CHILD, and a mixed RUNNING+DEAD vcpu set. Coverage for the three new functions is 100%.

This is very similar to andreykarpenko-qc PR ... I thought I'd push this WIP so we can compare.

Wires up the dormant H2K_VMSTATUS_KILL bit into a cross-thread kill API.
KILL_THREAD sets KILL+VMWORK on the target and forces it out of any state
(VMWAIT / RUNNING / INTBLOCKED / BLOCKED / READY), ignoring guest IE so a
target with interrupts disabled still terminates.  KILL_CHILD iterates a
child VM's contexts[] under a single BKL critical section.  Permission
mirrors vmop_status (self or child) for kill_thread and vmop_free
(parent-only) for kill_child; the natural H2K_thread_stop teardown signals
the parent and frees the vmblock when the last vcpu drains.

The state-switch is duplicated from H2K_vm_int_deliver_locked rather than
factored out, since unifying the two paths would require touching
vmint.v4opt.S.  A FIXME marks that refactor as future work.

Test exercises every state, the kill-ignores-IE invariant, self-kill
through KILL_THREAD, both permission denials for KILL_CHILD, and a mixed
RUNNING+DEAD vcpu set.  Coverage for the three new functions is 100%.

Signed-off-by: Erich Plondke <erich@qti.qualcomm.com>
@andreykarpenko-qc

Copy link
Copy Markdown
Contributor

Erich, could you take the tests from my PR and try with your change ?

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

Labels

untested Mark untested PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants