)]}'
{
  "commit": "2b43b2995b02e73b70d10b5be2f2b29b68c7e2fa",
  "tree": "ef1b4a9545a0257b9a201b835581b7b5ed00c18b",
  "parents": [
    "3c26c80a0a269ce7870d1475e756607e939226cd"
  ],
  "author": {
    "name": "Zhenzhong Duan",
    "email": "zhenzhong.duan@intel.com",
    "time": "Mon Jul 03 15:15:08 2023 +0800"
  },
  "committer": {
    "name": "Cédric Le Goater",
    "email": "clg@redhat.com",
    "time": "Mon Jul 10 09:52:52 2023 +0200"
  },
  "message": "vfio/migration: Free resources when vfio_migration_realize fails\n\nWhen vfio_realize() succeeds, hot unplug will call vfio_exitfn()\nto free resources allocated in vfio_realize(); when vfio_realize()\nfails, vfio_exitfn() is never called and we need to free resources\nin vfio_realize().\n\nIn the case that vfio_migration_realize() fails,\ne.g: with -only-migratable \u0026 enable-migration\u003doff, we see below:\n\n(qemu) device_add vfio-pci,host\u003d81:11.1,id\u003dvfio1,bus\u003droot1,enable-migration\u003doff\n0000:81:11.1: Migration disabled\nError: disallowing migration blocker (--only-migratable) for: 0000:81:11.1: Migration is disabled for VFIO device\n\nIf we hotplug again we should see same log as above, but we see:\n(qemu) device_add vfio-pci,host\u003d81:11.1,id\u003dvfio1,bus\u003droot1,enable-migration\u003doff\nError: vfio 0000:81:11.1: device is already attached\n\nThat\u0027s because some references to VFIO device isn\u0027t released.\nFor resources allocated in vfio_migration_realize(), free them by\njumping to out_deinit path with calling a new function\nvfio_migration_deinit(). For resources allocated in vfio_realize(),\nfree them by jumping to de-register path in vfio_realize().\n\nSigned-off-by: Zhenzhong Duan \u003czhenzhong.duan@intel.com\u003e\nFixes: a22651053b59 (\"vfio: Make vfio-pci device migration capable\")\nReviewed-by: Cédric Le Goater \u003cclg@redhat.com\u003e\nReviewed-by: Joao Martins \u003cjoao.m.martins@oracle.com\u003e\nSigned-off-by: Cédric Le Goater \u003cclg@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e6e5e85f75807693429c66c84966330d3f00246e",
      "old_mode": 33188,
      "old_path": "hw/vfio/migration.c",
      "new_id": "e3954570c85365ef2d48ad9dbb007dc3145649fc",
      "new_mode": 33188,
      "new_path": "hw/vfio/migration.c"
    },
    {
      "type": "modify",
      "old_id": "c2cf7454ece66498070740af7a7e8eca7f499923",
      "old_mode": 33188,
      "old_path": "hw/vfio/pci.c",
      "new_id": "9154dd929d07a98e61df79b16768188a0378d3f3",
      "new_mode": 33188,
      "new_path": "hw/vfio/pci.c"
    }
  ]
}
