Skip to contentSkip to conversation

drm/i915: Use Transparent Hugepages when IOMMU is enabled

PATCH Superseded Tvrtko Ursulin 3 participants 5 messages Sep 7, 2021 – Sep 8, 2021

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 drm/i915: Use Transparent Hugepages when IOMMU is enabled

From: Tvrtko Ursulin <[email protected]>

Usage of Transparent Hugepages was disabled in 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A"), but since it appears majority of performance regressions reported with an enabled IOMMU can be almost eliminated by turning them on, lets just do that.

To err on the side of safety we keep the current default in cases where IOMMU is not active, and only when it is default to the "huge=within_size" mode. Although there probably would be wins to enable them throughout, more extensive testing across benchmarks and platforms would need to be done.

With the patch and IOMMU enabled my local testing on a small Skylake part shows OglVSTangent regression being reduced from ~14% (IOMMU on versus IOMMU off) to ~2% (same comparison but with THP on).

More detailed testing done in the below referenced Gitlab issue by Eero:

Skylake GT4e:

Performance drops from enabling IOMMU:

30-35% SynMark CSDof
20-25% Unigine Heaven, MemBW GPU write, SynMark VSTangent ~20% GLB Egypt (1/2 screen window)
10-15% GLB T-Rex (1/2 screen window)
8-10% GfxBench T-Rex, MemBW GPU blit
7-8% SynMark DeferredAA + TerrainFly* + ZBuffer
6-7% GfxBench Manhattan 3.0 + 3.1, SynMark TexMem128 & CSCloth 5-6% GfxBench CarChase, Unigine Valley
3-5% GfxBench Vulkan & GL AztecRuins + ALU2, MemBW GPU texture,
SynMark Fill*, Deferred, TerrainPan*
1-2% Most of the other tests

With the patch drops become:

20-25% SynMark TexMem*
15-20% GLB Egypt (1/2 screen window)
10-15% GLB T-Rex (1/2 screen window)
4-7% GfxBench T-Rex, GpuTest Triangle
1-8% GfxBench ALU2 (offscreen 1%, onscreen 8%)
3% GfxBench Manhattan 3.0, SynMark CSDof
2-3% Unigine Heaven + Valley, MemBW GPU texture
1-3 GfxBench Manhattan 3.1 + CarChase + Vulkan & GL AztecRuins

Broxton:

Performance drops from IOMMU, without patch:

30% MemBW GPU write
25% SynMark ZBuffer + Fill*
20% MemBW GPU blit
15% MemBW GPU blend, GpuTest Triangle
10-15% MemBW GPU texture
10% GLB Egypt, Unigine Heaven (had hangs), SynMark TerrainFly* 7-9% GLB T-Rex, GfxBench Manhattan 3.0 + T-Rex,
SynMark Deferred* + TexMem*
6-8% GfxBench CarChase, Unigine Valley,
SynMark CSCloth + ShMapVsm + TerrainPan*
5-6% GfxBench Manhattan 3.1 + GL AztecRuins,
SynMark CSDof + TexFilterTri
2-4% GfxBench ALU2, SynMark DrvRes + GSCloth + ShMapPcf + Batch[0-5] +
TexFilterAniso, GpuTest GiMark + 32-bit Julia

And with patch:

15-20% MemBW GPU texture
10% SynMark TexMem*
8-9% GLB Egypt (1/2 screen window)
4-5% GLB T-Rex (1/2 screen window)
3-6% GfxBench Manhattan 3.0, GpuTest FurMark,
SynMark Deferred + TexFilterTri
3-4% GfxBench Manhattan 3.1 + T-Rex, SynMark VSInstancing 2-4% GpuTest Triangle, SynMark DeferredAA
2-3% Unigine Heaven + Valley
1-3% SynMark Terrain*
1-2% GfxBench CarChase, SynMark TexFilterAniso + ZBuffer

Tigerlake-H:

