RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2143158 - nodedev-dumpxml fails to read mdev attributes for transient device
Summary: nodedev-dumpxml fails to read mdev attributes for transient device
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.2
Hardware: s390x
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Boris Fiuczynski (IBM)
QA Contact: smitterl
Jiri Herrmann
URL:
Whiteboard:
Depends On:
Blocks: 2143160
TreeView+ depends on / blocked
 
Reported: 2022-11-16 08:41 UTC by smitterl
Modified: 2024-01-04 09:39 UTC (History)
17 users (show)

Fixed In Version: libvirt-9.5.0-3.el9
Doc Type: Bug Fix
Doc Text:
.`nodedev-dumpxml` lists attributes correctly for certain mediated devices Before this update, the `nodedev-dumpxml` utility did not list attributes correctly for mediated devices that were created using the `nodedev-create` command. This has been fixed, and `nodedev-dumpxml` now displays the attributes of the affected mediated devices properly.
Clone Of:
: 2143160 (view as bug list)
Environment:
Last Closed: 2023-11-07 08:30:47 UTC
Type: Bug
Target Upstream Version: 9.4.0
Embargoed:


Attachments (Terms of Use)
vfio_ap_nodedev.xml (303 bytes, text/plain)
2022-11-16 08:41 UTC, smitterl
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-139536 0 None None None 2022-11-16 08:45:53 UTC
Red Hat Product Errata RHSA-2023:6409 0 None None None 2023-11-07 08:31:29 UTC

Description smitterl 2022-11-16 08:41:15 UTC
Created attachment 1924615 [details]
vfio_ap_nodedev.xml

Created attachment 1924615 [details]
vfio_ap_nodedev.xml

Description of problem:
Though nodedev-create sets the necessary device attributes for vfio_ap devices, the attributes are not listed with nodedev-dumpxml. This happens only for transient devices

Version-Release number of selected component (if applicable):
libvirt-8.9.0-2.el9.s390x

How reproducible:
100%

Steps to Reproduce:

With attached vfio_ap_nodedev.xml on appropriate host

1. virsh nodedev-create vfio_ap_nodedev.xml
==> returns name of the mediated device, let it be mdev_XXX
2. virsh nodedev-dumpxml mdev_XXX

Actual results:
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='1'/>
  </capability>
</device>

However, the values are set, e.g. 
#cat /sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b/guest_matrix
01.002c

Expected results:

<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='1'/>
    <attr name='assign_adapter' value='0x01'/>
    <attr name='assign_domain' value='0x002c'/>
  </capability>
</device>



Additional info:

A)
The expected result is obtained with steps

1. virsh nodedev-define vfio_ap_nodedev.xml
2. virsh nodedev-start mdev_XXX
3. virsh nodedev-dumpxml mdev_XXX

B)
I think this is no regression, it doesn't work either on RHEL 8.4 AV w/ libvirt-7.0.0-14.module+el8.4.0+10886+79296686.s390x

Comment 1 smitterl 2022-11-16 08:45:22 UTC
This can be reproduced with libvirt-8.0.0-10.module+el8.8.0+16781+9f4724c2.s390x

Comment 2 Thomas Huth 2022-11-28 12:27:04 UTC
@jjongsma , @bfiuczyn : Could you please comment on this BZ? Is this a real bug, or is this expected behavior?

Comment 3 Boris Fiuczynski (IBM) 2022-11-28 18:51:21 UTC
nodedev-create creates with mdevctl a transient mdev.
This means: mdevctl does not store a definition for the mdev but it just creates the mdev from json which is generated from the libvirt XML.
When you call mdevctl to list and dump the json of the mdev it is not possible for mdevctl to retrieve the attributes provided during creation time from the running mdev.

Above is the generic answer which needs to be extended if your system has also mdevctl callout scripts installed.
A callout script can enable mdevctl to provide the attributes of the running mdev as the callout script hold the mdev type specific knowledge how to retrieve the attribute data from the drivers sysfs.

As your example uses the mdev type vfio_ap-passthrough I suspect that you also have the ap-check callout script provided by s390-tools available and installed on your system.

