diff mbox

[v4,14/17] ahci: Migrate IDEStatus

Message ID 1424708286-16483-15-git-send-email-jsnow@redhat.com
State New
Headers show

Commit Message

John Snow Feb. 23, 2015, 4:18 p.m. UTC
Amazingly, we weren't doing this before.

Make sure we migrate the IDEState structure that belongs to
the AHCIDevice.IDEBus structure during migrations.

No version numbering changes because AHCI is not officially
migratable (and we can all see with good reason why) so we
do not impact any official builds by altering the stream and
leaving it at version 1.

This fixes the rerror=stop/werror=stop test case where we wish
to migrate a halted job. Previously, the error code would not
migrate, so even if the job completed successfully, AHCI would
report an error because it would still have the placeholder
error code from initialization time.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 hw/ide/ahci.c     | 1 +
 hw/ide/internal.h | 3 +++
 2 files changed, 4 insertions(+)

Comments

Amit Shah March 13, 2015, 6:01 a.m. UTC | #1
On (Mon) 23 Feb 2015 [11:18:03], John Snow wrote:
> Amazingly, we weren't doing this before.
> 
> Make sure we migrate the IDEState structure that belongs to
> the AHCIDevice.IDEBus structure during migrations.
> 
> No version numbering changes because AHCI is not officially
> migratable (and we can all see with good reason why) so we
> do not impact any official builds by altering the stream and
> leaving it at version 1.
> 
> This fixes the rerror=stop/werror=stop test case where we wish
> to migrate a halted job. Previously, the error code would not
> migrate, so even if the job completed successfully, AHCI would
> report an error because it would still have the placeholder
> error code from initialization time.
> 
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  hw/ide/ahci.c     | 1 +
>  hw/ide/internal.h | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
> index bc6d5ce..3f4fc77 100644
> --- a/hw/ide/ahci.c
> +++ b/hw/ide/ahci.c
> @@ -1321,6 +1321,7 @@ static const VMStateDescription vmstate_ahci_device = {
>      .version_id = 1,
>      .fields = (VMStateField[]) {
>          VMSTATE_IDE_BUS(port, AHCIDevice),
> +        VMSTATE_IDE_DRIVE(port.ifs[0], AHCIDevice),

This adds a new field to the struct without bumping up the version
number.

Flagged by the static checker.


		Amit
Kevin Wolf March 13, 2015, 8:21 a.m. UTC | #2
Am 13.03.2015 um 07:01 hat Amit Shah geschrieben:
> On (Mon) 23 Feb 2015 [11:18:03], John Snow wrote:
> > Amazingly, we weren't doing this before.
> > 
> > Make sure we migrate the IDEState structure that belongs to
> > the AHCIDevice.IDEBus structure during migrations.
> > 
> > No version numbering changes because AHCI is not officially
> > migratable (and we can all see with good reason why) so we
> > do not impact any official builds by altering the stream and
> > leaving it at version 1.
> > 
> > This fixes the rerror=stop/werror=stop test case where we wish
> > to migrate a halted job. Previously, the error code would not
> > migrate, so even if the job completed successfully, AHCI would
> > report an error because it would still have the placeholder
> > error code from initialization time.
> > 
> > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: John Snow <jsnow@redhat.com>
> > ---
> >  hw/ide/ahci.c     | 1 +
> >  hw/ide/internal.h | 3 +++
> >  2 files changed, 4 insertions(+)
> > 
> > diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
> > index bc6d5ce..3f4fc77 100644
> > --- a/hw/ide/ahci.c
> > +++ b/hw/ide/ahci.c
> > @@ -1321,6 +1321,7 @@ static const VMStateDescription vmstate_ahci_device = {
> >      .version_id = 1,
> >      .fields = (VMStateField[]) {
> >          VMSTATE_IDE_BUS(port, AHCIDevice),
> > +        VMSTATE_IDE_DRIVE(port.ifs[0], AHCIDevice),
> 
> This adds a new field to the struct without bumping up the version
> number.
> 
> Flagged by the static checker.

AHCI is still marked unmigratable, so it doesn't matter (and actually,
I just see that the commit message above explicitly states this).

Kevin
Amit Shah March 13, 2015, 8:43 a.m. UTC | #3
On (Fri) 13 Mar 2015 [09:21:19], Kevin Wolf wrote:
> Am 13.03.2015 um 07:01 hat Amit Shah geschrieben:
> > On (Mon) 23 Feb 2015 [11:18:03], John Snow wrote:
> > > Amazingly, we weren't doing this before.
> > > 
> > > Make sure we migrate the IDEState structure that belongs to
> > > the AHCIDevice.IDEBus structure during migrations.
> > > 
> > > No version numbering changes because AHCI is not officially
> > > migratable (and we can all see with good reason why) so we
> > > do not impact any official builds by altering the stream and
> > > leaving it at version 1.
> > > 
> > > This fixes the rerror=stop/werror=stop test case where we wish
> > > to migrate a halted job. Previously, the error code would not
> > > migrate, so even if the job completed successfully, AHCI would
> > > report an error because it would still have the placeholder
> > > error code from initialization time.
> > > 
> > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > > Signed-off-by: John Snow <jsnow@redhat.com>
> > > ---
> > >  hw/ide/ahci.c     | 1 +
> > >  hw/ide/internal.h | 3 +++
> > >  2 files changed, 4 insertions(+)
> > > 
> > > diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
> > > index bc6d5ce..3f4fc77 100644
> > > --- a/hw/ide/ahci.c
> > > +++ b/hw/ide/ahci.c
> > > @@ -1321,6 +1321,7 @@ static const VMStateDescription vmstate_ahci_device = {
> > >      .version_id = 1,
> > >      .fields = (VMStateField[]) {
> > >          VMSTATE_IDE_BUS(port, AHCIDevice),
> > > +        VMSTATE_IDE_DRIVE(port.ifs[0], AHCIDevice),
> > 
> > This adds a new field to the struct without bumping up the version
> > number.
> > 
> > Flagged by the static checker.
> 
> AHCI is still marked unmigratable, so it doesn't matter (and actually,
> I just see that the commit message above explicitly states this).

I missed that.  Thanks.


		Amit
diff mbox

Patch

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index bc6d5ce..3f4fc77 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1321,6 +1321,7 @@  static const VMStateDescription vmstate_ahci_device = {
     .version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_IDE_BUS(port, AHCIDevice),
+        VMSTATE_IDE_DRIVE(port.ifs[0], AHCIDevice),
         VMSTATE_UINT32(port_state, AHCIDevice),
         VMSTATE_UINT32(finished, AHCIDevice),
         VMSTATE_UINT32(port_regs.lst_addr, AHCIDevice),
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 0d5f881..965cc55 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -526,6 +526,9 @@  extern const VMStateDescription vmstate_ide_drive;
 #define VMSTATE_IDE_DRIVES(_field, _state) \
     VMSTATE_STRUCT_ARRAY(_field, _state, 2, 3, vmstate_ide_drive, IDEState)
 
+#define VMSTATE_IDE_DRIVE(_field, _state) \
+    VMSTATE_STRUCT(_field, _state, 1, vmstate_ide_drive, IDEState)
+
 void ide_bus_reset(IDEBus *bus);
 int64_t ide_get_sector(IDEState *s);
 void ide_set_sector(IDEState *s, int64_t sector_num);