From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755931AbbI2HkU (ORCPT ); Tue, 29 Sep 2015 03:40:20 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:37439 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755776AbbI2HkQ (ORCPT ); Tue, 29 Sep 2015 03:40:16 -0400 Date: Tue, 29 Sep 2015 09:43:10 +0200 From: Daniel Vetter To: Jani Nikula Cc: Rasmus Villemoes , Daniel Vetter , David Airlie , 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 Message-ID: <20150929074310.GC3383@phenom.ffwll.local> Mail-Followup-To: Jani Nikula , Rasmus Villemoes , Daniel Vetter , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <1443474531-11560-1-git-send-email-linux@rasmusvillemoes.dk> <87vbatislh.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87vbatislh.fsf@intel.com> X-Operating-System: Linux phenom 4.1.0-2-amd64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2015 at 10:37:30AM +0300, Jani Nikula wrote: > On Tue, 29 Sep 2015, Rasmus Villemoes 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 > > Reviewed-by: Jani Nikula 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