From: Stefan Hajnoczi <stefanha@gmail.com>
To: Asias He <asias@redhat.com>
Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
target-devel@vger.kernel.org,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V3 WIP 2/3] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Date: Tue, 19 Mar 2013 09:40:16 +0100 [thread overview]
Message-ID: <20130319084016.GA24393@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1363653285-23776-3-git-send-email-asias@redhat.com>
On Tue, Mar 19, 2013 at 08:34:44AM +0800, Asias He wrote:
> +static void vhost_scsi_stop(VHostSCSI *vs, VirtIODevice *vdev)
> +{
> + int ret = 0;
> +
> + if (!vdev->binding->set_guest_notifiers) {
> + ret = vdev->binding->set_guest_notifiers(vdev->binding_opaque,
> + vs->dev.nvqs, false);
> + if (ret < 0) {
> + error_report("vhost guest notifier cleanup failed: %d\n", ret);
Indentation. scripts/checkpatch.pl should catch this.
> + }
> + }
> + assert(ret >= 0);
> +
> + vhost_scsi_clear_endpoint(vdev);
> + vhost_dev_stop(&vs->dev, vdev);
> + vhost_dev_disable_notifiers(&vs->dev, vdev);
> +}
> +
> +static void vhost_scsi_set_config(VirtIODevice *vdev,
> + const uint8_t *config)
> +{
> + VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config;
> + VHostSCSI *vs = (VHostSCSI *)vdev;
> +
> + if ((uint32_t) ldl_raw(&scsiconf->sense_size) != vs->vs.sense_size ||
> + (uint32_t) ldl_raw(&scsiconf->cdb_size) != vs->vs.cdb_size) {
> + error_report("vhost-scsi does not support changing the sense data and CDB sizes");
> + exit(1);
Guest-triggerable exits can be used as a denial of service - especially
under nested virtualization where killing the L1 hypervisor would kill
all L2 guests!
I would just log a warning here.
> + }
> +}
> +
> +static void vhost_scsi_set_status(VirtIODevice *vdev, uint8_t val)
> +{
> + VHostSCSI *vs = (VHostSCSI *)vdev;
> + bool start = (val & VIRTIO_CONFIG_S_DRIVER_OK);
> +
> + if (vs->dev.started == start) {
> + return;
> + }
> +
> + if (start) {
> + int ret;
> +
> + ret = vhost_scsi_start(vs, vdev);
> + if (ret < 0) {
> + error_report("virtio-scsi: unable to start vhost: %s\n",
> + strerror(-ret));
> +
> + /* There is no userspace virtio-scsi fallback so exit */
> + exit(1);
It's questionable whether to kill the guest or simply disable this
virtio-scsi-pci adapter. Fine for now but we may want to allow a policy
here in the future.
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 39c1966..281a7e2 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -22,6 +22,7 @@
> #include "hw/virtio-net.h"
> #include "hw/virtio-serial.h"
> #include "hw/virtio-scsi.h"
> +#include "hw/vhost-scsi.h"
Can this header be included unconditionally? It uses _IOW() which may
not be available on all host platforms.
next prev parent reply other threads:[~2013-03-19 8:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 0:34 [Qemu-devel] [PATCH V3 WIP 0/3] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Asias He
2013-03-19 0:34 ` [Qemu-devel] [PATCH V3 WIP 1/3] virtio-scsi: create VirtIOSCSICommon Asias He
2013-03-19 0:34 ` [Qemu-devel] [PATCH V3 WIP 2/3] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Asias He
2013-03-19 8:40 ` Stefan Hajnoczi [this message]
2013-03-19 0:34 ` [Qemu-devel] [PATCH V3 WIP 3/3] disable vhost_verify_ring_mappings check Asias He
2013-03-19 8:40 ` Stefan Hajnoczi
2013-03-19 8:47 ` Asias He
2013-03-20 1:57 ` Nicholas A. Bellinger
2013-03-20 9:51 ` Michael S. Tsirkin
2013-03-27 21:31 ` Nicholas A. Bellinger
2013-03-27 21:56 ` Michael S. Tsirkin
2013-03-27 22:33 ` Nicholas A. Bellinger
2013-03-28 6:45 ` Nicholas A. Bellinger
2013-03-28 7:35 ` Nicholas A. Bellinger
2013-03-28 9:04 ` Michael S. Tsirkin
2013-03-28 10:03 ` Paolo Bonzini
2013-03-29 2:47 ` Nicholas A. Bellinger
2013-03-28 10:13 ` Paolo Bonzini
2013-03-29 2:53 ` Nicholas A. Bellinger
2013-03-29 8:14 ` Paolo Bonzini
2013-04-02 1:05 ` Nicholas A. Bellinger
2013-04-02 13:27 ` Michael S. Tsirkin
2013-04-03 4:04 ` Nicholas A. Bellinger
2013-04-03 4:59 ` Nicholas A. Bellinger
2013-04-03 6:47 ` Paolo Bonzini
2013-03-29 3:28 ` Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130319084016.GA24393@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=asias@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=target-devel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).