On Tue, 2016-11-15 at 17:05 -0500, Alex Deucher wrote: > This reverts commit a693e050edfe794fea81d7cfe72429a406aa380b. > > This breaks on systems with huge amounts of system memory as we do not have > enough vram to store the page tables.  Additionally, this is less of an issue > with the recent gtt manager changes. Why revert it instead of limit the amount of vram it can use (as per the patch I sent the other day)? If there's no benefit to scaling the GTT size why was the change made in the first place? - Russell > > Signed-off-by: Alex Deucher <alexander.deucher at amd.com> > --- >  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  2 -- >  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 12 +++++------- >  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c   |  7 +------ >  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c   |  7 +------ >  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c   |  7 +------ >  5 files changed, 8 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index 496f72b..303989b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -2434,8 +2434,6 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device > *adev, struct ttm_tt *ttm, >  void amdgpu_vram_location(struct amdgpu_device *adev, struct amdgpu_mc *mc, > u64 base); >  void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc); >  void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size); > -u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev); > -int amdgpu_ttm_global_init(struct amdgpu_device *adev); >  int amdgpu_ttm_init(struct amdgpu_device *adev); >  void amdgpu_ttm_fini(struct amdgpu_device *adev); >  void amdgpu_program_register_sequence(struct amdgpu_device *adev, > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > index dcaf691..afada2f 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > @@ -34,7 +34,6 @@ >  #include <ttm/ttm_placement.h> >  #include <ttm/ttm_module.h> >  #include <ttm/ttm_page_alloc.h> > -#include <ttm/ttm_memory.h> >  #include <drm/drmP.h> >  #include <drm/amdgpu_drm.h> >  #include <linux/seq_file.h> > @@ -75,7 +74,7 @@ static void amdgpu_ttm_mem_global_release(struct > drm_global_reference *ref) >  ttm_mem_global_release(ref->object); >  } >  > -int amdgpu_ttm_global_init(struct amdgpu_device *adev) > +static int amdgpu_ttm_global_init(struct amdgpu_device *adev) >  { >  struct drm_global_reference *global_ref; >  struct amdgpu_ring *ring; > @@ -1083,6 +1082,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) >  unsigned i, j; >  int r; >  > + r = amdgpu_ttm_global_init(adev); > + if (r) { > + return r; > + } >  /* No others user of address space so set it to 0 */ >  r = ttm_bo_device_init(&adev->mman.bdev, >         adev->mman.bo_global_ref.ref.object, > @@ -1554,8 +1557,3 @@ static void amdgpu_ttm_debugfs_fini(struct amdgpu_device > *adev) >  >  #endif >  } > - > -u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev) > -{ > - return ttm_get_kernel_zone_memory_size(adev- > >mman.mem_global_ref.object); > -} > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c > b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c > index b13c8aa..ca7a77b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c > @@ -317,7 +317,7 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev) >   * size equal to the 1024 or vram, whichever is larger. >   */ >  if (amdgpu_gart_size == -1) > - adev->mc.gtt_size = amdgpu_ttm_get_gtt_mem_size(adev); > + adev->mc.gtt_size = max((1024ULL << 20), adev- > >mc.mc_vram_size); >  else >  adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20; >  > @@ -766,11 +766,6 @@ static int gmc_v6_0_sw_init(void *handle) >  return r; >  } >  > - r = amdgpu_ttm_global_init(adev); > - if (r) { > - return r; > - } > - >  r = gmc_v6_0_mc_init(adev); >  if (r) >  return r; > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c > b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c > index aa0c4b9..b1a01dd 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c > @@ -385,7 +385,7 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev) >   * size equal to the 1024 or vram, whichever is larger. >   */ >  if (amdgpu_gart_size == -1) > - adev->mc.gtt_size = amdgpu_ttm_get_gtt_mem_size(adev); > + adev->mc.gtt_size = max((1024ULL << 20), adev- > >mc.mc_vram_size); >  else >  adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20; >  > @@ -945,11 +945,6 @@ static int gmc_v7_0_sw_init(void *handle) >  return r; >  } >  > - r = amdgpu_ttm_global_init(adev); > - if (r) { > - return r; > - } > - >  r = gmc_v7_0_mc_init(adev); >  if (r) >  return r; > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c > b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c > index a16b220..1ccdac3 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c > @@ -472,7 +472,7 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) >   * size equal to the 1024 or vram, whichever is larger. >   */ >  if (amdgpu_gart_size == -1) > - adev->mc.gtt_size = amdgpu_ttm_get_gtt_mem_size(adev); > + adev->mc.gtt_size = max((1024ULL << 20), adev- > >mc.mc_vram_size); >  else >  adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20; >  > @@ -952,11 +952,6 @@ static int gmc_v8_0_sw_init(void *handle) >  return r; >  } >  > - r = amdgpu_ttm_global_init(adev); > - if (r) { > - return r; > - } > - >  r = gmc_v8_0_mc_init(adev); >  if (r) >  return r;