From nobody Sat May 18 07:31:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1562288963; cv=none; d=zoho.com; s=zohoarc; b=hGgJSWp2msaQZiswzMmJFcCOVkj/PHIsf3reUAWTijhLb2zLhVLSqrUKcHvsiVW+z0evlsUSaAA+Tfb9/iAEBvmJydn5QELffdcS9x6W5TOdH7tIBdrwHWGBgA0oGlFz4gQNhEs6JHFfWZp3yxYE5ebEYGObG3wB3APRSEgJQ9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562288963; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=7VWaydvmEr5vgsNAU9NcQFy/TVwhpNurHQ4Uy2fRjOg=; b=LjTO+39Wb0ci0rvNfqhPcuDFWEdEH7TH+3wGZ8Hq06TcM+UcAsjYZL4FqV5RNKXLsQysuHpNnS1jyuCykFdScNAtUVvtNMWjMztWNF3w7fAHxm2OXXhR+TnMdDUEhYvbjefMU3xnxuNm6sOwI2ZXhRbnggDGlKdMSZzhmvSF/HQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562288963348677.6850727364134; Thu, 4 Jul 2019 18:09:23 -0700 (PDT) Received: from localhost ([::1]:49424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hjCiv-0002cH-KM for importer@patchew.org; Thu, 04 Jul 2019 21:09:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44301) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hjCi9-000209-Uf for qemu-devel@nongnu.org; Thu, 04 Jul 2019 21:08:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hjCi4-0005IP-V1 for qemu-devel@nongnu.org; Thu, 04 Jul 2019 21:08:25 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:42831) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hjCi4-0005He-M4 for qemu-devel@nongnu.org; Thu, 04 Jul 2019 21:08:20 -0400 Received: by mail-wr1-x444.google.com with SMTP id a10so7068311wrp.9 for ; Thu, 04 Jul 2019 18:08:20 -0700 (PDT) Received: from localhost.localdomain ([37.142.144.12]) by smtp.gmail.com with ESMTPSA id z2sm6375742wrt.41.2019.07.04.18.08.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jul 2019 18:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7VWaydvmEr5vgsNAU9NcQFy/TVwhpNurHQ4Uy2fRjOg=; b=ZqwrMzqTO059NRoLV93lNIU/sr9BTMnR4LvBLIFgPhyfsbNrGahI5u0mPolA3BsOrS 5gncaqvF16YZwSCBPDpmD3OpBy0RZnybFBsyeXJpE5UJqN85Qb/FdcqSOYn17eXArbaR PS3GfhBNsO853wO+czzG5lBca+rCWtD/WqDdudrBt2LaWMrX/TLWWVCOqXJUcUDu/HMt MbmbwRFnX8af+eF3nIdvn2kF2/p2skOCbBQmXruhQ2wKA/PYhz64Mtht0VX1ap60YO15 jcTwpornJNIBA01K5s5g4xZB8n9/UaU9QMOIs8dX31krrGtgIg/oTK3htIekCDYBnQr+ AhDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7VWaydvmEr5vgsNAU9NcQFy/TVwhpNurHQ4Uy2fRjOg=; b=s8dcCbNtsOnjPvDuNJyihTuUNcQq2D7uuzxlOQ9213O0eU96kYugfSL2EJ0IhDtQmJ xG1oOd3JF9WWF5jV/SpOCBfRZ2edsBoCPD6IpBI6eTnkrk3eJh6ARUbXjF1IAcyvNvc/ bjT4EqrasdIBxC1oa+C8qy/wosgywxaZbmRGYLG9wwRcOr+ySd/Lj6YbOdFIhZLEszc0 MtJPAV7sjjFCtdLVPRhWNXxwzjVsfrWa/QWxiIQbu/1+2AnHkbx8d7D7VmOs1KZG80+j ceP9pEUA1JjxlAuOsufqdIdPmI6BSUpXdDWdasmX5N9yOPa+iRwZQ19w4AkEoENyhRHY xkkg== X-Gm-Message-State: APjAAAV96keGMKRRporWwRipElBhv8jlc4j34wjYoUI9Jb7iKeHf8aUt 8dAqmWG7wbrqlbpPbTB6fauqDvTU X-Google-Smtp-Source: APXvYqzyH/vq6ZgD3LZOp8e1s6dqWatWR30aX+9ej1l9j4OA49v4i0AZ8ha0Bdq/Qmfj3K5qxDAzMQ== X-Received: by 2002:adf:ef8d:: with SMTP id d13mr739717wro.60.1562288898908; Thu, 04 Jul 2019 18:08:18 -0700 (PDT) From: Marcel Apfelbaum To: qemu-devel@nongnu.org, dmitry.fleytman@gmail.com Date: Fri, 5 Jul 2019 04:07:11 +0300 Message-Id: <20190705010711.23277-1-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH] hw/net: fix vmxnet3 live migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skrtbhtngr@gmail.com, dgilbert@redhat.com, yuval.shaia@oracle.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" At some point vmxnet3 live migration stopped working and git-bisect didn't help finding a working version. The issue is the PCI configuration space is not being migrated successfully and MSIX remains masked at destination. Remove the migration differentiation between PCI and PCIe since the logic resides now inside VMSTATE_PCI_DEVICE. Remove also the VMXNET3_COMPAT_FLAG_DISABLE_PCIE based differentiation since at 'realize' time is decided if the device is PCI or PCIe, then the above macro is enough. Use the opportunity to move to the standard VMSTATE_MSIX instead of the deprecated SaveVMHandlers. Signed-off-by: Marcel Apfelbaum Reviewed-by: Dmitry Fleytman Tested-by: Sukrit Bhatnagar --- hw/net/vmxnet3.c | 52 ++---------------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 10d01d0058..8b17548b02 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2141,21 +2141,6 @@ vmxnet3_cleanup_msi(VMXNET3State *s) msi_uninit(d); } =20 -static void -vmxnet3_msix_save(QEMUFile *f, void *opaque) -{ - PCIDevice *d =3D PCI_DEVICE(opaque); - msix_save(d, f); -} - -static int -vmxnet3_msix_load(QEMUFile *f, void *opaque, int version_id) -{ - PCIDevice *d =3D PCI_DEVICE(opaque); - msix_load(d, f); - return 0; -} - static const MemoryRegionOps b0_ops =3D { .read =3D vmxnet3_io_bar0_read, .write =3D vmxnet3_io_bar0_write, @@ -2176,11 +2161,6 @@ static const MemoryRegionOps b1_ops =3D { }, }; =20 -static SaveVMHandlers savevm_vmxnet3_msix =3D { - .save_state =3D vmxnet3_msix_save, - .load_state =3D vmxnet3_msix_load, -}; - static uint64_t vmxnet3_device_serial_num(VMXNET3State *s) { uint64_t dsn_payload; @@ -2203,7 +2183,6 @@ static uint64_t vmxnet3_device_serial_num(VMXNET3Stat= e *s) =20 static void vmxnet3_pci_realize(PCIDevice *pci_dev, Error **errp) { - DeviceState *dev =3D DEVICE(pci_dev); VMXNET3State *s =3D VMXNET3(pci_dev); int ret; =20 @@ -2249,8 +2228,6 @@ static void vmxnet3_pci_realize(PCIDevice *pci_dev, E= rror **errp) pcie_dev_ser_num_init(pci_dev, VMXNET3_DSN_OFFSET, vmxnet3_device_serial_num(s)); } - - register_savevm_live(dev, "vmxnet3-msix", -1, 1, &savevm_vmxnet3_msix,= s); } =20 static void vmxnet3_instance_init(Object *obj) @@ -2440,29 +2417,6 @@ static const VMStateDescription vmstate_vmxnet3_int_= state =3D { } }; =20 -static bool vmxnet3_vmstate_need_pcie_device(void *opaque) -{ - VMXNET3State *s =3D VMXNET3(opaque); - - return !(s->compat_flags & VMXNET3_COMPAT_FLAG_DISABLE_PCIE); -} - -static bool vmxnet3_vmstate_test_pci_device(void *opaque, int version_id) -{ - return !vmxnet3_vmstate_need_pcie_device(opaque); -} - -static const VMStateDescription vmstate_vmxnet3_pcie_device =3D { - .name =3D "vmxnet3/pcie", - .version_id =3D 1, - .minimum_version_id =3D 1, - .needed =3D vmxnet3_vmstate_need_pcie_device, - .fields =3D (VMStateField[]) { - VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State), - VMSTATE_END_OF_LIST() - } -}; - static const VMStateDescription vmstate_vmxnet3 =3D { .name =3D "vmxnet3", .version_id =3D 1, @@ -2470,9 +2424,8 @@ static const VMStateDescription vmstate_vmxnet3 =3D { .pre_save =3D vmxnet3_pre_save, .post_load =3D vmxnet3_post_load, .fields =3D (VMStateField[]) { - VMSTATE_STRUCT_TEST(parent_obj, VMXNET3State, - vmxnet3_vmstate_test_pci_device, 0, - vmstate_pci_device, PCIDevice), + VMSTATE_PCI_DEVICE(parent_obj, VMXNET3State), + VMSTATE_MSIX(parent_obj, VMXNET3State), VMSTATE_BOOL(rx_packets_compound, VMXNET3State), VMSTATE_BOOL(rx_vlan_stripping, VMXNET3State), VMSTATE_BOOL(lro_supported, VMXNET3State), @@ -2508,7 +2461,6 @@ static const VMStateDescription vmstate_vmxnet3 =3D { }, .subsections =3D (const VMStateDescription*[]) { &vmxstate_vmxnet3_mcast_list, - &vmstate_vmxnet3_pcie_device, NULL } }; --=20 2.17.1