Skip to contentSkip to conversation

vdpa/ifc: improve device stop logic for block device

PATCH Applied Andy Pei 2 participants 3 messages Dec 13, 2022 – Feb 3, 2023 virtio core

lore
Share & tools
lore

Andy Pei

author
#0 lore raw

PATCH 1/1 vdpa/ifc: improve device stop logic for block device

For block device, we make sure no IO is inflight before we stop device. We terminate the notify relay process and wait for all inflight IOs to be completed. So in this period, we wait for hardware to update used index, there is no need to relay new kick.

---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -5
index 49d68ad..0822f47 100644
@@ -367,11 +367,7 @@ struct rte_vdpa_dev_info {
 					(u16)(ring_state & IFCVF_16_BIT_MASK);
 				hw->vring[i].last_used_idx =
 					(u16)(ring_state >> 16);
-				if (hw->vring[i].last_avail_idx !=
-					hw->vring[i].last_used_idx) {
-					ifcvf_notify_queue(hw, i);
-					usleep(10);
-				}
+				usleep(10);
 			} while (hw->vring[i].last_avail_idx !=
 				hw->vring[i].last_used_idx);
 		}
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Andy Pei

For block device, we make sure no IO is inflight before we stop device. We terminate the notify relay process and wait for all inflight IOs to be completed. So in this period, we wait for hardware to update used index, there is no need to relay new kick.

---
  drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/vdpa/ifc/ifcvf_vdpa.c +0 -0
index 49d68ad..0822f47 100644
@@ -367,11 +367,7 @@ struct rte_vdpa_dev_info {
  					(u16)(ring_state & IFCVF_16_BIT_MASK);
  				hw->vring[i].last_used_idx =

drivers/vdpa/ifc/ifcvf_vdpa.c struct rte_vdpa_dev_info { · line 373

Quoted 10 lines
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -5
  					(u16)(ring_state >> 16);
-				if (hw->vring[i].last_avail_idx !=
-					hw->vring[i].last_used_idx) {
-					ifcvf_notify_queue(hw, i);
-					usleep(10);
-				}
+				usleep(10);
  			} while (hw->vring[i].last_avail_idx !=
  				hw->vring[i].last_used_idx);
  		}

Thanks,
Maxime

#2 lore raw
In reply to Andy Pei
Quoted 11 lines · Andy Pei

For block device, we make sure no IO is inflight before we stop device. We terminate the notify relay process and wait for all inflight IOs to be completed. So in this period, we wait for hardware to update used index, there is no need to relay new kick.

---
  drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)

Applied to dpdk-next-virtio/main.

Thanks,
Maxime