From: Luben Tuikov <luben.tuikov@amd.com>
To: Sasha Levin <sashal@kernel.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Alex Deucher" <Alexander.Deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"AMD Graphics" <amd-gfx@lists.freedesktop.org>,
Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch,
Felix.Kuehling@amd.com, michael.j.ruhl@intel.com,
guchun.chen@amd.com, Yuliang.Shi@amd.com,
rajneesh.bhardwaj@amd.com, Philip.Yang@amd.com,
sunpeng.li@amd.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH AUTOSEL 6.1 5/7] drm/amdgpu: Fix size validation for non-exclusive domains (v4)
Date: Thu, 12 Jan 2023 11:24:15 -0500 [thread overview]
Message-ID: <663dd4d4-6b82-af8f-f69e-6d3b7742cdbf@amd.com> (raw)
In-Reply-To: <20221231200439.1748686-5-sashal@kernel.org>
Hi Sasha,
The patch in the link is a Fixes patch of the quoted patch, and should also go in:
https://lore.kernel.org/all/20230104221935.113400-1-luben.tuikov@amd.com/
Regards,
Luben
On 2022-12-31 15:04, Sasha Levin wrote:
> From: Luben Tuikov <luben.tuikov@amd.com>
>
> [ Upstream commit 7554886daa31eacc8e7fac9e15bbce67d10b8f1f ]
>
> Fix amdgpu_bo_validate_size() to check whether the TTM domain manager for the
> requested memory exists, else we get a kernel oops when dereferencing "man".
>
> v2: Make the patch standalone, i.e. not dependent on local patches.
> v3: Preserve old behaviour and just check that the manager pointer is not
> NULL.
> v4: Complain if GTT domain requested and it is uninitialized--most likely a
> bug.
>
> Cc: Alex Deucher <Alexander.Deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: AMD Graphics <amd-gfx@lists.freedesktop.org>
> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 2e8f6cd7a729..33e266433e9b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -446,27 +446,24 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
>
> /*
> * If GTT is part of requested domains the check must succeed to
> - * allow fall back to GTT
> + * allow fall back to GTT.
> */
> if (domain & AMDGPU_GEM_DOMAIN_GTT) {
> man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
>
> - if (size < man->size)
> + if (man && size < man->size)
> return true;
> - else
> - goto fail;
> - }
> -
> - if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
> + else if (!man)
> + WARN_ON_ONCE("GTT domain requested but GTT mem manager uninitialized");
> + goto fail;
> + } else if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
> man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
>
> - if (size < man->size)
> + if (man && size < man->size)
> return true;
> - else
> - goto fail;
> + goto fail;
> }
>
> -
> /* TODO add more domains checks, such as AMDGPU_GEM_DOMAIN_CPU */
> return true;
>
next prev parent reply other threads:[~2023-01-12 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-31 20:04 [PATCH AUTOSEL 6.1 1/7] ASoC: SOF: Revert: "core: unregister clients and machine drivers in .shutdown" Sasha Levin
2022-12-31 20:04 ` [PATCH AUTOSEL 6.1 2/7] 9p/client: fix data race on req->status Sasha Levin
2022-12-31 20:04 ` [PATCH AUTOSEL 6.1 3/7] ASoC: Intel: bytcr_rt5640: Add quirk for the Advantech MICA-071 tablet Sasha Levin
2022-12-31 20:04 ` [PATCH AUTOSEL 6.1 4/7] ASoC: SOF: mediatek: initialize panic_info to zero Sasha Levin
2022-12-31 20:04 ` [PATCH AUTOSEL 6.1 5/7] drm/amdgpu: Fix size validation for non-exclusive domains (v4) Sasha Levin
2023-01-12 16:24 ` Luben Tuikov [this message]
2022-12-31 20:04 ` [PATCH AUTOSEL 6.1 6/7] drm/amdkfd: Fix kfd_process_device_init_vm error handling Sasha Levin
2022-12-31 20:04 ` [PATCH AUTOSEL 6.1 7/7] drm/amdkfd: Fix double release compute pasid Sasha Levin
2023-01-04 12:34 ` [PATCH AUTOSEL 6.1 1/7] ASoC: SOF: Revert: "core: unregister clients and machine drivers in .shutdown" Kai Vehmanen
2023-01-09 12:35 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=663dd4d4-6b82-af8f-f69e-6d3b7742cdbf@amd.com \
--to=luben.tuikov@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Felix.Kuehling@amd.com \
--cc=Philip.Yang@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=Yuliang.Shi@amd.com \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=guchun.chen@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.j.ruhl@intel.com \
--cc=rajneesh.bhardwaj@amd.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox