Commit 71ae046a authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

lib/vhost_blk: remove `packed_ring_recovery` flag



No matter inflight fd is supported or not in QEMU, QEMU
will not restore `last_used_idx` and `last_used_idx`,
so it's always safe for the two cases, here we just remove
this flag.

Fix issue #3070.

Change-Id: I739fe222e98a9e34ee24c3238906c6ff6a3cc44d
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19130


Reviewed-by: default avatarJim Harris <jim.harris@gmail.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 2129d768
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -309,7 +309,6 @@ int spdk_vhost_scsi_dev_remove_tgt(struct spdk_vhost_dev *vdev, unsigned scsi_tg
 * readonly if set, all writes to the device will fail with
 * \c VIRTIO_BLK_S_IOERR error code.
 * packed_ring this controller supports packed ring if set.
 * packed_ring_recovery
 *
 * \return 0 on success, negative errno on error.
 */
+5 −11
Original line number Diff line number Diff line
@@ -1077,18 +1077,12 @@ enable_device_vq(struct spdk_vhost_session *vsession, uint16_t qid)
	}

	if (packed_ring) {
		/* Use the inflight mem to restore the last_avail_idx and last_used_idx.
		 * When the vring format is packed, there is no used_idx in the
		 * used ring, so VM can't resend the used_idx to VHOST when reconnect.
		 * QEMU version 5.2.0 supports the packed inflight before that it only
		 * supports split ring inflight because it doesn't send negotiated features
		 * before get inflight fd. Users can use RPC to enable this function.
		/* Since packed ring flag is already negociated between SPDK and VM, VM doesn't
		 * restore `last_avail_idx` and `last_used_idx` for packed ring, so use the
		 * inflight mem to restore the `last_avail_idx` and `last_used_idx`.
		 */
		if (spdk_unlikely(vsession->vdev->packed_ring_recovery)) {
			rte_vhost_get_vring_base_from_inflight(vsession->vid, qid,
							       &q->last_avail_idx,
		rte_vhost_get_vring_base_from_inflight(vsession->vid, qid, &q->last_avail_idx,
						       &q->last_used_idx);
		}

		/* Packed virtqueues support up to 2^15 entries each
		 * so left one bit can be used as wrap counter.
+0 −5
Original line number Diff line number Diff line
@@ -1776,13 +1776,11 @@ vhost_user_blk_destroy(struct spdk_virtio_blk_transport *transport,
struct rpc_vhost_blk {
	bool readonly;
	bool packed_ring;
	bool packed_ring_recovery;
};

static const struct spdk_json_object_decoder rpc_construct_vhost_blk[] = {
	{"readonly", offsetof(struct rpc_vhost_blk, readonly), spdk_json_decode_bool, true},
	{"packed_ring", offsetof(struct rpc_vhost_blk, packed_ring), spdk_json_decode_bool, true},
	{"packed_ring_recovery", offsetof(struct rpc_vhost_blk, packed_ring_recovery), spdk_json_decode_bool, true},
};

static int
@@ -1801,11 +1799,8 @@ vhost_user_blk_create_ctrlr(struct spdk_vhost_dev *vdev, struct spdk_cpuset *cpu
		return -EINVAL;
	}

	vdev->packed_ring_recovery = false;

	if (req.packed_ring) {
		vdev->virtio_features |= (uint64_t)req.packed_ring << VIRTIO_F_RING_PACKED;
		vdev->packed_ring_recovery = req.packed_ring_recovery;
	}
	if (req.readonly) {
		vdev->virtio_features |= (1ULL << VIRTIO_BLK_F_RO);
+0 −1
Original line number Diff line number Diff line
@@ -177,7 +177,6 @@ struct spdk_vhost_dev {
	uint64_t virtio_features;
	uint64_t disabled_features;
	uint64_t protocol_features;
	bool packed_ring_recovery;

	const struct spdk_vhost_dev_backend *backend;

+0 −1
Original line number Diff line number Diff line
@@ -99,7 +99,6 @@ def vhost_create_blk_controller(client, **params):
        transport: virtio blk transport name (default: vhost_user_blk)
        readonly: set controller as read-only
        packed_ring: support controller packed_ring
        packed_ring_recovery: enable packed ring live recovery
    """
    strip_globals(params)
    remove_null(params)
Loading