From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2LBc-0003Qy-As for qemu-devel@nongnu.org; Thu, 03 Nov 2016 12:48:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2LBZ-0007Al-6e for qemu-devel@nongnu.org; Thu, 03 Nov 2016 12:48:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48118) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c2LBY-00079l-Vj for qemu-devel@nongnu.org; Thu, 03 Nov 2016 12:48:17 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA3GiJtQ146007 for ; Thu, 3 Nov 2016 12:48:15 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 26g5epwrcp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Nov 2016 12:48:15 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Nov 2016 12:48:13 -0400 References: <1477943636-21024-1-git-send-email-duanj@linux.vnet.ibm.com> <1477943636-21024-4-git-send-email-duanj@linux.vnet.ibm.com> <87funa88fz.fsf@emacs.mitica> From: Jianjun Duan Date: Thu, 3 Nov 2016 09:47:55 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Message-Id: <1c541e96-55c6-cd43-f598-afd5f0ecae9e@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [QEMU PATCH v10 3/3] tests/migration: Add test for QTAILQ migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Halil Pasic , quintela@redhat.com Cc: veroniabahaa@gmail.com, peter.maydell@linaro.org, dgilbert@redhat.com, mdroth@linux.vnet.ibm.com, mst@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, mreitz@redhat.com, blauwirbel@gmail.com, amit.shah@redhat.com, qemu-ppc@nongnu.org, kraxel@redhat.com, kwolf@redhat.com, dmitry@daynix.com, pbonzini@redhat.com, rth@twiddle.net, leon.alrae@imgtec.com, aurelien@aurel32.net, david@gibson.dropbear.id.au On 11/03/2016 05:22 AM, Halil Pasic wrote: > > > On 11/02/2016 11:47 AM, Juan Quintela wrote: >> Jianjun Duan wrote: >>> Add a test for QTAILQ migration to tests/test-vmstate.c. >>> >>> Signed-off-by: Jianjun Duan >> >> Reviewed-by: Juan Quintela >> > > Empty QTAILQ seems to be broken. Have written a small > test to prove my point. It May even make sense to have such > a test in the test-suite (some prettyfication might be > necessary though). > It is working as intended. The current design is to append the qtailq from source to the corresponding one on target. It works well for the task in hard such as migrating ccs_list and pending_events for DRC objects. I suspect in most cases the qtailqs on target are empty. If not, appending to them is a good choice. Clearing them is tricky since each queue probably require a specialized routine to clean. If they are not empty there are must be good reasons for that. Thanks, Jianjun > Halil > > -----------------------8<------------------------------------- > > From 4323c308c5f56ed86eb0a5bb6027bca4617ecc8c Mon Sep 17 00:00:00 2001 > From: Halil Pasic > Date: Thu, 3 Nov 2016 13:07:05 +0100 > Subject: [PATCH] tests/test-vmstate.c: add test empty qtailq > > Add test for empty qtailq. > > Signed-off-by: Halil Pasic > > -- > > For fixup. > --- > tests/test-vmstate.c | 28 ++++++++++++++++++++++++++++ > 1 files changed, 28 insertions(+), 0 deletions(-) > > diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c > index a992408..789f07a 100644 > --- a/tests/test-vmstate.c > +++ b/tests/test-vmstate.c > @@ -126,6 +126,14 @@ static int load_vmstate_one(const VMStateDescription *desc, void *obj, > return ret; > } > > +static void load_vmstate_one_obj(const VMStateDescription *vmsd, void *obj, > + int version_id) > +{ > + QEMUFile *fload = open_test_file(false); > + > + SUCCESS(vmstate_load_state(fload, vmsd, obj, version_id)); > + qemu_fclose(fload); > +} > > static int load_vmstate(const VMStateDescription *desc, > void *obj, void *obj_clone, > @@ -633,6 +641,25 @@ static void test_load_q(void) > qemu_fclose(fload); > } > > + > +static void test_sl_empty_q(void) > +{ > + TestQtailq obj_q = { > + .i16 = -512, > + .i32 = 70000, > + }; > + TestQtailq tgt = {.q = {.tqh_first = (void *)1}}; > + > + QTAILQ_INIT(&obj_q.q); > + > + save_vmstate(&vmstate_q, &obj_q); > + load_vmstate_one_obj(&vmstate_q, &tgt, 1); > + g_assert_cmpint(tgt.i16, ==, obj_q.i16); > + g_assert_cmpint(tgt.i32, ==, obj_q.i32); > + g_assert_cmpint(QTAILQ_EMPTY(&(tgt.q)),!=, false); > + > +} > + > int main(int argc, char **argv) > { > temp_fd = mkstemp(temp_file); > @@ -649,6 +676,7 @@ int main(int argc, char **argv) > g_test_add_func("/vmstate/field_exists/save/skip", test_save_skip); > g_test_add_func("/vmstate/qtailq/save/saveq", test_save_q); > g_test_add_func("/vmstate/qtailq/load/loadq", test_load_q); > + g_test_add_func("/vmstate/qtailq/empty", test_sl_empty_q); > g_test_run(); > > close(temp_fd); >