Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp394046rdb; Mon, 22 Jan 2024 07:29:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1rmCD4VWovCMDtGpAi8WdvjYP6+zfNqxKldn7IOusALkefPob2Pp1BYaiKkKLpANU7CAP X-Received: by 2002:a05:620a:1659:b0:783:3eb7:73d2 with SMTP id c25-20020a05620a165900b007833eb773d2mr4810457qko.124.1705937364498; Mon, 22 Jan 2024 07:29:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705937364; cv=pass; d=google.com; s=arc-20160816; b=wLE450loNSajl8pmWXHc4NU7wUO3V84/q0O53E/z8peJWgpTzmfxOTsjX3YAvoq8Ho ep8wj8iQHpiAm4CTtzuMawKBzdeRxQatnAuYMxmkfqZ67LBq8hodI2ynLfR7InKpfJVs Vzvx1dC6kljaq1zAwd3y0A1PUkcJsIRbiAg2EBb3ZdweuRrAj+agmewzqvtYp2COZrqY U2xYBV7vWlGxEyPADfy9rU1XigrdnGEXpN2taj0QfI9Tlh5Ui4mzmkjwtTUSnDka3rPg iq6NeJlQ8P0WilD4cehWWhtFuOrzTW+ACLUpzeWHGHMIkjYhR3hMq474vcEDFm73DtMP xWUQ== 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=sAw6Kk1s/6IRZC2+Vw0kYrwzsujmc5vW0Z47HGEMl2M=; fh=RBp1tFR20D6/5n5CXxnLW9mlceKLIiLy8XXO/rbDU6Y=; b=KFpuXV2bZdzqzI/UVRDpVsgA8Tvl+hxCotRB9wmC/6KCXiAFIWLrv9gCOjXzBn+6zv Mk9ImaQp8bhNA/Zsp6sC5TKkwlC1c9uaUE0T5RY1zXjwJMhn/sXcBr4f7NdaFg8vguQ2 5iDY+IFjLTG3avednI4TrcWZQMpGUcrB694FfL+oGrURiMK9OxuaY5oxum0vJ6ISp/uv 5d3TGMASs1JL91ewgiEHUEIn3lIGdM4BFdY/OfltVgeNIaldIdnIeClGEkA2YbKj4n3Z vHjYFbfJxuR5GZP3ubg3ytJ1+nFprsCesxsosO9VbjJet008l+z0HjaJTbdbV2QxKof8 z/Uw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b2cCF++W; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s20-20020a05620a0bd400b007811becdc63si6277712qki.81.2024.01.22.07.29.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:29:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b2cCF++W; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33305-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 41B701C22BA8 for ; Mon, 22 Jan 2024 15:29:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EE445FB91; Mon, 22 Jan 2024 15:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b2cCF++W" 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 67D825FB82; Mon, 22 Jan 2024 15:02:04 +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=1705935724; cv=none; b=kqaW+sxq5Qp1LxlPCKDwa9UX9Cn7OzDhhZMYt/cmNocatPIe3MYISYRgmZBYzuaBL9Piicl5GMaOguaMxiNCpB9kmi667A07VI80zRLyRb6sHJi5YOZ1av+LTaCK0sHsYfD+W37frOl6IFOHOqaxg0DxtX+4m7ieDlWe42aKcLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935724; c=relaxed/simple; bh=QSXYM/qKEYRrHwsHjMRC7WYNgQDaa6w1LGyVKlLjTJc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mFn71FafsRpyEL1Sovn8FLb1yzUeL6gv79bf1PxDniBVgO3r0Wli8HoLIjQfaZwl/CFlUqP8ilCMX8wa/ZY+gkFcEUFSs5rI+OXllou9k7jgHFQ9/6eLYssaIDTbCirTXn3guZeASapyZgfEAu2DfSJSsEGbVGwUMkbRjd+OeKI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b2cCF++W; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD74FC433A6; Mon, 22 Jan 2024 15:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935724; bh=QSXYM/qKEYRrHwsHjMRC7WYNgQDaa6w1LGyVKlLjTJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2cCF++WRLaKTez5Yu8eReaCxfUU1x1JGosjjk+DCpIvIVgIMLMUQmTDfnGrknpEJ LAqynKz/2g3OY3wrmSlTgqj7rUeD7P/4JjmWvHOgd2RfSi7akBnzKHj3Vk0r1lspYt zmDd2RyDT/y74I6o9a2cB/+13GP/sAhhoCJmfRPDACALmi0A15A75CFHVRz3HNtHQF DwYwxwX+Q5V7vewDyzbeuBS1tFBjQ8jAxNEOyj58Y35sKcrhR9E+vPl1l0skzv8kFZ SWrRPvBAiE4M603O4DgskaTnbgCZbes9fu7oA3HQTBG4i0i6KZ04SKYm4JobQ7UHb1 r6eaikNC9txgw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kaibo Ma , Jay Cornwall , 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.7 83/88] Revert "drm/amdkfd: Relocate TBA/TMA to opposite side of VM hole" Date: Mon, 22 Jan 2024 09:51:56 -0500 Message-ID: <20240122145608.990137-83-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-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.7.1 Content-Transfer-Encoding: 8bit From: Kaibo Ma [ Upstream commit 0f35b0a7b8fa402adbffa2565047cdcc4c480153 ] That commit causes NULL pointer dereferences in dmesgs when running applications using ROCm, including clinfo, blender, and PyTorch, since v6.6.1. Revert it to fix blender again. This reverts commit 96c211f1f9ef82183493f4ceed4e347b52849149. Closes: https://github.com/ROCm/ROCm/issues/2596 Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2991 Reviewed-by: Jay Cornwall Signed-off-by: Kaibo Ma Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c b/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c index 62b205dac63a..6604a3f99c5e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c @@ -330,12 +330,6 @@ static void kfd_init_apertures_vi(struct kfd_process_device *pdd, uint8_t id) pdd->gpuvm_limit = pdd->dev->kfd->shared_resources.gpuvm_size - 1; - /* dGPUs: the reserved space for kernel - * before SVM - */ - pdd->qpd.cwsr_base = SVM_CWSR_BASE; - pdd->qpd.ib_base = SVM_IB_BASE; - pdd->scratch_base = MAKE_SCRATCH_APP_BASE_VI(); pdd->scratch_limit = MAKE_SCRATCH_APP_LIMIT(pdd->scratch_base); } @@ -345,18 +339,18 @@ static void kfd_init_apertures_v9(struct kfd_process_device *pdd, uint8_t id) pdd->lds_base = MAKE_LDS_APP_BASE_V9(); pdd->lds_limit = MAKE_LDS_APP_LIMIT(pdd->lds_base); - pdd->gpuvm_base = PAGE_SIZE; + /* Raven needs SVM to support graphic handle, etc. Leave the small + * reserved space before SVM on Raven as well, even though we don't + * have to. + * Set gpuvm_base and gpuvm_limit to CANONICAL addresses so that they + * are used in Thunk to reserve SVM. + */ + pdd->gpuvm_base = SVM_USER_BASE; pdd->gpuvm_limit = pdd->dev->kfd->shared_resources.gpuvm_size - 1; pdd->scratch_base = MAKE_SCRATCH_APP_BASE_V9(); pdd->scratch_limit = MAKE_SCRATCH_APP_LIMIT(pdd->scratch_base); - - /* - * Place TBA/TMA on opposite side of VM hole to prevent - * stray faults from triggering SVM on these pages. - */ - pdd->qpd.cwsr_base = pdd->dev->kfd->shared_resources.gpuvm_size; } int kfd_init_apertures(struct kfd_process *process) @@ -413,6 +407,12 @@ int kfd_init_apertures(struct kfd_process *process) return -EINVAL; } } + + /* dGPUs: the reserved space for kernel + * before SVM + */ + pdd->qpd.cwsr_base = SVM_CWSR_BASE; + pdd->qpd.ib_base = SVM_IB_BASE; } dev_dbg(kfd_device, "node id %u\n", id); -- 2.43.0