From patchwork Wed Apr 20 18:16:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12820640 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 A8A63C433F5 for ; Wed, 20 Apr 2022 18:16:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1424C10F16F; Wed, 20 Apr 2022 18:16:33 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD9F810F0C6; Wed, 20 Apr 2022 18:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650478587; x=1682014587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NQvdXMR8VJZkfFbkqOekFtgyx8K8r75dirGeAIhwMPM=; b=T3COwRHXUlS5uNauVdXKA9WwyavgQm4VGnjWNvb5KSNEt31iSf8m0kLo BuDxQ6amXOxhaC+lxHqgnxzXzVoSgV9xfwWgOKgNSm7y1kK123q2EpM80 bIXJ0JW7Hkkm2cJlqBi3dflGHGgOIq8/xTTa9WTlFilfALZA+rjVtqYZz VS4U2d9WRcf6qbXCHtULaUFuDQ2ksmutZfz3ZSEuXD3Yyinqb6fgP13BA FLTthjGY26JMwxq6ULq8e6i3NPsmsYj7CIg+gp5VENhh07fpsjm3YfR+z rw/TTfPFDinA6F/HJco3urZ0468qs3vWlO03TPMEpjZv87xJ9uGYiUMgU A==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="261723156" X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="261723156" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 11:16:27 -0700 X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="593286070" Received: from briansim-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.3.144]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 11:16:24 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Subject: [CI 2/4] drm/i915/buddy: sanity check the size Date: Wed, 20 Apr 2022 19:16:11 +0100 Message-Id: <20220420181613.70033-2-matthew.auld@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220420181613.70033-1-matthew.auld@intel.com> References: <20220420181613.70033-1-matthew.auld@intel.com> 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: , Cc: =?utf-8?q?Thomas_Hellstr=C3=B6m?= , dri-devel@lists.freedesktop.org, Nirmoy Das Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Ensure we check that the size is compatible with the requested page_size. For tiny objects that are automatically annotated with TTM_PL_FLAG_CONTIGUOUS(since they fit within a single page), we currently end up silently overriding the min_page_size, which ends up hiding bugs elsewhere. Signed-off-by: Matthew Auld Cc: Thomas Hellström Cc: Nirmoy Das Reviewed-by: Nirmoy Das --- drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c index 8e4e3f72c1ef..a5109548abc0 100644 --- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c +++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c @@ -70,6 +70,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man, min_page_size = bo->page_alignment << PAGE_SHIFT; GEM_BUG_ON(min_page_size < mm->chunk_size); + GEM_BUG_ON(!IS_ALIGNED(size, min_page_size)); if (place->fpfn + bman_res->base.num_pages != place->lpfn && place->flags & TTM_PL_FLAG_CONTIGUOUS) {