From abc327a39a4be775853df9e281a2d6d8df32461a Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 11 Apr 2024 19:48:38 -0700 Subject: [PATCH] venus: use more relaxed profile for TLS ring seqno wait Excessive polling for TLS ring synchronous cmds is a waste of cpu cycles. Signed-off-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_common.c | 3 +++ src/virtio/vulkan/vn_common.h | 1 + src/virtio/vulkan/vn_ring.c | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c index 9fba1b8b952..4d22f184487 100644 --- a/src/virtio/vulkan/vn_common.c +++ b/src/virtio/vulkan/vn_common.c @@ -167,6 +167,8 @@ vn_relax_reason_string(enum vn_relax_reason reason) switch (reason) { case VN_RELAX_REASON_RING_SEQNO: return "ring seqno"; + case VN_RELAX_REASON_TLS_RING_SEQNO: + return "tls ring seqno"; case VN_RELAX_REASON_RING_SPACE: return "ring space"; case VN_RELAX_REASON_FENCE: @@ -204,6 +206,7 @@ vn_relax_get_profile(enum vn_relax_reason reason) .warn_order = 12, .abort_order = 16, }; + case VN_RELAX_REASON_TLS_RING_SEQNO: case VN_RELAX_REASON_RING_SPACE: case VN_RELAX_REASON_FENCE: case VN_RELAX_REASON_SEMAPHORE: diff --git a/src/virtio/vulkan/vn_common.h b/src/virtio/vulkan/vn_common.h index 320e1853101..2d5f222ab0a 100644 --- a/src/virtio/vulkan/vn_common.h +++ b/src/virtio/vulkan/vn_common.h @@ -206,6 +206,7 @@ struct vn_watchdog { enum vn_relax_reason { VN_RELAX_REASON_RING_SEQNO, + VN_RELAX_REASON_TLS_RING_SEQNO, VN_RELAX_REASON_RING_SPACE, VN_RELAX_REASON_FENCE, VN_RELAX_REASON_SEMAPHORE, diff --git a/src/virtio/vulkan/vn_ring.c b/src/virtio/vulkan/vn_ring.c index fd209dd94b5..198495404a4 100644 --- a/src/virtio/vulkan/vn_ring.c +++ b/src/virtio/vulkan/vn_ring.c @@ -175,8 +175,10 @@ vn_ring_wait_seqno(struct vn_ring *ring, uint32_t seqno) /* A renderer wait incurs several hops and the renderer might poll * repeatedly anyway. Let's just poll here. */ - struct vn_relax_state relax_state = - vn_relax_init(ring->instance, VN_RELAX_REASON_RING_SEQNO); + const enum vn_relax_reason reason = ring == ring->instance->ring.ring + ? VN_RELAX_REASON_RING_SEQNO + : VN_RELAX_REASON_TLS_RING_SEQNO; + struct vn_relax_state relax_state = vn_relax_init(ring->instance, reason); do { if (vn_ring_get_seqno_status(ring, seqno)) { vn_relax_fini(&relax_state);