Skip to content

History rewrite scripts#7

Draft
gidonstudinski-qc wants to merge 1 commit into
masterfrom
history_rewrite
Draft

History rewrite scripts#7
gidonstudinski-qc wants to merge 1 commit into
masterfrom
history_rewrite

Conversation

@gidonstudinski-qc

Copy link
Copy Markdown
Contributor

See REWRITE_README.md for details. For reference only, do not submit. Scripts assume that git-filter-repo is available in the same directory.

Pull Request

Description
A clear and concise description of what this pull request does.

Related Issue
Link to the issue that this pull request addresses (e.g., Fixes #123).

Type of Change
Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional Context
Add any other context about the pull request here.

See REWRITE_README.md for details.
For reference only, do not submit.
Scripts assume that git-filter-repo is available in the same directory.
@bryanb-h2 bryanb-h2 marked this pull request as draft May 5, 2026 14:28
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Remove the stale label or add a comment to reset the inactivity timer

@github-actions github-actions Bot added the Stale label Jun 5, 2026
@stzahi1 stzahi1 added do-not-merge Created just for reference in the future no need to merge. and removed Stale labels Jun 7, 2026
andreykarpenko-qc added a commit that referenced this pull request Jun 11, 2026
Returning from main (or calling exit()) needs to tear down the entire VM,
not just the calling thread.  Previously sys_exit() funneled into
pthread_exit, which left peer threads — especially ones blocked in a
futex (H2K_STATUS_BLOCKED) or intpool wait (H2K_STATUS_INTBLOCKED) —
stuck forever, leaking the vmblock.

Introduce a new H2_TRAP_VM_STOP (#7) syscall vector dispatched to
H2K_vm_stop, and route sys_exit through h2_vm_stop_trap unconditionally
(any status, not just zero).  H2K_vm_stop scans the vmblock's context
array and reaps every non-DEAD peer regardless of state:

  * BLOCKED  — remove from futex hash, cancel timer
  * INTBLOCKED — remove from intpool ring
  * READY / VMWAIT — remove from runlist
  * RUNNING peers on other HW threads — flagged via vmblock->exiting
    and IPI'd; resched.ref.c picks up the flag and self-reaps the
    context before scheduling

Each reap path performs the common cleanup (ASID refcount,
context clear, return to free list, num_cpus--), then the new helper
H2K_vmblock_finalize_if_done_locked() signals the parent VM and frees
the vmblock once num_cpus reaches zero.

Track which context is "main" so future policy can hinge on it:
vmblock->main_context is set by setup.ref.c for the boot VM and by
create.ref.c for the first thread of every other VM.

Trap-table test (kernel/event/trap/test/test.c) and the intpool h2 test
(kernel/event/intpool/test_h2/test.c) are updated for the new vector
and the new teardown semantics — the latter no longer needs to manually
join workers since main's return now reaps them.

Signed-off-by: Andrey Karpenko <andreyk@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Created just for reference in the future no need to merge. not_tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants