[bug report] drm/amdgpu/mes: ring aggregatged doorbell when mes queue is unmapped
Dan Carpenter
dan.carpenter at oracle.com
Thu Jul 14 11:53:26 UTC 2022
Hello Le Ma,
The patch 5fdbff096edb: "drm/amdgpu/mes: ring aggregatged doorbell
when mes queue is unmapped" from Oct 30, 2020, leads to the following
unpublished Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:8552 gfx_v10_0_ring_set_wptr_gfx()
warn: duplicate check '*is_queue_unmap' (previous on line 8546)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
8525 static void gfx_v10_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)
8526 {
8527 struct amdgpu_device *adev = ring->adev;
8528 uint32_t *wptr_saved;
8529 uint32_t *is_queue_unmap;
8530 uint64_t aggregated_db_index;
8531 uint32_t mqd_size = adev->mqds[AMDGPU_HW_IP_GFX].mqd_size;
8532 uint64_t wptr_tmp;
8533
8534 if (ring->is_mes_queue) {
8535 wptr_saved = (uint32_t *)(ring->mqd_ptr + mqd_size);
8536 is_queue_unmap = (uint32_t *)(ring->mqd_ptr + mqd_size +
8537 sizeof(uint32_t));
8538 aggregated_db_index =
8539 amdgpu_mes_get_aggregated_doorbell_index(adev,
8540 AMDGPU_MES_PRIORITY_LEVEL_NORMAL);
8541
8542 wptr_tmp = ring->wptr & ring->buf_mask;
8543 atomic64_set((atomic64_t *)ring->wptr_cpu_addr, wptr_tmp);
8544 *wptr_saved = wptr_tmp;
8545 /* assume doorbell always being used by mes mapped queue */
8546 if (*is_queue_unmap) {
^^^^^^^^^^^^^^^
Checked
8547 WDOORBELL64(aggregated_db_index, wptr_tmp);
8548 WDOORBELL64(ring->doorbell_index, wptr_tmp);
8549 } else {
8550 WDOORBELL64(ring->doorbell_index, wptr_tmp);
8551
--> 8552 if (*is_queue_unmap)
^^^^^^^^^^^^^^^
It's possible this is changed inside a function, but it looks suspicious.
8553 WDOORBELL64(aggregated_db_index, wptr_tmp);
8554 }
8555 } else {
8556 if (ring->use_doorbell) {
8557 /* XXX check if swapping is necessary on BE */
8558 atomic64_set((atomic64_t *)ring->wptr_cpu_addr,
8559 ring->wptr);
8560 WDOORBELL64(ring->doorbell_index, ring->wptr);
8561 } else {
8562 WREG32_SOC15(GC, 0, mmCP_RB0_WPTR,
8563 lower_32_bits(ring->wptr));
8564 WREG32_SOC15(GC, 0, mmCP_RB0_WPTR_HI,
8565 upper_32_bits(ring->wptr));
8566 }
8567 }
8568 }
regards,
dan carpenter
More information about the amd-gfx
mailing list