Skip to content

Conversation

@heywji
Copy link
Contributor

@heywji heywji commented Aug 2, 2025

Poll mode is a must-have feature for Windows Server 2025 and Windows 11.

ID: 2267

Signed-off-by: Wenkang Ji [email protected]

Summary by CodeRabbit

  • Tests
    • Added end-to-end tests for netkvm poll mode that verify poll-mode state and trace output keywords.
    • Expanded coverage with multiple RSS and queue/SMP variants (different queue counts, RSS enabled/disabled) to validate behavior across configurations.
    • Added configuration variants to exercise polling behavior across Windows versions and virtualization settings.

@heywji
Copy link
Contributor Author

heywji commented Aug 2, 2025

Test result:

 (01/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_thr
eads.q35: STARTED                                                                                                                                                       
 (01/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_thr
eads.q35: PASS (1863.84 s)                                                                                                                                              
 (02/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_t
hreads.q35: STARTED                                                                                                                                                     
 (02/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.unattended_install.cdrom.extra_cdrom_ks.default_install.aio_t
hreads.q35: PASS (2419.12 s)                                                                                                                                            
 (03/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_16.q35: STARTED               
 (03/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_16.q35: PASS (318.76 s)       
 (04/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_2.q35: STARTED                
 (04/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_2.q35: PASS (303.40 s)        
 (05/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp2.q35: STARTED                      
 (05/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp2.q35: PASS (335.38 s)              
 (06/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue32_smp20.q35: STARTED                    
 (06/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win11.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue32_smp20.q35: PASS (306.80 s)            
 (07/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_16.q35: STARTED             
 (07/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_16.q35: PASS (362.45 s)     
 (08/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_2.q35: STARTED              
 (08/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp4.rss_2.q35: PASS (308.13 s)      
 (09/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp2.q35: STARTED                    
 (09/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue4_smp2.q35: PASS (324.31 s)
 (10/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue32_smp20.q35: STARTED                  
 (10/10) Host_RHEL.m9.u7.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.Win2025.x86_64.io-github-autotest-qemu.netkvm_poll_mode.queue32_smp20.q35: PASS (297.05 s)
RESULTS    : PASS 10 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0        

@heywji heywji force-pushed the add_pollmode_case2 branch 2 times, most recently from 653d703 to 9b32bdb Compare August 2, 2025 04:02
@heywji
Copy link
Contributor Author

heywji commented Aug 4, 2025

@leidwang Hi Leidong, please help review this poll mode patch. I have completed it now.


:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environmen.
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
:param env: Dictionary with test environmen.
:param env: Dictionary with test environment.

mapping_output = re.findall(keyword, result)
if not mapping_output:
test.error("Can't get %s from traceview", keyword)
return mapping_output
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to return any value for run()

Comment on lines 14 to 15
setup_rss_queues = '"*NumRssQueues" %s'
check_rss_queues = "*NumRssQueues"
Copy link
Contributor

Choose a reason for hiding this comment

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

rss_queue_name = "*NumRssQueues"

Please update these lines as we discussed.

queues = ${smp}
variants:
- rss_16:
rss_queues = 16
Copy link
Contributor

Choose a reason for hiding this comment

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

rss_queue_value = 1

restore_image_after_testing = yes
# this case only tested on prewhql255 or higher version
cdroms += " virtio"
required_virtio_win_prewhql = [0.1.255, )
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we also need add virtio-win version here

@heywji
Copy link
Contributor Author

heywji commented Nov 4, 2025

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds a new test configuration qemu/tests/cfg/netkvm_poll_mode.cfg and a new test module qemu/tests/netkvm_poll_mode.py. The config defines a netkvm_poll_mode test with multiple variants that set SMP, virtio-net queues, RSS enablement, and rss_queues. The test module's run(test, params, env) ensures the VM is running, sets netkvm RSS parameters via utils_net.set_netkvm_param_value, reads the NDIS poll-mode state via utils_net.get_netkvm_param_value, dumps TraceView logs with utils_net.dump_traceview_log_windows, searches the logs for a keyword from params, logs matches, and raises an error if no matches are found.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Small, focused change: one new config and one test module with linear control flow and calls to existing helpers.
  • Homogeneous edits: parameter parsing, helper invocations, log parsing.

Areas to review closely:

  • Parsing/formatting of enable_rss and setup_rss_queues before calling utils_net.set_netkvm_param_value.
  • Correct usage and expected return values of utils_net.set_netkvm_param_value, utils_net.get_netkvm_param_value, and utils_net.dump_traceview_log_windows.
  • Regex/search behavior for params["keyword"] and handling when no matches are found.
  • Consistency of config variants (SMP, queues, rss_queues) with target Windows versions in the config.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'netkvm: add netkvm_poll_mode test case' directly and clearly describes the main change: adding a new test case for netkvm poll mode functionality.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e2969f and f5712ab.

📒 Files selected for processing (2)
  • qemu/tests/cfg/netkvm_poll_mode.cfg (1 hunks)
  • qemu/tests/netkvm_poll_mode.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • qemu/tests/netkvm_poll_mode.py
  • qemu/tests/cfg/netkvm_poll_mode.cfg

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (2)
qemu/tests/netkvm_poll_mode.py (2)

17-17: Fix the typo in the docstring (past review comment not addressed).

The docstring has a typo: "environmen." should be "environment." This was previously flagged but remains unfixed.

Apply this diff:

-    :param env: Dictionary with test environmen.
+    :param env: Dictionary with test environment.

33-40: Remove the return statement (past review comment not addressed).

The run() function should not return a value, as mentioned in the previous review. In the avocado-vt test framework, test functions communicate results through test.fail(), test.error(), or test.log methods, not return values.

Apply this diff:

     mapping_output = re.findall(keyword, result)
     if not mapping_output:
         test.error("Can't get %s from traceview", keyword)
-    return mapping_output
+    test.log.info("Found keyword matches: %s", mapping_output)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4eb58da and 9b32bdb.

📒 Files selected for processing (2)
  • qemu/tests/cfg/netkvm_poll_mode.cfg (1 hunks)
  • qemu/tests/netkvm_poll_mode.py (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-30T07:12:07.731Z
Learnt from: JinLiul
Repo: autotest/tp-qemu PR: 4362
File: qemu/tests/cfg/sev_direct_kernel_boot.cfg:18-18
Timestamp: 2025-09-30T07:12:07.731Z
Learning: In QEMU SEV testing configurations, the vm_sev_kernel_hashes property works with both SEV and SNP variants as it was moved to common SevCommonProperties in recent QEMU patches, so it can be declared at the top level to apply to both variants.

Applied to files:

  • qemu/tests/cfg/netkvm_poll_mode.cfg
🔇 Additional comments (4)
qemu/tests/cfg/netkvm_poll_mode.cfg (3)

1-11: LGTM! Version requirement and OS restrictions look correct.

The configuration properly restricts the test to Windows 11 and Windows Server 2025 with virtio-net devices, and includes the virtio-win version requirement (prewhql 0.1.255 or higher) as mentioned in the past review feedback.


12-17: Parameter definitions look correct.

The RSS and poll mode parameter definitions are properly structured. The quoted format for parameter names (e.g., "*RSS", "*NumRssQueues") appears intentional for Windows netkvm registry/command usage, and the template with %s placeholder on line 14 correctly supports dynamic RSS queue values.


18-38: Test variants are well-structured.

The variants properly define multiple test scenarios covering different combinations of SMP counts, queue counts, and RSS queue settings. The nested variant structure (queue4_smp4 with rss_16/rss_2 sub-variants) and the keyword expectations (enabled/disabled) align well with the test logic in the Python module.

qemu/tests/netkvm_poll_mode.py (1)

19-21: VM setup looks correct.

@heywji heywji force-pushed the add_pollmode_case2 branch from 9b32bdb to 2e2969f Compare November 4, 2025 07:31
Poll mode is a must-have feature for Windows Server 2025 and Windows 11.

Signed-off-by: wji <[email protected]>
@heywji heywji force-pushed the add_pollmode_case2 branch from 2e2969f to f5712ab Compare November 4, 2025 07:35
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.

2 participants