qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 615cf6: error: only prepend timestamp on stde


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 615cf6: error: only prepend timestamp on stderr
Date: Fri, 18 Sep 2015 09:00:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 615cf669b55a689f9e535ecf87075e50004b6e0a
      
https://github.com/qemu/qemu/commit/615cf669b55a689f9e535ecf87075e50004b6e0a
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M util/qemu-error.c

  Log Message:
  -----------
  error: only prepend timestamp on stderr

The -msg timestamp=on option prepends a timestamp to error messages.
This is useful on stderr where it allows users to identify when an error
was raised.

Timestamps do not make sense on the monitor since error_report() is
called in response to a synchronous monitor command and the user already
knows "when" the command was issued.  Additionally, the rest of the
monitor conversation lacks timestamps so the error timestamp cannot be
correlated with other activity.

Only prepend timestamps on stderr.  This fixes libvirt's 'drive_del'
processing, which did not expect a timestamp.  Other QEMU monitor
clients are probably equally confused by timestamps on monitor error
messages.

Cc: Markus Armbruster <address@hidden>
Cc: Seiji Aguchi <address@hidden>
Cc: Frank Schreuder <address@hidden>
Cc: Daniel P. Berrange <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Tested-by: Frank Schreuder <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 50b7b000c9171c1253c1c875f46f654c3c0e1fc8
      
https://github.com/qemu/qemu/commit/50b7b000c9171c1253c1c875f46f654c3c0e1fc8
  Author: Eric Blake <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M include/qapi/error.h
    M qdev-monitor.c
    M util/error.c
    M util/qemu-option.c

  Log Message:
  -----------
  hmp: Allow for error message hints on HMP

Commits 7216ae3d and d2828429 disabled some error message hints,
all because a change to use modern error reporting meant that the
hint would be output prior to the actual error.  Fix this by making
hints a first-class member of Error.

For example, we are now back to the pleasant:

 $ qemu-system-x86_64 --nodefaults -S --vnc :0 --chardev null,id=,
 qemu-system-x86_64: --chardev null,id=,: Parameter 'id' expects an identifier
 Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 88e2ce291595ed8f12636b40523fdb215a9d3374
      
https://github.com/qemu/qemu/commit/88e2ce291595ed8f12636b40523fdb215a9d3374
  Author: Eric Blake <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M util/error.c

  Log Message:
  -----------
  error: Copy location information in error_copy()

Commit 1e9b65bb forgot to propagate source information to copied
errors.

Signed-off-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>


  Commit: 4f966768acd1d677d24d60a01c160c18a09cce80
      
https://github.com/qemu/qemu/commit/4f966768acd1d677d24d60a01c160c18a09cce80
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  MAINTAINERS: Add "Error reporting" entry

Error reporting work has been flowing through my tree for a while.
Time for MAINTAINERS to catch up.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>


  Commit: a29a37b994ca3c5a1d39fa0e8934f7e0f2cf57ef
      
https://github.com/qemu/qemu/commit/a29a37b994ca3c5a1d39fa0e8934f7e0f2cf57ef
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M include/qapi/error.h
    M util/error.c

  Log Message:
  -----------
  error: New error_fatal

Similar to error_abort, but doesn't report where the error was
created, and terminates the process with exit(1) rather than abort().

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>


  Commit: f8ed85ac992c48814d916d5df4d44f9a971c5de4
      
