Bug 1895204

Summary: RFE: support cpu feature kvm-poll-control
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Han Han <hhan>
Component: libvirtAssignee: Tim Wiederhake <twiederh>
Status: CLOSED ERRATA QA Contact: Luyao Huang <lhuang>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: chhu, dyuan, jdenemar, jinqi, jsuchane, lhuang, lmen, virt-maint, xuzhang, yalzhang
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.10.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-25 06:45:10 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 6.10.0
Embargoed:

Description Han Han 2020-11-06 02:13:07 UTC
Description of problem:
The kvm halt poll control support has been introduced since QEMU v4.2:
commit d645e13287
Author: Marcelo Tosatti <mtosatti>
Date:   Mon Jun 3 20:04:08 2019 -0300

    kvm: i386: halt poll control MSR support
    
    Add support for halt poll control MSR: save/restore, migration
    and new feature name.
    
    The purpose of this MSR is to allow the guest to disable
    host halt poll.
    
    Signed-off-by: Marcelo Tosatti <mtosatti>
    Message-Id: <20190603230408.GA7938>
    [Do not enable by default, as pointed out by Mark Kanda. - Paolo]
    Signed-off-by: Paolo Bonzini <pbonzini>

And guest kernel v5.4:
commit fa86ee90eb11
Author: Marcelo Tosatti <mtosatti>
Date:   Wed Jul 3 20:51:25 2019 -0300

    add cpuidle-haltpoll driver
    
    Add a cpuidle driver that calls the architecture default_idle routine.
    
    To be used in conjunction with the haltpoll governor.
    
    Signed-off-by: Marcelo Tosatti <mtosatti>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki>

It will help improve performance for virtualized guests(See p18 of Stefan Hajnoczi's Optimizing for NVMe Drives: https://vmsplice.net/~stefan/stefanha-kvm-forum-2020.pdf)

Expected cpu xml:
<cpu ...>
    <feature policy='require' name='kvm-poll-control'/>
</cpu>

Current status in libvirt:
➜  ~ virsh start fedora31 
error: Failed to start domain fedora31
error: unsupported configuration: unknown CPU feature: kvm-poll-control

Comment 6 Luyao Huang 2020-12-16 02:29:05 UTC
Verify this bug with libvirt-daemon-6.10.0-1.module+el8.4.0+8898+a84e86e1.x86_64:

S1: Start guest with cpu feature kvm-poll-control

1. enable poll-control in guest xml:

# virsh dumpxml vm1 --inactive
..
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <kvm>
      <poll-control state='on'/>
    </kvm>
  </features>
..

2. start guest
# virsh start vm1
Domain vm1 started

3. check qemu command line:
# ps uax|grep qemu
...,kvm-poll-control=on...

4. destroy guest
# virsh destroy vm1
Domain vm1 destroyed

5. disable poll-control in guest xml:

  <features>
    <acpi/>
    <apic/>
    <pae/>
    <kvm>
      <poll-control state='off'/>
    </kvm>
  </features>

6. start guest
# virsh start vm1
Domain vm1 started

7. check qemu command line and there is no kvm-poll-control:

# ps aux|grep qemu |grep kvm-poll-control
# echo $?
1

Comment 8 errata-xmlrpc 2021-05-25 06:45:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:2098