Skip to content

Commit

Permalink
drm/i915: Bump object bookkeeping to u64 from size_t
Browse files Browse the repository at this point in the history
Internally we allow for using more objects than a single process can
allocate, i.e. we allow for a 64bit GPU address space even on a 32bit
system. Using size_t may oveerflow.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161018120251.25043-1-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Oct 18, 2016
1 parent 30d1b5f commit 3ef7f22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
if (ret)
return ret;

seq_printf(m, "%u objects, %zu bytes\n",
seq_printf(m, "%u objects, %llu bytes\n",
dev_priv->mm.object_count,
dev_priv->mm.object_memory);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ struct i915_gem_mm {

/* accounting, useful for userland debugging */
spinlock_t object_stat_lock;
size_t object_memory;
u64 object_memory;
u32 object_count;
};

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ remove_mappable_node(struct drm_mm_node *node)

/* some bookkeeping */
static void i915_gem_info_add_obj(struct drm_i915_private *dev_priv,
size_t size)
u64 size)
{
spin_lock(&dev_priv->mm.object_stat_lock);
dev_priv->mm.object_count++;
Expand All @@ -91,7 +91,7 @@ static void i915_gem_info_add_obj(struct drm_i915_private *dev_priv,
}

static void i915_gem_info_remove_obj(struct drm_i915_private *dev_priv,
size_t size)
u64 size)
{
spin_lock(&dev_priv->mm.object_stat_lock);
dev_priv->mm.object_count--;
Expand Down

0 comments on commit 3ef7f22

Please sign in to comment.