20-25% MemBW GPU texture
15-20% GpuTest Triangle
13-15% SynMark TerrainFly* + DeferredAA + HdrBloom
8-10% GfxBench Manhattan 3.1, SynMark TerrainPan* + DrvRes 6-7% GfxBench Manhattan 3.0, SynMark TexMem*
4-8% GLB onscreen Fill + T-Rex + Egypt (more in onscreen than
offscreen versions of T-Rex/Egypt)
4-6% GfxBench CarChase + GLES AztecRuins + ALU2, GpuTest 32-bit Julia,
SynMark CSDof + DrvState
3-5% GfxBench T-Rex + Egypt, Unigine Heaven + Valley, GpuTest Plot3D 1-7% Media tests
2-3% MemBW GPU blit
1-3% Most of the rest of 3D tests

With the patch:

6-8% MemBW GPU blend => the only regression in these tests (compared
to IOMMU without THP)
4-6% SynMark DrvState (not impacted) + HdrBloom (improved) 3-4% GLB T-Rex
~3% GLB Egypt, SynMark DrvRes
1-3% GfxBench T-Rex + Egypt, SynMark TexFilterTri
1-2% GfxBench CarChase + GLES AztecRuins, Unigine Valley,
GpuTest Triangle
~1% GfxBench Manhattan 3.0/3.1, Unigine Heaven

Perf of several tests actually improved with IOMMU + THP, compared to no IOMMU / no THP:

10-15% SynMark Batch[0-3]
5-10% MemBW GPU texture, SynMark ShMapVsm
3-4% SynMark Fill* + Geom*
2-3% SynMark TexMem512 + CSCloth
1-2% SynMark TexMem128 + DeferredAA

v2:
* Add Kconfig dependency to transparent hugepages and some help text.
* Move to helper for easier handling of kernel build options.

v3:
* Drop Kconfig. (Daniel)

v4:
* Add some benchmark results to commit message.

References: b901bb89324a ("drm/i915/gemfs: enable THP")
References: 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")
References: https://gitlab.freedesktop.org/drm/intel/-/issues/430

Cc Joonas Lahtinen <[email protected]>
Cc Matthew Auld <[email protected]>
Cc Eero Tamminen <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gemfs.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gem/i915_gemfs.c +19 -3
index 5e6e8c91ab38..dbdbdc344d87 100644
@@ -6,7 +6,6 @@
 
 #include <linux/fs.h>
 #include <linux/mount.h>
-#include <linux/pagemap.h>
 
 #include "i915_drv.h"
 #include "i915_gemfs.h"
@@ -15,6 +14,7 @@ int i915_gemfs_init(struct drm_i915_private *i915)
 {
 	struct file_system_type *type;
 	struct vfsmount *gemfs;
+	char *opts;
 
 	type = get_fs_type("tmpfs");
 	if (!type)
@@ -26,10 +26,26 @@ int i915_gemfs_init(struct drm_i915_private *i915)
 	 *
 	 * One example, although it is probably better with a per-file
 	 * control, is selecting huge page allocations ("huge=within_size").
-	 * Currently unused due to bandwidth issues (slow reads) on Broadwell+.
+	 * However, we only do so to offset the overhead of iommu lookups
+	 * due to bandwidth issues (slow reads) on Broadwell+.
 	 */
 
-	gemfs = kern_mount(type);
+	opts = NULL;
+	if (intel_vtd_active()) {
+		if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
+			static char huge_opt[] = "huge=within_size"; /* r/w */
+
+			opts = huge_opt;
+			drm_info(&i915->drm,
+				 "Transparent Hugepage mode '%s'\n",
+				 opts);
+		} else {
+			drm_notice(&i915->drm,
+				   "Transparent Hugepage support is recommended for optimal performance when IOMMU is enabled!\n");
+		}
+	}
+
+	gemfs = vfs_kern_mount(type, SB_KERNMOUNT, type->name, opts);
 	if (IS_ERR(gemfs))
 		return PTR_ERR(gemfs);
 
Signature · 1 line
2.30.2
#1 lore raw

Hi,

For completeness sake, it might be worth mentioning specifically what (synthetic) test-cases regress with THP patch.

* Skylake GT4e:
20-25% SynMark TexMem*
(whereas all MemBW GPU tests either improve or are not affected)

* Broxton J4205:
7% MemBW GPU texture
2-3% SynMark TexMem*

* Tigerlake-H:
7% MemBW GPU blend

I have no idea why on GEN9 texture accesses regress, but on GEN12 TGL it's render buffer blend that regresses.

Blend (read+write) regressing is especially odd, as neither render buffer read nor write regresses.

Maybe that is a GEN12 specific driver bug similar to Mesa/i965 bug from few years back in how its shaders access render buffer, that had caused SIMD32 accesses to regress memory BW bound test-cases perf a bit compared to SIMD16?

(Blend test is likely to run nowadays as SIMD32.)

- Eero

Quoted 193 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Usage of Transparent Hugepages was disabled in 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A"), but since it appears majority of performance regressions reported with an enabled IOMMU can be almost eliminated by turning them on, lets just do that.

To err on the side of safety we keep the current default in cases where IOMMU is not active, and only when it is default to the "huge=within_size" mode. Although there probably would be wins to enable them throughout, more extensive testing across benchmarks and platforms would need to be done.

With the patch and IOMMU enabled my local testing on a small Skylake part shows OglVSTangent regression being reduced from ~14% (IOMMU on versus IOMMU off) to ~2% (same comparison but with THP on).

More detailed testing done in the below referenced Gitlab issue by Eero:

Skylake GT4e:

Performance drops from enabling IOMMU:

30-35% SynMark CSDof
20-25% Unigine Heaven, MemBW GPU write, SynMark VSTangent ~20% GLB Egypt (1/2 screen window)
10-15% GLB T-Rex (1/2 screen window)
8-10% GfxBench T-Rex, MemBW GPU blit
7-8% SynMark DeferredAA + TerrainFly* + ZBuffer
6-7% GfxBench Manhattan 3.0 + 3.1, SynMark TexMem128 & CSCloth 5-6% GfxBench CarChase, Unigine Valley
3-5% GfxBench Vulkan & GL AztecRuins + ALU2, MemBW GPU texture,
SynMark Fill*, Deferred, TerrainPan*
1-2% Most of the other tests

With the patch drops become:

20-25% SynMark TexMem*
15-20% GLB Egypt (1/2 screen window)
10-15% GLB T-Rex (1/2 screen window)
4-7% GfxBench T-Rex, GpuTest Triangle
1-8% GfxBench ALU2 (offscreen 1%, onscreen 8%)
3% GfxBench Manhattan 3.0, SynMark CSDof
2-3% Unigine Heaven + Valley, MemBW GPU texture
1-3 GfxBench Manhattan 3.1 + CarChase + Vulkan & GL AztecRuins

Broxton:

Performance drops from IOMMU, without patch:

30% MemBW GPU write
25% SynMark ZBuffer + Fill*
20% MemBW GPU blit
15% MemBW GPU blend, GpuTest Triangle
10-15% MemBW GPU texture
10% GLB Egypt, Unigine Heaven (had hangs), SynMark TerrainFly* 7-9% GLB T-Rex, GfxBench Manhattan 3.0 + T-Rex,
SynMark Deferred* + TexMem*
6-8% GfxBench CarChase, Unigine Valley,
SynMark CSCloth + ShMapVsm + TerrainPan*
5-6% GfxBench Manhattan 3.1 + GL AztecRuins,
SynMark CSDof + TexFilterTri
2-4% GfxBench ALU2, SynMark DrvRes + GSCloth + ShMapPcf + Batch[0-5] +
TexFilterAniso, GpuTest GiMark + 32-bit Julia

And with patch:

15-20% MemBW GPU texture
10% SynMark TexMem*
8-9% GLB Egypt (1/2 screen window)
4-5% GLB T-Rex (1/2 screen window)
3-6% GfxBench Manhattan 3.0, GpuTest FurMark,
SynMark Deferred + TexFilterTri
3-4% GfxBench Manhattan 3.1 + T-Rex, SynMark VSInstancing 2-4% GpuTest Triangle, SynMark DeferredAA
2-3% Unigine Heaven + Valley
1-3% SynMark Terrain*
1-2% GfxBench CarChase, SynMark TexFilterAniso + ZBuffer

Tigerlake-H:

