From patchwork Mon Aug 29 12:04:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 12957684 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 00C72ECAAD4 for ; Mon, 29 Aug 2022 12:04:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 398C910F17C; Mon, 29 Aug 2022 12:04:43 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 545D810F167; Mon, 29 Aug 2022 12:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661774679; x=1693310679; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JDt2sUk2X1oCVdgSTfAuuFX5toRav6GNAo6o4hHV6as=; b=aql4fAiWkMmJwv8fgBWIRozrrnMqtw//rEV2+sDcE4nAH6D3BBthSqvu lD7idm7ApC/wsSkYl3eGZuiy2Zs1h0weQ/gkyWAoUgakcglQR9NzlZTua PJhfyXaqnNWsFFi742OXUirnnZXIAwZNRWWBiR57pBjTrH8GPg1Cde6tK XxjQdngR/P5gmrQFB+K7HmhYmcESj3dx5cUEPjuJ0tPsSbQbPRtGkP8ac jY7K50JYos7GNmTY8LYXMgW47IsJWMbj1YbYVVhBxyOKu9/TiXQCpNo+F YDKG3TUQtlzYy45qihemBahaHo+BuVQyYENddZ2UR1/cNwzkZQ1PORdB5 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10453"; a="295653092" X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="295653092" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 05:04:17 -0700 X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="672354997" Received: from nirmoyda-desk.igk.intel.com ([10.102.13.19]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 05:04:15 -0700 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Date: Mon, 29 Aug 2022 14:04:09 +0200 Message-Id: <20220829120409.24260-1-nirmoy.das@intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Organization: Intel Deutschland GmbH, Registered Address: Am Campeon 10, 85579 Neubiberg, Germany, Commercial Register: Amtsgericht Muenchen HRB 186928 Subject: [Intel-gfx] [PATCH] drm/i915/ttm: Abort suspend on i915_ttm_backup failure X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.hellstrom@intel.com, matthew.auld@intel.com, dri-devel@lists.freedesktop.org, chris.p.wilson@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On system suspend when system memory is low then i915_gem_obj_copy_ttm() could fail trying to backup a lmem obj. GEM_WARN_ON() is not enough, suspend shouldn't continue if i915_ttm_backup() throws an error. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6529 Suggested-by: Chris P Wilson Signed-off-by: Nirmoy Das Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c index 9aad84059d56..6f5d5c0909b4 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c @@ -79,7 +79,12 @@ static int i915_ttm_backup(struct i915_gem_apply_to_region *apply, goto out_no_populate; err = i915_gem_obj_copy_ttm(backup, obj, pm_apply->allow_gpu, false); - GEM_WARN_ON(err); + if (err) { + drm_err(&i915->drm, + "Unable to copy from device to system memory, err:%d\n", + err); + goto out_no_populate; + } ttm_bo_wait_ctx(backup_bo, &ctx); obj->ttm.backup = backup;