Skip to content
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

numa: Fix the check of guest numa cell allaction #5368

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

hs0210
Copy link
Contributor

@hs0210 hs0210 commented Dec 28, 2023

If the memory mode and memnode mode are not set, It is unpredictable on which host numa node a guest numa cell will be allocated. So all the host numa nodes should be checked.

The current test only considers the case where the host has two numa nodes. This patch fixes this issue.

Before:

Result:

FAIL 1-type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.no_mem_mode.multiple_nodes -> TestFail: Expect N0 + N1 > 0, but found not

Debug log:

2023-12-21 04:16:23,407 process          L0658 INFO | Running 'grep -B1 1024000 /proc/`pidof qemu-kvm`/smaps'
2023-12-21 04:16:23,470 process          L0470 DEBUG| [stdout] ffff1d400000-ffff5bc00000 rw-p 00000000 00:00 0 
2023-12-21 04:16:23,471 process          L0740 INFO | Command 'grep -B1 1024000 /proc/`pidof qemu-kvm`/smaps' finished with 0 after 0.059512729s
2023-12-21 04:16:23,472 process          L0470 DEBUG| [stdout] Size:            1024000 kB
2023-12-21 04:16:23,474 process          L0658 INFO | Running 'grep ffff1d400000 /proc/`pidof qemu-kvm`/numa_maps'
2023-12-21 04:16:23,537 process          L0470 DEBUG| [stdout] ffff1d400000 default anon=9440 dirty=9440 active=9429 N2=8904 N3=536 kernelpagesize_kB=64
2023-12-21 04:16:23,537 process          L0740 INFO | Command 'grep ffff1d400000 /proc/`pidof qemu-kvm`/numa_maps' finished with 0 after 0.058449983s
2023-12-21 04:16:23,539 host_guest_mixed L0112 DEBUG| all_nodes:[0, 1, 2, 3], N0_value:[], N1_value:[]

After:

Result:

PASS 1-type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.no_mem_mode.multiple_nodes

Debug log:

2023-12-28 03:15:15,505 process          L0658 INFO | Running 'grep -B1 1024000 /proc/`pidof qemu-kvm`/smaps'
2023-12-28 03:15:15,676 process          L0470 DEBUG| [stdout] fffef9400000-ffff37c00000 rw-p 00000000 00:00 0
2023-12-28 03:15:15,677 process          L0740 INFO | Command 'grep -B1 1024000 /proc/`pidof qemu-kvm`/smaps' finished with 0 after 0.166657469s
2023-12-28 03:15:15,677 process          L0470 DEBUG| [stdout] Size:            1024000 kB
2023-12-28 03:15:15,680 process          L0658 INFO | Running 'grep fffef9400000 /proc/`pidof qemu-kvm`/numa_maps'
2023-12-28 03:15:15,740 process          L0470 DEBUG| [stdout] fffef9400000 default anon=8819 dirty=8819 active=8815 N2=591 N3=8228 kernelpagesize_kB=64
2023-12-28 03:15:15,740 process          L0740 INFO | Command 'grep fffef9400000 /proc/`pidof qemu-kvm`/numa_maps' finished with 0 after 0.056382117s
2023-12-28 03:15:15,743 host_guest_mixed L0111 DEBUG| all_nodes:[0, 1, 2, 3]
2023-12-28 03:15:15,747 host_guest_mixed L0116 DEBUG| N2_value:591
2023-12-28 03:15:15,747 host_guest_mixed L0116 DEBUG| N3_value:8228
2023-12-28 03:15:15,748 host_guest_mixed L0182 DEBUG| Step: verify vm numa node 1 memory allocation - PASS

@hs0210 hs0210 force-pushed the numa_check_nodes_sum branch from d2067ea to 4fe1192 Compare December 28, 2023 08:45
Copy link
Contributor

@dzhengfy dzhengfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixing

@dzhengfy
Copy link
Contributor

Thanks for the fixing

Could you paste test results for all cases?

@hs0210
Copy link
Contributor Author

hs0210 commented Jan 26, 2024

Hi @dzhengfy , for some cases, there's another issue which can be fixed by #5326 and avocado-framework/avocado-vt#3804
With all the 3 patches, all cases passed except a few unsupported ones.

