From patchwork Tue Dec 3 05:49:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 296077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B45082C009F for ; Tue, 3 Dec 2013 16:50:41 +1100 (EST) Received: from localhost ([::1]:40234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnisY-0007ab-Sv for incoming@patchwork.ozlabs.org; Tue, 03 Dec 2013 00:50:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vniry-0007W0-9S for qemu-devel@nongnu.org; Tue, 03 Dec 2013 00:50:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vnirq-0001LB-Uz for qemu-devel@nongnu.org; Tue, 03 Dec 2013 00:50:02 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vnirq-0001L7-MB for qemu-devel@nongnu.org; Tue, 03 Dec 2013 00:49:54 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so2462218pab.34 for ; Mon, 02 Dec 2013 21:49:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Wn7nb3fsBI+G8xZuICt+05UUfblrWgR71NsJln8kju0=; b=ECD96nhiG79MLX2U3gNouEB0QKTw8sd8vZBqL31WKHOGJM8sDIebu0vLjuaUt6qdlD dRY6C9R5ydp7H+1q87Rj9HXA8OKaW5bAfj8c7XLAMbsUQsjk2SHyuCBIPq1zw94itCj3 9hbXXvglR0HV+jR6UbTa12eDd8LOlLL0+6emWB9CRkUtRxqCssQdJ52UajlywN4GPi1L 6Tl4ReGSy909Q2TgPtnDyEU+V0PAcmyEfKERgAT8YN+Q0ylPkRgkTfDlWyEawHHPP5PB P13x6roMW2/0PrqefBC0H91bu3VjEGbN8QRPPElkAWqSrcf4J3lO0tzq8nLY7cLkFOoj bxtg== X-Gm-Message-State: ALoCoQleq+GxJwTYsOt0k2LO3UI9aGO6IswSresda/iPt6AS1HZ4274wbzJexaG0TANzAEmtYBqt X-Received: by 10.66.13.138 with SMTP id h10mr8455164pac.148.1386049793178; Mon, 02 Dec 2013 21:49:53 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id ki1sm127100219pbd.1.2013.12.02.21.49.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Dec 2013 21:49:52 -0800 (PST) From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Mon, 2 Dec 2013 21:49:20 -0800 Message-Id: X-Mailer: git-send-email 1.8.4.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.47 Cc: imammedo@redhat.com, afaerber@suse.de, armbru@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [RFC PATCH v1 0/5] Add error_abort and associated cleanups X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Following our discussion RE self asserting API calls, here is a spin of my proposal. This series obsoletes the need for _nofail variants for Error ** accepting APIs. Is also greately reduces the verbosity of calls sites that are currently asserting against errors. Patch 1 is the main event - addition of error_abort. The following patches then cleanup uses of _nofail and assert_no_error(). To give it a smoke test, I introduce a (critical) bug into QOM: prop->set(obj, v, prop->opaque, name, errp); And run QEMU: $ gdb --args ./microblazeel-softmmu/qemu-system-microblazeel -M petalogix-ml605 -nographic Without application of this series, the bug manifests as: qemu-system-microblazeel: Insufficient permission to perform this operation Program received signal SIGABRT, Aborted. (gdb) bt 0 0x00007ffff55f7425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 1 0x00007ffff55fab8b in __GI_abort () at abort.c:91 2 0x00005555557073da in assert_no_error (err=) at qobject/qerror.c:128 3 0x0000555555615159 in qdev_property_add_static (dev=0x555555e9e6a0, prop=0x5555559ea4c0, errp=0x7fffffffe3c0) at hw/core/qdev.c:666 4 0x0000555555615355 in device_initfn (obj=) at hw/core/qdev.c:744 With this series, we now get a the full backtrace into the QOM API when the assertion occurs (note stack frames 2-4 giving visibility into the broken QOM API): qemu-system-microblazeel: Insufficient permission to perform this operation Program received signal SIGABRT, Aborted. (gdb) bt 0 0x00007ffff55f7425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 1 0x00007ffff55fab8b in __GI_abort () at abort.c:91 2 0x000055555570c5a4 in error_set (errp=0x555555e1b5f0, err_class=ERROR_CLASS_GENERIC_ERROR, fmt=0x55555571f5c0 "Insufficient permission to perform this operation") at util/error.c:47 3 0x00005555556778e5 in object_property_set_qobject (obj=0x555555e9e6a0, value=, name=0x55555574e7a6 "xlnx.base-vectors", errp=0x555555e1b5f0) at qom/qom-qobject.c:24 4 0x000055555567674d in object_property_set_int (obj=0x555555e9e6a0, value=, name=0x55555574e7a6 "xlnx.base-vectors", errp=0x555555e1b5f0) at qom/object.c:898 5 0x0000555555615192 in qdev_property_add_static (dev=0x555555e9e6a0, prop=0x5555559ea4c0, errp=0x555555e1b5f0) at hw/core/qdev.c:664 6 0x000055555561534f in device_initfn (obj=) at hw/core/qdev.c:741 Peter Crosthwaite (5): error: Add error_abort hw: Remove assert_no_error usages target-i386: Remove assert_no_error usage qemu-option: Remove qemu_opts_create_nofail qerror: Remove assert_no_error() block/blkdebug.c | 2 +- block/blkverify.c | 2 +- block/curl.c | 2 +- block/gluster.c | 2 +- block/iscsi.c | 2 +- block/nbd.c | 2 +- block/qcow2.c | 2 +- block/raw-posix.c | 2 +- block/raw-win32.c | 4 ++-- block/rbd.c | 2 +- block/sheepdog.c | 2 +- block/vvfat.c | 2 +- blockdev.c | 6 ++++-- hw/core/qdev-properties-system.c | 8 ++------ hw/core/qdev-properties.c | 40 ++++++++++------------------------------ hw/core/qdev.c | 28 +++++++--------------------- hw/dma/xilinx_axidma.c | 13 ++++--------- hw/net/xilinx_axienet.c | 13 ++++--------- hw/watchdog/watchdog.c | 3 ++- include/hw/xilinx.h | 14 ++++---------- include/qapi/error.h | 6 ++++++ include/qapi/qmp/qerror.h | 1 - include/qemu/option.h | 1 - qdev-monitor.c | 2 +- qemu-img.c | 2 +- qobject/qerror.c | 8 -------- target-i386/cpu.c | 4 +--- util/error.c | 22 +++++++++++++++++++++- util/qemu-config.c | 2 +- util/qemu-option.c | 9 --------- util/qemu-sockets.c | 18 +++++++++--------- vl.c | 17 ++++++++++------- 32 files changed, 100 insertions(+), 143 deletions(-) --- a/qom/object.c +++ b/qom/object.c @@ -797,7 +797,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name, return; } - if (!prop->set) { + if (prop->set) { error_set(errp, QERR_PERMISSION_DENIED); } else {