Bug 2119007 - [RFE] support setting the poll* attributes in iothread XML
Summary: [RFE] support setting the poll* attributes in iothread XML
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: All
OS: Linux
low
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-17 09:57 UTC by Han Han
Modified: 2023-08-09 06:17 UTC (History)
7 users (show)

Fixed In Version: libvirt-9.4.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Feature Request
Target Upstream Version: 9.4.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-131312 0 None None None 2022-08-17 10:00:08 UTC

Description Han Han 2022-08-17 09:57:45 UTC
Description of problem:
As subject

Version-Release number of selected component (if applicable):
libvirt-8.5.0-5.el9.x86_64
qemu-kvm-7.0.0-11.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare an inactive VM with iothreads. The XML will be like:
...
<iothreads>4</iothreads>
<iothread id="2"/>
<iothread id="4"/>
<iothread id="6"/>
<iothread id="8" thread_pool_min="1" thread_pool_max="120"/>
...


2. Set the poll-max-ns by `virsh iothreadset --config`
➜  ~ virsh iothreadset rhel 2 --poll-max-ns 2 --config
error: Operation not supported: configuring persistent polling values is not supported


Actual results:
As above

Expected results:
poll-max-ns could be set like what we did for thread-pool-min in https://bugzilla.redhat.com/show_bug.cgi?id=2059511#c30


Additional info:
Here is a qemu example to set poll-max-ns by qemu cmdline:
➜  ~ /usr/libexec/qemu-kvm -object '{"qom-type":"iothread","id":"iothread2", "poll-max-ns": 2}' --qmp tcp:localhost:4444,server,wait=off
qemu-kvm: Machine type 'pc-i440fx-rhel7.6.0' is deprecated: machine types for previous major releases are deprecated
qemu-kvm: warning: CPU model qemu64-x86_64-cpu is deprecated -- use at least 'Nehalem' / 'Opteron_G4', or 'host' / 'max'
VNC server running on ::1:5900

Then connect qmp socket and get the iothreads info:
➜  ~ nc localhost 4444
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 7}, "package": "qemu-kvm-7.0.0-11.el9"}, "capabilities": ["oob"]}}
{ "execute": "qmp_capabilities" }
{"return": {}}
{ "execute": "query-iothreads"}
{"return": [{"poll-shrink": 0, "thread-id": 6877, "aio-max-batch": 0, "poll-grow": 0, "poll-max-ns": 2, "id": "iothread2"}]}

It works for poll-max-ns. We can support setting the poll attributes poll-max-ns/poll-grow/poll-shrink by the domain XML or `virsh iothreadset --config`

Comment 2 Peter Krempa 2022-08-22 12:09:51 UTC
For now libvirt didn't represent the values in XML.

Comment 3 Peter Krempa 2023-03-15 14:44:02 UTC
Implemented as part of https://listman.redhat.com/archives/libvir-list/2023-March/238250.html

Comment 4 Peter Krempa 2023-05-05 14:38:12 UTC
Fixed upstream:

commit 4b5a9e34ad36872ffb941772d86a210e36753de2
Author: Peter Krempa <pkrempa>
Date:   Thu Feb 23 14:27:17 2023 +0100

    qemu: Use configured iothread poll parameters on startup
    
    Implement the support for the persisted poll parameters and remove
    restrictions on saving config when modifying them during runtime.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

commit 83eee66f811cc81c632738b84129f006035a88d0
Author: Peter Krempa <pkrempa>
Date:   Thu Feb 23 13:48:35 2023 +0100

    conf: Store the iothread 'poll' settings in the XML
    
    Currently we allow configuring the 'poll-max-ns', 'poll-grow', and
    'poll-shrink' parameters of qemu iothreads only during runtime and they
    are not persisted. Add XML machinery to persist them.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

v9.3.0-26-g4b5a9e34ad

Comment 5 Han Han 2023-05-15 09:41:06 UTC
Tested on v9.3.0-62-g4a681995bc, qemu-kvm-8.0.0-2.el9.x86_64:

1. Define a VM with iothreads
➜  xmllint --xpath //iothreadids rhel.xml 
<iothreadids>
    <iothread id="2"/>
    <iothread id="4"/>
    <iothread id="6"/>
    <iothread id="8" thread_pool_min="2" thread_pool_max="32">
      <poll max="123" grow="456" shrink="789"/>
    </iothread>
  </iothreadids>

➜  /root/libvirt/build/tools/virsh define rhel.xml
Domain 'rhel' defined from rhel.xml


2. Set the iothread attributes inactively:
➜  virsh iothreadset rhel 6 --poll-max-ns 222 --poll-grow 222 --poll-shrink 222 --config 

➜  /root/libvirt/build/tools/virsh dumpxml rhel --xpath //iothreadids
<iothreadids>
  <iothread id="2"/>
  <iothread id="4"/>
  <iothread id="6">
    <poll max="222" grow="222" shrink="222"/>
  </iothread>
  <iothread id="8" thread_pool_min="2" thread_pool_max="32">
    <poll max="123" grow="456" shrink="789"/>
  </iothread>
</iothreadids>


3. Start the domain and check the iothreads:
➜  /root/libvirt/build/tools/virsh start rhel                                          
Domain 'rhel' started

➜  /root/libvirt/build/tools/virsh domstats rhel|grep iothread
  iothread.count=4
  iothread.2.poll-max-ns=32768
  iothread.2.poll-grow=0
  iothread.2.poll-shrink=0
  iothread.4.poll-max-ns=32768
  iothread.4.poll-grow=0
  iothread.4.poll-shrink=0
  iothread.6.poll-max-ns=222
  iothread.6.poll-grow=222
  iothread.6.poll-shrink=222
  iothread.8.poll-max-ns=123
  iothread.8.poll-grow=456
  iothread.8.poll-shrink=789

Comment 6 Han Han 2023-07-06 05:34:25 UTC
Test as comment5 on libvirt-9.5.0-0rc1.1.el9.x86_64 qemu-kvm-8.0.0-6.el9.x86_64. PASS

Comment 11 Han Han 2023-08-09 06:17:25 UTC
Tested on libvirt-9.5.0-5.el9.x86_64 qemu-kvm-8.0.0-11.el9.x86_64 as comment5. PASS


Note You need to log in before you can comment on or make changes to this bug.