This avoids a potential race condition if two threads are competing for
the monitor with the initial states, and the losing one may run into
alive status being false and abort.
Fixes:
4a4b05869a6 ("venus: check and configure new ringMonitoring feature")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reported-by: Lina Versace <lina@kiwitree.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26179>
(cherry picked from commit
8ac7d78bf3512aa7575f9c8595494ea592ab2e58)
"description": "venus: properly initialize ring monitor initial alive status",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "4a4b05869a6ad909417e30d46706ad6038084901",
"notes": null
ring->monitor.report_period_us);
#endif
- if (vn_ring_monitor_acquire(ring)) {
- ring->monitor.alive = true;
+ if (vn_ring_monitor_acquire(ring))
vn_ring_unset_status_bits(ring, VK_RING_STATUS_ALIVE_BIT_MESA);
- }
}
return (struct vn_relax_state){
ring->monitor.report_period_us = 3000000;
mtx_init(&ring->monitor.mutex, mtx_plain);
+ /* ring monitor should be alive at all time */
+ ring->monitor.alive = true;
+
const struct VkRingMonitorInfoMESA monitor_info = {
.sType = VK_STRUCTURE_TYPE_RING_MONITOR_INFO_MESA,
.maxReportingPeriodMicroseconds = ring->monitor.report_period_us,