Re: [libvirt PATCH 1/2] nodedev: fix parent device of inactive mdevs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/9/21 4:48 PM, Jonathon Jongsma wrote:
On Fri, Jul 9, 2021 at 6:11 AM Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> wrote:

Some observations without these patches


# mdevctl list -d
e60cef97-3f6b-485e-ac46-0520f9f66ac2 0.0.0033 vfio_ccw-io manual (active)

# virsh nodedev-list --cap mdev
mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2

# virsh nodedev-list --inactive --cap mdev

# virsh nodedev-dumpxml mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>

<path>/sys/devices/css0/0.0.0033/e60cef97-3f6b-485e-ac46-0520f9f66ac2</path>
    <parent>css_0_0_0033</parent>
    <driver>
      <name>vfio_mdev</name>
    </driver>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>

# virsh nodedev-destroy mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
Destroyed node device 'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2'

# virsh nodedev-list --inactive --cap mdev
mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2


QUESTION: My mdev is defined and active. I know this from looking at
mdevctl.
As the option inactive seems not to match the mdevctl option defined how
can I find out that I can e.g. use nodedev-undefine without
stopping/destroying it first?
Do we need another option like defined on nodedev-list?


Anyway using nodedev-dumpxml I get the parent correctly.
# virsh nodedev-dumpxml mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>
    <parent>css_0_0_0033</parent>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>


And now the wrap up to start over again...


# virsh nodedev-undefine mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
Undefined node device 'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2'

# virsh nodedev-list --inactive --cap mdev
mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2

# virsh nodedev-list --all --cap mdev
mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2

# virsh nodedev-list --cap mdev

# mdevctl list -d
# mdevctl list

# virsh nodedev-dumpxml mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>
    <parent>css_0_0_0033</parent>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>

# virsh nodedev-start mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
error: Failed to start device mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
error: internal error: Unable to create mediated device: Config for
e60cef97-3f6b-485e-ac46-0520f9f66ac2 does not exist, define it first?

# virsh nodedev-undefine mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
Undefined node device 'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2'

# virsh nodedev-list --all --cap mdev
mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2


That is definitely a bug.
But in all dumped XMLs the parent seems to be provided correctly.

This looks like the bug parsing an empty list that you just submitted
a patch for.

Yes, but I might have broken another path with that fix...
nodedev-create followed by nodedev-dumpxml



# cat mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2.xml
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>

<path>/sys/devices/css0/0.0.0033/e60cef97-3f6b-485e-ac46-0520f9f66ac2</path>
    <parent>css_0_0_0033</parent>
    <driver>
      <name>vfio_mdev</name>
    </driver>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>

# virsh nodedev-define mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2.xml
Node device 'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2' defined from
'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2.xml'

# virsh nodedev-list --all --cap mdev
mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2

# mdevctl list -d
e60cef97-3f6b-485e-ac46-0520f9f66ac2 0.0.0033 vfio_ccw-io manual
# virsh nodedev-dumpxml mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>
    <parent>css_0_0_0033</parent>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>


Rerunning it with the dumpxml from the defined only mdev.


# virsh nodedev-undefine mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
Undefined node device 'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2'

# mdevctl list -d
# virsh nodedev-dumpxml mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>
    <parent>css_0_0_0033</parent>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>

# cat mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2_defined.xml
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>
    <parent>css_0_0_0033</parent>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>

# virsh nodedev-define mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2_defined.xml
Node device 'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2' defined from
'mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2_defined.xml'

# mdevctl list -d
e60cef97-3f6b-485e-ac46-0520f9f66ac2 0.0.0033 vfio_ccw-io manual

# virsh nodedev-dumpxml mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2
<device>
    <name>mdev_e60cef97_3f6b_485e_ac46_0520f9f66ac2</name>
    <parent>css_0_0_0033</parent>
    <capability type='mdev'>
      <type id='vfio_ccw-io'/>
      <uuid>e60cef97-3f6b-485e-ac46-0520f9f66ac2</uuid>
      <iommuGroup number='1'/>
    </capability>
</device>


So either I misunderstood the problem you are trying to resolve or it
exists on PCI only.

Ah, this bug only manifests for inactive devices that were loaded from
mdevctl without first being processed by libvirt some other way. So,
in your example, the bug is not present because libvirt parsed the
appropriate parent id from your XML input. Here are a couple simple
ways to reproduce the bug:
  - define a device outside of libvirt (using mdevctl directly) and
then dump the xml in libvirt.
  - define the device with nodedev-define, then restart the libvirt
daemon so that the cached value from the XML input is forgotten. Then
dump xml for the defined device.

Shalini or I will give that a spin


Jonathon



--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux