Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtio device queue_reset polarity to be improved #139

Closed
paravmellanox opened this issue Apr 25, 2022 · 2 comments
Closed

virtio device queue_reset polarity to be improved #139

paravmellanox opened this issue Apr 25, 2022 · 2 comments

Comments

@paravmellanox
Copy link
Contributor

paravmellanox commented Apr 25, 2022

A recently defined queue_reset register has a little weird definition that we should improve.
When driver initiate queue reset, it writes queue_reset = 1.
When device is busy resetting the queue, on this driver request, it is expected to return queue_reset=0.
Once queue reset is completed it is expected to return queue_reset = 1.
(Polarity changed twice to same value as what was driver set). See more below.

So state wise,

q_enable, q_reset represents :

a) 0,0 -> device init time value
b) 1,0 -> vq is enabled by driver and working
c) 1,1 -> vq is enabled, driver initiated reset
d) 0,0 -> queue reset is ongoing
conflicts with #a, because queue is still enabled in device
whose reset is in progress.
External entity has no knowledge if VQ is undergoing reset or
VQ is never enabled.
e) 0,1 -> queue reset is completed (conflicts with #a initial value)

Instead, I think we should have below better, consistent definition, no matter how queue reset occurs (init time or later).

option-1:
q_enable, q_reset
A) 0, 0 -> default, device init time
B) 1, 0 -> driver has enabled vq
C) 1, 1 -> driver started q reset
D) 1, 1 -> q_reset stays 1 until device is busy resetting vq (communicating that its working on resetting, consistent with #C)
E) 0, 0 -> q_reset by device is completed, q got disabled (now matches the state same as device init time #A)

option-2:
When VIRTIO_F_RING_RESET flag is negotiated, writing queue_enable of 0 is allowed. device communicates that queue reset is completed when this bit turns 0 after writing 1.

Both options enable burning another 16-bit PCI register (to communicate one bit) that must be implemented in on-chip memory, because queue reset state is aligned with the queue_enable bit.

secondly,
Due described problem,
when a virtio device register state for queue_eanble = 1 and queue_reset = 0, a hypervisor system, reading device values cannot differentiate if the device VQ is under reset (ongoing reset) or reset never started.
This is because 1,0 state (queue reset ongoing) is same as state #B above.
This bug requires nasty workarounds in driver in the future virtio device live migration flow and certain hardware based devices needs to maintain extra bits to further workaround this.
It isn't elegant to start having workarounds on the specification not yet released. Lets please fix this.

Proposal:
https://lists.oasis-open.org/archives/virtio-comment/202204/msg00119.html

@paravmellanox
Copy link
Contributor Author

secondly,
Due described problem,
when a virtio device register state for queue_eanble = 1 and queue_reset = 0, a hypervisor system, reading device values cannot differentiate if the device VQ is under reset (ongoing reset) or reset never started.
This is because 1,0 state (queue reset ongoing) is same as state #B above.
This bug requires nasty workarounds in driver in the future virtio device live migration flow and certain hardware based devices needs to maintain extra bits to further workaround this.
It isn't elegant to start having workarounds on the specification not yet released. Lets please fix this.

@mstsirkin
Copy link
Contributor

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jun 24, 2022
Added VIRTIO_F_RING_RESET, it came from here

oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

This feature indicates that the driver can reset a queue individually.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jun 24, 2022
Add queue_reset in virtio_pci_common_cfg.

For not breaks uABI, add a new struct virtio_pci_common_cfg_reset.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jun 24, 2022
Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
fengidri added a commit to fengidri/qemu that referenced this issue Jun 29, 2022
oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jul 20, 2022
Added VIRTIO_F_RING_RESET, it came from here

oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

This feature indicates that the driver can reset a queue individually.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jul 20, 2022
Add queue_reset in virtio_pci_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jul 20, 2022
Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jul 26, 2022
Added VIRTIO_F_RING_RESET, it came from here

oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

This feature indicates that the driver can reset a queue individually.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jul 26, 2022
Add queue_reset in virtio_pci_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Jul 26, 2022
Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Aug 1, 2022
Added VIRTIO_F_RING_RESET, it came from here

oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

This feature indicates that the driver can reset a queue individually.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Aug 1, 2022
Add queue_reset in virtio_pci_modern_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Aug 1, 2022
Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 10, 2022
Added VIRTIO_F_RING_RESET, it came from here

oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

This feature indicates that the driver can reset a queue individually.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-28-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 10, 2022
Add queue_reset in virtio_pci_modern_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-30-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 10, 2022
Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-31-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 12, 2022
Added VIRTIO_F_RING_RESET, it came from here

oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

This feature indicates that the driver can reset a queue individually.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-28-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 12, 2022
Add queue_reset in virtio_pci_modern_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-30-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 12, 2022
Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-31-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
middaywords pushed a commit to middaywords/linux that referenced this issue Aug 12, 2022
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they does not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
middaywords pushed a commit to middaywords/linux that referenced this issue Aug 12, 2022
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
middaywords pushed a commit to middaywords/linux that referenced this issue Aug 25, 2022
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
middaywords pushed a commit to middaywords/qemu that referenced this issue Aug 25, 2022
This is updated using scripts/update-linux-headers.sh.

Added VIRTIO_F_RING_RESET, VIRTIO_PCI_COMMON_Q_RESET. It came from here:
oasis-tcs/virtio-spec#124
oasis-tcs/virtio-spec#139

Add VIRTIO_PCI_COMMON_Q_NDATA, which comes from here:
oasis-tcs/virtio-spec#89

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
it-is-a-robot pushed a commit to openeuler-mirror/kernel that referenced this issue Dec 14, 2022
mainline inclusion
from mainline-v6.0-rc1
commit 0b50cec
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b50cece0b7857732d2055f2c77f8730c10f9196

----------------------------------------------------------------------

Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-31-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Pengyuan Zhao <zhaopengyuan@hisilicon.com>
(cherry picked from commit 21ea447)
it-is-a-robot pushed a commit to openeuler-mirror/kernel that referenced this issue Dec 14, 2022
mainline inclusion
from mainline-v6.0-rc1
commit 0cdd450
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0cdd450e70510c9e13af8099e9f6c1467e6a0b91

----------------------------------------------------------------------

Add queue_reset in virtio_pci_modern_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-30-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Pengyuan Zhao <zhaopengyuan@hisilicon.com>
(cherry picked from commit 0a3d24b)
it-is-a-robot pushed a commit to openeuler-mirror/kernel that referenced this issue Dec 14, 2022
mainline inclusion
from mainline-v6.0-rc1
commit 0b50cec
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b50cece0b7857732d2055f2c77f8730c10f9196

----------------------------------------------------------------------

Introduce new helpers to implement queue reset and get queue reset
status.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-31-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Pengyuan Zhao <zhaopengyuan@hisilicon.com>
it-is-a-robot pushed a commit to openeuler-mirror/kernel that referenced this issue Dec 14, 2022
mainline inclusion
from mainline-v6.0-rc1
commit 0cdd450
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0cdd450e70510c9e13af8099e9f6c1467e6a0b91

----------------------------------------------------------------------

Add queue_reset in virtio_pci_modern_common_cfg.

 oasis-tcs/virtio-spec#124
 oasis-tcs/virtio-spec#139

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-30-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Pengyuan Zhao <zhaopengyuan@hisilicon.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Feb 2, 2023
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Message-Id: <20220825085610.80315-1-kangjie.xu@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
staging-kernelci-org pushed a commit to kernelci/linux that referenced this issue Feb 6, 2023
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Message-Id: <20220825085610.80315-1-kangjie.xu@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Feb 14, 2023
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Message-Id: <20220825085610.80315-1-kangjie.xu@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Feb 15, 2023
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Message-Id: <20220825085610.80315-1-kangjie.xu@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
roxell pushed a commit to roxell/linux that referenced this issue Feb 21, 2023
Add VIRTIO_F_RING_RESET, which indicates that the driver can reset a
queue individually.

VIRTIO_F_RING_RESET feature is added to virtio-spec 1.2. The relevant
information is in
    oasis-tcs/virtio-spec#124
    oasis-tcs/virtio-spec#139

The implementation only adds the feature bit in supported features. It
does not require any other changes because we reuse the existing vhost
protocol.

The virtqueue reset process can be concluded as two parts:
1. The driver can reset a virtqueue. When it is triggered, we use the
set_backend to disable the virtqueue.
2. After the virtqueue is disabled, the driver may optionally re-enable
it. The process is basically similar to when the device is started,
except that the restart process does not need to set features and set
mem table since they do not change. QEMU will send messages containing
size, base, addr, kickfd and callfd of the virtqueue in order.
Specifically, the host kernel will receive these messages in order:
    a. VHOST_SET_VRING_NUM
    b. VHOST_SET_VRING_BASE
    c. VHOST_SET_VRING_ADDR
    d. VHOST_SET_VRING_KICK
    e. VHOST_SET_VRING_CALL
    f. VHOST_NET_SET_BACKEND
Finally, after we use set_backend to attach the virtqueue, the virtqueue
will be enabled and start to work.

Signed-off-by: Kangjie Xu <kangjie.xu@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Message-Id: <20220825085610.80315-1-kangjie.xu@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants