Hi Michal,
The domain xml is attached.
Regards,
Jing Qi
On Wed, Sep 15, 2021 at 7:14 PM Michal Prívozník <[email protected]>
wrote:
> On 9/14/21 3:05 PM, David Hildenbrand wrote:
> > On 13.09.21 16:52, Michal Privoznik wrote:
> >> Nothing special is happening here. All important changes were
> >> done when for 'virtio-pmem' (adjusting the code to put virtio
> >> memory on PCI bus, generating alias using
> >> qemuDomainDeviceAliasIndex(). The only bit that might look
> >> suspicious is no prealloc for virtio-mem. But if you think about
> >> it, the whole purpose of this device is to change amount of
> >> memory exposed to guest on the fly. There is no point in locking
> >> the whole backend in memory.
> >
> > Do I understand correctly that we'll always try setting "reserve=off",
> > and "prealloc=off"? That would be awesome :)
>
> prealloc=off would be set (almost) unconditionally for all
> memory-backend-* objects that are associated with virtio-mem device. And
> if QEMU is new enough to have .reserve attribute then reserve=off is set
> too.
>
> >
> > I do wonder if we want to warn or bail out if "priv->memPrealloc" is set
> > but we are temporarily not able to support it -- as discussed, because
> > virtio-mem in QEMU yet has to be taught about it.
>
> priv->memPrealloc might not be what you think it is. The fact whether
> immediate allocation was requested is stored in def->mem.allocation; and
> priv->memPrealloc is just there to track whether -mem-prealloc what
> already put onto (paritally) generated cmd line and thus the rest of
> generators must refrain from setting prealloc=on.
>
> Codewise speaking, if you'd look at qemuBuildCommandLine() (this is
> where cmd line generation happens) then you'd see
> qemuBuildMemCommandLine() being called first and only after that
> qemuBuildMemoryDeviceCommandLine() being called second.
>
> The former is responsible for generating generic memory for guest (e.g.
> -m XX -mem-prealloc -mem-path ... which is the old style, nowadays a
> combination of -machine memory-backend= + -object memory-backend-* is
> generated).
>
> Long story short, if priv->memPrealloc isn't true at this point, then
> libvirt doesn't have to set prealloc=off explicitly, because off is the
> default.
>
>
> >
> > FYI: QEMU will bail out if "reserve=off,prealloc=on" is set in
> combination.
>
> Yeah, this combination should never happen.
>
> Michal
>
>
--
Thanks & Regards,
Jing,Qi
<domain type='kvm' id='12'>
<name>pc</name>
<uuid>bb508b28-d57b-44bd-9e9c-a134cef24b60</uuid>
<maxMemory slots='16' unit='KiB'>8388608</maxMemory>
<memory unit='KiB'>1179648</memory>
<currentMemory unit='KiB'>1179648</currentMemory>
<memoryBacking>
<allocation mode='immediate'/>
</memoryBacking>
<vcpu placement='static'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-5.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<vmport state='off'/>
</features>
<cpu mode='custom' match='exact' check='full'>
<model fallback='forbid'>qemu64</model>
<feature policy='require' name='x2apic'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='lahf_lm'/>
<feature policy='disable' name='svm'/>
<numa>
<cell id='0' cpus='0-1' memory='1048576' unit='KiB' discard='yes'/>
</numa>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/Fedora-Cloud-Base-Rawhide-20210605.n.0.x86_64.qcow2' index='1'/>
<backingStore/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<alias name='usb'/>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<alias name='usb'/>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<alias name='usb'/>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<controller type='ide' index='0'>
<alias name='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='scsi0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</controller>
<serial type='pty'>
<source path='/dev/pts/1'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='tablet' bus='usb'>
<alias name='input0'/>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'>
<alias name='input1'/>
</input>
<input type='keyboard' bus='ps2'>
<alias name='input2'/>
</input>
<graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
<image compression='off'/>
</graphics>
<sound model='ich6'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<audio id='1' type='spice'/>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<redirdev bus='usb' type='spicevmc'>
<alias name='redir0'/>
<address type='usb' bus='0' port='2'/>
</redirdev>
<redirdev bus='usb' type='spicevmc'>
<alias name='redir1'/>
<address type='usb' bus='0' port='3'/>
</redirdev>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
<memory model='virtio-mem'>
<source>
<nodemask>0</nodemask>
<pagesize unit='KiB'>2048</pagesize>
</source>
<target>
<size unit='KiB'>131072</size>
<node>0</node>
<block unit='KiB'>2048</block>
<requested unit='KiB'>131072</requested>
<current unit='KiB'>131072</current>
</target>
<alias name='virtiomem0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</memory>
</devices>
<seclabel type='dynamic' model='selinux' relabel='yes'>
<label>system_u:system_r:svirt_t:s0:c339,c343</label>
<imagelabel>system_u:object_r:svirt_image_t:s0:c339,c343</imagelabel>
</seclabel>
<seclabel type='dynamic' model='dac' relabel='yes'>
<label>+107:+107</label>
<imagelabel>+107:+107</imagelabel>
</seclabel>
</domain>