* [PATCH AUTOSEL 6.13 13/34] drm/amdkfd: sriov doesn't support per queue reset
[not found] <20250414132729.679254-1-sashal@kernel.org>
@ 2025-04-14 13:27 ` Sasha Levin
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 14/34] drm/amdgpu: Increase KIQ invalidate_tlbs timeout Sasha Levin
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P Sasha Levin
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2025-04-14 13:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Emily Deng, Jonathan Kim, Alex Deucher, Sasha Levin,
Felix.Kuehling, christian.koenig, airlied, simona, amd-gfx,
dri-devel
From: Emily Deng <Emily.Deng@amd.com>
[ Upstream commit ba6d8f878d6180d4d0ed0574479fc1e232928184 ]
Disable per queue reset for sriov.
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 9476e30d6baa1..f45fb81cacd2f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1999,7 +1999,8 @@ static void kfd_topology_set_capabilities(struct kfd_topology_device *dev)
dev->node_props.capability |=
HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED;
- dev->node_props.capability |= HSA_CAP_PER_QUEUE_RESET_SUPPORTED;
+ if (!amdgpu_sriov_vf(dev->gpu->adev))
+ dev->node_props.capability |= HSA_CAP_PER_QUEUE_RESET_SUPPORTED;
} else {
dev->node_props.debug_prop |= HSA_DBG_WATCH_ADDR_MASK_LO_BIT_GFX10 |
HSA_DBG_WATCH_ADDR_MASK_HI_BIT;
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH AUTOSEL 6.13 14/34] drm/amdgpu: Increase KIQ invalidate_tlbs timeout
[not found] <20250414132729.679254-1-sashal@kernel.org>
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 13/34] drm/amdkfd: sriov doesn't support per queue reset Sasha Levin
@ 2025-04-14 13:27 ` Sasha Levin
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P Sasha Levin
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2025-04-14 13:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Jay Cornwall, Kent Russell, Harish Kasiviswanathan, Alex Deucher,
Sasha Levin, christian.koenig, airlied, simona, lijo.lazar,
Hawking.Zhang, sunil.khatri, srinivasan.shanmugam, Jesse.zhang,
linux, zhangzekun11, victor.skvortsov, rajneesh.bhardwaj,
Yunxiang.Li, tim.huang, amd-gfx, dri-devel
From: Jay Cornwall <jay.cornwall@amd.com>
[ Upstream commit 3666ed821832f42baaf25f362680dda603cde732 ]
KIQ invalidate_tlbs request has been seen to marginally exceed the
configured 100 ms timeout on systems under load.
All other KIQ requests in the driver use a 10 second timeout. Use a
similar timeout implementation on the invalidate_tlbs path.
v2: Poll once before msleep
v3: Fix return value
Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Cc: Kent Russell <kent.russell@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@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.h | 1 -
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 19 ++++++++++++++-----
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 4653a8d2823a6..d5514b5ac1239 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -352,7 +352,6 @@ enum amdgpu_kiq_irq {
AMDGPU_CP_KIQ_IRQ_DRIVER0 = 0,
AMDGPU_CP_KIQ_IRQ_LAST
};
-#define SRIOV_USEC_TIMEOUT 1200000 /* wait 12 * 100ms for SRIOV */
#define MAX_KIQ_REG_WAIT 5000 /* in usecs, 5ms */
#define MAX_KIQ_REG_BAILOUT_INTERVAL 5 /* in msecs, 5ms */
#define MAX_KIQ_REG_TRY 1000
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 1c19a65e65533..ef74259c448d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -678,12 +678,10 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
uint32_t flush_type, bool all_hub,
uint32_t inst)
{
- u32 usec_timeout = amdgpu_sriov_vf(adev) ? SRIOV_USEC_TIMEOUT :
- adev->usec_timeout;
struct amdgpu_ring *ring = &adev->gfx.kiq[inst].ring;
struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst];
unsigned int ndw;
- int r;
+ int r, cnt = 0;
uint32_t seq;
/*
@@ -740,10 +738,21 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
amdgpu_ring_commit(ring);
spin_unlock(&adev->gfx.kiq[inst].ring_lock);
- if (amdgpu_fence_wait_polling(ring, seq, usec_timeout) < 1) {
+
+ r = amdgpu_fence_wait_polling(ring, seq, MAX_KIQ_REG_WAIT);
+
+ might_sleep();
+ while (r < 1 && cnt++ < MAX_KIQ_REG_TRY &&
+ !amdgpu_reset_pending(adev->reset_domain)) {
+ msleep(MAX_KIQ_REG_BAILOUT_INTERVAL);
+ r = amdgpu_fence_wait_polling(ring, seq, MAX_KIQ_REG_WAIT);
+ }
+
+ if (cnt > MAX_KIQ_REG_TRY) {
dev_err(adev->dev, "timeout waiting for kiq fence\n");
r = -ETIME;
- }
+ } else
+ r = 0;
}
error_unlock_reset:
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P
[not found] <20250414132729.679254-1-sashal@kernel.org>
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 13/34] drm/amdkfd: sriov doesn't support per queue reset Sasha Levin
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 14/34] drm/amdgpu: Increase KIQ invalidate_tlbs timeout Sasha Levin
@ 2025-04-14 13:27 ` Sasha Levin
2025-04-14 13:48 ` [Linaro-mm-sig] " Alex Deucher
2 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2025-04-14 13:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Christian König, Simona Vetter, Felix Kuehling, Pak Nin Lui,
Alex Deucher, Sasha Levin, airlied, simona, sumit.semwal,
Yunxiang.Li, tvrtko.ursulin, matthew.auld, amd-gfx, dri-devel,
linux-media, linaro-mm-sig
From: Christian König <christian.koenig@amd.com>
[ Upstream commit f5e7fabd1f5c65b2e077efcdb118cfa67eae7311 ]
Try pinning into VRAM to allow P2P with RDMA NICs without ODP
support if all attachments can do P2P. If any attachment can't do
P2P just pin into GTT instead.
Acked-by: Simona Vetter <simona.vetter@ffwll.ch>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Tested-by: Pak Nin Lui <pak.lui@amd.com>
Cc: Simona Vetter <simona.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 25 +++++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 8e81a83d37d84..83390143c2e9f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -72,11 +72,25 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
*/
static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
{
- struct drm_gem_object *obj = attach->dmabuf->priv;
- struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
+ struct dma_buf *dmabuf = attach->dmabuf;
+ struct amdgpu_bo *bo = gem_to_amdgpu_bo(dmabuf->priv);
+ u32 domains = bo->preferred_domains;
- /* pin buffer into GTT */
- return amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
+ dma_resv_assert_held(dmabuf->resv);
+
+ /*
+ * Try pinning into VRAM to allow P2P with RDMA NICs without ODP
+ * support if all attachments can do P2P. If any attachment can't do
+ * P2P just pin into GTT instead.
+ */
+ list_for_each_entry(attach, &dmabuf->attachments, node)
+ if (!attach->peer2peer)
+ domains &= ~AMDGPU_GEM_DOMAIN_VRAM;
+
+ if (domains & AMDGPU_GEM_DOMAIN_VRAM)
+ bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+
+ return amdgpu_bo_pin(bo, domains);
}
/**
@@ -131,9 +145,6 @@ static struct sg_table *amdgpu_dma_buf_map(struct dma_buf_attachment *attach,
r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
if (r)
return ERR_PTR(r);
-
- } else if (bo->tbo.resource->mem_type != TTM_PL_TT) {
- return ERR_PTR(-EBUSY);
}
switch (bo->tbo.resource->mem_type) {
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Linaro-mm-sig] [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P Sasha Levin
@ 2025-04-14 13:48 ` Alex Deucher
2025-04-27 23:59 ` Sasha Levin
0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2025-04-14 13:48 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Christian König, Simona Vetter,
Felix Kuehling, Pak Nin Lui, Alex Deucher, simona, sumit.semwal,
Yunxiang.Li, tvrtko.ursulin, matthew.auld, amd-gfx, dri-devel,
linux-media, linaro-mm-sig
On Mon, Apr 14, 2025 at 9:28 AM Sasha Levin <sashal@kernel.org> wrote:
>
> From: Christian König <christian.koenig@amd.com>
>
> [ Upstream commit f5e7fabd1f5c65b2e077efcdb118cfa67eae7311 ]
>
> Try pinning into VRAM to allow P2P with RDMA NICs without ODP
> support if all attachments can do P2P. If any attachment can't do
> P2P just pin into GTT instead.
>
> Acked-by: Simona Vetter <simona.vetter@ffwll.ch>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
> Tested-by: Pak Nin Lui <pak.lui@amd.com>
> Cc: Simona Vetter <simona.vetter@ffwll.ch>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
This should not go to stable. It depends on dmem cgroups.
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 25 +++++++++++++++------
> 1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> index 8e81a83d37d84..83390143c2e9f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> @@ -72,11 +72,25 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf,
> */
> static int amdgpu_dma_buf_pin(struct dma_buf_attachment *attach)
> {
> - struct drm_gem_object *obj = attach->dmabuf->priv;
> - struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
> + struct dma_buf *dmabuf = attach->dmabuf;
> + struct amdgpu_bo *bo = gem_to_amdgpu_bo(dmabuf->priv);
> + u32 domains = bo->preferred_domains;
>
> - /* pin buffer into GTT */
> - return amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT);
> + dma_resv_assert_held(dmabuf->resv);
> +
> + /*
> + * Try pinning into VRAM to allow P2P with RDMA NICs without ODP
> + * support if all attachments can do P2P. If any attachment can't do
> + * P2P just pin into GTT instead.
> + */
> + list_for_each_entry(attach, &dmabuf->attachments, node)
> + if (!attach->peer2peer)
> + domains &= ~AMDGPU_GEM_DOMAIN_VRAM;
> +
> + if (domains & AMDGPU_GEM_DOMAIN_VRAM)
> + bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
> +
> + return amdgpu_bo_pin(bo, domains);
> }
>
> /**
> @@ -131,9 +145,6 @@ static struct sg_table *amdgpu_dma_buf_map(struct dma_buf_attachment *attach,
> r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
> if (r)
> return ERR_PTR(r);
> -
> - } else if (bo->tbo.resource->mem_type != TTM_PL_TT) {
> - return ERR_PTR(-EBUSY);
> }
>
> switch (bo->tbo.resource->mem_type) {
> --
> 2.39.5
>
> _______________________________________________
> Linaro-mm-sig mailing list -- linaro-mm-sig@lists.linaro.org
> To unsubscribe send an email to linaro-mm-sig-leave@lists.linaro.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Linaro-mm-sig] [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P
2025-04-14 13:48 ` [Linaro-mm-sig] " Alex Deucher
@ 2025-04-27 23:59 ` Sasha Levin
0 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2025-04-27 23:59 UTC (permalink / raw)
To: Alex Deucher
Cc: linux-kernel, stable, Christian König, Simona Vetter,
Felix Kuehling, Pak Nin Lui, Alex Deucher, simona, sumit.semwal,
Yunxiang.Li, tvrtko.ursulin, matthew.auld, amd-gfx, dri-devel,
linux-media, linaro-mm-sig
On Mon, Apr 14, 2025 at 09:48:10AM -0400, Alex Deucher wrote:
>On Mon, Apr 14, 2025 at 9:28 AM Sasha Levin <sashal@kernel.org> wrote:
>>
>> From: Christian König <christian.koenig@amd.com>
>>
>> [ Upstream commit f5e7fabd1f5c65b2e077efcdb118cfa67eae7311 ]
>>
>> Try pinning into VRAM to allow P2P with RDMA NICs without ODP
>> support if all attachments can do P2P. If any attachment can't do
>> P2P just pin into GTT instead.
>>
>> Acked-by: Simona Vetter <simona.vetter@ffwll.ch>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Felix Kuehling <felix.kuehling@amd.com>
>> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
>> Tested-by: Pak Nin Lui <pak.lui@amd.com>
>> Cc: Simona Vetter <simona.vetter@ffwll.ch>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
>This should not go to stable. It depends on dmem cgroups.
I'll drop it.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-27 23:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250414132729.679254-1-sashal@kernel.org>
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 13/34] drm/amdkfd: sriov doesn't support per queue reset Sasha Levin
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 14/34] drm/amdgpu: Increase KIQ invalidate_tlbs timeout Sasha Levin
2025-04-14 13:27 ` [PATCH AUTOSEL 6.13 15/34] drm/amdgpu: allow pinning DMA-bufs into VRAM if all importers can do P2P Sasha Levin
2025-04-14 13:48 ` [Linaro-mm-sig] " Alex Deucher
2025-04-27 23:59 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox