From patchwork Thu Mar 29 15:48:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 892836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Bq3x48H2z9s0t for ; Fri, 30 Mar 2018 02:51:25 +1100 (AEDT) Received: from localhost ([::1]:35257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1Zpj-0006m3-60 for incoming@patchwork.ozlabs.org; Thu, 29 Mar 2018 11:51:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1ZnG-000546-Vy for qemu-devel@nongnu.org; Thu, 29 Mar 2018 11:48:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1ZnB-0006S9-WD for qemu-devel@nongnu.org; Thu, 29 Mar 2018 11:48:51 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38464 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1ZnB-0006QL-Qm for qemu-devel@nongnu.org; Thu, 29 Mar 2018 11:48:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 500DE4068053 for ; Thu, 29 Mar 2018 15:48:41 +0000 (UTC) Received: from localhost (ovpn-112-62.ams2.redhat.com [10.36.112.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 966DD10B2B44; Thu, 29 Mar 2018 15:48:34 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Thu, 29 Mar 2018 17:48:29 +0200 Message-Id: <20180329154833.566-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 29 Mar 2018 15:48:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 29 Mar 2018 15:48:41 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v3 0/4] RFC: simplify qobject refcount 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: armbru@redhat.com, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , pbonzini@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hi, This series aims to get rid of the distinction between QObject, that must use qobject_incref/qobject_decref and its various derived types that have to use QINCREF/QDECREF. Instead, replace it with qobject_ref/qobject_unref for all types. v3: after v2 review with Eric and Paolo - fix clang ubsan warning when a null pointer is given to QOBJECT. - add a patch to make qobject_ref() assert on null pointer, and return the same pointer, simplifying some code. v2: - use the QObjectCommon base approach suggested by Paolo and Eric - remove need for QEMU_GENERIC Marc-André Lureau (4): qobject: ensure base is at offset 0 qobject: introduce QObjectCommon qobject: replace qobject_incref/QINCREF qobject_decref/QDECREF qobject: modify qobject_ref() to assert on NULL and return obj scripts/qapi/events.py | 2 +- include/qapi/qmp/qbool.h | 2 +- include/qapi/qmp/qdict.h | 2 +- include/qapi/qmp/qlist.h | 2 +- include/qapi/qmp/qnull.h | 4 +- include/qapi/qmp/qnum.h | 2 +- include/qapi/qmp/qobject.h | 75 +++++++++++--------- include/qapi/qmp/qstring.h | 2 +- block.c | 82 ++++++++++----------- block/blkdebug.c | 7 +- block/blkverify.c | 8 +-- block/crypto.c | 4 +- block/gluster.c | 4 +- block/iscsi.c | 2 +- block/nbd.c | 4 +- block/nfs.c | 4 +- block/null.c | 3 +- block/nvme.c | 3 +- block/parallels.c | 4 +- block/qapi.c | 2 +- block/qcow.c | 8 +-- block/qcow2.c | 8 +-- block/qed.c | 4 +- block/quorum.c | 4 +- block/rbd.c | 14 ++-- block/sheepdog.c | 12 ++-- block/snapshot.c | 4 +- block/ssh.c | 4 +- block/vdi.c | 2 +- block/vhdx.c | 4 +- block/vpc.c | 4 +- block/vvfat.c | 2 +- block/vxhs.c | 2 +- blockdev.c | 16 ++--- hw/i386/acpi-build.c | 12 ++-- hw/ppc/spapr_drc.c | 2 +- hw/usb/xen-usb.c | 4 +- migration/migration.c | 4 +- migration/qjson.c | 2 +- monitor.c | 57 +++++++-------- qapi/qapi-dealloc-visitor.c | 4 +- qapi/qmp-dispatch.c | 6 +- qapi/qobject-input-visitor.c | 10 ++- qapi/qobject-output-visitor.c | 11 ++- qemu-img.c | 18 ++--- qemu-io.c | 6 +- qga/main.c | 12 ++-- qmp.c | 4 +- qobject/json-parser.c | 10 +-- qobject/qdict.c | 49 +++++-------- qobject/qjson.c | 2 +- qobject/qlist.c | 4 +- qobject/qobject.c | 21 ++++-- qom/object.c | 16 ++--- qom/object_interfaces.c | 2 +- target/ppc/translate_init.c | 2 +- target/s390x/cpu_models.c | 2 +- tests/ahci-test.c | 6 +- tests/check-qdict.c | 106 ++++++++++++++-------------- tests/check-qjson.c | 84 +++++++++++----------- tests/check-qlist.c | 8 +-- tests/check-qlit.c | 10 +-- tests/check-qnull.c | 10 +-- tests/check-qnum.c | 28 ++++---- tests/check-qobject.c | 2 +- tests/check-qstring.c | 10 +-- tests/cpu-plug-test.c | 4 +- tests/device-introspect-test.c | 24 +++---- tests/drive_del-test.c | 4 +- tests/libqos/libqos.c | 8 +-- tests/libqos/pci-pc.c | 2 +- tests/libqtest.c | 24 +++---- tests/machine-none-test.c | 2 +- tests/migration-test.c | 24 +++---- tests/numa-test.c | 16 ++--- tests/pvpanic-test.c | 2 +- tests/q35-test.c | 2 +- tests/qmp-test.c | 38 +++++----- tests/qom-test.c | 8 +-- tests/tco-test.c | 12 ++-- tests/test-char.c | 2 +- tests/test-keyval.c | 82 ++++++++++----------- tests/test-netfilter.c | 26 +++---- tests/test-qemu-opts.c | 14 ++-- tests/test-qga.c | 76 ++++++++++---------- tests/test-qmp-cmds.c | 24 +++---- tests/test-qmp-event.c | 2 +- tests/test-qobject-input-visitor.c | 10 +-- tests/test-qobject-output-visitor.c | 18 ++--- tests/test-visitor-serialization.c | 6 +- tests/test-x86-cpuid-compat.c | 14 ++-- tests/tmp105-test.c | 4 +- tests/vhost-user-test.c | 6 +- tests/virtio-net-test.c | 6 +- tests/vmgenid-test.c | 2 +- tests/wdt_ib700-test.c | 14 ++-- util/keyval.c | 12 ++-- util/qemu-config.c | 4 +- docs/devel/qapi-code-gen.txt | 2 +- roms/seabios | 2 +- scripts/coccinelle/qobject.cocci | 8 +-- 101 files changed, 665 insertions(+), 669 deletions(-)