On 03.03.21 11:26, David Hildenbrand wrote:
On 03.03.21 03:53, Jason Wang wrote:
On 2021/3/3 12:21 上午, David Hildenbrand wrote:
Similar to VFIO, vDPA will go ahead an map+pin all guest memory. Memory
that used to be discarded will get re-populated and if we
discard+re-access memory after mapping+pinning, the pages mapped into the
vDPA IOMMU will go out of sync with the actual pages mapped into the user
space page tables.
Set discarding of RAM broken such that:
- virtio-mem and vhost-vdpa run mutually exclusive
- virtio-balloon is inhibited and no memory discards will get issued
In the future, we might be able to support coordinated discarding of RAM
as used by virtio-mem and as planned for VFIO.
Cc: Jason Wang <jasow...@redhat.com>
Cc: Michael S. Tsirkin <m...@redhat.com>
Cc: Cindy Lu <l...@redhat.com>
Signed-off-by: David Hildenbrand <da...@redhat.com>
Acked-by: Jason Wang <jasow...@redhat.com>
---
Note: I was not actually able to reproduce/test as I fail to get the
vdpa_sim/vdpa_sim_net running on upstream Linux (whetever vdpa, vhost_vdpa,
vdpa_sim, vdpa_sim_net modules I probe, and in which order, no vdpa devices
appear under /sys/bus/vdpa/devices/ or /dev/).
The device creation was switched to use vdpa tool that is integrated
with iproue2[1].
[1]
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=143610383da51e1f868c6d5a2a5e2fb552293d18
It would be great to document that somewhere if not already done. I only
found older RH documentations that were not aware of that. I'll give it
a try - thanks!
Seems to work just fine:
$ sudo ./build/qemu-system-x86_64 -m 2G,maxmem=4G --enable-kvm -object
memory-backend-ram,id=mem0,size=2G -device
virtio-mem-pci,id=vmem0,memdev=mem0,node=0,requested-size=0G -netdev
type=vhost-vdpa,vhostdev=/dev/vhost-vdpa-0,id=vhost-vdpa1 -device
virtio-net-pci,netdev=vhost-vdpa1,mac=00:e8:ca:33:ba:05,disable-modern=off,page-per-vq=on
-nographic
qemu-system-x86_64: -device
virtio-mem-pci,id=vmem0,memdev=mem0,node=0,requested-size=0G: Discarding RAM is
disabled
I think the -netdev is always processed/initialized before the
"-device virtio-mem-pci", which is why we always fail from virtio-mem code
right now and not from vhost-vdpa code.
--
Thanks,
David / dhildenb