qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: famz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 0/2] hw/scsi: support SCSI-2 passthrough without PI
Date: Thu, 5 Apr 2018 20:10:27 -0300	[thread overview]
Message-ID: <5a3d6ece-e68b-5eae-3808-510c4eed4d68@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180405162347.5623-1-pbonzini@redhat.com>

Hi,


On 04/05/2018 01:23 PM, Paolo Bonzini wrote:
> This is my version of Daniel's patch.  In order to keep the
> RD/WRPROTECT check for emulated SCSI disks, I've added a new property
> to scsi-disk/hd/cd devices as well.  The property, similar to the
> earlier versions posted by Daniel, is available to the user, but for
> scsi-disk/hd/cd it affects the INQUIRY value returned by the emulated
> INQUIRY command.
>
> Daniel, can you please test it?

Emulated case worked as intended: I was able to set the scsi_version of 
the emulated device via command line.

One thing I noticed is that I am also able to set the scsi_version of 
scsi-block devices - if I set scsi_version=6 in a SCSI passthrough 
device that has version=2, the version that ends up being passed to the 
guest is 6. In a quick look I believe that this behavior is caused by 
setting

+    s->qdev.scsi_version = s->qdev.default_scsi_version;

in scsi_disk_reset, which is the reset function that is also used for 
scsi-block devices. So, setting scsi_version=6 in the command line 
overwrites the default_scsi_version = -1 that is being set in patch 2, 
making scsi_version =! -1 and bypassing the scsi_version assignment code.

A quick fix is to get rid of the scsi_version == -1 restriction to set 
the scsi_version. This is something that Fam proposed in one of the 
reviews. Given that a well behaved guest will not spam INQUIRY messages 
(causing the code to always recalculate the same version again), I am 
fine with it.

Another quick fix is to make a new scsi_block_reset function that calls 
scsi_disk_reset and  sets s->scsi_version = -1 right after.

Yet another fix is to fully prohibit the user to set scsi_version 
scsi-block and scsi-generic cases, returning an error message right off 
the start. Not sure how hard this would be - perhaps the above 
alternatives are cleaner.

Another fix is ... no fix. I am not sure how far the design philosophy 
of passthrough devices allows the user to overwrite device parameters in 
despite of their real values, but ....  what if the user wants to 
enforce a scsi_version when using a scsi-block device? The device will 
surely behave badly, but the user explicitly enforced it via command 
line, so perhaps let him/her have at it?


Thanks,


Daniel




>
> Thanks,
>
> Paolo
>
> Daniel Henrique Barboza (1):
>    hw/scsi: support SCSI-2 passthrough without PI
>
> Paolo Bonzini (1):
>    scsi-disk: allow customizing the SCSI version
>
>   hw/scsi/scsi-disk.c    | 29 ++++++++++++++++++++++++-----
>   hw/scsi/scsi-generic.c | 48 +++++++++++++++++++++++++++++++++++++-----------
>   include/hw/scsi/scsi.h |  2 ++
>   3 files changed, 63 insertions(+), 16 deletions(-)
>

  parent reply	other threads:[~2018-04-05 23:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 16:23 [Qemu-devel] [PATCH v4 0/2] hw/scsi: support SCSI-2 passthrough without PI Paolo Bonzini
2018-04-05 16:23 ` [Qemu-devel] [PATCH 1/2] scsi-disk: allow customizing the SCSI version Paolo Bonzini
2018-04-05 22:49   ` Daniel Henrique Barboza
2018-04-05 16:23 ` [Qemu-devel] [PATCH 2/2] hw/scsi: support SCSI-2 passthrough without PI Paolo Bonzini
2018-04-05 23:10 ` Daniel Henrique Barboza [this message]
2018-04-06 10:12   ` [Qemu-devel] [PATCH v4 0/2] " Paolo Bonzini
2018-04-06 12:06     ` Daniel Henrique Barboza

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=5a3d6ece-e68b-5eae-3808-510c4eed4d68@linux.vnet.ibm.com \
    --to=danielhb@linux.vnet.ibm.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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).