20-25% MemBW GPU texture
15-20% GpuTest Triangle
13-15% SynMark TerrainFly* + DeferredAA + HdrBloom
8-10% GfxBench Manhattan 3.1, SynMark TerrainPan* + DrvRes 6-7% GfxBench Manhattan 3.0, SynMark TexMem*
4-8% GLB onscreen Fill + T-Rex + Egypt (more in onscreen than
offscreen versions of T-Rex/Egypt)
4-6% GfxBench CarChase + GLES AztecRuins + ALU2, GpuTest 32-bit Julia,
SynMark CSDof + DrvState
3-5% GfxBench T-Rex + Egypt, Unigine Heaven + Valley, GpuTest Plot3D 1-7% Media tests
2-3% MemBW GPU blit
1-3% Most of the rest of 3D tests

With the patch:

6-8% MemBW GPU blend => the only regression in these tests (compared
to IOMMU without THP)
4-6% SynMark DrvState (not impacted) + HdrBloom (improved) 3-4% GLB T-Rex
~3% GLB Egypt, SynMark DrvRes
1-3% GfxBench T-Rex + Egypt, SynMark TexFilterTri
1-2% GfxBench CarChase + GLES AztecRuins, Unigine Valley,
GpuTest Triangle
~1% GfxBench Manhattan 3.0/3.1, Unigine Heaven

Perf of several tests actually improved with IOMMU + THP, compared to no IOMMU / no THP:

10-15% SynMark Batch[0-3]
5-10% MemBW GPU texture, SynMark ShMapVsm
3-4% SynMark Fill* + Geom*
2-3% SynMark TexMem512 + CSCloth
1-2% SynMark TexMem128 + DeferredAA

v2:
* Add Kconfig dependency to transparent hugepages and some help text.
* Move to helper for easier handling of kernel build options.

v3:
* Drop Kconfig. (Daniel)

v4:
* Add some benchmark results to commit message.

References: b901bb89324a ("drm/i915/gemfs: enable THP")
References: 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")
References: https://gitlab.freedesktop.org/drm/intel/-/issues/430

Cc Joonas Lahtinen <[email protected]>
Cc Matthew Auld <[email protected]>
Cc Eero Tamminen <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Daniel Vetter <[email protected]>
---
  drivers/gpu/drm/i915/gem/i915_gemfs.c | 22 +++++++++++++++++++---
  1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gem/i915_gemfs.c +19 -3
index 5e6e8c91ab38..dbdbdc344d87 100644
@@ -6,7 +6,6 @@
 
  #include <linux/fs.h>
  #include <linux/mount.h>
-#include <linux/pagemap.h>
 
  #include "i915_drv.h"
  #include "i915_gemfs.h"
@@ -15,6 +14,7 @@ int i915_gemfs_init(struct drm_i915_private *i915)
  {
  	struct file_system_type *type;
  	struct vfsmount *gemfs;
+	char *opts;
 
  	type = get_fs_type("tmpfs");
  	if (!type)
@@ -26,10 +26,26 @@ int i915_gemfs_init(struct drm_i915_private *i915)
  	 *
  	 * One example, although it is probably better with a per-file
  	 * control, is selecting huge page allocations ("huge=within_size").
-	 * Currently unused due to bandwidth issues (slow reads) on Broadwell+.
+	 * However, we only do so to offset the overhead of iommu lookups
+	 * due to bandwidth issues (slow reads) on Broadwell+.
  	 */
 
-	gemfs = kern_mount(type);
+	opts = NULL;
+	if (intel_vtd_active()) {
+		if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
+			static char huge_opt[] = "huge=within_size"; /* r/w */
+
+			opts = huge_opt;
+			drm_info(&i915->drm,
+				 "Transparent Hugepage mode '%s'\n",
+				 opts);
+		} else {
+			drm_notice(&i915->drm,
+				   "Transparent Hugepage support is recommended for optimal performance when IOMMU is enabled!\n");
+		}
+	}
+
+	gemfs = vfs_kern_mount(type, SB_KERNMOUNT, type->name, opts);
  	if (IS_ERR(gemfs))
  		return PTR_ERR(gemfs);
 
#2 lore raw
Quoted 8 lines · Eero Tamminen

Hi,

For completeness sake, it might be worth mentioning specifically what (synthetic) test-cases regress with THP patch.

* Skylake GT4e:
  20-25% SynMark TexMem*
  (whereas all MemBW GPU tests either improve or are not affected)

Quoted 6 lines

* Broxton J4205:
  7% MemBW GPU texture
  2-3% SynMark TexMem*

