* [CI 1/3] drm/i915: Split device release from unload
@ 2017-02-10 16:35 Chris Wilson
2017-02-10 16:35 ` [CI 2/3] drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown Chris Wilson
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-02-10 16:35 UTC (permalink / raw)
To: intel-gfx
We may need to keep our memory management alive after we have unloaded
the physical pci device. For example, if we have exported an object via
dmabuf, that will keep the device around but the pci device may be
removed before the dmabuf itself is released, use of the pci hardware
will be revoked, but the memory and object management needs to persist
for the dmabuf.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
drivers/gpu/drm/i915/i915_drv.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 300eb19a5124..502b8912c59a 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1228,8 +1228,7 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
ret = drm_dev_init(&dev_priv->drm, &driver, &pdev->dev);
if (ret) {
DRM_DEV_ERROR(&pdev->dev, "allocation failed\n");
- kfree(dev_priv);
- return ret;
+ goto out_free;
}
dev_priv->drm.pdev = pdev;
@@ -1237,7 +1236,7 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
ret = pci_enable_device(pdev);
if (ret)
- goto out_free_priv;
+ goto out_fini;
pci_set_drvdata(pdev, &dev_priv->drm);
@@ -1301,9 +1300,11 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
i915_driver_cleanup_early(dev_priv);
out_pci_disable:
pci_disable_device(pdev);
-out_free_priv:
+out_fini:
i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret);
- drm_dev_unref(&dev_priv->drm);
+ drm_dev_fini(&dev_priv->drm);
+out_free:
+ kfree(dev_priv);
return ret;
}
@@ -1384,8 +1385,16 @@ void i915_driver_unload(struct drm_device *dev)
i915_driver_cleanup_mmio(dev_priv);
intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
+}
+
+static void i915_driver_release(struct drm_device *dev)
+{
+ struct drm_i915_private *dev_priv = to_i915(dev);
i915_driver_cleanup_early(dev_priv);
+ drm_dev_fini(&dev_priv->drm);
+
+ kfree(dev_priv);
}
static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
@@ -2629,6 +2638,7 @@ static struct drm_driver driver = {
.driver_features =
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME |
DRIVER_RENDER | DRIVER_MODESET | DRIVER_ATOMIC,
+ .release = i915_driver_release,
.open = i915_driver_open,
.lastclose = i915_driver_lastclose,
.preclose = i915_driver_preclose,
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [CI 2/3] drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown
2017-02-10 16:35 [CI 1/3] drm/i915: Split device release from unload Chris Wilson
@ 2017-02-10 16:35 ` Chris Wilson
2017-02-10 16:35 ` [CI 3/3] drm/i915: Flush the freed object queue on device release Chris Wilson
2017-02-10 18:52 ` ✓ Fi.CI.BAT: success for series starting with [CI,1/3] drm/i915: Split device release from unload Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-02-10 16:35 UTC (permalink / raw)
To: intel-gfx
We may unload the PCI device before all users (such as dma-buf) are
completely shutdown. This may leave VMA in the global GTT which we want
to revoke, whilst keeping the objects themselves around to service the
dma-buf.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 3c83f2b91af0..d580e2b4081b 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2818,6 +2818,15 @@ int i915_gem_init_ggtt(struct drm_i915_private *dev_priv)
void i915_ggtt_cleanup_hw(struct drm_i915_private *dev_priv)
{
struct i915_ggtt *ggtt = &dev_priv->ggtt;
+ struct i915_vma *vma, *vn;
+
+ ggtt->base.closed = true;
+
+ mutex_lock(&dev_priv->drm.struct_mutex);
+ WARN_ON(!list_empty(&ggtt->base.active_list));
+ list_for_each_entry_safe(vma, vn, &ggtt->base.inactive_list, vm_link)
+ WARN_ON(i915_vma_unbind(vma));
+ mutex_unlock(&dev_priv->drm.struct_mutex);
if (dev_priv->mm.aliasing_ppgtt) {
struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [CI 3/3] drm/i915: Flush the freed object queue on device release
2017-02-10 16:35 [CI 1/3] drm/i915: Split device release from unload Chris Wilson
2017-02-10 16:35 ` [CI 2/3] drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown Chris Wilson
@ 2017-02-10 16:35 ` Chris Wilson
2017-02-10 18:52 ` ✓ Fi.CI.BAT: success for series starting with [CI,1/3] drm/i915: Split device release from unload Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-02-10 16:35 UTC (permalink / raw)
To: intel-gfx
As dmabufs may live beyond the PCI device removal, we need to flush the
freed object worker on device release, and include a warning in case
there is a leak.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 306a2fb362a2..303c079b75e8 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4659,7 +4659,9 @@ i915_gem_load_init(struct drm_i915_private *dev_priv)
void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)
{
+ i915_gem_drain_freed_objects(dev_priv);
WARN_ON(!llist_empty(&dev_priv->mm.free_list));
+ WARN_ON(dev_priv->mm.object_count);
mutex_lock(&dev_priv->drm.struct_mutex);
i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [CI,1/3] drm/i915: Split device release from unload
2017-02-10 16:35 [CI 1/3] drm/i915: Split device release from unload Chris Wilson
2017-02-10 16:35 ` [CI 2/3] drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown Chris Wilson
2017-02-10 16:35 ` [CI 3/3] drm/i915: Flush the freed object queue on device release Chris Wilson
@ 2017-02-10 18:52 ` Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-02-10 18:52 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [CI,1/3] drm/i915: Split device release from unload
URL : https://patchwork.freedesktop.org/series/19467/
State : success
== Summary ==
Series 19467v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/19467/revisions/1/mbox/
fi-bdw-5557u total:252 pass:241 dwarn:0 dfail:0 fail:0 skip:11
fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39
fi-bxt-j4205 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19
fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12
fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27
fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31
fi-hsw-4770 total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16
fi-hsw-4770r total:252 pass:236 dwarn:0 dfail:0 fail:0 skip:16
fi-ilk-650 total:252 pass:202 dwarn:0 dfail:0 fail:0 skip:50
fi-ivb-3520m total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18
fi-ivb-3770 total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18
fi-kbl-7500u total:252 pass:234 dwarn:0 dfail:0 fail:0 skip:18
fi-skl-6260u total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10
fi-skl-6700hq total:252 pass:235 dwarn:0 dfail:0 fail:0 skip:17
fi-skl-6700k total:252 pass:230 dwarn:4 dfail:0 fail:0 skip:18
fi-skl-6770hq total:252 pass:242 dwarn:0 dfail:0 fail:0 skip:10
fi-snb-2520m total:252 pass:224 dwarn:0 dfail:0 fail:0 skip:28
fi-snb-2600 total:252 pass:223 dwarn:0 dfail:0 fail:0 skip:29
de2ea45a48455f125439790c71bd1a5a7e82a167 drm-tip: 2017y-02m-10d-16h-49m-01s UTC integration manifest
b530530 drm/i915: Flush the freed object queue on device release
5154370 drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown
a0e8bbf drm/i915: Split device release from unload
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3771/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [CI,1/3] drm/i915: Split device release from unload
2017-02-08 14:09 [CI 1/3] " Chris Wilson
@ 2017-02-09 7:58 ` Patchwork
0 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-02-09 7:58 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: series starting with [CI,1/3] drm/i915: Split device release from unload
URL : https://patchwork.freedesktop.org/series/19312/
State : success
== Summary ==
Series 19312v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/19312/revisions/1/mbox/
Test gem_exec_fence:
Subgroup await-hang-default:
incomplete -> PASS (fi-hsw-4770)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
incomplete -> PASS (fi-ilk-650)
fi-bdw-5557u total:252 pass:238 dwarn:0 dfail:0 fail:0 skip:14
fi-bsw-n3050 total:252 pass:213 dwarn:0 dfail:0 fail:0 skip:39
fi-bxt-j4205 total:252 pass:230 dwarn:0 dfail:0 fail:0 skip:22
fi-bxt-t5700 total:83 pass:70 dwarn:0 dfail:0 fail:0 skip:12
fi-byt-j1900 total:252 pass:225 dwarn:0 dfail:0 fail:0 skip:27
fi-byt-n2820 total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31
fi-hsw-4770 total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19
fi-hsw-4770r total:252 pass:233 dwarn:0 dfail:0 fail:0 skip:19
fi-ilk-650 total:252 pass:199 dwarn:0 dfail:0 fail:0 skip:53
fi-ivb-3520m total:252 pass:231 dwarn:0 dfail:0 fail:0 skip:21
fi-ivb-3770 total:252 pass:231 dwarn:0 dfail:0 fail:0 skip:21
fi-kbl-7500u total:252 pass:229 dwarn:0 dfail:0 fail:2 skip:21
fi-skl-6260u total:252 pass:239 dwarn:0 dfail:0 fail:0 skip:13
fi-skl-6700hq total:252 pass:232 dwarn:0 dfail:0 fail:0 skip:20
fi-skl-6700k total:252 pass:227 dwarn:4 dfail:0 fail:0 skip:21
fi-snb-2520m total:252 pass:221 dwarn:0 dfail:0 fail:0 skip:31
fi-snb-2600 total:252 pass:220 dwarn:0 dfail:0 fail:0 skip:32
2699547830db3e698485f452e29278c09f084397 drm-tip: 2017y-02m-08d-18h-25m-45s UTC integration manifest
98e4fd0 drm/i915: Flush the freed object queue on device release
88fad21 drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown
d93b257 drm/i915: Split device release from unload
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3739/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-10 18:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 16:35 [CI 1/3] drm/i915: Split device release from unload Chris Wilson
2017-02-10 16:35 ` [CI 2/3] drm/i915: Unbind any residual objects/vma from the Global GTT on shutdown Chris Wilson
2017-02-10 16:35 ` [CI 3/3] drm/i915: Flush the freed object queue on device release Chris Wilson
2017-02-10 18:52 ` ✓ Fi.CI.BAT: success for series starting with [CI,1/3] drm/i915: Split device release from unload Patchwork
-- strict thread matches above, loose matches on Subject: below --
2017-02-08 14:09 [CI 1/3] " Chris Wilson
2017-02-09 7:58 ` ✓ Fi.CI.BAT: success for series starting with [CI,1/3] " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.