public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sitsofe Wheeler <sitsofe@gmail.com>
To: KY Srinivasan <kys@microsoft.com>
Cc: Jeff Leung <jleung@v10networks.ca>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Christoph Hellwig <hch@infradead.org>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>
Subject: Re: [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks
Date: Tue, 21 Oct 2014 05:45:50 +0100	[thread overview]
Message-ID: <20141021044550.GC11691@sucs.org> (raw)
In-Reply-To: <da5106ddc725481784ed12bccb594980@BY2PR0301MB0711.namprd03.prod.outlook.com>

On Sun, Oct 12, 2014 at 01:21:01AM +0000, KY Srinivasan wrote:
> 
> > -----Original Message-----
> > From: Jeff Leung [mailto:jleung@v10networks.ca]
> > Sent: Saturday, October 11, 2014 1:22 PM
> > 
> > > On the current release of Windows (windows 10), we are advertising
> > > SPC3 compliance.
> > > We are ok with declaring compliance to SPC3 in our drivers.
> > If you are going to declare SPC3 compliance in the drivers, are you going to
> > put in checks to ensure that SPC-3 compliance doesn't get accidentally
> > enabled for hypervisors below Win10?
> > 
> > I do know for a fact that Ubuntu's kernels already force SPC3 compliance to
> > enable specific features such as TRIM on earlier versions of Hyper-V (Namely
> > Hyper-V 2012 and 2012 R2).
> You are right; Ubuntu has been carrying a patch  that was doing just
> this and this has been working without any issues on many earlier
> versions of Windows. (2012 and 2012 R2).  On windows 10 we don't need
> any changes in the Linux driver as the host itself is advertising SPC3
> compliance. Based on the testing we have done with Ubuntu, we are
> comfortable picking up that patch.

OK this seems to be the patch currently carried by Ubuntu:

>From ff2c5fa3fa9adf0b919b9425e71a8ba044c31a7d Mon Sep 17 00:00:00 2001
From: Andy Whitcroft <apw@canonical.com>
Date: Fri, 13 Sep 2013 17:49:16 +0100
Subject: [PATCH] scsi: hyper-v storsvc switch up to SPC-3

Suggested-By: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/scsi/storvsc_drv.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 9969fa1..3903c8a 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1441,6 +1441,14 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
 
 	sdevice->no_write_same = 1;
 
+	/*
+	 * hyper-v lies about its capabilities indicating it is only SPC-2
+	 * compliant, but actually implements the core SPC-3 features.
+	 * If we pretend to be SPC-3, we send RC16 which activates trim and
+	 * will query the appropriate VPD pages to enable trim.
+	 */
+	sdevice->scsi_level = SCSI_SPC_3;
+
 	return 0;
 }
 
-- 
1.7.9.5

(Downloaded from
http://kernel.ubuntu.com/git?p=jsalisbury/stable/trusty/ubuntu-trusty.git;a=patch;h=ff2c5fa3fa9adf0b919b9425e71a8ba044c31a7d
).

I think it's unwise to override the scsi_level at this particular point
because you are going to do it for ALL Hyper-V "disks" (perhaps all
Hyper-V SCSI devices?)...

Here's the SCSI inquiry information reported by a USB 2 hard disk being
passed passed-through by one of my 2012 R2 hosts:

# sg_inq /dev/sdc
standard INQUIRY:
  PQual=0  Device_type=0  RMB=0  version=0x02  [SCSI-2]
  [AERC=0]  [TrmTsk=0]  NormACA=0  HiSUP=0  Resp_data_format=1
  SCCS=0  ACC=0  TPGS=0  3PC=0  Protect=0  [BQue=0]
  EncServ=0  MultiP=0  [MChngr=0]  [ACKREQQ=0]  Addr16=0
  [RelAdr=0]  WBus16=0  Sync=0  Linked=0  [TranDis=0]  CmdQue=0
    length=36 (0x24)   Peripheral device type: disk
 Vendor identification: MDT MD50
 Product identification: 00AAKS-00TMA0   
 Product revision level: 

Is it OK to replace a scsi_level of SCSI-2 with SCSI_SPC_3? Additionally
is it also OK to force SCSI_SPC_3 on Hyper-V 2008?

> > > NryزXvؖ){nlj{zX\x17}zj:v zZzf~zwڢ)^[jyA
> > >
> > > \x0fi
> N?????r??y????b?X??ǧv?^?)޺{.n?+????{????zX??\x17??ܨ}???Ơz?&j:+v???\a????zZ+??+zf???h???~????i???z?\x1e?w?????????&?)ߢ^[f??^jǫy?m??@A?a??\x7f?\f0??h?\x0f??i\x7f

^^^ Where do these characters come from? I've occasionally seen them on
emails from other Microsoft folks posting to LKML too...

-- 
Sitsofe | http://sucs.org/~sits/

  reply	other threads:[~2014-10-21  4:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10  7:49 [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks Sitsofe Wheeler
2014-10-10  7:51 ` [PATCH 1/3] Revert "Drivers: add blist flags" Sitsofe Wheeler
2014-10-10  7:52 ` [PATCH 2/3] scsi: add try_rc16 blacklist flag Sitsofe Wheeler
2014-10-15  1:08   ` Martin K. Petersen
2014-10-15  2:07     ` KY Srinivasan
2014-10-21  4:21     ` Sitsofe Wheeler
2014-10-23  1:46       ` Martin K. Petersen
2014-10-10  7:55 ` [PATCH 3/3] scsi: Use try_rc16 and try_vpd_pages quirks on Hyper-V virtual disks Sitsofe Wheeler
2014-10-11 17:39 ` [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks Christoph Hellwig
2014-10-11 17:41   ` James Bottomley
2014-10-11 19:48     ` KY Srinivasan
2014-10-11 20:22       ` Jeff Leung
2014-10-12  1:21         ` KY Srinivasan
2014-10-21  4:45           ` Sitsofe Wheeler [this message]
2014-10-21  5:19             ` Jeff Leung
2014-10-21 18:30             ` KY Srinivasan
2014-10-15  1:06 ` Martin K. Petersen
2014-10-21  4:17   ` Sitsofe Wheeler
2014-10-23  1:50     ` Martin K. Petersen
2014-10-23  9:03       ` Sitsofe Wheeler

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=20141021044550.GC11691@sucs.org \
    --to=sitsofe@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jleung@v10networks.ca \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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