* Tigerlake-H:
  7% MemBW GPU blend

Ah right that makes sense. All the entries marker with asterisk under the "with patch" list. Okay if I just add an explanation on what does the asterisk mean for them at a single place?

And about the Broxton one. In the bug you put "15-20% MemBW GPU texture" and "10% SynMark TexMem*" so from where are these numbers now?

Quoted 8 lines

I have no idea why on GEN9 texture accesses regress, but on GEN12 TGL it's render buffer blend that regresses.

Blend (read+write) regressing is especially odd, as neither render buffer read nor write regresses.

Maybe that is a GEN12 specific driver bug similar to Mesa/i965 bug from few years back in how its shaders access render buffer, that had caused SIMD32 accesses to regress memory BW bound test-cases perf a bit compared to SIMD16?

(Blend test is likely to run nowadays as SIMD32.)

No idea on this one from me, leaving to more qualified people to comment.

Regards,

Tvrtko

Quoted 194 lines

    - Eero

Quoted 190 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Usage of Transparent Hugepages was disabled in 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A"), but since it appears majority of performance regressions reported with an enabled IOMMU can be almost eliminated by turning them on, lets just do that.

To err on the side of safety we keep the current default in cases where IOMMU is not active, and only when it is default to the "huge=within_size" mode. Although there probably would be wins to enable them throughout, more extensive testing across benchmarks and platforms would need to be done.

With the patch and IOMMU enabled my local testing on a small Skylake part shows OglVSTangent regression being reduced from ~14% (IOMMU on versus IOMMU off) to ~2% (same comparison but with THP on).

More detailed testing done in the below referenced Gitlab issue by Eero:

Skylake GT4e:

Performance drops from enabling IOMMU:

     30-35% SynMark CSDof
     20-25% Unigine Heaven, MemBW GPU write, SynMark VSTangent ~20% GLB Egypt  (1/2 screen window)
     10-15% GLB T-Rex (1/2 screen window)
     8-10% GfxBench T-Rex, MemBW GPU blit
     7-8% SynMark DeferredAA + TerrainFly* + ZBuffer
     6-7% GfxBench Manhattan 3.0 + 3.1, SynMark TexMem128 & CSCloth 5-6% GfxBench CarChase, Unigine Valley
     3-5% GfxBench Vulkan & GL AztecRuins + ALU2, MemBW GPU texture, SynMark Fill*, Deferred, TerrainPan*
     1-2% Most of the other tests

With the patch drops become:

     20-25% SynMark TexMem*
     15-20% GLB Egypt (1/2 screen window)
     10-15% GLB T-Rex (1/2 screen window)
     4-7% GfxBench T-Rex, GpuTest Triangle
     1-8% GfxBench ALU2 (offscreen 1%, onscreen 8%)
     3% GfxBench Manhattan 3.0, SynMark CSDof
     2-3% Unigine Heaven + Valley, MemBW GPU texture
     1-3 GfxBench Manhattan 3.1 + CarChase + Vulkan & GL AztecRuins

Broxton:

Performance drops from IOMMU, without patch:

     30% MemBW GPU write
     25% SynMark ZBuffer + Fill*
     20% MemBW GPU blit
     15% MemBW GPU blend, GpuTest Triangle
     10-15% MemBW GPU texture
     10% GLB Egypt, Unigine Heaven (had hangs), SynMark TerrainFly* 7-9% GLB T-Rex, GfxBench Manhattan 3.0 + T-Rex,
          SynMark Deferred* + TexMem*
     6-8% GfxBench CarChase, Unigine Valley,
          SynMark CSCloth + ShMapVsm + TerrainPan*
     5-6% GfxBench Manhattan 3.1 + GL AztecRuins,
          SynMark CSDof + TexFilterTri
     2-4% GfxBench ALU2, SynMark DrvRes + GSCloth + ShMapPcf + Batch[0-5] + TexFilterAniso, GpuTest GiMark + 32-bit Julia

