1. 13 1月, 2016 1 次提交
    • M
      Use error_fatal to simplify obvious fatal errors · 007b0657
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch:
      
          @@
          type T;
          identifier FUN, RET;
          expression list ARGS;
          expression ERR, EC;
          @@
          (
          -    T RET = FUN(ARGS, &ERR);
          +    T RET = FUN(ARGS, &error_fatal);
          |
          -    RET = FUN(ARGS, &ERR);
          +    RET = FUN(ARGS, &error_fatal);
          |
          -    FUN(ARGS, &ERR);
          +    FUN(ARGS, &error_fatal);
          )
          -    if (ERR != NULL) {
          -        error_report_err(ERR);
          -        exit(EC);
          -    }
      
      This is actually a more elegant version of my initial semantic patch
      by courtesy of Eduardo.
      
      It leaves dead Error * variables behind, cleaned up manually.
      
      Cc: qemu-arm@nongnu.org
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      007b0657
  2. 19 12月, 2015 1 次提交
  3. 02 11月, 2015 1 次提交
    • E
      memory: Convert to new qapi union layout · 1fd5d4fe
      Eric Blake 提交于
      We have two issues with our qapi union layout:
      1) Even though the QMP wire format spells the tag 'type', the
      C code spells it 'kind', requiring some hacks in the generator.
      2) The C struct uses an anonymous union, which places all tag
      values in the same namespace as all non-variant members. This
      leads to spurious collisions if a tag value matches a non-variant
      member's name.
      
      Make the conversion to the new layout for memory-related code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1445898903-12082-21-git-send-email-eblake@redhat.com>
      [Commit message tweaked slightly]
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      1fd5d4fe
  4. 18 9月, 2015 1 次提交
    • M
      Fix bad error handling after memory_region_init_ram() · f8ed85ac
      Markus Armbruster 提交于
      Symptom:
      
          $ qemu-system-x86_64 -m 10000000
          Unexpected error in ram_block_add() at /work/armbru/qemu/exec.c:1456:
          upstream-qemu: cannot set up guest memory 'pc.ram': Cannot allocate memory
          Aborted (core dumped)
      
      Root cause: commit ef701d7b screwed up handling of out-of-memory
      conditions.  Before the commit, we report the error and exit(1), in
      one place, ram_block_add().  The commit lifts the error handling up
      the call chain some, to three places.  Fine.  Except it uses
      &error_abort in these places, changing the behavior from exit(1) to
      abort(), and thus undoing the work of commit 39228250 "exec: Don't
      abort when we can't allocate guest memory".
      
      The three places are:
      
      * memory_region_init_ram()
      
        Commit 49946538 (right after commit ef701d7b) lifted the error
        handling further, through memory_region_init_ram(), multiplying the
        incorrect use of &error_abort.  Later on, imitation of existing
        (bad) code may have created more.
      
      * memory_region_init_ram_ptr()
      
        The &error_abort is still there.
      
      * memory_region_init_rom_device()
      
        Doesn't need fixing, because commit 33e0eb52 (soon after commit
        ef701d7b) lifted the error handling further, and in the process
        changed it from &error_abort to passing it up the call chain.
        Correct, because the callers are realize() methods.
      
      Fix the error handling after memory_region_init_ram() with a
      Coccinelle semantic patch:
      
          @r@
          expression mr, owner, name, size, err;
          position p;
          @@
                  memory_region_init_ram(mr, owner, name, size,
          (
          -                              &error_abort
          +                              &error_fatal
          |
                                         err@p
          )
                                        );
          @script:python@
              p << r.p;
          @@
          print "%s:%s:%s" % (p[0].file, p[0].line, p[0].column)
      
      When the last argument is &error_abort, it gets replaced by
      &error_fatal.  This is the fix.
      
      If the last argument is anything else, its position is reported.  This
      lets us check the fix is complete.  Four positions get reported:
      
      * ram_backend_memory_alloc()
      
        Error is passed up the call chain, ultimately through
        user_creatable_complete().  As far as I can tell, it's callers all
        handle the error sanely.
      
      * fsl_imx25_realize(), fsl_imx31_realize(), dp8393x_realize()
      
        DeviceClass.realize() methods, errors handled sanely further up the
        call chain.
      
      We're good.  Test case again behaves:
      
          $ qemu-system-x86_64 -m 10000000
          qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
          [Exit 1 ]
      
      The next commits will repair the rest of commit ef701d7b's damage.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1441983105-26376-3-git-send-email-armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <crosthwaite.peter@gmail.com>
      f8ed85ac
  5. 11 9月, 2015 1 次提交
  6. 16 7月, 2015 1 次提交
  7. 04 7月, 2015 3 次提交
  8. 23 6月, 2015 1 次提交
  9. 20 6月, 2015 2 次提交
  10. 09 6月, 2015 2 次提交
  11. 20 3月, 2015 5 次提交
    • E
      numa: Print warning if no node is assigned to a CPU · 549fc54b
      Eduardo Habkost 提交于
      We need all possible CPUs (including hotplug ones) to be present in the
      SRAT when QEMU starts. QEMU already does that correctly today, the only
      problem is that when a CPU is omitted from the NUMA configuration, it is
      silently assigned to node 0.
      
      Check if all CPUs up to max_cpus are present in the NUMA configuration
      and warn about missing CPUs.
      
      Make it just a warning, to allow management software to be updated if
      necessary. In the future we may make it a fatal error instead.
      
      Command-line examples:
      
      * Correct, no warning:
      
        $ qemu-system-x86_64 -smp 2,maxcpus=4
        $ qemu-system-x86_64 -smp 2,maxcpus=4 -numa node,cpus=0-3
      
      * Incomplete, with warnings:
      
        $ qemu-system-x86_64 -smp 2,maxcpus=4 -numa node,cpus=0
        qemu-system-x86_64: warning: CPU(s) not present in any NUMA nodes: 1 2 3
        qemu-system-x86_64: warning: All CPU(s) up to maxcpus should be described in NUMA config
      
        $ qemu-system-x86_64 -smp 2,maxcpus=4 -numa node,cpus=0-2
        qemu-system-x86_64: warning: CPU(s) not present in any NUMA nodes: 3
        qemu-system-x86_64: warning: All CPU(s) up to maxcpus should be described in NUMA config
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      ---
      v1 -> v2: (no changes)
      
      v2 -> v3:
       * Use enumerate_cpus() and error_report() for error message
       * Simplify logic using bitmap_full()
      
      v3 -> v4:
       * Clarify error message, mention that all CPUs up to
         maxcpus need to be described in NUMA config
      
      v4 -> v5:
       * Commit log update, to make problem description clearer
      549fc54b
    • I
      numa: introduce machine callback for VCPU to node mapping · 57924bcd
      Igor Mammedov 提交于
      Current default round-robin way of distributing VCPUs among
      NUMA nodes might be wrong in case on multi-core/threads
      CPUs. Making guests confused wrt topology where cores from
      the same socket are on different nodes.
      
      Allow a machine to override default mapping by providing
       MachineClass::cpu_index_to_socket_id()
      callback which would allow it group VCPUs from a socket
      on the same NUMA node.
      Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: NAndreas Färber <afaerber@suse.de>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      57924bcd
    • E
      numa: Reject configuration if CPU appears on multiple nodes · 3ef71975
      Eduardo Habkost 提交于
      Each CPU can appear in only one NUMA node on the NUMA config. Reject
      configuration if a CPU appears in multiple nodes.
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      3ef71975
    • E
      numa: Reject CPU indexes > max_cpus · 8979c945
      Eduardo Habkost 提交于
      CPU index is always less than max_cpus, as documented at sysemu.h:
      
      > The following shall be true for all CPUs:
      >   cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS
      
      Reject configuration which uses invalid CPU indexes.
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      8979c945
    • E
      numa: Fix off-by-one error at MAX_CPUMASK_BITS check · ed26b922
      Eduardo Habkost 提交于
      Fix the CPU index check to ensure we don't go beyond the size of the
      node_cpu bitmap.
      
      CPU index is always less than MAX_CPUMASK_BITS, as documented at
      sysemu.h:
      
      > The following shall be true for all CPUs:
      >   cpu->cpu_index < max_cpus <= MAX_CPUMASK_BITS
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      ed26b922
  12. 10 3月, 2015 1 次提交
  13. 24 2月, 2015 6 次提交
  14. 18 2月, 2015 1 次提交
  15. 11 11月, 2014 1 次提交
  16. 09 9月, 2014 1 次提交
  17. 03 9月, 2014 2 次提交
  18. 14 8月, 2014 1 次提交
  19. 06 7月, 2014 1 次提交
  20. 29 6月, 2014 5 次提交
  21. 19 6月, 2014 2 次提交