Re: [PATCH 4/5] drm/ttm: if need_dma32 is not set, actually no need dma32 zone at all.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



NAK, that the gfx driver doesn't need DMA32 doesn't mean that we can use it all up with BO allocations.

It is still quite likely that other drivers in the system might need it.

Christian.

Am 02.02.2018 um 08:22 schrieb Roger He:
because this zone has only 4GB, it is easy to became bottleneck for
huge normal zone.

Signed-off-by: Roger He <Hongbo.He@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |  3 +++
  drivers/gpu/drm/ttm/ttm_memory.c        | 10 ++++++++--
  include/drm/ttm/ttm_memory.h            |  1 +
  3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 95f9901..9f90022 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -75,6 +75,7 @@ static void amdgpu_ttm_mem_global_release(struct drm_global_reference *ref)
  static int amdgpu_ttm_global_init(struct amdgpu_device *adev)
  {
  	struct drm_global_reference *global_ref;
+	struct ttm_mem_global *mem_glob;
  	struct amdgpu_ring *ring;
  	struct drm_sched_rq *rq;
  	int r;
@@ -91,6 +92,8 @@ static int amdgpu_ttm_global_init(struct amdgpu_device *adev)
  			  "subsystem.\n");
  		goto error_mem;
  	}
+	mem_glob = (struct ttm_mem_global *)global_ref->object;
+	mem_glob->bdev = &adev->mman.bdev;
adev->mman.bo_global_ref.mem_glob =
  		adev->mman.mem_global_ref.object;
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index f5227a5..875e5b8 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -567,6 +567,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
  			      bool in_pagefault)
  {
  	struct ttm_mem_zone *zone = NULL;
+	struct ttm_bo_device *bdev = glob->bdev;
/**
  	 * Page allocations may be registed in a single zone
@@ -577,7 +578,9 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
  	if (PageHighMem(page) && glob->zone_highmem != NULL)
  		zone = glob->zone_highmem;
  #else
-	if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
+	if (bdev && !bdev->need_dma32)
+		zone = glob->zone_kernel;
+	else if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
  		zone = glob->zone_kernel;
  #endif
  	return ttm_mem_global_alloc_zone(glob, zone, size,
@@ -588,12 +591,15 @@ void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,
  			      uint64_t size)
  {
  	struct ttm_mem_zone *zone = NULL;
+	struct ttm_bo_device *bdev = glob->bdev;
#ifdef CONFIG_HIGHMEM
  	if (PageHighMem(page) && glob->zone_highmem != NULL)
  		zone = glob->zone_highmem;
  #else
-	if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
+	if (bdev && !bdev->need_dma32)
+		zone = glob->zone_kernel;
+	else if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
  		zone = glob->zone_kernel;
  #endif
  	ttm_mem_global_free_zone(glob, zone, size);
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index 6c29b5c..0577475 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -79,6 +79,7 @@ struct ttm_mem_global {
  #else
  	struct ttm_mem_zone *zone_dma32;
  #endif
+	struct ttm_bo_device *bdev;
  };
extern int ttm_mem_global_init(struct ttm_mem_global *glob);

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux