From patchwork Fri Apr 15 03:02:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prerna Saxena X-Patchwork-Id: 8851061 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8C031BF440 for ; Fri, 15 Apr 2016 13:36:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7639E20272 for ; Fri, 15 Apr 2016 13:36:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FF942026F for ; Fri, 15 Apr 2016 13:36:56 +0000 (UTC) Received: from localhost ([::1]:34335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar3vb-0005lg-PR for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Apr 2016 09:36:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqu2O-0006XL-Q0 for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:03:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqu2N-0004ZA-88 for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:03:16 -0400 Received: from mail-pa0-x243.google.com ([2607:f8b0:400e:c03::243]:36221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqu2M-0004Z4-TA for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:03:15 -0400 Received: by mail-pa0-x243.google.com with SMTP id k3so8216247pav.3 for ; Thu, 14 Apr 2016 20:03:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xBLTkc5aO0NW3zUNZIHoD0q1aP/FwvHSgO3cTwAL0XQ=; b=NHKVvbmf4ML9yOws8Zkjse0ZpVkcs+vXMNBX9me7pS3eWo5kPDIIXXNE7Ig8xFxFj7 +TAfieoKx9nGTR6j7qmEF4YYxS8IJuyvVBB3C/kAwwvEzI4R9QPy9SYx4XS2MyxZy4yv xp8mor9KrvxsG8z4d48E7GW6uvm4Q44W0QP+1qASQLu6NdS99WK/SnnwVcwdkp1jVfPe 3BAhgg7lVA3RRPwY1b5UcS60hzZV9ogH+9/0BidvcezTbgI7Ikr4C6AHFootpaQlWika rtz5NaiMBYdw9HbAsDiSt9tcJkmDFyGlx3rLCKzUxXwMFobQdT4HRbPVDEXsU7C23znd o+TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xBLTkc5aO0NW3zUNZIHoD0q1aP/FwvHSgO3cTwAL0XQ=; b=auAHv34Xw+iXUR90Yp0r4gRaxfzG4vAo+GNKg5+m4fLSB/MYeq/0BnRKq764svBA/j RvXNEHLfmQXYoNuMa9vlFm5Py8veJeOcpfcSMRKSPeKsmh4SB2n8O4s5whnJHJLc5irK tWc7zfm/I/qvzMzEw2B8B8MbusJOzlrv/Wq20bjyeIxwdyE4tgUhQwhrPPhVjlt2MrmX Oa+qsu0rMgZybk6PA3DEoIFT4jpgwd7D69SpSUWc+mM3IR3wVB4NvzzZUUVnOI94CRz7 VMx8kTr5qHnIr8xJLewu9nNKqZzZ9rVlmduA+7T/myho9GY/NUe3KgMZD5GZ9sFlUuUB 4vfA== X-Gm-Message-State: AOPr4FXgH36MidIqlAofB69eO25big3CR95MW9n8kPENTlTd4fOvDifE2aI5SdsbxnFa3A== X-Received: by 10.66.134.15 with SMTP id pg15mr652536pab.98.1460689394111; Thu, 14 Apr 2016 20:03:14 -0700 (PDT) Received: from localhost.localdomain ([14.141.153.182]) by smtp.gmail.com with ESMTPSA id xs10sm61016252pab.4.2016.04.14.20.03.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Apr 2016 20:03:13 -0700 (PDT) From: Prerna Saxena To: qemu-devel@nongnu.org Date: Fri, 15 Apr 2016 08:32:54 +0530 Message-Id: <1460689374-9690-3-git-send-email-saxenap.ltc@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1460689374-9690-1-git-send-email-saxenap.ltc@gmail.com> References: <1460689374-9690-1-git-send-email-saxenap.ltc@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::243 X-Mailman-Approved-At: Fri, 15 Apr 2016 09:36:33 -0400 Subject: [Qemu-devel] [PATCH 2/2] Debug : Add error messages before a call to debug(). X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prerna Saxena Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Qemu code has abort() calls in various places which raises a SIGABRT; This patch adds error messages before (most)calls to abort(), so that it is easier to determine why QEMU died. Signed-off-by: Prerna Saxena --- block.c | 1 + block/block-backend.c | 4 ++++ block/curl.c | 1 + block/io.c | 1 + block/linux-aio.c | 1 + block/mirror.c | 2 ++ block/qcow2-cache.c | 1 + block/qcow2-cluster.c | 3 +++ block/qcow2-refcount.c | 7 +++++++ block/qcow2.c | 2 ++ blockdev.c | 3 +++ crypto/aes.c | 1 + exec.c | 4 ++++ hw/scsi/scsi-disk.c | 2 ++ hw/virtio/virtio.c | 5 ++++- vl.c | 2 ++ 16 files changed, 39 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index d4939b4..160f277 100644 --- a/block.c +++ b/block.c @@ -3725,6 +3725,7 @@ void bdrv_remove_aio_context_notifier(BlockDriverState *bs, } } + error_report("Matching context notifier not found for removal. Aborting"); abort(); } diff --git a/block/block-backend.c b/block/block-backend.c index d74f670..0aa8692 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -407,6 +407,7 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo) return blk; } } + error_report("Drive Info not found, Aborting."); abort(); } @@ -463,6 +464,8 @@ int blk_attach_dev(BlockBackend *blk, void *dev) void blk_attach_dev_nofail(BlockBackend *blk, void *dev) { if (blk_attach_dev(blk, dev) < 0) { + error_report("Attaching device model to block %s failed. Aborting", + blk->name); abort(); } } @@ -1143,6 +1146,7 @@ BlockErrorAction blk_get_error_action(BlockBackend *blk, bool is_read, case BLOCKDEV_ON_ERROR_IGNORE: return BLOCK_ERROR_ACTION_IGNORE; default: + error_report("Unrecognized Block Error Action %d. Aborting.",on_err); abort(); } } diff --git a/block/curl.c b/block/curl.c index 5a8f8b6..fe2225a 100644 --- a/block/curl.c +++ b/block/curl.c @@ -382,6 +382,7 @@ static void curl_multi_timeout_do(void *arg) curl_multi_check_completion(s); #else + error_report("Curl timer expired, Aborting."); abort(); #endif } diff --git a/block/io.c b/block/io.c index a7dbf85..6f45959 100644 --- a/block/io.c +++ b/block/io.c @@ -2045,6 +2045,7 @@ void bdrv_aio_cancel(BlockAIOCB *acb) } else if (acb->bs) { aio_poll(bdrv_get_aio_context(acb->bs), true); } else { + error_report("Aio context not found. Aborting."); abort(); } } diff --git a/block/linux-aio.c b/block/linux-aio.c index 805757e..38d7812 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -206,6 +206,7 @@ static void ioq_submit(struct qemu_laio_state *s) break; } if (ret < 0) { + error_report("Error %d submitting io. Aborting.", ret); abort(); } diff --git a/block/mirror.c b/block/mirror.c index c2cfc1a..600e3c2 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -389,6 +389,8 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s) mirror_do_zero_or_discard(s, sector_num, io_sectors, true); break; default: + error_report("Unrecognized mirror option %d. Aborting.", + mirror_method); abort(); } assert(io_sectors); diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 0fe8eda..80766a2 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -334,6 +334,7 @@ static int qcow2_cache_do_get(BlockDriverState *bs, Qcow2Cache *c, if (min_lru_index == -1) { /* This can't happen in current synchronous code, but leave the check * here as a reminder for whoever starts using AIO with the cache */ + error_report("Invalid Index %d, Aborting", min_lru_index); abort(); } diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 31ecc10..1914d97 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -583,6 +583,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, } break; default: + error_report("Invalid cluster type %d. Aborting.", ret); abort(); } @@ -868,6 +869,7 @@ static int count_cow_clusters(BDRVQcow2State *s, int nb_clusters, case QCOW2_CLUSTER_ZERO: break; default: + error_report("Invalid cluster type %d, Aborting.", cluster_type); abort(); } } @@ -1494,6 +1496,7 @@ static int discard_single_l2(BlockDriverState *bs, uint64_t offset, break; default: + error_report("Invalid cluster type %d. Aborting.", ret); abort(); } diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index ca6094f..6ff8395 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -28,6 +28,7 @@ #include "block/block_int.h" #include "block/qcow2.h" #include "qemu/range.h" +#include "qemu/error-report.h" static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size); static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, @@ -1033,6 +1034,8 @@ void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, case QCOW2_CLUSTER_UNALLOCATED: break; default: + error_report("Invalid cluster type %d, Aborting", + qcow2_get_cluster_type(l2_entry)); abort(); } } @@ -1170,6 +1173,8 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs, break; default: + error_report("Invalid cluster type %d, Aborting", + qcow2_get_cluster_type(offset)); abort(); } @@ -1470,6 +1475,8 @@ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, break; default: + error_report("Invalid cluster type %d, Aborting", + qcow2_get_cluster_type(l2_entry)); abort(); } } diff --git a/block/qcow2.c b/block/qcow2.c index 470734b..7550fa9 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3102,6 +3102,8 @@ static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts, } else { /* if this point is reached, this probably means a new option was * added without having it covered here */ + error_report("Invalid qcow2 amend option %s. Aborting.", + desc->name); abort(); } diff --git a/blockdev.c b/blockdev.c index f1f520a..4bc001c 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2556,6 +2556,8 @@ void qmp_blockdev_change_medium(const char *device, const char *filename, break; default: + error_report("Unrecognized change mode %d for block device, Aborting", + read_only); abort(); } @@ -3587,6 +3589,7 @@ void qmp_drive_mirror(const char *device, const char *target, NULL, size, flags, &local_err, false); break; default: + error_report("Unrecognized image mode %d, Aborting.", mode); abort(); } } diff --git a/crypto/aes.c b/crypto/aes.c index 3456eac..3228c5e 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1162,6 +1162,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits, rk += 8; } } + error_report("Error setting AES encryption key, Aborting."); abort(); } diff --git a/exec.c b/exec.c index c4f9036..1b1d713 100644 --- a/exec.c +++ b/exec.c @@ -2218,6 +2218,7 @@ static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, *data = ldq_p(buf); return MEMTX_OK; default: + printf("Unsupported read size %d, Aborting", len); abort(); } } @@ -2247,6 +2248,7 @@ static MemTxResult subpage_write(void *opaque, hwaddr addr, stq_p(buf, value); break; default: + printf("Unsupported write size %d, Aborting", len); abort(); } return address_space_write(subpage->as, addr + subpage->base, @@ -2620,6 +2622,7 @@ static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr, attrs); break; default: + printf("Unsupported memory access size %d, Aborting.", l); abort(); } } else { @@ -2712,6 +2715,7 @@ MemTxResult address_space_read_continue(AddressSpace *as, hwaddr addr, stb_p(buf, val); break; default: + printf("Unsupported memory access size %d, Aborting.", l); abort(); } } else { diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index c3ce54a..ef224e2 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1845,6 +1845,7 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req) break; default: + printf("Unhandled SCSI command %d, Aborting",req->cmd.buf[0]); abort(); } } @@ -2187,6 +2188,7 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf) r->sector_count = len * (s->qdev.blocksize / 512); break; default: + printf("Unhandled SCSI command %d, Aborting.",command); abort(); illegal_request: scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index f745c4a..5cd2efb 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1147,8 +1147,10 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, break; } - if (i == VIRTIO_QUEUE_MAX || queue_size > VIRTQUEUE_MAX_SIZE) + if (i == VIRTIO_QUEUE_MAX || queue_size > VIRTQUEUE_MAX_SIZE) { + error_report("Error adding virtqueue. Max limits reached. Aborting."); abort(); + } vdev->vq[i].vring.num = queue_size; vdev->vq[i].vring.num_default = queue_size; @@ -1162,6 +1164,7 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, void virtio_del_queue(VirtIODevice *vdev, int n) { if (n < 0 || n >= VIRTIO_QUEUE_MAX) { + error_report("Error deleting virtqueue.Index out of range.Aborting"); abort(); } diff --git a/vl.c b/vl.c index 9df534f..3e6a686 100644 --- a/vl.c +++ b/vl.c @@ -2273,6 +2273,8 @@ char *qemu_find_file(int type, const char *name) subdir = "keymaps/"; break; default: + error_printf("Unrecognized type %d for file %s. Exiting.", + type, name); abort(); }