Skip to contentSkip to conversation

drm/amdgpu: Add support for page queue scheduling

PATCH In review [email protected] 2 participants 2 messages Feb 11, 2025 – Feb 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Add support for page queue scheduling

This patch updates the sdma engine to support scheduling for the page queue. The main changes include:

- Introduce a new variable page to handle the page queue if it exists.
- Update the scheduling logic to conditionally set the sched.ready flag for both the sdma gfx queue and the page queue based on the provided mask.
- Ensure that the scheduling flags are updated correctly for both queues when the mask is applied.

The patch ensures that the SDMA engine can handle scheduling for both the sdma gfx queue and the page queue,

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +11 -3
index 6ba785798a4a..e82ded95540c 100644
@@ -358,7 +358,7 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
 	struct amdgpu_device *adev = (struct amdgpu_device *)data;
 	u32 i;
 	u64 mask = 0;
-	struct amdgpu_ring *ring;
+	struct amdgpu_ring *ring, *page;
 
 	if (!adev)
 		return -ENODEV;
@@ -369,10 +369,18 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
 
 	for (i = 0; i < adev->sdma.num_instances; ++i) {
 		ring = &adev->sdma.instance[i].ring;
-		if (val & BIT_ULL(i))
+		if (adev->sdma.has_page_queue)
+			page = &adev->sdma.instance[i].page;
+		if (val & BIT_ULL(i)) {
 			ring->sched.ready = true;
-		else
+			if (adev->sdma.has_page_queue)
+				page->sched.ready = true;
+		} else {
 			ring->sched.ready = false;
+			if (adev->sdma.has_page_queue)
+				page->sched.ready = false;
+		}
+
 	}
 	/* publish sched.ready flag update effective immediately across smp */
 	smp_rmb();
Signature · 1 line
2.25.1
#1 lore raw
Quoted 39 lines · On Tue, Feb 11, 2025 at 4:02 AM [email protected] <[email protected]> wrote:

This patch updates the sdma engine to support scheduling for the page queue. The main changes include:

- Introduce a new variable page to handle the page queue if it exists.
- Update the scheduling logic to conditionally set the sched.ready flag for both the sdma gfx queue and the page queue based on the provided mask.
- Ensure that the scheduling flags are updated correctly for both queues when the mask is applied.

The patch ensures that the SDMA engine can handle scheduling for both the sdma gfx queue and the page queue,

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +4 -2
index 6ba785798a4a..e82ded95540c 100644
@@ -358,7 +358,7 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
        struct amdgpu_device *adev = (struct amdgpu_device *)data;
        u32 i;
        u64 mask = 0;
-       struct amdgpu_ring *ring;
+       struct amdgpu_ring *ring, *page;
 
        if (!adev)
                return -ENODEV;
@@ -369,10 +369,18 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
 
        for (i = 0; i < adev->sdma.num_instances; ++i) {
                ring = &adev->sdma.instance[i].ring;
-               if (val & BIT_ULL(i))
+               if (adev->sdma.has_page_queue)
+                       page = &adev->sdma.instance[i].page;
+               if (val & BIT_ULL(i)) {

drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val) · line 383

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +7 -1
                        ring->sched.ready = true;
-               else
+                       if (adev->sdma.has_page_queue)
+                               page->sched.ready = true;
+               } else {
                        ring->sched.ready = false;
+                       if (adev->sdma.has_page_queue)
+                               page->sched.ready = false;
+               }
+

Not really specific to this patch, but if we disable schedulers here, we may disable the buffer_funcs scheduler used by the driver for memory management.

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +0 -1
        }
        /* publish sched.ready flag update effective immediately across smp */
        smp_rmb();
--

2.25.1