Skip to contentSkip to conversation

gpu: nova-core: gsp: cmdq: reduce sleep delta in wait_for_msg

PATCH Applied Alexandre Courbot 3 participants 4 messages Nov 2

Subsystems (5)
lore
Share & tools
lore

Alexandre Courbot

author maintainer
#0 lore raw

PATCH v2 1/1 gpu: nova-core: gsp: cmdq: reduce sleep delta in wait_for_msg

If a message is not immediately available on the queue, wait_for_msg sleeps for 1 millisecond before checking again. This is 3 orders of magnitude more than Nouveau (which sleeps for 1 microsecond) or OpenRM (which does not sleep at all and busy-polls) and is way too much, as GSP commands are expected to be processed much faster than that.

Reduce the sleep time to 1 microsecond. This effectively makes fsleep busy-loop with a call to cpu_relax afterwards, keeping latency to a minimum.

---
Changes in v2:
- Wait for 1 microsecond. (Eliot)
- Link to v1: https://patch.msgid.link/[email protected]

---
 drivers/gpu/nova-core/gsp/cmdq.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/nova-core/gsp/cmdq.rs +1 -1
index 936406004a57..8ee8a99e4d7e 100644
@@ -603,7 +603,7 @@ fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> {
             read_poll_timeout(
                 || Ok(self.gsp_mem.driver_read_area()),
                 |driver_area| !driver_area.0.is_empty(),
-                Delta::from_millis(1),
+                Delta::from_micros(1),
                 timeout,
             )
         }

---
base-commit: 9fe580fd90e20c8432832c5f9a7e92b049ae9af6
change-id: 20261030-cmdq_wait_msg_timeout-26df11234d10

Best regards,

Signature · 1 line
Alexandre Courbot <[email protected]>
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Alexandre Courbot

If a message is not immediately available on the queue, wait_for_msg sleeps for 1 millisecond before checking again. This is 3 orders of magnitude more than Nouveau (which sleeps for 1 microsecond) or OpenRM (which does not sleep at all and busy-polls) and is way too much, as GSP commands are expected to be processed much faster than that.

Reduce the sleep time to 1 microsecond. This effectively makes fsleep busy-loop with a call to cpu_relax afterwards, keeping latency to a minimum.

Quoted 6 lines

---
Changes in v2:
- Wait for 1 microsecond. (Eliot)
- Link to v1: https://patch.msgid.link/[email protected]
---

maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Alexandre Courbot
Quoted 11 lines · Alexandre Courbot

If a message is not immediately available on the queue, wait_for_msg sleeps for 1 millisecond before checking again. This is 3 orders of magnitude more than Nouveau (which sleeps for 1 microsecond) or OpenRM (which does not sleep at all and busy-polls) and is way too much, as GSP commands are expected to be processed much faster than that.

Reduce the sleep time to 1 microsecond. This effectively makes fsleep busy-loop with a call to cpu_relax afterwards, keeping latency to a minimum.

author maintainer Applied
#3 lore raw
In reply to Alexandre Courbot
Quoted 11 lines · Alexandre Courbot

If a message is not immediately available on the queue, wait_for_msg sleeps for 1 millisecond before checking again. This is 3 orders of magnitude more than Nouveau (which sleeps for 1 microsecond) or OpenRM (which does not sleep at all and busy-polls) and is way too much, as GSP commands are expected to be processed much faster than that.

Reduce the sleep time to 1 microsecond. This effectively makes fsleep busy-loop with a call to cpu_relax afterwards, keeping latency to a minimum.

Pushed to drm-rust-next, thanks!