[PATCH v2 2/2] qemu: allow configuring mem-path for ivshmem-plain device

Wangxin (Alexander) wangxinxin.wang at huawei.com
Tue Jul 21 13:46:19 UTC 2020

> On Fri, Jul 17, 2020 at 09:04:51PM +0800, Wang Xin wrote:
> >The shared memory path is generated by shmem name as default,
> >however, we may need to change it to avoid filename conflict
> >when VM migrate to other host.
> >
> At which point there is no need for the name at all.  I agree that having the
> 'name' was an unfortunate decision, but adding more attributes does not seem
> like a proper fix.  If it needs to be changed then we should allow changing the
> name in the process.  You can also unplug the old name and plug in the new one,
> just like you'd have to do with role='peer'.  Did I miss any other reason for
> this?

Ivshmem config:
  <shmem name='abcdefg'>
    <model type='ivshmem-plain'/>
    <size unit='M'>4</size>
    <alias name='shmem0'/>  <!--auto generated in runtime-->
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

qemu args:
  -object memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/abcdefg,size=4194304,share=yes 
  -device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,bus=pci.0,addr=0x3

The shmem 'name' usually mean the ivshmem device name/id, I think we shouldn't change it in migration.
However, here we use the auto generated 'alias name' as device name/id instead.

Add a new optional attribute for easier understanding what we changed, no other reason.

Update the shmem 'name' will also work, I can support it in V3.

More information about the libvir-list mailing list