And with patch:

     15-20% MemBW GPU texture
     10% SynMark TexMem*
     8-9% GLB Egypt (1/2 screen window)
     4-5% GLB T-Rex (1/2 screen window)
     3-6% GfxBench Manhattan 3.0, GpuTest FurMark, SynMark Deferred + TexFilterTri
     3-4% GfxBench Manhattan 3.1 + T-Rex, SynMark VSInstancing 2-4% GpuTest Triangle, SynMark DeferredAA
     2-3% Unigine Heaven + Valley
     1-3% SynMark Terrain*
     1-2% GfxBench CarChase, SynMark TexFilterAniso + ZBuffer

Tigerlake-H:

     20-25% MemBW GPU texture
     15-20% GpuTest Triangle
     13-15% SynMark TerrainFly* + DeferredAA + HdrBloom
     8-10% GfxBench Manhattan 3.1, SynMark TerrainPan* + DrvRes 6-7% GfxBench Manhattan 3.0, SynMark TexMem*
     4-8% GLB onscreen Fill + T-Rex + Egypt (more in onscreen than offscreen versions of T-Rex/Egypt)
     4-6% GfxBench CarChase + GLES AztecRuins + ALU2, GpuTest 32-bit Julia, SynMark CSDof + DrvState
     3-5% GfxBench T-Rex + Egypt, Unigine Heaven + Valley, GpuTest Plot3D 1-7% Media tests
     2-3% MemBW GPU blit
     1-3% Most of the rest of 3D tests

With the patch:

     6-8% MemBW GPU blend => the only regression in these tests (compared to IOMMU without THP)
     4-6% SynMark DrvState (not impacted) + HdrBloom (improved) 3-4% GLB T-Rex
     ~3% GLB Egypt, SynMark DrvRes
     1-3% GfxBench T-Rex + Egypt, SynMark TexFilterTri
     1-2% GfxBench CarChase + GLES AztecRuins, Unigine Valley, GpuTest Triangle
     ~1% GfxBench Manhattan 3.0/3.1, Unigine Heaven

Perf of several tests actually improved with IOMMU + THP, compared to no IOMMU / no THP:

     10-15% SynMark Batch[0-3]
     5-10% MemBW GPU texture, SynMark ShMapVsm
     3-4% SynMark Fill* + Geom*
     2-3% SynMark TexMem512 + CSCloth
     1-2% SynMark TexMem128 + DeferredAA

v2:
  * Add Kconfig dependency to transparent hugepages and some help text.
  * Move to helper for easier handling of kernel build options.

v3:
  * Drop Kconfig. (Daniel)

v4:
  * Add some benchmark results to commit message.

References: b901bb89324a ("drm/i915/gemfs: enable THP")
References: 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")
References: https://gitlab.freedesktop.org/drm/intel/-/issues/430

Cc Joonas Lahtinen <[email protected]>
Cc Matthew Auld <[email protected]>
Cc Eero Tamminen <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Daniel Vetter <[email protected]>

---
  drivers/gpu/drm/i915/gem/i915_gemfs.c | 22 +++++++++++++++++++---

  1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gem/i915_gemfs.c +1 -2
index 5e6e8c91ab38..dbdbdc344d87 100644
@@ -6,7 +6,6 @@
   #include <linux/fs.h>
   #include <linux/mount.h>
-#include <linux/pagemap.h>
   #include "i915_drv.h"
   #include "i915_gemfs.h"
@@ -15,6 +14,7 @@ int i915_gemfs_init(struct drm_i915_private *i915)
   {
       struct file_system_type *type;
       struct vfsmount *gemfs;
+    char *opts;
       type = get_fs_type("tmpfs");
       if (!type)
@@ -26,10 +26,26 @@ int i915_gemfs_init(struct drm_i915_private *i915)
        *
        * One example, although it is probably better with a per-file
        * control, is selecting huge page allocations ("huge=within_size").
-     * Currently unused due to bandwidth issues (slow reads) on 

Broadwell+.
+     * However, we only do so to offset the overhead of iommu lookups +     * due to bandwidth issues (slow reads) on Broadwell+. */
-    gemfs = kern_mount(type);
+    opts = NULL;
+    if (intel_vtd_active()) {
+        if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
+            static char huge_opt[] = "huge=within_size"; /* r/w */ +
+            opts = huge_opt;
+            drm_info(&i915->drm,
+                 "Transparent Hugepage mode '%s'\n",
+                 opts);
+        } else {
+            drm_notice(&i915->drm,
+                   "Transparent Hugepage support is recommended for optimal performance when IOMMU is enabled!\n");
+        }
+    }
+
+    gemfs = vfs_kern_mount(type, SB_KERNMOUNT, type->name, opts); if (IS_ERR(gemfs))
          return PTR_ERR(gemfs);