https://github.com/qemu/qemu/commit/f8ed85ac992c48814d916d5df4d44f9a971c5de4
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M hw/arm/armv7m.c
    M hw/arm/exynos4210.c
    M hw/arm/highbank.c
    M hw/arm/integratorcp.c
    M hw/arm/mainstone.c
    M hw/arm/musicpal.c
    M hw/arm/omap1.c
    M hw/arm/omap2.c
    M hw/arm/omap_sx1.c
    M hw/arm/palm.c
    M hw/arm/pxa2xx.c
    M hw/arm/realview.c
    M hw/arm/spitz.c
    M hw/arm/stellaris.c
    M hw/arm/stm32f205_soc.c
    M hw/arm/tosa.c
    M hw/arm/vexpress.c
    M hw/arm/xilinx_zynq.c
    M hw/arm/xlnx-zynqmp.c
    M hw/block/onenand.c
    M hw/cris/axis_dev88.c
    M hw/display/cg3.c
    M hw/display/qxl.c
    M hw/display/sm501.c
    M hw/display/tc6393xb.c
    M hw/display/tcx.c
    M hw/display/vga.c
    M hw/display/vmware_vga.c
    M hw/i386/pc.c
    M hw/i386/pc_sysfw.c
    M hw/input/milkymist-softusb.c
    M hw/m68k/an5206.c
    M hw/m68k/mcf5208.c
    M hw/microblaze/petalogix_ml605_mmu.c
    M hw/microblaze/petalogix_s3adsp1800_mmu.c
    M hw/mips/mips_fulong2e.c
    M hw/mips/mips_jazz.c
    M hw/mips/mips_malta.c
    M hw/mips/mips_mipssim.c
    M hw/mips/mips_r4k.c
    M hw/moxie/moxiesim.c
    M hw/net/milkymist-minimac2.c
    M hw/openrisc/openrisc_sim.c
    M hw/pci-host/prep.c
    M hw/pci/pci.c
    M hw/ppc/mac_newworld.c
    M hw/ppc/mac_oldworld.c
    M hw/ppc/ppc405_boards.c
    M hw/ppc/ppc405_uc.c
    M hw/s390x/s390-virtio-ccw.c
    M hw/s390x/sclp.c
    M hw/sh4/r2d.c
    M hw/sh4/shix.c
    M hw/sparc/leon3.c
    M hw/sparc/sun4m.c
    M hw/sparc64/sun4u.c
    M hw/tricore/tricore_testboard.c
    M hw/unicore32/puv3.c
    M hw/xtensa/sim.c
    M hw/xtensa/xtfpga.c
    M numa.c
    M xen-hvm.c

  Log Message:
  -----------
  Fix bad error handling after memory_region_init_ram()

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 ef701d7 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 3922825 "exec: Don't
abort when we can't allocate guest memory".

The three places are:

* memory_region_init_ram()

  Commit 4994653 (right after commit ef701d7) 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 33e0eb5 (soon after commit
  ef701d7) 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
    |
                             address@hidden
    )
                            );
    @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 ef701d7's damage.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>


  Commit: df8abec8cb48f6c439516fd78b3ab6535e6fd493
      
https://github.com/qemu/qemu/commit/df8abec8cb48f6c439516fd78b3ab6535e6fd493
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M hw/core/loader.c

  Log Message:
  -----------
  loader: Fix memory_region_init_resizeable_ram() error handling

Commit ef701d7 screwed up handling of out-of-memory conditions.
Before the commit, we report the error and exit(1), in one place.  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 3922825 "exec: Don't abort when we can't allocate guest
memory".

The previous commit fixed up uses of memory_region_init_ram().  One of
them was replaced by memory_region_init_resizeable_ram() [sic!] in
commit a166614, so Coccinelle missed it.  Fix it up.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>


  Commit: 0bdaa3a429c6d07cd437b442a1f15f70be1addaa
      
https://github.com/qemu/qemu/commit/0bdaa3a429c6d07cd437b442a1f15f70be1addaa
  Author: Markus Armbruster <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M memory.c

  Log Message:
  -----------
  memory: Fix bad error handling in memory_region_init_ram_ptr()

Commit ef701d7 screwed up handling of out-of-memory conditions.
Before the commit, we report the error and exit(1), in one place.  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 3922825 "exec: Don't abort when we can't allocate guest
memory".

The previous two commits fixed one of the three places, another one
was fixed in commit 33e0eb5.  This commit fixes the third one.

