Bug 1857671

Summary: <hint-dedicated> should not require <cpu mode='host-passthrough'>
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Stefan Hajnoczi <stefanha>
Component: libvirtAssignee: Tim Wiederhake <twiederh>
Status: CLOSED ERRATA QA Contact: Luyao Huang <lhuang>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: dyuan, jdenemar, jsuchane, jtomko, lmen, mprivozn, mst, pbonzini, virt-maint, xuzhang, yalzhang, ymankad
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.3Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.3.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2034942 (view as bug list) Environment:
Last Closed: 2021-11-16 07:50:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 7.1.0
Embargoed:
Bug Depends On:    
Bug Blocks: 2034942    

Description Stefan Hajnoczi 2020-07-16 10:25:58 UTC
Description of problem:

The guest Linux cpuidle-haltpoll feature requires <hints-dedicated state='on'/>. Libvirt currently only allows hints-dedicated to be enabled when <cpu mode='host-passthrough'> is used.

KVM_HINTS_REALTIME (formerly called KVM_HINTS_DEDICATED) is documented in
Linux as follows:

  guest checks this feature bit to determine that vCPUs are never
  preempted for an unlimited time, allowing optimizations

Any KVM vCPU should be able to support this feature, regardless of whether
host-passthrough is used or not.

The original author of the libvirt code has confirmed that limiting hints-dedicate to host-passthrough is too restrictive:
https://www.mail-archive.com/libvir-list@redhat.com/msg202968.html

Paolo Bonzini noted that mwait behavior may be affected by hints-dedicated, but now I can't find the code that does this.

How reproducible:
100%

Steps to Reproduce:
1. Add <hint-dedicated state='on'/> to the domain XML without <cpu mode='host-passthrough'/>

Actual results:
Libvirt does not allow this.

Expected results:
Libvirt allows this.

Comment 2 Tim Wiederhake 2021-01-18 14:44:49 UTC
Proposed patch: https://www.redhat.com/archives/libvir-list/2021-January/msg00756.html

Comment 6 Luyao Huang 2021-06-03 09:25:42 UTC
Verify this bug with libvirt-daemon-7.4.0-1.module+el8.5.0+11218+83343022.x86_64:

1. define a guest with host-model cpu mode & hint-dedicated=on


# virsh dumpxml vm1
...
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <kvm>
      <hint-dedicated state='on'/>
    </kvm>
  </features>
  <cpu mode='host-model' check='partial'>
    <numa>
      <cell id='0' cpus='0-1' memory='524288' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='524288' unit='KiB'/>
    </numa>
  </cpu>
...

2. start guest

# virsh start vm1
Domain 'vm1' started

3. check qemu command line:

# ps uax|grep qemu
... -cpu Skylake-Server-IBRS,...,kvm-hint-dedicated=on ...

Comment 8 errata-xmlrpc 2021-11-16 07:50:50 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:4684