vhost: always acknowledge kickfd in intr
kickfd of virtvq should be akcnowledged firstly in vhost_vq_avail_ring_get function, in case there is no available requests then kickfd won't get acked. Change-Id: I9c2f0cc19be9da54649991ddab5a5b5640ed941a Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5780 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
f8330a575e
commit
fce2956c24
@ -183,9 +183,26 @@ vhost_vq_avail_ring_get(struct spdk_vhost_virtqueue *virtqueue, uint16_t *reqs,
|
||||
uint16_t size_mask = vring->size - 1;
|
||||
uint16_t last_idx = virtqueue->last_avail_idx, avail_idx = avail->idx;
|
||||
uint16_t count, i;
|
||||
int rc;
|
||||
uint64_t num_events;
|
||||
|
||||
spdk_smp_rmb();
|
||||
|
||||
if (virtqueue->vsession && spdk_unlikely(virtqueue->vsession->interrupt_mode)) {
|
||||
/* Acknowledge vring's kickfd */
|
||||
rc = read(vring->kickfd, &num_events, sizeof(num_events));
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("failed to acknowledge kickfd: %s.\n", spdk_strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if ((uint16_t)(avail_idx - last_idx) != num_events) {
|
||||
SPDK_DEBUGLOG(vhost_ring,
|
||||
"virtqueue gets %d reqs, but kickfd shows %lu reqs\n",
|
||||
avail_idx - last_idx, num_events);
|
||||
}
|
||||
}
|
||||
|
||||
count = avail_idx - last_idx;
|
||||
if (spdk_likely(count == 0)) {
|
||||
return 0;
|
||||
@ -199,25 +216,7 @@ vhost_vq_avail_ring_get(struct spdk_vhost_virtqueue *virtqueue, uint16_t *reqs,
|
||||
}
|
||||
|
||||
count = spdk_min(count, reqs_len);
|
||||
if (virtqueue->vsession && virtqueue->vsession->interrupt_mode) {
|
||||
/* if completed IO number is larger than SPDK_AIO_QUEUE_DEPTH,
|
||||
* io_getevent should be called again to ensure all completed IO are processed.
|
||||
*/
|
||||
int rc;
|
||||
uint64_t num_events;
|
||||
|
||||
rc = read(vring->kickfd, &num_events, sizeof(num_events));
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("failed to acknowledge kickfd: %s.\n", spdk_strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if ((uint16_t)(avail_idx - last_idx) != num_events) {
|
||||
SPDK_DEBUGLOG(vhost_ring,
|
||||
"virtqueue gets %d reqs, but kickfd shows %lu reqs\n",
|
||||
avail_idx - last_idx, num_events);
|
||||
}
|
||||
|
||||
if (virtqueue->vsession && spdk_unlikely(virtqueue->vsession->interrupt_mode)) {
|
||||
if (num_events > count) {
|
||||
SPDK_DEBUGLOG(vhost_ring,
|
||||
"virtqueue kickfd shows %lu reqs, take %d, send notice for other reqs\n",
|
||||
|
Loading…
Reference in New Issue
Block a user