#3 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Use Transparent Hugepages when IOMMU is enabled (rev2)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Use Transparent Hugepages when IOMMU is enabled (rev2)
URL : https://patchwork.freedesktop.org/series/93122/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
2f994050d821 drm/i915: Use Transparent Hugepages when IOMMU is enabled
-:6: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")'
#6: 
Usage of Transparent Hugepages was disabled in 9987da4b5dcf

-:130: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit b901bb89324a ("drm/i915/gemfs: enable THP")' #130:
References: b901bb89324a ("drm/i915/gemfs: enable THP")

-:131: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #131:
References: 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")

-:131: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")' #131:
References: 9987da4b5dcf ("drm/i915: Disable THP until we have a GPU read BW W/A")

-:177: WARNING:STATIC_CONST_CHAR_ARRAY: static char array declaration should probably be static const char #177: FILE: drivers/gpu/drm/i915/gem/i915_gemfs.c:36:
+ static char huge_opt[] = "huge=within_size"; /* r/w */

total: 3 errors, 2 warnings, 0 checks, 42 lines checked

#4 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Use Transparent Hugepages when IOMMU is enabled (rev2)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Use Transparent Hugepages when IOMMU is enabled (rev2)
URL : https://patchwork.freedesktop.org/series/93122/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10557 -> Patchwork_20973
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_20973 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_20973, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_20973:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@hugepages:
- fi-rkl-11600: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-rkl-11600/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-rkl-11600/igt@i915_selftest@[email protected]
- fi-icl-u2: [PASS][3] -> [DMESG-FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-icl-u2/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-icl-u2/igt@i915_selftest@[email protected]
- fi-ivb-3770: [PASS][5] -> [DMESG-FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-ivb-3770/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-ivb-3770/igt@i915_selftest@[email protected]
- fi-tgl-1115g4: [PASS][7] -> [DMESG-FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-tgl-1115g4/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-tgl-1115g4/igt@i915_selftest@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_selftest@live@hugepages:
- {fi-ehl-2}: [PASS][9] -> [DMESG-FAIL][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-ehl-2/igt@i915_selftest@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-ehl-2/igt@i915_selftest@[email protected]

Known issues
------------

Here are the changes found in Patchwork_20973 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@core_hotunplug@unbind-rebind:
- fi-rkl-guc: [PASS][11] -> [DMESG-WARN][12] ([i915#3925])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10557/fi-rkl-guc/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-rkl-guc/igt@[email protected]

* igt@runner@aborted:
- fi-kbl-r: NOTRUN -> [FAIL][13] ([i915#1569] / [i915#192] / [i915#193] / [i915#194] / [i915#3363])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-kbl-r/igt@[email protected]
- fi-rkl-guc: NOTRUN -> [FAIL][14] ([i915#1602])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/fi-rkl-guc/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1569]: https://gitlab.freedesktop.org/drm/intel/issues/1569
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#192]: https://gitlab.freedesktop.org/drm/intel/issues/192
[i915#193]: https://gitlab.freedesktop.org/drm/intel/issues/193
[i915#194]: https://gitlab.freedesktop.org/drm/intel/issues/194
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#3925]: https://gitlab.freedesktop.org/drm/intel/issues/3925

Participating hosts (47 -> 39)
------------------------------

Missing (8): fi-ilk-m540 bat-adls-5 bat-dg1-6 fi-hsw-4200u fi-bsw-cyan bat-adlp-4 fi-ctg-p8600 fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_10557 -> Patchwork_20973

CI-20190529: 20190529
CI_DRM_10557: e8f764006582e44658833c07aef79c8c4b1a0758 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6198: 0f17f38c3e5e2139e59f1458c149bb7a93c88bbf @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20973: 2f994050d821336a21e5ad1bc8d2663e66ea90a1 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

2f994050d821 drm/i915: Use Transparent Hugepages when IOMMU is enabled

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20973/index.html