** Changed in: ubuntu-power-systems
   Importance: Medium => Low

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1840026

Title:
  Ubuntu 18.04.2: Unable to boot guest with scsi disk having sgio flag

Status in The Ubuntu-power-systems project:
  New
Status in libvirt package in Ubuntu:
  New
Status in linux package in Ubuntu:
  New

Bug description:
  == Comment: #0 - SRIKANTH AITHAL <bssrika...@in.ibm.com> - 2019-07-03 
22:28:43 ==
  ---Problem Description---
  When we try to boot KVM guest with scsi disk having `sgio="unfiltered"`, 
guest fails to boot throwing below error

  virsh start vm1 --console
  error: Failed to start domain vm1
  error: Requested operation is not valid: unpriv_sgio is not supported by this 
kernel

   
  Contact Information = srikanth/bssrika...@in.ibm.com 
   
  ---uname output---
  Linux pkvmhab008 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:54:50 UTC 
2019 ppc64le ppc64le ppc64le GNU/Linux
   
  Machine Type = witherspoon 
   
  ---Debugger---
  A debugger is not configured
   
  ---Steps to Reproduce---
   Recreation steps:

  1. Using scsi_debug driver to simulate scsi disk

  #/sbin/modprobe scsi_debug dev_size_mb=2048 lbpu=1
  #lsscsi|grep scsi_debug|awk '{print $6}'
  /dev/sdk

  2. Using below disk xml,

  <disk device="lun" rawio="no" sgio="unfiltered" type="block">
    <target bus="scsi" dev="sda" />
    <source dev="/dev/sdk" />
    <driver name="qemu" />
    <shareable />
  </disk>

  3. Try booting KVM guest with above disk,

  # virsh start vm1 --console
  error: Failed to start domain vm1
  error: Requested operation is not valid: unpriv_sgio is not supported by this 
kernel

   
  Stack trace output:
   no
   
  Oops output:
   no
   
  System Dump Location:
   There was no dump
   
  *Additional Instructions for srikanth/bssrika...@in.ibm.com: 
  -Attach sysctl -a output output to the bug.

  == Comment: #1 - SRIKANTH AITHAL <bssrika...@in.ibm.com> - 2019-07-03
  22:30:28 ==

  
  == Comment: #2 - SRIKANTH AITHAL <bssrika...@in.ibm.com> - 2019-07-03 
22:31:03 ==

  
  == Comment: #3 - SRIKANTH AITHAL <bssrika...@in.ibm.com> - 2019-07-03 
22:32:34 ==
  unpriv_sgio is required for KVM guest running as qemu   user to be able to 
configure to issue any SCSI commands to storages.

  == Comment: #5 - Fabiano Almeida Rosas <faro...@br.ibm.com> - 2019-07-25 
12:46:15 ==
  It seems libvirt added support to `unpriv_sgio` but the kernel side of the 
feature never got merged. It was then reverted on libvirt's side but the revert 
caused issues so they re-enabled the support. As far as I can tell it will 
always fail.

  Some iterations of the kernel side feature:
  https://lwn.net/Articles/533901/
  https://lwn.net/Articles/535075/
  https://lkml.org/lkml/2013/5/23/294 

  Libvirt side:
  https://www.redhat.com/archives/libvir-list/2013-January/msg00013.html

  Revert of the feature:
  
https://libvirt.org/git/?p=libvirt.git;a=patch;h=ce346623c19f82f4b35f3466e2ee4066847b750c

  Unrevert:
  https://www.redhat.com/archives/libvir-list/2015-June/msg00814.html

  
  @Srikanth
  Is this known to have worked at some point? Because it might be the case that 
the distro is carrying these patches downstream. If that is the case I would 
like to know which distro + version, so we can compare the setups.

  == Comment: #6 - SRIKANTH AITHAL <bssrika...@in.ibm.com> - 2019-07-25 