I just recently sent a fix for mdevctl (https://github.com/mdevctl/mdevctl/pull/71) to cover transient mdevs such that callout scripts are called on mdevctl list and therefor also provide the attributes back to the libvirt nodedev driver.

It is no regression as it has never worked before.

Comment 4 smitterl 2022-12-19 10:48:59 UTC
I think it is reasonable to require nodedev-create provide the indicated attributes. This is consistent with how other 'dumpxml' commands work, e.g. virsh dumpxml provides the live domain xml on a transient domain. It's also useful because, IMO, because as it enables a user to learn which crypto devices are passed through through libvirt's API instead of switching to sysfs or logging into the guest.

With mdevctl-1.1.0-4.el9.s390x and the callout scripts I can retrieve the attributes already (in decimal instead of hexadecimal representation):

# mdevctl list -vu d36d7d0f-cf3d-4fef-bb9c-ed393954996b
d36d7d0f-cf3d-4fef-bb9c-ed393954996b matrix vfio_ap-passthrough manual
  Attrs:
    @{0}: {"assign_adapter":"2"}
    @{1}: {"assign_domain":"43"}

Comment 5 Thomas Huth 2023-01-30 12:34:03 UTC
I just checked this with a mdevctl that contains the fix from https://github.com/mdevctl/mdevctl/pull/71 , and "mdevctl list -vu ..." also shows the attributes here - but "virsh nodedev-dumpxml ..." still ignores them.

Boris, could you please have a closer look at this?

Comment 6 smitterl 2023-04-25 10:04:08 UTC
The callout script ap-check are provided by s390-tools/s390utils.

I tested with both upstream and downstream mdevctl and ap-check versions and the result is the same for a transient device:

1. The attributes are set (I updated the title and description to reflect this)
2. mdevctl -vu <uuid> --dumpjson lists the attributes
3. nodedev-dumpxml mdev_XXX does NOT list the attributes
4. For a persisted device, the attributes are listed.

I also made sure to restart virtnodedevd before defining the device.

Unless I've done something wrong, it looks like there's a problem in how libvirt retrieves the device information for transient devices only.

Boris, could you have a look?

Comment 7 Boris Fiuczynski (IBM) 2023-04-25 14:43:53 UTC
I can reproduce this.
It seems libvirt is calling mdevctl with the options "list --dumpjson --defined".
Therefore transient devices which only do show up with the options "list --dumpjson" are not getting any attributes in the nodedev driver.

@

Comment 8 Boris Fiuczynski (IBM) 2023-04-25 14:49:23 UTC
(In reply to Boris Fiuczynski (IBM) from comment #7)
> I can reproduce this.
> It seems libvirt is calling mdevctl with the options "list --dumpjson
> --defined".
> Therefore transient devices which only do show up with the options "list
> --dumpjson" are not getting any attributes in the nodedev driver.
> 
> @

Pressing enter after typing @ is a bad idea. Sorry about this. Anyway...

@jjongsma: Do you have any good ideas how libvirt could fetch the active devices?
Should nodeDeviceUpdateMediatedDevice trigger a second mdevctl execution with options "list --dumpjson" and update the returned the devices in the nodedev driver?

Comment 9 Boris Fiuczynski (IBM) 2023-04-25 15:41:43 UTC
Something like this.. (which worked for me)

Author: Boris Fiuczynski <fiuczy.com>
Date:   Tue Apr 25 17:19:57 2023 +0200

    nodedev: update transient mdevs

    Instead of updating defined mdevs only add another update for active
    devices as well to cover transient mdev devices as well.

    Signed-off-by: Boris Fiuczynski <fiuczy.com>

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 3cac25a10c..afa3ea1c95 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1636,6 +1636,24 @@ virMdevctlListDefined(virNodeDeviceDef ***devs, char **errmsg)
 }


+static int
+virMdevctlListActive(virNodeDeviceDef ***devs, char **errmsg)
+{
+    int status;
+    g_autofree char *output = NULL;
+    g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(false, &output, errmsg);
+
+    if (virCommandRun(cmd, &status) < 0 || status != 0) {
+        return -1;
+    }
+
+    if (!output)
+        return -1;
+
+    return nodeDeviceParseMdevctlJSON(output, devs);
+}
+
+
 typedef struct _virMdevctlForEachData virMdevctlForEachData;
 struct _virMdevctlForEachData {
     int ndefs;
@@ -1699,6 +1717,8 @@ int
 nodeDeviceUpdateMediatedDevices(void)
 {
     g_autofree virNodeDeviceDef **defs = NULL;
+    g_autofree virNodeDeviceDef **act_defs = NULL;
+    int act_ndefs = 0;
     g_autofree char *errmsg = NULL;
     g_autofree char *mdevctl = NULL;
     virMdevctlForEachData data = { 0, };
@@ -1725,6 +1745,17 @@ nodeDeviceUpdateMediatedDevices(void)
         if (nodeDeviceUpdateMediatedDevice(defs[i]) < 0)
             return -1;

+    /* Update transient mdev devices */
+    if ((act_ndefs = virMdevctlListActive(&act_defs, &errmsg)) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("failed to query mdevs from mdevctl: %1$s"), errmsg);
+        return -1;
+    }
+
+    for (i = 0; i < act_ndefs; i++)
+        if (nodeDeviceUpdateMediatedDevice(act_defs[i]) < 0)
+            return -1;
+
     return 0;
 }

Comment 10 Jonathon Jongsma 2023-05-05 16:00:55 UTC
Thanks Boris,

I guess that's probably a reasonable approach. Would you be willing to post that patch to the libvirt mailing list for review?

Comment 11 Boris Fiuczynski (IBM) 2023-05-08 15:54:47 UTC
(In reply to Jonathon Jongsma from comment #10)
> Thanks Boris,
> 
> I guess that's probably a reasonable approach. Would you be willing to post
> that patch to the libvirt mailing list for review?

I will post the code above and that will fix the problem.

Aside from that:
Actually at this point we might want to revisited the discussion about the defined and active states of an mdev device.
The defined and active configuration can be different. Therefore defined and active is not just a boolean state variable but it is/can be two different configurations.
With the fix above a defined mdev configuration stored in the nodedev object is overridden with the active configuration of the mdev (unless we add code to only update the transient mdevs).
In nodedev-list there are three possibilities given by options:
 1) without any option: the active mdevs with their configuration are listed
 2) with option "inactive": the defined mdevs with their configuration are listed
 3) with option "all": the defined and active mdevs with their configurations are listed

If an mdev is active and inactive which configuration should than be listed?
The defined configuration, the active configuration or both?

Comment 12 Boris Fiuczynski (IBM) 2023-05-08 17:12:12 UTC
Sent patch to libvirt mailing list:
https://listman.redhat.com/archives/libvir-list/2023-May/239820.html

Comment 13 Jonathon Jongsma 2023-05-23 19:46:12 UTC
pushed upstream as 44a0f2f0c8ff5e78c238013ed297b8fce223ac5a

Comment 14 John Ferlan 2023-05-25 17:27:30 UTC
Sebastian - I believe you're QE for s390x - can you also set the qa_ack+ and ITM

Comment 15 liang cong 2023-06-07 10:20:08 UTC
Tested on build:
# rpm -q mdevctl libvirt
mdevctl-1.1.0-4.el9.s390x
libvirt-9.4.0-1.el9.s390x

Test steps:
1. prepare a node device xml:
# cat vfio_ap_nodedev.xml 
<device>
	<!-- same parent device for all -->
	<parent>ap_matrix</parent>
	<capability type="mdev">
		<type id="vfio_ap-passthrough"/>
		<uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
		<attr name="assign_adapter" value="0x02"/>
		<attr name="assign_domain" value="0x002b"/>
	</capability>
</device>

2. virsh nodedev-create vfio_ap_nodedev.xml
# virsh nodedev-create vfio_ap_nodedev.xml
Node device mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix created from vfio_ap_nodedev.xml

3. virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix, and could not see attribute "assign_adapter" and "assign_domain"
# virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='4'/>
  </capability>
</device>

4. Check the guest matrix, we could see the value is set
# cat /sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b/guest_matrix
02.002b

Hi Boris, this issue is still reproduced on libvirt-9.4.0-1.el9.s390x, could you help to clarify this, thx?

Comment 16 Boris Fiuczynski (IBM) 2023-06-13 15:36:20 UTC
As you did not list it on comment 15:
Did you install the callout script for vfio_ap?

