From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Lang Yu" <Lang.Yu@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Sasha Levin" <sashal@kernel.org>,
Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch,
gregkh@linuxfoundation.org, samuel.pitoiset@gmail.com,
Hongkun.Zhang@amd.com, bas@basnieuwenhuizen.nl,
olvaffe@gmail.com, danijel.slivka@amd.com,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 6.1 26/41] drm/amdgpu: install stub fence into potential unused fence pointers
Date: Sun, 23 Jul 2023 21:20:59 -0400 [thread overview]
Message-ID: <20230724012118.2316073-26-sashal@kernel.org> (raw)
In-Reply-To: <20230724012118.2316073-1-sashal@kernel.org>
From: Lang Yu <Lang.Yu@amd.com>
[ Upstream commit 187916e6ed9d0c3b3abc27429f7a5f8c936bd1f0 ]
When using cpu to update page tables, vm update fences are unused.
Install stub fence into these fence pointers instead of NULL
to avoid NULL dereference when calling dma_fence_wait() on them.
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Lang Yu <Lang.Yu@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_vm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 003aa9e47085e..2fa7b68c5966d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1352,6 +1352,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
amdgpu_vm_bo_base_init(&bo_va->base, vm, bo);
bo_va->ref_count = 1;
+ bo_va->last_pt_update = dma_fence_get_stub();
INIT_LIST_HEAD(&bo_va->valids);
INIT_LIST_HEAD(&bo_va->invalids);
@@ -2061,7 +2062,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
vm->update_funcs = &amdgpu_vm_cpu_funcs;
else
vm->update_funcs = &amdgpu_vm_sdma_funcs;
- vm->last_update = NULL;
+
+ vm->last_update = dma_fence_get_stub();
vm->last_unlocked = dma_fence_get_stub();
vm->last_tlb_flush = dma_fence_get_stub();
@@ -2186,7 +2188,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
goto unreserve_bo;
dma_fence_put(vm->last_update);
- vm->last_update = NULL;
+ vm->last_update = dma_fence_get_stub();
vm->is_compute_context = true;
/* Free the shadow bo for compute VM */
--
2.39.2
next prev parent reply other threads:[~2023-07-24 1:25 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 1:20 [PATCH AUTOSEL 6.1 01/41] drm/amd/display: Do not set drr on pipe commit Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 02/41] drm/amdgpu: fix calltrace warning in amddrm_buddy_fini Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 03/41] drm/radeon: Fix integer overflow in radeon_cs_parser_init Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 04/41] drm/amdgpu: Fix integer overflow in amdgpu_cs_pass1 Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 05/41] drm/amdgpu: fix memory leak in mes self test Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 06/41] ALSA: emu10k1: roll up loops in DSP setup code for Audigy Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 07/41] ASoC: Intel: sof_sdw: add quirk for MTL RVP Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 08/41] ASoC: Intel: sof_sdw: add quirk for LNL RVP Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 09/41] PCI: tegra194: Fix possible array out of bounds access Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 10/41] ASoC: SOF: amd: Add pci revision id check Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 11/41] drm/stm: ltdc: fix late dereference check Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 12/41] drm: rcar-du: remove R-Car H3 ES1.* workarounds Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 13/41] ASoC: amd: vangogh: Add check for acp config flags in vangogh platform Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 14/41] ARM: dts: imx6dl: prtrvt, prtvt7, prti6q, prtwd2: fix USB related warnings Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 15/41] ASoC: Intel: sof_sdw_rt_sdca_jack_common: test SOF_JACK_JDSRC in _exit Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 16/41] ASoC: Intel: sof_sdw: Add support for Rex soundwire Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 17/41] iopoll: Call cpu_relax() in busy loops Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 18/41] quota: Properly disable quotas when add_dquot_ref() fails Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 19/41] quota: fix warning in dqgrab() Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 20/41] ALSA: hda: Add Loongson LS7A HD-Audio support Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 21/41] ASoC: SOF: Intel: fix SoundWire/HDaudio mutual exclusion Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 22/41] dma-remap: use kvmalloc_array/kvfree for larger dma memory remap Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 23/41] accel/habanalabs: add pci health check during heartbeat Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 24/41] HID: logitech-hidpp: Add USB and Bluetooth IDs for the Logitech G915 TKL Keyboard Sasha Levin
2023-07-24 1:20 ` [PATCH AUTOSEL 6.1 25/41] iommu/amd: Introduce Disable IRTE Caching Support Sasha Levin
2023-07-24 1:20 ` Sasha Levin [this message]
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 27/41] drm/amd/display: Apply 60us prefetch for DCFCLK <= 300Mhz Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 28/41] Revert "drm/amd/display: Do not set drr on pipe commit" Sasha Levin
2023-07-24 10:46 ` Michel Dänzer
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 29/41] HID: add quirk for 03f0:464a HP Elite Presenter Mouse Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 30/41] RDMA/mlx5: Return the firmware result upon destroying QP/RQ Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 31/41] drm/amd/display: Skip DPP DTO update if root clock is gated Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 32/41] drm/amd/display: Enable dcn314 DPP RCO Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 33/41] ASoC: SOF: core: Free the firmware trace before calling snd_sof_shutdown() Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 34/41] ovl: check type and offset of struct vfsmount in ovl_entry Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 35/41] HID: intel-ish-hid: ipc: Add Arrow Lake PCI device ID Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 36/41] udf: Fix uninitialized array access for some pathnames Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 37/41] ALSA: hda/realtek: Add quirks for ROG ALLY CS35l41 audio Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 38/41] fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 39/41] MIPS: dec: prom: Address -Warray-bounds warning Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 40/41] FS: JFS: Fix null-ptr-deref Read in txBegin Sasha Levin
2023-07-24 1:21 ` [PATCH AUTOSEL 6.1 41/41] FS: JFS: Check for read-only mounted filesystem " 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=20230724012118.2316073-26-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Hongkun.Zhang@amd.com \
--cc=Lang.Yu@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bas@basnieuwenhuizen.nl \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=danijel.slivka@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olvaffe@gmail.com \
--cc=samuel.pitoiset@gmail.com \
--cc=stable@vger.kernel.org \
/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