Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp177365lqo; Tue, 7 May 2024 16:50:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIcWGx1kYrVyKyfuq+or+yp9HktxF8UcbAXsypVwYB2TLGq+g+d0VPOxYd9isrW2z5mo4cW6z8gwWxMGQzpj06UllDrL+ixoFKmSB5TQ== X-Google-Smtp-Source: AGHT+IH6DIXl04lu9L2KcyQPfFm8tZoah1+eNQ/ZpgPmhqFrissIS6CsSvbJhZrZhdBs37pK4qbi X-Received: by 2002:a17:90b:b17:b0:2b4:36d7:b6ad with SMTP id 98e67ed59e1d1-2b61639c45dmr1036214a91.4.1715125808226; Tue, 07 May 2024 16:50:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715125808; cv=pass; d=google.com; s=arc-20160816; b=cogvuNigVz4F26UlfmQKMTtvBjd8/OzntBzxM7iML1SZCKd8GXUN2SH/Vd7Tx/hb3J MpYQzlt+7Jhu/chzpWswQa5QMLe4tgWTKWmeCcEHLs4wbwGwFV1eZ6DMMkjTPxpiaQHP QWblSiK4v8FVX9Za9w/4R1Xmjo9DnTh4VXSXbeGtTsS7myDvTIR+g7pmx6Qf4ix5hNaC WjhYeSTPeENJM2PK/w7sbHCshdm/UmSg+XV/dIAEjyu2xOlF+4ZwrSUt8LFOJYabhiRS jl3bQY/0+FNfLJgYdV6tLs/WV6wgC6ET0FpuzR9WBS5S9k+Fg9f/As83osf2+HFjLO07 m8nw== 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=jhI7fh4Cqhrb7SBGlDEj3pIDCNPX9faQSNfbX8GUrPI=; fh=YhyT2CEWrlhwfxNcxfR8K0L7VckNSNH+HkCIoM0YHvw=; b=dAO7i257WWKY5qtwmbD6T6LfAN6Z4dzUAqEIZ+x7j1962fraF+BFBnOEaKjGjlxq05 TRFmRT/sXgWt2/175kegRu25dVzZNR3kXUoVfSs5S9jXKe8qZrlomlxKLk06Zo8NH6Uy KFwPHTbAdQSFIsQicymKaKs2CwLtS11/OUh93xeWmclrvyP4Hfvct6eZWNjmprMHvyeP 8J8M87wSQLq1ZKJvbYR1/wTyex/ZTKND76Uc1gXhFce9m4shEYdsdlXf1/J536ap5xrW 1T5L79XZ+26+ReMqGlTAdjbeHqflNnbdcsqzRpWQJ0MEG6BEv4fSqTS4CM+qvdPNY0s3 4MkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N9s4CWCq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172378-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. [147.75.48.161]) by mx.google.com with ESMTPS id h3-20020a17090a3d0300b002b29744a309si148390pjc.124.2024.05.07.16.50.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:50:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N9s4CWCq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172378-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 3DB5FB2826A for ; Tue, 7 May 2024 23:30:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AEBE144D2C; Tue, 7 May 2024 23:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N9s4CWCq" 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 54AE9144D0E; Tue, 7 May 2024 23:09:09 +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=1715123349; cv=none; b=mavOaJfBREJuOBIuHqNbJrMhWbNv2goX29yS9haSoKMq31OKqAg7P5bpVRNlf1S0RaNaLMxVfGadoqMm8Yi+MX5m3quvVNc3Tfa1tmVAqT4hMirfl3qnxRaFSBWM3lvYy4ZQzgHk6q2tvx+npizcJQq/uheCX0qNTi4fOx7t95E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123349; c=relaxed/simple; bh=TC1fHbwX4lCqA9LuinqAvLD4Tet9hyjvajiKyUSSdPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RBGVwZAFjQeMCdL/fEcwxWIXoZsvIa3biZ4l+OTtpr29n9VxKuU9MYkYv5GmIt17qxlK/R8aDxNXSLKO+kiry9DcxrooNjRC3TYt3636RpjgW1DwC8O2LJYu4z8+mS3juurXw2UTNFV2lut5L0RzT7LO0EljdnnBvjq+iBvNi3Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N9s4CWCq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF039C4AF68; Tue, 7 May 2024 23:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123349; bh=TC1fHbwX4lCqA9LuinqAvLD4Tet9hyjvajiKyUSSdPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N9s4CWCqkLwaLVB7BVI3qB4SZ8ZtZCZD5JYpvjFWC0NfF9Hk1ayINANny1eFBKV4/ PVUN55Vl6HIcKb9vHIs74BB8IkXGSzkXYQHe9g958j06GsVndr5Fs7sDoFjnM5MfHL ZWPryPpQWxVmc8sFAzuD1PrnBQ8ktbATViT5rA4xiWvCJh5JtbiJYHXwtRkd6TAqtZ XPozEbqB5pvAjzNNvrJNLVUw0jMg7WejA6UOpSJ9YkSm34UFSpPndLH2SWh9v2r/ys 75by9Izu8yLKYY45ATTqdARoUWBmu5n0+HQD1LzSiIMcUir7zhwTAaeUGJINaCr0c1 3bHnS9XekBX3Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mukul Joshi , 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 35/52] drm/amdgpu: Fix VRAM memory accounting Date: Tue, 7 May 2024 19:07:01 -0400 Message-ID: <20240507230800.392128-35-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507230800.392128-1-sashal@kernel.org> References: <20240507230800.392128-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.9 Content-Transfer-Encoding: 8bit From: Mukul Joshi [ Upstream commit f06446ef23216090d1ee8ede1a7d7ae430c22dcc ] Subtract the VRAM pinned memory when checking for available memory in amdgpu_amdkfd_reserve_mem_limit function since that memory is not available for use. Signed-off-by: Mukul Joshi Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- 1 file changed, 1 insertion(+), 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..b1e2dd52e643d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -220,7 +220,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev, (kfd_mem_limit.ttm_mem_used + ttm_mem_needed > kfd_mem_limit.max_ttm_mem_limit) || (adev && xcp_id >= 0 && adev->kfd.vram_used[xcp_id] + vram_needed > - vram_size - reserved_for_pt)) { + vram_size - reserved_for_pt - atomic64_read(&adev->vram_pin_size))) { ret = -ENOMEM; goto release; } -- 2.43.0