Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253668

[PATCH v2 6/6] vfio: platform: move get/put reset at open/release

From Eric Auger <eric.auger@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v2 6/6] vfio: platform: move get/put reset at open/release
Date 2015-10-22 11:50 +0200
Message-ID <qmkFs-6UJ-5@gated-at.bofh.it> (permalink)
References <qmkFs-6UJ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Currently reset lookup is done on probe. This introduces a
race with new registration mechanism in the case where the
vfio-platform driver is bound to the device before its module
is loaded: on the load, the probe happens which triggers the
reset module load which itself attempts to get the symbol for
the registration function (vfio_platform_register_reset). The
symbol is not yet available hence the lookup fails. In case we
do the lookup in the first open we are sure the vfio-platform
module is loaded and vfio_platform_register_reset is available.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 drivers/vfio/platform/vfio_platform_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index 95b8294..5ebae8c 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -155,6 +155,7 @@ static void vfio_platform_release(void *device_data)
 			vdev->reset(vdev);
 		vfio_platform_regions_cleanup(vdev);
 		vfio_platform_irq_cleanup(vdev);
+		vfio_platform_put_reset(vdev);
 	}
 
 	mutex_unlock(&driver_lock);
@@ -181,6 +182,8 @@ static int vfio_platform_open(void *device_data)
 		if (ret)
 			goto err_irq;
 
+		vfio_platform_get_reset(vdev);
+
 		if (vdev->reset)
 			vdev->reset(vdev);
 	}
@@ -570,8 +573,6 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev,
 		return ret;
 	}
 
-	vfio_platform_get_reset(vdev);
-
 	mutex_init(&vdev->igate);
 
 	return 0;
@@ -585,7 +586,6 @@ struct vfio_platform_device *vfio_platform_remove_common(struct device *dev)
 	vdev = vfio_del_group_dev(dev);
 
 	if (vdev) {
-		vfio_platform_put_reset(vdev);
 		iommu_group_put(dev->iommu_group);
 	}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2 6/6] vfio: platform: move get/put reset at open/release Eric Auger <eric.auger@linaro.org> - 2015-10-22 11:50 +0200
  Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Arnd Bergmann <arnd@arndb.de> - 2015-10-22 12:30 +0200
    Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Eric Auger <eric.auger@linaro.org> - 2015-10-22 13:50 +0200
      Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Arnd Bergmann <arnd@arndb.de> - 2015-10-22 14:10 +0200
        Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Eric Auger <eric.auger@linaro.org> - 2015-10-22 14:30 +0200
    Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Eric Auger <eric.auger@linaro.org> - 2015-10-22 15:30 +0200
      Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Arnd Bergmann <arnd@arndb.de> - 2015-10-22 16:20 +0200
        Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Eric Auger <eric.auger@linaro.org> - 2015-10-22 16:30 +0200
          Re: [PATCH v2 6/6] vfio: platform: move get/put reset at  open/release Alex Williamson <alex.williamson@redhat.com> - 2015-10-22 17:50 +0200

csiph-web