1. 24 5月, 2017 4 次提交
  2. 12 5月, 2017 4 次提交
    • I
      spapr: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() · 722387e7
      Igor Mammedov 提交于
      it's safe to remove thread node_id != core node_id error
      branch as machine_set_cpu_numa_node() also does mismatch
      check and is called even before any CPU is created.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Acked-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <1494415802-227633-10-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      722387e7
    • I
      spapr: add node-id property to sPAPR core · 0b8497f0
      Igor Mammedov 提交于
      it will allow switching from cpu_index to core based numa
      mapping in follow up patches.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Message-Id: <1494415802-227633-3-git-send-email-imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      0b8497f0
    • I
      numa: move source of default CPUs to NUMA node mapping into boards · ea089eeb
      Igor Mammedov 提交于
      Originally CPU threads were by default assigned in
      round-robin fashion. However it was causing issues in
      guest since CPU threads from the same socket/core could
      be placed on different NUMA nodes.
      Commit fb43b73b (pc: fix default VCPU to NUMA node mapping)
      fixed it by grouping threads within a socket on the same node
      introducing cpu_index_to_socket_id() callback and commit
      20bb648d (spapr: Fix default NUMA node allocation for threads)
      reused callback to fix similar issues for SPAPR machine
      even though socket doesn't make much sense there.
      
      As result QEMU ended up having 3 default distribution rules
      used by 3 targets /virt-arm, spapr, pc/.
      
      In effort of moving NUMA mapping for CPUs into possible_cpus,
      generalize default mapping in numa.c by making boards decide
      on default mapping and let them explicitly tell generic
      numa code to which node a CPU thread belongs to by replacing
      cpu_index_to_socket_id() with @cpu_index_to_instance_props()
      which provides default node_id assigned by board to specified
      cpu_index.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1494415802-227633-2-git-send-email-imammedo@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      ea089eeb
    • L
      numa: equally distribute memory on nodes · 3bfe5716
      Laurent Vivier 提交于
      When there are more nodes than available memory to put the minimum
      allowed memory by node, all the memory is put on the last node.
      
      This is because we put (ram_size / nb_numa_nodes) &
      ~((1 << mc->numa_mem_align_shift) - 1); on each node, and in this
      case the value is 0. This is particularly true with pseries,
      as the memory must be aligned to 256MB.
      
      To avoid this problem, this patch uses an error diffusion algorithm [1]
      to distribute equally the memory on nodes.
      
      We introduce numa_auto_assign_ram() function in MachineClass
      to keep compatibility between machine type versions.
      The legacy function is used with pseries-2.9, pc-q35-2.9 and
      pc-i440fx-2.9 (and previous), the new one with all others.
      
      Example:
      
      qemu-system-ppc64 -S -nographic  -nodefaults -monitor stdio -m 1G -smp 8 \
                        -numa node -numa node -numa node \
                        -numa node -numa node -numa node
      
      Before:
      
      (qemu) info numa
      6 nodes
      node 0 cpus: 0 6
      node 0 size: 0 MB
      node 1 cpus: 1 7
      node 1 size: 0 MB
      node 2 cpus: 2
      node 2 size: 0 MB
      node 3 cpus: 3
      node 3 size: 0 MB
      node 4 cpus: 4
      node 4 size: 0 MB
      node 5 cpus: 5
      node 5 size: 1024 MB
      
      After:
      (qemu) info numa
      6 nodes
      node 0 cpus: 0 6
      node 0 size: 0 MB
      node 1 cpus: 1 7
      node 1 size: 256 MB
      node 2 cpus: 2
      node 2 size: 0 MB
      node 3 cpus: 3
      node 3 size: 256 MB
      node 4 cpus: 4
      node 4 size: 256 MB
      node 5 cpus: 5
      node 5 size: 256 MB
      
      [1] https://en.wikipedia.org/wiki/Error_diffusionSigned-off-by: NLaurent Vivier <lvivier@redhat.com>
      Message-Id: <20170502162955.1610-2-lvivier@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      [ehabkost: s/ram_size/size/ at numa_default_auto_assign_ram()]
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      3bfe5716
  3. 11 5月, 2017 2 次提交
  4. 26 4月, 2017 11 次提交
  5. 03 4月, 2017 1 次提交
    • D
      pseries: Enforce homogeneous threads-per-core · 8149e299
      David Gibson 提交于
      For reasons that may be useful in future, CPU core objects, as used on the
      pseries machine type have their own nr-threads property, potentially
      allowing cores with different numbers of threads in the same system.
      
      If the user/management uses the values specified in query-hotpluggable-cpus
      as they're expected to do, this will never matter in pratice.  But that's
      not actually enforced - it's possible to manually specify a core with
      a different number of threads from that in -smp.  That will confuse the
      platform - most immediately, this can be used to create a CPU thread with
      index above max_cpus which leads to an assertion failure in
      spapr_cpu_core_realize().
      
      For now, enforce that all cores must have the same, standard, number of
      threads.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      8149e299
  6. 29 3月, 2017 1 次提交
    • M
      spapr: fix buffer-overflow · 24ec2863
      Marc-André Lureau 提交于
      Running postcopy-test with ASAN produces the following error:
      
      QTEST_QEMU_BINARY=ppc64-softmmu/qemu-system-ppc64  tests/postcopy-test
      ...
      =================================================================
      ==23641==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f1556600000 at pc 0x55b8e9d28208 bp 0x7f1555f4d3c0 sp 0x7f1555f4d3b0
      READ of size 8 at 0x7f1556600000 thread T6
          #0 0x55b8e9d28207 in htab_save_first_pass /home/elmarco/src/qq/hw/ppc/spapr.c:1528
          #1 0x55b8e9d2939c in htab_save_iterate /home/elmarco/src/qq/hw/ppc/spapr.c:1665
          #2 0x55b8e9beae3a in qemu_savevm_state_iterate /home/elmarco/src/qq/migration/savevm.c:1044
          #3 0x55b8ea677733 in migration_thread /home/elmarco/src/qq/migration/migration.c:1976
          #4 0x7f15845f46c9 in start_thread (/lib64/libpthread.so.0+0x76c9)
          #5 0x7f157d9d0f7e in clone (/lib64/libc.so.6+0x107f7e)
      
      0x7f1556600000 is located 0 bytes to the right of 2097152-byte region [0x7f1556400000,0x7f1556600000)
      allocated by thread T0 here:
          #0 0x7f159bb76980 in posix_memalign (/lib64/libasan.so.3+0xc7980)
          #1 0x55b8eab185b2 in qemu_try_memalign /home/elmarco/src/qq/util/oslib-posix.c:106
          #2 0x55b8eab186c8 in qemu_memalign /home/elmarco/src/qq/util/oslib-posix.c:122
          #3 0x55b8e9d268a8 in spapr_reallocate_hpt /home/elmarco/src/qq/hw/ppc/spapr.c:1214
          #4 0x55b8e9d26e04 in ppc_spapr_reset /home/elmarco/src/qq/hw/ppc/spapr.c:1261
          #5 0x55b8ea12e913 in qemu_system_reset /home/elmarco/src/qq/vl.c:1697
          #6 0x55b8ea13fa40 in main /home/elmarco/src/qq/vl.c:4679
          #7 0x7f157d8e9400 in __libc_start_main (/lib64/libc.so.6+0x20400)
      
      Thread T6 created by T0 here:
          #0 0x7f159bae0488 in __interceptor_pthread_create (/lib64/libasan.so.3+0x31488)
          #1 0x55b8eab1d9cb in qemu_thread_create /home/elmarco/src/qq/util/qemu-thread-posix.c:465
          #2 0x55b8ea67874c in migrate_fd_connect /home/elmarco/src/qq/migration/migration.c:2096
          #3 0x55b8ea66cbb0 in migration_channel_connect /home/elmarco/src/qq/migration/migration.c:500
          #4 0x55b8ea678f38 in socket_outgoing_migration /home/elmarco/src/qq/migration/socket.c:87
          #5 0x55b8eaa5a03a in qio_task_complete /home/elmarco/src/qq/io/task.c:142
          #6 0x55b8eaa599cc in gio_task_thread_result /home/elmarco/src/qq/io/task.c:88
          #7 0x7f15823e38e6  (/lib64/libglib-2.0.so.0+0x468e6)
      SUMMARY: AddressSanitizer: heap-buffer-overflow /home/elmarco/src/qq/hw/ppc/spapr.c:1528 in htab_save_first_pass
      
      index seems to be wrongly incremented, unless I miss something that
      would be worth a comment.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      24ec2863
  7. 22 3月, 2017 1 次提交
    • L
      numa,spapr: align default numa node memory size to 256MB · 55641213
      Laurent Vivier 提交于
      Since commit 224245bf ("spapr: Add LMB DR connectors"), NUMA node
      memory size must be aligned to 256MB (SPAPR_MEMORY_BLOCK_SIZE).
      
      But when "-numa" option is provided without "mem" parameter,
      the memory is equally divided between nodes, but 8MB aligned.
      This can be not valid for pseries.
      
      In that case we can have:
      $ ./ppc64-softmmu/qemu-system-ppc64 -m 4G -numa node -numa node -numa node
      qemu-system-ppc64: Node 0 memory size 0x55000000 is not aligned to 256 MiB
      
      With this patch, we have:
      (qemu) info numa
      3 nodes
      node 0 cpus: 0
      node 0 size: 1280 MB
      node 1 cpus:
      node 1 size: 1280 MB
      node 2 cpus:
      node 2 size: 1536 MB
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      55641213
  8. 14 3月, 2017 1 次提交
  9. 06 3月, 2017 1 次提交
  10. 03 3月, 2017 3 次提交
    • S
      spapr: Small cleanup of PPC MMU enums · ec975e83
      Sam Bobroff 提交于
      The PPC MMU types are sometimes treated as if they were a bit field
      and sometime as if they were an enum which causes maintenance
      problems: flipping bits in the MMU type (which is done on both the 1TB
      segment and 64K segment bits) currently produces new MMU type
      values that are not handled in every "switch" on it, sometimes causing
      an abort().
      
      This patch provides some macros that can be used to filter out the
      "bit field-like" bits so that the remainder of the value can be
      switched on, like an enum. This allows removal of all of the
      "degraded" types from the list and should ease maintenance.
      Signed-off-by: NSam Bobroff <sam.bobroff@au1.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ec975e83
    • S
      target/ppc/POWER9: Add POWER9 pa-features definition · 4975c098
      Suraj Jitindar Singh 提交于
      Add a pa-features definition which includes all of the new fields which
      have been added, note we don't claim support for any of these new features
      at this stage.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Acked-by: NBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      4975c098
    • S
      target/ppc: Add patb_entry to sPAPRMachineState · 9861bb3e
      Suraj Jitindar Singh 提交于
      ISA v3.00 adds the idea of a partition table which is used to store the
      address translation details for all partitions on the system. The partition
      table consists of double word entries indexed by partition id where the second
      double word contains the location of the process table in guest memory. The
      process table is registered by the guest via a h-call.
      
      We need somewhere to store the address of the process table so we add an entry
      to the sPAPRMachineState struct called patb_entry to represent the second
      doubleword of a single partition table entry corresponding to the current
      guest. We need to store this value so we know if the guest is using radix or
      hash translation and the location of the corresponding process table in guest
      memory. Since we only have a single guest per qemu instance, we only need one
      entry.
      
      Since the partition table is technically a hypervisor resource we require that
      access to it is abstracted by the virtual hypervisor through the get_patbe()
      call. Currently the value of the entry is never set (and thus
      defaults to 0 indicating hash), but it will be required to both implement
      POWER9 kvm support and tcg radix support.
      
      We also add this field to be migrated as part of the sPAPRMachineState as we
      will need it on the receiving side as the guest will never tell us this
      information again and we need it to perform translation.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      9861bb3e
  11. 01 3月, 2017 11 次提交