From patchwork Tue Feb 27 20:26:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13574386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC5FEC54E41 for ; Tue, 27 Feb 2024 20:26:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C543510E993; Tue, 27 Feb 2024 20:26:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="V9JVO8zB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6E9810E992; Tue, 27 Feb 2024 20:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709065612; x=1740601612; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=rVjiJFnIz9QuGzOYqaIk0B2kID+k1JY0BTBjYB/WLLc=; b=V9JVO8zBFS2NRp8b9o3m4Rewumy4kj6QhxBCT+DrVJwcRiHW0FMqwhb3 lIqGtNxH89BoQWTB1jj7slYCVIcLznot9aO3QLQh40CTo/hlPA2AFGiQK rdmo59CViV3trKyXeFPnMh7f5bAvgXiuHTICSVhn2e97gMkbCIXYsxEYK SF7QC3WH2RS5UIzQxRxvkdZjjrzcozTFs4tvtHFvviuMIot3cXtnGU/no m67bLBCONOBfYlUH3uR41tO2k2IwnHXalp3TjA2Uw5BYbZqsmdLiukUkS j0PAn9Hdj5YpoJahOqiBXpRwHoeTEKOc1fGniwnGJzKziEKMOyH7722oC Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="20979214" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="20979214" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 12:26:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="827770874" X-IronPort-AV: E=Sophos;i="6.06,188,1705392000"; d="scan'208";a="827770874" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 27 Feb 2024 12:26:46 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 27 Feb 2024 22:26:45 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, Somalapuram Amaranath , =?utf-8?q?Christian_?= =?utf-8?q?K=C3=B6nig?= , Zack Rusin , Thomas Zimmermann , =?utf-8?q?Thomas_Hellstr=C3=B6m?= Subject: [PATCH] drm/i915/ttm: Fix TTM_PL_FLAG_DESIRED Date: Tue, 27 Feb 2024 22:26:45 +0200 Message-ID: <20240227202645.20111-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä inlined from ‘i915_ttm_get_pages’ at ../drivers/gpu/drm/i915/gem/i915_gem_ttm.c:847:2: ../drivers/gpu/drm/i915/gem/i915_gem_ttm.c:165:18: warning: ‘places[0].flags’ is used uninitialized [-Wuninitialized] 165 | places[0].flags |= TTM_PL_FLAG_DESIRED; | ~~~~~~~~~^~~~~~ ../drivers/gpu/drm/i915/gem/i915_gem_ttm.c: In function ‘i915_ttm_get_pages’: ../drivers/gpu/drm/i915/gem/i915_gem_ttm.c:837:26: note: ‘places’ declared here 837 | struct ttm_place places[I915_TTM_MAX_PLACEMENTS + 1]; | ^~~~~~ Furhermore we then proceed to call i915_ttm_place_from_region() which memset()s the whole thing back to zero anyway. So in the end we lose the TTM_PL_FLAG_DESIRED flag (and fortunately also whatever else stack garbage happened to be in the flags at this point). No idea what functional changes this will result in... Cc: Somalapuram Amaranath Cc: Christian König Cc: Zack Rusin Cc: Thomas Zimmermann Cc: Thomas Hellström Fixes: a78a8da51b36 ("drm/ttm: replace busy placement with flags v6") Signed-off-by: Ville Syrjälä --- 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 27dcfd8a34bb..e6f177183c0f 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -162,10 +162,10 @@ i915_ttm_placement_from_obj(const struct drm_i915_gem_object *obj, unsigned int flags = obj->flags; unsigned int i; - places[0].flags |= TTM_PL_FLAG_DESIRED; i915_ttm_place_from_region(num_allowed ? obj->mm.placements[0] : obj->mm.region, &places[0], obj->bo_offset, obj->base.size, flags); + places[0].flags |= TTM_PL_FLAG_DESIRED; /* Cache this on object? */ for (i = 0; i < num_allowed; ++i) {