All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Coding style for errors
Date: Wed, 21 Oct 2015 21:16:39 +0100	[thread overview]
Message-ID: <CAFEAcA_bu5wKjL31EHHYMXUWRzbT1v4B0BmT6G=0OZ87BabgWw@mail.gmail.com> (raw)
In-Reply-To: <87si54i2w4.fsf@blackfin.pond.sub.org>

On 21 October 2015 at 17:48, Markus Armbruster <armbru@redhat.com> wrote:
> Lluís Vilanova <vilanova@ac.upc.edu> writes:
>
>> Hi,
>>
>> I was wondering what is the proper way (or ways, depending on the subsystem) of
>> reporting and signalling errors in QEMU. The coding style file does not seem to
>> mention it, and the code uses all kinds of forms for that:
>>
>> * printf + exit(1)
>> * fprintf(stderr) + exit(1)
>> * error_report + exit(1)
>> * cpu_abort
>> * Some other I probably forgot
>
> cpu_abort() and hw_error() are fancy ways to abort().  Terminating with
> abort() on "this can't be happening" conditions is perfectly sensible,
> and doing it in fancy ways can be useful.  For other errors, it's
> inappropriate.

In particular, the fact that TCG will cpu_abort() if you try to
generate code out of something that's not RAM is a perpetual
source of confusion to users, because the usual reason it happens
is not a QEMU bug but buggy guest code jumping off to a random address...

-- PMM

  reply	other threads:[~2015-10-21 20:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 15:03 [Qemu-devel] Coding style for errors Lluís Vilanova
2015-10-21 15:14 ` Eric Blake
2015-10-21 19:41   ` Lluís Vilanova
2015-10-21 16:48 ` Markus Armbruster
2015-10-21 20:16   ` Peter Maydell [this message]
2015-10-22 13:30   ` Lluís Vilanova
2015-10-23 16:01     ` Stefan Hajnoczi
2015-10-23 16:12       ` Laszlo Ersek
2015-10-23 17:02       ` Dr. David Alan Gilbert
2015-10-28 16:44         ` Thomas Huth
2015-10-23 17:34       ` Lluís Vilanova
2015-10-26 11:39         ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA_bu5wKjL31EHHYMXUWRzbT1v4B0BmT6G=0OZ87BabgWw@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.