linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/25] virtio: fix spec compliance issues
@ 2014-10-13  7:48 Michael S. Tsirkin
  2014-10-13  7:48 ` [PATCH v4 01/25] virtio_pci: fix virtio spec compliance on restore Michael S. Tsirkin
                   ` (24 more replies)
  0 siblings, 25 replies; 43+ messages in thread
From: Michael S. Tsirkin @ 2014-10-13  7:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rusty Russell, virtualization, linux-scsi, linux-s390,
	v9fs-developer, netdev, kvm, Amit Shah, Cornelia Huck,
	Christian Borntraeger, David S. Miller, Paolo Bonzini

Changes from v4:
	rename virtio_enable_vqs_early() to virtio_device_ready()
Note: Rusty requested we add a BUG_ON in the virtio_ring code.
	This can be done by a separate patch on top.
	Good for bisectability in case BUG_ON starts triggering :)

Rusty, please review this, and consider for this merge window.

This fixes the following virtio spec compliance issues:
1. on restore, drivers use device before setting ACKNOWLEDGE and DRIVER bits
2. on probe, drivers aren't prepared to handle config interrupts
   arriving before probe returns
3. on probe, drivers use device before DRIVER_OK it set

Note that 1 is a clear violation of virtio spec 0.9 and 1.0,
so I am proposing the fix for stable. OTOH 2 is against 1.0 rules but
is a known documented bug in many drivers, so let's fix it going
forward, but it does not seem to be worth it to backport
the changes.

An error handling bugfix for virtio-net and a fix for a
theoretical race condition in virtio scsi is also included.

2 is merely a theoretical race condition, but it seems important
to address to make sure that changes to address 3 do not introduce
instability.

I also included patch to drop scan callback use from virtio
scsi: using this callback creates asymmetry between probe
and resume, and we actually had to add code comments so
people can figure out the flow. Code flow becomes clearer
with the new API.

After this change, the only user of the scan callback is virtio rng.
It's possible to modify it trivially and then drop scan callback
from core, but I'm rather inclined to look at ways to
make some rng core changes so that we don't need to
have so many variables tracking device state.
So this is deferred for now.

Michael S. Tsirkin (24):
  virtio_pci: fix virtio spec compliance on restore
  virtio: unify config_changed handling
  virtio-pci: move freeze/restore to virtio core
  virtio: defer config changed notifications
  virtio_blk: drop config_enable
  virtio-blk: drop config_mutex
  virtio_net: drop config_enable
  virtio-net: drop config_mutex
  virtio_net: minor cleanup
  virtio: add API to enable VQs early
  virtio_net: enable VQs early
  virtio_blk: enable VQs early
  virtio_console: enable VQs early
  9p/trans_virtio: enable VQs early
  virtio_net: fix use after free on allocation failure
  virtio_scsi: move kick event out from virtscsi_init
  virtio_blk: enable VQs early on restore
  virtio_scsi: enable VQs early on restore
  virtio_console: enable VQs early on restore
  virtio_net: enable VQs early on restore
  virtio_scsi: fix race on device removal
  virtio_balloon: enable VQs early on restore
  virtio_scsi: drop scan callback
  virtio-rng: refactor probe error handling

Paolo Bonzini (1):
  virito_scsi: use freezable WQ for events

 include/linux/virtio.h              |  14 +++++
 include/linux/virtio_config.h       |  17 ++++++
 drivers/block/virtio_blk.c          |  40 ++++----------
 drivers/char/hw_random/virtio-rng.c |  15 +++---
 drivers/char/virtio_console.c       |   4 ++
 drivers/misc/mic/card/mic_virtio.c  |   6 +--
 drivers/net/virtio_net.c            |  44 +++++-----------
 drivers/s390/kvm/kvm_virtio.c       |   9 +---
 drivers/s390/kvm/virtio_ccw.c       |   6 +--
 drivers/scsi/virtio_scsi.c          |  42 +++++++++------
 drivers/virtio/virtio.c             | 102 ++++++++++++++++++++++++++++++++++++
 drivers/virtio/virtio_balloon.c     |   2 +
 drivers/virtio/virtio_mmio.c        |   7 +--
 drivers/virtio/virtio_pci.c         |  33 ++----------
 net/9p/trans_virtio.c               |   2 +
 15 files changed, 206 insertions(+), 137 deletions(-)

-- 
MST



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

end of thread, other threads:[~2014-11-11  6:15 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13  7:48 [PATCH v4 00/25] virtio: fix spec compliance issues Michael S. Tsirkin
2014-10-13  7:48 ` [PATCH v4 01/25] virtio_pci: fix virtio spec compliance on restore Michael S. Tsirkin
2014-10-13  7:48 ` [PATCH v4 02/25] virtio: unify config_changed handling Michael S. Tsirkin
2014-10-13  7:48 ` [PATCH v4 03/25] virtio-pci: move freeze/restore to virtio core Michael S. Tsirkin
2014-10-15  7:05   ` Paul Bolle
2014-10-13  7:50 ` [PATCH v4 04/25] virtio: defer config changed notifications Michael S. Tsirkin
2014-10-14  0:31   ` Rusty Russell
2014-10-14  8:59     ` Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 05/25] virtio_blk: drop config_enable Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 06/25] virtio-blk: drop config_mutex Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 07/25] virtio_net: drop config_enable Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 08/25] virtio-net: drop config_mutex Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 09/25] virtio_net: minor cleanup Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 10/25] virtio: add API to enable VQs early Michael S. Tsirkin
2014-11-11  0:45   ` Andy Grover
2014-11-11  6:15     ` Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 11/25] virtio_net: " Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 12/25] virtio_blk: " Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 13/25] virtio_console: " Michael S. Tsirkin
2014-10-20 12:07   ` Thomas Graf
2014-10-20 12:42     ` Cornelia Huck
2014-10-20 13:10       ` Thomas Graf
2014-10-20 13:35       ` Michael S. Tsirkin
2014-10-20 13:58         ` [PATCH] virtio_console: move early VQ enablement Cornelia Huck
2014-10-20 14:05           ` Michael S. Tsirkin
2014-10-20 17:09             ` Josh Boyer
2014-11-11  2:24               ` Dave Airlie
2014-10-20 14:04         ` [PATCH v4 13/25] virtio_console: enable VQs early Michael S. Tsirkin
2014-10-20 13:10     ` Michael S. Tsirkin
2014-10-20 13:12       ` Thomas Graf
2014-10-20 13:14       ` Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 14/25] 9p/trans_virtio: " Michael S. Tsirkin
2014-10-13  7:50 ` [PATCH v4 15/25] virtio_net: fix use after free on allocation failure Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 16/25] virtio_scsi: move kick event out from virtscsi_init Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 17/25] virtio_blk: enable VQs early on restore Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 18/25] virtio_scsi: " Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 19/25] virtio_console: " Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 20/25] virtio_net: " Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 21/25] virito_scsi: use freezable WQ for events Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 22/25] virtio_scsi: fix race on device removal Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 23/25] virtio_balloon: enable VQs early on restore Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 24/25] virtio_scsi: drop scan callback Michael S. Tsirkin
2014-10-13  7:51 ` [PATCH v4 25/25] virtio-rng: refactor probe error handling Michael S. Tsirkin

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).