1. 02 9月, 2020 3 次提交
    • D
      virtio-mem: Don't rely on implicit compiler padding for requests · 8e6d8cc8
      David Hildenbrand 提交于
      task #29077503
      commit fce8afd76e3a4d8c59c92f84f8027569fd7031d0 upstream
      The compiler will add padding after the last member, make that explicit.
      The size of a request is always 24 bytes. The size of a response always
      10 bytes. Add compile-time checks.
      
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: teawater <teawaterz@linux.alibaba.com>
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/r/20200515101402.16597-1-david@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      (cherry picked from ccommit fce8afd76e3a4d8c59c92f84f8027569fd7031d0)
      Signed-off-by: NAlex Shi <alex.shi@linux.alibaba.com>
      Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
      8e6d8cc8
    • D
      virtio-mem: Allow to specify an ACPI PXM as nid · c9f36272
      David Hildenbrand 提交于
      task #29077503
      commit f2af6d3978d74a7891d0f428537b4494498202cb upstream
      virtio-mem device (and, therefore, its memory) belongs. Add a new
      virtio-mem feature flag and export pxm_to_node, so it can be used in kernel
      module context.
      
      Acked-by: Michal Hocko <mhocko@suse.com> # for the export
      Acked-by: "Rafael J. Wysocki" <rafael@kernel.org> # for the export
      Acked-by: NPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Tested-by: NPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Len Brown <lenb@kernel.org>
      Cc: linux-acpi@vger.kernel.org
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/r/20200507140139.17083-4-david@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      (cherry picked from ccommit f2af6d3978d74a7891d0f428537b4494498202cb)
      Signed-off-by: NAlex Shi <alex.shi@linux.alibaba.com>
      
      Conflicts:
      	move drivers/acpi/numa/srat.c modification into
      	drivers/acpi/numa.c
      Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
      c9f36272
    • D
      virtio-mem: Paravirtualized memory hotplug · d3997ceb
      David Hildenbrand 提交于
      task #29077503
      commit 5f1f79bbc9e26fa9412fa9522f957bb8f030c442 upstream
      for adding/removing memory from that memory region on request.
      
      When the device driver starts up, the requested amount of memory is
      queried and then plugged to Linux. On request, further memory can be
      plugged or unplugged. This patch only implements the plugging part.
      
      On x86-64, memory can currently be plugged in 4MB ("subblock") granularity.
      When required, a new memory block will be added (e.g., usually 128MB on
      x86-64) in order to plug more subblocks. Only x86-64 was tested for now.
      
      The online_page callback is used to keep unplugged subblocks offline
      when onlining memory - similar to the Hyper-V balloon driver. Unplugged
      pages are marked PG_offline, to tell dump tools (e.g., makedumpfile) to
      skip them.
      
      User space is usually responsible for onlining the added memory. The
      memory hotplug notifier is used to synchronize virtio-mem activity
      against memory onlining/offlining.
      
      Each virtio-mem device can belong to a NUMA node, which allows us to
      easily add/remove small chunks of memory to/from a specific NUMA node by
      using multiple virtio-mem devices. Something that works even when the
      guest has no idea about the NUMA topology.
      
      One way to view virtio-mem is as a "resizable DIMM" or a DIMM with many
      "sub-DIMMS".
      
      This patch directly introduces the basic infrastructure to implement memory
      unplug. Especially the memory block states and subblock bitmaps will be
      heavily used there.
      
      Notes:
      - In case memory is to be onlined by user space, we limit the amount of
        offline memory blocks, to not run out of memory. This is esp. an
        issue if memory is added faster than it is getting onlined.
      - Suspend/Hibernate is not supported due to the way virtio-mem devices
        behave. Limited support might be possible in the future.
      - Reloading the device driver is not supported.
      Reviewed-by: NPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Tested-by: NPankaj Gupta <pankaj.gupta.linux@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
      Cc: Stefan Hajnoczi <stefanha@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: linux-acpi@vger.kernel.org
      Signed-off-by: NDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/r/20200507140139.17083-2-david@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      (cherry picked from ccommit 5f1f79bbc9e26fa9412fa9522f957bb8f030c442)
      Signed-off-by: NAlex Shi <alex.shi@linux.alibaba.com>
      
      Conflicts:
      	drivers/virtio/Makefile
      	include/uapi/linux/virtio_ids.h
      Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
      d3997ceb