Skip to contentSkip to conversation

drm/amd/amdgpu: remove vram_page_split kernel option (v3)

PATCH In review StDenis, Tom 2 participants 4 messages Jun 6, 2019 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: remove vram_page_split kernel option (v3)

This option is no longer needed. The default code paths are now the only option.

v2: Add HPAGE support and a default for non contiguous maps
v3: Misread 512 pages as MiB ...

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h          |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c   |  7 -------
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c      |  8 --------
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 14 +++++++++-----
 4 files changed, 9 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 19a00282e34c..e54f31865f60 100644
@@ -142,7 +142,6 @@ extern uint amdgpu_sdma_phase_quantum;
 extern char *amdgpu_disable_cu;
 extern char *amdgpu_virtual_display;
 extern uint amdgpu_pp_feature_mask;
-extern int amdgpu_vram_page_split;
 extern int amdgpu_ngg;
 extern int amdgpu_prim_buf_per_se;
 extern int amdgpu_pos_buf_per_se;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -7
index 0212c9ee317c..2e13b8ef6681 100644
@@ -973,13 +973,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
 	amdgpu_device_check_block_size(adev);
 
-	if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split < 16 ||
-	    !is_power_of_2(amdgpu_vram_page_split))) {
-		dev_warn(adev->dev, "invalid VRAM page split (%d)\n",
-			 amdgpu_vram_page_split);
-		amdgpu_vram_page_split = 1024;
-	}
-
 	ret = amdgpu_device_get_job_timeout_settings(adev);
 	if (ret) {
 		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -8
index 1f38d6fc1fe3..ef22a2a25448 100644
@@ -108,7 +108,6 @@ int amdgpu_vm_fragment_size = -1;
 int amdgpu_vm_block_size = -1;
 int amdgpu_vm_fault_stop = 0;
 int amdgpu_vm_debug = 0;
-int amdgpu_vram_page_split = 512;
 int amdgpu_vm_update_mode = -1;
 int amdgpu_exp_hw_support = 0;
 int amdgpu_dc = -1;
@@ -342,13 +341,6 @@ module_param_named(vm_debug, amdgpu_vm_debug, int, 0644);
 MODULE_PARM_DESC(vm_update_mode, "VM update using CPU (0 = never (default except for large BAR(LB)), 1 = Graphics only, 2 = Compute only (default for LB), 3 = Both");
 module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444);
 
-/**
- * DOC: vram_page_split (int)
- * Override the number of pages after we split VRAM allocations (default 512, -1 = disable). The default is 512.
- */
-MODULE_PARM_DESC(vram_page_split, "Number of pages after we split VRAM allocations (default 512, -1 = disable)");
-module_param_named(vram_page_split, amdgpu_vram_page_split, int, 0444);
-
 /**
  * DOC: exp_hw_support (int)
  * Enable experimental hw support (1 = enable). The default is 0 (disabled).
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +9 -5
index ec9ea3fdbb4a..8aea2f21b202 100644
@@ -284,17 +284,21 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
 	if (!lpfn)
 		lpfn = man->size;
 
-	if (place->flags & TTM_PL_FLAG_CONTIGUOUS ||
-	    amdgpu_vram_page_split == -1) {
+	if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
 		pages_per_node = ~0ul;
 		num_nodes = 1;
 	} else {
-		pages_per_node = max((uint32_t)amdgpu_vram_page_split,
-				     mem->page_alignment);
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		pages_per_node = HPAGE_PMD_NR;
+#else
+		/* default to 2MB */
+		pages_per_node = (2UL << (20UL - PAGE_SHIFT));
+#endif
+		pages_per_node = max((uint32_t)pages_per_node, mem->page_alignment);
 		num_nodes = DIV_ROUND_UP(mem->num_pages, pages_per_node);
 	}
 
