[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] virtio: abort on fatal error instead of just ex
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] virtio: abort on fatal error instead of just exiting |
Date: |
Thu, 30 Jun 2016 07:12:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Igor Mammedov <address@hidden> writes:
> On Wed, 29 Jun 2016 14:49:59 +0200
> Markus Armbruster <address@hidden> wrote:
>
>> Igor Mammedov <address@hidden> writes:
>>
>> > replace mainly useless exit(1) on fatal error path with
>> > abort(), so that it would be possible to generate core
>> > dump, that could be used to analyse cause of problem.
>> >
>> > Signed-off-by: Igor Mammedov <address@hidden>
>> > ---
>> > hw/virtio/virtio.c | 24 ++++++++++++------------
>> > 1 file changed, 12 insertions(+), 12 deletions(-)
>> >
>> > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
>> > index 7ed06ea..9d3ac72 100644
>> > --- a/hw/virtio/virtio.c
>> > +++ b/hw/virtio/virtio.c
>> > @@ -315,7 +315,7 @@ static int virtqueue_num_heads(VirtQueue *vq,
>> > unsigned int idx) if (num_heads > vq->vring.num) {
>> > error_report("Guest moved used index from %u to %u",
>> > idx, vq->shadow_avail_idx);
>> > - exit(1);
>> > + abort();
>>
>> What's wrong with a simple assert(num_heads <= vq->vring.num)?
> Nothing, it should work to as we don't use NDEBUG.
> My intent was to make core dump at the point and no to remove
> error message
> (though message's mostly useless for me as virtio is unfamiliar to me
> and I had to dig into core dump to analyze issue).
Understand.
The solution we really want is of course putting the device in an error
state, where it stays until reset.