Message ID | 20211210195005.2582884-1-bob.beckett@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/ttm: fix large buffer population trucation | expand |
On 10/12/2021 19:50, Robert Beckett wrote: > ttm->num_pages is uint32_t which was causing very large buffers to > only populate a truncated size. > > This fixes gem_create@create-clear igt test on large memory systems. > > Fixes: 7ae034590cea ("drm/i915/ttm: add tt shmem backend") > Signed-off-by: Robert Beckett <bob.beckett@collabora.com> Nice catch, Reviewed-by: Matthew Auld <matthew.auld@intel.com> > --- > drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > index 218a9b3037c7..923cc7ad8d70 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > @@ -166,7 +166,7 @@ static int i915_ttm_tt_shmem_populate(struct ttm_device *bdev, > struct intel_memory_region *mr = i915->mm.regions[INTEL_MEMORY_SYSTEM]; > struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); > const unsigned int max_segment = i915_sg_segment_size(); > - const size_t size = ttm->num_pages << PAGE_SHIFT; > + const size_t size = (size_t)ttm->num_pages << PAGE_SHIFT; > struct file *filp = i915_tt->filp; > struct sgt_iter sgt_iter; > struct sg_table *st; >
On Mon, 13 Dec 2021 at 13:03, Matthew Auld <matthew.auld@intel.com> wrote: > > On 10/12/2021 19:50, Robert Beckett wrote: > > ttm->num_pages is uint32_t which was causing very large buffers to > > only populate a truncated size. > > > > This fixes gem_create@create-clear igt test on large memory systems. > > > > Fixes: 7ae034590cea ("drm/i915/ttm: add tt shmem backend") > > Signed-off-by: Robert Beckett <bob.beckett@collabora.com> > > Nice catch, > Reviewed-by: Matthew Auld <matthew.auld@intel.com> Pushed to drm-intel-gt-next. Thanks again for the fix. > > > --- > > drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > > index 218a9b3037c7..923cc7ad8d70 100644 > > --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > > +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c > > @@ -166,7 +166,7 @@ static int i915_ttm_tt_shmem_populate(struct ttm_device *bdev, > > struct intel_memory_region *mr = i915->mm.regions[INTEL_MEMORY_SYSTEM]; > > struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); > > const unsigned int max_segment = i915_sg_segment_size(); > > - const size_t size = ttm->num_pages << PAGE_SHIFT; > > + const size_t size = (size_t)ttm->num_pages << PAGE_SHIFT; > > struct file *filp = i915_tt->filp; > > struct sgt_iter sgt_iter; > > struct sg_table *st; > >
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 218a9b3037c7..923cc7ad8d70 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -166,7 +166,7 @@ static int i915_ttm_tt_shmem_populate(struct ttm_device *bdev, struct intel_memory_region *mr = i915->mm.regions[INTEL_MEMORY_SYSTEM]; struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); const unsigned int max_segment = i915_sg_segment_size(); - const size_t size = ttm->num_pages << PAGE_SHIFT; + const size_t size = (size_t)ttm->num_pages << PAGE_SHIFT; struct file *filp = i915_tt->filp; struct sgt_iter sgt_iter; struct sg_table *st;
ttm->num_pages is uint32_t which was causing very large buffers to only populate a truncated size. This fixes gem_create@create-clear igt test on large memory systems. Fixes: 7ae034590cea ("drm/i915/ttm: add tt shmem backend") Signed-off-by: Robert Beckett <bob.beckett@collabora.com> --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)