Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp174547lqo; Tue, 7 May 2024 16:41:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgzCQDRMMR4tKNxRIWMN9PRtwRXVbQbJqWnZzA6+SBcdddHP/nNOwtGOn/+o+mKxQyDlM5BjY1OKcaiqoG8hSRa3waOHIFX0r7xymeEw== X-Google-Smtp-Source: AGHT+IGvvnC3evu1KBVpW+wPt9ANYS7UCPQCUtjhEtmur3tYK7E9i99Z9ts1rxLeKsV9DBzSaB2U X-Received: by 2002:a05:622a:448:b0:43a:fa0d:68cb with SMTP id d75a77b69052e-43dbec043a5mr12924041cf.6.1715125283143; Tue, 07 May 2024 16:41:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715125283; cv=pass; d=google.com; s=arc-20160816; b=mv2MuhOYEtcV3wDHIFWz0nNn/c56EexQWfczX25lH2+1Ow2tqfoQme8HtqhSGNtIhC d1IpK2rII96UjTy4tXPYeH3kdDQJjakO69rl/O1ZIOq2UgXLw1GmdBqcABgmms3gQYy+ RhWhbDJSChtv1moI5HUpR2nZ/wTBteeoM5P/d+8K6//JmVtMRZUpPjdXh7WGBh5jkA7T cy6fJqhOmVSVTJhfUsfh0iD5YGr/vJ5gqt8aX07MKfV4UBgbmgRnyagPWG9oKW+bK7sk WvdzqQQh3xGBrh39NvYLy6jfL94sSbFzo+2EqZTedgBwcytMCbma9JbCfEIraoEYxA4n xl/g== 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=q/0+ytwRlEDjgnBca/hFNLpsNoqWCj0mtX6wXFlNKNo=; fh=YhyT2CEWrlhwfxNcxfR8K0L7VckNSNH+HkCIoM0YHvw=; b=ltZkAIqPwMygBoZPtXpQo6f4JzteJJV/P01+biJrvRHlPrUFGtnco/QZ8Esr+sYm3N g4xv/OaYh2YkU7tz1Gn8KZxJNwj6DhD+s+T9tvMFt9YRTZhpJSmwmPFxBcLOlTLgdK6g pTJ7wIj00qW8KRdC4qOeXCmVD8FduuIA79dP+H3/kCdF7F/oLmDd7+vqWJsiuKwmqjRZ jGBNGa/xS+s1bFMwvbG+/6n3WMPFcZ7qiKNyUL7+fwkA0hnPpTtsqhQDUbCVReCfIj1A JvGDUzvnHLnOYiShXx2DzeOKOEMkWy3vWtrHtcRA0lQlZPTwf2bAcyNv6rDljT7H4RrP FErg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AJIOPI26; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172423-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t21-20020a05622a149500b0043c764336e1si12754986qtx.352.2024.05.07.16.41.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AJIOPI26; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172423-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172423-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 AF2DB1C236AF for ; Tue, 7 May 2024 23:41:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A61616F28C; Tue, 7 May 2024 23:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AJIOPI26" 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 828E916F274; Tue, 7 May 2024 23:11:27 +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=1715123487; cv=none; b=I5egSgoous6r8wxuScrAR9RAnVIv0ZKWfjDzca8dLTwUoGWEhXvhsry8MiDyjx3uvAwJeJ9UWeiiX2CdS7UcIamyPFBZQJqJryDb6yR4NJoi2SyP54BQJ422CQfLl7/ROfF58KKZPzy640eDlSAJPtSe+I+aZlsVdolsy99IVZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123487; c=relaxed/simple; bh=Izw35QVQsTLTzboznqrLCxwrPV1y5ztO80AnI0ghQyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ucgeE6zvV2v7hpKYudF6mJjz1TUlu6YPzqizFnZ9MQg9n6sbEJ991284aWk0QO2L9KGQYV2fASa4R7J9Ve5o+5BPBTF+qobe76p5p5q1DGcLoA2donw+w7CUwMnuqMT9EAv+6F1xPlPkjNsIEUnIsiehCxZgVOThMqu1PB9xaLM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AJIOPI26; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F6B3C4DDE0; Tue, 7 May 2024 23:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123487; bh=Izw35QVQsTLTzboznqrLCxwrPV1y5ztO80AnI0ghQyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJIOPI26LC95GJQBdn31FpfE5GTZzQLNkcqDkUEq4yj/tDVFiD2I5GjsRh2J/Mi+T Ifu88OZkeBVNdGtaR2unCdMLNCkG5R00gNUp2/Z54nXgffO7xqS1WnZjeOWRKIZZ2K MtRgrM2RA+S5BBwnWPUbUhqMwXTbCQQ1gJtp8KCHduen/5YsnS/MN6EPtxQtGwbJP2 RMA7Lk7ed61FvLcCygqz3GjNzB59iZa2nzToYvnTFAk1NRbWC2Tm6xXwekD5kimr7q BWKmGoEV9lWjpmDBkJqize/rXD6hco+QJQLf09oJRjGiN/XWfjqe/yRayl0JZ/Exxi 4wMirhQ3wuujw== 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.6 28/43] drm/amdgpu: Fix VRAM memory accounting Date: Tue, 7 May 2024 19:09:49 -0400 Message-ID: <20240507231033.393285-28-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507231033.393285-1-sashal@kernel.org> References: <20240507231033.393285-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.6.30 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 15c5a2533ba60..704567885c7a4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -213,7 +213,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