From patchwork Mon Jul 26 19:38:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 59940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 031AAB70AE for ; Tue, 27 Jul 2010 05:44:09 +1000 (EST) Received: from localhost ([127.0.0.1]:39717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdTXw-0003tT-Ib for incoming@patchwork.ozlabs.org; Mon, 26 Jul 2010 15:41:08 -0400 Received: from [140.186.70.92] (port=54087 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdTX4-0003sy-2i for qemu-devel@nongnu.org; Mon, 26 Jul 2010 15:40:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdTX2-0007SL-OB for qemu-devel@nongnu.org; Mon, 26 Jul 2010 15:40:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1831) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdTX2-0007S7-Gy for qemu-devel@nongnu.org; Mon, 26 Jul 2010 15:40:12 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6QJe8Uk021072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Jul 2010 15:40:09 -0400 Received: from trasno.mitica (ovpn-113-23.phx2.redhat.com [10.3.113.23]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6QJe73P016073; Mon, 26 Jul 2010 15:40:07 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 26 Jul 2010 21:38:40 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH 0/6] [PATCH v2 0/6] Migration subsections (and ide as example) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org v3: - spell checking documentation - s/[Qq]emu/QEMU/ v2: - add documentation - improve commit messages - remove debug printf's - rebase latest qemu v1: At the end, here is the migration subsections implementation. As an example I ported the last two ide changes to migration to work with subsections. Notes: - subsections I went for qemu_peek_byte() insteadof adding a subsection part in qemu_loadvm_state() due to two reasons: - it makes mandatory that subsections came after sections (better for error messages) - it makes post_load() for the section to be run after subsections are loaded. I think that running section post_load() and then subsections can make for some subtle errors. How does it works? We have a new array of subsections at the end of each section (it can be NULL). Each subsection is composed of VMStateDescription and a test function. test function checks if subsection is needed or not. if needed, it is just emmited. On load, we peek to see if after a section is loaded, if there is any subsection at the end, and if so, we search for it on this section subsections. - ide: 1st revert is not clear because there has been posterior changes that I honored. only change done is that ide_dummy_transfer_stop to transfer_end_table for it to be complete. - testing. In normal operation this code is not triggered (one of the reason for not wanting to sent it in the 1st place). I used patch attached at the end to trigger it. Commetnts? Later, Juan. Juan Quintela (6): Revert "ide save/restore pio/atapi cmd transfer fields and io buffer" Revert "ide save/restore current transfer fields" vmstate: add subsections code ide: fix migration in the middle of pio operation ide: fix migration in the middle of a bmdma transfer Initial documentation for migration docs/migration.txt | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/hw.h | 6 + hw/ide/core.c | 72 +++++++++---- hw/ide/pci.c | 38 ++++++- savevm.c | 86 +++++++++++++++- 5 files changed, 477 insertions(+), 28 deletions(-) create mode 100644 docs/migration.txt diff --git a/hw/ide/core.c b/hw/ide/core.c index 59341a1..a4e6b82 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -421,6 +421,15 @@ static void ide_sector_read(IDEState *s) ide_set_irq(s->bus); ide_set_sector(s, sector_num + n); s->nsector -= n; + if ((s->status & DRQ_STAT)) { + static int val = 1; + if (((val++) == 1000)) { + qemu_aio_flush(); + vm_stop(0); + printf("stopped %d ide_ioport_readaaa\n", val); + } + } + } } @@ -2744,6 +2753,14 @@ static int ide_drive_pio_post_load(void *opaque, int version_id) s->data_ptr = s->io_buffer + s->cur_io_buffer_offset; s->data_end = s->data_ptr + s->cur_io_buffer_len; + printf("addr %p: status %d\n", s, s->status& DRQ_STAT); + printf("\tdata_ptr %p\n", s->data_ptr); + printf("\tdata_end %p\n", s->data_end); + printf("\tio_buffer %p\n", s->io_buffer); + printf("\treq_nb_sectors %d\n", s->req_nb_sectors); + printf("\tidx %d\n", transfer_end_table_idx(s->end_transfer_func)); + printf("\telementary_transfer_size %d\n", s->elementary_transfer_size); + printf("\tpacket_transfer_size %d\n", s->packet_transfer_size); return 0; } @@ -2763,6 +2780,15 @@ static void ide_drive_pio_pre_save(void *opaque) } else { s->end_transfer_fn_idx = idx; } + + printf("addr %p: status %d\n", s, s->status& DRQ_STAT); + printf("\tdata_ptr %p\n", s->data_ptr); + printf("\tdata_end %p\n", s->data_end); + printf("\tio_buffer %p\n", s->io_buffer); + printf("\treq_nb_sectors %d\n", s->req_nb_sectors); + printf("\tidx %d\n", transfer_end_table_idx(s->end_transfer_func)); + printf("\telementary_transfer_size %d\n", s->elementary_transfer_size); + printf("\tpacket_transfer_size %d\n", s->packet_transfer_size); } static bool ide_drive_pio_state_needed(void *opaque)