From nobody Sat Apr 27 22:42:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501682566252192.51332227355556; Wed, 2 Aug 2017 07:02:46 -0700 (PDT) Received: from localhost ([::1]:47965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuEX-0004i6-0y for importer@patchew.org; Wed, 02 Aug 2017 10:02:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuBB-00028e-VU for qemu-devel@nongnu.org; Wed, 02 Aug 2017 09:59:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcuB8-0005bd-UT for qemu-devel@nongnu.org; Wed, 02 Aug 2017 09:59:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53266) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcuB8-0005ay-OJ for qemu-devel@nongnu.org; Wed, 02 Aug 2017 09:59:14 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B37B7EA87 for ; Wed, 2 Aug 2017 13:59:13 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-59.ams2.redhat.com [10.36.117.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD3976A900; Wed, 2 Aug 2017 13:58:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B37B7EA87 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 2 Aug 2017 14:58:32 +0100 Message-Id: <20170802135834.1455-2-dgilbert@redhat.com> In-Reply-To: <20170802135834.1455-1-dgilbert@redhat.com> References: <20170802135834.1455-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 02 Aug 2017 13:59:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/3] migration: fix small leaks 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: marcandre.lureau@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Spotted thanks to valgrind and tests/device-introspect-test: =3D=3D11711=3D=3D 1 bytes in 1 blocks are definitely lost in loss record 6 = of 14,537 =3D=3D11711=3D=3D at 0x4C2EB6B: malloc (vg_replace_malloc.c:299) =3D=3D11711=3D=3D by 0x1E0CDBD8: g_malloc (gmem.c:94) =3D=3D11711=3D=3D by 0x1E0E696E: g_strdup (gstrfuncs.c:363) =3D=3D11711=3D=3D by 0x695693: migration_instance_init (migration.c:2226) =3D=3D11711=3D=3D by 0x717C4B: object_init_with_type (object.c:344) =3D=3D11711=3D=3D by 0x717E80: object_initialize_with_type (object.c:375) =3D=3D11711=3D=3D by 0x7182EB: object_new_with_type (object.c:483) =3D=3D11711=3D=3D by 0x718328: object_new (object.c:493) =3D=3D11711=3D=3D by 0x4B8A29: qmp_device_list_properties (qmp.c:542) =3D=3D11711=3D=3D by 0x4A9561: qmp_marshal_device_list_properties (qmp-m= arshal.c:1425) =3D=3D11711=3D=3D by 0x819D4A: do_qmp_dispatch (qmp-dispatch.c:104) =3D=3D11711=3D=3D by 0x819E82: qmp_dispatch (qmp-dispatch.c:131) Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20170801160419.14180-1-marcandre.lureau@redhat.com> Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 085c32c994..c3fe0ed9ca 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2214,6 +2214,15 @@ static void migration_class_init(ObjectClass *klass,= void *data) dc->props =3D migration_properties; } =20 +static void migration_instance_finalize(Object *obj) +{ + MigrationState *ms =3D MIGRATION_OBJ(obj); + MigrationParameters *params =3D &ms->parameters; + + g_free(params->tls_hostname); + g_free(params->tls_creds); +} + static void migration_instance_init(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); @@ -2282,6 +2291,7 @@ static const TypeInfo migration_type =3D { .class_size =3D sizeof(MigrationClass), .instance_size =3D sizeof(MigrationState), .instance_init =3D migration_instance_init, + .instance_finalize =3D migration_instance_finalize, }; =20 static void register_migration_types(void) --=20 2.13.3 From nobody Sat Apr 27 22:42:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501682485544958.4071573193974; Wed, 2 Aug 2017 07:01:25 -0700 (PDT) Received: from localhost ([::1]:47960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuDE-0003ZX-4F for importer@patchew.org; Wed, 02 Aug 2017 10:01:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuBV-0002Mm-09 for qemu-devel@nongnu.org; Wed, 02 Aug 2017 09:59:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcuBS-0005rj-0w for qemu-devel@nongnu.org; Wed, 02 Aug 2017 09:59:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54394) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcuBR-0005r1-Qw for qemu-devel@nongnu.org; Wed, 02 Aug 2017 09:59:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B95694A6E8 for ; Wed, 2 Aug 2017 13:59:32 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-59.ams2.redhat.com [10.36.117.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCD636A8ED; Wed, 2 Aug 2017 13:59:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B95694A6E8 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 2 Aug 2017 14:58:33 +0100 Message-Id: <20170802135834.1455-3-dgilbert@redhat.com> In-Reply-To: <20170802135834.1455-1-dgilbert@redhat.com> References: <20170802135834.1455-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 02 Aug 2017 13:59:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] migration: fix comment disorder in RAMState 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: marcandre.lureau@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu Comments for "migration_dirty_pages" and "bitmap_mutex" are switched. Fix it. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Peter Xu Message-Id: <1501666880-10159-2-git-send-email-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- migration/ram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 1b08296d1b..e18b3e2d4f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -188,9 +188,9 @@ struct RAMState { uint64_t iterations_prev; /* Iterations since start */ uint64_t iterations; - /* protects modification of the bitmap */ - uint64_t migration_dirty_pages; /* number of dirty bits in the bitmap */ + uint64_t migration_dirty_pages; + /* protects modification of the bitmap */ QemuMutex bitmap_mutex; /* The RAMBlock used in the last src_page_requests */ RAMBlock *last_req_rb; --=20 2.13.3 From nobody Sat Apr 27 22:42:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501682552387736.8643675942774; Wed, 2 Aug 2017 07:02:32 -0700 (PDT) Received: from localhost ([::1]:47964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuEJ-0004a3-1R for importer@patchew.org; Wed, 02 Aug 2017 10:02:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcuC3-0002uG-Bq for qemu-devel@nongnu.org; Wed, 02 Aug 2017 10:00:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcuBu-0006CV-5n for qemu-devel@nongnu.org; Wed, 02 Aug 2017 10:00:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13697) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcuBu-0006Bj-08 for qemu-devel@nongnu.org; Wed, 02 Aug 2017 10:00:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB35E622DC for ; Wed, 2 Aug 2017 13:59:59 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-59.ams2.redhat.com [10.36.117.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C94E69AFE; Wed, 2 Aug 2017 13:59:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DB35E622DC Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 2 Aug 2017 14:58:34 +0100 Message-Id: <20170802135834.1455-4-dgilbert@redhat.com> In-Reply-To: <20170802135834.1455-1-dgilbert@redhat.com> References: <20170802135834.1455-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 02 Aug 2017 14:00:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] io: fix qio_channel_socket_accept err handling 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: marcandre.lureau@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu When accept failed, we should setup errp with the reason. More importantly, the caller may assume errp be non-NULL when error happens, and not setting the errp may crash QEMU. At the same time, move the trace_qio_channel_socket_accept_fail() after the if check on EINTR. Two reasons: 1. when EINTR happened, it's not really a fault (we should just try again), so we should not log with an "accept failure". 2. trace_*() functions may overwrite errno, then the old errno will be missing. We need to either check errno before trace_*() calls, or reserve the errno. Signed-off-by: Peter Xu Message-Id: <1501666880-10159-3-git-send-email-peterx@redhat.com> Reviewed-by: Daniel P. Berrange Signed-off-by: Dr. David Alan Gilbert --- io/channel-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/io/channel-socket.c b/io/channel-socket.c index 53386b7ba3..591d27e8c3 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -340,10 +340,11 @@ qio_channel_socket_accept(QIOChannelSocket *ioc, cioc->fd =3D qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr, &cioc->remoteAddrLen); if (cioc->fd < 0) { - trace_qio_channel_socket_accept_fail(ioc); if (errno =3D=3D EINTR) { goto retry; } + error_setg_errno(errp, errno, "Unable to accept connection"); + trace_qio_channel_socket_accept_fail(ioc); goto error; } =20 --=20 2.13.3