qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR
@ 2023-07-04  3:34 Hawkins Jiawei
  2023-07-04  3:34 ` [PATCH v3 1/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac() Hawkins Jiawei
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Hawkins Jiawei @ 2023-07-04  3:34 UTC (permalink / raw)
  To: jasowang, mst, eperezma; +Cc: qemu-stable, qemu-devel, yin31149, 18801353760

According to VirtIO standard, "The class, command and
command-specific-data are set by the driver,
and the device sets the ack byte.
There is little it can do except issue a diagnostic
if ack is not VIRTIO_NET_OK."

Therefore, QEMU should stop sending the queued SVQ commands and
cancel the device startup if the device's ack is not VIRTIO_NET_OK.

Yet the problem is that, vhost_vdpa_net_load_x() returns 1 based on
`*s->status != VIRTIO_NET_OK` when the device's ack is VIRTIO_NET_ERR.
As a result, net->nc->info->load() also returns 1, this makes
vhost_net_start_one() incorrectly assume the device state is
successfully loaded by vhost_vdpa_net_load() and return 0, instead of
goto `fail` label to cancel the device startup, as vhost_net_start_one()
only cancels the device startup when net->nc->info->load() returns a
negative value.

This patchset fixes this problem by returning -EIO when the device's
ack is not VIRTIO_NET_OK.

Changelog
=========
v3:
 - split the fixes suggested by Eugenio
 - return -EIO suggested by Michael

v2: https://lore.kernel.org/all/69010e9ebb5e3729aef595ed92840f43e48e53e5.1687875592.git.yin31149@gmail.com/
 - fix the same bug in vhost_vdpa_net_load_offloads()

v1: https://lore.kernel.org/all/cover.1686746406.git.yin31149@gmail.com/

Hawkins Jiawei (3):
  vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac()
  vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq()
  vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_offloads()

 net/vhost-vdpa.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-05  9:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04  3:34 [PATCH v3 0/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR Hawkins Jiawei
2023-07-04  3:34 ` [PATCH v3 1/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac() Hawkins Jiawei
2023-07-04  3:34 ` [PATCH v3 2/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq() Hawkins Jiawei
2023-07-04  3:34 ` [PATCH v3 3/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_offloads() Hawkins Jiawei
2023-07-05  7:59 ` [PATCH v3 0/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR Lei Yang
2023-07-05 11:03   ` Hawkins Jiawei
2023-07-06 11:03     ` Lei Yang
2023-08-05  6:15 ` Michael Tokarev
2023-08-05  9:28   ` Hawkins Jiawei
2023-08-05  9:53     ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).