-	nodes = kvmalloc_array(num_nodes, sizeof(*nodes),
+	nodes = kvmalloc_array((uint32_t)num_nodes, sizeof(*nodes),
 			       GFP_KERNEL | __GFP_ZERO);
 	if (!nodes)
 		return -ENOMEM;
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Am 06.06.19 um 12:50 schrieb StDenis, Tom:

Quoted 88 lines

This option is no longer needed. The default code paths are now the only option.

v2: Add HPAGE support and a default for non contiguous maps
v3: Misread 512 pages as MiB ...

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h          |  1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c   |  7 -------
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c      |  8 --------
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 14 +++++++++-----
  4 files changed, 9 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 19a00282e34c..e54f31865f60 100644
@@ -142,7 +142,6 @@ extern uint amdgpu_sdma_phase_quantum;
  extern char *amdgpu_disable_cu;
  extern char *amdgpu_virtual_display;
  extern uint amdgpu_pp_feature_mask;
-extern int amdgpu_vram_page_split;
  extern int amdgpu_ngg;
  extern int amdgpu_prim_buf_per_se;
  extern int amdgpu_pos_buf_per_se;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -7
index 0212c9ee317c..2e13b8ef6681 100644
@@ -973,13 +973,6 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
 
  	amdgpu_device_check_block_size(adev);
 
-	if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split < 16 ||
-	    !is_power_of_2(amdgpu_vram_page_split))) {
-		dev_warn(adev->dev, "invalid VRAM page split (%d)\n",
-			 amdgpu_vram_page_split);
-		amdgpu_vram_page_split = 1024;
-	}
-
  	ret = amdgpu_device_get_job_timeout_settings(adev);
  	if (ret) {
  		dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -8
index 1f38d6fc1fe3..ef22a2a25448 100644
@@ -108,7 +108,6 @@ int amdgpu_vm_fragment_size = -1;
  int amdgpu_vm_block_size = -1;
  int amdgpu_vm_fault_stop = 0;
  int amdgpu_vm_debug = 0;
-int amdgpu_vram_page_split = 512;
  int amdgpu_vm_update_mode = -1;
  int amdgpu_exp_hw_support = 0;
  int amdgpu_dc = -1;
@@ -342,13 +341,6 @@ module_param_named(vm_debug, amdgpu_vm_debug, int, 0644);
  MODULE_PARM_DESC(vm_update_mode, "VM update using CPU (0 = never (default except for large BAR(LB)), 1 = Graphics only, 2 = Compute only (default for LB), 3 = Both");
  module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444);
 
-/**
- * DOC: vram_page_split (int)
- * Override the number of pages after we split VRAM allocations (default 512, -1 = disable). The default is 512.
- */
-MODULE_PARM_DESC(vram_page_split, "Number of pages after we split VRAM allocations (default 512, -1 = disable)");
-module_param_named(vram_page_split, amdgpu_vram_page_split, int, 0444);
-
  /**
   * DOC: exp_hw_support (int)
   * Enable experimental hw support (1 = enable). The default is 0 (disabled).
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +3 -4
index ec9ea3fdbb4a..8aea2f21b202 100644
@@ -284,17 +284,21 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
  	if (!lpfn)
  		lpfn = man->size;
 
-	if (place->flags & TTM_PL_FLAG_CONTIGUOUS ||
-	    amdgpu_vram_page_split == -1) {
+	if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
  		pages_per_node = ~0ul;
  		num_nodes = 1;
  	} else {
-		pages_per_node = max((uint32_t)amdgpu_vram_page_split,
-				     mem->page_alignment);
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		pages_per_node = HPAGE_PMD_NR;

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man, · line 301

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +6 -1
+#else
+		/* default to 2MB */
+		pages_per_node = (2UL << (20UL - PAGE_SHIFT));
+#endif
+		pages_per_node = max((uint32_t)pages_per_node, mem->page_alignment);
  		num_nodes = DIV_ROUND_UP(mem->num_pages, pages_per_node);
  	}
 
-	nodes = kvmalloc_array(num_nodes, sizeof(*nodes),
+	nodes = kvmalloc_array((uint32_t)num_nodes, sizeof(*nodes),

You can probably drop that cast here, apart from that the patch is Reviewed-by: Christian König <[email protected]>.

Do you want to look into test/benchmark as well?

Thanks,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man, · line 304

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +0 -0
  			       GFP_KERNEL | __GFP_ZERO);
  	if (!nodes)
  		return -ENOMEM;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3fd2e057-0284-2bc7-7b76-8280646aad52-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw
Quoted 111 lines · Christian König

Am 06.06.19 um 12:50 schrieb StDenis, Tom:

Quoted 103 lines

This option is no longer needed.  The default code paths are now the only option.

v2: Add HPAGE support and a default for non contiguous maps
v3: Misread 512 pages as MiB ...

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h          |  1 - drivers/gpu/drm/amd/amdgpu/amdgpu_device.c   |  7 ------- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c      |  8 -------- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 14 +++++++++-----

  4 files changed, 9 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 19a00282e34c..e54f31865f60 100644
@@ -142,7 +142,6 @@ extern uint amdgpu_sdma_phase_quantum;
   extern char *amdgpu_disable_cu;
   extern char *amdgpu_virtual_display;
   extern uint amdgpu_pp_feature_mask;
-extern int amdgpu_vram_page_split;
   extern int amdgpu_ngg;
   extern int amdgpu_prim_buf_per_se;
   extern int amdgpu_pos_buf_per_se;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 0212c9ee317c..2e13b8ef6681 100644
@@ -973,13 +973,6 @@ static int amdgpu_device_check_arguments(struct 
 amdgpu_device *adev)
         amdgpu_device_check_block_size(adev);

  -    if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split < 16 ||
-        !is_power_of_2(amdgpu_vram_page_split))) {
-        dev_warn(adev->dev, "invalid VRAM page split (%d)\n", -             amdgpu_vram_page_split);
-        amdgpu_vram_page_split = 1024;
-    }
-
      ret = amdgpu_device_get_job_timeout_settings(adev); if (ret) {
          dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
index 1f38d6fc1fe3..ef22a2a25448 100644
@@ -108,7 +108,6 @@ int amdgpu_vm_fragment_size = -1;
   int amdgpu_vm_block_size = -1;
   int amdgpu_vm_fault_stop = 0;
   int amdgpu_vm_debug = 0;
-int amdgpu_vram_page_split = 512;
   int amdgpu_vm_update_mode = -1;
   int amdgpu_exp_hw_support = 0;
   int amdgpu_dc = -1;
@@ -342,13 +341,6 @@ module_param_named(vm_debug, amdgpu_vm_debug, 
 int, 0644);

  MODULE_PARM_DESC(vm_update_mode, "VM update using CPU (0 = never (default except for large BAR(LB)), 1 = Graphics only, 2 = Compute only (default for LB), 3 = Both"); module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444); -/**
- * DOC: vram_page_split (int)
- * Override the number of pages after we split VRAM allocations (default 512, -1 = disable). The default is 512.
- */
-MODULE_PARM_DESC(vram_page_split, "Number of pages after we split VRAM allocations (default 512, -1 = disable)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -2
-module_param_named(vram_page_split, amdgpu_vram_page_split, int, 0444);
-

  /**
   * DOC: exp_hw_support (int)
   * Enable experimental hw support (1 = enable). The default is 0 (disabled).

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +0 -0
index ec9ea3fdbb4a..8aea2f21b202 100644
@@ -284,17 +284,21 @@ static int amdgpu_vram_mgr_new(struct 
 ttm_mem_type_manager *man,
       if (!lpfn)
           lpfn = man->size;

  -    if (place->flags & TTM_PL_FLAG_CONTIGUOUS ||
-        amdgpu_vram_page_split == -1) {
+    if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { pages_per_node = ~0ul;
          num_nodes = 1;
      } else {
-        pages_per_node = max((uint32_t)amdgpu_vram_page_split, -                     mem->page_alignment);

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +7 -0
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+        pages_per_node = HPAGE_PMD_NR;
+#else
+        /* default to 2MB */
+        pages_per_node = (2UL << (20UL - PAGE_SHIFT));
+#endif
+        pages_per_node = max((uint32_t)pages_per_node, 
Quoted 5 lines

mem->page_alignment);
          num_nodes = DIV_ROUND_UP(mem->num_pages, pages_per_node); }
  -    nodes = kvmalloc_array(num_nodes, sizeof(*nodes), +    nodes = kvmalloc_array((uint32_t)num_nodes, sizeof(*nodes),

You can probably drop that cast here, apart from that the patch is

Quoted 1 line

Without the cast it produces a somewhat lengthy warning diagnostic.  The original code had the cast as well.

Quoted 2 lines

Do you want to look into test/benchmark as well?

Sure, is the plan to cleave all that out too?

Thanks,

Tom

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): bec35b63-8c57-5b3b-f37c-e73b740906c5-5C7GfCeVMHo@public.gmane.org

#6 lore raw

Am 06.06.19 um 13:51 schrieb StDenis, Tom:

Quoted 113 lines · Christian König
Quoted 110 lines

Am 06.06.19 um 12:50 schrieb StDenis, Tom:

Quoted 98 lines

This option is no longer needed.  The default code paths are now the only option.

v2: Add HPAGE support and a default for non contiguous maps
v3: Misread 512 pages as MiB ...

---
   drivers/gpu/drm/amd/amdgpu/amdgpu.h          |  1 -
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c   |  7 -------
   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c      |  8 --------
   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 14 +++++++++-----
   4 files changed, 9 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 19a00282e34c..e54f31865f60 100644
@@ -142,7 +142,6 @@ extern uint amdgpu_sdma_phase_quantum;
   extern char *amdgpu_disable_cu;
   extern char *amdgpu_virtual_display;
   extern uint amdgpu_pp_feature_mask;
-extern int amdgpu_vram_page_split;
   extern int amdgpu_ngg;
   extern int amdgpu_prim_buf_per_se;
   extern int amdgpu_pos_buf_per_se;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 0212c9ee317c..2e13b8ef6681 100644
@@ -973,13 +973,6 @@ static int amdgpu_device_check_arguments(struct
 amdgpu_device *adev)
         amdgpu_device_check_block_size(adev);
   -    if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split <

16 ||
-        !is_power_of_2(amdgpu_vram_page_split))) {
-        dev_warn(adev->dev, "invalid VRAM page split (%d)\n", -             amdgpu_vram_page_split);
-        amdgpu_vram_page_split = 1024;
-    }
-
      ret = amdgpu_device_get_job_timeout_settings(adev); if (ret) {
          dev_err(adev->dev, "invalid lockup_timeout parameter
syntax\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
index 1f38d6fc1fe3..ef22a2a25448 100644
@@ -108,7 +108,6 @@ int amdgpu_vm_fragment_size = -1;
   int amdgpu_vm_block_size = -1;
   int amdgpu_vm_fault_stop = 0;
   int amdgpu_vm_debug = 0;
-int amdgpu_vram_page_split = 512;
   int amdgpu_vm_update_mode = -1;
   int amdgpu_exp_hw_support = 0;
   int amdgpu_dc = -1;
@@ -342,13 +341,6 @@ module_param_named(vm_debug, amdgpu_vm_debug,
 int, 0644);
   MODULE_PARM_DESC(vm_update_mode, "VM update using CPU (0 = never

(default except for large BAR(LB)), 1 = Graphics only, 2 = Compute only (default for LB), 3 = Both");
  module_param_named(vm_update_mode, amdgpu_vm_update_mode, int, 0444); -/**
- * DOC: vram_page_split (int)
- * Override the number of pages after we split VRAM allocations (default 512, -1 = disable). The default is 512.
- */
-MODULE_PARM_DESC(vram_page_split, "Number of pages after we split VRAM allocations (default 512, -1 = disable)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -2
-module_param_named(vram_page_split, amdgpu_vram_page_split, int, 0444);
-
   /**
    * DOC: exp_hw_support (int)
    * Enable experimental hw support (1 = enable). The default is 0

(disabled).

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +3 -3
index ec9ea3fdbb4a..8aea2f21b202 100644
@@ -284,17 +284,21 @@ static int amdgpu_vram_mgr_new(struct
 ttm_mem_type_manager *man,
       if (!lpfn)
           lpfn = man->size;
   -    if (place->flags & TTM_PL_FLAG_CONTIGUOUS ||
-        amdgpu_vram_page_split == -1) {
+    if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
           pages_per_node = ~0ul;
           num_nodes = 1;
       } else {
-        pages_per_node = max((uint32_t)amdgpu_vram_page_split,
-                     mem->page_alignment);
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+        pages_per_node = HPAGE_PMD_NR;

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c static int amdgpu_vram_mgr_new(struct · line 303

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +6 -0
+#else
+        /* default to 2MB */
+        pages_per_node = (2UL << (20UL - PAGE_SHIFT));
+#endif
+        pages_per_node = max((uint32_t)pages_per_node,
 mem->page_alignment);
           num_nodes = DIV_ROUND_UP(mem->num_pages, pages_per_node);
       }
   -    nodes = kvmalloc_array(num_nodes, sizeof(*nodes),
+    nodes = kvmalloc_array((uint32_t)num_nodes, sizeof(*nodes),

You can probably drop that cast here, apart from that the patch is

Quoted 1 line
Quoted 2 lines

Without the cast it produces a somewhat lengthy warning diagnostic.  The original code had the cast as well.

Strange, the original code hat the case because amdgpu_vram_page_split was a signed int, but num_nodes should be unsigned anyway.

So that shouldn't be necessary any more. Anyway keeping the cast works for me as well.

Quoted 2 lines
Quoted 1 line

Do you want to look into test/benchmark as well?

Sure, is the plan to cleave all that out too?

Well first of all dig a bit into what those still do. If I'm not completely mistaken at least one of them is redundant now.

Christian.

Quoted 11 lines

Thanks,

Tom

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx