From mboxrd@z Thu Jan 1 00:00:00 1970 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 14D7EEB64DD for ; Thu, 22 Jun 2023 12:25:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 382D310E559; Thu, 22 Jun 2023 12:25:31 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id E920310E550; Thu, 22 Jun 2023 12:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687436728; x=1718972728; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=tG380jqTzpNo5ZL67fT6Js9jxrrZXcN1PKFqveEdQic=; b=NwlDBMGJtP4UTso7TepQ6RuMNbRNHor2XrhcBRH5CjZe2h13L1m8mKeI VHceSe+gPQeAn/yS4aoVO04eDF2CnF15Ed8yPd9UpgSYp1ww8he3AE21y wKtIpIk9i8p+NO5QmNLnun6VLoOoBA3lBXSEzFUW8yqOuheu1/uwpnNUW hP1TBSCi5qkzJ33P/dWe6RJLoUM8LuvK2bgcoouGTPTkyDMEJncdlPuiP Yn3/WLWlsST+yqxulS4zsG0Txq40eaKV9SIsN+PB8t/znDuWg1E50VUsq recAFNrWrRq3yTgy7ota/NcuI47fWWIl2rALde/cKZa2tT+d3vc30Hp+b Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="360489583" X-IronPort-AV: E=Sophos;i="6.00,263,1681196400"; d="scan'208";a="360489583" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2023 05:25:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="839028370" X-IronPort-AV: E=Sophos;i="6.00,263,1681196400"; d="scan'208";a="839028370" Received: from nirmoyda-mobl.ger.corp.intel.com (HELO [10.249.46.93]) ([10.249.46.93]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2023 05:25:25 -0700 Message-ID: Date: Thu, 22 Jun 2023 14:25:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= , intel-xe@lists.freedesktop.org References: <20230622101412.78426-1-thomas.hellstrom@linux.intel.com> <20230622101412.78426-5-thomas.hellstrom@linux.intel.com> From: Nirmoy Das In-Reply-To: <20230622101412.78426-5-thomas.hellstrom@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH 4/4] drm/ttm: Don't leak a resource on swapout move error 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: =?UTF-8?Q?Christian_K=c3=b6nig?= , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, stable@vger.kernel.org, =?UTF-8?Q?Christian_K=c3=b6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 6/22/2023 12:14 PM, Thomas Hellström wrote: > If moving the bo to system for swapout failed, we were leaking > a resource. Fix. > > Fixes: bfa3357ef9ab ("drm/ttm: allocate resource object instead of embedding it v2") > Cc: Christian König > Cc: "Christian König" > Cc: dri-devel@lists.freedesktop.org > Cc: # v5.14+ > Signed-off-by: Thomas Hellström Reviewed-by: Nirmoy Das > --- > drivers/gpu/drm/ttm/ttm_bo.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index 89530f2a027f..d737ddd7f4c0 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -1166,6 +1166,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, > ret = ttm_bo_handle_move_mem(bo, evict_mem, true, ctx, &hop); > if (unlikely(ret != 0)) { > WARN(ret == -EMULTIHOP, "Unexpected multihop in swaput - likely driver bug.\n"); > + ttm_resource_free(bo, &evict_mem); > goto out; > } > }