From: Daniel Vetter <daniel@ffwll.ch>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>,
intel-gfx@lists.freedesktop.org,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/i915: Fix comparison bug
Date: Tue, 29 Sep 2015 09:43:10 +0200 [thread overview]
Message-ID: <20150929074310.GC3383@phenom.ffwll.local> (raw)
In-Reply-To: <87vbatislh.fsf@intel.com>
On Tue, Sep 29, 2015 at 10:37:30AM +0300, Jani Nikula wrote:
> On Tue, 29 Sep 2015, Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> > ->stolen->start has type u64 aka unsigned long long; relying on the
> > difference (effectively cast to int) for sorting is wrong.
> >
> > It wouldn't be a problem in practice if the values compared are always
> > within INT_MAX of each other (so that the difference is actually
> > representable in an int), but 440fd5283a87 ("drm/mm: Support 4 GiB and
> > larger ranges") strongly suggests that's not the case.
> >
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drm_mm is the shared gpu memmory manager, but stolen itself can only go to
about 1.5G currently. So safe, but I merged your patch anyway with a small
note added for 4.4.
Thanks, Daniel
>
>
> > ---
> > drivers/gpu/drm/i915/i915_debugfs.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index e3ec9049081f..5207e681a987 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -258,7 +258,11 @@ static int obj_rank_by_stolen(void *priv,
> > struct drm_i915_gem_object *b =
> > container_of(B, struct drm_i915_gem_object, obj_exec_link);
> >
> > - return a->stolen->start - b->stolen->start;
> > + if (a->stolen->start < b->stolen->start)
> > + return -1;
> > + if (a->stolen->start > b->stolen->start)
> > + return 1;
> > + return 0;
> > }
> >
> > static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
> > --
> > 2.1.3
> >
>
> --
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Daniel Vetter <daniel.vetter@intel.com>,
David Airlie <airlied@linux.ie>,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix comparison bug
Date: Tue, 29 Sep 2015 09:43:10 +0200 [thread overview]
Message-ID: <20150929074310.GC3383@phenom.ffwll.local> (raw)
In-Reply-To: <87vbatislh.fsf@intel.com>
On Tue, Sep 29, 2015 at 10:37:30AM +0300, Jani Nikula wrote:
> On Tue, 29 Sep 2015, Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> > ->stolen->start has type u64 aka unsigned long long; relying on the
> > difference (effectively cast to int) for sorting is wrong.
> >
> > It wouldn't be a problem in practice if the values compared are always
> > within INT_MAX of each other (so that the difference is actually
> > representable in an int), but 440fd5283a87 ("drm/mm: Support 4 GiB and
> > larger ranges") strongly suggests that's not the case.
> >
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drm_mm is the shared gpu memmory manager, but stolen itself can only go to
about 1.5G currently. So safe, but I merged your patch anyway with a small
note added for 4.4.
Thanks, Daniel
>
>
> > ---
> > drivers/gpu/drm/i915/i915_debugfs.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index e3ec9049081f..5207e681a987 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -258,7 +258,11 @@ static int obj_rank_by_stolen(void *priv,
> > struct drm_i915_gem_object *b =
> > container_of(B, struct drm_i915_gem_object, obj_exec_link);
> >
> > - return a->stolen->start - b->stolen->start;
> > + if (a->stolen->start < b->stolen->start)
> > + return -1;
> > + if (a->stolen->start > b->stolen->start)
> > + return 1;
> > + return 0;
> > }
> >
> > static int i915_gem_stolen_list_info(struct seq_file *m, void *data)
> > --
> > 2.1.3
> >
>
> --
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2015-09-29 7:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 21:08 [PATCH] drm/i915: Fix comparison bug Rasmus Villemoes
2015-09-29 7:37 ` Jani Nikula
2015-09-29 7:37 ` Jani Nikula
2015-09-29 7:43 ` Daniel Vetter [this message]
2015-09-29 7:43 ` [Intel-gfx] " Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2014-12-07 21:26 Rasmus Villemoes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150929074310.GC3383@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.