-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SRIOV: add new test case of dma_translation for vIOMMU #5937
base: master
Are you sure you want to change the base?
Conversation
|
@@ -33,6 +33,8 @@ def run(test, params, env): | |||
vmxml.features = features | |||
vmxml.sync() | |||
err_msg = '' | |||
if libvirt_version.version_compare(10, 7, 0) and iommu_dict['model'] == 'intel': | |||
iommu_dict['driver']['dma_translation'] = 'on' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dma_translation is new feature, so maybe create separate case under intel variant of ./libvirt/tests/cfg/sriov/vIOMMU/attach_iommu_device.cfg , otherwise it is easy to ignore this feature if still under previous test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've considered whether we need to add a new case. But after the evaluation I gave up because:
- Keep the same attributes strategy as before in plan.
- This new attribute is not so important because before it was enabled default.
Certainly it can also reduce our debug workloads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@Yingshun Could you help review this PR? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, it's better to add it to intel iommu cases or create a new one.
2c4386a
to
c718500
Compare
|
iommu_dict = eval(params.get("iommu_dict", "{}") % dma_translation) | ||
with_more_vcpus = "yes" == params.get("with_more_vcpus", "no") | ||
test_obj = viommu_base.VIOMMUTest(vm, test, params) | ||
libvirt_version.is_libvirt_feature_supported(params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's covered in viommu_base.VIOMMUTest(), plz remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it now.
type = intel_iommu_with_dma_translation | ||
start_vm = "yes" | ||
enable_guest_iommu = "yes" | ||
iommu_dict = {'model': 'intel', 'driver': {'intremap': 'on', 'caching_mode': 'on', 'iotlb': 'on', 'dma_translation': '%s'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to move this line to the end of this file and use the variant 'dma_translation' to show the iommu settings for each tests:
iommu_dict = {'model': 'intel', 'driver': {'intremap': 'on', 'caching_mode': 'on', 'iotlb': 'on', 'dma_translation': 'dma_translation'}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it can also be at the end of this file.
iommu_dict['driver'].update(eim_dict) | ||
test.log.info("TEST STEP1: Prepare guest xml with intel iommu device.") | ||
test_obj.setup_iommu_test(iommu_dict=iommu_dict) | ||
vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only used for L27-29, I think it can be moved into the if statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved it now.
vmxml.vcpu = int(guest_vcpus) | ||
vmxml.sync() | ||
test.log.info("TEST STEP2: Start the guest.") | ||
virsh.start(vm_name, debug=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use vm.start which will raise exceptions if the startup fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use vm.start().
test.log.info("TEST STEP3: Check the message for iommu group and DMA.") | ||
vm.cleanup_serial_console() | ||
vm.create_serial_console() | ||
vm_session = vm.wait_for_serial_login(timeout=6000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we expect the timeout to be so long? 6000s is too long in my opinion, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because when we start guest with 256 vCPUs, it may take long time to login the guest. Based on this scenario, I extended the timeout.
if dma_translation == "on" and (not dma_status or iommu_status): | ||
test.fail("Can't get expected message result when enabling dma_translation.") | ||
if dma_translation == "off" and (dma_status or not iommu_status): | ||
test.fail("Can't get expected message result when disabling dma_translation.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to log the outputs of above 2 shell commands - 'dmesg | xxx'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated now.
if with_more_vcpus: | ||
s, o = vm_session.cmd_status_output("cat /proc/cpuinfo | grep processor| wc -l") | ||
if int(o) != int(guest_vcpus): | ||
test.fail("Can't get expected vCPU number, the actual number is %s" % type(o)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type(o) to 'o'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, just a mistake in my debugging. I forgot to restore it before.
14ecc69
to
282b647
Compare
Automate new dma_translation attribute for vIOMMU: VIRT-302220 - [vIOMMU][intel] Start VM with intel iommu and dma_translation attribute Signed-off-by: Meina Li <[email protected]>
Automate new dma_translation attribute for vIOMMU:
VIRT-302220 - [vIOMMU][intel] Start VM with intel iommu and dma_translation attribute