Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp265287lqr; Wed, 5 Jun 2024 05:39:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtxkkdykhbOzwLxs13Yx7cNReueLmltVELK3ura2U6ZmhYJUUR/dovbNLmYtslvPtsDk55SAyK6jiPWEjkeuSAAegY5kPN8GiU0hb2zA== X-Google-Smtp-Source: AGHT+IHJEtfpG75WiLaQaMARmCAbtYyy2VnxfmkiGzam/sq7jWyUfDKq5wRLdlWi+dnl62M3K+hb X-Received: by 2002:a17:902:ccc5:b0:1f6:ab51:22ec with SMTP id d9443c01a7336-1f6ab5129f2mr13240125ad.4.1717591198997; Wed, 05 Jun 2024 05:39:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717591198; cv=pass; d=google.com; s=arc-20160816; b=IpAyZuZDEaHzc2GJywcVtIy9Tp2KrT4so1W6PrLwblhZR38mEHq4gASFavs03uCzz+ gmhU0lGLjDfcV7VmJghxBgXFWAVYdXbYAtA0XsM9jnv55mbDIqrUmTCpnwLXNSMwE9PI rV0+wup/B4hndHw0cqwH7j2H1eiIKpBciiAIft7sOKcRKfYi689KjLC8DNwcTZo1xNzp kXfQiouKiH82o6JUyUvlVng00DXRXd+1j3VRYKFt813Vsu3HZt9YnoyXLMJlQyDnga0g bt8XuZiOUSn2Kla2yatXmm3yYBGIHUk1f/7eo3w2tG0MIORvbPHsixTNIuFLBvUTiKVT sXRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=J7Kc7az7Oeq8o84FzbUvyoIF5GZoiTQgceVZ7xDB4xo=; fh=v9wq7dboZ64jWyee73s7vUomL3rRsBGzKDtJ69Ug7KI=; b=sn5ptIdQs6xPFTepTecQBg7VDYtJrTKrFjNidwlp9fUgSFA0RRmL634vi7p2NWfBbR 6mJBfZUYYB+lLFB9a7+CEHQuP3FB/KAgRAR27hbO3OOL2mIFCHQvL41TmVmZM69n8YbJ ejyAI8W+zJ3662DYpLIfCdgZLLUHdF2Q4DgJMvRB8FSwVIn+Hr5u0q+N7d4jQMv1kKCp aWrd7KClA82dUNz8TJRRq2H5A+aGBr1Z98VDEYlhMfWBNyxjyE/wf6QPYMNxar81eoxx cWfACTjL67Kt11/GIBYrD2aq/pRlt9Oh+HC5Z8sRvgR9DxYI5u0lccVgK3wX6+CWsgYq EaPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P+VdVchh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6738ee3f5si58650445ad.540.2024.06.05.05.39.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:39:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P+VdVchh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202426-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202426-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 24E51B220A5 for ; Wed, 5 Jun 2024 12:21:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E39B193077; Wed, 5 Jun 2024 11:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P+VdVchh" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 771761BC09D; Wed, 5 Jun 2024 11:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588567; cv=none; b=UgZpvWnqH5LR7j1F1z0NXnSq2phZ5f9JGy3jw7uwAVryoOrFVCk9lcnB50+1tBKt+IicMhuyLISIUZtNxhPhg7eQhZ5pbSTruLt7lVoPcqresAQ93b4TyienUmf5YMpGsOZ5+F8ijmRqIMyKiyYG5bDu09m7UMxZ3vfQpvPL08U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588567; c=relaxed/simple; bh=MQlafrH1ZsAWU4GMtq3xWoxO3rSPyWFUyXOPtV5F/2c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VVwhsnN/t7pv2GnMq2TsoF2HQlvD47+TKwlWmNVJ8/v9vfZokIDgcH0S4DLzSmUHdabvWL4r1f2wCQwH5mjBqtcrdKgjP5/PSnDnZXfFibVEU69xg7swAyUYTRRAOIx+BNkQA/iKDeeOIpu7F1MMHwHmPTOTklXS3L4JC3HcGvs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P+VdVchh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0EDFC4AF07; Wed, 5 Jun 2024 11:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588567; bh=MQlafrH1ZsAWU4GMtq3xWoxO3rSPyWFUyXOPtV5F/2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+VdVchhTFt2D0z0ex9prF+bS85YqAHvGATE0KRJzJqNzmVYH59GcGbtvNJnL8Xzl c8PaE3+ycWpN/BJkNOItEcGvAT1b6huTVLG1lpfi1wir9uqfgRVsL2VqTQf2/F6nUR TgrAA4+c0JLI/e4dq5/1dNk+Qk7pEBpivOtGD9Bj19U8gcQEqnZZ6F1DfZXGky6OTq vCMPwKexAosXP8XrR8yrYCz+z5Bm+PyrgjuD7Ti8npWHNsMfVpM0XsJmiUJJQhhWeB ZEwgPxJuco0Hc6rT7q9PZZH6LnsCEJsqwKwQ96Yo2FHbBmTDUKVXhxnlBVyc0CP1Mz jQ0VYFKULz3Jg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Lang Yu , Felix Kuehling , Alex Deucher , Sasha Levin , Felix.Kuehling@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.8 3/6] drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms Date: Wed, 5 Jun 2024 07:55:55 -0400 Message-ID: <20240605115602.2964993-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605115602.2964993-1-sashal@kernel.org> References: <20240605115602.2964993-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.12 Content-Transfer-Encoding: 8bit From: Lang Yu [ Upstream commit 2a705f3e49d20b59cd9e5cc3061b2d92ebe1e5f0 ] Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used. Two attachments use the same VM, root PD would be locked twice. [ 57.910418] Call Trace: [ 57.793726] ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu] [ 57.793820] amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu] [ 57.793923] ? idr_get_next_ul+0xbe/0x100 [ 57.793933] kfd_process_device_free_bos+0x7e/0xf0 [amdgpu] [ 57.794041] kfd_process_wq_release+0x2ae/0x3c0 [amdgpu] [ 57.794141] ? process_scheduled_works+0x29c/0x580 [ 57.794147] process_scheduled_works+0x303/0x580 [ 57.794157] ? __pfx_worker_thread+0x10/0x10 [ 57.794160] worker_thread+0x1a2/0x370 [ 57.794165] ? __pfx_worker_thread+0x10/0x10 [ 57.794167] kthread+0x11b/0x150 [ 57.794172] ? __pfx_kthread+0x10/0x10 [ 57.794177] ret_from_fork+0x3d/0x60 [ 57.794181] ? __pfx_kthread+0x10/0x10 [ 57.794184] ret_from_fork_asm+0x1b/0x30 Signed-off-by: Lang Yu Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index daa66eb4f722b..36796fbc00315 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1186,7 +1186,8 @@ static int reserve_bo_and_cond_vms(struct kgd_mem *mem, int ret; ctx->sync = &mem->sync; - drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0); + drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT | + DRM_EXEC_IGNORE_DUPLICATES, 0); drm_exec_until_all_locked(&ctx->exec) { ctx->n_vms = 0; list_for_each_entry(entry, &mem->attachments, list) { -- 2.43.0