Comment 17 liang cong 2023-06-14 09:12:36 UTC
(In reply to Boris Fiuczynski (IBM) from comment #16)
> As you did not list it on comment 15:
> Did you install the callout script for vfio_ap?

Hi Boris, could you provide more info about the install step and check steps for callout script of vfio_ap?

Comment 18 Boris Fiuczynski (IBM) 2023-06-19 09:32:32 UTC
Please read comments #3, #4 and #6.

Comment 19 liang cong 2023-06-19 11:12:33 UTC
(In reply to Boris Fiuczynski (IBM) from comment #18)
> Please read comments #3, #4 and #6.

Hi boris, I check as these things:

1. make sure s390utils related packages, mdevctl and libvirt are installed:
# rpm -qa s390utils*
s390utils-core-2.25.0-4.el9.s390x
s390utils-base-2.25.0-4.el9.s390x
s390utils-iucvterm-2.25.0-4.el9.s390x
s390utils-mon_statd-2.25.0-4.el9.s390x
s390utils-cpuplugd-2.25.0-4.el9.s390x
s390utils-osasnmpd-2.25.0-4.el9.s390x
s390utils-ziomon-2.25.0-4.el9.s390x
s390utils-cmsfs-fuse-2.25.0-4.el9.s390x
s390utils-hmcdrvfs-2.25.0-4.el9.s390x
s390utils-zdsfs-2.25.0-4.el9.s390x
s390utils-2.25.0-4.el9.s390x
s390utils-devel-2.25.0-4.el9.s390x
s390utils-cpacfstatsd-2.25.0-4.el9.s390x
s390utils-chreipl-fcp-mpath-2.25.0-4.el9.s390x

# rpm -q mdevctl
mdevctl-1.1.0-4.el9.s390x

# rpm -q libvirt qemu-kvm
libvirt-9.4.0-1.el9.s390x
qemu-kvm-8.0.0-5.el9.s390x

2. I could find mdevctl callout script at places:
# ls /etc/mdevctl.d/scripts.d/callouts/ap-check.sh 
/etc/mdevctl.d/scripts.d/callouts/ap-check.sh

# cat /etc/mdevctl.d/scripts.d/callouts/ap-check.sh
[ -e /usr/lib/mdevctl/scripts.d/callouts/ap-check ] && /usr/lib/mdevctl/scripts.d/callouts/ap-check "$@"

# ls /usr/lib/mdevctl/scripts.d/callouts/ap-check
/usr/lib/mdevctl/scripts.d/callouts/ap-check

3. Restart virtnodedevd service
# systemctl restart virtnodedevd.service

4. virsh nodedev-create vfio_ap_nodedev.xml
# cat vfio_ap_nodedev.xml 
<device>
	<!-- same parent device for all -->
	<parent>ap_matrix</parent>
	<capability type="mdev">
		<type id="vfio_ap-passthrough"/>
		<uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
		<attr name="assign_adapter" value="0x02"/>
		<attr name="assign_domain" value="0x002b"/>
	</capability>
</device>

# virsh nodedev-create vfio_ap_nodedev.xml
Node device mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix created from vfio_ap_nodedev.xml

5. virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix, and could not see attribute "assign_adapter" and "assign_domain"
# virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='4'/>
  </capability>
</device>

6. Check the mdevctl output:
# mdevctl list -vu d36d7d0f-cf3d-4fef-bb9c-ed393954996b --dumpjson
{
  "mdev_type": "vfio_ap-passthrough",
  "start": "manual",
  "attrs": [
    {
      "assign_adapter": "2"
    },
    {
      "assign_domain": "43"
    }
  ]
}

# mdevctl list -vu d36d7d0f-cf3d-4fef-bb9c-ed393954996b
d36d7d0f-cf3d-4fef-bb9c-ed393954996b matrix vfio_ap-passthrough manual
  Attrs:
    @{0}: {"assign_adapter":"2"}
    @{1}: {"assign_domain":"43"}

7. virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix again. And still could not see attribute "assign_adapter" and "assign_domain"
# virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='4'/>
  </capability>
</device>

8. Then I restart virtnodedevd service again
# systemctl restart virtnodedevd.service

9. Check virsh nodedev-dumpxml output, then found attribute "assign_adapter" and "assign_domain".
# virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='4'/>
    <attr name='assign_adapter' value='2'/>
    <attr name='assign_domain' value='43'/>
  </capability>
</device>

So for above steps, after virsh nodedev-create we have to restart the virtnodedevd service then virsh nodedev-dumpxml could get the attributes we want, I am not sure this is expected, could you help to clarify it?

Comment 20 liang cong 2023-06-19 11:23:39 UTC
And I also found with steps:
1. virsh nodedev-define vfio_ap_nodedev.xml
2. virsh nodedev-start mdev_XXX
3. virsh nodedev-dumpxml mdev_XXX

the assign_adapter and assign_domain is in Hex:
# virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='4'/>
    <attr name='assign_adapter' value='0x02'/>
    <attr name='assign_domain' value='0x002b'/>
  </capability>
</device>


with steps:
1. virsh nodedev-create vfio_ap_nodedev.xml
2. systemctl restart virtnodedevd.service

the assign_adapter and assign_domain is in Dec:
# virsh nodedev-dumpxml mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix
<device>
  <name>mdev_d36d7d0f_cf3d_4fef_bb9c_ed393954996b_matrix</name>
  <path>/sys/devices/vfio_ap/matrix/d36d7d0f-cf3d-4fef-bb9c-ed393954996b</path>
  <parent>ap_matrix</parent>
  <driver>
    <name>vfio_ap_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='vfio_ap-passthrough'/>
    <uuid>d36d7d0f-cf3d-4fef-bb9c-ed393954996b</uuid>
    <parent_addr>matrix</parent_addr>
    <iommuGroup number='4'/>
    <attr name='assign_adapter' value='2'/>
    <attr name='assign_domain' value='43'/>
  </capability>
</device>

Comment 21 Boris Fiuczynski (IBM) 2023-06-20 15:09:35 UTC
Regarding comment #19:
A restart of virtnodedevd should not be required. I have to look into the problem.

Regarding comment #20:
That is expected behavior as ap-check returns the values in decimal from the system.

Comment 22 Boris Fiuczynski (IBM) 2023-06-23 10:49:39 UTC
To resolve the missing attributes issue after the nodedev-create (without virtnodedevd restarted) I posted this patch
https://listman.redhat.com/archives/libvir-list/2023-June/240418.html

Comment 23 John Ferlan 2023-06-29 18:39:08 UTC
Will the patch from comment 22 be needed for the RHEL8 related bug 2143160 ?  

If so then we should have Jonathon revisit that bug too

Comment 24 Boris Fiuczynski (IBM) 2023-06-30 11:55:42 UTC
(In reply to Boris Fiuczynski (IBM) from comment #22)
> To resolve the missing attributes issue after the nodedev-create (without
> virtnodedevd restarted) I posted this patch
> https://listman.redhat.com/archives/libvir-list/2023-June/240418.html

I sent v2 of the patch which triggers a mdevctl update when a udev add event for a mdev device occurs.
https://listman.redhat.com/archives/libvir-list/2023-June/240563.html

Comment 25 Boris Fiuczynski (IBM) 2023-06-30 12:11:58 UTC
(In reply to John Ferlan from comment #23)
> Will the patch from comment 22 be needed for the RHEL8 related bug 2143160 ?
> 
> 
> If so then we should have Jonathon revisit that bug too

Hi John,
yes, the additional patch (comment #24) is needed to fix the problem found during verification mentioned in comment #19.

Comment 27 smitterl 2023-07-10 13:47:42 UTC
(In reply to Boris Fiuczynski (IBM) from comment #24)
> (In reply to Boris Fiuczynski (IBM) from comment #22)
> > To resolve the missing attributes issue after the nodedev-create (without
> > virtnodedevd restarted) I posted this patch
> > https://listman.redhat.com/archives/libvir-list/2023-June/240418.html
> 
> I sent v2 of the patch which triggers a mdevctl update when a udev add event
> for a mdev device occurs.
> https://listman.redhat.com/archives/libvir-list/2023-June/240563.html

I tested this patch on Jonathon's branch https://gitlab.com/jjongsma/libvirt/-/tree/mdev-transient-attributes?ref_type=heads and it worked well, no need to restart the virtnodedevd

Comment 28 smitterl 2023-07-18 15:11:48 UTC
I confirm the attributes are listed with w/ libvirt-9.5.0-2.el9.s390x

However, I see a regression, nodedev-info with that version tells me the transient device is persistent:

# virsh nodedev-info mdev_a5272b12_2577_11ee_b7a2_0a12c58839ea_matrix
Name:           mdev_a5272b12_2577_11ee_b7a2_0a12c58839ea_matrix
Parent:         ap_matrix
Active:         yes
Persistent:     yes
Autostart:      no


Whereas with the latest version in nightly, the information is correct:
libvirt-9.3.0-2.el9.s390x

# virsh nodedev-info mdev_a5272b12_2577_11ee_b7a2_0a12c58839ea_matrix 
Name:           mdev_a5272b12_2577_11ee_b7a2_0a12c58839ea_matrix
Parent:         ap_matrix
Active:         yes
Persistent:     no
Autostart:      no

Comment 29 smitterl 2023-07-18 16:00:28 UTC
I see the regression also in the build that I created from Jonathon's branch, I'm sorry I didn't notice it back then libvirt-9.6.0-1.el9.s390x comment#27

Comment 30 smitterl 2023-07-18 16:11:24 UTC
Unfortunately, I can reproduce the regression also on the latest upstream libvirt now at commit aece25f66517a327c2a6bde4d06b432d415ed7da

Comment 31 Jonathon Jongsma 2023-07-18 19:56:34 UTC
Unfortunately, the regression was caused by commit 44a0f2f0. I've posted a patch upstream.

Comment 33 smitterl 2023-07-19 10:22:20 UTC
Automated test https://github.com/autotest/tp-libvirt/pull/5040

Comment 35 smitterl 2023-07-24 13:04:26 UTC
Pre-verified with libvirt-9.5.0-3.el9.s390x

Comment 39 errata-xmlrpc 2023-11-07 08:30:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: libvirt security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6409


Note You need to log in before you can comment on or make changes to this bug.