rust-vmm / vm-memory

Virtual machine's guest memory crate
Apache License 2.0
309 stars 103 forks source link

volatile-memory: add split_at() #126

Closed elmarco closed 3 years ago

elmarco commented 3 years ago

This will come handy to implement https://github.com/rust-vmm/vm-virtio/pull/33

elmarco commented 3 years ago

buildkite failure isn't fair:

pytest rust-vmm-ci/integration_tests/test_coverage.py FAILED rust-vmm-ci/integration_tests/test_coverage.py::test_coverage - AssertionError: Coverage is increased from 85.5 to 85.6. Please update the coverage in tests/coverage.

andreeaflorescu commented 3 years ago

@elmarco yeah, that's not nice indeed. It isn't buidlkite's fault though, it is ours because the coverage test is implemented such that if the coverage is not the same as the one configured in coverage_config_x86_64.json, the test fails. You'll need to manually update the coverage score so that the test passes. It is a bit bizarre though that the coverage is increased when the code you added is not tested.

elmarco commented 3 years ago

@andreeaflorescu the added code is covered by the example test

jiangliu commented 3 years ago

This will come handy to implement rust-vmm/vm-virtio#33

when does it need to split a slice buffer into reader and writer parter? According to virtio spec, a descriptor will be readonly or write-only, what's the case where a buffer will be rw?

elmarco commented 3 years ago

when does it need to split a slice buffer into reader and writer parter? According to virtio spec, a descriptor will be readonly or write-only, what's the case where a buffer will be rw?

This is not the concern here, but rather of DescriptorChainConsumer in rust-vmm/vm-virtio#33. It collects the readable() buffers for the Reader, and writable for the Writer. There is thus no buffer that can be dual read & write.

bonzini commented 3 years ago

Looks good once the coverage % is fixed.