1. 03 7月, 2020 2 次提交
    • D
      virtio-pci: Proxy for virtio-mem · 0b9a2443
      David Hildenbrand 提交于
      Let's add a proxy for virtio-mem, make it a memory device, and
      pass-through the properties.
      Reviewed-by: NPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-12-david@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      0b9a2443
    • D
      virtio-mem: Paravirtualized memory hot(un)plug · 910b2576
      David Hildenbrand 提交于
      This is the very basic/initial version of virtio-mem. An introduction to
      virtio-mem can be found in the Linux kernel driver [1]. While it can be
      used in the current state for hotplug of a smaller amount of memory, it
      will heavily benefit from resizeable memory regions in the future.
      
      Each virtio-mem device manages a memory region (provided via a memory
      backend). After requested by the hypervisor ("requested-size"), the
      guest can try to plug/unplug blocks of memory within that region, in order
      to reach the requested size. Initially, and after a reboot, all memory is
      unplugged (except in special cases - reboot during postcopy).
      
      The guest may only try to plug/unplug blocks of memory within the usable
      region size. The usable region size is a little bigger than the
      requested size, to give the device driver some flexibility. The usable
      region size will only grow, except on reboots or when all memory is
      requested to get unplugged. The guest can never plug more memory than
      requested. Unplugged memory will get zapped/discarded, similar to in a
      balloon device.
      
      The block size is variable, however, it is always chosen in a way such that
      THP splits are avoided (e.g., 2MB). The state of each block
      (plugged/unplugged) is tracked in a bitmap.
      
      As virtio-mem devices (e.g., virtio-mem-pci) will be memory devices, we now
      expose "VirtioMEMDeviceInfo" via "query-memory-devices".
      
      --------------------------------------------------------------------------
      
      There are two important follow-up items that are in the works:
      1. Resizeable memory regions: Use resizeable allocations/RAM blocks to
         grow/shrink along with the usable region size. This avoids creating
         initially very big VMAs, RAM blocks, and KVM slots.
      2. Protection of unplugged memory: Make sure the gust cannot actually
         make use of unplugged memory.
      
      Other follow-up items that are in the works:
      1. Exclude unplugged memory during migration (via precopy notifier).
      2. Handle remapping of memory.
      3. Support for other architectures.
      
      --------------------------------------------------------------------------
      
      Example usage (virtio-mem-pci is introduced in follow-up patches):
      
      Start QEMU with two virtio-mem devices (one per NUMA node):
       $ qemu-system-x86_64 -m 4G,maxmem=20G \
        -smp sockets=2,cores=2 \
        -numa node,nodeid=0,cpus=0-1 -numa node,nodeid=1,cpus=2-3 \
        [...]
        -object memory-backend-ram,id=mem0,size=8G \
        -device virtio-mem-pci,id=vm0,memdev=mem0,node=0,requested-size=0M \
        -object memory-backend-ram,id=mem1,size=8G \
        -device virtio-mem-pci,id=vm1,memdev=mem1,node=1,requested-size=1G
      
      Query the configuration:
       (qemu) info memory-devices
       Memory device [virtio-mem]: "vm0"
         memaddr: 0x140000000
         node: 0
         requested-size: 0
         size: 0
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem0
       Memory device [virtio-mem]: "vm1"
         memaddr: 0x340000000
         node: 1
         requested-size: 1073741824
         size: 1073741824
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem1
      
      Add some memory to node 0:
       (qemu) qom-set vm0 requested-size 500M
      
      Remove some memory from node 1:
       (qemu) qom-set vm1 requested-size 200M
      
      Query the configuration again:
       (qemu) info memory-devices
       Memory device [virtio-mem]: "vm0"
         memaddr: 0x140000000
         node: 0
         requested-size: 524288000
         size: 524288000
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem0
       Memory device [virtio-mem]: "vm1"
         memaddr: 0x340000000
         node: 1
         requested-size: 209715200
         size: 209715200
         max-size: 8589934592
         block-size: 2097152
         memdev: /objects/mem1
      
      [1] https://lkml.kernel.org/r/20200311171422.10484-1-david@redhat.com
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Message-Id: <20200626072248.78761-11-david@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      910b2576
  2. 12 6月, 2020 3 次提交
  3. 27 2月, 2020 2 次提交
  4. 18 12月, 2019 1 次提交
  5. 06 10月, 2019 2 次提交
  6. 05 7月, 2019 1 次提交
    • P
      virtio-pci: Proxy for virtio-pmem · adf0748a
      Pankaj Gupta 提交于
      We need a proxy device for virtio-pmem, and this device has to be the
      actual memory device so we can cleanly hotplug it.
      
      Forward memory device class functions either to the actual device or use
      properties of the virtio-pmem device to implement these in the proxy.
      
      virtio-pmem will only be compiled for selected, supported architectures
      (that can deal with virtio/pci devices being memory devices). An
      architecture that is prepared for that can simply enable
      CONFIG_VIRTIO_PMEM to make it work.
      
      As not all architectures support memory devices (and CONFIG_VIRTIO_PMEM
      will be enabled per supported architecture), we have to move the PCI proxy
      to a separate file.
      Signed-off-by: NPankaj Gupta <pagupta@redhat.com>
      [ split up patches, memory-device changes, move pci proxy]
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Message-Id: <20190619094907.10131-5-pagupta@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      adf0748a
  7. 03 7月, 2019 1 次提交
    • P
      virtio-pmem: add virtio device · 5f503cd9
      Pankaj Gupta 提交于
      This is the implementation of virtio-pmem device. Support will require
      machine changes for the architectures that will support it, so it will
      not yet be compiled. It can be unlocked with VIRTIO_PMEM_SUPPORTED per
      machine and disabled globally via VIRTIO_PMEM.
      
      We cannot use the "addr" property as that is already used e.g. for
      virtio-pci/pci devices. And we will have e.g. virtio-pmem-pci as a proxy.
      So we have to choose a different one (unfortunately). "memaddr" it is.
      That name should ideally be used by all other virtio-* based memory
      devices in the future.
          -device virtio-pmem-pci,id=p0,bus=bux0,addr=0x01,memaddr=0x1000000...
      Acked-by: NMarkus Armbruster <armbru@redhat.com>
      [ QAPI bits ]
      Signed-off-by: NPankaj Gupta <pagupta@redhat.com>
      [ MemoryDevice/MemoryRegion changes, cleanups, addr property "memaddr",
        split up patches, unplug handler ]
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Message-Id: <20190619094907.10131-2-pagupta@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      5f503cd9
  8. 10 5月, 2019 1 次提交
    • M
      Add vhost-user-input-pci · 9c4d05b7
      Marc-André Lureau 提交于
      Add a new virtio-input device, which connects to a vhost-user
      backend.
      
      Instead of reading configuration directly from an input device /
      evdev (like virtio-input-host), it reads it over vhost-user protocol
      with {SET,GET}_CONFIG messages. The vhost-user-backend handles the
      queues & events setup.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-id: 20190503130034.24916-5-marcandre.lureau@redhat.com
      
      [ kraxel: drop -{non-,}transitional variants ]
      [ kraxel: fix "make check" on !linux ]
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9c4d05b7
  9. 08 3月, 2019 1 次提交
  10. 22 2月, 2019 2 次提交
  11. 05 2月, 2019 1 次提交
  12. 18 1月, 2019 13 次提交
  13. 01 6月, 2018 1 次提交
  14. 25 5月, 2018 1 次提交
  15. 17 1月, 2017 1 次提交
  16. 02 11月, 2016 2 次提交
  17. 10 9月, 2016 1 次提交
  18. 25 2月, 2016 1 次提交
  19. 16 2月, 2015 1 次提交
  20. 22 9月, 2014 1 次提交
  21. 19 6月, 2014 1 次提交
    • N
      Add vhost-user as a vhost backend. · 5f6f6664
      Nikolay Nikolaev 提交于
      The initialization takes a chardev backed by a unix domain socket.
      It should implement qemu_fe_set_msgfds in order to be able to pass
      file descriptors to the remote process.
      
      Each ioctl request of vhost-kernel has a vhost-user message equivalent,
      which is sent over the control socket.
      
      The general approach is to copy the data from the supplied argument
      pointer to a designated field in the message. If a file descriptor is
      to be passed it will be placed in the fds array for inclusion in
      the sendmsg control header.
      
      VHOST_SET_MEM_TABLE ignores the supplied vhost_memory structure and scans
      the global ram_list for ram blocks with a valid fd field set. This would
      be set when the '-object memory-file' option with share=on property is used.
      Signed-off-by: NAntonios Motakis <a.motakis@virtualopensystems.com>
      Signed-off-by: NNikolay Nikolaev <n.nikolaev@virtualopensystems.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      5f6f6664