Signed-off-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Peter Crosthwaite <address@hidden>


  Commit: ffa4822c015d5670ef6a2239f3cbd2ff2cec57de
      
https://github.com/qemu/qemu/commit/ffa4822c015d5670ef6a2239f3cbd2ff2cec57de
  Author: Peter Maydell <address@hidden>
  Date:   2015-09-18 (Fri, 18 Sep 2015)

  Changed paths:
    M MAINTAINERS
    M hw/arm/armv7m.c
    M hw/arm/exynos4210.c
    M hw/arm/highbank.c
    M hw/arm/integratorcp.c
    M hw/arm/mainstone.c
    M hw/arm/musicpal.c
    M hw/arm/omap1.c
    M hw/arm/omap2.c
    M hw/arm/omap_sx1.c
    M hw/arm/palm.c
    M hw/arm/pxa2xx.c
    M hw/arm/realview.c
    M hw/arm/spitz.c
    M hw/arm/stellaris.c
    M hw/arm/stm32f205_soc.c
    M hw/arm/tosa.c
    M hw/arm/vexpress.c
    M hw/arm/xilinx_zynq.c
    M hw/arm/xlnx-zynqmp.c
    M hw/block/onenand.c
    M hw/core/loader.c
    M hw/cris/axis_dev88.c
    M hw/display/cg3.c
    M hw/display/qxl.c
    M hw/display/sm501.c
    M hw/display/tc6393xb.c
    M hw/display/tcx.c
    M hw/display/vga.c
    M hw/display/vmware_vga.c
    M hw/i386/pc.c
    M hw/i386/pc_sysfw.c
    M hw/input/milkymist-softusb.c
    M hw/m68k/an5206.c
    M hw/m68k/mcf5208.c
    M hw/microblaze/petalogix_ml605_mmu.c
    M hw/microblaze/petalogix_s3adsp1800_mmu.c
    M hw/mips/mips_fulong2e.c
    M hw/mips/mips_jazz.c
    M hw/mips/mips_malta.c
    M hw/mips/mips_mipssim.c
    M hw/mips/mips_r4k.c
    M hw/moxie/moxiesim.c
    M hw/net/milkymist-minimac2.c
    M hw/openrisc/openrisc_sim.c
    M hw/pci-host/prep.c
    M hw/pci/pci.c
    M hw/ppc/mac_newworld.c
    M hw/ppc/mac_oldworld.c
    M hw/ppc/ppc405_boards.c
    M hw/ppc/ppc405_uc.c
    M hw/s390x/s390-virtio-ccw.c
    M hw/s390x/sclp.c
    M hw/sh4/r2d.c
    M hw/sh4/shix.c
    M hw/sparc/leon3.c
    M hw/sparc/sun4m.c
    M hw/sparc64/sun4u.c
    M hw/tricore/tricore_testboard.c
    M hw/unicore32/puv3.c
    M hw/xtensa/sim.c
    M hw/xtensa/xtfpga.c
    M include/qapi/error.h
    M memory.c
    M numa.c
    M qdev-monitor.c
    M util/error.c
    M util/qemu-error.c
    M util/qemu-option.c
    M xen-hvm.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-09-18' into 
staging

Error reporting patches

# gpg: Signature made Fri 18 Sep 2015 13:42:49 BST using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <address@hidden>"
# gpg:                 aka "Markus Armbruster <address@hidden>"

* remotes/armbru/tags/pull-error-2015-09-18:
  memory: Fix bad error handling in memory_region_init_ram_ptr()
  loader: Fix memory_region_init_resizeable_ram() error handling
  Fix bad error handling after memory_region_init_ram()
  error: New error_fatal
  MAINTAINERS: Add "Error reporting" entry
  error: Copy location information in error_copy()
  hmp: Allow for error message hints on HMP
  error: only prepend timestamp on stderr

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/3bf1f5ec6a7e...ffa4822c015d

reply via email to

[Prev in Thread] Current Thread [Next in Thread]