# /usr/local/bin/avocado run --vt-type libvirt --test-runner=runner --vt-machine-type arm64-mmio guest_numa_node_tuning.host_guest_mixed_memory_binding --vt-connect-uri qemu:///system
JOB ID     : efbadcccfc5abc8be2b519b6f4b7b32236f908dd
JOB LOG    : /root/avocado/job-results/job-2024-01-26T00.30-efbadcc/job.log
 (01/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_strict.single_node: PASS (12.09 s)                                                                                                                                                     
 (02/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_strict.multiple_nodes: PASS (58.11 s)                                                                                                                                                  
 (03/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_interleave.single_node: PASS (58.68 s)                                                                                                                                                 
 (04/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_interleave.multiple_nodes: PASS (59.54 s)                                                                                                                                              
 (05/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_preferred.single_node: PASS (57.88 s)                                                                                                                                                  
 (06/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_preferred.multiple_nodes: PASS (12.19 s)                                                                                                                                               
 (07/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_restrictive.single_node: CANCEL: This libvirt version doesn't support this function. (8.15 s)                                                                                          
 (08/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.mem_mode_restrictive.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.18 s)                                                                                       
 (09/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.no_mem_mode.single_node: PASS (58.81 s)                                                                                                                                                         
 (10/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.no_mem_mode.multiple_nodes: PASS (58.52 s)                                                                                                                                                      
 (11/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_strict.no_mem_mode.no_node: PASS (58.69 s)                                                                                                                                                             
 (12/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_strict.single_node: PASS (12.19 s)                                                                                                                                                 
 (13/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_strict.multiple_nodes: PASS (58.57 s)                                                                                                                                              
 (14/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_interleave.single_node: PASS (58.60 s)                                                                                                                                             
 (15/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_interleave.multiple_nodes: PASS (58.87 s)                                                                                                                                          
 (16/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_preferred.single_node: PASS (58.55 s)                                                                                                                                              
 (17/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_preferred.multiple_nodes: PASS (12.44 s)                                                                                                                                           
 (18/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_restrictive.single_node: CANCEL: This libvirt version doesn't support this function. (8.11 s)                                                                                      
 (19/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.mem_mode_restrictive.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.22 s)                                                                                   
 (20/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.no_mem_mode.single_node: PASS (58.62 s)                                                                                                                                                     
 (21/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.no_mem_mode.multiple_nodes: PASS (58.75 s)                                                                                                                                                  
 (22/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_interleave.no_mem_mode.no_node: PASS (58.82 s)                                                                                                                                                         
 (23/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_strict.single_node: PASS (12.27 s)                                                                                                                                                  
 (24/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_strict.multiple_nodes: PASS (58.56 s)                                                                                                                                               
 (25/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_interleave.single_node: PASS (59.82 s)                                                                                                                                              
 (26/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_interleave.multiple_nodes: PASS (59.09 s)                                                                                                                                           
 (27/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_preferred.single_node: PASS (57.77 s)                                                                                                                                               
 (28/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_preferred.multiple_nodes: PASS (12.14 s)                                                                                                                                            
 (29/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_restrictive.single_node: CANCEL: This libvirt version doesn't support this function. (8.11 s)                                                                                       
 (30/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.mem_mode_restrictive.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.20 s)                                                                                    
 (31/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.no_mem_mode.single_node: PASS (57.63 s)                                                                                                                                                      
 (32/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.no_mem_mode.multiple_nodes: PASS (58.94 s)                                                                                                                                                   
 (33/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_preferred.no_mem_mode.no_node: PASS (57.59 s)                                                                                                                                                          
 (34/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_strict.single_node: CANCEL: This libvirt version doesn't support this function. (8.22 s)                                                                                          
 (35/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_strict.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.28 s)                                                                                       
 (36/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_interleave.single_node: CANCEL: This libvirt version doesn't support this function. (8.25 s)                                                                                      
 (37/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_interleave.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.29 s)                                                                                   
 (38/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_preferred.single_node: CANCEL: This libvirt version doesn't support this function. (8.20 s)                                                                                       
 (39/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_preferred.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.09 s)                                                                                    
 (40/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_restrictive.single_node: CANCEL: This libvirt version doesn't support this function. (8.23 s)                                                                                     
 (41/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.mem_mode_restrictive.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.38 s)                                                                                  
 (42/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.no_mem_mode.single_node: CANCEL: This libvirt version doesn't support this function. (8.02 s)                                                                                              
 (43/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.no_mem_mode.multiple_nodes: CANCEL: This libvirt version doesn't support this function. (8.17 s)                                                                                           
 (44/44) type_specific.io-github-autotest-libvirt.guest_numa_node_tuning.host_guest_mixed_memory_binding.memnode_mode_restrictive.no_mem_mode.no_node: CANCEL: This libvirt version doesn't support this function. (8.19 s)                                                                                                  
RESULTS    : PASS 27 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 17
JOB HTML   : /root/avocado/job-results/job-2024-01-26T00.30-efbadcc/results.html
JOB TIME   : 1445.36 s

for node_value in node_values.values():
node_value_sum += int(node_value)
if node_value_sum <= 0:
numatest_obj.test.fail("Expect the sum of all node values is grater than 0, but found not")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
numatest_obj.test.fail("Expect the sum of all node values is grater than 0, but found not")
numatest_obj.test.fail("Expect the sum of all node values is **greater** than 0, but found not")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated.

@hs0210 hs0210 force-pushed the numa_check_nodes_sum branch from 4fe1192 to 5fc3758 Compare January 31, 2024 06:52
If the memory mode and memnode mode are not set, It is unpredictable on which
host numa node a guest numa cell will be allocated. So all the host numa nodes
should be checked.

The current test only considers the case where the host has two numa nodes.
This patch fixes this issue.

Signed-off-by: Hu Shuai <[email protected]>
@dzhengfy dzhengfy requested a review from chloerh March 1, 2024 10:51
@chloerh chloerh merged commit 785a2e2 into autotest:master Mar 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants