lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150311095814-mutt-send-email-mst@redhat.com>
Date:	Wed, 11 Mar 2015 10:06:13 +0100
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	Fam Zheng <famz@...hat.com>
Cc:	linux-kernel@...r.kernel.org,
	Rusty Russell <rusty@...tcorp.com.au>,
	virtualization@...ts.linux-foundation.org,
	Paolo Bonzini <pbonzini@...hat.com>,
	Jason Wang <jasowang@...hat.com>
Subject: Re: [PATCH] virtio: Remove virtio device during shutdown

On Wed, Mar 11, 2015 at 04:09:17PM +0800, Fam Zheng wrote:
> Currently shutdown is nop for virtio devices, but the core code could
> remove things behind us such as MSI-X handler etc. For example in the
> case of virtio-scsi-pci, the device may still try to send interupts,
> which will be on IRQ lines seeing MSI-X disabled. Those interrupts will
> be unhandled, and may cause flood.

This sounds very tentative. Do you, in fact, observe some problems
with virtio scsi? How to reproduce them? this needs to go
into the commit messages.

> Remove the device in "shutdown" callback to allow device drivers clean
> up things.
> 
> Signed-off-by: Fam Zheng <famz@...hat.com>

I'm concerned this will cause more hangs on shutdown: one
of the reasons for reboot is device mal-functioning.
How about we just reset devices instead? Something like
the below (untested).

Signed-off-by: Michael S. Tsirkin <mst@...hat.com>

diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 5ce2aa4..0769941 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -269,6 +269,17 @@ static int virtio_dev_remove(struct device *_d)
 	return 0;
 }
 
+static void virtio_dev_shutdown(struct device *_d)
+{
+	struct virtio_device *dev = dev_to_virtio(_d);
+	/*
+	 * Reset the device to make it stop sending interrupts, DMA, etc.
+	 * We are shutting down, no need for full cleanup.
+	 */
+	dev->config->reset(dev);
+
+}
+
 static struct bus_type virtio_bus = {
 	.name  = "virtio",
 	.match = virtio_dev_match,
@@ -276,6 +288,7 @@ static struct bus_type virtio_bus = {
 	.uevent = virtio_uevent,
 	.probe = virtio_dev_probe,
 	.remove = virtio_dev_remove,
+	.shutdown = virtio_dev_shutdown,
 };
 
 bool virtio_device_is_legacy_only(struct virtio_device_id id)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