agp/intel-gtt: Don't leak the scratch page
Subsystems (3)
PATCH 1/3 agp/intel-gtt: Don't leak the scratch page
Recently discovered by enabling CONFIG_DMA_API_DEBUG in our CI. By the looks of it broken since forever.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93793
--- drivers/char/agp/intel-gtt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/agp/intel-gtt.c +8 -0
@@ -1430,6 +1430,14 @@ void intel_gmch_remove(void)if (--intel_private.refcount)return ; +if (intel_private.scratch_page) { +if (intel_private.needs_dmar) +pci_unmap_page (intel_private.pcidev, + intel_private.scratch_page_dma, +PAGE_SIZE ,PCI_DMA_BIDIRECTIONAL ); + +__free_page (intel_private.scratch_page); + }if (intel_private.pcidev)pci_dev_put (intel_private.pcidev);if (intel_private.bridge_dev)
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915: Stop depending upon CONFIG_AGP/_INTEL
We need this to be able to paper over some CI fail: DMA API debuggin complaints that we leak the gmch scratch page, but fundamentally that's the only way to do it if there's both the intel-agp and i915 driver using it: intel-agp shadow-attaches, i915 binds for real to the gpu. But when i915 unloads we need to keep the dma-mapping for intel-agp around, and the dma debugging code doesn't approve of that.
With this patch we can disable CONFIG_AGP_INTEL and avoid this troubel.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93769
--- drivers/gpu/drm/i915/Kconfig | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/Kconfig +0 -2
@@ -2,9 +2,7 @@ config DRM_I915 tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics" depends on DRM depends on X86 && PCI - depends on (AGP || AGP=n) select INTEL_GTT - select AGP_INTEL if AGP select INTERVAL_TREE # we need shmfs for the swappable backing store, and in particular # the shmem_readpage() which depends upon tmpfs
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/3] drm/i915: Stop depending upon CONFIG_AGP/_INTEL
Quoted 9 lines · Daniel Vetter
We need this to be able to paper over some CI fail: DMA API debuggin complaints that we leak the gmch scratch page, but fundamentally that's the only way to do it if there's both the intel-agp and i915 driver using it: intel-agp shadow-attaches, i915 binds for real to the gpu. But when i915 unloads we need to keep the dma-mapping for intel-agp around, and the dma debugging code doesn't approve of that.
With this patch we can disable
CONFIG_AGP_INTELand avoid this troubel.
How about:
The AGP_INTEL driver provides an interface for very old userspace to control the GART (though the GART itself was only ever emulated on Intel systems). The pci bridge discovery code is also used by the i915.ko driver to set up the GTT on old systems, but it does not require the old userspace interface. When i915.ko selects the old interface, it binds another user to the core GTT routines, and in particular creates a second reference to the scratch pages allocated. This hinders resource leak debugging for when we unload i915.ko as we want to assert that all DMA pages have been released, but we appear to leak because of the secondary interface which persists after i915.ko unloads.
All i915.ko users do not require the old /dev/agpgart interface so stop selecting it and simplify our debugging by dropping the historical baggage.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/3] drm/i915: Stop depending upon CONFIG_AGP/_INTEL
In reply to Daniel VetterQuoted 21 lines · Daniel Vetter
We need this to be able to paper over some CI fail: DMA API debuggin complaints that we leak the gmch scratch page, but fundamentally that's the only way to do it if there's both the intel-agp and i915 driver using it: intel-agp shadow-attaches, i915 binds for real to the gpu. But when i915 unloads we need to keep the dma-mapping for intel-agp around, and the dma debugging code doesn't approve of that.
With this patch we can disable
CONFIG_AGP_INTELand avoid this troubel.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93769
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/Kconfig | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/i915/Kconfig +0
-0
drivers/gpu/drm/i915/Kconfig config DRM_I915 · line 7
Quoted 6 lines
drivers/gpu/drm/i915/Kconfig +0
-2@@ -2,9 +2,7 @@ config DRM_I915 tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics" depends on DRM depends on X86 && PCI - depends on (AGP || AGP=n) select INTEL_GTT - select AGP_INTEL if AGP
Just setting AGP=n in .config isn't enough?
Quoted 10 lines
drivers/gpu/drm/i915/Kconfig +0
-0select INTERVAL_TREE # we need shmfs for the swappable backing store, and in particular # the shmem_readpage() which depends upon tmpfsSignature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 agp/intel-gtt: Only register fake agp driver for gen1
In reply to Daniel VetterThe fake agp driver for the intel graphics gart is only needed for ums support. And we ditched that a long time ago:
commit 03dae59c72ffffd8ef6e005f48ba356c863e0587
Author: Daniel Vetter <[email protected]> Date: Wed Jul 23 16:27:25 2014 +0200
drm/i915: Ditch UMS config option
With this there's no longer the problem that 2 drivers (fake agp driver and the drm/i915 driver) fight over the same piece, which fixes apparent dma leaks detected by CONFIG_DMA_API_DEBUG.
Note that the leak isn't real since intel-gtt refcounts and will tear down eventually. But the debug code assumes that when the i915 driver unbinds from the pci device everything should be gone. Which isn't the case if we have intel-agp enabled - userspace might need it. But by ditching this intel-gtt setup and teardown is completely tied to the livetime of the "real" driver.
While at it untangle the init ordering a bit - the fake agp wouldn't be initialized correctly if i915.ko loads first. Which isn't a problem since when i915 loads in kms mode you won't need the fake agp support needed by the ums driver ...
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93793
--- drivers/char/agp/intel-gtt.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/char/agp/intel-gtt.c +12 -12
@@ -1346,16 +1346,6 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev, {int i, mask; -/* -* Can be called from the fake agp driver but also directly from -* drm/i915.ko. Hence we need to check whether everything is set up -* already. -*/ -if (intel_private.driver) { - intel_private.refcount++; -return 1 ; - } -for (i =0 ; intel_gtt_chipsets[i].name !=NULL ; i++) {if (gpu_pdev) { if (gpu_pdev->device ==
@@ -1376,16 +1366,26 @@ int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,if (!intel_private.driver)return 0 ; - intel_private.refcount++; -#if IS_ENABLED (CONFIG_AGP_INTEL )if (bridge) { +if (INTEL_GTT_GEN >1 ) +return 0 ; + bridge->driver = &intel_fake_agp_driver; bridge->dev_private_data = &intel_private; bridge->dev = bridge_pdev; }#endif + +/* +* Can be called from the fake agp driver but also directly from +* drm/i915.ko. Hence we need to check whether everything is set up +* already. +*/ +if (intel_private.refcount++) +return 1 ; + intel_private.bridge_dev =pci_dev_get (bridge_pdev);dev_info (&bridge_pdev->dev,"Intel %s Chipset\n" , intel_gtt_chipsets[i].name);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] agp/intel-gtt: Only register fake agp driver for gen1
Quoted 20 lines · Daniel Vetter
The fake agp driver for the intel graphics gart is only needed for ums support. And we ditched that a long time ago:
commit
03dae59c72ffffd8ef6e005f48ba356c863e0587Author: Daniel Vetter <[email protected]> Date: Wed Jul 23 16:27:25 2014 +0200drm/i915: Ditch UMS config option
With this there's no longer the problem that 2 drivers (fake agp driver and the drm/i915 driver) fight over the same piece, which fixes apparent dma leaks detected by
CONFIG_DMA_API_DEBUG.Note that the leak isn't real since intel-gtt refcounts and will tear down eventually. But the debug code assumes that when the i915 driver unbinds from the pci device everything should be gone. Which isn't the case if we have intel-agp enabled - userspace might need it. But by ditching this intel-gtt setup and teardown is completely tied to the livetime of the "real" driver.
Quoted 7 lines
While at it untangle the init ordering a bit - the fake agp wouldn't be initialized correctly if i915.ko loads first. Which isn't a problem since when i915 loads in kms mode you won't need the fake agp support needed by the ums driver ...
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93793
Signed-off-by Daniel Vetter <[email protected]>
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Daniel Vetter
Recently discovered by enabling
CONFIG_DMA_API_DEBUGin our CI. By the looks of it broken since forever.Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93793
Signed-off-by Daniel Vetter <[email protected]>--- drivers/char/agp/intel-gtt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/char/agp/intel-gtt.c +0
-0
drivers/char/agp/intel-gtt.c void intel_gmch_remove(void) · line 1433
Quoted 4 lines
drivers/char/agp/intel-gtt.c +1
-0@@ -1430,6 +1430,14 @@ void intel_gmch_remove(void)if (--intel_private.refcount)return ; +if (intel_private.scratch_page) {
The page (for who knows what reason) is set to uc. We need to restore it back to wb before releasing it.
drivers/char/agp/intel-gtt.c void intel_gmch_remove(void) · line 1438
Quoted 5 lines
drivers/char/agp/intel-gtt.c +5
-0+if (intel_private.needs_dmar) +pci_unmap_page (intel_private.pcidev, + intel_private.scratch_page_dma, +PAGE_SIZE ,PCI_DMA_BIDIRECTIONAL ); +
set_pages_wb(intel_private.scratch_page, 1);
Quoted 5 lines
drivers/char/agp/intel-gtt.c +2
-0+__free_page (intel_private.scratch_page); + }if (intel_private.pcidev)pci_dev_put (intel_private.pcidev);if (intel_private.bridge_dev)
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [1/3] agp/intel-gtt: Don't leak the scratch page
In reply to Daniel Vetter== Summary ==
== Summary ==
Built on 430706bace599ea1a908b9a7c6b7ea17535fe17f drm-intel-nightly: 2016y-01m-27d-16h-33m-06s UTC integration manifest
Test kms_flip:
Subgroup basic-flip-vs-dpms:
pass -> DMESG-WARN (ilk-hp8440p) UNSTABLE
Subgroup basic-flip-vs-wf_vblank:
pass -> FAIL (bdw-ultra)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
pass -> DMESG-WARN (skl-i5k-2)
Subgroup read-crc-pipe-b:
dmesg-warn -> PASS (ilk-hp8440p)bdw-nuci7 total:141 pass:132 dwarn:0 dfail:0 fail:0 skip:9 bdw-ultra total:144 pass:137 dwarn:0 dfail:0 fail:1 skip:6 bsw-nuc-2 total:144 pass:120 dwarn:0 dfail:0 fail:0 skip:24 byt-nuc total:144 pass:129 dwarn:0 dfail:0 fail:0 skip:15 hsw-brixbox total:144 pass:137 dwarn:0 dfail:0 fail:0 skip:7 hsw-gt2 total:144 pass:140 dwarn:0 dfail:0 fail:0 skip:4 ilk-hp8440p total:144 pass:104 dwarn:1 dfail:0 fail:1 skip:38 ivb-t430s total:144 pass:138 dwarn:0 dfail:0 fail:0 skip:6 skl-i5k-2 total:144 pass:134 dwarn:2 dfail:0 fail:0 skip:8 snb-dellxps total:144 pass:130 dwarn:0 dfail:0 fail:0 skip:14 snb-x220t total:144 pass:130 dwarn:0 dfail:0 fail:1 skip:13
Results at /archive/results/CI_IGT_test/Patchwork_1269/
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/3] agp/intel-gtt: Don't leak the scratch page
In reply to Daniel Vetter== Summary ==
== Summary ==
Series 2851v1 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/2851/revisions/1/mbox/
bdw-nuci7 total:156 pass:147 dwarn:0 dfail:0 fail:0 skip:9 bdw-ultra total:159 pass:153 dwarn:0 dfail:0 fail:0 skip:6 bsw-nuc-2 total:159 pass:135 dwarn:0 dfail:0 fail:0 skip:24 byt-nuc total:159 pass:142 dwarn:0 dfail:0 fail:0 skip:17 hsw-brixbox total:159 pass:152 dwarn:0 dfail:0 fail:0 skip:7 hsw-gt2 total:159 pass:155 dwarn:0 dfail:0 fail:0 skip:4 ilk-hp8440p total:159 pass:114 dwarn:0 dfail:0 fail:1 skip:44 ivb-t430s total:159 pass:151 dwarn:0 dfail:0 fail:0 skip:8 skl-i5k-2 total:159 pass:150 dwarn:1 dfail:0 fail:0 skip:8 snb-dellxps total:159 pass:141 dwarn:0 dfail:0 fail:0 skip:18 snb-x220t total:159 pass:141 dwarn:0 dfail:0 fail:1 skip:17
Results at /archive/results/CI_IGT_test/Patchwork_1298/
b3f8ad64bc71f6236f05c2e9f4ad49a61745869a drm-intel-nightly: 2016y-01m-28d-10h-26m-23s UTC integration manifest ccf350019ee7f44491df9438405c4a7c651e5c34 agp/intel-gtt: Only register fake agp driver for gen1 27a9bfda50dca90958389412d538c923dc2653ee drm/i915: Stop depending upon CONFIG_AGP/_INTEL f11f867f3f49d543d643b5b3487dfc54ad7a3ab2 agp/intel-gtt: Don't leak the scratch page
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx