Repository navigation
feat(hvc_blk): issue DISCARD to the host so freed blocks are reclaimed - #20
Merged
Merged
Conversation
The HVC block device carried READ/WRITE/FLUSH only, so a Btrfs data disk on it advertised discard_max_bytes=0: discard=async did nothing and fstrim failed with "Not supported", and the host's sparse image never shrank after the guest freed space. Add ARCBOX_HVC_BLK_DISCARD (0xC2000005) and route REQ_OP_DISCARD to it. A zero-length call at probe is the capability check: a host that implements the call answers 0, an older host answers the SMCCC "not supported" code, and the device then stays exactly as before. Limits: 1 GiB per request (the host punches synchronously on the calling vCPU, ~20 ms per GiB of live data), 4 KiB granularity (what the host frees).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The HVC block device carried READ/WRITE/FLUSH only, so a Btrfs data disk on it advertised
discard_max_bytes=0:discard=asyncdid nothing,fstrimfailed with "Not supported", and the host's sparse image never shrank after the guest freed space. Measured on the ArcBox System VM (HV backend): 5 GiB written and deleted leftdocker.imgat 5.4 GiB indefinitely, while the same test on VZ (Apple virtio-blk) returned to 250 MiB within 3 minutes.This adds
ARCBOX_HVC_BLK_DISCARD(0xC2000005) and routesREQ_OP_DISCARDto it. A zero-length call at probe is the capability check: a host that implements the call answers 0, an older host answers the SMCCC "not supported" code through its PSCI fallback, and the device then stays exactly as before. Limits: 1 GiB per request (the host punches synchronously on the calling vCPU, ~20 ms per GiB of live data on APFS), 4 KiB granularity (what the host frees).Host half: arcboxlabs/arcbox
feat(vmm): punch DISCARDedranges on the HVC block fast path(virt/arcbox-vmm/src/vmm/darwin_hv/hvc_blk.rs). Either side alone is inert.Verified with the CI-built
kernel-arm64from this branch booted under an arcbox HV dev daemon:arcbox_hvc_blk: /dev/arcboxhvc1 (device 1, rw, discard),discard_max_bytes=1073741824, and the 5 GiB write/delete matrix now reclaims on HV (numbers in the arcbox change'sdocs/disk-reclaim.md).