rust-vmm / vmm-reference

A VMM implementation based of rust-vmm components
Apache License 2.0
146 stars 61 forks source link

Something may be wrong in test_run_reference_vmm.py::test_reference_vmm_num_vcpus #207

Open iscas-glm opened 2 years ago

iscas-glm commented 2 years ago

in test_reference_vmm_num_vcpus testcase,it calls real check function expect_vcpus(vmm_process, expected_vcpus) which extracts "siblings" in /proc/cpuinfo file,while the number of siblings on a processor is the total number of execution units within that processor,not the meaning of real physical vcpus. If the test sample is as problematic as I say, this line should be changed as: vmm_process.stdin.write(b'cat /proc/cpuinfo| grep "physical id"|wc -l\n')

andreeaflorescu commented 2 years ago

We should indeed think about a better way to write this test such that it works as expected on both hyperthreading enabled & disabled hosts. We do not necessarily care about how those vcpus are arranged in a topology (i.e. if we have 2 threads per core or not), in this case we should just care about the number of configured vcpus being the same number of vcpus we're seeing in the host. We can further extend the test to also take into account the topology.

Are you interested in submitting a fix?

iscas-glm commented 2 years ago

We should indeed think about a better way to write this test such that it works as expected on both hyperthreading enabled & disabled hosts. We do not necessarily care about how those vcpus are arranged in a topology (i.e. if we have 2 threads per core or not), in this case we should just care about the number of configured vcpus being the same number of vcpus we're seeing in the host. We can further extend the test to also take into account the topology.

Are you interested in submitting a fix?

I'd love to, if you don't mind that I'm new at this project. In fact, I've only been working with the Rust-Vmm project for a while and found that the test sample failed when I replicated test_run_reference_vmm.py::test_run_reference_vmm. Early I started by trying to send the following command from the test function to the child process that started the VM

cat /proc/cpuinfo| grep "physical id"|wc -l

But it seems that the vmm_process.stdin.write() function can only write 32 characters to the terminal, and I don't know why.

I ended up getting the number of virtual machine instance cpus in a different way.