Enable TRIM support in Ubuntu for Hyper-V

Bug #1223499 reported by Ben Howard
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
High
Andy Whitcroft
Saucy
Fix Released
High
Andy Whitcroft

Bug Description

Microsoft has asked for us to enable unmap support Hyper-V targets. The current kernels for 12.04 and later do not correctly identify the devices as being capable of supporting unmap

Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :
Download full text (9.8 KiB)

The test kernel from http://people.canonical.com/~apw/lp1177609-saucy/ is confirmed. I tested it against the latest Ubuntu 13.10 daily build on Windows Azure.

Fix is confirmed.

[ 6.923197] hv_vmbus: registering driver hv_storvsc
[ 6.936018] hv_utils: Registering HyperV Utility Driver
[ 6.938944] hv_vmbus: registering driver hv_util
[ 6.955275] hv_vmbus: registering driver hv_netvsc
[ 6.959151] hv_netvsc: hv_netvsc channel opened successfully
[ 7.067640] hv_netvsc vmbus_0_14: Device MAC 00:15:5d:36:4c:c2 link state up
[ 7.072234] scsi2 : storvsc_host_t
[ 7.074757] scsi 2:0:0:0: Direct-Access Msft Virtual Disk 1.0 PQ: 0 ANSI: 4
[ 7.077609] APW: storvsc_device_configure sdevice=ffff880147ae0800 marked use_vpd_spc2 = 1
[ 7.081427] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 7.084174] APW: sd_try_rc16_first sdp=ffff880147ae0800 returning 1
[ 7.086447] APW: read_capacity_16: sdkp=ffff8801475dc000 called
[ 7.088689] APW: read_capacity_16: sdkp=ffff8801475dc000 called
[ 7.091254] APW: read_capacity_16: sdkp=ffff8801475dc000 after sd_read_protection_type
[ 7.094051] APW: read_capacity_16: sdkp=ffff8801475dc000 checking LBPME
[ 7.096925] APW: read_capacity_16: sdkp=ffff8801475dc000 checking LBPME found
[ 7.099850] APW: sd_read_block_characteristics: sdkp=ffff8801475dc000 got page
[ 7.102641] sd 2:0:0:0: [sda] 61440000 512-byte logical blocks: (31.4 GB/29.2 GiB)
[ 7.105287] sd 2:0:0:0: [sda] 1024-byte physical blocks
[ 7.107478] APW: sd_try_extended_inquiry sdp=ffff880147ae0800 sdp->scsi_level=5 sdp->use_vpd_spc2=1
[ 7.110345] APW: sd_try_extended_inquiry sdp=0000000000000046 returning 1
[ 7.112746] APW: sd_revalidate_disk calling those VPD bits
[ 7.115208] APW: sd_read_block_provisioning: sdkp=ffff8801475dc000 called
[ 7.118092] APW: sd_read_block_provisioning: sdkp=ffff8801475dc000 getting page
[ 7.121964] APW: sd_read_block_provisioning: sdkp=ffff8801475dc000 got page sdkp->lbpu=1 sdkp->lbpws=0 sdkp->lbpws10=0
[ 7.125665] APW: sd_read_block_limits: sdkp=ffff8801475dc000 called
[ 7.129145] APW: sd_read_block_limits: sdkp=ffff8801475dc000 got page
[ 7.131437] APW: sd_read_block_characteristics: sdkp=ffff8801475dc000 called
[ 7.134196] APW: sd_read_block_characteristics: sdkp=ffff8801475dc000 got page
[ 7.136489] scsi3 : storvsc_host_t
[ 7.138479] sd 2:0:0:0: [sda] Write Protect is off
[ 7.140470] sd 2:0:0:0: [sda] Mode Sense: 0f 00 10 00
[ 7.140490] scsi 3:0:1:0: Direct-Access Msft Virtual Disk 1.0 PQ: 0 ANSI: 4
[ 7.142907] APW: storvsc_device_configure sdevice=ffff880147ae5800 marked use_vpd_spc2 = 1
[ 7.146972] APW: sd_try_rc16_first sdp=ffff880147ae5800 returning 1
[ 7.149185] APW: read_capacity_16: sdkp=ffff8801475de000 called
[ 7.150829] APW: read_capacity_16: sdkp=ffff8801475de000 called
[ 7.152442] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[ 7.155724] sd 3:0:1:0: Attached scsi generic sg2 type 0
[ 7.157796] APW: sd_try_rc16_first sdp=ffff880147ae0800 returning 1
[ 7.159853] APW: read_capacity_16: sdkp=ffff8801475dc000 called
[ 7.162645] APW: read_capacity_16: sdkp=ffff8801475dc000 called
[ 7.165186] APW: read_capacity_16: sdkp=ffff8801475de000 after sd_read_protection_type
[ 7.167659] APW: read_capa...

Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

Microsoft reports that the proposed fix does work from the hypervisor level.

affects: ubuntu → linux-meta (Ubuntu)
Revision history for this message
Andy Whitcroft (apw) wrote :

I have applied the fixes as tested against the saucy tip for the next upload.

affects: linux-meta (Ubuntu Saucy) → linux (Ubuntu Saucy)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 3.11.0-7.13

---------------
linux (3.11.0-7.13) saucy; urgency=low

  * Release tracker
    - LP: #1223545

  [ Andy Whitcroft ]

  * SAUCE: (no-up) scsi: add scsi device flag to request VPD pages be used at SPC-2
    - LP: #1223499
  * SAUCE: (no-up) scsi: add scsi device flag to request READ CAPACITY (16) be preferred
    - LP: #1223499
  * SAUCE: (no-up) scsi: hyper-v storage -- mark as VPD capable at SPC-2
    - LP: #1223499
  * SAUCE: (no-up) scsi: hyper-v storage -- mark as preferring READ CAPACITY (16) at SPC-2
    - LP: #1223499

  [ Maximiliano Curia ]

  * SAUCE: (no-up) Only let characters through when there are active readers.
    - LP: #1208740

  [ Tim Gardner ]

  * [Debian] getabis: Commit new ABI directory, remove the old
  * [Config] CONFIG_EFIVAR_FS=y
    - LP: #1223195
  * [Config] CONFIG_EFI_VARS_PSTORE=m,
    CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=n
  * SAUCE: (no-up) USB: input: cm109.c: Convert high volume dev_err() to dev_err_ratelimited()
    - LP: #1222850

  [ Upstream Kernel Changes ]

  * Intel xhci: refactor EHCI/xHCI port switching
    - LP: #1210858
 -- Tim Gardner <email address hidden> Tue, 10 Sep 2013 09:00:19 -0600

Changed in linux (Ubuntu Saucy):
status: Confirmed → Fix Released
Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

tested new proposed kernel, and it works:

utlemming@utl-0917-s3a:~$ cat /sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:08/VMBUS:00/vmbus_0_2/host3/target3:0:1/3:0:1:0/scsi_disk/3:0:1:0/thin_provisioning
1
utlemming@utl-0917-s3a:~$ cat /sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:08/VMBUS:00/vmbus_0_1/host2/target2:0:0/2:0:0:0/scsi_disk/2:0:0:0/provisioning_mode
unmap
utlemming@utl-0917-s3a:~$ cat /sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:08/VMBUS:00/vmbus_0_2/host3/target3:0:1/3:0:1:0/scsi_disk/3:0:1:0/provisioning_mode
unmap
utlemming@utl-0917-s3a:~$ uname -a
Linux utl-0917-s3a 3.11.0-8-generic #14~lp1223499v201309131830 SMP Fri Sep 13 17:31:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.