Thanks Michal. I checked the virtio_mem module in the host last time. 
I tried a new guest image with virtio_mem module and start the domain , then the value of actual can be set correctly.
  
Jing Qi
 

On Thu, Feb 4, 2021 at 4:52 PM Michal Privoznik <mprivozn@redhat.com> wrote:
On 2/4/21 3:33 AM, Jing Qi wrote:
> Michal,
> I checked the virtio_mem module and it's loaded -
>
> lsmod |grep virtio_mem
> virtio_mem             32768  0
>
> And I can't make the actual value change to non-zerio.
> ->  virsh update-memory pc  --requested-size 256M
> or
> ->virsh setmem pc 1000M

This is unrelated. 'setmem' modifies balloon not virtio-mem-pci device.

>
>   <memory model='virtio-mem'>
>        <target>
>          <size unit='KiB'>524288</size>
>          <node>0</node>
>          <block unit='KiB'>2048</block>
>          <requested unit='KiB'>262144</requested>
>          <actual unit='KiB'>0</actual>
>        </target>
>        <alias name='virtiomem0'/>
>        <address type='pci' domain='0x0000' bus='0x00' slot='0x0a'
> function='0x0'/>
>      </memory>
> Any other suggestions ?


Is there something in the guest dmesg? This is what I get:

virsh update-memory-device gentoo --alias ua-virtiomem 256M

[   17.619060] virtio_mem virtio3: plugged size: 0x0
[   17.619062] virtio_mem virtio3: requested size: 0x10000000
[   17.653072] Built 4 zonelists, mobility grouping on.  Total pages:
2065850
[   17.653074] Policy zone: Normal


And I can see actual size updated:

     <memory model='virtio-mem'>
       <source>
         <pagesize unit='KiB'>2048</pagesize>
       </source>
       <target>
         <size unit='KiB'>4194304</size>
         <node>0</node>
         <block unit='KiB'>2048</block>
         <requested unit='KiB'>262144</requested>
         <actual unit='KiB'>262144</actual>
       </target>
       <alias name='ua-virtiomem'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08'
function='0x0'/>
     </memory>

Maybe David knows the answer.

Michal



--
Thanks & Regards,
Jing,Qi