VFIO fixes 2018-08-23
- Fix coverity reported issue with use of realpath (Alex Williamson) - Cleanup file descriptor in error path (Alex Williamson) - Fix postcopy use of new balloon inhibitor (Alex Williamson) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIcBAABAgAGBQJbfuTxAAoJECObm247sIsiO0sP/RJKVP52D5ZXChdv/Fxwo2N/ 5UulKRDVu1RAGKPFxww2JHN3hoo4Jz3keGSnK4l300pMBbxRLZsB8189IIb95ejH EzRFM73icK2//2zunFnv7V8CjcBS9Ol2ST6OdGmHk+kp5XFEb0wsysPn7lL+b0Uv +Ijext7xgPqqc6Lz7WiKcjcducD6Rm8ReIItvYw0S7ePVGviK8b/lM2BtfQOZY0W hlkp89za5l4fZigpHFy3XM9v1LEbtAUwnIWh+iHMelRU91og07cvnMuLINdaXyy9 lF52REiPL1jOTRQZMOuUUcuXBAHgeHtoVd837TRuZTI2kcresSC3b3SVgu7zG0To Z48fVIaFxmwjAcwJmzckash2Jhk3CfSE5HJvX1CODtWbSLh+o28MekxGGMPWpYM/ XJK8kTY7atace72j86f05INE4jPwQ3okak1jLb7FXz2LfRjpplPKeLEzSnhjm0dg 63e0c88D1eNTEad6H1WYrq9WZ7yjgEgu3jDBTtah+ZKKHPltUbOkc9j+ZkHWFsFK VIHNAD1X8TJCqj5vxSEAgiqT+XxIn8LfTrfCoeORJsoEfGJaRPTKMkdEGq7M1/k4 XMVJY7uK5C1p7loaUcqKs2J3RkIKuE4HvDWLXkeeAFHc1s9wtOzEBoKucREGt0UR V7L6J9paWJA4YQMy5SLw =aRcH -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20180823.1' into staging VFIO fixes 2018-08-23 - Fix coverity reported issue with use of realpath (Alex Williamson) - Cleanup file descriptor in error path (Alex Williamson) - Fix postcopy use of new balloon inhibitor (Alex Williamson) # gpg: Signature made Thu 23 Aug 2018 17:46:41 BST # gpg: using RSA key 239B9B6E3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" # Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22 * remotes/awilliam/tags/vfio-fixes-20180823.1: postcopy: Synchronize usage of the balloon inhibitor vfio/pci: Fix failure to close file descriptor on error vfio/pci: Handle subsystem realpath() returning NULL Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
17182bb47f
@ -1432,6 +1432,7 @@ int vfio_get_device(VFIOGroup *group, const char *name,
|
||||
if (!QLIST_EMPTY(&group->device_list)) {
|
||||
error_setg(errp,
|
||||
"Inconsistent device balloon setting within group");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2879,7 +2879,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||
tmp = g_strdup_printf("%s/subsystem", vdev->vbasedev.sysfsdev);
|
||||
subsys = realpath(tmp, NULL);
|
||||
g_free(tmp);
|
||||
is_mdev = (strcmp(subsys, "/sys/bus/mdev") == 0);
|
||||
is_mdev = subsys && (strcmp(subsys, "/sys/bus/mdev") == 0);
|
||||
free(subsys);
|
||||
|
||||
trace_vfio_mdev(vdev->vbasedev.name, is_mdev);
|
||||
|
@ -509,6 +509,20 @@ int postcopy_ram_incoming_init(MigrationIncomingState *mis)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Manage a single vote to the QEMU balloon inhibitor for all postcopy usage,
|
||||
* last caller wins.
|
||||
*/
|
||||
static void postcopy_balloon_inhibit(bool state)
|
||||
{
|
||||
static bool cur_state = false;
|
||||
|
||||
if (state != cur_state) {
|
||||
qemu_balloon_inhibit(state);
|
||||
cur_state = state;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* At the end of a migration where postcopy_ram_incoming_init was called.
|
||||
*/
|
||||
@ -539,7 +553,7 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
|
||||
mis->have_fault_thread = false;
|
||||
}
|
||||
|
||||
qemu_balloon_inhibit(false);
|
||||
postcopy_balloon_inhibit(false);
|
||||
|
||||
if (enable_mlock) {
|
||||
if (os_mlock() < 0) {
|
||||
@ -1109,7 +1123,7 @@ int postcopy_ram_enable_notify(MigrationIncomingState *mis)
|
||||
* Ballooning can mark pages as absent while we're postcopying
|
||||
* that would cause false userfaults.
|
||||
*/
|
||||
qemu_balloon_inhibit(true);
|
||||
postcopy_balloon_inhibit(true);
|
||||
|
||||
trace_postcopy_ram_enable_notify();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user