22:35:33 ==
  (In reply to comment #5)
  > It seems libvirt added support to `unpriv_sgio` but the kernel side of the
  > feature never got merged. It was then reverted on libvirt's side but the
  > revert caused issues so they re-enabled the support. As far as I can tell it
  > will always fail.
  > 
  > Some iterations of the kernel side feature:
  > https://lwn.net/Articles/533901/
  > https://lwn.net/Articles/535075/
  > https://lkml.org/lkml/2013/5/23/294 
  > 
  > Libvirt side:
  > https://www.redhat.com/archives/libvir-list/2013-January/msg00013.html
  > 
  > Revert of the feature:
  > https://libvirt.org/git/?p=libvirt.git;a=patch;
  > h=ce346623c19f82f4b35f3466e2ee4066847b750c
  > 
  > Unrevert:
  > https://www.redhat.com/archives/libvir-list/2015-June/msg00814.html
  > 
  > 
  > @Srikanth
  > Is this known to have worked at some point? Because it might be the case
  > that the distro is carrying these patches downstream. If that is the case I
  > would like to know which distro + version, so we can compare the setups.

  No, this was uncovered as part of adding new testcases to our existing
  test bucket. So we have not executed this testcase before.

  == Comment: #8 - Daniel Henrique Barboza <danie...@br.ibm.com> - 2019-08-07 
15:32:47 ==
  The error message  "unpriv_sgio is not supported by this kernel" comes from a 
Libvirt code that verifies if the file 'unpriv_sgio' exists in the sysfs path 
of the device. In case it doesn't, this error message is thrown.

  Fabiano is right in comment #5: the feature that implemented
  unpriv_sgio didn't make it upstream. However, I found out that the
  RHEL 7.4 manual [1] talks about the feature. With that in mind, I went
  to a RHEL 7.6 server and verified that the feature exists in its 3.10
  kernel by finding references of 'QUEUE_FLAG_UNPRIV_SGIO' in the kernel
  source code. This symbol belongs to the feature implementation that
  didn't make upstream, as Fabiano found out [2]:

  [danielhb@kop5 3.10.0-957.el7.ppc64le]$ cat /etc/redhat-release 
  Red Hat Enterprise Linux Server release 7.6 (Maipo)
  [danielhb@kop5 3.10.0-957.el7.ppc64le]$ pwd
  /usr/src/kernels/3.10.0-957.el7.ppc64le
  [danielhb@kop5 3.10.0-957.el7.ppc64le]$ grep -R 'QUEUE_FLAG_UNPRIV_SGIO'
  include/linux/blkdev.h:#define QUEUE_FLAG_UNPRIV_SGIO 21      /* SG_IO free 
for unprivileged users */
  include/linux/blkdev.h:       test_bit(QUEUE_FLAG_UNPRIV_SGIO, 
&(q)->queue_flags)
  [danielhb@kop5 3.10.0-957.el7.ppc64le]$ 

  
  This is the path that Libvirt looks for when checking if a kernel has 
'unpriv_sgio', in this case for a device 'sda':

  [danielhb@kop5 ~]$ lsblk | grep sda
  sda                                           8:0    0     1T  0 disk  
  [danielhb@kop5 ~]$ file /sys/dev/block/8\:0/queue/unpriv_sgio
  /sys/dev/block/8:0/queue/unpriv_sgio: ASCII text

  
  This proves that this RHEL 7.6 supports the feature. Going to the Ubuntu host 
mentioned in comment #1, we see that the feature isn't available at all in its 
kernel:

  root@pkvmhab008:/usr/src/linux-headers-4.15.0-54-generic# grep -R 
'QUEUE_FLAG_UNPRIV_SGIO' .
  root@pkvmhab008:/usr/src/linux-headers-4.15.0-54-generic# 

  
  This is what happened, at least from my observation: Red Hat tried to push 
the 'unpriv_sgio' feature upstream in the kernel, but for some reason it didn't 
make it. They decided to backport it to its RHEL kernel tree anyway. 

  There are 2 paths to go from here. We either remove 'unpriv_sgio'
  support from Libvirt or we push 'unpriv_sgio' support to the Ubuntu
  kernel. I recommend the later. We can sit and discuss whether Libvirt
  should support in upstream code a feature that apparently exists only
  in downstream RHEL kernels (why doesn't Red Hat support this feature
  in its downstream Libvirt that RHEL uses instead?), but this is a
  discussion that I don't advise making in the community - the error
  message is clear, the feature is optional (i.e. the user must set it
  by hand) and it's not a regression to Ubuntu guests. Removing the
  feature from upstream code, or even from Libvirt docs, is not worth
  the effort.

  Srikanth, I am aware of comment #3 and the importance of the feature.
  But apparently this is a RHEL kernel only feature. As such, I'm
  changing the component of this bug to 'kernel'.

  
  Fabiano, not sure if you'll want to pursue this kernel feature in Ubuntu, so 
I'll leave the bug assigned to you. Feel free to reset the assignee if you're 
not available to do this.

  
  [1] 
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Storage_Volumes-Adding_storage_devices_to_guests.html

  [2] https://lkml.org/lkml/2013/5/23/294

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-power-systems/+bug/1840026/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to