Bug 2176215 - [libvirt] allow configuring host-phys-bits-limit
Summary: [libvirt] allow configuring host-phys-bits-limit
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 9.3
Assignee: Ján Tomko
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks: 2171860
TreeView+ depends on / blocked
 
Reported: 2023-03-07 16:43 UTC by Ján Tomko
Modified: 2023-08-07 12:45 UTC (History)
6 users (show)

Fixed In Version: libvirt-9.3.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.3.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab libvirt libvirt issues 450 0 None opened qemu: Support host-phys-bits-limit=int 2023-03-07 16:43:08 UTC
Red Hat Issue Tracker LIBVIRTAT-14267 0 None None None 2023-06-01 04:05:26 UTC
Red Hat Issue Tracker RHELPLAN-150965 0 None None None 2023-03-07 16:44:13 UTC

Description Ján Tomko 2023-03-07 16:43:08 UTC
Description of problem:
For migration compatibility, libvirt needs a knob to set the host-phys-bits-limit.
See bug 2171860 for more details.

Upstream issue:
https://gitlab.com/libvirt/libvirt/-/issues/450
Upstream patches:
https://listman.redhat.com/archives/libvir-list/2023-March/238231.html

Comment 2 Ján Tomko 2023-04-25 09:22:44 UTC
Pushed upstream as:
commit e3d95a1eba78f2b797dbdce7d8bd604a8e004961
Author:     Ján Tomko <jtomko>
CommitDate: 2023-04-25 11:19:37 +0200

    qemu: add support for setting host-phys-bits-limit
    
    Translate <maxphysaddr limit='39'/> to:
    host-phys-bits-limit=39
    
    https://gitlab.com/libvirt/libvirt/-/issues/450
    https://bugzilla.redhat.com/show_bug.cgi?id=2171860
    
    Signed-off-by: Ján Tomko <jtomko>
    Reviewed-by: Martin Kletzander <mkletzan>

git describe: v9.2.0-304-g03ca889b15

Comment 6 Luyao Huang 2023-05-19 02:30:20 UTC
Verify this bug with libvirt-9.3.0-2.el9.x86_64:

S1: Test set guest maxphysaddr limit < host Address sizes

1. check host Address sizes:
# lscpu |grep "Address sizes:"
Address sizes:                   46 bits physical, 48 bits virtual

2. Add limit in maxphysaddr element
# virsh edit vm1
...
  <cpu mode='host-model' check='partial'>
    <maxphysaddr mode='passthrough' limit='36'/>
    <numa>
      <cell id='0' cpus='0-5' memory='1048576' unit='KiB'/>
      <cell id='1' cpus='6-11' memory='1048576' unit='KiB'/>
    </numa>
  </cpu>
...

3. start guest
# virsh start vm1
Domain 'vm1' started

4. check qemu command line:
# ps aux|grep qemu
...host-phys-bits=on,host-phys-bits-limit=36

5. login guest and check guest Address sizes:
IN GUEST:
# lscpu|grep Address
Address sizes:                   36 bits physical, 48 bits virtual


S2: Test set guest maxphysaddr limit >= host Address sizes

1. check host Address sizes:
# lscpu |grep "Address sizes:"
Address sizes:                   46 bits physical, 48 bits virtual

2. Add limit in maxphysaddr element
# virsh edit vm1
...
  <cpu mode='host-model' check='partial'>
    <maxphysaddr mode='passthrough' limit='50'/>
    <numa>
      <cell id='0' cpus='0-5' memory='1048576' unit='KiB'/>
      <cell id='1' cpus='6-11' memory='1048576' unit='KiB'/>
    </numa>
  </cpu>
...

3. start guest
# virsh start vm1
Domain 'vm1' started

4. check qemu command line:
# ps aux|grep qemu
...host-phys-bits=on,host-phys-bits-limit=50


5. login guest and check guest Address sizes:

IN GUEST:
# lscpu|grep Address
Address sizes:                   46 bits physical, 48 bits virtual

S3: some negative scenarios

1. 
xml: <maxphysaddr mode='emulate' limit='50'/>

# virsh edit vm1
error: unsupported configuration: attribute 'limit' is only supported for maxphysaddr mode 'passthrough'
Failed. Try again? [y,n,i,f,?]: 

2.
xml: <maxphysaddr mode='passthrough' limit='0'/>

# virsh edit vm1
error: XML error: Invalid value for attribute 'limit' in element 'maxphysaddr': Zero is not permitted
Failed. Try again? [y,n,i,f,?]: 

3.
xml: <maxphysaddr mode='passthrough' limit='-1'/>

# virsh edit vm1
error: XML error: Invalid value for attribute 'limit' in element 'maxphysaddr': '-1'. Expected non-negative integer value
Failed. Try again? [y,n,f,?]: 


Migration and cross migration related scenarios will be tested in bug 2171860

Comment 7 smitterl 2023-08-07 12:45:49 UTC
Note: this is not supported on s390x:

error: unsupported configuration: CPU maximum physical address bits specification is not supported for 's390x' architecture


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