All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V5 00/12] Add support for binding guest numa nodes to host numa nodes
@ 2013-07-17  9:29 Wanlong Gao
  2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 01/12] NUMA: add NumaOptions, NumaNodeOptions and NumaMemOptions Wanlong Gao
                   ` (11 more replies)
  0 siblings, 12 replies; 34+ messages in thread
From: Wanlong Gao @ 2013-07-17  9:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: aliguori, ehabkost, lersek, peter.huangpeng, lcapitulino, bsd,
	y-goto, pbonzini, afaerber, gaowanlong

As you know, QEMU can't direct it's memory allocation now, this may cause
guest cross node access performance regression.
And, the worse thing is that if PCI-passthrough is used,
direct-attached-device uses DMA transfer between device and qemu process.
All pages of the guest will be pinned by get_user_pages().

KVM_ASSIGN_PCI_DEVICE ioctl
  kvm_vm_ioctl_assign_device()
    =>kvm_assign_device()
      => kvm_iommu_map_memslots()
        => kvm_iommu_map_pages()
           => kvm_pin_pages()

So, with direct-attached-device, all guest page's page count will be +1 and
any page migration will not work. AutoNUMA won't too.

So, we should set the guest nodes memory allocation policy before
the pages are really mapped.

According to this patch set, we are able to set guest nodes memory policy
like following:

 -numa node,nodeid=0,cpus=0, \
 -numa mem,size=1024M,policy=membind,host-nodes=0-1 \
 -numa node,nodeid=1,cpus=1 \
 -numa mem,size=1024M,policy=interleave,host-nodes=1

This supports "policy={membind|interleave|preferred},host-nodes=[+|!]{all|N-N}" like format.

And patch 9/12 adds a QMP command "set-mem-policy" to set the memory policy
for every guest nodes:
    set-mem-policy nodeid=0 policy=membind host-nodes=0-1

And patch 10/12 adds a monitor command "set-mem-policy" whose format like:
    set-mem-policy 0 policy=membind,host-nodes=0-1

And patch 11/12 adds a QMP command "query-numa" to show numa info through
this API.

And patch 12/12 converts the "info numa" monitor command to use this
QMP command "query-numa".


V1->V2:
    change to use QemuOpts in numa options (Paolo)
    handle Error in mpol parser (Paolo)
    change qmp command format to mem-policy=membind,mem-hostnode=0-1 like (Paolo)
V2->V3:
    also handle Error in cpus parser (5/10)
    split out common parser from cpus and hostnode parser (Bandan 6/10)
V3-V4:
    rebase to request for comments
V4->V5:
    use OptVisitor and split -numa option (Paolo)
     - s/set-mpol/set-mem-policy (Andreas)
     - s/mem-policy/policy
     - s/mem-hostnode/host-nodes
    fix hmp command process after error (Luiz)
    add qmp command query-numa and convert info numa to it (Luiz)


Wanlong Gao (12):
  NUMA: add NumaOptions, NumaNodeOptions and NumaMemOptions
  NUMA: split -numa option
  NUMA: move numa related code to numa.c
  NUMA: Add numa_info structure to contain numa nodes info
  NUMA: Add Linux libnuma detection
  NUMA: parse guest numa nodes memory policy
  NUMA: split out the common range parser
  NUMA: set guest numa nodes memory policy
  NUMA: add qmp command set-mem-policy to set memory policy for NUMA
    node
  NUMA: add hmp command set-mem-policy
  NUMA: add qmp command query-numa
  NUMA: convert hmp command info_numa to use qmp command query_numa

 Makefile.target         |   2 +-
 configure               |  32 +++
 cpus.c                  |  14 --
 hmp-commands.hx         |  16 ++
 hmp.c                   |  70 +++++++
 hmp.h                   |   2 +
 hw/i386/pc.c            |   4 +-
 hw/net/eepro100.c       |   1 -
 include/sysemu/cpus.h   |   1 -
 include/sysemu/sysemu.h |  20 +-
 monitor.c               |  21 +-
 numa.c                  | 513 ++++++++++++++++++++++++++++++++++++++++++++++++
 qapi-schema.json        | 103 ++++++++++
 qemu-options.hx         |   6 +-
 qmp-commands.hx         |  84 ++++++++
 vl.c                    | 157 ++-------------
 16 files changed, 861 insertions(+), 185 deletions(-)
 create mode 100644 numa.c

-- 
1.8.3.2.634.g7a3187e

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2013-07-17 15:55 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-17  9:29 [Qemu-devel] [PATCH V5 00/12] Add support for binding guest numa nodes to host numa nodes Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 01/12] NUMA: add NumaOptions, NumaNodeOptions and NumaMemOptions Wanlong Gao
2013-07-17 10:35   ` Laszlo Ersek
2013-07-17 11:11     ` Paolo Bonzini
2013-07-17 13:16       ` Wanlong Gao
2013-07-17 12:24     ` Eric Blake
2013-07-17 13:57       ` Laszlo Ersek
2013-07-17 14:20         ` Paolo Bonzini
2013-07-17 14:33           ` Laszlo Ersek
2013-07-17 14:44             ` Paolo Bonzini
2013-07-17 15:24               ` Laszlo Ersek
2013-07-17 15:26                 ` Paolo Bonzini
2013-07-17 15:45                   ` Laszlo Ersek
2013-07-17 15:54                     ` Paolo Bonzini
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 02/12] NUMA: split -numa option Wanlong Gao
2013-07-17 11:00   ` Laszlo Ersek
2013-07-17 11:14     ` Paolo Bonzini
2013-07-17 11:13   ` Paolo Bonzini
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 03/12] NUMA: move numa related code to numa.c Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 04/12] NUMA: Add numa_info structure to contain numa nodes info Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 05/12] NUMA: Add Linux libnuma detection Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 06/12] NUMA: parse guest numa nodes memory policy Wanlong Gao
2013-07-17 12:31   ` Eric Blake
2013-07-17 13:12     ` Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 07/12] NUMA: split out the common range parser Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 08/12] NUMA: set guest numa nodes memory policy Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 09/12] NUMA: add qmp command set-mem-policy to set memory policy for NUMA node Wanlong Gao
2013-07-17 12:36   ` Eric Blake
2013-07-17 13:22     ` Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 10/12] NUMA: add hmp command set-mem-policy Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 11/12] NUMA: add qmp command query-numa Wanlong Gao
2013-07-17 12:41   ` Eric Blake
2013-07-17 13:24     ` Wanlong Gao
2013-07-17  9:29 ` [Qemu-devel] [PATCH V5 12/12] NUMA: convert hmp command info_numa to use qmp command query_numa Wanlong Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.