qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>,
	Jens Freimann <jfreimann@redhat.com>
Subject: Re: [PATCH v3] failover: unregister ROM on unplug
Date: Wed, 21 Jul 2021 15:41:13 +0200	[thread overview]
Message-ID: <87tukneqdi.fsf@secure.mitica> (raw)
In-Reply-To: <YPgAjFzE/hq+tSIS@work-vm> (David Alan Gilbert's message of "Wed,  21 Jul 2021 12:10:04 +0100")

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Laurent Vivier (lvivier@redhat.com) wrote:
>> The intend of failover is to allow to migrate a VM with a VFIO
>> networking card without disrupting the network operation by switching
>> to a virtio-net device during the migration.
>> 
>> This simple change allows to test failover with a simulated device
>> like e1000e rather than a vfio device, even if it's useless in real
>> life it can help to debug failover.
>> 
>> This is interesting to developers that want to test failover on
>> a system with no vfio device. Moreover it simplifies host networking
>> configuration as we can use the same bridge for virtio-net and
>> the other failover networking device.
>> 
>> Without this change the migration of a system configured with failover
>> fails with:
>> 
>>   ...
>>   -device virtio-net-pci,id=virtionet0,failover=on,...  \
>>   -device e1000,failover_pair_id=virtionet0,... \
>>   ...
>> 
>>   (qemu) migrate ...
>> 
>>   Unknown ramblock "0000:00:01.1:00.0/e1000e.rom", cannot accept migration
>>   error while loading state for instance 0x0 of device 'ram'
>>   load of migration failed: Invalid argument
>> 
>> This happens because QEMU correctly unregisters the interface vmstate but
>> not the ROM one. This patch fixes that.
>> 
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>> 
>> Notes:
>>     v3:
>>       remove useless space before comma
>>     
>>     v2:
>>       reset has_rom to false
>>       update commit log message
>> 
>>  hw/net/virtio-net.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> 
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 16d20cdee52a..c0c2ec1ebb98 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -3256,6 +3256,10 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s)
>>      if (migration_in_setup(s) && !should_be_hidden) {
>>          if (failover_unplug_primary(n, dev)) {
>>              vmstate_unregister(VMSTATE_IF(dev), qdev_get_vmsd(dev), dev);
>> +            if (PCI_DEVICE(dev)->has_rom) {
>> +                PCI_DEVICE(dev)->has_rom = false;
>> +                vmstate_unregister_ram(&PCI_DEVICE(dev)->rom, dev);
>> +            }
>
> Not actually originated by your fix, but....
>
> Why doesn't failover_replug_primary re-add the vmstates?

Because we can't migrate until the "unplug" has happened.
Yes, it is a mess.

I think this is the saner patch that I can think of for that
functionality.

What I wonder is why we register rom as ram, but I guess that the rom
can be updated from userspace, or who knows.

Later, Juan.

> (I did wonder if passing rom-file="" to the e1000 would help in your
> testing case, but it still creates the RAM image).
>
> Dave
>
>>              qapi_event_send_unplug_primary(dev->id);
>>              qatomic_set(&n->failover_primary_hidden, true);
>>          } else {
>> -- 
>> 2.31.1
>> 



  parent reply	other threads:[~2021-07-21 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  9:39 [PATCH v3] failover: unregister ROM on unplug Laurent Vivier
2021-07-21 11:10 ` Dr. David Alan Gilbert
2021-07-21 11:22   ` Laurent Vivier
2021-07-21 13:41   ` Juan Quintela [this message]
2021-07-21 13:45     ` Dr. David Alan Gilbert
2021-07-21 14:01       ` Philippe Mathieu-Daudé
2021-07-21 13:56 ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tukneqdi.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jfreimann@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).